Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 18 additions & 0 deletions tokens/transfer-hook-transfer-switch/anchor/Anchor.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[toolchain]

[features]
resolution = true
skip-lint = false

[programs.localnet]
transfer_hook = "2KKm5dexWn2uw7tPTYs4KYc1R2P111rCu7YUEhZyoLh2"

[registry]
url = "https://api.apr.dev"

[provider]
cluster = "Localnet"
wallet = "~/.config/solana/id.json"

[scripts]
test = "pnpm run ts-mocha -p ./tsconfig.json -t 1000000 tests/*.ts"
14 changes: 14 additions & 0 deletions tokens/transfer-hook-transfer-switch/anchor/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[workspace]
members = [
"programs/*"
]
resolver = "2"

[profile.release]
overflow-checks = true
lto = "fat"
codegen-units = 1
[profile.release.build-override]
opt-level = 3
incremental = false
codegen-units = 1
48 changes: 48 additions & 0 deletions tokens/transfer-hook-transfer-switch/anchor/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Transfer Hook Transfer Switch

A Solana program that implements token transfer controls using a hook pattern, allowing wallets to be frozen and unfrozen for tokens.

## Prerequisites

- Rust and Cargo
- Solana CLI tools
- Anchor CLI
- Node.js and Yarn

## Setup

1. Clone the repository

```bash
git clone <repository-url>
cd <project-directory>
```

2. Install dependencies:

```bash
pnpm install
```

3. Build the Anchor project

```bash
anchor build
```

4. Sync the program ID:

```bash
anchor keys sync
```

## Running Tests

```bash
anchor test
```

## Notes

- Ensure your Solana validator is running locally before running tests.
- If you encounter any issues, make sure your Anchor.toml and Cargo.toml files are correctly configured for your project.
12 changes: 12 additions & 0 deletions tokens/transfer-hook-transfer-switch/anchor/migrations/deploy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Migrations are an early feature. Currently, they're nothing more than this
// single deploy script that's invoked from the CLI, injecting a provider
// configured from the workspace's Anchor.toml.

const anchor = require('@coral-xyz/anchor');

module.exports = async (provider) => {
// Configure client to use the provider.
anchor.setProvider(provider);

// Add your deploy script here.
};
26 changes: 26 additions & 0 deletions tokens/transfer-hook-transfer-switch/anchor/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"license": "ISC",
"scripts": {
"lint:fix": "prettier */*.js \"*/**/*{.js,.ts}\" -w",
"lint": "prettier */*.js \"*/**/*{.js,.ts}\" --check",
"ts-mocha": "ts-mocha"
},
"dependencies": {
"@coral-xyz/anchor": "^0.30.1",
"@solana/spl-token": "^0.4.9",
"@solana/web3.js": "^1.95.4"
},
"devDependencies": {
"@types/chai": "^4.3.7",
"@types/mocha": "10.0.9",
"@types/node": "^22.7.4",
"@types/bn.js": "^5.1.0",
"anchor-bankrun": "^0.5.0",
"borsh": "^2.0.0",
"chai": "^4.3.7",
"mocha": "10.7.3",
"solana-bankrun": "0.4.0",
"ts-mocha": "^10.0.0",
"typescript": "5.6.3"
}
}
Loading
Loading