Skip to main content

build_token_unshield_transition

Function build_token_unshield_transition 

Source
pub async fn build_token_unshield_transition<S: Signer<IdentityPublicKey>, P: OrchardProver>(
    token_id: Identifier,
    owner_id: Identifier,
    data_contract_id: Identifier,
    token_contract_position: u16,
    spends: Vec<SpendableNote>,
    recipient_id: Identifier,
    amount: TokenAmount,
    change_address: &OrchardAddress,
    fvk: &FullViewingKey,
    ask: &SpendAuthorizingKey,
    anchor: Anchor,
    memo: [u8; 36],
    identity_public_key: &IdentityPublicKey,
    identity_contract_nonce: IdentityNonce,
    user_fee_increase: UserFeeIncrease,
    signer: &S,
    prover: &P,
    platform_version: &PlatformVersion,
) -> Result<StateTransition, ProtocolError>
Expand description

Builds a TokenUnshield batch transition: spends spends from the token’s shielded pool, credits amount tokens to recipient_id, returns the remainder to change_address as a new note, and wraps the bundle in a batch transition signed by owner_id.

Tokens cannot pay fees, so unlike the credit pool’s Unshield nothing is carved from the value balance: value_balance == amount exactly, and the signing identity pays the fee in credits. The token id, owner id, recipient id and amount are bound into the Orchard sighash so the bundle cannot be replayed against a different token, recipient or amount.