Skip to content
This repository has been archived by the owner on Nov 26, 2024. It is now read-only.

Commit

Permalink
Demo 5: transfer hooks (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
urani-engineering-helper authored Mar 29, 2024
1 parent ae5740c commit b0334c5
Show file tree
Hide file tree
Showing 22 changed files with 116 additions and 1,698 deletions.
6 changes: 3 additions & 3 deletions chapters/07_transfer_hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

* All accounts from the initial transfer are converted to read-only accounts (i.e., the signer privileges of the sender do not extend to the Transfer Hook program).

* Extra accounts required by `Execute` are stored in a predefined PDA that must be derived using the following seeds: `extra-account-metas` string, the mint account address, the transfer hook `program_id`.
* Extra accounts required by `Execute` are stored in a predefined PDA that must be derived using the following seeds: `extra-account-metas` string, the mint account address, and the transfer hook `_id`.

<br>

Expand All @@ -63,7 +63,7 @@ const [pda] = PublicKey.findProgramAddressSync(
- `Discriminator`, the first 8 bytes of the hash of "spl-transfer-hook-interface:execute"
- `Data`:
- `amount`: `u64`, the transfer amount
- `accounts:
- `accounts`:
- 1 []: Source token account
- 2 []: Mint
- 3 []: Destination token account
Expand All @@ -73,7 +73,7 @@ const [pda] = PublicKey.findProgramAddressSync(
* `InitializeExtraAccountMetaList` is optional and intializes the validation account to store a list of extra required `AccountMeta` configurations for the `Execute` instruction.


* `UpdateExtraAccountMetaList` is optional and allows an on-chain program to update its list of required accounts for 1Execute`.
* `UpdateExtraAccountMetaList` is optional and allows an on-chain program to update its list of required accounts for `Execute`.


<br>
Expand Down
4 changes: 2 additions & 2 deletions demos/backend/05_transfer_hooks/Anchor.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ seeds = false
skip-lint = false

[programs.localnet]
vesting_template = "FohntM2s5Z1uqyDbBAu1CHxYh9umzeiRSKr198rSSdvT"
transfer_hooks = "6HDohFvWAiJ78K8x7qki3aZ3MvMD1nSJr1g2hYvfRxhe"

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

[provider]
cluster = "Localnet"
wallet = "/Users/leo/.config/solana/id.json"
wallet = "/Users/urani/.config/solana/id.json"

[scripts]
test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"
12 changes: 0 additions & 12 deletions demos/backend/05_transfer_hooks/migrations/deploy.ts

This file was deleted.

4 changes: 2 additions & 2 deletions demos/backend/05_transfer_hooks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
},
"dependencies": {
"@coral-xyz/anchor": "^0.29.0",
"@solana/spl-token": "^0.4.1"
"@solana/spl-token": "^0.4.3"
},
"devDependencies": {
"@types/bn.js": "^5.1.0",
"@types/chai": "^4.3.0",
"@types/mocha": "^9.0.0",
"chai": "^4.3.4",
"mocha": "^9.0.3",
"mocha": "^9.2.2",
"prettier": "^2.6.2",
"ts-mocha": "^10.0.0",
"typescript": "^4.3.5"
Expand Down

This file was deleted.

249 changes: 0 additions & 249 deletions demos/backend/05_transfer_hooks/tests/vesting-template.ts

This file was deleted.

Loading

0 comments on commit b0334c5

Please sign in to comment.