@bitgo-beta/abstract-eth 1.2.3-alpha.35 → 1.2.3-alpha.350

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 (121) hide show
  1. package/CHANGELOG.md +1692 -0
  2. package/dist/src/abstractEthLikeCoin.d.ts +18 -9
  3. package/dist/src/abstractEthLikeCoin.d.ts.map +1 -1
  4. package/dist/src/abstractEthLikeCoin.js +39 -15
  5. package/dist/src/abstractEthLikeNewCoins.d.ts +696 -0
  6. package/dist/src/abstractEthLikeNewCoins.d.ts.map +1 -0
  7. package/dist/src/abstractEthLikeNewCoins.js +2096 -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 +286 -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 +16 -0
  21. package/dist/src/lib/index.d.ts.map +1 -0
  22. package/dist/src/lib/index.js +57 -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/messages/eip191/eip191Message.d.ts +12 -0
  27. package/dist/src/lib/messages/eip191/eip191Message.d.ts.map +1 -0
  28. package/dist/src/lib/messages/eip191/eip191Message.js +25 -0
  29. package/dist/src/lib/messages/eip191/eip191MessageBuilder.d.ts +19 -0
  30. package/dist/src/lib/messages/eip191/eip191MessageBuilder.d.ts.map +1 -0
  31. package/dist/src/lib/messages/eip191/eip191MessageBuilder.js +27 -0
  32. package/dist/src/lib/messages/eip191/index.d.ts +3 -0
  33. package/dist/src/lib/messages/eip191/index.d.ts.map +1 -0
  34. package/dist/src/lib/messages/eip191/index.js +19 -0
  35. package/dist/src/lib/messages/index.d.ts +3 -0
  36. package/dist/src/lib/messages/index.d.ts.map +1 -0
  37. package/dist/src/lib/messages/index.js +19 -0
  38. package/dist/src/lib/messages/messageBuilderFactory.d.ts +7 -0
  39. package/dist/src/lib/messages/messageBuilderFactory.d.ts.map +1 -0
  40. package/dist/src/lib/messages/messageBuilderFactory.js +20 -0
  41. package/dist/src/lib/transaction.d.ts +67 -0
  42. package/dist/src/lib/transaction.d.ts.map +1 -0
  43. package/dist/src/lib/transaction.js +142 -0
  44. package/dist/src/lib/transactionBuilder.d.ts +251 -0
  45. package/dist/src/lib/transactionBuilder.d.ts.map +1 -0
  46. package/dist/src/lib/transactionBuilder.js +742 -0
  47. package/dist/src/lib/transferBuilder.d.ts +76 -0
  48. package/dist/src/lib/transferBuilder.d.ts.map +1 -0
  49. package/dist/src/lib/transferBuilder.js +307 -0
  50. package/dist/src/lib/transferBuilders/baseNFTTransferBuilder.d.ts +54 -0
  51. package/dist/src/lib/transferBuilders/baseNFTTransferBuilder.d.ts.map +1 -0
  52. package/dist/src/lib/transferBuilders/baseNFTTransferBuilder.js +120 -0
  53. package/dist/src/lib/transferBuilders/index.d.ts +4 -0
  54. package/dist/src/lib/transferBuilders/index.d.ts.map +1 -0
  55. package/dist/src/lib/transferBuilders/index.js +20 -0
  56. package/dist/src/lib/transferBuilders/transferBuilderERC1155.d.ts +17 -0
  57. package/dist/src/lib/transferBuilders/transferBuilderERC1155.d.ts.map +1 -0
  58. package/dist/src/lib/transferBuilders/transferBuilderERC1155.js +96 -0
  59. package/dist/src/lib/transferBuilders/transferBuilderERC721.d.ts +16 -0
  60. package/dist/src/lib/transferBuilders/transferBuilderERC721.d.ts.map +1 -0
  61. package/dist/src/lib/transferBuilders/transferBuilderERC721.js +81 -0
  62. package/dist/src/lib/types.d.ts +39 -0
  63. package/dist/src/lib/types.d.ts.map +1 -0
  64. package/dist/src/lib/types.js +137 -0
  65. package/dist/src/lib/utils.d.ts +270 -0
  66. package/dist/src/lib/utils.d.ts.map +1 -0
  67. package/dist/src/lib/utils.js +717 -0
  68. package/dist/src/lib/walletUtil.d.ts +32 -0
  69. package/dist/src/lib/walletUtil.d.ts.map +1 -0
  70. package/dist/src/lib/walletUtil.js +35 -0
  71. package/dist/src/types.d.ts +9 -0
  72. package/dist/src/types.d.ts.map +1 -0
  73. package/dist/src/types.js +3 -0
  74. package/dist/test/index.d.ts +2 -0
  75. package/dist/test/index.d.ts.map +1 -0
  76. package/dist/test/index.js +18 -0
  77. package/dist/test/unit/coin.d.ts +8 -0
  78. package/dist/test/unit/coin.d.ts.map +1 -0
  79. package/dist/test/unit/coin.js +577 -0
  80. package/dist/test/unit/index.d.ts +6 -0
  81. package/dist/test/unit/index.d.ts.map +1 -0
  82. package/dist/test/unit/index.js +22 -0
  83. package/dist/test/unit/messages/eip191/eip191Message.d.ts +2 -0
  84. package/dist/test/unit/messages/eip191/eip191Message.d.ts.map +1 -0
  85. package/dist/test/unit/messages/eip191/eip191Message.js +137 -0
  86. package/dist/test/unit/messages/eip191/eip191MessageBuilder.d.ts +2 -0
  87. package/dist/test/unit/messages/eip191/eip191MessageBuilder.d.ts.map +1 -0
  88. package/dist/test/unit/messages/eip191/eip191MessageBuilder.js +95 -0
  89. package/dist/test/unit/messages/fixtures.d.ts +24 -0
  90. package/dist/test/unit/messages/fixtures.d.ts.map +1 -0
  91. package/dist/test/unit/messages/fixtures.js +28 -0
  92. package/dist/test/unit/messages/index.d.ts +4 -0
  93. package/dist/test/unit/messages/index.d.ts.map +1 -0
  94. package/dist/test/unit/messages/index.js +20 -0
  95. package/dist/test/unit/messages/messageBuilderFactory.d.ts +2 -0
  96. package/dist/test/unit/messages/messageBuilderFactory.d.ts.map +1 -0
  97. package/dist/test/unit/messages/messageBuilderFactory.js +44 -0
  98. package/dist/test/unit/token.d.ts +2 -0
  99. package/dist/test/unit/token.d.ts.map +1 -0
  100. package/dist/test/unit/token.js +37 -0
  101. package/dist/test/unit/transaction.d.ts +3 -0
  102. package/dist/test/unit/transaction.d.ts.map +1 -0
  103. package/dist/test/unit/transaction.js +60 -0
  104. package/dist/test/unit/transactionBuilder/addressInitialization.d.ts +8 -0
  105. package/dist/test/unit/transactionBuilder/addressInitialization.d.ts.map +1 -0
  106. package/dist/test/unit/transactionBuilder/addressInitialization.js +95 -0
  107. package/dist/test/unit/transactionBuilder/index.d.ts +4 -0
  108. package/dist/test/unit/transactionBuilder/index.d.ts.map +1 -0
  109. package/dist/test/unit/transactionBuilder/index.js +20 -0
  110. package/dist/test/unit/transactionBuilder/send.d.ts +3 -0
  111. package/dist/test/unit/transactionBuilder/send.d.ts.map +1 -0
  112. package/dist/test/unit/transactionBuilder/send.js +197 -0
  113. package/dist/test/unit/transactionBuilder/walletInitialization.d.ts +10 -0
  114. package/dist/test/unit/transactionBuilder/walletInitialization.d.ts.map +1 -0
  115. package/dist/test/unit/transactionBuilder/walletInitialization.js +124 -0
  116. package/dist/test/unit/transferBuilder.d.ts +2 -0
  117. package/dist/test/unit/transferBuilder.d.ts.map +1 -0
  118. package/dist/test/unit/transferBuilder.js +76 -0
  119. package/dist/tsconfig.tsbuildinfo +1 -10143
  120. package/index.ts +2 -0
  121. package/package.json +29 -9
