@aptos-labs/ts-sdk 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +144 -0
- package/dist/browser/index.global.js +410 -0
- package/dist/browser/index.global.js.map +1 -0
- package/dist/cjs/index.d.ts +4965 -0
- package/dist/cjs/index.js +4762 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/esm/index.d.ts +4965 -0
- package/dist/esm/index.mjs +4645 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/types/index.d.ts +1247 -0
- package/dist/types/index.js +151 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +79 -0
- package/src/api/account.ts +360 -0
- package/src/api/aptos.ts +103 -0
- package/src/api/aptosConfig.ts +77 -0
- package/src/api/coin.ts +39 -0
- package/src/api/digitalAsset.ts +192 -0
- package/src/api/event.ts +78 -0
- package/src/api/faucet.ts +30 -0
- package/src/api/fungibleAsset.ts +82 -0
- package/src/api/general.ts +188 -0
- package/src/api/index.ts +5 -0
- package/src/api/staking.ts +58 -0
- package/src/api/transaction.ts +135 -0
- package/src/api/transactionSubmission.ts +168 -0
- package/src/bcs/consts.ts +12 -0
- package/src/bcs/deserializer.ts +248 -0
- package/src/bcs/index.ts +9 -0
- package/src/bcs/serializable/entryFunctionBytes.ts +61 -0
- package/src/bcs/serializable/fixedBytes.ts +65 -0
- package/src/bcs/serializable/movePrimitives.ts +211 -0
- package/src/bcs/serializable/moveStructs.ts +462 -0
- package/src/bcs/serializer.ts +353 -0
- package/src/client/core.ts +106 -0
- package/src/client/get.ts +109 -0
- package/src/client/index.ts +7 -0
- package/src/client/post.ts +90 -0
- package/src/client/types.ts +58 -0
- package/src/core/account.ts +180 -0
- package/src/core/accountAddress.ts +407 -0
- package/src/core/authenticationKey.ts +102 -0
- package/src/core/common.ts +40 -0
- package/src/core/crypto/asymmetricCrypto.ts +77 -0
- package/src/core/crypto/ed25519.ts +224 -0
- package/src/core/crypto/index.ts +7 -0
- package/src/core/crypto/multiEd25519.ts +251 -0
- package/src/core/crypto/secp256k1.ts +227 -0
- package/src/core/hex.ts +177 -0
- package/src/core/index.ts +9 -0
- package/src/index.ts +12 -0
- package/src/internal/account.ts +484 -0
- package/src/internal/coin.ts +32 -0
- package/src/internal/digitalAsset.ts +302 -0
- package/src/internal/event.ts +88 -0
- package/src/internal/faucet.ts +41 -0
- package/src/internal/fungibleAsset.ts +114 -0
- package/src/internal/general.ts +160 -0
- package/src/internal/queries/TokenActivitiesFieldsFragment.graphql +17 -0
- package/src/internal/queries/currentTokenOwnershipFieldsFragment.graphql +45 -0
- package/src/internal/queries/getAccountCoinCount.graphql +7 -0
- package/src/internal/queries/getAccountCoinsData.graphql +32 -0
- package/src/internal/queries/getAccountCollectionsWithOwnedTokens.graphql +33 -0
- package/src/internal/queries/getAccountOwnedObjects.graphql +16 -0
- package/src/internal/queries/getAccountOwnedTokens.graphql +11 -0
- package/src/internal/queries/getAccountOwnedTokensByTokenData.graphql +11 -0
- package/src/internal/queries/getAccountOwnedTokensFromCollectionAddress.graphql +11 -0
- package/src/internal/queries/getAccountTokensCount.graphql +7 -0
- package/src/internal/queries/getAccountTransactionsCount.graphql +7 -0
- package/src/internal/queries/getChainTopUserTransactions.graphql +5 -0
- package/src/internal/queries/getCollectionData.graphql +20 -0
- package/src/internal/queries/getCurrentFungibleAssetBalances.graphql +17 -0
- package/src/internal/queries/getDelegatedStakingActivities.graphql +12 -0
- package/src/internal/queries/getEvents.graphql +12 -0
- package/src/internal/queries/getFungibleAssetActivities.graphql +20 -0
- package/src/internal/queries/getFungibleAssetMetadata.graphql +16 -0
- package/src/internal/queries/getNumberOfDelegatorsQuery.graphql +9 -0
- package/src/internal/queries/getProcessorStatus.graphql +7 -0
- package/src/internal/queries/getTokenActivity.graphql +11 -0
- package/src/internal/queries/getTokenCurrentOwner.graphql +11 -0
- package/src/internal/queries/getTokenData.graphql +38 -0
- package/src/internal/staking.ts +68 -0
- package/src/internal/transaction.ts +245 -0
- package/src/internal/transactionSubmission.ts +162 -0
- package/src/transactions/authenticator/account.ts +121 -0
- package/src/transactions/authenticator/transaction.ts +222 -0
- package/src/transactions/instances/chainId.ts +26 -0
- package/src/transactions/instances/identifier.ts +28 -0
- package/src/transactions/instances/index.ts +9 -0
- package/src/transactions/instances/moduleId.ts +53 -0
- package/src/transactions/instances/rawTransaction.ts +199 -0
- package/src/transactions/instances/signedTransaction.ts +43 -0
- package/src/transactions/instances/transactionArgument.ts +37 -0
- package/src/transactions/instances/transactionPayload.ts +407 -0
- package/src/transactions/transaction_builder/transaction_builder.ts +541 -0
- package/src/transactions/typeTag/typeTag.ts +487 -0
- package/src/transactions/types.ts +262 -0
- package/src/types/codegen.yaml +33 -0
- package/src/types/generated/operations.ts +623 -0
- package/src/types/generated/queries.ts +737 -0
- package/src/types/generated/types.ts +10387 -0
- package/src/types/index.ts +944 -0
- package/src/types/indexer.ts +93 -0
- package/src/utils/apiEndpoints.ts +36 -0
- package/src/utils/const.ts +51 -0
- package/src/utils/hdKey.ts +113 -0
- package/src/utils/helpers.ts +12 -0
- package/src/utils/memoize.ts +68 -0
- package/src/version.ts +9 -0
|
@@ -0,0 +1,4965 @@
|
|
|
1
|
+
declare const NetworkToIndexerAPI: Record<string, string>;
|
|
2
|
+
declare const NetworkToNodeAPI: Record<string, string>;
|
|
3
|
+
declare const NetworkToFaucetAPI: Record<string, string>;
|
|
4
|
+
declare enum Network {
|
|
5
|
+
MAINNET = "mainnet",
|
|
6
|
+
TESTNET = "testnet",
|
|
7
|
+
DEVNET = "devnet",
|
|
8
|
+
LOCAL = "local",
|
|
9
|
+
CUSTOM = "custom"
|
|
10
|
+
}
|
|
11
|
+
declare const NetworkToChainId: Record<string, number>;
|
|
12
|
+
|
|
13
|
+
declare type Maybe<T> = T | null;
|
|
14
|
+
declare type InputMaybe<T> = Maybe<T>;
|
|
15
|
+
/** All built-in and custom scalars, mapped to their actual values */
|
|
16
|
+
declare type Scalars = {
|
|
17
|
+
ID: string;
|
|
18
|
+
String: string;
|
|
19
|
+
Boolean: boolean;
|
|
20
|
+
Int: number;
|
|
21
|
+
Float: number;
|
|
22
|
+
bigint: any;
|
|
23
|
+
jsonb: any;
|
|
24
|
+
numeric: any;
|
|
25
|
+
timestamp: any;
|
|
26
|
+
timestamptz: any;
|
|
27
|
+
};
|
|
28
|
+
/** Boolean expression to compare columns of type "Boolean". All fields are combined with logical 'AND'. */
|
|
29
|
+
declare type BooleanComparisonExp = {
|
|
30
|
+
_eq?: InputMaybe<Scalars["Boolean"]>;
|
|
31
|
+
_gt?: InputMaybe<Scalars["Boolean"]>;
|
|
32
|
+
_gte?: InputMaybe<Scalars["Boolean"]>;
|
|
33
|
+
_in?: InputMaybe<Array<Scalars["Boolean"]>>;
|
|
34
|
+
_is_null?: InputMaybe<Scalars["Boolean"]>;
|
|
35
|
+
_lt?: InputMaybe<Scalars["Boolean"]>;
|
|
36
|
+
_lte?: InputMaybe<Scalars["Boolean"]>;
|
|
37
|
+
_neq?: InputMaybe<Scalars["Boolean"]>;
|
|
38
|
+
_nin?: InputMaybe<Array<Scalars["Boolean"]>>;
|
|
39
|
+
};
|
|
40
|
+
/** Boolean expression to compare columns of type "Int". All fields are combined with logical 'AND'. */
|
|
41
|
+
declare type IntComparisonExp = {
|
|
42
|
+
_eq?: InputMaybe<Scalars["Int"]>;
|
|
43
|
+
_gt?: InputMaybe<Scalars["Int"]>;
|
|
44
|
+
_gte?: InputMaybe<Scalars["Int"]>;
|
|
45
|
+
_in?: InputMaybe<Array<Scalars["Int"]>>;
|
|
46
|
+
_is_null?: InputMaybe<Scalars["Boolean"]>;
|
|
47
|
+
_lt?: InputMaybe<Scalars["Int"]>;
|
|
48
|
+
_lte?: InputMaybe<Scalars["Int"]>;
|
|
49
|
+
_neq?: InputMaybe<Scalars["Int"]>;
|
|
50
|
+
_nin?: InputMaybe<Array<Scalars["Int"]>>;
|
|
51
|
+
};
|
|
52
|
+
/** Boolean expression to compare columns of type "String". All fields are combined with logical 'AND'. */
|
|
53
|
+
declare type StringComparisonExp = {
|
|
54
|
+
_eq?: InputMaybe<Scalars["String"]>;
|
|
55
|
+
_gt?: InputMaybe<Scalars["String"]>;
|
|
56
|
+
_gte?: InputMaybe<Scalars["String"]>;
|
|
57
|
+
/** does the column match the given case-insensitive pattern */
|
|
58
|
+
_ilike?: InputMaybe<Scalars["String"]>;
|
|
59
|
+
_in?: InputMaybe<Array<Scalars["String"]>>;
|
|
60
|
+
/** does the column match the given POSIX regular expression, case insensitive */
|
|
61
|
+
_iregex?: InputMaybe<Scalars["String"]>;
|
|
62
|
+
_is_null?: InputMaybe<Scalars["Boolean"]>;
|
|
63
|
+
/** does the column match the given pattern */
|
|
64
|
+
_like?: InputMaybe<Scalars["String"]>;
|
|
65
|
+
_lt?: InputMaybe<Scalars["String"]>;
|
|
66
|
+
_lte?: InputMaybe<Scalars["String"]>;
|
|
67
|
+
_neq?: InputMaybe<Scalars["String"]>;
|
|
68
|
+
/** does the column NOT match the given case-insensitive pattern */
|
|
69
|
+
_nilike?: InputMaybe<Scalars["String"]>;
|
|
70
|
+
_nin?: InputMaybe<Array<Scalars["String"]>>;
|
|
71
|
+
/** does the column NOT match the given POSIX regular expression, case insensitive */
|
|
72
|
+
_niregex?: InputMaybe<Scalars["String"]>;
|
|
73
|
+
/** does the column NOT match the given pattern */
|
|
74
|
+
_nlike?: InputMaybe<Scalars["String"]>;
|
|
75
|
+
/** does the column NOT match the given POSIX regular expression, case sensitive */
|
|
76
|
+
_nregex?: InputMaybe<Scalars["String"]>;
|
|
77
|
+
/** does the column NOT match the given SQL regular expression */
|
|
78
|
+
_nsimilar?: InputMaybe<Scalars["String"]>;
|
|
79
|
+
/** does the column match the given POSIX regular expression, case sensitive */
|
|
80
|
+
_regex?: InputMaybe<Scalars["String"]>;
|
|
81
|
+
/** does the column match the given SQL regular expression */
|
|
82
|
+
_similar?: InputMaybe<Scalars["String"]>;
|
|
83
|
+
};
|
|
84
|
+
/** Boolean expression to compare columns of type "bigint". All fields are combined with logical 'AND'. */
|
|
85
|
+
declare type BigintComparisonExp = {
|
|
86
|
+
_eq?: InputMaybe<Scalars["bigint"]>;
|
|
87
|
+
_gt?: InputMaybe<Scalars["bigint"]>;
|
|
88
|
+
_gte?: InputMaybe<Scalars["bigint"]>;
|
|
89
|
+
_in?: InputMaybe<Array<Scalars["bigint"]>>;
|
|
90
|
+
_is_null?: InputMaybe<Scalars["Boolean"]>;
|
|
91
|
+
_lt?: InputMaybe<Scalars["bigint"]>;
|
|
92
|
+
_lte?: InputMaybe<Scalars["bigint"]>;
|
|
93
|
+
_neq?: InputMaybe<Scalars["bigint"]>;
|
|
94
|
+
_nin?: InputMaybe<Array<Scalars["bigint"]>>;
|
|
95
|
+
};
|
|
96
|
+
/** Boolean expression to filter rows from the table "current_aptos_names". All fields are combined with a logical 'AND'. */
|
|
97
|
+
declare type CurrentAptosNamesBoolExp = {
|
|
98
|
+
_and?: InputMaybe<Array<CurrentAptosNamesBoolExp>>;
|
|
99
|
+
_not?: InputMaybe<CurrentAptosNamesBoolExp>;
|
|
100
|
+
_or?: InputMaybe<Array<CurrentAptosNamesBoolExp>>;
|
|
101
|
+
domain?: InputMaybe<StringComparisonExp>;
|
|
102
|
+
domain_with_suffix?: InputMaybe<StringComparisonExp>;
|
|
103
|
+
expiration_timestamp?: InputMaybe<TimestampComparisonExp>;
|
|
104
|
+
is_active?: InputMaybe<BooleanComparisonExp>;
|
|
105
|
+
is_domain_owner?: InputMaybe<CurrentAptosNamesBoolExp>;
|
|
106
|
+
is_primary?: InputMaybe<BooleanComparisonExp>;
|
|
107
|
+
last_transaction_version?: InputMaybe<BigintComparisonExp>;
|
|
108
|
+
owner_address?: InputMaybe<StringComparisonExp>;
|
|
109
|
+
registered_address?: InputMaybe<StringComparisonExp>;
|
|
110
|
+
subdomain?: InputMaybe<StringComparisonExp>;
|
|
111
|
+
token_name?: InputMaybe<StringComparisonExp>;
|
|
112
|
+
token_standard?: InputMaybe<StringComparisonExp>;
|
|
113
|
+
};
|
|
114
|
+
/** Boolean expression to filter rows from the table "current_fungible_asset_balances". All fields are combined with a logical 'AND'. */
|
|
115
|
+
declare type CurrentFungibleAssetBalancesBoolExp = {
|
|
116
|
+
_and?: InputMaybe<Array<CurrentFungibleAssetBalancesBoolExp>>;
|
|
117
|
+
_not?: InputMaybe<CurrentFungibleAssetBalancesBoolExp>;
|
|
118
|
+
_or?: InputMaybe<Array<CurrentFungibleAssetBalancesBoolExp>>;
|
|
119
|
+
amount?: InputMaybe<NumericComparisonExp>;
|
|
120
|
+
asset_type?: InputMaybe<StringComparisonExp>;
|
|
121
|
+
is_frozen?: InputMaybe<BooleanComparisonExp>;
|
|
122
|
+
is_primary?: InputMaybe<BooleanComparisonExp>;
|
|
123
|
+
last_transaction_timestamp?: InputMaybe<TimestampComparisonExp>;
|
|
124
|
+
last_transaction_version?: InputMaybe<BigintComparisonExp>;
|
|
125
|
+
metadata?: InputMaybe<FungibleAssetMetadataBoolExp>;
|
|
126
|
+
owner_address?: InputMaybe<StringComparisonExp>;
|
|
127
|
+
storage_id?: InputMaybe<StringComparisonExp>;
|
|
128
|
+
token_standard?: InputMaybe<StringComparisonExp>;
|
|
129
|
+
};
|
|
130
|
+
/** Boolean expression to filter rows from the table "events". All fields are combined with a logical 'AND'. */
|
|
131
|
+
declare type EventsBoolExp = {
|
|
132
|
+
_and?: InputMaybe<Array<EventsBoolExp>>;
|
|
133
|
+
_not?: InputMaybe<EventsBoolExp>;
|
|
134
|
+
_or?: InputMaybe<Array<EventsBoolExp>>;
|
|
135
|
+
account_address?: InputMaybe<StringComparisonExp>;
|
|
136
|
+
creation_number?: InputMaybe<BigintComparisonExp>;
|
|
137
|
+
data?: InputMaybe<JsonbComparisonExp>;
|
|
138
|
+
event_index?: InputMaybe<BigintComparisonExp>;
|
|
139
|
+
sequence_number?: InputMaybe<BigintComparisonExp>;
|
|
140
|
+
transaction_block_height?: InputMaybe<BigintComparisonExp>;
|
|
141
|
+
transaction_version?: InputMaybe<BigintComparisonExp>;
|
|
142
|
+
type?: InputMaybe<StringComparisonExp>;
|
|
143
|
+
};
|
|
144
|
+
/** Boolean expression to filter rows from the table "fungible_asset_activities". All fields are combined with a logical 'AND'. */
|
|
145
|
+
declare type FungibleAssetActivitiesBoolExp = {
|
|
146
|
+
_and?: InputMaybe<Array<FungibleAssetActivitiesBoolExp>>;
|
|
147
|
+
_not?: InputMaybe<FungibleAssetActivitiesBoolExp>;
|
|
148
|
+
_or?: InputMaybe<Array<FungibleAssetActivitiesBoolExp>>;
|
|
149
|
+
amount?: InputMaybe<NumericComparisonExp>;
|
|
150
|
+
asset_type?: InputMaybe<StringComparisonExp>;
|
|
151
|
+
block_height?: InputMaybe<BigintComparisonExp>;
|
|
152
|
+
entry_function_id_str?: InputMaybe<StringComparisonExp>;
|
|
153
|
+
event_index?: InputMaybe<BigintComparisonExp>;
|
|
154
|
+
gas_fee_payer_address?: InputMaybe<StringComparisonExp>;
|
|
155
|
+
is_frozen?: InputMaybe<BooleanComparisonExp>;
|
|
156
|
+
is_gas_fee?: InputMaybe<BooleanComparisonExp>;
|
|
157
|
+
is_transaction_success?: InputMaybe<BooleanComparisonExp>;
|
|
158
|
+
metadata?: InputMaybe<FungibleAssetMetadataBoolExp>;
|
|
159
|
+
owner_address?: InputMaybe<StringComparisonExp>;
|
|
160
|
+
owner_aptos_names?: InputMaybe<CurrentAptosNamesBoolExp>;
|
|
161
|
+
storage_id?: InputMaybe<StringComparisonExp>;
|
|
162
|
+
storage_refund_amount?: InputMaybe<NumericComparisonExp>;
|
|
163
|
+
token_standard?: InputMaybe<StringComparisonExp>;
|
|
164
|
+
transaction_timestamp?: InputMaybe<TimestampComparisonExp>;
|
|
165
|
+
transaction_version?: InputMaybe<BigintComparisonExp>;
|
|
166
|
+
type?: InputMaybe<StringComparisonExp>;
|
|
167
|
+
};
|
|
168
|
+
/** Boolean expression to filter rows from the table "fungible_asset_metadata". All fields are combined with a logical 'AND'. */
|
|
169
|
+
declare type FungibleAssetMetadataBoolExp = {
|
|
170
|
+
_and?: InputMaybe<Array<FungibleAssetMetadataBoolExp>>;
|
|
171
|
+
_not?: InputMaybe<FungibleAssetMetadataBoolExp>;
|
|
172
|
+
_or?: InputMaybe<Array<FungibleAssetMetadataBoolExp>>;
|
|
173
|
+
asset_type?: InputMaybe<StringComparisonExp>;
|
|
174
|
+
creator_address?: InputMaybe<StringComparisonExp>;
|
|
175
|
+
decimals?: InputMaybe<IntComparisonExp>;
|
|
176
|
+
icon_uri?: InputMaybe<StringComparisonExp>;
|
|
177
|
+
last_transaction_timestamp?: InputMaybe<TimestampComparisonExp>;
|
|
178
|
+
last_transaction_version?: InputMaybe<BigintComparisonExp>;
|
|
179
|
+
name?: InputMaybe<StringComparisonExp>;
|
|
180
|
+
project_uri?: InputMaybe<StringComparisonExp>;
|
|
181
|
+
supply_aggregator_table_handle_v1?: InputMaybe<StringComparisonExp>;
|
|
182
|
+
supply_aggregator_table_key_v1?: InputMaybe<StringComparisonExp>;
|
|
183
|
+
symbol?: InputMaybe<StringComparisonExp>;
|
|
184
|
+
token_standard?: InputMaybe<StringComparisonExp>;
|
|
185
|
+
};
|
|
186
|
+
declare type JsonbCastExp = {
|
|
187
|
+
String?: InputMaybe<StringComparisonExp>;
|
|
188
|
+
};
|
|
189
|
+
/** Boolean expression to compare columns of type "jsonb". All fields are combined with logical 'AND'. */
|
|
190
|
+
declare type JsonbComparisonExp = {
|
|
191
|
+
_cast?: InputMaybe<JsonbCastExp>;
|
|
192
|
+
/** is the column contained in the given json value */
|
|
193
|
+
_contained_in?: InputMaybe<Scalars["jsonb"]>;
|
|
194
|
+
/** does the column contain the given json value at the top level */
|
|
195
|
+
_contains?: InputMaybe<Scalars["jsonb"]>;
|
|
196
|
+
_eq?: InputMaybe<Scalars["jsonb"]>;
|
|
197
|
+
_gt?: InputMaybe<Scalars["jsonb"]>;
|
|
198
|
+
_gte?: InputMaybe<Scalars["jsonb"]>;
|
|
199
|
+
/** does the string exist as a top-level key in the column */
|
|
200
|
+
_has_key?: InputMaybe<Scalars["String"]>;
|
|
201
|
+
/** do all of these strings exist as top-level keys in the column */
|
|
202
|
+
_has_keys_all?: InputMaybe<Array<Scalars["String"]>>;
|
|
203
|
+
/** do any of these strings exist as top-level keys in the column */
|
|
204
|
+
_has_keys_any?: InputMaybe<Array<Scalars["String"]>>;
|
|
205
|
+
_in?: InputMaybe<Array<Scalars["jsonb"]>>;
|
|
206
|
+
_is_null?: InputMaybe<Scalars["Boolean"]>;
|
|
207
|
+
_lt?: InputMaybe<Scalars["jsonb"]>;
|
|
208
|
+
_lte?: InputMaybe<Scalars["jsonb"]>;
|
|
209
|
+
_neq?: InputMaybe<Scalars["jsonb"]>;
|
|
210
|
+
_nin?: InputMaybe<Array<Scalars["jsonb"]>>;
|
|
211
|
+
};
|
|
212
|
+
/** Boolean expression to compare columns of type "numeric". All fields are combined with logical 'AND'. */
|
|
213
|
+
declare type NumericComparisonExp = {
|
|
214
|
+
_eq?: InputMaybe<Scalars["numeric"]>;
|
|
215
|
+
_gt?: InputMaybe<Scalars["numeric"]>;
|
|
216
|
+
_gte?: InputMaybe<Scalars["numeric"]>;
|
|
217
|
+
_in?: InputMaybe<Array<Scalars["numeric"]>>;
|
|
218
|
+
_is_null?: InputMaybe<Scalars["Boolean"]>;
|
|
219
|
+
_lt?: InputMaybe<Scalars["numeric"]>;
|
|
220
|
+
_lte?: InputMaybe<Scalars["numeric"]>;
|
|
221
|
+
_neq?: InputMaybe<Scalars["numeric"]>;
|
|
222
|
+
_nin?: InputMaybe<Array<Scalars["numeric"]>>;
|
|
223
|
+
};
|
|
224
|
+
/** Boolean expression to compare columns of type "timestamp". All fields are combined with logical 'AND'. */
|
|
225
|
+
declare type TimestampComparisonExp = {
|
|
226
|
+
_eq?: InputMaybe<Scalars["timestamp"]>;
|
|
227
|
+
_gt?: InputMaybe<Scalars["timestamp"]>;
|
|
228
|
+
_gte?: InputMaybe<Scalars["timestamp"]>;
|
|
229
|
+
_in?: InputMaybe<Array<Scalars["timestamp"]>>;
|
|
230
|
+
_is_null?: InputMaybe<Scalars["Boolean"]>;
|
|
231
|
+
_lt?: InputMaybe<Scalars["timestamp"]>;
|
|
232
|
+
_lte?: InputMaybe<Scalars["timestamp"]>;
|
|
233
|
+
_neq?: InputMaybe<Scalars["timestamp"]>;
|
|
234
|
+
_nin?: InputMaybe<Array<Scalars["timestamp"]>>;
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
declare type GetAccountCoinsDataQuery = {
|
|
238
|
+
current_fungible_asset_balances: Array<{
|
|
239
|
+
amount: any;
|
|
240
|
+
asset_type: string;
|
|
241
|
+
is_frozen: boolean;
|
|
242
|
+
is_primary: boolean;
|
|
243
|
+
last_transaction_timestamp: any;
|
|
244
|
+
last_transaction_version: any;
|
|
245
|
+
owner_address: string;
|
|
246
|
+
storage_id: string;
|
|
247
|
+
token_standard: string;
|
|
248
|
+
metadata?: {
|
|
249
|
+
token_standard: string;
|
|
250
|
+
symbol: string;
|
|
251
|
+
supply_aggregator_table_key_v1?: string | null;
|
|
252
|
+
supply_aggregator_table_handle_v1?: string | null;
|
|
253
|
+
project_uri?: string | null;
|
|
254
|
+
name: string;
|
|
255
|
+
last_transaction_version: any;
|
|
256
|
+
last_transaction_timestamp: any;
|
|
257
|
+
icon_uri?: string | null;
|
|
258
|
+
decimals: number;
|
|
259
|
+
creator_address: string;
|
|
260
|
+
asset_type: string;
|
|
261
|
+
} | null;
|
|
262
|
+
}>;
|
|
263
|
+
};
|
|
264
|
+
declare type GetAccountCollectionsWithOwnedTokensQuery = {
|
|
265
|
+
current_collection_ownership_v2_view: Array<{
|
|
266
|
+
collection_id?: string | null;
|
|
267
|
+
collection_name?: string | null;
|
|
268
|
+
collection_uri?: string | null;
|
|
269
|
+
creator_address?: string | null;
|
|
270
|
+
distinct_tokens?: any | null;
|
|
271
|
+
last_transaction_version?: any | null;
|
|
272
|
+
owner_address?: string | null;
|
|
273
|
+
single_token_uri?: string | null;
|
|
274
|
+
current_collection?: {
|
|
275
|
+
collection_id: string;
|
|
276
|
+
collection_name: string;
|
|
277
|
+
creator_address: string;
|
|
278
|
+
current_supply: any;
|
|
279
|
+
description: string;
|
|
280
|
+
last_transaction_timestamp: any;
|
|
281
|
+
last_transaction_version: any;
|
|
282
|
+
mutable_description?: boolean | null;
|
|
283
|
+
max_supply?: any | null;
|
|
284
|
+
mutable_uri?: boolean | null;
|
|
285
|
+
table_handle_v1?: string | null;
|
|
286
|
+
token_standard: string;
|
|
287
|
+
total_minted_v2?: any | null;
|
|
288
|
+
uri: string;
|
|
289
|
+
} | null;
|
|
290
|
+
}>;
|
|
291
|
+
};
|
|
292
|
+
declare type GetAccountOwnedObjectsQuery = {
|
|
293
|
+
current_objects: Array<{
|
|
294
|
+
allow_ungated_transfer: boolean;
|
|
295
|
+
state_key_hash: string;
|
|
296
|
+
owner_address: string;
|
|
297
|
+
object_address: string;
|
|
298
|
+
last_transaction_version: any;
|
|
299
|
+
last_guid_creation_num: any;
|
|
300
|
+
is_deleted: boolean;
|
|
301
|
+
}>;
|
|
302
|
+
};
|
|
303
|
+
declare type GetAccountOwnedTokensQuery = {
|
|
304
|
+
current_token_ownerships_v2: Array<{
|
|
305
|
+
token_standard: string;
|
|
306
|
+
token_properties_mutated_v1?: any | null;
|
|
307
|
+
token_data_id: string;
|
|
308
|
+
table_type_v1?: string | null;
|
|
309
|
+
storage_id: string;
|
|
310
|
+
property_version_v1: any;
|
|
311
|
+
owner_address: string;
|
|
312
|
+
last_transaction_version: any;
|
|
313
|
+
last_transaction_timestamp: any;
|
|
314
|
+
is_soulbound_v2?: boolean | null;
|
|
315
|
+
is_fungible_v2?: boolean | null;
|
|
316
|
+
amount: any;
|
|
317
|
+
current_token_data?: {
|
|
318
|
+
collection_id: string;
|
|
319
|
+
description: string;
|
|
320
|
+
is_fungible_v2?: boolean | null;
|
|
321
|
+
largest_property_version_v1?: any | null;
|
|
322
|
+
last_transaction_timestamp: any;
|
|
323
|
+
last_transaction_version: any;
|
|
324
|
+
maximum?: any | null;
|
|
325
|
+
supply: any;
|
|
326
|
+
token_data_id: string;
|
|
327
|
+
token_name: string;
|
|
328
|
+
token_properties: any;
|
|
329
|
+
token_standard: string;
|
|
330
|
+
token_uri: string;
|
|
331
|
+
current_collection?: {
|
|
332
|
+
collection_id: string;
|
|
333
|
+
collection_name: string;
|
|
334
|
+
creator_address: string;
|
|
335
|
+
current_supply: any;
|
|
336
|
+
description: string;
|
|
337
|
+
last_transaction_timestamp: any;
|
|
338
|
+
last_transaction_version: any;
|
|
339
|
+
max_supply?: any | null;
|
|
340
|
+
mutable_description?: boolean | null;
|
|
341
|
+
mutable_uri?: boolean | null;
|
|
342
|
+
table_handle_v1?: string | null;
|
|
343
|
+
token_standard: string;
|
|
344
|
+
total_minted_v2?: any | null;
|
|
345
|
+
uri: string;
|
|
346
|
+
} | null;
|
|
347
|
+
} | null;
|
|
348
|
+
}>;
|
|
349
|
+
};
|
|
350
|
+
declare type GetAccountOwnedTokensFromCollectionQuery = {
|
|
351
|
+
current_token_ownerships_v2: Array<{
|
|
352
|
+
token_standard: string;
|
|
353
|
+
token_properties_mutated_v1?: any | null;
|
|
354
|
+
token_data_id: string;
|
|
355
|
+
table_type_v1?: string | null;
|
|
356
|
+
storage_id: string;
|
|
357
|
+
property_version_v1: any;
|
|
358
|
+
owner_address: string;
|
|
359
|
+
last_transaction_version: any;
|
|
360
|
+
last_transaction_timestamp: any;
|
|
361
|
+
is_soulbound_v2?: boolean | null;
|
|
362
|
+
is_fungible_v2?: boolean | null;
|
|
363
|
+
amount: any;
|
|
364
|
+
current_token_data?: {
|
|
365
|
+
collection_id: string;
|
|
366
|
+
description: string;
|
|
367
|
+
is_fungible_v2?: boolean | null;
|
|
368
|
+
largest_property_version_v1?: any | null;
|
|
369
|
+
last_transaction_timestamp: any;
|
|
370
|
+
last_transaction_version: any;
|
|
371
|
+
maximum?: any | null;
|
|
372
|
+
supply: any;
|
|
373
|
+
token_data_id: string;
|
|
374
|
+
token_name: string;
|
|
375
|
+
token_properties: any;
|
|
376
|
+
token_standard: string;
|
|
377
|
+
token_uri: string;
|
|
378
|
+
current_collection?: {
|
|
379
|
+
collection_id: string;
|
|
380
|
+
collection_name: string;
|
|
381
|
+
creator_address: string;
|
|
382
|
+
current_supply: any;
|
|
383
|
+
description: string;
|
|
384
|
+
last_transaction_timestamp: any;
|
|
385
|
+
last_transaction_version: any;
|
|
386
|
+
max_supply?: any | null;
|
|
387
|
+
mutable_description?: boolean | null;
|
|
388
|
+
mutable_uri?: boolean | null;
|
|
389
|
+
table_handle_v1?: string | null;
|
|
390
|
+
token_standard: string;
|
|
391
|
+
total_minted_v2?: any | null;
|
|
392
|
+
uri: string;
|
|
393
|
+
} | null;
|
|
394
|
+
} | null;
|
|
395
|
+
}>;
|
|
396
|
+
};
|
|
397
|
+
declare type GetChainTopUserTransactionsQuery = {
|
|
398
|
+
user_transactions: Array<{
|
|
399
|
+
version: any;
|
|
400
|
+
}>;
|
|
401
|
+
};
|
|
402
|
+
declare type GetCollectionDataQuery = {
|
|
403
|
+
current_collections_v2: Array<{
|
|
404
|
+
collection_id: string;
|
|
405
|
+
collection_name: string;
|
|
406
|
+
creator_address: string;
|
|
407
|
+
current_supply: any;
|
|
408
|
+
description: string;
|
|
409
|
+
last_transaction_timestamp: any;
|
|
410
|
+
last_transaction_version: any;
|
|
411
|
+
max_supply?: any | null;
|
|
412
|
+
mutable_description?: boolean | null;
|
|
413
|
+
mutable_uri?: boolean | null;
|
|
414
|
+
table_handle_v1?: string | null;
|
|
415
|
+
token_standard: string;
|
|
416
|
+
total_minted_v2?: any | null;
|
|
417
|
+
uri: string;
|
|
418
|
+
}>;
|
|
419
|
+
};
|
|
420
|
+
declare type GetCurrentFungibleAssetBalancesQuery = {
|
|
421
|
+
current_fungible_asset_balances: Array<{
|
|
422
|
+
amount: any;
|
|
423
|
+
asset_type: string;
|
|
424
|
+
is_frozen: boolean;
|
|
425
|
+
is_primary: boolean;
|
|
426
|
+
last_transaction_timestamp: any;
|
|
427
|
+
last_transaction_version: any;
|
|
428
|
+
owner_address: string;
|
|
429
|
+
storage_id: string;
|
|
430
|
+
token_standard: string;
|
|
431
|
+
}>;
|
|
432
|
+
};
|
|
433
|
+
declare type GetDelegatedStakingActivitiesQuery = {
|
|
434
|
+
delegated_staking_activities: Array<{
|
|
435
|
+
amount: any;
|
|
436
|
+
delegator_address: string;
|
|
437
|
+
event_index: any;
|
|
438
|
+
event_type: string;
|
|
439
|
+
pool_address: string;
|
|
440
|
+
transaction_version: any;
|
|
441
|
+
}>;
|
|
442
|
+
};
|
|
443
|
+
declare type GetEventsQuery = {
|
|
444
|
+
events: Array<{
|
|
445
|
+
account_address: string;
|
|
446
|
+
creation_number: any;
|
|
447
|
+
data: any;
|
|
448
|
+
event_index: any;
|
|
449
|
+
sequence_number: any;
|
|
450
|
+
transaction_block_height: any;
|
|
451
|
+
transaction_version: any;
|
|
452
|
+
type: string;
|
|
453
|
+
}>;
|
|
454
|
+
};
|
|
455
|
+
declare type GetFungibleAssetActivitiesQuery = {
|
|
456
|
+
fungible_asset_activities: Array<{
|
|
457
|
+
amount?: any | null;
|
|
458
|
+
asset_type: string;
|
|
459
|
+
block_height: any;
|
|
460
|
+
entry_function_id_str?: string | null;
|
|
461
|
+
event_index: any;
|
|
462
|
+
gas_fee_payer_address?: string | null;
|
|
463
|
+
is_frozen?: boolean | null;
|
|
464
|
+
is_gas_fee: boolean;
|
|
465
|
+
is_transaction_success: boolean;
|
|
466
|
+
owner_address: string;
|
|
467
|
+
storage_id: string;
|
|
468
|
+
storage_refund_amount: any;
|
|
469
|
+
token_standard: string;
|
|
470
|
+
transaction_timestamp: any;
|
|
471
|
+
transaction_version: any;
|
|
472
|
+
type: string;
|
|
473
|
+
}>;
|
|
474
|
+
};
|
|
475
|
+
declare type GetFungibleAssetMetadataQuery = {
|
|
476
|
+
fungible_asset_metadata: Array<{
|
|
477
|
+
icon_uri?: string | null;
|
|
478
|
+
project_uri?: string | null;
|
|
479
|
+
supply_aggregator_table_handle_v1?: string | null;
|
|
480
|
+
supply_aggregator_table_key_v1?: string | null;
|
|
481
|
+
creator_address: string;
|
|
482
|
+
asset_type: string;
|
|
483
|
+
decimals: number;
|
|
484
|
+
last_transaction_timestamp: any;
|
|
485
|
+
last_transaction_version: any;
|
|
486
|
+
name: string;
|
|
487
|
+
symbol: string;
|
|
488
|
+
token_standard: string;
|
|
489
|
+
}>;
|
|
490
|
+
};
|
|
491
|
+
declare type GetNumberOfDelegatorsQuery = {
|
|
492
|
+
num_active_delegator_per_pool: Array<{
|
|
493
|
+
num_active_delegator?: any | null;
|
|
494
|
+
pool_address?: string | null;
|
|
495
|
+
}>;
|
|
496
|
+
};
|
|
497
|
+
declare type GetProcessorStatusQuery = {
|
|
498
|
+
processor_status: Array<{
|
|
499
|
+
last_success_version: any;
|
|
500
|
+
processor: string;
|
|
501
|
+
last_updated: any;
|
|
502
|
+
}>;
|
|
503
|
+
};
|
|
504
|
+
declare type GetTokenActivityQuery = {
|
|
505
|
+
token_activities_v2: Array<{
|
|
506
|
+
after_value?: string | null;
|
|
507
|
+
before_value?: string | null;
|
|
508
|
+
entry_function_id_str?: string | null;
|
|
509
|
+
event_account_address: string;
|
|
510
|
+
event_index: any;
|
|
511
|
+
from_address?: string | null;
|
|
512
|
+
is_fungible_v2?: boolean | null;
|
|
513
|
+
property_version_v1: any;
|
|
514
|
+
to_address?: string | null;
|
|
515
|
+
token_amount: any;
|
|
516
|
+
token_data_id: string;
|
|
517
|
+
token_standard: string;
|
|
518
|
+
transaction_timestamp: any;
|
|
519
|
+
transaction_version: any;
|
|
520
|
+
type: string;
|
|
521
|
+
}>;
|
|
522
|
+
};
|
|
523
|
+
declare type GetCurrentTokenOwnershipQuery = {
|
|
524
|
+
current_token_ownerships_v2: Array<{
|
|
525
|
+
token_standard: string;
|
|
526
|
+
token_properties_mutated_v1?: any | null;
|
|
527
|
+
token_data_id: string;
|
|
528
|
+
table_type_v1?: string | null;
|
|
529
|
+
storage_id: string;
|
|
530
|
+
property_version_v1: any;
|
|
531
|
+
owner_address: string;
|
|
532
|
+
last_transaction_version: any;
|
|
533
|
+
last_transaction_timestamp: any;
|
|
534
|
+
is_soulbound_v2?: boolean | null;
|
|
535
|
+
is_fungible_v2?: boolean | null;
|
|
536
|
+
amount: any;
|
|
537
|
+
current_token_data?: {
|
|
538
|
+
collection_id: string;
|
|
539
|
+
description: string;
|
|
540
|
+
is_fungible_v2?: boolean | null;
|
|
541
|
+
largest_property_version_v1?: any | null;
|
|
542
|
+
last_transaction_timestamp: any;
|
|
543
|
+
last_transaction_version: any;
|
|
544
|
+
maximum?: any | null;
|
|
545
|
+
supply: any;
|
|
546
|
+
token_data_id: string;
|
|
547
|
+
token_name: string;
|
|
548
|
+
token_properties: any;
|
|
549
|
+
token_standard: string;
|
|
550
|
+
token_uri: string;
|
|
551
|
+
current_collection?: {
|
|
552
|
+
collection_id: string;
|
|
553
|
+
collection_name: string;
|
|
554
|
+
creator_address: string;
|
|
555
|
+
current_supply: any;
|
|
556
|
+
description: string;
|
|
557
|
+
last_transaction_timestamp: any;
|
|
558
|
+
last_transaction_version: any;
|
|
559
|
+
max_supply?: any | null;
|
|
560
|
+
mutable_description?: boolean | null;
|
|
561
|
+
mutable_uri?: boolean | null;
|
|
562
|
+
table_handle_v1?: string | null;
|
|
563
|
+
token_standard: string;
|
|
564
|
+
total_minted_v2?: any | null;
|
|
565
|
+
uri: string;
|
|
566
|
+
} | null;
|
|
567
|
+
} | null;
|
|
568
|
+
}>;
|
|
569
|
+
};
|
|
570
|
+
declare type GetTokenDataQuery = {
|
|
571
|
+
current_token_datas_v2: Array<{
|
|
572
|
+
collection_id: string;
|
|
573
|
+
description: string;
|
|
574
|
+
is_fungible_v2?: boolean | null;
|
|
575
|
+
largest_property_version_v1?: any | null;
|
|
576
|
+
last_transaction_timestamp: any;
|
|
577
|
+
last_transaction_version: any;
|
|
578
|
+
maximum?: any | null;
|
|
579
|
+
supply: any;
|
|
580
|
+
token_data_id: string;
|
|
581
|
+
token_name: string;
|
|
582
|
+
token_properties: any;
|
|
583
|
+
token_standard: string;
|
|
584
|
+
token_uri: string;
|
|
585
|
+
current_collection?: {
|
|
586
|
+
collection_id: string;
|
|
587
|
+
collection_name: string;
|
|
588
|
+
creator_address: string;
|
|
589
|
+
current_supply: any;
|
|
590
|
+
description: string;
|
|
591
|
+
last_transaction_timestamp: any;
|
|
592
|
+
last_transaction_version: any;
|
|
593
|
+
max_supply?: any | null;
|
|
594
|
+
mutable_description?: boolean | null;
|
|
595
|
+
mutable_uri?: boolean | null;
|
|
596
|
+
table_handle_v1?: string | null;
|
|
597
|
+
token_standard: string;
|
|
598
|
+
total_minted_v2?: any | null;
|
|
599
|
+
uri: string;
|
|
600
|
+
} | null;
|
|
601
|
+
}>;
|
|
602
|
+
};
|
|
603
|
+
|
|
604
|
+
/**
|
|
605
|
+
* GENERATED QUERY TYPES FROM GRAPHQL SCHEMA
|
|
606
|
+
*
|
|
607
|
+
* generated types we generate from graphql schema that match the structure of the
|
|
608
|
+
* response type when querying from Hasura schema.
|
|
609
|
+
*
|
|
610
|
+
* These types are used as the return type when making the actual request (usually
|
|
611
|
+
* under the /internal/ folder)
|
|
612
|
+
*/
|
|
613
|
+
|
|
614
|
+
/**
|
|
615
|
+
* CUSTOM RESPONSE TYPES FOR THE END USER
|
|
616
|
+
*
|
|
617
|
+
* To provide a good dev exp, we build custom types derived from the
|
|
618
|
+
* query types to be the response type the end developer/user will
|
|
619
|
+
* work with.
|
|
620
|
+
*
|
|
621
|
+
* These types are used as the return type when calling a sdk api function
|
|
622
|
+
* that calls the function that queries the server (usually under the /api/ folder)
|
|
623
|
+
*/
|
|
624
|
+
declare type GetAccountOwnedObjectsResponse = GetAccountOwnedObjectsQuery["current_objects"];
|
|
625
|
+
declare type GetAccountOwnedTokensQueryResponse = GetAccountOwnedTokensQuery["current_token_ownerships_v2"];
|
|
626
|
+
declare type GetAccountOwnedTokensFromCollectionResponse = GetAccountOwnedTokensFromCollectionQuery["current_token_ownerships_v2"];
|
|
627
|
+
declare type GetAccountCollectionsWithOwnedTokenResponse = GetAccountCollectionsWithOwnedTokensQuery["current_collection_ownership_v2_view"];
|
|
628
|
+
declare type GetAccountCoinsDataResponse = GetAccountCoinsDataQuery["current_fungible_asset_balances"];
|
|
629
|
+
declare type GetChainTopUserTransactionsResponse = GetChainTopUserTransactionsQuery["user_transactions"];
|
|
630
|
+
declare type GetEventsResponse = GetEventsQuery["events"];
|
|
631
|
+
declare type GetNumberOfDelegatorsResponse = GetNumberOfDelegatorsQuery["num_active_delegator_per_pool"];
|
|
632
|
+
declare type GetDelegatedStakingActivitiesResponse = GetDelegatedStakingActivitiesQuery["delegated_staking_activities"];
|
|
633
|
+
declare type GetCollectionDataResponse = GetCollectionDataQuery["current_collections_v2"][0];
|
|
634
|
+
declare type GetTokenDataResponse = GetTokenDataQuery["current_token_datas_v2"][0];
|
|
635
|
+
declare type GetProcessorStatusResponse = GetProcessorStatusQuery["processor_status"];
|
|
636
|
+
declare type GetFungibleAssetMetadataResponse = GetFungibleAssetMetadataQuery["fungible_asset_metadata"];
|
|
637
|
+
declare type GetFungibleAssetActivitiesResponse = GetFungibleAssetActivitiesQuery["fungible_asset_activities"];
|
|
638
|
+
declare type GetCurrentFungibleAssetBalancesResponse = GetCurrentFungibleAssetBalancesQuery["current_fungible_asset_balances"];
|
|
639
|
+
declare type GetTokenActivityResponse = GetTokenActivityQuery["token_activities_v2"];
|
|
640
|
+
declare type GetCurrentTokenOwnershipResponse = GetCurrentTokenOwnershipQuery["current_token_ownerships_v2"][0];
|
|
641
|
+
declare type GetOwnedTokensResponse = GetCurrentTokenOwnershipQuery["current_token_ownerships_v2"];
|
|
642
|
+
/**
|
|
643
|
+
* A generic type that being passed by each function and holds an
|
|
644
|
+
* array of properties we can sort the query by
|
|
645
|
+
*/
|
|
646
|
+
declare type OrderBy<T> = Array<{
|
|
647
|
+
[K in keyof T]?: OrderByValue;
|
|
648
|
+
}>;
|
|
649
|
+
declare type OrderByValue = "asc" | "asc_nulls_first" | "asc_nulls_last" | "desc" | "desc_nulls_first" | "desc_nulls_last";
|
|
650
|
+
/**
|
|
651
|
+
* Refers to the token standard we want to query for
|
|
652
|
+
*/
|
|
653
|
+
declare type TokenStandard = "v1" | "v2";
|
|
654
|
+
/**
|
|
655
|
+
* The graphql query type to pass into the `queryIndexer` function
|
|
656
|
+
*/
|
|
657
|
+
declare type GraphqlQuery = {
|
|
658
|
+
query: string;
|
|
659
|
+
variables?: {};
|
|
660
|
+
};
|
|
661
|
+
|
|
662
|
+
declare enum MimeType {
|
|
663
|
+
/**
|
|
664
|
+
* JSON representation, used for transaction submission and accept type JSON output
|
|
665
|
+
*/
|
|
666
|
+
JSON = "application/json",
|
|
667
|
+
/**
|
|
668
|
+
* BCS representation, used for accept type BCS output
|
|
669
|
+
*/
|
|
670
|
+
BCS = "application/x-bcs",
|
|
671
|
+
/**
|
|
672
|
+
* BCS representation, used for transaction submission in BCS input
|
|
673
|
+
*/
|
|
674
|
+
BCS_SIGNED_TRANSACTION = "application/x.aptos.signed_transaction+bcs"
|
|
675
|
+
}
|
|
676
|
+
/**
|
|
677
|
+
* Hex data as input to a function
|
|
678
|
+
*/
|
|
679
|
+
declare type HexInput = string | Uint8Array;
|
|
680
|
+
/**
|
|
681
|
+
* Script transaction arguments enum as they are represented in Rust
|
|
682
|
+
* {@link https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/move-core/types/src/language_storage.rs#L27}
|
|
683
|
+
*/
|
|
684
|
+
declare enum TypeTagVariants {
|
|
685
|
+
Bool = 0,
|
|
686
|
+
U8 = 1,
|
|
687
|
+
U64 = 2,
|
|
688
|
+
U128 = 3,
|
|
689
|
+
Address = 4,
|
|
690
|
+
Signer = 5,
|
|
691
|
+
Vector = 6,
|
|
692
|
+
Struct = 7,
|
|
693
|
+
U16 = 8,
|
|
694
|
+
U32 = 9,
|
|
695
|
+
U256 = 10
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* Script transaction arguments enum as they are represented in Rust
|
|
699
|
+
* {@link https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/move-core/types/src/transaction_argument.rs#L11}
|
|
700
|
+
*/
|
|
701
|
+
declare enum ScriptTransactionArgumentVariants {
|
|
702
|
+
U8 = 0,
|
|
703
|
+
U64 = 1,
|
|
704
|
+
U128 = 2,
|
|
705
|
+
Address = 3,
|
|
706
|
+
U8Vector = 4,
|
|
707
|
+
Bool = 5,
|
|
708
|
+
U16 = 6,
|
|
709
|
+
U32 = 7,
|
|
710
|
+
U256 = 8
|
|
711
|
+
}
|
|
712
|
+
/**
|
|
713
|
+
* Transaction payload enum as they are represented in Rust
|
|
714
|
+
* {@link https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/mod.rs#L478}
|
|
715
|
+
*/
|
|
716
|
+
declare enum TransactionPayloadVariants {
|
|
717
|
+
Script = 0,
|
|
718
|
+
EntryFunction = 2,
|
|
719
|
+
Multisig = 3
|
|
720
|
+
}
|
|
721
|
+
/**
|
|
722
|
+
* Transaction variants enum as they are represented in Rust
|
|
723
|
+
* {@link https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/mod.rs#L440}
|
|
724
|
+
*/
|
|
725
|
+
declare enum TransactionVariants {
|
|
726
|
+
MultiAgentTransaction = 0,
|
|
727
|
+
FeePayerTransaction = 1
|
|
728
|
+
}
|
|
729
|
+
/**
|
|
730
|
+
* Transaction Authenticator enum as they are represented in Rust
|
|
731
|
+
* {@link https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/authenticator.rs#L44}
|
|
732
|
+
*/
|
|
733
|
+
declare enum TransactionAuthenticatorVariant {
|
|
734
|
+
Ed25519 = 0,
|
|
735
|
+
MultiEd25519 = 1,
|
|
736
|
+
MultiAgent = 2,
|
|
737
|
+
FeePayer = 3,
|
|
738
|
+
Secp256k1Ecdsa = 4
|
|
739
|
+
}
|
|
740
|
+
/**
|
|
741
|
+
* Transaction Authenticator enum as they are represented in Rust
|
|
742
|
+
* {@link https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/authenticator.rs#L414}
|
|
743
|
+
*/
|
|
744
|
+
declare enum AccountAuthenticatorVariant {
|
|
745
|
+
Ed25519 = 0,
|
|
746
|
+
MultiEd25519 = 1,
|
|
747
|
+
Secp256k1 = 2
|
|
748
|
+
}
|
|
749
|
+
/**
|
|
750
|
+
* BCS types
|
|
751
|
+
*/
|
|
752
|
+
declare type Uint8 = number;
|
|
753
|
+
declare type Uint16 = number;
|
|
754
|
+
declare type Uint32 = number;
|
|
755
|
+
declare type Uint64 = bigint;
|
|
756
|
+
declare type Uint128 = bigint;
|
|
757
|
+
declare type Uint256 = bigint;
|
|
758
|
+
declare type AnyNumber = number | bigint;
|
|
759
|
+
/**
|
|
760
|
+
* Set of configuration options that can be provided when initializing the SDK.
|
|
761
|
+
* The purpose of these options is to configure various aspects of the SDK's
|
|
762
|
+
* behavior and interaction with the Aptos network
|
|
763
|
+
*/
|
|
764
|
+
declare type AptosSettings = {
|
|
765
|
+
readonly network: Network;
|
|
766
|
+
readonly fullnode?: string;
|
|
767
|
+
readonly faucet?: string;
|
|
768
|
+
readonly indexer?: string;
|
|
769
|
+
readonly clientConfig?: ClientConfig;
|
|
770
|
+
};
|
|
771
|
+
/**
|
|
772
|
+
*
|
|
773
|
+
* Controls the number of results that are returned and the starting position of those results.
|
|
774
|
+
* @param offset parameter specifies the starting position of the query result within the set of data. Default is 0.
|
|
775
|
+
* @param limit specifies the maximum number of items or records to return in a query result. Default is 25.
|
|
776
|
+
*/
|
|
777
|
+
interface PaginationArgs {
|
|
778
|
+
offset?: AnyNumber;
|
|
779
|
+
limit?: number;
|
|
780
|
+
}
|
|
781
|
+
/**
|
|
782
|
+
* QUERY TYPES
|
|
783
|
+
*/
|
|
784
|
+
/**
|
|
785
|
+
* A configuration object we can pass with the request to the server.
|
|
786
|
+
*
|
|
787
|
+
* @param TOKEN - an auth token to send with the request
|
|
788
|
+
* @param HEADERS - extra headers we want to send with the request
|
|
789
|
+
* @param WITH_CREDENTIALS - whether to carry cookies. By default, it is set to true and cookies will be sent
|
|
790
|
+
*/
|
|
791
|
+
declare type ClientConfig = {
|
|
792
|
+
TOKEN?: string;
|
|
793
|
+
HEADERS?: Record<string, string | number | boolean>;
|
|
794
|
+
WITH_CREDENTIALS?: boolean;
|
|
795
|
+
};
|
|
796
|
+
/**
|
|
797
|
+
* The API request type
|
|
798
|
+
*
|
|
799
|
+
* @param url - the url to make the request to, i.e https://fullnode.aptoslabs.devnet.com/v1
|
|
800
|
+
* @param method - the request method "GET" | "POST"
|
|
801
|
+
* @param endpoint (optional) - the endpoint to make the request to, i.e transactions
|
|
802
|
+
* @param body (optional) - the body of the request
|
|
803
|
+
* @param contentType (optional) - the content type to set the `content-type` header to,
|
|
804
|
+
* by default is set to `application/json`
|
|
805
|
+
* @param params (optional) - query params to add to the request
|
|
806
|
+
* @param originMethod (optional) - the local method the request came from
|
|
807
|
+
* @param overrides (optional) - a `ClientConfig` object type to override request data
|
|
808
|
+
*/
|
|
809
|
+
declare type AptosRequest = {
|
|
810
|
+
url: string;
|
|
811
|
+
method: "GET" | "POST";
|
|
812
|
+
path?: string;
|
|
813
|
+
body?: any;
|
|
814
|
+
contentType?: string;
|
|
815
|
+
acceptType?: string;
|
|
816
|
+
params?: Record<string, string | AnyNumber | boolean | undefined>;
|
|
817
|
+
originMethod?: string;
|
|
818
|
+
overrides?: ClientConfig;
|
|
819
|
+
};
|
|
820
|
+
/**
|
|
821
|
+
* Specifies ledger version of transactions. By default latest version will be used
|
|
822
|
+
*/
|
|
823
|
+
declare type LedgerVersion = {
|
|
824
|
+
ledgerVersion?: AnyNumber;
|
|
825
|
+
};
|
|
826
|
+
/**
|
|
827
|
+
* RESPONSE TYPES
|
|
828
|
+
*/
|
|
829
|
+
/**
|
|
830
|
+
* Type holding the outputs of the estimate gas API
|
|
831
|
+
*/
|
|
832
|
+
declare type GasEstimation = {
|
|
833
|
+
/**
|
|
834
|
+
* The deprioritized estimate for the gas unit price
|
|
835
|
+
*/
|
|
836
|
+
deprioritized_gas_estimate?: number;
|
|
837
|
+
/**
|
|
838
|
+
* The current estimate for the gas unit price
|
|
839
|
+
*/
|
|
840
|
+
gas_estimate: number;
|
|
841
|
+
/**
|
|
842
|
+
* The prioritized estimate for the gas unit price
|
|
843
|
+
*/
|
|
844
|
+
prioritized_gas_estimate?: number;
|
|
845
|
+
};
|
|
846
|
+
declare type MoveResource = {
|
|
847
|
+
type: MoveResourceType;
|
|
848
|
+
data: {};
|
|
849
|
+
};
|
|
850
|
+
declare type AccountData = {
|
|
851
|
+
sequence_number: string;
|
|
852
|
+
authentication_key: string;
|
|
853
|
+
};
|
|
854
|
+
declare type MoveModuleBytecode = {
|
|
855
|
+
bytecode: string;
|
|
856
|
+
abi?: MoveModule;
|
|
857
|
+
};
|
|
858
|
+
/**
|
|
859
|
+
* TRANSACTION TYPES
|
|
860
|
+
*/
|
|
861
|
+
declare enum TransactionResponseType {
|
|
862
|
+
Pending = "pending_transaction",
|
|
863
|
+
User = "user_transaction",
|
|
864
|
+
Genesis = "genesis_transaction",
|
|
865
|
+
BlockMetadata = "block_metadata_transaction",
|
|
866
|
+
StateCheckpoint = "state_checkpoint_transaction"
|
|
867
|
+
}
|
|
868
|
+
declare type TransactionResponse = PendingTransactionResponse | UserTransactionResponse | GenesisTransactionResponse | BlockMetadataTransactionResponse | StateCheckpointTransactionResponse;
|
|
869
|
+
declare type PendingTransactionResponse = {
|
|
870
|
+
type: TransactionResponseType.Pending;
|
|
871
|
+
hash: string;
|
|
872
|
+
sender: string;
|
|
873
|
+
sequence_number: string;
|
|
874
|
+
max_gas_amount: string;
|
|
875
|
+
gas_unit_price: string;
|
|
876
|
+
expiration_timestamp_secs: string;
|
|
877
|
+
payload: TransactionPayloadResponse;
|
|
878
|
+
signature?: TransactionSignature;
|
|
879
|
+
};
|
|
880
|
+
declare type UserTransactionResponse = {
|
|
881
|
+
type: TransactionResponseType.User;
|
|
882
|
+
version: string;
|
|
883
|
+
hash: string;
|
|
884
|
+
state_change_hash: string;
|
|
885
|
+
event_root_hash: string;
|
|
886
|
+
state_checkpoint_hash?: string;
|
|
887
|
+
gas_used: string;
|
|
888
|
+
/**
|
|
889
|
+
* Whether the transaction was successful
|
|
890
|
+
*/
|
|
891
|
+
success: boolean;
|
|
892
|
+
/**
|
|
893
|
+
* The VM status of the transaction, can tell useful information in a failure
|
|
894
|
+
*/
|
|
895
|
+
vm_status: string;
|
|
896
|
+
accumulator_root_hash: string;
|
|
897
|
+
/**
|
|
898
|
+
* Final state of resources changed by the transaction
|
|
899
|
+
*/
|
|
900
|
+
changes: Array<WriteSetChange>;
|
|
901
|
+
sender: string;
|
|
902
|
+
sequence_number: string;
|
|
903
|
+
max_gas_amount: string;
|
|
904
|
+
gas_unit_price: string;
|
|
905
|
+
expiration_timestamp_secs: string;
|
|
906
|
+
payload: TransactionPayloadResponse;
|
|
907
|
+
signature?: TransactionSignature;
|
|
908
|
+
/**
|
|
909
|
+
* Events generated by the transaction
|
|
910
|
+
*/
|
|
911
|
+
events: Array<Event$1>;
|
|
912
|
+
timestamp: string;
|
|
913
|
+
};
|
|
914
|
+
declare type GenesisTransactionResponse = {
|
|
915
|
+
type: TransactionResponseType.Genesis;
|
|
916
|
+
version: string;
|
|
917
|
+
hash: string;
|
|
918
|
+
state_change_hash: string;
|
|
919
|
+
event_root_hash: string;
|
|
920
|
+
state_checkpoint_hash?: string;
|
|
921
|
+
gas_used: string;
|
|
922
|
+
/**
|
|
923
|
+
* Whether the transaction was successful
|
|
924
|
+
*/
|
|
925
|
+
success: boolean;
|
|
926
|
+
/**
|
|
927
|
+
* The VM status of the transaction, can tell useful information in a failure
|
|
928
|
+
*/
|
|
929
|
+
vm_status: string;
|
|
930
|
+
accumulator_root_hash: string;
|
|
931
|
+
/**
|
|
932
|
+
* Final state of resources changed by the transaction
|
|
933
|
+
*/
|
|
934
|
+
changes: Array<WriteSetChange>;
|
|
935
|
+
payload: GenesisPayload;
|
|
936
|
+
/**
|
|
937
|
+
* Events emitted during genesis
|
|
938
|
+
*/
|
|
939
|
+
events: Array<Event$1>;
|
|
940
|
+
};
|
|
941
|
+
declare type BlockMetadataTransactionResponse = {
|
|
942
|
+
type: TransactionResponseType.BlockMetadata;
|
|
943
|
+
version: string;
|
|
944
|
+
hash: string;
|
|
945
|
+
state_change_hash: string;
|
|
946
|
+
event_root_hash: string;
|
|
947
|
+
state_checkpoint_hash?: string;
|
|
948
|
+
gas_used: string;
|
|
949
|
+
/**
|
|
950
|
+
* Whether the transaction was successful
|
|
951
|
+
*/
|
|
952
|
+
success: boolean;
|
|
953
|
+
/**
|
|
954
|
+
* The VM status of the transaction, can tell useful information in a failure
|
|
955
|
+
*/
|
|
956
|
+
vm_status: string;
|
|
957
|
+
accumulator_root_hash: string;
|
|
958
|
+
/**
|
|
959
|
+
* Final state of resources changed by the transaction
|
|
960
|
+
*/
|
|
961
|
+
changes: Array<WriteSetChange>;
|
|
962
|
+
id: string;
|
|
963
|
+
epoch: string;
|
|
964
|
+
round: string;
|
|
965
|
+
/**
|
|
966
|
+
* The events emitted at the block creation
|
|
967
|
+
*/
|
|
968
|
+
events: Array<Event$1>;
|
|
969
|
+
/**
|
|
970
|
+
* Previous block votes
|
|
971
|
+
*/
|
|
972
|
+
previous_block_votes_bitvec: Array<number>;
|
|
973
|
+
proposer: string;
|
|
974
|
+
/**
|
|
975
|
+
* The indices of the proposers who failed to propose
|
|
976
|
+
*/
|
|
977
|
+
failed_proposer_indices: Array<number>;
|
|
978
|
+
timestamp: string;
|
|
979
|
+
};
|
|
980
|
+
declare type StateCheckpointTransactionResponse = {
|
|
981
|
+
type: TransactionResponseType.StateCheckpoint;
|
|
982
|
+
version: string;
|
|
983
|
+
hash: string;
|
|
984
|
+
state_change_hash: string;
|
|
985
|
+
event_root_hash: string;
|
|
986
|
+
state_checkpoint_hash?: string;
|
|
987
|
+
gas_used: string;
|
|
988
|
+
/**
|
|
989
|
+
* Whether the transaction was successful
|
|
990
|
+
*/
|
|
991
|
+
success: boolean;
|
|
992
|
+
/**
|
|
993
|
+
* The VM status of the transaction, can tell useful information in a failure
|
|
994
|
+
*/
|
|
995
|
+
vm_status: string;
|
|
996
|
+
accumulator_root_hash: string;
|
|
997
|
+
/**
|
|
998
|
+
* Final state of resources changed by the transaction
|
|
999
|
+
*/
|
|
1000
|
+
changes: Array<WriteSetChange>;
|
|
1001
|
+
timestamp: string;
|
|
1002
|
+
};
|
|
1003
|
+
/**
|
|
1004
|
+
* WRITESET CHANGE TYPES
|
|
1005
|
+
*/
|
|
1006
|
+
declare type WriteSetChange = WriteSetChangeDeleteModule | WriteSetChangeDeleteResource | WriteSetChangeDeleteTableItem | WriteSetChangeWriteModule | WriteSetChangeWriteResource | WriteSetChangeWriteTableItem;
|
|
1007
|
+
declare type WriteSetChangeDeleteModule = {
|
|
1008
|
+
type: string;
|
|
1009
|
+
address: string;
|
|
1010
|
+
/**
|
|
1011
|
+
* State key hash
|
|
1012
|
+
*/
|
|
1013
|
+
state_key_hash: string;
|
|
1014
|
+
module: MoveModuleId;
|
|
1015
|
+
};
|
|
1016
|
+
declare type WriteSetChangeDeleteResource = {
|
|
1017
|
+
type: string;
|
|
1018
|
+
address: string;
|
|
1019
|
+
state_key_hash: string;
|
|
1020
|
+
resource: string;
|
|
1021
|
+
};
|
|
1022
|
+
declare type WriteSetChangeDeleteTableItem = {
|
|
1023
|
+
type: string;
|
|
1024
|
+
state_key_hash: string;
|
|
1025
|
+
handle: string;
|
|
1026
|
+
key: string;
|
|
1027
|
+
data?: DeletedTableData;
|
|
1028
|
+
};
|
|
1029
|
+
declare type WriteSetChangeWriteModule = {
|
|
1030
|
+
type: string;
|
|
1031
|
+
address: string;
|
|
1032
|
+
state_key_hash: string;
|
|
1033
|
+
data: MoveModuleBytecode;
|
|
1034
|
+
};
|
|
1035
|
+
declare type WriteSetChangeWriteResource = {
|
|
1036
|
+
type: string;
|
|
1037
|
+
address: string;
|
|
1038
|
+
state_key_hash: string;
|
|
1039
|
+
data: MoveResource;
|
|
1040
|
+
};
|
|
1041
|
+
declare type WriteSetChangeWriteTableItem = {
|
|
1042
|
+
type: string;
|
|
1043
|
+
state_key_hash: string;
|
|
1044
|
+
handle: string;
|
|
1045
|
+
key: string;
|
|
1046
|
+
value: string;
|
|
1047
|
+
data?: DecodedTableData;
|
|
1048
|
+
};
|
|
1049
|
+
declare type DecodedTableData = {
|
|
1050
|
+
/**
|
|
1051
|
+
* Key of table in JSON
|
|
1052
|
+
*/
|
|
1053
|
+
key: any;
|
|
1054
|
+
/**
|
|
1055
|
+
* Type of key
|
|
1056
|
+
*/
|
|
1057
|
+
key_type: string;
|
|
1058
|
+
/**
|
|
1059
|
+
* Value of table in JSON
|
|
1060
|
+
*/
|
|
1061
|
+
value: any;
|
|
1062
|
+
/**
|
|
1063
|
+
* Type of value
|
|
1064
|
+
*/
|
|
1065
|
+
value_type: string;
|
|
1066
|
+
};
|
|
1067
|
+
/**
|
|
1068
|
+
* Deleted table data
|
|
1069
|
+
*/
|
|
1070
|
+
declare type DeletedTableData = {
|
|
1071
|
+
/**
|
|
1072
|
+
* Deleted key
|
|
1073
|
+
*/
|
|
1074
|
+
key: any;
|
|
1075
|
+
/**
|
|
1076
|
+
* Deleted key type
|
|
1077
|
+
*/
|
|
1078
|
+
key_type: string;
|
|
1079
|
+
};
|
|
1080
|
+
declare type TransactionPayloadResponse = EntryFunctionPayloadResponse | ScriptPayloadResponse | MultisigPayloadResponse;
|
|
1081
|
+
declare type EntryFunctionPayloadResponse = {
|
|
1082
|
+
type: string;
|
|
1083
|
+
function: MoveResourceType;
|
|
1084
|
+
/**
|
|
1085
|
+
* Type arguments of the function
|
|
1086
|
+
*/
|
|
1087
|
+
type_arguments: Array<string>;
|
|
1088
|
+
/**
|
|
1089
|
+
* Arguments of the function
|
|
1090
|
+
*/
|
|
1091
|
+
arguments: Array<any>;
|
|
1092
|
+
};
|
|
1093
|
+
declare type ScriptPayloadResponse = {
|
|
1094
|
+
type: string;
|
|
1095
|
+
code: MoveScriptBytecode;
|
|
1096
|
+
/**
|
|
1097
|
+
* Type arguments of the function
|
|
1098
|
+
*/
|
|
1099
|
+
type_arguments: Array<string>;
|
|
1100
|
+
/**
|
|
1101
|
+
* Arguments of the function
|
|
1102
|
+
*/
|
|
1103
|
+
arguments: Array<any>;
|
|
1104
|
+
};
|
|
1105
|
+
declare type MultisigPayloadResponse = {
|
|
1106
|
+
type: string;
|
|
1107
|
+
multisig_address: string;
|
|
1108
|
+
transaction_payload?: EntryFunctionPayloadResponse;
|
|
1109
|
+
};
|
|
1110
|
+
declare type GenesisPayload = {
|
|
1111
|
+
type: string;
|
|
1112
|
+
write_set: WriteSet;
|
|
1113
|
+
};
|
|
1114
|
+
/**
|
|
1115
|
+
* Move script bytecode
|
|
1116
|
+
*/
|
|
1117
|
+
declare type MoveScriptBytecode = {
|
|
1118
|
+
bytecode: string;
|
|
1119
|
+
abi?: MoveFunction;
|
|
1120
|
+
};
|
|
1121
|
+
/**
|
|
1122
|
+
* These are the JSON representations of transaction signatures returned from the node API.
|
|
1123
|
+
*/
|
|
1124
|
+
declare type TransactionSignature = TransactionEd25519Signature | TransactionSecp256k1Signature | TransactionMultiEd25519Signature | TransactionMultiAgentSignature | TransactionFeePayerSignature;
|
|
1125
|
+
declare type TransactionEd25519Signature = {
|
|
1126
|
+
type: string;
|
|
1127
|
+
public_key: string;
|
|
1128
|
+
signature: "ed25519_signature";
|
|
1129
|
+
};
|
|
1130
|
+
declare type TransactionSecp256k1Signature = {
|
|
1131
|
+
type: string;
|
|
1132
|
+
public_key: string;
|
|
1133
|
+
signature: "secp256k1_ecdsa_signature";
|
|
1134
|
+
};
|
|
1135
|
+
declare type TransactionMultiEd25519Signature = {
|
|
1136
|
+
type: "multi_ed25519_signature";
|
|
1137
|
+
/**
|
|
1138
|
+
* The public keys for the Ed25519 signature
|
|
1139
|
+
*/
|
|
1140
|
+
public_keys: Array<string>;
|
|
1141
|
+
/**
|
|
1142
|
+
* Signature associated with the public keys in the same order
|
|
1143
|
+
*/
|
|
1144
|
+
signatures: Array<string>;
|
|
1145
|
+
/**
|
|
1146
|
+
* The number of signatures required for a successful transaction
|
|
1147
|
+
*/
|
|
1148
|
+
threshold: number;
|
|
1149
|
+
bitmap: string;
|
|
1150
|
+
};
|
|
1151
|
+
declare type TransactionMultiAgentSignature = {
|
|
1152
|
+
type: "multi_agent_signature";
|
|
1153
|
+
sender: AccountSignature;
|
|
1154
|
+
/**
|
|
1155
|
+
* The other involved parties' addresses
|
|
1156
|
+
*/
|
|
1157
|
+
secondary_signer_addresses: Array<string>;
|
|
1158
|
+
/**
|
|
1159
|
+
* The associated signatures, in the same order as the secondary addresses
|
|
1160
|
+
*/
|
|
1161
|
+
secondary_signers: Array<AccountSignature>;
|
|
1162
|
+
};
|
|
1163
|
+
declare type TransactionFeePayerSignature = {
|
|
1164
|
+
type: "fee_payer_signature";
|
|
1165
|
+
sender: AccountSignature;
|
|
1166
|
+
/**
|
|
1167
|
+
* The other involved parties' addresses
|
|
1168
|
+
*/
|
|
1169
|
+
secondary_signer_addresses: Array<string>;
|
|
1170
|
+
/**
|
|
1171
|
+
* The associated signatures, in the same order as the secondary addresses
|
|
1172
|
+
*/
|
|
1173
|
+
secondary_signers: Array<AccountSignature>;
|
|
1174
|
+
fee_payer_address: string;
|
|
1175
|
+
fee_payer_signer: AccountSignature;
|
|
1176
|
+
};
|
|
1177
|
+
/**
|
|
1178
|
+
* The union of all single account signatures.
|
|
1179
|
+
*/
|
|
1180
|
+
declare type AccountSignature = AccountEd25519Signature | AccountSecp256k1Signature | AccountMultiEd25519Signature;
|
|
1181
|
+
declare type AccountEd25519Signature = TransactionEd25519Signature;
|
|
1182
|
+
declare type AccountSecp256k1Signature = TransactionSecp256k1Signature;
|
|
1183
|
+
declare type AccountMultiEd25519Signature = TransactionMultiEd25519Signature;
|
|
1184
|
+
declare type WriteSet = ScriptWriteSet | DirectWriteSet;
|
|
1185
|
+
declare type ScriptWriteSet = {
|
|
1186
|
+
type: string;
|
|
1187
|
+
execute_as: string;
|
|
1188
|
+
script: ScriptPayloadResponse;
|
|
1189
|
+
};
|
|
1190
|
+
declare type DirectWriteSet = {
|
|
1191
|
+
type: string;
|
|
1192
|
+
changes: Array<WriteSetChange>;
|
|
1193
|
+
events: Array<Event$1>;
|
|
1194
|
+
};
|
|
1195
|
+
declare type EventGuid = {
|
|
1196
|
+
creation_number: string;
|
|
1197
|
+
account_address: string;
|
|
1198
|
+
};
|
|
1199
|
+
declare type Event$1 = {
|
|
1200
|
+
guid: EventGuid;
|
|
1201
|
+
sequence_number: string;
|
|
1202
|
+
type: string;
|
|
1203
|
+
/**
|
|
1204
|
+
* The JSON representation of the event
|
|
1205
|
+
*/
|
|
1206
|
+
data: any;
|
|
1207
|
+
};
|
|
1208
|
+
/**
|
|
1209
|
+
* Map of Move types to local TypeScript types
|
|
1210
|
+
*/
|
|
1211
|
+
declare type MoveUint8Type = number;
|
|
1212
|
+
declare type MoveUint16Type = number;
|
|
1213
|
+
declare type MoveUint32Type = number;
|
|
1214
|
+
declare type MoveUint64Type = string;
|
|
1215
|
+
declare type MoveUint128Type = string;
|
|
1216
|
+
declare type MoveUint256Type = string;
|
|
1217
|
+
declare type MoveAddressType = `0x${string}`;
|
|
1218
|
+
declare type MoveObjectType = `0x${string}`;
|
|
1219
|
+
declare type MoveStructType = `0x${string}::${string}::${string}`;
|
|
1220
|
+
declare type MoveOptionType = MoveType | null | undefined;
|
|
1221
|
+
/**
|
|
1222
|
+
* String representation of a on-chain Move struct type.
|
|
1223
|
+
*/
|
|
1224
|
+
declare type MoveResourceType = `${string}::${string}::${string}`;
|
|
1225
|
+
declare type MoveType = boolean | string | MoveUint8Type | MoveUint16Type | MoveUint32Type | MoveUint64Type | MoveUint128Type | MoveUint256Type | MoveAddressType | MoveObjectType | MoveStructType | Array<MoveType>;
|
|
1226
|
+
/**
|
|
1227
|
+
* Possible Move values acceptable by move functions (entry, view)
|
|
1228
|
+
*
|
|
1229
|
+
* Map of a Move value to the corresponding TypeScript value
|
|
1230
|
+
*
|
|
1231
|
+
* `Bool -> boolean`
|
|
1232
|
+
*
|
|
1233
|
+
* `u8, u16, u32 -> number`
|
|
1234
|
+
*
|
|
1235
|
+
* `u64, u128, u256 -> string`
|
|
1236
|
+
*
|
|
1237
|
+
* `String -> string`
|
|
1238
|
+
*
|
|
1239
|
+
* `Address -> 0x${string}`
|
|
1240
|
+
*
|
|
1241
|
+
* `Struct - 0x${string}::${string}::${string}`
|
|
1242
|
+
*
|
|
1243
|
+
* `Object -> 0x${string}`
|
|
1244
|
+
*
|
|
1245
|
+
* `Vector -> Array<MoveValue>`
|
|
1246
|
+
*
|
|
1247
|
+
* `Option -> MoveValue | null | undefined`
|
|
1248
|
+
*/
|
|
1249
|
+
declare type MoveValue = boolean | string | MoveUint8Type | MoveUint16Type | MoveUint32Type | MoveUint64Type | MoveUint128Type | MoveUint256Type | MoveAddressType | MoveObjectType | MoveStructType | MoveOptionType | Array<MoveValue>;
|
|
1250
|
+
/**
|
|
1251
|
+
* Move module id is a string representation of Move module.
|
|
1252
|
+
* Module name is case-sensitive.
|
|
1253
|
+
*/
|
|
1254
|
+
declare type MoveModuleId = `${string}::${string}`;
|
|
1255
|
+
/**
|
|
1256
|
+
* Move function visibility
|
|
1257
|
+
*/
|
|
1258
|
+
declare enum MoveFunctionVisibility {
|
|
1259
|
+
PRIVATE = "private",
|
|
1260
|
+
PUBLIC = "public",
|
|
1261
|
+
FRIEND = "friend"
|
|
1262
|
+
}
|
|
1263
|
+
/**
|
|
1264
|
+
* Move function ability
|
|
1265
|
+
*/
|
|
1266
|
+
declare enum MoveAbility {
|
|
1267
|
+
STORE = "store",
|
|
1268
|
+
DROP = "drop",
|
|
1269
|
+
KEY = "key",
|
|
1270
|
+
COPY = "copy"
|
|
1271
|
+
}
|
|
1272
|
+
/**
|
|
1273
|
+
* Move abilities tied to the generic type param and associated with the function that uses it
|
|
1274
|
+
*/
|
|
1275
|
+
declare type MoveFunctionGenericTypeParam = {
|
|
1276
|
+
constraints: Array<MoveAbility>;
|
|
1277
|
+
};
|
|
1278
|
+
/**
|
|
1279
|
+
* Move struct field
|
|
1280
|
+
*/
|
|
1281
|
+
declare type MoveStructField = {
|
|
1282
|
+
name: string;
|
|
1283
|
+
type: string;
|
|
1284
|
+
};
|
|
1285
|
+
/**
|
|
1286
|
+
* A Move module
|
|
1287
|
+
*/
|
|
1288
|
+
declare type MoveModule = {
|
|
1289
|
+
address: string;
|
|
1290
|
+
name: string;
|
|
1291
|
+
/**
|
|
1292
|
+
* Friends of the module
|
|
1293
|
+
*/
|
|
1294
|
+
friends: Array<MoveModuleId>;
|
|
1295
|
+
/**
|
|
1296
|
+
* Public functions of the module
|
|
1297
|
+
*/
|
|
1298
|
+
exposed_functions: Array<MoveFunction>;
|
|
1299
|
+
/**
|
|
1300
|
+
* Structs of the module
|
|
1301
|
+
*/
|
|
1302
|
+
structs: Array<MoveStruct>;
|
|
1303
|
+
};
|
|
1304
|
+
/**
|
|
1305
|
+
* A move struct
|
|
1306
|
+
*/
|
|
1307
|
+
declare type MoveStruct = {
|
|
1308
|
+
name: string;
|
|
1309
|
+
/**
|
|
1310
|
+
* Whether the struct is a native struct of Move
|
|
1311
|
+
*/
|
|
1312
|
+
is_native: boolean;
|
|
1313
|
+
/**
|
|
1314
|
+
* Abilities associated with the struct
|
|
1315
|
+
*/
|
|
1316
|
+
abilities: Array<MoveAbility>;
|
|
1317
|
+
/**
|
|
1318
|
+
* Generic types associated with the struct
|
|
1319
|
+
*/
|
|
1320
|
+
generic_type_params: Array<MoveFunctionGenericTypeParam>;
|
|
1321
|
+
/**
|
|
1322
|
+
* Fields associated with the struct
|
|
1323
|
+
*/
|
|
1324
|
+
fields: Array<MoveStructField>;
|
|
1325
|
+
};
|
|
1326
|
+
/**
|
|
1327
|
+
* Move function
|
|
1328
|
+
*/
|
|
1329
|
+
declare type MoveFunction = {
|
|
1330
|
+
name: string;
|
|
1331
|
+
visibility: MoveFunctionVisibility;
|
|
1332
|
+
/**
|
|
1333
|
+
* Whether the function can be called as an entry function directly in a transaction
|
|
1334
|
+
*/
|
|
1335
|
+
is_entry: boolean;
|
|
1336
|
+
/**
|
|
1337
|
+
* Whether the function is a view function or not
|
|
1338
|
+
*/
|
|
1339
|
+
is_view: boolean;
|
|
1340
|
+
/**
|
|
1341
|
+
* Generic type params associated with the Move function
|
|
1342
|
+
*/
|
|
1343
|
+
generic_type_params: Array<MoveFunctionGenericTypeParam>;
|
|
1344
|
+
/**
|
|
1345
|
+
* Parameters associated with the move function
|
|
1346
|
+
*/
|
|
1347
|
+
params: Array<string>;
|
|
1348
|
+
/**
|
|
1349
|
+
* Return type of the function
|
|
1350
|
+
*/
|
|
1351
|
+
return: Array<string>;
|
|
1352
|
+
};
|
|
1353
|
+
declare enum RoleType {
|
|
1354
|
+
VALIDATOR = "validator",
|
|
1355
|
+
FULL_NODE = "full_node"
|
|
1356
|
+
}
|
|
1357
|
+
declare type LedgerInfo = {
|
|
1358
|
+
/**
|
|
1359
|
+
* Chain ID of the current chain
|
|
1360
|
+
*/
|
|
1361
|
+
chain_id: number;
|
|
1362
|
+
epoch: string;
|
|
1363
|
+
ledger_version: string;
|
|
1364
|
+
oldest_ledger_version: string;
|
|
1365
|
+
ledger_timestamp: string;
|
|
1366
|
+
node_role: RoleType;
|
|
1367
|
+
oldest_block_height: string;
|
|
1368
|
+
block_height: string;
|
|
1369
|
+
/**
|
|
1370
|
+
* Git hash of the build of the API endpoint. Can be used to determine the exact
|
|
1371
|
+
* software version used by the API endpoint.
|
|
1372
|
+
*/
|
|
1373
|
+
git_hash?: string;
|
|
1374
|
+
};
|
|
1375
|
+
/**
|
|
1376
|
+
* A Block type
|
|
1377
|
+
*/
|
|
1378
|
+
declare type Block = {
|
|
1379
|
+
block_height: string;
|
|
1380
|
+
block_hash: `0x${string}`;
|
|
1381
|
+
block_timestamp: string;
|
|
1382
|
+
first_version: string;
|
|
1383
|
+
last_version: string;
|
|
1384
|
+
/**
|
|
1385
|
+
* The transactions in the block in sequential order
|
|
1386
|
+
*/
|
|
1387
|
+
transactions?: Array<TransactionResponse>;
|
|
1388
|
+
};
|
|
1389
|
+
/**
|
|
1390
|
+
* The data needed to generate a View Request payload
|
|
1391
|
+
*/
|
|
1392
|
+
declare type ViewRequestData = {
|
|
1393
|
+
function: MoveStructType;
|
|
1394
|
+
typeArguments?: Array<MoveResourceType>;
|
|
1395
|
+
arguments?: Array<MoveValue>;
|
|
1396
|
+
};
|
|
1397
|
+
/**
|
|
1398
|
+
* View request for the Move view function API
|
|
1399
|
+
*
|
|
1400
|
+
* `type MoveResourceType = ${string}::${string}::${string}`;
|
|
1401
|
+
*/
|
|
1402
|
+
declare type ViewRequest = {
|
|
1403
|
+
function: MoveResourceType;
|
|
1404
|
+
/**
|
|
1405
|
+
* Type arguments of the function
|
|
1406
|
+
*/
|
|
1407
|
+
type_arguments: Array<MoveResourceType>;
|
|
1408
|
+
/**
|
|
1409
|
+
* Arguments of the function
|
|
1410
|
+
*/
|
|
1411
|
+
arguments: Array<MoveValue>;
|
|
1412
|
+
};
|
|
1413
|
+
/**
|
|
1414
|
+
* Table Item request for the GetTableItem API
|
|
1415
|
+
*/
|
|
1416
|
+
declare type TableItemRequest = {
|
|
1417
|
+
key_type: MoveValue;
|
|
1418
|
+
value_type: MoveValue;
|
|
1419
|
+
/**
|
|
1420
|
+
* The value of the table item's key
|
|
1421
|
+
*/
|
|
1422
|
+
key: any;
|
|
1423
|
+
};
|
|
1424
|
+
/**
|
|
1425
|
+
* A list of Authentication Key schemes that are supported by Aptos.
|
|
1426
|
+
*
|
|
1427
|
+
* They are combinations of signing schemes and derive schemes.
|
|
1428
|
+
*/
|
|
1429
|
+
declare type AuthenticationKeyScheme = SigningScheme | DeriveScheme;
|
|
1430
|
+
/**
|
|
1431
|
+
* A list of signing schemes that are supported by Aptos.
|
|
1432
|
+
*
|
|
1433
|
+
* https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/authenticator.rs#L375-L378
|
|
1434
|
+
*/
|
|
1435
|
+
declare enum SigningScheme {
|
|
1436
|
+
/**
|
|
1437
|
+
* For Ed25519PublicKey
|
|
1438
|
+
*/
|
|
1439
|
+
Ed25519 = 0,
|
|
1440
|
+
/**
|
|
1441
|
+
* For MultiEd25519PublicKey
|
|
1442
|
+
*/
|
|
1443
|
+
MultiEd25519 = 1,
|
|
1444
|
+
/**
|
|
1445
|
+
* For Secp256k1 ecdsa
|
|
1446
|
+
*/
|
|
1447
|
+
Secp256k1Ecdsa = 2
|
|
1448
|
+
}
|
|
1449
|
+
/**
|
|
1450
|
+
* Scheme used for deriving account addresses from other data
|
|
1451
|
+
*/
|
|
1452
|
+
declare enum DeriveScheme {
|
|
1453
|
+
/**
|
|
1454
|
+
* Derives an address using an AUID, used for objects
|
|
1455
|
+
*/
|
|
1456
|
+
DeriveAuid = 251,
|
|
1457
|
+
/**
|
|
1458
|
+
* Derives an address from another object address
|
|
1459
|
+
*/
|
|
1460
|
+
DeriveObjectAddressFromObject = 252,
|
|
1461
|
+
/**
|
|
1462
|
+
* Derives an address from a GUID, used for objects
|
|
1463
|
+
*/
|
|
1464
|
+
DeriveObjectAddressFromGuid = 253,
|
|
1465
|
+
/**
|
|
1466
|
+
* Derives an address from seed bytes, used for named objects
|
|
1467
|
+
*/
|
|
1468
|
+
DeriveObjectAddressFromSeed = 254,
|
|
1469
|
+
/**
|
|
1470
|
+
* Derives an address from seed bytes, used for resource accounts
|
|
1471
|
+
*/
|
|
1472
|
+
DeriveResourceAccountAddress = 255
|
|
1473
|
+
}
|
|
1474
|
+
|
|
1475
|
+
/**
|
|
1476
|
+
* Type of API endpoint for request routing
|
|
1477
|
+
*/
|
|
1478
|
+
declare enum AptosApiType {
|
|
1479
|
+
FULLNODE = 0,
|
|
1480
|
+
INDEXER = 1,
|
|
1481
|
+
FAUCET = 2
|
|
1482
|
+
}
|
|
1483
|
+
|
|
1484
|
+
/**
|
|
1485
|
+
* This class holds the config information for the SDK client instance.
|
|
1486
|
+
*/
|
|
1487
|
+
declare class AptosConfig {
|
|
1488
|
+
/** The Network that this SDK is associated with. */
|
|
1489
|
+
readonly network: Network;
|
|
1490
|
+
/**
|
|
1491
|
+
* The optional hardcoded fullnode URL to send requests to instead of using the network
|
|
1492
|
+
*/
|
|
1493
|
+
readonly fullnode?: string;
|
|
1494
|
+
/**
|
|
1495
|
+
* The optional hardcoded faucet URL to send requests to instead of using the network
|
|
1496
|
+
*/
|
|
1497
|
+
readonly faucet?: string;
|
|
1498
|
+
/**
|
|
1499
|
+
* The optional hardcoded indexer URL to send requests to instead of using the network
|
|
1500
|
+
*/
|
|
1501
|
+
readonly indexer?: string;
|
|
1502
|
+
readonly clientConfig?: ClientConfig;
|
|
1503
|
+
constructor(settings?: AptosSettings);
|
|
1504
|
+
/**
|
|
1505
|
+
* Returns the URL endpoint to send the request to.
|
|
1506
|
+
* If a custom URL was provided in the config, that URL is returned.
|
|
1507
|
+
* If a custom URL was provided but not URL endpoints, an error is thrown.
|
|
1508
|
+
* Otherwise, the URL endpoint is derived from the network.
|
|
1509
|
+
*
|
|
1510
|
+
* @param apiType - The type of Aptos API to get the URL for.
|
|
1511
|
+
*
|
|
1512
|
+
* @internal
|
|
1513
|
+
*/
|
|
1514
|
+
getRequestUrl(apiType: AptosApiType): string;
|
|
1515
|
+
/**
|
|
1516
|
+
* Checks if the URL is a known indexer endpoint
|
|
1517
|
+
*
|
|
1518
|
+
* @internal
|
|
1519
|
+
* */
|
|
1520
|
+
isIndexerRequest(url: string): boolean;
|
|
1521
|
+
}
|
|
1522
|
+
|
|
1523
|
+
/**
|
|
1524
|
+
* This error is used to explain why parsing failed.
|
|
1525
|
+
*/
|
|
1526
|
+
declare class ParsingError<T> extends Error {
|
|
1527
|
+
/**
|
|
1528
|
+
* This provides a programmatic way to access why parsing failed. Downstream devs
|
|
1529
|
+
* might want to use this to build their own error messages if the default error
|
|
1530
|
+
* messages are not suitable for their use case. This should be an enum.
|
|
1531
|
+
*/
|
|
1532
|
+
invalidReason: T;
|
|
1533
|
+
constructor(message: string, invalidReason: T);
|
|
1534
|
+
}
|
|
1535
|
+
/**
|
|
1536
|
+
* Whereas ParsingError is thrown when parsing fails, e.g. in a fromString function,
|
|
1537
|
+
* this type is returned from "defensive" functions like isValid.
|
|
1538
|
+
*/
|
|
1539
|
+
declare type ParsingResult<T> = {
|
|
1540
|
+
/**
|
|
1541
|
+
* True if valid, false otherwise.
|
|
1542
|
+
*/
|
|
1543
|
+
valid: boolean;
|
|
1544
|
+
/**
|
|
1545
|
+
* If valid is false, this will be a code explaining why parsing failed.
|
|
1546
|
+
*/
|
|
1547
|
+
invalidReason?: T;
|
|
1548
|
+
/**
|
|
1549
|
+
* If valid is false, this will be a string explaining why parsing failed.
|
|
1550
|
+
*/
|
|
1551
|
+
invalidReasonMessage?: string;
|
|
1552
|
+
};
|
|
1553
|
+
|
|
1554
|
+
/**
|
|
1555
|
+
* This enum is used to explain why parsing might have failed.
|
|
1556
|
+
*/
|
|
1557
|
+
declare enum HexInvalidReason {
|
|
1558
|
+
TOO_SHORT = "too_short",
|
|
1559
|
+
INVALID_LENGTH = "invalid_length",
|
|
1560
|
+
INVALID_HEX_CHARS = "invalid_hex_chars"
|
|
1561
|
+
}
|
|
1562
|
+
/**
|
|
1563
|
+
* NOTE: Do not use this class when working with account addresses, use AccountAddress.
|
|
1564
|
+
*
|
|
1565
|
+
* NOTE: When accepting hex data as input to a function, prefer to accept HexInput and
|
|
1566
|
+
* then use the static helper methods of this class to convert it into the desired
|
|
1567
|
+
* format. This enables the greatest flexibility for the developer.
|
|
1568
|
+
*
|
|
1569
|
+
* Hex is a helper class for working with hex data. Hex data, when represented as a
|
|
1570
|
+
* string, generally looks like this, for example: 0xaabbcc, 45cd32, etc.
|
|
1571
|
+
*
|
|
1572
|
+
* You might use this class like this:
|
|
1573
|
+
*
|
|
1574
|
+
* ```ts
|
|
1575
|
+
* getTransactionByHash(txnHash: HexInput): Promise<Transaction> {
|
|
1576
|
+
* const txnHashString = Hex.fromHexInput(txnHash).toString();
|
|
1577
|
+
* return await getTransactionByHashInner(txnHashString);
|
|
1578
|
+
* }
|
|
1579
|
+
* ```
|
|
1580
|
+
*
|
|
1581
|
+
* This call to `Hex.fromHexInput().toString()` converts the HexInput to a hex string
|
|
1582
|
+
* with a leading 0x prefix, regardless of what the input format was.
|
|
1583
|
+
*
|
|
1584
|
+
* These are some other ways to chain the functions together:
|
|
1585
|
+
* - `Hex.fromString({ hexInput: "0x1f" }).toUint8Array()`
|
|
1586
|
+
* - `new Hex([1, 3]).toStringWithoutPrefix()`
|
|
1587
|
+
*/
|
|
1588
|
+
declare class Hex {
|
|
1589
|
+
private readonly data;
|
|
1590
|
+
/**
|
|
1591
|
+
* Create a new Hex instance from a Uint8Array.
|
|
1592
|
+
*
|
|
1593
|
+
* @param data Uint8Array
|
|
1594
|
+
*/
|
|
1595
|
+
constructor(data: Uint8Array);
|
|
1596
|
+
/**
|
|
1597
|
+
* Get the inner hex data. The inner data is already a Uint8Array so no conversion
|
|
1598
|
+
* is taking place here, it just returns the inner data.
|
|
1599
|
+
*
|
|
1600
|
+
* @returns Hex data as Uint8Array
|
|
1601
|
+
*/
|
|
1602
|
+
toUint8Array(): Uint8Array;
|
|
1603
|
+
/**
|
|
1604
|
+
* Get the hex data as a string without the 0x prefix.
|
|
1605
|
+
*
|
|
1606
|
+
* @returns Hex string without 0x prefix
|
|
1607
|
+
*/
|
|
1608
|
+
toStringWithoutPrefix(): string;
|
|
1609
|
+
/**
|
|
1610
|
+
* Get the hex data as a string with the 0x prefix.
|
|
1611
|
+
*
|
|
1612
|
+
* @returns Hex string with 0x prefix
|
|
1613
|
+
*/
|
|
1614
|
+
toString(): string;
|
|
1615
|
+
/**
|
|
1616
|
+
* Static method to convert a hex string to Hex
|
|
1617
|
+
*
|
|
1618
|
+
* @param str A hex string, with or without the 0x prefix
|
|
1619
|
+
*
|
|
1620
|
+
* @returns Hex
|
|
1621
|
+
*/
|
|
1622
|
+
static fromString(str: string): Hex;
|
|
1623
|
+
/**
|
|
1624
|
+
* Static method to convert an instance of HexInput to Hex
|
|
1625
|
+
*
|
|
1626
|
+
* @param hexInput A HexInput (string or Uint8Array)
|
|
1627
|
+
*
|
|
1628
|
+
* @returns Hex
|
|
1629
|
+
*/
|
|
1630
|
+
static fromHexInput(hexInput: HexInput): Hex;
|
|
1631
|
+
/**
|
|
1632
|
+
* Check if the string is valid hex.
|
|
1633
|
+
*
|
|
1634
|
+
* @param str A hex string representing byte data.
|
|
1635
|
+
*
|
|
1636
|
+
* @returns valid = true if the string is valid, false if not. If the string is not
|
|
1637
|
+
* valid, invalidReason and invalidReasonMessage will be set explaining why it is
|
|
1638
|
+
* invalid.
|
|
1639
|
+
*/
|
|
1640
|
+
static isValid(str: string): ParsingResult<HexInvalidReason>;
|
|
1641
|
+
/**
|
|
1642
|
+
* Return whether Hex instances are equal. Hex instances are considered equal if
|
|
1643
|
+
* their underlying byte data is identical.
|
|
1644
|
+
*
|
|
1645
|
+
* @param other The Hex instance to compare to.
|
|
1646
|
+
* @returns true if the Hex instances are equal, false if not.
|
|
1647
|
+
*/
|
|
1648
|
+
equals(other: Hex): boolean;
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1651
|
+
declare abstract class Serializable {
|
|
1652
|
+
abstract serialize(serializer: Serializer): void;
|
|
1653
|
+
/**
|
|
1654
|
+
* Serializes a `Serializable` value to its BCS representation.
|
|
1655
|
+
* This function is the Typescript SDK equivalent of `bcs::to_bytes` in Move.
|
|
1656
|
+
* @returns the BCS representation of the Serializable instance as a byte buffer
|
|
1657
|
+
*/
|
|
1658
|
+
bcsToBytes(): Uint8Array;
|
|
1659
|
+
/**
|
|
1660
|
+
* Helper function to get a value's BCS-serialized bytes as a Hex instance.
|
|
1661
|
+
* @returns a Hex instance with the BCS-serialized bytes loaded into its underlying Uint8Array
|
|
1662
|
+
*/
|
|
1663
|
+
bcsToHex(): Hex;
|
|
1664
|
+
}
|
|
1665
|
+
declare class Serializer {
|
|
1666
|
+
private buffer;
|
|
1667
|
+
private offset;
|
|
1668
|
+
constructor(length?: number);
|
|
1669
|
+
private ensureBufferWillHandleSize;
|
|
1670
|
+
protected appendToBuffer(values: Uint8Array): void;
|
|
1671
|
+
private serializeWithFunction;
|
|
1672
|
+
/**
|
|
1673
|
+
* Serializes a string. UTF8 string is supported.
|
|
1674
|
+
*
|
|
1675
|
+
* The number of bytes in the string content is serialized first, as a uleb128-encoded u32 integer.
|
|
1676
|
+
* Then the string content is serialized as UTF8 encoded bytes.
|
|
1677
|
+
*
|
|
1678
|
+
* BCS layout for "string": string_length | string_content
|
|
1679
|
+
* where string_length is a u32 integer encoded as a uleb128 integer, equal to the number of bytes in string_content.
|
|
1680
|
+
*
|
|
1681
|
+
* @example
|
|
1682
|
+
* ```ts
|
|
1683
|
+
* const serializer = new Serializer();
|
|
1684
|
+
* serializer.serializeStr("1234abcd");
|
|
1685
|
+
* assert(serializer.toUint8Array() === new Uint8Array([8, 49, 50, 51, 52, 97, 98, 99, 100]));
|
|
1686
|
+
* ```
|
|
1687
|
+
*/
|
|
1688
|
+
serializeStr(value: string): void;
|
|
1689
|
+
/**
|
|
1690
|
+
* Serializes an array of bytes.
|
|
1691
|
+
*
|
|
1692
|
+
* BCS layout for "bytes": bytes_length | bytes
|
|
1693
|
+
* where bytes_length is a u32 integer encoded as a uleb128 integer, equal to the length of the bytes array.
|
|
1694
|
+
*/
|
|
1695
|
+
serializeBytes(value: Uint8Array): void;
|
|
1696
|
+
/**
|
|
1697
|
+
* Serializes an array of bytes with known length. Therefore, length doesn't need to be
|
|
1698
|
+
* serialized to help deserialization.
|
|
1699
|
+
*
|
|
1700
|
+
* When deserializing, the number of bytes to deserialize needs to be passed in.
|
|
1701
|
+
*/
|
|
1702
|
+
serializeFixedBytes(value: Uint8Array): void;
|
|
1703
|
+
/**
|
|
1704
|
+
* Serializes a boolean value.
|
|
1705
|
+
*
|
|
1706
|
+
* BCS layout for "boolean": One byte. "0x01" for true and "0x00" for false.
|
|
1707
|
+
*/
|
|
1708
|
+
serializeBool(value: boolean): void;
|
|
1709
|
+
/**
|
|
1710
|
+
* Serializes a uint8 number.
|
|
1711
|
+
*
|
|
1712
|
+
* BCS layout for "uint8": One byte. Binary format in little-endian representation.
|
|
1713
|
+
*/
|
|
1714
|
+
serializeU8(value: Uint8): void;
|
|
1715
|
+
/**
|
|
1716
|
+
* Serializes a uint16 number.
|
|
1717
|
+
*
|
|
1718
|
+
* BCS layout for "uint16": Two bytes. Binary format in little-endian representation.
|
|
1719
|
+
* @example
|
|
1720
|
+
* ```ts
|
|
1721
|
+
* const serializer = new Serializer();
|
|
1722
|
+
* serializer.serializeU16(4660);
|
|
1723
|
+
* assert(serializer.toUint8Array() === new Uint8Array([0x34, 0x12]));
|
|
1724
|
+
* ```
|
|
1725
|
+
*/
|
|
1726
|
+
serializeU16(value: Uint16): void;
|
|
1727
|
+
/**
|
|
1728
|
+
* Serializes a uint32 number.
|
|
1729
|
+
*
|
|
1730
|
+
* BCS layout for "uint32": Four bytes. Binary format in little-endian representation.
|
|
1731
|
+
* @example
|
|
1732
|
+
* ```ts
|
|
1733
|
+
* const serializer = new Serializer();
|
|
1734
|
+
* serializer.serializeU32(305419896);
|
|
1735
|
+
* assert(serializer.toUint8Array() === new Uint8Array([0x78, 0x56, 0x34, 0x12]));
|
|
1736
|
+
* ```
|
|
1737
|
+
*/
|
|
1738
|
+
serializeU32(value: Uint32): void;
|
|
1739
|
+
/**
|
|
1740
|
+
* Serializes a uint64 number.
|
|
1741
|
+
*
|
|
1742
|
+
* BCS layout for "uint64": Eight bytes. Binary format in little-endian representation.
|
|
1743
|
+
* @example
|
|
1744
|
+
* ```ts
|
|
1745
|
+
* const serializer = new Serializer();
|
|
1746
|
+
* serializer.serializeU64(1311768467750121216);
|
|
1747
|
+
* assert(serializer.toUint8Array() === new Uint8Array([0x00, 0xEF, 0xCD, 0xAB, 0x78, 0x56, 0x34, 0x12]));
|
|
1748
|
+
* ```
|
|
1749
|
+
*/
|
|
1750
|
+
serializeU64(value: AnyNumber): void;
|
|
1751
|
+
/**
|
|
1752
|
+
* Serializes a uint128 number.
|
|
1753
|
+
*
|
|
1754
|
+
* BCS layout for "uint128": Sixteen bytes. Binary format in little-endian representation.
|
|
1755
|
+
*/
|
|
1756
|
+
serializeU128(value: AnyNumber): void;
|
|
1757
|
+
/**
|
|
1758
|
+
* Serializes a uint256 number.
|
|
1759
|
+
*
|
|
1760
|
+
* BCS layout for "uint256": Sixteen bytes. Binary format in little-endian representation.
|
|
1761
|
+
*/
|
|
1762
|
+
serializeU256(value: AnyNumber): void;
|
|
1763
|
+
/**
|
|
1764
|
+
* Serializes a uint32 number with uleb128.
|
|
1765
|
+
*
|
|
1766
|
+
* BCS uses uleb128 encoding in two cases: (1) lengths of variable-length sequences and (2) tags of enum values
|
|
1767
|
+
*/
|
|
1768
|
+
serializeU32AsUleb128(val: Uint32): void;
|
|
1769
|
+
/**
|
|
1770
|
+
* Returns the buffered bytes
|
|
1771
|
+
*/
|
|
1772
|
+
toUint8Array(): Uint8Array;
|
|
1773
|
+
/**
|
|
1774
|
+
* Serializes a `Serializable` value, facilitating composable serialization.
|
|
1775
|
+
*
|
|
1776
|
+
* @param value The Serializable value to serialize
|
|
1777
|
+
*
|
|
1778
|
+
* @example
|
|
1779
|
+
* // Define the MoveStruct class that implements the Serializable interface
|
|
1780
|
+
* class MoveStruct extends Serializable {
|
|
1781
|
+
* constructor(
|
|
1782
|
+
* public creatorAddress: AccountAddress, // where AccountAddress extends Serializable
|
|
1783
|
+
* public collectionName: string,
|
|
1784
|
+
* public tokenName: string
|
|
1785
|
+
* ) {}
|
|
1786
|
+
*
|
|
1787
|
+
* serialize(serializer: Serializer): void {
|
|
1788
|
+
* serializer.serialize(this.creatorAddress); // Composable serialization of another Serializable object
|
|
1789
|
+
* serializer.serializeStr(this.collectionName);
|
|
1790
|
+
* serializer.serializeStr(this.tokenName);
|
|
1791
|
+
* }
|
|
1792
|
+
* }
|
|
1793
|
+
*
|
|
1794
|
+
* // Construct a MoveStruct
|
|
1795
|
+
* const moveStruct = new MoveStruct(new AccountAddress(...), "MyCollection", "TokenA");
|
|
1796
|
+
*
|
|
1797
|
+
* // Serialize a string, a u64 number, and a MoveStruct instance.
|
|
1798
|
+
* const serializer = new Serializer();
|
|
1799
|
+
* serializer.serializeStr("ExampleString");
|
|
1800
|
+
* serializer.serializeU64(12345678);
|
|
1801
|
+
* serializer.serialize(moveStruct);
|
|
1802
|
+
*
|
|
1803
|
+
* // Get the bytes from the Serializer instance
|
|
1804
|
+
* const serializedBytes = serializer.toUint8Array();
|
|
1805
|
+
*
|
|
1806
|
+
* @returns the serializer instance
|
|
1807
|
+
*/
|
|
1808
|
+
serialize<T extends Serializable>(value: T): void;
|
|
1809
|
+
/**
|
|
1810
|
+
* Serializes an array of BCS Serializable values to a serializer instance.
|
|
1811
|
+
* Note that this does not return anything. The bytes are added to the serializer instance's byte buffer.
|
|
1812
|
+
*
|
|
1813
|
+
* @param values The array of BCS Serializable values
|
|
1814
|
+
* @example
|
|
1815
|
+
* const addresses = new Array<AccountAddress>(
|
|
1816
|
+
* AccountAddress.fromHexInputRelaxed("0x1"),
|
|
1817
|
+
* AccountAddress.fromHexInputRelaxed("0x2"),
|
|
1818
|
+
* AccountAddress.fromHexInputRelaxed("0xa"),
|
|
1819
|
+
* AccountAddress.fromHexInputRelaxed("0xb"),
|
|
1820
|
+
* );
|
|
1821
|
+
* const serializer = new Serializer();
|
|
1822
|
+
* serializer.serializeVector(addresses);
|
|
1823
|
+
* const serializedBytes = serializer.toUint8Array();
|
|
1824
|
+
* // serializedBytes is now the BCS-serialized bytes
|
|
1825
|
+
* // The equivalent value in Move would be:
|
|
1826
|
+
* // `bcs::to_bytes(&vector<address> [@0x1, @0x2, @0xa, @0xb])`;
|
|
1827
|
+
*/
|
|
1828
|
+
serializeVector<T extends Serializable>(values: Array<T>): void;
|
|
1829
|
+
}
|
|
1830
|
+
declare function ensureBoolean(value: unknown): asserts value is boolean;
|
|
1831
|
+
declare const outOfRangeErrorMessage: (value: AnyNumber, min: AnyNumber, max: AnyNumber) => string;
|
|
1832
|
+
declare function validateNumberInRange<T extends AnyNumber>(value: T, minValue: T, maxValue: T): void;
|
|
1833
|
+
|
|
1834
|
+
/**
|
|
1835
|
+
* This interface exists to define Deserializable<T> inputs for functions that
|
|
1836
|
+
* deserialize a byte buffer into a type T.
|
|
1837
|
+
* It is not intended to be implemented or extended, because Typescript has no support
|
|
1838
|
+
* for static methods in interfaces.
|
|
1839
|
+
*/
|
|
1840
|
+
interface Deserializable<T> {
|
|
1841
|
+
deserialize(deserializer: Deserializer): T;
|
|
1842
|
+
}
|
|
1843
|
+
declare class Deserializer {
|
|
1844
|
+
private buffer;
|
|
1845
|
+
private offset;
|
|
1846
|
+
constructor(data: Uint8Array);
|
|
1847
|
+
private read;
|
|
1848
|
+
/**
|
|
1849
|
+
* Deserializes a string. UTF8 string is supported. Reads the string's bytes length "l" first,
|
|
1850
|
+
* and then reads "l" bytes of content. Decodes the byte array into a string.
|
|
1851
|
+
*
|
|
1852
|
+
* BCS layout for "string": string_length | string_content
|
|
1853
|
+
* where string_length is a u32 integer encoded as a uleb128 integer, equal to the number of bytes in string_content.
|
|
1854
|
+
*
|
|
1855
|
+
* @example
|
|
1856
|
+
* ```ts
|
|
1857
|
+
* const deserializer = new Deserializer(new Uint8Array([8, 49, 50, 51, 52, 97, 98, 99, 100]));
|
|
1858
|
+
* assert(deserializer.deserializeStr() === "1234abcd");
|
|
1859
|
+
* ```
|
|
1860
|
+
*/
|
|
1861
|
+
deserializeStr(): string;
|
|
1862
|
+
/**
|
|
1863
|
+
* Deserializes an array of bytes.
|
|
1864
|
+
*
|
|
1865
|
+
* BCS layout for "bytes": bytes_length | bytes
|
|
1866
|
+
* where bytes_length is a u32 integer encoded as a uleb128 integer, equal to the length of the bytes array.
|
|
1867
|
+
*/
|
|
1868
|
+
deserializeBytes(): Uint8Array;
|
|
1869
|
+
/**
|
|
1870
|
+
* Deserializes an array of bytes. The number of bytes to read is already known.
|
|
1871
|
+
*
|
|
1872
|
+
*/
|
|
1873
|
+
deserializeFixedBytes(len: number): Uint8Array;
|
|
1874
|
+
/**
|
|
1875
|
+
* Deserializes a boolean value.
|
|
1876
|
+
*
|
|
1877
|
+
* BCS layout for "boolean": One byte. "0x01" for true and "0x00" for false.
|
|
1878
|
+
*/
|
|
1879
|
+
deserializeBool(): boolean;
|
|
1880
|
+
/**
|
|
1881
|
+
* Deserializes a uint8 number.
|
|
1882
|
+
*
|
|
1883
|
+
* BCS layout for "uint8": One byte. Binary format in little-endian representation.
|
|
1884
|
+
*/
|
|
1885
|
+
deserializeU8(): Uint8;
|
|
1886
|
+
/**
|
|
1887
|
+
* Deserializes a uint16 number.
|
|
1888
|
+
*
|
|
1889
|
+
* BCS layout for "uint16": Two bytes. Binary format in little-endian representation.
|
|
1890
|
+
* @example
|
|
1891
|
+
* ```ts
|
|
1892
|
+
* const deserializer = new Deserializer(new Uint8Array([0x34, 0x12]));
|
|
1893
|
+
* assert(deserializer.deserializeU16() === 4660);
|
|
1894
|
+
* ```
|
|
1895
|
+
*/
|
|
1896
|
+
deserializeU16(): Uint16;
|
|
1897
|
+
/**
|
|
1898
|
+
* Deserializes a uint32 number.
|
|
1899
|
+
*
|
|
1900
|
+
* BCS layout for "uint32": Four bytes. Binary format in little-endian representation.
|
|
1901
|
+
* @example
|
|
1902
|
+
* ```ts
|
|
1903
|
+
* const deserializer = new Deserializer(new Uint8Array([0x78, 0x56, 0x34, 0x12]));
|
|
1904
|
+
* assert(deserializer.deserializeU32() === 305419896);
|
|
1905
|
+
* ```
|
|
1906
|
+
*/
|
|
1907
|
+
deserializeU32(): Uint32;
|
|
1908
|
+
/**
|
|
1909
|
+
* Deserializes a uint64 number.
|
|
1910
|
+
*
|
|
1911
|
+
* BCS layout for "uint64": Eight bytes. Binary format in little-endian representation.
|
|
1912
|
+
* @example
|
|
1913
|
+
* ```ts
|
|
1914
|
+
* const deserializer = new Deserializer(new Uint8Array([0x00, 0xEF, 0xCD, 0xAB, 0x78, 0x56, 0x34, 0x12]));
|
|
1915
|
+
* assert(deserializer.deserializeU64() === 1311768467750121216);
|
|
1916
|
+
* ```
|
|
1917
|
+
*/
|
|
1918
|
+
deserializeU64(): Uint64;
|
|
1919
|
+
/**
|
|
1920
|
+
* Deserializes a uint128 number.
|
|
1921
|
+
*
|
|
1922
|
+
* BCS layout for "uint128": Sixteen bytes. Binary format in little-endian representation.
|
|
1923
|
+
*/
|
|
1924
|
+
deserializeU128(): Uint128;
|
|
1925
|
+
/**
|
|
1926
|
+
* Deserializes a uint256 number.
|
|
1927
|
+
*
|
|
1928
|
+
* BCS layout for "uint256": Thirty-two bytes. Binary format in little-endian representation.
|
|
1929
|
+
*/
|
|
1930
|
+
deserializeU256(): Uint256;
|
|
1931
|
+
/**
|
|
1932
|
+
* Deserializes a uleb128 encoded uint32 number.
|
|
1933
|
+
*
|
|
1934
|
+
* BCS use uleb128 encoding in two cases: (1) lengths of variable-length sequences and (2) tags of enum values
|
|
1935
|
+
*/
|
|
1936
|
+
deserializeUleb128AsU32(): Uint32;
|
|
1937
|
+
/**
|
|
1938
|
+
* Helper function that primarily exists to support alternative syntax for deserialization.
|
|
1939
|
+
* That is, if we have a `const deserializer: new Deserializer(...)`, instead of having to use
|
|
1940
|
+
* `MyClass.deserialize(deserializer)`, we can call `deserializer.deserialize(MyClass)`.
|
|
1941
|
+
*
|
|
1942
|
+
* @example const deserializer = new Deserializer(new Uint8Array([1, 2, 3]));
|
|
1943
|
+
* const value = deserializer.deserialize(MyClass); // where MyClass has a `deserialize` function
|
|
1944
|
+
* // value is now an instance of MyClass
|
|
1945
|
+
* // equivalent to `const value = MyClass.deserialize(deserializer)`
|
|
1946
|
+
* @param cls The BCS-deserializable class to deserialize the buffered bytes into.
|
|
1947
|
+
*
|
|
1948
|
+
* @returns the deserialized value of class type T
|
|
1949
|
+
*/
|
|
1950
|
+
deserialize<T>(cls: Deserializable<T>): T;
|
|
1951
|
+
/**
|
|
1952
|
+
* Deserializes an array of BCS Deserializable values given an existing Deserializer
|
|
1953
|
+
* instance with a loaded byte buffer.
|
|
1954
|
+
*
|
|
1955
|
+
* @param cls The BCS-deserializable class to deserialize the buffered bytes into.
|
|
1956
|
+
* @example
|
|
1957
|
+
* // serialize a vector of addresses
|
|
1958
|
+
* const addresses = new Array<AccountAddress>(
|
|
1959
|
+
* AccountAddress.fromHexInputRelaxed("0x1"),
|
|
1960
|
+
* AccountAddress.fromHexInputRelaxed("0x2"),
|
|
1961
|
+
* AccountAddress.fromHexInputRelaxed("0xa"),
|
|
1962
|
+
* AccountAddress.fromHexInputRelaxed("0xb"),
|
|
1963
|
+
* );
|
|
1964
|
+
* const serializer = new Serializer();
|
|
1965
|
+
* serializer.serializeVector(addresses);
|
|
1966
|
+
* const serializedBytes = serializer.toUint8Array();
|
|
1967
|
+
*
|
|
1968
|
+
* // deserialize the bytes into an array of addresses
|
|
1969
|
+
* const deserializer = new Deserializer(serializedBytes);
|
|
1970
|
+
* const deserializedAddresses = deserializer.deserializeVector(AccountAddress);
|
|
1971
|
+
* // deserializedAddresses is now an array of AccountAddress instances
|
|
1972
|
+
* @returns an array of deserialized values of type T
|
|
1973
|
+
*/
|
|
1974
|
+
deserializeVector<T>(cls: Deserializable<T>): Array<T>;
|
|
1975
|
+
}
|
|
1976
|
+
|
|
1977
|
+
interface TransactionArgument extends EntryFunctionArgument, ScriptFunctionArgument {
|
|
1978
|
+
}
|
|
1979
|
+
interface EntryFunctionArgument {
|
|
1980
|
+
/**
|
|
1981
|
+
* Serialize an argument to BCS-serialized bytes.
|
|
1982
|
+
*/
|
|
1983
|
+
serialize(serializer: Serializer): void;
|
|
1984
|
+
/**
|
|
1985
|
+
* Serialize an argument as a type-agnostic, fixed byte sequence. The byte sequence contains
|
|
1986
|
+
* the number of the following bytes followed by the BCS-serialized bytes for a typed argument.
|
|
1987
|
+
*/
|
|
1988
|
+
serializeForEntryFunction(serializer: Serializer): void;
|
|
1989
|
+
bcsToBytes(): Uint8Array;
|
|
1990
|
+
bcsToHex(): Hex;
|
|
1991
|
+
}
|
|
1992
|
+
interface ScriptFunctionArgument {
|
|
1993
|
+
/**
|
|
1994
|
+
* Serialize an argument to BCS-serialized bytes.
|
|
1995
|
+
*/
|
|
1996
|
+
serialize(serializer: Serializer): void;
|
|
1997
|
+
/**
|
|
1998
|
+
* Serialize an argument to BCS-serialized bytes as a type aware byte sequence.
|
|
1999
|
+
* The byte sequence contains an enum variant index followed by the BCS-serialized
|
|
2000
|
+
* bytes for a typed argument.
|
|
2001
|
+
*/
|
|
2002
|
+
serializeForScriptFunction(serializer: Serializer): void;
|
|
2003
|
+
bcsToBytes(): Uint8Array;
|
|
2004
|
+
bcsToHex(): Hex;
|
|
2005
|
+
}
|
|
2006
|
+
|
|
2007
|
+
/**
|
|
2008
|
+
* This enum is used to explain why an address was invalid.
|
|
2009
|
+
*/
|
|
2010
|
+
declare enum AddressInvalidReason {
|
|
2011
|
+
INCORRECT_NUMBER_OF_BYTES = "incorrect_number_of_bytes",
|
|
2012
|
+
INVALID_HEX_CHARS = "invalid_hex_chars",
|
|
2013
|
+
TOO_SHORT = "too_short",
|
|
2014
|
+
TOO_LONG = "too_long",
|
|
2015
|
+
LEADING_ZERO_X_REQUIRED = "leading_zero_x_required",
|
|
2016
|
+
LONG_FORM_REQUIRED_UNLESS_SPECIAL = "long_form_required_unless_special",
|
|
2017
|
+
INVALID_PADDING_ZEROES = "INVALID_PADDING_ZEROES"
|
|
2018
|
+
}
|
|
2019
|
+
/**
|
|
2020
|
+
* NOTE: Only use this class for account addresses. For other hex data, e.g. transaction
|
|
2021
|
+
* hashes, use the Hex class.
|
|
2022
|
+
*
|
|
2023
|
+
* AccountAddress is used for working with account addresses. Account addresses, when
|
|
2024
|
+
* represented as a string, generally look like these examples:
|
|
2025
|
+
* - 0x1
|
|
2026
|
+
* - 0xaa86fe99004361f747f91342ca13c426ca0cccb0c1217677180c9493bad6ef0c
|
|
2027
|
+
*
|
|
2028
|
+
* Proper formatting and parsing of account addresses is defined by AIP-40.
|
|
2029
|
+
* To learn more about the standard, read the AIP here:
|
|
2030
|
+
* https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.
|
|
2031
|
+
*
|
|
2032
|
+
* The comments in this class make frequent reference to the LONG and SHORT formats,
|
|
2033
|
+
* as well as "special" addresses. To learn what these refer to see AIP-40.
|
|
2034
|
+
*/
|
|
2035
|
+
declare class AccountAddress extends Serializable implements TransactionArgument {
|
|
2036
|
+
/**
|
|
2037
|
+
* This is the internal representation of an account address.
|
|
2038
|
+
*/
|
|
2039
|
+
readonly data: Uint8Array;
|
|
2040
|
+
/**
|
|
2041
|
+
* The number of bytes that make up an account address.
|
|
2042
|
+
*/
|
|
2043
|
+
static readonly LENGTH: number;
|
|
2044
|
+
/**
|
|
2045
|
+
* The length of an address string in LONG form without a leading 0x.
|
|
2046
|
+
*/
|
|
2047
|
+
static readonly LONG_STRING_LENGTH: number;
|
|
2048
|
+
static ONE: AccountAddress;
|
|
2049
|
+
static TWO: AccountAddress;
|
|
2050
|
+
static THREE: AccountAddress;
|
|
2051
|
+
static FOUR: AccountAddress;
|
|
2052
|
+
/**
|
|
2053
|
+
* Creates an instance of AccountAddress from a Uint8Array.
|
|
2054
|
+
*
|
|
2055
|
+
* @param args.data A Uint8Array representing an account address.
|
|
2056
|
+
*/
|
|
2057
|
+
constructor(args: {
|
|
2058
|
+
data: Uint8Array;
|
|
2059
|
+
});
|
|
2060
|
+
/**
|
|
2061
|
+
* Returns whether an address is special, where special is defined as 0x0 to 0xf
|
|
2062
|
+
* inclusive. In other words, the last byte of the address must be < 0b10000 (16)
|
|
2063
|
+
* and every other byte must be zero.
|
|
2064
|
+
*
|
|
2065
|
+
* For more information on how special addresses are defined see AIP-40:
|
|
2066
|
+
* https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.
|
|
2067
|
+
*
|
|
2068
|
+
* @returns true if the address is special, false if not.
|
|
2069
|
+
*/
|
|
2070
|
+
isSpecial(): boolean;
|
|
2071
|
+
/**
|
|
2072
|
+
* Return the AccountAddress as a string as per AIP-40.
|
|
2073
|
+
* https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.
|
|
2074
|
+
*
|
|
2075
|
+
* In short, it means that special addresses are represented in SHORT form, meaning
|
|
2076
|
+
* 0x0 through to 0xf inclusive, and every other address is represented in LONG form,
|
|
2077
|
+
* meaning 0x + 64 hex characters.
|
|
2078
|
+
*
|
|
2079
|
+
* @returns AccountAddress as a string conforming to AIP-40.
|
|
2080
|
+
*/
|
|
2081
|
+
toString(): string;
|
|
2082
|
+
/**
|
|
2083
|
+
* NOTE: Prefer to use `toString` where possible.
|
|
2084
|
+
*
|
|
2085
|
+
* Return the AccountAddress as a string as per AIP-40 but without the leading 0x.
|
|
2086
|
+
*
|
|
2087
|
+
* Learn more by reading the docstring of `toString`.
|
|
2088
|
+
*
|
|
2089
|
+
* @returns AccountAddress as a string conforming to AIP-40 but without the leading 0x.
|
|
2090
|
+
*/
|
|
2091
|
+
toStringWithoutPrefix(): string;
|
|
2092
|
+
/**
|
|
2093
|
+
* NOTE: Prefer to use `toString` where possible.
|
|
2094
|
+
*
|
|
2095
|
+
* Whereas toString will format special addresses (as defined by isSpecial) using the
|
|
2096
|
+
* SHORT form (no leading 0s), this format the address in the LONG format
|
|
2097
|
+
* unconditionally.
|
|
2098
|
+
*
|
|
2099
|
+
* This means it will be 0x + 64 hex characters.
|
|
2100
|
+
*
|
|
2101
|
+
* @returns AccountAddress as a string in LONG form.
|
|
2102
|
+
*/
|
|
2103
|
+
toStringLong(): string;
|
|
2104
|
+
/**
|
|
2105
|
+
* NOTE: Prefer to use `toString` where possible.
|
|
2106
|
+
*
|
|
2107
|
+
* Whereas toString will format special addresses (as defined by isSpecial) using the
|
|
2108
|
+
* SHORT form (no leading 0s), this function will include leading zeroes. The string
|
|
2109
|
+
* will not have a leading zero.
|
|
2110
|
+
*
|
|
2111
|
+
* This means it will be 64 hex characters without a leading 0x.
|
|
2112
|
+
*
|
|
2113
|
+
* @returns AccountAddress as a string in LONG form without a leading 0x.
|
|
2114
|
+
*/
|
|
2115
|
+
toStringLongWithoutPrefix(): string;
|
|
2116
|
+
/**
|
|
2117
|
+
* Get the inner hex data. The inner data is already a Uint8Array so no conversion
|
|
2118
|
+
* is taking place here, it just returns the inner data.
|
|
2119
|
+
*
|
|
2120
|
+
* @returns Hex data as Uint8Array
|
|
2121
|
+
*/
|
|
2122
|
+
toUint8Array(): Uint8Array;
|
|
2123
|
+
/**
|
|
2124
|
+
* Serialize the AccountAddress to a Serializer instance's data buffer.
|
|
2125
|
+
* @param serializer The serializer to serialize the AccountAddress to.
|
|
2126
|
+
* @returns void
|
|
2127
|
+
* @example
|
|
2128
|
+
* const serializer = new Serializer();
|
|
2129
|
+
* const address = AccountAddress.fromString("0x1");
|
|
2130
|
+
* address.serialize(serializer);
|
|
2131
|
+
* const bytes = serializer.toUint8Array();
|
|
2132
|
+
* // `bytes` is now the BCS-serialized address.
|
|
2133
|
+
*/
|
|
2134
|
+
serialize(serializer: Serializer): void;
|
|
2135
|
+
serializeForEntryFunction(serializer: Serializer): void;
|
|
2136
|
+
serializeForScriptFunction(serializer: Serializer): void;
|
|
2137
|
+
/**
|
|
2138
|
+
* Deserialize an AccountAddress from the byte buffer in a Deserializer instance.
|
|
2139
|
+
* @param deserializer The deserializer to deserialize the AccountAddress from.
|
|
2140
|
+
* @returns An instance of AccountAddress.
|
|
2141
|
+
* @example
|
|
2142
|
+
* const bytes = hexToBytes("0x0102030405060708091011121314151617181920212223242526272829303132");
|
|
2143
|
+
* const deserializer = new Deserializer(bytes);
|
|
2144
|
+
* const address = AccountAddress.deserialize(deserializer);
|
|
2145
|
+
* // `address` is now an instance of AccountAddress.
|
|
2146
|
+
*/
|
|
2147
|
+
static deserialize(deserializer: Deserializer): AccountAddress;
|
|
2148
|
+
/**
|
|
2149
|
+
* NOTE: This function has strict parsing behavior. For relaxed behavior, please use
|
|
2150
|
+
* the `fromStringRelaxed` function.
|
|
2151
|
+
*
|
|
2152
|
+
* Creates an instance of AccountAddress from a hex string.
|
|
2153
|
+
*
|
|
2154
|
+
* This function allows only the strictest formats defined by AIP-40. In short this
|
|
2155
|
+
* means only the following formats are accepted:
|
|
2156
|
+
*
|
|
2157
|
+
* - LONG
|
|
2158
|
+
* - SHORT for special addresses
|
|
2159
|
+
*
|
|
2160
|
+
* Where:
|
|
2161
|
+
* - LONG is defined as 0x + 64 hex characters.
|
|
2162
|
+
* - SHORT for special addresses is 0x0 to 0xf inclusive without padding zeroes.
|
|
2163
|
+
*
|
|
2164
|
+
* This means the following are not accepted:
|
|
2165
|
+
* - SHORT for non-special addresses.
|
|
2166
|
+
* - Any address without a leading 0x.
|
|
2167
|
+
*
|
|
2168
|
+
* Learn more about the different address formats by reading AIP-40:
|
|
2169
|
+
* https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.
|
|
2170
|
+
*
|
|
2171
|
+
* @param input A hex string representing an account address.
|
|
2172
|
+
*
|
|
2173
|
+
* @returns An instance of AccountAddress.
|
|
2174
|
+
*/
|
|
2175
|
+
static fromString(input: string): AccountAddress;
|
|
2176
|
+
/**
|
|
2177
|
+
* NOTE: This function has relaxed parsing behavior. For strict behavior, please use
|
|
2178
|
+
* the `fromString` function. Where possible use `fromString` rather than this
|
|
2179
|
+
* function, `fromStringRelaxed` is only provided for backwards compatibility.
|
|
2180
|
+
*
|
|
2181
|
+
* Creates an instance of AccountAddress from a hex string.
|
|
2182
|
+
*
|
|
2183
|
+
* This function allows all formats defined by AIP-40. In short this means the
|
|
2184
|
+
* following formats are accepted:
|
|
2185
|
+
*
|
|
2186
|
+
* - LONG, with or without leading 0x
|
|
2187
|
+
* - SHORT, with or without leading 0x
|
|
2188
|
+
*
|
|
2189
|
+
* Where:
|
|
2190
|
+
* - LONG is 64 hex characters.
|
|
2191
|
+
* - SHORT is 1 to 63 hex characters inclusive.
|
|
2192
|
+
* - Padding zeroes are allowed, e.g. 0x0123 is valid.
|
|
2193
|
+
*
|
|
2194
|
+
* Learn more about the different address formats by reading AIP-40:
|
|
2195
|
+
* https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.
|
|
2196
|
+
*
|
|
2197
|
+
* @param input A hex string representing an account address.
|
|
2198
|
+
*
|
|
2199
|
+
* @returns An instance of AccountAddress.
|
|
2200
|
+
*/
|
|
2201
|
+
static fromStringRelaxed(input: string): AccountAddress;
|
|
2202
|
+
/**
|
|
2203
|
+
* Convenience method for creating an AccountAddress from HexInput. For
|
|
2204
|
+
* more information on how this works, see the constructor and fromString.
|
|
2205
|
+
*
|
|
2206
|
+
* @param input A hex string or Uint8Array representing an account address.
|
|
2207
|
+
*
|
|
2208
|
+
* @returns An instance of AccountAddress.
|
|
2209
|
+
*/
|
|
2210
|
+
static fromHexInput(input: HexInput): AccountAddress;
|
|
2211
|
+
/**
|
|
2212
|
+
* Convenience method for creating an AccountAddress from HexInput. For
|
|
2213
|
+
* more information on how this works, see the constructor and fromStringRelaxed.
|
|
2214
|
+
*
|
|
2215
|
+
* @param hexInput A hex string or Uint8Array representing an account address.
|
|
2216
|
+
*
|
|
2217
|
+
* @returns An instance of AccountAddress.
|
|
2218
|
+
*/
|
|
2219
|
+
static fromHexInputRelaxed(hexInput: HexInput): AccountAddress;
|
|
2220
|
+
/**
|
|
2221
|
+
* Check if the string is a valid AccountAddress.
|
|
2222
|
+
*
|
|
2223
|
+
* @param args.input A hex string representing an account address.
|
|
2224
|
+
* @param args.relaxed If true, use relaxed parsing behavior. If false, use strict parsing behavior.
|
|
2225
|
+
*
|
|
2226
|
+
* @returns valid = true if the string is valid, valid = false if not. If the string
|
|
2227
|
+
* is not valid, invalidReason will be set explaining why it is invalid.
|
|
2228
|
+
*/
|
|
2229
|
+
static isValid(args: {
|
|
2230
|
+
input: string;
|
|
2231
|
+
relaxed?: boolean;
|
|
2232
|
+
}): ParsingResult<AddressInvalidReason>;
|
|
2233
|
+
/**
|
|
2234
|
+
* Return whether AccountAddresses are equal. AccountAddresses are considered equal
|
|
2235
|
+
* if their underlying byte data is identical.
|
|
2236
|
+
*
|
|
2237
|
+
* @param other The AccountAddress to compare to.
|
|
2238
|
+
* @returns true if the AccountAddresses are equal, false if not.
|
|
2239
|
+
*/
|
|
2240
|
+
equals(other: AccountAddress): boolean;
|
|
2241
|
+
}
|
|
2242
|
+
|
|
2243
|
+
/**
|
|
2244
|
+
* This class exists to represent a contiguous sequence of already serialized BCS-bytes.
|
|
2245
|
+
*
|
|
2246
|
+
* It differs from most other Serializable classes in that its internal byte buffer is serialized to BCS
|
|
2247
|
+
* bytes exactly as-is, without prepending the length of the bytes.
|
|
2248
|
+
*
|
|
2249
|
+
* If you want to write your own serialization function and pass the bytes as a transaction argument,
|
|
2250
|
+
* you should use this class.
|
|
2251
|
+
*
|
|
2252
|
+
* This class is also more generally used to represent type-agnostic BCS bytes as a vector<u8>.
|
|
2253
|
+
*
|
|
2254
|
+
* An example of this is the bytes resulting from entry function arguments that have been serialized
|
|
2255
|
+
* for an entry function.
|
|
2256
|
+
*
|
|
2257
|
+
* @example
|
|
2258
|
+
* const yourCustomSerializedBytes = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]);
|
|
2259
|
+
* const fixedBytes = new FixedBytes(yourCustomSerializedBytes);
|
|
2260
|
+
* const payload = generateTransactionPayload({
|
|
2261
|
+
* function: "0xbeefcafe::your_module::your_function_that_requires_custom_serialization",
|
|
2262
|
+
* arguments: [yourCustomBytes],
|
|
2263
|
+
* });
|
|
2264
|
+
*
|
|
2265
|
+
* For example, if you store each of the 32 bytes for an address as a U8 in a MoveVector<U8>, when you
|
|
2266
|
+
* serialize that MoveVector<U8>, it will be serialized to 33 bytes. If you solely want to pass around
|
|
2267
|
+
* the 32 bytes as a Serializable class that *does not* prepend the length to the BCS-serialized representation,
|
|
2268
|
+
* use this class.
|
|
2269
|
+
*
|
|
2270
|
+
* @params value: HexInput representing a sequence of Uint8 bytes
|
|
2271
|
+
* @returns a Serializable FixedBytes instance, which when serialized, does not prepend the length of the bytes
|
|
2272
|
+
* @see EntryFunctionBytes
|
|
2273
|
+
*/
|
|
2274
|
+
declare class FixedBytes extends Serializable implements TransactionArgument {
|
|
2275
|
+
value: Uint8Array;
|
|
2276
|
+
constructor(value: HexInput);
|
|
2277
|
+
serialize(serializer: Serializer): void;
|
|
2278
|
+
serializeForEntryFunction(serializer: Serializer): void;
|
|
2279
|
+
serializeForScriptFunction(serializer: Serializer): void;
|
|
2280
|
+
static deserialize(deserializer: Deserializer, length: number): FixedBytes;
|
|
2281
|
+
}
|
|
2282
|
+
|
|
2283
|
+
/**
|
|
2284
|
+
* This class exists solely to represent a sequence of fixed bytes as a serialized entry function, because
|
|
2285
|
+
* serializing an entry function appends a prefix that's *only* used for entry function arguments.
|
|
2286
|
+
*
|
|
2287
|
+
* NOTE: Attempting to use this class for a serialized script function will result in erroneous
|
|
2288
|
+
* and unexpected behavior.
|
|
2289
|
+
*
|
|
2290
|
+
* If you wish to convert this class back to a TransactionArgument, you must know the type
|
|
2291
|
+
* of the argument beforehand, and use the appropriate class to deserialize the bytes within
|
|
2292
|
+
* an instance of this class.
|
|
2293
|
+
*/
|
|
2294
|
+
declare class EntryFunctionBytes extends Serializable implements EntryFunctionArgument {
|
|
2295
|
+
readonly value: FixedBytes;
|
|
2296
|
+
private constructor();
|
|
2297
|
+
serialize(serializer: Serializer): void;
|
|
2298
|
+
serializeForEntryFunction(serializer: Serializer): void;
|
|
2299
|
+
/**
|
|
2300
|
+
* The only way to create an instance of this class is to use this static method.
|
|
2301
|
+
*
|
|
2302
|
+
* This function should only be used when deserializing a sequence of EntryFunctionPayload arguments.
|
|
2303
|
+
* @param deserializer the deserializer instance with the buffered bytes
|
|
2304
|
+
* @param length the length of the bytes to deserialize
|
|
2305
|
+
* @returns an instance of this class, which will now only be usable as an EntryFunctionArgument
|
|
2306
|
+
*/
|
|
2307
|
+
static deserialize(deserializer: Deserializer, length: number): EntryFunctionBytes;
|
|
2308
|
+
}
|
|
2309
|
+
|
|
2310
|
+
declare class Bool extends Serializable implements TransactionArgument {
|
|
2311
|
+
readonly value: boolean;
|
|
2312
|
+
constructor(value: boolean);
|
|
2313
|
+
serialize(serializer: Serializer): void;
|
|
2314
|
+
serializeForEntryFunction(serializer: Serializer): void;
|
|
2315
|
+
serializeForScriptFunction(serializer: Serializer): void;
|
|
2316
|
+
static deserialize(deserializer: Deserializer): Bool;
|
|
2317
|
+
}
|
|
2318
|
+
declare class U8 extends Serializable implements TransactionArgument {
|
|
2319
|
+
readonly value: Uint8;
|
|
2320
|
+
constructor(value: Uint8);
|
|
2321
|
+
serialize(serializer: Serializer): void;
|
|
2322
|
+
serializeForEntryFunction(serializer: Serializer): void;
|
|
2323
|
+
serializeForScriptFunction(serializer: Serializer): void;
|
|
2324
|
+
static deserialize(deserializer: Deserializer): U8;
|
|
2325
|
+
}
|
|
2326
|
+
declare class U16 extends Serializable implements TransactionArgument {
|
|
2327
|
+
readonly value: Uint16;
|
|
2328
|
+
constructor(value: Uint16);
|
|
2329
|
+
serialize(serializer: Serializer): void;
|
|
2330
|
+
serializeForEntryFunction(serializer: Serializer): void;
|
|
2331
|
+
serializeForScriptFunction(serializer: Serializer): void;
|
|
2332
|
+
static deserialize(deserializer: Deserializer): U16;
|
|
2333
|
+
}
|
|
2334
|
+
declare class U32 extends Serializable implements TransactionArgument {
|
|
2335
|
+
readonly value: Uint32;
|
|
2336
|
+
constructor(value: Uint32);
|
|
2337
|
+
serialize(serializer: Serializer): void;
|
|
2338
|
+
serializeForEntryFunction(serializer: Serializer): void;
|
|
2339
|
+
serializeForScriptFunction(serializer: Serializer): void;
|
|
2340
|
+
static deserialize(deserializer: Deserializer): U32;
|
|
2341
|
+
}
|
|
2342
|
+
declare class U64 extends Serializable implements TransactionArgument {
|
|
2343
|
+
readonly value: bigint;
|
|
2344
|
+
constructor(value: AnyNumber);
|
|
2345
|
+
serialize(serializer: Serializer): void;
|
|
2346
|
+
serializeForEntryFunction(serializer: Serializer): void;
|
|
2347
|
+
serializeForScriptFunction(serializer: Serializer): void;
|
|
2348
|
+
static deserialize(deserializer: Deserializer): U64;
|
|
2349
|
+
}
|
|
2350
|
+
declare class U128 extends Serializable implements TransactionArgument {
|
|
2351
|
+
readonly value: bigint;
|
|
2352
|
+
constructor(value: AnyNumber);
|
|
2353
|
+
serialize(serializer: Serializer): void;
|
|
2354
|
+
serializeForEntryFunction(serializer: Serializer): void;
|
|
2355
|
+
serializeForScriptFunction(serializer: Serializer): void;
|
|
2356
|
+
static deserialize(deserializer: Deserializer): U128;
|
|
2357
|
+
}
|
|
2358
|
+
declare class U256 extends Serializable implements TransactionArgument {
|
|
2359
|
+
readonly value: bigint;
|
|
2360
|
+
constructor(value: AnyNumber);
|
|
2361
|
+
serialize(serializer: Serializer): void;
|
|
2362
|
+
serializeForEntryFunction(serializer: Serializer): void;
|
|
2363
|
+
serializeForScriptFunction(serializer: Serializer): void;
|
|
2364
|
+
static deserialize(deserializer: Deserializer): U256;
|
|
2365
|
+
}
|
|
2366
|
+
|
|
2367
|
+
/**
|
|
2368
|
+
* This class is the Aptos Typescript SDK representation of a Move `vector<T>`,
|
|
2369
|
+
* where `T` represents either a primitive type (`bool`, `u8`, `u64`, ...)
|
|
2370
|
+
* or a BCS-serializable struct itself.
|
|
2371
|
+
*
|
|
2372
|
+
* It is a BCS-serializable, array-like type that contains an array of values of type `T`,
|
|
2373
|
+
* where `T` is a class that implements `Serializable`.
|
|
2374
|
+
*
|
|
2375
|
+
* The purpose of this class is to facilitate easy construction of BCS-serializable
|
|
2376
|
+
* Move `vector<T>` types.
|
|
2377
|
+
*
|
|
2378
|
+
* @example
|
|
2379
|
+
* // in Move: `vector<u8> [1, 2, 3, 4];`
|
|
2380
|
+
* const vecOfU8s = new MoveVector<U8>([new U8(1), new U8(2), new U8(3), new U8(4)]);
|
|
2381
|
+
* // in Move: `std::bcs::to_bytes(vector<u8> [1, 2, 3, 4]);`
|
|
2382
|
+
* const bcsBytes = vecOfU8s.toUint8Array();
|
|
2383
|
+
*
|
|
2384
|
+
* // vector<vector<u8>> [ vector<u8> [1], vector<u8> [1, 2, 3, 4], vector<u8> [5, 6, 7, 8] ];
|
|
2385
|
+
* const vecOfVecs = new MoveVector<MoveVector<U8>>([
|
|
2386
|
+
* new MoveVector<U8>([new U8(1)]),
|
|
2387
|
+
* MoveVector.U8([1, 2, 3, 4]),
|
|
2388
|
+
* MoveVector.U8([5, 6, 7, 8]),
|
|
2389
|
+
* ]);
|
|
2390
|
+
*
|
|
2391
|
+
* // vector<Option<u8>> [ std::option::some<u8>(1), std::option::some<u8>(2) ];
|
|
2392
|
+
* const vecOfOptionU8s = new MoveVector<MoveOption<U8>>([
|
|
2393
|
+
* MoveOption.U8(1),
|
|
2394
|
+
* MoveOption.U8(2),
|
|
2395
|
+
* ]);
|
|
2396
|
+
*
|
|
2397
|
+
* // vector<MoveString> [ std::string::utf8(b"hello"), std::string::utf8(b"world") ];
|
|
2398
|
+
* const vecOfStrings = new MoveVector([new MoveString("hello"), new MoveString("world")]);
|
|
2399
|
+
* const vecOfStrings2 = MoveVector.MoveString(["hello", "world"]);
|
|
2400
|
+
*
|
|
2401
|
+
* // where MySerializableStruct is a class you've made that implements Serializable
|
|
2402
|
+
* const vecOfSerializableValues = new MoveVector<MySerializableStruct>([
|
|
2403
|
+
* new MySerializableStruct("hello", "world"),
|
|
2404
|
+
* new MySerializableStruct("foo", "bar"),
|
|
2405
|
+
* ]);
|
|
2406
|
+
* @params
|
|
2407
|
+
* values: an Array<T> of values where T is a class that implements Serializable
|
|
2408
|
+
* @returns a `MoveVector<T>` with the values `values`
|
|
2409
|
+
*/
|
|
2410
|
+
declare class MoveVector<T extends Serializable> extends Serializable implements TransactionArgument {
|
|
2411
|
+
values: Array<T>;
|
|
2412
|
+
constructor(values: Array<T>);
|
|
2413
|
+
serializeForEntryFunction(serializer: Serializer): void;
|
|
2414
|
+
/**
|
|
2415
|
+
* NOTE: This function will only work when the inner values in the `MoveVector` are `U8`s.
|
|
2416
|
+
* @param serializer
|
|
2417
|
+
*/
|
|
2418
|
+
serializeForScriptFunction(serializer: Serializer): void;
|
|
2419
|
+
/**
|
|
2420
|
+
* Factory method to generate a MoveVector of U8s from an array of numbers.
|
|
2421
|
+
*
|
|
2422
|
+
* @example
|
|
2423
|
+
* const v = MoveVector.U8([1, 2, 3, 4]);
|
|
2424
|
+
* @params values: an array of `numbers` to convert to U8s
|
|
2425
|
+
* @returns a `MoveVector<U8>`
|
|
2426
|
+
*/
|
|
2427
|
+
static U8(values: Array<number> | HexInput): MoveVector<U8>;
|
|
2428
|
+
/**
|
|
2429
|
+
* Factory method to generate a MoveVector of U16s from an array of numbers.
|
|
2430
|
+
*
|
|
2431
|
+
* @example
|
|
2432
|
+
* const v = MoveVector.U16([1, 2, 3, 4]);
|
|
2433
|
+
* @params values: an array of `numbers` to convert to U16s
|
|
2434
|
+
* @returns a `MoveVector<U16>`
|
|
2435
|
+
*/
|
|
2436
|
+
static U16(values: Array<number>): MoveVector<U16>;
|
|
2437
|
+
/**
|
|
2438
|
+
* Factory method to generate a MoveVector of U32s from an array of numbers.
|
|
2439
|
+
*
|
|
2440
|
+
* @example
|
|
2441
|
+
* const v = MoveVector.U32([1, 2, 3, 4]);
|
|
2442
|
+
* @params values: an array of `numbers` to convert to U32s
|
|
2443
|
+
* @returns a `MoveVector<U32>`
|
|
2444
|
+
*/
|
|
2445
|
+
static U32(values: Array<number>): MoveVector<U32>;
|
|
2446
|
+
/**
|
|
2447
|
+
* Factory method to generate a MoveVector of U64s from an array of numbers or bigints.
|
|
2448
|
+
*
|
|
2449
|
+
* @example
|
|
2450
|
+
* const v = MoveVector.U64([1, 2, 3, 4]);
|
|
2451
|
+
* @params values: an array of numbers of type `number | bigint` to convert to U64s
|
|
2452
|
+
* @returns a `MoveVector<U64>`
|
|
2453
|
+
*/
|
|
2454
|
+
static U64(values: Array<AnyNumber>): MoveVector<U64>;
|
|
2455
|
+
/**
|
|
2456
|
+
* Factory method to generate a MoveVector of U128s from an array of numbers or bigints.
|
|
2457
|
+
*
|
|
2458
|
+
* @example
|
|
2459
|
+
* const v = MoveVector.U128([1, 2, 3, 4]);
|
|
2460
|
+
* @params values: an array of numbers of type `number | bigint` to convert to U128s
|
|
2461
|
+
* @returns a `MoveVector<U128>`
|
|
2462
|
+
*/
|
|
2463
|
+
static U128(values: Array<AnyNumber>): MoveVector<U128>;
|
|
2464
|
+
/**
|
|
2465
|
+
* Factory method to generate a MoveVector of U256s from an array of numbers or bigints.
|
|
2466
|
+
*
|
|
2467
|
+
* @example
|
|
2468
|
+
* const v = MoveVector.U256([1, 2, 3, 4]);
|
|
2469
|
+
* @params values: an array of numbers of type `number | bigint` to convert to U256s
|
|
2470
|
+
* @returns a `MoveVector<U256>`
|
|
2471
|
+
*/
|
|
2472
|
+
static U256(values: Array<AnyNumber>): MoveVector<U256>;
|
|
2473
|
+
/**
|
|
2474
|
+
* Factory method to generate a MoveVector of Bools from an array of booleans.
|
|
2475
|
+
*
|
|
2476
|
+
* @example
|
|
2477
|
+
* const v = MoveVector.Bool([true, false, true, false]);
|
|
2478
|
+
* @params values: an array of `numbers` to convert to Bools
|
|
2479
|
+
* @returns a `MoveVector<Bool>`
|
|
2480
|
+
*/
|
|
2481
|
+
static Bool(values: Array<boolean>): MoveVector<Bool>;
|
|
2482
|
+
/**
|
|
2483
|
+
* Factory method to generate a MoveVector of MoveStrings from an array of strings.
|
|
2484
|
+
*
|
|
2485
|
+
* @example
|
|
2486
|
+
* const v = MoveVector.MoveString(["hello", "world"]);
|
|
2487
|
+
* @params values: an array of `numbers` to convert to MoveStrings
|
|
2488
|
+
* @returns a `MoveVector<MoveString>`
|
|
2489
|
+
*/
|
|
2490
|
+
static MoveString(values: Array<string>): MoveVector<MoveString>;
|
|
2491
|
+
serialize(serializer: Serializer): void;
|
|
2492
|
+
/**
|
|
2493
|
+
* Deserialize a MoveVector of type T, specifically where T is a Serializable and Deserializable type.
|
|
2494
|
+
*
|
|
2495
|
+
* NOTE: This only works with a depth of one. Generics will not work.
|
|
2496
|
+
*
|
|
2497
|
+
* NOTE: This will not work with types that aren't of the Serializable class.
|
|
2498
|
+
*
|
|
2499
|
+
* If you want to use types that merely implement Deserializable,
|
|
2500
|
+
* please use the deserializeVector function in the Deserializer class.
|
|
2501
|
+
* @example
|
|
2502
|
+
* const vec = MoveVector.deserialize(deserializer, U64);
|
|
2503
|
+
* @params deserializer: the Deserializer instance to use, with bytes loaded into it already.
|
|
2504
|
+
* cls: the class to typecast the input values to, must be a Serializable and Deserializable type.
|
|
2505
|
+
* @returns a MoveVector of the corresponding class T
|
|
2506
|
+
* *
|
|
2507
|
+
*/
|
|
2508
|
+
static deserialize<T extends Serializable>(deserializer: Deserializer, cls: Deserializable<T>): MoveVector<T>;
|
|
2509
|
+
}
|
|
2510
|
+
declare class MoveString extends Serializable implements TransactionArgument {
|
|
2511
|
+
value: string;
|
|
2512
|
+
constructor(value: string);
|
|
2513
|
+
serialize(serializer: Serializer): void;
|
|
2514
|
+
serializeForEntryFunction(serializer: Serializer): void;
|
|
2515
|
+
serializeForScriptFunction(serializer: Serializer): void;
|
|
2516
|
+
static deserialize(deserializer: Deserializer): MoveString;
|
|
2517
|
+
}
|
|
2518
|
+
declare class MoveOption<T extends Serializable> extends Serializable implements EntryFunctionArgument {
|
|
2519
|
+
private vec;
|
|
2520
|
+
readonly value?: T;
|
|
2521
|
+
constructor(value?: T | null);
|
|
2522
|
+
serializeForEntryFunction(serializer: Serializer): void;
|
|
2523
|
+
/**
|
|
2524
|
+
* Retrieves the inner value of the MoveOption.
|
|
2525
|
+
*
|
|
2526
|
+
* This method is inspired by Rust's `Option<T>.unwrap()`.
|
|
2527
|
+
* In Rust, attempting to unwrap a `None` value results in a panic.
|
|
2528
|
+
*
|
|
2529
|
+
* Similarly, this method will throw an error if the value is not present.
|
|
2530
|
+
*
|
|
2531
|
+
* @example
|
|
2532
|
+
* const option = new MoveOption<Bool>(new Bool(true));
|
|
2533
|
+
* const value = option.unwrap(); // Returns the Bool instance
|
|
2534
|
+
*
|
|
2535
|
+
* @throws {Error} Throws an error if the MoveOption does not contain a value.
|
|
2536
|
+
*
|
|
2537
|
+
* @returns {T} The contained value if present.
|
|
2538
|
+
*/
|
|
2539
|
+
unwrap(): T;
|
|
2540
|
+
isSome(): boolean;
|
|
2541
|
+
serialize(serializer: Serializer): void;
|
|
2542
|
+
/**
|
|
2543
|
+
* Factory method to generate a MoveOption<U8> from a `number` or `undefined`.
|
|
2544
|
+
*
|
|
2545
|
+
* @example
|
|
2546
|
+
* MoveOption.U8(1).isSome() === true;
|
|
2547
|
+
* MoveOption.U8().isSome() === false;
|
|
2548
|
+
* MoveOption.U8(undefined).isSome() === false;
|
|
2549
|
+
* @params value: the value used to fill the MoveOption. If `value` is undefined
|
|
2550
|
+
* the resulting MoveOption's .isSome() method will return false.
|
|
2551
|
+
* @returns a MoveOption<U8> with an inner value `value`
|
|
2552
|
+
*/
|
|
2553
|
+
static U8(value?: number | null): MoveOption<U8>;
|
|
2554
|
+
/**
|
|
2555
|
+
* Factory method to generate a MoveOption<U16> from a `number` or `undefined`.
|
|
2556
|
+
*
|
|
2557
|
+
* @example
|
|
2558
|
+
* MoveOption.U16(1).isSome() === true;
|
|
2559
|
+
* MoveOption.U16().isSome() === false;
|
|
2560
|
+
* MoveOption.U16(undefined).isSome() === false;
|
|
2561
|
+
* @params value: the value used to fill the MoveOption. If `value` is undefined
|
|
2562
|
+
* the resulting MoveOption's .isSome() method will return false.
|
|
2563
|
+
* @returns a MoveOption<U16> with an inner value `value`
|
|
2564
|
+
*/
|
|
2565
|
+
static U16(value?: number | null): MoveOption<U16>;
|
|
2566
|
+
/**
|
|
2567
|
+
* Factory method to generate a MoveOption<U32> from a `number` or `undefined`.
|
|
2568
|
+
*
|
|
2569
|
+
* @example
|
|
2570
|
+
* MoveOption.U32(1).isSome() === true;
|
|
2571
|
+
* MoveOption.U32().isSome() === false;
|
|
2572
|
+
* MoveOption.U32(undefined).isSome() === false;
|
|
2573
|
+
* @params value: the value used to fill the MoveOption. If `value` is undefined
|
|
2574
|
+
* the resulting MoveOption's .isSome() method will return false.
|
|
2575
|
+
* @returns a MoveOption<U32> with an inner value `value`
|
|
2576
|
+
*/
|
|
2577
|
+
static U32(value?: number | null): MoveOption<U32>;
|
|
2578
|
+
/**
|
|
2579
|
+
* Factory method to generate a MoveOption<U64> from a `number` or a `bigint` or `undefined`.
|
|
2580
|
+
*
|
|
2581
|
+
* @example
|
|
2582
|
+
* MoveOption.U64(1).isSome() === true;
|
|
2583
|
+
* MoveOption.U64().isSome() === false;
|
|
2584
|
+
* MoveOption.U64(undefined).isSome() === false;
|
|
2585
|
+
* @params value: the value used to fill the MoveOption. If `value` is undefined
|
|
2586
|
+
* the resulting MoveOption's .isSome() method will return false.
|
|
2587
|
+
* @returns a MoveOption<U64> with an inner value `value`
|
|
2588
|
+
*/
|
|
2589
|
+
static U64(value?: AnyNumber | null): MoveOption<U64>;
|
|
2590
|
+
/**
|
|
2591
|
+
* Factory method to generate a MoveOption<U128> from a `number` or a `bigint` or `undefined`.
|
|
2592
|
+
*
|
|
2593
|
+
* @example
|
|
2594
|
+
* MoveOption.U128(1).isSome() === true;
|
|
2595
|
+
* MoveOption.U128().isSome() === false;
|
|
2596
|
+
* MoveOption.U128(undefined).isSome() === false;
|
|
2597
|
+
* @params value: the value used to fill the MoveOption. If `value` is undefined
|
|
2598
|
+
* the resulting MoveOption's .isSome() method will return false.
|
|
2599
|
+
* @returns a MoveOption<U128> with an inner value `value`
|
|
2600
|
+
*/
|
|
2601
|
+
static U128(value?: AnyNumber | null): MoveOption<U128>;
|
|
2602
|
+
/**
|
|
2603
|
+
* Factory method to generate a MoveOption<U256> from a `number` or a `bigint` or `undefined`.
|
|
2604
|
+
*
|
|
2605
|
+
* @example
|
|
2606
|
+
* MoveOption.U256(1).isSome() === true;
|
|
2607
|
+
* MoveOption.U256().isSome() === false;
|
|
2608
|
+
* MoveOption.U256(undefined).isSome() === false;
|
|
2609
|
+
* @params value: the value used to fill the MoveOption. If `value` is undefined
|
|
2610
|
+
* the resulting MoveOption's .isSome() method will return false.
|
|
2611
|
+
* @returns a MoveOption<U256> with an inner value `value`
|
|
2612
|
+
*/
|
|
2613
|
+
static U256(value?: AnyNumber | null): MoveOption<U256>;
|
|
2614
|
+
/**
|
|
2615
|
+
* Factory method to generate a MoveOption<Bool> from a `boolean` or `undefined`.
|
|
2616
|
+
*
|
|
2617
|
+
* @example
|
|
2618
|
+
* MoveOption.Bool(true).isSome() === true;
|
|
2619
|
+
* MoveOption.Bool().isSome() === false;
|
|
2620
|
+
* MoveOption.Bool(undefined).isSome() === false;
|
|
2621
|
+
* @params value: the value used to fill the MoveOption. If `value` is undefined
|
|
2622
|
+
* the resulting MoveOption's .isSome() method will return false.
|
|
2623
|
+
* @returns a MoveOption<Bool> with an inner value `value`
|
|
2624
|
+
*/
|
|
2625
|
+
static Bool(value?: boolean | null): MoveOption<Bool>;
|
|
2626
|
+
/**
|
|
2627
|
+
* Factory method to generate a MoveOption<MoveString> from a `string` or `undefined`.
|
|
2628
|
+
*
|
|
2629
|
+
* @example
|
|
2630
|
+
* MoveOption.MoveString("hello").isSome() === true;
|
|
2631
|
+
* MoveOption.MoveString("").isSome() === true;
|
|
2632
|
+
* MoveOption.MoveString().isSome() === false;
|
|
2633
|
+
* MoveOption.MoveString(undefined).isSome() === false;
|
|
2634
|
+
* @params value: the value used to fill the MoveOption. If `value` is undefined
|
|
2635
|
+
* the resulting MoveOption's .isSome() method will return false.
|
|
2636
|
+
* @returns a MoveOption<MoveString> with an inner value `value`
|
|
2637
|
+
*/
|
|
2638
|
+
static MoveString(value?: string | null): MoveOption<MoveString>;
|
|
2639
|
+
static deserialize<U extends Serializable>(deserializer: Deserializer, cls: Deserializable<U>): MoveOption<U>;
|
|
2640
|
+
}
|
|
2641
|
+
declare class MoveObject extends Serializable implements TransactionArgument {
|
|
2642
|
+
value: AccountAddress;
|
|
2643
|
+
constructor(value: HexInput | AccountAddress);
|
|
2644
|
+
serialize(serializer: Serializer): void;
|
|
2645
|
+
serializeForEntryFunction(serializer: Serializer): void;
|
|
2646
|
+
serializeForScriptFunction(serializer: Serializer): void;
|
|
2647
|
+
static deserialize(deserializer: Deserializer): MoveObject;
|
|
2648
|
+
}
|
|
2649
|
+
|
|
2650
|
+
/**
|
|
2651
|
+
* An abstract representation of a public key. All Asymmetric key pairs will use this to
|
|
2652
|
+
* verify signatures and for authentication keys.
|
|
2653
|
+
*/
|
|
2654
|
+
declare abstract class PublicKey extends Serializable {
|
|
2655
|
+
/**
|
|
2656
|
+
* Verifies that the private key associated with this public key signed the message with the given signature.
|
|
2657
|
+
* @param args.message The message that was signed
|
|
2658
|
+
* @param args.signature The signature to verify
|
|
2659
|
+
*/
|
|
2660
|
+
abstract verifySignature(args: {
|
|
2661
|
+
message: HexInput;
|
|
2662
|
+
signature: Signature;
|
|
2663
|
+
}): boolean;
|
|
2664
|
+
/**
|
|
2665
|
+
* Get the raw public key bytes
|
|
2666
|
+
*/
|
|
2667
|
+
abstract toUint8Array(): Uint8Array;
|
|
2668
|
+
/**
|
|
2669
|
+
* Get the public key as a hex string with a 0x prefix e.g. 0x123456...
|
|
2670
|
+
*/
|
|
2671
|
+
abstract toString(): string;
|
|
2672
|
+
abstract serialize(serializer: Serializer): void;
|
|
2673
|
+
}
|
|
2674
|
+
/**
|
|
2675
|
+
* An abstract representation of a private key. This is used to sign transactions and
|
|
2676
|
+
* derive the public key associated.
|
|
2677
|
+
*/
|
|
2678
|
+
declare abstract class PrivateKey extends Serializable {
|
|
2679
|
+
/**
|
|
2680
|
+
* Sign a message with the key
|
|
2681
|
+
* @param message The message to sign
|
|
2682
|
+
*/
|
|
2683
|
+
abstract sign(message: HexInput): Signature;
|
|
2684
|
+
/**
|
|
2685
|
+
* Get the raw private key bytes
|
|
2686
|
+
*/
|
|
2687
|
+
abstract toUint8Array(): Uint8Array;
|
|
2688
|
+
/**
|
|
2689
|
+
* Get the private key as a hex string with a 0x prefix e.g. 0x123456...
|
|
2690
|
+
*/
|
|
2691
|
+
abstract toString(): string;
|
|
2692
|
+
abstract serialize(serializer: Serializer): void;
|
|
2693
|
+
/**
|
|
2694
|
+
* Derives the public key associated with the private key
|
|
2695
|
+
*/
|
|
2696
|
+
abstract publicKey(): PublicKey;
|
|
2697
|
+
}
|
|
2698
|
+
/**
|
|
2699
|
+
* An abstract representation of a signature. This is the product of signing a
|
|
2700
|
+
* message and can be used with the PublicKey to verify the signature.
|
|
2701
|
+
*/
|
|
2702
|
+
declare abstract class Signature extends Serializable {
|
|
2703
|
+
/**
|
|
2704
|
+
* Get the raw signature bytes
|
|
2705
|
+
*/
|
|
2706
|
+
abstract toUint8Array(): Uint8Array;
|
|
2707
|
+
/**
|
|
2708
|
+
* Get the signature as a hex string with a 0x prefix e.g. 0x123456...
|
|
2709
|
+
*/
|
|
2710
|
+
abstract toString(): string;
|
|
2711
|
+
abstract serialize(serializer: Serializer): void;
|
|
2712
|
+
}
|
|
2713
|
+
|
|
2714
|
+
/**
|
|
2715
|
+
* Class for creating and managing account on Aptos network
|
|
2716
|
+
*
|
|
2717
|
+
* Use this class to create accounts, sign transactions, and more.
|
|
2718
|
+
* Note: Creating an account instance does not create the account on-chain.
|
|
2719
|
+
*/
|
|
2720
|
+
declare class Account$1 {
|
|
2721
|
+
/**
|
|
2722
|
+
* Public key associated with the account
|
|
2723
|
+
*/
|
|
2724
|
+
readonly publicKey: PublicKey;
|
|
2725
|
+
/**
|
|
2726
|
+
* Private key associated with the account
|
|
2727
|
+
*/
|
|
2728
|
+
readonly privateKey: PrivateKey;
|
|
2729
|
+
/**
|
|
2730
|
+
* Account address associated with the account
|
|
2731
|
+
*/
|
|
2732
|
+
readonly accountAddress: AccountAddress;
|
|
2733
|
+
/**
|
|
2734
|
+
* Signing scheme used to sign transactions
|
|
2735
|
+
*/
|
|
2736
|
+
readonly signingScheme: SigningScheme;
|
|
2737
|
+
/**
|
|
2738
|
+
* constructor for Account
|
|
2739
|
+
*
|
|
2740
|
+
* Need to update this to use the new crypto library if new schemes are added.
|
|
2741
|
+
*
|
|
2742
|
+
* @param args.privateKey PrivateKey - private key of the account
|
|
2743
|
+
* @param args.address AccountAddress - address of the account
|
|
2744
|
+
*
|
|
2745
|
+
* This method is private because it should only be called by the factory static methods.
|
|
2746
|
+
* @returns Account
|
|
2747
|
+
*/
|
|
2748
|
+
private constructor();
|
|
2749
|
+
/**
|
|
2750
|
+
* Derives an account with random private key and address
|
|
2751
|
+
*
|
|
2752
|
+
* @param scheme optional SigningScheme - type of SigningScheme to use. Default to Ed25519
|
|
2753
|
+
* Currently only Ed25519 and Secp256k1 are supported
|
|
2754
|
+
*
|
|
2755
|
+
* @returns Account with the given signing scheme
|
|
2756
|
+
*/
|
|
2757
|
+
static generate(scheme?: SigningScheme): Account$1;
|
|
2758
|
+
/**
|
|
2759
|
+
* Derives an account with provided private key
|
|
2760
|
+
*
|
|
2761
|
+
* @param privateKey Hex - private key of the account
|
|
2762
|
+
* @returns Account
|
|
2763
|
+
*/
|
|
2764
|
+
static fromPrivateKey(privateKey: PrivateKey): Account$1;
|
|
2765
|
+
/**
|
|
2766
|
+
* Derives an account with provided private key and address
|
|
2767
|
+
* This is intended to be used for account that has it's key rotated
|
|
2768
|
+
*
|
|
2769
|
+
* @param args.privateKey Hex - private key of the account
|
|
2770
|
+
* @param args.address AccountAddress - address of the account
|
|
2771
|
+
* @returns Account
|
|
2772
|
+
*/
|
|
2773
|
+
static fromPrivateKeyAndAddress(args: {
|
|
2774
|
+
privateKey: PrivateKey;
|
|
2775
|
+
address: AccountAddress;
|
|
2776
|
+
}): Account$1;
|
|
2777
|
+
/**
|
|
2778
|
+
* Derives an account with bip44 path and mnemonics,
|
|
2779
|
+
*
|
|
2780
|
+
* @param args.path the BIP44 derive path (e.g. m/44'/637'/0'/0'/0')
|
|
2781
|
+
* Detailed description: {@link https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki}
|
|
2782
|
+
* @param args.mnemonic the mnemonic seed phrase of the account
|
|
2783
|
+
* @returns AptosAccount
|
|
2784
|
+
*/
|
|
2785
|
+
static fromDerivationPath(args: {
|
|
2786
|
+
path: string;
|
|
2787
|
+
mnemonic: string;
|
|
2788
|
+
}): Account$1;
|
|
2789
|
+
/**
|
|
2790
|
+
* This key enables account owners to rotate their private key(s)
|
|
2791
|
+
* associated with the account without changing the address that hosts their account.
|
|
2792
|
+
* See here for more info: {@link https://aptos.dev/concepts/accounts#single-signer-authentication}
|
|
2793
|
+
*
|
|
2794
|
+
* @param args.publicKey PublicKey - public key of the account
|
|
2795
|
+
* @returns Authentication key for the associated account
|
|
2796
|
+
*/
|
|
2797
|
+
static authKey(args: {
|
|
2798
|
+
publicKey: PublicKey;
|
|
2799
|
+
}): Hex;
|
|
2800
|
+
/**
|
|
2801
|
+
* Sign the given message with the private key.
|
|
2802
|
+
*
|
|
2803
|
+
* TODO: Add sign transaction or specific types
|
|
2804
|
+
*
|
|
2805
|
+
* @param data in HexInput format
|
|
2806
|
+
* @returns Signature
|
|
2807
|
+
*/
|
|
2808
|
+
sign(data: HexInput): Signature;
|
|
2809
|
+
/**
|
|
2810
|
+
* Verify the given message and signature with the public key.
|
|
2811
|
+
*
|
|
2812
|
+
* @param args.message raw message data in HexInput format
|
|
2813
|
+
* @param args.signature signed message Signature
|
|
2814
|
+
* @returns
|
|
2815
|
+
*/
|
|
2816
|
+
verifySignature(args: {
|
|
2817
|
+
message: HexInput;
|
|
2818
|
+
signature: Signature;
|
|
2819
|
+
}): boolean;
|
|
2820
|
+
}
|
|
2821
|
+
|
|
2822
|
+
/**
|
|
2823
|
+
* Each account stores an authentication key. Authentication key enables account owners to rotate
|
|
2824
|
+
* their private key(s) associated with the account without changing the address that hosts their account.
|
|
2825
|
+
* @see {@link https://aptos.dev/concepts/accounts | Account Basics}
|
|
2826
|
+
*
|
|
2827
|
+
* Note: AuthenticationKey only supports Ed25519 and MultiEd25519 public keys for now.
|
|
2828
|
+
*
|
|
2829
|
+
* Account addresses can be derived from AuthenticationKey
|
|
2830
|
+
*/
|
|
2831
|
+
declare class AuthenticationKey {
|
|
2832
|
+
/**
|
|
2833
|
+
* An authentication key is always a SHA3-256 hash of data, and is always 32 bytes.
|
|
2834
|
+
*/
|
|
2835
|
+
static readonly LENGTH: number;
|
|
2836
|
+
/**
|
|
2837
|
+
* The raw bytes of the authentication key.
|
|
2838
|
+
*/
|
|
2839
|
+
readonly data: Hex;
|
|
2840
|
+
constructor(args: {
|
|
2841
|
+
data: HexInput;
|
|
2842
|
+
});
|
|
2843
|
+
toString(): string;
|
|
2844
|
+
toUint8Array(): Uint8Array;
|
|
2845
|
+
/**
|
|
2846
|
+
* Creates an AuthenticationKey from seed bytes and a scheme
|
|
2847
|
+
*
|
|
2848
|
+
* This allows for the creation of AuthenticationKeys that are not derived from Public Keys directly
|
|
2849
|
+
* @param args
|
|
2850
|
+
*/
|
|
2851
|
+
private static fromBytesAndScheme;
|
|
2852
|
+
/**
|
|
2853
|
+
* Converts a PublicKey(s) to AuthenticationKey
|
|
2854
|
+
*
|
|
2855
|
+
* @param args.publicKey
|
|
2856
|
+
* @returns AuthenticationKey
|
|
2857
|
+
*/
|
|
2858
|
+
static fromPublicKey(args: {
|
|
2859
|
+
publicKey: PublicKey;
|
|
2860
|
+
}): AuthenticationKey;
|
|
2861
|
+
/**
|
|
2862
|
+
* Derives an account address from AuthenticationKey. Since current AccountAddress is 32 bytes,
|
|
2863
|
+
* AuthenticationKey bytes are directly translated to AccountAddress.
|
|
2864
|
+
*
|
|
2865
|
+
* @returns AccountAddress
|
|
2866
|
+
*/
|
|
2867
|
+
derivedAddress(): AccountAddress;
|
|
2868
|
+
}
|
|
2869
|
+
|
|
2870
|
+
/**
|
|
2871
|
+
* Represents the public key of an Ed25519 key pair.
|
|
2872
|
+
*/
|
|
2873
|
+
declare class Ed25519PublicKey extends PublicKey {
|
|
2874
|
+
/**
|
|
2875
|
+
* Length of an Ed25519 public key
|
|
2876
|
+
*/
|
|
2877
|
+
static readonly LENGTH: number;
|
|
2878
|
+
/**
|
|
2879
|
+
* Bytes of the public key
|
|
2880
|
+
* @private
|
|
2881
|
+
*/
|
|
2882
|
+
private readonly key;
|
|
2883
|
+
/**
|
|
2884
|
+
* Create a new PublicKey instance from a Uint8Array or String.
|
|
2885
|
+
*
|
|
2886
|
+
* @param hexInput A HexInput (string or Uint8Array)
|
|
2887
|
+
*/
|
|
2888
|
+
constructor(hexInput: HexInput);
|
|
2889
|
+
/**
|
|
2890
|
+
* Get the public key in bytes (Uint8Array).
|
|
2891
|
+
*
|
|
2892
|
+
* @returns Uint8Array representation of the public key
|
|
2893
|
+
*/
|
|
2894
|
+
toUint8Array(): Uint8Array;
|
|
2895
|
+
/**
|
|
2896
|
+
* Get the public key as a hex string with the 0x prefix.
|
|
2897
|
+
*
|
|
2898
|
+
* @returns string representation of the public key
|
|
2899
|
+
*/
|
|
2900
|
+
toString(): string;
|
|
2901
|
+
/**
|
|
2902
|
+
* Verifies a signed data with a public key
|
|
2903
|
+
* @param args.message a signed message
|
|
2904
|
+
* @param args.signature the signature of the message
|
|
2905
|
+
*/
|
|
2906
|
+
verifySignature(args: {
|
|
2907
|
+
message: HexInput;
|
|
2908
|
+
signature: Ed25519Signature;
|
|
2909
|
+
}): boolean;
|
|
2910
|
+
serialize(serializer: Serializer): void;
|
|
2911
|
+
static deserialize(deserializer: Deserializer): Ed25519PublicKey;
|
|
2912
|
+
}
|
|
2913
|
+
/**
|
|
2914
|
+
* Represents the private key of an Ed25519 key pair.
|
|
2915
|
+
*/
|
|
2916
|
+
declare class Ed25519PrivateKey extends PrivateKey {
|
|
2917
|
+
/**
|
|
2918
|
+
* Length of an Ed25519 private key
|
|
2919
|
+
*/
|
|
2920
|
+
static readonly LENGTH: number;
|
|
2921
|
+
/**
|
|
2922
|
+
* The Ed25519 signing key
|
|
2923
|
+
* @private
|
|
2924
|
+
*/
|
|
2925
|
+
private readonly signingKeyPair;
|
|
2926
|
+
/**
|
|
2927
|
+
* Create a new PrivateKey instance from a Uint8Array or String.
|
|
2928
|
+
*
|
|
2929
|
+
* @param hexInput HexInput (string or Uint8Array)
|
|
2930
|
+
*/
|
|
2931
|
+
constructor(hexInput: HexInput);
|
|
2932
|
+
/**
|
|
2933
|
+
* Get the private key in bytes (Uint8Array).
|
|
2934
|
+
*
|
|
2935
|
+
* @returns Uint8Array representation of the private key
|
|
2936
|
+
*/
|
|
2937
|
+
toUint8Array(): Uint8Array;
|
|
2938
|
+
/**
|
|
2939
|
+
* Get the private key as a hex string with the 0x prefix.
|
|
2940
|
+
*
|
|
2941
|
+
* @returns string representation of the private key
|
|
2942
|
+
*/
|
|
2943
|
+
toString(): string;
|
|
2944
|
+
/**
|
|
2945
|
+
* Sign the given message with the private key.
|
|
2946
|
+
*
|
|
2947
|
+
* @param message in HexInput format
|
|
2948
|
+
* @returns Signature
|
|
2949
|
+
*/
|
|
2950
|
+
sign(message: HexInput): Ed25519Signature;
|
|
2951
|
+
serialize(serializer: Serializer): void;
|
|
2952
|
+
static deserialize(deserializer: Deserializer): Ed25519PrivateKey;
|
|
2953
|
+
/**
|
|
2954
|
+
* Generate a new random private key.
|
|
2955
|
+
*
|
|
2956
|
+
* @returns Ed25519PrivateKey
|
|
2957
|
+
*/
|
|
2958
|
+
static generate(): Ed25519PrivateKey;
|
|
2959
|
+
/**
|
|
2960
|
+
* Derive the Ed25519PublicKey for this private key.
|
|
2961
|
+
*
|
|
2962
|
+
* @returns Ed25519PublicKey
|
|
2963
|
+
*/
|
|
2964
|
+
publicKey(): Ed25519PublicKey;
|
|
2965
|
+
}
|
|
2966
|
+
/**
|
|
2967
|
+
* A signature of a message signed using an Ed25519 private key
|
|
2968
|
+
*/
|
|
2969
|
+
declare class Ed25519Signature extends Signature {
|
|
2970
|
+
/**
|
|
2971
|
+
* Length of an Ed25519 signature
|
|
2972
|
+
*/
|
|
2973
|
+
static readonly LENGTH = 64;
|
|
2974
|
+
/**
|
|
2975
|
+
* The signature bytes
|
|
2976
|
+
* @private
|
|
2977
|
+
*/
|
|
2978
|
+
private readonly data;
|
|
2979
|
+
constructor(hexInput: HexInput);
|
|
2980
|
+
/**
|
|
2981
|
+
* Get the signature in bytes (Uint8Array).
|
|
2982
|
+
*
|
|
2983
|
+
* @returns Uint8Array representation of the signature
|
|
2984
|
+
*/
|
|
2985
|
+
toUint8Array(): Uint8Array;
|
|
2986
|
+
/**
|
|
2987
|
+
* Get the signature as a hex string with the 0x prefix.
|
|
2988
|
+
*
|
|
2989
|
+
* @returns string representation of the signature
|
|
2990
|
+
*/
|
|
2991
|
+
toString(): string;
|
|
2992
|
+
serialize(serializer: Serializer): void;
|
|
2993
|
+
static deserialize(deserializer: Deserializer): Ed25519Signature;
|
|
2994
|
+
}
|
|
2995
|
+
|
|
2996
|
+
/**
|
|
2997
|
+
* Represents the public key of a K-of-N Ed25519 multi-sig transaction.
|
|
2998
|
+
*/
|
|
2999
|
+
declare class MultiEd25519PublicKey extends PublicKey {
|
|
3000
|
+
/**
|
|
3001
|
+
* Maximum number of public keys supported
|
|
3002
|
+
*/
|
|
3003
|
+
static readonly MAX_KEYS = 32;
|
|
3004
|
+
/**
|
|
3005
|
+
* Minimum number of public keys needed
|
|
3006
|
+
*/
|
|
3007
|
+
static readonly MIN_KEYS = 2;
|
|
3008
|
+
/**
|
|
3009
|
+
* Minimum threshold for the number of valid signatures required
|
|
3010
|
+
*/
|
|
3011
|
+
static readonly MIN_THRESHOLD = 1;
|
|
3012
|
+
/**
|
|
3013
|
+
* List of Ed25519 public keys for this MultiEd25519PublicKey
|
|
3014
|
+
*/
|
|
3015
|
+
readonly publicKeys: Ed25519PublicKey[];
|
|
3016
|
+
/**
|
|
3017
|
+
* The minimum number of valid signatures required, for the number of public keys specified
|
|
3018
|
+
*/
|
|
3019
|
+
readonly threshold: number;
|
|
3020
|
+
/**
|
|
3021
|
+
* Public key for a K-of-N multi-sig transaction. A K-of-N multi-sig transaction means that for such a
|
|
3022
|
+
* transaction to be executed, at least K out of the N authorized signers have signed the transaction
|
|
3023
|
+
* and passed the check conducted by the chain.
|
|
3024
|
+
*
|
|
3025
|
+
* @see {@link
|
|
3026
|
+
* https://aptos.dev/integration/creating-a-signed-transaction/ | Creating a Signed Transaction}
|
|
3027
|
+
*
|
|
3028
|
+
* @param args.publicKeys A list of public keys
|
|
3029
|
+
* @param args.threshold At least "threshold" signatures must be valid
|
|
3030
|
+
*/
|
|
3031
|
+
constructor(args: {
|
|
3032
|
+
publicKeys: Ed25519PublicKey[];
|
|
3033
|
+
threshold: number;
|
|
3034
|
+
});
|
|
3035
|
+
/**
|
|
3036
|
+
* Converts a PublicKeys into Uint8Array (bytes) with: bytes = p1_bytes | ... | pn_bytes | threshold
|
|
3037
|
+
*/
|
|
3038
|
+
toUint8Array(): Uint8Array;
|
|
3039
|
+
toString(): string;
|
|
3040
|
+
verifySignature(args: {
|
|
3041
|
+
message: HexInput;
|
|
3042
|
+
signature: MultiEd25519Signature;
|
|
3043
|
+
}): boolean;
|
|
3044
|
+
serialize(serializer: Serializer): void;
|
|
3045
|
+
static deserialize(deserializer: Deserializer): MultiEd25519PublicKey;
|
|
3046
|
+
}
|
|
3047
|
+
/**
|
|
3048
|
+
* Represents the signature of a K-of-N Ed25519 multi-sig transaction.
|
|
3049
|
+
*/
|
|
3050
|
+
declare class MultiEd25519Signature extends Signature {
|
|
3051
|
+
/**
|
|
3052
|
+
* Maximum number of Ed25519 signatures supported
|
|
3053
|
+
*/
|
|
3054
|
+
static MAX_SIGNATURES_SUPPORTED: number;
|
|
3055
|
+
/**
|
|
3056
|
+
* Number of bytes in the bitmap representing who signed the transaction (32-bits)
|
|
3057
|
+
*/
|
|
3058
|
+
static BITMAP_LEN: number;
|
|
3059
|
+
/**
|
|
3060
|
+
* The list of underlying Ed25519 signatures
|
|
3061
|
+
*/
|
|
3062
|
+
readonly signatures: Ed25519Signature[];
|
|
3063
|
+
/**
|
|
3064
|
+
* 32-bit Bitmap representing who signed the transaction
|
|
3065
|
+
*
|
|
3066
|
+
* This is represented where each public key can be masked to determine whether the message was signed by that key.
|
|
3067
|
+
*/
|
|
3068
|
+
readonly bitmap: Uint8Array;
|
|
3069
|
+
/**
|
|
3070
|
+
* Signature for a K-of-N multi-sig transaction.
|
|
3071
|
+
*
|
|
3072
|
+
* @see {@link
|
|
3073
|
+
* https://aptos.dev/integration/creating-a-signed-transaction/#multisignature-transactions | Creating a Signed Transaction}
|
|
3074
|
+
*
|
|
3075
|
+
* @param args.signatures A list of signatures
|
|
3076
|
+
* @param args.bitmap 4 bytes, at most 32 signatures are supported. If Nth bit value is `1`, the Nth
|
|
3077
|
+
* signature should be provided in `signatures`. Bits are read from left to right
|
|
3078
|
+
*/
|
|
3079
|
+
constructor(args: {
|
|
3080
|
+
signatures: Ed25519Signature[];
|
|
3081
|
+
bitmap: Uint8Array;
|
|
3082
|
+
});
|
|
3083
|
+
/**
|
|
3084
|
+
* Converts a MultiSignature into Uint8Array (bytes) with `bytes = s1_bytes | ... | sn_bytes | bitmap`
|
|
3085
|
+
*/
|
|
3086
|
+
toUint8Array(): Uint8Array;
|
|
3087
|
+
toString(): string;
|
|
3088
|
+
/**
|
|
3089
|
+
* Helper method to create a bitmap out of the specified bit positions
|
|
3090
|
+
* @param args.bits The bitmap positions that should be set. A position starts at index 0.
|
|
3091
|
+
* Valid position should range between 0 and 31.
|
|
3092
|
+
* @example
|
|
3093
|
+
* Here's an example of valid `bits`
|
|
3094
|
+
* ```
|
|
3095
|
+
* [0, 2, 31]
|
|
3096
|
+
* ```
|
|
3097
|
+
* `[0, 2, 31]` means the 1st, 3rd and 32nd bits should be set in the bitmap.
|
|
3098
|
+
* The result bitmap should be 0b1010000000000000000000000000001
|
|
3099
|
+
*
|
|
3100
|
+
* @returns bitmap that is 32bit long
|
|
3101
|
+
*/
|
|
3102
|
+
static createBitmap(args: {
|
|
3103
|
+
bits: number[];
|
|
3104
|
+
}): Uint8Array;
|
|
3105
|
+
serialize(serializer: Serializer): void;
|
|
3106
|
+
static deserialize(deserializer: Deserializer): MultiEd25519Signature;
|
|
3107
|
+
}
|
|
3108
|
+
|
|
3109
|
+
/**
|
|
3110
|
+
* Represents the Secp256k1 ecdsa public key
|
|
3111
|
+
*/
|
|
3112
|
+
declare class Secp256k1PublicKey extends PublicKey {
|
|
3113
|
+
static readonly LENGTH: number;
|
|
3114
|
+
private readonly key;
|
|
3115
|
+
/**
|
|
3116
|
+
* Create a new PublicKey instance from a Uint8Array or String.
|
|
3117
|
+
*
|
|
3118
|
+
* @param hexInput A HexInput (string or Uint8Array)
|
|
3119
|
+
*/
|
|
3120
|
+
constructor(hexInput: HexInput);
|
|
3121
|
+
/**
|
|
3122
|
+
* Get the public key in bytes (Uint8Array).
|
|
3123
|
+
*
|
|
3124
|
+
* @returns Uint8Array representation of the public key
|
|
3125
|
+
*/
|
|
3126
|
+
toUint8Array(): Uint8Array;
|
|
3127
|
+
/**
|
|
3128
|
+
* Get the public key as a hex string with the 0x prefix.
|
|
3129
|
+
*
|
|
3130
|
+
* @returns string representation of the public key
|
|
3131
|
+
*/
|
|
3132
|
+
toString(): string;
|
|
3133
|
+
/**
|
|
3134
|
+
* Verifies a signed data with a public key
|
|
3135
|
+
*
|
|
3136
|
+
* @param args.message message
|
|
3137
|
+
* @param args.signature The signature
|
|
3138
|
+
* @returns true if the signature is valid
|
|
3139
|
+
*/
|
|
3140
|
+
verifySignature(args: {
|
|
3141
|
+
message: HexInput;
|
|
3142
|
+
signature: Secp256k1Signature;
|
|
3143
|
+
}): boolean;
|
|
3144
|
+
serialize(serializer: Serializer): void;
|
|
3145
|
+
static deserialize(deserializer: Deserializer): Secp256k1PublicKey;
|
|
3146
|
+
}
|
|
3147
|
+
/**
|
|
3148
|
+
* A Secp256k1 ecdsa private key
|
|
3149
|
+
*/
|
|
3150
|
+
declare class Secp256k1PrivateKey extends PrivateKey {
|
|
3151
|
+
/**
|
|
3152
|
+
* Length of Secp256k1 ecdsa private key
|
|
3153
|
+
*/
|
|
3154
|
+
static readonly LENGTH: number;
|
|
3155
|
+
/**
|
|
3156
|
+
* The private key bytes
|
|
3157
|
+
* @private
|
|
3158
|
+
*/
|
|
3159
|
+
private readonly key;
|
|
3160
|
+
/**
|
|
3161
|
+
* Create a new PrivateKey instance from a Uint8Array or String.
|
|
3162
|
+
*
|
|
3163
|
+
* @param hexInput A HexInput (string or Uint8Array)
|
|
3164
|
+
*/
|
|
3165
|
+
constructor(hexInput: HexInput);
|
|
3166
|
+
/**
|
|
3167
|
+
* Get the private key in bytes (Uint8Array).
|
|
3168
|
+
*
|
|
3169
|
+
* @returns
|
|
3170
|
+
*/
|
|
3171
|
+
toUint8Array(): Uint8Array;
|
|
3172
|
+
/**
|
|
3173
|
+
* Get the private key as a hex string with the 0x prefix.
|
|
3174
|
+
*
|
|
3175
|
+
* @returns string representation of the private key
|
|
3176
|
+
*/
|
|
3177
|
+
toString(): string;
|
|
3178
|
+
/**
|
|
3179
|
+
* Sign the given message with the private key.
|
|
3180
|
+
*
|
|
3181
|
+
* @param message in HexInput format
|
|
3182
|
+
* @returns Signature
|
|
3183
|
+
*/
|
|
3184
|
+
sign(message: HexInput): Secp256k1Signature;
|
|
3185
|
+
serialize(serializer: Serializer): void;
|
|
3186
|
+
static deserialize(deserializer: Deserializer): Secp256k1PrivateKey;
|
|
3187
|
+
/**
|
|
3188
|
+
* Generate a new random private key.
|
|
3189
|
+
*
|
|
3190
|
+
* @returns Secp256k1PrivateKey
|
|
3191
|
+
*/
|
|
3192
|
+
static generate(): Secp256k1PrivateKey;
|
|
3193
|
+
/**
|
|
3194
|
+
* Derive the Secp256k1PublicKey from this private key.
|
|
3195
|
+
*
|
|
3196
|
+
* @returns Secp256k1PublicKey
|
|
3197
|
+
*/
|
|
3198
|
+
publicKey(): Secp256k1PublicKey;
|
|
3199
|
+
}
|
|
3200
|
+
/**
|
|
3201
|
+
* A signature of a message signed using an Secp256k1 ecdsa private key
|
|
3202
|
+
*/
|
|
3203
|
+
declare class Secp256k1Signature extends Signature {
|
|
3204
|
+
/**
|
|
3205
|
+
* Secp256k1 ecdsa signatures are 256-bit.
|
|
3206
|
+
*/
|
|
3207
|
+
static readonly LENGTH = 64;
|
|
3208
|
+
/**
|
|
3209
|
+
* The signature bytes
|
|
3210
|
+
* @private
|
|
3211
|
+
*/
|
|
3212
|
+
private readonly data;
|
|
3213
|
+
/**
|
|
3214
|
+
* Create a new Signature instance from a Uint8Array or String.
|
|
3215
|
+
*
|
|
3216
|
+
* @param hexInput A HexInput (string or Uint8Array)
|
|
3217
|
+
*/
|
|
3218
|
+
constructor(hexInput: HexInput);
|
|
3219
|
+
/**
|
|
3220
|
+
* Get the signature in bytes (Uint8Array).
|
|
3221
|
+
*
|
|
3222
|
+
* @returns Uint8Array representation of the signature
|
|
3223
|
+
*/
|
|
3224
|
+
toUint8Array(): Uint8Array;
|
|
3225
|
+
/**
|
|
3226
|
+
* Get the signature as a hex string with the 0x prefix.
|
|
3227
|
+
*
|
|
3228
|
+
* @returns string representation of the signature
|
|
3229
|
+
*/
|
|
3230
|
+
toString(): string;
|
|
3231
|
+
serialize(serializer: Serializer): void;
|
|
3232
|
+
static deserialize(deserializer: Deserializer): Secp256k1Signature;
|
|
3233
|
+
}
|
|
3234
|
+
|
|
3235
|
+
/**
|
|
3236
|
+
* A class to query all `Account` related queries on Aptos.
|
|
3237
|
+
*/
|
|
3238
|
+
declare class Account {
|
|
3239
|
+
readonly config: AptosConfig;
|
|
3240
|
+
constructor(config: AptosConfig);
|
|
3241
|
+
/**
|
|
3242
|
+
* Queries the current state for an Aptos account given its account address
|
|
3243
|
+
*
|
|
3244
|
+
* @param args.accountAddress Aptos account address
|
|
3245
|
+
*
|
|
3246
|
+
* @returns The account data
|
|
3247
|
+
*
|
|
3248
|
+
* @example An example of the returned account
|
|
3249
|
+
* ```
|
|
3250
|
+
* {
|
|
3251
|
+
* sequence_number: "1",
|
|
3252
|
+
* authentication_key: "0x5307b5f4bc67829097a8ba9b43dba3b88261eeccd1f709d9bde240fc100fbb69"
|
|
3253
|
+
* }
|
|
3254
|
+
* ```
|
|
3255
|
+
*/
|
|
3256
|
+
getAccountInfo(args: {
|
|
3257
|
+
accountAddress: HexInput;
|
|
3258
|
+
}): Promise<AccountData>;
|
|
3259
|
+
/**
|
|
3260
|
+
* Queries for all modules in an account given an account address
|
|
3261
|
+
*
|
|
3262
|
+
* Note: In order to get all account modules, this function may call the API
|
|
3263
|
+
* multiple times as it auto paginates.
|
|
3264
|
+
*
|
|
3265
|
+
* @param args.accountAddress Aptos account address
|
|
3266
|
+
* @param args.options.offset The number module to start returning results from
|
|
3267
|
+
* @param args.options.limit The number of results to return
|
|
3268
|
+
* @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version
|
|
3269
|
+
*
|
|
3270
|
+
* @returns Account modules
|
|
3271
|
+
*/
|
|
3272
|
+
getAccountModules(args: {
|
|
3273
|
+
accountAddress: HexInput;
|
|
3274
|
+
options?: PaginationArgs & LedgerVersion;
|
|
3275
|
+
}): Promise<MoveModuleBytecode[]>;
|
|
3276
|
+
/**
|
|
3277
|
+
* Queries for a specific account module given account address and module name
|
|
3278
|
+
*
|
|
3279
|
+
* @param args.accountAddress Aptos account address
|
|
3280
|
+
* @param args.moduleName The name of the module
|
|
3281
|
+
* @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version
|
|
3282
|
+
*
|
|
3283
|
+
* @returns Account module
|
|
3284
|
+
*
|
|
3285
|
+
* @example An example of an account module
|
|
3286
|
+
* ```
|
|
3287
|
+
* {
|
|
3288
|
+
* bytecode: "0xa11ceb0b0600000006010002030206050807070f0d081c200",
|
|
3289
|
+
* abi: { address: "0x1" }
|
|
3290
|
+
* }
|
|
3291
|
+
* ```
|
|
3292
|
+
*/
|
|
3293
|
+
getAccountModule(args: {
|
|
3294
|
+
accountAddress: HexInput;
|
|
3295
|
+
moduleName: string;
|
|
3296
|
+
options?: LedgerVersion;
|
|
3297
|
+
}): Promise<MoveModuleBytecode>;
|
|
3298
|
+
/**
|
|
3299
|
+
* Queries account transactions given an account address
|
|
3300
|
+
*
|
|
3301
|
+
* Note: In order to get all account transactions, this function may call the API
|
|
3302
|
+
* multiple times as it auto paginates.
|
|
3303
|
+
*
|
|
3304
|
+
* @param args.accountAddress Aptos account address
|
|
3305
|
+
* @param args.options.offset The number transaction to start returning results from
|
|
3306
|
+
* @param args.options.limit The number of results to return
|
|
3307
|
+
*
|
|
3308
|
+
* @returns The account transactions
|
|
3309
|
+
*/
|
|
3310
|
+
getAccountTransactions(args: {
|
|
3311
|
+
accountAddress: HexInput;
|
|
3312
|
+
options?: PaginationArgs;
|
|
3313
|
+
}): Promise<TransactionResponse[]>;
|
|
3314
|
+
/**
|
|
3315
|
+
* Queries all account resources given an account address
|
|
3316
|
+
*
|
|
3317
|
+
* Note: In order to get all account resources, this function may call the API
|
|
3318
|
+
* multiple times as it auto paginates.
|
|
3319
|
+
*
|
|
3320
|
+
* @param args.accountAddress Aptos account address
|
|
3321
|
+
* @param args.options.offset The number resource to start returning results from
|
|
3322
|
+
* @param args.options.limit The number of results to return
|
|
3323
|
+
* @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version
|
|
3324
|
+
* @returns Account resources
|
|
3325
|
+
*/
|
|
3326
|
+
getAccountResources(args: {
|
|
3327
|
+
accountAddress: HexInput;
|
|
3328
|
+
options?: PaginationArgs & LedgerVersion;
|
|
3329
|
+
}): Promise<MoveResource[]>;
|
|
3330
|
+
/**
|
|
3331
|
+
* Queries a specific account resource given account address and resource type
|
|
3332
|
+
*
|
|
3333
|
+
* @param args.accountAddress Aptos account address
|
|
3334
|
+
* @param args.resourceType String representation of an on-chain Move struct type, i.e "0x1::aptos_coin::AptosCoin"
|
|
3335
|
+
* @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version
|
|
3336
|
+
*
|
|
3337
|
+
* @returns Account resource
|
|
3338
|
+
*
|
|
3339
|
+
* @example An example of an account resource
|
|
3340
|
+
* ```
|
|
3341
|
+
* {
|
|
3342
|
+
* type: "0x1::aptos_coin::AptosCoin",
|
|
3343
|
+
* data: { value: 6 }
|
|
3344
|
+
* }
|
|
3345
|
+
* ```
|
|
3346
|
+
*/
|
|
3347
|
+
getAccountResource(args: {
|
|
3348
|
+
accountAddress: HexInput;
|
|
3349
|
+
resourceType: MoveResourceType;
|
|
3350
|
+
options?: LedgerVersion;
|
|
3351
|
+
}): Promise<MoveResource>;
|
|
3352
|
+
/**
|
|
3353
|
+
* Looks up the account address for a given authentication key
|
|
3354
|
+
*
|
|
3355
|
+
* This handles both if the account's authentication key has been rotated or not.
|
|
3356
|
+
*
|
|
3357
|
+
* @param args.authenticationKey The authentication key
|
|
3358
|
+
* @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version
|
|
3359
|
+
* @returns Promise<AccountAddress> The accountAddress associated with the authentication key
|
|
3360
|
+
*/
|
|
3361
|
+
lookupOriginalAccountAddress(args: {
|
|
3362
|
+
authenticationKey: HexInput;
|
|
3363
|
+
options?: LedgerVersion;
|
|
3364
|
+
}): Promise<AccountAddress>;
|
|
3365
|
+
/**
|
|
3366
|
+
* Queries the current count of tokens owned by an account
|
|
3367
|
+
*
|
|
3368
|
+
* @param args.accountAddress The account address
|
|
3369
|
+
* @returns Current count of tokens owned by the account
|
|
3370
|
+
*/
|
|
3371
|
+
getAccountTokensCount(args: {
|
|
3372
|
+
accountAddress: HexInput;
|
|
3373
|
+
}): Promise<number>;
|
|
3374
|
+
/**
|
|
3375
|
+
* Queries the account's current owned tokens.
|
|
3376
|
+
*
|
|
3377
|
+
* This query returns all tokens (v1 and v2 standards) an account owns, including NFTs, fungible, soulbound, etc.
|
|
3378
|
+
* If you want to get only the token from a specific standard, you can pass an optional tokenStandard param
|
|
3379
|
+
*
|
|
3380
|
+
* @param args.accountAddress The account address we want to get the tokens for
|
|
3381
|
+
* @param args.options.tokenStandard The NFT standard to query for
|
|
3382
|
+
* @param args.options.pagination.offset The number token to start returning results from
|
|
3383
|
+
* @param args.options.pagination.limit The number of results to return
|
|
3384
|
+
* @param args.options.orderBy The order to sort the tokens by
|
|
3385
|
+
* @returns Tokens array with the token data
|
|
3386
|
+
*/
|
|
3387
|
+
getAccountOwnedTokens(args: {
|
|
3388
|
+
accountAddress: HexInput;
|
|
3389
|
+
options?: {
|
|
3390
|
+
tokenStandard?: TokenStandard;
|
|
3391
|
+
pagination?: PaginationArgs;
|
|
3392
|
+
orderBy?: OrderBy<GetAccountOwnedTokensQueryResponse[0]>;
|
|
3393
|
+
};
|
|
3394
|
+
}): Promise<GetAccountOwnedTokensQueryResponse>;
|
|
3395
|
+
/**
|
|
3396
|
+
* Queries all current tokens of a specific collection that an account owns by the collection address
|
|
3397
|
+
*
|
|
3398
|
+
* This query returns all tokens (v1 and v2 standards) an account owns, including NFTs, fungible, soulbound, etc.
|
|
3399
|
+
* If you want to get only the token from a specific standard, you can pass an optional tokenStandard param
|
|
3400
|
+
*
|
|
3401
|
+
* @param args.accountAddress The account address we want to get the tokens for
|
|
3402
|
+
* @param args.collectionAddress The address of the collection being queried
|
|
3403
|
+
* @param args.options.tokenStandard The NFT standard to query for
|
|
3404
|
+
* @param args.options.pagination.offset The number token to start returning results from
|
|
3405
|
+
* @param args.options.pagination.limit The number of results to return
|
|
3406
|
+
* @param args.options.orderBy The order to sort the tokens by
|
|
3407
|
+
* @returns Tokens array with the token data
|
|
3408
|
+
*/
|
|
3409
|
+
getAccountOwnedTokensFromCollectionAddress(args: {
|
|
3410
|
+
accountAddress: HexInput;
|
|
3411
|
+
collectionAddress: HexInput;
|
|
3412
|
+
options?: {
|
|
3413
|
+
tokenStandard?: TokenStandard;
|
|
3414
|
+
pagination?: PaginationArgs;
|
|
3415
|
+
orderBy?: OrderBy<GetAccountOwnedTokensFromCollectionResponse[0]>;
|
|
3416
|
+
};
|
|
3417
|
+
}): Promise<GetAccountOwnedTokensFromCollectionResponse>;
|
|
3418
|
+
/**
|
|
3419
|
+
* Queries for all collections that an account currently has tokens for.
|
|
3420
|
+
*
|
|
3421
|
+
* This query returns all tokens (v1 and v2 standards) an account owns, including NFTs, fungible, soulbound, etc.
|
|
3422
|
+
* If you want to get only the token from a specific standard, you can pass an optional tokenStandard param
|
|
3423
|
+
*
|
|
3424
|
+
* @param args.accountAddress The account address we want to get the collections for
|
|
3425
|
+
* @param args.options.tokenStandard The NFT standard to query for
|
|
3426
|
+
* @param args.options.pagination.offset The number collection to start returning results from
|
|
3427
|
+
* @param args.options.pagination.limit The number of results to return
|
|
3428
|
+
* @param args.options.orderBy The order to sort the tokens by
|
|
3429
|
+
* @returns Collections array with the collections data
|
|
3430
|
+
*/
|
|
3431
|
+
getAccountCollectionsWithOwnedTokens(args: {
|
|
3432
|
+
accountAddress: HexInput;
|
|
3433
|
+
options?: {
|
|
3434
|
+
tokenStandard?: TokenStandard;
|
|
3435
|
+
pagination?: PaginationArgs;
|
|
3436
|
+
orderBy?: OrderBy<GetAccountCollectionsWithOwnedTokenResponse[0]>;
|
|
3437
|
+
};
|
|
3438
|
+
}): Promise<GetAccountCollectionsWithOwnedTokenResponse>;
|
|
3439
|
+
/**
|
|
3440
|
+
* Queries the current count of transactions submitted by an account
|
|
3441
|
+
*
|
|
3442
|
+
* @param args.accountAddress The account address we want to get the total count for
|
|
3443
|
+
* @returns Current count of transactions made by an account
|
|
3444
|
+
*/
|
|
3445
|
+
getAccountTransactionsCount(args: {
|
|
3446
|
+
accountAddress: HexInput;
|
|
3447
|
+
}): Promise<number>;
|
|
3448
|
+
/**
|
|
3449
|
+
* Queries an account's coins data
|
|
3450
|
+
*
|
|
3451
|
+
* @param args.accountAddress The account address we want to get the coins data for
|
|
3452
|
+
* @param args.options.pagination.offset The number coin to start returning results from
|
|
3453
|
+
* @param args.options.pagination.limit The number of results to return
|
|
3454
|
+
* @param args.options.orderBy The order to sort the coins by
|
|
3455
|
+
* @returns Array with the coins data
|
|
3456
|
+
*/
|
|
3457
|
+
getAccountCoinsData(args: {
|
|
3458
|
+
accountAddress: HexInput;
|
|
3459
|
+
options?: {
|
|
3460
|
+
pagination?: PaginationArgs;
|
|
3461
|
+
orderBy?: OrderBy<GetAccountCoinsDataResponse[0]>;
|
|
3462
|
+
};
|
|
3463
|
+
}): Promise<GetAccountCoinsDataResponse>;
|
|
3464
|
+
/**
|
|
3465
|
+
* Queries the current count of an account's coins aggregated
|
|
3466
|
+
*
|
|
3467
|
+
* @param args.accountAddress The account address we want to get the total count for
|
|
3468
|
+
* @returns Current count of the aggregated count of all account's coins
|
|
3469
|
+
*/
|
|
3470
|
+
getAccountCoinsCount(args: {
|
|
3471
|
+
accountAddress: HexInput;
|
|
3472
|
+
}): Promise<number>;
|
|
3473
|
+
/**
|
|
3474
|
+
* Queries an account's owned objects
|
|
3475
|
+
*
|
|
3476
|
+
* @param args.accountAddress The account address we want to get the objects for
|
|
3477
|
+
* @param args.options.pagination.offset The number coin to start returning results from
|
|
3478
|
+
* @param args.options.pagination.limit The number of results to return
|
|
3479
|
+
* @param args.options.orderBy The order to sort the coins by
|
|
3480
|
+
* @returns Objects array with the object data
|
|
3481
|
+
*/
|
|
3482
|
+
getAccountOwnedObjects(args: {
|
|
3483
|
+
accountAddress: HexInput;
|
|
3484
|
+
options?: {
|
|
3485
|
+
pagination?: PaginationArgs;
|
|
3486
|
+
orderBy?: OrderBy<GetAccountOwnedObjectsResponse[0]>;
|
|
3487
|
+
};
|
|
3488
|
+
}): Promise<GetAccountOwnedObjectsResponse>;
|
|
3489
|
+
}
|
|
3490
|
+
|
|
3491
|
+
/**
|
|
3492
|
+
* Representation of a ChainId that can serialized and deserialized
|
|
3493
|
+
*/
|
|
3494
|
+
declare class ChainId extends Serializable {
|
|
3495
|
+
readonly chainId: number;
|
|
3496
|
+
constructor(chainId: number);
|
|
3497
|
+
serialize(serializer: Serializer): void;
|
|
3498
|
+
static deserialize(deserializer: Deserializer): ChainId;
|
|
3499
|
+
}
|
|
3500
|
+
|
|
3501
|
+
/**
|
|
3502
|
+
* Representation of an Identifier that can serialized and deserialized.
|
|
3503
|
+
* We use Identifier to represent the module "name" in "ModuleId" and
|
|
3504
|
+
* the "function name" in "EntryFunction"
|
|
3505
|
+
*/
|
|
3506
|
+
declare class Identifier extends Serializable {
|
|
3507
|
+
identifier: string;
|
|
3508
|
+
constructor(identifier: string);
|
|
3509
|
+
serialize(serializer: Serializer): void;
|
|
3510
|
+
static deserialize(deserializer: Deserializer): Identifier;
|
|
3511
|
+
}
|
|
3512
|
+
|
|
3513
|
+
/**
|
|
3514
|
+
* Representation of a ModuleId that can serialized and deserialized
|
|
3515
|
+
* ModuleId means the module address (e.g "0x1") and the module name (e.g "coin")
|
|
3516
|
+
*/
|
|
3517
|
+
declare class ModuleId extends Serializable {
|
|
3518
|
+
readonly address: AccountAddress;
|
|
3519
|
+
readonly name: Identifier;
|
|
3520
|
+
/**
|
|
3521
|
+
* Full name of a module.
|
|
3522
|
+
* @param address The account address. e.g "0x1"
|
|
3523
|
+
* @param name The module name under the "address". e.g "coin"
|
|
3524
|
+
*/
|
|
3525
|
+
constructor(address: AccountAddress, name: Identifier);
|
|
3526
|
+
/**
|
|
3527
|
+
* Converts a string literal to a ModuleId
|
|
3528
|
+
* @param moduleId String literal in format "account_address::module_name", e.g. "0x1::coin"
|
|
3529
|
+
* @returns ModuleId
|
|
3530
|
+
*/
|
|
3531
|
+
static fromStr(moduleId: MoveModuleId): ModuleId;
|
|
3532
|
+
serialize(serializer: Serializer): void;
|
|
3533
|
+
static deserialize(deserializer: Deserializer): ModuleId;
|
|
3534
|
+
}
|
|
3535
|
+
|
|
3536
|
+
declare abstract class TypeTag extends Serializable {
|
|
3537
|
+
abstract serialize(serializer: Serializer): void;
|
|
3538
|
+
static deserialize(deserializer: Deserializer): TypeTag;
|
|
3539
|
+
}
|
|
3540
|
+
declare class TypeTagBool extends TypeTag {
|
|
3541
|
+
serialize(serializer: Serializer): void;
|
|
3542
|
+
static load(_deserializer: Deserializer): TypeTagBool;
|
|
3543
|
+
}
|
|
3544
|
+
declare class TypeTagU8 extends TypeTag {
|
|
3545
|
+
serialize(serializer: Serializer): void;
|
|
3546
|
+
static load(_deserializer: Deserializer): TypeTagU8;
|
|
3547
|
+
}
|
|
3548
|
+
declare class TypeTagU16 extends TypeTag {
|
|
3549
|
+
serialize(serializer: Serializer): void;
|
|
3550
|
+
static load(_deserializer: Deserializer): TypeTagU16;
|
|
3551
|
+
}
|
|
3552
|
+
declare class TypeTagU32 extends TypeTag {
|
|
3553
|
+
serialize(serializer: Serializer): void;
|
|
3554
|
+
static load(_deserializer: Deserializer): TypeTagU32;
|
|
3555
|
+
}
|
|
3556
|
+
declare class TypeTagU64 extends TypeTag {
|
|
3557
|
+
serialize(serializer: Serializer): void;
|
|
3558
|
+
static load(_deserializer: Deserializer): TypeTagU64;
|
|
3559
|
+
}
|
|
3560
|
+
declare class TypeTagU128 extends TypeTag {
|
|
3561
|
+
serialize(serializer: Serializer): void;
|
|
3562
|
+
static load(_deserializer: Deserializer): TypeTagU128;
|
|
3563
|
+
}
|
|
3564
|
+
declare class TypeTagU256 extends TypeTag {
|
|
3565
|
+
serialize(serializer: Serializer): void;
|
|
3566
|
+
static load(_deserializer: Deserializer): TypeTagU256;
|
|
3567
|
+
}
|
|
3568
|
+
declare class TypeTagAddress extends TypeTag {
|
|
3569
|
+
serialize(serializer: Serializer): void;
|
|
3570
|
+
static load(_deserializer: Deserializer): TypeTagAddress;
|
|
3571
|
+
}
|
|
3572
|
+
declare class TypeTagSigner extends TypeTag {
|
|
3573
|
+
serialize(serializer: Serializer): void;
|
|
3574
|
+
static load(_deserializer: Deserializer): TypeTagSigner;
|
|
3575
|
+
}
|
|
3576
|
+
declare class TypeTagVector extends TypeTag {
|
|
3577
|
+
readonly value: TypeTag;
|
|
3578
|
+
constructor(value: TypeTag);
|
|
3579
|
+
serialize(serializer: Serializer): void;
|
|
3580
|
+
static load(deserializer: Deserializer): TypeTagVector;
|
|
3581
|
+
}
|
|
3582
|
+
declare class TypeTagStruct extends TypeTag {
|
|
3583
|
+
readonly value: StructTag;
|
|
3584
|
+
constructor(value: StructTag);
|
|
3585
|
+
serialize(serializer: Serializer): void;
|
|
3586
|
+
static load(deserializer: Deserializer): TypeTagStruct;
|
|
3587
|
+
/**
|
|
3588
|
+
* This function checks if the TypeTagStruct is a Move String TypeTag.
|
|
3589
|
+
* In Move, a string is represented as the String struct from string.move, deployed at `0x1`,
|
|
3590
|
+
* meaning it has the following properties:
|
|
3591
|
+
* - address: 0x1
|
|
3592
|
+
* - module_name: "string"
|
|
3593
|
+
* - name: "String"
|
|
3594
|
+
*
|
|
3595
|
+
* @returns true if the StructTag is a String type tag, false otherwise
|
|
3596
|
+
*/
|
|
3597
|
+
isStringTypeTag(): boolean;
|
|
3598
|
+
}
|
|
3599
|
+
declare class StructTag extends Serializable {
|
|
3600
|
+
readonly address: AccountAddress;
|
|
3601
|
+
readonly module_name: Identifier;
|
|
3602
|
+
readonly name: Identifier;
|
|
3603
|
+
readonly type_args: Array<TypeTag>;
|
|
3604
|
+
constructor(address: AccountAddress, module_name: Identifier, name: Identifier, type_args: Array<TypeTag>);
|
|
3605
|
+
/**
|
|
3606
|
+
* Converts a string literal to a StructTag
|
|
3607
|
+
* @param structTag String literal in format "AccountAddress::module_name::ResourceName",
|
|
3608
|
+
* e.g. "0x1::aptos_coin::AptosCoin"
|
|
3609
|
+
* @returns
|
|
3610
|
+
*/
|
|
3611
|
+
static fromString(structTag: string): StructTag;
|
|
3612
|
+
serialize(serializer: Serializer): void;
|
|
3613
|
+
static deserialize(deserializer: Deserializer): StructTag;
|
|
3614
|
+
}
|
|
3615
|
+
declare const stringStructTag: () => StructTag;
|
|
3616
|
+
declare function optionStructTag(typeArg: TypeTag): StructTag;
|
|
3617
|
+
declare function objectStructTag(typeArg: TypeTag): StructTag;
|
|
3618
|
+
/**
|
|
3619
|
+
* Parser to parse a type tag string
|
|
3620
|
+
*/
|
|
3621
|
+
declare class TypeTagParser {
|
|
3622
|
+
private readonly tokens;
|
|
3623
|
+
private readonly typeTags;
|
|
3624
|
+
constructor(tagStr: string, typeTags?: string[]);
|
|
3625
|
+
private consume;
|
|
3626
|
+
/**
|
|
3627
|
+
* Consumes all of an unused generic field, mostly applicable to object
|
|
3628
|
+
*
|
|
3629
|
+
* Note: This is recursive. it can be problematic if there's bad input
|
|
3630
|
+
* @private
|
|
3631
|
+
*/
|
|
3632
|
+
private consumeWholeGeneric;
|
|
3633
|
+
private parseCommaList;
|
|
3634
|
+
parseTypeTag(): TypeTag;
|
|
3635
|
+
}
|
|
3636
|
+
declare class TypeTagParserError extends Error {
|
|
3637
|
+
constructor(message: string);
|
|
3638
|
+
}
|
|
3639
|
+
|
|
3640
|
+
/**
|
|
3641
|
+
* Representation of the supported Transaction Payload
|
|
3642
|
+
* that can serialized and deserialized
|
|
3643
|
+
*/
|
|
3644
|
+
declare abstract class TransactionPayload$1 extends Serializable {
|
|
3645
|
+
/**
|
|
3646
|
+
* Serialize a Transaction Payload
|
|
3647
|
+
*/
|
|
3648
|
+
abstract serialize(serializer: Serializer): void;
|
|
3649
|
+
/**
|
|
3650
|
+
* Deserialize a Transaction Payload
|
|
3651
|
+
*/
|
|
3652
|
+
static deserialize(deserializer: Deserializer): TransactionPayload$1;
|
|
3653
|
+
}
|
|
3654
|
+
/**
|
|
3655
|
+
* Representation of a Transaction Payload Script that can serialized and deserialized
|
|
3656
|
+
*/
|
|
3657
|
+
declare class TransactionPayloadScript extends TransactionPayload$1 {
|
|
3658
|
+
readonly script: Script;
|
|
3659
|
+
constructor(script: Script);
|
|
3660
|
+
serialize(serializer: Serializer): void;
|
|
3661
|
+
static load(deserializer: Deserializer): TransactionPayloadScript;
|
|
3662
|
+
}
|
|
3663
|
+
/**
|
|
3664
|
+
* Representation of a Transaction Payload Entry Function that can serialized and deserialized
|
|
3665
|
+
*/
|
|
3666
|
+
declare class TransactionPayloadEntryFunction extends TransactionPayload$1 {
|
|
3667
|
+
readonly entryFunction: EntryFunction;
|
|
3668
|
+
constructor(entryFunction: EntryFunction);
|
|
3669
|
+
serialize(serializer: Serializer): void;
|
|
3670
|
+
static load(deserializer: Deserializer): TransactionPayloadEntryFunction;
|
|
3671
|
+
}
|
|
3672
|
+
/**
|
|
3673
|
+
* Representation of a Transaction Payload Multi-sig that can serialized and deserialized
|
|
3674
|
+
*/
|
|
3675
|
+
declare class TransactionPayloadMultisig extends TransactionPayload$1 {
|
|
3676
|
+
readonly multiSig: MultiSig;
|
|
3677
|
+
constructor(multiSig: MultiSig);
|
|
3678
|
+
serialize(serializer: Serializer): void;
|
|
3679
|
+
static load(deserializer: Deserializer): TransactionPayloadMultisig;
|
|
3680
|
+
}
|
|
3681
|
+
/**
|
|
3682
|
+
* Representation of a EntryFunction that can serialized and deserialized
|
|
3683
|
+
*/
|
|
3684
|
+
declare class EntryFunction {
|
|
3685
|
+
readonly module_name: ModuleId;
|
|
3686
|
+
readonly function_name: Identifier;
|
|
3687
|
+
readonly type_args: Array<TypeTag>;
|
|
3688
|
+
readonly args: Array<EntryFunctionArgument>;
|
|
3689
|
+
/**
|
|
3690
|
+
* Contains the payload to run a function within a module.
|
|
3691
|
+
* @param module_name Fully qualified module name in format "account_address::module_name" e.g. "0x1::coin"
|
|
3692
|
+
* @param function_name The function name. e.g "transfer"
|
|
3693
|
+
* @param type_args Type arguments that move function requires.
|
|
3694
|
+
*
|
|
3695
|
+
* @example
|
|
3696
|
+
* A coin transfer function has one type argument "CoinType".
|
|
3697
|
+
* ```
|
|
3698
|
+
* public entry fun transfer<CoinType>(from: &signer, to: address, amount: u64)
|
|
3699
|
+
* ```
|
|
3700
|
+
* @param args arguments to the move function.
|
|
3701
|
+
*
|
|
3702
|
+
* @example
|
|
3703
|
+
* A coin transfer function has three arguments "from", "to" and "amount".
|
|
3704
|
+
* ```
|
|
3705
|
+
* public entry fun transfer<CoinType>(from: &signer, to: address, amount: u64)
|
|
3706
|
+
* ```
|
|
3707
|
+
*/
|
|
3708
|
+
constructor(module_name: ModuleId, function_name: Identifier, type_args: Array<TypeTag>, args: Array<EntryFunctionArgument>);
|
|
3709
|
+
/**
|
|
3710
|
+
* A helper function to build a EntryFunction payload from raw primitive values
|
|
3711
|
+
*
|
|
3712
|
+
* @param module_id Fully qualified module name in format "AccountAddress::module_id" e.g. "0x1::coin"
|
|
3713
|
+
* @param function_name Function name
|
|
3714
|
+
* @param type_args Type arguments that move function requires.
|
|
3715
|
+
*
|
|
3716
|
+
* @example
|
|
3717
|
+
* A coin transfer function has one type argument "CoinType".
|
|
3718
|
+
* ```
|
|
3719
|
+
* public(script) fun transfer<CoinType>(from: &signer, to: address, amount: u64,)
|
|
3720
|
+
* ```
|
|
3721
|
+
* @param args Arguments to the move function.
|
|
3722
|
+
*
|
|
3723
|
+
* @example
|
|
3724
|
+
* A coin transfer function has three arguments "from", "to" and "amount".
|
|
3725
|
+
* ```
|
|
3726
|
+
* public(script) fun transfer<CoinType>(from: &signer, to: address, amount: u64,)
|
|
3727
|
+
* ```
|
|
3728
|
+
* @returns EntryFunction
|
|
3729
|
+
*/
|
|
3730
|
+
static build(module_id: MoveModuleId, function_name: string, type_args: Array<TypeTag>, args: Array<EntryFunctionArgument>): EntryFunction;
|
|
3731
|
+
serialize(serializer: Serializer): void;
|
|
3732
|
+
/**
|
|
3733
|
+
* Deserializes an entry function payload with the arguments represented as EntryFunctionBytes instances.
|
|
3734
|
+
* @see EntryFunctionBytes
|
|
3735
|
+
*
|
|
3736
|
+
* NOTE: When you deserialize an EntryFunction payload with this method, the entry function
|
|
3737
|
+
* arguments are populated into the deserialized instance as type-agnostic, raw fixed bytes
|
|
3738
|
+
* in the form of the EntryFunctionBytes class.
|
|
3739
|
+
*
|
|
3740
|
+
* In order to correctly deserialize these arguments as their actual type representations, you
|
|
3741
|
+
* must know the types of the arguments beforehand and deserialize them yourself individually.
|
|
3742
|
+
*
|
|
3743
|
+
* One way you could achieve this is by using the ABIs for an entry function and deserializing each
|
|
3744
|
+
* argument as its given, corresponding type.
|
|
3745
|
+
*
|
|
3746
|
+
* @param deserializer
|
|
3747
|
+
* @returns A deserialized EntryFunction payload for a transaction.
|
|
3748
|
+
*
|
|
3749
|
+
*/
|
|
3750
|
+
static deserialize(deserializer: Deserializer): EntryFunction;
|
|
3751
|
+
}
|
|
3752
|
+
/**
|
|
3753
|
+
* Representation of a Script that can serialized and deserialized
|
|
3754
|
+
*/
|
|
3755
|
+
declare class Script {
|
|
3756
|
+
/**
|
|
3757
|
+
* The move module bytecode
|
|
3758
|
+
*/
|
|
3759
|
+
readonly bytecode: Uint8Array;
|
|
3760
|
+
/**
|
|
3761
|
+
* The type arguments that the bytecode function requires.
|
|
3762
|
+
*/
|
|
3763
|
+
readonly type_args: Array<TypeTag>;
|
|
3764
|
+
/**
|
|
3765
|
+
* The arguments that the bytecode function requires.
|
|
3766
|
+
*/
|
|
3767
|
+
readonly args: Array<ScriptFunctionArgument>;
|
|
3768
|
+
/**
|
|
3769
|
+
* Scripts contain the Move bytecodes payload that can be submitted to Aptos chain for execution.
|
|
3770
|
+
*
|
|
3771
|
+
* @param bytecode The move module bytecode
|
|
3772
|
+
* @param type_args The type arguments that the bytecode function requires.
|
|
3773
|
+
*
|
|
3774
|
+
* @example
|
|
3775
|
+
* A coin transfer function has one type argument "CoinType".
|
|
3776
|
+
* ```
|
|
3777
|
+
* public(script) fun transfer<CoinType>(from: &signer, to: address, amount: u64,)
|
|
3778
|
+
* ```
|
|
3779
|
+
* @param args The arguments that the bytecode function requires.
|
|
3780
|
+
*
|
|
3781
|
+
* @example
|
|
3782
|
+
* A coin transfer function has three arguments "from", "to" and "amount".
|
|
3783
|
+
* ```
|
|
3784
|
+
* public(script) fun transfer<CoinType>(from: &signer, to: address, amount: u64,)
|
|
3785
|
+
* ```
|
|
3786
|
+
*/
|
|
3787
|
+
constructor(bytecode: Uint8Array, type_args: Array<TypeTag>, args: Array<ScriptFunctionArgument>);
|
|
3788
|
+
serialize(serializer: Serializer): void;
|
|
3789
|
+
static deserialize(deserializer: Deserializer): Script;
|
|
3790
|
+
}
|
|
3791
|
+
/**
|
|
3792
|
+
* Representation of a MultiSig that can serialized and deserialized
|
|
3793
|
+
*/
|
|
3794
|
+
declare class MultiSig {
|
|
3795
|
+
readonly multisig_address: AccountAddress;
|
|
3796
|
+
readonly transaction_payload?: MultiSigTransactionPayload;
|
|
3797
|
+
/**
|
|
3798
|
+
* Contains the payload to run a multi-sig account transaction.
|
|
3799
|
+
*
|
|
3800
|
+
* @param multisig_address The multi-sig account address the transaction will be executed as.
|
|
3801
|
+
*
|
|
3802
|
+
* @param transaction_payload The payload of the multi-sig transaction. This is optional when executing a multi-sig
|
|
3803
|
+
* transaction whose payload is already stored on chain.
|
|
3804
|
+
*/
|
|
3805
|
+
constructor(multisig_address: AccountAddress, transaction_payload?: MultiSigTransactionPayload);
|
|
3806
|
+
serialize(serializer: Serializer): void;
|
|
3807
|
+
static deserialize(deserializer: Deserializer): MultiSig;
|
|
3808
|
+
}
|
|
3809
|
+
/**
|
|
3810
|
+
* Representation of a MultiSig Transaction Payload that can serialized and deserialized
|
|
3811
|
+
*/
|
|
3812
|
+
declare class MultiSigTransactionPayload {
|
|
3813
|
+
readonly transaction_payload: EntryFunction;
|
|
3814
|
+
/**
|
|
3815
|
+
* Contains the payload to run a multi-sig account transaction.
|
|
3816
|
+
*
|
|
3817
|
+
* @param transaction_payload The payload of the multi-sig transaction.
|
|
3818
|
+
* This can only be EntryFunction for now but,
|
|
3819
|
+
* Script might be supported in the future.
|
|
3820
|
+
*/
|
|
3821
|
+
constructor(transaction_payload: EntryFunction);
|
|
3822
|
+
serialize(serializer: Serializer): void;
|
|
3823
|
+
static deserialize(deserializer: Deserializer): MultiSigTransactionPayload;
|
|
3824
|
+
}
|
|
3825
|
+
|
|
3826
|
+
/**
|
|
3827
|
+
* Representation of a Raw Transaction that can serialized and deserialized
|
|
3828
|
+
*/
|
|
3829
|
+
declare class RawTransaction extends Serializable {
|
|
3830
|
+
readonly sender: AccountAddress;
|
|
3831
|
+
readonly sequence_number: bigint;
|
|
3832
|
+
readonly payload: TransactionPayload$1;
|
|
3833
|
+
readonly max_gas_amount: bigint;
|
|
3834
|
+
readonly gas_unit_price: bigint;
|
|
3835
|
+
readonly expiration_timestamp_secs: bigint;
|
|
3836
|
+
readonly chain_id: ChainId;
|
|
3837
|
+
/**
|
|
3838
|
+
* RawTransactions contain the metadata and payloads that can be submitted to Aptos chain for execution.
|
|
3839
|
+
* RawTransactions must be signed before Aptos chain can execute them.
|
|
3840
|
+
*
|
|
3841
|
+
* @param sender The sender Account Address
|
|
3842
|
+
* @param sequence_number Sequence number of this transaction. This must match the sequence number stored in
|
|
3843
|
+
* the sender's account at the time the transaction executes.
|
|
3844
|
+
* @param payload Instructions for the Aptos Blockchain, including publishing a module,
|
|
3845
|
+
* execute an entry function or execute a script payload.
|
|
3846
|
+
* @param max_gas_amount Maximum total gas to spend for this transaction. The account must have more
|
|
3847
|
+
* than this gas or the transaction will be discarded during validation.
|
|
3848
|
+
* @param gas_unit_price Price to be paid per gas unit.
|
|
3849
|
+
* @param expiration_timestamp_secs The blockchain timestamp at which the blockchain would discard this transaction.
|
|
3850
|
+
* @param chain_id The chain ID of the blockchain that this transaction is intended to be run on.
|
|
3851
|
+
*/
|
|
3852
|
+
constructor(sender: AccountAddress, sequence_number: bigint, payload: TransactionPayload$1, max_gas_amount: bigint, gas_unit_price: bigint, expiration_timestamp_secs: bigint, chain_id: ChainId);
|
|
3853
|
+
serialize(serializer: Serializer): void;
|
|
3854
|
+
static deserialize(deserializer: Deserializer): RawTransaction;
|
|
3855
|
+
}
|
|
3856
|
+
/**
|
|
3857
|
+
* Representation of a Raw Transaction With Data that can serialized and deserialized
|
|
3858
|
+
*/
|
|
3859
|
+
declare abstract class RawTransactionWithData extends Serializable {
|
|
3860
|
+
/**
|
|
3861
|
+
* Serialize a Raw Transaction With Data
|
|
3862
|
+
*/
|
|
3863
|
+
abstract serialize(serializer: Serializer): void;
|
|
3864
|
+
/**
|
|
3865
|
+
* Deserialize a Raw Transaction With Data
|
|
3866
|
+
*/
|
|
3867
|
+
static deserialize(deserializer: Deserializer): RawTransactionWithData;
|
|
3868
|
+
}
|
|
3869
|
+
/**
|
|
3870
|
+
* Representation of a Multi Agent Transaction that can serialized and deserialized
|
|
3871
|
+
*/
|
|
3872
|
+
declare class MultiAgentRawTransaction extends RawTransactionWithData {
|
|
3873
|
+
/**
|
|
3874
|
+
* The raw transaction
|
|
3875
|
+
*/
|
|
3876
|
+
readonly raw_txn: RawTransaction;
|
|
3877
|
+
/**
|
|
3878
|
+
* The secondary signers on this transaction
|
|
3879
|
+
*/
|
|
3880
|
+
readonly secondary_signer_addresses: Array<AccountAddress>;
|
|
3881
|
+
constructor(raw_txn: RawTransaction, secondary_signer_addresses: Array<AccountAddress>);
|
|
3882
|
+
serialize(serializer: Serializer): void;
|
|
3883
|
+
static load(deserializer: Deserializer): MultiAgentRawTransaction;
|
|
3884
|
+
}
|
|
3885
|
+
/**
|
|
3886
|
+
* Representation of a Fee Payer Transaction that can serialized and deserialized
|
|
3887
|
+
*/
|
|
3888
|
+
declare class FeePayerRawTransaction extends RawTransactionWithData {
|
|
3889
|
+
/**
|
|
3890
|
+
* The raw transaction
|
|
3891
|
+
*/
|
|
3892
|
+
readonly raw_txn: RawTransaction;
|
|
3893
|
+
/**
|
|
3894
|
+
* The secondary signers on this transaction - optional and can be empty
|
|
3895
|
+
*/
|
|
3896
|
+
readonly secondary_signer_addresses: Array<AccountAddress>;
|
|
3897
|
+
/**
|
|
3898
|
+
* The fee payer account address
|
|
3899
|
+
*/
|
|
3900
|
+
readonly fee_payer_address: AccountAddress;
|
|
3901
|
+
constructor(raw_txn: RawTransaction, secondary_signer_addresses: Array<AccountAddress>, fee_payer_address: AccountAddress);
|
|
3902
|
+
serialize(serializer: Serializer): void;
|
|
3903
|
+
static load(deserializer: Deserializer): FeePayerRawTransaction;
|
|
3904
|
+
}
|
|
3905
|
+
|
|
3906
|
+
declare type EntryFunctionArgumentTypes = Bool | U8 | U16 | U32 | U64 | U128 | U256 | AccountAddress | MoveObject | MoveVector<EntryFunctionArgumentTypes> | MoveOption<EntryFunctionArgumentTypes> | MoveString | FixedBytes;
|
|
3907
|
+
declare type ScriptFunctionArgumentTypes = Bool | U8 | U16 | U32 | U64 | U128 | U256 | AccountAddress | MoveObject | MoveVector<U8> | MoveString | FixedBytes;
|
|
3908
|
+
/**
|
|
3909
|
+
* Type that holds all raw transaction instances Aptos SDK supports
|
|
3910
|
+
*/
|
|
3911
|
+
declare type AnyRawTransactionInstance = RawTransaction | MultiAgentRawTransaction | FeePayerRawTransaction;
|
|
3912
|
+
/**
|
|
3913
|
+
* Optional options to set when generating a transaction
|
|
3914
|
+
*/
|
|
3915
|
+
declare type GenerateTransactionOptions = {
|
|
3916
|
+
maxGasAmount?: AnyNumber;
|
|
3917
|
+
gasUnitPrice?: AnyNumber;
|
|
3918
|
+
expireTimestamp?: AnyNumber;
|
|
3919
|
+
accountSequenceNumber?: AnyNumber;
|
|
3920
|
+
};
|
|
3921
|
+
/**
|
|
3922
|
+
* The generated transaction payload type that was produces from `generateTransactionPayload()` function.
|
|
3923
|
+
*/
|
|
3924
|
+
declare type TransactionPayload = TransactionPayloadEntryFunction | TransactionPayloadScript | TransactionPayloadMultisig;
|
|
3925
|
+
/**
|
|
3926
|
+
* Unified type for the data needed to generate a transaction payload of types:
|
|
3927
|
+
* Entry Function | Script | Multi Sig
|
|
3928
|
+
*/
|
|
3929
|
+
declare type GenerateTransactionPayloadData = EntryFunctionData | ScriptData | MultiSigData;
|
|
3930
|
+
/**
|
|
3931
|
+
* The data needed to generate an Entry Function payload
|
|
3932
|
+
*/
|
|
3933
|
+
declare type EntryFunctionData = {
|
|
3934
|
+
function: MoveStructType;
|
|
3935
|
+
typeArguments?: Array<TypeTag>;
|
|
3936
|
+
arguments: Array<EntryFunctionArgumentTypes>;
|
|
3937
|
+
};
|
|
3938
|
+
/**
|
|
3939
|
+
* The data needed to generate a Multi Sig payload
|
|
3940
|
+
*/
|
|
3941
|
+
declare type MultiSigData = {
|
|
3942
|
+
multisigAddress: AccountAddress;
|
|
3943
|
+
} & EntryFunctionData;
|
|
3944
|
+
/**
|
|
3945
|
+
* The data needed to generate a Script payload
|
|
3946
|
+
*/
|
|
3947
|
+
declare type ScriptData = {
|
|
3948
|
+
bytecode: HexInput;
|
|
3949
|
+
typeArguments?: Array<TypeTag>;
|
|
3950
|
+
arguments: Array<ScriptFunctionArgumentTypes>;
|
|
3951
|
+
};
|
|
3952
|
+
/**
|
|
3953
|
+
* Interface of the arguments to generate a single signer transaction.
|
|
3954
|
+
* Used to provide to `generateTransaction()` method in the transaction builder flow
|
|
3955
|
+
*/
|
|
3956
|
+
interface GenerateSingleSignerRawTransactionArgs {
|
|
3957
|
+
aptosConfig: AptosConfig;
|
|
3958
|
+
sender: HexInput;
|
|
3959
|
+
payload: TransactionPayload;
|
|
3960
|
+
feePayerAddress?: undefined;
|
|
3961
|
+
secondarySignerAddresses?: undefined;
|
|
3962
|
+
options?: GenerateTransactionOptions;
|
|
3963
|
+
}
|
|
3964
|
+
/**
|
|
3965
|
+
* Interface of the arguments to generate a fee payer transaction.
|
|
3966
|
+
* Used to provide to `generateTransaction()` method in the transaction builder flow
|
|
3967
|
+
*/
|
|
3968
|
+
interface GenerateFeePayerRawTransactionArgs {
|
|
3969
|
+
aptosConfig: AptosConfig;
|
|
3970
|
+
sender: HexInput;
|
|
3971
|
+
payload: TransactionPayload;
|
|
3972
|
+
feePayerAddress: HexInput;
|
|
3973
|
+
secondarySignerAddresses?: HexInput[];
|
|
3974
|
+
options?: GenerateTransactionOptions;
|
|
3975
|
+
}
|
|
3976
|
+
/**
|
|
3977
|
+
* Interface of the arguments to generate a multi-agent transaction.
|
|
3978
|
+
* Used to provide to `generateTransaction()` method in the transaction builder flow
|
|
3979
|
+
*/
|
|
3980
|
+
interface GenerateMultiAgentRawTransactionArgs {
|
|
3981
|
+
aptosConfig: AptosConfig;
|
|
3982
|
+
sender: HexInput;
|
|
3983
|
+
payload: TransactionPayload;
|
|
3984
|
+
secondarySignerAddresses: HexInput[];
|
|
3985
|
+
feePayerAddress?: undefined;
|
|
3986
|
+
options?: GenerateTransactionOptions;
|
|
3987
|
+
}
|
|
3988
|
+
/**
|
|
3989
|
+
* Unified type that holds all the interfaces to generate different transaction types
|
|
3990
|
+
*/
|
|
3991
|
+
declare type GenerateRawTransactionArgs = GenerateSingleSignerRawTransactionArgs | GenerateFeePayerRawTransactionArgs | GenerateMultiAgentRawTransactionArgs;
|
|
3992
|
+
/**
|
|
3993
|
+
* Interface that holds the return data when generating a single signer transaction
|
|
3994
|
+
*
|
|
3995
|
+
* @param rawTransaction a bcs serialized raw transaction
|
|
3996
|
+
*/
|
|
3997
|
+
interface SingleSignerTransaction {
|
|
3998
|
+
rawTransaction: Uint8Array;
|
|
3999
|
+
feePayerAddress?: undefined;
|
|
4000
|
+
secondarySignerAddresses?: undefined;
|
|
4001
|
+
}
|
|
4002
|
+
/**
|
|
4003
|
+
* Interface that holds the return data when generating a fee payer transaction
|
|
4004
|
+
*
|
|
4005
|
+
* @param rawTransaction a bcs serialized raw transaction
|
|
4006
|
+
* @param secondarySignerAddresses optional. secondary signer addresses for multi-agent transaction
|
|
4007
|
+
* @param feePayerAddress fee payer address for a fee payer transaction (aka Sponsored Transaction)
|
|
4008
|
+
*/
|
|
4009
|
+
interface FeePayerTransaction {
|
|
4010
|
+
rawTransaction: Uint8Array;
|
|
4011
|
+
feePayerAddress: AccountAddress;
|
|
4012
|
+
secondarySignerAddresses?: AccountAddress[];
|
|
4013
|
+
}
|
|
4014
|
+
/**
|
|
4015
|
+
* Interface that holds the return data when generating a multi-agent transaction.
|
|
4016
|
+
*
|
|
4017
|
+
* @param rawTransaction a bcs serialized raw transaction
|
|
4018
|
+
* @param secondarySignerAddresses secondary signer addresses for multi-agent transaction
|
|
4019
|
+
*/
|
|
4020
|
+
interface MultiAgentTransaction {
|
|
4021
|
+
rawTransaction: Uint8Array;
|
|
4022
|
+
secondarySignerAddresses: AccountAddress[];
|
|
4023
|
+
feePayerAddress?: undefined;
|
|
4024
|
+
}
|
|
4025
|
+
/**
|
|
4026
|
+
* Unified type that holds all the return interfaces when generating different transaction types
|
|
4027
|
+
*/
|
|
4028
|
+
declare type AnyRawTransaction = SingleSignerTransaction | FeePayerTransaction | MultiAgentTransaction;
|
|
4029
|
+
declare type SimulateTransactionData = {
|
|
4030
|
+
/**
|
|
4031
|
+
* The transaction to simulate, probably generated by `generateTransaction()`
|
|
4032
|
+
*/
|
|
4033
|
+
transaction: AnyRawTransaction;
|
|
4034
|
+
/**
|
|
4035
|
+
* For a single signer transaction
|
|
4036
|
+
*/
|
|
4037
|
+
signerPublicKey: PublicKey;
|
|
4038
|
+
/**
|
|
4039
|
+
* For a fee payer or multi-agent transaction that requires additional signers in
|
|
4040
|
+
*/
|
|
4041
|
+
secondarySignersPublicKeys?: Array<PublicKey>;
|
|
4042
|
+
/**
|
|
4043
|
+
* For a fee payer transaction (aka Sponsored Transaction)
|
|
4044
|
+
*/
|
|
4045
|
+
feePayerPublicKey?: PublicKey;
|
|
4046
|
+
options?: SimulateTransactionOptions;
|
|
4047
|
+
};
|
|
4048
|
+
declare type SimulateTransactionOptions = {
|
|
4049
|
+
estimateGasUnitPrice?: boolean;
|
|
4050
|
+
estimateMaxGasAmount?: boolean;
|
|
4051
|
+
estimatePrioritizedGasUnitPrice?: boolean;
|
|
4052
|
+
};
|
|
4053
|
+
/**
|
|
4054
|
+
* Interface that holds the user data input when generating a single signer transaction
|
|
4055
|
+
*/
|
|
4056
|
+
interface GenerateSingleSignerRawTransactionInput {
|
|
4057
|
+
sender: HexInput;
|
|
4058
|
+
feePayerAddress?: undefined;
|
|
4059
|
+
secondarySignerAddresses?: undefined;
|
|
4060
|
+
options?: GenerateTransactionOptions;
|
|
4061
|
+
data: GenerateTransactionPayloadData;
|
|
4062
|
+
}
|
|
4063
|
+
/**
|
|
4064
|
+
* Interface that holds the user data input when generating a fee payer transaction
|
|
4065
|
+
*/
|
|
4066
|
+
interface GenerateFeePayerRawTransactionInput {
|
|
4067
|
+
sender: HexInput;
|
|
4068
|
+
feePayerAddress: HexInput;
|
|
4069
|
+
secondarySignerAddresses?: HexInput[];
|
|
4070
|
+
options?: GenerateTransactionOptions;
|
|
4071
|
+
data: GenerateTransactionPayloadData;
|
|
4072
|
+
}
|
|
4073
|
+
/**
|
|
4074
|
+
* Interface that holds the user data input when generating a multi-agent transaction
|
|
4075
|
+
*/
|
|
4076
|
+
interface GenerateMultiAgentRawTransactionInput {
|
|
4077
|
+
sender: HexInput;
|
|
4078
|
+
secondarySignerAddresses: HexInput[];
|
|
4079
|
+
feePayerAddress?: undefined;
|
|
4080
|
+
options?: GenerateTransactionOptions;
|
|
4081
|
+
data: GenerateTransactionPayloadData;
|
|
4082
|
+
}
|
|
4083
|
+
/**
|
|
4084
|
+
* Unified type that holds all the user data input interfaces when generating different transaction types
|
|
4085
|
+
*/
|
|
4086
|
+
declare type GenerateTransactionInput = GenerateMultiAgentRawTransactionInput | GenerateFeePayerRawTransactionInput | GenerateSingleSignerRawTransactionInput;
|
|
4087
|
+
|
|
4088
|
+
/**
|
|
4089
|
+
* A class to handle all `Coin` operations
|
|
4090
|
+
*/
|
|
4091
|
+
declare class Coin {
|
|
4092
|
+
readonly config: AptosConfig;
|
|
4093
|
+
constructor(config: AptosConfig);
|
|
4094
|
+
/**
|
|
4095
|
+
* Generate a transfer coin transaction that can be simulated and/or signed and submitted
|
|
4096
|
+
*
|
|
4097
|
+
* @param args.sender The sender account
|
|
4098
|
+
* @param args.recipient The recipient address
|
|
4099
|
+
* @param args.amount The amount to transfer
|
|
4100
|
+
* @param args.coinType optional. The coin struct type to transfer. Defaults to 0x1::aptos_coin::AptosCoin
|
|
4101
|
+
*
|
|
4102
|
+
* @returns SingleSignerTransaction
|
|
4103
|
+
*/
|
|
4104
|
+
transferCoinTransaction(args: {
|
|
4105
|
+
sender: Account$1;
|
|
4106
|
+
recipient: HexInput;
|
|
4107
|
+
amount: AnyNumber;
|
|
4108
|
+
coinType?: MoveResourceType;
|
|
4109
|
+
options?: GenerateTransactionOptions;
|
|
4110
|
+
}): Promise<SingleSignerTransaction>;
|
|
4111
|
+
}
|
|
4112
|
+
|
|
4113
|
+
/**
|
|
4114
|
+
* This file contains the underlying implementations for exposed API surface in
|
|
4115
|
+
* the {@link api/digitalAsset}. By moving the methods out into a separate file,
|
|
4116
|
+
* other namespaces and processes can access these methods without depending on the entire
|
|
4117
|
+
* digitalAsset namespace and without having a dependency cycle error.
|
|
4118
|
+
*/
|
|
4119
|
+
|
|
4120
|
+
interface CreateCollectionOptions {
|
|
4121
|
+
maxSupply?: AnyNumber;
|
|
4122
|
+
mutableDescription?: boolean;
|
|
4123
|
+
mutableRoyalty?: boolean;
|
|
4124
|
+
mutableURI?: boolean;
|
|
4125
|
+
mutableTokenDescription?: boolean;
|
|
4126
|
+
mutableTokenName?: boolean;
|
|
4127
|
+
mutableTokenProperties?: boolean;
|
|
4128
|
+
mutableTokenURI?: boolean;
|
|
4129
|
+
tokensBurnableByCreator?: boolean;
|
|
4130
|
+
tokensFreezableByCreator?: boolean;
|
|
4131
|
+
royaltyNumerator?: number;
|
|
4132
|
+
royaltyDenominator?: number;
|
|
4133
|
+
}
|
|
4134
|
+
|
|
4135
|
+
/**
|
|
4136
|
+
* A class to query all `DigitalAsset` related queries on Aptos.
|
|
4137
|
+
*/
|
|
4138
|
+
declare class DigitalAsset {
|
|
4139
|
+
readonly config: AptosConfig;
|
|
4140
|
+
constructor(config: AptosConfig);
|
|
4141
|
+
/**
|
|
4142
|
+
* Creates a new collection within the specified account
|
|
4143
|
+
*
|
|
4144
|
+
* @param args.creator the account of the collection's creator
|
|
4145
|
+
* @param args.description the description of the collection
|
|
4146
|
+
* @param args.name the name of the collection
|
|
4147
|
+
* @param args.uri the URI to additional info about the collection
|
|
4148
|
+
*
|
|
4149
|
+
* The parameters below are optional.
|
|
4150
|
+
* @param args.maxSupply controls the max supply of the tokens - defaults MAX_U64_BIG_INT
|
|
4151
|
+
* @param args.mutableDescription controls mutability of the collection's description - defaults true
|
|
4152
|
+
* @param args.mutableRoyalty controls mutability of the collection's description - defaults true
|
|
4153
|
+
* @param args.mutableUri controls mutability of the collection's URI - defaults true
|
|
4154
|
+
* @param args.mutableTokenDescription controls mutability of the token's description - defaults true
|
|
4155
|
+
* @param args.mutableTokenName controls mutability of the token's name - defaults true
|
|
4156
|
+
* @param args.mutableTokenProperties controls mutability of token's properties - defaults true
|
|
4157
|
+
* @param args.mutableTokenUri controls mutability of the token's URI - defaults true
|
|
4158
|
+
* @param args.tokensBurnableByCreator controls whether tokens can be burnable by the creator - defaults true
|
|
4159
|
+
* @param args.tokensFreezableByCreator controls whether tokens can be frozen by the creator - defaults true
|
|
4160
|
+
* @param args.royaltyNumerator the numerator of the royalty to be paid to the creator when a token is transferred - defaults 0
|
|
4161
|
+
* @param args.royaltyDenominator the denominator of the royalty to be paid to the creator when a token is transferred -
|
|
4162
|
+
* defaults 1
|
|
4163
|
+
*
|
|
4164
|
+
* @returns A SingleSignerTransaction that when submitted will create the collection.
|
|
4165
|
+
*/
|
|
4166
|
+
createCollectionTransaction(args: {
|
|
4167
|
+
creator: Account$1;
|
|
4168
|
+
description: string;
|
|
4169
|
+
name: string;
|
|
4170
|
+
uri: string;
|
|
4171
|
+
options?: GenerateTransactionOptions;
|
|
4172
|
+
} & CreateCollectionOptions): Promise<SingleSignerTransaction>;
|
|
4173
|
+
/**
|
|
4174
|
+
* Queries data of a specific collection by the collection creator address and the collection name.
|
|
4175
|
+
*
|
|
4176
|
+
* If, for some reason, a creator account has 2 collections with the same name in v1 and v2,
|
|
4177
|
+
* can pass an optional `tokenStandard` parameter to query a specific standard
|
|
4178
|
+
*
|
|
4179
|
+
* @param args.creatorAddress the address of the collection's creator
|
|
4180
|
+
* @param args.collectionName the name of the collection
|
|
4181
|
+
* @param args.options.tokenStandard the token standard to query
|
|
4182
|
+
* @returns GetCollectionDataResponse response type
|
|
4183
|
+
*/
|
|
4184
|
+
getCollectionData(args: {
|
|
4185
|
+
creatorAddress: HexInput;
|
|
4186
|
+
collectionName: string;
|
|
4187
|
+
options?: {
|
|
4188
|
+
tokenStandard?: TokenStandard;
|
|
4189
|
+
};
|
|
4190
|
+
}): Promise<GetCollectionDataResponse>;
|
|
4191
|
+
/**
|
|
4192
|
+
* Queries a collection's ID.
|
|
4193
|
+
*
|
|
4194
|
+
* This is the same as the collection's object address in V2, but V1 does
|
|
4195
|
+
* not use objects, and does not have an address
|
|
4196
|
+
*
|
|
4197
|
+
* @param args.creatorAddress the address of the collection's creator
|
|
4198
|
+
* @param args.collectionName the name of the collection
|
|
4199
|
+
* @param args.options.tokenStandard the token standard to query
|
|
4200
|
+
* @returns the collection id
|
|
4201
|
+
*/
|
|
4202
|
+
getCollectionId(args: {
|
|
4203
|
+
creatorAddress: HexInput;
|
|
4204
|
+
collectionName: string;
|
|
4205
|
+
options?: {
|
|
4206
|
+
tokenStandard?: TokenStandard;
|
|
4207
|
+
};
|
|
4208
|
+
}): Promise<string>;
|
|
4209
|
+
/**
|
|
4210
|
+
* Create a transaction to mint a token into the creators account within an existing collection.
|
|
4211
|
+
*
|
|
4212
|
+
* @param args.creator the creator of the collection
|
|
4213
|
+
* @param args.collection the name of the collection the token belongs to
|
|
4214
|
+
* @param args.description the description of the token
|
|
4215
|
+
* @param args.name the name of the token
|
|
4216
|
+
* @param args.uri the URI to additional info about the token
|
|
4217
|
+
*
|
|
4218
|
+
* @returns A SingleSignerTransaction that can be simulated or submitted to chain
|
|
4219
|
+
*/
|
|
4220
|
+
mintTokenTransaction(args: {
|
|
4221
|
+
creator: Account$1;
|
|
4222
|
+
collection: string;
|
|
4223
|
+
description: string;
|
|
4224
|
+
name: string;
|
|
4225
|
+
uri: string;
|
|
4226
|
+
options?: GenerateTransactionOptions;
|
|
4227
|
+
}): Promise<SingleSignerTransaction>;
|
|
4228
|
+
/**
|
|
4229
|
+
* Gets token data given the address of a token.
|
|
4230
|
+
*
|
|
4231
|
+
* @param args.tokenAddress The address of the token
|
|
4232
|
+
* @returns GetTokenDataResponse containing relevant data to the token.
|
|
4233
|
+
*/
|
|
4234
|
+
getTokenData(args: {
|
|
4235
|
+
tokenAddress: HexInput;
|
|
4236
|
+
}): Promise<GetTokenDataResponse>;
|
|
4237
|
+
/**
|
|
4238
|
+
* Gets token ownership data given the address of a token.
|
|
4239
|
+
*
|
|
4240
|
+
* @param args.tokenAddress The address of the token
|
|
4241
|
+
* @returns GetCurrentTokenOwnershipResponse containing relevant ownership data of the token.
|
|
4242
|
+
*/
|
|
4243
|
+
getCurrentTokenOwnership(args: {
|
|
4244
|
+
tokenAddress: HexInput;
|
|
4245
|
+
}): Promise<GetCurrentTokenOwnershipResponse>;
|
|
4246
|
+
/**
|
|
4247
|
+
* Gets the tokens that the given address owns.
|
|
4248
|
+
*
|
|
4249
|
+
* @param args.ownerAddress The address of the owner
|
|
4250
|
+
* @returns GetOwnedTokensResponse containing ownership data of the tokens belonging to the ownerAddresss.
|
|
4251
|
+
*/
|
|
4252
|
+
getOwnedTokens(args: {
|
|
4253
|
+
ownerAddress: HexInput;
|
|
4254
|
+
options?: {
|
|
4255
|
+
pagination?: PaginationArgs;
|
|
4256
|
+
orderBy?: OrderBy<GetOwnedTokensResponse[0]>;
|
|
4257
|
+
};
|
|
4258
|
+
}): Promise<GetOwnedTokensResponse>;
|
|
4259
|
+
/**
|
|
4260
|
+
* Gets the activity data given the address of a token.
|
|
4261
|
+
*
|
|
4262
|
+
* @param args.tokenAddress The address of the token
|
|
4263
|
+
* @returns GetTokenActivityResponse containing relevant activity data to the token.
|
|
4264
|
+
*/
|
|
4265
|
+
getTokenActivity(args: {
|
|
4266
|
+
tokenAddress: HexInput;
|
|
4267
|
+
options?: {
|
|
4268
|
+
pagination?: PaginationArgs;
|
|
4269
|
+
orderBy?: OrderBy<GetTokenActivityResponse[0]>;
|
|
4270
|
+
};
|
|
4271
|
+
}): Promise<GetTokenActivityResponse>;
|
|
4272
|
+
}
|
|
4273
|
+
|
|
4274
|
+
/**
|
|
4275
|
+
* A class to query all `Event` Aptos related queries
|
|
4276
|
+
*/
|
|
4277
|
+
declare class Event {
|
|
4278
|
+
readonly config: AptosConfig;
|
|
4279
|
+
constructor(config: AptosConfig);
|
|
4280
|
+
/**
|
|
4281
|
+
* Get events by creation number and an account address
|
|
4282
|
+
*
|
|
4283
|
+
* @param args.accountAddress - The account address
|
|
4284
|
+
* @param args.creationNumber - The event creation number
|
|
4285
|
+
*
|
|
4286
|
+
* @returns Promise<GetEventsResponse>
|
|
4287
|
+
*/
|
|
4288
|
+
getAccountEventsByCreationNumber(args: {
|
|
4289
|
+
accountAddress: HexInput;
|
|
4290
|
+
creationNumber: AnyNumber;
|
|
4291
|
+
}): Promise<GetEventsResponse>;
|
|
4292
|
+
/**
|
|
4293
|
+
* Get events by event type and an account address
|
|
4294
|
+
*
|
|
4295
|
+
* @param args.accountAddress - The account address
|
|
4296
|
+
* @param args.eventType - The event type
|
|
4297
|
+
*
|
|
4298
|
+
* @returns Promise<GetEventsResponse>
|
|
4299
|
+
*/
|
|
4300
|
+
getAccountEventsByEventType(args: {
|
|
4301
|
+
accountAddress: HexInput;
|
|
4302
|
+
eventType: MoveResourceType;
|
|
4303
|
+
options?: {
|
|
4304
|
+
pagination?: PaginationArgs;
|
|
4305
|
+
orderBy?: OrderBy<GetEventsResponse[0]>;
|
|
4306
|
+
};
|
|
4307
|
+
}): Promise<GetEventsResponse>;
|
|
4308
|
+
/**
|
|
4309
|
+
* Get all events
|
|
4310
|
+
*
|
|
4311
|
+
* An optional `where` can be passed in to filter out the response.
|
|
4312
|
+
*
|
|
4313
|
+
* @example
|
|
4314
|
+
* ```
|
|
4315
|
+
* { where:
|
|
4316
|
+
* {
|
|
4317
|
+
* transaction_version: { _eq: 123456 },
|
|
4318
|
+
* }
|
|
4319
|
+
* }
|
|
4320
|
+
* ```
|
|
4321
|
+
*
|
|
4322
|
+
* @returns GetEventsQuery response type
|
|
4323
|
+
*/
|
|
4324
|
+
getEvents(args?: {
|
|
4325
|
+
options?: {
|
|
4326
|
+
where?: EventsBoolExp;
|
|
4327
|
+
pagination?: PaginationArgs;
|
|
4328
|
+
orderBy?: OrderBy<GetEventsResponse[0]>;
|
|
4329
|
+
};
|
|
4330
|
+
}): Promise<GetEventsResponse>;
|
|
4331
|
+
}
|
|
4332
|
+
|
|
4333
|
+
/**
|
|
4334
|
+
* A class to query all `Faucet` related queries on Aptos.
|
|
4335
|
+
*/
|
|
4336
|
+
declare class Faucet {
|
|
4337
|
+
readonly config: AptosConfig;
|
|
4338
|
+
constructor(config: AptosConfig);
|
|
4339
|
+
/**
|
|
4340
|
+
* This creates an account if it does not exist and mints the specified amount of
|
|
4341
|
+
* coins into that account
|
|
4342
|
+
*
|
|
4343
|
+
* @param args.accountAddress Address of the account to fund
|
|
4344
|
+
* @param args.amount Amount of tokens to fund the account with
|
|
4345
|
+
* @param args.timeoutSecs Timeout in seconds. Defaults to 20 seconds.
|
|
4346
|
+
* @returns Transaction hash of the transaction that funded the account
|
|
4347
|
+
*/
|
|
4348
|
+
fundAccount(args: {
|
|
4349
|
+
accountAddress: HexInput;
|
|
4350
|
+
amount: number;
|
|
4351
|
+
timeoutSecs?: number;
|
|
4352
|
+
}): Promise<string>;
|
|
4353
|
+
}
|
|
4354
|
+
|
|
4355
|
+
/**
|
|
4356
|
+
* A class to query all `FungibleAsset` related queries on Aptos.
|
|
4357
|
+
*/
|
|
4358
|
+
declare class FungibleAsset {
|
|
4359
|
+
readonly config: AptosConfig;
|
|
4360
|
+
constructor(config: AptosConfig);
|
|
4361
|
+
/**
|
|
4362
|
+
* Queries the current fungible asset metadata.
|
|
4363
|
+
*
|
|
4364
|
+
* This query returns the fungible asset metadata for all fungible assets.
|
|
4365
|
+
* It can be filtered by creator address and asset type.
|
|
4366
|
+
*
|
|
4367
|
+
* @returns getFungibleAssetMetadata A list of fungible asset metadata
|
|
4368
|
+
*/
|
|
4369
|
+
getFungibleAssetMetadata(args?: {
|
|
4370
|
+
options?: {
|
|
4371
|
+
pagination?: PaginationArgs;
|
|
4372
|
+
where?: FungibleAssetMetadataBoolExp;
|
|
4373
|
+
};
|
|
4374
|
+
}): Promise<GetFungibleAssetMetadataResponse>;
|
|
4375
|
+
/**
|
|
4376
|
+
* Queries the fungible asset activities
|
|
4377
|
+
*
|
|
4378
|
+
* This query returns the fungible asset activities.
|
|
4379
|
+
* It can be filtered by owner address, asset type, and type.
|
|
4380
|
+
*
|
|
4381
|
+
* @returns GetFungibleAssetActivitiesResponse A list of fungible asset metadata
|
|
4382
|
+
*/
|
|
4383
|
+
getFungibleAssetActivities(args?: {
|
|
4384
|
+
options?: {
|
|
4385
|
+
pagination?: PaginationArgs;
|
|
4386
|
+
where?: FungibleAssetActivitiesBoolExp;
|
|
4387
|
+
};
|
|
4388
|
+
}): Promise<GetFungibleAssetActivitiesResponse>;
|
|
4389
|
+
/**
|
|
4390
|
+
* Queries the fungible asset balance
|
|
4391
|
+
*
|
|
4392
|
+
* This query returns the fungible asset balance.
|
|
4393
|
+
* It can be filtered by owner address, and asset type
|
|
4394
|
+
*
|
|
4395
|
+
* @returns GetCurrentFungibleAssetBalancesResponse A list of fungible asset metadata
|
|
4396
|
+
*/
|
|
4397
|
+
getCurrentFungibleAssetBalances(args?: {
|
|
4398
|
+
options?: {
|
|
4399
|
+
pagination?: PaginationArgs;
|
|
4400
|
+
where?: CurrentFungibleAssetBalancesBoolExp;
|
|
4401
|
+
};
|
|
4402
|
+
}): Promise<GetCurrentFungibleAssetBalancesResponse>;
|
|
4403
|
+
}
|
|
4404
|
+
|
|
4405
|
+
/**
|
|
4406
|
+
* A class to query all `General` Aptos related queries
|
|
4407
|
+
*/
|
|
4408
|
+
declare class General {
|
|
4409
|
+
readonly config: AptosConfig;
|
|
4410
|
+
constructor(config: AptosConfig);
|
|
4411
|
+
/**
|
|
4412
|
+
* Queries for the Aptos ledger info
|
|
4413
|
+
*
|
|
4414
|
+
* @returns Aptos Ledger Info
|
|
4415
|
+
*
|
|
4416
|
+
* @example An example of the returned data
|
|
4417
|
+
* ```
|
|
4418
|
+
* {
|
|
4419
|
+
* "chain_id": 4,
|
|
4420
|
+
* "epoch": "8",
|
|
4421
|
+
* "ledger_version": "714",
|
|
4422
|
+
* "oldest_ledger_version": "0",
|
|
4423
|
+
* "ledger_timestamp": "1694695496521775",
|
|
4424
|
+
* "node_role": "validator",
|
|
4425
|
+
* "oldest_block_height": "0",
|
|
4426
|
+
* "block_height": "359",
|
|
4427
|
+
* "git_hash": "c82193f36f4e185fed9f68c4ad21f6c6dd390c6e"
|
|
4428
|
+
* }
|
|
4429
|
+
* ```
|
|
4430
|
+
*/
|
|
4431
|
+
getLedgerInfo(): Promise<LedgerInfo>;
|
|
4432
|
+
/**
|
|
4433
|
+
* Queries for the chain id
|
|
4434
|
+
*
|
|
4435
|
+
* @returns The chain id
|
|
4436
|
+
*/
|
|
4437
|
+
getChainId(): Promise<number>;
|
|
4438
|
+
/**
|
|
4439
|
+
* Queries for block by transaction version
|
|
4440
|
+
*
|
|
4441
|
+
* @param args.ledgerVersion Ledger version to lookup block information for
|
|
4442
|
+
* @param args.options.withTransactions If set to true, include all transactions in the block
|
|
4443
|
+
*
|
|
4444
|
+
* @returns Block information with optional transactions
|
|
4445
|
+
*/
|
|
4446
|
+
getBlockByVersion(args: {
|
|
4447
|
+
ledgerVersion: AnyNumber;
|
|
4448
|
+
options?: {
|
|
4449
|
+
withTransactions?: boolean;
|
|
4450
|
+
};
|
|
4451
|
+
}): Promise<Block>;
|
|
4452
|
+
/**
|
|
4453
|
+
* Get block by block height
|
|
4454
|
+
*
|
|
4455
|
+
* @param args.blockHeight Block height to lookup. Starts at 0
|
|
4456
|
+
* @param args.options.withTransactions If set to true, include all transactions in the block
|
|
4457
|
+
*
|
|
4458
|
+
* @returns Block with optional transactions
|
|
4459
|
+
*/
|
|
4460
|
+
getBlockByHeight(args: {
|
|
4461
|
+
blockHeight: AnyNumber;
|
|
4462
|
+
options?: {
|
|
4463
|
+
withTransactions?: boolean;
|
|
4464
|
+
};
|
|
4465
|
+
}): Promise<Block>;
|
|
4466
|
+
/**
|
|
4467
|
+
* Queries for a table item for a table identified by the handle and the key for the item.
|
|
4468
|
+
* Key and value types need to be passed in to help with key serialization and value deserialization.
|
|
4469
|
+
* @param args.handle A pointer to where that table is stored
|
|
4470
|
+
* @param args.data Object that describes table item
|
|
4471
|
+
* @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version
|
|
4472
|
+
*
|
|
4473
|
+
* @example https://fullnode.devnet.aptoslabs.com/v1/accounts/0x1/resource/0x1::coin::CoinInfo%3C0x1::aptos_coin::AptosCoin%3E
|
|
4474
|
+
* {
|
|
4475
|
+
* data.key_type = "address" // Move type of table key
|
|
4476
|
+
* data.value_type = "u128" // Move type of table value
|
|
4477
|
+
* data.key = "0x619dc29a0aac8fa146714058e8dd6d2d0f3bdf5f6331907bf91f3acd81e6935" // Value of table key
|
|
4478
|
+
* }
|
|
4479
|
+
*
|
|
4480
|
+
* @returns Table item value rendered in JSON
|
|
4481
|
+
*/
|
|
4482
|
+
getTableItem(args: {
|
|
4483
|
+
handle: string;
|
|
4484
|
+
data: TableItemRequest;
|
|
4485
|
+
options?: LedgerVersion;
|
|
4486
|
+
}): Promise<any>;
|
|
4487
|
+
/**
|
|
4488
|
+
* Queries for a Move view function
|
|
4489
|
+
* @param args.payload Payload for the view function
|
|
4490
|
+
* @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version
|
|
4491
|
+
* @example
|
|
4492
|
+
* `
|
|
4493
|
+
* const payload: ViewRequest = {
|
|
4494
|
+
* function: "0x1::coin::balance",
|
|
4495
|
+
* type_arguments: ["0x1::aptos_coin::AptosCoin"],
|
|
4496
|
+
* arguments: [accountAddress],
|
|
4497
|
+
* };
|
|
4498
|
+
* `
|
|
4499
|
+
*
|
|
4500
|
+
* @returns an array of Move values
|
|
4501
|
+
*/
|
|
4502
|
+
view(args: {
|
|
4503
|
+
payload: ViewRequestData;
|
|
4504
|
+
options?: LedgerVersion;
|
|
4505
|
+
}): Promise<Array<MoveValue>>;
|
|
4506
|
+
/**
|
|
4507
|
+
* Queries top user transactions
|
|
4508
|
+
*
|
|
4509
|
+
* @param args.limit The number of transactions to return
|
|
4510
|
+
* @returns GetChainTopUserTransactionsResponse
|
|
4511
|
+
*/
|
|
4512
|
+
getChainTopUserTransactions(args: {
|
|
4513
|
+
limit: number;
|
|
4514
|
+
}): Promise<GetChainTopUserTransactionsResponse>;
|
|
4515
|
+
/**
|
|
4516
|
+
* A generic function for retrieving data from Aptos Indexer.
|
|
4517
|
+
* For more detailed queries specification see
|
|
4518
|
+
* {@link https://cloud.hasura.io/public/graphiql?endpoint=https://indexer.mainnet.aptoslabs.com/v1/graphql}
|
|
4519
|
+
*
|
|
4520
|
+
* @param args.query.query A GraphQL query
|
|
4521
|
+
* @param args.query.variables The variables for the query
|
|
4522
|
+
* @example
|
|
4523
|
+
* ```
|
|
4524
|
+
* {
|
|
4525
|
+
* query: `query MyQuery {
|
|
4526
|
+
ledger_infos {
|
|
4527
|
+
chain_id
|
|
4528
|
+
}
|
|
4529
|
+
}`;
|
|
4530
|
+
* }
|
|
4531
|
+
* ```
|
|
4532
|
+
*
|
|
4533
|
+
* @return The provided T type
|
|
4534
|
+
*/
|
|
4535
|
+
queryIndexer<T>(args: {
|
|
4536
|
+
query: GraphqlQuery;
|
|
4537
|
+
}): Promise<T>;
|
|
4538
|
+
/**
|
|
4539
|
+
* Queries for the last successful indexer version
|
|
4540
|
+
*
|
|
4541
|
+
* This is useful to tell what ledger version the indexer is updated to, as it can be behind the full nodes.
|
|
4542
|
+
*/
|
|
4543
|
+
getIndexerLastSuccessVersion(): Promise<number>;
|
|
4544
|
+
}
|
|
4545
|
+
|
|
4546
|
+
/**
|
|
4547
|
+
* A class to query all `Staking` related queries on Aptos.
|
|
4548
|
+
*/
|
|
4549
|
+
declare class Staking {
|
|
4550
|
+
readonly config: AptosConfig;
|
|
4551
|
+
constructor(config: AptosConfig);
|
|
4552
|
+
/**
|
|
4553
|
+
* Queries current number of delegators in a pool. Throws an error if the pool is not found.
|
|
4554
|
+
*
|
|
4555
|
+
* @param args.poolAddress Pool address
|
|
4556
|
+
* @returns The number of delegators for the given pool
|
|
4557
|
+
*/
|
|
4558
|
+
getNumberOfDelegators(args: {
|
|
4559
|
+
poolAddress: HexInput;
|
|
4560
|
+
}): Promise<number>;
|
|
4561
|
+
/**
|
|
4562
|
+
* Queries current number of delegators in a pool. Throws an error if the pool is not found.
|
|
4563
|
+
*
|
|
4564
|
+
* @returns GetNumberOfDelegatorsForAllPoolsResponse response type
|
|
4565
|
+
*/
|
|
4566
|
+
getNumberOfDelegatorsForAllPools(args?: {
|
|
4567
|
+
options?: {
|
|
4568
|
+
orderBy?: OrderBy<GetNumberOfDelegatorsResponse[0]>;
|
|
4569
|
+
};
|
|
4570
|
+
}): Promise<GetNumberOfDelegatorsResponse>;
|
|
4571
|
+
/**
|
|
4572
|
+
* Queries delegated staking activities
|
|
4573
|
+
*
|
|
4574
|
+
* @param args.delegatorAddress Delegator address
|
|
4575
|
+
* @param args.poolAddress Pool address
|
|
4576
|
+
* @returns GetDelegatedStakingActivitiesResponse response type
|
|
4577
|
+
*/
|
|
4578
|
+
getDelegatedStakingActivities(args: {
|
|
4579
|
+
delegatorAddress: HexInput;
|
|
4580
|
+
poolAddress: HexInput;
|
|
4581
|
+
}): Promise<GetDelegatedStakingActivitiesResponse>;
|
|
4582
|
+
}
|
|
4583
|
+
|
|
4584
|
+
declare class Transaction {
|
|
4585
|
+
readonly config: AptosConfig;
|
|
4586
|
+
constructor(config: AptosConfig);
|
|
4587
|
+
/**
|
|
4588
|
+
* Queries on-chain transactions. This function will not return pending
|
|
4589
|
+
* transactions. For that, use `getTransactionsByHash`.
|
|
4590
|
+
*
|
|
4591
|
+
* @param args.options.offset The number transaction to start with
|
|
4592
|
+
* @param args.options.limit Number of results to return
|
|
4593
|
+
*
|
|
4594
|
+
* @returns Array of on-chain transactions
|
|
4595
|
+
*/
|
|
4596
|
+
getTransactions(args?: {
|
|
4597
|
+
options?: PaginationArgs;
|
|
4598
|
+
}): Promise<TransactionResponse[]>;
|
|
4599
|
+
/**
|
|
4600
|
+
* Queries on-chain transaction by version. This function will not return pending transactions.
|
|
4601
|
+
*
|
|
4602
|
+
* @param args.ledgerVersion - Transaction version is an unsigned 64-bit number.
|
|
4603
|
+
* @returns On-chain transaction. Only on-chain transactions have versions, so this
|
|
4604
|
+
* function cannot be used to query pending transactions.
|
|
4605
|
+
*/
|
|
4606
|
+
getTransactionByVersion(args: {
|
|
4607
|
+
ledgerVersion: AnyNumber;
|
|
4608
|
+
}): Promise<TransactionResponse>;
|
|
4609
|
+
/**
|
|
4610
|
+
* Queries on-chain transaction by transaction hash. This function will return pending transactions.
|
|
4611
|
+
* @param args.transactionHash - Transaction hash should be hex-encoded bytes string with 0x prefix.
|
|
4612
|
+
* @returns Transaction from mempool (pending) or on-chain (committed) transaction
|
|
4613
|
+
*/
|
|
4614
|
+
getTransactionByHash(args: {
|
|
4615
|
+
transactionHash: HexInput;
|
|
4616
|
+
}): Promise<TransactionResponse>;
|
|
4617
|
+
/**
|
|
4618
|
+
* Defines if specified transaction is currently in pending state
|
|
4619
|
+
*
|
|
4620
|
+
* To create a transaction hash:
|
|
4621
|
+
*
|
|
4622
|
+
* 1. Create a hash message from the bytes: "Aptos::Transaction" bytes + the BCS-serialized Transaction bytes.
|
|
4623
|
+
* 2. Apply hash algorithm SHA3-256 to the hash message bytes.
|
|
4624
|
+
* 3. Hex-encode the hash bytes with 0x prefix.
|
|
4625
|
+
*
|
|
4626
|
+
* @param args.transactionHash A hash of transaction
|
|
4627
|
+
* @returns `true` if transaction is in pending state and `false` otherwise
|
|
4628
|
+
*/
|
|
4629
|
+
isPendingTransaction(args: {
|
|
4630
|
+
transactionHash: HexInput;
|
|
4631
|
+
}): Promise<boolean>;
|
|
4632
|
+
/**
|
|
4633
|
+
* Waits for a transaction to move past the pending state.
|
|
4634
|
+
*
|
|
4635
|
+
* There are 4 cases.
|
|
4636
|
+
* 1. Transaction is successfully processed and committed to the chain.
|
|
4637
|
+
* - The function will resolve with the transaction response from the API.
|
|
4638
|
+
* 2. Transaction is rejected for some reason, and is therefore not committed to the blockchain.
|
|
4639
|
+
* - The function will throw an AptosApiError with an HTTP status code indicating some problem with the request.
|
|
4640
|
+
* 3. Transaction is committed but execution failed, meaning no changes were
|
|
4641
|
+
* written to the blockchain state.
|
|
4642
|
+
* - If `checkSuccess` is true, the function will throw a FailedTransactionError
|
|
4643
|
+
* If `checkSuccess` is false, the function will resolve with the transaction response where the `success` field is false.
|
|
4644
|
+
* 4. Transaction does not move past the pending state within `args.options.timeoutSecs` seconds.
|
|
4645
|
+
* - The function will throw a WaitForTransactionError
|
|
4646
|
+
*
|
|
4647
|
+
*
|
|
4648
|
+
* @param args.transactionHash The hash of a transaction previously submitted to the blockchain.
|
|
4649
|
+
* @param args.options.timeoutSecs Timeout in seconds. Defaults to 20 seconds.
|
|
4650
|
+
* @param args.options.checkSuccess A boolean which controls whether the function will error if the transaction failed.
|
|
4651
|
+
* Defaults to true. See case 3 above.
|
|
4652
|
+
* @returns The transaction on-chain. See above for more details.
|
|
4653
|
+
*/
|
|
4654
|
+
waitForTransaction(args: {
|
|
4655
|
+
transactionHash: HexInput;
|
|
4656
|
+
options?: {
|
|
4657
|
+
timeoutSecs?: number;
|
|
4658
|
+
checkSuccess?: boolean;
|
|
4659
|
+
};
|
|
4660
|
+
}): Promise<TransactionResponse>;
|
|
4661
|
+
/**
|
|
4662
|
+
* Gives an estimate of the gas unit price required to get a
|
|
4663
|
+
* transaction on chain in a reasonable amount of time.
|
|
4664
|
+
* For more information {@link https://fullnode.mainnet.aptoslabs.com/v1/spec#/operations/estimate_gas_price}
|
|
4665
|
+
*
|
|
4666
|
+
* @returns Object holding the outputs of the estimate gas API
|
|
4667
|
+
* @example
|
|
4668
|
+
* ```
|
|
4669
|
+
* {
|
|
4670
|
+
* gas_estimate: number;
|
|
4671
|
+
* deprioritized_gas_estimate?: number;
|
|
4672
|
+
* prioritized_gas_estimate?: number;
|
|
4673
|
+
* }
|
|
4674
|
+
* ```
|
|
4675
|
+
*/
|
|
4676
|
+
getGasPriceEstimation(): Promise<GasEstimation>;
|
|
4677
|
+
}
|
|
4678
|
+
|
|
4679
|
+
declare abstract class AccountAuthenticator extends Serializable {
|
|
4680
|
+
abstract serialize(serializer: Serializer): void;
|
|
4681
|
+
static deserialize(deserializer: Deserializer): AccountAuthenticator;
|
|
4682
|
+
}
|
|
4683
|
+
|
|
4684
|
+
declare class TransactionSubmission {
|
|
4685
|
+
readonly config: AptosConfig;
|
|
4686
|
+
constructor(config: AptosConfig);
|
|
4687
|
+
/**
|
|
4688
|
+
* We are defining function signatures, each with its specific input and output.
|
|
4689
|
+
* These are the possible function signature for `generateTransaction` function.
|
|
4690
|
+
* When we call `generateTransaction` function with the relevant type properties,
|
|
4691
|
+
* Typescript can infer the return type based on the appropriate function overload.
|
|
4692
|
+
*/
|
|
4693
|
+
generateTransaction(args: GenerateSingleSignerRawTransactionInput): Promise<SingleSignerTransaction>;
|
|
4694
|
+
generateTransaction(args: GenerateFeePayerRawTransactionInput): Promise<FeePayerTransaction>;
|
|
4695
|
+
generateTransaction(args: GenerateMultiAgentRawTransactionInput): Promise<MultiAgentTransaction>;
|
|
4696
|
+
generateTransaction(args: GenerateTransactionInput): Promise<AnyRawTransaction>;
|
|
4697
|
+
/**
|
|
4698
|
+
* Sign a transaction that can later be submitted to chain
|
|
4699
|
+
*
|
|
4700
|
+
* @param args.signer The signer account to sign the transaction
|
|
4701
|
+
* @param args.transaction A raw transaction type (note that it holds the raw transaction as a bcs serialized data)
|
|
4702
|
+
* ```
|
|
4703
|
+
* {
|
|
4704
|
+
* rawTransaction: Uint8Array,
|
|
4705
|
+
* secondarySignerAddresses? : Array<AccountAddress>,
|
|
4706
|
+
* feePayerAddress?: AccountAddress
|
|
4707
|
+
* }
|
|
4708
|
+
* ```
|
|
4709
|
+
*
|
|
4710
|
+
* @return The signer AccountAuthenticator
|
|
4711
|
+
*/
|
|
4712
|
+
signTransaction(args: {
|
|
4713
|
+
signer: Account$1;
|
|
4714
|
+
transaction: AnyRawTransaction;
|
|
4715
|
+
}): AccountAuthenticator;
|
|
4716
|
+
/**
|
|
4717
|
+
* Simulates a transaction before singing it.
|
|
4718
|
+
*
|
|
4719
|
+
* @param args.signerPublicKey The signer public key
|
|
4720
|
+
* @param args.transaction The raw transaction to simulate
|
|
4721
|
+
* @param args.secondarySignersPublicKeys optional. For when the transaction is a multi signers transaction
|
|
4722
|
+
* @param args.feePayerPublicKey optional. For when the transaction is a fee payer (aka sponsored) transaction
|
|
4723
|
+
* @param args.options optional. A config to simulate the transaction with
|
|
4724
|
+
*/
|
|
4725
|
+
simulateTransaction(args: SimulateTransactionData): Promise<Array<UserTransactionResponse>>;
|
|
4726
|
+
/**
|
|
4727
|
+
* Submit transaction to chain
|
|
4728
|
+
*
|
|
4729
|
+
* @param args.transaction A aptos transaction type
|
|
4730
|
+
* @param args.senderAuthenticator The account authenticator of the transaction sender
|
|
4731
|
+
* @param args.secondarySignerAuthenticators optional. For when the transaction is a multi signers transaction
|
|
4732
|
+
*
|
|
4733
|
+
* @return PendingTransactionResponse
|
|
4734
|
+
*/
|
|
4735
|
+
submitTransaction(args: {
|
|
4736
|
+
transaction: AnyRawTransaction;
|
|
4737
|
+
senderAuthenticator: AccountAuthenticator;
|
|
4738
|
+
secondarySignerAuthenticators?: {
|
|
4739
|
+
feePayerAuthenticator?: AccountAuthenticator;
|
|
4740
|
+
additionalSignersAuthenticators?: Array<AccountAuthenticator>;
|
|
4741
|
+
};
|
|
4742
|
+
}): Promise<PendingTransactionResponse>;
|
|
4743
|
+
/**
|
|
4744
|
+
* Sign and submit a single signer transaction to chain
|
|
4745
|
+
*
|
|
4746
|
+
* @param args.signer The signer account to sign the transaction
|
|
4747
|
+
* @param args.transaction A raw transaction type (note that it holds the raw transaction as a bcs serialized data)
|
|
4748
|
+
* ```
|
|
4749
|
+
* {
|
|
4750
|
+
* rawTransaction: Uint8Array,
|
|
4751
|
+
* secondarySignerAddresses? : Array<AccountAddress>,
|
|
4752
|
+
* feePayerAddress?: AccountAddress
|
|
4753
|
+
* }
|
|
4754
|
+
* ```
|
|
4755
|
+
*
|
|
4756
|
+
* @return PendingTransactionResponse
|
|
4757
|
+
*/
|
|
4758
|
+
signAndSubmitTransaction(args: {
|
|
4759
|
+
signer: Account$1;
|
|
4760
|
+
transaction: AnyRawTransaction;
|
|
4761
|
+
}): Promise<PendingTransactionResponse>;
|
|
4762
|
+
}
|
|
4763
|
+
|
|
4764
|
+
/**
|
|
4765
|
+
* This class is the main entry point into Aptos's
|
|
4766
|
+
* APIs and separates functionality into different namespaces.
|
|
4767
|
+
*
|
|
4768
|
+
* To use the SDK, create a new Aptos instance to get access
|
|
4769
|
+
* to all the sdk functionality.
|
|
4770
|
+
*/
|
|
4771
|
+
declare class Aptos {
|
|
4772
|
+
readonly config: AptosConfig;
|
|
4773
|
+
readonly account: Account;
|
|
4774
|
+
readonly coin: Coin;
|
|
4775
|
+
readonly digitalAsset: DigitalAsset;
|
|
4776
|
+
readonly event: Event;
|
|
4777
|
+
readonly faucet: Faucet;
|
|
4778
|
+
readonly fungibleAsset: FungibleAsset;
|
|
4779
|
+
readonly general: General;
|
|
4780
|
+
readonly staking: Staking;
|
|
4781
|
+
readonly transaction: Transaction;
|
|
4782
|
+
readonly transactionSubmission: TransactionSubmission;
|
|
4783
|
+
constructor(settings?: AptosConfig);
|
|
4784
|
+
}
|
|
4785
|
+
interface Aptos extends Account, Coin, DigitalAsset, Event, Faucet, FungibleAsset, General, Staking, Transaction, TransactionSubmission {
|
|
4786
|
+
}
|
|
4787
|
+
|
|
4788
|
+
/**
|
|
4789
|
+
* The API response type
|
|
4790
|
+
*
|
|
4791
|
+
* @param status - the response status. i.e. 200
|
|
4792
|
+
* @param statusText - the response message
|
|
4793
|
+
* @param data the response data
|
|
4794
|
+
* @param url the url the request was made to
|
|
4795
|
+
* @param headers the response headers
|
|
4796
|
+
* @param config (optional) - the request object
|
|
4797
|
+
* @param request (optional) - the request object
|
|
4798
|
+
*/
|
|
4799
|
+
interface AptosResponse<Req, Res> {
|
|
4800
|
+
status: number;
|
|
4801
|
+
statusText: string;
|
|
4802
|
+
data: Res;
|
|
4803
|
+
url: string;
|
|
4804
|
+
headers: any;
|
|
4805
|
+
config?: any;
|
|
4806
|
+
request?: Req;
|
|
4807
|
+
}
|
|
4808
|
+
/**
|
|
4809
|
+
* The type returned from an API error
|
|
4810
|
+
*
|
|
4811
|
+
* @param name - the error name "AptosApiError"
|
|
4812
|
+
* @param url the url the request was made to
|
|
4813
|
+
* @param status - the response status. i.e. 400
|
|
4814
|
+
* @param statusText - the response message
|
|
4815
|
+
* @param data the response data
|
|
4816
|
+
* @param request - the AptosRequest
|
|
4817
|
+
*/
|
|
4818
|
+
declare class AptosApiError extends Error {
|
|
4819
|
+
readonly url: string;
|
|
4820
|
+
readonly status: number;
|
|
4821
|
+
readonly statusText: string;
|
|
4822
|
+
readonly data: any;
|
|
4823
|
+
readonly request: AptosRequest;
|
|
4824
|
+
constructor(request: AptosRequest, response: AptosResponse<any, any>, message: string);
|
|
4825
|
+
}
|
|
4826
|
+
|
|
4827
|
+
/**
|
|
4828
|
+
* The main function to use when doing an API request.
|
|
4829
|
+
*
|
|
4830
|
+
* @param options AptosRequest
|
|
4831
|
+
* @param aptosConfig The config information for the SDK client instance
|
|
4832
|
+
* @returns the response or AptosApiError
|
|
4833
|
+
*/
|
|
4834
|
+
declare function aptosRequest<Req, Res>(options: AptosRequest, aptosConfig: AptosConfig): Promise<AptosResponse<Req, Res>>;
|
|
4835
|
+
|
|
4836
|
+
declare type GetRequestOptions = {
|
|
4837
|
+
/**
|
|
4838
|
+
* The config for the API client
|
|
4839
|
+
*/
|
|
4840
|
+
aptosConfig: AptosConfig;
|
|
4841
|
+
/**
|
|
4842
|
+
* The type of API endpoint to call e.g. fullnode, indexer, etc
|
|
4843
|
+
*/
|
|
4844
|
+
type: AptosApiType;
|
|
4845
|
+
/**
|
|
4846
|
+
* The name of the API method
|
|
4847
|
+
*/
|
|
4848
|
+
originMethod: string;
|
|
4849
|
+
/**
|
|
4850
|
+
* The URL path to the API method
|
|
4851
|
+
*/
|
|
4852
|
+
path: string;
|
|
4853
|
+
/**
|
|
4854
|
+
* The content type of the request body
|
|
4855
|
+
*/
|
|
4856
|
+
contentType?: MimeType;
|
|
4857
|
+
/**
|
|
4858
|
+
* The accepted content type of the response of the API
|
|
4859
|
+
*/
|
|
4860
|
+
acceptType?: MimeType;
|
|
4861
|
+
/**
|
|
4862
|
+
* The query parameters for the request
|
|
4863
|
+
*/
|
|
4864
|
+
params?: Record<string, string | AnyNumber | boolean | undefined>;
|
|
4865
|
+
/**
|
|
4866
|
+
* Specific client overrides for this request to override aptosConfig
|
|
4867
|
+
*/
|
|
4868
|
+
overrides?: ClientConfig;
|
|
4869
|
+
};
|
|
4870
|
+
declare type GetAptosRequestOptions = Omit<GetRequestOptions, "type">;
|
|
4871
|
+
/**
|
|
4872
|
+
* Main function to do a Get request
|
|
4873
|
+
*
|
|
4874
|
+
* @param options GetRequestOptions
|
|
4875
|
+
* @returns
|
|
4876
|
+
*/
|
|
4877
|
+
declare function get<Req, Res>(options: GetRequestOptions): Promise<AptosResponse<Req, Res>>;
|
|
4878
|
+
declare function getAptosFullNode<Req, Res>(options: GetAptosRequestOptions): Promise<AptosResponse<Req, Res>>;
|
|
4879
|
+
declare function paginateWithCursor<Req extends Record<string, any>, Res extends any[]>(options: GetAptosRequestOptions): Promise<Res>;
|
|
4880
|
+
|
|
4881
|
+
declare type PostRequestOptions = {
|
|
4882
|
+
/**
|
|
4883
|
+
* The config for the API client
|
|
4884
|
+
*/
|
|
4885
|
+
aptosConfig: AptosConfig;
|
|
4886
|
+
/**
|
|
4887
|
+
* The type of API endpoint to call e.g. fullnode, indexer, etc
|
|
4888
|
+
*/
|
|
4889
|
+
type: AptosApiType;
|
|
4890
|
+
/**
|
|
4891
|
+
* The name of the API method
|
|
4892
|
+
*/
|
|
4893
|
+
originMethod: string;
|
|
4894
|
+
/**
|
|
4895
|
+
* The URL path to the API method
|
|
4896
|
+
*/
|
|
4897
|
+
path: string;
|
|
4898
|
+
/**
|
|
4899
|
+
* The content type of the request body
|
|
4900
|
+
*/
|
|
4901
|
+
contentType?: MimeType;
|
|
4902
|
+
/**
|
|
4903
|
+
* The accepted content type of the response of the API
|
|
4904
|
+
*/
|
|
4905
|
+
acceptType?: MimeType;
|
|
4906
|
+
/**
|
|
4907
|
+
* The query parameters for the request
|
|
4908
|
+
*/
|
|
4909
|
+
params?: Record<string, string | AnyNumber | boolean | undefined>;
|
|
4910
|
+
/**
|
|
4911
|
+
* The body of the request, should match teh content type of the request
|
|
4912
|
+
*/
|
|
4913
|
+
body?: any;
|
|
4914
|
+
/**
|
|
4915
|
+
* Specific client overrides for this request to override aptosConfig
|
|
4916
|
+
*/
|
|
4917
|
+
overrides?: ClientConfig;
|
|
4918
|
+
};
|
|
4919
|
+
declare type PostAptosRequestOptions = Omit<PostRequestOptions, "type">;
|
|
4920
|
+
/**
|
|
4921
|
+
* Main function to do a Post request
|
|
4922
|
+
*
|
|
4923
|
+
* @param options PostRequestOptions
|
|
4924
|
+
* @returns
|
|
4925
|
+
*/
|
|
4926
|
+
declare function post<Req, Res>(options: PostRequestOptions): Promise<AptosResponse<Req, Res>>;
|
|
4927
|
+
declare function postAptosFullNode<Req, Res>(options: PostAptosRequestOptions): Promise<AptosResponse<Req, Res>>;
|
|
4928
|
+
declare function postAptosIndexer<Req, Res>(options: PostAptosRequestOptions): Promise<AptosResponse<Req, Res>>;
|
|
4929
|
+
declare function postAptosFaucet<Req, Res>(options: PostAptosRequestOptions): Promise<AptosResponse<Req, Res>>;
|
|
4930
|
+
|
|
4931
|
+
declare type DerivedKeys = {
|
|
4932
|
+
key: Uint8Array;
|
|
4933
|
+
chainCode: Uint8Array;
|
|
4934
|
+
};
|
|
4935
|
+
/**
|
|
4936
|
+
* Aptos derive path is 637
|
|
4937
|
+
*
|
|
4938
|
+
* See https://github.com/satoshilabs/slips/blob/master/slip-0044.md
|
|
4939
|
+
*/
|
|
4940
|
+
declare const APTOS_PATH_REGEX: RegExp;
|
|
4941
|
+
/**
|
|
4942
|
+
* A list of supported key types and associated seeds
|
|
4943
|
+
*/
|
|
4944
|
+
declare enum KeyType {
|
|
4945
|
+
ED25519 = "ed25519 seed"
|
|
4946
|
+
}
|
|
4947
|
+
/**
|
|
4948
|
+
* Checks if the BIP44 path is valid for Aptos
|
|
4949
|
+
* @param path the BIP44 path
|
|
4950
|
+
*
|
|
4951
|
+
* @returns true if the path is a valid Aptos path
|
|
4952
|
+
*/
|
|
4953
|
+
declare const isValidPath: (path: string) => boolean;
|
|
4954
|
+
/**
|
|
4955
|
+
* Derives a private key from a mnemonic seed phrase.
|
|
4956
|
+
*
|
|
4957
|
+
* To derive multiple keys from the same phrase, change the path
|
|
4958
|
+
* @param keyType the key type seed used to derive keys
|
|
4959
|
+
* @param path the BIP44 path
|
|
4960
|
+
* @param seedPhrase the mnemonic seed phrase
|
|
4961
|
+
* @param offset the offset used for key derivation, defaults to [HARDENED_OFFSET]
|
|
4962
|
+
*/
|
|
4963
|
+
declare const derivePrivateKeyFromMnemonic: (keyType: KeyType, path: string, seedPhrase: string, offset?: number) => DerivedKeys;
|
|
4964
|
+
|
|
4965
|
+
export { APTOS_PATH_REGEX, Account$1 as Account, AccountAddress, AccountAuthenticatorVariant, AccountData, AccountEd25519Signature, AccountMultiEd25519Signature, AccountSecp256k1Signature, AccountSignature, AddressInvalidReason, AnyNumber, AnyRawTransaction, AnyRawTransactionInstance, Aptos, AptosApiError, AptosConfig, AptosRequest, AptosResponse, AptosSettings, AuthenticationKey, AuthenticationKeyScheme, Block, BlockMetadataTransactionResponse, Bool, ClientConfig, DecodedTableData, DeletedTableData, DeriveScheme, DerivedKeys, Deserializable, Deserializer, DirectWriteSet, Ed25519PrivateKey, Ed25519PublicKey, Ed25519Signature, EntryFunctionArgumentTypes, EntryFunctionBytes, EntryFunctionData, EntryFunctionPayloadResponse, Event$1 as Event, EventGuid, FeePayerTransaction, FixedBytes, GasEstimation, GenerateFeePayerRawTransactionArgs, GenerateFeePayerRawTransactionInput, GenerateMultiAgentRawTransactionArgs, GenerateMultiAgentRawTransactionInput, GenerateRawTransactionArgs, GenerateSingleSignerRawTransactionArgs, GenerateSingleSignerRawTransactionInput, GenerateTransactionInput, GenerateTransactionOptions, GenerateTransactionPayloadData, GenesisPayload, GenesisTransactionResponse, GetAccountCoinsDataResponse, GetAccountCollectionsWithOwnedTokenResponse, GetAccountOwnedObjectsResponse, GetAccountOwnedTokensFromCollectionResponse, GetAccountOwnedTokensQueryResponse, GetAptosRequestOptions, GetChainTopUserTransactionsResponse, GetCollectionDataResponse, GetCurrentFungibleAssetBalancesResponse, GetCurrentTokenOwnershipResponse, GetDelegatedStakingActivitiesResponse, GetEventsResponse, GetFungibleAssetActivitiesResponse, GetFungibleAssetMetadataResponse, GetNumberOfDelegatorsResponse, GetOwnedTokensResponse, GetProcessorStatusResponse, GetRequestOptions, GetTokenActivityResponse, GetTokenDataResponse, GraphqlQuery, Hex, HexInput, HexInvalidReason, KeyType, LedgerInfo, LedgerVersion, MimeType, MoveAbility, MoveAddressType, MoveFunction, MoveFunctionGenericTypeParam, MoveFunctionVisibility, MoveModule, MoveModuleBytecode, MoveModuleId, MoveObject, MoveObjectType, MoveOption, MoveOptionType, MoveResource, MoveResourceType, MoveScriptBytecode, MoveString, MoveStruct, MoveStructField, MoveStructType, MoveType, MoveUint128Type, MoveUint16Type, MoveUint256Type, MoveUint32Type, MoveUint64Type, MoveUint8Type, MoveValue, MoveVector, MultiAgentTransaction, MultiEd25519PublicKey, MultiEd25519Signature, MultiSigData, MultisigPayloadResponse, Network, NetworkToChainId, NetworkToFaucetAPI, NetworkToIndexerAPI, NetworkToNodeAPI, OrderBy, OrderByValue, PaginationArgs, ParsingError, ParsingResult, PendingTransactionResponse, PostAptosRequestOptions, PostRequestOptions, PrivateKey, PublicKey, RoleType, ScriptData, ScriptFunctionArgumentTypes, ScriptPayloadResponse, ScriptTransactionArgumentVariants, ScriptWriteSet, Secp256k1PrivateKey, Secp256k1PublicKey, Secp256k1Signature, Serializable, Serializer, Signature, SigningScheme, SimulateTransactionData, SimulateTransactionOptions, SingleSignerTransaction, StateCheckpointTransactionResponse, StructTag, TableItemRequest, TokenStandard, TransactionAuthenticatorVariant, TransactionEd25519Signature, TransactionFeePayerSignature, TransactionMultiAgentSignature, TransactionMultiEd25519Signature, TransactionPayload, TransactionPayloadResponse, TransactionPayloadVariants, TransactionResponse, TransactionResponseType, TransactionSecp256k1Signature, TransactionSignature, TransactionVariants, TypeTag, TypeTagAddress, TypeTagBool, TypeTagParser, TypeTagParserError, TypeTagSigner, TypeTagStruct, TypeTagU128, TypeTagU16, TypeTagU256, TypeTagU32, TypeTagU64, TypeTagU8, TypeTagVariants, TypeTagVector, U128, U16, U256, U32, U64, U8, Uint128, Uint16, Uint256, Uint32, Uint64, Uint8, UserTransactionResponse, ViewRequest, ViewRequestData, WriteSet, WriteSetChange, WriteSetChangeDeleteModule, WriteSetChangeDeleteResource, WriteSetChangeDeleteTableItem, WriteSetChangeWriteModule, WriteSetChangeWriteResource, WriteSetChangeWriteTableItem, aptosRequest, derivePrivateKeyFromMnemonic, ensureBoolean, get, getAptosFullNode, isValidPath, objectStructTag, optionStructTag, outOfRangeErrorMessage, paginateWithCursor, post, postAptosFaucet, postAptosFullNode, postAptosIndexer, stringStructTag, validateNumberInRange };
|