Skip to content
This repository was archived by the owner on Jun 16, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f330771
chore: add repository in package.json
ChiefWoods Jun 11, 2025
e9b7fec
chore: remove package-lock.json
ChiefWoods Jun 11, 2025
5895ce3
feat: add lint-staged
ChiefWoods Jun 11, 2025
8c72f8a
fix: add new programs to Anchor.toml
ChiefWoods Jun 10, 2025
556dcf7
chore: update toolchain versions
ChiefWoods Jun 10, 2025
54a0083
chore: bump dependencies
ChiefWoods Jun 10, 2025
6e714b9
chore: remove redundant feature flags
ChiefWoods Jun 10, 2025
c0610e3
chore: explicit discriminator len
ChiefWoods Jun 11, 2025
3478270
feat: use custom discriminator
ChiefWoods Jun 11, 2025
fb07180
chore: remove address constraint
ChiefWoods Jun 11, 2025
91bf55d
chore: add prefix seed
ChiefWoods Jun 11, 2025
de49fe8
feat: remove redundant owner check
ChiefWoods Jun 11, 2025
046d5cb
chore: improve CHECK comments
ChiefWoods Jun 11, 2025
8d72df2
feat: add missing program checks
ChiefWoods Jun 11, 2025
ba47fcc
chore: remove unused accounts
ChiefWoods Jun 11, 2025
a01e4c8
chore: rename signer accounts to payer
ChiefWoods Jun 11, 2025
e95c217
feat: add missing bump fields
ChiefWoods Jun 11, 2025
91e5ee3
chore: rename rule.rs to rule_data.rs
ChiefWoods Jun 11, 2025
7d76787
feat: move address and bump check to constraint
ChiefWoods Jun 11, 2025
3254d5a
chore: explicit PASSKEY_SIZE
ChiefWoods Jun 11, 2025
468e365
feat: improve error handling
ChiefWoods Jun 11, 2025
948ae59
feat: move passkey and smart wallet check to constraint
ChiefWoods Jun 11, 2025
303f48e
chore: rename error.rs to errors.rs
ChiefWoods Jun 11, 2025
e7f1c42
chore: update readme
ChiefWoods Jun 14, 2025
ffc4077
feat: restore original files from feat/beta-test pre-submodule
ChiefWoods Jun 15, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pnpm dlx lint-staged
3 changes: 3 additions & 0 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default {
"programs/*/src/**/*.rs": "cargo fmt --",
}
6 changes: 5 additions & 1 deletion Anchor.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
[toolchain]
solana_version = "2.1.0"
anchor_version = "0.31.1"

[features]
resolution = true
skip-lint = false

[programs.localnet]
contract = "3jq9oBWGCUWmBynC8TTBL9KWJdGegsChJ1c8ksybGhum"
default_rule = "AULUCD8kw4Nnjb1hUsWyvucZ5tzwu3wCH7Dstc5p6AMj"
lazorkit = "HPN843A4SZB7tfcLF9pu6hbvwTgv7HtdRscXoZWbAdXs"
transfer_limit = "Dy9SC7En4NsVPYuiDdPJMCxfsV2Vd11YqtLVYabApzXb"

[registry]
url = "https://api.apr.dev"
Expand Down
38 changes: 38 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
.PHONY: check fmt lint test build run clean all fix-all

# Default target
all: check test build

# Check code formatting
check:
cargo fmt --all -- --check

# Format code
fmt:
cargo fmt --all

# Run clippy
lint:
cargo clippy -- -D warnings

# Run tests
test:
anchor run test

# Build all binaries
build:
cargo build --workspace

# Clean build artifacts
clean:
anchor clean

test-local:
./scripts/install.sh
./scripts/test.local.sh

# Run all fixes and checks
lint-fix-all:
cargo clippy --fix -- -D warnings
cargo fmt --all
cargo fmt --all -- --check
142 changes: 124 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,148 @@
# Lazorkit | Programm
# Wallet Management Contract

A Solana-based smart wallet management system that provides secure and flexible wallet management capabilities with customizable rules and transfer limits.

## Overview

Onchain program for Secp256r1 verification and exercute transaction, management smart wallet
This project implements a smart wallet system on Solana with the following key features:
- Smart wallet creation and management
- Default rule implementation
- Transfer limit controls
- Whitelist rule program support
- Secp256r1 authentication

## Installation
## Project Structure