@@ -0,0 +1,696 @@
1
+ /**
2
+ * @prettier
3
+ */
4
+ import { AddressCoinSpecific, BitGoBase, BuildNftTransferDataOptions, FeeEstimateOptions, FullySignedTransaction, HalfSignedTransaction, IWallet, KeyPair, MPCSweepRecoveryOptions, MPCTxs, ParsedTransaction, ParseTransactionOptions, PrebuildTransactionResult, PresignTransactionOptions as BasePresignTransactionOptions, Recipient, SignTransactionOptions as BaseSignTransactionOptions, TransactionParams, TransactionPrebuild as BaseTransactionPrebuild, TransactionRecipient, TypedData, UnsignedTransactionTss, VerifyAddressOptions as BaseVerifyAddressOptions, VerifyTransactionOptions, Wallet } from '@bitgo-beta/sdk-core';
5
+ import { BaseCoin as StaticsBaseCoin, EthereumNetwork as EthLikeNetwork } 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
+ protected getEthLikeCommon(eip1559?: EIP1559, replayProtectionOptions?: ReplayProtectionOptions): EthLikeCommon.default;
307
+ /**
308
+ * Method to build the tx object
309
+ * @param {BuildTransactionParams} params - params to build transaction
310
+ * @returns {EthLikeTxLib.FeeMarketEIP1559Transaction | EthLikeTxLib.Transaction}
311
+ */
312
+ 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
+ walletVersion?: number;
475
+ }>;
476
+ /**
477
+ * Builds a unsigned (for cold, custody wallet) or
478
+ * half-signed (for hot wallet) evm cross chain recovery transaction with
479
+ * same expected arguments as recover method.
480
+ * This helps recover funds from evm based wrong chain.
481
+ * @param {RecoverOptions} params
482
+ * @returns {Promise<RecoveryInfo | OfflineVaultTxInfo>}
483
+ */
484
+ protected recoverEthLikeforEvmBasedRecovery(params: RecoverOptions): Promise<RecoveryInfo | OfflineVaultTxInfo>;
485
+ /**
486
+ * Query explorer for the balance of an address for a token
487
+ * @param {string} tokenContractAddress - address where the token smart contract is hosted
488
+ * @param {string} walletContractAddress - address of the wallet
489
+ * @returns {BigNumber} token balaance in base units
490
+ */
491
+ queryAddressTokenBalance(tokenContractAddress: string, walletContractAddress: string): Promise<any>;
492
+ recoverEthLikeTokenforEvmBasedRecovery(params: RecoverOptions, bitgoFeeAddressNonce: number, gasLimit: any, gasPrice: any, userKey: any, userSigningKey: any): Promise<OfflineVaultTxInfo>;
493
+ /**
494
+ * Validate evm based cross chain recovery params
495
+ * @param params {RecoverOptions}
496
+ * @returns {void}
497
+ */
498
+ validateEvmBasedRecoveryParams(params: RecoverOptions): void;
499
+ /**
500
+ * Return types, values, and total amount in wei to send in a batch transaction, using the method signature
501
+ * `distributeBatch(address[], uint256[])`
502
+ * @param {Recipient[]} recipients - transaction recipients
503
+ * @returns {GetBatchExecutionInfoRT} information needed to execute the batch transaction
504
+ */
505
+ getBatchExecutionInfo(recipients: Recipient[]): GetBatchExecutionInfoRT;
506
+ /**
507
+ * Get the data required to make an ETH function call defined by the given types and values
508
+ *
509
+ * @param {string} functionName - The name of the function being called, e.g. transfer
510
+ * @param types The types of the function call in order
511
+ * @param values The values of the function call in order
512
+ * @return {Buffer} The combined data for the function call
513
+ */
514
+ getMethodCallData: (functionName: any, types: any, values: any) => Buffer<ArrayBuffer>;
515
+ /**
516
+ * Build arguments to call the send method on the wallet contract
517
+ * @param txInfo
518
+ */
519
+ getSendMethodArgs(txInfo: GetSendMethodArgsOptions): SendMethodArgs[];
520
+ /**
521
+ * Recovers a tx with TSS key shares
522
+ * same expected arguments as recover method, but with TSS key shares
523
+ */
524
+ protected recoverTSS(params: RecoverOptions): Promise<RecoveryInfo | OfflineVaultTxInfo | UnsignedSweepTxMPCv2>;
525
+ private getGasValues;
526
+ protected buildUnsignedSweepTxnTSS(params: RecoverOptions): Promise<OfflineVaultTxInfo | UnsignedSweepTxMPCv2>;
527
+ protected buildUnsignedSweepTxnMPCv2(params: RecoverOptions): Promise<UnsignedSweepTxMPCv2>;
528
+ createBroadcastableSweepTransaction(params: MPCSweepRecoveryOptions): Promise<MPCTxs>;
529
+ /**
530
+ * Method to validate recovery params
531
+ * @param {RecoverOptions} params
532
+ * @returns {void}
533
+ */
534
+ private validateUnsignedSweepTSSParams;
535
+ /**
536
+ * Helper function for recover()
537
+ * This transforms the unsigned transaction information into a format the BitGo offline vault expects
538
+ * @param {UnformattedTxInfo} txInfo - tx info
539
+ * @param {EthLikeTxLib.Transaction | EthLikeTxLib.FeeMarketEIP1559Transaction} ethTx - the ethereumjs tx object
540
+ * @param {string} derivationPath - the derivationPath
541
+ * @param {number} nonce - the nonce of the backup key address
542
+ * @param {Buffer} gasPrice - gas price for the tx
543
+ * @param {number} gasLimit - gas limit for the tx
544
+ * @param {EIP1559} eip1559 - eip1559 params
545
+ * @returns {Promise<OfflineVaultTxInfo>}
546
+ */
547
+ private buildTxRequestForOfflineVaultMPCv2;
548
+ private buildTssRecoveryTxn;
549
+ validateBalanceAndGetTxAmount(baseAddress: string, gasPrice: BN, gasLimit: BN): Promise<any>;
550
+ recoveryBlockchainExplorerQuery(query: Record<string, string>): Promise<any>;
551
+ /**
552
+ * Creates the extra parameters needed to build a hop transaction
553
+ * @param buildParams The original build parameters
554
+ * @returns extra parameters object to merge with the original build parameters object and send to the platform
555
+ */
556
+ createHopTransactionParams(buildParams: HopTransactionBuildOptions): Promise<HopParams>;
557
+ /**
558
+ * Validates that the hop prebuild from the HSM is valid and correct
559
+ * @param {IWallet} wallet - The wallet that the prebuild is for
560
+ * @param {HopPrebuild} hopPrebuild - The prebuild to validate
561
+ * @param {Object} originalParams - The original parameters passed to prebuildTransaction
562
+ * @param {Recipient[]} originalParams.recipients - The original recipients array
563
+ * @returns {void}
564
+ * @throws Error if The prebuild is invalid
565
+ */
566
+ validateHopPrebuild(wallet: IWallet, hopPrebuild: HopPrebuild, originalParams?: {
567
+ recipients: Recipient[];
568
+ }): Promise<void>;
569
+ /**
570
+ * Gets the hop digest for the user to sign. This is validated in the HSM to prove that the user requested this tx
571
+ * @param {string[]} paramsArr - The parameters to hash together for the digest
572
+ * @returns {Buffer}
573
+ */
574
+ static getHopDigest(paramsArr: string[]): Buffer;
575
+ /**
576
+ * Modify prebuild before sending it to the server. Add things like hop transaction params
577
+ * @param {BuildOptions} buildParams - The whitelisted parameters for this prebuild
578
+ * @param {boolean} buildParams.hop - True if this should prebuild a hop tx, else false
579
+ * @param {Recipient[]} buildParams.recipients - The recipients array of this transaction
580
+ * @param {Wallet} buildParams.wallet - The wallet sending this tx
581
+ * @param {string} buildParams.walletPassphrase - the passphrase for this wallet
582
+ * @returns {Promise<BuildOptions>}
583
+ */
584
+ getExtraPrebuildParams(buildParams: BuildOptions): Promise<BuildOptions>;
585
+ /**
586
+ * Modify prebuild after receiving it from the server. Add things like nlocktime
587
+ * @param {TransactionPrebuild} params - The prebuild to modify
588
+ * @returns {TransactionPrebuild} The modified prebuild
589
+ */
590
+ postProcessPrebuild(params: TransactionPrebuild): Promise<TransactionPrebuild>;
591
+ /**
592
+ * Coin-specific things done before signing a transaction, i.e. verification
593
+ * @param {PresignTransactionOptions} params
594
+ * @returns {Promise<PresignTransactionOptions>}
595
+ */
596
+ presignTransaction(params: PresignTransactionOptions): Promise<PresignTransactionOptions>;
597
+ /**
598
+ * Fetch fee estimate information from the server
599
+ * @param {Object} params - The params passed into the function
600
+ * @param {boolean} [params.hop] - True if we should estimate fee for a hop transaction
601
+ * @param {string} [params.recipient] - The recipient of the transaction to estimate a send to
602
+ * @param {string} [params.data] - The ETH tx data to estimate a send for
603
+ * @returns {Object} The fee info returned from the server
604
+ */
605
+ feeEstimate(params: FeeEstimateOptions): Promise<FeeEstimate>;
606
+ /**
607
+ * Generate secp256k1 key pair
608
+ *
609
+ * @param {Buffer} seed
610
+ * @returns {KeyPair} object with generated pub and prv
611
+ */
612
+ generateKeyPair(seed: Buffer): KeyPair;
613
+ parseTransaction(params: ParseTransactionOptions): Promise<ParsedTransaction>;
614
+ /**
615
+ * Make sure an address is a wallet address and throw an error if it's not.
616
+ * @param {Object} params
617
+ * @param {string} params.address - The derived address string on the network
618
+ * @param {Object} params.coinSpecific - Coin-specific details for the address such as a forwarderVersion
619
+ * @param {string} params.baseAddress - The base address of the wallet on the network
620
+ * @throws {InvalidAddressError}
621
+ * @throws {InvalidAddressVerificationObjectPropertyError}
622
+ * @throws {UnexpectedAddressError}
623
+ * @returns {boolean} True iff address is a wallet address
624
+ */
625
+ isWalletAddress(params: VerifyEthAddressOptions): Promise<boolean>;
626
+ /**
627
+ *
628
+ * @param {TransactionPrebuild} txPrebuild
629
+ * @returns {boolean}
630
+ */
631
+ verifyCoin(txPrebuild: TransactionPrebuild): boolean;
632
+ /**
633
+ * Verify if a tss transaction is valid
634
+ *
635
+ * @param {VerifyEthTransactionOptions} params
636
+ * @param {TransactionParams} params.txParams - params object passed to send
637
+ * @param {TransactionPrebuild} params.txPrebuild - prebuild object returned by server
638
+ * @param {Wallet} params.wallet - Wallet object to obtain keys to verify against
639
+ * @returns {boolean}
640
+ */
641
+ verifyTssTransaction(params: VerifyEthTransactionOptions): Promise<boolean>;
642
+ /**
643
+ * Verify that a transaction prebuild complies with the original intention
644
+ *
645
+ * @param {VerifyEthTransactionOptions} params
646
+ * @param {TransactionParams} params.txParams - params object passed to send
647
+ * @param {TransactionPrebuild} params.txPrebuild - prebuild object returned by server
648
+ * @param {Wallet} params.wallet - Wallet object to obtain keys to verify against
649
+ * @returns {boolean}
650
+ */
651
+ verifyTransaction(params: VerifyEthTransactionOptions): Promise<boolean>;
652
+ /**
653
+ * Check if address is valid eth address
654
+ * @param address
655
+ * @returns {boolean}
656
+ */
657
+ private isETHAddress;
658
+ /**
659
+ * Transform message to accommodate specific blockchain requirements.
660
+ * @param {string} message - the message to prepare
661
+ * @return {string} the prepared message as a hex encoded string.
662
+ */
663
+ encodeMessage(message: string): string;
664
+ /**
665
+ * Transform the Typed data to accomodate the blockchain requirements (EIP-712)
666
+ * @param {TypedData} typedData - the typed data to prepare
667
+ * @return {Buffer} a buffer of the result
668
+ */
669
+ encodeTypedData(typedData: TypedData): Buffer;
670
+ /**
671
+ * Build the data to transfer an ERC-721 or ERC-1155 token to another address
672
+ * @param params
673
+ */
674
+ buildNftTransferData(params: BuildNftTransferDataOptions): string;
675
+ /**
676
+ * Fetch the gas price from the explorer
677
+ */
678
+ getGasPriceFromExternalAPI(wrongChainCoin: string): Promise<BN>;
679
+ /**
680
+ * Fetch the gas limit from the explorer
681
+ * @param intendedChain
682
+ * @param from
683
+ * @param to
684
+ * @param data
685
+ */
686
+ getGasLimitFromExternalAPI(intendedChain: string, from: string, to: string, data: string): Promise<BN>;
687
+ /**
688
+ * Get the balance of bitgoFeeAddress to ensure funds are available to pay fees
689
+ * @param bitgoFeeAddress
690
+ * @param gasPrice
691
+ * @param gasLimit
692
+ */
693
+ ensureSufficientBalance(bitgoFeeAddress: string, gasPrice: BN, gasLimit: BN): Promise<void>;
694
+ }
695
+ export {};
696
+ //# sourceMappingURL=abstractEthLikeNewCoins.d.ts.map