Splice.TokenStandard.Utils.Internal.Conversions
Splice.TokenStandard.Utils.Internal.Conversions
Internal module implementing conversion functions between v1 and v2 of the token standard.
Import ‘Splice.TokenStandard.Utils’ to get access to the public ones.
Typeclasses
class BackwardCompatible v1 v2 where
A backwards compatible API upgrade from v1 to v2.
upcast: v1 -> v2
instance BackwardCompatible (ContractId AllocationInstruction) (ContractId AllocationInstruction)
instance BackwardCompatible (ContractId Allocation) (ContractId Allocation)
instance BackwardCompatible (ContractId Holding) (ContractId Holding)
instance BackwardCompatible (ContractId TransferInstruction) (ContractId TransferInstruction)
instance BackwardCompatible AllocationInstructionResult_Output AllocationInstructionResult_Output
instance BackwardCompatible AllocationSpecification AllocationSpecification
instance BackwardCompatible SettlementInfo SettlementInfo
instance BackwardCompatible HoldingView HoldingView
instance BackwardCompatible InstrumentId InstrumentId
instance BackwardCompatible Lock Lock
instance BackwardCompatible Transfer Transfer
instance BackwardCompatible TransferFactoryView TransferFactoryView
instance BackwardCompatible TransferInstructionResult TransferInstructionResult
instance BackwardCompatible TransferInstructionResult_Output TransferInstructionResult_Output
class ForwardCompatible v1 v2 where
downcast: v2 -> v1
instance ForwardCompatible (ContractId Holding) (ContractId Holding)
instance ForwardCompatible (ContractId TransferFactory) (ContractId TransferFactory)
instance ForwardCompatible (ContractId TransferInstruction) (ContractId TransferInstruction)
instance ForwardCompatible AllocationInstructionResult AllocationInstructionResult
instance ForwardCompatible AllocationInstructionResult_Output AllocationInstructionResult_Output
instance ForwardCompatible AllocationRequestView AllocationRequestView
instance ForwardCompatible Reference SettlementInfo
instance ForwardCompatible HoldingView HoldingView
instance ForwardCompatible InstrumentId InstrumentId
instance ForwardCompatible Lock Lock
instance ForwardCompatible Transfer Transfer
instance ForwardCompatible TransferFactoryView TransferFactoryView
instance ForwardCompatible TransferInstructionResult TransferInstructionResult
instance ForwardCompatible TransferInstructionResult_Output TransferInstructionResult_Output
instance ForwardCompatible TransferInstructionView TransferInstructionView
Functions
maxTime: Time
fromAnyContractId: AnyContractId -> ContractId t
toAnyContractId: ContractId t -> AnyContractId
tokenStandardV2Namespace: Text
Namespace for token standard V2 which is published as CIP-0112.
timeToMeta: Text -> Time -> Metadata -> Metadata
timeFromMeta: Text -> Metadata -> Optional Time
specialAccountOwnerStubV1: Party
Party to use for as a stub for special accounts when reporting them through V1 APIs. Minimize the use of this function where possible.
accountOwnerForV1: Account -> Party
Owner of an account for V1 APIs that do expect a party to be given.
Uses the specialAccountOwnerStubV1 for special accounts.
The principal of an account, which is the owner for regular accounts, and the instrument admin for special accounts.
basicAccount: Party -> Account
Construct the basic account for an owner.
isBasicAccount: Account -> Bool
True if the account is a basic account.
isRegularAccount: Account -> Bool
True iff the account is a regular account, i.e., has an owner specified.
accountPartiesThe principal of an account and the provider, if set.
regularAccountParties: Account -> [Party]
Get the account parties of a regular account. Fails if the account is no regular account.
Prefer to use accountParties where possible, as that function works for both regular and special accounts.
: Account -> Party
Get the owner of a regular account. Fails the it is not regular account.
providerMetaKey accountIdMetaKey expiresAtMetaKey: Text
accountToMeta: Text -> Account -> Metadata -> Metadata
accountFromMeta: Party -> Text -> Metadata -> Account
dropAccountMeta: Text -> Metadata -> Metadata
ensureNoAccountMeta: Text -> Text -> Metadata -> Update ()
ensureBasicAccount: Text -> Account -> Update ()
validateNoAccountMeta validateNoMeta dropMeta: Text -> Metadata -> Metadata
partiesToMeta: Text -> [Party] -> Metadata -> Metadata
partiesFromMeta expiresAtToMeta: Optional Time -> Metadata -> Metadata
Report early expiry of instructions or allocations in the V1 metadata.
reasonMetaKey: Text
Short, human-readable reason for the transaction.
txKindMetaKey: Text
Kind of the transaction.
senderMetaKey: Text
The sender of a transfer.
receiverMetaKey: Text
The receiver of a transfer.
Note: this keys is not defined in CIP-0056, but matches the sender key, and is useful for transfer metadata, so we add it here for consistency.
reasonFromMeta: Metadata -> Text
Extra the transfer reason from the metadata. Returns an empty string if no reason is found.
reasonToMeta: Text -> Metadata -> Metadata
Add the given reason to the metadata, if it’s not empty.
mkMetaTransferFromMetadata to tag a transfer for V1 transaction history parsing.
v1HistoryTagAsUnlockV1: Metadata -> Metadata
Tag a holdings change as an unlock for V1 tx history parsers.
availableToPendingActions: (a -> Text) -> Map a [[Party]] -> Map Party Text
Convert a map of named available actions to an approximate list of pending actions,
using joint- to mark actions that require joint-authorization, and using or to combine
multiple actions available to a party.
Comments