@0dotxyz/p0-ts-sdk 2.4.0 → 2.4.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
@@ -1,13 +1,13 @@
1
1
  import * as superstruct from 'superstruct';
2
2
  import { Infer } from 'superstruct';
3
- import { b as BankType, R as RiskTier, A as AssetTag, c as BankConfigFlag, O as OperationalState, d as OracleSetup, E as EmodeTag, e as EmodeEntryFlags, f as EmodeFlags, W as WrappedI80F48, I as InterestRateConfigRaw, g as OperationalStateRaw, h as OracleSetupRaw, i as RiskTierRaw, M as MarginfiProgram, j as BankConfigOpt, k as InterestRateConfig, l as BankConfigType, m as BankConfigRaw, a as BankConfigOptRaw, n as EmodeSettingsType, o as BankRaw, p as BankRateLimiterRaw, q as EmodeSettingsRaw, r as MarginfiIdlType, s as BankRateLimiterType, t as OraclePrice, P as PriceWithConfidence, u as PriceBias, v as OraclePriceDto, H as HealthCacheFlags, w as HealthCacheStatus, x as AccountFlags, y as MarginfiAccountType, z as Amount, C as BankIntegrationMetadataMap, T as TypedAmount, D as BalanceType, F as HealthCacheType, G as EmodePair, J as ActiveEmodePair, K as ActionEmodeImpact, L as MarginRequirementType, N as EmodeImpactStatus, Q as BankVaultType, S as BankIntegrationMetadataMapDto, U as BankIntegrationMetadataDto, V as BankIntegrationMetadata, X as Bank, Y as Environment, Z as Project0Config, _ as MintData } from './types-DDP4jEc9.cjs';
4
- export { ax as AccountType, aC as AmountType, aw as BankAddress, $ as BankConfig, B as BankConfigCompactRaw, az as BankMap, av as BankMetadata, a2 as BankMetadataRaw, ao as ComputeAssetUsdValueParams, am as ComputeLiabilityUsdValueParams, ak as ComputeUsdValueParams, a7 as EmodeConfigRaw, ab as EmodeEntry, ad as EmodeImpact, a0 as EmodeSettings, af as GetAssetWeightParams, a4 as InterestRateConfigCompactRaw, a9 as InterestRateConfigOpt, a5 as InterestRateConfigOptRaw, ay as KaminoStates, as as MARGINFI_IDL, aB as MintDataMap, ac as OracleConfigOpt, a6 as OracleConfigOptRaw, aA as OraclePriceMap, ar as PriceWithConfidenceDto, at as Program, a1 as RateLimitWindowRaw, aa as RateLimitWindowType, a8 as RatePoint, a3 as RatePointRaw, au as Wallet, ap as computeAssetUsdValue, an as computeLiabilityUsdValue, aj as computeLoopingParams, ai as computeMaxLeverage, aq as computeTvl, al as computeUsdValue, ag as getAssetWeight, ah as getLiabilityWeight, ae as isWeightedPrice, aD as resolveAmount } from './types-DDP4jEc9.cjs';
3
+ import { b as BankType, R as RiskTier, A as AssetTag, c as BankConfigFlag, O as OperationalState, d as OracleSetup, E as EmodeTag, e as EmodeEntryFlags, f as EmodeFlags, W as WrappedI80F48, I as InterestRateConfigRaw, g as OperationalStateRaw, h as OracleSetupRaw, i as RiskTierRaw, M as MarginfiProgram, j as BankConfigOpt, k as InterestRateConfig, l as BankConfigType, m as BankConfigRaw, a as BankConfigOptRaw, n as EmodeSettingsType, o as BankRaw, p as BankRateLimiterRaw, q as EmodeSettingsRaw, r as MarginfiIdlType, s as BankRateLimiterType, t as OraclePrice, P as PriceWithConfidence, u as PriceBias, v as OraclePriceDto, H as HealthCacheFlags, w as HealthCacheStatus, x as AccountFlags, y as MarginfiAccountType, z as Amount, C as BankIntegrationMetadataMap, T as TypedAmount, D as BalanceType, F as HealthCacheType, G as EmodePair, J as ActiveEmodePair, K as ActionEmodeImpact, L as MarginRequirementType, N as EmodeImpactStatus, Q as BankVaultType, S as BankIntegrationMetadataMapDto, U as BankIntegrationMetadataDto, V as BankIntegrationMetadata, X as Bank, Y as Environment, Z as Project0Config, _ as MintData } from './types-BkXrDBCr.cjs';
4
+ export { ax as AccountType, aC as AmountType, aw as BankAddress, $ as BankConfig, B as BankConfigCompactRaw, az as BankMap, av as BankMetadata, a2 as BankMetadataRaw, ao as ComputeAssetUsdValueParams, am as ComputeLiabilityUsdValueParams, ak as ComputeUsdValueParams, a7 as EmodeConfigRaw, ab as EmodeEntry, ad as EmodeImpact, a0 as EmodeSettings, af as GetAssetWeightParams, a4 as InterestRateConfigCompactRaw, a9 as InterestRateConfigOpt, a5 as InterestRateConfigOptRaw, ay as KaminoStates, as as MARGINFI_IDL, aB as MintDataMap, ac as OracleConfigOpt, a6 as OracleConfigOptRaw, aA as OraclePriceMap, ar as PriceWithConfidenceDto, at as Program, a1 as RateLimitWindowRaw, aa as RateLimitWindowType, a8 as RatePoint, a3 as RatePointRaw, au as Wallet, ap as computeAssetUsdValue, an as computeLiabilityUsdValue, aj as computeLoopingParams, ai as computeMaxLeverage, aq as computeTvl, al as computeUsdValue, ag as getAssetWeight, ah as getLiabilityWeight, ae as isWeightedPrice, aD as resolveAmount } from './types-BkXrDBCr.cjs';
5
5
  import * as _solana_web3_js from '@solana/web3.js';
