opnet 1.2.2 → 1.2.3

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 (82) hide show
  1. package/browser/_version.d.ts +1 -1
  2. package/browser/abi/shared/interfaces/motoswap/INativeSwapContract.d.ts +71 -0
  3. package/browser/abi/shared/json/motoswap/NATIVE_SWAP_ABI.d.ts +3 -0
  4. package/browser/bitcoin/UTXOs.d.ts +1 -1
  5. package/browser/bitcoin/interfaces/IUTXO.d.ts +1 -1
  6. package/browser/block/Block.d.ts +2 -1
  7. package/browser/contracts/CallResult.d.ts +1 -0
  8. package/browser/index.js +1 -1
  9. package/browser/opnet.d.ts +3 -2
  10. package/browser/providers/AbstractRpcProvider.d.ts +1 -1
  11. package/browser/transactions/Transaction.d.ts +5 -1
  12. package/browser/transactions/TransactionParser.d.ts +3 -2
  13. package/browser/transactions/decoders/DeploymentTransaction.d.ts +2 -1
  14. package/browser/transactions/decoders/GenericTransaction.d.ts +2 -1
  15. package/browser/transactions/decoders/InteractionTransaction.d.ts +2 -1
  16. package/browser/transactions/interfaces/ITransaction.d.ts +2 -0
  17. package/browser/transactions/interfaces/ProofOfWorkChallenge.d.ts +12 -0
  18. package/browser/transactions/interfaces/transactions/ICommonTransaction.d.ts +2 -0
  19. package/browser/transactions/metadata/TransactionInput.d.ts +1 -1
  20. package/browser/transactions/metadata/TransactionOutput.d.ts +1 -1
  21. package/browser/transactions/metadata/TransactionReceipt.d.ts +2 -1
  22. package/build/_version.d.ts +1 -1
  23. package/build/_version.js +1 -1
  24. package/build/abi/shared/interfaces/motoswap/INativeSwapContract.d.ts +71 -0
  25. package/build/abi/shared/json/motoswap/NATIVE_SWAP_ABI.d.ts +3 -0
  26. package/build/abi/shared/json/motoswap/{EWMA_ABI.js → NATIVE_SWAP_ABI.js} +208 -37
  27. package/build/bitcoin/UTXOs.d.ts +1 -1
  28. package/build/bitcoin/interfaces/IUTXO.d.ts +1 -1
  29. package/build/block/Block.d.ts +2 -1
  30. package/build/block/Block.js +2 -2
  31. package/build/contracts/CallResult.d.ts +1 -0
  32. package/build/contracts/CallResult.js +7 -3
  33. package/build/opnet.d.ts +3 -2
  34. package/build/opnet.js +3 -2
  35. package/build/providers/AbstractRpcProvider.d.ts +1 -1
  36. package/build/providers/AbstractRpcProvider.js +4 -4
  37. package/build/transactions/Transaction.d.ts +5 -1
  38. package/build/transactions/Transaction.js +14 -2
  39. package/build/transactions/TransactionParser.d.ts +3 -2
  40. package/build/transactions/TransactionParser.js +6 -6
  41. package/build/transactions/decoders/DeploymentTransaction.d.ts +2 -1
  42. package/build/transactions/decoders/DeploymentTransaction.js +2 -2
  43. package/build/transactions/decoders/GenericTransaction.d.ts +2 -1
  44. package/build/transactions/decoders/GenericTransaction.js +2 -2
  45. package/build/transactions/decoders/InteractionTransaction.d.ts +2 -1
  46. package/build/transactions/decoders/InteractionTransaction.js +2 -2
  47. package/build/transactions/interfaces/ITransaction.d.ts +2 -0
  48. package/build/transactions/interfaces/ProofOfWorkChallenge.d.ts +12 -0
  49. package/build/transactions/interfaces/ProofOfWorkChallenge.js +1 -0
  50. package/build/transactions/interfaces/transactions/ICommonTransaction.d.ts +2 -0
  51. package/build/transactions/metadata/TransactionInput.d.ts +1 -1
  52. package/build/transactions/metadata/TransactionOutput.d.ts +1 -1
  53. package/build/transactions/metadata/TransactionReceipt.d.ts +2 -1
  54. package/build/transactions/metadata/TransactionReceipt.js +12 -8
  55. package/package.json +14 -14
  56. package/src/_version.ts +1 -1
  57. package/src/abi/shared/interfaces/motoswap/INativeSwapContract.ts +267 -0
  58. package/src/abi/shared/json/motoswap/{EWMA_ABI.ts → NATIVE_SWAP_ABI.ts} +252 -37
  59. package/src/bitcoin/UTXOs.ts +2 -2
  60. package/src/bitcoin/interfaces/IUTXO.ts +1 -1
  61. package/src/block/Block.ts +3 -1
  62. package/src/contracts/CallResult.ts +9 -6
  63. package/src/opnet.ts +3 -2
  64. package/src/providers/AbstractRpcProvider.ts +5 -5
  65. package/src/providers/JSONRpcProvider.ts +1 -1
  66. package/src/transactions/Transaction.ts +30 -8
  67. package/src/transactions/TransactionParser.ts +7 -8
  68. package/src/transactions/decoders/DeploymentTransaction.ts +3 -2
  69. package/src/transactions/decoders/GenericTransaction.ts +3 -2
  70. package/src/transactions/decoders/InteractionTransaction.ts +3 -2
  71. package/src/transactions/interfaces/ITransaction.ts +6 -0
  72. package/src/transactions/interfaces/ProofOfWorkChallenge.ts +13 -0
  73. package/src/transactions/interfaces/transactions/ICommonTransaction.ts +6 -0
  74. package/src/transactions/metadata/TransactionInput.ts +1 -1
  75. package/src/transactions/metadata/TransactionOutput.ts +1 -1
  76. package/src/transactions/metadata/TransactionReceipt.ts +23 -11
  77. package/browser/abi/shared/interfaces/motoswap/IEwmaContract.d.ts +0 -46
  78. package/browser/abi/shared/json/motoswap/EWMA_ABI.d.ts +0 -3
  79. package/build/abi/shared/interfaces/motoswap/IEwmaContract.d.ts +0 -46
  80. package/build/abi/shared/json/motoswap/EWMA_ABI.d.ts +0 -3
  81. package/src/abi/shared/interfaces/motoswap/IEwmaContract.ts +0 -188
  82. /package/build/abi/shared/interfaces/motoswap/{IEwmaContract.js → INativeSwapContract.js} +0 -0
