@bitgo-beta/sdk-coin-eth 4.4.1-beta.98 → 4.4.1-beta.980

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.
Files changed (67) hide show
  1. package/CHANGELOG.md +1460 -0
  2. package/dist/src/erc20Token.d.ts +13 -5
  3. package/dist/src/erc20Token.d.ts.map +1 -1
  4. package/dist/src/erc20Token.js +61 -23
  5. package/dist/src/eth.d.ts +22 -533
  6. package/dist/src/eth.d.ts.map +1 -1
  7. package/dist/src/eth.js +198 -1613
  8. package/dist/src/gteth.d.ts +0 -4
  9. package/dist/src/gteth.d.ts.map +1 -1
  10. package/dist/src/gteth.js +1 -11
  11. package/dist/src/hteth.d.ts +8 -0
  12. package/dist/src/hteth.d.ts.map +1 -0
  13. package/dist/src/hteth.js +14 -0
  14. package/dist/src/index.d.ts +1 -0
  15. package/dist/src/index.d.ts.map +1 -1
  16. package/dist/src/index.js +7 -2
  17. package/dist/src/lib/index.d.ts +5 -13
  18. package/dist/src/lib/index.d.ts.map +1 -1
  19. package/dist/src/lib/index.js +18 -30
  20. package/dist/src/lib/messages/index.d.ts +3 -0
  21. package/dist/src/lib/messages/index.d.ts.map +1 -0
  22. package/dist/src/lib/messages/index.js +6 -0
  23. package/dist/src/lib/transactionBuilder.d.ts +9 -213
  24. package/dist/src/lib/transactionBuilder.d.ts.map +1 -1
  25. package/dist/src/lib/transactionBuilder.js +18 -677
  26. package/dist/src/lib/transferBuilder.d.ts +2 -50
  27. package/dist/src/lib/transferBuilder.d.ts.map +1 -1
  28. package/dist/src/lib/transferBuilder.js +3 -199
  29. package/dist/src/lib/transferBuilders/index.d.ts +2 -3
  30. package/dist/src/lib/transferBuilders/index.d.ts.map +1 -1
  31. package/dist/src/lib/transferBuilders/index.js +6 -14
  32. package/dist/src/lib/walletUtil.d.ts +0 -25
  33. package/dist/src/lib/walletUtil.d.ts.map +1 -1
  34. package/dist/src/lib/walletUtil.js +2 -27
  35. package/dist/src/register.d.ts.map +1 -1
  36. package/dist/src/register.js +3 -1
  37. package/dist/src/teth.d.ts +0 -3
  38. package/dist/src/teth.d.ts.map +1 -1
  39. package/dist/src/teth.js +1 -8
  40. package/package.json +12 -17
  41. package/dist/src/lib/contractCall.d.ts +0 -8
  42. package/dist/src/lib/contractCall.d.ts.map +0 -1
  43. package/dist/src/lib/contractCall.js +0 -17
  44. package/dist/src/lib/iface.d.ts +0 -130
  45. package/dist/src/lib/iface.d.ts.map +0 -1
  46. package/dist/src/lib/iface.js +0 -8
  47. package/dist/src/lib/keyPair.d.ts +0 -26
  48. package/dist/src/lib/keyPair.d.ts.map +0 -1
  49. package/dist/src/lib/keyPair.js +0 -66
  50. package/dist/src/lib/transaction.d.ts +0 -64
  51. package/dist/src/lib/transaction.d.ts.map +0 -1
  52. package/dist/src/lib/transaction.js +0 -137
  53. package/dist/src/lib/transferBuilders/baseNFTTransferBuilder.d.ts +0 -47
  54. package/dist/src/lib/transferBuilders/baseNFTTransferBuilder.d.ts.map +0 -1
  55. package/dist/src/lib/transferBuilders/baseNFTTransferBuilder.js +0 -113
  56. package/dist/src/lib/transferBuilders/transferBuilderERC1155.d.ts +0 -14
  57. package/dist/src/lib/transferBuilders/transferBuilderERC1155.d.ts.map +0 -1
  58. package/dist/src/lib/transferBuilders/transferBuilderERC1155.js +0 -83
  59. package/dist/src/lib/transferBuilders/transferBuilderERC721.d.ts +0 -13
  60. package/dist/src/lib/transferBuilders/transferBuilderERC721.d.ts.map +0 -1
  61. package/dist/src/lib/transferBuilders/transferBuilderERC721.js +0 -68
  62. package/dist/src/lib/types.d.ts +0 -39
  63. package/dist/src/lib/types.d.ts.map +0 -1
  64. package/dist/src/lib/types.js +0 -137
  65. package/dist/src/lib/utils.d.ts +0 -227
  66. package/dist/src/lib/utils.d.ts.map +0 -1
  67. package/dist/src/lib/utils.js +0 -577
