@bitgo-beta/abstract-eth 1.2.3-alpha.405 → 1.2.3-alpha.407
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/src/abstractEthLikeCoin.d.ts +95 -0
- package/dist/src/abstractEthLikeCoin.d.ts.map +1 -0
- package/dist/src/abstractEthLikeCoin.js +160 -0
- package/dist/src/abstractEthLikeNewCoins.d.ts +749 -0
- package/dist/src/abstractEthLikeNewCoins.d.ts.map +1 -0
- package/dist/src/abstractEthLikeNewCoins.js +2229 -0
- package/dist/src/ethLikeToken.d.ts +70 -0
- package/dist/src/ethLikeToken.d.ts.map +1 -0
- package/dist/src/ethLikeToken.js +360 -0
- package/dist/src/index.d.ts +5 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +21 -0
- package/dist/src/lib/contractCall.d.ts +8 -0
- package/dist/src/lib/contractCall.d.ts.map +1 -0
- package/dist/src/lib/contractCall.js +17 -0
- package/dist/src/lib/iface.d.ts +133 -0
- package/dist/src/lib/iface.d.ts.map +1 -0
- package/dist/src/lib/iface.js +8 -0
- package/dist/src/lib/index.d.ts +16 -0
- package/dist/src/lib/index.d.ts.map +1 -0
- package/dist/src/lib/index.js +57 -0
- package/dist/src/lib/keyPair.d.ts +26 -0
- package/dist/src/lib/keyPair.d.ts.map +1 -0
- package/dist/src/lib/keyPair.js +65 -0
- package/dist/src/lib/messages/eip191/eip191Message.d.ts +12 -0
- package/dist/src/lib/messages/eip191/eip191Message.d.ts.map +1 -0
- package/dist/src/lib/messages/eip191/eip191Message.js +25 -0
- package/dist/src/lib/messages/eip191/eip191MessageBuilder.d.ts +19 -0
- package/dist/src/lib/messages/eip191/eip191MessageBuilder.d.ts.map +1 -0
- package/dist/src/lib/messages/eip191/eip191MessageBuilder.js +27 -0
- package/dist/src/lib/messages/eip191/index.d.ts +3 -0
- package/dist/src/lib/messages/eip191/index.d.ts.map +1 -0
- package/dist/src/lib/messages/eip191/index.js +19 -0
- package/dist/src/lib/messages/eip712/eip712Message.d.ts +6 -0
- package/dist/src/lib/messages/eip712/eip712Message.d.ts.map +1 -0
- package/dist/src/lib/messages/eip712/eip712Message.js +27 -0
- package/dist/src/lib/messages/eip712/eip712MessageBuilder.d.ts +7 -0
- package/dist/src/lib/messages/eip712/eip712MessageBuilder.d.ts.map +1 -0
- package/dist/src/lib/messages/eip712/eip712MessageBuilder.js +15 -0
- package/dist/src/lib/messages/eip712/index.d.ts +3 -0
- package/dist/src/lib/messages/eip712/index.d.ts.map +1 -0
- package/dist/src/lib/messages/eip712/index.js +19 -0
- package/dist/src/lib/messages/index.d.ts +4 -0
- package/dist/src/lib/messages/index.d.ts.map +1 -0
- package/dist/src/lib/messages/index.js +20 -0
- package/dist/src/lib/messages/messageBuilderFactory.d.ts +7 -0
- package/dist/src/lib/messages/messageBuilderFactory.d.ts.map +1 -0
- package/dist/src/lib/messages/messageBuilderFactory.js +23 -0
- package/dist/src/lib/transaction.d.ts +67 -0
- package/dist/src/lib/transaction.d.ts.map +1 -0
- package/dist/src/lib/transaction.js +142 -0
- package/dist/src/lib/transactionBuilder.d.ts +270 -0
- package/dist/src/lib/transactionBuilder.d.ts.map +1 -0
- package/dist/src/lib/transactionBuilder.js +822 -0
- package/dist/src/lib/transferBuilder.d.ts +76 -0
- package/dist/src/lib/transferBuilder.d.ts.map +1 -0
- package/dist/src/lib/transferBuilder.js +307 -0
- package/dist/src/lib/transferBuilders/baseNFTTransferBuilder.d.ts +54 -0
- package/dist/src/lib/transferBuilders/baseNFTTransferBuilder.d.ts.map +1 -0
- package/dist/src/lib/transferBuilders/baseNFTTransferBuilder.js +120 -0
- package/dist/src/lib/transferBuilders/index.d.ts +4 -0
- package/dist/src/lib/transferBuilders/index.d.ts.map +1 -0
- package/dist/src/lib/transferBuilders/index.js +20 -0
- package/dist/src/lib/transferBuilders/transferBuilderERC1155.d.ts +17 -0
- package/dist/src/lib/transferBuilders/transferBuilderERC1155.d.ts.map +1 -0
- package/dist/src/lib/transferBuilders/transferBuilderERC1155.js +96 -0
- package/dist/src/lib/transferBuilders/transferBuilderERC721.d.ts +16 -0
- package/dist/src/lib/transferBuilders/transferBuilderERC721.d.ts.map +1 -0
- package/dist/src/lib/transferBuilders/transferBuilderERC721.js +81 -0
- package/dist/src/lib/types.d.ts +39 -0
- package/dist/src/lib/types.d.ts.map +1 -0
- package/dist/src/lib/types.js +137 -0
- package/dist/src/lib/utils.d.ts +310 -0
- package/dist/src/lib/utils.d.ts.map +1 -0
- package/dist/src/lib/utils.js +829 -0
- package/dist/src/lib/walletUtil.d.ts +40 -0
- package/dist/src/lib/walletUtil.d.ts.map +1 -0
- package/dist/src/lib/walletUtil.js +43 -0
- package/dist/src/types.d.ts +9 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +3 -0
- package/dist/test/index.d.ts +2 -0
- package/dist/test/index.d.ts.map +1 -0
- package/dist/test/index.js +18 -0
- package/dist/test/unit/coin.d.ts +8 -0
- package/dist/test/unit/coin.d.ts.map +1 -0
- package/dist/test/unit/coin.js +577 -0
- package/dist/test/unit/index.d.ts +6 -0
- package/dist/test/unit/index.d.ts.map +1 -0
- package/dist/test/unit/index.js +22 -0
- package/dist/test/unit/messages/abstractEthMessageBuilderTests.d.ts +3 -0
- package/dist/test/unit/messages/abstractEthMessageBuilderTests.d.ts.map +1 -0
- package/dist/test/unit/messages/abstractEthMessageBuilderTests.js +110 -0
- package/dist/test/unit/messages/abstractEthMessageTestTypes.d.ts +43 -0
- package/dist/test/unit/messages/abstractEthMessageTestTypes.d.ts.map +1 -0
- package/dist/test/unit/messages/abstractEthMessageTestTypes.js +3 -0
- package/dist/test/unit/messages/abstractEthMessagesTests.d.ts +3 -0
- package/dist/test/unit/messages/abstractEthMessagesTests.d.ts.map +1 -0
- package/dist/test/unit/messages/abstractEthMessagesTests.js +129 -0
- package/dist/test/unit/messages/eip191/eip191Message.d.ts +2 -0
- package/dist/test/unit/messages/eip191/eip191Message.d.ts.map +1 -0
- package/dist/test/unit/messages/eip191/eip191Message.js +15 -0
- package/dist/test/unit/messages/eip191/eip191MessageBuilder.d.ts +2 -0
- package/dist/test/unit/messages/eip191/eip191MessageBuilder.d.ts.map +1 -0
- package/dist/test/unit/messages/eip191/eip191MessageBuilder.js +16 -0
- package/dist/test/unit/messages/eip191/fixtures.d.ts +109 -0
- package/dist/test/unit/messages/eip191/fixtures.d.ts.map +1 -0
- package/dist/test/unit/messages/eip191/fixtures.js +63 -0
- package/dist/test/unit/messages/eip712/eip712Message.d.ts +2 -0
- package/dist/test/unit/messages/eip712/eip712Message.d.ts.map +1 -0
- package/dist/test/unit/messages/eip712/eip712Message.js +15 -0
- package/dist/test/unit/messages/eip712/eip712MessageBuilder.d.ts +2 -0
- package/dist/test/unit/messages/eip712/eip712MessageBuilder.d.ts.map +1 -0
- package/dist/test/unit/messages/eip712/eip712MessageBuilder.js +16 -0
- package/dist/test/unit/messages/eip712/fixtures.d.ts +76 -0
- package/dist/test/unit/messages/eip712/fixtures.d.ts.map +1 -0
- package/dist/test/unit/messages/eip712/fixtures.js +120 -0
- package/dist/test/unit/messages/index.d.ts +4 -0
- package/dist/test/unit/messages/index.d.ts.map +1 -0
- package/dist/test/unit/messages/index.js +20 -0
- package/dist/test/unit/messages/messageBuilderFactory.d.ts +2 -0
- package/dist/test/unit/messages/messageBuilderFactory.d.ts.map +1 -0
- package/dist/test/unit/messages/messageBuilderFactory.js +52 -0
- package/dist/test/unit/token.d.ts +2 -0
- package/dist/test/unit/token.d.ts.map +1 -0
- package/dist/test/unit/token.js +37 -0
- package/dist/test/unit/transaction.d.ts +3 -0
- package/dist/test/unit/transaction.d.ts.map +1 -0
- package/dist/test/unit/transaction.js +60 -0
- package/dist/test/unit/transactionBuilder/addressInitialization.d.ts +8 -0
- package/dist/test/unit/transactionBuilder/addressInitialization.d.ts.map +1 -0
- package/dist/test/unit/transactionBuilder/addressInitialization.js +95 -0
- package/dist/test/unit/transactionBuilder/flushNft.d.ts +2 -0
- package/dist/test/unit/transactionBuilder/flushNft.d.ts.map +1 -0
- package/dist/test/unit/transactionBuilder/flushNft.js +381 -0
- package/dist/test/unit/transactionBuilder/index.d.ts +5 -0
- package/dist/test/unit/transactionBuilder/index.d.ts.map +1 -0
- package/dist/test/unit/transactionBuilder/index.js +21 -0
- package/dist/test/unit/transactionBuilder/send.d.ts +3 -0
- package/dist/test/unit/transactionBuilder/send.d.ts.map +1 -0
- package/dist/test/unit/transactionBuilder/send.js +197 -0
- package/dist/test/unit/transactionBuilder/walletInitialization.d.ts +10 -0
- package/dist/test/unit/transactionBuilder/walletInitialization.d.ts.map +1 -0
- package/dist/test/unit/transactionBuilder/walletInitialization.js +124 -0
- package/dist/test/unit/transferBuilder.d.ts +2 -0
- package/dist/test/unit/transferBuilder.d.ts.map +1 -0
- package/dist/test/unit/transferBuilder.js +76 -0
- package/dist/test/unit/utils.d.ts +2 -0
- package/dist/test/unit/utils.d.ts.map +1 -0
- package/dist/test/unit/utils.js +184 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +11 -8
- package/.eslintignore +0 -5
- package/CHANGELOG.md +0 -1941
- package/index.ts +0 -2
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
import { Buffer } from 'buffer';
|
|
2
|
+
import { BaseCoin, BaseNetwork, EthereumNetwork } from '@bitgo-beta/statics';
|
|
3
|
+
import EthereumCommon from '@ethereumjs/common';
|
|
4
|
+
import BN from 'bn.js';
|
|
5
|
+
import { TransactionType } from '@bitgo-beta/sdk-core';
|
|
6
|
+
import { ERC1155TransferData, ERC721TransferData, FlushTokensData, NativeTransferData, SignatureParts, TokenTransferData, TransferData, TxData, WalletInitializationData, ForwarderInitializationData } from './iface';
|
|
7
|
+
import { KeyPair } from './keyPair';
|
|
8
|
+
/**
|
|
9
|
+
* @param network
|
|
10
|
+
*/
|
|
11
|
+
export declare function getCommon(network: EthereumNetwork): EthereumCommon;
|
|
12
|
+
/**
|
|
13
|
+
* Signs the transaction using the appropriate algorithm
|
|
14
|
+
* and the provided common for the blockchain
|
|
15
|
+
*
|
|
16
|
+
* @param {TxData} transactionData the transaction data to sign
|
|
17
|
+
* @param {KeyPair} keyPair the signer's keypair
|
|
18
|
+
* @param {EthereumCommon} customCommon the network's custom common
|
|
19
|
+
* @returns {string} the transaction signed and encoded
|
|
20
|
+
*/
|
|
21
|
+
export declare function signInternal(transactionData: TxData, keyPair: KeyPair, customCommon: EthereumCommon): Promise<string>;
|
|
22
|
+
/**
|
|
23
|
+
* Signs the transaction using the appropriate algorithm
|
|
24
|
+
*
|
|
25
|
+
* @param {TxData} transactionData the transaction data to sign
|
|
26
|
+
* @param {KeyPair} keyPair the signer's keypair
|
|
27
|
+
* @returns {string} the transaction signed and encoded
|
|
28
|
+
*/
|
|
29
|
+
export declare function sign(transactionData: TxData, keyPair: KeyPair): Promise<string>;
|
|
30
|
+
/**
|
|
31
|
+
* Returns the contract method encoded data
|
|
32
|
+
*
|
|
33
|
+
* @param {string} to destination address
|
|
34
|
+
* @param {number} value Amount to tranfer
|
|
35
|
+
* @param {string} data aditional method call data
|
|
36
|
+
* @param {number} expireTime expiration time for the transaction in seconds
|
|
37
|
+
* @param {number} sequenceId sequence id
|
|
38
|
+
* @param {string} signature signature of the call
|
|
39
|
+
* @returns {string} -- the contract method encoded data
|
|
40
|
+
*/
|
|
41
|
+
export declare function sendMultiSigData(to: string, value: string, data: string, expireTime: number, sequenceId: number, signature: string): string;
|
|
42
|
+
/**
|
|
43
|
+
* Returns the contract method encoded data
|
|
44
|
+
*
|
|
45
|
+
* @param {string} to destination address
|
|
46
|
+
* @param {number} value Amount to tranfer
|
|
47
|
+
* @param {string} tokenContractAddress the address of the erc20 token contract
|
|
48
|
+
* @param {number} expireTime expiration time for the transaction in seconds
|
|
49
|
+
* @param {number} sequenceId sequence id
|
|
50
|
+
* @param {string} signature signature of the call
|
|
51
|
+
* @returns {string} -- the contract method encoded data
|
|
52
|
+
*/
|
|
53
|
+
export declare function sendMultiSigTokenData(to: string, value: string, tokenContractAddress: string, expireTime: number, sequenceId: number, signature: string): string;
|
|
54
|
+
/**
|
|
55
|
+
* Get the data required to make a flush tokens contract call
|
|
56
|
+
*
|
|
57
|
+
* @param forwarderAddress The forwarder address to flush
|
|
58
|
+
* @param tokenAddress The token address to flush from
|
|
59
|
+
*/
|
|
60
|
+
export declare function flushTokensData(forwarderAddress: string, tokenAddress: string, forwarderVersion: number): string;
|
|
61
|
+
/**
|
|
62
|
+
* Get the data required to make a flush native coins contract call
|
|
63
|
+
*/
|
|
64
|
+
export declare function flushCoinsData(): string;
|
|
65
|
+
/**
|
|
66
|
+
* Get the data required to make a flush ERC721 tokens contract call
|
|
67
|
+
* @param forwarderAddress - The forwarder address (for v0-v3)
|
|
68
|
+
* @param tokenAddress - The ERC721 token contract address
|
|
69
|
+
* @param tokenId - The token ID to flush
|
|
70
|
+
* @param forwarderVersion - The forwarder version
|
|
71
|
+
*/
|
|
72
|
+
export declare function flushERC721TokensData(forwarderAddress: string, tokenAddress: string, tokenId: string, forwarderVersion: number): string;
|
|
73
|
+
/**
|
|
74
|
+
* Decode the given ABI-encoded flush ERC721 tokens data
|
|
75
|
+
* @param data The data to decode
|
|
76
|
+
* @param to The to address (contract address for v4+)
|
|
77
|
+
* @returns parsed flush data with forwarderAddress, tokenAddress, tokenId and forwarderVersion
|
|
78
|
+
*/
|
|
79
|
+
export declare function decodeFlushERC721TokensData(data: string, to?: string): {
|
|
80
|
+
forwarderAddress: string;
|
|
81
|
+
tokenAddress: string;
|
|
82
|
+
tokenId: string;
|
|
83
|
+
forwarderVersion?: number;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Get the data required to make a flush ERC1155 tokens contract call
|
|
87
|
+
* @param forwarderAddress - The forwarder address (for v0-v3)
|
|
88
|
+
* @param tokenAddress - The ERC1155 token contract address
|
|
89
|
+
* @param tokenId - The token ID to flush
|
|
90
|
+
* @param forwarderVersion - The forwarder version
|
|
91
|
+
*/
|
|
92
|
+
export declare function flushERC1155TokensData(forwarderAddress: string, tokenAddress: string, tokenId: string, forwarderVersion: number): string;
|
|
93
|
+
/**
|
|
94
|
+
* Decode the given ABI-encoded flush ERC1155 tokens data
|
|
95
|
+
* @param data The data to decode
|
|
96
|
+
* @param to The to address (contract address for v4+)
|
|
97
|
+
* @returns parsed flush data with forwarderAddress, tokenAddress, tokenId and forwarderVersion
|
|
98
|
+
*/
|
|
99
|
+
export declare function decodeFlushERC1155TokensData(data: string, to?: string): {
|
|
100
|
+
forwarderAddress: string;
|
|
101
|
+
tokenAddress: string;
|
|
102
|
+
tokenId: string;
|
|
103
|
+
forwarderVersion?: number;
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Returns the create forwarder method calling data
|
|
107
|
+
*
|
|
108
|
+
* @returns {string} - the createForwarder method encoded
|
|
109
|
+
*/
|
|
110
|
+
export declare function getAddressInitializationData(): string;
|
|
111
|
+
/**
|
|
112
|
+
* Returns whether or not the string is a valid Eth address
|
|
113
|
+
*
|
|
114
|
+
* @param {string} address - the tx hash to validate
|
|
115
|
+
* @returns {boolean} - the validation result
|
|
116
|
+
*/
|
|
117
|
+
export declare function isValidEthAddress(address: string): boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Returns whether or not the string is a valid amount number
|
|
120
|
+
*
|
|
121
|
+
* @param {string} amount - the string to validate
|
|
122
|
+
* @returns {boolean} - the validation result
|
|
123
|
+
*/
|
|
124
|
+
export declare function isValidAmount(amount: string): boolean;
|
|
125
|
+
/**
|
|
126
|
+
* Returns the smart contract encoded data
|
|
127
|
+
*
|
|
128
|
+
* @param {string} data The wallet creation data to decode
|
|
129
|
+
* @returns {string[]} - The list of signer addresses
|
|
130
|
+
*/
|
|
131
|
+
export declare function decodeWalletCreationData(data: string): WalletInitializationData;
|
|
132
|
+
/**
|
|
133
|
+
* Decode the given ABI-encoded transfer data and return parsed fields
|
|
134
|
+
*
|
|
135
|
+
* @param data The data to decode
|
|
136
|
+
* @param isFirstSigner whether transaction is being built for a first signer
|
|
137
|
+
* @returns parsed transfer data
|
|
138
|
+
*/
|
|
139
|
+
export declare function decodeTransferData(data: string, isFirstSigner?: boolean): TransferData;
|
|
140
|
+
/**
|
|
141
|
+
* Decode the given ABI-encoded transfer data for the sendMultisigToken function and return parsed fields
|
|
142
|
+
*
|
|
143
|
+
* @param data The data to decode
|
|
144
|
+
* @param isFirstSigner whether transaction is being built for a first signer
|
|
145
|
+
* @returns parsed token transfer data
|
|
146
|
+
*/
|
|
147
|
+
export declare function decodeTokenTransferData(data: string, isFirstSigner?: boolean): TokenTransferData;
|
|
148
|
+
export declare function decodeERC721TransferData(data: string): ERC721TransferData;
|
|
149
|
+
export declare function decodeERC1155TransferData(data: string): ERC1155TransferData;
|
|
150
|
+
/**
|
|
151
|
+
* Decode the given ABI-encoded transfer data for the sendMultisig function and return parsed fields
|
|
152
|
+
*
|
|
153
|
+
* @param data The data to decode
|
|
154
|
+
* @param isFirstSigner whether transaction is being built for a first signer
|
|
155
|
+
* @returns parsed transfer data
|
|
156
|
+
*/
|
|
157
|
+
export declare function decodeNativeTransferData(data: string, isFirstSigner?: boolean): NativeTransferData;
|
|
158
|
+
/**
|
|
159
|
+
* Decode the given ABI-encoded flush tokens data and return parsed fields
|
|
160
|
+
*
|
|
161
|
+
* @param data The data to decode
|
|
162
|
+
* @param to Optional to parameter of tx
|
|
163
|
+
* @returns parsed transfer data
|
|
164
|
+
*/
|
|
165
|
+
export declare function decodeFlushTokensData(data: string, to?: string): FlushTokensData;
|
|
166
|
+
/**
|
|
167
|
+
* Classify the given transaction data based as a transaction type.
|
|
168
|
+
* ETH transactions are defined by the first 8 bytes of the transaction data, also known as the method id
|
|
169
|
+
*
|
|
170
|
+
* @param {string} data The data to classify the transaction with
|
|
171
|
+
* @returns {TransactionType} The classified transaction type
|
|
172
|
+
*/
|
|
173
|
+
export declare function classifyTransaction(data: string): TransactionType;
|
|
174
|
+
/**
|
|
175
|
+
*
|
|
176
|
+
* @param {number} num number to be converted to hex
|
|
177
|
+
* @returns {string} the hex number
|
|
178
|
+
*/
|
|
179
|
+
export declare function numberToHexString(num: number): string;
|
|
180
|
+
/**
|
|
181
|
+
*
|
|
182
|
+
* @param {string} hex The hex string to be converted
|
|
183
|
+
* @returns {number} the resulting number
|
|
184
|
+
*/
|
|
185
|
+
export declare function hexStringToNumber(hex: string): number;
|
|
186
|
+
/**
|
|
187
|
+
* Generates an address of the forwarder address to be deployed
|
|
188
|
+
*
|
|
189
|
+
* @param {string} contractAddress the address which is creating this new address
|
|
190
|
+
* @param {number} contractCounter the nonce of the contract address
|
|
191
|
+
* @returns {string} the calculated forwarder contract address
|
|
192
|
+
*/
|
|
193
|
+
export declare function calculateForwarderAddress(contractAddress: string, contractCounter: number): string;
|
|
194
|
+
/**
|
|
195
|
+
* Calculate the forwarder v1 address that will be generated if `creatorAddress` creates it with salt `salt`
|
|
196
|
+
* and initcode `inicode using the create2 opcode
|
|
197
|
+
* @param {string} creatorAddress The address that is sending the tx to create a new address, hex string
|
|
198
|
+
* @param {string} salt The salt to create the address with using create2, hex string
|
|
199
|
+
* @param {string} initcode The initcode that will be deployed to the address, hex string
|
|
200
|
+
* @return {string} The calculated address
|
|
201
|
+
*/
|
|
202
|
+
export declare function calculateForwarderV1Address(creatorAddress: string, salt: string, initcode: string): string;
|
|
203
|
+
/**
|
|
204
|
+
* Take the implementation address for the proxy contract, and get the binary initcode for the associated proxy
|
|
205
|
+
* @param {string} implementationAddress The address of the implementation contract for the proxy
|
|
206
|
+
* @return {string} Binary hex string of the proxy
|
|
207
|
+
*/
|
|
208
|
+
export declare function getProxyInitcode(implementationAddress: string): string;
|
|
209
|
+
/**
|
|
210
|
+
* Convert the given signature parts to a string representation
|
|
211
|
+
*
|
|
212
|
+
* @param {SignatureParts} sig The signature to convert to string
|
|
213
|
+
* @returns {string} String representation of the signature
|
|
214
|
+
*/
|
|
215
|
+
export declare function toStringSig(sig: SignatureParts): string;
|
|
216
|
+
/**
|
|
217
|
+
* Return whether or not the given tx data has a signature
|
|
218
|
+
*
|
|
219
|
+
* @param {TxData} txData The transaction data to check for signature
|
|
220
|
+
* @returns {boolean} true if the tx has a signature, else false
|
|
221
|
+
*/
|
|
222
|
+
export declare function hasSignature(txData: TxData): boolean;
|
|
223
|
+
type RecursiveBufferOrString = string | Buffer | BN | RecursiveBufferOrString[];
|
|
224
|
+
/**
|
|
225
|
+
* Get the raw data decoded for some types
|
|
226
|
+
*
|
|
227
|
+
* @param {string[]} types ABI types definition
|
|
228
|
+
* @param {Buffer} serializedArgs encoded args
|
|
229
|
+
* @returns {Buffer[]} the decoded raw
|
|
230
|
+
*/
|
|
231
|
+
export declare function getRawDecoded(types: string[], serializedArgs: Buffer): RecursiveBufferOrString[];
|
|
232
|
+
/**
|
|
233
|
+
* Get the buffered bytecode from rawData using a methodId as delimiter
|
|
234
|
+
*
|
|
235
|
+
* @param {string} methodId the hex encoded method Id
|
|
236
|
+
* @param {string} rawData the hex encoded raw data
|
|
237
|
+
* @returns {Buffer} data buffered bytecode
|
|
238
|
+
*/
|
|
239
|
+
export declare function getBufferedByteCode(methodId: string, rawData: string): Buffer;
|
|
240
|
+
/**
|
|
241
|
+
* Get the statics coin object matching a given contract address if it exists
|
|
242
|
+
*
|
|
243
|
+
* @param tokenContractAddress The contract address to match against
|
|
244
|
+
* @param network - the coin network
|
|
245
|
+
* @param family - the coin family
|
|
246
|
+
* @returns statics BaseCoin object for the matching token
|
|
247
|
+
*/
|
|
248
|
+
export declare function getToken(tokenContractAddress: string, network: BaseNetwork, family: string): Readonly<BaseCoin> | undefined;
|
|
249
|
+
/**
|
|
250
|
+
* Returns the create wallet method calling data for v1 wallets
|
|
251
|
+
*
|
|
252
|
+
* @param {string[]} walletOwners - wallet owner addresses for wallet initialization transactions
|
|
253
|
+
* @param {string} salt - The salt for wallet initialization transactions
|
|
254
|
+
* @returns {string} - the createWallet method encoded
|
|
255
|
+
*/
|
|
256
|
+
export declare function getV1WalletInitializationData(walletOwners: string[], salt: string): string;
|
|
257
|
+
/**
|
|
258
|
+
* Returns the create address method calling data for v1, v2, v4 forwarders
|
|
259
|
+
*
|
|
260
|
+
* @param {string} baseAddress - The address of the wallet contract
|
|
261
|
+
* @param {string} salt - The salt for address initialization transactions
|
|
262
|
+
* @param {string} feeAddress - The fee address for the enterprise
|
|
263
|
+
* @returns {string} - the createForwarder method encoded
|
|
264
|
+
*/
|
|
265
|
+
export declare function getV1AddressInitializationData(baseAddress: string, salt: string, feeAddress?: string): string;
|
|
266
|
+
/**
|
|
267
|
+
* Returns the create address method calling data for all forwarder versions
|
|
268
|
+
*
|
|
269
|
+
* @param {number} forwarderVersion - The version of the forwarder to create
|
|
270
|
+
* @param {string} baseAddress - The address of the wallet contract
|
|
271
|
+
* @param {string} salt - The salt for address initialization transactions
|
|
272
|
+
* @param {string} feeAddress - The fee address for the enterprise
|
|
273
|
+
* @returns {string} - the createForwarder method encoded
|
|
274
|
+
*
|
|
275
|
+
*/
|
|
276
|
+
export declare function getAddressInitDataAllForwarderVersions(forwarderVersion: number, baseAddress: string, salt: string, feeAddress?: string): string;
|
|
277
|
+
/**
|
|
278
|
+
* Returns the createForwarderTypes and createForwarderParams for all forwarder versions
|
|
279
|
+
*
|
|
280
|
+
* @param {string} baseAddress - The address of the wallet contract
|
|
281
|
+
* @param {Buffer} saltBuffer - The salt for address initialization transaction
|
|
282
|
+
* @param {string} feeAddress - The fee address for the enterprise
|
|
283
|
+
* @returns {createForwarderParams: (string | Buffer)[], createForwarderTypes: string[]}
|
|
284
|
+
*/
|
|
285
|
+
export declare function getCreateForwarderParamsAndTypes(baseAddress: string, saltBuffer: Buffer, feeAddress?: string): {
|
|
286
|
+
createForwarderParams: (string | Buffer)[];
|
|
287
|
+
createForwarderTypes: string[];
|
|
288
|
+
};
|
|
289
|
+
/**
|
|
290
|
+
* Decode the given ABI-encoded create forwarder data and return parsed fields
|
|
291
|
+
*
|
|
292
|
+
* @param data The data to decode
|
|
293
|
+
* @returns parsed transfer data
|
|
294
|
+
*/
|
|
295
|
+
export declare function decodeForwarderCreationData(data: string): ForwarderInitializationData;
|
|
296
|
+
/**
|
|
297
|
+
* Make a query to explorer for information such as balance, token balance, solidity calls
|
|
298
|
+
* @param {Object} query key-value pairs of parameters to append after /api
|
|
299
|
+
* @param {string} token the API token to use for the request
|
|
300
|
+
* @param {string} explorerUrl the URL of the explorer
|
|
301
|
+
* @returns {Promise<Object>} response from explorer
|
|
302
|
+
*/
|
|
303
|
+
export declare function recoveryBlockchainExplorerQuery(query: Record<string, string>, explorerUrl: string, token?: string): Promise<Record<string, unknown>>;
|
|
304
|
+
/**
|
|
305
|
+
* Default expire time for a contract call (1 week)
|
|
306
|
+
* @returns {number} Time in seconds
|
|
307
|
+
*/
|
|
308
|
+
export declare function getDefaultExpireTime(): number;
|
|
309
|
+
export {};
|
|
310
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAehC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAsC,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEjH,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,MAAM,OAAO,CAAC;AAEvB,OAAO,EAKL,eAAe,EAKhB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,MAAM,EACN,wBAAwB,EACxB,2BAA2B,EAC5B,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA0CpC;;GAEG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,eAAe,GAAG,cAAc,CAWlE;AAED;;;;;;;;GAQG;AACH,wBAAsB,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