opnet 1.2.1 → 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 (118) hide show
  1. package/browser/_version.d.ts +1 -1
  2. package/browser/abi/shared/interfaces/motoswap/IAdministeredOP20.d.ts +21 -0
  3. package/browser/abi/shared/interfaces/motoswap/IMotoChefContract.d.ts +121 -0
  4. package/browser/abi/shared/interfaces/motoswap/INativeSwapContract.d.ts +71 -0
  5. package/browser/abi/shared/interfaces/motoswap/IOwnableContract.d.ts +12 -0
  6. package/browser/abi/shared/interfaces/motoswap/IOwnableReentrancyGuardContract.d.ts +13 -0
  7. package/browser/abi/shared/interfaces/motoswap/IReentrancyGuardContract.d.ts +7 -0
  8. package/browser/abi/shared/json/motoswap/ADMINISTERD_OP_20_ABI.d.ts +3 -0
  9. package/browser/abi/shared/json/motoswap/MOTOSWAP_MOTOCHEF_ABI.d.ts +4 -0
  10. package/browser/abi/shared/json/motoswap/NATIVE_SWAP_ABI.d.ts +3 -0
  11. package/browser/abi/shared/json/motoswap/OWNABLE_ABI.d.ts +3 -0
  12. package/browser/abi/shared/json/motoswap/REENTRANCY_GUARD_ABI.d.ts +2 -0
  13. package/browser/bitcoin/UTXOs.d.ts +1 -1
  14. package/browser/bitcoin/interfaces/IUTXO.d.ts +1 -1
  15. package/browser/block/Block.d.ts +2 -1
  16. package/browser/contracts/CallResult.d.ts +1 -0
  17. package/browser/index.js +1 -1
  18. package/browser/opnet.d.ts +7 -2
  19. package/browser/providers/AbstractRpcProvider.d.ts +1 -1
  20. package/browser/transactions/Transaction.d.ts +5 -1
  21. package/browser/transactions/TransactionParser.d.ts +3 -2
  22. package/browser/transactions/decoders/DeploymentTransaction.d.ts +2 -1
  23. package/browser/transactions/decoders/GenericTransaction.d.ts +2 -1
  24. package/browser/transactions/decoders/InteractionTransaction.d.ts +2 -1
  25. package/browser/transactions/interfaces/ITransaction.d.ts +2 -0
  26. package/browser/transactions/interfaces/ProofOfWorkChallenge.d.ts +12 -0
  27. package/browser/transactions/interfaces/transactions/ICommonTransaction.d.ts +2 -0
  28. package/browser/transactions/metadata/TransactionInput.d.ts +1 -1
  29. package/browser/transactions/metadata/TransactionOutput.d.ts +1 -1
  30. package/browser/transactions/metadata/TransactionReceipt.d.ts +2 -1
  31. package/build/_version.d.ts +1 -1
  32. package/build/_version.js +1 -1
  33. package/build/abi/shared/interfaces/motoswap/IAdministeredOP20.d.ts +21 -0
  34. package/build/abi/shared/interfaces/motoswap/IMotoChefContract.d.ts +121 -0
  35. package/build/abi/shared/interfaces/motoswap/IMotoChefContract.js +1 -0
  36. package/build/abi/shared/interfaces/motoswap/INativeSwapContract.d.ts +71 -0
  37. package/build/abi/shared/interfaces/motoswap/INativeSwapContract.js +1 -0
  38. package/build/abi/shared/interfaces/motoswap/IOwnableContract.d.ts +12 -0
  39. package/build/abi/shared/interfaces/motoswap/IOwnableContract.js +1 -0
  40. package/build/abi/shared/interfaces/motoswap/IOwnableReentrancyGuardContract.d.ts +13 -0
  41. package/build/abi/shared/interfaces/motoswap/IOwnableReentrancyGuardContract.js +1 -0
  42. package/build/abi/shared/interfaces/motoswap/IReentrancyGuardContract.d.ts +7 -0
  43. package/build/abi/shared/interfaces/motoswap/IReentrancyGuardContract.js +1 -0
  44. package/build/abi/shared/json/motoswap/ADMINISTERD_OP_20_ABI.d.ts +3 -0
  45. package/build/abi/shared/json/motoswap/ADMINISTERD_OP_20_ABI.js +81 -0
  46. package/build/abi/shared/json/motoswap/MOTOSWAP_MOTOCHEF_ABI.d.ts +4 -0
  47. package/build/abi/shared/json/motoswap/MOTOSWAP_MOTOCHEF_ABI.js +443 -0
  48. package/build/abi/shared/json/motoswap/NATIVE_SWAP_ABI.d.ts +3 -0
  49. package/build/abi/shared/json/motoswap/{EWMA_ABI.js → NATIVE_SWAP_ABI.js} +208 -37
  50. package/build/abi/shared/json/motoswap/OWNABLE_ABI.d.ts +3 -0
  51. package/build/abi/shared/json/motoswap/OWNABLE_ABI.js +35 -0
  52. package/build/abi/shared/json/motoswap/REENTRANCY_GUARD_ABI.d.ts +2 -0
  53. package/build/abi/shared/json/motoswap/REENTRANCY_GUARD_ABI.js +15 -0
  54. package/build/bitcoin/UTXOs.d.ts +1 -1
  55. package/build/bitcoin/interfaces/IUTXO.d.ts +1 -1
  56. package/build/block/Block.d.ts +2 -1
  57. package/build/block/Block.js +2 -2
  58. package/build/contracts/CallResult.d.ts +1 -0
  59. package/build/contracts/CallResult.js +7 -3
  60. package/build/opnet.d.ts +7 -2
  61. package/build/opnet.js +7 -2
  62. package/build/providers/AbstractRpcProvider.d.ts +1 -1
  63. package/build/providers/AbstractRpcProvider.js +4 -4
  64. package/build/transactions/Transaction.d.ts +5 -1
  65. package/build/transactions/Transaction.js +14 -2
  66. package/build/transactions/TransactionParser.d.ts +3 -2
  67. package/build/transactions/TransactionParser.js +6 -6
  68. package/build/transactions/decoders/DeploymentTransaction.d.ts +2 -1
  69. package/build/transactions/decoders/DeploymentTransaction.js +2 -2
  70. package/build/transactions/decoders/GenericTransaction.d.ts +2 -1
  71. package/build/transactions/decoders/GenericTransaction.js +2 -2
  72. package/build/transactions/decoders/InteractionTransaction.d.ts +2 -1
  73. package/build/transactions/decoders/InteractionTransaction.js +2 -2
  74. package/build/transactions/interfaces/ITransaction.d.ts +2 -0
  75. package/build/transactions/interfaces/ProofOfWorkChallenge.d.ts +12 -0
  76. package/build/transactions/interfaces/ProofOfWorkChallenge.js +1 -0
  77. package/build/transactions/interfaces/transactions/ICommonTransaction.d.ts +2 -0
  78. package/build/transactions/metadata/TransactionInput.d.ts +1 -1
  79. package/build/transactions/metadata/TransactionOutput.d.ts +1 -1
  80. package/build/transactions/metadata/TransactionReceipt.d.ts +2 -1
  81. package/build/transactions/metadata/TransactionReceipt.js +12 -8
  82. package/package.json +14 -14
  83. package/src/_version.ts +1 -1
  84. package/src/abi/shared/interfaces/motoswap/IAdministeredOP20.ts +56 -0
  85. package/src/abi/shared/interfaces/motoswap/IMotoChefContract.ts +348 -0
  86. package/src/abi/shared/interfaces/motoswap/INativeSwapContract.ts +267 -0
  87. package/src/abi/shared/interfaces/motoswap/IOwnableContract.ts +32 -0
  88. package/src/abi/shared/interfaces/motoswap/IOwnableReentrancyGuardContract.ts +33 -0
  89. package/src/abi/shared/interfaces/motoswap/IReentrancyGuardContract.ts +18 -0
  90. package/src/abi/shared/json/motoswap/ADMINISTERD_OP_20_ABI.ts +85 -0
  91. package/src/abi/shared/json/motoswap/MOTOSWAP_MOTOCHEF_ABI.ts +455 -0
  92. package/src/abi/shared/json/motoswap/{EWMA_ABI.ts → NATIVE_SWAP_ABI.ts} +252 -37
  93. package/src/abi/shared/json/motoswap/OWNABLE_ABI.ts +38 -0
  94. package/src/abi/shared/json/motoswap/REENTRANCY_GUARD_ABI.ts +20 -0
  95. package/src/bitcoin/UTXOs.ts +2 -2
  96. package/src/bitcoin/interfaces/IUTXO.ts +1 -1
  97. package/src/block/Block.ts +3 -1
  98. package/src/contracts/CallResult.ts +9 -6
  99. package/src/opnet.ts +7 -2
  100. package/src/providers/AbstractRpcProvider.ts +5 -5
  101. package/src/providers/JSONRpcProvider.ts +1 -1
  102. package/src/transactions/Transaction.ts +30 -8
  103. package/src/transactions/TransactionParser.ts +7 -8
  104. package/src/transactions/decoders/DeploymentTransaction.ts +3 -2
  105. package/src/transactions/decoders/GenericTransaction.ts +3 -2
  106. package/src/transactions/decoders/InteractionTransaction.ts +3 -2
  107. package/src/transactions/interfaces/ITransaction.ts +6 -0
  108. package/src/transactions/interfaces/ProofOfWorkChallenge.ts +13 -0
  109. package/src/transactions/interfaces/transactions/ICommonTransaction.ts +6 -0
  110. package/src/transactions/metadata/TransactionInput.ts +1 -1
  111. package/src/transactions/metadata/TransactionOutput.ts +1 -1
  112. package/src/transactions/metadata/TransactionReceipt.ts +23 -11
  113. package/browser/abi/shared/interfaces/motoswap/IEwmaContract.d.ts +0 -46
  114. package/browser/abi/shared/json/motoswap/EWMA_ABI.d.ts +0 -3
  115. package/build/abi/shared/interfaces/motoswap/IEwmaContract.d.ts +0 -46
  116. package/build/abi/shared/json/motoswap/EWMA_ABI.d.ts +0 -3
  117. package/src/abi/shared/interfaces/motoswap/IEwmaContract.ts +0 -188
  118. /package/build/abi/shared/interfaces/motoswap/{IEwmaContract.js → IAdministeredOP20.js} +0 -0
