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 client: refactor transfer to use new offchain helper #6107

Conversation

buffalojoec
Copy link
Contributor

This PR continues the necessary repairs for addressing #6064 by refactoring the
Token Client's transfer(..) function to use the new offchain transfer hook
helpers.

If transfer hook accounts are provided, in either case they're appended to the
instruction like before.

If no transfer hook accounts are provided:

  • If decimals are provided, Token2022's offchain helper
    create_transfer_checked_instruction_with_extra_metas(..) is used.
  • If decimals are not provided, SPL Transfer Hook interface's
    add_extra_account_metas_for_execute(..) is used.

In either case where no transfer hook accounts are provided, the new,
non-deprecated helpers are used.

@buffalojoec buffalojoec force-pushed the 01-10-token_client_refactor_transfer_to_use_new_offchain_helper branch from e7bd4a3 to 2a9013f Compare January 10, 2024 14:52
@buffalojoec buffalojoec requested a review from joncinque January 10, 2024 14:59
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.

I might have misunderstood the unchecked portion, but after that, this looks good!

token/client/src/token.rs Outdated Show resolved Hide resolved
token/client/src/token.rs Outdated Show resolved Hide resolved
@buffalojoec buffalojoec force-pushed the 01-09-token_2022_add_new_offchain_helper branch from 0c3b21e to 95bbbbd Compare January 10, 2024 17:04
@buffalojoec buffalojoec force-pushed the 01-10-token_client_refactor_transfer_to_use_new_offchain_helper branch from 2a9013f to 8df6a4b Compare January 10, 2024 17:04
@buffalojoec buffalojoec force-pushed the 01-09-token_2022_add_new_offchain_helper branch from 95bbbbd to 2fa3ac2 Compare January 10, 2024 21:18
@buffalojoec buffalojoec force-pushed the 01-10-token_client_refactor_transfer_to_use_new_offchain_helper branch from 8df6a4b to 8bda3ed Compare January 10, 2024 21:18
@buffalojoec buffalojoec requested a review from joncinque January 10, 2024 21:18
joncinque
joncinque previously approved these changes Jan 10, 2024
@buffalojoec buffalojoec force-pushed the 01-09-token_2022_add_new_offchain_helper branch from 2fa3ac2 to 8c04474 Compare January 11, 2024 16:35
@buffalojoec buffalojoec force-pushed the 01-10-token_client_refactor_transfer_to_use_new_offchain_helper branch from 37daf18 to 1358800 Compare January 11, 2024 16:36
Copy link
Contributor Author

buffalojoec commented Jan 11, 2024

Merge activity

  • Jan 11, 4:15 PM: @buffalojoec started a stack merge that includes this pull request via Graphite.
  • Jan 11, 4:17 PM: Graphite rebased this pull request as part of a merge.
  • Jan 11, 4:18 PM: @buffalojoec merged this pull request with Graphite.

@buffalojoec buffalojoec force-pushed the 01-09-token_2022_add_new_offchain_helper branch from 8c04474 to 006e8fc Compare January 11, 2024 21:15
Base automatically changed from 01-09-token_2022_add_new_offchain_helper to master January 11, 2024 21:16
@buffalojoec buffalojoec force-pushed the 01-10-token_client_refactor_transfer_to_use_new_offchain_helper branch from 1358800 to e2efa93 Compare January 11, 2024 21:16
@mergify mergify bot dismissed joncinque’s stale review January 11, 2024 21:17

Pull request has been modified.

@buffalojoec buffalojoec merged commit e13db27 into master Jan 11, 2024
29 checks passed
@buffalojoec buffalojoec deleted the 01-10-token_client_refactor_transfer_to_use_new_offchain_helper branch January 11, 2024 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants