@atomiqlabs/chain-evm 1.0.0-dev.22

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 (146) hide show
  1. package/LICENSE +201 -0
  2. package/dist/chains/citrea/CitreaChainType.d.ts +13 -0
  3. package/dist/chains/citrea/CitreaChainType.js +2 -0
  4. package/dist/chains/citrea/CitreaInitializer.d.ts +30 -0
  5. package/dist/chains/citrea/CitreaInitializer.js +120 -0
  6. package/dist/evm/btcrelay/BtcRelayAbi.d.ts +198 -0
  7. package/dist/evm/btcrelay/BtcRelayAbi.js +261 -0
  8. package/dist/evm/btcrelay/BtcRelayTypechain.d.ts +172 -0
  9. package/dist/evm/btcrelay/BtcRelayTypechain.js +2 -0
  10. package/dist/evm/btcrelay/EVMBtcRelay.d.ts +188 -0
  11. package/dist/evm/btcrelay/EVMBtcRelay.js +419 -0
  12. package/dist/evm/btcrelay/headers/EVMBtcHeader.d.ts +33 -0
  13. package/dist/evm/btcrelay/headers/EVMBtcHeader.js +84 -0
  14. package/dist/evm/btcrelay/headers/EVMBtcStoredHeader.d.ts +56 -0
  15. package/dist/evm/btcrelay/headers/EVMBtcStoredHeader.js +123 -0
  16. package/dist/evm/chain/EVMChainInterface.d.ts +51 -0
  17. package/dist/evm/chain/EVMChainInterface.js +90 -0
  18. package/dist/evm/chain/EVMModule.d.ts +9 -0
  19. package/dist/evm/chain/EVMModule.js +13 -0
  20. package/dist/evm/chain/modules/ERC20Abi.d.ts +168 -0
  21. package/dist/evm/chain/modules/ERC20Abi.js +225 -0
  22. package/dist/evm/chain/modules/EVMAddresses.d.ts +9 -0
  23. package/dist/evm/chain/modules/EVMAddresses.js +26 -0
  24. package/dist/evm/chain/modules/EVMBlocks.d.ts +20 -0
  25. package/dist/evm/chain/modules/EVMBlocks.js +64 -0
  26. package/dist/evm/chain/modules/EVMEvents.d.ts +36 -0
  27. package/dist/evm/chain/modules/EVMEvents.js +122 -0
  28. package/dist/evm/chain/modules/EVMFees.d.ts +35 -0
  29. package/dist/evm/chain/modules/EVMFees.js +73 -0
  30. package/dist/evm/chain/modules/EVMSignatures.d.ts +29 -0
  31. package/dist/evm/chain/modules/EVMSignatures.js +68 -0
  32. package/dist/evm/chain/modules/EVMTokens.d.ts +49 -0
  33. package/dist/evm/chain/modules/EVMTokens.js +105 -0
  34. package/dist/evm/chain/modules/EVMTransactions.d.ts +89 -0
  35. package/dist/evm/chain/modules/EVMTransactions.js +216 -0
  36. package/dist/evm/contract/EVMContractBase.d.ts +22 -0
  37. package/dist/evm/contract/EVMContractBase.js +34 -0
  38. package/dist/evm/contract/EVMContractModule.d.ts +8 -0
  39. package/dist/evm/contract/EVMContractModule.js +11 -0
  40. package/dist/evm/contract/modules/EVMContractEvents.d.ts +42 -0
  41. package/dist/evm/contract/modules/EVMContractEvents.js +75 -0
  42. package/dist/evm/events/EVMChainEvents.d.ts +22 -0
  43. package/dist/evm/events/EVMChainEvents.js +67 -0
  44. package/dist/evm/events/EVMChainEventsBrowser.d.ts +86 -0
  45. package/dist/evm/events/EVMChainEventsBrowser.js +294 -0
  46. package/dist/evm/spv_swap/EVMSpvVaultContract.d.ts +64 -0
  47. package/dist/evm/spv_swap/EVMSpvVaultContract.js +410 -0
  48. package/dist/evm/spv_swap/EVMSpvVaultData.d.ts +38 -0
  49. package/dist/evm/spv_swap/EVMSpvVaultData.js +159 -0
  50. package/dist/evm/spv_swap/EVMSpvWithdrawalData.d.ts +19 -0
  51. package/dist/evm/spv_swap/EVMSpvWithdrawalData.js +55 -0
  52. package/dist/evm/spv_swap/SpvVaultContractAbi.d.ts +91 -0
  53. package/dist/evm/spv_swap/SpvVaultContractAbi.js +849 -0
  54. package/dist/evm/spv_swap/SpvVaultContractTypechain.d.ts +450 -0
  55. package/dist/evm/spv_swap/SpvVaultContractTypechain.js +2 -0
  56. package/dist/evm/swaps/EVMSwapContract.d.ts +192 -0
  57. package/dist/evm/swaps/EVMSwapContract.js +373 -0
  58. package/dist/evm/swaps/EVMSwapData.d.ts +64 -0
  59. package/dist/evm/swaps/EVMSwapData.js +254 -0
  60. package/dist/evm/swaps/EVMSwapModule.d.ts +9 -0
  61. package/dist/evm/swaps/EVMSwapModule.js +11 -0
  62. package/dist/evm/swaps/EscrowManagerAbi.d.ts +120 -0
  63. package/dist/evm/swaps/EscrowManagerAbi.js +985 -0
  64. package/dist/evm/swaps/EscrowManagerTypechain.d.ts +475 -0
  65. package/dist/evm/swaps/EscrowManagerTypechain.js +2 -0
  66. package/dist/evm/swaps/handlers/IHandler.d.ts +13 -0
  67. package/dist/evm/swaps/handlers/IHandler.js +2 -0
  68. package/dist/evm/swaps/handlers/claim/ClaimHandlers.d.ts +10 -0
  69. package/dist/evm/swaps/handlers/claim/ClaimHandlers.js +13 -0
  70. package/dist/evm/swaps/handlers/claim/HashlockClaimHandler.d.ts +20 -0
  71. package/dist/evm/swaps/handlers/claim/HashlockClaimHandler.js +39 -0
  72. package/dist/evm/swaps/handlers/claim/btc/BitcoinNoncedOutputClaimHandler.d.ts +24 -0
  73. package/dist/evm/swaps/handlers/claim/btc/BitcoinNoncedOutputClaimHandler.js +59 -0
  74. package/dist/evm/swaps/handlers/claim/btc/BitcoinOutputClaimHandler.d.ts +25 -0
  75. package/dist/evm/swaps/handlers/claim/btc/BitcoinOutputClaimHandler.js +51 -0
  76. package/dist/evm/swaps/handlers/claim/btc/BitcoinTxIdClaimHandler.d.ts +21 -0
  77. package/dist/evm/swaps/handlers/claim/btc/BitcoinTxIdClaimHandler.js +28 -0
  78. package/dist/evm/swaps/handlers/claim/btc/IBitcoinClaimHandler.d.ts +48 -0
  79. package/dist/evm/swaps/handlers/claim/btc/IBitcoinClaimHandler.js +63 -0
  80. package/dist/evm/swaps/handlers/refund/TimelockRefundHandler.d.ts +17 -0
  81. package/dist/evm/swaps/handlers/refund/TimelockRefundHandler.js +28 -0
  82. package/dist/evm/swaps/modules/EVMLpVault.d.ts +69 -0
  83. package/dist/evm/swaps/modules/EVMLpVault.js +131 -0
  84. package/dist/evm/swaps/modules/EVMSwapClaim.d.ts +53 -0
  85. package/dist/evm/swaps/modules/EVMSwapClaim.js +101 -0
  86. package/dist/evm/swaps/modules/EVMSwapInit.d.ts +88 -0
  87. package/dist/evm/swaps/modules/EVMSwapInit.js +241 -0
  88. package/dist/evm/swaps/modules/EVMSwapRefund.d.ts +62 -0
  89. package/dist/evm/swaps/modules/EVMSwapRefund.js +132 -0
  90. package/dist/evm/typechain/common.d.ts +50 -0
  91. package/dist/evm/typechain/common.js +2 -0
  92. package/dist/evm/wallet/EVMSigner.d.ts +9 -0
  93. package/dist/evm/wallet/EVMSigner.js +16 -0
  94. package/dist/index.d.ts +37 -0
  95. package/dist/index.js +53 -0
  96. package/dist/utils/Utils.d.ts +15 -0
  97. package/dist/utils/Utils.js +71 -0
  98. package/package.json +37 -0
  99. package/src/chains/citrea/CitreaChainType.ts +28 -0
  100. package/src/chains/citrea/CitreaInitializer.ts +167 -0
  101. package/src/evm/btcrelay/BtcRelayAbi.ts +258 -0
  102. package/src/evm/btcrelay/BtcRelayTypechain.ts +371 -0
  103. package/src/evm/btcrelay/EVMBtcRelay.ts +517 -0
  104. package/src/evm/btcrelay/headers/EVMBtcHeader.ts +110 -0
  105. package/src/evm/btcrelay/headers/EVMBtcStoredHeader.ts +153 -0
  106. package/src/evm/chain/EVMChainInterface.ts +157 -0
  107. package/src/evm/chain/EVMModule.ts +21 -0
  108. package/src/evm/chain/modules/ERC20Abi.ts +222 -0
  109. package/src/evm/chain/modules/EVMAddresses.ts +24 -0
  110. package/src/evm/chain/modules/EVMBlocks.ts +75 -0
  111. package/src/evm/chain/modules/EVMEvents.ts +139 -0
  112. package/src/evm/chain/modules/EVMFees.ts +105 -0
  113. package/src/evm/chain/modules/EVMSignatures.ts +76 -0
  114. package/src/evm/chain/modules/EVMTokens.ts +115 -0
  115. package/src/evm/chain/modules/EVMTransactions.ts +246 -0
  116. package/src/evm/contract/EVMContractBase.ts +63 -0
  117. package/src/evm/contract/EVMContractModule.ts +16 -0
  118. package/src/evm/contract/modules/EVMContractEvents.ts +102 -0
  119. package/src/evm/events/EVMChainEvents.ts +81 -0
  120. package/src/evm/events/EVMChainEventsBrowser.ts +390 -0
  121. package/src/evm/spv_swap/EVMSpvVaultContract.ts +533 -0
  122. package/src/evm/spv_swap/EVMSpvVaultData.ts +201 -0
  123. package/src/evm/spv_swap/EVMSpvWithdrawalData.ts +70 -0
  124. package/src/evm/spv_swap/SpvVaultContractAbi.ts +846 -0
  125. package/src/evm/spv_swap/SpvVaultContractTypechain.ts +685 -0
  126. package/src/evm/swaps/EVMSwapContract.ts +590 -0
  127. package/src/evm/swaps/EVMSwapData.ts +367 -0
  128. package/src/evm/swaps/EVMSwapModule.ts +16 -0
  129. package/src/evm/swaps/EscrowManagerAbi.ts +982 -0
  130. package/src/evm/swaps/EscrowManagerTypechain.ts +723 -0
  131. package/src/evm/swaps/handlers/IHandler.ts +17 -0
  132. package/src/evm/swaps/handlers/claim/ClaimHandlers.ts +20 -0
  133. package/src/evm/swaps/handlers/claim/HashlockClaimHandler.ts +47 -0
  134. package/src/evm/swaps/handlers/claim/btc/BitcoinNoncedOutputClaimHandler.ts +82 -0
  135. package/src/evm/swaps/handlers/claim/btc/BitcoinOutputClaimHandler.ts +76 -0
  136. package/src/evm/swaps/handlers/claim/btc/BitcoinTxIdClaimHandler.ts +46 -0
  137. package/src/evm/swaps/handlers/claim/btc/IBitcoinClaimHandler.ts +115 -0
  138. package/src/evm/swaps/handlers/refund/TimelockRefundHandler.ts +38 -0
  139. package/src/evm/swaps/modules/EVMLpVault.ts +153 -0
  140. package/src/evm/swaps/modules/EVMSwapClaim.ts +141 -0
  141. package/src/evm/swaps/modules/EVMSwapInit.ts +292 -0
  142. package/src/evm/swaps/modules/EVMSwapRefund.ts +198 -0
  143. package/src/evm/typechain/common.ts +131 -0
  144. package/src/evm/wallet/EVMSigner.ts +23 -0
  145. package/src/index.ts +44 -0
  146. package/src/utils/Utils.ts +81 -0
