opnet 1.1.21 → 1.1.23
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/.github/workflows/ci.yml +43 -43
- package/browser/_version.d.ts +1 -1
- package/browser/abi/shared/interfaces/{IStackingContract.d.ts → generic/IStackingContract.d.ts} +1 -1
- package/browser/abi/shared/interfaces/motoswap/IEwmaContract.d.ts +36 -0
- package/browser/abi/shared/interfaces/{IMotoswapFactoryContract.d.ts → motoswap/IMotoswapFactoryContract.d.ts} +2 -2
- package/browser/abi/shared/interfaces/{IMotoswapPoolContract.d.ts → motoswap/IMotoswapPoolContract.d.ts} +2 -2
- package/browser/abi/shared/interfaces/{IMotoswapRouterContract.d.ts → motoswap/IMotoswapRouterContract.d.ts} +2 -2
- package/{build/abi/shared/interfaces → browser/abi/shared/interfaces/opnet}/IOP_20Contract.d.ts +1 -1
- package/browser/abi/shared/interfaces/{IOP_NETContract.d.ts → opnet/IOP_NETContract.d.ts} +2 -2
- package/{build/abi/shared/interfaces → browser/abi/shared/interfaces/tests}/IWBTCContract.d.ts +3 -3
- package/browser/abi/shared/json/{STAKING_ABI.d.ts → generic/STAKING_ABI.d.ts} +1 -1
- package/browser/abi/shared/json/motoswap/EWMA_ABI.d.ts +3 -0
- package/browser/abi/shared/json/{MOTOSWAP_FACTORY_ABI.d.ts → motoswap/MOTOSWAP_FACTORY_ABI.d.ts} +1 -1
- package/browser/abi/shared/json/{MOTOSWAP_POOL_ABI.d.ts → motoswap/MOTOSWAP_POOL_ABI.d.ts} +1 -1
- package/browser/abi/shared/json/motoswap/MOTOSWAP_ROUTER_ABI.d.ts +2 -0
- package/browser/abi/shared/json/{OP_20_ABI.d.ts → opnet/OP_20_ABI.d.ts} +1 -1
- package/browser/abi/shared/json/opnet/OP_NET_ABI.d.ts +2 -0
- package/browser/abi/shared/json/{WBTC_ABI.d.ts → tests/WBTC_ABI.d.ts} +1 -1
- package/browser/index.js +1 -1
- package/browser/opnet.d.ts +16 -14
- package/build/_version.d.ts +1 -1
- package/build/_version.js +1 -1
- package/build/abi/shared/interfaces/{IStackingContract.d.ts → generic/IStackingContract.d.ts} +1 -1
- package/build/abi/shared/interfaces/motoswap/IEwmaContract.d.ts +36 -0
- package/build/abi/shared/interfaces/{IMotoswapFactoryContract.d.ts → motoswap/IMotoswapFactoryContract.d.ts} +2 -2
- package/build/abi/shared/interfaces/{IMotoswapPoolContract.d.ts → motoswap/IMotoswapPoolContract.d.ts} +2 -2
- package/build/abi/shared/interfaces/{IMotoswapRouterContract.d.ts → motoswap/IMotoswapRouterContract.d.ts} +2 -2
- package/{browser/abi/shared/interfaces → build/abi/shared/interfaces/opnet}/IOP_20Contract.d.ts +1 -1
- package/build/abi/shared/interfaces/{IOP_NETContract.d.ts → opnet/IOP_NETContract.d.ts} +2 -2
- package/{browser/abi/shared/interfaces → build/abi/shared/interfaces/tests}/IWBTCContract.d.ts +3 -3
- package/build/abi/shared/interfaces/tests/IWBTCContract.js +1 -0
- package/build/abi/shared/json/{STAKING_ABI.d.ts → generic/STAKING_ABI.d.ts} +1 -1
- package/build/abi/shared/json/{STAKING_ABI.js → generic/STAKING_ABI.js} +1 -1
- package/build/abi/shared/json/motoswap/EWMA_ABI.d.ts +3 -0
- package/build/abi/shared/json/motoswap/EWMA_ABI.js +271 -0
- package/build/abi/shared/json/{MOTOSWAP_FACTORY_ABI.d.ts → motoswap/MOTOSWAP_FACTORY_ABI.d.ts} +1 -1
- package/build/abi/shared/json/{MOTOSWAP_FACTORY_ABI.js → motoswap/MOTOSWAP_FACTORY_ABI.js} +2 -2
- package/build/abi/shared/json/{MOTOSWAP_POOL_ABI.d.ts → motoswap/MOTOSWAP_POOL_ABI.d.ts} +1 -1
- package/build/abi/shared/json/{MOTOSWAP_POOL_ABI.js → motoswap/MOTOSWAP_POOL_ABI.js} +2 -2
- package/build/abi/shared/json/motoswap/MOTOSWAP_ROUTER_ABI.d.ts +2 -0
- package/build/abi/shared/json/{MOTOSWAP_ROUTER_ABI.js → motoswap/MOTOSWAP_ROUTER_ABI.js} +3 -3
- package/build/abi/shared/json/{OP_20_ABI.d.ts → opnet/OP_20_ABI.d.ts} +1 -1
- package/build/abi/shared/json/{OP_20_ABI.js → opnet/OP_20_ABI.js} +1 -1
- package/build/abi/shared/json/opnet/OP_NET_ABI.d.ts +2 -0
- package/build/abi/shared/json/{OP_NET_ABI.js → opnet/OP_NET_ABI.js} +1 -1
- package/build/abi/shared/json/{WBTC_ABI.d.ts → tests/WBTC_ABI.d.ts} +1 -1
- package/build/abi/shared/json/{WBTC_ABI.js → tests/WBTC_ABI.js} +3 -3
- package/build/contracts/Contract.js +25 -3
- package/build/opnet.d.ts +16 -14
- package/build/opnet.js +16 -14
- package/build/providers/AbstractRpcProvider.js +1 -1
- package/package.json +2 -2
- package/src/_version.ts +1 -1
- package/src/abi/shared/interfaces/{IStackingContract.ts → generic/IStackingContract.ts} +1 -1
- package/src/abi/shared/interfaces/motoswap/IEwmaContract.ts +153 -0
- package/src/abi/shared/interfaces/{IMotoswapFactoryContract.ts → motoswap/IMotoswapFactoryContract.ts} +2 -2
- package/src/abi/shared/interfaces/{IMotoswapPoolContract.ts → motoswap/IMotoswapPoolContract.ts} +2 -2
- package/src/abi/shared/interfaces/{IMotoswapRouterContract.ts → motoswap/IMotoswapRouterContract.ts} +2 -2
- package/src/abi/shared/interfaces/{IOP_20Contract.ts → opnet/IOP_20Contract.ts} +2 -3
- package/src/abi/shared/interfaces/{IOP_NETContract.ts → opnet/IOP_NETContract.ts} +2 -2
- package/src/abi/shared/interfaces/{IWBTCContract.ts → tests/IWBTCContract.ts} +3 -3
- package/src/abi/shared/json/{STAKING_ABI.ts → generic/STAKING_ABI.ts} +2 -2
- package/src/abi/shared/json/motoswap/EWMA_ABI.ts +289 -0
- package/src/abi/shared/json/{MOTOSWAP_FACTORY_ABI.ts → motoswap/MOTOSWAP_FACTORY_ABI.ts} +3 -3
- package/src/abi/shared/json/{MOTOSWAP_POOL_ABI.ts → motoswap/MOTOSWAP_POOL_ABI.ts} +3 -3
- package/src/abi/shared/json/{MOTOSWAP_ROUTER_ABI.ts → motoswap/MOTOSWAP_ROUTER_ABI.ts} +4 -4
- package/src/abi/shared/json/{OP_20_ABI.ts → opnet/OP_20_ABI.ts} +2 -2
- package/src/abi/shared/json/{OP_NET_ABI.ts → opnet/OP_NET_ABI.ts} +2 -2
- package/src/abi/shared/json/{WBTC_ABI.ts → tests/WBTC_ABI.ts} +4 -4
- package/src/contracts/Contract.ts +28 -2
- package/src/opnet.ts +16 -20
- package/src/providers/AbstractRpcProvider.ts +1 -1
- package/browser/abi/shared/json/MOTOSWAP_ROUTER_ABI.d.ts +0 -2
- package/browser/abi/shared/json/OP_NET_ABI.d.ts +0 -2
- package/build/abi/shared/json/MOTOSWAP_ROUTER_ABI.d.ts +0 -2
- package/build/abi/shared/json/OP_NET_ABI.d.ts +0 -2
- package/src/providers/interfaces/Generate.ts.disabled +0 -7
- package/src/transactions/decoders/UnwrapTransaction.ts.disabled +0 -67
- package/src/transactions/decoders/WrapTransaction.ts.disabled +0 -69
- package/src/transactions/interfaces/transactions/IUnwrapTransaction.ts.disabled +0 -59
- package/src/transactions/interfaces/transactions/IWrapTransaction.ts.disabled +0 -43
- /package/build/abi/shared/interfaces/{IStackingContract.js → generic/IStackingContract.js} +0 -0
- /package/build/abi/shared/interfaces/{IMotoswapFactoryContract.js → motoswap/IEwmaContract.js} +0 -0
- /package/build/abi/shared/interfaces/{IMotoswapPoolContract.js → motoswap/IMotoswapFactoryContract.js} +0 -0
- /package/build/abi/shared/interfaces/{IMotoswapRouterContract.js → motoswap/IMotoswapPoolContract.js} +0 -0
- /package/build/abi/shared/interfaces/{IOP_20Contract.js → motoswap/IMotoswapRouterContract.js} +0 -0
- /package/build/abi/shared/interfaces/{IOP_NETContract.js → opnet/IOP_20Contract.js} +0 -0
- /package/build/abi/shared/interfaces/{IWBTCContract.js → opnet/IOP_NETContract.js} +0 -0
package/build/opnet.js
CHANGED
|
@@ -48,17 +48,19 @@ export * from './common/CommonTypes.js';
|
|
|
48
48
|
export * from './bitcoin/interfaces/IUTXO.js';
|
|
49
49
|
export * from './bitcoin/UTXOs.js';
|
|
50
50
|
export { ABIDataTypes } from '@btc-vision/transaction';
|
|
51
|
-
export * from './abi/shared/json/MOTOSWAP_FACTORY_ABI.js';
|
|
52
|
-
export * from './abi/shared/json/MOTOSWAP_POOL_ABI.js';
|
|
53
|
-
export * from './abi/shared/json/MOTOSWAP_ROUTER_ABI.js';
|
|
54
|
-
export * from './abi/shared/json/OP_20_ABI.js';
|
|
55
|
-
export * from './abi/shared/json/OP_NET_ABI.js';
|
|
56
|
-
export * from './abi/shared/json/STAKING_ABI.js';
|
|
57
|
-
export * from './abi/shared/json/WBTC_ABI.js';
|
|
58
|
-
export * from './abi/shared/
|
|
59
|
-
export * from './abi/shared/interfaces/
|
|
60
|
-
export * from './abi/shared/interfaces/
|
|
61
|
-
export * from './abi/shared/interfaces/
|
|
62
|
-
export * from './abi/shared/interfaces/
|
|
63
|
-
export * from './abi/shared/interfaces/
|
|
64
|
-
export * from './abi/shared/interfaces/
|
|
51
|
+
export * from './abi/shared/json/motoswap/MOTOSWAP_FACTORY_ABI.js';
|
|
52
|
+
export * from './abi/shared/json/motoswap/MOTOSWAP_POOL_ABI.js';
|
|
53
|
+
export * from './abi/shared/json/motoswap/MOTOSWAP_ROUTER_ABI.js';
|
|
54
|
+
export * from './abi/shared/json/opnet/OP_20_ABI.js';
|
|
55
|
+
export * from './abi/shared/json/opnet/OP_NET_ABI.js';
|
|
56
|
+
export * from './abi/shared/json/generic/STAKING_ABI.js';
|
|
57
|
+
export * from './abi/shared/json/tests/WBTC_ABI.js';
|
|
58
|
+
export * from './abi/shared/json/motoswap/EWMA_ABI.js';
|
|
59
|
+
export * from './abi/shared/interfaces/motoswap/IMotoswapFactoryContract.js';
|
|
60
|
+
export * from './abi/shared/interfaces/motoswap/IMotoswapPoolContract.js';
|
|
61
|
+
export * from './abi/shared/interfaces/motoswap/IMotoswapRouterContract.js';
|
|
62
|
+
export * from './abi/shared/interfaces/opnet/IOP_20Contract.js';
|
|
63
|
+
export * from './abi/shared/interfaces/opnet/IOP_NETContract.js';
|
|
64
|
+
export * from './abi/shared/interfaces/generic/IStackingContract.js';
|
|
65
|
+
export * from './abi/shared/interfaces/tests/IWBTCContract.js';
|
|
66
|
+
export * from './abi/shared/interfaces/motoswap/IEwmaContract.js';
|
|
@@ -160,7 +160,7 @@ export class AbstractRpcProvider {
|
|
|
160
160
|
}
|
|
161
161
|
async call(to, data, from, height) {
|
|
162
162
|
const toStr = to.toString();
|
|
163
|
-
const fromStr = from ? from.
|
|
163
|
+
const fromStr = from ? from.toHex() : null;
|
|
164
164
|
let dataStr = Buffer.isBuffer(data) ? this.bufferToHex(data) : data;
|
|
165
165
|
if (dataStr.startsWith('0x')) {
|
|
166
166
|
dataStr = dataStr.slice(2);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opnet",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.23",
|
|
5
5
|
"author": "OP_NET",
|
|
6
6
|
"description": "The perfect library for building Bitcoin-based applications.",
|
|
7
7
|
"engines": {
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
"@bitcoinerlab/secp256k1": "^1.1.1",
|
|
106
106
|
"@btc-vision/bitcoin": "^6.3.0",
|
|
107
107
|
"@btc-vision/bsi-bitcoin-rpc": ">=1.0.29",
|
|
108
|
-
"@btc-vision/transaction": "^1.1.
|
|
108
|
+
"@btc-vision/transaction": "^1.1.10",
|
|
109
109
|
"@noble/hashes": "^1.5.0",
|
|
110
110
|
"bignumber.js": "^9.1.2",
|
|
111
111
|
"buffer": "^6.0.3",
|
package/src/_version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '1.1.
|
|
1
|
+
export const version = '1.1.23';
|
|
@@ -0,0 +1,153 @@
|
|
|
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 the `addLiquidity` function call.
|
|
14
|
+
*/
|
|
15
|
+
export type AddLiquidity = CallResult<{
|
|
16
|
+
ok: boolean;
|
|
17
|
+
}>;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @description Represents the result of the `removeLiquidity` function call.
|
|
21
|
+
*/
|
|
22
|
+
export type RemoveLiquidity = CallResult<{
|
|
23
|
+
totalTokensReturned: bigint;
|
|
24
|
+
}>;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @description Represents the result of the `swap` function call.
|
|
28
|
+
*/
|
|
29
|
+
export type Swap = CallResult<{
|
|
30
|
+
ok: boolean;
|
|
31
|
+
}>;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @description Represents the result of the `getReserve` function call.
|
|
35
|
+
*/
|
|
36
|
+
export type GetReserve = CallResult<{
|
|
37
|
+
liquidity: bigint;
|
|
38
|
+
reservedLiquidity: bigint;
|
|
39
|
+
}>;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @description Represents the result of the `getQuote` function call.
|
|
43
|
+
*/
|
|
44
|
+
export type GetQuote = CallResult<{
|
|
45
|
+
tokensOut: bigint;
|
|
46
|
+
requiredSatoshis: bigint;
|
|
47
|
+
currentPrice: bigint;
|
|
48
|
+
}>;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @description Represents the result of the `setQuote` function call.
|
|
52
|
+
*/
|
|
53
|
+
export type SetQuote = CallResult<{
|
|
54
|
+
ok: boolean;
|
|
55
|
+
}>;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @description This interface represents the OP_NET contract.
|
|
59
|
+
* @interface IOP_NETContract
|
|
60
|
+
* @extends {IOP_NETContract}
|
|
61
|
+
* @category Contracts
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* import { Address } from '@btc-vision/transaction';
|
|
65
|
+
* import { IOP_NETContract } from '../abi/shared/interfaces/IOP_NETContract.js';
|
|
66
|
+
* import { OP_NET_ABI } from '../abi/shared/json/OP_NET_ABI.js';
|
|
67
|
+
* import { CallResult } from '../contracts/CallResult.js';
|
|
68
|
+
* import { getContract } from '../contracts/Contract.js';
|
|
69
|
+
* import { JSONRpcProvider } from '../providers/JSONRpcProvider.js';
|
|
70
|
+
*
|
|
71
|
+
* const provider: JSONRpcProvider = new JSONRpcProvider('https://regtest.opnet.org');
|
|
72
|
+
* const contract: IOP_NETContract = getContract<IOP_NETContract>(
|
|
73
|
+
* 'bcrt1pyrs3eqwnrmd4ql3nwvx66yzp0wc24xd2t9pf8699ln340pjs7f3sar3tum',
|
|
74
|
+
* OP_NET_ABI,
|
|
75
|
+
* provider,
|
|
76
|
+
* networks.regtest,
|
|
77
|
+
* );
|
|
78
|
+
*
|
|
79
|
+
* const tokenAddress: Address = new Address([
|
|
80
|
+
* 40, 11, 228, 172, 219, 50, 169, 155, 163, 235, 250, 102, 169, 29, 219, 65, 167, 183, 161, 210,
|
|
81
|
+
* 254, 244, 21, 57, 153, 34, 205, 138, 4, 72, 92, 2,
|
|
82
|
+
* ]);
|
|
83
|
+
*
|
|
84
|
+
* const reserveExample = await contract.reserve(
|
|
85
|
+
* tokenAddress,
|
|
86
|
+
* BigInt("1000000000000000000"), // maximumAmountIn
|
|
87
|
+
* BigInt("500000000000000000") // minimumAmountOut
|
|
88
|
+
* );
|
|
89
|
+
*
|
|
90
|
+
* console.log('Reserved:', reserveExample.properties.reserved);
|
|
91
|
+
*/
|
|
92
|
+
export interface IEwmaContract extends IOP_NETContract {
|
|
93
|
+
/**
|
|
94
|
+
* @description Reserves a certain amount of tokens.
|
|
95
|
+
* @param token - The address of the token to reserve.
|
|
96
|
+
* @param maximumAmountIn - The maximum amount of tokens to reserve.
|
|
97
|
+
* @param minimumAmountOut - The minimum amount of tokens expected out.
|
|
98
|
+
* @returns {Promise<ReserveEWMA>}
|
|
99
|
+
*/
|
|
100
|
+
reserve(
|
|
101
|
+
token: Address,
|
|
102
|
+
maximumAmountIn: bigint,
|
|
103
|
+
minimumAmountOut: bigint,
|
|
104
|
+
): Promise<ReserveEWMA>;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* @description Adds liquidity to the contract.
|
|
108
|
+
* @param token - The address of the token to add liquidity for.
|
|
109
|
+
* @param receiver - The receiver of the liquidity.
|
|
110
|
+
* @param amountIn - The amount of tokens to add.
|
|
111
|
+
* @returns {Promise<AddLiquidity>}
|
|
112
|
+
*/
|
|
113
|
+
addLiquidity(token: Address, receiver: string, amountIn: bigint): Promise<AddLiquidity>;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* @description Removes liquidity from the contract.
|
|
117
|
+
* @param token - The address of the token to remove liquidity for.
|
|
118
|
+
* @returns {Promise<RemoveLiquidity>}
|
|
119
|
+
*/
|
|
120
|
+
removeLiquidity(token: Address): Promise<RemoveLiquidity>;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* @description Executes a swap operation.
|
|
124
|
+
* @param token - The address of the token to swap.
|
|
125
|
+
* @param reservationId - The reservation ID for the swap.
|
|
126
|
+
* @param isSimulation - Whether the swap is a simulation.
|
|
127
|
+
* @returns {Promise<Swap>}
|
|
128
|
+
*/
|
|
129
|
+
swap(token: Address, reservationId: bigint, isSimulation: boolean): Promise<Swap>;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* @description Retrieves the reserve information for a token.
|
|
133
|
+
* @param token - The address of the token.
|
|
134
|
+
* @returns {Promise<GetReserve>}
|
|
135
|
+
*/
|
|
136
|
+
getReserve(token: Address): Promise<GetReserve>;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* @description Retrieves a quote for swapping tokens.
|
|
140
|
+
* @param token - The address of the token.
|
|
141
|
+
* @param satoshisIn - The amount of satoshis to swap.
|
|
142
|
+
* @returns {Promise<GetQuote>}
|
|
143
|
+
*/
|
|
144
|
+
getQuote(token: Address, satoshisIn: bigint): Promise<GetQuote>;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* @description Sets a new quote for a token.
|
|
148
|
+
* @param token - The address of the token.
|
|
149
|
+
* @param p0 - The new quote parameter.
|
|
150
|
+
* @returns {Promise<SetQuote>}
|
|
151
|
+
*/
|
|
152
|
+
setQuote(token: Address, p0: bigint): Promise<SetQuote>;
|
|
153
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Address } from '@btc-vision/transaction';
|
|
2
|
-
import { CallResult } from '
|
|
3
|
-
import { IOP_NETContract } from '
|
|
2
|
+
import { CallResult } from '../../../../contracts/CallResult.js';
|
|
3
|
+
import { IOP_NETContract } from '../opnet/IOP_NETContract.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @description This is the interface that represent the MotoSwap Factory contract.
|
package/src/abi/shared/interfaces/{IMotoswapPoolContract.ts → motoswap/IMotoswapPoolContract.ts}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Address } from '@btc-vision/transaction';
|
|
2
|
-
import { CallResult } from '
|
|
3
|
-
import { IOP_20Contract } from '
|
|
2
|
+
import { CallResult } from '../../../../contracts/CallResult.js';
|
|
3
|
+
import { IOP_20Contract } from '../opnet/IOP_20Contract.js';
|
|
4
4
|
|
|
5
5
|
export type Reserves = {
|
|
6
6
|
readonly reserve0: bigint;
|
package/src/abi/shared/interfaces/{IMotoswapRouterContract.ts → motoswap/IMotoswapRouterContract.ts}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Address } from '@btc-vision/transaction';
|
|
2
|
-
import { CallResult } from '
|
|
3
|
-
import { IOP_NETContract } from '
|
|
2
|
+
import { CallResult } from '../../../../contracts/CallResult.js';
|
|
3
|
+
import { IOP_NETContract } from '../opnet/IOP_NETContract.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @description This interface represents the Motoswap router contract.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Address, AddressMap } from '@btc-vision/transaction';
|
|
2
|
-
import { CallResult } from '
|
|
2
|
+
import { CallResult } from '../../../../contracts/CallResult.js';
|
|
3
3
|
import { IOP_NETContract } from './IOP_NETContract.js';
|
|
4
4
|
|
|
5
5
|
export type Name = CallResult<{ name: string }>;
|
|
@@ -49,8 +49,7 @@ export type AirdropWithAmount = CallResult<{ success: boolean }>;
|
|
|
49
49
|
* address
|
|
50
50
|
* );
|
|
51
51
|
*
|
|
52
|
-
*
|
|
53
|
-
* console.log('Balance:', balanceExample.decoded);
|
|
52
|
+
* console.log('Balance:', balanceExample.properties.balance);
|
|
54
53
|
*/
|
|
55
54
|
export interface IOP_20Contract extends IOP_NETContract {
|
|
56
55
|
balanceOf(account: Address): Promise<BalanceOf>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Address } from '@btc-vision/transaction';
|
|
2
|
-
import { CallResult } from '
|
|
3
|
-
import { BaseContractProperties } from '
|
|
2
|
+
import { CallResult } from '../../../../contracts/CallResult.js';
|
|
3
|
+
import { BaseContractProperties } from '../../../interfaces/BaseContractProperties.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @description This interface represents the OP_NET base contract.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Address } from '@btc-vision/transaction';
|
|
2
|
-
import { CallResult } from '
|
|
3
|
-
import { IOP_20Contract } from '
|
|
4
|
-
import { IStackingContract } from '
|
|
2
|
+
import { CallResult } from '../../../../contracts/CallResult.js';
|
|
3
|
+
import { IOP_20Contract } from '../opnet/IOP_20Contract.js';
|
|
4
|
+
import { IStackingContract } from '../generic/IStackingContract.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* @description This interface represents the contract OP_20 and Stacking contract merged.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ABIDataTypes } from '@btc-vision/transaction';
|
|
2
|
-
import { BitcoinAbiTypes } from '
|
|
3
|
-
import { BitcoinInterfaceAbi } from '
|
|
2
|
+
import { BitcoinAbiTypes } from '../../../BitcoinAbiTypes.js';
|
|
3
|
+
import { BitcoinInterfaceAbi } from '../../../interfaces/BitcoinInterfaceAbi.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @category Events
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
import { ABIDataTypes } from '@btc-vision/transaction';
|
|
2
|
+
import { BitcoinAbiTypes } from '../../../BitcoinAbiTypes.js';
|
|
3
|
+
import { BitcoinInterfaceAbi } from '../../../interfaces/BitcoinInterfaceAbi.js';
|
|
4
|
+
import { OP_NET_ABI } from '../opnet/OP_NET_ABI.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @category Events
|
|
8
|
+
*/
|
|
9
|
+
export const EwmaEvents: BitcoinInterfaceAbi = [
|
|
10
|
+
{
|
|
11
|
+
name: 'LiquidityAdded',
|
|
12
|
+
values: [
|
|
13
|
+
{
|
|
14
|
+
name: 'totalLiquidity',
|
|
15
|
+
type: ABIDataTypes.UINT128,
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: 'receiver',
|
|
19
|
+
type: ABIDataTypes.STRING,
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
type: BitcoinAbiTypes.Event,
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: 'ReservationCreated',
|
|
26
|
+
values: [
|
|
27
|
+
{
|
|
28
|
+
name: 'reservationId',
|
|
29
|
+
type: ABIDataTypes.UINT256,
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: 'expectedAmountOut',
|
|
33
|
+
type: ABIDataTypes.UINT256,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: 'buyer',
|
|
37
|
+
type: ABIDataTypes.ADDRESS,
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
type: BitcoinAbiTypes.Event,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: 'LiquidityRemoved',
|
|
44
|
+
values: [
|
|
45
|
+
{
|
|
46
|
+
name: 'token',
|
|
47
|
+
type: ABIDataTypes.ADDRESS,
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: 'removedAmount',
|
|
51
|
+
type: ABIDataTypes.UINT128,
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: 'liquidityAmount',
|
|
55
|
+
type: ABIDataTypes.UINT256,
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
type: BitcoinAbiTypes.Event,
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: 'LiquidityRemovalBlocked',
|
|
62
|
+
values: [
|
|
63
|
+
{
|
|
64
|
+
name: 'tickId',
|
|
65
|
+
type: ABIDataTypes.UINT256,
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
type: BitcoinAbiTypes.Event,
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: 'SwapExecuted',
|
|
72
|
+
values: [
|
|
73
|
+
{
|
|
74
|
+
name: 'buyer',
|
|
75
|
+
type: ABIDataTypes.ADDRESS,
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: 'amountIn',
|
|
79
|
+
type: ABIDataTypes.UINT256,
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: 'amountOut',
|
|
83
|
+
type: ABIDataTypes.UINT256,
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
type: BitcoinAbiTypes.Event,
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: 'TickUpdated',
|
|
90
|
+
values: [
|
|
91
|
+
{
|
|
92
|
+
name: 'liquidityAmount',
|
|
93
|
+
type: ABIDataTypes.UINT256,
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: 'acquiredAmount',
|
|
97
|
+
type: ABIDataTypes.UINT256,
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
type: BitcoinAbiTypes.Event,
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: 'LiquidityReserved',
|
|
104
|
+
values: [
|
|
105
|
+
{
|
|
106
|
+
name: 'amount',
|
|
107
|
+
type: ABIDataTypes.UINT256,
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
name: 'index',
|
|
111
|
+
type: ABIDataTypes.UINT64,
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
type: BitcoinAbiTypes.Event,
|
|
115
|
+
},
|
|
116
|
+
];
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* @category ABI
|
|
120
|
+
*/
|
|
121
|
+
export const EwmaAbi: BitcoinInterfaceAbi = [
|
|
122
|
+
{
|
|
123
|
+
name: 'reserve',
|
|
124
|
+
inputs: [
|
|
125
|
+
{
|
|
126
|
+
name: 'token',
|
|
127
|
+
type: ABIDataTypes.ADDRESS,
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
name: 'maximumAmountIn',
|
|
131
|
+
type: ABIDataTypes.UINT256,
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
name: 'minimumAmountOut',
|
|
135
|
+
type: ABIDataTypes.UINT256,
|
|
136
|
+
},
|
|
137
|
+
],
|
|
138
|
+
outputs: [
|
|
139
|
+
{
|
|
140
|
+
name: 'reserved',
|
|
141
|
+
type: ABIDataTypes.UINT256,
|
|
142
|
+
},
|
|
143
|
+
],
|
|
144
|
+
type: BitcoinAbiTypes.Function,
|
|
145
|
+
},
|
|
146
|
+
|
|
147
|
+
{
|
|
148
|
+
name: 'addLiquidity',
|
|
149
|
+
inputs: [
|
|
150
|
+
{
|
|
151
|
+
name: 'token',
|
|
152
|
+
type: ABIDataTypes.ADDRESS,
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
name: 'receiver',
|
|
156
|
+
type: ABIDataTypes.STRING,
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
name: 'amountIn',
|
|
160
|
+
type: ABIDataTypes.UINT128,
|
|
161
|
+
},
|
|
162
|
+
],
|
|
163
|
+
outputs: [
|
|
164
|
+
{
|
|
165
|
+
name: 'ok',
|
|
166
|
+
type: ABIDataTypes.BOOL,
|
|
167
|
+
},
|
|
168
|
+
],
|
|
169
|
+
type: BitcoinAbiTypes.Function,
|
|
170
|
+
},
|
|
171
|
+
|
|
172
|
+
{
|
|
173
|
+
name: 'removeLiquidity',
|
|
174
|
+
inputs: [
|
|
175
|
+
{
|
|
176
|
+
name: 'token',
|
|
177
|
+
type: ABIDataTypes.ADDRESS,
|
|
178
|
+
},
|
|
179
|
+
],
|
|
180
|
+
outputs: [
|
|
181
|
+
{
|
|
182
|
+
name: 'totalTokensReturned',
|
|
183
|
+
type: ABIDataTypes.UINT128,
|
|
184
|
+
},
|
|
185
|
+
],
|
|
186
|
+
type: BitcoinAbiTypes.Function,
|
|
187
|
+
},
|
|
188
|
+
|
|
189
|
+
{
|
|
190
|
+
name: 'swap',
|
|
191
|
+
inputs: [
|
|
192
|
+
{
|
|
193
|
+
name: 'token',
|
|
194
|
+
type: ABIDataTypes.ADDRESS,
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
name: 'reservationId',
|
|
198
|
+
type: ABIDataTypes.UINT256,
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
name: 'isSimulation',
|
|
202
|
+
type: ABIDataTypes.BOOL,
|
|
203
|
+
},
|
|
204
|
+
],
|
|
205
|
+
outputs: [
|
|
206
|
+
{
|
|
207
|
+
name: 'ok',
|
|
208
|
+
type: ABIDataTypes.BOOL,
|
|
209
|
+
},
|
|
210
|
+
],
|
|
211
|
+
type: BitcoinAbiTypes.Function,
|
|
212
|
+
},
|
|
213
|
+
|
|
214
|
+
{
|
|
215
|
+
name: 'getReserve',
|
|
216
|
+
inputs: [
|
|
217
|
+
{
|
|
218
|
+
name: 'token',
|
|
219
|
+
type: ABIDataTypes.ADDRESS,
|
|
220
|
+
},
|
|
221
|
+
],
|
|
222
|
+
outputs: [
|
|
223
|
+
{
|
|
224
|
+
name: 'liquidity',
|
|
225
|
+
type: ABIDataTypes.UINT256,
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
name: 'reservedLiquidity',
|
|
229
|
+
type: ABIDataTypes.UINT256,
|
|
230
|
+
},
|
|
231
|
+
],
|
|
232
|
+
type: BitcoinAbiTypes.Function,
|
|
233
|
+
},
|
|
234
|
+
|
|
235
|
+
{
|
|
236
|
+
name: 'getQuote',
|
|
237
|
+
inputs: [
|
|
238
|
+
{
|
|
239
|
+
name: 'token',
|
|
240
|
+
type: ABIDataTypes.ADDRESS,
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
name: 'satoshisIn',
|
|
244
|
+
type: ABIDataTypes.UINT256,
|
|
245
|
+
},
|
|
246
|
+
],
|
|
247
|
+
outputs: [
|
|
248
|
+
{
|
|
249
|
+
name: 'tokensOut',
|
|
250
|
+
type: ABIDataTypes.UINT256,
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
name: 'requiredSatoshis',
|
|
254
|
+
type: ABIDataTypes.UINT256,
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
name: 'currentPrice',
|
|
258
|
+
type: ABIDataTypes.UINT256,
|
|
259
|
+
},
|
|
260
|
+
],
|
|
261
|
+
type: BitcoinAbiTypes.Function,
|
|
262
|
+
},
|
|
263
|
+
|
|
264
|
+
{
|
|
265
|
+
name: 'setQuote',
|
|
266
|
+
inputs: [
|
|
267
|
+
{
|
|
268
|
+
name: 'token',
|
|
269
|
+
type: ABIDataTypes.ADDRESS,
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
name: 'p0',
|
|
273
|
+
type: ABIDataTypes.UINT256,
|
|
274
|
+
},
|
|
275
|
+
],
|
|
276
|
+
outputs: [
|
|
277
|
+
{
|
|
278
|
+
name: 'ok',
|
|
279
|
+
type: ABIDataTypes.BOOL,
|
|
280
|
+
},
|
|
281
|
+
],
|
|
282
|
+
type: BitcoinAbiTypes.Function,
|
|
283
|
+
},
|
|
284
|
+
|
|
285
|
+
...EwmaEvents,
|
|
286
|
+
|
|
287
|
+
// OP_NET
|
|
288
|
+
...OP_NET_ABI,
|
|
289
|
+
];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ABIDataTypes } from '@btc-vision/transaction';
|
|
2
|
-
import { BitcoinAbiTypes } from '
|
|
3
|
-
import { BitcoinInterfaceAbi } from '
|
|
4
|
-
import { OP_NET_ABI } from '
|
|
2
|
+
import { BitcoinAbiTypes } from '../../../BitcoinAbiTypes.js';
|
|
3
|
+
import { BitcoinInterfaceAbi } from '../../../interfaces/BitcoinInterfaceAbi.js';
|
|
4
|
+
import { OP_NET_ABI } from '../opnet/OP_NET_ABI.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* @category Events
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ABIDataTypes } from '@btc-vision/transaction';
|
|
2
|
-
import { BitcoinAbiTypes } from '
|
|
3
|
-
import { BitcoinInterfaceAbi } from '
|
|
4
|
-
import { OP_20_ABI } from '
|
|
2
|
+
import { BitcoinAbiTypes } from '../../../BitcoinAbiTypes.js';
|
|
3
|
+
import { BitcoinInterfaceAbi } from '../../../interfaces/BitcoinInterfaceAbi.js';
|
|
4
|
+
import { OP_20_ABI } from '../opnet/OP_20_ABI.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* @category Events
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ABIDataTypes } from '@btc-vision/transaction';
|
|
2
|
-
import { BitcoinAbiTypes } from '
|
|
3
|
-
import { BitcoinInterfaceAbi } from '
|
|
2
|
+
import { BitcoinAbiTypes } from '../../../BitcoinAbiTypes.js';
|
|
3
|
+
import { BitcoinInterfaceAbi } from '../../../interfaces/BitcoinInterfaceAbi.js';
|
|
4
|
+
import { OP20Events } from '../opnet/OP_20_ABI.js';
|
|
5
|
+
import { OP_NET_ABI } from '../opnet/OP_NET_ABI.js';
|
|
4
6
|
import { MotoSwapFactoryEvents } from './MOTOSWAP_FACTORY_ABI.js';
|
|
5
7
|
import { MotoSwapPoolEvents } from './MOTOSWAP_POOL_ABI.js';
|
|
6
|
-
import { OP20Events } from './OP_20_ABI.js';
|
|
7
|
-
import { OP_NET_ABI } from './OP_NET_ABI.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @category ABI
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ABIDataTypes } from '@btc-vision/transaction';
|
|
2
|
-
import { BitcoinAbiTypes } from '
|
|
3
|
-
import { BitcoinInterfaceAbi } from '
|
|
2
|
+
import { BitcoinAbiTypes } from '../../../BitcoinAbiTypes.js';
|
|
3
|
+
import { BitcoinInterfaceAbi } from '../../../interfaces/BitcoinInterfaceAbi.js';
|
|
4
4
|
import { OP_NET_ABI } from './OP_NET_ABI.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ABIDataTypes } from '@btc-vision/transaction';
|
|
2
|
-
import { BitcoinAbiTypes } from '
|
|
3
|
-
import { BitcoinInterfaceAbi } from '
|
|
2
|
+
import { BitcoinAbiTypes } from '../../../BitcoinAbiTypes.js';
|
|
3
|
+
import { BitcoinInterfaceAbi } from '../../../interfaces/BitcoinInterfaceAbi.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @category ABI
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ABIDataTypes } from '@btc-vision/transaction';
|
|
2
|
-
import { BitcoinAbiTypes } from '
|
|
3
|
-
import { BitcoinInterfaceAbi } from '
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { BitcoinAbiTypes } from '../../../BitcoinAbiTypes.js';
|
|
3
|
+
import { BitcoinInterfaceAbi } from '../../../interfaces/BitcoinInterfaceAbi.js';
|
|
4
|
+
import { STAKING_ABI } from '../generic/STAKING_ABI.js';
|
|
5
|
+
import { OP_20_ABI } from '../opnet/OP_20_ABI.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @category Events
|