Skip to main content

build_document_shielded_token_payment

Function build_document_shielded_token_payment 

Source
pub fn build_document_shielded_token_payment<P: OrchardProver>(
    token_id: Identifier,
    owner_id: Identifier,
    data_contract_id: Identifier,
    document_id: Identifier,
    spends: Vec<SpendableNote>,
    amount: TokenAmount,
    change_address: &OrchardAddress,
    fvk: &FullViewingKey,
    ask: &SpendAuthorizingKey,
    anchor: Anchor,
    memo: [u8; 36],
    prover: &P,
    platform_version: &PlatformVersion,
) -> Result<TokenShieldedPayment, ProtocolError>
Expand description

Builds the shielded payment of a document action whose token cost is amount: spends spends from the token’s shielded pool, returns the remainder to change_address as a new note and binds the token id, the batch owner, the document’s contract and id and the amount into the Orchard sighash. Put the result into a TokenPaymentInfo::V1 on the document transition’s base; the identity signing the batch still pays the credit fee.

For document creation, document_id must be the final ID derived from the creation nonce. Call Document::set_id_for_creation before building this payment; a document factory’s placeholder ID is replaced when the create transition is built.

value_balance == amount exactly; the pool pays the cost, nothing is carved for fees.