@@ -0,0 +1,450 @@
1
+ import type { BaseContract, BigNumberish, BytesLike, FunctionFragment, Result, Interface, EventFragment, AddressLike, ContractRunner, ContractMethod, Listener } from "ethers";
2
+ import type { TypedContractEvent, TypedDeferredTopicFilter, TypedEventLog, TypedLogDescription, TypedListener, TypedContractMethod } from "../typechain/common";
3
+ export type SpvVaultParametersStruct = {
4
+ btcRelayContract: AddressLike;
5
+ token0: AddressLike;
6
+ token1: AddressLike;
7
+ token0Multiplier: BigNumberish;
8
+ token1Multiplier: BigNumberish;
9
+ confirmations: BigNumberish;
10
+ };
11
+ export type SpvVaultParametersStructOutput = [
12
+ btcRelayContract: string,
13
+ token0: string,
14
+ token1: string,
15
+ token0Multiplier: bigint,
16
+ token1Multiplier: bigint,
17
+ confirmations: bigint
18
+ ] & {
19
+ btcRelayContract: string;
20
+ token0: string;
21
+ token1: string;
22
+ token0Multiplier: bigint;
23
+ token1Multiplier: bigint;
24
+ confirmations: bigint;
25
+ };
26
+ export type StoredBlockHeaderStruct = {
27
+ data: [BytesLike, BytesLike, BytesLike, BytesLike, BytesLike];
28
+ };
29
+ export type StoredBlockHeaderStructOutput = [
30
+ data: [string, string, string, string, string]
31
+ ] & {
32
+ data: [string, string, string, string, string];
33
+ };
34
+ export type BitcoinVaultTransactionDataStruct = {
35
+ recipient: AddressLike;
36
+ amount0: BigNumberish;
37
+ amount1: BigNumberish;
38
+ callerFee0: BigNumberish;
39
+ callerFee1: BigNumberish;
40
+ frontingFee0: BigNumberish;
41
+ frontingFee1: BigNumberish;
42
+ executionHandlerFeeAmount0: BigNumberish;
43
+ executionHash: BytesLike;
44
+ executionExpiry: BigNumberish;
45
+ };
46
+ export type BitcoinVaultTransactionDataStructOutput = [
47
+ recipient: string,
48
+ amount0: bigint,
49
+ amount1: bigint,
50
+ callerFee0: bigint,
51
+ callerFee1: bigint,
52
+ frontingFee0: bigint,
53
+ frontingFee1: bigint,
54
+ executionHandlerFeeAmount0: bigint,
55
+ executionHash: string,
56
+ executionExpiry: bigint
57
+ ] & {
58
+ recipient: string;
59
+ amount0: bigint;
60
+ amount1: bigint;
61
+ callerFee0: bigint;
62
+ callerFee1: bigint;
63
+ frontingFee0: bigint;
64
+ frontingFee1: bigint;
65
+ executionHandlerFeeAmount0: bigint;
66
+ executionHash: string;
67
+ executionExpiry: bigint;
68
+ };
69
+ export type SpvVaultStateStruct = {
70
+ spvVaultParametersCommitment: BytesLike;
71
+ utxoTxHash: BytesLike;
72
+ utxoVout: BigNumberish;
73
+ openBlockheight: BigNumberish;
74
+ withdrawCount: BigNumberish;
75
+ depositCount: BigNumberish;
76
+ token0Amount: BigNumberish;
77
+ token1Amount: BigNumberish;
78
+ };
79
+ export type SpvVaultStateStructOutput = [
80
+ spvVaultParametersCommitment: string,
81
+ utxoTxHash: string,
82
+ utxoVout: bigint,
83
+ openBlockheight: bigint,
84
+ withdrawCount: bigint,
85
+ depositCount: bigint,
86
+ token0Amount: bigint,
87
+ token1Amount: bigint
88
+ ] & {
89
+ spvVaultParametersCommitment: string;
90
+ utxoTxHash: string;
91
+ utxoVout: bigint;
92
+ openBlockheight: bigint;
93
+ withdrawCount: bigint;
94
+ depositCount: bigint;
95
+ token0Amount: bigint;
96
+ token1Amount: bigint;
97
+ };
98
+ export interface SpvVaultManagerInterface extends Interface {
99
+ getFunction(nameOrSignature: "claim" | "deposit" | "front" | "getFronterAddress" | "getFronterById" | "getVault" | "open" | "parseBitcoinTx"): FunctionFragment;
100
+ getEvent(nameOrSignatureOrTopic: "Claimed" | "Closed" | "Deposited" | "Fronted" | "Opened"): EventFragment;
101
+ encodeFunctionData(functionFragment: "claim", values: [
102
+ AddressLike,
103
+ BigNumberish,
104
+ SpvVaultParametersStruct,
105
+ BytesLike,
106
+ StoredBlockHeaderStruct,
107
+ BytesLike[],
108
+ BigNumberish
109
+ ]): string;
110
+ encodeFunctionData(functionFragment: "deposit", values: [
111
+ AddressLike,
112
+ BigNumberish,
113
+ SpvVaultParametersStruct,
114
+ BigNumberish,
115
+ BigNumberish
116
+ ]): string;
117
+ encodeFunctionData(functionFragment: "front", values: [
118
+ AddressLike,
119
+ BigNumberish,
120
+ SpvVaultParametersStruct,
121
+ BigNumberish,
122
+ BytesLike,
123
+ BitcoinVaultTransactionDataStruct
124
+ ]): string;
125
+ encodeFunctionData(functionFragment: "getFronterAddress", values: [
126
+ AddressLike,
127
+ BigNumberish,
128
+ BytesLike,
129
+ BitcoinVaultTransactionDataStruct
130
+ ]): string;
131
+ encodeFunctionData(functionFragment: "getFronterById", values: [AddressLike, BigNumberish, BytesLike]): string;
132
+ encodeFunctionData(functionFragment: "getVault", values: [AddressLike, BigNumberish]): string;
133
+ encodeFunctionData(functionFragment: "open", values: [BigNumberish, SpvVaultParametersStruct, BytesLike, BigNumberish]): string;
134
+ encodeFunctionData(functionFragment: "parseBitcoinTx", values: [BytesLike]): string;
135
+ decodeFunctionResult(functionFragment: "claim", data: BytesLike): Result;
136
+ decodeFunctionResult(functionFragment: "deposit", data: BytesLike): Result;
137
+ decodeFunctionResult(functionFragment: "front", data: BytesLike): Result;
138
+ decodeFunctionResult(functionFragment: "getFronterAddress", data: BytesLike): Result;
139
+ decodeFunctionResult(functionFragment: "getFronterById", data: BytesLike): Result;
140
+ decodeFunctionResult(functionFragment: "getVault", data: BytesLike): Result;
141
+ decodeFunctionResult(functionFragment: "open", data: BytesLike): Result;
142
+ decodeFunctionResult(functionFragment: "parseBitcoinTx", data: BytesLike): Result;
143
+ }
144
+ export declare namespace ClaimedEvent {
145
+ type InputTuple = [
146
+ ownerAndVaultId: BytesLike,
147
+ recipient: AddressLike,
148
+ btcTxHash: BytesLike,
149
+ caller: AddressLike,
150
+ executionHash: BytesLike,
151
+ frontingAddress: AddressLike,
152
+ withdrawCount: BigNumberish,
153
+ amount0: BigNumberish,
154
+ amount1: BigNumberish
155
+ ];
156
+ type OutputTuple = [
157
+ ownerAndVaultId: string,
158
+ recipient: string,
159
+ btcTxHash: string,
160
+ caller: string,
161
+ executionHash: string,
162
+ frontingAddress: string,
163
+ withdrawCount: bigint,
164
+ amount0: bigint,
165
+ amount1: bigint
166
+ ];
167
+ interface OutputObject {
168
+ ownerAndVaultId: string;
169
+ recipient: string;
170
+ btcTxHash: string;
171
+ caller: string;
172
+ executionHash: string;
173
+ frontingAddress: string;
174
+ withdrawCount: bigint;
175
+ amount0: bigint;
176
+ amount1: bigint;
177
+ }
178
+ type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
179
+ type Filter = TypedDeferredTopicFilter<Event>;
180
+ type Log = TypedEventLog<Event>;
181
+ type LogDescription = TypedLogDescription<Event>;
182
+ }
183
+ export declare namespace ClosedEvent {
184
+ type InputTuple = [
185
+ owner: AddressLike,
186
+ vaultId: BigNumberish,
187
+ btcTxHash: BytesLike,
188
+ error: BytesLike
189
+ ];
190
+ type OutputTuple = [
191
+ owner: string,
192
+ vaultId: bigint,
193
+ btcTxHash: string,
194
+ error: string
195
+ ];
196
+ interface OutputObject {
197
+ owner: string;
198
+ vaultId: bigint;
199
+ btcTxHash: string;
200
+ error: string;
201
+ }
202
+ type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
203
+ type Filter = TypedDeferredTopicFilter<Event>;
204
+ type Log = TypedEventLog<Event>;
205
+ type LogDescription = TypedLogDescription<Event>;
206
+ }
207
+ export declare namespace DepositedEvent {
208
+ type InputTuple = [
209
+ ownerAndVaultId: BytesLike,
210
+ depositCount: BigNumberish,
211
+ amount0: BigNumberish,
212
+ amount1: BigNumberish
213
+ ];
214
+ type OutputTuple = [
215
+ ownerAndVaultId: string,
216
+ depositCount: bigint,
217
+ amount0: bigint,
218
+ amount1: bigint
219
+ ];
220
+ interface OutputObject {
221
+ ownerAndVaultId: string;
222
+ depositCount: bigint;
223
+ amount0: bigint;
224
+ amount1: bigint;
225
+ }
226
+ type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
227
+ type Filter = TypedDeferredTopicFilter<Event>;
228
+ type Log = TypedEventLog<Event>;
229
+ type LogDescription = TypedLogDescription<Event>;
230
+ }
231
+ export declare namespace FrontedEvent {
232
+ type InputTuple = [
233
+ ownerAndVaultId: BytesLike,
234
+ recipient: AddressLike,
235
+ btcTxHash: BytesLike,
236
+ caller: AddressLike,
237
+ executionHash: BytesLike,
238
+ amount0: BigNumberish,
239
+ amount1: BigNumberish
240
+ ];
241
+ type OutputTuple = [
242
+ ownerAndVaultId: string,
243
+ recipient: string,
244
+ btcTxHash: string,
245
+ caller: string,
246
+ executionHash: string,
247
+ amount0: bigint,
248
+ amount1: bigint
249
+ ];
250
+ interface OutputObject {
251
+ ownerAndVaultId: string;
252
+ recipient: string;
253
+ btcTxHash: string;
254
+ caller: string;
255
+ executionHash: string;
256
+ amount0: bigint;
257
+ amount1: bigint;
258
+ }
259
+ type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
260
+ type Filter = TypedDeferredTopicFilter<Event>;
261
+ type Log = TypedEventLog<Event>;
262
+ type LogDescription = TypedLogDescription<Event>;
263
+ }
264
+ export declare namespace OpenedEvent {
265
+ type InputTuple = [
266
+ owner: AddressLike,
267
+ vaultId: BigNumberish,
268
+ btcTxHash: BytesLike,
269
+ vout: BigNumberish,
270
+ params: SpvVaultParametersStruct
271
+ ];
272
+ type OutputTuple = [
273
+ owner: string,
274
+ vaultId: bigint,
275
+ btcTxHash: string,
276
+ vout: bigint,
277
+ params: SpvVaultParametersStructOutput
278
+ ];
279
+ interface OutputObject {
280
+ owner: string;
281
+ vaultId: bigint;
282
+ btcTxHash: string;
283
+ vout: bigint;
284
+ params: SpvVaultParametersStructOutput;
285
+ }
286
+ type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
287
+ type Filter = TypedDeferredTopicFilter<Event>;
288
+ type Log = TypedEventLog<Event>;
289
+ type LogDescription = TypedLogDescription<Event>;
290
+ }
291
+ export interface SpvVaultManager extends BaseContract {
292
+ connect(runner?: ContractRunner | null): SpvVaultManager;
293
+ waitForDeployment(): Promise<this>;
294
+ interface: SpvVaultManagerInterface;
295
+ queryFilter<TCEvent extends TypedContractEvent>(event: TCEvent, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise<Array<TypedEventLog<TCEvent>>>;
296
+ queryFilter<TCEvent extends TypedContractEvent>(filter: TypedDeferredTopicFilter<TCEvent>, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise<Array<TypedEventLog<TCEvent>>>;
297
+ on<TCEvent extends TypedContractEvent>(event: TCEvent, listener: TypedListener<TCEvent>): Promise<this>;
298
+ on<TCEvent extends TypedContractEvent>(filter: TypedDeferredTopicFilter<TCEvent>, listener: TypedListener<TCEvent>): Promise<this>;
299
+ once<TCEvent extends TypedContractEvent>(event: TCEvent, listener: TypedListener<TCEvent>): Promise<this>;
300
+ once<TCEvent extends TypedContractEvent>(filter: TypedDeferredTopicFilter<TCEvent>, listener: TypedListener<TCEvent>): Promise<this>;
301
+ listeners<TCEvent extends TypedContractEvent>(event: TCEvent): Promise<Array<TypedListener<TCEvent>>>;
302
+ listeners(eventName?: string): Promise<Array<Listener>>;
303
+ removeAllListeners<TCEvent extends TypedContractEvent>(event?: TCEvent): Promise<this>;
304
+ claim: TypedContractMethod<[
305
+ owner: AddressLike,
306
+ vaultId: BigNumberish,
307
+ vaultParams: SpvVaultParametersStruct,
308
+ transaction: BytesLike,
309
+ blockheader: StoredBlockHeaderStruct,
310
+ merkleProof: BytesLike[],
311
+ position: BigNumberish
312
+ ], [
313
+ void
314
+ ], "nonpayable">;
315
+ deposit: TypedContractMethod<[
316
+ owner: AddressLike,
317
+ vaultId: BigNumberish,
318
+ vaultParams: SpvVaultParametersStruct,
319
+ rawToken0: BigNumberish,
320
+ rawToken1: BigNumberish
321
+ ], [
322
+ void
323
+ ], "payable">;
324
+ front: TypedContractMethod<[
325
+ owner: AddressLike,
326
+ vaultId: BigNumberish,
327
+ vaultParams: SpvVaultParametersStruct,
328
+ withdrawalSequence: BigNumberish,
329
+ btcTxHash: BytesLike,
330
+ data: BitcoinVaultTransactionDataStruct
331
+ ], [
332
+ void
333
+ ], "payable">;
334
+ getFronterAddress: TypedContractMethod<[
335
+ owner: AddressLike,
336
+ vaultId: BigNumberish,
337
+ btcTxHash: BytesLike,
338
+ data: BitcoinVaultTransactionDataStruct
339
+ ], [
340
+ string
341
+ ], "view">;
342
+ getFronterById: TypedContractMethod<[
343
+ owner: AddressLike,
344
+ vaultId: BigNumberish,
345
+ frontingId: BytesLike
346
+ ], [
347
+ string
348
+ ], "view">;
349
+ getVault: TypedContractMethod<[
350
+ owner: AddressLike,
351
+ vaultId: BigNumberish
352
+ ], [
353
+ SpvVaultStateStructOutput
354
+ ], "view">;
355
+ open: TypedContractMethod<[
356
+ vaultId: BigNumberish,
357
+ vaultParams: SpvVaultParametersStruct,
358
+ utxoTxHash: BytesLike,
359
+ utxoVout: BigNumberish
360
+ ], [
361
+ void
362
+ ], "nonpayable">;
363
+ parseBitcoinTx: TypedContractMethod<[
364
+ transaction: BytesLike
365
+ ], [
366
+ BitcoinVaultTransactionDataStructOutput
367
+ ], "view">;
368
+ getFunction<T extends ContractMethod = ContractMethod>(key: string | FunctionFragment): T;
369
+ getFunction(nameOrSignature: "claim"): TypedContractMethod<[
370
+ owner: AddressLike,
371
+ vaultId: BigNumberish,
372
+ vaultParams: SpvVaultParametersStruct,
373
+ transaction: BytesLike,
374
+ blockheader: StoredBlockHeaderStruct,
375
+ merkleProof: BytesLike[],
376
+ position: BigNumberish
377
+ ], [
378
+ void
379
+ ], "nonpayable">;
380
+ getFunction(nameOrSignature: "deposit"): TypedContractMethod<[
381
+ owner: AddressLike,
382
+ vaultId: BigNumberish,
383
+ vaultParams: SpvVaultParametersStruct,
384
+ rawToken0: BigNumberish,
385
+ rawToken1: BigNumberish
386
+ ], [
387
+ void
388
+ ], "payable">;
389
+ getFunction(nameOrSignature: "front"): TypedContractMethod<[
390
+ owner: AddressLike,
391
+ vaultId: BigNumberish,
392
+ vaultParams: SpvVaultParametersStruct,
393
+ withdrawalSequence: BigNumberish,
394
+ btcTxHash: BytesLike,
395
+ data: BitcoinVaultTransactionDataStruct
396
+ ], [
397
+ void
398
+ ], "payable">;
399
+ getFunction(nameOrSignature: "getFronterAddress"): TypedContractMethod<[
400
+ owner: AddressLike,
401
+ vaultId: BigNumberish,
402
+ btcTxHash: BytesLike,
403
+ data: BitcoinVaultTransactionDataStruct
404
+ ], [
405
+ string
406
+ ], "view">;
407
+ getFunction(nameOrSignature: "getFronterById"): TypedContractMethod<[
408
+ owner: AddressLike,
409
+ vaultId: BigNumberish,
410
+ frontingId: BytesLike
411
+ ], [
412
+ string
413
+ ], "view">;
414
+ getFunction(nameOrSignature: "getVault"): TypedContractMethod<[
415
+ owner: AddressLike,
416
+ vaultId: BigNumberish
417
+ ], [
418
+ SpvVaultStateStructOutput
419
+ ], "view">;
420
+ getFunction(nameOrSignature: "open"): TypedContractMethod<[
421
+ vaultId: BigNumberish,
422
+ vaultParams: SpvVaultParametersStruct,
423
+ utxoTxHash: BytesLike,
424
+ utxoVout: BigNumberish
425
+ ], [
426
+ void
427
+ ], "nonpayable">;
428
+ getFunction(nameOrSignature: "parseBitcoinTx"): TypedContractMethod<[
429
+ transaction: BytesLike
430
+ ], [
431
+ BitcoinVaultTransactionDataStructOutput
432
+ ], "view">;
433
+ getEvent(key: "Claimed"): TypedContractEvent<ClaimedEvent.InputTuple, ClaimedEvent.OutputTuple, ClaimedEvent.OutputObject>;
434
+ getEvent(key: "Closed"): TypedContractEvent<ClosedEvent.InputTuple, ClosedEvent.OutputTuple, ClosedEvent.OutputObject>;
435
+ getEvent(key: "Deposited"): TypedContractEvent<DepositedEvent.InputTuple, DepositedEvent.OutputTuple, DepositedEvent.OutputObject>;
436
+ getEvent(key: "Fronted"): TypedContractEvent<FrontedEvent.InputTuple, FrontedEvent.OutputTuple, FrontedEvent.OutputObject>;
437
+ getEvent(key: "Opened"): TypedContractEvent<OpenedEvent.InputTuple, OpenedEvent.OutputTuple, OpenedEvent.OutputObject>;
438
+ filters: {
439
+ "Claimed(bytes32,address,bytes32,address,bytes32,address,uint32,uint64,uint64)": TypedContractEvent<ClaimedEvent.InputTuple, ClaimedEvent.OutputTuple, ClaimedEvent.OutputObject>;
440
+ Claimed: TypedContractEvent<ClaimedEvent.InputTuple, ClaimedEvent.OutputTuple, ClaimedEvent.OutputObject>;
441
+ "Closed(address,uint96,bytes32,bytes)": TypedContractEvent<ClosedEvent.InputTuple, ClosedEvent.OutputTuple, ClosedEvent.OutputObject>;
442
+ Closed: TypedContractEvent<ClosedEvent.InputTuple, ClosedEvent.OutputTuple, ClosedEvent.OutputObject>;
443
+ "Deposited(bytes32,uint32,uint64,uint64)": TypedContractEvent<DepositedEvent.InputTuple, DepositedEvent.OutputTuple, DepositedEvent.OutputObject>;
444
+ Deposited: TypedContractEvent<DepositedEvent.InputTuple, DepositedEvent.OutputTuple, DepositedEvent.OutputObject>;
445
+ "Fronted(bytes32,address,bytes32,address,bytes32,uint64,uint64)": TypedContractEvent<FrontedEvent.InputTuple, FrontedEvent.OutputTuple, FrontedEvent.OutputObject>;
446
+ Fronted: TypedContractEvent<FrontedEvent.InputTuple, FrontedEvent.OutputTuple, FrontedEvent.OutputObject>;
447
+ "Opened(address,uint96,bytes32,uint32,tuple)": TypedContractEvent<OpenedEvent.InputTuple, OpenedEvent.OutputTuple, OpenedEvent.OutputObject>;
448
+ Opened: TypedContractEvent<OpenedEvent.InputTuple, OpenedEvent.OutputTuple, OpenedEvent.OutputObject>;
449
+ };
450
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,192 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ import { ChainSwapType, IntermediaryReputationType, RelaySynchronizer, SignatureData, SwapCommitState, SwapContract, TransactionConfirmationOptions } from "@atomiqlabs/base";
4
+ import { Buffer } from "buffer";
5
+ import { IClaimHandler } from "./handlers/claim/ClaimHandlers";
6
+ import { IHandler } from "./handlers/IHandler";
7
+ import { EVMContractBase } from "../contract/EVMContractBase";
8
+ import { EscrowManager } from "./EscrowManagerTypechain";
9
+ import { EVMSwapData } from "./EVMSwapData";
10
+ import { EVMTx } from "../chain/modules/EVMTransactions";
11
+ import { EVMSigner } from "../wallet/EVMSigner";
12
+ import { EVMChainInterface } from "../chain/EVMChainInterface";
13
+ import { EVMBtcRelay } from "../btcrelay/EVMBtcRelay";
14
+ import { EVMBtcStoredHeader } from "../btcrelay/headers/EVMBtcStoredHeader";
15
+ import { EVMLpVault } from "./modules/EVMLpVault";
16
+ import { EVMPreFetchVerification, EVMSwapInit } from "./modules/EVMSwapInit";
17
+ import { EVMSwapRefund } from "./modules/EVMSwapRefund";
18
+ import { EVMSwapClaim } from "./modules/EVMSwapClaim";
19
+ export declare class EVMSwapContract<ChainId extends string = string> extends EVMContractBase<EscrowManager> implements SwapContract<EVMSwapData, EVMTx, never, EVMPreFetchVerification, EVMSigner, ChainId> {
20
+ readonly chainId: ChainId;
21
+ readonly claimWithSecretTimeout: number;
22
+ readonly claimWithTxDataTimeout: number;
23
+ readonly refundTimeout: number;
24
+ readonly claimGracePeriod: number;
25
+ readonly refundGracePeriod: number;
26
+ readonly authGracePeriod: number;
27
+ readonly Init: EVMSwapInit;
28
+ readonly Refund: EVMSwapRefund;
29
+ readonly Claim: EVMSwapClaim;
30
+ readonly LpVault: EVMLpVault;
31
+ readonly claimHandlersByAddress: {
32
+ [address: string]: IClaimHandler<any, any>;
33
+ };
34
+ readonly claimHandlersBySwapType: {
35
+ [type in ChainSwapType]?: IClaimHandler<any, any>;
36
+ };
37
+ readonly refundHandlersByAddress: {
38
+ [address: string]: IHandler<any, any>;
39
+ };
40
+ readonly timelockRefundHandler: IHandler<any, any>;
41
+ readonly btcRelay: EVMBtcRelay<any>;
42
+ constructor(chainInterface: EVMChainInterface<ChainId>, btcRelay: EVMBtcRelay<any>, contractAddress: string, handlerAddresses: {
43
+ refund: {
44
+ timelock: string;
45
+ };
46
+ claim: {
47
+ [type in ChainSwapType]: string;
48
+ };
49
+ });
50
+ start(): Promise<void>;
51
+ preFetchForInitSignatureVerification(): Promise<EVMPreFetchVerification>;
52
+ getInitSignature(signer: EVMSigner, swapData: EVMSwapData, authorizationTimeout: number, preFetchedBlockData?: never, feeRate?: string): Promise<SignatureData>;
53
+ isValidInitAuthorization(sender: string, swapData: EVMSwapData, { timeout, prefix, signature }: {
54
+ timeout: any;
55
+ prefix: any;
56
+ signature: any;
57
+ }, feeRate?: string, preFetchedData?: EVMPreFetchVerification): Promise<Buffer>;
58
+ getInitAuthorizationExpiry(swapData: EVMSwapData, { timeout, prefix, signature }: {
59
+ timeout: any;
60
+ prefix: any;
61
+ signature: any;
62
+ }, preFetchedData?: EVMPreFetchVerification): Promise<number>;
63
+ isInitAuthorizationExpired(swapData: EVMSwapData, { timeout, prefix, signature }: {
64
+ timeout: any;
65
+ prefix: any;
66
+ signature: any;
67
+ }): Promise<boolean>;
68
+ getRefundSignature(signer: EVMSigner, swapData: EVMSwapData, authorizationTimeout: number): Promise<SignatureData>;
69
+ isValidRefundAuthorization(swapData: EVMSwapData, { timeout, prefix, signature }: {
70
+ timeout: any;
71
+ prefix: any;
72
+ signature: any;
73
+ }): Promise<Buffer>;
74
+ getDataSignature(signer: EVMSigner, data: Buffer): Promise<string>;
75
+ isValidDataSignature(data: Buffer, signature: string, publicKey: string): Promise<boolean>;
76
+ /**
77
+ * Checks whether the claim is claimable by us, that means not expired, we are claimer & the swap is commited
78
+ *
79
+ * @param signer
80
+ * @param data
81
+ */
82
+ isClaimable(signer: string, data: EVMSwapData): Promise<boolean>;
83
+ /**
84
+ * Checks whether a swap is commited, i.e. the swap still exists on-chain and was not claimed nor refunded
85
+ *
86
+ * @param swapData
87
+ */
88
+ isCommited(swapData: EVMSwapData): Promise<boolean>;
89
+ /**
90
+ * Checks whether the swap is expired, takes into consideration possible on-chain time skew, therefore for claimer
91
+ * the swap expires a bit sooner than it should've & for the offerer it expires a bit later
92
+ *
93
+ * @param signer
94
+ * @param data
95
+ */
96
+ isExpired(signer: string, data: EVMSwapData): Promise<boolean>;
97
+ /**
98
+ * Checks if the swap is refundable by us, checks if we are offerer, if the swap is already expired & if the swap
99
+ * is still commited
100
+ *
101
+ * @param signer
102
+ * @param data
103
+ */
104
+ isRequestRefundable(signer: string, data: EVMSwapData): Promise<boolean>;
105
+ getHashForTxId(txId: string, confirmations: number): Buffer;
106
+ /**
107
+ * Get the swap payment hash to be used for an on-chain swap, uses poseidon hash of the value
108
+ *
109
+ * @param outputScript output script required to claim the swap
110
+ * @param amount sats sent required to claim the swap
111
+ * @param confirmations
112
+ * @param nonce swap nonce uniquely identifying the transaction to prevent replay attacks
113
+ */
114
+ getHashForOnchain(outputScript: Buffer, amount: bigint, confirmations: number, nonce?: bigint): Buffer;
115
+ /**
116
+ * Get the swap payment hash to be used for a lightning htlc swap, uses poseidon hash of the sha256 hash of the preimage
117
+ *
118
+ * @param paymentHash payment hash of the HTLC
119
+ */
120
+ getHashForHtlc(paymentHash: Buffer): Buffer;
121
+ getExtraData(outputScript: Buffer, amount: bigint, confirmations: number, nonce?: bigint): Buffer;
122
+ /**
123
+ * Gets the status of the specific swap, this also checks if we are offerer/claimer & checks for expiry (to see
124
+ * if swap is refundable)
125
+ *
126
+ * @param signer
127
+ * @param data
128
+ */
129
+ getCommitStatus(signer: string, data: EVMSwapData): Promise<SwapCommitState>;
130
+ /**
131
+ * Returns the data committed for a specific payment hash, or null if no data is currently commited for
132
+ * the specific swap
133
+ *
134
+ * @param paymentHashHex
135
+ */
136
+ getCommitedData(paymentHashHex: string): Promise<EVMSwapData>;
137
+ createSwapData(type: ChainSwapType, offerer: string, claimer: string, token: string, amount: bigint, paymentHash: string, sequence: bigint, expiry: bigint, payIn: boolean, payOut: boolean, securityDeposit: bigint, claimerBounty: bigint, depositToken?: string): Promise<EVMSwapData>;
138
+ getBalance(signer: string, tokenAddress: string, inContract?: boolean): Promise<bigint>;
139
+ getIntermediaryData(address: string, token: string): Promise<{
140
+ balance: bigint;
141
+ reputation: IntermediaryReputationType;
142
+ }>;
143
+ getIntermediaryReputation(address: string, token: string): Promise<IntermediaryReputationType>;
144
+ getIntermediaryBalance(address: string, token: string): Promise<bigint>;
145
+ txsClaimWithSecret(signer: string | EVMSigner, swapData: EVMSwapData, secret: string, checkExpiry?: boolean, initAta?: boolean, feeRate?: string, skipAtaCheck?: boolean): Promise<EVMTx[]>;
146
+ txsClaimWithTxData(signer: string | EVMSigner, swapData: EVMSwapData, tx: {
147
+ blockhash: string;
148
+ confirmations: number;
149
+ txid: string;
150
+ hex: string;
151
+ height: number;
152
+ }, requiredConfirmations: number, vout: number, commitedHeader?: EVMBtcStoredHeader, synchronizer?: RelaySynchronizer<EVMBtcStoredHeader, EVMTx, any>, initAta?: boolean, feeRate?: string): Promise<EVMTx[] | null>;
153
+ txsRefund(signer: string, swapData: EVMSwapData, check?: boolean, initAta?: boolean, feeRate?: string): Promise<EVMTx[]>;
154
+ txsRefundWithAuthorization(signer: string, swapData: EVMSwapData, { timeout, prefix, signature }: {
155
+ timeout: any;
156
+ prefix: any;
157
+ signature: any;
158
+ }, check?: boolean, initAta?: boolean, feeRate?: string): Promise<EVMTx[]>;
159
+ txsInit(signer: string, swapData: EVMSwapData, { timeout, prefix, signature }: {
160
+ timeout: any;
161
+ prefix: any;
162
+ signature: any;
163
+ }, skipChecks?: boolean, feeRate?: string): Promise<EVMTx[]>;
164
+ txsWithdraw(signer: string, token: string, amount: bigint, feeRate?: string): Promise<EVMTx[]>;
165
+ txsDeposit(signer: string, token: string, amount: bigint, feeRate?: string): Promise<EVMTx[]>;
166
+ claimWithSecret(signer: EVMSigner, swapData: EVMSwapData, secret: string, checkExpiry?: boolean, initAta?: boolean, txOptions?: TransactionConfirmationOptions): Promise<string>;
167
+ claimWithTxData(signer: EVMSigner, swapData: EVMSwapData, tx: {
168
+ blockhash: string;
169
+ confirmations: number;
170
+ txid: string;
171
+ hex: string;
172
+ height: number;
173
+ }, requiredConfirmations: number, vout: number, commitedHeader?: EVMBtcStoredHeader, synchronizer?: RelaySynchronizer<EVMBtcStoredHeader, EVMTx, any>, initAta?: boolean, txOptions?: TransactionConfirmationOptions): Promise<string>;
174
+ refund(signer: EVMSigner, swapData: EVMSwapData, check?: boolean, initAta?: boolean, txOptions?: TransactionConfirmationOptions): Promise<string>;
175
+ refundWithAuthorization(signer: EVMSigner, swapData: EVMSwapData, signature: SignatureData, check?: boolean, initAta?: boolean, txOptions?: TransactionConfirmationOptions): Promise<string>;
176
+ init(signer: EVMSigner, swapData: EVMSwapData, signature: SignatureData, skipChecks?: boolean, txOptions?: TransactionConfirmationOptions): Promise<string>;
177
+ withdraw(signer: EVMSigner, token: string, amount: bigint, txOptions?: TransactionConfirmationOptions): Promise<string>;
178
+ deposit(signer: EVMSigner, token: string, amount: bigint, txOptions?: TransactionConfirmationOptions): Promise<string>;
179
+ getInitPayInFeeRate(offerer?: string, claimer?: string, token?: string, paymentHash?: string): Promise<string>;
180
+ getInitFeeRate(offerer?: string, claimer?: string, token?: string, paymentHash?: string): Promise<string>;
181
+ getRefundFeeRate(swapData: EVMSwapData): Promise<string>;
182
+ getClaimFeeRate(signer: string, swapData: EVMSwapData): Promise<string>;
183
+ getClaimFee(signer: string, swapData: EVMSwapData, feeRate?: string): Promise<bigint>;
184
+ /**
185
+ * Get the estimated solana fee of the commit transaction
186
+ */
187
+ getCommitFee(swapData: EVMSwapData, feeRate?: string): Promise<bigint>;
188
+ /**
189
+ * Get the estimated solana transaction fee of the refund transaction
190
+ */
191
+ getRefundFee(swapData: EVMSwapData, feeRate?: string): Promise<bigint>;
192
+ }