@bitgo-beta/abstract-eth 1.2.3-alpha.30 → 1.2.3-alpha.300

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 (91) hide show
  1. package/CHANGELOG.md +1601 -0
  2. package/dist/src/abstractEthLikeCoin.d.ts +14 -8
  3. package/dist/src/abstractEthLikeCoin.d.ts.map +1 -1
  4. package/dist/src/abstractEthLikeCoin.js +18 -15
  5. package/dist/src/abstractEthLikeNewCoins.d.ts +694 -0
  6. package/dist/src/abstractEthLikeNewCoins.d.ts.map +1 -0
  7. package/dist/src/abstractEthLikeNewCoins.js +2043 -0
  8. package/dist/src/ethLikeToken.d.ts +36 -6
  9. package/dist/src/ethLikeToken.d.ts.map +1 -1
  10. package/dist/src/ethLikeToken.js +285 -10
  11. package/dist/src/index.d.ts +2 -0
  12. package/dist/src/index.d.ts.map +1 -1
  13. package/dist/src/index.js +8 -2
  14. package/dist/src/lib/contractCall.d.ts +8 -0
  15. package/dist/src/lib/contractCall.d.ts.map +1 -0
  16. package/dist/src/lib/contractCall.js +17 -0
  17. package/dist/src/lib/iface.d.ts +132 -0
  18. package/dist/src/lib/iface.d.ts.map +1 -0
  19. package/dist/src/lib/iface.js +8 -0
  20. package/dist/src/lib/index.d.ts +15 -0
  21. package/dist/src/lib/index.d.ts.map +1 -0
  22. package/dist/src/lib/index.js +56 -0
  23. package/dist/src/lib/keyPair.d.ts +26 -0
  24. package/dist/src/lib/keyPair.d.ts.map +1 -0
  25. package/dist/src/lib/keyPair.js +65 -0
  26. package/dist/src/lib/transaction.d.ts +64 -0
  27. package/dist/src/lib/transaction.d.ts.map +1 -0
  28. package/dist/src/lib/transaction.js +137 -0
  29. package/dist/src/lib/transactionBuilder.d.ts +249 -0
  30. package/dist/src/lib/transactionBuilder.d.ts.map +1 -0
  31. package/dist/src/lib/transactionBuilder.js +741 -0
  32. package/dist/src/lib/transferBuilder.d.ts +73 -0
  33. package/dist/src/lib/transferBuilder.d.ts.map +1 -0
  34. package/dist/src/lib/transferBuilder.js +293 -0
  35. package/dist/src/lib/transferBuilders/baseNFTTransferBuilder.d.ts +54 -0
  36. package/dist/src/lib/transferBuilders/baseNFTTransferBuilder.d.ts.map +1 -0
  37. package/dist/src/lib/transferBuilders/baseNFTTransferBuilder.js +120 -0
  38. package/dist/src/lib/transferBuilders/index.d.ts +4 -0
  39. package/dist/src/lib/transferBuilders/index.d.ts.map +1 -0
  40. package/dist/src/lib/transferBuilders/index.js +20 -0
  41. package/dist/src/lib/transferBuilders/transferBuilderERC1155.d.ts +16 -0
  42. package/dist/src/lib/transferBuilders/transferBuilderERC1155.d.ts.map +1 -0
  43. package/dist/src/lib/transferBuilders/transferBuilderERC1155.js +93 -0
  44. package/dist/src/lib/transferBuilders/transferBuilderERC721.d.ts +15 -0
  45. package/dist/src/lib/transferBuilders/transferBuilderERC721.d.ts.map +1 -0
  46. package/dist/src/lib/transferBuilders/transferBuilderERC721.js +78 -0
  47. package/dist/src/lib/types.d.ts +39 -0
  48. package/dist/src/lib/types.d.ts.map +1 -0
  49. package/dist/src/lib/types.js +137 -0
  50. package/dist/src/lib/utils.d.ts +267 -0
  51. package/dist/src/lib/utils.d.ts.map +1 -0
  52. package/dist/src/lib/utils.js +688 -0
  53. package/dist/src/lib/walletUtil.d.ts +30 -0
  54. package/dist/src/lib/walletUtil.d.ts.map +1 -0
  55. package/dist/src/lib/walletUtil.js +33 -0
  56. package/dist/src/types.d.ts +9 -0
  57. package/dist/src/types.d.ts.map +1 -0
  58. package/dist/src/types.js +3 -0
  59. package/dist/test/index.d.ts +2 -0
  60. package/dist/test/index.d.ts.map +1 -0
  61. package/dist/test/index.js +18 -0
  62. package/dist/test/unit/coin.d.ts +8 -0
  63. package/dist/test/unit/coin.d.ts.map +1 -0
  64. package/dist/test/unit/coin.js +577 -0
  65. package/dist/test/unit/index.d.ts +5 -0
  66. package/dist/test/unit/index.d.ts.map +1 -0
  67. package/dist/test/unit/index.js +21 -0
  68. package/dist/test/unit/token.d.ts +2 -0
  69. package/dist/test/unit/token.d.ts.map +1 -0
  70. package/dist/test/unit/token.js +37 -0
  71. package/dist/test/unit/transaction.d.ts +3 -0
  72. package/dist/test/unit/transaction.d.ts.map +1 -0
  73. package/dist/test/unit/transaction.js +60 -0
  74. package/dist/test/unit/transactionBuilder/addressInitialization.d.ts +8 -0
  75. package/dist/test/unit/transactionBuilder/addressInitialization.d.ts.map +1 -0
  76. package/dist/test/unit/transactionBuilder/addressInitialization.js +95 -0
  77. package/dist/test/unit/transactionBuilder/index.d.ts +4 -0
  78. package/dist/test/unit/transactionBuilder/index.d.ts.map +1 -0
  79. package/dist/test/unit/transactionBuilder/index.js +20 -0
  80. package/dist/test/unit/transactionBuilder/send.d.ts +3 -0
  81. package/dist/test/unit/transactionBuilder/send.d.ts.map +1 -0
  82. package/dist/test/unit/transactionBuilder/send.js +197 -0
  83. package/dist/test/unit/transactionBuilder/walletInitialization.d.ts +10 -0
  84. package/dist/test/unit/transactionBuilder/walletInitialization.d.ts.map +1 -0
  85. package/dist/test/unit/transactionBuilder/walletInitialization.js +124 -0
  86. package/dist/test/unit/transferBuilder.d.ts +2 -0
  87. package/dist/test/unit/transferBuilder.d.ts.map +1 -0
  88. package/dist/test/unit/transferBuilder.js +76 -0
  89. package/dist/tsconfig.tsbuildinfo +1 -8234
  90. package/index.ts +2 -0
  91. package/package.json +29 -9