@@ -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,
@@ -0,0 +1,38 @@
1
+ import { ABIDataTypes } from '@btc-vision/transaction';
2
+ import { BitcoinAbiTypes } from '../../../BitcoinAbiTypes';
3
+ import { BitcoinInterfaceAbi } from '../../../interfaces/BitcoinInterfaceAbi';
4
+
5
+ const OWNABLE_ABI: BitcoinInterfaceAbi = [
6
+ {
7
+ name: 'admin',
8
+ type: BitcoinAbiTypes.Function,
9
+ constant: true,
10
+ inputs: [],
11
+ outputs: [
12
+ {
13
+ name: 'adminAddress',
14
+ type: ABIDataTypes.ADDRESS,
15
+ },
16
+ ],
17
+ },
18
+ {
19
+ name: 'changeAdmin',
20
+ type: BitcoinAbiTypes.Function,
21
+ constant: false,
22
+ payable: false,
23
+ inputs: [
24
+ {
25
+ name: 'newAdmin',
26
+ type: ABIDataTypes.ADDRESS,
27
+ },
28
+ ],
29
+ outputs: [
30
+ {
31
+ name: 'success',
32
+ type: ABIDataTypes.BOOL,
33
+ },
34
+ ],
35
+ },
36
+ ];
37
+
38
+ export default OWNABLE_ABI;
@@ -0,0 +1,20 @@
1
+ import { ABIDataTypes } from '@btc-vision/transaction';
2
+ import { BitcoinAbiTypes } from '../../../BitcoinAbiTypes';
3
+ import { BitcoinInterfaceAbi } from '../../../interfaces/BitcoinInterfaceAbi';
4
+
5
+ /**
6
+ * @category ABI
7
+ */
8
+ export const REENTRANCY_GUARD_ABI: BitcoinInterfaceAbi = [
9
+ {
10
+ name: 'status',
11
+ inputs: [],
12
+ outputs: [
13
+ {
14
+ name: 'status',
15
+ type: ABIDataTypes.UINT256,
16
+ },
17
+ ],
18
+ type: BitcoinAbiTypes.Function,
19
+ },
20
+ ];
@@ -1,4 +1,4 @@
1
- import { ScriptPubKey } from '@btc-vision/bsi-bitcoin-rpc';
1
+ import { ScriptPubKey } from '@btc-vision/bitcoin-rpc';
2
2
  import { IUTXO } from './interfaces/IUTXO.js';
