@huma-finance/sdk 0.0.72-beta.883 → 0.0.72-beta.895

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.
@@ -2,11 +2,12 @@ import { Connection, PublicKey } from '@solana/web3.js';
2
2
  import { POOL_NAME, SolanaChainEnum } from '@huma-finance/shared';
3
3
  export declare class HumaSolanaContext {
4
4
  #private;
5
- constructor({ publicKey, connection, chainId, poolName, }: {
5
+ constructor({ publicKey, connection, chainId, poolName, heliusApiKey, }: {
6
6
  publicKey: PublicKey;
7
7
  connection: Connection;
8
8
  chainId: SolanaChainEnum;
9
9
  poolName: POOL_NAME;
10
+ heliusApiKey?: string;
10
11
  });
11
12
  get publicKey(): PublicKey;
12
13
  set publicKey(value: PublicKey);
@@ -16,4 +17,5 @@ export declare class HumaSolanaContext {
16
17
  set chainId(value: SolanaChainEnum);
17
18
  get poolName(): POOL_NAME;
18
19
  set poolName(value: POOL_NAME);
20
+ get heliusApiKey(): string | null;
19
21
  }
@@ -1,14 +1,15 @@
1
1
  "use strict";
2
- var _HumaSolanaContext_publicKey, _HumaSolanaContext_connection, _HumaSolanaContext_chainId, _HumaSolanaContext_poolName;
2
+ var _HumaSolanaContext_publicKey, _HumaSolanaContext_connection, _HumaSolanaContext_chainId, _HumaSolanaContext_poolName, _HumaSolanaContext_heliusApiKey;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.HumaSolanaContext = void 0;
5
5
  const tslib_1 = require("tslib");
6
6
  class HumaSolanaContext {
7
- constructor({ publicKey, connection, chainId, poolName, }) {
7
+ constructor({ publicKey, connection, chainId, poolName, heliusApiKey, }) {
8
8
  _HumaSolanaContext_publicKey.set(this, void 0);
9
9
  _HumaSolanaContext_connection.set(this, void 0);
10
10
  _HumaSolanaContext_chainId.set(this, void 0);
11
11
  _HumaSolanaContext_poolName.set(this, void 0);
12
+ _HumaSolanaContext_heliusApiKey.set(this, void 0);
12
13
  if (!publicKey || !connection || !chainId || !poolName) {
13
14
  throw new Error('All parameters are required');
14
15
  }
@@ -16,6 +17,7 @@ class HumaSolanaContext {
16
17
  tslib_1.__classPrivateFieldSet(this, _HumaSolanaContext_connection, connection, "f");
17
18
  tslib_1.__classPrivateFieldSet(this, _HumaSolanaContext_chainId, chainId, "f");
18
19
  tslib_1.__classPrivateFieldSet(this, _HumaSolanaContext_poolName, poolName, "f");
20
+ tslib_1.__classPrivateFieldSet(this, _HumaSolanaContext_heliusApiKey, heliusApiKey || null, "f");
19
21
  }
20
22
  get publicKey() {
21
23
  return tslib_1.__classPrivateFieldGet(this, _HumaSolanaContext_publicKey, "f");
@@ -41,7 +43,10 @@ class HumaSolanaContext {
41
43
  set poolName(value) {
42
44
  tslib_1.__classPrivateFieldSet(this, _HumaSolanaContext_poolName, value, "f");
43
45
  }
46
+ get heliusApiKey() {
47
+ return tslib_1.__classPrivateFieldGet(this, _HumaSolanaContext_heliusApiKey, "f");
48
+ }
44
49
  }
45
50
  exports.HumaSolanaContext = HumaSolanaContext;
46
- _HumaSolanaContext_publicKey = new WeakMap(), _HumaSolanaContext_connection = new WeakMap(), _HumaSolanaContext_chainId = new WeakMap(), _HumaSolanaContext_poolName = new WeakMap();
51
+ _HumaSolanaContext_publicKey = new WeakMap(), _HumaSolanaContext_connection = new WeakMap(), _HumaSolanaContext_chainId = new WeakMap(), _HumaSolanaContext_poolName = new WeakMap(), _HumaSolanaContext_heliusApiKey = new WeakMap();
47
52
  //# sourceMappingURL=HumaSolanaContext.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"HumaSolanaContext.js","sourceRoot":"","sources":["../../../../src/helpers/solana/HumaSolanaContext.ts"],"names":[],"mappings":";;;;;AAGA,MAAa,iBAAiB;IAS5B,YAAY,EACV,SAAS,EACT,UAAU,EACV,OAAO,EACP,QAAQ,GAMT;QAlBD,+CAAqB;QAErB,gDAAuB;QAEvB,6CAAyB;QAEzB,8CAAoB;QAalB,IAAI,CAAC,SAAS,IAAI,CAAC,UAA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,CAAC,SAAS,IAAI,CAAC,UAAU,IAAI,CAAC,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;YACvD,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAA;QAChD,CAAC;QAED,+BAAA,IAAI,gCAAc,SAAS,MAAA,CAAA;QAC3B,+BAAA,IAAI,iCAAe,UAAU,MAAA,CAAA;QAC7B,+BAAA,IAAI,8BAAY,OAAO,MAAA,CAAA;QACvB,+BAAA,IAAI,+BAAa,QAAQ,MAAA,CAAA;QACzB,+BAAA,IAAI,mCAAiB,YAAY,IAAI,IAAI,MAAA,CAAA;IAC3C,CAAC;IAED,IAAI,SAAS;QACX,OAAO,+BAAA,IAAI,oCAAW,CAAA;IACxB,CAAC;IAED,IAAI,SAAS,CAAC,KAAgB;QAC5B,+BAAA,IAAI,gCAAc,KAAK,MAAA,CAAA;IACzB,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,+BAAA,IAAI,qCAAY,CAAA;IACzB,CAAC;IAED,IAAI,UAAU,CAAC,KAAiB;QAC9B,+BAAA,IAAI,iCAAe,KAAK,MAAA,CAAA;IAC1B,CAAC;IAED,IAAI,OAAO;QACT,OAAO,+BAAA,IAAI,kCAAS,CAAA;IACtB,CAAC;IAED,IAAI,OAAO,CAAC,KAAsB;QAChC,+BAAA,IAAI,8BAAY,KAAK,MAAA,CAAA;IACvB,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,+BAAA,IAAI,mCAAU,CAAA;IACvB,CAAC;IAED,IAAI,QAAQ,CAAC,KAAgB;QAC3B,+BAAA,IAAI,+BAAa,KAAK,MAAA,CAAA;IACxB,CAAC;IAED,IAAI,YAAY;QACd,OAAO,+BAAA,IAAI,uCAAc,CAAA;IAC3B,CAAC;CACF;AAtED,8CAsEC"}
@@ -1,5 +1,7 @@
1
1
  import { Connection, PublicKey, Transaction } from '@solana/web3.js';
2
+ import { SolanaChainEnum } from '@huma-finance/shared';
2
3
  import { HumaSolanaContext } from '../../helpers';
3
4
  export declare function extractWritableAccounts(tx: Transaction): PublicKey[];
4
- export declare function buildOptimalTransaction(tx: Transaction, txAccounts: PublicKey[], context: HumaSolanaContext): Promise<Transaction>;
5
- export declare function buildOptimalTransactionFromConnection(tx: Transaction, txAccounts: PublicKey[], connection: Connection): Promise<Transaction>;
5
+ export type HeliusPriorityLevel = 'Min' | 'Low' | 'Medium' | 'High' | 'VeryHigh' | 'UnsafeMax';
6
+ export declare function buildOptimalTransaction(tx: Transaction, txAccounts: PublicKey[], context: HumaSolanaContext, heliusPriorityLevel?: HeliusPriorityLevel): Promise<Transaction>;
7
+ export declare function buildOptimalTransactionFromConnection(tx: Transaction, txAccounts: PublicKey[], connection: Connection, chainId: SolanaChainEnum, signer: PublicKey, heliusPriorityLevel?: HeliusPriorityLevel, heliusApiKey?: string | null): Promise<Transaction>;
@@ -4,6 +4,7 @@ exports.extractWritableAccounts = extractWritableAccounts;
4
4
  exports.buildOptimalTransaction = buildOptimalTransaction;
5
5
  exports.buildOptimalTransactionFromConnection = buildOptimalTransactionFromConnection;
6
6
  const web3_js_1 = require("@solana/web3.js");
7
+ const shared_1 = require("@huma-finance/shared");
7
8
  function extractWritableAccounts(tx) {
8
9
  const writableAccounts = new Set();
9
10
  tx.instructions.forEach((ix) => {
@@ -15,19 +16,72 @@ function extractWritableAccounts(tx) {
15
16
  });
16
17
  return Array.from(writableAccounts);
17
18
  }
18
- async function buildOptimalTransactionImpl(tx, txAccounts, connection) {
19
- const recentBlockhash = await connection.getLatestBlockhash('confirmed');
19
+ async function getPriorityFeeEstimate(priorityLevel, tx, txAccounts, chainEnum, heliusApiKey) {
20
+ if (!heliusApiKey) {
21
+ return null;
22
+ }
23
+ const heliusURL = chainEnum === shared_1.SolanaChainEnum.SolanaMainnet
24
+ ? `https://mainnet.helius-rpc.com/?api-key=${heliusApiKey}`
25
+ : `https://devnet.helius-rpc.com/?api-key=${heliusApiKey}`;
26
+ try {
27
+ const response = await fetch(heliusURL, {
28
+ method: 'POST',
29
+ headers: { 'Content-Type': 'application/json' },
30
+ body: JSON.stringify({
31
+ jsonrpc: '2.0',
32
+ id: '1',
33
+ method: 'getPriorityFeeEstimate',
34
+ params: [
35
+ {
36
+ accountKeys: txAccounts,
37
+ options: {
38
+ priorityLevel,
39
+ evaluateEmptySlotAsZero: true,
40
+ },
41
+ },
42
+ ],
43
+ }),
44
+ });
45
+ const data = await response.json();
46
+ return data.result;
47
+ }
48
+ catch (err) {
49
+ console.warn(err);
50
+ return null;
51
+ }
52
+ }
53
+ async function buildOptimalTransactionImpl(tx, txAccounts, connection, chainEnum, signer, heliusPriority = 'Medium', heliusApiKey) {
54
+ // Calculate compute unit limit
55
+ const testInstructions = [
56
+ web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: 1400000 }),
57
+ ...tx.instructions,
58
+ ];
59
+ const testTransaction = new web3_js_1.VersionedTransaction(new web3_js_1.TransactionMessage({
60
+ instructions: testInstructions,
61
+ payerKey: signer,
62
+ recentBlockhash: (await connection.getLatestBlockhash()).blockhash,
63
+ }).compileToV0Message([]));
64
+ const rpcResponse = await connection.simulateTransaction(testTransaction, {
65
+ replaceRecentBlockhash: true,
66
+ sigVerify: false,
67
+ });
68
+ const { unitsConsumed } = rpcResponse.value;
69
+ if (unitsConsumed) {
70
+ tx.instructions.unshift(web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: unitsConsumed * 1.2 }));
71
+ }
72
+ // Calculate compute unit priority fee
73
+ const heliusPriorityFeeEstimateRes = await getPriorityFeeEstimate(heliusPriority, tx, txAccounts, chainEnum, heliusApiKey);
74
+ const heliusPriorityFeeEstimate = heliusPriorityFeeEstimateRes === null || heliusPriorityFeeEstimateRes === void 0 ? void 0 : heliusPriorityFeeEstimateRes.priorityFeeEstimate;
75
+ const chosenFee = heliusPriorityFeeEstimate !== null && heliusPriorityFeeEstimate !== void 0 ? heliusPriorityFeeEstimate : 500000;
20
76
  tx.instructions.unshift(web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({
21
- microLamports: 200000,
77
+ microLamports: chosenFee,
22
78
  }));
23
- tx.recentBlockhash = recentBlockhash.blockhash;
24
- tx.lastValidBlockHeight = recentBlockhash.lastValidBlockHeight;
25
79
  return tx;
26
80
  }
27
- async function buildOptimalTransaction(tx, txAccounts, context) {
28
- return buildOptimalTransactionImpl(tx, txAccounts, context.connection);
81
+ async function buildOptimalTransaction(tx, txAccounts, context, heliusPriorityLevel) {
82
+ return buildOptimalTransactionImpl(tx, txAccounts, context.connection, context.chainId, context.publicKey, heliusPriorityLevel, context.heliusApiKey);
29
83
  }
30
- async function buildOptimalTransactionFromConnection(tx, txAccounts, connection) {
31
- return buildOptimalTransactionImpl(tx, txAccounts, connection);
84
+ async function buildOptimalTransactionFromConnection(tx, txAccounts, connection, chainId, signer, heliusPriorityLevel, heliusApiKey) {
85
+ return buildOptimalTransactionImpl(tx, txAccounts, connection, chainId, signer, heliusPriorityLevel, heliusApiKey);
32
86
  }
33
87
  //# sourceMappingURL=buildOptimalTransaction.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"buildOptimalTransaction.js","sourceRoot":"","sources":["../../../../src/utils/solana/buildOptimalTransaction.ts"],"names":[],"mappings":";;AAQA,0DAYC;AAoBD,0DAMC;AAED,sFAMC;AAtDD,6CAKwB;AAGxB,SAAgB,uBAAuB,CAAC,EAAe;IACrD,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAa,CAAA;IAE7C,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE;QAC7B,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YACtB,IAAI,GAAG,CAAC,UAAU,EAAE,CAAC;gBACnB,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;YAClC,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,OAAO,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAA;AACrC,CAAC;AAED,KAAK,UAAU,2BAA2B,CACxC,EAAe,EACf,UAAuB,EACvB,UAAsB;IAEtB,MAAM,eAAe,GAAG,MAAM,UAAU,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAA;IAExE,EAAE,CAAC,YAAY,CAAC,OAAO,CACrB,8BAAoB,CAAC,mBAAmB,CAAC;QACvC,aAAa,EAAE,MAAO;KACvB,CAAC,CACH,CAAA;IAED,EAAE,CAAC,eAAe,GAAG,eAAe,CAAC,SAAS,CAAA;IAC9C,EAAE,CAAC,oBAAoB,GAAG,eAAe,CAAC,oBAAoB,CAAA;IAC9D,OAAO,EAAE,CAAA;AACX,CAAC;AAEM,KAAK,UAAU,uBAAuB,CAC3C,EAAe,EACf,UAAuB,EACvB,OAA0B;IAE1B,OAAO,2BAA2B,CAAC,EAAE,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,CAAA;AACxE,CAAC;AAEM,KAAK,UAAU,qCAAqC,CACzD,EAAe,EACf,UAAuB,EACvB,UAAsB;IAEtB,OAAO,2BAA2B,CAAC,EAAE,EAAE,UAAU,EAAE,UAAU,CAAC,CAAA;AAChE,CAAC"}
1
+ {"version":3,"file":"buildOptimalTransaction.js","sourceRoot":"","sources":["../../../../src/utils/solana/buildOptimalTransaction.ts"],"names":[],"mappings":";;AAWA,0DAYC;AAwGD,0DAeC;AAED,sFAkBC;AAlKD,6CAOwB;AACxB,iDAAsD;AAGtD,SAAgB,uBAAuB,CAAC,EAAe;IACrD,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAa,CAAA;IAE7C,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE;QAC7B,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YACtB,IAAI,GAAG,CAAC,UAAU,EAAE,CAAC;gBACnB,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;YAClC,CAAC;Q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,EACvB,OAA0B,EAC1B,mBAAyC;IAEzC,OAAO,2BAA2B,CAChC,EAAE,EACF,UAAU,EACV,OAAO,CAAC,UAAU,EAClB,OAAO,CAAC,OAAO,EACf,OAAO,CAAC,SAAS,EACjB,mBAAmB,EACnB,OAAO,CAAC,YAAY,CACrB,CAAA;AACH,CAAC;AAEM,KAAK,UAAU,qCAAqC,CACzD,EAAe,EACf,UAAuB,EACvB,UAAsB,EACtB,OAAwB,EACxB,MAAiB,EACjB,mBAAyC,EACzC,YAA4B;IAE5B,OAAO,2BAA2B,CAChC,EAAE,EACF,UAAU,EACV,UAAU,EACV,OAAO,EACP,MAAM,EACN,mBAAmB,EACnB,YAAY,CACb,CAAA;AACH,CAAC"}
@@ -2,11 +2,12 @@ import { Connection, PublicKey } from '@solana/web3.js';
2
2
  import { POOL_NAME, SolanaChainEnum } from '@huma-finance/shared';
3
3
  export declare class HumaSolanaContext {
4
4
  #private;
5
- constructor({ publicKey, connection, chainId, poolName, }: {
5
+ constructor({ publicKey, connection, chainId, poolName, heliusApiKey, }: {
6
6
  publicKey: PublicKey;
7
7
  connection: Connection;
8
8
  chainId: SolanaChainEnum;
9
9
  poolName: POOL_NAME;
10
+ heliusApiKey?: string;
10
11
  });
11
12
  get publicKey(): PublicKey;
12
13
  set publicKey(value: PublicKey);
@@ -16,4 +17,5 @@ export declare class HumaSolanaContext {
16
17
  set chainId(value: SolanaChainEnum);
17
18
  get poolName(): POOL_NAME;
18
19
  set poolName(value: POOL_NAME);
20
+ get heliusApiKey(): string | null;
19
21
  }
@@ -1,11 +1,12 @@
1
- var _HumaSolanaContext_publicKey, _HumaSolanaContext_connection, _HumaSolanaContext_chainId, _HumaSolanaContext_poolName;
1
+ var _HumaSolanaContext_publicKey, _HumaSolanaContext_connection, _HumaSolanaContext_chainId, _HumaSolanaContext_poolName, _HumaSolanaContext_heliusApiKey;
2
2
  import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
3
3
  export class HumaSolanaContext {
4
- constructor({ publicKey, connection, chainId, poolName, }) {
4
+ constructor({ publicKey, connection, chainId, poolName, heliusApiKey, }) {
5
5
  _HumaSolanaContext_publicKey.set(this, void 0);
6
6
  _HumaSolanaContext_connection.set(this, void 0);
7
7
  _HumaSolanaContext_chainId.set(this, void 0);
8
8
  _HumaSolanaContext_poolName.set(this, void 0);
9
+ _HumaSolanaContext_heliusApiKey.set(this, void 0);
9
10
  if (!publicKey || !connection || !chainId || !poolName) {
10
11
  throw new Error('All parameters are required');
11
12
  }
@@ -13,6 +14,7 @@ export class HumaSolanaContext {
13
14
  __classPrivateFieldSet(this, _HumaSolanaContext_connection, connection, "f");
14
15
  __classPrivateFieldSet(this, _HumaSolanaContext_chainId, chainId, "f");
15
16
  __classPrivateFieldSet(this, _HumaSolanaContext_poolName, poolName, "f");
17
+ __classPrivateFieldSet(this, _HumaSolanaContext_heliusApiKey, heliusApiKey || null, "f");
16
18
  }
17
19
  get publicKey() {
18
20
  return __classPrivateFieldGet(this, _HumaSolanaContext_publicKey, "f");
@@ -38,6 +40,9 @@ export class HumaSolanaContext {
38
40
  set poolName(value) {
39
41
  __classPrivateFieldSet(this, _HumaSolanaContext_poolName, value, "f");
40
42
  }
43
+ get heliusApiKey() {
44
+ return __classPrivateFieldGet(this, _HumaSolanaContext_heliusApiKey, "f");
45
+ }
41
46
  }
42
- _HumaSolanaContext_publicKey = new WeakMap(), _HumaSolanaContext_connection = new WeakMap(), _HumaSolanaContext_chainId = new WeakMap(), _HumaSolanaContext_poolName = new WeakMap();
47
+ _HumaSolanaContext_publicKey = new WeakMap(), _HumaSolanaContext_connection = new WeakMap(), _HumaSolanaContext_chainId = new WeakMap(), _HumaSolanaContext_poolName = new WeakMap(), _HumaSolanaContext_heliusApiKey = new WeakMap();
43
48
  //# sourceMappingURL=HumaSolanaContext.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"HumaSolanaContext.js","sourceRoot":"","sources":["../../../src/helpers/solana/HumaSolanaContext.ts"],"names":[],"mappings":";;A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