@@ -0,0 +1,694 @@
1
+ /**
2
+ * @prettier
3
+ */
4
+ import { AddressCoinSpecific, PresignTransactionOptions as BasePresignTransactionOptions, SignTransactionOptions as BaseSignTransactionOptions, TransactionPrebuild as BaseTransactionPrebuild, VerifyAddressOptions as BaseVerifyAddressOptions, BitGoBase, BuildNftTransferDataOptions, FeeEstimateOptions, FullySignedTransaction, HalfSignedTransaction, IWallet, KeyPair, MPCSweepRecoveryOptions, MPCTxs, ParsedTransaction, ParseTransactionOptions, PrebuildTransactionResult, Recipient, TransactionParams, TransactionRecipient, TypedData, UnsignedTransactionTss, VerifyTransactionOptions, Wallet } from '@bitgo-beta/sdk-core';
5
+ import { EthereumNetwork as EthLikeNetwork, BaseCoin as StaticsBaseCoin } from '@bitgo-beta/statics';
6
+ import type * as EthLikeCommon from '@ethereumjs/common';
7
+ import type * as EthLikeTxLib from '@ethereumjs/tx';
8
+ import BN from 'bn.js';
9
+ import { AbstractEthLikeCoin } from './abstractEthLikeCoin';
10
+ import { SendCrossChainRecoveryOptions } from './types';
11
+ /**
12
+ * The prebuilt hop transaction returned from the HSM
13
+ */
14
+ interface HopPrebuild {
15
+ tx: string;
16
+ id: string;
17
+ signature: string;
18
+ paymentId: string;
19
+ gasPrice: number;
20
+ gasLimit: number;
21
+ amount: number;
22
+ recipient: string;
23
+ nonce: number;
24
+ userReqSig: string;
25
+ gasPriceMax: number;
26
+ }
27
+ /**
28
+ * The extra parameters to send to platform build route for hop transactions
29
+ */
30
+ interface HopParams {
31
+ hopParams: {
32
+ gasPriceMax: number;
33
+ userReqSig: string;
34
+ paymentId: string;
35
+ gasLimit: number;
36
+ };
37
+ }
38
+ export interface EIP1559 {
39
+ maxPriorityFeePerGas: number;
40
+ maxFeePerGas: number;
41
+ }
42
+ export interface ReplayProtectionOptions {
43
+ chain: string | number;
44
+ hardfork: string;
45
+ }
46
+ export interface TransactionPrebuild extends BaseTransactionPrebuild {
47
+ hopTransaction?: HopPrebuild;
48
+ buildParams: {
49
+ recipients: Recipient[];
50
+ };
51
+ recipients: TransactionRecipient[];
52
+ nextContractSequenceId: number;
53
+ gasPrice: number;
54
+ gasLimit: number;
55
+ isBatch: boolean;
56
+ coin: string;
57
+ token?: string;
58
+ }
59
+ export interface SignFinalOptions {
60
+ txPrebuild: {
61
+ eip1559?: EIP1559;
62
+ replayProtectionOptions?: ReplayProtectionOptions;
63
+ gasPrice?: string;
64
+ gasLimit?: string;
65
+ recipients?: Recipient[];
66
+ halfSigned?: {
67
+ expireTime: number;
68
+ contractSequenceId: number;
69
+ backupKeyNonce?: number;
70
+ signature: string;
71
+ txHex?: string;
72
+ };
73
+ nextContractSequenceId?: number;
74
+ hopTransaction?: string;
75
+ backupKeyNonce?: number;
76
+ isBatch?: boolean;
77
+ txHex?: string;
78
+ expireTime?: number;
79
+ };
80
+ signingKeyNonce?: number;
81
+ walletContractAddress?: string;
82
+ prv: string;
83
+ recipients?: Recipient[];
84
+ common?: EthLikeCommon.default;
85
+ }
86
+ export interface SignTransactionOptions extends BaseSignTransactionOptions, SignFinalOptions {
87
+ isLastSignature?: boolean;
88
+ expireTime?: number;
89
+ sequenceId?: number;
90
+ gasLimit?: number;
91
+ gasPrice?: number;
92
+ custodianTransactionId?: string;
93
+ common?: EthLikeCommon.default;
94
+ walletVersion?: number;
95
+ }
96
+ export type SignedTransaction = HalfSignedTransaction | FullySignedTransaction;
97
+ export interface FeesUsed {
98
+ gasPrice: number;
99
+ gasLimit: number;
100
+ }
101
+ interface PrecreateBitGoOptions {
102
+ enterprise?: string;
103
+ newFeeAddress?: string;
104
+ }
105
+ export interface OfflineVaultTxInfo {
106
+ nextContractSequenceId?: string;
107
+ contractSequenceId?: string;
108
+ tx?: string;
109
+ txHex?: string;
110
+ userKey?: string;
111
+ backupKey?: string;
112
+ coin: string;
113
+ gasPrice: number;
114
+ gasLimit: number;
115
+ recipients: Recipient[];
116
+ walletContractAddress: string;
117
+ amount: string;
118
+ backupKeyNonce: number;
119
+ eip1559?: EIP1559;
120
+ replayProtectionOptions?: ReplayProtectionOptions;
121
+ halfSigned?: HalfSignedTransaction;
122
+ feesUsed?: FeesUsed;
123
+ isEvmBasedCrossChainRecovery?: boolean;
124
+ walletVersion?: number;
125
+ }
126
+ interface UnformattedTxInfo {
127
+ recipient: Recipient;
128
+ }
129
+ export type UnsignedSweepTxMPCv2 = {
130
+ txRequests: {
131
+ transactions: [
132
+ {
133
+ unsignedTx: UnsignedTransactionTss;
134
+ nonce: number;
135
+ signatureShares: [];
136
+ }
137
+ ];
138
+ walletCoin: string;
139
+ }[];
140
+ };
141
+ export type RecoverOptionsWithBytes = {
142
+ isTss: true;
143
+ /**
144
+ * @deprecated this is no longer used
145
+ */
146
+ openSSLBytes?: Uint8Array;
147
+ };
148
+ export type NonTSSRecoverOptions = {
149
+ isTss?: false | undefined;
150
+ };
151
+ export type TSSRecoverOptions = RecoverOptionsWithBytes | NonTSSRecoverOptions;
152
+ export type RecoverOptions = {
153
+ userKey: string;
154
+ backupKey: string;
155
+ walletPassphrase?: string;
156
+ walletContractAddress: string;
157
+ recoveryDestination: string;
158
+ krsProvider?: string;
159
+ gasPrice?: number;
160
+ gasLimit?: number;
161
+ eip1559?: EIP1559;
162
+ replayProtectionOptions?: ReplayProtectionOptions;
163
+ bitgoFeeAddress?: string;
164
+ bitgoDestinationAddress?: string;
165
+ tokenContractAddress?: string;
166
+ intendedChain?: string;
167
+ common?: EthLikeCommon.default;
168
+ derivationSeed?: string;
169
+ } & TSSRecoverOptions;
170
+ export type GetBatchExecutionInfoRT = {
171
+ values: [string[], string[]];
172
+ totalAmount: string;
173
+ };
174
+ export interface BuildTransactionParams {
175
+ to: string;
176
+ nonce?: number;
177
+ value: number;
178
+ data?: Buffer;
179
+ gasPrice?: number;
180
+ gasLimit?: number;
181
+ eip1559?: EIP1559;
182
+ replayProtectionOptions?: ReplayProtectionOptions;
183
+ }
184
+ export interface RecoveryInfo {
185
+ id: string;
186
+ tx: string;
187
+ backupKey?: string;
188
+ coin?: string;
189
+ }
190
+ export interface RecoverTokenTransaction {
191
+ halfSigned: {
192
+ recipient: Recipient;
193
+ expireTime: number;
194
+ contractSequenceId: number;
195
+ operationHash: string;
196
+ signature: string;
197
+ gasLimit: number;
198
+ gasPrice: number;
199
+ tokenContractAddress: string;
200
+ walletId: string;
201
+ };
202
+ }
203
+ export interface RecoverTokenOptions {
204
+ tokenContractAddress: string;
205
+ wallet: Wallet;
206
+ recipient: string;
207
+ broadcast?: boolean;
208
+ walletPassphrase?: string;
209
+ prv?: string;
210
+ }
211
+ export interface GetSendMethodArgsOptions {
212
+ recipient: Recipient;
213
+ expireTime: number;
214
+ contractSequenceId: number;
215
+ signature: string;
216
+ }
217
+ export interface SendMethodArgs {
218
+ name: string;
219
+ type: string;
220
+ value: any;
221
+ }
222
+ interface HopTransactionBuildOptions {
223
+ wallet: Wallet;
224
+ recipients: Recipient[];
225
+ walletPassphrase: string;
226
+ }
227
+ export interface BuildOptions {
228
+ hop?: boolean;
229
+ wallet?: Wallet;
230
+ recipients?: Recipient[];
231
+ walletPassphrase?: string;
232
+ [index: string]: unknown;
233
+ }
234
+ interface FeeEstimate {
235
+ gasLimitEstimate: number;
236
+ feeEstimate: number;
237
+ }
238
+ interface EthTransactionParams extends TransactionParams {
239
+ gasPrice?: number;
240
+ gasLimit?: number;
241
+ hopParams?: HopParams;
242
+ hop?: boolean;
243
+ prebuildTx?: PrebuildTransactionResult;
244
+ }
245
+ interface VerifyEthTransactionOptions extends VerifyTransactionOptions {
246
+ txPrebuild: TransactionPrebuild;
247
+ txParams: EthTransactionParams;
248
+ }
249
+ interface PresignTransactionOptions extends TransactionPrebuild, BasePresignTransactionOptions {
250
+ wallet: Wallet;
251
+ }
252
+ interface EthAddressCoinSpecifics extends AddressCoinSpecific {
253
+ forwarderVersion: number;
254
+ salt?: string;
255
+ }
256
+ export interface VerifyEthAddressOptions extends BaseVerifyAddressOptions {
257
+ baseAddress: string;
258
+ coinSpecific: EthAddressCoinSpecifics;
259
+ forwarderVersion: number;
260
+ }
261
+ export declare const optionalDeps: {
262
+ readonly ethAbi: any;
263
+ readonly ethUtil: any;
264
+ readonly EthTx: typeof EthLikeTxLib;
265
+ readonly EthCommon: typeof EthLikeCommon;
266
+ };
267
+ export declare abstract class AbstractEthLikeNewCoins extends AbstractEthLikeCoin {
268
+ static hopTransactionSalt: string;
269
+ protected readonly sendMethodName: 'sendMultiSig' | 'sendMultiSigToken';
270
+ readonly staticsCoin?: Readonly<StaticsBaseCoin>;
271
+ protected constructor(bitgo: BitGoBase, staticsCoin?: Readonly<StaticsBaseCoin>);
272
+ /**
273
+ * Method to return the coin's network object
274
+ * @returns {EthLikeNetwork | undefined}
275
+ */
276
+ getNetwork(): EthLikeNetwork | undefined;
277
+ /**
278
+ * Evaluates whether an address string is valid for this coin
279
+ * @param {string} address
280
+ * @returns {boolean} True if address is the valid ethlike adderss
281
+ */
282
+ isValidAddress(address: string): boolean;
283
+ /**
284
+ * Flag for sending data along with transactions
285
+ * @returns {boolean} True if okay to send tx data (ETH), false otherwise
286
+ */
287
+ transactionDataAllowed(): boolean;
288
+ /**
289
+ * Default expire time for a contract call (1 week)
290
+ * @returns {number} Time in seconds
291
+ */
292
+ getDefaultExpireTime(): number;
293
+ /**
294
+ * Method to get the custom chain common object based on params from recovery
295
+ * @param {number} chainId - the chain id of the custom chain
296
+ * @returns {EthLikeCommon.default}
297
+ */
298
+ static getCustomChainCommon(chainId: number): EthLikeCommon.default;
299
+ /**
300
+ * Gets correct Eth Common object based on params from either recovery or tx building
301
+ * @param {EIP1559} eip1559 - configs that specify whether we should construct an eip1559 tx
302
+ * @param {ReplayProtectionOptions} replayProtectionOptions - check if chain id supports replay protection
303
+ * @returns {EthLikeCommon.default}
304
+ */
305
+ private static getEthLikeCommon;
306
+ /**
307
+ * Method to build the tx object
308
+ * @param {BuildTransactionParams} params - params to build transaction
309
+ * @returns {EthLikeTxLib.FeeMarketEIP1559Transaction | EthLikeTxLib.Transaction}
310
+ */
311
+ static buildTransaction(params: BuildTransactionParams): EthLikeTxLib.FeeMarketEIP1559Transaction | EthLikeTxLib.Transaction;
312
+ /**
313
+ * Query explorer for the balance of an address
314
+ * @param {String} address - the ETHLike address
315
+ * @returns {BigNumber} address balance
316
+ */
317
+ queryAddressBalance(address: string): Promise<any>;
318
+ /**
319
+ * @param {Recipient[]} recipients - the recipients of the transaction
320
+ * @param {number} expireTime - the expire time of the transaction
321
+ * @param {number} contractSequenceId - the contract sequence id of the transaction
322
+ * @returns {string}
323
+ */
324
+ getOperationSha3ForExecuteAndConfirm(recipients: Recipient[], expireTime: number, contractSequenceId: number): string;
325
+ /**
326
+ * Get transfer operation for coin
327
+ * @param {Recipient} recipient - recipient info
328
+ * @param {number} expireTime - expiry time
329
+ * @param {number} contractSequenceId - sequence id
330
+ * @returns {Array} operation array
331
+ */
332
+ getOperation(recipient: Recipient, expireTime: number, contractSequenceId: number): (string | Buffer)[][];
333
+ /**
334
+ * Queries the contract (via explorer API) for the next sequence ID
335
+ * @param {String} address - address of the contract
336
+ * @returns {Promise<Number>} sequence ID
337
+ */
338
+ querySequenceId(address: string): Promise<number>;
339
+ /**
340
+ * Recover an unsupported token from a BitGo multisig wallet
341
+ * This builds a half-signed transaction, for which there will be an admin route to co-sign and broadcast. Optionally
342
+ * the user can set params.broadcast = true and the half-signed tx will be sent to BitGo for cosigning and broadcasting
343
+ * @param {RecoverTokenOptions} params
344
+ * @param {Wallet} params.wallet - the wallet to recover the token from
345
+ * @param {string} params.tokenContractAddress - the contract address of the unsupported token
346
+ * @param {string} params.recipient - the destination address recovered tokens should be sent to
347
+ * @param {string} params.walletPassphrase - the wallet passphrase
348
+ * @param {string} params.prv - the xprv
349
+ * @param {boolean} params.broadcast - if true, we will automatically submit the half-signed tx to BitGo for cosigning and broadcasting
350
+ * @returns {Promise<RecoverTokenTransaction>}
351
+ */
352
+ recoverToken(params: RecoverTokenOptions): Promise<RecoverTokenTransaction>;
353
+ /**
354
+ * Ensure either enterprise or newFeeAddress is passed, to know whether to create new key or use enterprise key
355
+ * @param {PrecreateBitGoOptions} params
356
+ * @param {string} params.enterprise {String} the enterprise id to associate with this key
357
+ * @param {string} params.newFeeAddress {Boolean} create a new fee address (enterprise not needed in this case)
358
+ * @returns {void}
359
+ */
360
+ preCreateBitGo(params: PrecreateBitGoOptions): void;
361
+ /**
362
+ * Queries public block explorer to get the next ETHLike coin's nonce that should be used for the given ETH address
363
+ * @param {string} address
364
+ * @returns {Promise<number>}
365
+ */
366
+ getAddressNonce(address: string): Promise<number>;
367
+ /**
368
+ * Helper function for recover()
369
+ * This transforms the unsigned transaction information into a format the BitGo offline vault expects
370
+ * @param {UnformattedTxInfo} txInfo - tx info
371
+ * @param {EthLikeTxLib.Transaction | EthLikeTxLib.FeeMarketEIP1559Transaction} ethTx - the ethereumjs tx object
372
+ * @param {string} userKey - the user's key
373
+ * @param {string} backupKey - the backup key
374
+ * @param {Buffer} gasPrice - gas price for the tx
375
+ * @param {number} gasLimit - gas limit for the tx
376
+ * @param {EIP1559} eip1559 - eip1559 params
377
+ * @param {ReplayProtectionOptions} replayProtectionOptions - replay protection options
378
+ * @returns {Promise<OfflineVaultTxInfo>}
379
+ */
380
+ formatForOfflineVault(txInfo: UnformattedTxInfo, ethTx: EthLikeTxLib.Transaction | EthLikeTxLib.FeeMarketEIP1559Transaction, userKey: string, backupKey: string, gasPrice: Buffer, gasLimit: number, eip1559?: EIP1559, replayProtectionOptions?: ReplayProtectionOptions): Promise<OfflineVaultTxInfo>;
381
+ /**
382
+ * Helper function for recover()
383
+ * This transforms the unsigned transaction information into a format the BitGo offline vault expects
384
+ * @param {UnformattedTxInfo} txInfo - tx info
385
+ * @param {EthLikeTxLib.Transaction | EthLikeTxLib.FeeMarketEIP1559Transaction} ethTx - the ethereumjs tx object
386
+ * @param {string} userKey - the user's key
387
+ * @param {string} backupKey - the backup key
388
+ * @param {Buffer} gasPrice - gas price for the tx
389
+ * @param {number} gasLimit - gas limit for the tx
390
+ * @param {number} backupKeyNonce - the nonce of the backup key address
391
+ * @param {EIP1559} eip1559 - eip1559 params
392
+ * @param {ReplayProtectionOptions} replayProtectionOptions - replay protection options
393
+ * @returns {Promise<OfflineVaultTxInfo>}
394
+ */
395
+ formatForOfflineVaultTSS(txInfo: UnformattedTxInfo, ethTx: EthLikeTxLib.Transaction | EthLikeTxLib.FeeMarketEIP1559Transaction, userKey: string, backupKey: string, gasPrice: Buffer, gasLimit: number, backupKeyNonce: number, eip1559?: EIP1559, replayProtectionOptions?: ReplayProtectionOptions): OfflineVaultTxInfo;
396
+ /**
397
+ * Check whether the gas price passed in by user are within our max and min bounds
398
+ * If they are not set, set them to the defaults
399
+ * @param {number} userGasPrice - user defined gas price
400
+ * @returns {number} the gas price to use for this transaction
401
+ */
402
+ setGasPrice(userGasPrice?: number): number;
403
+ /**
404
+ * Check whether gas limit passed in by user are within our max and min bounds
405
+ * If they are not set, set them to the defaults
406
+ * @param {number} userGasLimit user defined gas limit
407
+ * @returns {number} the gas limit to use for this transaction
408
+ */
409
+ setGasLimit(userGasLimit?: number): number;
410
+ /**
411
+ * Helper function for signTransaction for the rare case that SDK is doing the second signature
412
+ * Note: we are expecting this to be called from the offline vault
413
+ * @param {SignFinalOptions.txPrebuild} params.txPrebuild
414
+ * @param {string} params.prv
415
+ * @returns {{txHex: string}}
416
+ */
417
+ signFinalEthLike(params: SignFinalOptions): Promise<FullySignedTransaction>;
418
+ /**
419
+ * Assemble half-sign prebuilt transaction
420
+ * @param {SignTransactionOptions} params
421
+ */
422
+ signTransaction(params: SignTransactionOptions): Promise<SignedTransaction>;
423
+ /**
424
+ * Method to validate recovery params
425
+ * @param {RecoverOptions} params
426
+ * @returns {void}
427
+ */
428
+ validateRecoveryParams(params: RecoverOptions): void;
429
+ /**
430
+ * Helper which Adds signatures to tx object and re-serializes tx
431
+ * @param {EthLikeCommon.default} ethCommon
432
+ * @param {EthLikeTxLib.FeeMarketEIP1559Transaction | EthLikeTxLib.Transaction} tx
433
+ * @param {ECDSAMethodTypes.Signature} signature
434
+ * @returns {EthLikeTxLib.FeeMarketEIP1559Transaction | EthLikeTxLib.Transaction}
435
+ */
436
+ private getSignedTxFromSignature;
437
+ /**
438
+ * Builds a funds recovery transaction without BitGo
439
+ * @param params
440
+ * @param {string} params.userKey - [encrypted] xprv
441
+ * @param {string} params.backupKey - [encrypted] xprv or xpub if the xprv is held by a KRS provider
442
+ * @param {string} params.walletPassphrase - used to decrypt userKey and backupKey
443
+ * @param {string} params.walletContractAddress - the ETH address of the wallet contract
444
+ * @param {string} params.krsProvider - necessary if backup key is held by KRS
445
+ * @param {string} params.recoveryDestination - target address to send recovered funds to
446
+ * @param {string} params.bitgoFeeAddress - wrong chain wallet fee address for evm based cross chain recovery txn
447
+ * @param {string} params.bitgoDestinationAddress - target bitgo address where fee will be sent for evm based cross chain recovery txn
448
+ */
449
+ recover(params: RecoverOptions): Promise<RecoveryInfo | OfflineVaultTxInfo | UnsignedSweepTxMPCv2>;
450
+ /**
451
+ * Builds a funds recovery transaction without BitGo for non-TSS transaction
452
+ * @param params
453
+ * @param {string} params.userKey [encrypted] xprv or xpub
454
+ * @param {string} params.backupKey [encrypted] xprv or xpub if the xprv is held by a KRS provider
455
+ * @param {string} params.walletPassphrase used to decrypt userKey and backupKey
456
+ * @param {string} params.walletContractAddress the EthLike address of the wallet contract
457
+ * @param {string} params.krsProvider necessary if backup key is held by KRS
458
+ * @param {string} params.recoveryDestination target address to send recovered funds to
459
+ * @param {string} params.bitgoFeeAddress wrong chain wallet fee address for evm based cross chain recovery txn
460
+ * @param {string} params.bitgoDestinationAddress target bitgo address where fee will be sent for evm based cross chain recovery txn
461
+ * @returns {Promise<RecoveryInfo | OfflineVaultTxInfo>}
462
+ */
463
+ protected recoverEthLike(params: RecoverOptions): Promise<RecoveryInfo | OfflineVaultTxInfo>;
464
+ sendCrossChainRecoveryTransaction(params: SendCrossChainRecoveryOptions): Promise<{
465
+ coin: string;
466
+ txHex?: string;
467
+ txid: string;
468
+ }>;
469
+ buildCrossChainRecoveryTransaction(recoveryId: string): Promise<{
470
+ coin: string;
471
+ txHex: string;
472
+ txid: string;
473
+ }>;
474
+ /**
475
+ * Builds a unsigned (for cold, custody wallet) or
476
+ * half-signed (for hot wallet) evm cross chain recovery transaction with
477
+ * same expected arguments as recover method.
478
+ * This helps recover funds from evm based wrong chain.
479
+ * @param {RecoverOptions} params
480
+ * @returns {Promise<RecoveryInfo | OfflineVaultTxInfo>}
481
+ */
482
+ protected recoverEthLikeforEvmBasedRecovery(params: RecoverOptions): Promise<RecoveryInfo | OfflineVaultTxInfo>;
483
+ /**
484
+ * Query explorer for the balance of an address for a token
485
+ * @param {string} tokenContractAddress - address where the token smart contract is hosted
486
+ * @param {string} walletContractAddress - address of the wallet
487
+ * @returns {BigNumber} token balaance in base units
488
+ */
489
+ queryAddressTokenBalance(tokenContractAddress: string, walletContractAddress: string): Promise<any>;
490
+ recoverEthLikeTokenforEvmBasedRecovery(params: RecoverOptions, bitgoFeeAddressNonce: number, gasLimit: any, gasPrice: any, userKey: any, userSigningKey: any): Promise<OfflineVaultTxInfo>;
491
+ /**
492
+ * Validate evm based cross chain recovery params
493
+ * @param params {RecoverOptions}
494
+ * @returns {void}
495
+ */
496
+ validateEvmBasedRecoveryParams(params: RecoverOptions): void;
497
+ /**
498
+ * Return types, values, and total amount in wei to send in a batch transaction, using the method signature
499
+ * `distributeBatch(address[], uint256[])`
500
+ * @param {Recipient[]} recipients - transaction recipients
501
+ * @returns {GetBatchExecutionInfoRT} information needed to execute the batch transaction
502
+ */
503
+ getBatchExecutionInfo(recipients: Recipient[]): GetBatchExecutionInfoRT;
504
+ /**
505
+ * Get the data required to make an ETH function call defined by the given types and values
506
+ *
507
+ * @param {string} functionName - The name of the function being called, e.g. transfer
508
+ * @param types The types of the function call in order
509
+ * @param values The values of the function call in order
510
+ * @return {Buffer} The combined data for the function call
511
+ */
512
+ getMethodCallData: (functionName: any, types: any, values: any) => Buffer<ArrayBuffer>;
513
+ /**
514
+ * Build arguments to call the send method on the wallet contract
515
+ * @param txInfo
516
+ */
517
+ getSendMethodArgs(txInfo: GetSendMethodArgsOptions): SendMethodArgs[];
518
+ /**
519
+ * Recovers a tx with TSS key shares
520
+ * same expected arguments as recover method, but with TSS key shares
521
+ */
522
+ protected recoverTSS(params: RecoverOptions): Promise<RecoveryInfo | OfflineVaultTxInfo | UnsignedSweepTxMPCv2>;
523
+ private getGasValues;
524
+ protected buildUnsignedSweepTxnTSS(params: RecoverOptions): Promise<OfflineVaultTxInfo | UnsignedSweepTxMPCv2>;
525
+ protected buildUnsignedSweepTxnMPCv2(params: RecoverOptions): Promise<UnsignedSweepTxMPCv2>;
526
+ createBroadcastableSweepTransaction(params: MPCSweepRecoveryOptions): Promise<MPCTxs>;
527
+ /**
528
+ * Method to validate recovery params
529
+ * @param {RecoverOptions} params
530
+ * @returns {void}
531
+ */
532
+ private validateUnsignedSweepTSSParams;
533
+ /**
534
+ * Helper function for recover()
535
+ * This transforms the unsigned transaction information into a format the BitGo offline vault expects
536
+ * @param {UnformattedTxInfo} txInfo - tx info
537
+ * @param {EthLikeTxLib.Transaction | EthLikeTxLib.FeeMarketEIP1559Transaction} ethTx - the ethereumjs tx object
538
+ * @param {string} derivationPath - the derivationPath
539
+ * @param {number} nonce - the nonce of the backup key address
540
+ * @param {Buffer} gasPrice - gas price for the tx
541
+ * @param {number} gasLimit - gas limit for the tx
542
+ * @param {EIP1559} eip1559 - eip1559 params
543
+ * @returns {Promise<OfflineVaultTxInfo>}
544
+ */
545
+ private buildTxRequestForOfflineVaultMPCv2;
546
+ private buildTssRecoveryTxn;
547
+ validateBalanceAndGetTxAmount(baseAddress: string, gasPrice: BN, gasLimit: BN): Promise<any>;
548
+ recoveryBlockchainExplorerQuery(query: Record<string, string>): Promise<any>;
549
+ /**
550
+ * Creates the extra parameters needed to build a hop transaction
551
+ * @param buildParams The original build parameters
552
+ * @returns extra parameters object to merge with the original build parameters object and send to the platform
553
+ */
554
+ createHopTransactionParams(buildParams: HopTransactionBuildOptions): Promise<HopParams>;
555
+ /**
556
+ * Validates that the hop prebuild from the HSM is valid and correct
557
+ * @param {IWallet} wallet - The wallet that the prebuild is for
558
+ * @param {HopPrebuild} hopPrebuild - The prebuild to validate
559
+ * @param {Object} originalParams - The original parameters passed to prebuildTransaction
560
+ * @param {Recipient[]} originalParams.recipients - The original recipients array
561
+ * @returns {void}
562
+ * @throws Error if The prebuild is invalid
563
+ */
564
+ validateHopPrebuild(wallet: IWallet, hopPrebuild: HopPrebuild, originalParams?: {
565
+ recipients: Recipient[];
566
+ }): Promise<void>;
567
+ /**
568
+ * Gets the hop digest for the user to sign. This is validated in the HSM to prove that the user requested this tx
569
+ * @param {string[]} paramsArr - The parameters to hash together for the digest
570
+ * @returns {Buffer}
571
+ */
572
+ static getHopDigest(paramsArr: string[]): Buffer;
573
+ /**
574
+ * Modify prebuild before sending it to the server. Add things like hop transaction params
575
+ * @param {BuildOptions} buildParams - The whitelisted parameters for this prebuild
576
+ * @param {boolean} buildParams.hop - True if this should prebuild a hop tx, else false
577
+ * @param {Recipient[]} buildParams.recipients - The recipients array of this transaction
578
+ * @param {Wallet} buildParams.wallet - The wallet sending this tx
579
+ * @param {string} buildParams.walletPassphrase - the passphrase for this wallet
580
+ * @returns {Promise<BuildOptions>}
581
+ */
582
+ getExtraPrebuildParams(buildParams: BuildOptions): Promise<BuildOptions>;
583
+ /**
584
+ * Modify prebuild after receiving it from the server. Add things like nlocktime
585
+ * @param {TransactionPrebuild} params - The prebuild to modify
586
+ * @returns {TransactionPrebuild} The modified prebuild
587
+ */
588
+ postProcessPrebuild(params: TransactionPrebuild): Promise<TransactionPrebuild>;
589
+ /**
590
+ * Coin-specific things done before signing a transaction, i.e. verification
591
+ * @param {PresignTransactionOptions} params
592
+ * @returns {Promise<PresignTransactionOptions>}
593
+ */
594
+ presignTransaction(params: PresignTransactionOptions): Promise<PresignTransactionOptions>;
595
+ /**
596
+ * Fetch fee estimate information from the server
597
+ * @param {Object} params - The params passed into the function
598
+ * @param {boolean} [params.hop] - True if we should estimate fee for a hop transaction
599
+ * @param {string} [params.recipient] - The recipient of the transaction to estimate a send to
600
+ * @param {string} [params.data] - The ETH tx data to estimate a send for
601
+ * @returns {Object} The fee info returned from the server
602
+ */
603
+ feeEstimate(params: FeeEstimateOptions): Promise<FeeEstimate>;
604
+ /**
605
+ * Generate secp256k1 key pair
606
+ *
607
+ * @param {Buffer} seed
608
+ * @returns {KeyPair} object with generated pub and prv
609
+ */
610
+ generateKeyPair(seed: Buffer): KeyPair;
611
+ parseTransaction(params: ParseTransactionOptions): Promise<ParsedTransaction>;
612
+ /**
613
+ * Make sure an address is a wallet address and throw an error if it's not.
614
+ * @param {Object} params
615
+ * @param {string} params.address - The derived address string on the network
616
+ * @param {Object} params.coinSpecific - Coin-specific details for the address such as a forwarderVersion
617
+ * @param {string} params.baseAddress - The base address of the wallet on the network
618
+ * @throws {InvalidAddressError}
619
+ * @throws {InvalidAddressVerificationObjectPropertyError}
620
+ * @throws {UnexpectedAddressError}
621
+ * @returns {boolean} True iff address is a wallet address
622
+ */
623
+ isWalletAddress(params: VerifyEthAddressOptions): Promise<boolean>;
624
+ /**
625
+ *
626
+ * @param {TransactionPrebuild} txPrebuild
627
+ * @returns {boolean}
628
+ */
629
+ verifyCoin(txPrebuild: TransactionPrebuild): boolean;
630
+ /**
631
+ * Verify if a tss transaction is valid
632
+ *
633
+ * @param {VerifyEthTransactionOptions} params
634
+ * @param {TransactionParams} params.txParams - params object passed to send
635
+ * @param {TransactionPrebuild} params.txPrebuild - prebuild object returned by server
636
+ * @param {Wallet} params.wallet - Wallet object to obtain keys to verify against
637
+ * @returns {boolean}
638
+ */
639
+ verifyTssTransaction(params: VerifyEthTransactionOptions): boolean;
640
+ /**
641
+ * Verify that a transaction prebuild complies with the original intention
642
+ *
643
+ * @param {VerifyEthTransactionOptions} params
644
+ * @param {TransactionParams} params.txParams - params object passed to send
645
+ * @param {TransactionPrebuild} params.txPrebuild - prebuild object returned by server
646
+ * @param {Wallet} params.wallet - Wallet object to obtain keys to verify against
647
+ * @returns {boolean}
648
+ */
649
+ verifyTransaction(params: VerifyEthTransactionOptions): Promise<boolean>;
650
+ /**
651
+ * Check if address is valid eth address
652
+ * @param address
653
+ * @returns {boolean}
654
+ */
655
+ private isETHAddress;
656
+ /**
657
+ * Transform message to accommodate specific blockchain requirements.
658
+ * @param {string} message - the message to prepare
659
+ * @return {string} the prepared message as a hex encoded string.
660
+ */
661
+ encodeMessage(message: string): string;
662
+ /**
663
+ * Transform the Typed data to accomodate the blockchain requirements (EIP-712)
664
+ * @param {TypedData} typedData - the typed data to prepare
665
+ * @return {Buffer} a buffer of the result
666
+ */
667
+ encodeTypedData(typedData: TypedData): Buffer;
668
+ /**
669
+ * Build the data to transfer an ERC-721 or ERC-1155 token to another address
670
+ * @param params
671
+ */
672
+ buildNftTransferData(params: BuildNftTransferDataOptions): string;
673
+ /**
674
+ * Fetch the gas price from the explorer
675
+ */
676
+ getGasPriceFromExternalAPI(wrongChainCoin: string): Promise<BN>;
677
+ /**
678
+ * Fetch the gas limit from the explorer
679
+ * @param intendedChain
680
+ * @param from
681
+ * @param to
682
+ * @param data
683
+ */
684
+ getGasLimitFromExternalAPI(intendedChain: string, from: string, to: string, data: string): Promise<BN>;
685
+ /**
686
+ * Get the balance of bitgoFeeAddress to ensure funds are available to pay fees
687
+ * @param bitgoFeeAddress
688
+ * @param gasPrice
689
+ * @param gasLimit
690
+ */
691
+ ensureSufficientBalance(bitgoFeeAddress: string, gasPrice: BN, gasLimit: BN): Promise<void>;
692
+ }
693
+ export {};
694
+ //# sourceMappingURL=abstractEthLikeNewCoins.d.ts.map