@bitgo-beta/abstract-eth 1.0.2-beta.235 → 1.0.2-beta.2351

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 (188) hide show
  1. package/dist/src/abstractEthLikeCoin.d.ts +20 -9
  2. package/dist/src/abstractEthLikeCoin.d.ts.map +1 -1
  3. package/dist/src/abstractEthLikeCoin.js +46 -15
  4. package/dist/src/abstractEthLikeNewCoins.d.ts +978 -0
  5. package/dist/src/abstractEthLikeNewCoins.d.ts.map +1 -0
  6. package/dist/src/abstractEthLikeNewCoins.js +3072 -0
  7. package/dist/src/ethLikeToken.d.ts +38 -6
  8. package/dist/src/ethLikeToken.d.ts.map +1 -1
  9. package/dist/src/ethLikeToken.js +293 -10
  10. package/dist/src/index.d.ts +2 -0
  11. package/dist/src/index.d.ts.map +1 -1
  12. package/dist/src/index.js +8 -2
  13. package/dist/src/lib/constants.d.ts +4 -0
  14. package/dist/src/lib/constants.d.ts.map +1 -0
  15. package/dist/src/lib/constants.js +11 -0
  16. package/dist/src/lib/contractCall.d.ts +8 -0
  17. package/dist/src/lib/contractCall.d.ts.map +1 -0
  18. package/dist/src/lib/contractCall.js +17 -0
  19. package/dist/src/lib/decryptionDelegationBuilder.d.ts +90 -0
  20. package/dist/src/lib/decryptionDelegationBuilder.d.ts.map +1 -0
  21. package/dist/src/lib/decryptionDelegationBuilder.js +59 -0
  22. package/dist/src/lib/iface.d.ts +173 -0
  23. package/dist/src/lib/iface.d.ts.map +1 -0
  24. package/dist/src/lib/iface.js +8 -0
  25. package/dist/src/lib/index.d.ts +19 -0
  26. package/dist/src/lib/index.d.ts.map +1 -0
  27. package/dist/src/lib/index.js +60 -0
  28. package/dist/src/lib/keyPair.d.ts +26 -0
  29. package/dist/src/lib/keyPair.d.ts.map +1 -0
  30. package/dist/src/lib/keyPair.js +65 -0
  31. package/dist/src/lib/messages/eip191/eip191Message.d.ts +12 -0
  32. package/dist/src/lib/messages/eip191/eip191Message.d.ts.map +1 -0
  33. package/dist/src/lib/messages/eip191/eip191Message.js +25 -0
  34. package/dist/src/lib/messages/eip191/eip191MessageBuilder.d.ts +19 -0
  35. package/dist/src/lib/messages/eip191/eip191MessageBuilder.d.ts.map +1 -0
  36. package/dist/src/lib/messages/eip191/eip191MessageBuilder.js +27 -0
  37. package/dist/src/lib/messages/eip191/index.d.ts +3 -0
  38. package/dist/src/lib/messages/eip191/index.d.ts.map +1 -0
  39. package/dist/src/lib/messages/eip191/index.js +19 -0
  40. package/dist/src/lib/messages/eip712/eip712Message.d.ts +6 -0
  41. package/dist/src/lib/messages/eip712/eip712Message.d.ts.map +1 -0
  42. package/dist/src/lib/messages/eip712/eip712Message.js +27 -0
  43. package/dist/src/lib/messages/eip712/eip712MessageBuilder.d.ts +7 -0
  44. package/dist/src/lib/messages/eip712/eip712MessageBuilder.d.ts.map +1 -0
  45. package/dist/src/lib/messages/eip712/eip712MessageBuilder.js +15 -0
  46. package/dist/src/lib/messages/eip712/index.d.ts +3 -0
  47. package/dist/src/lib/messages/eip712/index.d.ts.map +1 -0
  48. package/dist/src/lib/messages/eip712/index.js +19 -0
  49. package/dist/src/lib/messages/index.d.ts +4 -0
  50. package/dist/src/lib/messages/index.d.ts.map +1 -0
  51. package/dist/src/lib/messages/index.js +20 -0
  52. package/dist/src/lib/messages/messageBuilderFactory.d.ts +7 -0
  53. package/dist/src/lib/messages/messageBuilderFactory.d.ts.map +1 -0
  54. package/dist/src/lib/messages/messageBuilderFactory.js +23 -0
  55. package/dist/src/lib/transaction.d.ts +69 -0
  56. package/dist/src/lib/transaction.d.ts.map +1 -0
  57. package/dist/src/lib/transaction.js +149 -0
  58. package/dist/src/lib/transactionBuilder.d.ts +388 -0
  59. package/dist/src/lib/transactionBuilder.d.ts.map +1 -0
  60. package/dist/src/lib/transactionBuilder.js +1120 -0
  61. package/dist/src/lib/transferBuilder.d.ts +76 -0
  62. package/dist/src/lib/transferBuilder.d.ts.map +1 -0
  63. package/dist/src/lib/transferBuilder.js +307 -0
  64. package/dist/src/lib/transferBuilders/baseNFTTransferBuilder.d.ts +54 -0
  65. package/dist/src/lib/transferBuilders/baseNFTTransferBuilder.d.ts.map +1 -0
  66. package/dist/src/lib/transferBuilders/baseNFTTransferBuilder.js +120 -0
  67. package/dist/src/lib/transferBuilders/index.d.ts +5 -0
  68. package/dist/src/lib/transferBuilders/index.d.ts.map +1 -0
  69. package/dist/src/lib/transferBuilders/index.js +21 -0
  70. package/dist/src/lib/transferBuilders/transferBuilderERC1155.d.ts +17 -0
  71. package/dist/src/lib/transferBuilders/transferBuilderERC1155.d.ts.map +1 -0
  72. package/dist/src/lib/transferBuilders/transferBuilderERC1155.js +96 -0
  73. package/dist/src/lib/transferBuilders/transferBuilderERC721.d.ts +21 -0
  74. package/dist/src/lib/transferBuilders/transferBuilderERC721.d.ts.map +1 -0
  75. package/dist/src/lib/transferBuilders/transferBuilderERC721.js +91 -0
  76. package/dist/src/lib/transferBuilders/transferBuilderERC7984.d.ts +35 -0
  77. package/dist/src/lib/transferBuilders/transferBuilderERC7984.d.ts.map +1 -0
  78. package/dist/src/lib/transferBuilders/transferBuilderERC7984.js +113 -0
  79. package/dist/src/lib/types.d.ts +40 -0
  80. package/dist/src/lib/types.d.ts.map +1 -0
  81. package/dist/src/lib/types.js +140 -0
  82. package/dist/src/lib/utils.d.ts +386 -0
  83. package/dist/src/lib/utils.d.ts.map +1 -0
  84. package/dist/src/lib/utils.js +1026 -0
  85. package/dist/src/lib/walletUtil.d.ts +46 -0
  86. package/dist/src/lib/walletUtil.d.ts.map +1 -0
  87. package/dist/src/lib/walletUtil.js +53 -0
  88. package/dist/src/lib/zamaUtils.d.ts +257 -0
  89. package/dist/src/lib/zamaUtils.d.ts.map +1 -0
  90. package/dist/src/lib/zamaUtils.js +527 -0
  91. package/dist/src/types.d.ts +9 -0
  92. package/dist/src/types.d.ts.map +1 -0
  93. package/dist/src/types.js +3 -0
  94. package/dist/test/index.d.ts +2 -0
  95. package/dist/test/index.d.ts.map +1 -0
  96. package/dist/test/index.js +18 -0
  97. package/dist/test/unit/coin.d.ts +8 -0
  98. package/dist/test/unit/coin.d.ts.map +1 -0
  99. package/dist/test/unit/coin.js +577 -0
  100. package/dist/test/unit/decryptionDelegationBuilder.d.ts +2 -0
  101. package/dist/test/unit/decryptionDelegationBuilder.d.ts.map +1 -0
  102. package/dist/test/unit/decryptionDelegationBuilder.js +265 -0
  103. package/dist/test/unit/index.d.ts +8 -0
  104. package/dist/test/unit/index.d.ts.map +1 -0
  105. package/dist/test/unit/index.js +24 -0
  106. package/dist/test/unit/messages/abstractEthMessageBuilderTests.d.ts +3 -0
  107. package/dist/test/unit/messages/abstractEthMessageBuilderTests.d.ts.map +1 -0
  108. package/dist/test/unit/messages/abstractEthMessageBuilderTests.js +110 -0
  109. package/dist/test/unit/messages/abstractEthMessageTestTypes.d.ts +43 -0
  110. package/dist/test/unit/messages/abstractEthMessageTestTypes.d.ts.map +1 -0
  111. package/dist/test/unit/messages/abstractEthMessageTestTypes.js +3 -0
  112. package/dist/test/unit/messages/abstractEthMessagesTests.d.ts +3 -0
  113. package/dist/test/unit/messages/abstractEthMessagesTests.d.ts.map +1 -0
  114. package/dist/test/unit/messages/abstractEthMessagesTests.js +129 -0
  115. package/dist/test/unit/messages/eip191/eip191Message.d.ts +2 -0
  116. package/dist/test/unit/messages/eip191/eip191Message.d.ts.map +1 -0
  117. package/dist/test/unit/messages/eip191/eip191Message.js +15 -0
  118. package/dist/test/unit/messages/eip191/eip191MessageBuilder.d.ts +2 -0
  119. package/dist/test/unit/messages/eip191/eip191MessageBuilder.d.ts.map +1 -0
  120. package/dist/test/unit/messages/eip191/eip191MessageBuilder.js +16 -0
  121. package/dist/test/unit/messages/eip191/fixtures.d.ts +109 -0
  122. package/dist/test/unit/messages/eip191/fixtures.d.ts.map +1 -0
  123. package/dist/test/unit/messages/eip191/fixtures.js +63 -0
  124. package/dist/test/unit/messages/eip712/eip712Message.d.ts +2 -0
  125. package/dist/test/unit/messages/eip712/eip712Message.d.ts.map +1 -0
  126. package/dist/test/unit/messages/eip712/eip712Message.js +15 -0
  127. package/dist/test/unit/messages/eip712/eip712MessageBuilder.d.ts +2 -0
  128. package/dist/test/unit/messages/eip712/eip712MessageBuilder.d.ts.map +1 -0
  129. package/dist/test/unit/messages/eip712/eip712MessageBuilder.js +16 -0
  130. package/dist/test/unit/messages/eip712/fixtures.d.ts +76 -0
  131. package/dist/test/unit/messages/eip712/fixtures.d.ts.map +1 -0
  132. package/dist/test/unit/messages/eip712/fixtures.js +120 -0
  133. package/dist/test/unit/messages/index.d.ts +4 -0
  134. package/dist/test/unit/messages/index.d.ts.map +1 -0
  135. package/dist/test/unit/messages/index.js +20 -0
  136. package/dist/test/unit/messages/messageBuilderFactory.d.ts +2 -0
  137. package/dist/test/unit/messages/messageBuilderFactory.d.ts.map +1 -0
  138. package/dist/test/unit/messages/messageBuilderFactory.js +52 -0
  139. package/dist/test/unit/token.d.ts +2 -0
  140. package/dist/test/unit/token.d.ts.map +1 -0
  141. package/dist/test/unit/token.js +37 -0
  142. package/dist/test/unit/transaction.d.ts +3 -0
  143. package/dist/test/unit/transaction.d.ts.map +1 -0
  144. package/dist/test/unit/transaction.js +73 -0
  145. package/dist/test/unit/transactionBuilder/addressInitialization.d.ts +8 -0
  146. package/dist/test/unit/transactionBuilder/addressInitialization.d.ts.map +1 -0
  147. package/dist/test/unit/transactionBuilder/addressInitialization.js +95 -0
  148. package/dist/test/unit/transactionBuilder/decryptionDelegation.d.ts +3 -0
  149. package/dist/test/unit/transactionBuilder/decryptionDelegation.d.ts.map +1 -0
  150. package/dist/test/unit/transactionBuilder/decryptionDelegation.js +161 -0
  151. package/dist/test/unit/transactionBuilder/finalizeUnwrapERC7984.d.ts +3 -0
  152. package/dist/test/unit/transactionBuilder/finalizeUnwrapERC7984.d.ts.map +1 -0
  153. package/dist/test/unit/transactionBuilder/finalizeUnwrapERC7984.js +127 -0
  154. package/dist/test/unit/transactionBuilder/flushERC7984.d.ts +3 -0
  155. package/dist/test/unit/transactionBuilder/flushERC7984.d.ts.map +1 -0
  156. package/dist/test/unit/transactionBuilder/flushERC7984.js +292 -0
  157. package/dist/test/unit/transactionBuilder/flushNft.d.ts +2 -0
  158. package/dist/test/unit/transactionBuilder/flushNft.d.ts.map +1 -0
  159. package/dist/test/unit/transactionBuilder/flushNft.js +381 -0
  160. package/dist/test/unit/transactionBuilder/index.d.ts +10 -0
  161. package/dist/test/unit/transactionBuilder/index.d.ts.map +1 -0
  162. package/dist/test/unit/transactionBuilder/index.js +26 -0
  163. package/dist/test/unit/transactionBuilder/send.d.ts +3 -0
  164. package/dist/test/unit/transactionBuilder/send.d.ts.map +1 -0
  165. package/dist/test/unit/transactionBuilder/send.js +197 -0
  166. package/dist/test/unit/transactionBuilder/unwrapERC7984.d.ts +3 -0
  167. package/dist/test/unit/transactionBuilder/unwrapERC7984.d.ts.map +1 -0
  168. package/dist/test/unit/transactionBuilder/unwrapERC7984.js +134 -0
  169. package/dist/test/unit/transactionBuilder/walletInitialization.d.ts +11 -0
  170. package/dist/test/unit/transactionBuilder/walletInitialization.d.ts.map +1 -0
  171. package/dist/test/unit/transactionBuilder/walletInitialization.js +137 -0
  172. package/dist/test/unit/transactionBuilder/wrapERC7984.d.ts +3 -0
  173. package/dist/test/unit/transactionBuilder/wrapERC7984.d.ts.map +1 -0
  174. package/dist/test/unit/transactionBuilder/wrapERC7984.js +140 -0
  175. package/dist/test/unit/transferBuilder.d.ts +2 -0
  176. package/dist/test/unit/transferBuilder.d.ts.map +1 -0
  177. package/dist/test/unit/transferBuilder.js +76 -0
  178. package/dist/test/unit/utils.d.ts +2 -0
  179. package/dist/test/unit/utils.d.ts.map +1 -0
  180. package/dist/test/unit/utils.js +214 -0
  181. package/dist/test/unit/zamaUtils.d.ts +2 -0
  182. package/dist/test/unit/zamaUtils.d.ts.map +1 -0
  183. package/dist/test/unit/zamaUtils.js +616 -0
  184. package/dist/tsconfig.tsbuildinfo +1 -8442
  185. package/package.json +34 -10
  186. package/.eslintignore +0 -5
  187. package/CHANGELOG.md +0 -178
  188. package/LICENSE +0 -191
