@alephium/web3 1.7.3 → 1.8.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/dist/alephium-web3.min.js +1 -1
- package/dist/alephium-web3.min.js.map +1 -1
- package/dist/src/api/api-alephium.d.ts +181 -9
- package/dist/src/api/api-alephium.js +62 -2
- package/dist/src/api/api-explorer.d.ts +55 -0
- package/dist/src/api/api-explorer.js +28 -0
- package/dist/src/contract/contract.d.ts +3 -1
- package/dist/src/contract/contract.js +4 -2
- package/dist/src/signer/signer.d.ts +5 -2
- package/dist/src/signer/signer.js +14 -4
- package/dist/src/signer/tx-builder.d.ts +8 -1
- package/dist/src/signer/tx-builder.js +107 -23
- package/dist/src/signer/types.d.ts +20 -0
- package/dist/src/utils/utils.d.ts +3 -0
- package/package.json +3 -3
- package/src/api/api-alephium.ts +247 -10
- package/src/api/api-explorer.ts +79 -0
- package/src/contract/contract.ts +5 -2
- package/src/signer/signer.ts +24 -10
- package/src/signer/tx-builder.ts +141 -28
- package/src/signer/types.ts +22 -2
- package/src/utils/utils.ts +8 -0
|
@@ -41,22 +41,103 @@ class TransactionBuilder {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
async buildTransferTx(params, publicKey) {
|
|
44
|
+
const data = this.buildTransferTxParams(params, publicKey);
|
|
45
|
+
const response = await this.nodeProvider.transactions.postTransactionsBuild(data);
|
|
46
|
+
return this.convertTransferTxResult(response);
|
|
47
|
+
}
|
|
48
|
+
async buildDeployContractTx(params, publicKey) {
|
|
49
|
+
const data = this.buildDeployContractTxParams(params, publicKey);
|
|
50
|
+
const response = await this.nodeProvider.contracts.postContractsUnsignedTxDeployContract(data);
|
|
51
|
+
return this.convertDeployContractTxResult(response);
|
|
52
|
+
}
|
|
53
|
+
async buildExecuteScriptTx(params, publicKey) {
|
|
54
|
+
const data = this.buildExecuteScriptTxParams(params, publicKey);
|
|
55
|
+
const response = await this.nodeProvider.contracts.postContractsUnsignedTxExecuteScript(data);
|
|
56
|
+
return this.convertExecuteScriptTxResult(response);
|
|
57
|
+
}
|
|
58
|
+
async buildChainedTx(params, publicKeys) {
|
|
59
|
+
if (params.length !== publicKeys.length) {
|
|
60
|
+
throw new Error('The number of build chained transaction parameters must match the number of public keys provided');
|
|
61
|
+
}
|
|
62
|
+
const data = params.map((param, index) => {
|
|
63
|
+
const paramType = param.type;
|
|
64
|
+
switch (paramType) {
|
|
65
|
+
case 'Transfer': {
|
|
66
|
+
const value = this.buildTransferTxParams(param, publicKeys[index]);
|
|
67
|
+
return { type: paramType, value };
|
|
68
|
+
}
|
|
69
|
+
case 'DeployContract': {
|
|
70
|
+
const value = this.buildDeployContractTxParams(param, publicKeys[index]);
|
|
71
|
+
return { type: paramType, value };
|
|
72
|
+
}
|
|
73
|
+
case 'ExecuteScript': {
|
|
74
|
+
const value = this.buildExecuteScriptTxParams(param, publicKeys[index]);
|
|
75
|
+
return { type: paramType, value };
|
|
76
|
+
}
|
|
77
|
+
default:
|
|
78
|
+
throw new Error(`Unsupported transaction type: ${paramType}`);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
const buildChainedTxsResponse = await this.nodeProvider.transactions.postTransactionsBuildChained(data);
|
|
82
|
+
const results = buildChainedTxsResponse.map((buildResult) => {
|
|
83
|
+
const buildResultType = buildResult.type;
|
|
84
|
+
switch (buildResultType) {
|
|
85
|
+
case 'Transfer': {
|
|
86
|
+
const buildTransferTxResult = buildResult.value;
|
|
87
|
+
return {
|
|
88
|
+
...this.convertTransferTxResult(buildTransferTxResult),
|
|
89
|
+
type: buildResultType
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
case 'DeployContract': {
|
|
93
|
+
const buildDeployContractTxResult = buildResult.value;
|
|
94
|
+
return {
|
|
95
|
+
...this.convertDeployContractTxResult(buildDeployContractTxResult),
|
|
96
|
+
type: buildResultType
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
case 'ExecuteScript': {
|
|
100
|
+
const buildExecuteScriptTxResult = buildResult.value;
|
|
101
|
+
return {
|
|
102
|
+
...this.convertExecuteScriptTxResult(buildExecuteScriptTxResult),
|
|
103
|
+
type: buildResultType
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
default:
|
|
107
|
+
throw new Error(`Unexpected transaction type: ${buildResultType} for ${buildResult.value.txId}`);
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
return results;
|
|
111
|
+
}
|
|
112
|
+
buildUnsignedTx(params) {
|
|
113
|
+
const unsignedTxBin = (0, utils_1.hexToBinUnsafe)(params.unsignedTx);
|
|
114
|
+
const decoded = codec_1.unsignedTxCodec.decode(unsignedTxBin);
|
|
115
|
+
const txId = (0, utils_1.binToHex)((0, hash_1.blakeHash)(unsignedTxBin));
|
|
116
|
+
const [fromGroup, toGroup] = (0, transaction_1.groupIndexOfTransaction)(decoded);
|
|
117
|
+
return {
|
|
118
|
+
fromGroup: fromGroup,
|
|
119
|
+
toGroup: toGroup,
|
|
120
|
+
unsignedTx: params.unsignedTx,
|
|
121
|
+
txId: txId,
|
|
122
|
+
gasAmount: decoded.gasAmount,
|
|
123
|
+
gasPrice: decoded.gasPrice
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
buildTransferTxParams(params, publicKey) {
|
|
44
127
|
TransactionBuilder.validatePublicKey(params, publicKey, params.signerKeyType);
|
|
45
128
|
const { destinations, gasPrice, ...rest } = params;
|
|
46
|
-
|
|
129
|
+
return {
|
|
47
130
|
fromPublicKey: publicKey,
|
|
48
131
|
fromPublicKeyType: params.signerKeyType,
|
|
49
132
|
destinations: (0, signer_1.toApiDestinations)(destinations),
|
|
50
133
|
gasPrice: (0, api_1.toApiNumber256Optional)(gasPrice),
|
|
51
134
|
...rest
|
|
52
135
|
};
|
|
53
|
-
const response = await this.nodeProvider.transactions.postTransactionsBuild(data);
|
|
54
|
-
return { ...response, gasPrice: (0, api_1.fromApiNumber256)(response.gasPrice) };
|
|
55
136
|
}
|
|
56
|
-
|
|
137
|
+
buildDeployContractTxParams(params, publicKey) {
|
|
57
138
|
TransactionBuilder.validatePublicKey(params, publicKey, params.signerKeyType);
|
|
58
139
|
const { initialAttoAlphAmount, initialTokenAmounts, issueTokenAmount, gasPrice, ...rest } = params;
|
|
59
|
-
|
|
140
|
+
return {
|
|
60
141
|
fromPublicKey: publicKey,
|
|
61
142
|
fromPublicKeyType: params.signerKeyType,
|
|
62
143
|
initialAttoAlphAmount: (0, api_1.toApiNumber256Optional)(initialAttoAlphAmount),
|
|
@@ -65,14 +146,11 @@ class TransactionBuilder {
|
|
|
65
146
|
gasPrice: (0, api_1.toApiNumber256Optional)(gasPrice),
|
|
66
147
|
...rest
|
|
67
148
|
};
|
|
68
|
-
const response = await this.nodeProvider.contracts.postContractsUnsignedTxDeployContract(data);
|
|
69
|
-
const contractId = (0, utils_1.binToHex)((0, address_1.contractIdFromAddress)(response.contractAddress));
|
|
70
|
-
return { ...response, groupIndex: response.fromGroup, contractId, gasPrice: (0, api_1.fromApiNumber256)(response.gasPrice) };
|
|
71
149
|
}
|
|
72
|
-
|
|
150
|
+
buildExecuteScriptTxParams(params, publicKey) {
|
|
73
151
|
TransactionBuilder.validatePublicKey(params, publicKey, params.signerKeyType);
|
|
74
152
|
const { attoAlphAmount, tokens, gasPrice, ...rest } = params;
|
|
75
|
-
|
|
153
|
+
return {
|
|
76
154
|
fromPublicKey: publicKey,
|
|
77
155
|
fromPublicKeyType: params.signerKeyType,
|
|
78
156
|
attoAlphAmount: (0, api_1.toApiNumber256Optional)(attoAlphAmount),
|
|
@@ -80,21 +158,27 @@ class TransactionBuilder {
|
|
|
80
158
|
gasPrice: (0, api_1.toApiNumber256Optional)(gasPrice),
|
|
81
159
|
...rest
|
|
82
160
|
};
|
|
83
|
-
const response = await this.nodeProvider.contracts.postContractsUnsignedTxExecuteScript(data);
|
|
84
|
-
return { ...response, groupIndex: response.fromGroup, gasPrice: (0, api_1.fromApiNumber256)(response.gasPrice) };
|
|
85
161
|
}
|
|
86
|
-
|
|
87
|
-
const unsignedTxBin = (0, utils_1.hexToBinUnsafe)(params.unsignedTx);
|
|
88
|
-
const decoded = codec_1.unsignedTxCodec.decode(unsignedTxBin);
|
|
89
|
-
const txId = (0, utils_1.binToHex)((0, hash_1.blakeHash)(unsignedTxBin));
|
|
90
|
-
const [fromGroup, toGroup] = (0, transaction_1.groupIndexOfTransaction)(decoded);
|
|
162
|
+
convertTransferTxResult(result) {
|
|
91
163
|
return {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
164
|
+
...result,
|
|
165
|
+
gasPrice: (0, api_1.fromApiNumber256)(result.gasPrice)
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
convertDeployContractTxResult(result) {
|
|
169
|
+
const contractId = (0, utils_1.binToHex)((0, address_1.contractIdFromAddress)(result.contractAddress));
|
|
170
|
+
return {
|
|
171
|
+
...result,
|
|
172
|
+
groupIndex: result.fromGroup,
|
|
173
|
+
contractId,
|
|
174
|
+
gasPrice: (0, api_1.fromApiNumber256)(result.gasPrice)
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
convertExecuteScriptTxResult(result) {
|
|
178
|
+
return {
|
|
179
|
+
...result,
|
|
180
|
+
groupIndex: result.fromGroup,
|
|
181
|
+
gasPrice: (0, api_1.fromApiNumber256)(result.gasPrice)
|
|
98
182
|
};
|
|
99
183
|
}
|
|
100
184
|
}
|
|
@@ -91,6 +91,26 @@ export interface SignUnsignedTxResult {
|
|
|
91
91
|
gasAmount: number;
|
|
92
92
|
gasPrice: Number256;
|
|
93
93
|
}
|
|
94
|
+
export type SignTransferChainedTxParams = SignTransferTxParams & {
|
|
95
|
+
type: 'Transfer';
|
|
96
|
+
};
|
|
97
|
+
export type SignDeployContractChainedTxParams = SignDeployContractTxParams & {
|
|
98
|
+
type: 'DeployContract';
|
|
99
|
+
};
|
|
100
|
+
export type SignExecuteScriptChainedTxParams = SignExecuteScriptTxParams & {
|
|
101
|
+
type: 'ExecuteScript';
|
|
102
|
+
};
|
|
103
|
+
export type SignChainedTxParams = SignTransferChainedTxParams | SignDeployContractChainedTxParams | SignExecuteScriptChainedTxParams;
|
|
104
|
+
export type SignTransferChainedTxResult = SignTransferTxResult & {
|
|
105
|
+
type: 'Transfer';
|
|
106
|
+
};
|
|
107
|
+
export type SignDeployContractChainedTxResult = SignDeployContractTxResult & {
|
|
108
|
+
type: 'DeployContract';
|
|
109
|
+
};
|
|
110
|
+
export type SignExecuteScriptChainedTxResult = SignExecuteScriptTxResult & {
|
|
111
|
+
type: 'ExecuteScript';
|
|
112
|
+
};
|
|
113
|
+
export type SignChainedTxResult = SignTransferChainedTxResult | SignDeployContractChainedTxResult | SignExecuteScriptChainedTxResult;
|
|
94
114
|
export type MessageHasher = 'alephium' | 'sha256' | 'blake2b' | 'identity';
|
|
95
115
|
export interface SignMessageParams {
|
|
96
116
|
signerAddress: string;
|
|
@@ -33,4 +33,7 @@ export type Eq<X, Y> = _Eq<{
|
|
|
33
33
|
}>;
|
|
34
34
|
export declare function assertType<T extends true>(): void;
|
|
35
35
|
export type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
|
|
36
|
+
export type Narrow<type> = (unknown extends type ? unknown : never) | (type extends Function ? type : never) | (type extends bigint | boolean | number | string ? type : never) | (type extends [] ? [] : never) | {
|
|
37
|
+
[K in keyof type]: Narrow<type[K]>;
|
|
38
|
+
};
|
|
36
39
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alephium/web3",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "A JS/TS library to interact with the Alephium platform",
|
|
5
5
|
"license": "GPL",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
},
|
|
34
34
|
"author": "Alephium dev <dev@alephium.org>",
|
|
35
35
|
"config": {
|
|
36
|
-
"alephium_version": "3.
|
|
37
|
-
"explorer_backend_version": "2.
|
|
36
|
+
"alephium_version": "3.8.1",
|
|
37
|
+
"explorer_backend_version": "2.2.3"
|
|
38
38
|
},
|
|
39
39
|
"type": "commonjs",
|
|
40
40
|
"dependencies": {
|
package/src/api/api-alephium.ts
CHANGED
|
@@ -189,6 +189,51 @@ export interface BrokerInfo {
|
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
+
/** BuildChainedDeployContractTx */
|
|
193
|
+
export interface BuildChainedDeployContractTx {
|
|
194
|
+
value: BuildDeployContractTx
|
|
195
|
+
type: string
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/** BuildChainedDeployContractTxResult */
|
|
199
|
+
export interface BuildChainedDeployContractTxResult {
|
|
200
|
+
value: BuildDeployContractTxResult
|
|
201
|
+
type: string
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/** BuildChainedExecuteScriptTx */
|
|
205
|
+
export interface BuildChainedExecuteScriptTx {
|
|
206
|
+
value: BuildExecuteScriptTx
|
|
207
|
+
type: string
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/** BuildChainedExecuteScriptTxResult */
|
|
211
|
+
export interface BuildChainedExecuteScriptTxResult {
|
|
212
|
+
value: BuildExecuteScriptTxResult
|
|
213
|
+
type: string
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/** BuildChainedTransferTx */
|
|
217
|
+
export interface BuildChainedTransferTx {
|
|
218
|
+
value: BuildTransferTx
|
|
219
|
+
type: string
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/** BuildChainedTransferTxResult */
|
|
223
|
+
export interface BuildChainedTransferTxResult {
|
|
224
|
+
value: BuildTransferTxResult
|
|
225
|
+
type: string
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/** BuildChainedTx */
|
|
229
|
+
export type BuildChainedTx = BuildChainedDeployContractTx | BuildChainedExecuteScriptTx | BuildChainedTransferTx
|
|
230
|
+
|
|
231
|
+
/** BuildChainedTxResult */
|
|
232
|
+
export type BuildChainedTxResult =
|
|
233
|
+
| BuildChainedDeployContractTxResult
|
|
234
|
+
| BuildChainedExecuteScriptTxResult
|
|
235
|
+
| BuildChainedTransferTxResult
|
|
236
|
+
|
|
192
237
|
/** BuildDeployContractTx */
|
|
193
238
|
export interface BuildDeployContractTx {
|
|
194
239
|
/** @format hex-string */
|
|
@@ -353,8 +398,8 @@ export interface BuildSweepMultisig {
|
|
|
353
398
|
targetBlockHash?: string
|
|
354
399
|
}
|
|
355
400
|
|
|
356
|
-
/**
|
|
357
|
-
export interface
|
|
401
|
+
/** BuildTransferTx */
|
|
402
|
+
export interface BuildTransferTx {
|
|
358
403
|
/** @format hex-string */
|
|
359
404
|
fromPublicKey: string
|
|
360
405
|
/** @format hex-string */
|
|
@@ -369,8 +414,8 @@ export interface BuildTransaction {
|
|
|
369
414
|
targetBlockHash?: string
|
|
370
415
|
}
|
|
371
416
|
|
|
372
|
-
/**
|
|
373
|
-
export interface
|
|
417
|
+
/** BuildTransferTxResult */
|
|
418
|
+
export interface BuildTransferTxResult {
|
|
374
419
|
unsignedTx: string
|
|
375
420
|
/** @format gas */
|
|
376
421
|
gasAmount: number
|
|
@@ -926,6 +971,97 @@ export interface RevealMnemonicResult {
|
|
|
926
971
|
mnemonic: string
|
|
927
972
|
}
|
|
928
973
|
|
|
974
|
+
/** RichAssetInput */
|
|
975
|
+
export interface RichAssetInput {
|
|
976
|
+
/** @format int32 */
|
|
977
|
+
hint: number
|
|
978
|
+
/** @format 32-byte-hash */
|
|
979
|
+
key: string
|
|
980
|
+
/** @format hex-string */
|
|
981
|
+
unlockScript: string
|
|
982
|
+
/** @format uint256 */
|
|
983
|
+
attoAlphAmount: string
|
|
984
|
+
/** @format address */
|
|
985
|
+
address: string
|
|
986
|
+
tokens: Token[]
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
/** RichBlockAndEvents */
|
|
990
|
+
export interface RichBlockAndEvents {
|
|
991
|
+
block: RichBlockEntry
|
|
992
|
+
events: ContractEventByBlockHash[]
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
/** RichBlockEntry */
|
|
996
|
+
export interface RichBlockEntry {
|
|
997
|
+
/** @format block-hash */
|
|
998
|
+
hash: string
|
|
999
|
+
/** @format int64 */
|
|
1000
|
+
timestamp: number
|
|
1001
|
+
/** @format int32 */
|
|
1002
|
+
chainFrom: number
|
|
1003
|
+
/** @format int32 */
|
|
1004
|
+
chainTo: number
|
|
1005
|
+
/** @format int32 */
|
|
1006
|
+
height: number
|
|
1007
|
+
deps: string[]
|
|
1008
|
+
transactions: RichTransaction[]
|
|
1009
|
+
/** @format hex-string */
|
|
1010
|
+
nonce: string
|
|
1011
|
+
version: number
|
|
1012
|
+
/** @format 32-byte-hash */
|
|
1013
|
+
depStateHash: string
|
|
1014
|
+
/** @format 32-byte-hash */
|
|
1015
|
+
txsHash: string
|
|
1016
|
+
/** @format hex-string */
|
|
1017
|
+
target: string
|
|
1018
|
+
ghostUncles: GhostUncleBlockEntry[]
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
/** RichBlocksAndEventsPerTimeStampRange */
|
|
1022
|
+
export interface RichBlocksAndEventsPerTimeStampRange {
|
|
1023
|
+
blocksAndEvents: RichBlockAndEvents[][]
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
/** RichContractInput */
|
|
1027
|
+
export interface RichContractInput {
|
|
1028
|
+
/** @format int32 */
|
|
1029
|
+
hint: number
|
|
1030
|
+
/** @format 32-byte-hash */
|
|
1031
|
+
key: string
|
|
1032
|
+
/** @format uint256 */
|
|
1033
|
+
attoAlphAmount: string
|
|
1034
|
+
/** @format address */
|
|
1035
|
+
address: string
|
|
1036
|
+
tokens: Token[]
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
/** RichTransaction */
|
|
1040
|
+
export interface RichTransaction {
|
|
1041
|
+
unsigned: RichUnsignedTx
|
|
1042
|
+
scriptExecutionOk: boolean
|
|
1043
|
+
contractInputs: RichContractInput[]
|
|
1044
|
+
generatedOutputs: Output[]
|
|
1045
|
+
inputSignatures: string[]
|
|
1046
|
+
scriptSignatures: string[]
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
/** RichUnsignedTx */
|
|
1050
|
+
export interface RichUnsignedTx {
|
|
1051
|
+
/** @format 32-byte-hash */
|
|
1052
|
+
txId: string
|
|
1053
|
+
version: number
|
|
1054
|
+
networkId: number
|
|
1055
|
+
/** @format script */
|
|
1056
|
+
scriptOpt?: string
|
|
1057
|
+
/** @format int32 */
|
|
1058
|
+
gasAmount: number
|
|
1059
|
+
/** @format uint256 */
|
|
1060
|
+
gasPrice: string
|
|
1061
|
+
inputs: RichAssetInput[]
|
|
1062
|
+
fixedOutputs: FixedAssetOutput[]
|
|
1063
|
+
}
|
|
1064
|
+
|
|
929
1065
|
/** Script */
|
|
930
1066
|
export interface Script {
|
|
931
1067
|
code: string
|
|
@@ -1113,6 +1249,8 @@ export interface TransactionTemplate {
|
|
|
1113
1249
|
unsigned: UnsignedTx
|
|
1114
1250
|
inputSignatures: string[]
|
|
1115
1251
|
scriptSignatures: string[]
|
|
1252
|
+
/** @format int64 */
|
|
1253
|
+
seenAt: number
|
|
1116
1254
|
}
|
|
1117
1255
|
|
|
1118
1256
|
/** Transfer */
|
|
@@ -1512,7 +1650,7 @@ export class HttpClient<SecurityDataType = unknown> {
|
|
|
1512
1650
|
|
|
1513
1651
|
/**
|
|
1514
1652
|
* @title Alephium API
|
|
1515
|
-
* @version 3.
|
|
1653
|
+
* @version 3.8.1
|
|
1516
1654
|
* @baseUrl ../
|
|
1517
1655
|
*/
|
|
1518
1656
|
export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> {
|
|
@@ -2169,6 +2307,40 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
|
|
|
2169
2307
|
...params
|
|
2170
2308
|
}).then(convertHttpResponse),
|
|
2171
2309
|
|
|
2310
|
+
/**
|
|
2311
|
+
* No description
|
|
2312
|
+
*
|
|
2313
|
+
* @tags Blockflow
|
|
2314
|
+
* @name GetBlockflowRichBlocks
|
|
2315
|
+
* @summary Given a time interval, list blocks containing events and transactions with enriched input information when node indexes are enabled.
|
|
2316
|
+
* @request GET:/blockflow/rich-blocks
|
|
2317
|
+
*/
|
|
2318
|
+
getBlockflowRichBlocks: (
|
|
2319
|
+
query: {
|
|
2320
|
+
/**
|
|
2321
|
+
* @format int64
|
|
2322
|
+
* @min 0
|
|
2323
|
+
*/
|
|
2324
|
+
fromTs: number
|
|
2325
|
+
/**
|
|
2326
|
+
* @format int64
|
|
2327
|
+
* @min 0
|
|
2328
|
+
*/
|
|
2329
|
+
toTs?: number
|
|
2330
|
+
},
|
|
2331
|
+
params: RequestParams = {}
|
|
2332
|
+
) =>
|
|
2333
|
+
this.request<
|
|
2334
|
+
RichBlocksAndEventsPerTimeStampRange,
|
|
2335
|
+
BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable
|
|
2336
|
+
>({
|
|
2337
|
+
path: `/blockflow/rich-blocks`,
|
|
2338
|
+
method: 'GET',
|
|
2339
|
+
query: query,
|
|
2340
|
+
format: 'json',
|
|
2341
|
+
...params
|
|
2342
|
+
}).then(convertHttpResponse),
|
|
2343
|
+
|
|
2172
2344
|
/**
|
|
2173
2345
|
* No description
|
|
2174
2346
|
*
|
|
@@ -2217,6 +2389,24 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
|
|
|
2217
2389
|
...params
|
|
2218
2390
|
}).then(convertHttpResponse),
|
|
2219
2391
|
|
|
2392
|
+
/**
|
|
2393
|
+
* No description
|
|
2394
|
+
*
|
|
2395
|
+
* @tags Blockflow
|
|
2396
|
+
* @name GetBlockflowRichBlocksBlockHash
|
|
2397
|
+
* @summary Get a block containing events and transactions with enriched input information when node indexes are enabled.
|
|
2398
|
+
* @request GET:/blockflow/rich-blocks/{block_hash}
|
|
2399
|
+
*/
|
|
2400
|
+
getBlockflowRichBlocksBlockHash: (blockHash: string, params: RequestParams = {}) =>
|
|
2401
|
+
this.request<RichBlockAndEvents, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>(
|
|
2402
|
+
{
|
|
2403
|
+
path: `/blockflow/rich-blocks/${blockHash}`,
|
|
2404
|
+
method: 'GET',
|
|
2405
|
+
format: 'json',
|
|
2406
|
+
...params
|
|
2407
|
+
}
|
|
2408
|
+
).then(convertHttpResponse),
|
|
2409
|
+
|
|
2220
2410
|
/**
|
|
2221
2411
|
* No description
|
|
2222
2412
|
*
|
|
@@ -2386,12 +2576,12 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
|
|
|
2386
2576
|
*
|
|
2387
2577
|
* @tags Transactions
|
|
2388
2578
|
* @name PostTransactionsBuild
|
|
2389
|
-
* @summary Build an unsigned transaction to a number of recipients
|
|
2579
|
+
* @summary Build an unsigned transfer transaction to a number of recipients
|
|
2390
2580
|
* @request POST:/transactions/build
|
|
2391
2581
|
*/
|
|
2392
|
-
postTransactionsBuild: (data:
|
|
2582
|
+
postTransactionsBuild: (data: BuildTransferTx, params: RequestParams = {}) =>
|
|
2393
2583
|
this.request<
|
|
2394
|
-
|
|
2584
|
+
BuildTransferTxResult,
|
|
2395
2585
|
BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable
|
|
2396
2586
|
>({
|
|
2397
2587
|
path: `/transactions/build`,
|
|
@@ -2412,7 +2602,7 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
|
|
|
2412
2602
|
*/
|
|
2413
2603
|
postTransactionsBuildMultiAddresses: (data: BuildMultiAddressesTransaction, params: RequestParams = {}) =>
|
|
2414
2604
|
this.request<
|
|
2415
|
-
|
|
2605
|
+
BuildTransferTxResult,
|
|
2416
2606
|
BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable
|
|
2417
2607
|
>({
|
|
2418
2608
|
path: `/transactions/build-multi-addresses`,
|
|
@@ -2509,6 +2699,32 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
|
|
|
2509
2699
|
...params
|
|
2510
2700
|
}).then(convertHttpResponse),
|
|
2511
2701
|
|
|
2702
|
+
/**
|
|
2703
|
+
* No description
|
|
2704
|
+
*
|
|
2705
|
+
* @tags Transactions
|
|
2706
|
+
* @name GetTransactionsRichDetailsTxid
|
|
2707
|
+
* @summary Get transaction with enriched input information when node indexes are enabled.
|
|
2708
|
+
* @request GET:/transactions/rich-details/{txId}
|
|
2709
|
+
*/
|
|
2710
|
+
getTransactionsRichDetailsTxid: (
|
|
2711
|
+
txId: string,
|
|
2712
|
+
query?: {
|
|
2713
|
+
/** @format int32 */
|
|
2714
|
+
fromGroup?: number
|
|
2715
|
+
/** @format int32 */
|
|
2716
|
+
toGroup?: number
|
|
2717
|
+
},
|
|
2718
|
+
params: RequestParams = {}
|
|
2719
|
+
) =>
|
|
2720
|
+
this.request<RichTransaction, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
|
|
2721
|
+
path: `/transactions/rich-details/${txId}`,
|
|
2722
|
+
method: 'GET',
|
|
2723
|
+
query: query,
|
|
2724
|
+
format: 'json',
|
|
2725
|
+
...params
|
|
2726
|
+
}).then(convertHttpResponse),
|
|
2727
|
+
|
|
2512
2728
|
/**
|
|
2513
2729
|
* No description
|
|
2514
2730
|
*
|
|
@@ -2585,6 +2801,27 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
|
|
|
2585
2801
|
query: query,
|
|
2586
2802
|
format: 'json',
|
|
2587
2803
|
...params
|
|
2804
|
+
}).then(convertHttpResponse),
|
|
2805
|
+
|
|
2806
|
+
/**
|
|
2807
|
+
* No description
|
|
2808
|
+
*
|
|
2809
|
+
* @tags Transactions
|
|
2810
|
+
* @name PostTransactionsBuildChained
|
|
2811
|
+
* @summary Build a chain of transactions
|
|
2812
|
+
* @request POST:/transactions/build-chained
|
|
2813
|
+
*/
|
|
2814
|
+
postTransactionsBuildChained: (data: BuildChainedTx[], params: RequestParams = {}) =>
|
|
2815
|
+
this.request<
|
|
2816
|
+
BuildChainedTxResult[],
|
|
2817
|
+
BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable
|
|
2818
|
+
>({
|
|
2819
|
+
path: `/transactions/build-chained`,
|
|
2820
|
+
method: 'POST',
|
|
2821
|
+
body: data,
|
|
2822
|
+
type: ContentType.Json,
|
|
2823
|
+
format: 'json',
|
|
2824
|
+
...params
|
|
2588
2825
|
}).then(convertHttpResponse)
|
|
2589
2826
|
}
|
|
2590
2827
|
mempool = {
|
|
@@ -2952,7 +3189,7 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
|
|
|
2952
3189
|
*/
|
|
2953
3190
|
postMultisigBuild: (data: BuildMultisig, params: RequestParams = {}) =>
|
|
2954
3191
|
this.request<
|
|
2955
|
-
|
|
3192
|
+
BuildTransferTxResult,
|
|
2956
3193
|
BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable
|
|
2957
3194
|
>({
|
|
2958
3195
|
path: `/multisig/build`,
|
package/src/api/api-explorer.ts
CHANGED
|
@@ -190,6 +190,7 @@ export interface AssetOutput {
|
|
|
190
190
|
|
|
191
191
|
/** NFT */
|
|
192
192
|
export interface NFT {
|
|
193
|
+
id: string
|
|
193
194
|
type: string
|
|
194
195
|
}
|
|
195
196
|
|
|
@@ -217,6 +218,14 @@ export interface AcceptedTransaction {
|
|
|
217
218
|
timestamp: number
|
|
218
219
|
}
|
|
219
220
|
|
|
221
|
+
/** HolderInfo */
|
|
222
|
+
export interface HolderInfo {
|
|
223
|
+
/** @format address */
|
|
224
|
+
address: string
|
|
225
|
+
/** @format uint256 */
|
|
226
|
+
balance: string
|
|
227
|
+
}
|
|
228
|
+
|
|
220
229
|
/** TokenSupply */
|
|
221
230
|
export interface TokenSupply {
|
|
222
231
|
/** @format uint256 */
|
|
@@ -317,6 +326,8 @@ export enum TokenStdInterfaceId {
|
|
|
317
326
|
export interface ExplorerInfo {
|
|
318
327
|
releaseVersion: string
|
|
319
328
|
commit: string
|
|
329
|
+
/** @format int64 */
|
|
330
|
+
lastHoldersUpdate: number
|
|
320
331
|
/** @format int32 */
|
|
321
332
|
migrationsVersion: number
|
|
322
333
|
/** @format int64 */
|
|
@@ -367,6 +378,7 @@ export interface Transaction {
|
|
|
367
378
|
|
|
368
379
|
/** FungibleToken */
|
|
369
380
|
export interface FungibleToken {
|
|
381
|
+
id: string
|
|
370
382
|
type: string
|
|
371
383
|
}
|
|
372
384
|
|
|
@@ -1588,6 +1600,40 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
|
|
|
1588
1600
|
...params
|
|
1589
1601
|
}).then(convertHttpResponse),
|
|
1590
1602
|
|
|
1603
|
+
/**
|
|
1604
|
+
* @description Get a sorted list of top addresses by {token_id} balance. Updates once per day.
|
|
1605
|
+
*
|
|
1606
|
+
* @tags Tokens
|
|
1607
|
+
* @name GetTokensHoldersTokenTokenId
|
|
1608
|
+
* @request GET:/tokens/holders/token/{token_id}
|
|
1609
|
+
*/
|
|
1610
|
+
getTokensHoldersTokenTokenId: (
|
|
1611
|
+
tokenId: string,
|
|
1612
|
+
query?: {
|
|
1613
|
+
/**
|
|
1614
|
+
* Page number
|
|
1615
|
+
* @format int32
|
|
1616
|
+
* @min 1
|
|
1617
|
+
*/
|
|
1618
|
+
page?: number
|
|
1619
|
+
/**
|
|
1620
|
+
* Number of items per page
|
|
1621
|
+
* @format int32
|
|
1622
|
+
* @min 0
|
|
1623
|
+
* @max 100
|
|
1624
|
+
*/
|
|
1625
|
+
limit?: number
|
|
1626
|
+
},
|
|
1627
|
+
params: RequestParams = {}
|
|
1628
|
+
) =>
|
|
1629
|
+
this.request<HolderInfo[], BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
|
|
1630
|
+
path: `/tokens/holders/token/${tokenId}`,
|
|
1631
|
+
method: 'GET',
|
|
1632
|
+
query: query,
|
|
1633
|
+
format: 'json',
|
|
1634
|
+
...params
|
|
1635
|
+
}).then(convertHttpResponse),
|
|
1636
|
+
|
|
1591
1637
|
/**
|
|
1592
1638
|
* @description List token transactions
|
|
1593
1639
|
*
|
|
@@ -1676,6 +1722,39 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
|
|
|
1676
1722
|
...params
|
|
1677
1723
|
}).then(convertHttpResponse),
|
|
1678
1724
|
|
|
1725
|
+
/**
|
|
1726
|
+
* @description Get a sorted list of top addresses by ALPH balance. Updates once per day.
|
|
1727
|
+
*
|
|
1728
|
+
* @tags Tokens
|
|
1729
|
+
* @name GetTokensHoldersAlph
|
|
1730
|
+
* @request GET:/tokens/holders/alph
|
|
1731
|
+
*/
|
|
1732
|
+
getTokensHoldersAlph: (
|
|
1733
|
+
query?: {
|
|
1734
|
+
/**
|
|
1735
|
+
* Page number
|
|
1736
|
+
* @format int32
|
|
1737
|
+
* @min 1
|
|
1738
|
+
*/
|
|
1739
|
+
page?: number
|
|
1740
|
+
/**
|
|
1741
|
+
* Number of items per page
|
|
1742
|
+
* @format int32
|
|
1743
|
+
* @min 0
|
|
1744
|
+
* @max 100
|
|
1745
|
+
*/
|
|
1746
|
+
limit?: number
|
|
1747
|
+
},
|
|
1748
|
+
params: RequestParams = {}
|
|
1749
|
+
) =>
|
|
1750
|
+
this.request<HolderInfo[], BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
|
|
1751
|
+
path: `/tokens/holders/alph`,
|
|
1752
|
+
method: 'GET',
|
|
1753
|
+
query: query,
|
|
1754
|
+
format: 'json',
|
|
1755
|
+
...params
|
|
1756
|
+
}).then(convertHttpResponse),
|
|
1757
|
+
|
|
1679
1758
|
/**
|
|
1680
1759
|
* @description Return metadata for the given nft tokens, if metadata doesn't exist or token isn't a nft, it won't be in the output list
|
|
1681
1760
|
*
|