@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
|
@@ -161,6 +161,40 @@ export interface BrokerInfo {
|
|
|
161
161
|
port: number;
|
|
162
162
|
};
|
|
163
163
|
}
|
|
164
|
+
/** BuildChainedDeployContractTx */
|
|
165
|
+
export interface BuildChainedDeployContractTx {
|
|
166
|
+
value: BuildDeployContractTx;
|
|
167
|
+
type: string;
|
|
168
|
+
}
|
|
169
|
+
/** BuildChainedDeployContractTxResult */
|
|
170
|
+
export interface BuildChainedDeployContractTxResult {
|
|
171
|
+
value: BuildDeployContractTxResult;
|
|
172
|
+
type: string;
|
|
173
|
+
}
|
|
174
|
+
/** BuildChainedExecuteScriptTx */
|
|
175
|
+
export interface BuildChainedExecuteScriptTx {
|
|
176
|
+
value: BuildExecuteScriptTx;
|
|
177
|
+
type: string;
|
|
178
|
+
}
|
|
179
|
+
/** BuildChainedExecuteScriptTxResult */
|
|
180
|
+
export interface BuildChainedExecuteScriptTxResult {
|
|
181
|
+
value: BuildExecuteScriptTxResult;
|
|
182
|
+
type: string;
|
|
183
|
+
}
|
|
184
|
+
/** BuildChainedTransferTx */
|
|
185
|
+
export interface BuildChainedTransferTx {
|
|
186
|
+
value: BuildTransferTx;
|
|
187
|
+
type: string;
|
|
188
|
+
}
|
|
189
|
+
/** BuildChainedTransferTxResult */
|
|
190
|
+
export interface BuildChainedTransferTxResult {
|
|
191
|
+
value: BuildTransferTxResult;
|
|
192
|
+
type: string;
|
|
193
|
+
}
|
|
194
|
+
/** BuildChainedTx */
|
|
195
|
+
export type BuildChainedTx = BuildChainedDeployContractTx | BuildChainedExecuteScriptTx | BuildChainedTransferTx;
|
|
196
|
+
/** BuildChainedTxResult */
|
|
197
|
+
export type BuildChainedTxResult = BuildChainedDeployContractTxResult | BuildChainedExecuteScriptTxResult | BuildChainedTransferTxResult;
|
|
164
198
|
/** BuildDeployContractTx */
|
|
165
199
|
export interface BuildDeployContractTx {
|
|
166
200
|
/** @format hex-string */
|
|
@@ -313,8 +347,8 @@ export interface BuildSweepMultisig {
|
|
|
313
347
|
/** @format block-hash */
|
|
314
348
|
targetBlockHash?: string;
|
|
315
349
|
}
|
|
316
|
-
/**
|
|
317
|
-
export interface
|
|
350
|
+
/** BuildTransferTx */
|
|
351
|
+
export interface BuildTransferTx {
|
|
318
352
|
/** @format hex-string */
|
|
319
353
|
fromPublicKey: string;
|
|
320
354
|
/** @format hex-string */
|
|
@@ -328,8 +362,8 @@ export interface BuildTransaction {
|
|
|
328
362
|
/** @format block-hash */
|
|
329
363
|
targetBlockHash?: string;
|
|
330
364
|
}
|
|
331
|
-
/**
|
|
332
|
-
export interface
|
|
365
|
+
/** BuildTransferTxResult */
|
|
366
|
+
export interface BuildTransferTxResult {
|
|
333
367
|
unsignedTx: string;
|
|
334
368
|
/** @format gas */
|
|
335
369
|
gasAmount: number;
|
|
@@ -818,6 +852,90 @@ export interface RevealMnemonic {
|
|
|
818
852
|
export interface RevealMnemonicResult {
|
|
819
853
|
mnemonic: string;
|
|
820
854
|
}
|
|
855
|
+
/** RichAssetInput */
|
|
856
|
+
export interface RichAssetInput {
|
|
857
|
+
/** @format int32 */
|
|
858
|
+
hint: number;
|
|
859
|
+
/** @format 32-byte-hash */
|
|
860
|
+
key: string;
|
|
861
|
+
/** @format hex-string */
|
|
862
|
+
unlockScript: string;
|
|
863
|
+
/** @format uint256 */
|
|
864
|
+
attoAlphAmount: string;
|
|
865
|
+
/** @format address */
|
|
866
|
+
address: string;
|
|
867
|
+
tokens: Token[];
|
|
868
|
+
}
|
|
869
|
+
/** RichBlockAndEvents */
|
|
870
|
+
export interface RichBlockAndEvents {
|
|
871
|
+
block: RichBlockEntry;
|
|
872
|
+
events: ContractEventByBlockHash[];
|
|
873
|
+
}
|
|
874
|
+
/** RichBlockEntry */
|
|
875
|
+
export interface RichBlockEntry {
|
|
876
|
+
/** @format block-hash */
|
|
877
|
+
hash: string;
|
|
878
|
+
/** @format int64 */
|
|
879
|
+
timestamp: number;
|
|
880
|
+
/** @format int32 */
|
|
881
|
+
chainFrom: number;
|
|
882
|
+
/** @format int32 */
|
|
883
|
+
chainTo: number;
|
|
884
|
+
/** @format int32 */
|
|
885
|
+
height: number;
|
|
886
|
+
deps: string[];
|
|
887
|
+
transactions: RichTransaction[];
|
|
888
|
+
/** @format hex-string */
|
|
889
|
+
nonce: string;
|
|
890
|
+
version: number;
|
|
891
|
+
/** @format 32-byte-hash */
|
|
892
|
+
depStateHash: string;
|
|
893
|
+
/** @format 32-byte-hash */
|
|
894
|
+
txsHash: string;
|
|
895
|
+
/** @format hex-string */
|
|
896
|
+
target: string;
|
|
897
|
+
ghostUncles: GhostUncleBlockEntry[];
|
|
898
|
+
}
|
|
899
|
+
/** RichBlocksAndEventsPerTimeStampRange */
|
|
900
|
+
export interface RichBlocksAndEventsPerTimeStampRange {
|
|
901
|
+
blocksAndEvents: RichBlockAndEvents[][];
|
|
902
|
+
}
|
|
903
|
+
/** RichContractInput */
|
|
904
|
+
export interface RichContractInput {
|
|
905
|
+
/** @format int32 */
|
|
906
|
+
hint: number;
|
|
907
|
+
/** @format 32-byte-hash */
|
|
908
|
+
key: string;
|
|
909
|
+
/** @format uint256 */
|
|
910
|
+
attoAlphAmount: string;
|
|
911
|
+
/** @format address */
|
|
912
|
+
address: string;
|
|
913
|
+
tokens: Token[];
|
|
914
|
+
}
|
|
915
|
+
/** RichTransaction */
|
|
916
|
+
export interface RichTransaction {
|
|
917
|
+
unsigned: RichUnsignedTx;
|
|
918
|
+
scriptExecutionOk: boolean;
|
|
919
|
+
contractInputs: RichContractInput[];
|
|
920
|
+
generatedOutputs: Output[];
|
|
921
|
+
inputSignatures: string[];
|
|
922
|
+
scriptSignatures: string[];
|
|
923
|
+
}
|
|
924
|
+
/** RichUnsignedTx */
|
|
925
|
+
export interface RichUnsignedTx {
|
|
926
|
+
/** @format 32-byte-hash */
|
|
927
|
+
txId: string;
|
|
928
|
+
version: number;
|
|
929
|
+
networkId: number;
|
|
930
|
+
/** @format script */
|
|
931
|
+
scriptOpt?: string;
|
|
932
|
+
/** @format int32 */
|
|
933
|
+
gasAmount: number;
|
|
934
|
+
/** @format uint256 */
|
|
935
|
+
gasPrice: string;
|
|
936
|
+
inputs: RichAssetInput[];
|
|
937
|
+
fixedOutputs: FixedAssetOutput[];
|
|
938
|
+
}
|
|
821
939
|
/** Script */
|
|
822
940
|
export interface Script {
|
|
823
941
|
code: string;
|
|
@@ -986,6 +1104,8 @@ export interface TransactionTemplate {
|
|
|
986
1104
|
unsigned: UnsignedTx;
|
|
987
1105
|
inputSignatures: string[];
|
|
988
1106
|
scriptSignatures: string[];
|
|
1107
|
+
/** @format int64 */
|
|
1108
|
+
seenAt: number;
|
|
989
1109
|
}
|
|
990
1110
|
/** Transfer */
|
|
991
1111
|
export interface Transfer {
|
|
@@ -1205,7 +1325,7 @@ export declare class HttpClient<SecurityDataType = unknown> {
|
|
|
1205
1325
|
}
|
|
1206
1326
|
/**
|
|
1207
1327
|
* @title Alephium API
|
|
1208
|
-
* @version 3.
|
|
1328
|
+
* @version 3.8.1
|
|
1209
1329
|
* @baseUrl ../
|
|
1210
1330
|
*/
|
|
1211
1331
|
export declare class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> {
|
|
@@ -1562,6 +1682,26 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1562
1682
|
*/
|
|
1563
1683
|
toTs?: number;
|
|
1564
1684
|
}, params?: RequestParams) => Promise<BlocksAndEventsPerTimeStampRange>;
|
|
1685
|
+
/**
|
|
1686
|
+
* No description
|
|
1687
|
+
*
|
|
1688
|
+
* @tags Blockflow
|
|
1689
|
+
* @name GetBlockflowRichBlocks
|
|
1690
|
+
* @summary Given a time interval, list blocks containing events and transactions with enriched input information when node indexes are enabled.
|
|
1691
|
+
* @request GET:/blockflow/rich-blocks
|
|
1692
|
+
*/
|
|
1693
|
+
getBlockflowRichBlocks: (query: {
|
|
1694
|
+
/**
|
|
1695
|
+
* @format int64
|
|
1696
|
+
* @min 0
|
|
1697
|
+
*/
|
|
1698
|
+
fromTs: number;
|
|
1699
|
+
/**
|
|
1700
|
+
* @format int64
|
|
1701
|
+
* @min 0
|
|
1702
|
+
*/
|
|
1703
|
+
toTs?: number;
|
|
1704
|
+
}, params?: RequestParams) => Promise<RichBlocksAndEventsPerTimeStampRange>;
|
|
1565
1705
|
/**
|
|
1566
1706
|
* No description
|
|
1567
1707
|
*
|
|
@@ -1589,6 +1729,15 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1589
1729
|
* @request GET:/blockflow/blocks-with-events/{block_hash}
|
|
1590
1730
|
*/
|
|
1591
1731
|
getBlockflowBlocksWithEventsBlockHash: (blockHash: string, params?: RequestParams) => Promise<BlockAndEvents>;
|
|
1732
|
+
/**
|
|
1733
|
+
* No description
|
|
1734
|
+
*
|
|
1735
|
+
* @tags Blockflow
|
|
1736
|
+
* @name GetBlockflowRichBlocksBlockHash
|
|
1737
|
+
* @summary Get a block containing events and transactions with enriched input information when node indexes are enabled.
|
|
1738
|
+
* @request GET:/blockflow/rich-blocks/{block_hash}
|
|
1739
|
+
*/
|
|
1740
|
+
getBlockflowRichBlocksBlockHash: (blockHash: string, params?: RequestParams) => Promise<RichBlockAndEvents>;
|
|
1592
1741
|
/**
|
|
1593
1742
|
* No description
|
|
1594
1743
|
*
|
|
@@ -1687,10 +1836,10 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1687
1836
|
*
|
|
1688
1837
|
* @tags Transactions
|
|
1689
1838
|
* @name PostTransactionsBuild
|
|
1690
|
-
* @summary Build an unsigned transaction to a number of recipients
|
|
1839
|
+
* @summary Build an unsigned transfer transaction to a number of recipients
|
|
1691
1840
|
* @request POST:/transactions/build
|
|
1692
1841
|
*/
|
|
1693
|
-
postTransactionsBuild: (data:
|
|
1842
|
+
postTransactionsBuild: (data: BuildTransferTx, params?: RequestParams) => Promise<BuildTransferTxResult>;
|
|
1694
1843
|
/**
|
|
1695
1844
|
* No description
|
|
1696
1845
|
*
|
|
@@ -1699,7 +1848,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1699
1848
|
* @summary Build an unsigned transaction with multiple addresses to a number of recipients
|
|
1700
1849
|
* @request POST:/transactions/build-multi-addresses
|
|
1701
1850
|
*/
|
|
1702
|
-
postTransactionsBuildMultiAddresses: (data: BuildMultiAddressesTransaction, params?: RequestParams) => Promise<
|
|
1851
|
+
postTransactionsBuildMultiAddresses: (data: BuildMultiAddressesTransaction, params?: RequestParams) => Promise<BuildTransferTxResult>;
|
|
1703
1852
|
/**
|
|
1704
1853
|
* No description
|
|
1705
1854
|
*
|
|
@@ -1741,6 +1890,20 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1741
1890
|
/** @format int32 */
|
|
1742
1891
|
toGroup?: number;
|
|
1743
1892
|
}, params?: RequestParams) => Promise<Transaction>;
|
|
1893
|
+
/**
|
|
1894
|
+
* No description
|
|
1895
|
+
*
|
|
1896
|
+
* @tags Transactions
|
|
1897
|
+
* @name GetTransactionsRichDetailsTxid
|
|
1898
|
+
* @summary Get transaction with enriched input information when node indexes are enabled.
|
|
1899
|
+
* @request GET:/transactions/rich-details/{txId}
|
|
1900
|
+
*/
|
|
1901
|
+
getTransactionsRichDetailsTxid: (txId: string, query?: {
|
|
1902
|
+
/** @format int32 */
|
|
1903
|
+
fromGroup?: number;
|
|
1904
|
+
/** @format int32 */
|
|
1905
|
+
toGroup?: number;
|
|
1906
|
+
}, params?: RequestParams) => Promise<RichTransaction>;
|
|
1744
1907
|
/**
|
|
1745
1908
|
* No description
|
|
1746
1909
|
*
|
|
@@ -1785,6 +1948,15 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1785
1948
|
/** @format 32-byte-hash */
|
|
1786
1949
|
key: string;
|
|
1787
1950
|
}, params?: RequestParams) => Promise<string>;
|
|
1951
|
+
/**
|
|
1952
|
+
* No description
|
|
1953
|
+
*
|
|
1954
|
+
* @tags Transactions
|
|
1955
|
+
* @name PostTransactionsBuildChained
|
|
1956
|
+
* @summary Build a chain of transactions
|
|
1957
|
+
* @request POST:/transactions/build-chained
|
|
1958
|
+
*/
|
|
1959
|
+
postTransactionsBuildChained: (data: BuildChainedTx[], params?: RequestParams) => Promise<BuildChainedTxResult[]>;
|
|
1788
1960
|
};
|
|
1789
1961
|
mempool: {
|
|
1790
1962
|
/**
|
|
@@ -1969,7 +2141,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1969
2141
|
* @summary Build a multisig unsigned transaction
|
|
1970
2142
|
* @request POST:/multisig/build
|
|
1971
2143
|
*/
|
|
1972
|
-
postMultisigBuild: (data: BuildMultisig, params?: RequestParams) => Promise<
|
|
2144
|
+
postMultisigBuild: (data: BuildMultisig, params?: RequestParams) => Promise<BuildTransferTxResult>;
|
|
1973
2145
|
/**
|
|
1974
2146
|
* No description
|
|
1975
2147
|
*
|
|
@@ -151,7 +151,7 @@ class HttpClient {
|
|
|
151
151
|
exports.HttpClient = HttpClient;
|
|
152
152
|
/**
|
|
153
153
|
* @title Alephium API
|
|
154
|
-
* @version 3.
|
|
154
|
+
* @version 3.8.1
|
|
155
155
|
* @baseUrl ../
|
|
156
156
|
*/
|
|
157
157
|
class Api extends HttpClient {
|
|
@@ -661,6 +661,21 @@ class Api extends HttpClient {
|
|
|
661
661
|
format: 'json',
|
|
662
662
|
...params
|
|
663
663
|
}).then(utils_1.convertHttpResponse),
|
|
664
|
+
/**
|
|
665
|
+
* No description
|
|
666
|
+
*
|
|
667
|
+
* @tags Blockflow
|
|
668
|
+
* @name GetBlockflowRichBlocks
|
|
669
|
+
* @summary Given a time interval, list blocks containing events and transactions with enriched input information when node indexes are enabled.
|
|
670
|
+
* @request GET:/blockflow/rich-blocks
|
|
671
|
+
*/
|
|
672
|
+
getBlockflowRichBlocks: (query, params = {}) => this.request({
|
|
673
|
+
path: `/blockflow/rich-blocks`,
|
|
674
|
+
method: 'GET',
|
|
675
|
+
query: query,
|
|
676
|
+
format: 'json',
|
|
677
|
+
...params
|
|
678
|
+
}).then(utils_1.convertHttpResponse),
|
|
664
679
|
/**
|
|
665
680
|
* No description
|
|
666
681
|
*
|
|
@@ -703,6 +718,20 @@ class Api extends HttpClient {
|
|
|
703
718
|
format: 'json',
|
|
704
719
|
...params
|
|
705
720
|
}).then(utils_1.convertHttpResponse),
|
|
721
|
+
/**
|
|
722
|
+
* No description
|
|
723
|
+
*
|
|
724
|
+
* @tags Blockflow
|
|
725
|
+
* @name GetBlockflowRichBlocksBlockHash
|
|
726
|
+
* @summary Get a block containing events and transactions with enriched input information when node indexes are enabled.
|
|
727
|
+
* @request GET:/blockflow/rich-blocks/{block_hash}
|
|
728
|
+
*/
|
|
729
|
+
getBlockflowRichBlocksBlockHash: (blockHash, params = {}) => this.request({
|
|
730
|
+
path: `/blockflow/rich-blocks/${blockHash}`,
|
|
731
|
+
method: 'GET',
|
|
732
|
+
format: 'json',
|
|
733
|
+
...params
|
|
734
|
+
}).then(utils_1.convertHttpResponse),
|
|
706
735
|
/**
|
|
707
736
|
* No description
|
|
708
737
|
*
|
|
@@ -828,7 +857,7 @@ class Api extends HttpClient {
|
|
|
828
857
|
*
|
|
829
858
|
* @tags Transactions
|
|
830
859
|
* @name PostTransactionsBuild
|
|
831
|
-
* @summary Build an unsigned transaction to a number of recipients
|
|
860
|
+
* @summary Build an unsigned transfer transaction to a number of recipients
|
|
832
861
|
* @request POST:/transactions/build
|
|
833
862
|
*/
|
|
834
863
|
postTransactionsBuild: (data, params = {}) => this.request({
|
|
@@ -918,6 +947,21 @@ class Api extends HttpClient {
|
|
|
918
947
|
format: 'json',
|
|
919
948
|
...params
|
|
920
949
|
}).then(utils_1.convertHttpResponse),
|
|
950
|
+
/**
|
|
951
|
+
* No description
|
|
952
|
+
*
|
|
953
|
+
* @tags Transactions
|
|
954
|
+
* @name GetTransactionsRichDetailsTxid
|
|
955
|
+
* @summary Get transaction with enriched input information when node indexes are enabled.
|
|
956
|
+
* @request GET:/transactions/rich-details/{txId}
|
|
957
|
+
*/
|
|
958
|
+
getTransactionsRichDetailsTxid: (txId, query, params = {}) => this.request({
|
|
959
|
+
path: `/transactions/rich-details/${txId}`,
|
|
960
|
+
method: 'GET',
|
|
961
|
+
query: query,
|
|
962
|
+
format: 'json',
|
|
963
|
+
...params
|
|
964
|
+
}).then(utils_1.convertHttpResponse),
|
|
921
965
|
/**
|
|
922
966
|
* No description
|
|
923
967
|
*
|
|
@@ -962,6 +1006,22 @@ class Api extends HttpClient {
|
|
|
962
1006
|
query: query,
|
|
963
1007
|
format: 'json',
|
|
964
1008
|
...params
|
|
1009
|
+
}).then(utils_1.convertHttpResponse),
|
|
1010
|
+
/**
|
|
1011
|
+
* No description
|
|
1012
|
+
*
|
|
1013
|
+
* @tags Transactions
|
|
1014
|
+
* @name PostTransactionsBuildChained
|
|
1015
|
+
* @summary Build a chain of transactions
|
|
1016
|
+
* @request POST:/transactions/build-chained
|
|
1017
|
+
*/
|
|
1018
|
+
postTransactionsBuildChained: (data, params = {}) => this.request({
|
|
1019
|
+
path: `/transactions/build-chained`,
|
|
1020
|
+
method: 'POST',
|
|
1021
|
+
body: data,
|
|
1022
|
+
type: ContentType.Json,
|
|
1023
|
+
format: 'json',
|
|
1024
|
+
...params
|
|
965
1025
|
}).then(utils_1.convertHttpResponse)
|
|
966
1026
|
};
|
|
967
1027
|
this.mempool = {
|
|
@@ -162,6 +162,7 @@ export interface AssetOutput {
|
|
|
162
162
|
}
|
|
163
163
|
/** NFT */
|
|
164
164
|
export interface NFT {
|
|
165
|
+
id: string;
|
|
165
166
|
type: string;
|
|
166
167
|
}
|
|
167
168
|
/** AcceptedTransaction */
|
|
@@ -187,6 +188,13 @@ export interface AcceptedTransaction {
|
|
|
187
188
|
/** @format int64 */
|
|
188
189
|
timestamp: number;
|
|
189
190
|
}
|
|
191
|
+
/** HolderInfo */
|
|
192
|
+
export interface HolderInfo {
|
|
193
|
+
/** @format address */
|
|
194
|
+
address: string;
|
|
195
|
+
/** @format uint256 */
|
|
196
|
+
balance: string;
|
|
197
|
+
}
|
|
190
198
|
/** TokenSupply */
|
|
191
199
|
export interface TokenSupply {
|
|
192
200
|
/** @format uint256 */
|
|
@@ -278,6 +286,8 @@ export declare enum TokenStdInterfaceId {
|
|
|
278
286
|
export interface ExplorerInfo {
|
|
279
287
|
releaseVersion: string;
|
|
280
288
|
commit: string;
|
|
289
|
+
/** @format int64 */
|
|
290
|
+
lastHoldersUpdate: number;
|
|
281
291
|
/** @format int32 */
|
|
282
292
|
migrationsVersion: number;
|
|
283
293
|
/** @format int64 */
|
|
@@ -323,6 +333,7 @@ export interface Transaction {
|
|
|
323
333
|
}
|
|
324
334
|
/** FungibleToken */
|
|
325
335
|
export interface FungibleToken {
|
|
336
|
+
id: string;
|
|
326
337
|
type: string;
|
|
327
338
|
}
|
|
328
339
|
/** GhostUncle */
|
|
@@ -1045,6 +1056,28 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1045
1056
|
*/
|
|
1046
1057
|
'interface-id'?: TokenStdInterfaceId | string;
|
|
1047
1058
|
}, params?: RequestParams) => Promise<TokenInfo[]>;
|
|
1059
|
+
/**
|
|
1060
|
+
* @description Get a sorted list of top addresses by {token_id} balance. Updates once per day.
|
|
1061
|
+
*
|
|
1062
|
+
* @tags Tokens
|
|
1063
|
+
* @name GetTokensHoldersTokenTokenId
|
|
1064
|
+
* @request GET:/tokens/holders/token/{token_id}
|
|
1065
|
+
*/
|
|
1066
|
+
getTokensHoldersTokenTokenId: (tokenId: string, query?: {
|
|
1067
|
+
/**
|
|
1068
|
+
* Page number
|
|
1069
|
+
* @format int32
|
|
1070
|
+
* @min 1
|
|
1071
|
+
*/
|
|
1072
|
+
page?: number;
|
|
1073
|
+
/**
|
|
1074
|
+
* Number of items per page
|
|
1075
|
+
* @format int32
|
|
1076
|
+
* @min 0
|
|
1077
|
+
* @max 100
|
|
1078
|
+
*/
|
|
1079
|
+
limit?: number;
|
|
1080
|
+
}, params?: RequestParams) => Promise<HolderInfo[]>;
|
|
1048
1081
|
/**
|
|
1049
1082
|
* @description List token transactions
|
|
1050
1083
|
*
|
|
@@ -1097,6 +1130,28 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1097
1130
|
*/
|
|
1098
1131
|
limit?: number;
|
|
1099
1132
|
}, params?: RequestParams) => Promise<string[]>;
|
|
1133
|
+
/**
|
|
1134
|
+
* @description Get a sorted list of top addresses by ALPH balance. Updates once per day.
|
|
1135
|
+
*
|
|
1136
|
+
* @tags Tokens
|
|
1137
|
+
* @name GetTokensHoldersAlph
|
|
1138
|
+
* @request GET:/tokens/holders/alph
|
|
1139
|
+
*/
|
|
1140
|
+
getTokensHoldersAlph: (query?: {
|
|
1141
|
+
/**
|
|
1142
|
+
* Page number
|
|
1143
|
+
* @format int32
|
|
1144
|
+
* @min 1
|
|
1145
|
+
*/
|
|
1146
|
+
page?: number;
|
|
1147
|
+
/**
|
|
1148
|
+
* Number of items per page
|
|
1149
|
+
* @format int32
|
|
1150
|
+
* @min 0
|
|
1151
|
+
* @max 100
|
|
1152
|
+
*/
|
|
1153
|
+
limit?: number;
|
|
1154
|
+
}, params?: RequestParams) => Promise<HolderInfo[]>;
|
|
1100
1155
|
/**
|
|
1101
1156
|
* @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
|
|
1102
1157
|
*
|
|
@@ -680,6 +680,20 @@ class Api extends HttpClient {
|
|
|
680
680
|
format: 'json',
|
|
681
681
|
...params
|
|
682
682
|
}).then(utils_1.convertHttpResponse),
|
|
683
|
+
/**
|
|
684
|
+
* @description Get a sorted list of top addresses by {token_id} balance. Updates once per day.
|
|
685
|
+
*
|
|
686
|
+
* @tags Tokens
|
|
687
|
+
* @name GetTokensHoldersTokenTokenId
|
|
688
|
+
* @request GET:/tokens/holders/token/{token_id}
|
|
689
|
+
*/
|
|
690
|
+
getTokensHoldersTokenTokenId: (tokenId, query, params = {}) => this.request({
|
|
691
|
+
path: `/tokens/holders/token/${tokenId}`,
|
|
692
|
+
method: 'GET',
|
|
693
|
+
query: query,
|
|
694
|
+
format: 'json',
|
|
695
|
+
...params
|
|
696
|
+
}).then(utils_1.convertHttpResponse),
|
|
683
697
|
/**
|
|
684
698
|
* @description List token transactions
|
|
685
699
|
*
|
|
@@ -723,6 +737,20 @@ class Api extends HttpClient {
|
|
|
723
737
|
format: 'json',
|
|
724
738
|
...params
|
|
725
739
|
}).then(utils_1.convertHttpResponse),
|
|
740
|
+
/**
|
|
741
|
+
* @description Get a sorted list of top addresses by ALPH balance. Updates once per day.
|
|
742
|
+
*
|
|
743
|
+
* @tags Tokens
|
|
744
|
+
* @name GetTokensHoldersAlph
|
|
745
|
+
* @request GET:/tokens/holders/alph
|
|
746
|
+
*/
|
|
747
|
+
getTokensHoldersAlph: (query, params = {}) => this.request({
|
|
748
|
+
path: `/tokens/holders/alph`,
|
|
749
|
+
method: 'GET',
|
|
750
|
+
query: query,
|
|
751
|
+
format: 'json',
|
|
752
|
+
...params
|
|
753
|
+
}).then(utils_1.convertHttpResponse),
|
|
726
754
|
/**
|
|
727
755
|
* @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
|
|
728
756
|
*
|
|
@@ -303,7 +303,9 @@ export declare function subscribeContractEvent<F extends Fields, M extends Contr
|
|
|
303
303
|
export declare function subscribeContractEvents(contract: Contract, instance: ContractInstance, options: EventSubscribeOptions<ContractEvent<any>>, fromCount?: number): EventSubscription;
|
|
304
304
|
export declare function callMethod<I extends ContractInstance, F extends Fields, A extends Arguments, R>(contract: ContractFactory<I, F>, instance: ContractInstance, methodName: string, params: Optional<CallContractParams<A>, 'args'>, getContractByCodeHash: (codeHash: string) => Contract): Promise<CallContractResult<R>>;
|
|
305
305
|
export declare function signExecuteMethod<I extends ContractInstance, F extends Fields, A extends Arguments, R>(contract: ContractFactory<I, F>, instance: ContractInstance, methodName: string, params: Optional<SignExecuteContractMethodParams<A>, 'args'>): Promise<SignExecuteScriptTxResult>;
|
|
306
|
-
|
|
306
|
+
type Calls = Record<string, Optional<CallContractParams<any>, 'args'>>;
|
|
307
|
+
export declare function multicallMethods<I extends ContractInstance, F extends Fields>(contract: ContractFactory<I, F>, instance: ContractInstance, _callss: Calls | Calls[], getContractByCodeHash: (codeHash: string) => Contract): Promise<Record<string, CallContractResult<any>>[] | Record<string, CallContractResult<any>>>;
|
|
307
308
|
export declare function getContractEventsCurrentCount(contractAddress: Address): Promise<number>;
|
|
308
309
|
export declare const getContractIdFromUnsignedTx: (nodeProvider: NodeProvider, unsignedTx: string) => Promise<HexString>;
|
|
309
310
|
export declare const getTokenIdFromUnsignedTx: (nodeProvider: NodeProvider, unsignedTx: string) => Promise<HexString>;
|
|
311
|
+
export {};
|
|
@@ -1328,7 +1328,8 @@ function toFieldsSig(contractName, functionSig) {
|
|
|
1328
1328
|
isMutable: [false].concat(functionSig.paramIsMutable)
|
|
1329
1329
|
};
|
|
1330
1330
|
}
|
|
1331
|
-
async function multicallMethods(contract, instance,
|
|
1331
|
+
async function multicallMethods(contract, instance, _callss, getContractByCodeHash) {
|
|
1332
|
+
const callss = Array.isArray(_callss) ? _callss : [_callss];
|
|
1332
1333
|
const callEntries = callss.map((calls) => Object.entries(calls));
|
|
1333
1334
|
const callsParams = callEntries.map((entries) => {
|
|
1334
1335
|
return entries.map((entry) => {
|
|
@@ -1340,7 +1341,7 @@ async function multicallMethods(contract, instance, callss, getContractByCodeHas
|
|
|
1340
1341
|
});
|
|
1341
1342
|
const result = await (0, global_1.getCurrentNodeProvider)().contracts.postContractsMulticallContract({ calls: callsParams.flat() });
|
|
1342
1343
|
let callResultIndex = 0;
|
|
1343
|
-
|
|
1344
|
+
const results = callsParams.map((calls, index0) => {
|
|
1344
1345
|
const callsResult = {};
|
|
1345
1346
|
const entries = callEntries[`${index0}`];
|
|
1346
1347
|
calls.forEach((call, index1) => {
|
|
@@ -1352,6 +1353,7 @@ async function multicallMethods(contract, instance, callss, getContractByCodeHas
|
|
|
1352
1353
|
});
|
|
1353
1354
|
return callsResult;
|
|
1354
1355
|
});
|
|
1356
|
+
return Array.isArray(_callss) ? results : results[0];
|
|
1355
1357
|
}
|
|
1356
1358
|
exports.multicallMethods = multicallMethods;
|
|
1357
1359
|
async function getContractEventsCurrentCount(contractAddress) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExplorerProvider, NodeProvider } from '../api';
|
|
2
2
|
import { node } from '../api';
|
|
3
|
-
import { Account, EnableOptionsBase, Destination, SignDeployContractTxParams, SignDeployContractTxResult, SignExecuteScriptTxParams, SignExecuteScriptTxResult, SignMessageParams, SignMessageResult, SignTransferTxParams, SignTransferTxResult, SignUnsignedTxParams, SignUnsignedTxResult, SubmissionResult, SubmitTransactionParams, KeyType, MessageHasher } from './types';
|
|
3
|
+
import { Account, EnableOptionsBase, Destination, SignDeployContractTxParams, SignDeployContractTxResult, SignExecuteScriptTxParams, SignExecuteScriptTxResult, SignMessageParams, SignMessageResult, SignTransferTxParams, SignTransferTxResult, SignUnsignedTxParams, SignUnsignedTxResult, SubmissionResult, SubmitTransactionParams, KeyType, MessageHasher, SignChainedTxParams, SignChainedTxResult } from './types';
|
|
4
4
|
export declare abstract class SignerProvider {
|
|
5
5
|
abstract get nodeProvider(): NodeProvider | undefined;
|
|
6
6
|
abstract get explorerProvider(): ExplorerProvider | undefined;
|
|
@@ -11,6 +11,7 @@ export declare abstract class SignerProvider {
|
|
|
11
11
|
abstract signAndSubmitDeployContractTx(params: SignDeployContractTxParams): Promise<SignDeployContractTxResult>;
|
|
12
12
|
abstract signAndSubmitExecuteScriptTx(params: SignExecuteScriptTxParams): Promise<SignExecuteScriptTxResult>;
|
|
13
13
|
abstract signAndSubmitUnsignedTx(params: SignUnsignedTxParams): Promise<SignUnsignedTxResult>;
|
|
14
|
+
abstract signAndSubmitChainedTx(params: SignChainedTxParams[]): Promise<SignChainedTxResult[]>;
|
|
14
15
|
abstract signUnsignedTx(params: SignUnsignedTxParams): Promise<SignUnsignedTxResult>;
|
|
15
16
|
abstract signMessage(params: SignMessageParams): Promise<SignMessageResult>;
|
|
16
17
|
}
|
|
@@ -26,14 +27,16 @@ export declare abstract class SignerProviderSimple extends SignerProvider {
|
|
|
26
27
|
signAndSubmitDeployContractTx(params: SignDeployContractTxParams): Promise<SignDeployContractTxResult>;
|
|
27
28
|
signAndSubmitExecuteScriptTx(params: SignExecuteScriptTxParams): Promise<SignExecuteScriptTxResult>;
|
|
28
29
|
signAndSubmitUnsignedTx(params: SignUnsignedTxParams): Promise<SignUnsignedTxResult>;
|
|
30
|
+
signAndSubmitChainedTx(params: SignChainedTxParams[]): Promise<SignChainedTxResult[]>;
|
|
29
31
|
protected abstract getPublicKey(address: string): Promise<string>;
|
|
30
|
-
private usePublicKey;
|
|
31
32
|
signTransferTx(params: SignTransferTxParams): Promise<SignTransferTxResult>;
|
|
32
33
|
buildTransferTx(params: SignTransferTxParams): Promise<Omit<SignTransferTxResult, 'signature'>>;
|
|
33
34
|
signDeployContractTx(params: SignDeployContractTxParams): Promise<SignDeployContractTxResult>;
|
|
34
35
|
buildDeployContractTx(params: SignDeployContractTxParams): Promise<Omit<SignDeployContractTxResult, 'signature'>>;
|
|
35
36
|
signExecuteScriptTx(params: SignExecuteScriptTxParams): Promise<SignExecuteScriptTxResult>;
|
|
36
37
|
buildExecuteScriptTx(params: SignExecuteScriptTxParams): Promise<Omit<SignExecuteScriptTxResult, 'signature'>>;
|
|
38
|
+
signChainedTx(params: SignChainedTxParams[]): Promise<SignChainedTxResult[]>;
|
|
39
|
+
buildChainedTx(params: SignChainedTxParams[]): Promise<Omit<SignChainedTxResult, 'signature'>[]>;
|
|
37
40
|
signUnsignedTx(params: SignUnsignedTxParams): Promise<SignUnsignedTxResult>;
|
|
38
41
|
signMessage(params: SignMessageParams): Promise<SignMessageResult>;
|
|
39
42
|
abstract signRaw(signerAddress: string, hexString: string): Promise<string>;
|
|
@@ -99,10 +99,12 @@ class SignerProviderSimple extends SignerProvider {
|
|
|
99
99
|
await this.submitTransaction(signResult);
|
|
100
100
|
return signResult;
|
|
101
101
|
}
|
|
102
|
-
async
|
|
103
|
-
const
|
|
104
|
-
const
|
|
105
|
-
|
|
102
|
+
async signAndSubmitChainedTx(params) {
|
|
103
|
+
const signResults = await this.signChainedTx(params);
|
|
104
|
+
for (const r of signResults) {
|
|
105
|
+
await this.submitTransaction(r);
|
|
106
|
+
}
|
|
107
|
+
return signResults;
|
|
106
108
|
}
|
|
107
109
|
async signTransferTx(params) {
|
|
108
110
|
const response = await this.buildTransferTx(params);
|
|
@@ -128,6 +130,14 @@ class SignerProviderSimple extends SignerProvider {
|
|
|
128
130
|
async buildExecuteScriptTx(params) {
|
|
129
131
|
return tx_builder_1.TransactionBuilder.from(this.nodeProvider).buildExecuteScriptTx(params, await this.getPublicKey(params.signerAddress));
|
|
130
132
|
}
|
|
133
|
+
async signChainedTx(params) {
|
|
134
|
+
const response = await this.buildChainedTx(params);
|
|
135
|
+
const signatures = await Promise.all(response.map((r, i) => this.signRaw(params[`${i}`].signerAddress, r.txId)));
|
|
136
|
+
return response.map((r, i) => ({ ...r, signature: signatures[`${i}`] }));
|
|
137
|
+
}
|
|
138
|
+
async buildChainedTx(params) {
|
|
139
|
+
return tx_builder_1.TransactionBuilder.from(this.nodeProvider).buildChainedTx(params, await Promise.all(params.map((p) => this.getPublicKey(p.signerAddress))));
|
|
140
|
+
}
|
|
131
141
|
// in general, wallet should show the decoded information to user for confirmation
|
|
132
142
|
// please overwrite this function for real wallet
|
|
133
143
|
async signUnsignedTx(params) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NodeProvider } from '../api';
|
|
2
|
-
import { SignDeployContractTxParams, SignDeployContractTxResult, SignExecuteScriptTxParams, SignExecuteScriptTxResult, SignTransferTxParams, SignTransferTxResult, SignUnsignedTxParams, SignUnsignedTxResult } from './types';
|
|
2
|
+
import { SignChainedTxParams, SignChainedTxResult, SignDeployContractTxParams, SignDeployContractTxResult, SignExecuteScriptTxParams, SignExecuteScriptTxResult, SignTransferTxParams, SignTransferTxResult, SignUnsignedTxParams, SignUnsignedTxResult } from './types';
|
|
3
3
|
export declare abstract class TransactionBuilder {
|
|
4
4
|
abstract get nodeProvider(): NodeProvider;
|
|
5
5
|
static from(nodeProvider: NodeProvider): TransactionBuilder;
|
|
@@ -8,5 +8,12 @@ export declare abstract class TransactionBuilder {
|
|
|
8
8
|
buildTransferTx(params: SignTransferTxParams, publicKey: string): Promise<Omit<SignTransferTxResult, 'signature'>>;
|
|
9
9
|
buildDeployContractTx(params: SignDeployContractTxParams, publicKey: string): Promise<Omit<SignDeployContractTxResult, 'signature'>>;
|
|
10
10
|
buildExecuteScriptTx(params: SignExecuteScriptTxParams, publicKey: string): Promise<Omit<SignExecuteScriptTxResult, 'signature'>>;
|
|
11
|
+
buildChainedTx(params: SignChainedTxParams[], publicKeys: string[]): Promise<Omit<SignChainedTxResult, 'signature'>[]>;
|
|
11
12
|
buildUnsignedTx(params: SignUnsignedTxParams): Omit<SignUnsignedTxResult, 'signature'>;
|
|
13
|
+
private buildTransferTxParams;
|
|
14
|
+
private buildDeployContractTxParams;
|
|
15
|
+
private buildExecuteScriptTxParams;
|
|
16
|
+
private convertTransferTxResult;
|
|
17
|
+
private convertDeployContractTxResult;
|
|
18
|
+
private convertExecuteScriptTxResult;
|
|
12
19
|
}
|