@@ -1,227 +0,0 @@
1
- /// <reference types="node" />
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): string;
61
- /**
62
- * Get the data required to make a flush native coins contract call
63
- */
64
- export declare function flushCoinsData(): string;
65
- /**
66
- * Returns the create forwarder method calling data
67
- *
68
- * @returns {string} - the createForwarder method encoded
69
- */
70
- export declare function getAddressInitializationData(): string;
71
- /**
72
- * Returns whether or not the string is a valid Eth address
73
- *
74
- * @param {string} address - the tx hash to validate
75
- * @returns {boolean} - the validation result
76
- */
77
- export declare function isValidEthAddress(address: string): boolean;
78
- /**
79
- * Returns whether or not the string is a valid amount number
80
- *
81
- * @param {string} amount - the string to validate
82
- * @returns {boolean} - the validation result
83
- */
84
- export declare function isValidAmount(amount: string): boolean;
85
- /**
86
- * Returns the smart contract encoded data
87
- *
88
- * @param {string} data The wallet creation data to decode
89
- * @returns {string[]} - The list of signer addresses
90
- */
91
- export declare function decodeWalletCreationData(data: string): WalletInitializationData;
92
- /**
93
- * Decode the given ABI-encoded transfer data and return parsed fields
94
- *
95
- * @param data The data to decode
96
- * @returns parsed transfer data
97
- */
98
- export declare function decodeTransferData(data: string): TransferData;
99
- /**
100
- * Decode the given ABI-encoded transfer data for the sendMultisigToken function and return parsed fields
101
- *
102
- * @param data The data to decode
103
- * @returns parsed token transfer data
104
- */
105
- export declare function decodeTokenTransferData(data: string): TokenTransferData;
106
- export declare function decodeERC721TransferData(data: string): ERC721TransferData;
107
- export declare function decodeERC1155TransferData(data: string): ERC1155TransferData;
108
- /**
109
- * Decode the given ABI-encoded transfer data for the sendMultisig function and return parsed fields
110
- *
111
- * @param data The data to decode
112
- * @returns parsed transfer data
113
- */
114
- export declare function decodeNativeTransferData(data: string): NativeTransferData;
115
- /**
116
- * Decode the given ABI-encoded flush tokens data and return parsed fields
117
- *
118
- * @param data The data to decode
119
- * @returns parsed transfer data
120
- */
121
- export declare function decodeFlushTokensData(data: string): FlushTokensData;
122
- /**
123
- * Classify the given transaction data based as a transaction type.
124
- * ETH transactions are defined by the first 8 bytes of the transaction data, also known as the method id
125
- *
126
- * @param {string} data The data to classify the transaction with
127
- * @returns {TransactionType} The classified transaction type
128
- */
129
- export declare function classifyTransaction(data: string): TransactionType;
130
- /**
131
- *
132
- * @param {number} num number to be converted to hex
133
- * @returns {string} the hex number
134
- */
135
- export declare function numberToHexString(num: number): string;
136
- /**
137
- *
138
- * @param {string} hex The hex string to be converted
139
- * @returns {number} the resulting number
140
- */
141
- export declare function hexStringToNumber(hex: string): number;
142
- /**
143
- * Generates an address of the forwarder address to be deployed
144
- *
145
- * @param {string} contractAddress the address which is creating this new address
146
- * @param {number} contractCounter the nonce of the contract address
147
- * @returns {string} the calculated forwarder contract address
148
- */
149
- export declare function calculateForwarderAddress(contractAddress: string, contractCounter: number): string;
150
- /**
151
- * Calculate the forwarder v1 address that will be generated if `creatorAddress` creates it with salt `salt`
152
- * and initcode `inicode using the create2 opcode
153
- * @param {string} creatorAddress The address that is sending the tx to create a new address, hex string
154
- * @param {string} salt The salt to create the address with using create2, hex string
155
- * @param {string} initcode The initcode that will be deployed to the address, hex string
156
- * @return {string} The calculated address
157
- */
158
- export declare function calculateForwarderV1Address(creatorAddress: string, salt: string, initcode: string): string;
159
- /**
160
- * Take the implementation address for the proxy contract, and get the binary initcode for the associated proxy
161
- * @param {string} implementationAddress The address of the implementation contract for the proxy
162
- * @return {string} Binary hex string of the proxy
163
- */
164
- export declare function getProxyInitcode(implementationAddress: string): string;
165
- /**
166
- * Convert the given signature parts to a string representation
167
- *
168
- * @param {SignatureParts} sig The signature to convert to string
169
- * @returns {string} String representation of the signature
170
- */
171
- export declare function toStringSig(sig: SignatureParts): string;
172
- /**
173
- * Return whether or not the given tx data has a signature
174
- *
175
- * @param {TxData} txData The transaction data to check for signature
176
- * @returns {boolean} true if the tx has a signature, else false
177
- */
178
- export declare function hasSignature(txData: TxData): boolean;
179
- declare type RecursiveBufferOrString = string | Buffer | BN | RecursiveBufferOrString[];
180
- /**
181
- * Get the raw data decoded for some types
182
- *
183
- * @param {string[]} types ABI types definition
184
- * @param {Buffer} serializedArgs encoded args
185
- * @returns {Buffer[]} the decoded raw
186
- */
187
- export declare function getRawDecoded(types: string[], serializedArgs: Buffer): RecursiveBufferOrString[];
188
- /**
189
- * Get the buffered bytecode from rawData using a methodId as delimiter
190
- *
191
- * @param {string} methodId the hex encoded method Id
192
- * @param {string} rawData the hex encoded raw data
193
- * @returns {Buffer} data buffered bytecode
194
- */
195
- export declare function getBufferedByteCode(methodId: string, rawData: string): Buffer;
196
- /**
197
- * Get the statics coin object matching a given contract address if it exists
198
- *
199
- * @param tokenContractAddress The contract address to match against
200
- * @returns statics BaseCoin object for the matching token
201
- */
202
- export declare function getToken(tokenContractAddress: string, network: BaseNetwork): Readonly<BaseCoin> | undefined;
203
- /**
204
- * Returns the create wallet method calling data for v1 wallets
205
- *
206
- * @param {string[]} walletOwners - wallet owner addresses for wallet initialization transactions
207
- * @param {string} salt - The salt for wallet initialization transactions
208
- * @returns {string} - the createWallet method encoded
209
- */
210
- export declare function getV1WalletInitializationData(walletOwners: string[], salt: string): string;
211
- /**
212
- * Returns the create address method calling data for v1 wallets
213
- *
214
- * @param {string} baseAddress - The address of the wallet contract
215
- * @param {string} salt - The salt for address initialization transactions
216
- * @returns {string} - the createForwarder method encoded
217
- */
218
- export declare function getV1AddressInitializationData(baseAddress: string, salt: string): string;
219
- /**
220
- * Decode the given ABI-encoded create forwarder data and return parsed fields
221
- *
222
- * @param data The data to decode
223
- * @returns parsed transfer data
224
- */
225
- export declare function decodeForwarderCreationData(data: string): ForwarderInitializationData;
226
- export {};
227
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/lib/utils.ts"],"names":[],"mappings":";AAcA,OAAO,EAAE,QAAQ,EAAE,WAAW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