@bitgo-beta/abstract-eth 1.2.3-alpha.32 → 1.2.3-alpha.320

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 +1624 -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 +695 -0
  6. package/dist/src/abstractEthLikeNewCoins.d.ts.map +1 -0
  7. package/dist/src/abstractEthLikeNewCoins.js +2081 -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 +133 -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 +67 -0
  27. package/dist/src/lib/transaction.d.ts.map +1 -0
  28. package/dist/src/lib/transaction.js +142 -0
  29. package/dist/src/lib/transactionBuilder.d.ts +251 -0
  30. package/dist/src/lib/transactionBuilder.d.ts.map +1 -0
  31. package/dist/src/lib/transactionBuilder.js +742 -0
  32. package/dist/src/lib/transferBuilder.d.ts +76 -0
  33. package/dist/src/lib/transferBuilder.d.ts.map +1 -0
  34. package/dist/src/lib/transferBuilder.js +307 -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 +17 -0
  42. package/dist/src/lib/transferBuilders/transferBuilderERC1155.d.ts.map +1 -0
  43. package/dist/src/lib/transferBuilders/transferBuilderERC1155.js +96 -0
  44. package/dist/src/lib/transferBuilders/transferBuilderERC721.d.ts +16 -0
  45. package/dist/src/lib/transferBuilders/transferBuilderERC721.d.ts.map +1 -0
  46. package/dist/src/lib/transferBuilders/transferBuilderERC721.js +81 -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 +270 -0
  51. package/dist/src/lib/utils.d.ts.map +1 -0
  52. package/dist/src/lib/utils.js +717 -0
  53. package/dist/src/lib/walletUtil.d.ts +32 -0
  54. package/dist/src/lib/walletUtil.d.ts.map +1 -0
  55. package/dist/src/lib/walletUtil.js +35 -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 -8236
  90. package/index.ts +2 -0
  91. package/package.json +29 -9
