@haven-fi/solauto-sdk 1.0.5 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +3 -0
- package/dist/generated/types/lendingPlatform.d.ts +1 -2
- package/dist/generated/types/lendingPlatform.d.ts.map +1 -1
- package/dist/generated/types/lendingPlatform.js +0 -1
- package/dist/transactions/transactionsManager.js +1 -1
- package/dist/utils/accountUtils.d.ts +0 -1
- package/dist/utils/accountUtils.d.ts.map +1 -1
- package/dist/utils/accountUtils.js +1 -14
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +0 -1
- package/dist/utils/numberUtils.d.ts.map +1 -1
- package/{src/utils/local → local}/shared.ts +14 -2
- package/{src/utils/local → local}/updateMarginfiLUT.ts +3 -3
- package/{src/utils/local → local}/updateSolautoLUT.ts +4 -4
- package/package.json +4 -4
- package/src/generated/types/lendingPlatform.ts +0 -1
- package/src/transactions/transactionsManager.ts +1 -1
- package/src/utils/accountUtils.ts +2 -26
- package/src/utils/index.ts +0 -1
- package/src/utils/numberUtils.ts +0 -1
- package/tests/shared.ts +1 -13
- package/dist/utils/local/shared.d.ts +0 -3
- package/dist/utils/local/shared.d.ts.map +0 -1
- package/dist/utils/local/shared.js +0 -63
- package/dist/utils/local/updateMarginfiLUT.d.ts +0 -2
- package/dist/utils/local/updateMarginfiLUT.d.ts.map +0 -1
- package/dist/utils/local/updateMarginfiLUT.js +0 -22
- package/dist/utils/local/updateSolautoLUT.d.ts +0 -2
- package/dist/utils/local/updateSolautoLUT.d.ts.map +0 -1
- package/dist/utils/local/updateSolautoLUT.js +0 -13
package/README.md
ADDED
@@ -8,8 +8,7 @@
|
|
8
8
|
import { Serializer } from '@metaplex-foundation/umi/serializers';
|
9
9
|
export declare enum LendingPlatform {
|
10
10
|
Marginfi = 0,
|
11
|
-
Kamino = 1
|
12
|
-
Solend = 2
|
11
|
+
Kamino = 1
|
13
12
|
}
|
14
13
|
export type LendingPlatformArgs = LendingPlatform;
|
15
14
|
export declare function getLendingPlatformSerializer(): Serializer<LendingPlatformArgs, LendingPlatform>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"lendingPlatform.d.ts","sourceRoot":"","sources":["../../../src/generated/types/lendingPlatform.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAc,MAAM,sCAAsC,CAAC;AAE9E,oBAAY,eAAe;IACzB,QAAQ,IAAA;IACR,MAAM,IAAA;
|
1
|
+
{"version":3,"file":"lendingPlatform.d.ts","sourceRoot":"","sources":["../../../src/generated/types/lendingPlatform.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAc,MAAM,sCAAsC,CAAC;AAE9E,oBAAY,eAAe;IACzB,QAAQ,IAAA;IACR,MAAM,IAAA;CACP;AAED,MAAM,MAAM,mBAAmB,GAAG,eAAe,CAAC;AAElD,wBAAgB,4BAA4B,IAAI,UAAU,CACxD,mBAAmB,EACnB,eAAe,CAChB,CAIA"}
|
@@ -13,7 +13,6 @@ var LendingPlatform;
|
|
13
13
|
(function (LendingPlatform) {
|
14
14
|
LendingPlatform[LendingPlatform["Marginfi"] = 0] = "Marginfi";
|
15
15
|
LendingPlatform[LendingPlatform["Kamino"] = 1] = "Kamino";
|
16
|
-
LendingPlatform[LendingPlatform["Solend"] = 2] = "Solend";
|
17
16
|
})(LendingPlatform = exports.LendingPlatform || (exports.LendingPlatform = {}));
|
18
17
|
function getLendingPlatformSerializer() {
|
19
18
|
return (0, serializers_1.scalarEnum)(LendingPlatform, {
|
@@ -177,7 +177,7 @@ class TransactionsManager {
|
|
177
177
|
choresBefore.prepend(updateLookupTable.updateLutTx);
|
178
178
|
}
|
179
179
|
if (choresBefore.getInstructions().length > 0) {
|
180
|
-
this.items.unshift(new TransactionItem(async () => ({ tx: choresBefore })));
|
180
|
+
this.items.unshift(new TransactionItem(async () => ({ tx: choresBefore }), "create account(s)"));
|
181
181
|
this.client.log("Chores before: ", choresBefore.getInstructions().length);
|
182
182
|
}
|
183
183
|
if (choresAfter.getInstructions().length > 0) {
|
@@ -7,5 +7,4 @@ export declare function getTokenAccounts(wallet: PublicKey, tokenMints: PublicKe
|
|
7
7
|
export declare function getSolautoPositionAccount(signer: PublicKey, positionId: number): Promise<PublicKey>;
|
8
8
|
export declare function getReferralState(authority: PublicKey): Promise<PublicKey>;
|
9
9
|
export declare function getMarginfiAccountPDA(solautoPositionAccount: PublicKey, marginfiAccountSeedIdx: bigint): Promise<PublicKey>;
|
10
|
-
export declare function getSolendObligationAccount(solautoPositionAccount: PublicKey | undefined, signer: PublicKey, lendingMarket: PublicKey, solendProgram: PublicKey): Promise<PublicKey>;
|
11
10
|
//# sourceMappingURL=accountUtils.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"accountUtils.d.ts","sourceRoot":"","sources":["../../src/utils/accountUtils.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,
|
1
|
+
{"version":3,"file":"accountUtils.d.ts","sourceRoot":"","sources":["../../src/utils/accountUtils.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAIhD;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAIjD;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,GAAG,SAAS,CAMlF;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE,CAExF;AAED,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,SAAS,EACjB,UAAU,EAAE,MAAM,sBAQnB;AAED,wBAAsB,gBAAgB,CAAC,SAAS,EAAE,SAAS,sBAU1D;AAED,wBAAsB,qBAAqB,CACzC,sBAAsB,EAAE,SAAS,EACjC,sBAAsB,EAAE,MAAM,sBAa/B"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.getMarginfiAccountPDA = exports.getReferralState = exports.getSolautoPositionAccount = exports.getTokenAccounts = exports.getTokenAccount = exports.bufferFromU64 = exports.bufferFromU8 = void 0;
|
4
4
|
const web3_js_1 = require("@solana/web3.js");
|
5
5
|
const spl_token_1 = require("@solana/spl-token");
|
6
6
|
const generated_1 = require("../generated");
|
@@ -45,16 +45,3 @@ async function getMarginfiAccountPDA(solautoPositionAccount, marginfiAccountSeed
|
|
45
45
|
return marginfiAccount;
|
46
46
|
}
|
47
47
|
exports.getMarginfiAccountPDA = getMarginfiAccountPDA;
|
48
|
-
async function getSolendObligationAccount(solautoPositionAccount, signer, lendingMarket, solendProgram) {
|
49
|
-
const seeds = [
|
50
|
-
signer.toBuffer(),
|
51
|
-
lendingMarket.toBuffer(),
|
52
|
-
solendProgram.toBuffer(),
|
53
|
-
];
|
54
|
-
if (solautoPositionAccount !== undefined) {
|
55
|
-
seeds.unshift(solautoPositionAccount.toBuffer());
|
56
|
-
}
|
57
|
-
const [obligationAccount, _] = await web3_js_1.PublicKey.findProgramAddress(seeds, new web3_js_1.PublicKey(generated_1.SOLAUTO_PROGRAM_ID));
|
58
|
-
return obligationAccount;
|
59
|
-
}
|
60
|
-
exports.getSolendObligationAccount = getSolendObligationAccount;
|
package/dist/utils/index.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC"}
|
package/dist/utils/index.js
CHANGED
@@ -17,7 +17,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./solauto/index"), exports);
|
18
18
|
__exportStar(require("./accountUtils"), exports);
|
19
19
|
__exportStar(require("./generalUtils"), exports);
|
20
|
-
__exportStar(require("./jitoUtils"), exports);
|
21
20
|
__exportStar(require("./jupiterUtils"), exports);
|
22
21
|
__exportStar(require("./marginfiUtils"), exports);
|
23
22
|
__exportStar(require("./numberUtils"), exports);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"numberUtils.d.ts","sourceRoot":"","sources":["../../src/utils/numberUtils.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"numberUtils.d.ts","sourceRoot":"","sources":["../../src/utils/numberUtils.ts"],"names":[],"mappings":"AAAA,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,MAAM,CAM3G;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEhE;AAEH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEpE;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE3C;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAqBrD;AAED,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAajE;AAED,wBAAgB,oBAAoB,CAClC,eAAe,EAAE,MAAM,EACvB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,2BAA2B,EAAE,MAAM,EACnC,gBAAgB,CAAC,EAAE,MAAM,UAQ1B"}
|
@@ -1,3 +1,5 @@
|
|
1
|
+
import path from "path";
|
2
|
+
import fs from "fs";
|
1
3
|
import {
|
2
4
|
Keypair,
|
3
5
|
AddressLookupTableProgram,
|
@@ -6,8 +8,18 @@ import {
|
|
6
8
|
VersionedTransaction,
|
7
9
|
PublicKey,
|
8
10
|
} from "@solana/web3.js";
|
9
|
-
import {
|
10
|
-
|
11
|
+
import { CONNECTION } from "../src/constants/solautoConstants";
|
12
|
+
|
13
|
+
function loadSecretKey(keypairPath: string) {
|
14
|
+
const secretKey = JSON.parse(fs.readFileSync(keypairPath, "utf8"));
|
15
|
+
return new Uint8Array(secretKey);
|
16
|
+
}
|
17
|
+
|
18
|
+
export function getSecretKey(keypairFilename: string = "id"): Uint8Array {
|
19
|
+
return loadSecretKey(
|
20
|
+
path.join(process.env.HOME!, ".config", "solana", keypairFilename + ".json")
|
21
|
+
);
|
22
|
+
}
|
11
23
|
|
12
24
|
const keypair = Keypair.fromSecretKey(getSecretKey());
|
13
25
|
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { PublicKey } from "@solana/web3.js";
|
2
|
-
import { MARGINFI_ACCOUNTS_LOOKUP_TABLE } from "
|
2
|
+
import { MARGINFI_ACCOUNTS_LOOKUP_TABLE } from "../constants/marginfiAccounts";
|
3
3
|
import {
|
4
4
|
MARGINFI_ACCOUNTS,
|
5
5
|
DEFAULT_MARGINFI_GROUP,
|
6
|
-
} from "
|
7
|
-
import { MARGINFI_PROGRAM_ID } from "
|
6
|
+
} from "../constants/marginfiAccounts";
|
7
|
+
import { MARGINFI_PROGRAM_ID } from "../marginfi-sdk";
|
8
8
|
import { updateLookupTable } from "./shared";
|
9
9
|
|
10
10
|
const LOOKUP_TABLE_ADDRESS = new PublicKey(MARGINFI_ACCOUNTS_LOOKUP_TABLE);
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { PublicKey } from "@solana/web3.js";
|
2
|
-
import { getTokenAccounts } from "../accountUtils";
|
3
|
-
import { SOLAUTO_MANAGER } from "
|
4
|
-
import { ALL_SUPPORTED_TOKENS } from "
|
2
|
+
import { getTokenAccounts } from "../src/utils/accountUtils";
|
3
|
+
import { SOLAUTO_MANAGER } from "../src/constants/generalAccounts";
|
4
|
+
import { ALL_SUPPORTED_TOKENS } from "../src/constants/tokenConstants";
|
5
5
|
import { updateLookupTable } from "./shared";
|
6
|
-
import { STANDARD_LUT_ACCOUNTS } from "
|
6
|
+
import { STANDARD_LUT_ACCOUNTS } from "../src/constants/solautoConstants";
|
7
7
|
|
8
8
|
const solautoManagerTokenAccounts = getTokenAccounts(SOLAUTO_MANAGER, ALL_SUPPORTED_TOKENS.map((x) => new PublicKey(x)));
|
9
9
|
|
package/package.json
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
{
|
2
2
|
"name": "@haven-fi/solauto-sdk",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.7",
|
4
4
|
"main": "dist/index.js",
|
5
5
|
"types": "dist/index.d.ts",
|
6
6
|
"description": "Typescript SDK for the Solauto program on the Solana blockchain",
|
7
7
|
"author": "Chelioso",
|
8
8
|
"license": "MIT",
|
9
9
|
"scripts": {
|
10
|
-
"build": "tsc",
|
10
|
+
"build": "rm -r dist && npx tsc",
|
11
11
|
"test:txs": "ts-mocha -p ./tsconfig.json -t 1000000 tests/transactions/**/*.ts",
|
12
12
|
"test:unit": "ts-mocha -p ./tsconfig.json -t 1000000 tests/unit/**/*.ts",
|
13
13
|
"test:all": "pnpm test:unit && pnpm test:txs",
|
14
|
-
"update-lut:solauto": "npx ts-node
|
15
|
-
"update-lut:marginfi": "npx ts-node
|
14
|
+
"update-lut:solauto": "npx ts-node local/updateSolautoLUT.ts",
|
15
|
+
"update-lut:marginfi": "npx ts-node local/updateMarginfiLUT.ts"
|
16
16
|
},
|
17
17
|
"dependencies": {
|
18
18
|
"@jup-ag/api": "^6.0.24",
|
@@ -249,7 +249,7 @@ export class TransactionsManager {
|
|
249
249
|
choresBefore.prepend(updateLookupTable.updateLutTx);
|
250
250
|
}
|
251
251
|
if (choresBefore.getInstructions().length > 0) {
|
252
|
-
this.items.unshift(new TransactionItem(async () => ({ tx: choresBefore })));
|
252
|
+
this.items.unshift(new TransactionItem(async () => ({ tx: choresBefore }), "create account(s)"));
|
253
253
|
this.client.log("Chores before: ", choresBefore.getInstructions().length);
|
254
254
|
}
|
255
255
|
if (choresAfter.getInstructions().length > 0) {
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { PublicKey
|
1
|
+
import { PublicKey } from "@solana/web3.js";
|
2
2
|
import { getAssociatedTokenAddressSync } from "@solana/spl-token";
|
3
3
|
import { SOLAUTO_PROGRAM_ID } from "../generated";
|
4
4
|
|
@@ -65,28 +65,4 @@ export async function getMarginfiAccountPDA(
|
|
65
65
|
);
|
66
66
|
|
67
67
|
return marginfiAccount;
|
68
|
-
}
|
69
|
-
|
70
|
-
export async function getSolendObligationAccount(
|
71
|
-
solautoPositionAccount: PublicKey | undefined,
|
72
|
-
signer: PublicKey,
|
73
|
-
lendingMarket: PublicKey,
|
74
|
-
solendProgram: PublicKey
|
75
|
-
) {
|
76
|
-
const seeds = [
|
77
|
-
signer.toBuffer(),
|
78
|
-
lendingMarket.toBuffer(),
|
79
|
-
solendProgram.toBuffer(),
|
80
|
-
];
|
81
|
-
|
82
|
-
if (solautoPositionAccount !== undefined) {
|
83
|
-
seeds.unshift(solautoPositionAccount.toBuffer());
|
84
|
-
}
|
85
|
-
|
86
|
-
const [obligationAccount, _] = await PublicKey.findProgramAddress(
|
87
|
-
seeds,
|
88
|
-
new PublicKey(SOLAUTO_PROGRAM_ID)
|
89
|
-
);
|
90
|
-
|
91
|
-
return obligationAccount;
|
92
|
-
}
|
68
|
+
}
|
package/src/utils/index.ts
CHANGED
package/src/utils/numberUtils.ts
CHANGED
package/tests/shared.ts
CHANGED
@@ -1,19 +1,7 @@
|
|
1
|
-
import path from "path";
|
2
|
-
import fs from "fs";
|
3
1
|
import { Signer, createSignerFromKeypair } from "@metaplex-foundation/umi";
|
4
2
|
import { Connection, clusterApiUrl } from "@solana/web3.js";
|
5
3
|
import { createUmi } from "@metaplex-foundation/umi-bundle-defaults";
|
6
|
-
|
7
|
-
export function loadSecretKey(keypairPath: string) {
|
8
|
-
const secretKey = JSON.parse(fs.readFileSync(keypairPath, "utf8"));
|
9
|
-
return new Uint8Array(secretKey);
|
10
|
-
}
|
11
|
-
|
12
|
-
export function getSecretKey(keypairFilename: string = "id"): Uint8Array {
|
13
|
-
return loadSecretKey(
|
14
|
-
path.join(process.env.HOME!, ".config", "solana", keypairFilename + ".json")
|
15
|
-
);
|
16
|
-
}
|
4
|
+
import { getSecretKey } from "../local/shared";
|
17
5
|
|
18
6
|
export function setupTest(keypairFilename?: string): Signer {
|
19
7
|
const umi = createUmi(
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/utils/local/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,SAAS,EACV,MAAM,iBAAiB,CAAC;AAsDzB,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,MAAM,EAAE,EAClB,kBAAkB,CAAC,EAAE,SAAS,iBAqB/B"}
|
@@ -1,63 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.updateLookupTable = void 0;
|
4
|
-
const web3_js_1 = require("@solana/web3.js");
|
5
|
-
const solanaUtils_1 = require("../solanaUtils");
|
6
|
-
const solautoConstants_1 = require("../../constants/solautoConstants");
|
7
|
-
const keypair = web3_js_1.Keypair.fromSecretKey((0, solanaUtils_1.getSecretKey)());
|
8
|
-
async function createAndSendV0Tx(txInstructions) {
|
9
|
-
let latestBlockhash = await solautoConstants_1.CONNECTION.getLatestBlockhash("finalized");
|
10
|
-
const messageV0 = new web3_js_1.TransactionMessage({
|
11
|
-
payerKey: keypair.publicKey,
|
12
|
-
recentBlockhash: latestBlockhash.blockhash,
|
13
|
-
instructions: txInstructions,
|
14
|
-
}).compileToV0Message();
|
15
|
-
const transaction = new web3_js_1.VersionedTransaction(messageV0);
|
16
|
-
transaction.sign([keypair]);
|
17
|
-
const txid = await solautoConstants_1.CONNECTION.sendTransaction(transaction, {
|
18
|
-
maxRetries: 5,
|
19
|
-
});
|
20
|
-
const confirmation = await solautoConstants_1.CONNECTION.confirmTransaction({
|
21
|
-
signature: txid,
|
22
|
-
blockhash: latestBlockhash.blockhash,
|
23
|
-
lastValidBlockHeight: latestBlockhash.lastValidBlockHeight,
|
24
|
-
});
|
25
|
-
if (confirmation.value.err) {
|
26
|
-
throw new Error(confirmation.value.err.toString());
|
27
|
-
}
|
28
|
-
console.log(txid);
|
29
|
-
}
|
30
|
-
async function addAddressesIfNeeded(lookupTableAddress, existingAddresses, addressesToAdd) {
|
31
|
-
const addresses = addressesToAdd
|
32
|
-
.filter((x) => !existingAddresses.includes(x))
|
33
|
-
.map((x) => new web3_js_1.PublicKey(x));
|
34
|
-
if (addresses.length > 0) {
|
35
|
-
await createAndSendV0Tx([
|
36
|
-
web3_js_1.AddressLookupTableProgram.extendLookupTable({
|
37
|
-
payer: keypair.publicKey,
|
38
|
-
authority: keypair.publicKey,
|
39
|
-
lookupTable: lookupTableAddress,
|
40
|
-
addresses,
|
41
|
-
}),
|
42
|
-
]);
|
43
|
-
}
|
44
|
-
}
|
45
|
-
async function updateLookupTable(accounts, lookupTableAddress) {
|
46
|
-
let lookupTable = lookupTableAddress
|
47
|
-
? await solautoConstants_1.CONNECTION.getAddressLookupTable(lookupTableAddress)
|
48
|
-
: null;
|
49
|
-
if (lookupTable === null) {
|
50
|
-
const [createLutIx, addr] = web3_js_1.AddressLookupTableProgram.createLookupTable({
|
51
|
-
authority: keypair.publicKey,
|
52
|
-
payer: keypair.publicKey,
|
53
|
-
recentSlot: await solautoConstants_1.CONNECTION.getSlot({ commitment: "finalized" }),
|
54
|
-
});
|
55
|
-
lookupTableAddress = addr;
|
56
|
-
console.log("Lookup Table Address:", lookupTableAddress.toString());
|
57
|
-
createAndSendV0Tx([createLutIx]);
|
58
|
-
}
|
59
|
-
const existingAccounts = lookupTable?.value?.state.addresses.map((x) => x.toString()) ?? [];
|
60
|
-
console.log("Existing accounts: ", existingAccounts.length);
|
61
|
-
await addAddressesIfNeeded(lookupTableAddress, existingAccounts, accounts);
|
62
|
-
}
|
63
|
-
exports.updateLookupTable = updateLookupTable;
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"updateMarginfiLUT.d.ts","sourceRoot":"","sources":["../../../src/utils/local/updateMarginfiLUT.ts"],"names":[],"mappings":""}
|
@@ -1,22 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const web3_js_1 = require("@solana/web3.js");
|
4
|
-
const marginfiAccounts_1 = require("../../constants/marginfiAccounts");
|
5
|
-
const marginfiAccounts_2 = require("../../constants/marginfiAccounts");
|
6
|
-
const marginfi_sdk_1 = require("../../marginfi-sdk");
|
7
|
-
const shared_1 = require("./shared");
|
8
|
-
const LOOKUP_TABLE_ADDRESS = new web3_js_1.PublicKey(marginfiAccounts_1.MARGINFI_ACCOUNTS_LOOKUP_TABLE);
|
9
|
-
async function addBanks() {
|
10
|
-
for (const key in marginfiAccounts_2.MARGINFI_ACCOUNTS) {
|
11
|
-
const accounts = marginfiAccounts_2.MARGINFI_ACCOUNTS[key];
|
12
|
-
await (0, shared_1.updateLookupTable)([
|
13
|
-
accounts.mint,
|
14
|
-
accounts.bank,
|
15
|
-
accounts.liquidityVault,
|
16
|
-
accounts.vaultAuthority,
|
17
|
-
accounts.priceOracle,
|
18
|
-
], LOOKUP_TABLE_ADDRESS);
|
19
|
-
}
|
20
|
-
}
|
21
|
-
(0, shared_1.updateLookupTable)([marginfiAccounts_2.DEFAULT_MARGINFI_GROUP, marginfi_sdk_1.MARGINFI_PROGRAM_ID], LOOKUP_TABLE_ADDRESS);
|
22
|
-
addBanks();
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"updateSolautoLUT.d.ts","sourceRoot":"","sources":["../../../src/utils/local/updateSolautoLUT.ts"],"names":[],"mappings":""}
|
@@ -1,13 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const web3_js_1 = require("@solana/web3.js");
|
4
|
-
const accountUtils_1 = require("../accountUtils");
|
5
|
-
const generalAccounts_1 = require("../../constants/generalAccounts");
|
6
|
-
const tokenConstants_1 = require("../../constants/tokenConstants");
|
7
|
-
const shared_1 = require("./shared");
|
8
|
-
const solautoConstants_1 = require("../../constants/solautoConstants");
|
9
|
-
const solautoManagerTokenAccounts = (0, accountUtils_1.getTokenAccounts)(generalAccounts_1.SOLAUTO_MANAGER, tokenConstants_1.ALL_SUPPORTED_TOKENS.map((x) => new web3_js_1.PublicKey(x)));
|
10
|
-
(0, shared_1.updateLookupTable)([
|
11
|
-
...solautoConstants_1.STANDARD_LUT_ACCOUNTS,
|
12
|
-
...solautoManagerTokenAccounts.map((x) => x.toString())
|
13
|
-
]);
|