@haven-fi/solauto-sdk 1.0.43 → 1.0.45

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- {"version":3,"file":"solautoClient.d.ts","sourceRoot":"","sources":["../../src/clients/solautoClient.ts"],"names":[],"mappings":"AAAA,OAAO,gCAAgC,CAAC;AACxC,OAAO,EAEL,UAAU,EACV,SAAS,EACV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,MAAM,EACN,kBAAkB,EAClB,GAAG,EAQJ,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,aAAa,EAEd,MAAM,iDAAiD,CAAC;AACzD,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,wBAAwB,EACxB,yBAAyB,EACzB,gCAAgC,EAChC,sBAAsB,EASvB,MAAM,cAAc,CAAC;AAOtB,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAMvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAInE,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAEpE,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,aAAa,CAAC;IAEvB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB,oBAAoB,CAAC,EAAE,SAAS,CAAC;IACjC,mBAAmB,CAAC,EAAE,SAAS,CAAC;CACjC;AAED,8BAAsB,aAAa;IAyCxB,SAAS,CAAC;IAxCZ,GAAG,EAAG,GAAG,CAAC;IACV,UAAU,EAAG,UAAU,CAAC;IACxB,eAAe,EAAG,eAAe,CAAC;IAElC,SAAS,EAAG,SAAS,CAAC;IACtB,MAAM,EAAG,MAAM,CAAC;IAEhB,UAAU,EA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EtC,mBAAmB,CAAC,IAAI,EAAE,iBAAiB,GAAG,kBAAkB;IAuFhE,QAAQ,CAAC,WAAW,CAClB,gBAAgB,EAAE,gBAAgB,EAClC,uBAAuB,EAAE,SAAS,GACjC,kBAAkB;IAErB,QAAQ,CAAC,UAAU,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,kBAAkB;IAE3E,QAAQ,CAAC,SAAS,CAChB,aAAa,EAAE,GAAG,GAAG,GAAG,EACxB,WAAW,EAAE,cAAc,EAC3B,aAAa,EAAE,wBAAwB,EACvC,SAAS,CAAC,EAAE,gBAAgB,EAC5B,2BAA2B,CAAC,EAAE,MAAM,EACpC,WAAW,CAAC,EAAE,MAAM,GACnB,kBAAkB;IAEf,qBAAqB,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;CAYlE"}
@@ -115,8 +115,7 @@ class SolautoClient {
115
115
  this.livePositionUpdates.reset();
116
116
  }
117
117
  defaultLookupTables() {
118
- // TODO: solauto lookup table here
119
- return [];
118
+ return [solautoConstants_1.SOLAUTO_LUT];
120
119
  }
