@symmetry-hq/temp-v3-sdk 0.0.1 → 0.0.3
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/index.d.ts +8 -5
- package/dist/src/index.js +8 -8
- package/dist/src/instructions/automation/rebalanceSwap.js +2 -2
- package/dist/src/instructions/management/addBounty.js +1 -2
- package/dist/src/instructions/management/admin.js +1 -2
- package/dist/src/instructions/management/edit.js +3 -3
- package/dist/src/instructions/management/luts.js +4 -5
- package/dist/src/instructions/user/deposit.js +5 -5
- package/dist/src/instructions/user/withdraw.js +3 -3
- package/dist/src/states/basket.d.ts +1 -0
- package/dist/src/states/basket.js +7 -2
- package/dist/src/states/oracles/pythOracle.d.ts +3 -3
- package/dist/src/txUtils.d.ts +13 -2
- package/dist/src/txUtils.js +5 -7
- package/dist/test.js +3 -3
- package/package.json +3 -3
- package/src/index.ts +19 -13
- package/src/instructions/automation/rebalanceSwap.ts +2 -2
- package/src/instructions/management/addBounty.ts +1 -2
- package/src/instructions/management/admin.ts +1 -2
- package/src/instructions/management/edit.ts +3 -3
- package/src/instructions/management/luts.ts +4 -5
- package/src/instructions/user/deposit.ts +5 -5
- package/src/instructions/user/withdraw.ts +3 -3
- package/src/states/basket.ts +7 -2
- package/src/states/oracles/pythOracle.ts +3 -4
- package/src/txUtils.ts +18 -11
- package/test.ts +3 -3
- package/dist/idl/idl.d.ts +0 -8
- package/dist/idl/idl.js +0 -4958
- package/dist/idl/types.d.ts +0 -4955
- package/dist/idl/types.js +0 -2
- package/dist/index.d.ts +0 -24
- package/dist/index.js +0 -60
- package/dist/layouts/basket.d.ts +0 -42
- package/dist/layouts/basket.js +0 -43
- package/dist/layouts/config.d.ts +0 -97
- package/dist/layouts/config.js +0 -102
- package/dist/layouts/fraction.d.ts +0 -6
- package/dist/layouts/fraction.js +0 -9
- package/dist/layouts/oracle.d.ts +0 -36
- package/dist/layouts/oracle.js +0 -37
- package/dist/src/idl/idl.d.ts +0 -8
- package/dist/src/idl/idl.js +0 -4958
- package/dist/src/idl/types.d.ts +0 -4955
- package/dist/src/idl/types.js +0 -2
- package/dist/src/instructions/accounts.d.ts +0 -27
- package/dist/src/instructions/accounts.js +0 -110
- package/dist/src/instructions/auction.d.ts +0 -7
- package/dist/src/instructions/auction.js +0 -43
- package/dist/src/instructions/basket.d.ts +0 -120
- package/dist/src/instructions/basket.js +0 -622
- package/dist/src/instructions/bounty.d.ts +0 -18
- package/dist/src/instructions/bounty.js +0 -81
- package/dist/src/instructions/fee.d.ts +0 -8
- package/dist/src/instructions/fee.js +0 -46
- package/dist/src/instructions/globalConfig.d.ts +0 -11
- package/dist/src/instructions/globalConfig.js +0 -43
- package/dist/src/instructions/luts.d.ts +0 -33
- package/dist/src/instructions/luts.js +0 -91
- package/dist/src/instructions/price.d.ts +0 -17
- package/dist/src/instructions/price.js +0 -47
- package/dist/src/states/oracles/clmm_oracle.d.ts +0 -178
- package/dist/src/states/oracles/clmm_oracle.js +0 -546
- package/dist/src/states/oracles/pyth_oracle.d.ts +0 -39
- package/dist/src/states/oracles/pyth_oracle.js +0 -202
- package/dist/src/states/oracles/raydium_cpmm_oracle.d.ts +0 -139
- package/dist/src/states/oracles/raydium_cpmm_oracle.js +0 -420
- package/dist/src/states/oracles/switchboard_oracle.d.ts +0 -0
- package/dist/src/states/oracles/switchboard_oracle.js +0 -1
- package/dist/states/basket.d.ts +0 -8
- package/dist/states/basket.js +0 -57
package/dist/src/index.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { BN
|
|
1
|
+
import { BN } from '@coral-xyz/anchor';
|
|
2
2
|
import { Connection, PublicKey, TransactionSignature } from '@solana/web3.js';
|
|
3
3
|
import { Basket } from './layouts/basket';
|
|
4
4
|
import { Fraction } from './layouts/fraction';
|
|
5
5
|
import { EditData, HostFees, Intent, MetadataParams, TaskType } from './layouts/intents/intent';
|
|
6
6
|
import { RebalanceIntent } from './layouts/intents/rebalanceIntent';
|
|
7
|
-
import {
|
|
7
|
+
import { BasketFilter } from './states/basket';
|
|
8
|
+
import { IntentFilter } from './states/intents/intent';
|
|
9
|
+
import { RebalanceIntentFilter } from './states/intents/rebalanceIntent';
|
|
10
|
+
import { VersionedTxs, Wallet } from './txUtils';
|
|
8
11
|
export declare const COMPUTE_UNITS = 1000000;
|
|
9
12
|
export declare const PRIORITY_FEE = 100000;
|
|
10
13
|
export declare const JUPITER_API_KEY = "https://quote-api.jup.ag/v6/";
|
|
@@ -22,9 +25,9 @@ export declare class BasketsSdk {
|
|
|
22
25
|
getBasket(params: {
|
|
23
26
|
basket: PublicKey;
|
|
24
27
|
}): Promise<Basket>;
|
|
25
|
-
fetchAllBaskets(): Promise<Basket[]>;
|
|
26
|
-
fetchAllIntents(): Promise<Intent[]>;
|
|
27
|
-
fetchAllRebalanceIntents(): Promise<RebalanceIntent[]>;
|
|
28
|
+
fetchAllBaskets(filters: BasketFilter[]): Promise<Basket[]>;
|
|
29
|
+
fetchAllIntents(filters: IntentFilter[]): Promise<Intent[]>;
|
|
30
|
+
fetchAllRebalanceIntents(filters: RebalanceIntentFilter[]): Promise<RebalanceIntent[]>;
|
|
28
31
|
createBasketTx(params: {
|
|
29
32
|
creator: PublicKey;
|
|
30
33
|
host: PublicKey;
|
package/dist/src/index.js
CHANGED
|
@@ -46,21 +46,21 @@ class BasketsSdk {
|
|
|
46
46
|
return basketState;
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
|
-
fetchAllBaskets() {
|
|
49
|
+
fetchAllBaskets(filters) {
|
|
50
50
|
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
-
const baskets = yield (0, basket_1.fetchBaskets)(this.sdkParams.connection,
|
|
51
|
+
const baskets = yield (0, basket_1.fetchBaskets)(this.sdkParams.connection, filters);
|
|
52
52
|
return baskets;
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
|
-
fetchAllIntents() {
|
|
55
|
+
fetchAllIntents(filters) {
|
|
56
56
|
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
-
const intents = yield (0, intent_1.fetchIntents)(this.sdkParams.connection,
|
|
57
|
+
const intents = yield (0, intent_1.fetchIntents)(this.sdkParams.connection, filters);
|
|
58
58
|
return intents;
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
|
-
fetchAllRebalanceIntents() {
|
|
61
|
+
fetchAllRebalanceIntents(filters) {
|
|
62
62
|
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
-
const rebalanceIntents = yield (0, rebalanceIntent_1.fetchRebalanceIntents)(this.sdkParams.connection,
|
|
63
|
+
const rebalanceIntents = yield (0, rebalanceIntent_1.fetchRebalanceIntents)(this.sdkParams.connection, filters);
|
|
64
64
|
return rebalanceIntents;
|
|
65
65
|
});
|
|
66
66
|
}
|
|
@@ -190,8 +190,8 @@ class BasketsSdk {
|
|
|
190
190
|
}
|
|
191
191
|
signAndSendVersionedTxs(params) {
|
|
192
192
|
return __awaiter(this, void 0, void 0, function* () {
|
|
193
|
-
|
|
194
|
-
vtxs
|
|
193
|
+
let { vtxs, wallet } = params;
|
|
194
|
+
vtxs = yield (0, txUtils_1.signedVersionedTxs)({ wallet, vtxs });
|
|
195
195
|
return yield (0, txUtils_1.sendV0Transactions)(this.sdkParams.connection, vtxs, false);
|
|
196
196
|
});
|
|
197
197
|
}
|
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.rebalanceSwapIx = rebalanceSwapIx;
|
|
4
4
|
const web3_js_1 = require("@solana/web3.js");
|
|
5
5
|
const pda_1 = require("../pda");
|
|
6
|
-
const system_1 = require("@coral-xyz/anchor/dist/cjs/native/system");
|
|
7
6
|
const spl_token_1 = require("@solana/spl-token");
|
|
8
7
|
const anchor_1 = require("@coral-xyz/anchor");
|
|
9
8
|
const constants_1 = require("../../constants");
|
|
9
|
+
const web3_js_2 = require("@solana/web3.js");
|
|
10
10
|
const REBALANCE_SWAP_DISCRIMINATOR = Buffer.from([101, 122, 61, 201, 21, 165, 177, 213]);
|
|
11
11
|
function rebalanceSwapIx(params) {
|
|
12
12
|
const { keeper, basket, mintFrom, mintTo, amount, side } = params;
|
|
@@ -25,7 +25,7 @@ function rebalanceSwapIx(params) {
|
|
|
25
25
|
{ pubkey: keeperToATA, isWritable: true, isSigner: false },
|
|
26
26
|
{ pubkey: basketFromATA, isWritable: true, isSigner: false },
|
|
27
27
|
{ pubkey: basketToATA, isWritable: true, isSigner: false },
|
|
28
|
-
{ pubkey:
|
|
28
|
+
{ pubkey: web3_js_2.SystemProgram.programId, isWritable: false, isSigner: false },
|
|
29
29
|
{ pubkey: spl_token_1.TOKEN_PROGRAM_ID, isWritable: false, isSigner: false },
|
|
30
30
|
{ pubkey: spl_token_1.TOKEN_2022_PROGRAM_ID, isWritable: false, isSigner: false },
|
|
31
31
|
{ pubkey: spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID, isWritable: false, isSigner: false },
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addBountyIx = addBountyIx;
|
|
4
4
|
const anchor_1 = require("@coral-xyz/anchor");
|
|
5
|
-
const system_1 = require("@coral-xyz/anchor/dist/cjs/native/system");
|
|
6
5
|
const spl_token_1 = require("@solana/spl-token");
|
|
7
6
|
const web3_js_1 = require("@solana/web3.js");
|
|
8
7
|
const constants_1 = require("../../constants");
|
|
@@ -26,7 +25,7 @@ function addBountyIx(params) {
|
|
|
26
25
|
{ pubkey: bountyVault, isSigner: false, isWritable: true },
|
|
27
26
|
{ pubkey: bountyVaultAta, isSigner: false, isWritable: true },
|
|
28
27
|
{ pubkey: globalConfig, isSigner: false, isWritable: false },
|
|
29
|
-
{ pubkey:
|
|
28
|
+
{ pubkey: web3_js_1.SystemProgram.programId, isSigner: false, isWritable: false },
|
|
30
29
|
{ pubkey: spl_token_1.TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
31
30
|
{ pubkey: spl_token_1.TOKEN_2022_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
32
31
|
{ pubkey: spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createGlobalConfigIx = createGlobalConfigIx;
|
|
4
4
|
exports.editGlobalConfigIx = editGlobalConfigIx;
|
|
5
|
-
const system_1 = require("@coral-xyz/anchor/dist/cjs/native/system");
|
|
6
5
|
const web3_js_1 = require("@solana/web3.js");
|
|
7
6
|
const constants_1 = require("../../constants");
|
|
8
7
|
const config_1 = require("../../layouts/config");
|
|
@@ -16,7 +15,7 @@ function createGlobalConfigIx(params) {
|
|
|
16
15
|
const keys = [
|
|
17
16
|
{ pubkey: admin, isSigner: true, isWritable: true },
|
|
18
17
|
{ pubkey: globalConfig, isSigner: false, isWritable: true },
|
|
19
|
-
{ pubkey:
|
|
18
|
+
{ pubkey: web3_js_1.SystemProgram.programId, isSigner: false, isWritable: false },
|
|
20
19
|
{ pubkey: web3_js_1.SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false },
|
|
21
20
|
];
|
|
22
21
|
return new web3_js_1.TransactionInstruction({
|
|
@@ -8,9 +8,9 @@ const web3_js_1 = require("@solana/web3.js");
|
|
|
8
8
|
const constants_1 = require("../../constants");
|
|
9
9
|
const pda_1 = require("../pda");
|
|
10
10
|
const spl_token_1 = require("@solana/spl-token");
|
|
11
|
-
const system_1 = require("@coral-xyz/anchor/dist/cjs/native/system");
|
|
12
11
|
const config_1 = require("../../layouts/config");
|
|
13
12
|
const anchor_1 = require("@coral-xyz/anchor");
|
|
13
|
+
const web3_js_2 = require("@solana/web3.js");
|
|
14
14
|
const EDIT_PRIVATE_BASKET_SETTINGS_DISCRIMINATOR = Buffer.from([202, 54, 138, 17, 3, 104, 128, 229]);
|
|
15
15
|
const CREATE_EDIT_BASKET_INTENT_DISCRIMINATOR = Buffer.from([82, 150, 58, 227, 153, 129, 20, 30]);
|
|
16
16
|
const EDIT_BASKET_DISCRIMINATOR = Buffer.from([156, 31, 4, 39, 248, 29, 55, 220]);
|
|
@@ -135,7 +135,7 @@ function createEditBasketIntentIx(params) {
|
|
|
135
135
|
{ pubkey: managerBountyATA, isSigner: false, isWritable: true },
|
|
136
136
|
{ pubkey: bountyVault, isSigner: false, isWritable: true },
|
|
137
137
|
{ pubkey: bountyVaultATA, isSigner: false, isWritable: true },
|
|
138
|
-
{ pubkey:
|
|
138
|
+
{ pubkey: web3_js_2.SystemProgram.programId, isSigner: false, isWritable: false },
|
|
139
139
|
{ pubkey: spl_token_1.TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
140
140
|
{ pubkey: spl_token_1.TOKEN_2022_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
141
141
|
{ pubkey: spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
@@ -167,7 +167,7 @@ function editBasketIx(params) {
|
|
|
167
167
|
{ pubkey: managerBountyATA, isSigner: false, isWritable: true },
|
|
168
168
|
{ pubkey: bountyVault, isSigner: false, isWritable: true },
|
|
169
169
|
{ pubkey: bountyVaultATA, isSigner: false, isWritable: true },
|
|
170
|
-
{ pubkey:
|
|
170
|
+
{ pubkey: web3_js_2.SystemProgram.programId, isSigner: false, isWritable: false },
|
|
171
171
|
{ pubkey: spl_token_1.TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
172
172
|
{ pubkey: spl_token_1.TOKEN_2022_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
173
173
|
{ pubkey: spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
@@ -5,7 +5,6 @@ exports.extendBasketLookupTablesIx = extendBasketLookupTablesIx;
|
|
|
5
5
|
exports.overwriteBasketLookupTablesIx = overwriteBasketLookupTablesIx;
|
|
6
6
|
exports.closeDeactivatedLookupTableIx = closeDeactivatedLookupTableIx;
|
|
7
7
|
const anchor_1 = require("@coral-xyz/anchor");
|
|
8
|
-
const system_1 = require("@coral-xyz/anchor/dist/cjs/native/system");
|
|
9
8
|
const web3_js_1 = require("@solana/web3.js");
|
|
10
9
|
const constants_1 = require("../../constants");
|
|
11
10
|
const pda_1 = require("../pda");
|
|
@@ -31,7 +30,7 @@ function createBasketLookupTablesInstruction(params) {
|
|
|
31
30
|
{ pubkey: newTempLookupTableInfo0, isSigner: false, isWritable: true },
|
|
32
31
|
{ pubkey: newTempLookupTableInfo1, isSigner: false, isWritable: true },
|
|
33
32
|
{ pubkey: constants_1.ADDRESS_LOOKUP_TABLE_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
34
|
-
{ pubkey:
|
|
33
|
+
{ pubkey: web3_js_1.SystemProgram.programId, isSigner: false, isWritable: false },
|
|
35
34
|
];
|
|
36
35
|
return new web3_js_1.TransactionInstruction({
|
|
37
36
|
keys,
|
|
@@ -46,7 +45,7 @@ function extendBasketLookupTablesIx(params) {
|
|
|
46
45
|
{ pubkey: params.tempLookupTable0, isWritable: true, isSigner: false },
|
|
47
46
|
{ pubkey: params.tempLookupTable1, isWritable: true, isSigner: false },
|
|
48
47
|
{ pubkey: constants_1.ADDRESS_LOOKUP_TABLE_PROGRAM_ID, isWritable: false, isSigner: false },
|
|
49
|
-
{ pubkey:
|
|
48
|
+
{ pubkey: web3_js_1.SystemProgram.programId, isWritable: false, isSigner: false },
|
|
50
49
|
];
|
|
51
50
|
return new web3_js_1.TransactionInstruction({
|
|
52
51
|
keys,
|
|
@@ -62,7 +61,7 @@ function overwriteBasketLookupTablesIx(params) {
|
|
|
62
61
|
{ pubkey: params.tempLookupTable1, isWritable: true, isSigner: false },
|
|
63
62
|
{ pubkey: params.activeLookupTable0, isWritable: true, isSigner: false },
|
|
64
63
|
{ pubkey: params.activeLookupTable1, isWritable: true, isSigner: false },
|
|
65
|
-
{ pubkey:
|
|
64
|
+
{ pubkey: web3_js_1.SystemProgram.programId, isWritable: false, isSigner: false },
|
|
66
65
|
];
|
|
67
66
|
return new web3_js_1.TransactionInstruction({
|
|
68
67
|
keys,
|
|
@@ -78,7 +77,7 @@ function closeDeactivatedLookupTableIx(params) {
|
|
|
78
77
|
{ pubkey: params.lookupTable, isWritable: true, isSigner: false },
|
|
79
78
|
{ pubkey: lookupTableInfo, isWritable: true, isSigner: false },
|
|
80
79
|
{ pubkey: constants_1.ADDRESS_LOOKUP_TABLE_PROGRAM_ID, isWritable: false, isSigner: false },
|
|
81
|
-
{ pubkey:
|
|
80
|
+
{ pubkey: web3_js_1.SystemProgram.programId, isWritable: false, isSigner: false },
|
|
82
81
|
];
|
|
83
82
|
return new web3_js_1.TransactionInstruction({
|
|
84
83
|
keys,
|
|
@@ -11,8 +11,8 @@ const anchor_1 = require("@coral-xyz/anchor");
|
|
|
11
11
|
const constants_1 = require("../../constants");
|
|
12
12
|
const pda_1 = require("../pda");
|
|
13
13
|
const spl_token_1 = require("@solana/spl-token");
|
|
14
|
-
const system_1 = require("@coral-xyz/anchor/dist/cjs/native/system");
|
|
15
14
|
const web3_js_2 = require("@solana/web3.js");
|
|
15
|
+
const web3_js_3 = require("@solana/web3.js");
|
|
16
16
|
const CREATE_USER_REBALANCE_INTENT_ACCOUNT = Buffer.from([212, 23, 1, 46, 192, 87, 74, 196]);
|
|
17
17
|
const RESIZE_REBALANCE_INTENT_HANDLER = Buffer.from([71, 204, 243, 183, 209, 118, 111, 94]);
|
|
18
18
|
const CREATE_DEPOSIT_STATE_DISCRIMINATOR = Buffer.from([66, 42, 217, 222, 49, 159, 36, 188]);
|
|
@@ -32,7 +32,7 @@ function createUserRebalanceIntentIx(params) {
|
|
|
32
32
|
{ pubkey: globalConfig, isSigner: false, isWritable: true },
|
|
33
33
|
{ pubkey: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY, isSigner: false, isWritable: false },
|
|
34
34
|
{ pubkey: web3_js_1.SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false },
|
|
35
|
-
{ pubkey:
|
|
35
|
+
{ pubkey: web3_js_3.SystemProgram.programId, isSigner: false, isWritable: false }
|
|
36
36
|
];
|
|
37
37
|
const data = CREATE_USER_REBALANCE_INTENT_ACCOUNT;
|
|
38
38
|
return new web3_js_2.TransactionInstruction({
|
|
@@ -83,7 +83,7 @@ function depositStateIx(params) {
|
|
|
83
83
|
{ pubkey: buyerBountyAta, isSigner: false, isWritable: true },
|
|
84
84
|
{ pubkey: bountyVault, isSigner: false, isWritable: true },
|
|
85
85
|
{ pubkey: bountyVaultAta, isSigner: false, isWritable: true },
|
|
86
|
-
{ pubkey:
|
|
86
|
+
{ pubkey: web3_js_3.SystemProgram.programId, isSigner: false, isWritable: false },
|
|
87
87
|
{ pubkey: spl_token_1.TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
88
88
|
{ pubkey: spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
89
89
|
// { pubkey: rebalanceIntent, isSigner: false, isWritable: true } // remaining accounts
|
|
@@ -107,7 +107,7 @@ function depositTokensIx(params) {
|
|
|
107
107
|
{ pubkey: spl_token_1.TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
108
108
|
{ pubkey: spl_token_1.TOKEN_2022_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
109
109
|
{ pubkey: spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
110
|
-
{ pubkey:
|
|
110
|
+
{ pubkey: web3_js_3.SystemProgram.programId, isSigner: false, isWritable: false },
|
|
111
111
|
];
|
|
112
112
|
// remaining accounts
|
|
113
113
|
contributions.forEach((contribution) => {
|
|
@@ -158,7 +158,7 @@ function mintBasketIx(params) {
|
|
|
158
158
|
{ pubkey: spl_token_1.TOKEN_PROGRAM_ID, isWritable: false, isSigner: false },
|
|
159
159
|
{ pubkey: spl_token_1.TOKEN_2022_PROGRAM_ID, isWritable: false, isSigner: false },
|
|
160
160
|
{ pubkey: spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID, isWritable: false, isSigner: false },
|
|
161
|
-
{ pubkey:
|
|
161
|
+
{ pubkey: web3_js_3.SystemProgram.programId, isWritable: false, isSigner: false },
|
|
162
162
|
];
|
|
163
163
|
return new web3_js_2.TransactionInstruction({
|
|
164
164
|
keys,
|
|
@@ -6,8 +6,8 @@ const constants_1 = require("../../constants");
|
|
|
6
6
|
const spl_token_1 = require("@solana/spl-token");
|
|
7
7
|
const anchor_1 = require("@coral-xyz/anchor");
|
|
8
8
|
const pda_1 = require("../pda");
|
|
9
|
-
const system_1 = require("@coral-xyz/anchor/dist/cjs/native/system");
|
|
10
9
|
const web3_js_1 = require("@solana/web3.js");
|
|
10
|
+
const web3_js_2 = require("@solana/web3.js");
|
|
11
11
|
const CREATE_WITHDRAW_STATE_DISCRIMINATOR = Buffer.from([161, 45, 253, 59, 110, 240, 65, 3]);
|
|
12
12
|
const REDEEM_TOKENS_DISCRIMINATOR = Buffer.from([83, 49, 112, 2, 105, 193, 106, 126]);
|
|
13
13
|
function createWithdrawStateIx(params) {
|
|
@@ -40,7 +40,7 @@ function createWithdrawStateIx(params) {
|
|
|
40
40
|
{ pubkey: sellerBountyAta, isSigner: false, isWritable: true },
|
|
41
41
|
{ pubkey: bountyVault, isSigner: false, isWritable: true },
|
|
42
42
|
{ pubkey: bountyVaultAta, isSigner: false, isWritable: true },
|
|
43
|
-
{ pubkey:
|
|
43
|
+
{ pubkey: web3_js_2.SystemProgram.programId, isSigner: false, isWritable: false },
|
|
44
44
|
{ pubkey: spl_token_1.TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
45
45
|
{ pubkey: spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
46
46
|
{ pubkey: rebalanceIntent, isSigner: false, isWritable: false } // remaining accounts
|
|
@@ -62,7 +62,7 @@ function redeemTokensIx(params) {
|
|
|
62
62
|
{ pubkey: spl_token_1.TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
63
63
|
{ pubkey: spl_token_1.TOKEN_2022_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
64
64
|
{ pubkey: spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
65
|
-
{ pubkey:
|
|
65
|
+
{ pubkey: web3_js_2.SystemProgram.programId, isSigner: false, isWritable: false },
|
|
66
66
|
];
|
|
67
67
|
// remaining accounts
|
|
68
68
|
params.tokenMints.forEach((mint) => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Connection, PublicKey } from "@solana/web3.js";
|
|
2
2
|
import { Basket } from "../layouts/basket";
|
|
3
|
+
export declare function decodeBasket(dataWithoutDiscriminator: Buffer): Basket;
|
|
3
4
|
export declare function fetchBasket(connection: Connection, basketAddress: PublicKey): Promise<Basket>;
|
|
4
5
|
export interface BasketFilter {
|
|
5
6
|
filterType: "host" | "creator";
|
|
@@ -9,17 +9,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.decodeBasket = decodeBasket;
|
|
12
13
|
exports.fetchBasket = fetchBasket;
|
|
13
14
|
exports.fetchBaskets = fetchBaskets;
|
|
14
15
|
const basket_1 = require("../layouts/basket");
|
|
15
16
|
const constants_1 = require("../constants");
|
|
17
|
+
function decodeBasket(dataWithoutDiscriminator) {
|
|
18
|
+
let basket = basket_1.BasketLayout.decode(dataWithoutDiscriminator);
|
|
19
|
+
return basket;
|
|
20
|
+
}
|
|
16
21
|
function fetchBasket(connection, basketAddress) {
|
|
17
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18
23
|
const basketAi = yield connection.getAccountInfo(basketAddress);
|
|
19
24
|
if (!basketAi) {
|
|
20
25
|
throw new Error("Basket not found");
|
|
21
26
|
}
|
|
22
|
-
return
|
|
27
|
+
return decodeBasket(basketAi.data.slice(8));
|
|
23
28
|
});
|
|
24
29
|
}
|
|
25
30
|
function fetchBaskets(connection, filters) {
|
|
@@ -48,7 +53,7 @@ function fetchBaskets(connection, filters) {
|
|
|
48
53
|
filters: accountFilters,
|
|
49
54
|
encoding: 'base64'
|
|
50
55
|
});
|
|
51
|
-
const baskets = accounts.map(account =>
|
|
56
|
+
const baskets = accounts.map(account => decodeBasket(account.account.data.slice(8)));
|
|
52
57
|
return baskets;
|
|
53
58
|
});
|
|
54
59
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Decimal } from 'decimal.js';
|
|
2
|
-
import { AnchorProvider, BN
|
|
2
|
+
import { AnchorProvider, BN } from '@coral-xyz/anchor';
|
|
3
3
|
import { HermesClient } from '@pythnetwork/hermes-client';
|
|
4
4
|
import { Connection, PublicKey, Signer, TransactionSignature, VersionedTransaction } from '@solana/web3.js';
|
|
5
5
|
import { Oracle, OracleResult } from './oracle';
|
|
@@ -17,7 +17,7 @@ export declare class PythOracle extends Oracle {
|
|
|
17
17
|
priceFeedId: string;
|
|
18
18
|
private constructor();
|
|
19
19
|
static create(connection: Connection | undefined, priceFeedAccount: PublicKey, weight: number, priceClient?: HermesClient, confThreshBps?: number, stalenessThresh?: number, volatilityThresh?: Decimal, minLiquidity?: Decimal, stalenessConfRateBps?: number): Promise<PythOracle>;
|
|
20
|
-
static createWithId(connection: Connection | undefined, priceFeedId: string, wallet:
|
|
20
|
+
static createWithId(connection: Connection | undefined, priceFeedId: string, wallet: any, weight: number, priceClient?: HermesClient, confThreshBps?: number, stalenessThresh?: number, volatilityThresh?: Decimal, minLiquidity?: Decimal, stalenessConfRateBps?: number): Promise<PythOracle>;
|
|
21
21
|
getConfidence(): Decimal;
|
|
22
22
|
setPriceFeedId(priceFeedId: string): void;
|
|
23
23
|
fetch(): Promise<OracleResult>;
|
|
@@ -27,7 +27,7 @@ export declare class PythOracle extends Oracle {
|
|
|
27
27
|
* @param {number} shardId - between 0-2^64, default is 0
|
|
28
28
|
* @param {number} [computeUnitPrice] - compute unit price in microlamports, default is 100_000
|
|
29
29
|
*/
|
|
30
|
-
updateFeedTx(wallet:
|
|
30
|
+
updateFeedTx(wallet: any, shardId?: number, computeUnitPrice?: number): Promise<{
|
|
31
31
|
tx: VersionedTransaction;
|
|
32
32
|
signers: Signer[];
|
|
33
33
|
}[]>;
|
package/dist/src/txUtils.d.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Transaction } from '@solana/web3.js';
|
|
2
|
+
import { AddressLookupTableAccount, Connection, Keypair, PublicKey, TransactionInstruction, VersionedTransaction } from '@solana/web3.js';
|
|
2
3
|
export declare const COMPUTE_UNITS = 1000000;
|
|
3
4
|
type TransactionSignature = string;
|
|
5
|
+
export interface Wallet {
|
|
6
|
+
signTransaction<T extends Transaction | VersionedTransaction>(tx: T): Promise<T>;
|
|
7
|
+
signAllTransactions<T extends Transaction | VersionedTransaction>(txs: T[]): Promise<T[]>;
|
|
8
|
+
publicKey: PublicKey;
|
|
9
|
+
/** Keypair of the configured payer (Node only) */
|
|
10
|
+
payer?: Keypair;
|
|
11
|
+
}
|
|
4
12
|
export interface VersionedTxs {
|
|
5
13
|
blockhash: string;
|
|
6
14
|
lastValidBlockHeight: number;
|
|
@@ -22,5 +30,8 @@ export declare function prepareV0Transactions(params: {
|
|
|
22
30
|
batches: number[];
|
|
23
31
|
}): Promise<VersionedTxs>;
|
|
24
32
|
export declare function sendV0Transactions(connection: Connection, txParams: VersionedTxs, simulateTransactions: boolean): Promise<TransactionSignature[]>;
|
|
25
|
-
export declare function
|
|
33
|
+
export declare function signedVersionedTxs(params: {
|
|
34
|
+
wallet: Wallet;
|
|
35
|
+
vtxs: VersionedTxs;
|
|
36
|
+
}): Promise<VersionedTxs>;
|
|
26
37
|
export {};
|
package/dist/src/txUtils.js
CHANGED
|
@@ -17,7 +17,7 @@ exports.wrapV0Transaction = wrapV0Transaction;
|
|
|
17
17
|
exports.sendV0Transaction = sendV0Transaction;
|
|
18
18
|
exports.prepareV0Transactions = prepareV0Transactions;
|
|
19
19
|
exports.sendV0Transactions = sendV0Transactions;
|
|
20
|
-
exports.
|
|
20
|
+
exports.signedVersionedTxs = signedVersionedTxs;
|
|
21
21
|
const web3_js_1 = require("@solana/web3.js");
|
|
22
22
|
exports.COMPUTE_UNITS = 1000000;
|
|
23
23
|
function delay(ms) {
|
|
@@ -172,12 +172,10 @@ function sendV0Transactions(connection, txParams, simulateTransactions) {
|
|
|
172
172
|
return txIds;
|
|
173
173
|
});
|
|
174
174
|
}
|
|
175
|
-
function
|
|
175
|
+
function signedVersionedTxs(params) {
|
|
176
176
|
return __awaiter(this, void 0, void 0, function* () {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
let tx = yield sendV0Transactions(connection, txs, false);
|
|
181
|
-
return tx;
|
|
177
|
+
const { wallet, vtxs } = params;
|
|
178
|
+
vtxs.versionedTxs = yield wallet.signAllTransactions(vtxs.versionedTxs);
|
|
179
|
+
return vtxs;
|
|
182
180
|
});
|
|
183
181
|
}
|
package/dist/test.js
CHANGED
|
@@ -28,11 +28,11 @@ function testStates() {
|
|
|
28
28
|
metadataModificationDelay: new anchor_1.BN(0),
|
|
29
29
|
});
|
|
30
30
|
console.log(x);
|
|
31
|
-
let baskets = yield sdk.fetchAllBaskets();
|
|
31
|
+
let baskets = yield sdk.fetchAllBaskets([]);
|
|
32
32
|
console.log(baskets.map(basket => basket.ownAddress.toBase58()));
|
|
33
|
-
let intents = yield sdk.fetchAllIntents();
|
|
33
|
+
let intents = yield sdk.fetchAllIntents([]);
|
|
34
34
|
console.log(intents.map(intent => intent.manager.toBase58()));
|
|
35
|
-
let rebalanceIntents = yield sdk.fetchAllRebalanceIntents();
|
|
35
|
+
let rebalanceIntents = yield sdk.fetchAllRebalanceIntents([]);
|
|
36
36
|
console.log(rebalanceIntents.map(rebalanceIntent => rebalanceIntent.owner.toBase58()));
|
|
37
37
|
});
|
|
38
38
|
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symmetry-hq/temp-v3-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Symmetry Baskets V3 SDK",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
5
|
+
"main": "dist/src/index.js",
|
|
6
|
+
"types": "dist/src/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"prepare": "npm run build",
|
|
9
9
|
"build": "tsc",
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BN } from '@coral-xyz/anchor';
|
|
2
2
|
import { Connection, Keypair, PublicKey, TransactionSignature } from '@solana/web3.js';
|
|
3
3
|
|
|
4
4
|
import { BOUNTY_MINT } from './constants';
|
|
@@ -14,10 +14,10 @@ import { Basket } from './layouts/basket';
|
|
|
14
14
|
import { Fraction } from './layouts/fraction';
|
|
15
15
|
import { EditData, HostFees, Intent, MetadataParams, TaskType } from './layouts/intents/intent';
|
|
16
16
|
import { RebalanceIntent } from './layouts/intents/rebalanceIntent';
|
|
17
|
-
import { fetchBasket, fetchBaskets } from './states/basket';
|
|
18
|
-
import { fetchIntents } from './states/intents/intent';
|
|
19
|
-
import { fetchRebalanceIntents } from './states/intents/rebalanceIntent';
|
|
20
|
-
import { prepareV0Transactions, sendV0Transactions, VersionedTxs } from './txUtils';
|
|
17
|
+
import { BasketFilter, fetchBasket, fetchBaskets } from './states/basket';
|
|
18
|
+
import { fetchIntents, IntentFilter } from './states/intents/intent';
|
|
19
|
+
import { fetchRebalanceIntents, RebalanceIntentFilter } from './states/intents/rebalanceIntent';
|
|
20
|
+
import { prepareV0Transactions, sendV0Transactions, signedVersionedTxs, VersionedTxs, Wallet } from './txUtils';
|
|
21
21
|
|
|
22
22
|
export const COMPUTE_UNITS = 1_000_000;
|
|
23
23
|
export const PRIORITY_FEE = 100_000;
|
|
@@ -62,18 +62,24 @@ export class BasketsSdk {
|
|
|
62
62
|
return basketState;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
async fetchAllBaskets(
|
|
66
|
-
|
|
65
|
+
async fetchAllBaskets(
|
|
66
|
+
filters: BasketFilter[],
|
|
67
|
+
): Promise<Basket[]> {
|
|
68
|
+
const baskets = await fetchBaskets(this.sdkParams.connection, filters);
|
|
67
69
|
return baskets;
|
|
68
70
|
}
|
|
69
71
|
|
|
70
|
-
async fetchAllIntents(
|
|
71
|
-
|
|
72
|
+
async fetchAllIntents(
|
|
73
|
+
filters: IntentFilter[],
|
|
74
|
+
): Promise<Intent[]> {
|
|
75
|
+
const intents = await fetchIntents(this.sdkParams.connection, filters);
|
|
72
76
|
return intents;
|
|
73
77
|
}
|
|
74
78
|
|
|
75
|
-
async fetchAllRebalanceIntents(
|
|
76
|
-
|
|
79
|
+
async fetchAllRebalanceIntents(
|
|
80
|
+
filters: RebalanceIntentFilter[],
|
|
81
|
+
): Promise<RebalanceIntent[]> {
|
|
82
|
+
const rebalanceIntents = await fetchRebalanceIntents(this.sdkParams.connection, filters);
|
|
77
83
|
return rebalanceIntents;
|
|
78
84
|
}
|
|
79
85
|
|
|
@@ -252,8 +258,8 @@ export class BasketsSdk {
|
|
|
252
258
|
vtxs: VersionedTxs,
|
|
253
259
|
wallet: Wallet,
|
|
254
260
|
}): Promise<TransactionSignature[]> {
|
|
255
|
-
|
|
256
|
-
vtxs
|
|
261
|
+
let { vtxs, wallet } = params;
|
|
262
|
+
vtxs = await signedVersionedTxs({ wallet, vtxs });
|
|
257
263
|
return await sendV0Transactions(this.sdkParams.connection, vtxs, false);
|
|
258
264
|
}
|
|
259
265
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { TransactionInstruction } from "@solana/web3.js";
|
|
2
2
|
import { PublicKey } from "@solana/web3.js";
|
|
3
3
|
import { getAta, getRebalanceIntentPda } from "../pda";
|
|
4
|
-
import { SYSTEM_PROGRAM_ID } from "@coral-xyz/anchor/dist/cjs/native/system";
|
|
5
4
|
import { ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_2022_PROGRAM_ID, TOKEN_PROGRAM_ID } from "@solana/spl-token";
|
|
6
5
|
import { BN } from "@coral-xyz/anchor";
|
|
7
6
|
import { BASKETS_V3_PROGRAM_ID } from "../../constants";
|
|
7
|
+
import { SystemProgram } from "@solana/web3.js";
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
@@ -39,7 +39,7 @@ export function rebalanceSwapIx(
|
|
|
39
39
|
{ pubkey: keeperToATA, isWritable: true, isSigner: false },
|
|
40
40
|
{ pubkey: basketFromATA, isWritable: true, isSigner: false },
|
|
41
41
|
{ pubkey: basketToATA, isWritable: true, isSigner: false },
|
|
42
|
-
{ pubkey:
|
|
42
|
+
{ pubkey: SystemProgram.programId, isWritable: false, isSigner: false },
|
|
43
43
|
{ pubkey: TOKEN_PROGRAM_ID, isWritable: false, isSigner: false },
|
|
44
44
|
{ pubkey: TOKEN_2022_PROGRAM_ID, isWritable: false, isSigner: false },
|
|
45
45
|
{ pubkey: ASSOCIATED_TOKEN_PROGRAM_ID, isWritable: false, isSigner: false },
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { BN } from '@coral-xyz/anchor';
|
|
2
|
-
import { SYSTEM_PROGRAM_ID } from '@coral-xyz/anchor/dist/cjs/native/system';
|
|
3
2
|
import {
|
|
4
3
|
ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
5
4
|
TOKEN_2022_PROGRAM_ID, TOKEN_PROGRAM_ID
|
|
@@ -42,7 +41,7 @@ export function addBountyIx(params: {
|
|
|
42
41
|
{ pubkey: bountyVault, isSigner: false, isWritable: true },
|
|
43
42
|
{ pubkey: bountyVaultAta, isSigner: false, isWritable: true },
|
|
44
43
|
{ pubkey: globalConfig, isSigner: false, isWritable: false },
|
|
45
|
-
{ pubkey:
|
|
44
|
+
{ pubkey: SystemProgram.programId, isSigner: false, isWritable: false },
|
|
46
45
|
{ pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
47
46
|
{ pubkey: TOKEN_2022_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
48
47
|
{ pubkey: ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { BN, Program } from '@coral-xyz/anchor';
|
|
2
|
-
import { SYSTEM_PROGRAM_ID } from '@coral-xyz/anchor/dist/cjs/native/system';
|
|
3
2
|
import { array, publicKey, struct, u16, u64, u8 } from '@coral-xyz/borsh';
|
|
4
3
|
import {
|
|
5
4
|
PublicKey, SystemProgram, SYSVAR_RENT_PUBKEY, TransactionInstruction
|
|
@@ -27,7 +26,7 @@ export function createGlobalConfigIx(params: {
|
|
|
27
26
|
const keys = [
|
|
28
27
|
{ pubkey: admin, isSigner: true, isWritable: true },
|
|
29
28
|
{ pubkey: globalConfig, isSigner: false, isWritable: true },
|
|
30
|
-
{ pubkey:
|
|
29
|
+
{ pubkey: SystemProgram.programId, isSigner: false, isWritable: false },
|
|
31
30
|
{ pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false },
|
|
32
31
|
];
|
|
33
32
|
|
|
@@ -4,9 +4,9 @@ import { TransactionInstruction } from "@solana/web3.js";
|
|
|
4
4
|
import { BASKETS_V3_PROGRAM_ID } from "../../constants";
|
|
5
5
|
import { getAta, getBountyVaultPda, getGlobalConfigPda, getIntentPda, getMetadataAccount, METADATA_PROGRAM_ID, serializeString } from "../pda";
|
|
6
6
|
import { ASSOCIATED_TOKEN_PROGRAM_ID, getAssociatedTokenAddressSync, TOKEN_2022_PROGRAM_ID, TOKEN_PROGRAM_ID } from "@solana/spl-token";
|
|
7
|
-
import { SYSTEM_PROGRAM_ID } from "@coral-xyz/anchor/dist/cjs/native/system";
|
|
8
7
|
import { AutomationSettings, AutomationSettingsLayout, FeeSettings, FeeSettingsLayout, LpSettings, LpSettingsLayout, ManagerSettings, ManagerSettingsLayout, MetadataSettings, MetadataSettingsLayout, ScheduleSettings, ScheduleSettingsLayout } from "../../layouts/config";
|
|
9
8
|
import { BN } from "@coral-xyz/anchor";
|
|
9
|
+
import { SystemProgram } from "@solana/web3.js";
|
|
10
10
|
|
|
11
11
|
const EDIT_PRIVATE_BASKET_SETTINGS_DISCRIMINATOR = Buffer.from([202,54,138,17,3,104,128,229]);
|
|
12
12
|
const CREATE_EDIT_BASKET_INTENT_DISCRIMINATOR = Buffer.from([82, 150, 58, 227, 153, 129, 20, 30]);
|
|
@@ -177,7 +177,7 @@ export function createEditBasketIntentIx(params: {
|
|
|
177
177
|
{ pubkey: managerBountyATA, isSigner: false, isWritable: true },
|
|
178
178
|
{ pubkey: bountyVault, isSigner: false, isWritable: true },
|
|
179
179
|
{ pubkey: bountyVaultATA, isSigner: false, isWritable: true },
|
|
180
|
-
{ pubkey:
|
|
180
|
+
{ pubkey: SystemProgram.programId, isSigner: false, isWritable: false },
|
|
181
181
|
{ pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
182
182
|
{ pubkey: TOKEN_2022_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
183
183
|
{ pubkey: ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
@@ -230,7 +230,7 @@ export function editBasketIx(params: {
|
|
|
230
230
|
{ pubkey: managerBountyATA, isSigner: false, isWritable: true },
|
|
231
231
|
{ pubkey: bountyVault, isSigner: false, isWritable: true },
|
|
232
232
|
{ pubkey: bountyVaultATA, isSigner: false, isWritable: true },
|
|
233
|
-
{ pubkey:
|
|
233
|
+
{ pubkey: SystemProgram.programId, isSigner: false, isWritable: false },
|
|
234
234
|
{ pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
235
235
|
{ pubkey: TOKEN_2022_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
236
236
|
{ pubkey: ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { BN, Program } from '@coral-xyz/anchor';
|
|
2
|
-
import { SYSTEM_PROGRAM_ID } from '@coral-xyz/anchor/dist/cjs/native/system';
|
|
3
2
|
import { PublicKey, SystemProgram, TransactionInstruction } from '@solana/web3.js';
|
|
4
3
|
import { ADDRESS_LOOKUP_TABLE_PROGRAM_ID, BASKETS_V3_PROGRAM_ID } from '../../constants';
|
|
5
4
|
import { getLookupTableInfoAccount } from '../pda';
|
|
@@ -48,7 +47,7 @@ export function createBasketLookupTablesInstruction(params: {
|
|
|
48
47
|
{ pubkey: newTempLookupTableInfo0, isSigner: false, isWritable: true },
|
|
49
48
|
{ pubkey: newTempLookupTableInfo1, isSigner: false, isWritable: true },
|
|
50
49
|
{ pubkey: ADDRESS_LOOKUP_TABLE_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
51
|
-
{ pubkey:
|
|
50
|
+
{ pubkey: SystemProgram.programId, isSigner: false, isWritable: false },
|
|
52
51
|
];
|
|
53
52
|
|
|
54
53
|
return new TransactionInstruction({
|
|
@@ -72,7 +71,7 @@ export function extendBasketLookupTablesIx(
|
|
|
72
71
|
{ pubkey: params.tempLookupTable0, isWritable: true, isSigner: false },
|
|
73
72
|
{ pubkey: params.tempLookupTable1, isWritable: true, isSigner: false },
|
|
74
73
|
{ pubkey: ADDRESS_LOOKUP_TABLE_PROGRAM_ID, isWritable: false, isSigner: false },
|
|
75
|
-
{ pubkey:
|
|
74
|
+
{ pubkey: SystemProgram.programId, isWritable: false, isSigner: false },
|
|
76
75
|
];
|
|
77
76
|
|
|
78
77
|
return new TransactionInstruction({
|
|
@@ -100,7 +99,7 @@ export function overwriteBasketLookupTablesIx(
|
|
|
100
99
|
{ pubkey: params.tempLookupTable1, isWritable: true, isSigner: false },
|
|
101
100
|
{ pubkey: params.activeLookupTable0, isWritable: true, isSigner: false },
|
|
102
101
|
{ pubkey: params.activeLookupTable1, isWritable: true, isSigner: false },
|
|
103
|
-
{ pubkey:
|
|
102
|
+
{ pubkey: SystemProgram.programId, isWritable: false, isSigner: false },
|
|
104
103
|
];
|
|
105
104
|
|
|
106
105
|
return new TransactionInstruction({
|
|
@@ -123,7 +122,7 @@ export function closeDeactivatedLookupTableIx(params: {
|
|
|
123
122
|
{ pubkey: params.lookupTable, isWritable: true, isSigner: false },
|
|
124
123
|
{ pubkey: lookupTableInfo, isWritable: true, isSigner: false },
|
|
125
124
|
{ pubkey: ADDRESS_LOOKUP_TABLE_PROGRAM_ID, isWritable: false, isSigner: false },
|
|
126
|
-
{ pubkey:
|
|
125
|
+
{ pubkey: SystemProgram.programId, isWritable: false, isSigner: false },
|
|
127
126
|
];
|
|
128
127
|
|
|
129
128
|
return new TransactionInstruction({
|