Deprecated

This Splice documentation site is deprecated. Use the current Canton Network docs.

Open current docs

Splice.Util.Token.Wallet.BatchingUtilityV2

Utility template for token standard V2 wallets to execute multiple token standard actions in a single transaction with chaining of input holdings.

Long-term Canton will likely gain support for constructing transactions in multiple steps, where later steps can fetch contracts created in earlier steps. Right now that support does not exist, which is why we provide this batching utility.

Templates

template BatchingUtility

This batching utility is intended to be used for V2 wallets to interact with both V1 and V2 apps and V1 and V2 assets.

Signatory: user

Field

Type

Description

user

Party

  • Choice Archive

    Controller: user

    Returns: ()

    (no fields)

  • Choice BatchingUtility_ExecuteBatch

    Controller: user

    Returns: BatchingUtility_ExecuteBatchResult

    Field

    Type

    Description

    inputHoldingMap

    HoldingMap

    Holdings to use to fund the actions.

    actions

    [TokenStandardAction]

    Actions to execute. Holdings will be properly threaded through.

    archiveAfterExecution

    Bool

    Whether to archive the batching utility contract at the end of execution. Use this for using the batching utility with createAndExercise.

Data Types

data BatchingUtility_ExecuteBatchResult

The result of execution a batch of token standard actions.

BatchingUtility_ExecuteBatchResult

Field

Type

Description

actionResults

[TokenStandardActionResult]

Results are delivered in the same order as the actions.

outputHoldingMap

HoldingMap

Map of holdings after executing the actions in th batch.

instance Eq BatchingUtility_ExecuteBatchResult

instance Show BatchingUtility_ExecuteBatchResult

instance GetField "actionResults" BatchingUtility_ExecuteBatchResult [TokenStandardActionResult]

instance GetField "outputHoldingMap" BatchingUtility_ExecuteBatchResult HoldingMap

instance SetField "actionResults" BatchingUtility_ExecuteBatchResult [TokenStandardActionResult]

instance SetField "outputHoldingMap" BatchingUtility_ExecuteBatchResult HoldingMap

instance HasExercise BatchingUtility BatchingUtility_ExecuteBatch BatchingUtility_ExecuteBatchResult

instance HasFromAnyChoice BatchingUtility BatchingUtility_ExecuteBatch BatchingUtility_ExecuteBatchResult

instance HasToAnyChoice BatchingUtility BatchingUtility_ExecuteBatch BatchingUtility_ExecuteBatchResult

data ChoiceCall arg

A call to a choice.

ChoiceCall

Field

Type

Description

cid

AnyContractId

arg

arg

instance Eq arg => Eq (ChoiceCall arg)

instance Show arg => Show (ChoiceCall arg)

instance GetField "arg" (ChoiceCall arg) arg

instance GetField "cid" (ChoiceCall arg) AnyContractId

instance SetField "arg" (ChoiceCall arg) arg

instance SetField "cid" (ChoiceCall arg) AnyContractId

data HoldingMap

Map of holdings, keyed by admin, account, and instrument id.

HoldingMap

Field

Type

Description

byAdminAndAccount

Map ScopedAccount (TextMap [ContractId Holding])

instance Eq HoldingMap

instance Show HoldingMap

instance Monoid HoldingMap

instance Semigroup HoldingMap

instance GetField "byAdminAndAccount" HoldingMap (Map ScopedAccount (TextMap [ContractId Holding]))

instance GetField "inputHoldingMap" BatchingUtility_ExecuteBatch HoldingMap

instance GetField "outputHoldingMap" BatchingUtility_ExecuteBatchResult HoldingMap

instance SetField "byAdminAndAccount" HoldingMap (Map ScopedAccount (TextMap [ContractId Holding]))

instance SetField "inputHoldingMap" BatchingUtility_ExecuteBatch HoldingMap

instance SetField "outputHoldingMap" BatchingUtility_ExecuteBatchResult HoldingMap

data ScopedAccount

Account for assets of a particular admin.

ScopedAccount

Field

Type

Description

admin

Party

account

Account

instance Eq ScopedAccount

instance Ord ScopedAccount

instance Show ScopedAccount

instance GetField "account" ScopedAccount Account

instance GetField "admin" ScopedAccount Party

instance GetField "byAdminAndAccount" HoldingMap (Map ScopedAccount (TextMap [ContractId Holding]))

instance SetField "account" ScopedAccount Account

instance SetField "admin" ScopedAccount Party

instance SetField "byAdminAndAccount" HoldingMap (Map ScopedAccount (TextMap [ContractId Holding]))

data TokenStandardAction

A token standard action executed by a token standard wallet.

TSA_TransferFactory_TransferV1 (ChoiceCall TransferFactory_Transfer)

TSA_TransferInstruction_AcceptV1 (ChoiceCall TransferInstruction_Accept)

TSA_TransferInstruction_RejectV1 (ChoiceCall TransferInstruction_Reject)

TSA_TransferInstruction_WithdrawV1 (ChoiceCall TransferInstruction_Withdraw)

TSA_TransferFactory_TransferV2 (ChoiceCall TransferFactory_Transfer)

TSA_TransferInstruction_AcceptV2 (ChoiceCall TransferInstruction_Accept)

TSA_TransferInstruction_RejectV2 (ChoiceCall TransferInstruction_Reject)

TSA_TransferInstruction_WithdrawV2 (ChoiceCall TransferInstruction_Withdraw)

TSA_AllocationFactory_AllocateV1 (ChoiceCall AllocationFactory_Allocate)

TSA_AllocationInstruction_WithdrawV1 (ChoiceCall AllocationInstruction_Withdraw)

TSA_Allocation_WithdrawV1 (ChoiceCall Allocation_Withdraw)

TSA_AllocationFactory_AllocateV2 (ChoiceCall AllocationFactory_Allocate)

TSA_AllocationInstruction_AcceptV2 (ChoiceCall AllocationInstruction_Accept)

TSA_AllocationInstruction_WithdrawV2 (ChoiceCall AllocationInstruction_Withdraw)

TSA_Allocation_WithdrawV2 (ChoiceCall Allocation_Withdraw)

TSA_AllocationRequest_AcceptV2 (ChoiceCall AllocationRequest_Accept)

TSA_AllocationRequest_RejectV2 (ChoiceCall AllocationRequest_Reject)

instance Eq TokenStandardAction

instance Show TokenStandardAction

instance GetField "actions" BatchingUtility_ExecuteBatch [TokenStandardAction]

instance SetField "actions" BatchingUtility_ExecuteBatch [TokenStandardAction]

data TokenStandardActionResult

The result of a token standard action.

TSAR_AllocationInstructionResultV1 AllocationInstructionResult

TSAR_TransferInstructionResultV1 TransferInstructionResult

TSAR_AllocationWithdrawResultV1 Allocation_WithdrawResult

TSAR_TransferInstructionResultV2 TransferInstructionResult

TSAR_AllocationInstructionResultV2 AllocationInstructionResult

TSAR_AllocationResultV2 AllocationResult

TSAR_AllocationRequest_AcceptV2Result AllocationRequest_AcceptResult

TSAR_AllocationRequest_RejectV2Result AllocationRequest_RejectResult

instance Eq TokenStandardActionResult

instance Show TokenStandardActionResult

instance GetField "actionResults" BatchingUtility_ExecuteBatchResult [TokenStandardActionResult]

instance SetField "actionResults" BatchingUtility_ExecuteBatchResult [TokenStandardActionResult]

Functions

holdingMapFromList

: [(ScopedAccount, TextMap [ContractId Holding])] -> HoldingMap

Comments