6
6
  import { VersionedTransaction, Transaction, PublicKey, TransactionError, TransactionInstruction, Keypair, Signer, AddressLookupTableAccount, Blockhash, TransactionMessage, Connection, AccountInfo } from '@solana/web3.js';
7
7
  import { Idl, Instruction, AnchorProvider, Address } from '@coral-xyz/anchor';
8
8
  import BN from 'bn.js';
9
9
  import BigNumber$1 from 'bignumber.js';
10
- import { K as KaminoReserve, D as DriftSpotMarket, d as DriftRewards, J as JupLendingState, i as KaminoReserveJSON, j as KaminoObligationJSON, k as KaminoFarmStateJSON, a as KaminoObligation, b as KaminoFarmState, l as DriftSpotMarketJSON, m as DriftUserJSON, n as DriftRewardsJSON, o as DriftUserStatsJSON, c as DriftUser, e as DriftUserStats, p as JupLendingStateJSON, q as JupTokenReserveJSON, r as JupLendingRewardsRateModelJSON, s as JupRateModelJSON, f as JupTokenReserve, g as JupLendingRewardsRateModel, h as JupRateModel } from './dto-rate-model.types-DWB7J91n.cjs';
10
+ import { K as KaminoReserve, D as DriftSpotMarket, d as DriftRewards, J as JupLendingState, i as KaminoReserveJSON, j as KaminoObligationJSON, k as KaminoFarmStateJSON, a as KaminoObligation, b as KaminoFarmState, l as DriftSpotMarketJSON, m as DriftUserJSON, n as DriftRewardsJSON, o as DriftUserStatsJSON, c as DriftUser, e as DriftUserStats, p as JupLendingStateJSON, q as JupTokenReserveJSON, r as JupLendingRewardsRateModelJSON, s as JupRateModelJSON, f as JupTokenReserve, g as JupLendingRewardsRateModel, h as JupRateModel } from './dto-rate-model.types-IT8wckYH.cjs';
11
11
  import { JupiterClientConfig, QuoteGetRequest, QuoteResponse } from './jupiter.cjs';
12
12
  import { F as FeedResponse } from './index-BDDVBMdM.cjs';
13
13
 
package/dist/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  import * as superstruct from 'superstruct';
2
2
  import { Infer } from 'superstruct';
