Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

token-js: added an e2e test for transferring using a mint with a transfer hook extension #5138

Merged
merged 8 commits into from
Sep 1, 2023

Conversation

wjthieme
Copy link
Contributor

@wjthieme wjthieme commented Aug 28, 2023

resolves #5128
blocked by #5112

  • Added an e2e test for transferring spl-tokens with a transfer hook extension.
  • Added a getExtraAccountMetaAccount helper function. fixed in token-js: added extra account resolution for transfer hook extension #5112
  • Fixed a bug in transfer-hook-example where no lamports were transferred to the extraAccountMeta account in the initialize instruction causing it to not be rent-exempt. wasn't actually a bug :)
  • State encode/decode for transfer hooks has become a little bit tricky as there are now multiple structs that require each other. ExtraAccountMeta is an individual extra account meta, ExtraAccountMetaList is a PodSlice of ExtraAccountMeta and ExtraAccountMetaAccountData which is the actual data inside the extraAccountMeta data account which apparently wraps ExtraAccountMetaList in a tlv. Any suggestions on naming/structure would be appreciated. fixed in token-js: added extra account resolution for transfer hook extension #5112
  • Had to add the extraAccountMeta and transferHookProgram accounts to addExtraAccountsToInstruction as they were still missing. fixed in token-js: added extra account resolution for transfer hook extension #5112

Ideally, we should be able to use Solana Bankrun to deploy the example program and test all of our JavaScript transfer hook magic!

Introducing solana-bankrun as described in the issue for just this single test felt a little bit out of place for this PR so I left that part out.

@mergify mergify bot added the community Community contribution label Aug 28, 2023
@wjthieme wjthieme force-pushed the wjthieme-patch-4 branch 3 times, most recently from 940a096 to 2d2406d Compare August 30, 2023 06:39
Copy link
Contributor

@joncinque joncinque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test itself looks great! Just a few other little things to address, we should be able to get this in soon

.github/workflows/pull-request-token.yml Outdated Show resolved Hide resolved
token/transfer-hook-example/src/processor.rs Outdated Show resolved Hide resolved
token/js/test/e2e-2022/transferHook.test.ts Show resolved Hide resolved
token/js/test/e2e-2022/transferHook.test.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@joncinque joncinque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks!

thank hook

@joncinque joncinque merged commit eafe27f into solana-labs:master Sep 1, 2023
29 checks passed
@wjthieme wjthieme deleted the wjthieme-patch-4 branch September 1, 2023 12:14
thlorenz added a commit to ironforge-cloud/solana-program-library that referenced this pull request Sep 4, 2023
* master: (719 commits)
  release: Bump token-2022 and all dependencies (solana-labs#5189)
  SPL errors from hashes (solana-labs#5169)
  stake-pool: Add comments about unnecessary ownership checks (HAL-01) (solana-labs#5084)
  stake-pool: Enforce that pool mint uses 9 decimal places (HAL-03) (solana-labs#5085)
  build(deps-dev): bump tsx from 3.12.7 to 3.12.8 in /single-pool/js (solana-labs#5188)
  account-compression: Fixup sdk doc deployment (solana-labs#5187)
  token-js: renamed `getExtraAccountMetaAccount` to `getExtraAccountMetaAddress` (solana-labs#5186)
  token-js: added an e2e test for transferring using a mint with a transfer hook extension (solana-labs#5138)
  Serde optional dependencies clean-up (solana-labs#5181)
  build(deps): bump chrono from 0.4.27 to 0.4.28 (solana-labs#5180)
  stake-pool: Use unaligned types for safe pointer cast (solana-labs#5179)
  spl-pod: make code docs more explicit (solana-labs#5178)
  token-js: added extra account resolution for transfer hook extension (solana-labs#5112)
  Fix incorrect code doc (solana-labs#5177)
  Move Pod types to separate library (solana-labs#5119)
  build(deps-dev): bump @typescript-eslint/eslint-plugin from 6.4.1 to 6.5.0 in /memo/js (solana-labs#5176)
  build(deps): bump chrono from 0.4.26 to 0.4.27 (solana-labs#5171)
  build(deps-dev): bump prettier from 3.0.2 to 3.0.3 in /token-swap/js (solana-labs#5174)
  build(deps-dev): bump prettier from 3.0.2 to 3.0.3 in /token/js (solana-labs#5172)
  build(deps-dev): bump prettier from 3.0.2 to 3.0.3 in /token-lending/js (solana-labs#5173)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Community contribution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Transfer Hook Interface Example JS Tests
2 participants