121
120
  lutAccountsToAdd() {
122
121
  return [
@@ -77,7 +77,7 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
77
77
  return [
78
78
  ...super.lutAccountsToAdd(),
79
79
  this.marginfiAccountPk,
80
- this.intermediaryMarginfiAccountPk,
80
+ ...(this.signer.publicKey.toString() === this.authority.toString() ? [this.intermediaryMarginfiAccountPk] : []),
81
81
  ];
82
82
  }
83
83
  marginfiAccountInitialize() {
@@ -8,6 +8,7 @@ export declare const PRICES: {
8
8
  time: number;
9
9
  };
10
10
  };
11
+ export declare const SOLAUTO_LUT = "9D4xwZwDf46n9ft5gQxZzq3rBbdRXsXojKQLZbBdskPY";
11
12
  export declare const JUPITER_PROGRAM_ID = "JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4";
12
13
  export declare const STANDARD_LUT_ACCOUNTS: string[];
13
14
  //# sourceMappingURL=solautoConstants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"solautoConstants.d.ts","sourceRoot":"","sources":["../../src/constants/solautoConstants.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,yBAAyB,OAAO,CAAC;AAC9C,eAAO,MAAM,qBAAqB,OAAO,CAAC;AAC1C,eAAO,MAAM,iCAAiC,IAAI,CAAC;AACnD,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAQrC,eAAO,MAAM,MAAM,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;KAAE,CAAA;CAAO,CAAC;AAE9E,eAAO,MAAM,kBAAkB,gDAAgD,CAAC;AAEhF,eAAO,MAAM,qBAAqB,UAWjC,CAAC"}
1
+ {"version":3,"file":"solautoConstants.d.ts","sourceRoot":"","sources":["../../src/constants/solautoConstants.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,yBAAyB,OAAO,CAAC;AAC9C,eAAO,MAAM,qBAAqB,OAAO,CAAC;AAC1C,eAAO,MAAM,iCAAiC,IAAI,CAAC;AACnD,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAQrC,eAAO,MAAM,MAAM,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;KAAE,CAAA;CAAO,CAAC;AAE9E,eAAO,MAAM,WAAW,iDAAiD,CAAC;AAE1E,eAAO,MAAM,kBAAkB,gDAAgD,CAAC;AAEhF,eAAO,MAAM,qBAAqB,UAWjC,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.STANDARD_LUT_ACCOUNTS = exports.JUPITER_PROGRAM_ID = exports.PRICES = exports.MAX_REPAY_GAP_BPS = exports.MIN_POSITION_STATE_FRESHNESS_SECS = exports.DEFAULT_LIMIT_GAP_BPS = exports.DEFAULT_RISK_AVERSION_BPS = void 0;
3
+ exports.STANDARD_LUT_ACCOUNTS = exports.JUPITER_PROGRAM_ID = exports.SOLAUTO_LUT = exports.PRICES = exports.MAX_REPAY_GAP_BPS = exports.MIN_POSITION_STATE_FRESHNESS_SECS = exports.DEFAULT_LIMIT_GAP_BPS = exports.DEFAULT_RISK_AVERSION_BPS = void 0;
4
4
  const web3_js_1 = require("@solana/web3.js");
5
5
  const spl_token_1 = require("@solana/spl-token");
6
6
  // import { JitoRpcConnection } from "jito-ts";
@@ -16,6 +16,7 @@ exports.MAX_REPAY_GAP_BPS = 100;
16
16
  // "finalized"
17
17
  // );
18
18
  exports.PRICES = {};
19
+ exports.SOLAUTO_LUT = "9D4xwZwDf46n9ft5gQxZzq3rBbdRXsXojKQLZbBdskPY";
19
20
  exports.JUPITER_PROGRAM_ID = "JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4";
20
21
  exports.STANDARD_LUT_ACCOUNTS = [
21
22
  web3_js_1.PublicKey.default.toString(),
@@ -210,7 +210,7 @@ exports.getAllPositionsByAuthority = getAllPositionsByAuthority;
210
210
  async function positionStateWithLatestPrices(umi, state, protocolAccount, lendingPlatform) {
211
211
  if ((0, generalUtils_1.currentUnixSeconds)() - Number(state.lastUpdated) > 60 * 60 * 24 * 7) {
212
212
  if (lendingPlatform === generated_1.LendingPlatform.Marginfi) {
213
- return await (0, marginfiUtils_1.getMarginfiAccountPositionState)(umi, (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(state.supply.mint), (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(state.debt.mint), protocolAccount);
213
+ return await (0, marginfiUtils_1.getMarginfiAccountPositionState)(umi, protocolAccount, (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(state.supply.mint), (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(state.debt.mint));
214
214
  }
215
215
  else {
216
216
  throw new Error("Lending platorm not yet supported");
@@ -0,0 +1,47 @@
1
+ import {
2
+ createSignerFromKeypair,
3
+ publicKey,
4
+ signerIdentity,
5
+ transactionBuilder,
6
+ } from "@metaplex-foundation/umi";
7
+ import {
8
+ getSolanaRpcConnection,
9
+ sendSingleOptimizedTransaction,
10
+ } from "../src/utils/solanaUtils";
11
+ import { marginfiAccountInitialize } from "../src/marginfi-sdk";
12
+ import { DEFAULT_MARGINFI_GROUP } from "../src/constants";
13
+ import { getSecretKey } from "./shared";
14
+ import { updateSolautoLut } from "./updateSolautoLUT";
15
+
16
+ async function create() {
17
+ let [connection, umi] = getSolanaRpcConnection(process.env.HELIUS_API_KEY!);
18
+
19
+ const secretKey = getSecretKey("solauto-manager");
20
+ const signerKeypair = umi.eddsa.createKeypairFromSecretKey(secretKey);
21
+ const signer = createSignerFromKeypair(umi, signerKeypair);
22
+
23
+ umi = umi.use(signerIdentity(signer));
24
+
25
+ const marginfiAccount = createSignerFromKeypair(
26
+ umi,
27
+ umi.eddsa.generateKeypair()
28
+ );
29
+ console.log(marginfiAccount.publicKey);
30
+
31
+ const tx = marginfiAccountInitialize(umi, {
32
+ marginfiAccount,
33
+ marginfiGroup: publicKey(DEFAULT_MARGINFI_GROUP),
34
+ authority: signer,
35
+ feePayer: signer,
36
+ });
37
+
38
+ await sendSingleOptimizedTransaction(
39
+ umi,
40
+ connection,
41
+ transactionBuilder().add(tx)
42
+ );
43
+
44
+ await updateSolautoLut([marginfiAccount.publicKey.toString()]);
45
+ }
46
+
47
+ create();
@@ -1,10 +1,10 @@
1
1
  import { PublicKey } from "@solana/web3.js";
2
- import { MARGINFI_ACCOUNTS_LOOKUP_TABLE } from "../constants/marginfiAccounts";
2
+ import { MARGINFI_ACCOUNTS_LOOKUP_TABLE } from "../src/constants/marginfiAccounts";
3
3
  import {
4
4
  MARGINFI_ACCOUNTS,
5
5
  DEFAULT_MARGINFI_GROUP,
6
- } from "../constants/marginfiAccounts";
7
- import { MARGINFI_PROGRAM_ID } from "../marginfi-sdk";
6
+ } from "../src/constants/marginfiAccounts";
7
+ import { MARGINFI_PROGRAM_ID } from "../src/marginfi-sdk";
8
8
  import { updateLookupTable } from "./shared";
9
9
 
10
10
  const LOOKUP_TABLE_ADDRESS = new PublicKey(MARGINFI_ACCOUNTS_LOOKUP_TABLE);
@@ -3,13 +3,20 @@ import { getTokenAccounts } from "../src/utils/accountUtils";
3
3
  import { SOLAUTO_MANAGER } from "../src/constants/generalAccounts";
4
4
  import { ALL_SUPPORTED_TOKENS } from "../src/constants/tokenConstants";
5
5
  import { updateLookupTable } from "./shared";
6
- import { STANDARD_LUT_ACCOUNTS } from "../src/constants/solautoConstants";
6
+ import { SOLAUTO_LUT, STANDARD_LUT_ACCOUNTS } from "../src/constants/solautoConstants";
7
7
 
8
+ const LOOKUP_TABLE_ADDRESS = new PublicKey(SOLAUTO_LUT);
8
9
  const solautoManagerTokenAccounts = getTokenAccounts(SOLAUTO_MANAGER, ALL_SUPPORTED_TOKENS.map((x) => new PublicKey(x)));
9
10
 
10
- updateLookupTable(
11
- [
12
- ...STANDARD_LUT_ACCOUNTS,
13
- ...solautoManagerTokenAccounts.map((x) => x.toString())
14
- ]
15
- );
11
+ export async function updateSolautoLut(additionalAccounts?: string[]) {
12
+ return updateLookupTable(
13
+ [
14
+ ...STANDARD_LUT_ACCOUNTS,
15
+ ...solautoManagerTokenAccounts.map((x) => x.toString()),
16
+ ...(additionalAccounts ?? [])
17
+ ],
18
+ LOOKUP_TABLE_ADDRESS
19
+ );
20
+ }
21
+
22
+ updateSolautoLut();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.43",
3
+ "version": "1.0.45",
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",
@@ -56,7 +56,7 @@ import {
56
56
  } from "../utils/solanaUtils";
57
57
  import { FlashLoanDetails } from "../utils/solauto/rebalanceUtils";
58
58
  import { NATIVE_MINT } from "@solana/spl-token";
59
- import { MIN_POSITION_STATE_FRESHNESS_SECS } from "../constants/solautoConstants";
59
+ import { MIN_POSITION_STATE_FRESHNESS_SECS, SOLAUTO_LUT } from "../constants/solautoConstants";
60
60
  import { currentUnixSeconds } from "../utils/generalUtils";
61
61
  import { LivePositionUpdates } from "../utils/solauto/generalUtils";
62
62
 
@@ -267,8 +267,7 @@ export abstract class SolautoClient {
267
267
  }
268
268
 
269
269
  defaultLookupTables(): string[] {
270
- // TODO: solauto lookup table here
271
- return [];
270
+ return [SOLAUTO_LUT];
272
271
  }
273
272
 
274
273
  lutAccountsToAdd(): PublicKey[] {
@@ -170,7 +170,7 @@ export class SolautoMarginfiClient extends SolautoClient {
170
170
  return [
171
171
  ...super.lutAccountsToAdd(),
172
172
  this.marginfiAccountPk,
173
- this.intermediaryMarginfiAccountPk,
173
+ ...(this.signer.publicKey.toString() === this.authority.toString() ? [this.intermediaryMarginfiAccountPk] : []),
174
174
  ];
175
175
  }
176
176
 
@@ -26,6 +26,8 @@ export const MAX_REPAY_GAP_BPS = 100;
26
26
 
27
27
  export const PRICES: { [key: string]: { price: number; time: number; } } = {};
28
28
 
29
+ export const SOLAUTO_LUT = "9D4xwZwDf46n9ft5gQxZzq3rBbdRXsXojKQLZbBdskPY";
30
+
29
31
  export const JUPITER_PROGRAM_ID = "JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4";
30
32
 
31
33
  export const STANDARD_LUT_ACCOUNTS = [
@@ -326,9 +326,9 @@ export async function positionStateWithLatestPrices(
326
326
  if (lendingPlatform === LendingPlatform.Marginfi) {
327
327
  return await getMarginfiAccountPositionState(
328
328
  umi,
329
+ protocolAccount,
329
330
  toWeb3JsPublicKey(state.supply.mint),
330
331
  toWeb3JsPublicKey(state.debt.mint),
331
- protocolAccount
332
332
  );
333
333
  } else {
334
334
  throw new Error("Lending platorm not yet supported");
@@ -34,8 +34,4 @@ describe("Assert lookup tables up-to-date", async () => {
34
34
  }
35
35
  }
36
36
  });
37
-
38
- it("solauto accounts LUT should have everything", async () => {
39
- // TODO
40
- });
41
37
  });