opnet 1.2.2 → 1.2.4
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/INativeSwapContract.d.ts +71 -0
- package/browser/abi/shared/json/motoswap/NATIVE_SWAP_ABI.d.ts +3 -0
- package/browser/bitcoin/UTXOs.d.ts +1 -1
- package/browser/bitcoin/interfaces/IUTXO.d.ts +1 -1
- package/browser/block/Block.d.ts +2 -1
- package/browser/contracts/CallResult.d.ts +1 -0
- package/browser/index.js +1 -1
- package/browser/opnet.d.ts +3 -2
- package/browser/providers/AbstractRpcProvider.d.ts +1 -1
- package/browser/transactions/Transaction.d.ts +5 -1
- package/browser/transactions/TransactionParser.d.ts +3 -2
- package/browser/transactions/decoders/DeploymentTransaction.d.ts +2 -1
- package/browser/transactions/decoders/GenericTransaction.d.ts +2 -1
- package/browser/transactions/decoders/InteractionTransaction.d.ts +2 -1
- package/browser/transactions/interfaces/ITransaction.d.ts +2 -0
- package/browser/transactions/interfaces/ProofOfWorkChallenge.d.ts +12 -0
- package/browser/transactions/interfaces/transactions/ICommonTransaction.d.ts +2 -0
- package/browser/transactions/metadata/TransactionInput.d.ts +1 -1
- package/browser/transactions/metadata/TransactionOutput.d.ts +1 -1
- package/browser/transactions/metadata/TransactionReceipt.d.ts +2 -1
- package/build/_version.d.ts +1 -1
- package/build/_version.js +1 -1
- package/build/abi/shared/interfaces/motoswap/INativeSwapContract.d.ts +71 -0
- package/build/abi/shared/json/motoswap/NATIVE_SWAP_ABI.d.ts +3 -0
- package/build/abi/shared/json/motoswap/{EWMA_ABI.js → NATIVE_SWAP_ABI.js} +208 -37
- package/build/bitcoin/UTXOs.d.ts +1 -1
- package/build/bitcoin/interfaces/IUTXO.d.ts +1 -1
- package/build/block/Block.d.ts +2 -1
- package/build/block/Block.js +2 -2
- package/build/contracts/CallResult.d.ts +1 -0
- package/build/contracts/CallResult.js +7 -3
- package/build/opnet.d.ts +3 -2
- package/build/opnet.js +3 -2
- package/build/providers/AbstractRpcProvider.d.ts +1 -1
- package/build/providers/AbstractRpcProvider.js +4 -4
- package/build/transactions/Transaction.d.ts +5 -1
- package/build/transactions/Transaction.js +14 -2
- package/build/transactions/TransactionParser.d.ts +3 -2
- package/build/transactions/TransactionParser.js +6 -6
- package/build/transactions/decoders/DeploymentTransaction.d.ts +2 -1
- package/build/transactions/decoders/DeploymentTransaction.js +2 -2
- package/build/transactions/decoders/GenericTransaction.d.ts +2 -1
- package/build/transactions/decoders/GenericTransaction.js +2 -2
- package/build/transactions/decoders/InteractionTransaction.d.ts +2 -1
- package/build/transactions/decoders/InteractionTransaction.js +2 -2
- package/build/transactions/interfaces/ITransaction.d.ts +2 -0
- package/build/transactions/interfaces/ProofOfWorkChallenge.d.ts +12 -0
- package/build/transactions/interfaces/ProofOfWorkChallenge.js +1 -0
- package/build/transactions/interfaces/transactions/ICommonTransaction.d.ts +2 -0
- package/build/transactions/metadata/TransactionInput.d.ts +1 -1
- package/build/transactions/metadata/TransactionOutput.d.ts +1 -1
- package/build/transactions/metadata/TransactionReceipt.d.ts +2 -1
- package/build/transactions/metadata/TransactionReceipt.js +12 -8
- package/package.json +14 -14
- package/src/_version.ts +1 -1
- package/src/abi/shared/interfaces/motoswap/INativeSwapContract.ts +267 -0
- package/src/abi/shared/json/motoswap/{EWMA_ABI.ts → NATIVE_SWAP_ABI.ts} +252 -37
- package/src/bitcoin/UTXOs.ts +2 -2
- package/src/bitcoin/interfaces/IUTXO.ts +1 -1
- package/src/block/Block.ts +3 -1
- package/src/contracts/CallResult.ts +9 -6
- package/src/opnet.ts +3 -2
- package/src/providers/AbstractRpcProvider.ts +5 -5
- package/src/providers/JSONRpcProvider.ts +1 -1
- package/src/transactions/Transaction.ts +30 -8
- package/src/transactions/TransactionParser.ts +7 -8
- package/src/transactions/decoders/DeploymentTransaction.ts +3 -2
- package/src/transactions/decoders/GenericTransaction.ts +3 -2
- package/src/transactions/decoders/InteractionTransaction.ts +3 -2
- package/src/transactions/interfaces/ITransaction.ts +6 -0
- package/src/transactions/interfaces/ProofOfWorkChallenge.ts +13 -0
- package/src/transactions/interfaces/transactions/ICommonTransaction.ts +6 -0
- package/src/transactions/metadata/TransactionInput.ts +1 -1
- package/src/transactions/metadata/TransactionOutput.ts +1 -1
- package/src/transactions/metadata/TransactionReceipt.ts +23 -11
- package/browser/abi/shared/interfaces/motoswap/IEwmaContract.d.ts +0 -46
- package/browser/abi/shared/json/motoswap/EWMA_ABI.d.ts +0 -3
- package/build/abi/shared/interfaces/motoswap/IEwmaContract.d.ts +0 -46
- package/build/abi/shared/json/motoswap/EWMA_ABI.d.ts +0 -3
- package/src/abi/shared/interfaces/motoswap/IEwmaContract.ts +0 -188
- /package/build/abi/shared/interfaces/motoswap/{IEwmaContract.js → INativeSwapContract.js} +0 -0
|
@@ -1,188 +0,0 @@
|
|
|
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 Represents the result of the priorityQueueCost function call.
|
|
59
|
-
*/
|
|
60
|
-
export type PriorityQueueCost = CallResult<{
|
|
61
|
-
cost: bigint;
|
|
62
|
-
}>;
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* @description Represents the result of the getProviderDetails function call.
|
|
66
|
-
*/
|
|
67
|
-
export type GetProviderDetails = CallResult<{
|
|
68
|
-
liquidity: bigint;
|
|
69
|
-
reserved: bigint;
|
|
70
|
-
btcReceiver: string;
|
|
71
|
-
}>;
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* @description This interface represents the OP_NET contract.
|
|
75
|
-
* @interface IOP_NETContract
|
|
76
|
-
* @extends {IOP_NETContract}
|
|
77
|
-
* @category Contracts
|
|
78
|
-
*
|
|
79
|
-
* @example
|
|
80
|
-
* import { Address } from '@btc-vision/transaction';
|
|
81
|
-
* import { IOP_NETContract } from '../abi/shared/interfaces/IOP_NETContract.js';
|
|
82
|
-
* import { OP_NET_ABI } from '../abi/shared/json/OP_NET_ABI.js';
|
|
83
|
-
* import { CallResult } from '../contracts/CallResult.js';
|
|
84
|
-
* import { getContract } from '../contracts/Contract.js';
|
|
85
|
-
* import { JSONRpcProvider } from '../providers/JSONRpcProvider.js';
|
|
86
|
-
*
|
|
87
|
-
* const provider: JSONRpcProvider = new JSONRpcProvider('https://regtest.opnet.org');
|
|
88
|
-
* const contract: IOP_NETContract = getContract<IOP_NETContract>(
|
|
89
|
-
* 'bcrt1pyrs3eqwnrmd4ql3nwvx66yzp0wc24xd2t9pf8699ln340pjs7f3sar3tum',
|
|
90
|
-
* OP_NET_ABI,
|
|
91
|
-
* provider,
|
|
92
|
-
* networks.regtest,
|
|
93
|
-
* );
|
|
94
|
-
*
|
|
95
|
-
* const tokenAddress: Address = new Address([
|
|
96
|
-
* 40, 11, 228, 172, 219, 50, 169, 155, 163, 235, 250, 102, 169, 29, 219, 65, 167, 183, 161, 210,
|
|
97
|
-
* 254, 244, 21, 57, 153, 34, 205, 138, 4, 72, 92, 2,
|
|
98
|
-
* ]);
|
|
99
|
-
*
|
|
100
|
-
* const reserveExample = await contract.reserve(
|
|
101
|
-
* tokenAddress,
|
|
102
|
-
* BigInt("1000000000000000000"), // maximumAmountIn
|
|
103
|
-
* BigInt("500000000000000000") // minimumAmountOut
|
|
104
|
-
* );
|
|
105
|
-
*
|
|
106
|
-
* console.log('Reserved:', reserveExample.properties.reserved);
|
|
107
|
-
*/
|
|
108
|
-
export interface IEwmaContract extends IOP_NETContract {
|
|
109
|
-
/**
|
|
110
|
-
* @description Reserves a certain amount of tokens.
|
|
111
|
-
* @param token - The address of the token to reserve.
|
|
112
|
-
* @param maximumAmountIn - The maximum amount of tokens to reserve.
|
|
113
|
-
* @param minimumAmountOut - The minimum amount of tokens expected out.
|
|
114
|
-
* @returns {Promise<ReserveEWMA>}
|
|
115
|
-
*/
|
|
116
|
-
reserve(
|
|
117
|
-
token: Address,
|
|
118
|
-
maximumAmountIn: bigint,
|
|
119
|
-
minimumAmountOut: bigint,
|
|
120
|
-
): Promise<ReserveEWMA>;
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* @description Adds liquidity to the contract.
|
|
124
|
-
* @param token - The address of the token to add liquidity for.
|
|
125
|
-
* @param receiver - The receiver of the liquidity.
|
|
126
|
-
* @param amountIn - The amount of tokens to add.
|
|
127
|
-
* @param priority - Whether to prioritize the liquidity addition.
|
|
128
|
-
* @returns {Promise<AddLiquidity>}
|
|
129
|
-
*/
|
|
130
|
-
addLiquidity(
|
|
131
|
-
token: Address,
|
|
132
|
-
receiver: string,
|
|
133
|
-
amountIn: bigint,
|
|
134
|
-
priority: boolean,
|
|
135
|
-
): Promise<AddLiquidity>;
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* @description Removes liquidity from the contract.
|
|
139
|
-
* @param token - The address of the token to remove liquidity for.
|
|
140
|
-
* @returns {Promise<RemoveLiquidity>}
|
|
141
|
-
*/
|
|
142
|
-
removeLiquidity(token: Address): Promise<RemoveLiquidity>;
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* @description Executes a swap operation.
|
|
146
|
-
* @param token - The address of the token to swap.
|
|
147
|
-
* @param isSimulation - Whether the swap is a simulation.
|
|
148
|
-
* @returns {Promise<Swap>}
|
|
149
|
-
*/
|
|
150
|
-
swap(token: Address, isSimulation: boolean): Promise<Swap>;
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* @description Retrieves the reserve information for a token.
|
|
154
|
-
* @param token - The address of the token.
|
|
155
|
-
* @returns {Promise<GetReserve>}
|
|
156
|
-
*/
|
|
157
|
-
getReserve(token: Address): Promise<GetReserve>;
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* @description Retrieves a quote for swapping tokens.
|
|
161
|
-
* @param token - The address of the token.
|
|
162
|
-
* @param satoshisIn - The amount of satoshis to swap.
|
|
163
|
-
* @returns {Promise<GetQuote>}
|
|
164
|
-
*/
|
|
165
|
-
getQuote(token: Address, satoshisIn: bigint): Promise<GetQuote>;
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* @description Sets a new quote for a token.
|
|
169
|
-
* @param token - The address of the token.
|
|
170
|
-
* @param p0 - The new quote parameter.
|
|
171
|
-
* @returns {Promise<SetQuote>}
|
|
172
|
-
*/
|
|
173
|
-
setQuote(token: Address, p0: bigint): Promise<SetQuote>;
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* @description Retrieves the cost of the priority queue for a token.
|
|
177
|
-
* @param token - The address of the token.
|
|
178
|
-
* @returns {Promise<PriorityQueueCost>}
|
|
179
|
-
*/
|
|
180
|
-
priorityQueueCost(token: Address): Promise<PriorityQueueCost>;
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* @description Retrieves the provider details for a token.
|
|
184
|
-
* @param token - The address of the token.
|
|
185
|
-
* @returns {Promise<GetProviderDetails>}
|
|
186
|
-
*/
|
|
187
|
-
getProviderDetails(token: Address): Promise<GetProviderDetails>;
|
|
188
|
-
}
|
|
File without changes
|