refactor: Allow custom on_sending_delegate_action_callback handler for transactions and on_after_signing_callback for sign-message#583
Conversation
1f477fe to
a7d7298
Compare
There was a problem hiding this comment.
Pull request overview
Refactors transaction submission to support a customizable handler for sending SignedDelegateAction (useful for external/meta-transaction relayers requiring custom auth).
Changes:
- Introduces
OnSendingDelegateActionCallbackand threads it throughSubmitContext,ActionContext, andTransactionContext. - Propagates the optional callback through most signing flows (seed phrase, private key, keychain/legacy keychain, ledger).
- Updates the send flow to invoke the custom delegate-action sender when present, otherwise falling back to the configured relayer URL or display fallback.
Reviewed changes
Copilot reviewed 43 out of 43 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/transaction_signature_options/mod.rs | Adds OnSendingDelegateActionCallback type + optional field on SubmitContext. |
| src/transaction_signature_options/send/mod.rs | Invokes custom delegate-action sender callback before relayer-url fallback. |
| src/network_for_transaction/mod.rs | Threads optional callback through network selection context. |
| src/commands/mod.rs | Adds optional callback to ActionContext and TransactionContext. |
| src/transaction_signature_options/sign_with_seed_phrase/mod.rs | Carries callback through seed-phrase signing context into SubmitContext. |
| src/transaction_signature_options/sign_with_private_key/mod.rs | Carries callback through private-key signing context into SubmitContext. |
| src/transaction_signature_options/sign_with_access_key_file/mod.rs | Carries callback through access-key-file signing context into SubmitContext. |
| src/transaction_signature_options/sign_with_keychain/mod.rs | Carries callback through keychain signing context into SubmitContext. |
| src/transaction_signature_options/sign_with_legacy_keychain/mod.rs | Carries callback through legacy-keychain signing context into SubmitContext. |
| src/transaction_signature_options/sign_with_ledger/mod.rs | Carries callback through ledger signing contexts (USB/BLE). |
| src/transaction_signature_options/sign_with_mpc/mod.rs | Initializes callback to None in MPC flows (see review comment re: propagation). |
| src/transaction_signature_options/submit_dao_proposal/mod.rs | Initializes callback to None for DAO proposal conversion (see review comment re: propagation). |
| src/commands/transaction/sign_transaction/mod.rs | Initializes callback to None in this command’s default ActionContext. |
| src/commands/transaction/send_meta_transaction/sign_as/mod.rs | Initializes callback to None in this command’s default ActionContext. |
| src/commands/transaction/construct_transaction/skip_action/mod.rs | Initializes callback to None when constructing ActionContext. |
| src/commands/tokens/send_near/mod.rs | Initializes callback to None when constructing ActionContext. |
| src/commands/tokens/send_nft/mod.rs | Initializes callback to None when constructing ActionContext. |
| src/commands/tokens/send_ft/amount_ft.rs | Initializes callback to None when constructing ActionContext. |
| src/commands/tokens/send_ft_call/amount_ft.rs | Initializes callback to None when constructing ActionContext. |
| src/commands/staking/delegate/deposit_and_stake.rs | Initializes callback to None when constructing ActionContext. |
| src/commands/staking/delegate/stake.rs | Initializes callback to None when constructing ActionContext. |
| src/commands/staking/delegate/stake_all.rs | Initializes callback to None when constructing ActionContext. |
| src/commands/staking/delegate/unstake.rs | Initializes callback to None when constructing ActionContext. |
| src/commands/staking/delegate/unstake_all.rs | Initializes callback to None when constructing ActionContext. |
| src/commands/staking/delegate/withdraw.rs | Initializes callback to None when constructing ActionContext. |
| src/commands/staking/delegate/withdraw_all.rs | Initializes callback to None when constructing ActionContext. |
| src/commands/contract/deploy_global/mod.rs | Initializes callback to None when constructing ActionContext. |
| src/commands/contract/deploy/initialize_mode/mod.rs | Initializes callback to None when constructing ActionContext. |
| src/commands/contract/deploy/initialize_mode/call_function_type/mod.rs | Initializes callback to None when constructing ActionContext. |
| src/commands/contract/call_function/as_transaction/mod.rs | Initializes callback to None when constructing ActionContext. |
| src/commands/account/update_social_profile/sign_as.rs | Initializes callback to None when constructing ActionContext. |
| src/commands/account/storage_management/storage_withdraw.rs | Initializes callback to None when constructing ActionContext. |
| src/commands/account/storage_management/storage_deposit.rs | Initializes callback to None when constructing ActionContext. |
| src/commands/account/delete_key/public_keys_to_delete.rs | Initializes callback to None when constructing ActionContext. |
| src/commands/account/delete_account/mod.rs | Initializes callback to None when constructing ActionContext. |
| src/commands/account/create_account/fund_myself_create_account/sign_as/mod.rs | Initializes callback to None when constructing ActionContext. |
| src/commands/account/add_key/use_public_key/mod.rs | Initializes callback to None when constructing ActionContext. |
| src/commands/account/add_key/use_mpc/mod.rs | Initializes callback to None when constructing ActionContext. |
| src/commands/account/add_key/use_manually_provided_seed_phrase/mod.rs | Initializes callback to None when constructing ActionContext. |
| src/commands/account/add_key/use_ledger/mod.rs | Initializes callback to None when constructing ActionContext (USB/BLE). |
| src/commands/account/add_key/autogenerate_new_keypair/save_keypair_to_legacy_keychain/mod.rs | Initializes callback to None when constructing ActionContext. |
| src/commands/account/add_key/autogenerate_new_keypair/save_keypair_to_keychain/mod.rs | Initializes callback to None when constructing ActionContext. |
| src/commands/account/add_key/autogenerate_new_keypair/print_keypair_to_terminal/mod.rs | Initializes callback to None when constructing ActionContext. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…as_delegate_action down to sign-with-MPC and submit-as-DAO contexts
ed1615d to
6bf9511
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 51 out of 51 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@race-of-sloths score 5 |
|
@frol Thank you for your contribution! Your pull request is now a part of the Race of Sloths! Current status: executed
Your contribution is much appreciated with a final score of 5! @vsavchyn-dev received 25 Sloth Points for reviewing and scoring this pull request. Another weekly streak completed, well done @frol! To keep your weekly streak and get another bonus make pull request next week! Looking forward to see you in race-of-sloths What is the Race of SlothsRace of Sloths is a friendly competition where you can participate in challenges and compete with other open-source contributors within your normal workflow For contributors:
For maintainers:
Feel free to check our website for additional details! Bot commands
|
<img width="998" height="592" alt="image" src="https://github.com/user-attachments/assets/fdb3a264-1c00-46fe-b995-58675150d4f8" /> There are still a couple of bugs here and there, but it mostly works. This PR is blocked on near/near-cli-rs#583
I need it for trezu CLI, which leverages a custom meta-transaction relayer backend that requires auth, so it is better to just enable customization here and let trezu CLI to reuse parts of near-cli-rs nicely