opnet 1.2.13 → 1.2.15
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/IMotoChefContract.d.ts +42 -1
- package/browser/abi/shared/interfaces/motoswap/IMotoswapFactoryContract.d.ts +7 -1
- package/browser/abi/shared/interfaces/motoswap/IMotoswapPoolContract.d.ts +26 -1
- package/browser/abi/shared/interfaces/motoswap/INativeSwapContract.d.ts +54 -14
- package/browser/abi/shared/interfaces/opnet/IOP_20Contract.d.ts +34 -14
- package/browser/contracts/CallResult.d.ts +3 -2
- package/browser/contracts/Contract.d.ts +1 -1
- package/browser/index.js +1 -1
- package/build/_version.d.ts +1 -1
- package/build/_version.js +1 -1
- package/build/abi/shared/interfaces/motoswap/IMotoChefContract.d.ts +42 -1
- package/build/abi/shared/interfaces/motoswap/IMotoswapFactoryContract.d.ts +7 -1
- package/build/abi/shared/interfaces/motoswap/IMotoswapPoolContract.d.ts +26 -1
- package/build/abi/shared/interfaces/motoswap/INativeSwapContract.d.ts +54 -14
- package/build/abi/shared/interfaces/opnet/IOP_20Contract.d.ts +34 -14
- package/build/abi/shared/json/motoswap/NATIVE_SWAP_ABI.js +0 -8
- package/build/contracts/CallResult.d.ts +3 -2
- package/build/contracts/CallResult.js +3 -0
- package/build/contracts/Contract.d.ts +1 -1
- package/build/contracts/Contract.js +1 -1
- package/package.json +1 -1
- package/src/_version.ts +1 -1
- package/src/abi/shared/interfaces/motoswap/IMotoChefContract.ts +52 -1
- package/src/abi/shared/interfaces/motoswap/IMotoswapFactoryContract.ts +8 -1
- package/src/abi/shared/interfaces/motoswap/IMotoswapPoolContract.ts +34 -3
- package/src/abi/shared/interfaces/motoswap/INativeSwapContract.ts +129 -56
- package/src/abi/shared/interfaces/opnet/IOP_20Contract.ts +43 -15
- package/src/abi/shared/json/motoswap/NATIVE_SWAP_ABI.ts +0 -8
- package/src/contracts/CallResult.ts +9 -3
- package/src/contracts/Contract.ts +5 -3
package/browser/_version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "1.2.
|
|
1
|
+
export declare const version = "1.2.15";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Address } from '@btc-vision/transaction';
|
|
2
|
-
import { IOwnableReentrancyGuardContract } from './IOwnableReentrancyGuardContract';
|
|
3
2
|
import { CallResult } from '../../../../opnet';
|
|
3
|
+
import { IOwnableReentrancyGuardContract } from './IOwnableReentrancyGuardContract';
|
|
4
4
|
export type PoolInfo = {
|
|
5
5
|
allocPoint: number;
|
|
6
6
|
lastRewardBlock: number;
|
|
@@ -89,6 +89,47 @@ export type SetBonusMultiplier = CallResult<{
|
|
|
89
89
|
export type EmergencyWithdraw = CallResult<{
|
|
90
90
|
success: boolean;
|
|
91
91
|
}>;
|
|
92
|
+
export type LogPoolAdditionEvent = {
|
|
93
|
+
readonly pid: number;
|
|
94
|
+
readonly allocPoint: bigint;
|
|
95
|
+
readonly lpToken: Address;
|
|
96
|
+
readonly rewarder: Address;
|
|
97
|
+
};
|
|
98
|
+
export type LogSetPoolEvent = {
|
|
99
|
+
readonly pid: number;
|
|
100
|
+
readonly allocPoint: bigint;
|
|
101
|
+
readonly rewarder: Address;
|
|
102
|
+
readonly overwrite: boolean;
|
|
103
|
+
};
|
|
104
|
+
export type LogUpdatePoolEvent = {
|
|
105
|
+
readonly pid: number;
|
|
106
|
+
readonly lastRewardBlock: bigint;
|
|
107
|
+
readonly lpSupply: bigint;
|
|
108
|
+
readonly accMotoPerShare: bigint;
|
|
109
|
+
};
|
|
110
|
+
export type DepositEvent = {
|
|
111
|
+
readonly user: Address;
|
|
112
|
+
readonly pid: number;
|
|
113
|
+
readonly amount: bigint;
|
|
114
|
+
readonly to: Address;
|
|
115
|
+
};
|
|
116
|
+
export type WithdrawEvent = {
|
|
117
|
+
readonly user: Address;
|
|
118
|
+
readonly pid: number;
|
|
119
|
+
readonly amount: bigint;
|
|
120
|
+
readonly to: Address;
|
|
121
|
+
};
|
|
122
|
+
export type HarvestEvent = {
|
|
123
|
+
readonly user: Address;
|
|
124
|
+
readonly pid: number;
|
|
125
|
+
readonly amount: bigint;
|
|
126
|
+
};
|
|
127
|
+
export type EmergencyWithdrawEvent = {
|
|
128
|
+
readonly user: Address;
|
|
129
|
+
readonly pid: number;
|
|
130
|
+
readonly amount: bigint;
|
|
131
|
+
readonly to: Address;
|
|
132
|
+
};
|
|
92
133
|
export interface IMotoChefContract extends IOwnableReentrancyGuardContract {
|
|
93
134
|
initialize(MOTO: Address, premineAmount: bigint, devaddr: Address, motoPerBlock: bigint, bonusEndBlock: bigint, bonusMultiplier: bigint): Promise<Initialize>;
|
|
94
135
|
getLpToken(pid: number): Promise<GetLpToken>;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { Address } from '@btc-vision/transaction';
|
|
2
2
|
import { CallResult } from '../../../../contracts/CallResult.js';
|
|
3
|
+
import { OPNetEvent } from '../../../../contracts/OPNetEvent.js';
|
|
3
4
|
import { IOP_NETContract } from '../opnet/IOP_NETContract.js';
|
|
5
|
+
export type PoolCreatedEvent = {
|
|
6
|
+
readonly token0: Address;
|
|
7
|
+
readonly token1: Address;
|
|
8
|
+
readonly pool: bigint;
|
|
9
|
+
};
|
|
4
10
|
export interface IMotoswapFactoryContract extends IOP_NETContract {
|
|
5
11
|
getPool(token0: Address, token1: Address): Promise<CallResult<{
|
|
6
12
|
pool: bigint;
|
|
@@ -8,5 +14,5 @@ export interface IMotoswapFactoryContract extends IOP_NETContract {
|
|
|
8
14
|
createPool(token0: Address, token1: Address): Promise<CallResult<{
|
|
9
15
|
pool: bigint;
|
|
10
16
|
address: Address;
|
|
11
|
-
}>>;
|
|
17
|
+
}, [OPNetEvent<PoolCreatedEvent>]>>;
|
|
12
18
|
}
|
|
@@ -1,11 +1,34 @@
|
|
|
1
1
|
import { Address } from '@btc-vision/transaction';
|
|
2
2
|
import { CallResult } from '../../../../contracts/CallResult.js';
|
|
3
|
+
import { OPNetEvent } from '../../../../contracts/OPNetEvent.js';
|
|
3
4
|
import { IOP_20Contract } from '../opnet/IOP_20Contract.js';
|
|
4
5
|
export type Reserves = {
|
|
5
6
|
readonly reserve0: bigint;
|
|
6
7
|
readonly reserve1: bigint;
|
|
7
8
|
readonly blockTimestampLast: bigint;
|
|
8
9
|
};
|
|
10
|
+
export type PoolBurnEvent = {
|
|
11
|
+
readonly sender: Address;
|
|
12
|
+
readonly amount0: bigint;
|
|
13
|
+
readonly amount1: bigint;
|
|
14
|
+
};
|
|
15
|
+
export type PoolMintEvent = {
|
|
16
|
+
readonly sender: Address;
|
|
17
|
+
readonly amount0: bigint;
|
|
18
|
+
readonly amount1: bigint;
|
|
19
|
+
};
|
|
20
|
+
export type SwapEvent = {
|
|
21
|
+
readonly sender: Address;
|
|
22
|
+
readonly amount0In: bigint;
|
|
23
|
+
readonly amount1In: bigint;
|
|
24
|
+
readonly amount0Out: bigint;
|
|
25
|
+
readonly amount1Out: bigint;
|
|
26
|
+
readonly to: Address;
|
|
27
|
+
};
|
|
28
|
+
export type SyncEvent = {
|
|
29
|
+
readonly reserve0: bigint;
|
|
30
|
+
readonly reserve1: bigint;
|
|
31
|
+
};
|
|
9
32
|
export interface IMotoswapPoolContract extends Omit<IOP_20Contract, 'burn' | 'mint'> {
|
|
10
33
|
token0(): Promise<CallResult<{
|
|
11
34
|
token0: Address;
|
|
@@ -16,7 +39,9 @@ export interface IMotoswapPoolContract extends Omit<IOP_20Contract, 'burn' | 'mi
|
|
|
16
39
|
getReserves(): Promise<CallResult<Reserves>>;
|
|
17
40
|
swap(amount0Out: bigint, amount1Out: bigint, to: string, data: Uint8Array): Promise<CallResult<{
|
|
18
41
|
success: boolean;
|
|
19
|
-
}
|
|
42
|
+
}, [
|
|
43
|
+
OPNetEvent<SwapEvent>
|
|
44
|
+
]>>;
|
|
20
45
|
skim(): Promise<CallResult<{
|
|
21
46
|
success: boolean;
|
|
22
47
|
}>>;
|
|
@@ -1,54 +1,94 @@
|
|
|
1
1
|
import { Address } from '@btc-vision/transaction';
|
|
2
2
|
import { CallResult } from '../../../../contracts/CallResult.js';
|
|
3
|
+
import { OPNetEvent } from '../../../../contracts/OPNetEvent.js';
|
|
4
|
+
import { TransferEvent } from '../opnet/IOP_20Contract.js';
|
|
3
5
|
import { IOP_NETContract } from '../opnet/IOP_NETContract.js';
|
|
6
|
+
export type LiquidityAddedEvent = {
|
|
7
|
+
readonly totalTokensContributed: bigint;
|
|
8
|
+
readonly virtualTokenExchanged: bigint;
|
|
9
|
+
readonly totalSatoshisSpent: bigint;
|
|
10
|
+
};
|
|
11
|
+
export type LiquidityListedEvent = {
|
|
12
|
+
readonly totalLiquidity: bigint;
|
|
13
|
+
readonly provider: string;
|
|
14
|
+
};
|
|
15
|
+
export type LiquidityRemovedEvent = {
|
|
16
|
+
readonly providerId: bigint;
|
|
17
|
+
readonly btcOwed: bigint;
|
|
18
|
+
readonly tokenAmount: bigint;
|
|
19
|
+
};
|
|
20
|
+
export type ReservationCreatedEvent = {
|
|
21
|
+
readonly expectedAmountOut: bigint;
|
|
22
|
+
readonly totalSatoshis: bigint;
|
|
23
|
+
};
|
|
24
|
+
export type SwapExecutedEvent = {
|
|
25
|
+
readonly buyer: Address;
|
|
26
|
+
readonly amountIn: bigint;
|
|
27
|
+
readonly amountOut: bigint;
|
|
28
|
+
};
|
|
29
|
+
export type UnlistEvent = {
|
|
30
|
+
readonly token: Address;
|
|
31
|
+
readonly amount: bigint;
|
|
32
|
+
readonly remainingLiquidity: bigint;
|
|
33
|
+
};
|
|
34
|
+
export type LiquidityReservedEvent = {
|
|
35
|
+
readonly depositAddress: string;
|
|
36
|
+
readonly amount: bigint;
|
|
37
|
+
};
|
|
4
38
|
export type ReserveNativeSwap = CallResult<{
|
|
5
39
|
ok: boolean;
|
|
6
|
-
}>;
|
|
40
|
+
}, OPNetEvent<LiquidityReservedEvent | ReservationCreatedEvent | TransferEvent>[]>;
|
|
7
41
|
export type AddLiquidity = CallResult<{
|
|
8
42
|
ok: boolean;
|
|
9
|
-
}>;
|
|
43
|
+
}, OPNetEvent<LiquidityAddedEvent | TransferEvent>[]>;
|
|
10
44
|
export type RemoveLiquidity = CallResult<{
|
|
11
45
|
ok: boolean;
|
|
12
|
-
}>;
|
|
46
|
+
}, OPNetEvent<LiquidityRemovedEvent | TransferEvent>[]>;
|
|
13
47
|
export type ListLiquidity = CallResult<{
|
|
14
48
|
ok: boolean;
|
|
15
|
-
}>;
|
|
49
|
+
}, OPNetEvent<LiquidityListedEvent>[]>;
|
|
16
50
|
export type CancelListing = CallResult<{
|
|
17
51
|
ok: boolean;
|
|
18
|
-
}>;
|
|
52
|
+
}, OPNetEvent<UnlistEvent | TransferEvent>[]>;
|
|
19
53
|
export type CreatePool = CallResult<{
|
|
20
54
|
ok: boolean;
|
|
21
|
-
}>;
|
|
55
|
+
}, OPNetEvent<TransferEvent | LiquidityAddedEvent>[]>;
|
|
22
56
|
export type SetFees = CallResult<{
|
|
23
57
|
ok: boolean;
|
|
24
|
-
}
|
|
58
|
+
}, [
|
|
59
|
+
]>;
|
|
25
60
|
export type GetFees = CallResult<{
|
|
26
61
|
reservationBaseFee: bigint;
|
|
27
62
|
priorityQueueBaseFee: bigint;
|
|
28
63
|
pricePerUserInPriorityQueueBTC: bigint;
|
|
29
|
-
}
|
|
64
|
+
}, [
|
|
65
|
+
]>;
|
|
30
66
|
export type Swap = CallResult<{
|
|
31
67
|
ok: boolean;
|
|
32
|
-
}>;
|
|
68
|
+
}, OPNetEvent<SwapExecutedEvent | TransferEvent>[]>;
|
|
33
69
|
export type GetReserve = CallResult<{
|
|
34
70
|
liquidity: bigint;
|
|
35
71
|
reservedLiquidity: bigint;
|
|
36
72
|
virtualBTCReserve: bigint;
|
|
37
73
|
virtualTokenReserve: bigint;
|
|
38
|
-
}
|
|
74
|
+
}, [
|
|
75
|
+
]>;
|
|
39
76
|
export type GetQuote = CallResult<{
|
|
40
77
|
tokensOut: bigint;
|
|
41
78
|
requiredSatoshis: bigint;
|
|
42
79
|
price: bigint;
|
|
43
|
-
}
|
|
80
|
+
}, [
|
|
81
|
+
]>;
|
|
44
82
|
export type GetProviderDetails = CallResult<{
|
|
45
83
|
liquidity: bigint;
|
|
46
84
|
reserved: bigint;
|
|
47
85
|
btcReceiver: string;
|
|
48
|
-
}
|
|
86
|
+
}, [
|
|
87
|
+
]>;
|
|
49
88
|
export type GetPriorityQueueCost = CallResult<{
|
|
50
89
|
cost: bigint;
|
|
51
|
-
}
|
|
90
|
+
}, [
|
|
91
|
+
]>;
|
|
52
92
|
export interface INativeSwapContract extends IOP_NETContract {
|
|
53
93
|
reserve(token: Address, maximumAmountIn: bigint, minimumAmountOut: bigint, forLP: boolean): Promise<ReserveNativeSwap>;
|
|
54
94
|
listLiquidity(token: Address, receiver: string, amountIn: bigint, priority: boolean): Promise<ListLiquidity>;
|
|
@@ -57,7 +97,7 @@ export interface INativeSwapContract extends IOP_NETContract {
|
|
|
57
97
|
createPoolWithSignature(signature: Buffer, approveAmount: bigint, token: Address, floorPrice: bigint, initialLiquidity: bigint, receiver: string, antiBotEnabledFor: number, antiBotMaximumTokensPerReservation: bigint, maxReservesIn5BlocksPercent: number): Promise<CreatePool>;
|
|
58
98
|
setFees(reservationBaseFee: bigint, priorityQueueBaseFee: bigint, pricePerUserInPriorityQueueBTC: bigint): Promise<SetFees>;
|
|
59
99
|
getFees(): Promise<GetFees>;
|
|
60
|
-
addLiquidity(token: Address, receiver: string
|
|
100
|
+
addLiquidity(token: Address, receiver: string): Promise<AddLiquidity>;
|
|
61
101
|
removeLiquidity(token: Address, amount: bigint): Promise<RemoveLiquidity>;
|
|
62
102
|
swap(token: Address): Promise<Swap>;
|
|
63
103
|
getReserve(token: Address): Promise<GetReserve>;
|
|
@@ -1,48 +1,68 @@
|
|
|
1
1
|
import { Address, AddressMap } from '@btc-vision/transaction';
|
|
2
2
|
import { CallResult } from '../../../../contracts/CallResult.js';
|
|
3
|
+
import { OPNetEvent } from '../../../../contracts/OPNetEvent.js';
|
|
3
4
|
import { IOP_NETContract } from './IOP_NETContract.js';
|
|
5
|
+
export type MintEvent = {
|
|
6
|
+
to: Address;
|
|
7
|
+
amount: bigint;
|
|
8
|
+
};
|
|
9
|
+
export type TransferEvent = {
|
|
10
|
+
from: Address;
|
|
11
|
+
to: Address;
|
|
12
|
+
amount: bigint;
|
|
13
|
+
};
|
|
14
|
+
export type BurnEvent = {
|
|
15
|
+
amount: bigint;
|
|
16
|
+
};
|
|
17
|
+
export type ApproveEvent = {
|
|
18
|
+
owner: Address;
|
|
19
|
+
spender: Address;
|
|
20
|
+
value: bigint;
|
|
21
|
+
};
|
|
4
22
|
export type Name = CallResult<{
|
|
5
23
|
name: string;
|
|
6
|
-
}>;
|
|
24
|
+
}, []>;
|
|
7
25
|
export type BalanceOf = CallResult<{
|
|
8
26
|
balance: bigint;
|
|
9
|
-
}>;
|
|
27
|
+
}, []>;
|
|
10
28
|
export type SymbolOf = CallResult<{
|
|
11
29
|
symbol: string;
|
|
12
|
-
}>;
|
|
30
|
+
}, []>;
|
|
13
31
|
export type TotalSupply = CallResult<{
|
|
14
32
|
totalSupply: bigint;
|
|
15
|
-
}>;
|
|
33
|
+
}, []>;
|
|
16
34
|
export type MaxSupply = CallResult<{
|
|
17
35
|
maximumSupply: bigint;
|
|
18
|
-
}>;
|
|
36
|
+
}, []>;
|
|
19
37
|
export type Decimals = CallResult<{
|
|
20
38
|
decimals: number;
|
|
21
|
-
}>;
|
|
39
|
+
}, []>;
|
|
22
40
|
export type Transfer = CallResult<{
|
|
23
41
|
success: boolean;
|
|
24
|
-
}
|
|
42
|
+
}, [
|
|
43
|
+
OPNetEvent<TransferEvent>
|
|
44
|
+
]>;
|
|
25
45
|
export type TransferFrom = CallResult<{
|
|
26
46
|
success: boolean;
|
|
27
|
-
}>;
|
|
47
|
+
}, [OPNetEvent<TransferEvent>]>;
|
|
28
48
|
export type Approve = CallResult<{
|
|
29
49
|
success: boolean;
|
|
30
|
-
}>;
|
|
50
|
+
}, [OPNetEvent<ApproveEvent>]>;
|
|
31
51
|
export type Allowance = CallResult<{
|
|
32
52
|
remaining: bigint;
|
|
33
|
-
}>;
|
|
53
|
+
}, []>;
|
|
34
54
|
export type Burn = CallResult<{
|
|
35
55
|
success: boolean;
|
|
36
|
-
}>;
|
|
56
|
+
}, [OPNetEvent<BurnEvent>]>;
|
|
37
57
|
export type Mint = CallResult<{
|
|
38
58
|
success: boolean;
|
|
39
|
-
}>;
|
|
59
|
+
}, [OPNetEvent<MintEvent>]>;
|
|
40
60
|
export type Airdrop = CallResult<{
|
|
41
61
|
success: boolean;
|
|
42
|
-
}>;
|
|
62
|
+
}, OPNetEvent<MintEvent>[]>;
|
|
43
63
|
export type AirdropWithAmount = CallResult<{
|
|
44
64
|
success: boolean;
|
|
45
|
-
}>;
|
|
65
|
+
}, OPNetEvent<MintEvent>[]>;
|
|
46
66
|
export interface IOP_20Contract extends IOP_NETContract {
|
|
47
67
|
balanceOf(account: Address): Promise<BalanceOf>;
|
|
48
68
|
name(): Promise<Name>;
|
|
@@ -23,7 +23,7 @@ export interface InteractionTransactionReceipt {
|
|
|
23
23
|
readonly estimatedFees: bigint;
|
|
24
24
|
readonly preimage: string;
|
|
25
25
|
}
|
|
26
|
-
export declare class CallResult<T extends ContractDecodedObjectResult = {}> implements Omit<ICallResultData, 'estimatedGas' | 'events'> {
|
|
26
|
+
export declare class CallResult<T extends ContractDecodedObjectResult = {}, U extends OPNetEvent<ContractDecodedObjectResult>[] = OPNetEvent<ContractDecodedObjectResult>[]> implements Omit<ICallResultData, 'estimatedGas' | 'events'> {
|
|
27
27
|
#private;
|
|
28
28
|
readonly result: BinaryReader;
|
|
29
29
|
readonly accessList: IAccessList;
|
|
@@ -32,7 +32,7 @@ export declare class CallResult<T extends ContractDecodedObjectResult = {}> impl
|
|
|
32
32
|
readonly estimatedGas: bigint | undefined;
|
|
33
33
|
properties: T;
|
|
34
34
|
estimatedSatGas: bigint;
|
|
35
|
-
events:
|
|
35
|
+
events: U;
|
|
36
36
|
to: string | undefined;
|
|
37
37
|
constructor(callResult: ICallResultData, provider: AbstractRpcProvider);
|
|
38
38
|
get rawEvents(): EventList;
|
|
@@ -40,6 +40,7 @@ export declare class CallResult<T extends ContractDecodedObjectResult = {}> impl
|
|
|
40
40
|
sendTransaction(interactionParams: TransactionParameters): Promise<InteractionTransactionReceipt>;
|
|
41
41
|
setGasEstimation(estimatedGas: bigint): void;
|
|
42
42
|
setDecoded(decoded: DecodedOutput): void;
|
|
43
|
+
setEvents(events: U): void;
|
|
43
44
|
setCalldata(calldata: Buffer): void;
|
|
44
45
|
private contractToString;
|
|
45
46
|
private parseEvents;
|
|
@@ -36,7 +36,7 @@ export declare abstract class IBaseContract<T extends BaseContractProperties> im
|
|
|
36
36
|
protected constructor(address: string | Address, abi: BitcoinInterface | BitcoinInterfaceAbi, provider: AbstractRpcProvider, network: Network, from?: Address);
|
|
37
37
|
get p2trOrTweaked(): string;
|
|
38
38
|
setSender(sender: Address): void;
|
|
39
|
-
decodeEvents(events: NetEvent[] | ContractEvents): OPNetEvent[];
|
|
39
|
+
decodeEvents(events: NetEvent[] | ContractEvents): OPNetEvent<ContractDecodedObjectResult>[];
|
|
40
40
|
decodeEvent(event: NetEvent): OPNetEvent;
|
|
41
41
|
encodeCalldata(functionName: string, args: unknown[]): Buffer;
|
|
42
42
|
currentGasParameters(): Promise<BlockGasParameters>;
|