3
3
 
4
4
  /**
@@ -22,7 +22,7 @@ export class UTXO implements Omit<IUTXO, 'raw'> {
22
22
  if (!iUTXO.raw) {
23
23
  throw new Error('Missing nonWitnessUtxo field in UTXO');
24
24
  }
25
-
25
+
26
26
  this.nonWitnessUtxo = Buffer.from(iUTXO.raw, 'base64');
27
27
  }
28
28
  }
@@ -1,4 +1,4 @@
1
- import { ScriptPubKey } from '@btc-vision/bsi-bitcoin-rpc';
1
+ import { ScriptPubKey } from '@btc-vision/bitcoin-rpc';
2
2
 
3
3
  /**
4
4
  * Unspent Transaction Output
@@ -1,3 +1,4 @@
1
+ import { Network } from '@btc-vision/bitcoin';
1
2
  import { BigNumberish } from '../common/CommonTypes.js';
2
3
  import { OPNetTransactionTypes } from '../interfaces/opnet/OPNetTransactionTypes.js';
3
4
  import { ITransaction } from '../transactions/interfaces/ITransaction.js';
@@ -42,7 +43,7 @@ export class Block implements Omit<IBlock, 'gasUsed' | 'ema' | 'baseGas'> {
42
43
 
43
44
  public readonly transactions: TransactionBase<OPNetTransactionTypes>[] = [];
44
45
 
45
- constructor(block: IBlock) {
46
+ constructor(block: IBlock, network: Network) {
46
47
  this.height = BigInt(block.height.toString());
47
48
 
48
49
  this.hash = block.hash;
@@ -74,6 +75,7 @@ export class Block implements Omit<IBlock, 'gasUsed' | 'ema' | 'baseGas'> {
74
75
 
75
76
  this.transactions = TransactionParser.parseTransactions(
76
77
  block.transactions as ITransaction[],
78
+ network
77
79
  );
78
80
  }
79
81
  }
@@ -1,5 +1,6 @@
1
1
  import { Network, PsbtOutputExtended, Signer } from '@btc-vision/bitcoin';
2
2
  import {
3
+ Address,
3
4
  BinaryReader,
4
5
  BufferHelper,
5
6
  IInteractionParameters,
@@ -59,12 +60,10 @@ export class CallResult<T extends ContractDecodedObjectResult = {}>
59
60
  readonly #rawEvents: EventList;
60
61
  readonly #provider: AbstractRpcProvider;
61
62
 
62
- //private readonly decoded: Array<DecodedCallResult> = [];
63
-
64
63
  constructor(callResult: ICallResultData, provider: AbstractRpcProvider) {
64
+ this.#provider = provider;
65
65
  this.#rawEvents = this.parseEvents(callResult.events);
66
66
  this.accessList = callResult.accessList;
67
- this.#provider = provider;
68
67
 
69
68
  if (callResult.estimatedGas) {
70
69
  this.estimatedGas = BigInt(callResult.estimatedGas);
@@ -167,8 +166,6 @@ export class CallResult<T extends ContractDecodedObjectResult = {}>
167
166
 
168
167
  public setDecoded(decoded: DecodedOutput): void {
169
168
  this.properties = Object.freeze(decoded.obj) as T;
170
-
171
- //this.decoded.push(...decoded.values);
172
169
  }
173
170
 
174
171
  public setCalldata(calldata: Buffer): void {
@@ -194,6 +191,12 @@ export class CallResult<T extends ContractDecodedObjectResult = {}>
194
191
  return utxos;
195
192
  }
196
193
 
194
+ private contractToString(contract: string): string {
195
+ const addressCa = Address.fromString(contract);
196
+
197
+ return addressCa.p2tr(this.#provider.network);
198
+ }
199
+
197
200
  private parseEvents(events: RawEventList): EventList {
198
201
  const eventsList: EventList = {};
199
202
 
@@ -206,7 +209,7 @@ export class CallResult<T extends ContractDecodedObjectResult = {}>
206
209
  events.push(eventData);
207
210
  }
208
211
 
209
- eventsList[contract] = events;
212
+ eventsList[this.contractToString(contract)] = events;
210
213
  }
211
214
 
212
215
  return eventsList;
package/src/opnet.ts CHANGED
@@ -15,6 +15,7 @@ export * from './transactions/Transaction.js';
15
15
  export * from './transactions/interfaces/transactions/ICommonTransaction.js';
16
16
  export * from './transactions/interfaces/transactions/IDeploymentTransaction.js';
17
17
  export * from './transactions/interfaces/transactions/IInteractionTransaction.js';
18
+ export * from './transactions/interfaces/ProofOfWorkChallenge.js';
18
19
 
19
20
  /** Providers */