3
- import { b as BankType, R as RiskTier, A as AssetTag, c as BankConfigFlag, O as OperationalState, d as OracleSetup, E as EmodeTag, e as EmodeEntryFlags, f as EmodeFlags, W as WrappedI80F48, I as InterestRateConfigRaw, g as OperationalStateRaw, h as OracleSetupRaw, i as RiskTierRaw, M as MarginfiProgram, j as BankConfigOpt, k as InterestRateConfig, l as BankConfigType, m as BankConfigRaw, a as BankConfigOptRaw, n as EmodeSettingsType, o as BankRaw, p as BankRateLimiterRaw, q as EmodeSettingsRaw, r as MarginfiIdlType, s as BankRateLimiterType, t as OraclePrice, P as PriceWithConfidence, u as PriceBias, v as OraclePriceDto, H as HealthCacheFlags, w as HealthCacheStatus, x as AccountFlags, y as MarginfiAccountType, z as Amount, C as BankIntegrationMetadataMap, T as TypedAmount, D as BalanceType, F as HealthCacheType, G as EmodePair, J as ActiveEmodePair, K as ActionEmodeImpact, L as MarginRequirementType, N as EmodeImpactStatus, Q as BankVaultType, S as BankIntegrationMetadataMapDto, U as BankIntegrationMetadataDto, V as BankIntegrationMetadata, X as Bank, Y as Environment, Z as Project0Config, _ as MintData } from './types-rBQYamIi.js';
4
- export { ax as AccountType, aC as AmountType, aw as BankAddress, $ as BankConfig, B as BankConfigCompactRaw, az as BankMap, av as BankMetadata, a2 as BankMetadataRaw, ao as ComputeAssetUsdValueParams, am as ComputeLiabilityUsdValueParams, ak as ComputeUsdValueParams, a7 as EmodeConfigRaw, ab as EmodeEntry, ad as EmodeImpact, a0 as EmodeSettings, af as GetAssetWeightParams, a4 as InterestRateConfigCompactRaw, a9 as InterestRateConfigOpt, a5 as InterestRateConfigOptRaw, ay as KaminoStates, as as MARGINFI_IDL, aB as MintDataMap, ac as OracleConfigOpt, a6 as OracleConfigOptRaw, aA as OraclePriceMap, ar as PriceWithConfidenceDto, at as Program, a1 as RateLimitWindowRaw, aa as RateLimitWindowType, a8 as RatePoint, a3 as RatePointRaw, au as Wallet, ap as computeAssetUsdValue, an as computeLiabilityUsdValue, aj as computeLoopingParams, ai as computeMaxLeverage, aq as computeTvl, al as computeUsdValue, ag as getAssetWeight, ah as getLiabilityWeight, ae as isWeightedPrice, aD as resolveAmount } from './types-rBQYamIi.js';
3
+ import { b as BankType, R as RiskTier, A as AssetTag, c as BankConfigFlag, O as OperationalState, d as OracleSetup, E as EmodeTag, e as EmodeEntryFlags, f as EmodeFlags, W as WrappedI80F48, I as InterestRateConfigRaw, g as OperationalStateRaw, h as OracleSetupRaw, i as RiskTierRaw, M as MarginfiProgram, j as BankConfigOpt, k as InterestRateConfig, l as BankConfigType, m as BankConfigRaw, a as BankConfigOptRaw, n as EmodeSettingsType, o as BankRaw, p as BankRateLimiterRaw, q as EmodeSettingsRaw, r as MarginfiIdlType, s as BankRateLimiterType, t as OraclePrice, P as PriceWithConfidence, u as PriceBias, v as OraclePriceDto, H as HealthCacheFlags, w as HealthCacheStatus, x as AccountFlags, y as MarginfiAccountType, z as Amount, C as BankIntegrationMetadataMap, T as TypedAmount, D as BalanceType, F as HealthCacheType, G as EmodePair, J as ActiveEmodePair, K as ActionEmodeImpact, L as MarginRequirementType, N as EmodeImpactStatus, Q as BankVaultType, S as BankIntegrationMetadataMapDto, U as BankIntegrationMetadataDto, V as BankIntegrationMetadata, X as Bank, Y as Environment, Z as Project0Config, _ as MintData } from './types-Ci3ayYQ2.js';
4
+ export { ax as AccountType, aC as AmountType, aw as BankAddress, $ as BankConfig, B as BankConfigCompactRaw, az as BankMap, av as BankMetadata, a2 as BankMetadataRaw, ao as ComputeAssetUsdValueParams, am as ComputeLiabilityUsdValueParams, ak as ComputeUsdValueParams, a7 as EmodeConfigRaw, ab as EmodeEntry, ad as EmodeImpact, a0 as EmodeSettings, af as GetAssetWeightParams, a4 as InterestRateConfigCompactRaw, a9 as InterestRateConfigOpt, a5 as InterestRateConfigOptRaw, ay as KaminoStates, as as MARGINFI_IDL, aB as MintDataMap, ac as OracleConfigOpt, a6 as OracleConfigOptRaw, aA as OraclePriceMap, ar as PriceWithConfidenceDto, at as Program, a1 as RateLimitWindowRaw, aa as RateLimitWindowType, a8 as RatePoint, a3 as RatePointRaw, au as Wallet, ap as computeAssetUsdValue, an as computeLiabilityUsdValue, aj as computeLoopingParams, ai as computeMaxLeverage, aq as computeTvl, al as computeUsdValue, ag as getAssetWeight, ah as getLiabilityWeight, ae as isWeightedPrice, aD as resolveAmount } from './types-Ci3ayYQ2.js';
5
5
  import * as _solana_web3_js from '@solana/web3.js';