@@ -0,0 +1,267 @@
1
+ import { Address } from '@btc-vision/transaction';
2
+ import { CallResult } from '../../../../contracts/CallResult.js';
3
+ import { IOP_NETContract } from '../opnet/IOP_NETContract.js';
4
+
5
+ /**
6
+ * @description Represents the result of the reserve function call.
7
+ */
8
+ export type ReserveEWMA = CallResult<{
9
+ reserved: bigint;
10
+ }>;
11
+
12
+ /**
13
+ * @description Represents the result of adding liquidity.
14
+ */
15
+ export type AddLiquidity = CallResult<{
16
+ ok: boolean;
17
+ }>;
18
+
19
+ /**
20
+ * @description Represents the result of removing liquidity.
21
+ */
22
+ export type RemoveLiquidity = CallResult<{
23
+ ok: boolean;
24
+ }>;
25
+
26
+ /**
27
+ * @description Represents the result of listing liquidity (new).
28
+ */
29
+ export type ListLiquidity = CallResult<{
30
+ ok: boolean;
31
+ }>;
32
+
33
+ /**
34
+ * @description Represents the result of canceling a listing (new).
35
+ */
36
+ export type CancelListing = CallResult<{
37
+ totalTokensReturned: bigint;
38
+ }>;
39
+
40
+ /**
41
+ * @description Represents the result of creating a new pool (new).
42
+ */
43
+ export type CreatePool = CallResult<{
44
+ ok: boolean;
45
+ }>;
46
+
47
+ /**
48
+ * @description Represents the result of setting fees (new).
49
+ */
50
+ export type SetFees = CallResult<{
51
+ ok: boolean;
52
+ }>;
53
+
54
+ /**
55
+ * @description Represents the result of retrieving the fees (new).
56
+ */
57
+ export type GetFees = CallResult<{
58
+ reservationBaseFee: bigint;
59
+ priorityQueueBaseFee: bigint;
60
+ pricePerUserInPriorityQueueBTC: bigint;
61
+ }>;
62
+
63
+ /**
64
+ * @description Represents the result of a swap operation.
65
+ */
66
+ export type Swap = CallResult<{
67
+ ok: boolean;
68
+ }>;
69
+
70
+ /**
71
+ * @description Represents the result of the getReserve function call.
72
+ * Now includes virtualBTCReserve and virtualTokenReserve.
73
+ */
74
+ export type GetReserve = CallResult<{
75
+ liquidity: bigint;
76
+ reservedLiquidity: bigint;
77
+ virtualBTCReserve: bigint;
78
+ virtualTokenReserve: bigint;
79
+ }>;
80
+
81
+ /**
82
+ * @description Represents the result of the getQuote function call.
83
+ * Renamed currentPrice -> price.
84
+ */
85
+ export type GetQuote = CallResult<{
86
+ tokensOut: bigint;
87
+ requiredSatoshis: bigint;
88
+ price: bigint;
89
+ }>;
90
+
91
+ /**
92
+ * @description Represents the result of retrieving provider details.
93
+ */
94
+ export type GetProviderDetails = CallResult<{
95
+ liquidity: bigint;
96
+ reserved: bigint;
97
+ btcReceiver: string;
98
+ }>;
99
+
100
+ /**
101
+ * @description Represents the result of retrieving the priority queue cost.
102
+ */
103
+ export type GetPriorityQueueCost = CallResult<{
104
+ cost: bigint;
105
+ }>;
106
+
107
+ /**
108
+ * @description Represents the result of retrieving the virtual reserves
109
+ */
110
+ export type VirtualReserves = CallResult<{
111
+ virtualBTCReserve: bigint;
112
+ virtualTokenReserve: bigint;
113
+ }>;
114
+
115
+ /**
116
+ * @description This interface represents the NativeSwap contract,
117
+ * including all new/updated methods and type definitions.
118
+ *
119
+ * @interface INativeSwapContract
120
+ * @extends {IOP_NETContract}
121
+ * @category Contracts
122
+ */
123
+ export interface INativeSwapContract extends IOP_NETContract {
124
+ /**
125
+ * @description Reserves a certain amount of tokens, possibly for LP.
126
+ * @param token - The address of the token to reserve.
127
+ * @param maximumAmountIn - The maximum amount of tokens to reserve.
128
+ * @param minimumAmountOut - The minimum amount of tokens expected out.
129
+ * @param forLP - Whether this reservation is for LP or not.
130
+ * @returns {Promise<ReserveEWMA>}
131
+ */
132
+ reserve(
133
+ token: Address,
134
+ maximumAmountIn: bigint,
135
+ minimumAmountOut: bigint,
136
+ forLP: boolean,
137
+ ): Promise<ReserveEWMA>;
138
+
139
+ /**
140
+ * @description Lists liquidity for sale (new).
141
+ * @param token - The address of the token to list.
142
+ * @param receiver - The Bitcoin address for receiving payments.
143
+ * @param amountIn - The amount of tokens to list for sale.
144
+ * @param priority - Whether to place this listing in the priority queue.
145
+ * @returns {Promise<ListLiquidity>}
146
+ */
147
+ listLiquidity(
148
+ token: Address,
149
+ receiver: string,
150
+ amountIn: bigint,
151
+ priority: boolean,
152
+ ): Promise<ListLiquidity>;
153
+
154
+ /**
155
+ * @description Cancels a previously listed liquidity position (new).
156
+ * @param token - The address of the token to remove from the listing.
157
+ * @returns {Promise<CancelListing>}
158
+ */
159
+ cancelListing(token: Address): Promise<CancelListing>;
160
+
161
+ /**
162
+ * @description Creates a new liquidity pool (new).
163
+ * @param token - The token address.
164
+ * @param floorPrice - The floor price to set.
165
+ * @param initialLiquidity - The amount of liquidity to seed.
166
+ * @param receiver - The Bitcoin address for receiving payments.
167
+ * @param antiBotEnabledFor - Number of blocks for anti-bot protection.
168
+ * @param antiBotMaximumTokensPerReservation - Anti-bot max tokens per user.
169
+ * @param maxReservesIn5BlocksPercent - Cap on reserves in a short window.
170
+ * @returns {Promise<CreatePool>}
171
+ */
172
+ createPool(
173
+ token: Address,
174
+ floorPrice: bigint,
175
+ initialLiquidity: bigint,
176
+ receiver: string,
177
+ antiBotEnabledFor: number,
178
+ antiBotMaximumTokensPerReservation: bigint,
179
+ maxReservesIn5BlocksPercent: number,
180
+ ): Promise<CreatePool>;
181
+
182
+ /**
183
+ * @description Sets the global fee parameters (new).
184
+ * @param reservationBaseFee - Base fee for a reservation.
185
+ * @param priorityQueueBaseFee - Base fee for priority queue usage.
186
+ * @param pricePerUserInPriorityQueueBTC - Additional cost per user in queue.
187
+ * @returns {Promise<SetFees>}
188
+ */
189
+ setFees(
190
+ reservationBaseFee: bigint,
191
+ priorityQueueBaseFee: bigint,
192
+ pricePerUserInPriorityQueueBTC: bigint,
193
+ ): Promise<SetFees>;
194
+
195
+ /**
196
+ * @description Retrieves the current fee parameters (new).
197
+ * @returns {Promise<GetFees>}
198
+ */
199
+ getFees(): Promise<GetFees>;
200
+
201
+ /**
202
+ * @description Adds liquidity to the contract.
203
+ * @param token - The address of the token to add liquidity for.
204
+ * @param receiver - The receiver of the liquidity (Bitcoin address).
205
+ * @param amountIn - The amount of tokens to add.
206
+ * @param priority - Whether to prioritize the liquidity addition.
207
+ * @returns {Promise<AddLiquidity>}
208
+ */
209
+ addLiquidity(
210
+ token: Address,
211
+ receiver: string,
212
+ amountIn: bigint,
213
+ priority: boolean,
214
+ ): Promise<AddLiquidity>;
215
+
216
+ /**
217
+ * @description Removes liquidity from the contract.
218
+ * @param token - The address of the token to remove liquidity for.
219
+ * @returns {Promise<RemoveLiquidity>}
220
+ */
221
+ removeLiquidity(token: Address): Promise<RemoveLiquidity>;
222
+
223
+ /**
224
+ * @description Executes a swap operation.
225
+ * @param token - The address of the token to swap.
226
+ * @param isSimulation - Whether this is just a simulation.
227
+ * @returns {Promise<Swap>}
228
+ */
229
+ swap(token: Address, isSimulation: boolean): Promise<Swap>;
230
+
231
+ /**
232
+ * @description Retrieves the reserve information for a token.
233
+ * Now includes virtual pool reserves.
234
+ * @param token - The address of the token.
235
+ * @returns {Promise<GetReserve>}
236
+ */
237
+ getReserve(token: Address): Promise<GetReserve>;
238
+
239
+ /**
240
+ * @description Retrieves a quote for swapping tokens.
241
+ * @param token - The address of the token.
242
+ * @param satoshisIn - The amount of satoshis being sent.
243
+ * @returns {Promise<GetQuote>}
244
+ */
245
+ getQuote(token: Address, satoshisIn: bigint): Promise<GetQuote>;
246
+
247
+ /**
248
+ * @description Retrieves the provider details for a token.
249
+ * @param token - The address of the token.
250
+ * @returns {Promise<GetProviderDetails>}
251
+ */
252
+ getProviderDetails(token: Address): Promise<GetProviderDetails>;
253
+
254
+ /**
255
+ * @description Retrieves the virtual reserves (akin to EWMA).
256
+ * @param token - The address of the token.
257
+ * @returns {Promise<VirtualReserves>}
258
+ */
259
+ getVirtualReserves(token: Address): Promise<VirtualReserves>;
260
+
261
+ /**
262
+ * @description Retrieves the cost for using the priority queue (new).
263
+ * @param token - The address of the token.
264
+ * @returns {Promise<GetPriorityQueueCost>}
265
+ */
266
+ getPriorityQueueCost(token: Address): Promise<GetPriorityQueueCost>;
267
+ }
@@ -6,9 +6,27 @@ import { OP_NET_ABI } from '../opnet/OP_NET_ABI.js';
6
6
  /**
7
7
  * @category Events
8
8
  */
