@glamsystems/glam-sdk 1.0.14-alpha.3 → 1.0.14-alpha.4

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.
package/index.cjs.js CHANGED
@@ -47360,7 +47360,11 @@ let TxBuilder$g = class TxBuilder extends BaseTxBuilder {
47360
47360
  const inputStakePool = STAKE_POOLS_MAP.get(inputMint.toBase58())?.poolState || null;
47361
47361
  const outputStakePool = STAKE_POOLS_MAP.get(outputMint.toBase58())?.poolState || null;
47362
47362
  const preInstructions = await this.getPreInstructions(glamSigner, inputMint, outputMint, amount, outputTokenProgram);
47363
- // glam_config is auto-resolved by Anchor via its PDA seeds declaration.
47363
+ if (oracleAccounts?.kaminoReservesToRefresh && oracleAccounts.kaminoReservesToRefresh.length > 0) {
47364
+ const reserves = await this.client.klend.fetchAndParseReserves(oracleAccounts.kaminoReservesToRefresh);
47365
+ const refreshReservesIx = this.client.klend.txBuilder.refreshReservesBatchIx(reserves, false);
47366
+ preInstructions.push(refreshReservesIx);
47367
+ }
47364
47368
  const ix = await this.client.base.protocolProgram.methods.jupiterSwapV2(skipQuotePriceCheck, swapIx.data).accounts({
47365
47369
  glamState: this.client.base.statePda,
47366
47370
  glamSigner,
@@ -47430,9 +47434,10 @@ class JupiterSwapClient {
47430
47434
  const tx = await this.txBuilder.swapV2Tx(options, txOptions);
47431
47435
  return await this.base.sendAndConfirm(tx);
47432
47436
  }
47433
- constructor(base, vault){
47437
+ constructor(base, vault, klend){
47434
47438
  this.base = base;
47435
47439
  this.vault = vault;
47440
+ this.klend = klend;
47436
47441
  this.txBuilder = new TxBuilder$g(this);
47437
47442
  this.jupApi = this.base.jupiterApiClient || new JupiterApiClient({
47438
47443
  apiKey: this.base.jupiterApiKey
@@ -54170,7 +54175,7 @@ class EpiClient {
54170
54175
  }
54171
54176
  get jupiterSwap() {
54172
54177
  if (!this._jupiterSwap) {
54173
- this._jupiterSwap = new JupiterSwapClient(this, this.vault);
54178
+ this._jupiterSwap = new JupiterSwapClient(this, this.vault, this.kaminoLending);
54174
54179
  }
54175
54180
  return this._jupiterSwap;
54176
54181
  }
package/index.esm.js CHANGED
@@ -47340,7 +47340,11 @@ let TxBuilder$g = class TxBuilder extends BaseTxBuilder {
47340
47340
  const inputStakePool = STAKE_POOLS_MAP.get(inputMint.toBase58())?.poolState || null;
47341
47341
  const outputStakePool = STAKE_POOLS_MAP.get(outputMint.toBase58())?.poolState || null;
47342
47342
  const preInstructions = await this.getPreInstructions(glamSigner, inputMint, outputMint, amount, outputTokenProgram);
47343
- // glam_config is auto-resolved by Anchor via its PDA seeds declaration.
47343
+ if (oracleAccounts?.kaminoReservesToRefresh && oracleAccounts.kaminoReservesToRefresh.length > 0) {
47344
+ const reserves = await this.client.klend.fetchAndParseReserves(oracleAccounts.kaminoReservesToRefresh);
47345
+ const refreshReservesIx = this.client.klend.txBuilder.refreshReservesBatchIx(reserves, false);
47346
+ preInstructions.push(refreshReservesIx);
47347
+ }
47344
47348
  const ix = await this.client.base.protocolProgram.methods.jupiterSwapV2(skipQuotePriceCheck, swapIx.data).accounts({
47345
47349
  glamState: this.client.base.statePda,
47346
47350
  glamSigner,
@@ -47410,9 +47414,10 @@ class JupiterSwapClient {
47410
47414
  const tx = await this.txBuilder.swapV2Tx(options, txOptions);
47411
47415
  return await this.base.sendAndConfirm(tx);
47412
47416
  }
47413
- constructor(base, vault){
47417
+ constructor(base, vault, klend){
47414
47418
  this.base = base;
47415
47419
  this.vault = vault;
47420
+ this.klend = klend;
47416
47421
  this.txBuilder = new TxBuilder$g(this);
47417
47422
  this.jupApi = this.base.jupiterApiClient || new JupiterApiClient({
47418
47423
  apiKey: this.base.jupiterApiKey
@@ -54150,7 +54155,7 @@ class EpiClient {
54150
54155
  }
54151
54156
  get jupiterSwap() {
54152
54157
  if (!this._jupiterSwap) {
54153
- this._jupiterSwap = new JupiterSwapClient(this, this.vault);
54158
+ this._jupiterSwap = new JupiterSwapClient(this, this.vault, this.kaminoLending);
54154
54159
  }
54155
54160
  return this._jupiterSwap;
54156
54161
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glamsystems/glam-sdk",
3
- "version": "1.0.14-alpha.3",
3
+ "version": "1.0.14-alpha.4",
4
4
  "description": "TypeScript SDK for the GLAM Protocol",
5
5
  "main": "./index.cjs.js",
6
6
  "module": "./index.esm.js",
@@ -3,6 +3,7 @@ import { PublicKey, TransactionInstruction, TransactionSignature, VersionedTrans
3
3
  import { BaseClient, BaseTxBuilder, TxOptions } from "./base";
4
4
  import { VaultClient } from "./vault";
5
5
  import { JupiterApiClient, JupiterInstruction, QuoteParams, QuoteResponse, SwapInstructions } from "../utils/jupiterApi";
6
+ import { KaminoLendingClient } from "./kamino";
6
7
  export type JupiterSwapOptions = {
7
8
  quoteParams?: QuoteParams;
8
9
  quoteResponse?: QuoteResponse;
@@ -13,6 +14,7 @@ export type JupiterSwapV2OracleAccounts = {
13
14
  solUsdOracle?: PublicKey;
14
15
  inputTokenOracle?: PublicKey;
15
16
  outputTokenOracle?: PublicKey;
17
+ kaminoReservesToRefresh: PublicKey[];
16
18
  };
17
19
  export type JupiterSwapV2Options = JupiterSwapOptions & {
18
20
  skipQuotePriceCheck?: boolean;
@@ -33,9 +35,10 @@ declare class TxBuilder extends BaseTxBuilder<JupiterSwapClient> {
33
35
  export declare class JupiterSwapClient {
34
36
  readonly base: BaseClient;
35
37
  readonly vault: VaultClient;
38
+ readonly klend: KaminoLendingClient;
36
39
  readonly txBuilder: TxBuilder;
37
40
  readonly jupApi: JupiterApiClient;
38
- constructor(base: BaseClient, vault: VaultClient);
41
+ constructor(base: BaseClient, vault: VaultClient, klend: KaminoLendingClient);
39
42
  swap(options: JupiterSwapOptions, txOptions?: TxOptions): Promise<TransactionSignature>;
40
43
  swapV2(options: JupiterSwapV2Options, txOptions?: TxOptions): Promise<TransactionSignature>;
41
44
  }