6
6
  import { VersionedTransaction, Transaction, PublicKey, TransactionError, TransactionInstruction, Keypair, Signer, AddressLookupTableAccount, Blockhash, TransactionMessage, Connection, AccountInfo } from '@solana/web3.js';
7
7
  import { Idl, Instruction, AnchorProvider, Address } from '@coral-xyz/anchor';
8
8
  import BN from 'bn.js';
9
9
  import BigNumber$1 from 'bignumber.js';
10
- import { K as KaminoReserve, D as DriftSpotMarket, d as DriftRewards, J as JupLendingState, i as KaminoReserveJSON, j as KaminoObligationJSON, k as KaminoFarmStateJSON, a as KaminoObligation, b as KaminoFarmState, l as DriftSpotMarketJSON, m as DriftUserJSON, n as DriftRewardsJSON, o as DriftUserStatsJSON, c as DriftUser, e as DriftUserStats, p as JupLendingStateJSON, q as JupTokenReserveJSON, r as JupLendingRewardsRateModelJSON, s as JupRateModelJSON, f as JupTokenReserve, g as JupLendingRewardsRateModel, h as JupRateModel } from './dto-rate-model.types-DWB7J91n.js';
10
+ import { K as KaminoReserve, D as DriftSpotMarket, d as DriftRewards, J as JupLendingState, i as KaminoReserveJSON, j as KaminoObligationJSON, k as KaminoFarmStateJSON, a as KaminoObligation, b as KaminoFarmState, l as DriftSpotMarketJSON, m as DriftUserJSON, n as DriftRewardsJSON, o as DriftUserStatsJSON, c as DriftUser, e as DriftUserStats, p as JupLendingStateJSON, q as JupTokenReserveJSON, r as JupLendingRewardsRateModelJSON, s as JupRateModelJSON, f as JupTokenReserve, g as JupLendingRewardsRateModel, h as JupRateModel } from './dto-rate-model.types-IT8wckYH.js';
11
11
  import { JupiterClientConfig, QuoteGetRequest, QuoteResponse } from './jupiter.js';
12
12
  import { F as FeedResponse } from './index-BDDVBMdM.js';
13
13
 