20
21
  export * from './providers/AbstractRpcProvider.js';
@@ -87,18 +88,22 @@ export { ABIDataTypes } from '@btc-vision/transaction';
87
88
  export * from './abi/shared/json/motoswap/MOTOSWAP_FACTORY_ABI.js';
88
89
  export * from './abi/shared/json/motoswap/MOTOSWAP_POOL_ABI.js';
89
90
  export * from './abi/shared/json/motoswap/MOTOSWAP_ROUTER_ABI.js';
91
+ export * from './abi/shared/json/motoswap/MOTOSWAP_MOTOCHEF_ABI.js';
92
+ export * from './abi/shared/json/motoswap/ADMINISTERD_OP_20_ABI.js';
90
93
  export * from './abi/shared/json/opnet/OP_20_ABI.js';
91
94
  export * from './abi/shared/json/opnet/OP_NET_ABI.js';
92
95
  export * from './abi/shared/json/generic/STAKING_ABI.js';
93
96
  export * from './abi/shared/json/tests/WBTC_ABI.js';
94
- export * from './abi/shared/json/motoswap/EWMA_ABI.js';
97
+ export * from './abi/shared/json/motoswap/NATIVE_SWAP_ABI.js';
95
98
 
96
99
  /** ABI Interfaces */
97
100
  export * from './abi/shared/interfaces/motoswap/IMotoswapFactoryContract.js';
