/
asset.ts
107 lines (99 loc) · 5.6 KB
/
asset.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
import algosdk from 'algosdk'
import { AlgoAmount } from './amount'
import { SendTransactionFrom, SendTransactionParams, TransactionNote } from './transaction'
import SuggestedParams = algosdk.SuggestedParams
/** Parameters for `createAsset` call. */
export interface CreateAssetParams extends SendTransactionParams {
/** The account to create the asset.
*
* This account automatically is opted in to the asset and holds all units after creation. */
creator: SendTransactionFrom
/** The total number of base (decimal) units of the asset to create.
* If decimal is, say, 2, then for every 100 `total` there would be 1 whole unit.
* This field can only be specified upon asset creation.
*/
total: number | bigint
/** The number of digits to use after the decimal point when displaying the asset.
* If 0, the asset is not divisible.
* If 1, the base unit of the asset is in tenths.
* If 2, the base unit of the asset is in hundredths.
* If 3, the base unit of the asset is in thousandths, and so on up to 19 decimal places.
* This field can only be specified upon asset creation.
*/
decimals: number
/** The optional name of the asset. Max size if 32 bytes. This field can only be specified upon asset creation. */
name?: string
/** The optional name of the unit of this asset. Max size is 8 bytes. This field can only be specified upon asset creation. */
unit?: string
/** Specifies an optional URL where more information about the asset can be retrieved. Max size is 96 bytes.
* This field can only be specified upon asset creation.
*/
url?: string
/** This field is intended to be a 32-byte hash of some metadata that is relevant to your asset and/or asset holders.
* The format of this metadata is up to the application. This field can only be specified upon asset creation.
*/
metadataHash?: string | Uint8Array
/** The optional account that can manage the configuration of the asset and destroy it.
* If not set at asset creation or subsequently set to empty by the manager the asset becomes immutable.
*/
manager?: string | SendTransactionFrom
/** The optional account that holds the reserve (non-minted) units of the asset. This address has no specific authority in the protocol itself and is informational.
* Some standards like [ARC-19](https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0019.md) rely on this field to hold meaningful data.
* It is used in the case where you want to signal to holders of your asset that the non-minted units of the asset reside in an account that is different from the default creator account.
* If not set at asset creation or subsequently set to empty by the manager the field is permanently empty.
*/
reserveAccount?: string | SendTransactionFrom
/** The optional account that can be used to freeze holdings of this asset. If empty, freezing is not permitted.
* If not set at asset creation or subsequently set to empty by the manager the field is permanently empty.
*/
freezeAccount?: string | SendTransactionFrom
/** The optional account that can clawback holdings of this asset. If empty, clawback is not permitted.
* If not set at asset creation or subsequently set to empty by the manager the field is permanently empty.
*/
clawbackAccount?: string | SendTransactionFrom
/** Whether to freeze holdings for this asset by default. If `true` then for anyone apart from the creator to hold the asset it needs to be unfrozen per account using `freeze`. Defaults to `false`. */
frozenByDefault?: boolean
/** Optional transaction parameters */
transactionParams?: SuggestedParams
/** The (optional) transaction note */
note?: TransactionNote
/** An (optional) [transaction lease](https://developer.algorand.org/articles/leased-transactions-securing-advanced-smart-contract-design/) to apply */
lease?: string | Uint8Array
}
/** Parameters for `assetOptIn` call. */
export interface AssetOptInParams extends SendTransactionParams {
/** The account to opt in/out for */
account: SendTransactionFrom
/** The ID of the assets to opt in for / out of */
assetId: number
/** Optional transaction parameters */
transactionParams?: SuggestedParams
/** The (optional) transaction note */
note?: TransactionNote
/** An (optional) [transaction lease](https://developer.algorand.org/articles/leased-transactions-securing-advanced-smart-contract-design/) to apply */
lease?: string | Uint8Array
}
/** Parameters for `assetOptOut` call. */
export interface AssetOptOutParams extends AssetOptInParams {
/** The address of the creator account for the asset; if unspecified then it looks it up using algod */
assetCreatorAddress?: string
/** Whether or not to validate the account has a zero-balance before issuing the opt-out; default = true */
ensureZeroBalance?: boolean
}
/** Parameters for `assetBulkOptIn` / `assetBulkOptOut` call. */
export interface AssetBulkOptInOutParams {
/** The account to opt in/out for */
account: SendTransactionFrom
/** The IDs of the assets to opt in for / out of */
assetIds: number[]
/** Whether or not to validate the opt-in/out is valid before issuing transactions; default = true */
validateBalances?: boolean
/** Optional transaction parameters */
transactionParams?: SuggestedParams
/** The (optional) transaction note */
note?: TransactionNote
/** The maximum fee that you are happy to pay per transaction (default: unbounded) - if this is set it's possible the transaction could get rejected during network congestion */
maxFee?: AlgoAmount
/** Whether to suppress log messages from transaction send, default: do not suppress */
suppressLog?: boolean
}