9
- export const EwmaEvents: BitcoinInterfaceAbi = [
9
+ export const NativeSwapEvents: BitcoinInterfaceAbi = [
10
10
  {
11
11
  name: 'LiquidityAdded',
12
+ values: [
13
+ {
14
+ name: 'totalTokensContributed',
15
+ type: ABIDataTypes.UINT256,
16
+ },
17
+ {
18
+ name: 'virtualTokenExchanged',
19
+ type: ABIDataTypes.UINT256,
20
+ },
21
+ {
22
+ name: 'totalSatoshisSpent',
23
+ type: ABIDataTypes.UINT256,
24
+ },
25
+ ],
26
+ type: BitcoinAbiTypes.Event,
27
+ },
28
+ {
29
+ name: 'LiquidityListed',
12
30
  values: [
13
31
  {
14
32
  name: 'totalLiquidity',
@@ -21,6 +39,24 @@ export const EwmaEvents: BitcoinInterfaceAbi = [
21
39
  ],
22
40
  type: BitcoinAbiTypes.Event,
23
41
  },
42
+ {
43
+ name: 'LiquidityRemoved',
44
+ values: [
45
+ {
46
+ name: 'providerId',
47
+ type: ABIDataTypes.UINT256,
48
+ },
49
+ {
50
+ name: 'btcOwed',
51
+ type: ABIDataTypes.UINT256,
52
+ },
53
+ {
54
+ name: 'tokenAmount',
55
+ type: ABIDataTypes.UINT256,
56
+ },
57
+ ],
58
+ type: BitcoinAbiTypes.Event,
59
+ },
24
60
  {
25
61
  name: 'ReservationCreated',
26
62
  values: [
@@ -36,36 +72,36 @@ export const EwmaEvents: BitcoinInterfaceAbi = [
36
72
  type: BitcoinAbiTypes.Event,
37
73
  },
38
74
  {
39
- name: 'LiquidityRemoved',
75
+ name: 'SwapExecuted',
40
76
  values: [
41
77
  {
42
- name: 'token',
78
+ name: 'buyer',
43
79
  type: ABIDataTypes.ADDRESS,
44
80
  },
45
81
  {
46
- name: 'amount',
82
+ name: 'amountIn',
47
83
  type: ABIDataTypes.UINT256,
48
84
  },
49
85
  {
50
- name: 'remainingLiquidity',
86
+ name: 'amountOut',
51
87
  type: ABIDataTypes.UINT256,
52
88
  },
53
89
  ],
54
90
  type: BitcoinAbiTypes.Event,
55
91
  },
56
92
  {
57
- name: 'SwapExecuted',
93
+ name: 'Unlist',
58
94
  values: [
59
95
  {
60
- name: 'buyer',
96
+ name: 'token',
61
97
  type: ABIDataTypes.ADDRESS,
62
98
  },
63
99
  {
64
- name: 'amountIn',
100
+ name: 'amount',
65
101
  type: ABIDataTypes.UINT256,
66
102
  },
67
103
  {
68
- name: 'amountOut',
104
+ name: 'remainingLiquidity',
69
105
  type: ABIDataTypes.UINT256,
70
106
  },
71
107
  ],
@@ -90,7 +126,10 @@ export const EwmaEvents: BitcoinInterfaceAbi = [
90
126
  /**
91
127
  * @category ABI
92
128
  */
93
- export const EwmaAbi: BitcoinInterfaceAbi = [
129
+ export const NativeSwapAbi: BitcoinInterfaceAbi = [
130
+ //=================================================
131
+ // RESERVE
132
+ //=================================================
94
133
  {
95
134
  name: 'reserve',
96
135
  inputs: [
@@ -106,6 +145,10 @@ export const EwmaAbi: BitcoinInterfaceAbi = [
106
145
  name: 'minimumAmountOut',
107
146
  type: ABIDataTypes.UINT256,
108
147
  },
148
+ {
149
+ name: 'forLP',
150
+ type: ABIDataTypes.BOOL,
151
+ },
109
152
  ],
110
153
  outputs: [
111
154
  {
@@ -116,8 +159,11 @@ export const EwmaAbi: BitcoinInterfaceAbi = [
116
159
  type: BitcoinAbiTypes.Function,
117
160
  },
118
161
 
162
+ //=================================================
163
+ // LIST LIQUIDITY
164
+ //=================================================
119
165
  {
120
- name: 'addLiquidity',
166
+ name: 'listLiquidity',
121
167
  inputs: [
122
168
  {
123
169
  name: 'token',
@@ -145,8 +191,11 @@ export const EwmaAbi: BitcoinInterfaceAbi = [
145
191
  type: BitcoinAbiTypes.Function,
146
192
  },
147
193
 
194
+ //=================================================
195
+ // CANCEL LISTING
196
+ //=================================================
148
197
  {
149
- name: 'removeLiquidity',
198
+ name: 'cancelListing',
150
199
  inputs: [
151
200
  {
152
201
  name: 'token',
@@ -162,18 +211,69 @@ export const EwmaAbi: BitcoinInterfaceAbi = [
162
211
  type: BitcoinAbiTypes.Function,
163
212
  },
164
213
 
214
+ //=================================================
215
+ // CREATE POOL
216
+ //=================================================
165
217
  {
166
- name: 'swap',
218
+ name: 'createPool',
167
219
  inputs: [
168
220
  {
169
221
  name: 'token',
170
222
  type: ABIDataTypes.ADDRESS,
171
223
  },
172
224
  {
173
- name: 'isSimulation',
225
+ name: 'floorPrice',
226
+ type: ABIDataTypes.UINT256,
227
+ },
228
+ {
229
+ name: 'initialLiquidity',
230
+ type: ABIDataTypes.UINT128,
231
+ },
232
+ {
233
+ name: 'receiver',
234
+ type: ABIDataTypes.STRING,
235
+ },
236
+ {
237
+ name: 'antiBotEnabledFor',
238
+ type: ABIDataTypes.UINT16,
239
+ },
240
+ {
241
+ name: 'antiBotMaximumTokensPerReservation',
242
+ type: ABIDataTypes.UINT256,
243
+ },
244
+ {
245
+ name: 'maxReservesIn5BlocksPercent',
246
+ type: ABIDataTypes.UINT16,
247
+ },
248
+ ],
249
+ outputs: [
250
+ {
251
+ name: 'ok',
174
252
  type: ABIDataTypes.BOOL,
175
253
  },
176
254
  ],
255
+ type: BitcoinAbiTypes.Function,
256
+ },
257
+
258
+ //=================================================
259
+ // SET FEES
260
+ //=================================================
261
+ {
262
+ name: 'setFees',
263
+ inputs: [
264
+ {
265
+ name: 'reservationBaseFee',
266
+ type: ABIDataTypes.UINT64,
267
+ },
268
+ {
269
+ name: 'priorityQueueBaseFee',
270
+ type: ABIDataTypes.UINT64,
271
+ },
272
+ {
273
+ name: 'pricePerUserInPriorityQueueBTC',
274
+ type: ABIDataTypes.UINT64,
275
+ },
276
+ ],
177
277
  outputs: [
178
278
  {
179
279
  name: 'ok',
@@ -183,6 +283,104 @@ export const EwmaAbi: BitcoinInterfaceAbi = [
183
283
  type: BitcoinAbiTypes.Function,
184
284
  },
185
285
 
286
+ //=================================================
287
+ // GET FEES
288
+ //=================================================
289
+ {
290
+ name: 'getFees',
291
+ inputs: [],
292
+ outputs: [
293
+ {
294
+ name: 'reservationBaseFee',
295
+ type: ABIDataTypes.UINT64,
296
+ },
297
+ {
298
+ name: 'priorityQueueBaseFee',
299
+ type: ABIDataTypes.UINT64,
300
+ },
301
+ {
302
+ name: 'pricePerUserInPriorityQueueBTC',
303
+ type: ABIDataTypes.UINT64,
304
+ },
305
+ ],
306
+ type: BitcoinAbiTypes.Function,
307
+ },
308
+
309
+ //=================================================
310
+ // ADD LIQUIDITY
311
+ //=================================================
312
+ {
313
+ name: 'addLiquidity',
314
+ inputs: [
315
+ {
316
+ name: 'token',
317
+ type: ABIDataTypes.ADDRESS,
318
+ },
319
+ {
320
+ name: 'receiver',
321
+ type: ABIDataTypes.STRING,
322
+ },
323
+ {
324
+ name: 'amountIn',
325
+ type: ABIDataTypes.UINT128,
326
+ },
327
+ {
328
+ name: 'priority',
329
+ type: ABIDataTypes.BOOL,
330
+ },
331
+ ],
332
+ outputs: [
333
+ {
334
+ name: 'ok',
335
+ type: ABIDataTypes.BOOL,
336
+ },
337
+ ],
338
+ type: BitcoinAbiTypes.Function,
339
+ },
340
+
341
+ //=================================================
342
+ // REMOVE LIQUIDITY (changed return type)
343
+ //=================================================
344
+ {
345
+ name: 'removeLiquidity',
346
+ inputs: [
347
+ {
348
+ name: 'token',
349
+ type: ABIDataTypes.ADDRESS,
350
+ },
351
+ ],
352
+ outputs: [
353
+ {
354
+ name: 'ok',
355
+ type: ABIDataTypes.BOOL,
356
+ },
357
+ ],
358
+ type: BitcoinAbiTypes.Function,
359
+ },
360
+
361
+ //=================================================
362
+ // SWAP
363
+ //=================================================
364
+ {
365
+ name: 'swap',
366
+ inputs: [
367
+ {
368
+ name: 'token',
369
+ type: ABIDataTypes.ADDRESS,
370
+ },
371
+ ],
372
+ outputs: [
373
+ {
374
+ name: 'ok',
375
+ type: ABIDataTypes.BOOL,
376
+ },
377
+ ],
378
+ type: BitcoinAbiTypes.Function,
379
+ },
380
+
381
+ //=================================================
382
+ // GET RESERVE
383
+ //=================================================
186
384
  {
187
385
  name: 'getReserve',
188
386
  inputs: [
@@ -200,10 +398,21 @@ export const EwmaAbi: BitcoinInterfaceAbi = [
200
398
  name: 'reservedLiquidity',
201
399
  type: ABIDataTypes.UINT256,
202
400
  },
401
+ {
402
+ name: 'virtualBTCReserve',
403
+ type: ABIDataTypes.UINT256,
404
+ },
405
+ {
406
+ name: 'virtualTokenReserve',
407
+ type: ABIDataTypes.UINT256,
408
+ },
203
409
  ],
204
410
  type: BitcoinAbiTypes.Function,
205
411
  },
206
412
 
413
+ //=================================================
414
+ // GET QUOTE
415
+ //=================================================
207
416
  {
208
417
  name: 'getQuote',
209
418
  inputs: [
@@ -226,36 +435,43 @@ export const EwmaAbi: BitcoinInterfaceAbi = [
226
435
  type: ABIDataTypes.UINT256,
227
436
  },
228
437
  {
229
- name: 'currentPrice',
438
+ name: 'price',
230
439
  type: ABIDataTypes.UINT256,
231
440
  },
232
441
  ],
233
442
  type: BitcoinAbiTypes.Function,
234
443
  },
235
444
 
445
+ //=================================================
446
+ // GET PROVIDER DETAILS
447
+ //=================================================
236
448
  {
237
- name: 'setQuote',
449
+ name: 'getProviderDetails',
238
450
  inputs: [
239
451
  {
240
452
  name: 'token',
241
453
  type: ABIDataTypes.ADDRESS,
242
454
  },
243
- {
244
- name: 'p0',
245
- type: ABIDataTypes.UINT256,
246
- },
247
455
  ],
248
456
  outputs: [
249
457
  {
250
- name: 'ok',
251
- type: ABIDataTypes.BOOL,
458
+ name: 'liquidity',
459
+ type: ABIDataTypes.UINT128,
460
+ },
461
+ {
462
+ name: 'reserved',
463
+ type: ABIDataTypes.UINT128,
464
+ },
465
+ {
466
+ name: 'btcReceiver',
467
+ type: ABIDataTypes.STRING,
252
468
  },
253
469
  ],
254
470
  type: BitcoinAbiTypes.Function,
255
471
  },
256
472
 
257
473
  {
258
- name: 'priorityQueueCost',
474
+ name: 'getVirtualReserves',
259
475
  inputs: [
260
476
  {
261
477
  name: 'token',
@@ -264,15 +480,22 @@ export const EwmaAbi: BitcoinInterfaceAbi = [
264
480
  ],
265
481
  outputs: [
266
482
  {
267
- name: 'cost',
268
- type: ABIDataTypes.UINT128,
483
+ name: 'virtualBTCReserve',
484
+ type: ABIDataTypes.UINT256,
485
+ },
486
+ {
487
+ name: 'virtualTokenReserve',
488
+ type: ABIDataTypes.UINT256,
269
489
  },
270
490
  ],
271
491
  type: BitcoinAbiTypes.Function,
272
492
  },
273
493
 
494
+ //=================================================
495
+ // GET PRIORITY QUEUE COST
496
+ //=================================================
274
497
  {
275
- name: 'getProviderDetails',
498
+ name: 'getPriorityQueueCost',
276
499
  inputs: [
277
500
  {
278
501
  name: 'token',
@@ -281,22 +504,14 @@ export const EwmaAbi: BitcoinInterfaceAbi = [
281
504
  ],
282
505
  outputs: [
283
506
  {
284
- name: 'liquidity',
285
- type: ABIDataTypes.UINT128,
286
- },
287
- {
288
- name: 'reserved',
289
- type: ABIDataTypes.UINT128,
290
- },
291
- {
292
- name: 'btcReceiver',
293
- type: ABIDataTypes.STRING,
507
+ name: 'cost',
508
+ type: ABIDataTypes.UINT64,
294
509
  },
295
510
  ],
296
511
  type: BitcoinAbiTypes.Function,
297
512
  },
298
513
 
299
- ...EwmaEvents,
514
+ ...NativeSwapEvents,
300
515
 
301
516
  // OP_NET
302
517
  ...OP_NET_ABI,