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
@@ -1,9 +1,27 @@
1
1
  import { ABIDataTypes } from '@btc-vision/transaction';
2
2
  import { BitcoinAbiTypes } from '../../../BitcoinAbiTypes.js';
3
3
  import { OP_NET_ABI } from '../opnet/OP_NET_ABI.js';
4
- export const EwmaEvents = [
4
+ export const NativeSwapEvents = [
5
5
  {
6
6
  name: 'LiquidityAdded',
7
+ values: [
8
+ {
9
+ name: 'totalTokensContributed',
10
+ type: ABIDataTypes.UINT256,
11
+ },
12
+ {
13
+ name: 'virtualTokenExchanged',
14
+ type: ABIDataTypes.UINT256,
15
+ },
16
+ {
17
+ name: 'totalSatoshisSpent',
18
+ type: ABIDataTypes.UINT256,
19
+ },
20
+ ],
21
+ type: BitcoinAbiTypes.Event,
22
+ },
23
+ {
24
+ name: 'LiquidityListed',
7
25
  values: [
8
26
  {
9
27
  name: 'totalLiquidity',
@@ -16,6 +34,24 @@ export const EwmaEvents = [
16
34
  ],
17
35
  type: BitcoinAbiTypes.Event,
18
36
  },
37
+ {
38
+ name: 'LiquidityRemoved',
39
+ values: [
40
+ {
41
+ name: 'providerId',
42
+ type: ABIDataTypes.UINT256,
43
+ },
44
+ {
45
+ name: 'btcOwed',
46
+ type: ABIDataTypes.UINT256,
47
+ },
48
+ {
49
+ name: 'tokenAmount',
50
+ type: ABIDataTypes.UINT256,
51
+ },
52
+ ],
53
+ type: BitcoinAbiTypes.Event,
54
+ },
19
55
  {
20
56
  name: 'ReservationCreated',
21
57
  values: [
@@ -31,36 +67,36 @@ export const EwmaEvents = [
31
67
  type: BitcoinAbiTypes.Event,
32
68
  },
33
69
  {
34
- name: 'LiquidityRemoved',
70
+ name: 'SwapExecuted',
35
71
  values: [
36
72
  {
37
- name: 'token',
73
+ name: 'buyer',
38
74
  type: ABIDataTypes.ADDRESS,
39
75
  },
40
76
  {
41
- name: 'amount',
77
+ name: 'amountIn',
42
78
  type: ABIDataTypes.UINT256,
43
79
  },
44
80
  {
45
- name: 'remainingLiquidity',
81
+ name: 'amountOut',
46
82
  type: ABIDataTypes.UINT256,
47
83
  },
48
84
  ],
49
85
  type: BitcoinAbiTypes.Event,
50
86
  },
51
87
  {
52
- name: 'SwapExecuted',
88
+ name: 'Unlist',
53
89
  values: [
54
90
  {
55
- name: 'buyer',
91
+ name: 'token',
56
92
  type: ABIDataTypes.ADDRESS,
57
93
  },
58
94
  {
59
- name: 'amountIn',
95
+ name: 'amount',
60
96
  type: ABIDataTypes.UINT256,
61
97
  },
62
98
  {
63
- name: 'amountOut',
99
+ name: 'remainingLiquidity',
64
100
  type: ABIDataTypes.UINT256,
65
101
  },
66
102
  ],
@@ -81,7 +117,7 @@ export const EwmaEvents = [
81
117
  type: BitcoinAbiTypes.Event,
82
118
  },
83
119
  ];
84
- export const EwmaAbi = [
120
+ export const NativeSwapAbi = [
85
121
  {
86
122
  name: 'reserve',
87
123
  inputs: [
@@ -97,6 +133,10 @@ export const EwmaAbi = [
97
133
  name: 'minimumAmountOut',
98
134
  type: ABIDataTypes.UINT256,
99
135
  },
136
+ {
137
+ name: 'forLP',
138
+ type: ABIDataTypes.BOOL,
139
+ },
100
140
  ],
101
141
  outputs: [
102
142
  {
@@ -107,7 +147,7 @@ export const EwmaAbi = [
107
147
  type: BitcoinAbiTypes.Function,
108
148
  },
109
149
  {
110
- name: 'addLiquidity',
150
+ name: 'listLiquidity',
111
151
  inputs: [
112
152
  {
113
153
  name: 'token',
@@ -135,7 +175,7 @@ export const EwmaAbi = [
135
175
  type: BitcoinAbiTypes.Function,
136
176
  },
137
177
  {
138
- name: 'removeLiquidity',
178
+ name: 'cancelListing',
139
179
  inputs: [
140
180
  {
141
181
  name: 'token',
@@ -151,17 +191,140 @@ export const EwmaAbi = [
151
191
  type: BitcoinAbiTypes.Function,
152
192
  },
153
193
  {
154
- name: 'swap',
194
+ name: 'createPool',
195
+ inputs: [
196
+ {
197
+ name: 'token',
198
+ type: ABIDataTypes.ADDRESS,
199
+ },
200
+ {
201
+ name: 'floorPrice',
202
+ type: ABIDataTypes.UINT256,
203
+ },
204
+ {
205
+ name: 'initialLiquidity',
206
+ type: ABIDataTypes.UINT128,
207
+ },
208
+ {
209
+ name: 'receiver',
210
+ type: ABIDataTypes.STRING,
211
+ },
212
+ {
213
+ name: 'antiBotEnabledFor',
214
+ type: ABIDataTypes.UINT16,
215
+ },
216
+ {
217
+ name: 'antiBotMaximumTokensPerReservation',
218
+ type: ABIDataTypes.UINT256,
219
+ },
220
+ {
221
+ name: 'maxReservesIn5BlocksPercent',
222
+ type: ABIDataTypes.UINT16,
223
+ },
224
+ ],
225
+ outputs: [
226
+ {
227
+ name: 'ok',
228
+ type: ABIDataTypes.BOOL,
229
+ },
230
+ ],
231
+ type: BitcoinAbiTypes.Function,
232
+ },
233
+ {
234
+ name: 'setFees',
235
+ inputs: [
236
+ {
237
+ name: 'reservationBaseFee',
238
+ type: ABIDataTypes.UINT64,
239
+ },
240
+ {
241
+ name: 'priorityQueueBaseFee',
242
+ type: ABIDataTypes.UINT64,
243
+ },
244
+ {
245
+ name: 'pricePerUserInPriorityQueueBTC',
246
+ type: ABIDataTypes.UINT64,
247
+ },
248
+ ],
249
+ outputs: [
250
+ {
251
+ name: 'ok',
252
+ type: ABIDataTypes.BOOL,
253
+ },
254
+ ],
255
+ type: BitcoinAbiTypes.Function,
256
+ },
257
+ {
258
+ name: 'getFees',
259
+ inputs: [],
260
+ outputs: [
261
+ {
262
+ name: 'reservationBaseFee',
263
+ type: ABIDataTypes.UINT64,
264
+ },
265
+ {
266
+ name: 'priorityQueueBaseFee',
267
+ type: ABIDataTypes.UINT64,
268
+ },
269
+ {
270
+ name: 'pricePerUserInPriorityQueueBTC',
271
+ type: ABIDataTypes.UINT64,
272
+ },
273
+ ],
274
+ type: BitcoinAbiTypes.Function,
275
+ },
276
+ {
277
+ name: 'addLiquidity',
278
+ inputs: [
279
+ {
280
+ name: 'token',
281
+ type: ABIDataTypes.ADDRESS,
282
+ },
283
+ {
284
+ name: 'receiver',
285
+ type: ABIDataTypes.STRING,
286
+ },
287
+ {
288
+ name: 'amountIn',
289
+ type: ABIDataTypes.UINT128,
290
+ },
291
+ {
292
+ name: 'priority',
293
+ type: ABIDataTypes.BOOL,
294
+ },
295
+ ],
296
+ outputs: [
297
+ {
298
+ name: 'ok',
299
+ type: ABIDataTypes.BOOL,
300
+ },
301
+ ],
302
+ type: BitcoinAbiTypes.Function,
303
+ },
304
+ {
305
+ name: 'removeLiquidity',
155
306
  inputs: [
156
307
  {
157
308
  name: 'token',
158
309
  type: ABIDataTypes.ADDRESS,
159
310
  },
311
+ ],
312
+ outputs: [
160
313
  {
161
- name: 'isSimulation',
314
+ name: 'ok',
162
315
  type: ABIDataTypes.BOOL,
163
316
  },
164
317
  ],
318
+ type: BitcoinAbiTypes.Function,
319
+ },
320
+ {
321
+ name: 'swap',
322
+ inputs: [
323
+ {
324
+ name: 'token',
325
+ type: ABIDataTypes.ADDRESS,
326
+ },
327
+ ],
165
328
  outputs: [
166
329
  {
167
330
  name: 'ok',
@@ -187,6 +350,14 @@ export const EwmaAbi = [
187
350
  name: 'reservedLiquidity',
188
351
  type: ABIDataTypes.UINT256,
189
352
  },
353
+ {
354
+ name: 'virtualBTCReserve',
355
+ type: ABIDataTypes.UINT256,
356
+ },
357
+ {
358
+ name: 'virtualTokenReserve',
359
+ type: ABIDataTypes.UINT256,
360
+ },
190
361
  ],
191
362
  type: BitcoinAbiTypes.Function,
192
363
  },
@@ -212,34 +383,38 @@ export const EwmaAbi = [
212
383
  type: ABIDataTypes.UINT256,
213
384
  },
214
385
  {
215
- name: 'currentPrice',
386
+ name: 'price',
216
387
  type: ABIDataTypes.UINT256,
217
388
  },
218
389
  ],
219
390
  type: BitcoinAbiTypes.Function,
220
391
  },
221
392
  {
222
- name: 'setQuote',
393
+ name: 'getProviderDetails',
223
394
  inputs: [
224
395
  {
225
396
  name: 'token',
226
397
  type: ABIDataTypes.ADDRESS,
227
398
  },
228
- {
229
- name: 'p0',
230
- type: ABIDataTypes.UINT256,
231
- },
232
399
  ],
233
400
  outputs: [
234
401
  {
235
- name: 'ok',
236
- type: ABIDataTypes.BOOL,
402
+ name: 'liquidity',
403
+ type: ABIDataTypes.UINT128,
404
+ },
405
+ {
406
+ name: 'reserved',
407
+ type: ABIDataTypes.UINT128,
408
+ },
409
+ {
410
+ name: 'btcReceiver',
411
+ type: ABIDataTypes.STRING,
237
412
  },
238
413
  ],
239
414
  type: BitcoinAbiTypes.Function,
240
415
  },
241
416
  {
242
- name: 'priorityQueueCost',
417
+ name: 'getVirtualReserves',
243
418
  inputs: [
244
419
  {
245
420
  name: 'token',
@@ -248,14 +423,18 @@ export const EwmaAbi = [
248
423
  ],
249
424
  outputs: [
250
425
  {
251
- name: 'cost',
252
- type: ABIDataTypes.UINT128,
426
+ name: 'virtualBTCReserve',
427
+ type: ABIDataTypes.UINT256,
428
+ },
429
+ {
430
+ name: 'virtualTokenReserve',
431
+ type: ABIDataTypes.UINT256,
253
432
  },
254
433
  ],
255
434
  type: BitcoinAbiTypes.Function,
256
435
  },
257
436
  {
258
- name: 'getProviderDetails',
437
+ name: 'getPriorityQueueCost',
259
438
  inputs: [
260
439
  {
261
440
  name: 'token',
@@ -264,20 +443,12 @@ export const EwmaAbi = [
264
443
  ],
265
444
  outputs: [
266
445
  {
267
- name: 'liquidity',
268
- type: ABIDataTypes.UINT128,
269
- },
270
- {
271
- name: 'reserved',
272
- type: ABIDataTypes.UINT128,
273
- },
274
- {
275
- name: 'btcReceiver',
276
- type: ABIDataTypes.STRING,
446
+ name: 'cost',
447
+ type: ABIDataTypes.UINT64,
277
448
  },
278
449
  ],
279
450
  type: BitcoinAbiTypes.Function,
280
451
  },
281
- ...EwmaEvents,
452
+ ...NativeSwapEvents,
282
453
  ...OP_NET_ABI,
283
454
  ];
@@ -0,0 +1,3 @@
1
+ import { BitcoinInterfaceAbi } from '../../../interfaces/BitcoinInterfaceAbi';
2
+ declare const OWNABLE_ABI: BitcoinInterfaceAbi;
3
+ export default OWNABLE_ABI;
@@ -0,0 +1,35 @@
1
+ import { ABIDataTypes } from '@btc-vision/transaction';
2
+ import { BitcoinAbiTypes } from '../../../BitcoinAbiTypes';
3
+ const OWNABLE_ABI = [
4
+ {
5
+ name: 'admin',
6
+ type: BitcoinAbiTypes.Function,
7
+ constant: true,
8
+ inputs: [],
9
+ outputs: [
10
+ {
11
+ name: 'adminAddress',
12
+ type: ABIDataTypes.ADDRESS,
13
+ },
14
+ ],
15
+ },
16
+ {
17
+ name: 'changeAdmin',
18
+ type: BitcoinAbiTypes.Function,
19
+ constant: false,
20
+ payable: false,
21
+ inputs: [
22
+ {
23
+ name: 'newAdmin',
24
+ type: ABIDataTypes.ADDRESS,
25
+ },
26
+ ],
27
+ outputs: [
28
+ {
29
+ name: 'success',
30
+ type: ABIDataTypes.BOOL,
31
+ },
32
+ ],
33
+ },
34
+ ];
35
+ export default OWNABLE_ABI;
@@ -0,0 +1,2 @@
1
+ import { BitcoinInterfaceAbi } from '../../../interfaces/BitcoinInterfaceAbi';
2
+ export declare const REENTRANCY_GUARD_ABI: BitcoinInterfaceAbi;
@@ -0,0 +1,15 @@
1
+ import { ABIDataTypes } from '@btc-vision/transaction';
2
+ import { BitcoinAbiTypes } from '../../../BitcoinAbiTypes';
3
+ export const REENTRANCY_GUARD_ABI = [
4
+ {
5
+ name: 'status',
6
+ inputs: [],
7
+ outputs: [
8
+ {
9
+ name: 'status',
10
+ type: ABIDataTypes.UINT256,
11
+ },
12
+ ],
13
+ type: BitcoinAbiTypes.Function,
14
+ },
15
+ ];
@@ -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
  export declare class UTXO implements Omit<IUTXO, 'raw'> {
4
4
  readonly transactionId: string;
@@ -1,4 +1,4 @@
1
- import { ScriptPubKey } from '@btc-vision/bsi-bitcoin-rpc';
1
+ import { ScriptPubKey } from '@btc-vision/bitcoin-rpc';
2
2
  export interface IUTXO {
3
3
  readonly transactionId: string;
4
4
  readonly outputIndex: number;
@@ -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 { TransactionBase } from '../transactions/Transaction.js';
@@ -25,5 +26,5 @@ export declare class Block implements Omit<IBlock, 'gasUsed' | 'ema' | 'baseGas'
25
26
  readonly gasUsed: bigint;
26
27
  readonly checksumProofs: BlockHeaderChecksumProof;
27
28
  readonly transactions: TransactionBase<OPNetTransactionTypes>[];
28
- constructor(block: IBlock);
29
+ constructor(block: IBlock, network: Network);
29
30
  }
@@ -22,7 +22,7 @@ export class Block {
22
22
  gasUsed;
23
23
  checksumProofs;
24
24
  transactions = [];
25
- constructor(block) {
25
+ constructor(block, network) {
26
26
  this.height = BigInt(block.height.toString());
27
27
  this.hash = block.hash;
28
28
  this.previousBlockHash = block.previousBlockHash;
@@ -44,6 +44,6 @@ export class Block {
44
44
  this.storageRoot = block.storageRoot;
45
45
  this.receiptRoot = block.receiptRoot;
46
46
  this.checksumProofs = block.checksumProofs;
47
- this.transactions = TransactionParser.parseTransactions(block.transactions);
47
+ this.transactions = TransactionParser.parseTransactions(block.transactions, network);
48
48
  }
49
49
  }
@@ -39,6 +39,7 @@ export declare class CallResult<T extends ContractDecodedObjectResult = {}> impl
39
39
  setGasEstimation(estimatedGas: bigint): void;
40
40
  setDecoded(decoded: DecodedOutput): void;
41
41
  setCalldata(calldata: Buffer): void;
42
+ private contractToString;
42
43
  private parseEvents;
43
44
  private base64ToUint8Array;
44
45
  }
@@ -1,4 +1,4 @@
1
- import { BinaryReader, BufferHelper, NetEvent, TransactionFactory, } from '@btc-vision/transaction';
1
+ import { Address, BinaryReader, BufferHelper, NetEvent, TransactionFactory, } from '@btc-vision/transaction';
2
2
  const factory = new TransactionFactory();
3
3
  export class CallResult {
4
4
  result;
@@ -13,9 +13,9 @@ export class CallResult {
13
13
  #rawEvents;
14
14
  #provider;
15
15
  constructor(callResult, provider) {
16
+ this.#provider = provider;
16
17
  this.#rawEvents = this.parseEvents(callResult.events);
17
18
  this.accessList = callResult.accessList;
18
- this.#provider = provider;
19
19
  if (callResult.estimatedGas) {
20
20
  this.estimatedGas = BigInt(callResult.estimatedGas);
21
21
  }
@@ -107,6 +107,10 @@ export class CallResult {
107
107
  }
108
108
  return utxos;
109
109
  }
110
+ contractToString(contract) {
111
+ const addressCa = Address.fromString(contract);
112
+ return addressCa.p2tr(this.#provider.network);
113
+ }
110
114
  parseEvents(events) {
111
115
  const eventsList = {};
112
116
  for (const [contract, value] of Object.entries(events)) {
@@ -115,7 +119,7 @@ export class CallResult {
115
119
  const eventData = new NetEvent(event.type, Buffer.from(event.data, 'base64'));
116
120
  events.push(eventData);
117
121
  }
118
- eventsList[contract] = events;
122
+ eventsList[this.contractToString(contract)] = events;
119
123
  }
120
124
  return eventsList;
121
125
  }
package/build/opnet.d.ts CHANGED
@@ -9,6 +9,7 @@ export * from './transactions/Transaction.js';
9
9
  export * from './transactions/interfaces/transactions/ICommonTransaction.js';
10
10
  export * from './transactions/interfaces/transactions/IDeploymentTransaction.js';
11
11
  export * from './transactions/interfaces/transactions/IInteractionTransaction.js';
12
+ export * from './transactions/interfaces/ProofOfWorkChallenge.js';
12
13
  export * from './providers/AbstractRpcProvider.js';
13
14
  export * from './providers/JSONRpcProvider.js';
14
15
  export * from './providers/WebsocketRpcProvider.js';
@@ -52,16 +53,20 @@ export { ABIDataTypes } from '@btc-vision/transaction';
52
53
  export * from './abi/shared/json/motoswap/MOTOSWAP_FACTORY_ABI.js';
53
54
  export * from './abi/shared/json/motoswap/MOTOSWAP_POOL_ABI.js';
54
55
  export * from './abi/shared/json/motoswap/MOTOSWAP_ROUTER_ABI.js';
56
+ export * from './abi/shared/json/motoswap/MOTOSWAP_MOTOCHEF_ABI.js';
57
+ export * from './abi/shared/json/motoswap/ADMINISTERD_OP_20_ABI.js';
55
58
  export * from './abi/shared/json/opnet/OP_20_ABI.js';
56
59
  export * from './abi/shared/json/opnet/OP_NET_ABI.js';
57
60
  export * from './abi/shared/json/generic/STAKING_ABI.js';
58
61
  export * from './abi/shared/json/tests/WBTC_ABI.js';
59
- export * from './abi/shared/json/motoswap/EWMA_ABI.js';
62
+ export * from './abi/shared/json/motoswap/NATIVE_SWAP_ABI.js';
60
63
  export * from './abi/shared/interfaces/motoswap/IMotoswapFactoryContract.js';
61
64
  export * from './abi/shared/interfaces/motoswap/IMotoswapPoolContract.js';
62
65
  export * from './abi/shared/interfaces/motoswap/IMotoswapRouterContract.js';
66
+ export * from './abi/shared/interfaces/motoswap/IMotoChefContract.js';
67
+ export * from './abi/shared/interfaces/motoswap/IAdministeredOP20.js';
63
68
  export * from './abi/shared/interfaces/opnet/IOP_20Contract.js';
64
69
  export * from './abi/shared/interfaces/opnet/IOP_NETContract.js';
65
70
  export * from './abi/shared/interfaces/generic/IStackingContract.js';
66
71
  export * from './abi/shared/interfaces/tests/IWBTCContract.js';
67
- export * from './abi/shared/interfaces/motoswap/IEwmaContract.js';
72
+ export * from './abi/shared/interfaces/motoswap/INativeSwapContract.js';
package/build/opnet.js CHANGED
@@ -9,6 +9,7 @@ export * from './transactions/Transaction.js';
9
9
  export * from './transactions/interfaces/transactions/ICommonTransaction.js';
10
10
  export * from './transactions/interfaces/transactions/IDeploymentTransaction.js';
11
11
  export * from './transactions/interfaces/transactions/IInteractionTransaction.js';
12
+ export * from './transactions/interfaces/ProofOfWorkChallenge.js';
12
13
  export * from './providers/AbstractRpcProvider.js';
13
14
  export * from './providers/JSONRpcProvider.js';
14
15
  export * from './providers/WebsocketRpcProvider.js';
@@ -52,16 +53,20 @@ export { ABIDataTypes } from '@btc-vision/transaction';
52
53
  export * from './abi/shared/json/motoswap/MOTOSWAP_FACTORY_ABI.js';
53
54
  export * from './abi/shared/json/motoswap/MOTOSWAP_POOL_ABI.js';
54
55
  export * from './abi/shared/json/motoswap/MOTOSWAP_ROUTER_ABI.js';
56
+ export * from './abi/shared/json/motoswap/MOTOSWAP_MOTOCHEF_ABI.js';
57
+ export * from './abi/shared/json/motoswap/ADMINISTERD_OP_20_ABI.js';
55
58
  export * from './abi/shared/json/opnet/OP_20_ABI.js';
56
59
  export * from './abi/shared/json/opnet/OP_NET_ABI.js';
57
60
  export * from './abi/shared/json/generic/STAKING_ABI.js';
58
61
  export * from './abi/shared/json/tests/WBTC_ABI.js';
59
- export * from './abi/shared/json/motoswap/EWMA_ABI.js';
62
+ export * from './abi/shared/json/motoswap/NATIVE_SWAP_ABI.js';
60
63
  export * from './abi/shared/interfaces/motoswap/IMotoswapFactoryContract.js';
61
64
  export * from './abi/shared/interfaces/motoswap/IMotoswapPoolContract.js';
62
65
  export * from './abi/shared/interfaces/motoswap/IMotoswapRouterContract.js';
66
+ export * from './abi/shared/interfaces/motoswap/IMotoChefContract.js';
67
+ export * from './abi/shared/interfaces/motoswap/IAdministeredOP20.js';
63
68
  export * from './abi/shared/interfaces/opnet/IOP_20Contract.js';
64
69
  export * from './abi/shared/interfaces/opnet/IOP_NETContract.js';
65
70
  export * from './abi/shared/interfaces/generic/IStackingContract.js';
66
71
  export * from './abi/shared/interfaces/tests/IWBTCContract.js';
67
- export * from './abi/shared/interfaces/motoswap/IEwmaContract.js';
72
+ export * from './abi/shared/interfaces/motoswap/INativeSwapContract.js';
@@ -21,7 +21,7 @@ import { JsonRpcCallResult, JsonRpcResult } from './interfaces/JSONRpcResult.js'
21
21
  import { AddressesInfo } from './interfaces/PublicKeyInfo.js';
22
22
  import { ReorgInformation } from './interfaces/ReorgInformation.js';
23
23
  export declare abstract class AbstractRpcProvider {
24
- private readonly network;
24
+ readonly network: Network;
25
25
  private nextId;
26
26
  private chainId;
27
27
  protected constructor(network: Network);
@@ -61,7 +61,7 @@ export class AbstractRpcProvider {
61
61
  ]);
62
62
  const block = await this.callPayloadSingle(payload);
63
63
  const result = block.result;
64
- return new Block(result);
64
+ return new Block(result, this.network);
65
65
  }
66
66
  async getBlocks(blockNumbers, prefetchTxs = false) {
67
67
  const payloads = blockNumbers.map((blockNumber) => {
@@ -80,7 +80,7 @@ export class AbstractRpcProvider {
80
80
  throw new Error(`Error fetching block: ${block.error}`);
81
81
  }
82
82
  const result = block.result;
83
- return new Block(result);
83
+ return new Block(result, this.network);
84
84
  });
85
85
  }
86
86
  async getBlockByHash(blockHash) {
@@ -106,12 +106,12 @@ export class AbstractRpcProvider {
106
106
  if ('error' in rawTransaction) {
107
107
  throw new Error(`Error fetching transaction: ${rawTransaction.error?.message || 'Unknown error'}`);
108
108
  }
109
- return TransactionParser.parseTransaction(result);
109
+ return TransactionParser.parseTransaction(result, this.network);
110
110
  }
111
111
  async getTransactionReceipt(txHash) {
112
112
  const payload = this.buildJsonRpcPayload(JSONRpcMethods.GET_TRANSACTION_RECEIPT, [txHash]);
113
113
  const rawTransaction = await this.callPayloadSingle(payload);
114
- return new TransactionReceipt(rawTransaction.result);
114
+ return new TransactionReceipt(rawTransaction.result, this.network);
115
115
  }
116
116
  getNetwork() {
117
117
  return this.network;
@@ -1,6 +1,8 @@
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 { ITransactionBase } from './interfaces/ITransaction.js';
5
+ import { ProofOfWorkChallenge } from './interfaces/ProofOfWorkChallenge.js';
4
6
  import { TransactionInput } from './metadata/TransactionInput.js';
5
7
  import { TransactionOutput } from './metadata/TransactionOutput.js';
6
8
  import { TransactionReceipt } from './metadata/TransactionReceipt.js';
@@ -13,5 +15,7 @@ export declare abstract class TransactionBase<T extends OPNetTransactionTypes> e
13
15
  readonly outputs: TransactionOutput[];
14
16
  readonly OPNetType: T;
15
17
  readonly gasUsed: bigint;
16
- protected constructor(transaction: ITransactionBase<T>);
18
+ readonly pow?: ProofOfWorkChallenge;
19
+ protected constructor(transaction: ITransactionBase<T>, network: Network);
20
+ private decodeProofOfWorkChallenge;
17
21
  }