Implement spender approvals and transfers#1903
Merged
Neopallium merged 16 commits intodevelopfrom Apr 14, 2026
Merged
Conversation
Neopallium
requested changes
Mar 18, 2026
Neopallium
requested changes
Mar 27, 2026
Neopallium
reviewed
Mar 31, 2026
Neopallium
reviewed
Mar 31, 2026
Neopallium
requested changes
Apr 6, 2026
HenriqueNogara
approved these changes
Apr 8, 2026
Neopallium
requested changes
Apr 9, 2026
Contributor
Neopallium
left a comment
There was a problem hiding this comment.
Overview of changes for this PR:
- Update the benchmarks/weights for NFTs.
Nft.transfer_nftuseAccountIdinstead ofAssetHolderfor from/to.
For follow-up PR:
- Use the
fund,from,toparameters to select a more optimal worse-case weight (to lower the estimated tx fee). - Don't include compliance/transfer rule and execution cost in base weights, so that the meter can be used for calculating a better actual fee.
Neopallium
approved these changes
Apr 14, 2026
Comment on lines
+4146
to
+4147
| let asset_count = Self::fungible_asset_count(is_fungible); | ||
| Self::base_try_execute_instruction(origin, instruction_id, &asset_count, weight_meter)?; |
Contributor
There was a problem hiding this comment.
Right now the is_fungible flag is only set to true, since this method is only called for the fungible case. If we decide to add a Nft.receiver_affirm_nft_transfer extrinsic, then we will need to have the AssetCount include the correct number of NFTs.
For this PR, this is fine as is.
HenriqueNogara
approved these changes
Apr 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements spender approval primitives for the asset pallet and adds a
transfer_fundsextrinsic to the settlement pallet for spending approved allowances and same-identity direct transfers.changelog
new features
transfer_fundsto the settlement pallet — supports same-identity direct transfers and spender-approved transfers without going through the settlement enginetransfer_assettransfer_nftto the NFT pallet — transfer NFTs between accounts/portfolios with same routing logic astransfer_fundsmodified external API
transfer_assetnow usesensure_origin_call_permissionsand routes same-DID transfers directly instead of always creating a settlement instructionnew external API
approveextrinsic to the asset pallet — set, replace, or revoke a spender allowance for a given assettransfer_fundsextrinsic to the settlement pallet — transfer assets with optional spender approval, defaults source to caller's account whenfromisNoneallowance(owner, spender, asset_id)Runtime API — query remaining spender allowance without a transactionnew events
Approval { owner, spender, asset_id, amount }event — emitted onapprovecalls, not on spendother
Allowancesstorage map to the asset pallet — maps(owner, spender, asset_id)to approved balanceInsufficientAllowanceerror to the asset palletSenderSameAsReceiverandAllowancesNotSupportedForNFTserrors to the settlement palletspend_allowancepublic helper to the asset pallet — used by the settlement pallet to check and decrement allowancesBalance::MAX) is never decremented on spend; allowance depleted to zero removes the storage entryapprove,allowanceRuntime API, andtransfer_fundscovering spender mode, same-identity transfers, cross-identity settlement, portfolio custody, NFT transfers, atomicity, and edge casesPortfolioFnTrait/PortfolioFnConfigtransfer_funds/transfer_funds_weighttoSettlementFnTrait— exposes routing logic for cross-pallet callerssimplified_nft_transfernow acceptsOption<InstructionId>(was required)transfer_asset_base_weightbenchmark,transfer_asset_and_try_execute,transfer_nft_and_try_execute