opnet 1.3.1 → 1.3.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.
- package/browser/_version.d.ts +1 -1
- package/browser/abi/shared/interfaces/motoswap/{IAdministeredOP20.d.ts → IMoto.d.ts} +2 -2
- package/browser/abi/shared/interfaces/motoswap/IMotoChef.d.ts +208 -0
- package/browser/abi/shared/interfaces/motoswap/IMotoswapPoolContract.d.ts +0 -4
- package/browser/abi/shared/interfaces/motoswap/IMotoswapStakingContract.d.ts +19 -3
- package/browser/abi/shared/interfaces/motoswap/INativeSwapContract.d.ts +13 -5
- package/browser/abi/shared/interfaces/opnet/IOP_NETContract.d.ts +2 -2
- package/browser/abi/shared/json/generic/STAKING_ABI.d.ts +0 -1
- package/{build/abi/shared/json/motoswap/REENTRANCY_GUARD_ABI.d.ts → browser/abi/shared/json/motoswap/MOTOCHEF_ABI.d.ts} +1 -1
- package/browser/abi/shared/json/motoswap/MOTOSWAP_STAKING_ABI.d.ts +0 -1
- package/browser/abi/shared/json/motoswap/MOTO_ABI.d.ts +2 -0
- package/browser/abi/shared/json/motoswap/NATIVE_SWAP_ABI.d.ts +0 -1
- package/browser/contracts/CallResult.d.ts +1 -1
- package/browser/fetch/fetch-browser.d.ts +4 -0
- package/browser/fetch/fetch.d.ts +2 -0
- package/browser/index.js +1 -1
- package/browser/opnet.d.ts +10 -12
- package/build/_version.d.ts +1 -1
- package/build/_version.js +1 -1
- package/build/abi/shared/interfaces/motoswap/{IAdministeredOP20.d.ts → IMoto.d.ts} +2 -2
- package/build/abi/shared/interfaces/motoswap/IMotoChef.d.ts +208 -0
- package/build/abi/shared/interfaces/motoswap/IMotoswapPoolContract.d.ts +0 -4
- package/build/abi/shared/interfaces/motoswap/IMotoswapStakingContract.d.ts +19 -3
- package/build/abi/shared/interfaces/motoswap/INativeSwapContract.d.ts +13 -5
- package/build/abi/shared/interfaces/opnet/IOP_NETContract.d.ts +2 -2
- package/build/abi/shared/json/generic/STAKING_ABI.d.ts +0 -1
- package/build/abi/shared/json/generic/STAKING_ABI.js +1 -1
- package/{browser/abi/shared/json/motoswap/REENTRANCY_GUARD_ABI.d.ts → build/abi/shared/json/motoswap/MOTOCHEF_ABI.d.ts} +1 -1
- package/build/abi/shared/json/motoswap/MOTOCHEF_ABI.js +820 -0
- package/build/abi/shared/json/motoswap/MOTOSWAP_STAKING_ABI.d.ts +0 -1
- package/build/abi/shared/json/motoswap/MOTOSWAP_STAKING_ABI.js +45 -5
- package/build/abi/shared/json/motoswap/MOTO_ABI.d.ts +2 -0
- package/build/abi/shared/json/motoswap/{ADMINISTERD_OP_20_ABI.js → MOTO_ABI.js} +5 -13
- package/build/abi/shared/json/motoswap/NATIVE_SWAP_ABI.d.ts +0 -1
- package/build/abi/shared/json/motoswap/NATIVE_SWAP_ABI.js +15 -1
- package/build/abi/shared/json/opnet/OP_NET_ABI.js +7 -18
- package/build/contracts/CallResult.d.ts +1 -1
- package/build/contracts/CallResult.js +10 -3
- package/build/contracts/Contract.js +2 -2
- package/build/fetch/fetch.d.ts +2 -0
- package/build/fetch/fetch.js +2 -0
- package/build/opnet.d.ts +10 -12
- package/build/opnet.js +10 -12
- package/build/providers/JSONRpcProvider.js +8 -0
- package/package.json +6 -4
- package/src/_version.ts +1 -1
- package/src/abi/shared/interfaces/motoswap/{IAdministeredOP20.ts → IMoto.ts} +4 -4
- package/src/abi/shared/interfaces/motoswap/IMotoChef.ts +485 -0
- package/src/abi/shared/interfaces/motoswap/IMotoswapPoolContract.ts +0 -5
- package/src/abi/shared/interfaces/motoswap/IMotoswapStakingContract.ts +50 -4
- package/src/abi/shared/interfaces/motoswap/INativeSwapContract.ts +19 -5
- package/src/abi/shared/interfaces/opnet/IOP_NETContract.ts +1 -1
- package/src/abi/shared/json/generic/STAKING_ABI.ts +1 -7
- package/src/abi/shared/json/motoswap/MOTOCHEF_ABI.ts +831 -0
- package/src/abi/shared/json/motoswap/MOTOSWAP_FACTORY_ABI.ts +0 -6
- package/src/abi/shared/json/motoswap/MOTOSWAP_POOL_ABI.ts +0 -6
- package/src/abi/shared/json/motoswap/MOTOSWAP_ROUTER_ABI.ts +0 -3
- package/src/abi/shared/json/motoswap/MOTOSWAP_STAKING_ABI.ts +51 -9
- package/src/abi/shared/json/motoswap/{ADMINISTERD_OP_20_ABI.ts → MOTO_ABI.ts} +7 -15
- package/src/abi/shared/json/motoswap/NATIVE_SWAP_ABI.ts +15 -7
- package/src/abi/shared/json/opnet/OP_NET_ABI.ts +7 -24
- package/src/contracts/CallResult.ts +14 -2
- package/src/contracts/Contract.ts +3 -3
- package/src/fetch/fetch-browser.js +5 -0
- package/src/fetch/fetch.ts +3 -0
- package/src/opnet.ts +10 -12
- package/src/providers/JSONRpcProvider.ts +10 -3
- package/webpack.config.js +1 -0
- package/browser/abi/shared/interfaces/motoswap/IMotoChefContract.d.ts +0 -229
- package/browser/abi/shared/interfaces/motoswap/IOwnableContract.d.ts +0 -12
- package/browser/abi/shared/interfaces/motoswap/IOwnableReentrancyGuardContract.d.ts +0 -13
- package/browser/abi/shared/interfaces/motoswap/IReentrancyGuardContract.d.ts +0 -7
- package/browser/abi/shared/interfaces/tests/IWBTCContract.d.ts +0 -13
- package/browser/abi/shared/json/motoswap/ADMINISTERD_OP_20_ABI.d.ts +0 -3
- package/browser/abi/shared/json/motoswap/MOTOSWAP_MOTOCHEF_ABI.d.ts +0 -4
- package/browser/abi/shared/json/motoswap/OWNABLE_ABI.d.ts +0 -3
- package/browser/abi/shared/json/tests/WBTC_ABI.d.ts +0 -3
- package/build/abi/shared/interfaces/motoswap/IMotoChefContract.d.ts +0 -229
- package/build/abi/shared/interfaces/motoswap/IOwnableContract.d.ts +0 -12
- package/build/abi/shared/interfaces/motoswap/IOwnableContract.js +0 -1
- package/build/abi/shared/interfaces/motoswap/IOwnableReentrancyGuardContract.d.ts +0 -13
- package/build/abi/shared/interfaces/motoswap/IOwnableReentrancyGuardContract.js +0 -1
- package/build/abi/shared/interfaces/motoswap/IReentrancyGuardContract.d.ts +0 -7
- package/build/abi/shared/interfaces/motoswap/IReentrancyGuardContract.js +0 -1
- package/build/abi/shared/interfaces/tests/IWBTCContract.d.ts +0 -13
- package/build/abi/shared/interfaces/tests/IWBTCContract.js +0 -1
- package/build/abi/shared/json/motoswap/ADMINISTERD_OP_20_ABI.d.ts +0 -3
- package/build/abi/shared/json/motoswap/MOTOSWAP_MOTOCHEF_ABI.d.ts +0 -4
- package/build/abi/shared/json/motoswap/MOTOSWAP_MOTOCHEF_ABI.js +0 -508
- package/build/abi/shared/json/motoswap/OWNABLE_ABI.d.ts +0 -3
- package/build/abi/shared/json/motoswap/OWNABLE_ABI.js +0 -35
- package/build/abi/shared/json/motoswap/REENTRANCY_GUARD_ABI.js +0 -15
- package/build/abi/shared/json/tests/WBTC_ABI.d.ts +0 -3
- package/build/abi/shared/json/tests/WBTC_ABI.js +0 -57
- package/src/abi/shared/interfaces/motoswap/IMotoChefContract.ts +0 -484
- package/src/abi/shared/interfaces/motoswap/IOwnableContract.ts +0 -32
- package/src/abi/shared/interfaces/motoswap/IOwnableReentrancyGuardContract.ts +0 -33
- package/src/abi/shared/interfaces/motoswap/IReentrancyGuardContract.ts +0 -18
- package/src/abi/shared/interfaces/tests/IWBTCContract.ts +0 -35
- package/src/abi/shared/json/motoswap/MOTOSWAP_MOTOCHEF_ABI.ts +0 -520
- package/src/abi/shared/json/motoswap/OWNABLE_ABI.ts +0 -38
- package/src/abi/shared/json/motoswap/REENTRANCY_GUARD_ABI.ts +0 -20
- package/src/abi/shared/json/tests/WBTC_ABI.ts +0 -73
- /package/build/abi/shared/interfaces/motoswap/{IAdministeredOP20.js → IMoto.js} +0 -0
- /package/build/abi/shared/interfaces/motoswap/{IMotoChefContract.js → IMotoChef.js} +0 -0
|
@@ -3,9 +3,6 @@ import { BitcoinAbiTypes } from '../../../BitcoinAbiTypes.js';
|
|
|
3
3
|
import { BitcoinInterfaceAbi } from '../../../interfaces/BitcoinInterfaceAbi.js';
|
|
4
4
|
import { OP_NET_ABI } from '../opnet/OP_NET_ABI.js';
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* @category Events
|
|
8
|
-
*/
|
|
9
6
|
export const MotoSwapFactoryEvents: BitcoinInterfaceAbi = [
|
|
10
7
|
{
|
|
11
8
|
name: 'PoolCreated',
|
|
@@ -27,9 +24,6 @@ export const MotoSwapFactoryEvents: BitcoinInterfaceAbi = [
|
|
|
27
24
|
},
|
|
28
25
|
];
|
|
29
26
|
|
|
30
|
-
/**
|
|
31
|
-
* @category ABI
|
|
32
|
-
*/
|
|
33
27
|
export const MotoSwapFactoryAbi: BitcoinInterfaceAbi = [
|
|
34
28
|
{
|
|
35
29
|
name: 'createPool',
|
|
@@ -3,9 +3,6 @@ import { BitcoinAbiTypes } from '../../../BitcoinAbiTypes.js';
|
|
|
3
3
|
import { BitcoinInterfaceAbi } from '../../../interfaces/BitcoinInterfaceAbi.js';
|
|
4
4
|
import { OP_20_ABI } from '../opnet/OP_20_ABI.js';
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* @category Events
|
|
8
|
-
*/
|
|
9
6
|
export const MotoSwapPoolEvents: BitcoinInterfaceAbi = [
|
|
10
7
|
{
|
|
11
8
|
name: 'PoolBurn',
|
|
@@ -89,9 +86,6 @@ export const MotoSwapPoolEvents: BitcoinInterfaceAbi = [
|
|
|
89
86
|
},
|
|
90
87
|
];
|
|
91
88
|
|
|
92
|
-
/**
|
|
93
|
-
* @category ABI
|
|
94
|
-
*/
|
|
95
89
|
export const MotoswapPoolAbi: BitcoinInterfaceAbi = [
|
|
96
90
|
{
|
|
97
91
|
name: 'initialize',
|
|
@@ -6,9 +6,6 @@ import { OP_NET_ABI } from '../opnet/OP_NET_ABI.js';
|
|
|
6
6
|
import { MotoSwapFactoryEvents } from './MOTOSWAP_FACTORY_ABI.js';
|
|
7
7
|
import { MotoSwapPoolEvents } from './MOTOSWAP_POOL_ABI.js';
|
|
8
8
|
|
|
9
|
-
/**
|
|
10
|
-
* @category ABI
|
|
11
|
-
*/
|
|
12
9
|
export const MOTOSWAP_ROUTER_ABI: BitcoinInterfaceAbi = [
|
|
13
10
|
/** Liquidity functions */
|
|
14
11
|
{
|
|
@@ -2,10 +2,55 @@ import { ABIDataTypes } from '@btc-vision/transaction';
|
|
|
2
2
|
import { BitcoinAbiTypes } from '../../../BitcoinAbiTypes.js';
|
|
3
3
|
import { BitcoinInterfaceAbi } from '../../../interfaces/BitcoinInterfaceAbi.js';
|
|
4
4
|
import { OP_NET_ABI } from '../opnet/OP_NET_ABI.js';
|
|
5
|
-
import OWNABLE_ABI from './OWNABLE_ABI.js';
|
|
6
|
-
import { REENTRANCY_GUARD_ABI } from './REENTRANCY_GUARD_ABI.js';
|
|
7
5
|
|
|
8
|
-
|
|
6
|
+
const MOTOSWAP_OWNABLE_REENTRANCY_GUARD_ABI: BitcoinInterfaceAbi = [
|
|
7
|
+
// Ownable
|
|
8
|
+
{
|
|
9
|
+
name: 'admin',
|
|
10
|
+
type: BitcoinAbiTypes.Function,
|
|
11
|
+
constant: true,
|
|
12
|
+
inputs: [],
|
|
13
|
+
outputs: [
|
|
14
|
+
{
|
|
15
|
+
name: 'adminAddress',
|
|
16
|
+
type: ABIDataTypes.ADDRESS,
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: 'changeAdmin',
|
|
22
|
+
type: BitcoinAbiTypes.Function,
|
|
23
|
+
constant: false,
|
|
24
|
+
payable: false,
|
|
25
|
+
inputs: [
|
|
26
|
+
{
|
|
27
|
+
name: 'newAdmin',
|
|
28
|
+
type: ABIDataTypes.ADDRESS,
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
outputs: [
|
|
32
|
+
{
|
|
33
|
+
name: 'success',
|
|
34
|
+
type: ABIDataTypes.BOOL,
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
// Reentrancy guard
|
|
40
|
+
{
|
|
41
|
+
name: 'status',
|
|
42
|
+
inputs: [],
|
|
43
|
+
outputs: [
|
|
44
|
+
{
|
|
45
|
+
name: 'status',
|
|
46
|
+
type: ABIDataTypes.UINT256,
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
type: BitcoinAbiTypes.Function,
|
|
50
|
+
},
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
const MotoswapStakingEvents: BitcoinInterfaceAbi = [
|
|
9
54
|
{
|
|
10
55
|
name: 'RewardTokenAdded',
|
|
11
56
|
type: BitcoinAbiTypes.Event,
|
|
@@ -163,15 +208,12 @@ export const MOTOSWAP_STAKING_ABI: BitcoinInterfaceAbi = [
|
|
|
163
208
|
outputs: [{ name: 'success', type: ABIDataTypes.BOOL }],
|
|
164
209
|
},
|
|
165
210
|
|
|
211
|
+
// Ownable Reentrancy Guard
|
|
212
|
+
...MOTOSWAP_OWNABLE_REENTRANCY_GUARD_ABI,
|
|
213
|
+
|
|
166
214
|
// Events
|
|
167
215
|
...MotoswapStakingEvents,
|
|
168
216
|
|
|
169
217
|
// OP_NET
|
|
170
218
|
...OP_NET_ABI,
|
|
171
|
-
|
|
172
|
-
// Reentrancy contract
|
|
173
|
-
...REENTRANCY_GUARD_ABI,
|
|
174
|
-
|
|
175
|
-
// Ownable contract
|
|
176
|
-
...OWNABLE_ABI,
|
|
177
219
|
];
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { ABIDataTypes } from '@btc-vision/transaction';
|
|
2
|
-
import { BitcoinAbiTypes } from '../../../BitcoinAbiTypes
|
|
3
|
-
import { BitcoinInterfaceAbi } from '../../../interfaces/BitcoinInterfaceAbi
|
|
4
|
-
import { OP_20_ABI } from '../opnet/OP_20_ABI
|
|
2
|
+
import { BitcoinAbiTypes } from '../../../BitcoinAbiTypes';
|
|
3
|
+
import { BitcoinInterfaceAbi } from '../../../interfaces/BitcoinInterfaceAbi';
|
|
4
|
+
import { OP_20_ABI } from '../opnet/OP_20_ABI';
|
|
5
5
|
|
|
6
|
-
const
|
|
6
|
+
export const MOTO_ABI: BitcoinInterfaceAbi = [
|
|
7
7
|
{
|
|
8
8
|
name: 'admin',
|
|
9
9
|
type: BitcoinAbiTypes.Function,
|
|
10
|
-
constant: true,
|
|
11
10
|
inputs: [],
|
|
12
11
|
outputs: [
|
|
13
12
|
{
|
|
14
|
-
name: '
|
|
13
|
+
name: 'adminAddress',
|
|
15
14
|
type: ABIDataTypes.ADDRESS,
|
|
16
15
|
},
|
|
17
16
|
],
|
|
@@ -19,11 +18,9 @@ const ADMINISTERED_OP_20_ABI: BitcoinInterfaceAbi = [
|
|
|
19
18
|
{
|
|
20
19
|
name: 'changeAdmin',
|
|
21
20
|
type: BitcoinAbiTypes.Function,
|
|
22
|
-
constant: false,
|
|
23
|
-
payable: false,
|
|
24
21
|
inputs: [
|
|
25
22
|
{
|
|
26
|
-
name: '
|
|
23
|
+
name: 'to',
|
|
27
24
|
type: ABIDataTypes.ADDRESS,
|
|
28
25
|
},
|
|
29
26
|
],
|
|
@@ -37,8 +34,6 @@ const ADMINISTERED_OP_20_ABI: BitcoinInterfaceAbi = [
|
|
|
37
34
|
{
|
|
38
35
|
name: 'adminMint',
|
|
39
36
|
type: BitcoinAbiTypes.Function,
|
|
40
|
-
constant: false,
|
|
41
|
-
payable: false,
|
|
42
37
|
inputs: [
|
|
43
38
|
{
|
|
44
39
|
name: 'to',
|
|
@@ -59,8 +54,6 @@ const ADMINISTERED_OP_20_ABI: BitcoinInterfaceAbi = [
|
|
|
59
54
|
{
|
|
60
55
|
name: 'adminBurn',
|
|
61
56
|
type: BitcoinAbiTypes.Function,
|
|
62
|
-
constant: false,
|
|
63
|
-
payable: false,
|
|
64
57
|
inputs: [
|
|
65
58
|
{
|
|
66
59
|
name: 'from',
|
|
@@ -78,8 +71,7 @@ const ADMINISTERED_OP_20_ABI: BitcoinInterfaceAbi = [
|
|
|
78
71
|
},
|
|
79
72
|
],
|
|
80
73
|
},
|
|
74
|
+
|
|
81
75
|
// OP_20
|
|
82
76
|
...OP_20_ABI,
|
|
83
77
|
];
|
|
84
|
-
|
|
85
|
-
export default ADMINISTERED_OP_20_ABI;
|
|
@@ -3,10 +3,7 @@ import { BitcoinAbiTypes } from '../../../BitcoinAbiTypes.js';
|
|
|
3
3
|
import { BitcoinInterfaceAbi } from '../../../interfaces/BitcoinInterfaceAbi.js';
|
|
4
4
|
import { OP_NET_ABI } from '../opnet/OP_NET_ABI.js';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
* @category Events
|
|
8
|
-
*/
|
|
9
|
-
export const NativeSwapEvents: BitcoinInterfaceAbi = [
|
|
6
|
+
const NativeSwapEvents: BitcoinInterfaceAbi = [
|
|
10
7
|
{
|
|
11
8
|
name: 'LiquidityAdded',
|
|
12
9
|
values: [
|
|
@@ -64,14 +61,25 @@ export const NativeSwapEvents: BitcoinInterfaceAbi = [
|
|
|
64
61
|
values: [
|
|
65
62
|
{ name: 'depositAddress', type: ABIDataTypes.STRING },
|
|
66
63
|
{ name: 'amount', type: ABIDataTypes.UINT128 },
|
|
64
|
+
{ name: 'providerId', type: ABIDataTypes.UINT256 },
|
|
65
|
+
],
|
|
66
|
+
type: BitcoinAbiTypes.Event,
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: 'ActivateProvider',
|
|
70
|
+
values: [
|
|
71
|
+
{ name: 'providerId', type: ABIDataTypes.UINT256 },
|
|
72
|
+
{ name: 'listingAmount', type: ABIDataTypes.UINT128 },
|
|
67
73
|
],
|
|
68
74
|
type: BitcoinAbiTypes.Event,
|
|
69
75
|
},
|
|
76
|
+
{
|
|
77
|
+
name: 'FulfilledProvider',
|
|
78
|
+
values: [{ name: 'providerId', type: ABIDataTypes.UINT256 }],
|
|
79
|
+
type: BitcoinAbiTypes.Event,
|
|
80
|
+
},
|
|
70
81
|
];
|
|
71
82
|
|
|
72
|
-
/**
|
|
73
|
-
* @category ABI
|
|
74
|
-
*/
|
|
75
83
|
export const NativeSwapAbi: BitcoinInterfaceAbi = [
|
|
76
84
|
//=================================================
|
|
77
85
|
// RESERVE
|
|
@@ -2,44 +2,27 @@ import { ABIDataTypes } from '@btc-vision/transaction';
|
|
|
2
2
|
import { BitcoinAbiTypes } from '../../../BitcoinAbiTypes.js';
|
|
3
3
|
import { BitcoinInterfaceAbi } from '../../../interfaces/BitcoinInterfaceAbi.js';
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
* @category ABI
|
|
7
|
-
*/
|
|
8
5
|
export const OP_NET_ABI: BitcoinInterfaceAbi = [
|
|
9
|
-
// OP_NET
|
|
10
6
|
{
|
|
11
|
-
name: '
|
|
12
|
-
constant: true,
|
|
13
|
-
outputs: [
|
|
14
|
-
{
|
|
15
|
-
name: 'owner',
|
|
16
|
-
type: ABIDataTypes.ADDRESS,
|
|
17
|
-
},
|
|
18
|
-
],
|
|
7
|
+
name: 'address',
|
|
19
8
|
type: BitcoinAbiTypes.Function,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
{
|
|
23
|
-
name: 'deployer',
|
|
24
|
-
constant: true,
|
|
9
|
+
inputs: [],
|
|
25
10
|
outputs: [
|
|
26
11
|
{
|
|
27
|
-
name: '
|
|
12
|
+
name: 'address',
|
|
28
13
|
type: ABIDataTypes.ADDRESS,
|
|
29
14
|
},
|
|
30
15
|
],
|
|
31
|
-
type: BitcoinAbiTypes.Function,
|
|
32
16
|
},
|
|
33
|
-
|
|
34
17
|
{
|
|
35
|
-
name: '
|
|
36
|
-
|
|
18
|
+
name: 'contractDeployer',
|
|
19
|
+
type: BitcoinAbiTypes.Function,
|
|
20
|
+
inputs: [],
|
|
37
21
|
outputs: [
|
|
38
22
|
{
|
|
39
|
-
name: '
|
|
23
|
+
name: 'contractDeployer',
|
|
40
24
|
type: ABIDataTypes.ADDRESS,
|
|
41
25
|
},
|
|
42
26
|
],
|
|
43
|
-
type: BitcoinAbiTypes.Function,
|
|
44
27
|
},
|
|
45
28
|
];
|
|
@@ -93,10 +93,12 @@ export class CallResult<
|
|
|
93
93
|
/**
|
|
94
94
|
* Easily create a bitcoin interaction transaction from a simulated contract call.
|
|
95
95
|
* @param {TransactionParameters} interactionParams - The parameters for the transaction.
|
|
96
|
+
* @param amountAddition
|
|
96
97
|
* @returns {Promise<InteractionTransactionReceipt>} The transaction hash, the transaction hex and the UTXOs used.
|
|
97
98
|
*/
|
|
98
99
|
public async sendTransaction(
|
|
99
100
|
interactionParams: TransactionParameters,
|
|
101
|
+
amountAddition: bigint = 0n,
|
|
100
102
|
): Promise<InteractionTransactionReceipt> {
|
|
101
103
|
if (!this.calldata) {
|
|
102
104
|
throw new Error('Calldata not set');
|
|
@@ -119,7 +121,10 @@ export class CallResult<
|
|
|
119
121
|
const UTXOs: UTXO[] =
|
|
120
122
|
interactionParams.utxos ||
|
|
121
123
|
(await this.#fetchUTXOs(
|
|
122
|
-
totalFee +
|
|
124
|
+
totalFee +
|
|
125
|
+
interactionParams.maximumAllowedSatToSpend +
|
|
126
|
+
totalAmount +
|
|
127
|
+
amountAddition,
|
|
123
128
|
interactionParams,
|
|
124
129
|
));
|
|
125
130
|
|
|
@@ -147,6 +152,7 @@ export class CallResult<
|
|
|
147
152
|
transaction.fundingTransaction,
|
|
148
153
|
false,
|
|
149
154
|
);
|
|
155
|
+
|
|
150
156
|
if (!tx1 || tx1.error) {
|
|
151
157
|
throw new Error(`Error sending transaction: ${tx1?.error || 'Unknown error'}`);
|
|
152
158
|
}
|
|
@@ -174,6 +180,12 @@ export class CallResult<
|
|
|
174
180
|
preimage: transaction.preimage,
|
|
175
181
|
};
|
|
176
182
|
} catch (e) {
|
|
183
|
+
const msgStr = (e as Error).message;
|
|
184
|
+
|
|
185
|
+
if (msgStr.includes('Insufficient funds to pay the fees') && amountAddition === 0n) {
|
|
186
|
+
return await this.sendTransaction(interactionParams, 200_000n);
|
|
187
|
+
}
|
|
188
|
+
|
|
177
189
|
// We need to clean up the UTXOs if the transaction fails
|
|
178
190
|
this.#provider.utxoManager.clean();
|
|
179
191
|
|
|
@@ -204,7 +216,7 @@ export class CallResult<
|
|
|
204
216
|
|
|
205
217
|
const utxoSetting: RequestUTXOsParamsWithAmount = {
|
|
206
218
|
address: interactionParams.refundTo,
|
|
207
|
-
amount:
|
|
219
|
+
amount: 50_000n + amount,
|
|
208
220
|
throwErrors: true,
|
|
209
221
|
};
|
|
210
222
|
|
|
@@ -629,10 +629,10 @@ export abstract class IBaseContract<T extends BaseContractProperties> implements
|
|
|
629
629
|
const gasPerSat = gasParameters.gasPerSat;
|
|
630
630
|
const exactGas = ((gas / 1000000n) * gasPerSat) / 1000000n;
|
|
631
631
|
|
|
632
|
-
// Add
|
|
633
|
-
const extraGas = (exactGas *
|
|
632
|
+
// Add 25% extra gas
|
|
633
|
+
const extraGas = (exactGas * 25n) / 100n;
|
|
634
634
|
|
|
635
|
-
return this.max(exactGas + extraGas, 330n);
|
|
635
|
+
return this.max(exactGas + extraGas, 330n) + 1n;
|
|
636
636
|
}
|
|
637
637
|
|
|
638
638
|
private max(a: bigint, b: bigint): bigint {
|
package/src/opnet.ts
CHANGED
|
@@ -12,10 +12,10 @@ export * from './transactions/metadata/TransactionInput.js';
|
|
|
12
12
|
export * from './transactions/metadata/TransactionOutput.js';
|
|
13
13
|
export * from './transactions/Transaction.js';
|
|
14
14
|
|
|
15
|
+
export * from './transactions/interfaces/ProofOfWorkChallenge.js';
|
|
15
16
|
export * from './transactions/interfaces/transactions/ICommonTransaction.js';
|
|
16
17
|
export * from './transactions/interfaces/transactions/IDeploymentTransaction.js';
|
|
17
18
|
export * from './transactions/interfaces/transactions/IInteractionTransaction.js';
|
|
18
|
-
export * from './transactions/interfaces/ProofOfWorkChallenge.js';
|
|
19
19
|
|
|
20
20
|
/** Providers */
|
|
21
21
|
export * from './providers/AbstractRpcProvider.js';
|
|
@@ -45,8 +45,8 @@ export * from './contracts/ContractData.js';
|
|
|
45
45
|
export * from './contracts/interfaces/IAccessList.js';
|
|
46
46
|
export * from './contracts/interfaces/ICallResult.js';
|
|
47
47
|
export * from './contracts/interfaces/IContract.js';
|
|
48
|
-
export * from './contracts/OPNetEvent.js';
|
|
49
48
|
export * from './contracts/interfaces/SimulatedTransaction.js';
|
|
49
|
+
export * from './contracts/OPNetEvent.js';
|
|
50
50
|
export * from './contracts/TypeToStr.js';
|
|
51
51
|
|
|
52
52
|
/** Abi */
|
|
@@ -86,25 +86,23 @@ export * from './bitcoin/UTXOs.js';
|
|
|
86
86
|
export { ABIDataTypes } from '@btc-vision/transaction';
|
|
87
87
|
|
|
88
88
|
/** ABI JSON */
|
|
89
|
+
export * from './abi/shared/json/generic/STAKING_ABI.js';
|
|
90
|
+
export * from './abi/shared/json/motoswap/MOTO_ABI.js';
|
|
91
|
+
export * from './abi/shared/json/motoswap/MOTOCHEF_ABI.js';
|
|
89
92
|
export * from './abi/shared/json/motoswap/MOTOSWAP_FACTORY_ABI.js';
|
|
90
93
|
export * from './abi/shared/json/motoswap/MOTOSWAP_POOL_ABI.js';
|
|
91
94
|
export * from './abi/shared/json/motoswap/MOTOSWAP_ROUTER_ABI.js';
|
|
92
|
-
export * from './abi/shared/json/motoswap/
|
|
93
|
-
export * from './abi/shared/json/motoswap/ADMINISTERD_OP_20_ABI.js';
|
|
95
|
+
export * from './abi/shared/json/motoswap/NATIVE_SWAP_ABI.js';
|
|
94
96
|
export * from './abi/shared/json/opnet/OP_20_ABI.js';
|
|
95
97
|
export * from './abi/shared/json/opnet/OP_NET_ABI.js';
|
|
96
|
-
export * from './abi/shared/json/generic/STAKING_ABI.js';
|
|
97
|
-
export * from './abi/shared/json/tests/WBTC_ABI.js';
|
|
98
|
-
export * from './abi/shared/json/motoswap/NATIVE_SWAP_ABI.js';
|
|
99
98
|
|
|
100
99
|
/** ABI Interfaces */
|
|
100
|
+
export * from './abi/shared/interfaces/generic/IStackingContract.js';
|
|
101
|
+
export * from './abi/shared/interfaces/motoswap/IMoto.js';
|
|
102
|
+
export * from './abi/shared/interfaces/motoswap/IMotoChef.js';
|
|
101
103
|
export * from './abi/shared/interfaces/motoswap/IMotoswapFactoryContract.js';
|
|
102
104
|
export * from './abi/shared/interfaces/motoswap/IMotoswapPoolContract.js';
|
|
103
105
|
export * from './abi/shared/interfaces/motoswap/IMotoswapRouterContract.js';
|
|
104
|
-
export * from './abi/shared/interfaces/motoswap/
|
|
105
|
-
export * from './abi/shared/interfaces/motoswap/IAdministeredOP20.js';
|
|
106
|
+
export * from './abi/shared/interfaces/motoswap/INativeSwapContract.js';
|
|
106
107
|
export * from './abi/shared/interfaces/opnet/IOP_20Contract.js';
|
|
107
108
|
export * from './abi/shared/interfaces/opnet/IOP_NETContract.js';
|
|
108
|
-
export * from './abi/shared/interfaces/generic/IStackingContract.js';
|
|
109
|
-
export * from './abi/shared/interfaces/tests/IWBTCContract.js';
|
|
110
|
-
export * from './abi/shared/interfaces/motoswap/INativeSwapContract.js';
|
|
@@ -3,6 +3,9 @@ import { AbstractRpcProvider } from './AbstractRpcProvider.js';
|
|
|
3
3
|
import { JsonRpcPayload } from './interfaces/JSONRpc.js';
|
|
4
4
|
import { JsonRpcCallResult, JsonRpcError, JsonRpcResult } from './interfaces/JSONRpcResult.js';
|
|
5
5
|
|
|
6
|
+
import fetch from '../fetch/fetch.js';
|
|
7
|
+
import { Response } from 'undici/types/fetch';
|
|
8
|
+
|
|
6
9
|
/**
|
|
7
10
|
* @description This class is used to provide a JSON RPC provider.
|
|
8
11
|
* @class JSONRpcProvider
|
|
@@ -38,6 +41,12 @@ export class JSONRpcProvider extends AbstractRpcProvider {
|
|
|
38
41
|
method: 'POST',
|
|
39
42
|
headers: {
|
|
40
43
|
'Content-Type': 'application/json',
|
|
44
|
+
'User-Agent': 'OPNET/1.0',
|
|
45
|
+
'Accept-Encoding': 'gzip, deflate, br',
|
|
46
|
+
Accept: 'application/json',
|
|
47
|
+
'Accept-Charset': 'utf-8',
|
|
48
|
+
'Accept-Language': 'en-US',
|
|
49
|
+
Connection: 'Keep-Alive',
|
|
41
50
|
},
|
|
42
51
|
body: JSON.stringify(payload),
|
|
43
52
|
timeout: this.timeout,
|
|
@@ -52,9 +61,6 @@ export class JSONRpcProvider extends AbstractRpcProvider {
|
|
|
52
61
|
|
|
53
62
|
clearTimeout(timeoutId);
|
|
54
63
|
|
|
55
|
-
//const str = await resp.text();
|
|
56
|
-
//fs.writeFileSync('response.json', str);
|
|
57
|
-
|
|
58
64
|
const fetchedData = (await resp.json()) as JsonRpcResult | JsonRpcError;
|
|
59
65
|
if (!fetchedData) {
|
|
60
66
|
throw new Error('No data fetched');
|
|
@@ -62,6 +68,7 @@ export class JSONRpcProvider extends AbstractRpcProvider {
|
|
|
62
68
|
|
|
63
69
|
return [fetchedData];
|
|
64
70
|
} catch (e) {
|
|
71
|
+
console.log(e);
|
|
65
72
|
const error = e as Error;
|
|
66
73
|
if (error.name === 'AbortError') {
|
|
67
74
|
throw new Error(`Request timed out after ${this.timeout}ms`);
|
package/webpack.config.js
CHANGED
|
@@ -29,6 +29,7 @@ export default {
|
|
|
29
29
|
|
|
30
30
|
assert: import.meta.resolve('assert/'),
|
|
31
31
|
crypto: import.meta.resolve('./src/crypto/crypto-browser.js'),
|
|
32
|
+
undici: import.meta.resolve('./src/fetch/fetch-browser.js'),
|
|
32
33
|
http: import.meta.resolve('stream-http/'),
|
|
33
34
|
https: import.meta.resolve('https-browserify/'),
|
|
34
35
|
os: import.meta.resolve('os-browserify/browser/'),
|