Install anchor cli and solana cli
Link: [text](https://solana.com/docs/intro/installation)
```
├── programs/
│ ├── lazorkit/ # Main smart wallet program
│ ├── default_rule/ # Default rule implementation
│ └── transfer_limit/ # Transfer limit functionality
├── sdk/
│ ├── lazor-kit.ts # Main SDK implementation
│ ├── default-rule-program.ts
│ ├── transfer_limit.ts
│ ├── utils.ts
│ ├── types.ts
│ └── constants.ts
└── tests/
├── smart_wallet_with_default_rule.test.ts
├── change_rule.test.ts
├── utils.ts
└── constants.ts
```

## Setup with Raydium Swap
## Prerequisites

Dex smart-contract: `EoTcMgcDRTJVZDMZWBoU6rhYHZfkNTVEAfz3uUJRcYGj`\
AMM smart-contract: `HWy1jotHpo6UqeQxx49dpYYdQB8wj9Qk9MdxwjLvDHB8`\
AMM config PDA: `8QN9yfKqWDoKjvZmqFsgCzAqwZBQuzVVnC388dN5RCPo`\
Fee collector: `3XMrhbv989VxAMi3DErLV9eJht1pHppW5LbKxe9fkEFR`
- Node.js
- Solana CLI
- Anchor Framework
- Rust (for program development)

### Set solana validator to localnet
## Installation

1. Clone the repository:
```bash
solana config set --url http://localhost:8899
git clone <repository-url>
cd wallet-management-contract
```

### Run validator and clone all the smart-contracts and accounts
2. Install dependencies:
```bash
npm install
```

3. Build the programs:
```bash
solana-test-validator --clone-upgradeable-program EoTcMgcDRTJVZDMZWBoU6rhYHZfkNTVEAfz3uUJRcYGj --clone-upgradeable-program HWy1jotHpo6UqeQxx49dpYYdQB8wj9Qk9MdxwjLvDHB8 --clone 8QN9yfKqWDoKjvZmqFsgCzAqwZBQuzVVnC388dN5RCPo --clone 3XMrhbv989VxAMi3DErLV9eJht1pHppW5LbKxe9fkEFR --url devnet --reset
anchor build
```

### Deploy the smart-contracts
## Program IDs

- LazorKit Program: `33tS3mSoyvdmKWxb6bgSL657AqH4Wxsu9R6GnvjtZdEd`
- Transfer Limit Program: `EXYavpYDn6twyPvsGtvuJkEaGeqbN5TLCnC3Fp3evv85`
- Default Rule Program: `scdFpnHi1Hu1BbKPwEdhRcdWwu5DohSWxCAg3UeDNKZ`

## Deployment

To deploy the programs and initialize the IDL:

```bash
anchor build && anchor deploy && anchor idl init -f ./target/idl/contract.json 3jq9oBWGCUWmBynC8TTBL9KWJdGegsChJ1c8ksybGhum
# Initialize IDL for LazorKit
anchor idl init -f ./target/idl/lazorkit.json 33tS3mSoyvdmKWxb6bgSL657AqH4Wxsu9R6GnvjtZdEd

# Initialize IDL for Transfer Limit
anchor idl init -f ./target/idl/transfer_limit.json EXYavpYDn6twyPvsGtvuJkEaGeqbN5TLCnC3Fp3evv85

# Initialize IDL for Default Rule
anchor idl init -f ./target/idl/default_rule.json scdFpnHi1Hu1BbKPwEdhRcdWwu5DohSWxCAg3UeDNKZ

# Upgrade IDL for LazorKit
anchor idl upgrade 33tS3mSoyvdmKWxb6bgSL657AqH4Wxsu9R6GnvjtZdEd -f ./target/idl/lazorkit.json

# Upgrade IDL for Transfer Limit
anchor idl upgrade EXYavpYDn6twyPvsGtvuJkEaGeqbN5TLCnC3Fp3evv85 -f ./target/idl/transfer_limit.json

# Upgrade IDL for Default Rule
anchor idl upgrade scdFpnHi1Hu1BbKPwEdhRcdWwu5DohSWxCAg3UeDNKZ -f ./target/idl/default_rule.json
```

### Test the smart-contracts
## Testing

Run the test suite:

```bash
anchor run test
anchor test
```

The test suite includes:
- Smart wallet creation and initialization
- Default rule implementation
- Transfer limit functionality
- Rule change operations

## SDK Usage

The SDK provides a comprehensive interface for interacting with the smart wallet system:

```typescript
import { LazorKitProgram } from './sdk/lazor-kit';
import { DefaultRuleProgram } from './sdk/default-rule-program';

// Initialize the programs
const connection = new anchor.web3.Connection('YOUR_RPC_URL');
const lazorkitProgram = new LazorKitProgram(connection);
const defaultRuleProgram = new DefaultRuleProgram(connection);

// Create a smart wallet
const createSmartWalletTxn = await lazorkitProgram.createSmartWalletTxn(
passkeyPubkey,
initRuleIns,
payer.publicKey
);
```

## Features

### Smart Wallet Management
- Create and manage smart wallets
- Secp256r1 authentication
- Configurable wallet rules

### Default Rule System
- Implement default transaction rules
- Custom rule program support
- Whitelist functionality

### Transfer Limits
- Configurable transfer limits
- Token transfer restrictions
- Custom limit rules

## Contributing

1. Fork the repository
2. Create your feature branch
3. Commit your changes
4. Push to the branch
5. Create a new Pull Request
Loading