98
101
  export * from './abi/shared/interfaces/motoswap/IMotoswapPoolContract.js';
99
102
  export * from './abi/shared/interfaces/motoswap/IMotoswapRouterContract.js';
103
+ export * from './abi/shared/interfaces/motoswap/IMotoChefContract.js';
104
+ export * from './abi/shared/interfaces/motoswap/IAdministeredOP20.js';
100
105
  export * from './abi/shared/interfaces/opnet/IOP_20Contract.js';
101
106
  export * from './abi/shared/interfaces/opnet/IOP_NETContract.js';
102
107
  export * from './abi/shared/interfaces/generic/IStackingContract.js';
103
108
  export * from './abi/shared/interfaces/tests/IWBTCContract.js';
104
- export * from './abi/shared/interfaces/motoswap/IEwmaContract.js';
109
+ export * from './abi/shared/interfaces/motoswap/INativeSwapContract.js';
@@ -42,7 +42,7 @@ export abstract class AbstractRpcProvider {
42
42
  private nextId: number = 0;
43
43
  private chainId: bigint | undefined;
44
44
 
45
- protected constructor(private readonly network: Network) {}
45
+ protected constructor(public readonly network: Network) {}
46
46
 
47
47
  private _utxoManager: UTXOsManager = new UTXOsManager(this);
48
48
 
@@ -139,7 +139,7 @@ export abstract class AbstractRpcProvider {
139
139
  const block: JsonRpcResult = await this.callPayloadSingle(payload);
140
140
 
141
141
  const result: IBlock = block.result as IBlock;
142
- return new Block(result);
142
+ return new Block(result, this.network);
143
143
  }
144
144
 
145
145
  /**
@@ -174,7 +174,7 @@ export abstract class AbstractRpcProvider {
174
174
 
175
175
  const result: IBlock = block.result as IBlock;
176
176
 
177
- return new Block(result);
177
+ return new Block(result, this.network);
178
178
  });
179
179
  }
180
180
 
@@ -236,7 +236,7 @@ export abstract class AbstractRpcProvider {
236
236
  );
237
237
  }
238
238
 
239
- return TransactionParser.parseTransaction(result);
239
+ return TransactionParser.parseTransaction(result, this.network);
240
240
  }
241
241
 
242
242
  /**
@@ -254,7 +254,7 @@ export abstract class AbstractRpcProvider {
254
254
  );
255
255
 
256
256
  const rawTransaction: JsonRpcResult = await this.callPayloadSingle(payload);
257
- return new TransactionReceipt(rawTransaction.result);
257
+ return new TransactionReceipt(rawTransaction.result, this.network);
258
258
  }
259
259
 
260
260
  /**
@@ -49,7 +49,7 @@ export class JSONRpcProvider extends AbstractRpcProvider {
49
49
  if (!resp.ok) {
50
50
  throw new Error(`Failed to fetch: ${resp.statusText}`);
51
51
  }
52
-
52
+
53
53
  clearTimeout(timeoutId);
54
54
 
55
55
  //const str = await resp.text();