package/dist/index.js CHANGED
@@ -36465,6 +36465,8 @@ function kaminoReserveToDto(reserve) {
36465
36465
  config: {
36466
36466
  protocolTakeRatePct: reserve.config.protocolTakeRatePct,
36467
36467
  hostFixedInterestRateBps: reserve.config.hostFixedInterestRateBps,
36468
+ depositLimit: reserve.config.depositLimit.toString(),
36469
+ borrowLimit: reserve.config.borrowLimit.toString(),
36468
36470
  borrowRateCurve: {
36469
36471
  points: reserve.config.borrowRateCurve.points.map((item) => ({
36470
36472
  utilizationRateBps: item.utilizationRateBps,
@@ -42985,12 +42987,13 @@ function dtoToKaminoObligation(obligationDto) {
42985
42987
  return {
42986
42988
  lendingMarket: new PublicKey(obligationDto.lendingMarket),
42987
42989
  owner: new PublicKey(obligationDto.owner),
42988
- deposits: obligationDto.deposits.map((item) => ({
42990
+ // Hosted endpoints may prune empty position arrays from the payload
42991
+ deposits: (obligationDto.deposits ?? []).map((item) => ({
42989
42992
  depositReserve: new PublicKey(item.depositReserve),
42990
42993
  depositedAmount: new BN8(item.depositedAmount),
42991
42994
  marketValueSf: new BN8(item.marketValueSf)
42992
42995
  })),
42993
- borrows: obligationDto.borrows.map((item) => ({
42996
+ borrows: (obligationDto.borrows ?? []).map((item) => ({
42994
42997
  borrowReserve: new PublicKey(item.borrowReserve),
42995
42998
  borrowedAmountSf: new BN8(item.borrowedAmountSf),
42996
42999
  marketValueSf: new BN8(item.marketValueSf)
@@ -43023,6 +43026,8 @@ function dtoToKaminoReserve(reserveDto) {
43023
43026
  config: {
43024
43027
  protocolTakeRatePct: reserveDto.config.protocolTakeRatePct,
43025
43028
  hostFixedInterestRateBps: reserveDto.config.hostFixedInterestRateBps,
43029
+ depositLimit: new BN8(reserveDto.config.depositLimit),
43030
+ borrowLimit: new BN8(reserveDto.config.borrowLimit),
43026
43031
  borrowRateCurve: {
43027
43032
  points: reserveDto.config.borrowRateCurve.points.map((item) => ({
43028
43033
  utilizationRateBps: item.utilizationRateBps,
@@ -43667,41 +43672,27 @@ function jupLendingStateRawToDto(raw) {
43667
43672
  function jupTokenReserveRawToDto(raw) {
43668
43673
  return {
43669
43674
  pubkey: raw.pubkey.toBase58(),
43670
- mint: raw.mint.toBase58(),
43671
- vault: raw.vault.toBase58(),
43672
43675
  borrowRate: raw.borrowRate,
43673
43676
  feeOnInterest: raw.feeOnInterest,
43674
43677
  lastUtilization: raw.lastUtilization,
43675
- lastUpdateTimestamp: raw.lastUpdateTimestamp.toString(),
43676
43678
  supplyExchangePrice: raw.supplyExchangePrice.toString(),
43677
43679
  borrowExchangePrice: raw.borrowExchangePrice.toString(),
43678
- maxUtilization: raw.maxUtilization,
43679
43680
  totalSupplyWithInterest: raw.totalSupplyWithInterest.toString(),
43680
43681
  totalSupplyInterestFree: raw.totalSupplyInterestFree.toString(),
43681
43682
  totalBorrowWithInterest: raw.totalBorrowWithInterest.toString(),
43682
- totalBorrowInterestFree: raw.totalBorrowInterestFree.toString(),
43683
- totalClaimAmount: raw.totalClaimAmount.toString(),
43684
- interactingProtocol: raw.interactingProtocol.toBase58(),
43685
- interactingTimestamp: raw.interactingTimestamp.toString(),
43686
- interactingBalance: raw.interactingBalance.toString()
43683
+ totalBorrowInterestFree: raw.totalBorrowInterestFree.toString()
43687
43684
  };
43688
43685
  }
43689
43686
  function jupLendingRewardsRateModelRawToDto(raw) {
43690
43687
  return {
43691
- pubkey: raw.pubkey.toBase58(),
43692
- mint: raw.mint.toBase58(),
43693
43688
  startTvl: raw.startTvl.toString(),
43694
43689
  duration: raw.duration.toString(),
43695
43690
  startTime: raw.startTime.toString(),
43696
- yearlyReward: raw.yearlyReward.toString(),
43697
- nextDuration: raw.nextDuration.toString(),
43698
- nextRewardAmount: raw.nextRewardAmount.toString()
43691
+ yearlyReward: raw.yearlyReward.toString()
43699
43692
  };
43700
43693
  }
43701
43694
  function jupRateModelRawToDto(raw) {
43702
43695
  return {
43703
- pubkey: raw.pubkey.toBase58(),
43704
- mint: raw.mint.toBase58(),
43705
43696
  version: raw.version,
43706
43697
  rateAtZero: raw.rateAtZero,
43707
43698
  kink1Utilization: raw.kink1Utilization,
@@ -43858,41 +43849,27 @@ function dtoToJupLendingStateRaw(dto) {
43858
43849
  function dtoToJupTokenReserveRaw(dto) {
43859
43850
  return {
43860
43851
  pubkey: new PublicKey(dto.pubkey),
43861
- mint: new PublicKey(dto.mint),
43862
- vault: new PublicKey(dto.vault),
43863
43852
  borrowRate: dto.borrowRate,
43864
43853
  feeOnInterest: dto.feeOnInterest,
43865
43854
  lastUtilization: dto.lastUtilization,
43866
- lastUpdateTimestamp: new BN8(dto.lastUpdateTimestamp),
43867
43855
  supplyExchangePrice: new BN8(dto.supplyExchangePrice),
43868
43856
  borrowExchangePrice: new BN8(dto.borrowExchangePrice),
43869
- maxUtilization: dto.maxUtilization,
43870
43857
  totalSupplyWithInterest: new BN8(dto.totalSupplyWithInterest),
43871
43858
  totalSupplyInterestFree: new BN8(dto.totalSupplyInterestFree),
43872
43859
  totalBorrowWithInterest: new BN8(dto.totalBorrowWithInterest),
43873
- totalBorrowInterestFree: new BN8(dto.totalBorrowInterestFree),
43874
- totalClaimAmount: new BN8(dto.totalClaimAmount),
43875
- interactingProtocol: new PublicKey(dto.interactingProtocol),
43876
- interactingTimestamp: new BN8(dto.interactingTimestamp),
43877
- interactingBalance: new BN8(dto.interactingBalance)
43860
+ totalBorrowInterestFree: new BN8(dto.totalBorrowInterestFree)
43878
43861
  };
43879
43862
  }
43880
43863
  function dtoToJupLendingRewardsRateModelRaw(dto) {
43881
43864
  return {
43882
- pubkey: new PublicKey(dto.pubkey),
43883
- mint: new PublicKey(dto.mint),
43884
43865
  startTvl: new BN8(dto.startTvl),
43885
43866
  duration: new BN8(dto.duration),
43886
43867
  startTime: new BN8(dto.startTime),
43887
- yearlyReward: new BN8(dto.yearlyReward),
43888
- nextDuration: new BN8(dto.nextDuration),
43889
- nextRewardAmount: new BN8(dto.nextRewardAmount)
43868
+ yearlyReward: new BN8(dto.yearlyReward)
43890
43869
  };
43891
43870
  }
43892
43871
  function dtoToJupRateModelRaw(dto) {
43893
43872
  return {
43894
- pubkey: new PublicKey(dto.pubkey),
43895
- mint: new PublicKey(dto.mint),
43896
43873
  version: dto.version,
43897
43874
  rateAtZero: dto.rateAtZero,
43898
43875
  kink1Utilization: dto.kink1Utilization,
@@ -57876,6 +57853,7 @@ function kaminoFarmStateToDto(farmState) {
57876
57853
  mint: item.token.mint.toBase58(),
57877
57854
  decimals: item.token.decimals.toString()
57878
57855
  },
57856
+ rewardsAvailable: item.rewardsAvailable.toString(),
57879
57857
  rewardsPerSecondDecimals: item.rewardsPerSecondDecimals,
57880
57858
  rewardScheduleCurve: {
57881
57859
  points: item.rewardScheduleCurve.points.map((p) => ({
@@ -57989,6 +57967,7 @@ function dtoToKaminoFarmState(dto) {
57989
57967
  mint: new PublicKey(item.token.mint),
57990
57968
  decimals: new BN8(item.token.decimals)
57991
57969
  },
57970
+ rewardsAvailable: new BN8(item.rewardsAvailable),
57992
57971
  rewardsPerSecondDecimals: item.rewardsPerSecondDecimals,
57993
57972
  rewardScheduleCurve: {
57994
57973
  points: item.rewardScheduleCurve.points.map((p) => ({