@haven-fi/solauto-sdk 1.0.652 → 1.0.653

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.
@@ -4,6 +4,7 @@ exports.createSolautoSettings = createSolautoSettings;
4
4
  exports.getPositionExBulk = getPositionExBulk;
5
5
  exports.getOrCreatePositionEx = getOrCreatePositionEx;
6
6
  exports.createFakePositionState = createFakePositionState;
7
+ const web3_js_1 = require("@solana/web3.js");
7
8
  const umi_web3js_adapters_1 = require("@metaplex-foundation/umi-web3js-adapters");
8
9
  const generated_1 = require("../generated");
9
10
  const utils_1 = require("../utils");
@@ -40,8 +41,8 @@ async function getOrCreatePositionEx(umi, publicKey, customArgs, contextUpdates)
40
41
  throw new Error("Must provide a supply & debt mint if creating a new position");
41
42
  }
42
43
  const placeholderState = createFakePositionState({
43
- mint: customArgs.supplyMint,
44
- }, { mint: customArgs.debtMint }, 0, 0);
44
+ mint: customArgs?.supplyMint ?? web3_js_1.PublicKey.default,
45
+ }, { mint: customArgs?.debtMint ?? web3_js_1.PublicKey.default }, 0, 0);
45
46
  const lendingPlatform = data
46
47
  ? data.position.lendingPlatform
47
48
  : customArgs.lendingPlatform;
@@ -13,10 +13,8 @@ import {
13
13
  SOLAUTO_PROD_PROGRAM,
14
14
  SOLAUTO_TEST_PROGRAM,
15
15
  TransactionsManager,
16
- USDC,
17
16
  } from "../src";
18
17
  import { getSecretKey } from "./shared";
19
- import { NATIVE_MINT } from "@solana/spl-token";
20
18
 
21
19
  const payForTransaction = false;
22
20
  const testProgram = true;
@@ -31,7 +29,7 @@ export async function main() {
31
29
 
32
30
  const signer = createSignerFromKeypair(
33
31
  umi,
34
- fromWeb3JsKeypair(Keypair.fromSecretKey(getSecretKey()))
32
+ fromWeb3JsKeypair(Keypair.fromSecretKey(getSecretKey("solauto-manager")))
35
33
  );
36
34
 
37
35
  const client = getClient(LendingPlatform.Marginfi, {
@@ -43,25 +41,24 @@ export async function main() {
43
41
  });
44
42
 
45
43
  await client.initialize({
46
- positionId: 5,
47
- supplyMint: NATIVE_MINT,
48
- debtMint: new PublicKey(USDC)
44
+ positionId: 1,
45
+ authority: new PublicKey("5UqsR2PGzbP8pGPbXEeXx86Gjz2N2UFBAuFZUSVydAEe"),
49
46
  });
50
47
 
51
- // const transactionItems = [rebalance(client)];
48
+ const transactionItems = [rebalance(client)];
52
49
 
53
- // const txManager = new TransactionsManager(
54
- // client,
55
- // undefined,
56
- // payForTransaction ? "normal" : "only-simulate",
57
- // PriorityFeeSetting.Min,
58
- // true,
59
- // undefined,
60
- // { totalRetries: 5 }
61
- // );
62
- // const statuses = await txManager.clientSend(transactionItems);
50
+ const txManager = new TransactionsManager(
51
+ client,
52
+ undefined,
53
+ payForTransaction ? "normal" : "only-simulate",
54
+ PriorityFeeSetting.Min,
55
+ true,
56
+ undefined,
57
+ { totalRetries: 5 }
58
+ );
59
+ const statuses = await txManager.clientSend(transactionItems);
63
60
 
64
- // consoleLog(statuses);
61
+ consoleLog(statuses);
65
62
  }
66
63
 
67
64
  main();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.652",
3
+ "version": "1.0.653",
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",
@@ -90,9 +90,9 @@ export async function getOrCreatePositionEx(
90
90
 
91
91
  const placeholderState = createFakePositionState(
92
92
  {
93
- mint: customArgs!.supplyMint!,
93
+ mint: customArgs?.supplyMint ?? PublicKey.default,
94
94
  },
95
- { mint: customArgs!.debtMint! },
95
+ { mint: customArgs?.debtMint ?? PublicKey.default },
96
96
  0,
97
97
  0
98
98
  );