Assets
export interface Assets {
add(other: Assets): Assets
addAssetClassQuantity(
assetClass: AssetClassLike,
qty: IntLike
): void
addPolicyTokenQuantity(
mph: MintingPolicyHashLike,
tokenName: BytesLike,
qty: IntLike
): void
addPolicyTokens(
mph: MintingPolicyHashLike,
tokens: [BytesLike, IntLike][]
): void
assertAllPositive(): void
assertSorted(): void
assetClasses: AssetClass<unknown>[]
assets: [MintingPolicyHash<unknown>, [number[], bigint][]][]
copy(): Assets
countTokens(): number
dump(): any
getAssetClassQuantity(assetClass: AssetClassLike): bigint
getPolicies(): MintingPolicyHash<unknown>[]
getPolicyTokenNames(policy: MintingPolicyHashLike): number[][]
getPolicyTokenQuantity(
mph: MintingPolicyHashLike,
tokenName: BytesLike
): bigint
getPolicyTokens(policy: MintingPolicyHashLike): [number[], bigint][]
hasAssetClass(assetClass: AssetClassLike): boolean
hasPolicyToken(
mph: MintingPolicyHashLike,
tokenName: BytesLike
): boolean
isAllPositive(): boolean
isEqual(other: Assets): boolean
isGreaterOrEqual(other: Assets): boolean
isGreaterThan(other: Assets): boolean
isZero(): boolean
kind: "Assets"
multiply(scalar: IntLike): Assets
normalize(): void
removeZeroes(): void
sort(shortestFirst?: boolean): void
subtract(other: Assets): Assets
toCbor(): number[]
toUplcData(isInScriptContext?: boolean): MapData
}
Represents a list of non-Ada tokens.
Properties
add
add(other: Assets): Assets
addAssetClassQuantity
addAssetClassQuantity(
assetClass: AssetClassLike,
qty: IntLike
): void
Mutates this
addPolicyTokenQuantity
addPolicyTokenQuantity(
mph: MintingPolicyHashLike,
tokenName: BytesLike,
qty: IntLike
): void
Mutates this
addPolicyTokens
addPolicyTokens(
mph: MintingPolicyHashLike,
tokens: [BytesLike, IntLike][]
): void
Mutates 'this'.
Throws error if mph is already contained in 'this'.
assertAllPositive
assertAllPositive(): void
assertSorted
assertSorted(): void
assetClasses
assetClasses: AssetClass<unknown>[]
assets
assets: [MintingPolicyHash<unknown>, [number[], bigint][]][]
copy
copy(): Assets
countTokens
countTokens(): number
dump
dump(): any
getAssetClassQuantity
getAssetClassQuantity(assetClass: AssetClassLike): bigint
Returns 0n if not found
getPolicies
getPolicies(): MintingPolicyHash<unknown>[]
Returns a list of all the minting policies.
getPolicyTokenNames
getPolicyTokenNames(policy: MintingPolicyHashLike): number[][]
Returns an empty list if the policy isn't found
getPolicyTokenQuantity
getPolicyTokenQuantity(
mph: MintingPolicyHashLike,
tokenName: BytesLike
): bigint
Returns 0n if not found
getPolicyTokens
getPolicyTokens(policy: MintingPolicyHashLike): [number[], bigint][]
Returns an empty list if the policy isn't found
hasAssetClass
hasAssetClass(assetClass: AssetClassLike): boolean
hasPolicyToken
hasPolicyToken(
mph: MintingPolicyHashLike,
tokenName: BytesLike
): boolean
isAllPositive
isAllPositive(): boolean
isEqual
isEqual(other: Assets): boolean
isGreaterOrEqual
isGreaterOrEqual(other: Assets): boolean
isGreaterThan
isGreaterThan(other: Assets): boolean
isZero
isZero(): boolean
kind
kind: "Assets"
multiply
multiply(scalar: IntLike): Assets
normalize
normalize(): void
removeZeroes
removeZeroes(): void
this
sort
sort(shortestFirst?: boolean): void
this
shortestFirst
If shortestFirst
is true
:
tokens are sorted in shortest-first order.
The shortest-first order (also called "canonical order") is required by some hardware wallets when calculating the tx hash. But the lexicographical order (i.e. alphabetical order independent of length) is used when evaluating a validator script.
subtract
subtract(other: Assets): Assets
toCbor
toCbor(): number[]
toUplcData
toUplcData(isInScriptContext?: boolean): MapData
Used when generating redeemers, datums or script contexts for running programs.
isInScriptContext
If isInScriptContext
is true
:
for each minting policy, tokens are sorted in strict lexicographical order instead of shortest-first order.
The shortest-first order (also called "canonical order") is required by some hardware wallets when calculating the tx hash. But the lexicographical order (i.e. alphabetical order independent of length) is used when evaluating a validator script.