Common utilities for implementing the token APIs for Amulet.Documentation Index
Fetch the complete documentation index at: https://docs.canton.network/llms.txt
Use this file to discover all available pages before exploring further.
Typeclasses
class ToAnyValue a where
Values that can be converted to AnyValuetoAnyValue : a -> AnyValueinstance ToAnyValue TimeLock instance ToAnyValue Bool instance ToAnyValue Decimal instance ToAnyValue Int instance ToAnyValue Text instance ToAnyValue (ContractId t) instance ToAnyValue Date instance ToAnyValue Party instance ToAnyValue Time instance ToAnyValue RelTime instance ToAnyValue ChoiceContext instance ToAnyValue a => ToAnyValue [a]
class FromAnyValue a where
Attempt to parse a value from AnyValue. If a type implements bothToAnyValueandFromAnyValuethen it must hold thatfromAnyValue (toAnyValue x) = Right xfor allx. instance FromAnyValue TimeLock instance FromAnyValue Bool instance FromAnyValue Decimal instance FromAnyValue Int instance FromAnyValue Text instance Template t => FromAnyValue (ContractId t) instance FromAnyValue Date instance FromAnyValue Party instance FromAnyValue Time instance FromAnyValue RelTime instance FromAnyValue ChoiceContext instance FromAnyValue a => FromAnyValue [a]
Orphan Typeclass Instances
instance Semigroup Metadata instance Monoid MetadataData Types
data TxKind
Internal type for the transaction kind.TxKind_TransferTxKind_UnlockTxKind_MergeSplitTxKind_BurnTxKind_MintTxKind_ExpireDustinstance Eq TxKind
Functions
splicePrefix
: Text
amuletPrefix
: Text
amuletInstrumentId
: Party -> InstrumentIdShared definition of the instrument-id used for amulets.
optionalMetadata
: Text -> (a -> Text) -> Optional a -> TextMap Text -> TextMap TextAdd an optional metadata entry.
nonZeroMetadata
: (Eq a, Additive a, Show a) => Text -> a -> TextMap Text -> TextMap TextAdd an metadata entry if it is non-zero number.
optionalNonZeroMetadata
: (Eq a, Additive a, Show a) => Text -> Optional a -> TextMap Text -> TextMap TextAdd an metadata entry for an optional value if it is non-zero number.
createdInRoundMetaKey
: Text
ratePerRoundMetaKey
: Text
svRewardAmountMetaKey
: Text
appRewardAmountMetaKey
: Text
unclaimedActivityRecordAmountMetaKey
: Text
validatorRewardAmountMetaKey
: Text
appRewardBeneficiariesMetaKey
: Text
appRewardBeneficiaryWeightsMetaKey
: Text
developmentFundAmountMetaKey
: Text
reasonMetaKey
: TextShort, human-readable reason for the transaction.
txKindMetaKey
: TextKind of the transaction.
senderMetaKey
: TextThe sender of a transfer.
burnedMetaKey
: TextThe amount of token holdings burned as part of a transaction.
holdingTxMeta
: TxKind -> Optional Text -> Optional Party -> Optional Decimal -> MetadataBuild the metadata for a transaction affecting the amulet holdings.
txKindToText
: TxKind -> TextExported for testing only
simpleHoldingTxMeta
: TxKind -> Optional Text -> Optional Decimal -> MetadataSimplified version for a few of the common cases.
externalPartyConfigStateContextKey
: Text
featuredAppRightContextKey
: Text
transferPreapprovalContextKey
: Text
lockContextKey
: TextThe key used to embed all the lock specification in the choice context.
lockExpiresAtContextKey
: Text
lockHoldersContextKey
: Text
lockContextContextKey
: TextThe context description of a lock.
expireLockKey
: TextKey used to signal to a choice whether an expired locked amulet should be unlocked.
addOptionalAnyValue
: ToAnyValue a => Text -> Optional a -> TextMap AnyValue -> TextMap AnyValueConvenience function to create maps that contain an optional value if it is set. See its use sites for examples.
lookupFromContext
: FromAnyValue a => ChoiceContext -> Text -> Either Text (Optional a)Lookup and decode a value within a choice context.
getFromContext
: FromAnyValue a => ChoiceContext -> Text -> Either Text aGet a value from a choice context, failing if it is not present or fails to parse.