@haven-fi/solauto-sdk 1.0.293 → 1.0.296

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- {"version":3,"file":"solanaUtils.d.ts","sourceRoot":"","sources":["../../src/utils/solanaUtils.ts"],"names":[],"mappings":"AACA,OAAO,EACL,uBAAuB,EACvB,MAAM,EACN,kBAAkB,EAClB,GAAG,EACH,kBAAkB,EAGnB,MAAM,0BAA0B,CAAC;AAOlC,OAAO,EAKL,UAAU,EACV,SAAS,EAKT,sBAAsB,EAEvB,MAAM,iBAAiB,CAAC;AAgBzB,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAIlE,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,MAAM,UAErD;AAED,wBAAgB,oBAAoB,CAAC,eAAe,EAAE,MAAM,UAE3D;AAED,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,MAAM,EACd,SAAS,GAAE,SAAgC,GAC1C,CAAC,UAAU,EAAE,GAAG,CAAC,CAQnB;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,sBAAsB,GACzB,kBAAkB,CAMpB;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,MAAM,GACtB,kBAAkB,CAOpB;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,kBAAkB,CAOpB;AAED,wBAAgB,iCAAiC,CAC/C,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,SAAS,GACd,kBAAkB,CAUpB;AAED,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,SAAS,EACtB,QAAQ,EAAE,MAAM,GACf,kBAAkB,CASpB;AAED,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,SAAS,EACvB,SAAS,EAAE,SAAS,GACnB,kBAAk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AChC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,kBAAkB,EAC/B,gBAAgB,CAAC,EAAE,MAAM,EACzB,gBAAgB,CAAC,EAAE,MAAM,sBAa1B;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,kBAAkB,EAC/B,gBAAgB,CAAC,EAAE,MAAM,EACzB,gBAAgB,CAAC,EAAE,MAAM,sBA2D1B;AAuBD,wBAAsB,2BAA2B,CAC/C,GAAG,EAAE,GAAG,EACR,EAAE,EAAE,kBAAkB,EACtB,eAAe,EAAE,kBAAkB,GAClC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAsB7B;AAiDD,wBAAsB,8BAA8B,CAClD,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,UAAU,EACtB,EAAE,EAAE,kBAAkB,EACtB,MAAM,CAAC,EAAE,kBAAkB,EAC3B,eAAe,GAAE,kBAA2C,EAC5D,cAAc,CAAC,EAAE,MAAM,IAAI,GAC1B,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CA2DjC"}
@@ -212,13 +212,14 @@ async function sendSingleOptimizedTransaction(umi, connection, tx, txType, prior
212
212
  if (!cuPrice) {
213
213
  cuPrice = 1000000;
214
214
  }
215
+ cuPrice = Math.min(cuPrice, 100 * 1000000);
215
216
  (0, generalUtils_1.consoleLog)("Compute unit price: ", cuPrice);
216
217
  }
217
218
  let computeUnitLimit = undefined;
218
219
  if (txType !== "skip-simulation") {
219
220
  const simulationResult = await (0, generalUtils_1.retryWithExponentialBackoff)(async () => await simulateTransaction(umi, connection, await assembleFinalTransaction(umi.identity, tx, cuPrice, 1400000).setLatestBlockhash(umi)), 3);
220
221
  simulationResult.value.err;
221
- computeUnitLimit = Math.round(simulationResult.value.unitsConsumed * 1.1);
222
+ computeUnitLimit = Math.round(simulationResult.value.unitsConsumed * 1.2);
222
223
  (0, generalUtils_1.consoleLog)("Compute unit limit: ", computeUnitLimit);
223
224
  }
224
225
  if (txType !== "only-simulate") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.293",
3
+ "version": "1.0.296",
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",
@@ -379,6 +379,7 @@ export async function sendSingleOptimizedTransaction(
379
379
  if (!cuPrice) {
380
380
  cuPrice = 1000000;
381
381
  }
382
+ cuPrice = Math.min(cuPrice, 100 * 1_000_000);
382
383
  consoleLog("Compute unit price: ", cuPrice);
383
384
  }
384
385
 
@@ -399,7 +400,7 @@ export async function sendSingleOptimizedTransaction(
399
400
  3
400
401
  );
401
402
  simulationResult.value.err;
402
- computeUnitLimit = Math.round(simulationResult.value.unitsConsumed! * 1.1);
403
+ computeUnitLimit = Math.round(simulationResult.value.unitsConsumed! * 1.2);
403
404
  consoleLog("Compute unit limit: ", computeUnitLimit);
404
405
  }
405
406
 
@@ -54,8 +54,8 @@ describe("Solauto Marginfi tests", async () => {
54
54
  // marginfiAccount: new PublicKey(
55
55
  // "4nNvUXF5YqHFcH2nGweSiuvy1ct7V5FXfoCLKFYUN36z"
56
56
  // ),
57
- supplyMint: NATIVE_MINT,
58
- debtMint: new PublicKey(USDC),
57
+ // supplyMint: NATIVE_MINT,
58
+ // debtMint: new PublicKey(USDC),
59
59
  });
60
60
 
61
61
  const transactionItems: TransactionItem[] = [];
@@ -9,6 +9,9 @@ import {
9
9
  } from "../../src/utils/solanaUtils";
10
10
  import { publicKey } from "@metaplex-foundation/umi";
11
11
  import { assert } from "chai";
12
+ import { getTokenAccount } from "../../src/utils";
13
+ import { SOLAUTO_FEES_WALLET } from "../../src/constants";
14
+ import { PublicKey } from "@solana/web3.js";
12
15
 
13
16
  describe("Assert Solauto fee token accounts are created", async () => {
14
17
  it("all Solauto fee token accounts created", async () => {
@@ -17,9 +20,12 @@ describe("Assert Solauto fee token accounts are created", async () => {
17
20
  );
18
21
 
19
22
  const tokenAccounts = await umi.rpc.getAccounts(
20
- ALL_SUPPORTED_TOKENS.map((x) => publicKey(x))
23
+ ALL_SUPPORTED_TOKENS.map((x) =>
24
+ publicKey(getTokenAccount(SOLAUTO_FEES_WALLET, new PublicKey(x)))
25
+ )
21
26
  );
22
27
  for (let i = 0; i < tokenAccounts.length; i++) {
28
+ console.log(tokenAccounts[i].publicKey.toString());
23
29
  if (!tokenAccounts[i].exists) {
24
30
  console.log(
25
31
  "Missing Solauto fees TA for ",
@@ -165,9 +165,9 @@ async function getFakePosition(
165
165
  padding: [],
166
166
  },
167
167
  lendingPlatform: LendingPlatform.Marginfi,
168
- supplyMint: publicKey(client.supplyMint),
169
- debtMint: publicKey(client.debtMint),
170
- protocolAccount: publicKey(PublicKey.default),
168
+ protocolSupplyAccount: publicKey(PublicKey.default),
169
+ protocolDebtAccount: publicKey(PublicKey.default),
170
+ protocolUserAccount: publicKey(PublicKey.default),
171
171
  settingParams: settings,
172
172
  padding1: [],
173
173
  padding: [],