@bitgo/sdk-coin-eth 1.0.1-rc.0

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 (63) hide show
  1. package/.eslintignore +5 -0
  2. package/.mocharc.yml +8 -0
  3. package/CHANGELOG.md +8 -0
  4. package/LICENSE +191 -0
  5. package/README.md +35 -0
  6. package/dist/src/erc20Token.d.ts +52 -0
  7. package/dist/src/erc20Token.d.ts.map +1 -0
  8. package/dist/src/erc20Token.js +296 -0
  9. package/dist/src/eth.d.ts +489 -0
  10. package/dist/src/eth.d.ts.map +1 -0
  11. package/dist/src/eth.js +1218 -0
  12. package/dist/src/gteth.d.ts +11 -0
  13. package/dist/src/gteth.d.ts.map +1 -0
  14. package/dist/src/gteth.js +21 -0
  15. package/dist/src/index.d.ts +6 -0
  16. package/dist/src/index.d.ts.map +1 -0
  17. package/dist/src/index.js +18 -0
  18. package/dist/src/lib/contractCall.d.ts +8 -0
  19. package/dist/src/lib/contractCall.d.ts.map +1 -0
  20. package/dist/src/lib/contractCall.js +17 -0
  21. package/dist/src/lib/iface.d.ts +122 -0
  22. package/dist/src/lib/iface.d.ts.map +1 -0
  23. package/dist/src/lib/iface.js +8 -0
  24. package/dist/src/lib/index.d.ts +15 -0
  25. package/dist/src/lib/index.d.ts.map +1 -0
  26. package/dist/src/lib/index.js +42 -0
  27. package/dist/src/lib/keyPair.d.ts +26 -0
  28. package/dist/src/lib/keyPair.d.ts.map +1 -0
  29. package/dist/src/lib/keyPair.js +85 -0
  30. package/dist/src/lib/transaction.d.ts +64 -0
  31. package/dist/src/lib/transaction.d.ts.map +1 -0
  32. package/dist/src/lib/transaction.js +137 -0
  33. package/dist/src/lib/transactionBuilder.d.ts +195 -0
  34. package/dist/src/lib/transactionBuilder.d.ts.map +1 -0
  35. package/dist/src/lib/transactionBuilder.js +625 -0
  36. package/dist/src/lib/transferBuilder.d.ts +65 -0
  37. package/dist/src/lib/transferBuilder.d.ts.map +1 -0
  38. package/dist/src/lib/transferBuilder.js +197 -0
  39. package/dist/src/lib/transferBuilders/baseNFTTransferBuilder.d.ts +47 -0
  40. package/dist/src/lib/transferBuilders/baseNFTTransferBuilder.d.ts.map +1 -0
  41. package/dist/src/lib/transferBuilders/baseNFTTransferBuilder.js +113 -0
  42. package/dist/src/lib/transferBuilders/index.d.ts +4 -0
  43. package/dist/src/lib/transferBuilders/index.d.ts.map +1 -0
  44. package/dist/src/lib/transferBuilders/index.js +16 -0
  45. package/dist/src/lib/transferBuilders/transferBuilderERC1155.d.ts +14 -0
  46. package/dist/src/lib/transferBuilders/transferBuilderERC1155.d.ts.map +1 -0
  47. package/dist/src/lib/transferBuilders/transferBuilderERC1155.js +83 -0
  48. package/dist/src/lib/transferBuilders/transferBuilderERC721.d.ts +13 -0
  49. package/dist/src/lib/transferBuilders/transferBuilderERC721.d.ts.map +1 -0
  50. package/dist/src/lib/transferBuilders/transferBuilderERC721.js +68 -0
  51. package/dist/src/lib/types.d.ts +39 -0
  52. package/dist/src/lib/types.d.ts.map +1 -0
  53. package/dist/src/lib/types.js +135 -0
  54. package/dist/src/lib/utils.d.ts +201 -0
  55. package/dist/src/lib/utils.d.ts.map +1 -0
  56. package/dist/src/lib/utils.js +485 -0
  57. package/dist/src/lib/walletUtil.d.ts +21 -0
  58. package/dist/src/lib/walletUtil.d.ts.map +1 -0
  59. package/dist/src/lib/walletUtil.js +31 -0
  60. package/dist/src/teth.d.ts +11 -0
  61. package/dist/src/teth.d.ts.map +1 -0
  62. package/dist/src/teth.js +21 -0
  63. package/package.json +67 -0
