@bitgo-beta/abstract-eth 1.2.3-alpha.37 → 1.2.3-alpha.370

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