@0dotxyz/p0-ts-sdk 3.0.0-next.1 → 3.0.0-next.2

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/dist/index.d.cts CHANGED
@@ -854,9 +854,13 @@ declare enum HealthCacheFlags {
854
854
  */
855
855
  ORACLE_OK = 4
856
856
  }
857
+ /** Where an account's `healthCache` values come from. */
857
858
  declare enum HealthCacheStatus {
859
+ /** As stored on-chain, not refreshed since the account's last instruction */
858
860
  UNSET = 0,
861
+ /** Refreshed by a simulated `pulse_health`: values, prices and flags come from the program */
859
862
  ONCHAIN = 1,
863
+ /** Computed locally from balances and oracle prices after the simulation failed; no prices or flags */
860
864
  COMPUTED = 2
861
865
  }
862
866
  interface HealthCacheType {
@@ -1059,6 +1063,8 @@ declare enum SwapProvider {
1059
1063
  DFLOW = "DFLOW"
1060
1064
  }
1061
1065
  interface SwapApiConfig {
1066
+ /** @deprecated Unused: the Jupiter adapter calls the Router `/build` endpoint and the Titan
1067
+ * adapter quotes over `wsUrl`. Will be removed in a future release. */
1062
1068
  basePath?: string;
1063
1069
  /** WebSocket endpoint (e.g. `wss://<host>/api/v1/ws`). Used by the Titan V3
1064
1070
  * adapter, which sends the full footprint template inline over the socket to
@@ -6534,7 +6540,7 @@ declare class MarginfiAccountWrapper {
6534
6540
  makeRepayIx(bankAddress: Address, amount: Amount, repayAll?: boolean, opts?: MakeRepayIxOpts): Promise<_solana_kit.Instruction<string, readonly (_solana_kit.AccountLookupMeta<string, string> | _solana_kit.AccountMeta<string>)[]>[]>;
6535
6541
  /**
6536
6542
  * Withdraw instructions for `amount` (UI units) from `bankAddress`; `withdrawAll` closes the
6537
- * balance.
6543
+ * balance. `opts.groupRateLimiterEnabled` defaults to the group's limiter state.
6538
6544
  * @throws Error if `amount` isn't positive without `withdrawAll`
6539
6545
  */
6540
6546
  makeWithdrawIx(bankAddress: Address, amount: Amount, withdrawAll?: boolean, opts?: MakeWithdrawIxOpts): Promise<_solana_kit.Instruction<string, readonly (_solana_kit.AccountLookupMeta<string, string> | _solana_kit.AccountMeta<string>)[]>[]>;
@@ -6549,7 +6555,7 @@ declare class MarginfiAccountWrapper {
6549
6555
  makeRepayTx(bankAddress: Address, amount: Amount, repayAll?: boolean, opts?: MakeRepayIxOpts): Promise<SolanaTransaction>;
6550
6556
  /**
6551
6557
  * Withdraw transaction for `amount` (UI units) from `bankAddress`; `withdrawAll` closes the
6552
- * balance.
6558
+ * balance. `opts.groupRateLimiterEnabled` defaults to the group's limiter state.
6553
6559
  */
6554
6560
  makeWithdrawTx(bankAddress: Address, amount: Amount, withdrawAll?: boolean, opts?: MakeWithdrawIxOpts): Promise<SolanaTransaction>;
6555
6561
  /** Borrow transaction for `amount` (UI units) from `bankAddress`. */
package/dist/index.d.ts CHANGED
@@ -854,9 +854,13 @@ declare enum HealthCacheFlags {
854
854
  */
855
855
  ORACLE_OK = 4
856
856
  }
857
+ /** Where an account's `healthCache` values come from. */
857
858
  declare enum HealthCacheStatus {
859
+ /** As stored on-chain, not refreshed since the account's last instruction */
858
860
  UNSET = 0,
861
+ /** Refreshed by a simulated `pulse_health`: values, prices and flags come from the program */
859
862
  ONCHAIN = 1,
863
+ /** Computed locally from balances and oracle prices after the simulation failed; no prices or flags */
860
864
  COMPUTED = 2
861
865
  }
862
866
  interface HealthCacheType {
@@ -1059,6 +1063,8 @@ declare enum SwapProvider {
1059
1063
  DFLOW = "DFLOW"
1060
1064
  }
1061
1065
  interface SwapApiConfig {
1066
+ /** @deprecated Unused: the Jupiter adapter calls the Router `/build` endpoint and the Titan
1067
+ * adapter quotes over `wsUrl`. Will be removed in a future release. */
1062
1068
  basePath?: string;
1063
1069
  /** WebSocket endpoint (e.g. `wss://<host>/api/v1/ws`). Used by the Titan V3
1064
1070
  * adapter, which sends the full footprint template inline over the socket to
@@ -6534,7 +6540,7 @@ declare class MarginfiAccountWrapper {
6534
6540
  makeRepayIx(bankAddress: Address, amount: Amount, repayAll?: boolean, opts?: MakeRepayIxOpts): Promise<_solana_kit.Instruction<string, readonly (_solana_kit.AccountLookupMeta<string, string> | _solana_kit.AccountMeta<string>)[]>[]>;
6535
6541
  /**
6536
6542
  * Withdraw instructions for `amount` (UI units) from `bankAddress`; `withdrawAll` closes the
6537
- * balance.
6543
+ * balance. `opts.groupRateLimiterEnabled` defaults to the group's limiter state.
6538
6544
  * @throws Error if `amount` isn't positive without `withdrawAll`
6539
6545
  */
6540
6546
  makeWithdrawIx(bankAddress: Address, amount: Amount, withdrawAll?: boolean, opts?: MakeWithdrawIxOpts): Promise<_solana_kit.Instruction<string, readonly (_solana_kit.AccountLookupMeta<string, string> | _solana_kit.AccountMeta<string>)[]>[]>;
@@ -6549,7 +6555,7 @@ declare class MarginfiAccountWrapper {
6549
6555
  makeRepayTx(bankAddress: Address, amount: Amount, repayAll?: boolean, opts?: MakeRepayIxOpts): Promise<SolanaTransaction>;
6550
6556
  /**
6551
6557
  * Withdraw transaction for `amount` (UI units) from `bankAddress`; `withdrawAll` closes the
6552
- * balance.
6558
+ * balance. `opts.groupRateLimiterEnabled` defaults to the group's limiter state.
6553
6559
  */
6554
6560
  makeWithdrawTx(bankAddress: Address, amount: Amount, withdrawAll?: boolean, opts?: MakeWithdrawIxOpts): Promise<SolanaTransaction>;
6555
6561
  /** Borrow transaction for `amount` (UI units) from `bankAddress`. */
package/dist/index.js CHANGED
@@ -18237,7 +18237,6 @@ function deserializeJupiterInstruction(instruction) {
18237
18237
  function toJupiterConfig(apiConfig) {
18238
18238
  if (!apiConfig) return void 0;
18239
18239
  return {
18240
- basePath: apiConfig.basePath,
18241
18240
  apiKey: apiConfig.apiKey,
18242
18241
  headers: apiConfig.headers
18243
18242
  };
@@ -20185,14 +20184,16 @@ async function simulateAccountHealthCacheWithFallback(params) {
20185
20184
  marginfiAccount,
20186
20185
  bankIntegrationMap
20187
20186
  });
20188
- marginfiAccount = parseMarginfiAccountRaw(params.marginfiAccount.address, {
20189
- ...simulatedAccount,
20187
+ const simulated = parseMarginfiAccountRaw(params.marginfiAccount.address, simulatedAccount);
20188
+ marginfiAccount = {
20189
+ ...simulated,
20190
20190
  healthCache: {
20191
- ...simulatedAccount.healthCache,
20192
- assetValueEquity: bigNumberToWrappedI80F48(assetValueEquity),
20193
- liabilityValueEquity: bigNumberToWrappedI80F48(liabilityValueEquity)
20191
+ ...simulated.healthCache,
20192
+ assetValueEquity,
20193
+ liabilityValueEquity,
20194
+ simulationStatus: 1 /* ONCHAIN */
20194
20195
  }
20195
- });
20196
+ };
20196
20197
  } catch (e) {
20197
20198
  const { assets: assetValueMaint, liabilities: liabilityValueMaint } = computeHealthComponentsFromBalances({
20198
20199
  activeBalances,
@@ -24690,7 +24691,7 @@ var MarginfiAccountWrapper = class {
24690
24691
  }
24691
24692
  /**
24692
24693
  * Withdraw instructions for `amount` (UI units) from `bankAddress`; `withdrawAll` closes the
24693
- * balance.
24694
+ * balance. `opts.groupRateLimiterEnabled` defaults to the group's limiter state.
24694
24695
  * @throws Error if `amount` isn't positive without `withdrawAll`
24695
24696
  */
24696
24697
  async makeWithdrawIx(bankAddress, amount, withdrawAll = false, opts = {}) {
@@ -24701,7 +24702,10 @@ var MarginfiAccountWrapper = class {
24701
24702
  ...await this.lendingContext(bankAddress),
24702
24703
  amount,
24703
24704
  withdrawAll,
24704
- opts
24705
+ opts: {
24706
+ groupRateLimiterEnabled: isGroupRateLimiterEnabled(this.client.group.rateLimiter),
24707
+ ...opts
24708
+ }
24705
24709
  });
24706
24710
  }
24707
24711
  /**
@@ -24731,14 +24735,17 @@ var MarginfiAccountWrapper = class {
24731
24735
  }
24732
24736
  /**
24733
24737
  * Withdraw transaction for `amount` (UI units) from `bankAddress`; `withdrawAll` closes the
24734
- * balance.
24738
+ * balance. `opts.groupRateLimiterEnabled` defaults to the group's limiter state.
24735
24739
  */
24736
24740
  async makeWithdrawTx(bankAddress, amount, withdrawAll = false, opts = {}) {
24737
24741
  return this.account.makeWithdrawTx({
24738
24742
  ...await this.lendingContext(bankAddress),
24739
24743
  amount,
24740
24744
  withdrawAll,
24741
- opts
24745
+ opts: {
24746
+ groupRateLimiterEnabled: isGroupRateLimiterEnabled(this.client.group.rateLimiter),
24747
+ ...opts
24748
+ }
24742
24749
  });
24743
24750
  }
24744
24751
  /** Borrow transaction for `amount` (UI units) from `bankAddress`. */