@@ -0,0 +1,695 @@
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
+ tokenName?: string;
245
+ }
246
+ export interface VerifyEthTransactionOptions extends VerifyTransactionOptions {
247
+ txPrebuild: TransactionPrebuild;
248
+ txParams: EthTransactionParams;
249
+ }
250
+ interface PresignTransactionOptions extends TransactionPrebuild, BasePresignTransactionOptions {
251
+ wallet: Wallet;
252
+ }
253
+ interface EthAddressCoinSpecifics extends AddressCoinSpecific {
254
+ forwarderVersion: number;
255
+ salt?: string;
256
+ }
257
+ export interface VerifyEthAddressOptions extends BaseVerifyAddressOptions {
258
+ baseAddress: string;
259
+ coinSpecific: EthAddressCoinSpecifics;
260
+ forwarderVersion: number;
261
+ }
262
+ export declare const optionalDeps: {
263
+ readonly ethAbi: any;
264
+ readonly ethUtil: any;
265
+ readonly EthTx: typeof EthLikeTxLib;
266
+ readonly EthCommon: typeof EthLikeCommon;
267
+ };
268
+ export declare abstract class AbstractEthLikeNewCoins extends AbstractEthLikeCoin {
269
+ static hopTransactionSalt: string;
270
+ protected readonly sendMethodName: 'sendMultiSig' | 'sendMultiSigToken';
271
+ readonly staticsCoin?: Readonly<StaticsBaseCoin>;
272
+ protected constructor(bitgo: BitGoBase, staticsCoin?: Readonly<StaticsBaseCoin>);
273
+ /**
274
+ * Method to return the coin's network object
275
+ * @returns {EthLikeNetwork | undefined}
276
+ */
277
+ getNetwork(): EthLikeNetwork | undefined;
278
+ /**
279
+ * Evaluates whether an address string is valid for this coin
280
+ * @param {string} address
281
+ * @returns {boolean} True if address is the valid ethlike adderss
282
+ */
283
+ isValidAddress(address: string): boolean;
284
+ /**
285
+ * Flag for sending data along with transactions
286
+ * @returns {boolean} True if okay to send tx data (ETH), false otherwise
287
+ */
288
+ transactionDataAllowed(): boolean;
289
+ /**
290
+ * Default expire time for a contract call (1 week)
291
+ * @returns {number} Time in seconds
292
+ */
293
+ getDefaultExpireTime(): number;
294
+ /**
295
+ * Method to get the custom chain common object based on params from recovery
296
+ * @param {number} chainId - the chain id of the custom chain
297
+ * @returns {EthLikeCommon.default}
298
+ */
299
+ static getCustomChainCommon(chainId: number): EthLikeCommon.default;
300
+ /**
301
+ * Gets correct Eth Common object based on params from either recovery or tx building
302
+ * @param {EIP1559} eip1559 - configs that specify whether we should construct an eip1559 tx
303
+ * @param {ReplayProtectionOptions} replayProtectionOptions - check if chain id supports replay protection
304
+ * @returns {EthLikeCommon.default}
305
+ */
306
+ private static getEthLikeCommon;
307
+ /**
308
+ * Method to build the tx object
309
+ * @param {BuildTransactionParams} params - params to build transaction
310
+ * @returns {EthLikeTxLib.FeeMarketEIP1559Transaction | EthLikeTxLib.Transaction}
311
+ */
312
+ static buildTransaction(params: BuildTransactionParams): EthLikeTxLib.FeeMarketEIP1559Transaction | EthLikeTxLib.Transaction;
313
+ /**
314
+ * Query explorer for the balance of an address
315
+ * @param {String} address - the ETHLike address
316
+ * @returns {BigNumber} address balance
317
+ */
318
+ queryAddressBalance(address: string): Promise<any>;
319
+ /**
320
+ * @param {Recipient[]} recipients - the recipients of the transaction
321
+ * @param {number} expireTime - the expire time of the transaction
322
+ * @param {number} contractSequenceId - the contract sequence id of the transaction
323
+ * @returns {string}
324
+ */
325
+ getOperationSha3ForExecuteAndConfirm(recipients: Recipient[], expireTime: number, contractSequenceId: number): string;
326
+ /**
327
+ * Get transfer operation for coin
328
+ * @param {Recipient} recipient - recipient info
329
+ * @param {number} expireTime - expiry time
330
+ * @param {number} contractSequenceId - sequence id
331
+ * @returns {Array} operation array
332
+ */
333
+ getOperation(recipient: Recipient, expireTime: number, contractSequenceId: number): (string | Buffer)[][];
334
+ /**
335
+ * Queries the contract (via explorer API) for the next sequence ID
336
+ * @param {String} address - address of the contract
337
+ * @returns {Promise<Number>} sequence ID
338
+ */
339
+ querySequenceId(address: string): Promise<number>;
340
+ /**
341
+ * Recover an unsupported token from a BitGo multisig wallet
342
+ * This builds a half-signed transaction, for which there will be an admin route to co-sign and broadcast. Optionally
343
+ * the user can set params.broadcast = true and the half-signed tx will be sent to BitGo for cosigning and broadcasting
344
+ * @param {RecoverTokenOptions} params
345
+ * @param {Wallet} params.wallet - the wallet to recover the token from
346
+ * @param {string} params.tokenContractAddress - the contract address of the unsupported token
347
+ * @param {string} params.recipient - the destination address recovered tokens should be sent to
348
+ * @param {string} params.walletPassphrase - the wallet passphrase
349
+ * @param {string} params.prv - the xprv
350
+ * @param {boolean} params.broadcast - if true, we will automatically submit the half-signed tx to BitGo for cosigning and broadcasting
351
+ * @returns {Promise<RecoverTokenTransaction>}
352
+ */
353
+ recoverToken(params: RecoverTokenOptions): Promise<RecoverTokenTransaction>;
354
+ /**
355
+ * Ensure either enterprise or newFeeAddress is passed, to know whether to create new key or use enterprise key
356
+ * @param {PrecreateBitGoOptions} params
357
+ * @param {string} params.enterprise {String} the enterprise id to associate with this key
358
+ * @param {string} params.newFeeAddress {Boolean} create a new fee address (enterprise not needed in this case)
359
+ * @returns {void}
360
+ */
361
+ preCreateBitGo(params: PrecreateBitGoOptions): void;
362
+ /**
363
+ * Queries public block explorer to get the next ETHLike coin's nonce that should be used for the given ETH address
364
+ * @param {string} address
365
+ * @returns {Promise<number>}
366
+ */
367
+ getAddressNonce(address: string): Promise<number>;
368
+ /**
369
+ * Helper function for recover()
370
+ * This transforms the unsigned transaction information into a format the BitGo offline vault expects
371
+ * @param {UnformattedTxInfo} txInfo - tx info
372
+ * @param {EthLikeTxLib.Transaction | EthLikeTxLib.FeeMarketEIP1559Transaction} ethTx - the ethereumjs tx object
373
+ * @param {string} userKey - the user's key
374
+ * @param {string} backupKey - the backup key
375
+ * @param {Buffer} gasPrice - gas price for the tx
376
+ * @param {number} gasLimit - gas limit for the tx
377
+ * @param {EIP1559} eip1559 - eip1559 params
378
+ * @param {ReplayProtectionOptions} replayProtectionOptions - replay protection options
379
+ * @returns {Promise<OfflineVaultTxInfo>}
380
+ */
381
+ formatForOfflineVault(txInfo: UnformattedTxInfo, ethTx: EthLikeTxLib.Transaction | EthLikeTxLib.FeeMarketEIP1559Transaction, userKey: string, backupKey: string, gasPrice: Buffer, gasLimit: number, eip1559?: EIP1559, replayProtectionOptions?: ReplayProtectionOptions): Promise<OfflineVaultTxInfo>;
382
+ /**
383
+ * Helper function for recover()
384
+ * This transforms the unsigned transaction information into a format the BitGo offline vault expects
385
+ * @param {UnformattedTxInfo} txInfo - tx info
386
+ * @param {EthLikeTxLib.Transaction | EthLikeTxLib.FeeMarketEIP1559Transaction} ethTx - the ethereumjs tx object
387
+ * @param {string} userKey - the user's key
388
+ * @param {string} backupKey - the backup key
389
+ * @param {Buffer} gasPrice - gas price for the tx
390
+ * @param {number} gasLimit - gas limit for the tx
391
+ * @param {number} backupKeyNonce - the nonce of the backup key address
392
+ * @param {EIP1559} eip1559 - eip1559 params
393
+ * @param {ReplayProtectionOptions} replayProtectionOptions - replay protection options
394
+ * @returns {Promise<OfflineVaultTxInfo>}
395
+ */
396
+ formatForOfflineVaultTSS(txInfo: UnformattedTxInfo, ethTx: EthLikeTxLib.Transaction | EthLikeTxLib.FeeMarketEIP1559Transaction, userKey: string, backupKey: string, gasPrice: Buffer, gasLimit: number, backupKeyNonce: number, eip1559?: EIP1559, replayProtectionOptions?: ReplayProtectionOptions): OfflineVaultTxInfo;
397
+ /**
398
+ * Check whether the gas price passed in by user are within our max and min bounds
399
+ * If they are not set, set them to the defaults
400
+ * @param {number} userGasPrice - user defined gas price
401
+ * @returns {number} the gas price to use for this transaction
402
+ */
403
+ setGasPrice(userGasPrice?: number): number;
404
+ /**
405
+ * Check whether gas limit passed in by user are within our max and min bounds
406
+ * If they are not set, set them to the defaults
407
+ * @param {number} userGasLimit user defined gas limit
408
+ * @returns {number} the gas limit to use for this transaction
409
+ */
410
+ setGasLimit(userGasLimit?: number): number;
411
+ /**
412
+ * Helper function for signTransaction for the rare case that SDK is doing the second signature
413
+ * Note: we are expecting this to be called from the offline vault
414
+ * @param {SignFinalOptions.txPrebuild} params.txPrebuild
415
+ * @param {string} params.prv
416
+ * @returns {{txHex: string}}
417
+ */
418
+ signFinalEthLike(params: SignFinalOptions): Promise<FullySignedTransaction>;
419
+ /**
420
+ * Assemble half-sign prebuilt transaction
421
+ * @param {SignTransactionOptions} params
422
+ */
423
+ signTransaction(params: SignTransactionOptions): Promise<SignedTransaction>;
424
+ /**
425
+ * Method to validate recovery params
426
+ * @param {RecoverOptions} params
427
+ * @returns {void}
428
+ */
429
+ validateRecoveryParams(params: RecoverOptions): void;
430
+ /**
431
+ * Helper which Adds signatures to tx object and re-serializes tx
432
+ * @param {EthLikeCommon.default} ethCommon
433
+ * @param {EthLikeTxLib.FeeMarketEIP1559Transaction | EthLikeTxLib.Transaction} tx
434
+ * @param {ECDSAMethodTypes.Signature} signature
435
+ * @returns {EthLikeTxLib.FeeMarketEIP1559Transaction | EthLikeTxLib.Transaction}
436
+ */
437
+ private getSignedTxFromSignature;
438
+ /**
439
+ * Builds a funds recovery transaction without BitGo
440
+ * @param params
441
+ * @param {string} params.userKey - [encrypted] xprv
442
+ * @param {string} params.backupKey - [encrypted] xprv or xpub if the xprv is held by a KRS provider
443
+ * @param {string} params.walletPassphrase - used to decrypt userKey and backupKey
444
+ * @param {string} params.walletContractAddress - the ETH address of the wallet contract
445
+ * @param {string} params.krsProvider - necessary if backup key is held by KRS
446
+ * @param {string} params.recoveryDestination - target address to send recovered funds to
447
+ * @param {string} params.bitgoFeeAddress - wrong chain wallet fee address for evm based cross chain recovery txn
448
+ * @param {string} params.bitgoDestinationAddress - target bitgo address where fee will be sent for evm based cross chain recovery txn
449
+ */
450
+ recover(params: RecoverOptions): Promise<RecoveryInfo | OfflineVaultTxInfo | UnsignedSweepTxMPCv2>;
451
+ /**
452
+ * Builds a funds recovery transaction without BitGo for non-TSS transaction
453
+ * @param params
454
+ * @param {string} params.userKey [encrypted] xprv or xpub
455
+ * @param {string} params.backupKey [encrypted] xprv or xpub if the xprv is held by a KRS provider
456
+ * @param {string} params.walletPassphrase used to decrypt userKey and backupKey
457
+ * @param {string} params.walletContractAddress the EthLike address of the wallet contract
458
+ * @param {string} params.krsProvider necessary if backup key is held by KRS
459
+ * @param {string} params.recoveryDestination target address to send recovered funds to
460
+ * @param {string} params.bitgoFeeAddress wrong chain wallet fee address for evm based cross chain recovery txn
461
+ * @param {string} params.bitgoDestinationAddress target bitgo address where fee will be sent for evm based cross chain recovery txn
462
+ * @returns {Promise<RecoveryInfo | OfflineVaultTxInfo>}
463
+ */
464
+ protected recoverEthLike(params: RecoverOptions): Promise<RecoveryInfo | OfflineVaultTxInfo>;
465
+ sendCrossChainRecoveryTransaction(params: SendCrossChainRecoveryOptions): Promise<{
466
+ coin: string;
467
+ txHex?: string;
468
+ txid: string;
469
+ }>;
470
+ buildCrossChainRecoveryTransaction(recoveryId: string): Promise<{
471
+ coin: string;
472
+ txHex: string;
473
+ txid: string;
474
+ }>;
475
+ /**
476
+ * Builds a unsigned (for cold, custody wallet) or
477
+ * half-signed (for hot wallet) evm cross chain recovery transaction with
478
+ * same expected arguments as recover method.
479
+ * This helps recover funds from evm based wrong chain.
480
+ * @param {RecoverOptions} params
481
+ * @returns {Promise<RecoveryInfo | OfflineVaultTxInfo>}
482
+ */
483
+ protected recoverEthLikeforEvmBasedRecovery(params: RecoverOptions): Promise<RecoveryInfo | OfflineVaultTxInfo>;
484
+ /**
485
+ * Query explorer for the balance of an address for a token
486
+ * @param {string} tokenContractAddress - address where the token smart contract is hosted
487
+ * @param {string} walletContractAddress - address of the wallet
488
+ * @returns {BigNumber} token balaance in base units
489
+ */
490
+ queryAddressTokenBalance(tokenContractAddress: string, walletContractAddress: string): Promise<any>;
491
+ recoverEthLikeTokenforEvmBasedRecovery(params: RecoverOptions, bitgoFeeAddressNonce: number, gasLimit: any, gasPrice: any, userKey: any, userSigningKey: any): Promise<OfflineVaultTxInfo>;
492
+ /**
493
+ * Validate evm based cross chain recovery params
494
+ * @param params {RecoverOptions}
495
+ * @returns {void}
496
+ */
497
+ validateEvmBasedRecoveryParams(params: RecoverOptions): void;
498
+ /**
499
+ * Return types, values, and total amount in wei to send in a batch transaction, using the method signature
500
+ * `distributeBatch(address[], uint256[])`
501
+ * @param {Recipient[]} recipients - transaction recipients
502
+ * @returns {GetBatchExecutionInfoRT} information needed to execute the batch transaction
503
+ */
504
+ getBatchExecutionInfo(recipients: Recipient[]): GetBatchExecutionInfoRT;
505
+ /**
506
+ * Get the data required to make an ETH function call defined by the given types and values
507
+ *
508
+ * @param {string} functionName - The name of the function being called, e.g. transfer
509
+ * @param types The types of the function call in order
510
+ * @param values The values of the function call in order
511
+ * @return {Buffer} The combined data for the function call
512
+ */
513
+ getMethodCallData: (functionName: any, types: any, values: any) => Buffer<ArrayBuffer>;
514
+ /**
515
+ * Build arguments to call the send method on the wallet contract
516
+ * @param txInfo
517
+ */
518
+ getSendMethodArgs(txInfo: GetSendMethodArgsOptions): SendMethodArgs[];
519
+ /**
520
+ * Recovers a tx with TSS key shares
521
+ * same expected arguments as recover method, but with TSS key shares
522
+ */
523
+ protected recoverTSS(params: RecoverOptions): Promise<RecoveryInfo | OfflineVaultTxInfo | UnsignedSweepTxMPCv2>;
524
+ private getGasValues;
525
+ protected buildUnsignedSweepTxnTSS(params: RecoverOptions): Promise<OfflineVaultTxInfo | UnsignedSweepTxMPCv2>;
526
+ protected buildUnsignedSweepTxnMPCv2(params: RecoverOptions): Promise<UnsignedSweepTxMPCv2>;
527
+ createBroadcastableSweepTransaction(params: MPCSweepRecoveryOptions): Promise<MPCTxs>;
528
+ /**
529
+ * Method to validate recovery params
530
+ * @param {RecoverOptions} params
531
+ * @returns {void}
532
+ */
533
+ private validateUnsignedSweepTSSParams;
534
+ /**
535
+ * Helper function for recover()
536
+ * This transforms the unsigned transaction information into a format the BitGo offline vault expects
537
+ * @param {UnformattedTxInfo} txInfo - tx info
538
+ * @param {EthLikeTxLib.Transaction | EthLikeTxLib.FeeMarketEIP1559Transaction} ethTx - the ethereumjs tx object
539
+ * @param {string} derivationPath - the derivationPath
540
+ * @param {number} nonce - the nonce of the backup key address
541
+ * @param {Buffer} gasPrice - gas price for the tx
542
+ * @param {number} gasLimit - gas limit for the tx
543
+ * @param {EIP1559} eip1559 - eip1559 params
544
+ * @returns {Promise<OfflineVaultTxInfo>}
545
+ */
546
+ private buildTxRequestForOfflineVaultMPCv2;
547
+ private buildTssRecoveryTxn;
548
+ validateBalanceAndGetTxAmount(baseAddress: string, gasPrice: BN, gasLimit: BN): Promise<any>;
549
+ recoveryBlockchainExplorerQuery(query: Record<string, string>): Promise<any>;
550
+ /**
551
+ * Creates the extra parameters needed to build a hop transaction
552
+ * @param buildParams The original build parameters
553
+ * @returns extra parameters object to merge with the original build parameters object and send to the platform
554
+ */
555
+ createHopTransactionParams(buildParams: HopTransactionBuildOptions): Promise<HopParams>;
556
+ /**
557
+ * Validates that the hop prebuild from the HSM is valid and correct
558
+ * @param {IWallet} wallet - The wallet that the prebuild is for
559
+ * @param {HopPrebuild} hopPrebuild - The prebuild to validate
560
+ * @param {Object} originalParams - The original parameters passed to prebuildTransaction
561
+ * @param {Recipient[]} originalParams.recipients - The original recipients array
562
+ * @returns {void}
563
+ * @throws Error if The prebuild is invalid
564
+ */
565
+ validateHopPrebuild(wallet: IWallet, hopPrebuild: HopPrebuild, originalParams?: {
566
+ recipients: Recipient[];
567
+ }): Promise<void>;
568
+ /**
569
+ * Gets the hop digest for the user to sign. This is validated in the HSM to prove that the user requested this tx
570
+ * @param {string[]} paramsArr - The parameters to hash together for the digest
571
+ * @returns {Buffer}
572
+ */
573
+ static getHopDigest(paramsArr: string[]): Buffer;
574
+ /**
575
+ * Modify prebuild before sending it to the server. Add things like hop transaction params
576
+ * @param {BuildOptions} buildParams - The whitelisted parameters for this prebuild
577
+ * @param {boolean} buildParams.hop - True if this should prebuild a hop tx, else false
578
+ * @param {Recipient[]} buildParams.recipients - The recipients array of this transaction
579
+ * @param {Wallet} buildParams.wallet - The wallet sending this tx
580
+ * @param {string} buildParams.walletPassphrase - the passphrase for this wallet
581
+ * @returns {Promise<BuildOptions>}
582
+ */
583
+ getExtraPrebuildParams(buildParams: BuildOptions): Promise<BuildOptions>;
584
+ /**
585
+ * Modify prebuild after receiving it from the server. Add things like nlocktime
586
+ * @param {TransactionPrebuild} params - The prebuild to modify
587
+ * @returns {TransactionPrebuild} The modified prebuild
588
+ */
589
+ postProcessPrebuild(params: TransactionPrebuild): Promise<TransactionPrebuild>;
590
+ /**
591
+ * Coin-specific things done before signing a transaction, i.e. verification
592
+ * @param {PresignTransactionOptions} params
593
+ * @returns {Promise<PresignTransactionOptions>}
594
+ */
595
+ presignTransaction(params: PresignTransactionOptions): Promise<PresignTransactionOptions>;
596
+ /**
597
+ * Fetch fee estimate information from the server
598
+ * @param {Object} params - The params passed into the function
599
+ * @param {boolean} [params.hop] - True if we should estimate fee for a hop transaction
600
+ * @param {string} [params.recipient] - The recipient of the transaction to estimate a send to
601
+ * @param {string} [params.data] - The ETH tx data to estimate a send for
602
+ * @returns {Object} The fee info returned from the server
603
+ */
604
+ feeEstimate(params: FeeEstimateOptions): Promise<FeeEstimate>;
605
+ /**
606
+ * Generate secp256k1 key pair
607
+ *
608
+ * @param {Buffer} seed
609
+ * @returns {KeyPair} object with generated pub and prv
610
+ */
611
+ generateKeyPair(seed: Buffer): KeyPair;
612
+ parseTransaction(params: ParseTransactionOptions): Promise<ParsedTransaction>;
613
+ /**
614
+ * Make sure an address is a wallet address and throw an error if it's not.
615
+ * @param {Object} params
616
+ * @param {string} params.address - The derived address string on the network
617
+ * @param {Object} params.coinSpecific - Coin-specific details for the address such as a forwarderVersion
618
+ * @param {string} params.baseAddress - The base address of the wallet on the network
619
+ * @throws {InvalidAddressError}
620
+ * @throws {InvalidAddressVerificationObjectPropertyError}
621
+ * @throws {UnexpectedAddressError}
622
+ * @returns {boolean} True iff address is a wallet address
623
+ */
624
+ isWalletAddress(params: VerifyEthAddressOptions): Promise<boolean>;
625
+ /**
626
+ *
627
+ * @param {TransactionPrebuild} txPrebuild
628
+ * @returns {boolean}
629
+ */
630
+ verifyCoin(txPrebuild: TransactionPrebuild): boolean;
631
+ /**
632
+ * Verify if a tss transaction is valid
633
+ *
634
+ * @param {VerifyEthTransactionOptions} params
635
+ * @param {TransactionParams} params.txParams - params object passed to send
636
+ * @param {TransactionPrebuild} params.txPrebuild - prebuild object returned by server
637
+ * @param {Wallet} params.wallet - Wallet object to obtain keys to verify against
638
+ * @returns {boolean}
639
+ */
640
+ verifyTssTransaction(params: VerifyEthTransactionOptions): Promise<boolean>;
641
+ /**
642
+ * Verify that a transaction prebuild complies with the original intention
643
+ *
644
+ * @param {VerifyEthTransactionOptions} params
645
+ * @param {TransactionParams} params.txParams - params object passed to send
646
+ * @param {TransactionPrebuild} params.txPrebuild - prebuild object returned by server
647
+ * @param {Wallet} params.wallet - Wallet object to obtain keys to verify against
648
+ * @returns {boolean}
649
+ */
650
+ verifyTransaction(params: VerifyEthTransactionOptions): Promise<boolean>;
651
+ /**
652
+ * Check if address is valid eth address
653
+ * @param address
654
+ * @returns {boolean}
655
+ */
656
+ private isETHAddress;
657
+ /**
658
+ * Transform message to accommodate specific blockchain requirements.
659
+ * @param {string} message - the message to prepare
660
+ * @return {string} the prepared message as a hex encoded string.
661
+ */
662
+ encodeMessage(message: string): string;
663
+ /**
664
+ * Transform the Typed data to accomodate the blockchain requirements (EIP-712)
665
+ * @param {TypedData} typedData - the typed data to prepare
666
+ * @return {Buffer} a buffer of the result
667
+ */
668
+ encodeTypedData(typedData: TypedData): Buffer;
669
+ /**
670
+ * Build the data to transfer an ERC-721 or ERC-1155 token to another address
671
+ * @param params
672
+ */
673
+ buildNftTransferData(params: BuildNftTransferDataOptions): string;
674
+ /**
675
+ * Fetch the gas price from the explorer
676
+ */
677
+ getGasPriceFromExternalAPI(wrongChainCoin: string): Promise<BN>;
678
+ /**
679
+ * Fetch the gas limit from the explorer
680
+ * @param intendedChain
681
+ * @param from
682
+ * @param to
683
+ * @param data
684
+ */
685
+ getGasLimitFromExternalAPI(intendedChain: string, from: string, to: string, data: string): Promise<BN>;
686
+ /**
687
+ * Get the balance of bitgoFeeAddress to ensure funds are available to pay fees
688
+ * @param bitgoFeeAddress
689
+ * @param gasPrice
690
+ * @param gasLimit
691
+ */
692
+ ensureSufficientBalance(bitgoFeeAddress: string, gasPrice: BN, gasLimit: BN): Promise<void>;
693
+ }
694
+ export {};
695
+ //# sourceMappingURL=abstractEthLikeNewCoins.d.ts.map