@symmetry-hq/sdk 1.0.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/dist/src/constants.d.ts +23 -0
- package/dist/src/constants.js +38 -0
- package/dist/src/index.d.ts +804 -0
- package/dist/src/index.js +2097 -0
- package/dist/src/instructions/automation/auction.d.ts +6 -0
- package/dist/src/instructions/automation/auction.js +40 -0
- package/dist/src/instructions/automation/claimBounty.d.ts +12 -0
- package/dist/src/instructions/automation/claimBounty.js +44 -0
- package/dist/src/instructions/automation/flashSwap.d.ts +21 -0
- package/dist/src/instructions/automation/flashSwap.js +74 -0
- package/dist/src/instructions/automation/priceUpdate.d.ts +19 -0
- package/dist/src/instructions/automation/priceUpdate.js +89 -0
- package/dist/src/instructions/automation/rebalanceIntent.d.ts +32 -0
- package/dist/src/instructions/automation/rebalanceIntent.js +117 -0
- package/dist/src/instructions/automation/rebalanceSwap.d.ts +11 -0
- package/dist/src/instructions/automation/rebalanceSwap.js +42 -0
- package/dist/src/instructions/management/addBounty.d.ts +7 -0
- package/dist/src/instructions/management/addBounty.js +41 -0
- package/dist/src/instructions/management/admin.d.ts +9 -0
- package/dist/src/instructions/management/admin.js +53 -0
- package/dist/src/instructions/management/claimFees.d.ts +15 -0
- package/dist/src/instructions/management/claimFees.js +95 -0
- package/dist/src/instructions/management/createBasket.d.ts +21 -0
- package/dist/src/instructions/management/createBasket.js +98 -0
- package/dist/src/instructions/management/edit.d.ts +51 -0
- package/dist/src/instructions/management/edit.js +477 -0
- package/dist/src/instructions/management/luts.d.ts +30 -0
- package/dist/src/instructions/management/luts.js +99 -0
- package/dist/src/instructions/pda.d.ts +25 -0
- package/dist/src/instructions/pda.js +128 -0
- package/dist/src/instructions/user/deposit.d.ts +20 -0
- package/dist/src/instructions/user/deposit.js +100 -0
- package/dist/src/instructions/user/withdraw.d.ts +8 -0
- package/dist/src/instructions/user/withdraw.js +36 -0
- package/dist/src/jup.d.ts +49 -0
- package/dist/src/jup.js +80 -0
- package/dist/src/keeperMonitor.d.ts +52 -0
- package/dist/src/keeperMonitor.js +624 -0
- package/dist/src/layouts/basket.d.ts +191 -0
- package/dist/src/layouts/basket.js +51 -0
- package/dist/src/layouts/config.d.ts +281 -0
- package/dist/src/layouts/config.js +237 -0
- package/dist/src/layouts/fraction.d.ts +20 -0
- package/dist/src/layouts/fraction.js +164 -0
- package/dist/src/layouts/intents/bounty.d.ts +18 -0
- package/dist/src/layouts/intents/bounty.js +19 -0
- package/dist/src/layouts/intents/intent.d.ts +209 -0
- package/dist/src/layouts/intents/intent.js +97 -0
- package/dist/src/layouts/intents/rebalanceIntent.d.ts +212 -0
- package/dist/src/layouts/intents/rebalanceIntent.js +94 -0
- package/dist/src/layouts/lookupTable.d.ts +7 -0
- package/dist/src/layouts/lookupTable.js +10 -0
- package/dist/src/layouts/oracle.d.ts +63 -0
- package/dist/src/layouts/oracle.js +96 -0
- package/dist/src/states/basket.d.ts +14 -0
- package/dist/src/states/basket.js +479 -0
- package/dist/src/states/config.d.ts +3 -0
- package/dist/src/states/config.js +71 -0
- package/dist/src/states/intents/intent.d.ts +10 -0
- package/dist/src/states/intents/intent.js +316 -0
- package/dist/src/states/intents/rebalanceIntent.d.ts +42 -0
- package/dist/src/states/intents/rebalanceIntent.js +680 -0
- package/dist/src/states/oracles/constants.d.ts +9 -0
- package/dist/src/states/oracles/constants.js +15 -0
- package/dist/src/states/oracles/oracle.d.ts +24 -0
- package/dist/src/states/oracles/oracle.js +168 -0
- package/dist/src/states/oracles/pythOracle.d.ts +132 -0
- package/dist/src/states/oracles/pythOracle.js +609 -0
- package/dist/src/states/oracles/raydiumClmmOracle.d.ts +184 -0
- package/dist/src/states/oracles/raydiumClmmOracle.js +843 -0
- package/dist/src/states/oracles/raydiumCpmmOracle.d.ts +120 -0
- package/dist/src/states/oracles/raydiumCpmmOracle.js +540 -0
- package/dist/src/states/oracles/switchboardOracle.d.ts +0 -0
- package/dist/src/states/oracles/switchboardOracle.js +1 -0
- package/dist/src/states/withdrawBasketFees.d.ts +10 -0
- package/dist/src/states/withdrawBasketFees.js +154 -0
- package/dist/src/txUtils.d.ts +65 -0
- package/dist/src/txUtils.js +306 -0
- package/dist/test.d.ts +1 -0
- package/dist/test.js +561 -0
- package/package.json +31 -0
- package/src/constants.ts +40 -0
- package/src/index.ts +2431 -0
- package/src/instructions/automation/auction.ts +55 -0
- package/src/instructions/automation/claimBounty.ts +69 -0
- package/src/instructions/automation/flashSwap.ts +104 -0
- package/src/instructions/automation/priceUpdate.ts +117 -0
- package/src/instructions/automation/rebalanceIntent.ts +181 -0
- package/src/instructions/management/addBounty.ts +55 -0
- package/src/instructions/management/admin.ts +72 -0
- package/src/instructions/management/claimFees.ts +129 -0
- package/src/instructions/management/createBasket.ts +138 -0
- package/src/instructions/management/edit.ts +602 -0
- package/src/instructions/management/luts.ts +157 -0
- package/src/instructions/pda.ts +151 -0
- package/src/instructions/user/deposit.ts +143 -0
- package/src/instructions/user/withdraw.ts +53 -0
- package/src/jup.ts +113 -0
- package/src/keeperMonitor.ts +585 -0
- package/src/layouts/basket.ts +233 -0
- package/src/layouts/config.ts +576 -0
- package/src/layouts/fraction.ts +164 -0
- package/src/layouts/intents/bounty.ts +35 -0
- package/src/layouts/intents/intent.ts +324 -0
- package/src/layouts/intents/rebalanceIntent.ts +306 -0
- package/src/layouts/lookupTable.ts +14 -0
- package/src/layouts/oracle.ts +157 -0
- package/src/states/basket.ts +527 -0
- package/src/states/config.ts +62 -0
- package/src/states/intents/intent.ts +311 -0
- package/src/states/intents/rebalanceIntent.ts +751 -0
- package/src/states/oracles/constants.ts +13 -0
- package/src/states/oracles/oracle.ts +212 -0
- package/src/states/oracles/pythOracle.ts +874 -0
- package/src/states/oracles/raydiumClmmOracle.ts +1193 -0
- package/src/states/oracles/raydiumCpmmOracle.ts +784 -0
- package/src/states/oracles/switchboardOracle.ts +0 -0
- package/src/states/withdrawBasketFees.ts +160 -0
- package/src/txUtils.ts +424 -0
- package/test.ts +609 -0
- package/tsconfig.json +101 -0
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import Decimal from 'decimal.js';
|
|
2
|
+
import BN from 'bn.js';
|
|
3
|
+
import { AccountInfo, PublicKey } from '@solana/web3.js';
|
|
4
|
+
import { OracleSettings } from '../../layouts/oracle';
|
|
5
|
+
import { OraclePrice } from './oracle';
|
|
6
|
+
export declare function i32ToBytes(num: number): Uint8Array;
|
|
7
|
+
export declare function getTickArrayStartIndexByTick(tickIndex: number, tickSpacing: number): number;
|
|
8
|
+
export declare function getNextTickArrayStartIndex(lastStart: number, tickSpacing: number, zeroForOne: boolean): number;
|
|
9
|
+
export declare function getPdaTickArrayAddress(poolId: PublicKey, startIndex: number): PublicKey;
|
|
10
|
+
declare class Observation {
|
|
11
|
+
blockTimestamp: BN;
|
|
12
|
+
tickCumulative: BN;
|
|
13
|
+
padding: BN[];
|
|
14
|
+
constructor(params: {
|
|
15
|
+
blockTimestamp: BN;
|
|
16
|
+
tickCumulative: BN;
|
|
17
|
+
padding: BN[];
|
|
18
|
+
});
|
|
19
|
+
static decode(data: Buffer, offset?: number): [Observation, number];
|
|
20
|
+
sub(other: Observation): Observation;
|
|
21
|
+
add(other: Observation): Observation;
|
|
22
|
+
getWeightedObservation(time: BN): Observation;
|
|
23
|
+
adjustToTimestamp(targetTimestamp: BN, observationPrev: Observation): Observation;
|
|
24
|
+
}
|
|
25
|
+
declare class RewardInfo {
|
|
26
|
+
rewardState: number;
|
|
27
|
+
openTime: BN;
|
|
28
|
+
endTime: BN;
|
|
29
|
+
lastUpdateTime: BN;
|
|
30
|
+
emissionsPerSecondX64: BN;
|
|
31
|
+
rewardTotalEmissioned: BN;
|
|
32
|
+
rewardClaimed: BN;
|
|
33
|
+
tokenMint: PublicKey;
|
|
34
|
+
tokenVault: PublicKey;
|
|
35
|
+
authority: PublicKey;
|
|
36
|
+
rewardGrowthGlobalX64: BN;
|
|
37
|
+
constructor(params: {
|
|
38
|
+
rewardState: number;
|
|
39
|
+
openTime: BN;
|
|
40
|
+
endTime: BN;
|
|
41
|
+
lastUpdateTime: BN;
|
|
42
|
+
emissionsPerSecondX64: BN;
|
|
43
|
+
rewardTotalEmissioned: BN;
|
|
44
|
+
rewardClaimed: BN;
|
|
45
|
+
tokenMint: PublicKey;
|
|
46
|
+
tokenVault: PublicKey;
|
|
47
|
+
authority: PublicKey;
|
|
48
|
+
rewardGrowthGlobalX64: BN;
|
|
49
|
+
});
|
|
50
|
+
static decode(data: Buffer, offset?: number): [RewardInfo, number];
|
|
51
|
+
}
|
|
52
|
+
export declare class PoolState {
|
|
53
|
+
bump: number[];
|
|
54
|
+
ammConfig: PublicKey;
|
|
55
|
+
owner: PublicKey;
|
|
56
|
+
tokenMint0: PublicKey;
|
|
57
|
+
tokenMint1: PublicKey;
|
|
58
|
+
tokenVault0: PublicKey;
|
|
59
|
+
tokenVault1: PublicKey;
|
|
60
|
+
observationKey: PublicKey;
|
|
61
|
+
mintDecimals0: number;
|
|
62
|
+
mintDecimals1: number;
|
|
63
|
+
tickSpacing: number;
|
|
64
|
+
liquidity: BN;
|
|
65
|
+
sqrtPriceX64: BN;
|
|
66
|
+
tickCurrent: number;
|
|
67
|
+
padding3: number;
|
|
68
|
+
padding4: number;
|
|
69
|
+
feeGrowthGlobal0X64: BN;
|
|
70
|
+
feeGrowthGlobal1X64: BN;
|
|
71
|
+
protocolFeesToken0: BN;
|
|
72
|
+
protocolFeesToken1: BN;
|
|
73
|
+
swapInAmountToken0: BN;
|
|
74
|
+
swapOutAmountToken1: BN;
|
|
75
|
+
swapInAmountToken1: BN;
|
|
76
|
+
swapOutAmountToken0: BN;
|
|
77
|
+
status: number;
|
|
78
|
+
padding: number[];
|
|
79
|
+
rewardInfos: RewardInfo[];
|
|
80
|
+
tickArrayBitmap: BN[];
|
|
81
|
+
totalFeesToken0: BN;
|
|
82
|
+
totalFeesClaimedToken0: BN;
|
|
83
|
+
totalFeesToken1: BN;
|
|
84
|
+
totalFeesClaimedToken1: BN;
|
|
85
|
+
fundFeesToken0: BN;
|
|
86
|
+
fundFeesToken1: BN;
|
|
87
|
+
openTime: BN;
|
|
88
|
+
recentEpoch: BN;
|
|
89
|
+
padding1: BN[];
|
|
90
|
+
padding2: BN[];
|
|
91
|
+
constructor(params: {
|
|
92
|
+
bump: number[];
|
|
93
|
+
ammConfig: PublicKey;
|
|
94
|
+
owner: PublicKey;
|
|
95
|
+
tokenMint0: PublicKey;
|
|
96
|
+
tokenMint1: PublicKey;
|
|
97
|
+
tokenVault0: PublicKey;
|
|
98
|
+
tokenVault1: PublicKey;
|
|
99
|
+
observationKey: PublicKey;
|
|
100
|
+
mintDecimals0: number;
|
|
101
|
+
mintDecimals1: number;
|
|
102
|
+
tickSpacing: number;
|
|
103
|
+
liquidity: BN;
|
|
104
|
+
sqrtPriceX64: BN;
|
|
105
|
+
tickCurrent: number;
|
|
106
|
+
padding3: number;
|
|
107
|
+
padding4: number;
|
|
108
|
+
feeGrowthGlobal0X64: BN;
|
|
109
|
+
feeGrowthGlobal1X64: BN;
|
|
110
|
+
protocolFeesToken0: BN;
|
|
111
|
+
protocolFeesToken1: BN;
|
|
112
|
+
swapInAmountToken0: BN;
|
|
113
|
+
swapOutAmountToken1: BN;
|
|
114
|
+
swapInAmountToken1: BN;
|
|
115
|
+
swapOutAmountToken0: BN;
|
|
116
|
+
status: number;
|
|
117
|
+
padding: number[];
|
|
118
|
+
rewardInfos: RewardInfo[];
|
|
119
|
+
tickArrayBitmap: BN[];
|
|
120
|
+
totalFeesToken0: BN;
|
|
121
|
+
totalFeesClaimedToken0: BN;
|
|
122
|
+
totalFeesToken1: BN;
|
|
123
|
+
totalFeesClaimedToken1: BN;
|
|
124
|
+
fundFeesToken0: BN;
|
|
125
|
+
fundFeesToken1: BN;
|
|
126
|
+
openTime: BN;
|
|
127
|
+
recentEpoch: BN;
|
|
128
|
+
padding1: BN[];
|
|
129
|
+
padding2: BN[];
|
|
130
|
+
});
|
|
131
|
+
static decode(data: Buffer, offset?: number): [PoolState, number];
|
|
132
|
+
}
|
|
133
|
+
declare class TickState {
|
|
134
|
+
tick: number;
|
|
135
|
+
liquidityNet: BN;
|
|
136
|
+
liquidityGross: BN;
|
|
137
|
+
feeGrowthOutside0X64: BN;
|
|
138
|
+
feeGrowthOutside1X64: BN;
|
|
139
|
+
rewardGrowthsOutsideX64: BN[];
|
|
140
|
+
padding: number[];
|
|
141
|
+
constructor(params: {
|
|
142
|
+
tick: number;
|
|
143
|
+
liquidityNet: BN;
|
|
144
|
+
liquidityGross: BN;
|
|
145
|
+
feeGrowthOutside0X64: BN;
|
|
146
|
+
feeGrowthOutside1X64: BN;
|
|
147
|
+
rewardGrowthsOutsideX64: BN[];
|
|
148
|
+
padding: number[];
|
|
149
|
+
});
|
|
150
|
+
static decode(data: Buffer, offset?: number): [TickState, number];
|
|
151
|
+
}
|
|
152
|
+
declare class TickArrayState {
|
|
153
|
+
poolId: PublicKey;
|
|
154
|
+
startTickIndex: number;
|
|
155
|
+
ticks: TickState[];
|
|
156
|
+
initializedTickCount: number;
|
|
157
|
+
recentEpoch: BN;
|
|
158
|
+
padding: number[];
|
|
159
|
+
constructor(params: {
|
|
160
|
+
poolId: PublicKey;
|
|
161
|
+
startTickIndex: number;
|
|
162
|
+
ticks: TickState[];
|
|
163
|
+
initializedTickCount: number;
|
|
164
|
+
recentEpoch: BN;
|
|
165
|
+
padding: number[];
|
|
166
|
+
});
|
|
167
|
+
static decode(data: Buffer, offset?: number): [TickArrayState, number];
|
|
168
|
+
}
|
|
169
|
+
export declare class RaydiumCLMMOracle {
|
|
170
|
+
static deriveObservationKey(poolId: PublicKey): [PublicKey, number];
|
|
171
|
+
static getObservationAtIndex(observations: Observation[], index: number): Observation;
|
|
172
|
+
static getObservationAtTimestamp(timestamp: BN, observations: Observation[], startIndex: number): Observation;
|
|
173
|
+
static getDeltaObservations(currentTime: BN, observations: Observation[], observationIndex: number, primarySeconds: BN, secondarySeconds: BN): Observation[];
|
|
174
|
+
static getSqrtPriceX64FromTick(tick: number): BN;
|
|
175
|
+
static sqrtPriceX64ToPrice(sqrtPriceX64: BN, decimalsA: number, decimalsB: number): Decimal;
|
|
176
|
+
static x64ToDecimal(num: BN, decimalPlaces?: number): Decimal;
|
|
177
|
+
static getSpotPrice(tickCurrent: number, mintDecimals0: number, mintDecimals1: number): Decimal;
|
|
178
|
+
static getTwapPrimary(observations: Observation[], observationIndex: number, primarySeconds: BN, secondarySeconds: BN, mintDecimals0: number, mintDecimals1: number, currentTime: BN): Decimal;
|
|
179
|
+
static getTwapSecondary(observations: Observation[], observationIndex: number, primarySeconds: BN, secondarySeconds: BN, mintDecimals0: number, mintDecimals1: number, currentTime: BN): Decimal;
|
|
180
|
+
static getConfidence(observations: Observation[], observationIndex: number, primarySeconds: BN, secondarySeconds: BN, tickCurrent: number, mintDecimals0: number, mintDecimals1: number, currentTime: BN): Decimal;
|
|
181
|
+
static calculateMaxPriceImpactForMinLiquidity(oracleParams: OracleSettings, poolState: PoolState, prevTickArray: TickArrayState, currentTickArray: TickArrayState, nextTickArray: TickArrayState, solPrice: OraclePrice, usdPrice: OraclePrice): Decimal;
|
|
182
|
+
static fetch(oracleParams: OracleSettings, accountInfos: AccountInfo<Buffer>[], solPrice: OraclePrice, usdPrice: OraclePrice): OraclePrice;
|
|
183
|
+
}
|
|
184
|
+
export {};
|