@@ -0,0 +1,489 @@
1
+ /// <reference types="node" />
2
+ import { AddressCoinSpecific, BaseCoin, BitGoBase, FeeEstimateOptions, HalfSignedAccountTransaction, IWallet, KeyPair, ParsedTransaction, ParseTransactionOptions, PresignTransactionOptions as BasePresignTransactionOptions, SignTransactionOptions as BaseSignTransactionOptions, TransactionParams, TransactionPrebuild as BaseTransactionPrebuild, TransactionRecipient, VerifyAddressOptions as BaseVerifyAddressOptions, VerifyTransactionOptions, Wallet } from '@bitgo/sdk-core';
3
+ import { BaseCoin as StaticsBaseCoin, EthereumNetwork } from '@bitgo/statics';
4
+ import type * as EthTxLib from '@ethereumjs/tx';
5
+ import type * as EthCommon from '@ethereumjs/common';
6
+ export declare const optionalDeps: {
7
+ readonly ethAbi: any;
8
+ readonly ethUtil: any;
9
+ readonly EthTx: typeof EthTxLib;
10
+ readonly EthCommon: typeof EthCommon;
11
+ };
12
+ /**
13
+ * The extra parameters to send to platform build route for hop transactions
14
+ */
15
+ interface HopParams {
16
+ hopParams: {
17
+ gasPriceMax: number;
18
+ userReqSig: string;
19
+ paymentId: string;
20
+ };
21
+ gasLimit: number;
22
+ }
23
+ /**
24
+ * The prebuilt hop transaction returned from the HSM
25
+ */
26
+ interface HopPrebuild {
27
+ tx: string;
28
+ id: string;
29
+ signature: string;
30
+ paymentId: string;
31
+ gasPrice: number;
32
+ gasLimit: number;
33
+ amount: number;
34
+ recipient: string;
35
+ nonce: number;
36
+ userReqSig: string;
37
+ gasPriceMax: number;
38
+ }
39
+ export interface Recipient {
40
+ address: string;
41
+ amount: string;
42
+ data?: string;
43
+ }
44
+ interface EIP1559 {
45
+ maxPriorityFeePerGas: number;
46
+ maxFeePerGas: number;
47
+ }
48
+ interface ReplayProtectionOptions {
49
+ chain: string | number;
50
+ hardfork: string;
51
+ }
52
+ interface SignFinalOptions {
53
+ txPrebuild: {
54
+ eip1559?: EIP1559;
55
+ replayProtectionOptions?: ReplayProtectionOptions;
56
+ gasPrice?: string;
57
+ gasLimit: string;
58
+ recipients: Recipient[];
59
+ halfSigned: {
60
+ expireTime: number;
61
+ contractSequenceId: number;
62
+ backupKeyNonce?: number;
63
+ signature: string;
64
+ };
65
+ nextContractSequenceId?: number;
66
+ hopTransaction?: string;
67
+ backupKeyNonce?: number;
68
+ isBatch?: boolean;
69
+ };
70
+ signingKeyNonce: number;
71
+ walletContractAddress: string;
72
+ prv: string;
73
+ recipients: Recipient[];
74
+ }
75
+ export interface SignTransactionOptions extends BaseSignTransactionOptions, SignFinalOptions {
76
+ isLastSignature?: boolean;
77
+ expireTime: number;
78
+ sequenceId: number;
79
+ gasLimit: number;
80
+ gasPrice: number;
81
+ custodianTransactionId?: string;
82
+ }
83
+ export interface HalfSignedTransaction extends HalfSignedAccountTransaction {
84
+ halfSigned: {
85
+ recipients: Recipient[];
86
+ expireTime: number;
87
+ contractSequenceId: number;
88
+ sequenceId: number;
89
+ txHex?: never;
90
+ };
91
+ }
92
+ export interface FullySignedTransaction {
93
+ txHex: string;
94
+ }
95
+ export declare type SignedTransaction = HalfSignedTransaction | FullySignedTransaction;
96
+ interface PrecreateBitGoOptions {
97
+ enterprise?: string;
98
+ newFeeAddress?: string;
99
+ }
100
+ interface OfflineVaultTxInfo {
101
+ nextContractSequenceId?: string;
102
+ contractSequenceId?: string;
103
+ tx: string;
104
+ userKey: string;
105
+ backupKey: string;
106
+ coin: string;
107
+ gasPrice: number;
108
+ gasLimit: number;
109
+ recipients: Recipient[];
110
+ walletContractAddress: string;
111
+ amount: string;
112
+ backupKeyNonce: number;
113
+ eip1559?: EIP1559;
114
+ replayProtectionOptions?: ReplayProtectionOptions;
115
+ }
116
+ interface UnformattedTxInfo {
117
+ recipient: Recipient;
118
+ }
119
+ export interface RecoverOptions {
120
+ userKey: string;
121
+ backupKey: string;
122
+ walletPassphrase?: string;
123
+ walletContractAddress: string;
124
+ recoveryDestination: string;
125
+ krsProvider?: string;
126
+ gasPrice?: number;
127
+ gasLimit?: number;
128
+ eip1559?: EIP1559;
129
+ replayProtectionOptions?: ReplayProtectionOptions;
130
+ }
131
+ interface BuildTransactionParams {
132
+ to: string;
133
+ nonce?: number;
134
+ value: number;
135
+ data?: Buffer;
136
+ gasPrice?: number;
137
+ gasLimit?: number;
138
+ eip1559?: EIP1559;
139
+ replayProtectionOptions?: ReplayProtectionOptions;
140
+ }
141
+ export interface RecoveryInfo {
142
+ id: string;
143
+ tx: string;
144
+ backupKey?: string;
145
+ coin?: string;
146
+ }
147
+ interface RecoverTokenOptions {
148
+ tokenContractAddress: string;
149
+ wallet: Wallet;
150
+ recipient: string;
151
+ broadcast?: boolean;
152
+ walletPassphrase?: string;
153
+ prv?: string;
154
+ }
155
+ export interface GetSendMethodArgsOptions {
156
+ recipient: Recipient;
157
+ expireTime: number;
158
+ contractSequenceId: number;
159
+ signature: string;
160
+ }
161
+ export interface SendMethodArgs {
162
+ name: string;
163
+ type: string;
164
+ value: any;
165
+ }
166
+ interface HopTransactionBuildOptions {
167
+ wallet: Wallet;
168
+ recipients: Recipient[];
169
+ walletPassphrase: string;
170
+ }
171
+ interface BuildOptions {
172
+ hop?: boolean;
173
+ wallet?: Wallet;
174
+ recipients?: Recipient[];
175
+ walletPassphrase?: string;
176
+ [index: string]: unknown;
177
+ }
178
+ interface FeeEstimate {
179
+ gasLimitEstimate: number;
180
+ feeEstimate: number;
181
+ }
182
+ export interface TransactionPrebuild extends BaseTransactionPrebuild {
183
+ hopTransaction?: HopPrebuild;
184
+ buildParams: {
185
+ recipients: Recipient[];
186
+ };
187
+ recipients: TransactionRecipient[];
188
+ nextContractSequenceId: string;
189
+ gasPrice: number;
190
+ gasLimit: number;
191
+ isBatch: boolean;
192
+ coin: string;
193
+ token?: string;
194
+ }
195
+ interface EthTransactionParams extends TransactionParams {
196
+ gasPrice?: number;
197
+ gasLimit?: number;
198
+ hopParams?: HopParams;
199
+ hop?: boolean;
200
+ }
201
+ interface VerifyEthTransactionOptions extends VerifyTransactionOptions {
202
+ txPrebuild: TransactionPrebuild;
203
+ txParams: EthTransactionParams;
204
+ }
205
+ interface PresignTransactionOptions extends TransactionPrebuild, BasePresignTransactionOptions {
206
+ wallet: Wallet;
207
+ }
208
+ interface RecoverTokenTransaction {
209
+ halfSigned: {
210
+ recipient: Recipient;
211
+ expireTime: number;
212
+ contractSequenceId: number;
213
+ operationHash: string;
214
+ signature: string;
215
+ gasLimit: number;
216
+ gasPrice: number;
217
+ tokenContractAddress: string;
218
+ walletId: string;
219
+ };
220
+ }
221
+ interface EthAddressCoinSpecifics extends AddressCoinSpecific {
222
+ forwarderVersion: number;
223
+ salt?: string;
224
+ }
225
+ interface VerifyEthAddressOptions extends BaseVerifyAddressOptions {
226
+ baseAddress: string;
227
+ coinSpecific: EthAddressCoinSpecifics;
228
+ forwarderVersion: number;
229
+ }
230
+ export declare class Eth extends BaseCoin {
231
+ static hopTransactionSalt: string;
232
+ protected readonly sendMethodName: 'sendMultiSig' | 'sendMultiSigToken';
233
+ readonly staticsCoin?: Readonly<StaticsBaseCoin>;
234
+ protected constructor(bitgo: BitGoBase, staticsCoin?: Readonly<StaticsBaseCoin>);
235
+ static createInstance(bitgo: BitGoBase, staticsCoin?: Readonly<StaticsBaseCoin>): BaseCoin;
236
+ static buildTransaction(params: BuildTransactionParams): EthTxLib.FeeMarketEIP1559Transaction | EthTxLib.Transaction;
237
+ /**
238
+ * Returns the factor between the base unit and its smallest subdivison
239
+ * @return {number}
240
+ */
241
+ getBaseFactor(): string;
242
+ getChain(): string;
243
+ getFamily(): string;
244
+ getNetwork(): EthereumNetwork | undefined;
245
+ getFullName(): string;
246
+ /**
247
+ * Flag for sending value of 0
248
+ * @returns {boolean} True if okay to send 0 value, false otherwise
249
+ */
250
+ valuelessTransferAllowed(): boolean;
251
+ /**
252
+ * Flag for sending data along with transactions
253
+ * @returns {boolean} True if okay to send tx data (ETH), false otherwise
254
+ */
255
+ transactionDataAllowed(): boolean;
256
+ /**
257
+ * Evaluates whether an address string is valid for this coin
258
+ * @param address
259
+ */
260
+ isValidAddress(address: string): boolean;
261
+ /**
262
+ * Return boolean indicating whether input is valid public key for the coin.
263
+ *
264
+ * @param {String} pub the pub to be checked
265
+ * @returns {Boolean} is it valid?
266
+ */
267
+ isValidPub(pub: string): boolean;
268
+ /**
269
+ * Default gas price from platform
270
+ * @returns {BigNumber}
271
+ */
272
+ getRecoveryGasPrice(): any;
273
+ /**
274
+ * Default gas limit from platform
275
+ * @returns {BigNumber}
276
+ */
277
+ getRecoveryGasLimit(): any;
278
+ /**
279
+ * Default expire time for a contract call (1 week)
280
+ * @returns {number} Time in seconds
281
+ */
282
+ getDefaultExpireTime(): number;
283
+ /**
284
+ * Query Etherscan for the balance of an address
285
+ * @param address {String} the ETH address
286
+ * @returns {BigNumber} address balance
287
+ */
288
+ queryAddressBalance(address: string): Promise<any>;
289
+ /**
290
+ * Query Etherscan for the balance of an address for a token
291
+ * @param tokenContractAddress {String} address where the token smart contract is hosted
292
+ * @param walletContractAddress {String} address of the wallet
293
+ * @returns {BigNumber} token balaance in base units
294
+ */
295
+ queryAddressTokenBalance(tokenContractAddress: string, walletContractAddress: string): Promise<any>;
296
+ /**
297
+ * Get transfer operation for coin
298
+ * @param recipient recipient info
299
+ * @param expireTime expiry time
300
+ * @param contractSequenceId sequence id
301
+ * @returns {Array} operation array
302
+ */
303
+ getOperation(recipient: Recipient, expireTime: number, contractSequenceId: number): (string | Buffer)[][];
304
+ getOperationSha3ForExecuteAndConfirm(recipients: Recipient[], expireTime: number, contractSequenceId: number): string;
305
+ /**
306
+ * Queries the contract (via Etherscan) for the next sequence ID
307
+ * @param address {String} address of the contract
308
+ * @returns {Number} sequence ID
309
+ */
310
+ querySequenceId(address: string): Promise<number>;
311
+ /**
312
+ * Helper function for signTransaction for the rare case that SDK is doing the second signature
313
+ * Note: we are expecting this to be called from the offline vault
314
+ * @param params.txPrebuild
315
+ * @param params.signingKeyNonce
316
+ * @param params.walletContractAddress
317
+ * @param params.prv
318
+ * @returns {{txHex: *}}
319
+ */
320
+ signFinal(params: SignFinalOptions): FullySignedTransaction;
321
+ /**
322
+ * Assemble keychain and half-sign prebuilt transaction
323
+ * @param params
324
+ * - txPrebuild
325
+ * - prv
326
+ * @returns {Promise<SignedTransaction>}
327
+ */
328
+ signTransaction(params: SignTransactionOptions): Promise<SignedTransaction>;
329
+ /**
330
+ * Ensure either enterprise or newFeeAddress is passed, to know whether to create new key or use enterprise key
331
+ * @param params
332
+ * @param params.enterprise {String} the enterprise id to associate with this key
333
+ * @param params.newFeeAddress {Boolean} create a new fee address (enterprise not needed in this case)
334
+ */
335
+ preCreateBitGo(params: PrecreateBitGoOptions): void;
336
+ /**
337
+ * Queries public block explorer to get the next ETH nonce that should be used for the given ETH address
338
+ * @param address
339
+ * @returns {*}
340
+ */
341
+ getAddressNonce(address: string): Promise<number>;
342
+ /**
343
+ * Helper function for recover()
344
+ * This transforms the unsigned transaction information into a format the BitGo offline vault expects
345
+ * @param txInfo
346
+ * @param ethTx
347
+ * @param userKey
348
+ * @param backupKey
349
+ * @param gasPrice
350
+ * @param gasLimit
351
+ * @param eip1559
352
+ * @param replayProtectionOptions
353
+ * @returns {Promise<OfflineVaultTxInfo>}
354
+ */
355
+ formatForOfflineVault(txInfo: UnformattedTxInfo, ethTx: EthTxLib.Transaction | EthTxLib.FeeMarketEIP1559Transaction, userKey: string, backupKey: string, gasPrice: Buffer, gasLimit: number, eip1559?: EIP1559, replayProtectionOptions?: ReplayProtectionOptions): Promise<OfflineVaultTxInfo>;
356
+ /**
357
+ * Check whether the gas price passed in by user are within our max and min bounds
358
+ * If they are not set, set them to the defaults
359
+ * @param userGasPrice user defined gas price
360
+ * @returns the gas price to use for this transaction
361
+ */
362
+ setGasPrice(userGasPrice?: number): number;
363
+ /**
364
+ * Check whether gas limit passed in by user are within our max and min bounds
365
+ * If they are not set, set them to the defaults
366
+ * @param userGasLimit user defined gas limit
367
+ * @returns the gas limit to use for this transaction
368
+ */
369
+ setGasLimit(userGasLimit?: number): number;
370
+ /**
371
+ * Builds a funds recovery transaction without BitGo
372
+ * @param params
373
+ * @param params.userKey {String} [encrypted] xprv
374
+ * @param params.backupKey {String} [encrypted] xprv or xpub if the xprv is held by a KRS provider
375
+ * @param params.walletPassphrase {String} used to decrypt userKey and backupKey
376
+ * @param params.walletContractAddress {String} the ETH address of the wallet contract
377
+ * @param params.krsProvider {String} necessary if backup key is held by KRS
378
+ * @param params.recoveryDestination {String} target address to send recovered funds to
379
+ */
380
+ recover(params: RecoverOptions): Promise<RecoveryInfo | OfflineVaultTxInfo>;
381
+ /**
382
+ * Recover an unsupported token from a BitGo multisig wallet
383
+ * This builds a half-signed transaction, for which there will be an admin route to co-sign and broadcast. Optionally
384
+ * the user can set params.broadcast = true and the half-signed tx will be sent to BitGo for cosigning and broadcasting
385
+ * @param params
386
+ * @param params.wallet the wallet to recover the token from
387
+ * @param params.tokenContractAddress the contract address of the unsupported token
388
+ * @param params.recipient the destination address recovered tokens should be sent to
389
+ * @param params.walletPassphrase the wallet passphrase
390
+ * @param params.prv the xprv
391
+ * @param params.broadcast if true, we will automatically submit the half-signed tx to BitGo for cosigning and broadcasting
392
+ */
393
+ recoverToken(params: RecoverTokenOptions): Promise<RecoverTokenTransaction>;
394
+ /**
395
+ * Build arguments to call the send method on the wallet contract
396
+ * @param txInfo
397
+ */
398
+ getSendMethodArgs(txInfo: GetSendMethodArgsOptions): SendMethodArgs[];
399
+ /**
400
+ * Make a query to Etherscan for information such as balance, token balance, solidity calls
401
+ * @param query {Object} key-value pairs of parameters to append after /api
402
+ * @returns {Object} response from Etherscan
403
+ */
404
+ recoveryBlockchainExplorerQuery(query: Record<string, string>): Promise<any>;
405
+ /**
406
+ * Creates the extra parameters needed to build a hop transaction
407
+ * @param buildParams The original build parameters
408
+ * @returns extra parameters object to merge with the original build parameters object and send to the platform
409
+ */
410
+ createHopTransactionParams(buildParams: HopTransactionBuildOptions): Promise<HopParams>;
411
+ /**
412
+ * Validates that the hop prebuild from the HSM is valid and correct
413
+ * @param wallet The wallet that the prebuild is for
414
+ * @param hopPrebuild The prebuild to validate
415
+ * @param originalParams The original parameters passed to prebuildTransaction
416
+ * @returns void
417
+ * @throws Error if The prebuild is invalid
418
+ */
419
+ validateHopPrebuild(wallet: IWallet, hopPrebuild: HopPrebuild, originalParams?: {
420
+ recipients: Recipient[];
421
+ }): Promise<void>;
422
+ /**
423
+ * Gets the hop digest for the user to sign. This is validated in the HSM to prove that the user requested this tx
424
+ * @param paramsArr The parameters to hash together for the digest
425
+ */
426
+ private static getHopDigest;
427
+ /**
428
+ * Modify prebuild before sending it to the server. Add things like hop transaction params
429
+ * @param buildParams The whitelisted parameters for this prebuild
430
+ * @param buildParams.hop True if this should prebuild a hop tx, else false
431
+ * @param buildParams.recipients The recipients array of this transaction
432
+ * @param buildParams.wallet The wallet sending this tx
433
+ * @param buildParams.walletPassphrase the passphrase for this wallet
434
+ */
435
+ getExtraPrebuildParams(buildParams: BuildOptions): Promise<BuildOptions>;
436
+ /**
437
+ * Modify prebuild after receiving it from the server. Add things like nlocktime
438
+ */
439
+ postProcessPrebuild(params: TransactionPrebuild): Promise<TransactionPrebuild>;
440
+ /**
441
+ * Coin-specific things done before signing a transaction, i.e. verification
442
+ * @param params
443
+ */
444
+ presignTransaction(params: PresignTransactionOptions): Promise<PresignTransactionOptions>;
445
+ /**
446
+ * Fetch fee estimate information from the server
447
+ * @param {Object} params The params passed into the function
448
+ * @param {Boolean} [params.hop] True if we should estimate fee for a hop transaction
449
+ * @param {String} [params.recipient] The recipient of the transaction to estimate a send to
450
+ * @param {String} [params.data] The ETH tx data to estimate a send for
451
+ * @returns {Object} The fee info returned from the server
452
+ */
453
+ feeEstimate(params: FeeEstimateOptions): Promise<FeeEstimate>;
454
+ /**
455
+ * Generate secp256k1 key pair
456
+ *
457
+ * @param seed
458
+ * @returns {Object} object with generated pub and prv
459
+ */
460
+ generateKeyPair(seed: Buffer): KeyPair;
461
+ parseTransaction(params: ParseTransactionOptions): Promise<ParsedTransaction>;
462
+ /**
463
+ * Make sure an address is a wallet address and throw an error if it's not.
464
+ * @param {Object} params
465
+ * @param {String} params.address The derived address string on the network
466
+ * @param {Object} params.coinSpecific Coin-specific details for the address such as a forwarderVersion
467
+ * @param {String} params.baseAddress The base address of the wallet on the network
468
+ * @throws {InvalidAddressError}
469
+ * @throws {InvalidAddressVerificationObjectPropertyError}
470
+ * @throws {UnexpectedAddressError}
471
+ * @returns {Boolean} True iff address is a wallet address
472
+ */
473
+ isWalletAddress(params: VerifyEthAddressOptions): boolean;
474
+ verifyCoin(txPrebuild: TransactionPrebuild): boolean;
475
+ /**
476
+ * Verify that a transaction prebuild complies with the original intention
477
+ *
478
+ * @param params
479
+ * @param params.txParams params object passed to send
480
+ * @param params.txPrebuild prebuild object returned by server
481
+ * @param params.wallet Wallet object to obtain keys to verify against
482
+ * @returns {boolean}
483
+ */
484
+ verifyTransaction(params: VerifyEthTransactionOptions): Promise<boolean>;
485
+ supportsStaking(): boolean;
486
+ private isETHAddress;
487
+ }
488
+ export {};
489
+ //# sourceMappingURL=eth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eth.d.ts","sourceRoot":"","sources":["../../src/eth.ts"],"names":[],"mappings":";AAaA,OAAO,EACL,mBAAmB,EACnB,QAAQ,EACR,SAAS,EAIT,kBAAkB,EAGlB,4BAA4B,EAG5B,OAAO,EACP,OAAO,EACP,iBAAiB,EACjB,uBAAuB,EAEvB,yBAAyB,IAAI,6BAA6B,EAC1D,sBAAsB,IAAI,0BAA0B,EACpD,iBAAiB,EACjB,mBAAmB,IAAI,uBAAuB,EAC9C,oBAAoB,EAEpB,oBAAoB,IAAI,wBAAwB,EAChD,wBAAwB,EACxB,MAAM,EACP,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,QAAQ,IAAI,eAAe,EAAE,eAAe,EAAiB,MAAM,gBAAgB,CAAC;AAC7F,OAAO,KAAK,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,KAAK,SAAS,MAAM,oBAAoB,CAAC;AAKrD,eAAO,MAAM,YAAY;;;;;CAwCxB,CAAC;AAEF;;GAEG;AACH,UAAU,SAAS;IACjB,SAAS,EAAE;QACT,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,UAAU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