@sodax/types 1.5.7-beta → 2.0.0-rc.1
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/README.md +49 -21
- package/dist/backend/backendApi.d.ts +75 -0
- package/dist/backend/backendApi.d.ts.map +1 -0
- package/dist/backend/backendApi.js +2 -0
- package/dist/backend/backendApi.js.map +1 -0
- package/dist/backend/index.d.ts +1 -80
- package/dist/backend/index.d.ts.map +1 -1
- package/dist/backend/index.js +1 -1
- package/dist/backend/index.js.map +1 -1
- package/dist/{btc/index.d.ts → bitcoin/bitcoin.d.ts} +31 -31
- package/dist/bitcoin/bitcoin.d.ts.map +1 -0
- package/dist/{btc/index.js → bitcoin/bitcoin.js} +5 -4
- package/dist/bitcoin/bitcoin.js.map +1 -0
- package/dist/bitcoin/index.d.ts +2 -0
- package/dist/bitcoin/index.d.ts.map +1 -0
- package/dist/bitcoin/index.js +2 -0
- package/dist/bitcoin/index.js.map +1 -0
- package/dist/chains/chain-keys.d.ts +31 -0
- package/dist/chains/chain-keys.d.ts.map +1 -0
- package/dist/chains/chain-keys.js +39 -0
- package/dist/chains/chain-keys.js.map +1 -0
- package/dist/chains/chains.d.ts +3491 -0
- package/dist/chains/chains.d.ts.map +1 -0
- package/dist/chains/chains.js +712 -0
- package/dist/chains/chains.js.map +1 -0
- package/dist/chains/index.d.ts +3 -0
- package/dist/chains/index.d.ts.map +1 -0
- package/dist/chains/index.js +3 -0
- package/dist/chains/index.js.map +1 -0
- package/dist/chains/tokens.d.ts +4390 -0
- package/dist/chains/tokens.d.ts.map +1 -0
- package/dist/chains/tokens.js +2139 -0
- package/dist/chains/tokens.js.map +1 -0
- package/dist/common/common.d.ts +282 -0
- package/dist/common/common.d.ts.map +1 -0
- package/dist/common/common.js +30 -0
- package/dist/common/common.js.map +1 -0
- package/dist/common/constants.d.ts +70 -0
- package/dist/common/constants.d.ts.map +1 -0
- package/dist/common/constants.js +31 -0
- package/dist/common/constants.js.map +1 -0
- package/dist/common/index.d.ts +2 -274
- package/dist/common/index.d.ts.map +1 -1
- package/dist/common/index.js +2 -1
- package/dist/common/index.js.map +1 -1
- package/dist/dex/dex.d.ts +268 -0
- package/dist/dex/dex.d.ts.map +1 -0
- package/dist/dex/dex.js +128 -0
- package/dist/dex/dex.js.map +1 -0
- package/dist/dex/index.d.ts +2 -0
- package/dist/dex/index.d.ts.map +1 -0
- package/dist/dex/index.js +2 -0
- package/dist/dex/index.js.map +1 -0
- package/dist/dex/pancakeswap-infinity.d.ts +539 -0
- package/dist/dex/pancakeswap-infinity.d.ts.map +1 -0
- package/dist/dex/pancakeswap-infinity.js +3 -0
- package/dist/dex/pancakeswap-infinity.js.map +1 -0
- package/dist/evm/evm.d.ts +48 -0
- package/dist/evm/evm.d.ts.map +1 -0
- package/dist/evm/evm.js +2 -0
- package/dist/evm/evm.js.map +1 -0
- package/dist/evm/index.d.ts +1 -39
- package/dist/evm/index.d.ts.map +1 -1
- package/dist/evm/index.js +1 -1
- package/dist/evm/index.js.map +1 -1
- package/dist/icon/icon.d.ts +55 -0
- package/dist/icon/icon.d.ts.map +1 -0
- package/dist/icon/icon.js +2 -0
- package/dist/icon/icon.js.map +1 -0
- package/dist/icon/index.d.ts +1 -35
- package/dist/icon/index.d.ts.map +1 -1
- package/dist/icon/index.js +1 -1
- package/dist/icon/index.js.map +1 -1
- package/dist/index.d.ts +15 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -7
- package/dist/index.js.map +1 -1
- package/dist/injective/index.d.ts +1 -67
- package/dist/injective/index.d.ts.map +1 -1
- package/dist/injective/index.js +1 -16
- package/dist/injective/index.js.map +1 -1
- package/dist/injective/injective.d.ts +103 -0
- package/dist/injective/injective.d.ts.map +1 -0
- package/dist/injective/injective.js +2 -0
- package/dist/injective/injective.js.map +1 -0
- package/dist/moneyMarket/index.d.ts +2 -0
- package/dist/moneyMarket/index.d.ts.map +1 -0
- package/dist/moneyMarket/index.js +2 -0
- package/dist/moneyMarket/index.js.map +1 -0
- package/dist/moneyMarket/moneyMarket.d.ts +2440 -0
- package/dist/moneyMarket/moneyMarket.d.ts.map +1 -0
- package/dist/moneyMarket/moneyMarket.js +194 -0
- package/dist/moneyMarket/moneyMarket.js.map +1 -0
- package/dist/near/index.d.ts +1 -69
- package/dist/near/index.d.ts.map +1 -1
- package/dist/near/index.js +1 -1
- package/dist/near/index.js.map +1 -1
- package/dist/near/near-api-js.d.ts +6119 -0
- package/dist/near/near-api-js.d.ts.map +1 -0
- package/dist/near/near-api-js.js +2 -0
- package/dist/near/near-api-js.js.map +1 -0
- package/dist/near/near.d.ts +75 -0
- package/dist/near/near.d.ts.map +1 -0
- package/dist/near/near.js +2 -0
- package/dist/near/near.js.map +1 -0
- package/dist/shared/index.d.ts +2 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/index.js +2 -0
- package/dist/shared/index.js.map +1 -0
- package/dist/shared/shared.d.ts +17 -0
- package/dist/shared/shared.d.ts.map +1 -0
- package/dist/shared/shared.js +6 -0
- package/dist/shared/shared.js.map +1 -0
- package/dist/sodax-config/index.d.ts +2 -0
- package/dist/sodax-config/index.d.ts.map +1 -0
- package/dist/sodax-config/index.js +2 -0
- package/dist/sodax-config/index.js.map +1 -0
- package/dist/sodax-config/sodax-config.d.ts +6070 -0
- package/dist/{constants/index.d.ts.map → sodax-config/sodax-config.d.ts.map} +1 -1
- package/dist/sodax-config/sodax-config.js +22 -0
- package/dist/sodax-config/sodax-config.js.map +1 -0
- package/dist/solana/index.d.ts +1 -99
- package/dist/solana/index.d.ts.map +1 -1
- package/dist/solana/index.js +1 -1
- package/dist/solana/index.js.map +1 -1
- package/dist/solana/solana-web3.d.ts +390 -0
- package/dist/solana/solana-web3.d.ts.map +1 -0
- package/dist/solana/solana-web3.js +2 -0
- package/dist/solana/solana-web3.js.map +1 -0
- package/dist/solana/solana.d.ts +111 -0
- package/dist/solana/solana.d.ts.map +1 -0
- package/dist/solana/solana.js +2 -0
- package/dist/solana/solana.js.map +1 -0
- package/dist/stacks/index.d.ts +1 -16
- package/dist/stacks/index.d.ts.map +1 -1
- package/dist/stacks/index.js +1 -1
- package/dist/stacks/index.js.map +1 -1
- package/dist/stacks/stacks.d.ts +211 -0
- package/dist/stacks/stacks.d.ts.map +1 -0
- package/dist/stacks/stacks.js +2 -0
- package/dist/stacks/stacks.js.map +1 -0
- package/dist/stellar/index.d.ts +1 -69
- package/dist/stellar/index.d.ts.map +1 -1
- package/dist/stellar/index.js +1 -1
- package/dist/stellar/index.js.map +1 -1
- package/dist/stellar/stellar.d.ts +97 -0
- package/dist/stellar/stellar.d.ts.map +1 -0
- package/dist/stellar/stellar.js +2 -0
- package/dist/stellar/stellar.js.map +1 -0
- package/dist/sui/index.d.ts +1 -32
- package/dist/sui/index.d.ts.map +1 -1
- package/dist/sui/index.js +1 -1
- package/dist/sui/index.js.map +1 -1
- package/dist/sui/sui.d.ts +312 -0
- package/dist/sui/sui.d.ts.map +1 -0
- package/dist/sui/sui.js +2 -0
- package/dist/sui/sui.js.map +1 -0
- package/dist/swap/index.d.ts +2 -0
- package/dist/swap/index.d.ts.map +1 -0
- package/dist/swap/index.js +2 -0
- package/dist/swap/index.js.map +1 -0
- package/dist/swap/swap.d.ts +3369 -0
- package/dist/swap/swap.d.ts.map +1 -0
- package/dist/swap/swap.js +242 -0
- package/dist/swap/swap.js.map +1 -0
- package/dist/utils/deep-partial.d.ts +9 -0
- package/dist/utils/deep-partial.d.ts.map +1 -0
- package/dist/utils/deep-partial.js +2 -0
- package/dist/utils/deep-partial.js.map +1 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/utils.d.ts +61 -0
- package/dist/utils/utils.d.ts.map +1 -0
- package/dist/utils/utils.js +144 -0
- package/dist/utils/utils.js.map +1 -0
- package/dist/wallet/index.d.ts +3 -0
- package/dist/wallet/index.d.ts.map +1 -0
- package/dist/wallet/index.js +3 -0
- package/dist/wallet/index.js.map +1 -0
- package/dist/wallet/providers.d.ts +24 -0
- package/dist/wallet/providers.d.ts.map +1 -0
- package/dist/wallet/providers.js +2 -0
- package/dist/wallet/providers.js.map +1 -0
- package/dist/wallet/wallet.d.ts +19 -0
- package/dist/wallet/wallet.d.ts.map +1 -0
- package/dist/wallet/wallet.js +2 -0
- package/dist/wallet/wallet.js.map +1 -0
- package/package.json +17 -9
- package/dist/btc/index.d.ts.map +0 -1
- package/dist/btc/index.js.map +0 -1
- package/dist/constants/index.d.ts +0 -7299
- package/dist/constants/index.js +0 -3227
- package/dist/constants/index.js.map +0 -1
package/dist/dex/dex.js
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { StatATokenAddresses } from '../chains/tokens.js';
|
|
2
|
+
export const concentratedLiquidityConfig = {
|
|
3
|
+
permit2: '0x000000000022D473030F116dDEE9F6B43aC78BA3',
|
|
4
|
+
clPoolManager: '0xA3256ab552A271A16AcDfdB521B32ef82d481F43',
|
|
5
|
+
router: '0x5bFB058c65E4c1DEC1cFF0Ff2cBd8522b4c3feBB',
|
|
6
|
+
clPositionManager: '0xcc08a04d9E5766c7A20FE6bb32cAa40EA0e7e9e1',
|
|
7
|
+
clPositionDescriptor: '0x83Ff9FC474DBe927BA5BB822571e0814122655bB',
|
|
8
|
+
clQuoter: '0x5f46CB668D39496b41CE8E19D6A7fE893826E363',
|
|
9
|
+
clTickLens: '0xb3e77dD9b1f206A2b797B3fE900b50cC92A38d26',
|
|
10
|
+
defaultHook: '0x598448d8f8553b9c6f27E52a92E2cCf27cDEF229',
|
|
11
|
+
stataTokenFactory: '0x9120956787FcE7D7082C52CDCAafb7F4B88272d4',
|
|
12
|
+
defaultTickSpacing: 10,
|
|
13
|
+
defaultBitmap: 16383n,
|
|
14
|
+
};
|
|
15
|
+
export const dexPools = {
|
|
16
|
+
AETH_BNUSD: {
|
|
17
|
+
currency0: '0x3E102c7D9b46c92aBcd4c2e1C70f362B47a201A6', // AsodaETH
|
|
18
|
+
currency1: '0xE801CA34E19aBCbFeA12025378D19c4FBE250131', // bnuSD
|
|
19
|
+
hooks: '0x598448d8f8553b9c6f27E52a92E2cCf27cDEF229', // defaultHook
|
|
20
|
+
poolManager: '0xA3256ab552A271A16AcDfdB521B32ef82d481F43', // clPoolManager
|
|
21
|
+
fee: 8388608, // DYNAMIC_FEE
|
|
22
|
+
parameters: {
|
|
23
|
+
tickSpacing: 10,
|
|
24
|
+
hooksRegistration: {
|
|
25
|
+
beforeInitialize: true,
|
|
26
|
+
afterInitialize: true,
|
|
27
|
+
beforeAddLiquidity: true,
|
|
28
|
+
afterAddLiquidity: true,
|
|
29
|
+
beforeRemoveLiquidity: true,
|
|
30
|
+
afterRemoveLiquidity: true,
|
|
31
|
+
beforeSwap: true,
|
|
32
|
+
afterSwap: true,
|
|
33
|
+
beforeDonate: true,
|
|
34
|
+
afterDonate: true,
|
|
35
|
+
beforeSwapReturnsDelta: true,
|
|
36
|
+
afterSwapReturnsDelta: true,
|
|
37
|
+
afterMintReturnsDelta: true,
|
|
38
|
+
afterBurnReturnsDelta: true,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
BTC_BNUSD: {
|
|
43
|
+
currency0: '0x8aDe79C255761971f4057253712b916AB2494275', // sodaBTC
|
|
44
|
+
currency1: '0xE801CA34E19aBCbFeA12025378D19c4FBE250131', // bnUSD
|
|
45
|
+
hooks: '0x598448d8f8553b9c6f27E52a92E2cCf27cDEF229', // defaultHook
|
|
46
|
+
poolManager: '0xA3256ab552A271A16AcDfdB521B32ef82d481F43', // clPoolManager
|
|
47
|
+
fee: 8388608, // DYNAMIC_FEE
|
|
48
|
+
parameters: {
|
|
49
|
+
tickSpacing: 10,
|
|
50
|
+
hooksRegistration: {
|
|
51
|
+
beforeInitialize: true,
|
|
52
|
+
afterInitialize: true,
|
|
53
|
+
beforeAddLiquidity: true,
|
|
54
|
+
afterAddLiquidity: true,
|
|
55
|
+
beforeRemoveLiquidity: true,
|
|
56
|
+
afterRemoveLiquidity: true,
|
|
57
|
+
beforeSwap: true,
|
|
58
|
+
afterSwap: true,
|
|
59
|
+
beforeDonate: true,
|
|
60
|
+
afterDonate: true,
|
|
61
|
+
beforeSwapReturnsDelta: true,
|
|
62
|
+
afterSwapReturnsDelta: true,
|
|
63
|
+
afterMintReturnsDelta: true,
|
|
64
|
+
afterBurnReturnsDelta: true,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
// SODA/ETH pool
|
|
69
|
+
ASODA_BNUSD: {
|
|
70
|
+
currency0: '0xac8540fee419c7ceb985889EaBa1e84B42a53e8a', // sodaSODA
|
|
71
|
+
currency1: '0xE801CA34E19aBCbFeA12025378D19c4FBE250131', // sodaETH
|
|
72
|
+
hooks: '0x598448d8f8553b9c6f27E52a92E2cCf27cDEF229', // defaultHook
|
|
73
|
+
poolManager: '0xA3256ab552A271A16AcDfdB521B32ef82d481F43', // clPoolManager
|
|
74
|
+
fee: 8388608, // DYNAMIC_FEE
|
|
75
|
+
parameters: {
|
|
76
|
+
tickSpacing: 10,
|
|
77
|
+
hooksRegistration: {
|
|
78
|
+
beforeInitialize: true,
|
|
79
|
+
afterInitialize: true,
|
|
80
|
+
beforeAddLiquidity: true,
|
|
81
|
+
afterAddLiquidity: true,
|
|
82
|
+
beforeRemoveLiquidity: true,
|
|
83
|
+
afterRemoveLiquidity: true,
|
|
84
|
+
beforeSwap: true,
|
|
85
|
+
afterSwap: true,
|
|
86
|
+
beforeDonate: true,
|
|
87
|
+
afterDonate: true,
|
|
88
|
+
beforeSwapReturnsDelta: true,
|
|
89
|
+
afterSwapReturnsDelta: true,
|
|
90
|
+
afterMintReturnsDelta: true,
|
|
91
|
+
afterBurnReturnsDelta: true,
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
// SODA/USDC pool
|
|
96
|
+
ASODA_XSODA: {
|
|
97
|
+
currency0: '0xac8540fee419c7ceb985889EaBa1e84B42a53e8a', // sodaSODA
|
|
98
|
+
currency1: '0xADC6561Cc8FC31767B4917CCc97F510D411378d9', // xSODA
|
|
99
|
+
hooks: '0x598448d8f8553b9c6f27E52a92E2cCf27cDEF229', // defaultHook
|
|
100
|
+
poolManager: '0xA3256ab552A271A16AcDfdB521B32ef82d481F43', // clPoolManager
|
|
101
|
+
fee: 8388608, // DYNAMIC_FEE
|
|
102
|
+
parameters: {
|
|
103
|
+
tickSpacing: 10,
|
|
104
|
+
hooksRegistration: {
|
|
105
|
+
beforeInitialize: true,
|
|
106
|
+
afterInitialize: true,
|
|
107
|
+
beforeAddLiquidity: true,
|
|
108
|
+
afterAddLiquidity: true,
|
|
109
|
+
beforeRemoveLiquidity: true,
|
|
110
|
+
afterRemoveLiquidity: true,
|
|
111
|
+
beforeSwap: true,
|
|
112
|
+
afterSwap: true,
|
|
113
|
+
beforeDonate: true,
|
|
114
|
+
afterDonate: true,
|
|
115
|
+
beforeSwapReturnsDelta: true,
|
|
116
|
+
afterSwapReturnsDelta: true,
|
|
117
|
+
afterMintReturnsDelta: true,
|
|
118
|
+
afterBurnReturnsDelta: true,
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
export const dexConfig = {
|
|
124
|
+
concentratedLiquidityConfig: concentratedLiquidityConfig,
|
|
125
|
+
dexPools: dexPools,
|
|
126
|
+
statATokenAddresses: StatATokenAddresses,
|
|
127
|
+
};
|
|
128
|
+
//# sourceMappingURL=dex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dex.js","sourceRoot":"","sources":["../../src/dex/dex.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dex/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/dex/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,539 @@
|
|
|
1
|
+
import type { Address } from '../shared/shared.js';
|
|
2
|
+
import type { Prettify } from '../common/common.js';
|
|
3
|
+
export type BigintIsh = bigint | number | string;
|
|
4
|
+
export declare enum TradeType {
|
|
5
|
+
EXACT_INPUT = 0,
|
|
6
|
+
EXACT_OUTPUT = 1
|
|
7
|
+
}
|
|
8
|
+
export declare enum Rounding {
|
|
9
|
+
ROUND_DOWN = 0,
|
|
10
|
+
ROUND_HALF_UP = 1,
|
|
11
|
+
ROUND_UP = 2
|
|
12
|
+
}
|
|
13
|
+
export declare const MINIMUM_LIQUIDITY = 1000n;
|
|
14
|
+
export declare const ZERO = 0n;
|
|
15
|
+
export declare const ONE = 1n;
|
|
16
|
+
export declare const TWO = 2n;
|
|
17
|
+
export declare const THREE = 3n;
|
|
18
|
+
export declare const FIVE = 5n;
|
|
19
|
+
export declare const TEN = 10n;
|
|
20
|
+
export declare const _100 = 100n;
|
|
21
|
+
export declare const _9975 = 9975n;
|
|
22
|
+
export declare const _10000 = 10000n;
|
|
23
|
+
export declare const MaxUint256: bigint;
|
|
24
|
+
export declare enum VMType {
|
|
25
|
+
uint8 = "uint8",
|
|
26
|
+
uint256 = "uint256"
|
|
27
|
+
}
|
|
28
|
+
export declare const VM_TYPE_MAXIMA: {
|
|
29
|
+
uint8: bigint;
|
|
30
|
+
uint256: bigint;
|
|
31
|
+
};
|
|
32
|
+
export declare const ZERO_ADDRESS: '0x0000000000000000000000000000000000000000';
|
|
33
|
+
/**
|
|
34
|
+
* A currency is any fungible financial instrument, including Ether, all ERC20 tokens, and other chain-native currencies
|
|
35
|
+
*/
|
|
36
|
+
export declare abstract class BaseCurrency<T extends BaseCurrency<any> = BaseCurrency<any>> {
|
|
37
|
+
/**
|
|
38
|
+
* Returns whether the currency is native to the chain and must be wrapped (e.g. Ether)
|
|
39
|
+
*/
|
|
40
|
+
abstract readonly isNative: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Returns whether the currency is a token that is usable in PancakeSwap without wrapping
|
|
43
|
+
*/
|
|
44
|
+
abstract readonly isToken: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* The chain ID on which this currency resides
|
|
47
|
+
*/
|
|
48
|
+
readonly chainId: number;
|
|
49
|
+
/**
|
|
50
|
+
* The decimals used in representing currency amounts
|
|
51
|
+
*/
|
|
52
|
+
readonly decimals: number;
|
|
53
|
+
/**
|
|
54
|
+
* The symbol of the currency, i.e. a short textual non-unique identifier
|
|
55
|
+
*/
|
|
56
|
+
readonly symbol: string;
|
|
57
|
+
/**
|
|
58
|
+
* The name of the currency, i.e. a descriptive textual non-unique identifier
|
|
59
|
+
*/
|
|
60
|
+
readonly name?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Constructs an instance of the base class `BaseCurrency`.
|
|
63
|
+
* @param chainId the chain ID on which this currency resides
|
|
64
|
+
* @param decimals decimals of the currency
|
|
65
|
+
* @param symbol symbol of the currency
|
|
66
|
+
* @param name of the currency
|
|
67
|
+
*/
|
|
68
|
+
protected constructor(chainId: number, decimals: number, symbol: string, name?: string);
|
|
69
|
+
/**
|
|
70
|
+
* Returns whether this currency is functionally equivalent to the other currency
|
|
71
|
+
* @param other the other currency
|
|
72
|
+
*/
|
|
73
|
+
abstract equals(other: BaseCurrency<T>): boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Return the wrapped version of this currency that can be used with the PancakeSwap contracts. Currencies must
|
|
76
|
+
* implement this to be used in PancakeSwap
|
|
77
|
+
*/
|
|
78
|
+
abstract get wrapped(): T;
|
|
79
|
+
get asToken(): T;
|
|
80
|
+
}
|
|
81
|
+
export interface SerializedToken {
|
|
82
|
+
chainId: number;
|
|
83
|
+
address: `0x${string}`;
|
|
84
|
+
decimals: number;
|
|
85
|
+
symbol: string;
|
|
86
|
+
name?: string;
|
|
87
|
+
projectLink?: string;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Represents an ERC20 token with a unique address and some metadata.
|
|
91
|
+
*/
|
|
92
|
+
export declare class Token extends BaseCurrency<Token> {
|
|
93
|
+
readonly isNative: false;
|
|
94
|
+
readonly isToken: true;
|
|
95
|
+
/**
|
|
96
|
+
* The contract address on the chain on which this token lives
|
|
97
|
+
*/
|
|
98
|
+
readonly address: `0x${string}`;
|
|
99
|
+
readonly projectLink?: string;
|
|
100
|
+
constructor(chainId: number, address: `0x${string}`, decimals: number, symbol: string, name?: string, projectLink?: string);
|
|
101
|
+
/**
|
|
102
|
+
* Returns true if the two tokens are equivalent, i.e. have the same chainId and address.
|
|
103
|
+
* @param other other token to compare
|
|
104
|
+
*/
|
|
105
|
+
equals(other: BaseCurrency): boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Returns true if the address of this token sorts before the address of the other token
|
|
108
|
+
* @param other other token to compare
|
|
109
|
+
* @throws if the tokens have the same address
|
|
110
|
+
* @throws if the tokens are on different chains
|
|
111
|
+
*/
|
|
112
|
+
sortsBefore(other: Token): boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Return this token, which does not need to be wrapped
|
|
115
|
+
*/
|
|
116
|
+
get wrapped(): Token;
|
|
117
|
+
get serialize(): SerializedToken;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Represents the native currency of the chain on which it resides, e.g.
|
|
121
|
+
*/
|
|
122
|
+
export declare abstract class NativeCurrency extends BaseCurrency<Token> {
|
|
123
|
+
readonly isNative: true;
|
|
124
|
+
readonly isToken: false;
|
|
125
|
+
get asToken(): Token;
|
|
126
|
+
}
|
|
127
|
+
export interface SerializedSPLToken {
|
|
128
|
+
chainId: number;
|
|
129
|
+
address: string;
|
|
130
|
+
programId: string;
|
|
131
|
+
decimals: number;
|
|
132
|
+
symbol: string;
|
|
133
|
+
name?: string;
|
|
134
|
+
projectLink?: string;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Represents an SPL token on Solana or other non-EVM chains.
|
|
138
|
+
*/
|
|
139
|
+
export declare class SPLToken extends BaseCurrency<SPLToken> {
|
|
140
|
+
readonly isNative: false;
|
|
141
|
+
readonly isToken: true;
|
|
142
|
+
readonly address: string;
|
|
143
|
+
readonly programId: string;
|
|
144
|
+
readonly logoURI: string;
|
|
145
|
+
readonly projectLink?: string;
|
|
146
|
+
static isSPLToken(token?: UnifiedCurrency): boolean;
|
|
147
|
+
constructor({ chainId, programId, address, decimals, symbol, logoURI, name, projectLink, }: {
|
|
148
|
+
chainId: number;
|
|
149
|
+
programId: string;
|
|
150
|
+
address: string;
|
|
151
|
+
decimals: number;
|
|
152
|
+
symbol: string;
|
|
153
|
+
logoURI: string;
|
|
154
|
+
name?: string;
|
|
155
|
+
projectLink?: string;
|
|
156
|
+
isNative?: boolean;
|
|
157
|
+
});
|
|
158
|
+
/**
|
|
159
|
+
* Returns true if the two tokens are equivalent, i.e. have the same chainId and programId.
|
|
160
|
+
* @param other other token to compare
|
|
161
|
+
*/
|
|
162
|
+
equals(other: BaseCurrency): boolean;
|
|
163
|
+
sortsBefore(other: SPLToken): boolean;
|
|
164
|
+
get wrapped(): SPLToken;
|
|
165
|
+
get serialize(): SerializedSPLToken;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Represents the native currency of the chain on which it resides, e.g.
|
|
169
|
+
*/
|
|
170
|
+
export declare abstract class SPLNativeCurrency extends BaseCurrency<SPLToken> {
|
|
171
|
+
readonly isNative: true;
|
|
172
|
+
readonly isToken: false;
|
|
173
|
+
readonly address: string;
|
|
174
|
+
}
|
|
175
|
+
export type Currency = NativeCurrency | Token;
|
|
176
|
+
export type UnifiedNativeCurrency = NativeCurrency | SPLNativeCurrency;
|
|
177
|
+
export type UnifiedCurrency = SPLToken | SPLNativeCurrency | Currency;
|
|
178
|
+
export type UnifiedToken = SPLToken | Token;
|
|
179
|
+
export declare class Fraction {
|
|
180
|
+
readonly numerator: bigint;
|
|
181
|
+
readonly denominator: bigint;
|
|
182
|
+
constructor(numerator: BigintIsh, denominator?: BigintIsh);
|
|
183
|
+
private static readonly tryParseFraction;
|
|
184
|
+
get quotient(): bigint;
|
|
185
|
+
get remainder(): Fraction;
|
|
186
|
+
invert(): Fraction;
|
|
187
|
+
add(other: Fraction | BigintIsh): Fraction;
|
|
188
|
+
subtract(other: Fraction | BigintIsh): Fraction;
|
|
189
|
+
lessThan(other: Fraction | BigintIsh): boolean;
|
|
190
|
+
equalTo(other: Fraction | BigintIsh): boolean;
|
|
191
|
+
greaterThan(other: Fraction | BigintIsh): boolean;
|
|
192
|
+
multiply(other: Fraction | BigintIsh): Fraction;
|
|
193
|
+
divide(other: Fraction | BigintIsh): Fraction;
|
|
194
|
+
toSignificant(significantDigits: number, format?: object, rounding?: Rounding): string;
|
|
195
|
+
toFixed(decimalPlaces: number, format?: object, rounding?: Rounding): string;
|
|
196
|
+
/**
|
|
197
|
+
* Helper method for converting any super class back to a fraction
|
|
198
|
+
*/
|
|
199
|
+
get asFraction(): Fraction;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Converts a fraction to a percent
|
|
203
|
+
* @param fraction the fraction to convert
|
|
204
|
+
*/
|
|
205
|
+
export declare function toPercent(fraction: Fraction): Percent;
|
|
206
|
+
export declare class Percent extends Fraction {
|
|
207
|
+
/**
|
|
208
|
+
* This boolean prevents a fraction from being interpreted as a Percent
|
|
209
|
+
*/
|
|
210
|
+
readonly isPercent: true;
|
|
211
|
+
static readonly toPercent: typeof toPercent;
|
|
212
|
+
add(other: Fraction | BigintIsh): Percent;
|
|
213
|
+
subtract(other: Fraction | BigintIsh): Percent;
|
|
214
|
+
multiply(other: Fraction | BigintIsh): Percent;
|
|
215
|
+
divide(other: Fraction | BigintIsh): Percent;
|
|
216
|
+
toSignificant(significantDigits?: number, format?: object, rounding?: Rounding): string;
|
|
217
|
+
toFixed(decimalPlaces?: number, format?: object, rounding?: Rounding): string;
|
|
218
|
+
}
|
|
219
|
+
export declare class CurrencyAmount<T extends Currency> extends Fraction {
|
|
220
|
+
readonly currency: T;
|
|
221
|
+
readonly decimalScale: bigint;
|
|
222
|
+
/**
|
|
223
|
+
* Returns a new currency amount instance from the unitless amount of token, i.e. the raw amount
|
|
224
|
+
* @param currency the currency in the amount
|
|
225
|
+
* @param rawAmount the raw token or ether amount
|
|
226
|
+
*/
|
|
227
|
+
static fromRawAmount<T extends Currency>(currency: T, rawAmount: BigintIsh): CurrencyAmount<T>;
|
|
228
|
+
/**
|
|
229
|
+
* Construct a currency amount with a denominator that is not equal to 1
|
|
230
|
+
* @param currency the currency
|
|
231
|
+
* @param numerator the numerator of the fractional token amount
|
|
232
|
+
* @param denominator the denominator of the fractional token amount
|
|
233
|
+
*/
|
|
234
|
+
static fromFractionalAmount<T extends Currency>(currency: T, numerator: BigintIsh, denominator: BigintIsh): CurrencyAmount<T>;
|
|
235
|
+
protected constructor(currency: T, numerator: BigintIsh, denominator?: BigintIsh);
|
|
236
|
+
add(other: CurrencyAmount<T>): CurrencyAmount<T>;
|
|
237
|
+
subtract(value: bigint): CurrencyAmount<T>;
|
|
238
|
+
subtract(other: CurrencyAmount<T>): CurrencyAmount<T>;
|
|
239
|
+
multiply(other: Fraction | BigintIsh): CurrencyAmount<T>;
|
|
240
|
+
divide(other: Fraction | BigintIsh): CurrencyAmount<T>;
|
|
241
|
+
toSignificant(significantDigits?: number, format?: object, rounding?: Rounding): string;
|
|
242
|
+
toFixed(decimalPlaces?: number, format?: object, rounding?: Rounding): string;
|
|
243
|
+
toExact(format?: object): string;
|
|
244
|
+
get wrapped(): CurrencyAmount<Token>;
|
|
245
|
+
info(): string;
|
|
246
|
+
}
|
|
247
|
+
export declare class UnifiedCurrencyAmount<T extends UnifiedCurrency> extends Fraction {
|
|
248
|
+
readonly currency: T;
|
|
249
|
+
readonly decimalScale: bigint;
|
|
250
|
+
/**
|
|
251
|
+
* Returns a new currency amount instance from the unitless amount of token, i.e. the raw amount
|
|
252
|
+
* @param currency the currency in the amount
|
|
253
|
+
* @param rawAmount the raw token or ether amount
|
|
254
|
+
*/
|
|
255
|
+
static fromRawAmount<T extends UnifiedCurrency>(currency: T, rawAmount: BigintIsh): UnifiedCurrencyAmount<T>;
|
|
256
|
+
/**
|
|
257
|
+
* Construct a currency amount with a denominator that is not equal to 1
|
|
258
|
+
* @param currency the currency
|
|
259
|
+
* @param numerator the numerator of the fractional token amount
|
|
260
|
+
* @param denominator the denominator of the fractional token amount
|
|
261
|
+
*/
|
|
262
|
+
static fromFractionalAmount<T extends UnifiedCurrency>(currency: T, numerator: BigintIsh, denominator: BigintIsh): UnifiedCurrencyAmount<T>;
|
|
263
|
+
protected constructor(currency: T, numerator: BigintIsh, denominator?: BigintIsh);
|
|
264
|
+
add(other: UnifiedCurrencyAmount<T>): UnifiedCurrencyAmount<T>;
|
|
265
|
+
subtract(value: bigint): UnifiedCurrencyAmount<T>;
|
|
266
|
+
subtract(other: UnifiedCurrencyAmount<T>): UnifiedCurrencyAmount<T>;
|
|
267
|
+
multiply(other: Fraction | BigintIsh): UnifiedCurrencyAmount<T>;
|
|
268
|
+
divide(other: Fraction | BigintIsh): UnifiedCurrencyAmount<T>;
|
|
269
|
+
toSignificant(significantDigits?: number, format?: object, rounding?: Rounding): string;
|
|
270
|
+
toFixed(decimalPlaces?: number, format?: object, rounding?: Rounding): string;
|
|
271
|
+
toExact(format?: object): string;
|
|
272
|
+
get wrapped(): UnifiedCurrencyAmount<UnifiedToken>;
|
|
273
|
+
info(): string;
|
|
274
|
+
}
|
|
275
|
+
export declare class Price<TBase extends UnifiedCurrency, TQuote extends UnifiedCurrency> extends Fraction {
|
|
276
|
+
readonly baseCurrency: TBase;
|
|
277
|
+
readonly quoteCurrency: TQuote;
|
|
278
|
+
readonly scalar: Fraction;
|
|
279
|
+
/**
|
|
280
|
+
* Construct a price, either with the base and quote currency amount, or the
|
|
281
|
+
* @param args
|
|
282
|
+
*/
|
|
283
|
+
constructor(...args: [TBase, TQuote, BigintIsh, BigintIsh] | [
|
|
284
|
+
{
|
|
285
|
+
baseAmount: UnifiedCurrencyAmount<TBase>;
|
|
286
|
+
quoteAmount: UnifiedCurrencyAmount<TQuote>;
|
|
287
|
+
}
|
|
288
|
+
]);
|
|
289
|
+
/**
|
|
290
|
+
* Flip the price, switching the base and quote currency
|
|
291
|
+
*/
|
|
292
|
+
invert(): Price<TQuote, TBase>;
|
|
293
|
+
/**
|
|
294
|
+
* Multiply the price by another price, returning a new price. The other price must have the same base currency as this price's quote currency
|
|
295
|
+
* @param other the other price
|
|
296
|
+
*/
|
|
297
|
+
multiply<TOtherQuote extends UnifiedCurrency>(other: Price<TQuote, TOtherQuote>): Price<TBase, TOtherQuote>;
|
|
298
|
+
/**
|
|
299
|
+
* Return the amount of quote currency corresponding to a given amount of the base currency
|
|
300
|
+
* @param currencyAmount the amount of base currency to quote against the price
|
|
301
|
+
*/
|
|
302
|
+
quote(currencyAmount: UnifiedCurrencyAmount<TBase>): UnifiedCurrencyAmount<TQuote>;
|
|
303
|
+
/**
|
|
304
|
+
* Get the value scaled by decimals for formatting
|
|
305
|
+
* @private
|
|
306
|
+
*/
|
|
307
|
+
private get adjustedForDecimals();
|
|
308
|
+
toSignificant(significantDigits?: number, format?: object, rounding?: Rounding): string;
|
|
309
|
+
toFixed(decimalPlaces?: number, format?: object, rounding?: Rounding): string;
|
|
310
|
+
get wrapped(): Price<TBase['wrapped'], TQuote['wrapped']>;
|
|
311
|
+
/**
|
|
312
|
+
* Create a price from base and quote currency and a decimal string
|
|
313
|
+
* @param base
|
|
314
|
+
* @param quote
|
|
315
|
+
* @param value
|
|
316
|
+
* @returns Price<TBase, TQuote> | undefined
|
|
317
|
+
*/
|
|
318
|
+
static fromDecimal<TBase extends UnifiedCurrency, TQuote extends UnifiedCurrency>(base: TBase, quote: TQuote, value: string): Price<TBase, TQuote> | undefined;
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Indicates that the pair has insufficient reserves for a desired output amount. I.e. the amount of output cannot be
|
|
322
|
+
* obtained by sending any amount of input.
|
|
323
|
+
*/
|
|
324
|
+
export declare class InsufficientReservesError extends Error {
|
|
325
|
+
readonly isInsufficientReservesError: true;
|
|
326
|
+
constructor();
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Indicates that the input amount is too small to produce any amount of output. I.e. the amount of input sent is less
|
|
330
|
+
* than the price of a single unit of output after fees.
|
|
331
|
+
*/
|
|
332
|
+
export declare class InsufficientInputAmountError extends Error {
|
|
333
|
+
readonly isInsufficientInputAmountError: true;
|
|
334
|
+
constructor();
|
|
335
|
+
}
|
|
336
|
+
export declare function validateVMTypeInstance(value: bigint, vmType: VMType): void;
|
|
337
|
+
export declare function sqrt(y: bigint): bigint;
|
|
338
|
+
export declare function sortedInsert<T>(items: T[], add: T, maxSize: number, comparator: (a: T, b: T) => number): T | null;
|
|
339
|
+
/**
|
|
340
|
+
* Returns the percent difference between the mid price and the execution price, i.e. price impact.
|
|
341
|
+
* @param midPrice mid price before the trade
|
|
342
|
+
* @param inputAmount the input amount of the trade
|
|
343
|
+
* @param outputAmount the output amount of the trade
|
|
344
|
+
*/
|
|
345
|
+
export declare function computePriceImpact<TBase extends Currency, TQuote extends Currency>(midPrice: Price<TBase, TQuote>, inputAmount: CurrencyAmount<TBase>, outputAmount: CurrencyAmount<TQuote>): Percent;
|
|
346
|
+
export declare function getTokenComparator(balances: {
|
|
347
|
+
[tokenAddress: string]: CurrencyAmount<Token> | undefined;
|
|
348
|
+
}): (tokenA: Token, tokenB: Token) => number;
|
|
349
|
+
export declare function sortCurrencies<T extends Currency>(currencies: T[]): T[];
|
|
350
|
+
export declare function sortUnifiedCurrencies<T extends UnifiedCurrency>(currencies: T[]): T[];
|
|
351
|
+
export declare const isCurrencySorted: (currencyA: Currency, currencyB: Currency) => boolean;
|
|
352
|
+
export declare const isUnifiedCurrencySorted: (currencyA: UnifiedCurrency, currencyB: UnifiedCurrency) => boolean;
|
|
353
|
+
export declare function getCurrencyAddress(currency: Currency): `0x${string}`;
|
|
354
|
+
export declare function getUnifiedCurrencyAddress(currency: UnifiedCurrency): string;
|
|
355
|
+
export declare function getMatchedCurrency(currency: Currency, list: Currency[], matchWrappedCurrency?: boolean): Currency | undefined;
|
|
356
|
+
export type Tuple<T, N, R extends T[] = []> = R['length'] extends N ? R : Tuple<T, N, [...R, T]>;
|
|
357
|
+
export type Bytes32 = `0x${string}`;
|
|
358
|
+
/**
|
|
359
|
+
* Hooks registration for all type pool
|
|
360
|
+
* if the value is true, the hook will be registered
|
|
361
|
+
*/
|
|
362
|
+
export type HooksRegistration = {
|
|
363
|
+
beforeInitialize?: boolean;
|
|
364
|
+
afterInitialize?: boolean;
|
|
365
|
+
beforeAddLiquidity?: boolean;
|
|
366
|
+
afterAddLiquidity?: boolean;
|
|
367
|
+
beforeRemoveLiquidity?: boolean;
|
|
368
|
+
afterRemoveLiquidity?: boolean;
|
|
369
|
+
beforeSwap?: boolean;
|
|
370
|
+
afterSwap?: boolean;
|
|
371
|
+
beforeDonate?: boolean;
|
|
372
|
+
afterDonate?: boolean;
|
|
373
|
+
beforeSwapReturnsDelta?: boolean;
|
|
374
|
+
afterSwapReturnsDelta?: boolean;
|
|
375
|
+
afterMintReturnsDelta?: boolean;
|
|
376
|
+
afterBurnReturnsDelta?: boolean;
|
|
377
|
+
};
|
|
378
|
+
export type BinTree = {
|
|
379
|
+
level0: Bytes32;
|
|
380
|
+
level1: Record<number, Bytes32>;
|
|
381
|
+
level2: Record<number, Bytes32>;
|
|
382
|
+
};
|
|
383
|
+
export declare enum BinLiquidityShape {
|
|
384
|
+
Spot = "Spot",
|
|
385
|
+
Curve = "Curve",
|
|
386
|
+
BidAsk = "BidAsk"
|
|
387
|
+
}
|
|
388
|
+
export declare enum POOL_TYPE {
|
|
389
|
+
CLAMM = "CL",
|
|
390
|
+
Bin = "Bin"
|
|
391
|
+
}
|
|
392
|
+
export type PoolType = `${POOL_TYPE}`;
|
|
393
|
+
export type CLPoolParameter = {
|
|
394
|
+
/**
|
|
395
|
+
* Hooks registration for the pool
|
|
396
|
+
* @see {@link HooksRegistration}
|
|
397
|
+
*/
|
|
398
|
+
hooksRegistration?: HooksRegistration;
|
|
399
|
+
tickSpacing: number;
|
|
400
|
+
};
|
|
401
|
+
export type BinPoolParameter = {
|
|
402
|
+
/**
|
|
403
|
+
* Hooks registration for the pool
|
|
404
|
+
* @see {@link HooksRegistration}
|
|
405
|
+
*/
|
|
406
|
+
hooksRegistration?: HooksRegistration;
|
|
407
|
+
binStep: number;
|
|
408
|
+
tickSpacing: number;
|
|
409
|
+
};
|
|
410
|
+
/**
|
|
411
|
+
* PoolKey is a unique identifier for a pool
|
|
412
|
+
*
|
|
413
|
+
* decoded version of `PoolKey`
|
|
414
|
+
*
|
|
415
|
+
*/
|
|
416
|
+
export type PoolKey<TPoolType extends PoolType = 'CL' | 'Bin'> = {
|
|
417
|
+
/**
|
|
418
|
+
* the lower currency address of the pool, use zero address for native token
|
|
419
|
+
*/
|
|
420
|
+
currency0: Address;
|
|
421
|
+
/**
|
|
422
|
+
* the higher currency address of the pool
|
|
423
|
+
*/
|
|
424
|
+
currency1: Address;
|
|
425
|
+
/**
|
|
426
|
+
* the address of the hooks contract, if not set, use zero address
|
|
427
|
+
*/
|
|
428
|
+
hooks?: Address;
|
|
429
|
+
/**
|
|
430
|
+
* the address of the pool manager contract
|
|
431
|
+
*/
|
|
432
|
+
poolManager: Address;
|
|
433
|
+
/**
|
|
434
|
+
* the lp fee of the pool, the max fee for cl pool is 1_000_000(100%) and for bin, it is 100_000(10%).
|
|
435
|
+
* If the pool has dynamic fee then it must be exactly equal to 0x800000
|
|
436
|
+
*
|
|
437
|
+
* @see DYNAMIC_FEE_FLAG
|
|
438
|
+
*/
|
|
439
|
+
fee: number;
|
|
440
|
+
/**
|
|
441
|
+
* the parameters of the pool
|
|
442
|
+
* include:
|
|
443
|
+
* 1. hooks registration callback
|
|
444
|
+
* 2. pool specific parameters: tickSpacing for CLPool, binStep for BinPool
|
|
445
|
+
*
|
|
446
|
+
* @see BinPoolParameter
|
|
447
|
+
* @see CLPoolParameter
|
|
448
|
+
* @see HooksRegistration
|
|
449
|
+
*/
|
|
450
|
+
parameters: TPoolType extends 'CL' ? CLPoolParameter : TPoolType extends 'Bin' ? BinPoolParameter : CLPoolParameter | BinPoolParameter;
|
|
451
|
+
};
|
|
452
|
+
/**
|
|
453
|
+
* encoded poolKey struct
|
|
454
|
+
*
|
|
455
|
+
* @see PoolKey
|
|
456
|
+
* @see {@link https://github.com/pancakeswap/infinity-core/blob/main/src/types/PoolKey.sol|infinity-core}
|
|
457
|
+
*/
|
|
458
|
+
export type EncodedPoolKey = {
|
|
459
|
+
currency0: Address;
|
|
460
|
+
currency1: Address;
|
|
461
|
+
hooks: Address;
|
|
462
|
+
poolManager: Address;
|
|
463
|
+
fee: number;
|
|
464
|
+
parameters: Bytes32;
|
|
465
|
+
};
|
|
466
|
+
export type CLPositionConfig = {
|
|
467
|
+
poolKey: PoolKey<'CL'>;
|
|
468
|
+
tickLower: number;
|
|
469
|
+
tickUpper: number;
|
|
470
|
+
};
|
|
471
|
+
export type EncodedCLPositionConfig = {
|
|
472
|
+
poolKey: Prettify<Omit<PoolKey<'CL'>, 'parameters'> & {
|
|
473
|
+
parameters: Bytes32;
|
|
474
|
+
}>;
|
|
475
|
+
tickLower: number;
|
|
476
|
+
tickUpper: number;
|
|
477
|
+
};
|
|
478
|
+
export type BinPool = {
|
|
479
|
+
poolType: 'Bin';
|
|
480
|
+
token0: Currency;
|
|
481
|
+
token1: Currency;
|
|
482
|
+
fee: number;
|
|
483
|
+
protocolFee: number;
|
|
484
|
+
dynamic: boolean;
|
|
485
|
+
activeId: number;
|
|
486
|
+
binStep: number;
|
|
487
|
+
hooksRegistration?: HooksRegistration | undefined;
|
|
488
|
+
};
|
|
489
|
+
export type CLSlot0 = {
|
|
490
|
+
sqrtPriceX96: bigint;
|
|
491
|
+
tick: number;
|
|
492
|
+
protocolFee: number;
|
|
493
|
+
lpFee: number;
|
|
494
|
+
};
|
|
495
|
+
export type BinSlot0 = {
|
|
496
|
+
activeId: number;
|
|
497
|
+
protocolFee: number;
|
|
498
|
+
lpFee: number;
|
|
499
|
+
};
|
|
500
|
+
export type Slot0<TPoolType extends PoolType | unknown = unknown> = TPoolType extends 'CL' ? CLSlot0 : TPoolType extends 'Bin' ? BinSlot0 : unknown;
|
|
501
|
+
export type HookTag = 'CL' | 'Bin' | 'Dynamic' | (string & NonNullable<unknown>);
|
|
502
|
+
export declare enum HOOK_CATEGORY {
|
|
503
|
+
DynamicFees = "Dynamic Fees",
|
|
504
|
+
LiquidityIncentivisation = "Liquidity Incentivisation",
|
|
505
|
+
YieldOptimisation = "Yield Optimisation",
|
|
506
|
+
JIT = "JIT",
|
|
507
|
+
MEV = "MEV",
|
|
508
|
+
RWA = "RWA",
|
|
509
|
+
ALM = "ALM",
|
|
510
|
+
CrossChain = "Cross-Chain",
|
|
511
|
+
Leverage = "Leverage",
|
|
512
|
+
PricingCurve = "Pricing Curve",
|
|
513
|
+
OrderType = "Order Type",
|
|
514
|
+
Oracle = "Oracle",
|
|
515
|
+
Others = "Others",
|
|
516
|
+
BrevisDiscount = "Fee Discount (Brevis)",
|
|
517
|
+
PrimusDiscount = "Fee Discount (Primus)"
|
|
518
|
+
}
|
|
519
|
+
export interface HookData {
|
|
520
|
+
address: Address;
|
|
521
|
+
name?: string;
|
|
522
|
+
category?: HOOK_CATEGORY[];
|
|
523
|
+
description?: string;
|
|
524
|
+
poolType?: POOL_TYPE;
|
|
525
|
+
github?: string;
|
|
526
|
+
audit?: string;
|
|
527
|
+
learnMoreLink?: string;
|
|
528
|
+
creator?: string;
|
|
529
|
+
isVerified?: boolean;
|
|
530
|
+
isUpgradable?: boolean;
|
|
531
|
+
hooksRegistration?: HooksRegistration;
|
|
532
|
+
hookType?: HookType;
|
|
533
|
+
defaultFee?: number;
|
|
534
|
+
}
|
|
535
|
+
export declare enum HookType {
|
|
536
|
+
Universal = "Universal",
|
|
537
|
+
PerPool = "PerPool"
|
|
538
|
+
}
|
|
539
|
+
//# sourceMappingURL=pancakeswap-infinity.d.ts.map
|