@@ -0,0 +1,978 @@
1
+ /**
2
+ * @prettier
3
+ */
4
+ import { AddressCoinSpecific, BitGoBase, BuildNftTransferDataOptions, DefiIntentParams, FeeEstimateOptions, FullySignedTransaction, HalfSignedTransaction, IWallet, KeyPair, MPCSweepRecoveryOptions, MPCSweepTxs, MPCTxs, ParsedTransaction, ParseTransactionOptions, PrebuildTransactionResult, PresignTransactionOptions as BasePresignTransactionOptions, Recipient, SignTransactionOptions as BaseSignTransactionOptions, TransactionParams, TransactionPrebuild as BaseTransactionPrebuild, TransactionRecipient, TypedData, UnsignedTransactionTss, VerifyAddressOptions as BaseVerifyAddressOptions, VerifyTransactionOptions, Wallet, TssVerifyAddressOptions, DeriveAddressOptions, DeriveAddressResult, CoinWithSignableConsistency } 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
+ txInfo?: {
59
+ recipients?: TransactionRecipient[];
60
+ nextContractSequenceId?: number;
61
+ eip1559?: EIP1559;
62
+ isBatch?: boolean;
63
+ };
64
+ }
65
+ export interface SignFinalOptions {
66
+ txPrebuild: {
67
+ eip1559?: EIP1559;
68
+ replayProtectionOptions?: ReplayProtectionOptions;
69
+ gasPrice?: string;
70
+ gasLimit?: string;
71
+ recipients?: Recipient[];
72
+ halfSigned?: {
73
+ expireTime: number;
74
+ contractSequenceId: number;
75
+ backupKeyNonce?: number;
76
+ signature: string;
77
+ txHex?: string;
78
+ };
79
+ nextContractSequenceId?: number;
80
+ hopTransaction?: string;
81
+ backupKeyNonce?: number;
82
+ isBatch?: boolean;
83
+ txHex?: string;
84
+ expireTime?: number;
85
+ txInfo?: {
86
+ recipients?: TransactionRecipient[];
87
+ nextContractSequenceId?: number;
88
+ eip1559?: EIP1559;
89
+ isBatch?: boolean;
90
+ };
91
+ };
92
+ signingKeyNonce?: number;
93
+ walletContractAddress?: string;
94
+ prv: string;
95
+ recipients?: Recipient[];
96
+ common?: EthLikeCommon.default;
97
+ }
98
+ export interface SignTransactionOptions extends BaseSignTransactionOptions, SignFinalOptions {
99
+ isLastSignature?: boolean;
100
+ expireTime?: number;
101
+ sequenceId?: number;
102
+ gasLimit?: number;
103
+ gasPrice?: number;
104
+ custodianTransactionId?: string;
105
+ common?: EthLikeCommon.default;
106
+ walletVersion?: number;
107
+ }
108
+ export type SignedTransaction = HalfSignedTransaction | FullySignedTransaction;
109
+ export interface FeesUsed {
110
+ gasPrice: number;
111
+ gasLimit: number;
112
+ }
113
+ interface PrecreateBitGoOptions {
114
+ enterprise?: string;
115
+ newFeeAddress?: string;
116
+ }
117
+ export interface OfflineVaultTxInfo {
118
+ nextContractSequenceId?: string;
119
+ contractSequenceId?: string;
120
+ tx?: string;
121
+ txHex?: string;
122
+ userKey?: string;
123
+ backupKey?: string;
124
+ coin: string;
125
+ gasPrice: number;
126
+ gasLimit: number;
127
+ recipients: Recipient[];
128
+ walletContractAddress: string;
129
+ amount: string;
130
+ backupKeyNonce: number;
131
+ eip1559?: EIP1559;
132
+ replayProtectionOptions?: ReplayProtectionOptions;
133
+ halfSigned?: HalfSignedTransaction;
134
+ feesUsed?: FeesUsed;
135
+ isEvmBasedCrossChainRecovery?: boolean;
136
+ walletVersion?: number;
137
+ }
138
+ interface UnformattedTxInfo {
139
+ recipient: Recipient;
140
+ }
141
+ export type UnsignedSweepTxMPCv2 = {
142
+ txRequests: {
143
+ transactions: [
144
+ {
145
+ unsignedTx: UnsignedTransactionTss;
146
+ nonce: number;
147
+ signatureShares: [];
148
+ }
149
+ ];
150
+ walletCoin: string;
151
+ }[];
152
+ };
153
+ export type UnsignedBuilConsolidation = {
154
+ transactions: MPCSweepTxs[] | UnsignedSweepTxMPCv2[] | RecoveryInfo[] | OfflineVaultTxInfo[];
155
+ lastScanIndex: number;
156
+ };
157
+ export type RecoverOptionsWithBytes = {
158
+ isTss: true;
159
+ /**
160
+ * @deprecated this is no longer used
161
+ */
162
+ openSSLBytes?: Uint8Array;
163
+ };
164
+ export type NonTSSRecoverOptions = {
165
+ isTss?: false | undefined;
166
+ };
167
+ export type TSSRecoverOptions = RecoverOptionsWithBytes | NonTSSRecoverOptions;
168
+ export type RecoverOptions = {
169
+ userKey: string;
170
+ backupKey: string;
171
+ walletPassphrase?: string;
172
+ walletContractAddress: string;
173
+ recoveryDestination: string;
174
+ krsProvider?: string;
175
+ gasPrice?: number;
176
+ gasLimit?: number;
177
+ eip1559?: EIP1559;
178
+ replayProtectionOptions?: ReplayProtectionOptions;
179
+ bitgoFeeAddress?: string;
180
+ bitgoDestinationAddress?: string;
181
+ tokenContractAddress?: string;
182
+ intendedChain?: string;
183
+ common?: EthLikeCommon.default;
184
+ derivationSeed?: string;
185
+ apiKey?: string;
186
+ isUnsignedSweep?: boolean;
187
+ /** ERC-7984: skip auto-query and use this encrypted balance handle directly (bytes32, 0x-prefixed) */
188
+ encryptedHandle?: string;
189
+ } & TSSRecoverOptions;
190
+ export type GetBatchExecutionInfoRT = {
191
+ values: [string[], string[]];
192
+ totalAmount: string;
193
+ };
194
+ export interface BuildTransactionParams {
195
+ to: string;
196
+ nonce?: number;
197
+ value: number;
198
+ data?: Buffer;
199
+ gasPrice?: number;
200
+ gasLimit?: number;
201
+ eip1559?: EIP1559;
202
+ replayProtectionOptions?: ReplayProtectionOptions;
203
+ }
204
+ export interface RecoveryInfo {
205
+ id: string;
206
+ tx: string;
207
+ backupKey?: string;
208
+ coin?: string;
209
+ }
210
+ export interface RecoverTokenTransaction {
211
+ halfSigned: {
212
+ recipient: Recipient;
213
+ expireTime: number;
214
+ contractSequenceId: number;
215
+ operationHash: string;
216
+ signature: string;
217
+ gasLimit: number;
218
+ gasPrice: number;
219
+ tokenContractAddress: string;
220
+ walletId: string;
221
+ };
222
+ }
223
+ export interface RecoverTokenOptions {
224
+ tokenContractAddress: string;
225
+ wallet: Wallet;
226
+ recipient: string;
227
+ broadcast?: boolean;
228
+ walletPassphrase?: string;
229
+ prv?: string;
230
+ }
231
+ export interface GetSendMethodArgsOptions {
232
+ recipient: Recipient;
233
+ expireTime: number;
234
+ contractSequenceId: number;
235
+ signature: string;
236
+ }
237
+ export interface SendMethodArgs {
238
+ name: string;
239
+ type: string;
240
+ value: any;
241
+ }
242
+ interface HopTransactionBuildOptions {
243
+ wallet: Wallet;
244
+ recipients: Recipient[];
245
+ walletPassphrase: string;
246
+ }
247
+ export interface BuildOptions {
248
+ hop?: boolean;
249
+ wallet?: Wallet;
250
+ recipients?: Recipient[];
251
+ walletPassphrase?: string;
252
+ [index: string]: unknown;
253
+ }
254
+ interface FeeEstimate {
255
+ gasLimitEstimate: number;
256
+ feeEstimate: number;
257
+ }
258
+ interface EthTransactionParams extends TransactionParams {
259
+ gasPrice?: number;
260
+ gasLimit?: number;
261
+ hopParams?: HopParams;
262
+ hop?: boolean;
263
+ prebuildTx?: PrebuildTransactionResult;
264
+ tokenName?: string;
265
+ feeToken?: string;
266
+ defiParams?: DefiIntentParams;
267
+ /** ERC-7984 shield intent (`type: 'wrapApprove' | 'wrap'`): wrapper coin name and exact amount. */
268
+ wrapParams?: {
269
+ tokenName: string;
270
+ amount: string;
271
+ };
272
+ }
273
+ export interface VerifyEthTransactionOptions extends VerifyTransactionOptions {
274
+ txPrebuild: TransactionPrebuild;
275
+ txParams: EthTransactionParams;
276
+ }
277
+ interface PresignTransactionOptions extends TransactionPrebuild, BasePresignTransactionOptions {
278
+ wallet: Wallet;
279
+ }
280
+ interface EthAddressCoinSpecifics extends AddressCoinSpecific {
281
+ forwarderVersion: number;
282
+ salt?: string;
283
+ feeAddress?: string;
284
+ }
285
+ export declare const DEFAULT_SCAN_FACTOR = 20;
286
+ export interface EthConsolidationRecoveryOptions {
287
+ coinName?: string;
288
+ walletContractAddress?: string;
289
+ apiKey?: string;
290
+ isTss?: boolean;
291
+ userKey?: string;
292
+ backupKey?: string;
293
+ walletPassphrase?: string;
294
+ recoveryDestination?: string;
295
+ krsProvider?: string;
296
+ gasPrice?: number;
297
+ gasLimit?: number;
298
+ eip1559?: EIP1559;
299
+ replayProtectionOptions?: ReplayProtectionOptions;
300
+ bitgoFeeAddress?: string;
301
+ bitgoDestinationAddress?: string;
302
+ tokenContractAddress?: string;
303
+ intendedChain?: string;
304
+ common?: EthLikeCommon.default;
305
+ derivationSeed?: string;
306
+ bitgoKey?: string;
307
+ startingScanIndex?: number;
308
+ endingScanIndex?: number;
309
+ ignoreAddressTypes?: unknown;
310
+ }
311
+ export interface VerifyEthAddressOptions extends BaseVerifyAddressOptions {
312
+ baseAddress: string;
313
+ coinSpecific: EthAddressCoinSpecifics;
314
+ forwarderVersion?: number;
315
+ walletVersion?: number;
316
+ }
317
+ export type TssVerifyEthAddressOptions = TssVerifyAddressOptions & VerifyEthAddressOptions;
318
+ /**
319
+ * Keychain with ethAddress for BIP32 wallet verification (V1, V2, V4)
320
+ * Used for wallets that derive addresses using Ethereum addresses from keychains
321
+ */
322
+ export interface KeychainWithEthAddress {
323
+ ethAddress: string;
324
+ pub: string;
325
+ }
326
+ /**
327
+ * BIP32 wallet base address verification options
328
+ * Supports V1, V2, and V4 wallets that use ethAddress-based derivation
329
+ */
330
+ export interface VerifyContractBaseAddressOptions extends VerifyEthAddressOptions {
331
+ walletVersion: number;
332
+ keychains: KeychainWithEthAddress[];
333
+ }
334
+ /**
335
+ * Type guard to check if params are for BIP32 base address verification (V1, V2, V4)
336
+ * These wallet versions use ethAddress for address derivation
337
+ */
338
+ export declare function isVerifyContractBaseAddressOptions(params: VerifyEthAddressOptions | TssVerifyEthAddressOptions): params is VerifyContractBaseAddressOptions;
339
+ export declare const optionalDeps: {
340
+ readonly ethAbi: any;
341
+ readonly ethUtil: any;
342
+ readonly EthTx: typeof EthLikeTxLib;
343
+ readonly EthCommon: typeof EthLikeCommon;
344
+ };
345
+ export declare abstract class AbstractEthLikeNewCoins extends AbstractEthLikeCoin implements CoinWithSignableConsistency {
346
+ static hopTransactionSalt: string;
347
+ protected readonly sendMethodName: 'sendMultiSig' | 'sendMultiSigToken';
348
+ readonly staticsCoin?: Readonly<StaticsBaseCoin>;
349
+ protected constructor(bitgo: BitGoBase, staticsCoin?: Readonly<StaticsBaseCoin>);
350
+ /**
351
+ * Method to return the coin's network object
352
+ * @returns {EthLikeNetwork | undefined}
353
+ */
354
+ getNetwork(): EthLikeNetwork | undefined;
355
+ /**
356
+ * Evaluates whether an address string is valid for this coin
357
+ * @param {string} address
358
+ * @returns {boolean} True if address is the valid ethlike adderss
359
+ */
360
+ isValidAddress(address: string): boolean;
361
+ /**
362
+ * Flag for sending data along with transactions
363
+ * @returns {boolean} True if okay to send tx data (ETH), false otherwise
364
+ */
365
+ transactionDataAllowed(): boolean;
366
+ /** @inheritDoc */
367
+ supportsMessageSigning(): boolean;
368
+ /** @inheritDoc */
369
+ supportsSigningTypedData(): boolean;
370
+ /**
371
+ * Default expire time for a contract call (1 week)
372
+ * @returns {number} Time in seconds
373
+ */
374
+ getDefaultExpireTime(): number;
375
+ /**
376
+ * Method to get the custom chain common object based on params from recovery
377
+ * @param {number} chainId - the chain id of the custom chain
378
+ * @returns {EthLikeCommon.default}
379
+ */
380
+ static getCustomChainCommon(chainId: number): EthLikeCommon.default;
381
+ /**
382
+ * Gets correct Eth Common object based on params from either recovery or tx building
383
+ * @param {EIP1559} eip1559 - configs that specify whether we should construct an eip1559 tx
384
+ * @param {ReplayProtectionOptions} replayProtectionOptions - check if chain id supports replay protection
385
+ * @returns {EthLikeCommon.default}
386
+ */
387
+ private static getEthLikeCommon;
388
+ /**
389
+ * Method to build the tx object
390
+ * @param {BuildTransactionParams} params - params to build transaction
391
+ * @returns {EthLikeTxLib.FeeMarketEIP1559Transaction | EthLikeTxLib.Transaction}
392
+ */
393
+ static buildTransaction(params: BuildTransactionParams): EthLikeTxLib.FeeMarketEIP1559Transaction | EthLikeTxLib.Transaction;
394
+ /**
395
+ * Query explorer for the balance of an address
396
+ * @param {String} address - the ETHLike address
397
+ * @param {String} apiKey - optional API key to use instead of the one from the environment
398
+ * @returns {BigNumber} address balance
399
+ */
400
+ queryAddressBalance(address: string, apiKey?: string): Promise<any>;
401
+ /**
402
+ * @param {Recipient[]} recipients - the recipients of the transaction
403
+ * @param {number} expireTime - the expire time of the transaction
404
+ * @param {number} contractSequenceId - the contract sequence id of the transaction
405
+ * @returns {string}
406
+ */
407
+ getOperationSha3ForExecuteAndConfirm(recipients: Recipient[], expireTime: number, contractSequenceId: number): string;
408
+ /**
409
+ * Get transfer operation for coin
410
+ * @param {Recipient} recipient - recipient info
411
+ * @param {number} expireTime - expiry time
412
+ * @param {number} contractSequenceId - sequence id
413
+ * @returns {Array} operation array
414
+ */
415
+ getOperation(recipient: Recipient, expireTime: number, contractSequenceId: number): (string | Buffer)[][];
416
+ /**
417
+ * Queries the contract (via explorer API) for the next sequence ID
418
+ * @param {String} address - address of the contract
419
+ * @param {String} apiKey - optional API key to use instead of the one from the environment
420
+ * @returns {Promise<Number>} sequence ID
421
+ */
422
+ querySequenceId(address: string, apiKey?: string): Promise<number>;
423
+ /**
424
+ * Queries the wallet contract (via explorer API) whether an address is a signer on it.
425
+ * Probes the explicit `isSigner(address)` function because it exists on every deployed
426
+ * WalletSimple generation: the newer generation declares it beside its
427
+ * `mapping(address => bool) public signers`, while eth-multisig-v2 (ETH wallets) only
428
+ * has `address[] public signers` whose getter takes an index. The contracts'
429
+ * non-reverting fallback would return empty data for a missing selector, so probing a
430
+ * generation-specific getter must never happen.
431
+ * @param walletContractAddress - address of the wallet contract
432
+ * @param signerAddress - address to test for membership
433
+ * @param apiKey - optional API key to use instead of the one from the environment
434
+ * @returns true if the address is a signer on the wallet contract
435
+ */
436
+ queryIsWalletSigner(walletContractAddress: string, signerAddress: string, apiKey?: string): Promise<boolean>;
437
+ /**
438
+ * Asserts the user and backup recovery keys are signers on the wallet contract.
439
+ * Runs before any balance/fee check so wrong pairings fail closed with RecoveryKeyMismatchError.
440
+ */
441
+ protected assertRecoveryKeysAreWalletSigners(userKey: string, backupKeyAddress: string, walletContractAddress: string, apiKey?: string): Promise<void>;
442
+ /**
443
+ * Recover an unsupported token from a BitGo multisig wallet
444
+ * This builds a half-signed transaction, for which there will be an admin route to co-sign and broadcast. Optionally
445
+ * the user can set params.broadcast = true and the half-signed tx will be sent to BitGo for cosigning and broadcasting
446
+ * @param {RecoverTokenOptions} params
447
+ * @param {Wallet} params.wallet - the wallet to recover the token from
448
+ * @param {string} params.tokenContractAddress - the contract address of the unsupported token
449
+ * @param {string} params.recipient - the destination address recovered tokens should be sent to
450
+ * @param {string} params.walletPassphrase - the wallet passphrase
451
+ * @param {string} params.prv - the xprv
452
+ * @param {boolean} params.broadcast - if true, we will automatically submit the half-signed tx to BitGo for cosigning and broadcasting
453
+ * @returns {Promise<RecoverTokenTransaction>}
454
+ */
455
+ recoverToken(params: RecoverTokenOptions): Promise<RecoverTokenTransaction>;
456
+ /**
457
+ * Ensure either enterprise or newFeeAddress is passed, to know whether to create new key or use enterprise key
458
+ * @param {PrecreateBitGoOptions} params
459
+ * @param {string} params.enterprise {String} the enterprise id to associate with this key
460
+ * @param {string} params.newFeeAddress {Boolean} create a new fee address (enterprise not needed in this case)
461
+ * @returns {void}
462
+ */
463
+ preCreateBitGo(params: PrecreateBitGoOptions): void;
464
+ /**
465
+ * Queries public block explorer to get the next ETHLike coin's nonce that should be used for the given ETH address
466
+ * @param {string} address
467
+ * @param {string} apiKey - optional API key to use instead of the one from the environment
468
+ * @returns {Promise<number>}
469
+ */
470
+ getAddressNonce(address: string, apiKey?: string): Promise<number>;
471
+ /**
472
+ * Helper function for recover()
473
+ * This transforms the unsigned transaction information into a format the BitGo offline vault expects
474
+ * @param {UnformattedTxInfo} txInfo - tx info
475
+ * @param {EthLikeTxLib.Transaction | EthLikeTxLib.FeeMarketEIP1559Transaction} ethTx - the ethereumjs tx object
476
+ * @param {string} userKey - the user's key
477
+ * @param {string} backupKey - the backup key
478
+ * @param {Buffer} gasPrice - gas price for the tx
479
+ * @param {number} gasLimit - gas limit for the tx
480
+ * @param {EIP1559} eip1559 - eip1559 params
481
+ * @param {ReplayProtectionOptions} replayProtectionOptions - replay protection options
482
+ * @param {apiKey} apiKey - optional apiKey to use when retrieving block chain data
483
+ * @returns {Promise<OfflineVaultTxInfo>}
484
+ */
485
+ formatForOfflineVault(txInfo: UnformattedTxInfo, ethTx: EthLikeTxLib.Transaction | EthLikeTxLib.FeeMarketEIP1559Transaction, userKey: string, backupKey: string, gasPrice: Buffer, gasLimit: number, eip1559?: EIP1559, replayProtectionOptions?: ReplayProtectionOptions, apiKey?: string): Promise<OfflineVaultTxInfo>;
486
+ /**
487
+ * Helper function for recover()
488
+ * This transforms the unsigned transaction information into a format the BitGo offline vault expects
489
+ * @param {UnformattedTxInfo} txInfo - tx info
490
+ * @param {EthLikeTxLib.Transaction | EthLikeTxLib.FeeMarketEIP1559Transaction} ethTx - the ethereumjs tx object
491
+ * @param {string} userKey - the user's key
492
+ * @param {string} backupKey - the backup key
493
+ * @param {Buffer} gasPrice - gas price for the tx
494
+ * @param {number} gasLimit - gas limit for the tx
495
+ * @param {number} backupKeyNonce - the nonce of the backup key address
496
+ * @param {EIP1559} eip1559 - eip1559 params
497
+ * @param {ReplayProtectionOptions} replayProtectionOptions - replay protection options
498
+ * @returns {Promise<OfflineVaultTxInfo>}
499
+ */
500
+ formatForOfflineVaultTSS(txInfo: UnformattedTxInfo, ethTx: EthLikeTxLib.Transaction | EthLikeTxLib.FeeMarketEIP1559Transaction, userKey: string, backupKey: string, gasPrice: Buffer, gasLimit: number, backupKeyNonce: number, eip1559?: EIP1559, replayProtectionOptions?: ReplayProtectionOptions): OfflineVaultTxInfo;
501
+ /**
502
+ * Check whether the gas price passed in by user are within our max and min bounds
503
+ * If they are not set, set them to the defaults
504
+ * @param {number} userGasPrice - user defined gas price
505
+ * @returns {number} the gas price to use for this transaction
506
+ */
507
+ setGasPrice(userGasPrice?: number): number;
508
+ /**
509
+ * Check whether gas limit passed in by user are within our max and min bounds
510
+ * If they are not set, set them to the defaults
511
+ * @param {number} userGasLimit user defined gas limit
512
+ * @returns {number} the gas limit to use for this transaction
513
+ */
514
+ setGasLimit(userGasLimit?: number): number;
515
+ /**
516
+ * Helper function for signTransaction for the rare case that SDK is doing the second signature
517
+ * Note: we are expecting this to be called from the offline vault
518
+ * @param {SignFinalOptions.txPrebuild} params.txPrebuild
519
+ * @param {string} params.prv
520
+ * @returns {{txHex: string}}
521
+ */
522
+ signFinalEthLike(params: SignFinalOptions): Promise<FullySignedTransaction>;
523
+ /**
524
+ * Assemble half-sign prebuilt transaction
525
+ * @param {SignTransactionOptions} params
526
+ */
527
+ signTransaction(params: SignTransactionOptions): Promise<SignedTransaction>;
528
+ /**
529
+ * Method to validate recovery params
530
+ * @param {RecoverOptions} params
531
+ * @returns {void}
532
+ */
533
+ validateRecoveryParams(params: RecoverOptions): void;
534
+ /**
535
+ * Helper which Adds signatures to tx object and re-serializes tx
536
+ * @param {EthLikeCommon.default} ethCommon
537
+ * @param {EthLikeTxLib.FeeMarketEIP1559Transaction | EthLikeTxLib.Transaction} tx
538
+ * @param {ECDSAMethodTypes.Signature} signature
539
+ * @returns {EthLikeTxLib.FeeMarketEIP1559Transaction | EthLikeTxLib.Transaction}
540
+ */
541
+ private getSignedTxFromSignature;
542
+ /**
543
+ * Builds a funds recovery transaction without BitGo
544
+ * @param params
545
+ * @param {string} params.userKey - [encrypted] xprv
546
+ * @param {string} params.backupKey - [encrypted] xprv or xpub if the xprv is held by a KRS provider
547
+ * @param {string} params.walletPassphrase - used to decrypt userKey and backupKey
548
+ * @param {string} params.walletContractAddress - the ETH address of the wallet contract
549
+ * @param {string} params.krsProvider - necessary if backup key is held by KRS
550
+ * @param {string} params.recoveryDestination - target address to send recovered funds to
551
+ * @param {string} params.bitgoFeeAddress - wrong chain wallet fee address for evm based cross chain recovery txn
552
+ * @param {string} params.bitgoDestinationAddress - target bitgo address where fee will be sent for evm based cross chain recovery txn
553
+ */
554
+ recover(params: RecoverOptions): Promise<RecoveryInfo | OfflineVaultTxInfo | UnsignedSweepTxMPCv2>;
555
+ generateForwarderAddress(baseAddress: string, feeAddress: string, forwarderFactoryAddress: string, forwarderImplementationAddress: string, index: number): string;
556
+ deriveAddressFromPublicKey(commonKeychain: string, index: number): string;
557
+ getConsolidationAddress(params: EthConsolidationRecoveryOptions, index: number): string[];
558
+ recoverConsolidations(params: EthConsolidationRecoveryOptions): Promise<UnsignedBuilConsolidation>;
559
+ /**
560
+ * Builds a funds recovery transaction without BitGo for non-TSS transaction
561
+ * @param params
562
+ * @param {string} params.userKey [encrypted] xprv or xpub
563
+ * @param {string} params.backupKey [encrypted] xprv or xpub if the xprv is held by a KRS provider
564
+ * @param {string} params.walletPassphrase used to decrypt userKey and backupKey
565
+ * @param {string} params.walletContractAddress the EthLike address of the wallet contract
566
+ * @param {string} params.krsProvider necessary if backup key is held by KRS
567
+ * @param {string} params.recoveryDestination target address to send recovered funds to
568
+ * @param {string} params.bitgoFeeAddress wrong chain wallet fee address for evm based cross chain recovery txn
569
+ * @param {string} params.bitgoDestinationAddress target bitgo address where fee will be sent for evm based cross chain recovery txn
570
+ * @returns {Promise<RecoveryInfo | OfflineVaultTxInfo>}
571
+ */
572
+ protected recoverEthLike(params: RecoverOptions): Promise<RecoveryInfo | OfflineVaultTxInfo>;
573
+ /**
574
+ * Extract recipients from transaction hex
575
+ * @param txHex - The transaction hex string
576
+ * @returns Array of recipients with address and amount
577
+ */
578
+ private extractRecipientsFromTxHex;
579
+ sendCrossChainRecoveryTransaction(params: SendCrossChainRecoveryOptions): Promise<{
580
+ coin: string;
581
+ txHex?: string;
582
+ txid: string;
583
+ }>;
584
+ buildCrossChainRecoveryTransaction(recoveryId: string): Promise<{
585
+ coin: string;
586
+ txHex: string;
587
+ txid: string;
588
+ walletVersion?: number;
589
+ recipients: Array<{
590
+ address: string;
591
+ amount: string;
592
+ }>;
593
+ }>;
594
+ /**
595
+ * Builds a unsigned (for cold, custody wallet) or
596
+ * half-signed (for hot wallet) evm cross chain recovery transaction with
597
+ * same expected arguments as recover method.
598
+ * This helps recover funds from evm based wrong chain.
599
+ * @param {RecoverOptions} params
600
+ * @returns {Promise<RecoveryInfo | OfflineVaultTxInfo>}
601
+ */
602
+ protected recoverEthLikeforEvmBasedRecovery(params: RecoverOptions): Promise<RecoveryInfo | OfflineVaultTxInfo>;
603
+ /**
604
+ * Query explorer for the balance of an address for a token
605
+ * @param {string} tokenContractAddress - address where the token smart contract is hosted
606
+ * @param {string} walletContractAddress - address of the wallet
607
+ * @param {string} apiKey - optional API key to use instead of the one from the environment
608
+ * @returns {BigNumber} token balaance in base units
609
+ */
610
+ queryAddressTokenBalance(tokenContractAddress: string, walletContractAddress: string, apiKey?: string): Promise<any>;
611
+ recoverEthLikeTokenforEvmBasedRecovery(params: RecoverOptions, bitgoFeeAddressNonce: number, gasLimit: any, gasPrice: any, userKey: any, userSigningKey: any, apiKey?: string): Promise<OfflineVaultTxInfo>;
612
+ /**
613
+ * Validate evm based cross chain recovery params
614
+ * @param params {RecoverOptions}
615
+ * @returns {void}
616
+ */
617
+ validateEvmBasedRecoveryParams(params: RecoverOptions): void;
618
+ /**
619
+ * Return types, values, and total amount in wei to send in a batch transaction, using the method signature
620
+ * `distributeBatch(address[], uint256[])`
621
+ * @param {Recipient[]} recipients - transaction recipients
622
+ * @returns {GetBatchExecutionInfoRT} information needed to execute the batch transaction
623
+ */
624
+ getBatchExecutionInfo(recipients: Recipient[]): GetBatchExecutionInfoRT;
625
+ /**
626
+ * Get the data required to make an ETH function call defined by the given types and values
627
+ *
628
+ * @param {string} functionName - The name of the function being called, e.g. transfer
629
+ * @param types The types of the function call in order
630
+ * @param values The values of the function call in order
631
+ * @return {Buffer} The combined data for the function call
632
+ */
633
+ getMethodCallData: (functionName: any, types: any, values: any) => Buffer<ArrayBuffer>;
634
+ /**
635
+ * Build arguments to call the send method on the wallet contract
636
+ * @param txInfo
637
+ */
638
+ getSendMethodArgs(txInfo: GetSendMethodArgsOptions): SendMethodArgs[];
639
+ /**
640
+ * Recovers a tx with TSS key shares
641
+ * same expected arguments as recover method, but with TSS key shares
642
+ */
643
+ protected recoverTSS(params: RecoverOptions): Promise<RecoveryInfo | OfflineVaultTxInfo | UnsignedSweepTxMPCv2>;
644
+ private getGasValues;
645
+ protected buildUnsignedSweepTxnTSS(params: RecoverOptions): Promise<OfflineVaultTxInfo | UnsignedSweepTxMPCv2>;
646
+ protected buildUnsignedSweepTxnMPCv2(params: RecoverOptions): Promise<UnsignedSweepTxMPCv2>;
647
+ createBroadcastableSweepTransaction(params: MPCSweepRecoveryOptions): Promise<MPCTxs>;
648
+ /**
649
+ * Method to validate recovery params
650
+ * @param {RecoverOptions} params
651
+ * @returns {void}
652
+ */
653
+ private validateUnsignedSweepTSSParams;
654
+ /**
655
+ * Helper function for recover()
656
+ * This transforms the unsigned transaction information into a format the BitGo offline vault expects
657
+ * @param {UnformattedTxInfo} txInfo - tx info
658
+ * @param {LegacyTransaction | FeeMarketEIP1559Transaction} ethTx - the ethereumjs tx object
659
+ * @param {string} derivationPath - the derivationPath
660
+ * @param {number} nonce - the nonce of the backup key address
661
+ * @param {Buffer} gasPrice - gas price for the tx
662
+ * @param {number} gasLimit - gas limit for the tx
663
+ * @param {EIP1559} eip1559 - eip1559 params
664
+ * @param replayProtectionOptions
665
+ * @param commonKeyChain
666
+ * @returns {Promise<OfflineVaultTxInfo>}
667
+ */
668
+ private buildTxRequestForOfflineVaultMPCv2;
669
+ private buildTssRecoveryTxn;
670
+ validateBalanceAndGetTxAmount(baseAddress: string, gasPrice: BN, gasLimit: BN, apiKey?: string): Promise<any>;
671
+ /**
672
+ * Make a query to blockchain explorer for information such as balance, token balance, solidity calls
673
+ * @param query {Object} key-value pairs of parameters to append after /api
674
+ * @param apiKey {string} optional API key to use instead of the one from the environment
675
+ * @returns {Object} response from the blockchain explorer
676
+ */
677
+ recoveryBlockchainExplorerQuery(query: Record<string, string>, apiKey?: string): Promise<any>;
678
+ /**
679
+ * Creates the extra parameters needed to build a hop transaction
680
+ * @param buildParams The original build parameters
681
+ * @returns extra parameters object to merge with the original build parameters object and send to the platform
682
+ */
683
+ createHopTransactionParams(buildParams: HopTransactionBuildOptions): Promise<HopParams>;
684
+ /**
685
+ * Validates that the hop prebuild from the HSM is valid and correct
686
+ * @param {IWallet} wallet - The wallet that the prebuild is for
687
+ * @param {HopPrebuild} hopPrebuild - The prebuild to validate
688
+ * @param {Object} originalParams - The original parameters passed to prebuildTransaction
689
+ * @param {Recipient[]} originalParams.recipients - The original recipients array
690
+ * @returns {void}
691
+ * @throws Error if The prebuild is invalid
692
+ */
693
+ validateHopPrebuild(wallet: IWallet, hopPrebuild: HopPrebuild, originalParams?: {
694
+ recipients: Recipient[];
695
+ }): Promise<void>;
696
+ /**
697
+ * Gets the hop digest for the user to sign. This is validated in the HSM to prove that the user requested this tx
698
+ * @param {string[]} paramsArr - The parameters to hash together for the digest
699
+ * @returns {Buffer}
700
+ */
701
+ static getHopDigest(paramsArr: string[]): Buffer;
702
+ /**
703
+ * Modify prebuild before sending it to the server. Add things like hop transaction params
704
+ * @param {BuildOptions} buildParams - The whitelisted parameters for this prebuild
705
+ * @param {boolean} buildParams.hop - True if this should prebuild a hop tx, else false
706
+ * @param {Recipient[]} buildParams.recipients - The recipients array of this transaction
707
+ * @param {Wallet} buildParams.wallet - The wallet sending this tx
708
+ * @param {string} buildParams.walletPassphrase - the passphrase for this wallet
709
+ * @returns {Promise<BuildOptions>}
710
+ */
711
+ getExtraPrebuildParams(buildParams: BuildOptions): Promise<BuildOptions>;
712
+ /**
713
+ * Modify prebuild after receiving it from the server. Add things like nlocktime
714
+ * @param {TransactionPrebuild} params - The prebuild to modify
715
+ * @returns {TransactionPrebuild} The modified prebuild
716
+ */
717
+ postProcessPrebuild(params: TransactionPrebuild): Promise<TransactionPrebuild>;
718
+ /**
719
+ * Coin-specific things done before signing a transaction, i.e. verification
720
+ * @param {PresignTransactionOptions} params
721
+ * @returns {Promise<PresignTransactionOptions>}
722
+ */
723
+ presignTransaction(params: PresignTransactionOptions): Promise<PresignTransactionOptions>;
724
+ /**
725
+ * Fetch fee estimate information from the server
726
+ * @param {Object} params - The params passed into the function
727
+ * @param {boolean} [params.hop] - True if we should estimate fee for a hop transaction
728
+ * @param {string} [params.recipient] - The recipient of the transaction to estimate a send to
729
+ * @param {string} [params.data] - The ETH tx data to estimate a send for
730
+ * @returns {Object} The fee info returned from the server
731
+ */
732
+ feeEstimate(params: FeeEstimateOptions): Promise<FeeEstimate>;
733
+ /**
734
+ * Generate secp256k1 key pair
735
+ *
736
+ * @param {Buffer} seed
737
+ * @returns {KeyPair} object with generated pub and prv
738
+ */
739
+ generateKeyPair(seed: Buffer): KeyPair;
740
+ parseTransaction(params: ParseTransactionOptions): Promise<ParsedTransaction>;
741
+ /**
742
+ * Get forwarder factory and implementation addresses for deposit address verification.
743
+ * Forwarders are smart contracts that forward funds to the base wallet address.
744
+ *
745
+ * @param {number | undefined} forwarderVersion - The wallet version
746
+ * @returns {object} Factory and implementation addresses for forwarders
747
+ */
748
+ getForwarderFactoryAddressesAndForwarderImplementationAddress(forwarderVersion: number | undefined): {
749
+ forwarderFactoryAddress: string;
750
+ forwarderImplementationAddress: string;
751
+ };
752
+ /**
753
+ * Get wallet base address factory and implementation addresses.
754
+ * This is used for base address verification for V1, V2, V4, and V5 wallets.
755
+ * The base address is the main wallet contract deployed via CREATE2.
756
+ *
757
+ * @param {number} walletVersion - The wallet version (1, 2, 4, or 5)
758
+ * @returns {object} Factory and implementation addresses for the wallet base address
759
+ * @throws {Error} if wallet version addresses are not configured
760
+ */
761
+ getWalletAddressFactoryAddressesAndImplementationAddress(walletVersion: number): {
762
+ walletFactoryAddress: string;
763
+ walletImplementationAddress: string;
764
+ };
765
+ /**
766
+ * Helper method to create a salt buffer from hex string.
767
+ * Converts a hex salt string to a 32-byte buffer.
768
+ *
769
+ * @param {string} salt - The hex salt string
770
+ * @returns {Buffer} 32-byte salt buffer
771
+ */
772
+ private createSaltBuffer;
773
+ /**
774
+ * Verify BIP32 wallet base address (V1, V2, V4).
775
+ * These wallets use a wallet factory to deploy base addresses with CREATE2.
776
+ * The address is derived from the keychains' ethAddresses and a salt.
777
+ *
778
+ * @param {VerifyBip32BaseAddressOptions} params - Verification parameters
779
+ * @returns {object} Expected and actual addresses for comparison
780
+ */
781
+ private verifyCreate2BaseAddress;
782
+ /**
783
+ * Verify forwarder receive address (deposit address).
784
+ * Forwarder addresses are derived using CREATE2 from the base address and salt.
785
+ *
786
+ * @param {VerifyEthAddressOptions} params - Verification parameters
787
+ * @param {number} forwarderVersion - The forwarder version
788
+ * @returns {object} Expected and actual addresses for comparison
789
+ */
790
+ private verifyForwarderAddress;
791
+ /**
792
+ * Make sure an address is a wallet address and throw an error if it's not.
793
+ * @param {Object} params
794
+ * @param {string} params.address - The derived address string on the network
795
+ * @param {Object} params.coinSpecific - Coin-specific details for the address such as a forwarderVersion
796
+ * @param {string} params.baseAddress - The base address of the wallet on the network
797
+ * @throws {InvalidAddressError}
798
+ * @throws {InvalidAddressVerificationObjectPropertyError}
799
+ * @throws {UnexpectedAddressError}
800
+ * @returns {boolean} True iff address is a wallet address
801
+ */
802
+ isWalletAddress(params: VerifyEthAddressOptions | TssVerifyEthAddressOptions): Promise<boolean>;
803
+ /**
804
+ * Locally derive an ETH wallet receive address from a derivation path, using the wallet's
805
+ * commonKeychain only (no private keys, no network access). The inverse of
806
+ * {@link isWalletAddress}: it *produces* the address via the same secp256k1 MPC derivation
807
+ * that isWalletAddress checks against (`deriveMPCWalletAddress` + `KeyPair.getAddress()`),
808
+ * so derive and verify can never diverge.
809
+ *
810
+ * Supports MPC/TSS wallets only (wallet versions 3, 5, 6). Legacy BIP32 forwarder wallets
811
+ * (versions 1, 2, 4) derive per-index forwarder contract addresses and are handled separately.
812
+ * @param params keychains (commonKeychain), derivation index, walletVersion, and optional SMC seed
813
+ * @returns the derived address, the index used, and the HD derivation path
814
+ */
815
+ deriveAddress(params: DeriveAddressOptions): Promise<DeriveAddressResult>;
816
+ /**
817
+ *
818
+ * @param {TransactionPrebuild} txPrebuild
819
+ * @returns {boolean}
820
+ */
821
+ verifyCoin(txPrebuild: TransactionPrebuild): boolean;
822
+ /**
823
+ * Generate transaction explanation for error reporting
824
+ * @param txPrebuild - Transaction prebuild containing txHex and fee info
825
+ * @returns Stringified JSON explanation
826
+ */
827
+ private getTxExplanation;
828
+ /**
829
+ * Verify if a tss transaction is valid
830
+ *
831
+ /** @inheritdoc CoinWithSignableConsistency */
832
+ assertSignableConsistency(serializedTxHex: string, signableHex: string): void;
833
+ /**
834
+ * Decode-and-assert for the ERC-7984 shield approve leg (defense-in-depth).
835
+ *
836
+ * The approve is signed through the chain coin, whose generic checks never parse calldata.
837
+ * WP builds the bytes server-side; re-parse them here so the client signs only
838
+ * `approve(wrapper, amount)` on the pair's underlying ERC-20 with the amount from the intent.
839
+ * Fails closed on any deviation.
840
+ *
841
+ * Scope: this runs when the declared type is `wrapApprove`, and {@link assertWrapperApproveIsDeclared} also
842
+ * forces any approve whose spender is a registered wrapper through it. Deliberately NOT covered: an approve
843
+ * of a registered underlying to a third-party spender under another declared type (tokenApproval, defiApprove,
844
+ * customTx) is indistinguishable from a legitimate approval, so a server that relabels the intent of such a
845
+ * tx still skips this check on signing paths that carry no caller txParams (pendingApproval re-sign).
846
+ */
847
+ private verifyWrapApproveTransaction;
848
+ /**
849
+ * Content-based guard for the ERC-7984 shield approve leg, for txs NOT declared `wrapApprove`.
850
+ *
851
+ * On signing paths that carry no caller txParams (pendingApproval re-sign) the declared type is the
852
+ * server-persisted `intent.intentType`, so a compromised or buggy WP could relabel a mutated
853
+ * `approve(wrapper, amount)` as another type and skip `verifyWrapApproveTransaction`. So an
854
+ * `approve(address,uint256)` sent to a registered ERC-7984 underlying whose spender is that pair's wrapper
855
+ * MUST be declared `wrapApprove` (and so pass the spender/amount check).
856
+ *
857
+ * A tx is rejected only when ALL of these hold:
858
+ * 1. the tx targets a registered ERC-7984 underlying (`to` is in `getErc7984WrappersByUnderlying()`);
859
+ * 2. the calldata is `approve(address,uint256)` (selector match);
860
+ * 3. the spender (first ABI word) is that underlying's wrapper;
861
+ * 4. the declared type is not `wrapApprove` (enforced by the caller, which only invokes this method then).
862
+ *
863
+ * Scoped to wrapper-directed approvals only: approvals of the same token to any other spender, transfers,
864
+ * and every other call are untouched. Known exceptions to "only the shield journey approves the wrapper":
865
+ * a dApp (WalletConnect) approving the wrapper directly would be rejected here, and the unbuilt Phase-2
866
+ * `approve(0)` allowance-reset leg must be declared `wrapApprove` (or get its own branch).
867
+ *
868
+ * On multisig wallets the approve is wrapped in sendMultiSig(underlying, 0, approve(...), ...), so the inner
869
+ * target and calldata are evaluated instead of the outer ones.
870
+ *
871
+ * Parsing is best-effort: if the tx cannot be parsed by this coin's builder the check is skipped, so it can
872
+ * never introduce a new failure for a tx that was verifiable before.
873
+ */
874
+ private assertWrapperApproveIsDeclared;
875
+ /**
876
+ * @param {VerifyEthTransactionOptions} params
877
+ * @param {TransactionParams} params.txParams - params object passed to send
878
+ * @param {TransactionPrebuild} params.txPrebuild - prebuild object returned by server
879
+ * @param {Wallet} params.wallet - Wallet object to obtain keys to verify against
880
+ * @returns {boolean}
881
+ * @throws {TxIntentMismatchRecipientError} if transaction recipients don't match user intent
882
+ */
883
+ verifyTssTransaction(params: VerifyEthTransactionOptions): Promise<boolean>;
884
+ /**
885
+ * Verify that a transaction prebuild complies with the original intention
886
+ *
887
+ * @param {VerifyEthTransactionOptions} params
888
+ * @param {TransactionParams} params.txParams - params object passed to send
889
+ * @param {TransactionPrebuild} params.txPrebuild - prebuild object returned by server
890
+ * @param {Wallet} params.wallet - Wallet object to obtain keys to verify against
891
+ * @returns {boolean}
892
+ * @throws {TxIntentMismatchError} if transaction validation fails
893
+ * @throws {TxIntentMismatchRecipientError} if transaction recipients don't match user intent
894
+ */
895
+ verifyTransaction(params: VerifyEthTransactionOptions): Promise<boolean>;
896
+ /**
897
+ * Check if address is valid eth address
898
+ * @param address
899
+ * @returns {boolean}
900
+ */
901
+ /**
902
+ * Verifies an ERC-7984 token enablement (decryption delegation) transaction for multisig wallets.
903
+ *
904
+ * Two wallet shapes are supported:
905
+ *
906
+ * Base-address wallet — txPrebuild targets the Zama ACL contract directly:
907
+ * txParams.recipients : one entry per token, all with the wallet base address, amount '0'
908
+ * txPrebuild.recipients[0] : the Zama ACL contract address
909
+ *
910
+ * Forwarder wallet — txPrebuild targets the forwarder which calls the ACL via callFromParent:
911
+ * txParams.recipients : one entry per token, all with the forwarder address, amount '0'
912
+ * txPrebuild.recipients[0] : the forwarder address (matches txParams recipients)
913
+ *
914
+ * In both cases all amounts must be 0 and all txParams recipients must share the same address.
915
+ */
916
+ private verifyMultisigEnableTokenTransaction;
917
+ /**
918
+ * Shared tail check for verify paths: the prebuild must be for the coin performing the verification.
919
+ */
920
+ private throwIfPrebuildCoinMismatch;
921
+ /**
922
+ * Verifies an ERC-7984 wrapApprove (shield approval) transaction for non-TSS (onchain multisig) wallets.
923
+ *
924
+ * Multisig shape (server-built unsigned tx):
925
+ * tx.to = wallet contract
926
+ * tx.data = sendMultiSig(underlyingErc20, 0, approve(wrapper, amount), expireTime, sequenceId, signature)
927
+ * txPrebuild.recipients[0] = { address: underlyingErc20, amount: '0', data: approve calldata }
928
+ *
929
+ * Checks: the sendMultiSig inner target is the wrapper pair's underlying ERC-20, the sendMultiSig
930
+ * value is 0, the inner calldata is approve(wrapper, wrapParams.amount) exactly, and — when the
931
+ * prebuild carries build recipients — that they mirror the sendMultiSig args encoded in txHex
932
+ * (the client signs the operation hash over those recipients).
933
+ */
934
+ private verifyMultisigWrapApproveTransaction;
935
+ private isETHAddress;
936
+ /**
937
+ * Transform message to accommodate specific blockchain requirements.
938
+ * @param {string} message - the message to prepare
939
+ * @return {string} the prepared message as a hex encoded string.
940
+ */
941
+ encodeMessage(message: string): string;
942
+ /**
943
+ * Transform the Typed data to accomodate the blockchain requirements (EIP-712)
944
+ * @param {TypedData} typedData - the typed data to prepare
945
+ * @return {Buffer} a buffer of the result
946
+ */
947
+ encodeTypedData(typedData: TypedData): Buffer;
948
+ /**
949
+ * Build the data to transfer an ERC-721 or ERC-1155 token to another address
950
+ * @param params
951
+ */
952
+ buildNftTransferData(params: BuildNftTransferDataOptions): string;
953
+ /**
954
+ * Fetch the gas price from the explorer
955
+ * @param {string} wrongChainCoin - the coin that we're getting gas price for
956
+ * @param {string} apiKey - optional API key to use instead of the one from the environment
957
+ */
958
+ getGasPriceFromExternalAPI(wrongChainCoin: string, apiKey?: string): Promise<BN>;
959
+ /**
960
+ * Fetch the gas limit from the explorer
961
+ * @param intendedChain
962
+ * @param from
963
+ * @param to
964
+ * @param data
965
+ * @param {string} apiKey - optional API key to use instead of the one from the environment
966
+ */
967
+ getGasLimitFromExternalAPI(intendedChain: string, from: string, to: string, data: string, apiKey?: string): Promise<BN>;
968
+ /**
969
+ * Get the balance of bitgoFeeAddress to ensure funds are available to pay fees
970
+ * @param bitgoFeeAddress
971
+ * @param gasPrice
972
+ * @param gasLimit
973
+ * @param apiKey - optional API key to use instead of the one from the environment
974
+ */
975
+ ensureSufficientBalance(bitgoFeeAddress: string, gasPrice: BN, gasLimit: BN, apiKey?: string): Promise<void>;
976
+ }
977
+ export {};
978
+ //# sourceMappingURL=abstractEthLikeNewCoins.d.ts.map