@symmetry-hq/temp-v3-sdk 0.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/idl/idl.d.ts +8 -0
- package/dist/idl/idl.js +4958 -0
- package/dist/idl/types.d.ts +4955 -0
- package/dist/idl/types.js +2 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +60 -0
- package/dist/layouts/basket.d.ts +42 -0
- package/dist/layouts/basket.js +43 -0
- package/dist/layouts/config.d.ts +97 -0
- package/dist/layouts/config.js +102 -0
- package/dist/layouts/fraction.d.ts +6 -0
- package/dist/layouts/fraction.js +9 -0
- package/dist/layouts/oracle.d.ts +36 -0
- package/dist/layouts/oracle.js +37 -0
- package/dist/src/constants.d.ts +15 -0
- package/dist/src/constants.js +19 -0
- package/dist/src/idl/idl.d.ts +8 -0
- package/dist/src/idl/idl.js +4958 -0
- package/dist/src/idl/types.d.ts +4955 -0
- package/dist/src/idl/types.js +2 -0
- package/dist/src/index.d.ts +53 -0
- package/dist/src/index.js +199 -0
- package/dist/src/instructions/accounts.d.ts +27 -0
- package/dist/src/instructions/accounts.js +110 -0
- package/dist/src/instructions/auction.d.ts +7 -0
- package/dist/src/instructions/auction.js +43 -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/priceUpdate.d.ts +15 -0
- package/dist/src/instructions/automation/priceUpdate.js +47 -0
- package/dist/src/instructions/automation/rebalanceSwap.d.ts +10 -0
- package/dist/src/instructions/automation/rebalanceSwap.js +42 -0
- package/dist/src/instructions/basket.d.ts +120 -0
- package/dist/src/instructions/basket.js +622 -0
- package/dist/src/instructions/bounty.d.ts +18 -0
- package/dist/src/instructions/bounty.js +81 -0
- package/dist/src/instructions/fee.d.ts +8 -0
- package/dist/src/instructions/fee.js +46 -0
- package/dist/src/instructions/globalConfig.d.ts +11 -0
- package/dist/src/instructions/globalConfig.js +43 -0
- package/dist/src/instructions/luts.d.ts +33 -0
- package/dist/src/instructions/luts.js +91 -0
- package/dist/src/instructions/management/addBounty.d.ts +7 -0
- package/dist/src/instructions/management/addBounty.js +39 -0
- package/dist/src/instructions/management/admin.d.ts +9 -0
- package/dist/src/instructions/management/admin.js +43 -0
- package/dist/src/instructions/management/claimFees.d.ts +7 -0
- package/dist/src/instructions/management/claimFees.js +47 -0
- package/dist/src/instructions/management/createBasket.d.ts +22 -0
- package/dist/src/instructions/management/createBasket.js +101 -0
- package/dist/src/instructions/management/edit.d.ts +34 -0
- package/dist/src/instructions/management/edit.js +192 -0
- package/dist/src/instructions/management/luts.d.ts +29 -0
- package/dist/src/instructions/management/luts.js +88 -0
- package/dist/src/instructions/pda.d.ts +26 -0
- package/dist/src/instructions/pda.js +110 -0
- package/dist/src/instructions/price.d.ts +17 -0
- package/dist/src/instructions/price.js +47 -0
- package/dist/src/instructions/user/deposit.d.ts +32 -0
- package/dist/src/instructions/user/deposit.js +168 -0
- package/dist/src/instructions/user/withdraw.d.ts +16 -0
- package/dist/src/instructions/user/withdraw.js +82 -0
- package/dist/src/layouts/basket.d.ts +41 -0
- package/dist/src/layouts/basket.js +43 -0
- package/dist/src/layouts/config.d.ts +133 -0
- package/dist/src/layouts/config.js +137 -0
- package/dist/src/layouts/fraction.d.ts +6 -0
- package/dist/src/layouts/fraction.js +9 -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 +101 -0
- package/dist/src/layouts/intents/intent.js +113 -0
- package/dist/src/layouts/intents/rebalanceIntent.d.ts +56 -0
- package/dist/src/layouts/intents/rebalanceIntent.js +63 -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 +42 -0
- package/dist/src/layouts/oracle.js +43 -0
- package/dist/src/states/basket.d.ts +8 -0
- package/dist/src/states/basket.js +54 -0
- package/dist/src/states/intents/intent.d.ts +14 -0
- package/dist/src/states/intents/intent.js +90 -0
- package/dist/src/states/intents/rebalanceIntent.d.ts +8 -0
- package/dist/src/states/intents/rebalanceIntent.js +54 -0
- package/dist/src/states/oracles/clmm_oracle.d.ts +178 -0
- package/dist/src/states/oracles/clmm_oracle.js +546 -0
- package/dist/src/states/oracles/constants.d.ts +8 -0
- package/dist/src/states/oracles/constants.js +12 -0
- package/dist/src/states/oracles/oracle.d.ts +60 -0
- package/dist/src/states/oracles/oracle.js +237 -0
- package/dist/src/states/oracles/pythOracle.d.ts +39 -0
- package/dist/src/states/oracles/pythOracle.js +202 -0
- package/dist/src/states/oracles/pyth_oracle.d.ts +39 -0
- package/dist/src/states/oracles/pyth_oracle.js +202 -0
- package/dist/src/states/oracles/raydiumClmmOracle.d.ts +178 -0
- package/dist/src/states/oracles/raydiumClmmOracle.js +546 -0
- package/dist/src/states/oracles/raydiumCpmmOracle.d.ts +139 -0
- package/dist/src/states/oracles/raydiumCpmmOracle.js +420 -0
- package/dist/src/states/oracles/raydium_cpmm_oracle.d.ts +139 -0
- package/dist/src/states/oracles/raydium_cpmm_oracle.js +420 -0
- package/dist/src/states/oracles/switchboardOracle.d.ts +0 -0
- package/dist/src/states/oracles/switchboardOracle.js +1 -0
- package/dist/src/states/oracles/switchboard_oracle.d.ts +0 -0
- package/dist/src/states/oracles/switchboard_oracle.js +1 -0
- package/dist/src/txUtils.d.ts +26 -0
- package/dist/src/txUtils.js +183 -0
- package/dist/states/basket.d.ts +8 -0
- package/dist/states/basket.js +57 -0
- package/dist/test.d.ts +1 -0
- package/dist/test.js +39 -0
- package/package.json +30 -0
- package/src/constants.ts +24 -0
- package/src/index.ts +260 -0
- package/src/instructions/automation/auction.ts +55 -0
- package/src/instructions/automation/claimBounty.ts +69 -0
- package/src/instructions/automation/priceUpdate.ts +73 -0
- package/src/instructions/automation/rebalanceSwap.ts +60 -0
- package/src/instructions/management/addBounty.ts +56 -0
- package/src/instructions/management/admin.ts +65 -0
- package/src/instructions/management/claimFees.ts +59 -0
- package/src/instructions/management/createBasket.ts +148 -0
- package/src/instructions/management/edit.ts +255 -0
- package/src/instructions/management/luts.ts +134 -0
- package/src/instructions/pda.ts +160 -0
- package/src/instructions/user/deposit.ts +237 -0
- package/src/instructions/user/withdraw.ts +130 -0
- package/src/layouts/basket.ts +82 -0
- package/src/layouts/config.ts +301 -0
- package/src/layouts/fraction.ts +12 -0
- package/src/layouts/intents/bounty.ts +35 -0
- package/src/layouts/intents/intent.ts +204 -0
- package/src/layouts/intents/rebalanceIntent.ts +111 -0
- package/src/layouts/lookupTable.ts +14 -0
- package/src/layouts/oracle.ts +96 -0
- package/src/states/basket.ts +56 -0
- package/src/states/intents/intent.ts +107 -0
- package/src/states/intents/rebalanceIntent.ts +57 -0
- package/src/states/oracles/constants.ts +13 -0
- package/src/states/oracles/oracle.ts +260 -0
- package/src/states/oracles/pythOracle.ts +270 -0
- package/src/states/oracles/raydiumClmmOracle.ts +812 -0
- package/src/states/oracles/raydiumCpmmOracle.ts +614 -0
- package/src/states/oracles/switchboardOracle.ts +0 -0
- package/src/txUtils.ts +250 -0
- package/test.ts +30 -0
- package/tsconfig.json +101 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rebalanceSwapIx = rebalanceSwapIx;
|
|
4
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
5
|
+
const pda_1 = require("../pda");
|
|
6
|
+
const system_1 = require("@coral-xyz/anchor/dist/cjs/native/system");
|
|
7
|
+
const spl_token_1 = require("@solana/spl-token");
|
|
8
|
+
const anchor_1 = require("@coral-xyz/anchor");
|
|
9
|
+
const constants_1 = require("../../constants");
|
|
10
|
+
const REBALANCE_SWAP_DISCRIMINATOR = Buffer.from([101, 122, 61, 201, 21, 165, 177, 213]);
|
|
11
|
+
function rebalanceSwapIx(params) {
|
|
12
|
+
const { keeper, basket, mintFrom, mintTo, amount, side } = params;
|
|
13
|
+
let rebalanceIntent = (0, pda_1.getRebalanceIntentPda)(basket, keeper);
|
|
14
|
+
let keeperFromATA = (0, pda_1.getAta)(keeper, mintFrom);
|
|
15
|
+
let keeperToATA = (0, pda_1.getAta)(keeper, mintTo);
|
|
16
|
+
let basketFromATA = (0, pda_1.getAta)(basket, mintFrom);
|
|
17
|
+
let basketToATA = (0, pda_1.getAta)(basket, mintTo);
|
|
18
|
+
const keys = [
|
|
19
|
+
{ pubkey: params.keeper, isWritable: true, isSigner: true },
|
|
20
|
+
{ pubkey: params.basket, isWritable: true, isSigner: false },
|
|
21
|
+
{ pubkey: rebalanceIntent, isWritable: true, isSigner: false },
|
|
22
|
+
{ pubkey: params.mintFrom, isWritable: false, isSigner: false },
|
|
23
|
+
{ pubkey: params.mintTo, isWritable: false, isSigner: false },
|
|
24
|
+
{ pubkey: keeperFromATA, isWritable: true, isSigner: false },
|
|
25
|
+
{ pubkey: keeperToATA, isWritable: true, isSigner: false },
|
|
26
|
+
{ pubkey: basketFromATA, isWritable: true, isSigner: false },
|
|
27
|
+
{ pubkey: basketToATA, isWritable: true, isSigner: false },
|
|
28
|
+
{ pubkey: system_1.SYSTEM_PROGRAM_ID, isWritable: false, isSigner: false },
|
|
29
|
+
{ pubkey: spl_token_1.TOKEN_PROGRAM_ID, isWritable: false, isSigner: false },
|
|
30
|
+
{ pubkey: spl_token_1.TOKEN_2022_PROGRAM_ID, isWritable: false, isSigner: false },
|
|
31
|
+
{ pubkey: spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID, isWritable: false, isSigner: false },
|
|
32
|
+
];
|
|
33
|
+
const discriminator = REBALANCE_SWAP_DISCRIMINATOR;
|
|
34
|
+
const amountBuffer = Buffer.from(new anchor_1.BN(amount).toArray("le", 8));
|
|
35
|
+
const sideBuffer = Buffer.from([side]);
|
|
36
|
+
const data = Buffer.concat([discriminator, amountBuffer, sideBuffer]);
|
|
37
|
+
return new web3_js_1.TransactionInstruction({
|
|
38
|
+
keys,
|
|
39
|
+
programId: constants_1.BASKETS_V3_PROGRAM_ID,
|
|
40
|
+
data,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { BN } from '@coral-xyz/anchor';
|
|
2
|
+
import { PublicKey, TransactionInstruction } from '@solana/web3.js';
|
|
3
|
+
import { AuthorityBitmasks, EditData, HostFees, MetadataParams, TaskType } from '../layouts/intents/intent';
|
|
4
|
+
import { AutomationSettings, FeeSettings, LpSettings, ManagerSettings, ScheduleSettings } from '../layouts/config';
|
|
5
|
+
export declare const CREATE_BASKET_DISCRIMINATOR: Buffer;
|
|
6
|
+
export declare function createBasketIx(params: {
|
|
7
|
+
creator: PublicKey;
|
|
8
|
+
basketSeeds: Uint8Array;
|
|
9
|
+
metadataAccount: PublicKey;
|
|
10
|
+
lookupTable0: PublicKey;
|
|
11
|
+
lookupTable1: PublicKey;
|
|
12
|
+
slot: BN;
|
|
13
|
+
host: PublicKey;
|
|
14
|
+
startPrice: {
|
|
15
|
+
numerator: BN;
|
|
16
|
+
exponent: BN;
|
|
17
|
+
};
|
|
18
|
+
hostFees: HostFees;
|
|
19
|
+
metadataParams: MetadataParams;
|
|
20
|
+
metadataModificationDelay: BN;
|
|
21
|
+
}): TransactionInstruction;
|
|
22
|
+
export declare const CREATE_BASKET_STATE_ACCOUNT_DISCRIMINATOR: Buffer;
|
|
23
|
+
export declare function createBasketStateAccountIx(params: {
|
|
24
|
+
creator: PublicKey;
|
|
25
|
+
basketSeeds: Uint8Array;
|
|
26
|
+
}): TransactionInstruction;
|
|
27
|
+
export declare function depositStateIx(params: {
|
|
28
|
+
buyer: PublicKey;
|
|
29
|
+
basket: PublicKey;
|
|
30
|
+
bountyMint: PublicKey;
|
|
31
|
+
rebalanceIntentRentPayer: PublicKey;
|
|
32
|
+
rebalanceSlippageBps: number;
|
|
33
|
+
executionStartTime: BN;
|
|
34
|
+
}): TransactionInstruction;
|
|
35
|
+
export declare const EDIT_BASKET_INTENT_DISCRIMINATOR: Buffer;
|
|
36
|
+
export declare function createEditBasketIntentIx(params: {
|
|
37
|
+
manager: PublicKey;
|
|
38
|
+
basket: PublicKey;
|
|
39
|
+
bountyMint: PublicKey;
|
|
40
|
+
editType: TaskType;
|
|
41
|
+
editData: EditData;
|
|
42
|
+
useBounty: number;
|
|
43
|
+
}): TransactionInstruction;
|
|
44
|
+
export declare const CREATE_WITHDRAW_STATE_DISCRIMINATOR: Buffer;
|
|
45
|
+
export declare function createWithdrawStateIx(params: {
|
|
46
|
+
seller: PublicKey;
|
|
47
|
+
basket: PublicKey;
|
|
48
|
+
withdrawAmount: BN;
|
|
49
|
+
rebalanceSlippageBps: number;
|
|
50
|
+
executionStartTime: BN;
|
|
51
|
+
bountyMint: PublicKey;
|
|
52
|
+
}): TransactionInstruction;
|
|
53
|
+
export declare const DEPOSIT_TOKENS_DISCRIMINATOR: Buffer;
|
|
54
|
+
export declare function depositTokensIx(params: {
|
|
55
|
+
owner: PublicKey;
|
|
56
|
+
basket: PublicKey;
|
|
57
|
+
contributionAmounts: BN[];
|
|
58
|
+
tokenMints: PublicKey[];
|
|
59
|
+
}): TransactionInstruction;
|
|
60
|
+
export declare const EDIT_BASKET_DISCRIMINATOR: Buffer;
|
|
61
|
+
export declare function editBasketIx(params: {
|
|
62
|
+
keeper: PublicKey;
|
|
63
|
+
basket: PublicKey;
|
|
64
|
+
intent: PublicKey;
|
|
65
|
+
bountyMint: PublicKey;
|
|
66
|
+
manager: PublicKey;
|
|
67
|
+
editType: TaskType;
|
|
68
|
+
metadataAccount: PublicKey;
|
|
69
|
+
}): TransactionInstruction;
|
|
70
|
+
export declare const EDIT_PRIVATE_BASKET_SETTINGS_DISCRIMINATOR: Buffer;
|
|
71
|
+
export declare function editPrivateBasketSettingsIx(params: {
|
|
72
|
+
creator: PublicKey;
|
|
73
|
+
basket: PublicKey;
|
|
74
|
+
basketType: number;
|
|
75
|
+
scheduleBytes: ScheduleSettings;
|
|
76
|
+
feeSettingsBytes: FeeSettings;
|
|
77
|
+
managerSettingsBytes: ManagerSettings;
|
|
78
|
+
automationSettingsBytes: AutomationSettings;
|
|
79
|
+
lpSettingsBytes: LpSettings;
|
|
80
|
+
authorityBitmasks: AuthorityBitmasks;
|
|
81
|
+
metadataParams: MetadataParams;
|
|
82
|
+
metadataModificationDelay: BN;
|
|
83
|
+
}): TransactionInstruction;
|
|
84
|
+
export declare const LOCK_DEPOSITS_DISCRIMINATOR: Buffer;
|
|
85
|
+
export declare function lockDepositsIx(params: {
|
|
86
|
+
owner: PublicKey;
|
|
87
|
+
}): TransactionInstruction;
|
|
88
|
+
export declare const MINT_BASKET_DISCRIMINATOR: Buffer;
|
|
89
|
+
export declare function mintBasketIx(params: {
|
|
90
|
+
keeper: PublicKey;
|
|
91
|
+
basket: PublicKey;
|
|
92
|
+
buyer: PublicKey;
|
|
93
|
+
}): TransactionInstruction;
|
|
94
|
+
export declare const REBALANCE_SWAP_DISCRIMINATOR: Buffer;
|
|
95
|
+
export declare function rebalanceSwapIx(params: {
|
|
96
|
+
keeper: PublicKey;
|
|
97
|
+
basket: PublicKey;
|
|
98
|
+
mintFrom: PublicKey;
|
|
99
|
+
mintTo: PublicKey;
|
|
100
|
+
amount: BN;
|
|
101
|
+
side: number;
|
|
102
|
+
}): TransactionInstruction;
|
|
103
|
+
export declare const REDEEM_TOKENS_DISCRIMINATOR: Buffer;
|
|
104
|
+
export declare function redeemTokensIx(params: {
|
|
105
|
+
keeper: PublicKey;
|
|
106
|
+
basket: PublicKey;
|
|
107
|
+
owner: PublicKey;
|
|
108
|
+
tokenMints: PublicKey[];
|
|
109
|
+
}): TransactionInstruction;
|
|
110
|
+
export declare const RESIZE_BASKET_STATE_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
|
|
111
|
+
export declare function resizeBasketStateIx(params: {
|
|
112
|
+
basketSeeds: Uint8Array;
|
|
113
|
+
}): TransactionInstruction;
|
|
114
|
+
export declare const CREATE_USER_REBALANCE_INTENT_ACCOUNT: Buffer;
|
|
115
|
+
export declare function createUserRebalanceIntentIx(params: {
|
|
116
|
+
user: PublicKey;
|
|
117
|
+
basket: PublicKey;
|
|
118
|
+
}): TransactionInstruction;
|
|
119
|
+
export declare const RESIZE_REBALANCE_INTENT_HANDLER: Buffer;
|
|
120
|
+
export declare function resizeRebalanceIntentIx(rebalanceIntent: PublicKey): TransactionInstruction;
|