@0dotxyz/p0-ts-sdk 2.2.1 → 2.2.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.
@@ -1,49 +1,5 @@
1
- import { BorshCoder, Provider, Program } from '@coral-xyz/anchor';
2
- import BN from 'bn.js';
3
1
  import { PublicKey } from '@solana/web3.js';
4
-
5
- declare const SWITCHBOARD_ONDEMANDE_PRICE_PRECISION = 18;
6
- interface CurrentResult {
7
- value: BN;
8
- std_dev: BN;
9
- mean: BN;
10
- range: BN;
11
- min_value: BN;
12
- max_vaalue: BN;
13
- slot: BN;
14
- min_slot: BN;
15
- max_slot: BN;
16
- }
17
- interface OracleSubmission {
18
- oracle: PublicKey;
19
- slot: BN;
20
- value: BN;
21
- }
22
- interface PullFeedAccountData {
23
- submissions: OracleSubmission[];
24
- authority: PublicKey;
25
- queue: PublicKey;
26
- feed_hash: Buffer;
27
- initialized_at: BN;
28
- permissions: BN;
29
- max_variance: BN;
30
- min_responses: number;
31
- name: Buffer;
32
- sample_size: number;
33
- last_update_timestamp: BN;
34
- lut_slot: BN;
35
- result: CurrentResult;
36
- max_staleness: number;
37
- min_sample_size: number;
38
- }
39
- type CrossbarSimulatePayload = FeedResponse[];
40
- interface FeedResponse {
41
- feedHash: string;
42
- results: number[];
43
- }
44
- declare const switchboardAccountCoder: BorshCoder<string, string>;
45
- declare function getSwitchboardProgram(provider: Provider): Program;
46
- declare function decodeSwitchboardPullFeedData(data: Buffer): PullFeedAccountData;
2
+ import BN from 'bn.js';
47
3
 
48
4
  interface LastUpdateFields {
49
5
  /** Last slot when updated */
@@ -1767,4 +1723,4 @@ interface JupRateModelJSON {
1767
1723
  rateAtKink2: number;
1768
1724
  }
1769
1725
 
1770
- export { type WithdrawalCapsFields as $, type CurrentResult as A, type OracleSubmission as B, type CurvePointFields as C, type DriftSpotMarket as D, type PullFeedAccountData as E, type FeedResponse as F, type CrossbarSimulatePayload as G, type HistoricalOracleData as H, type InsuranceFund as I, type JupLendingState as J, switchboardAccountCoder as K, getSwitchboardProgram as L, decodeSwitchboardPullFeedData as M, type ReserveLiquidityFields as N, type ObligationJSON as O, type PoolBalance as P, type ReserveCollateralFields as Q, type ReserveRaw as R, type SpotPosition as S, type ReserveConfigFields as T, type ReserveFeesFields as U, type BorrowRateCurveFields as V, type TokenInfoFields$1 as W, type PriceHeuristicFields as X, type ScopeConfigurationFields as Y, type SwitchboardConfigurationFields as Z, type PythConfigurationFields as _, type DriftRewards as a, type ReserveLiquidityJSON as a0, type ReserveCollateralJSON as a1, type ReserveConfigJSON as a2, type ReserveFeesJSON as a3, type BorrowRateCurveJSON as a4, type CurvePointJSON as a5, type TokenInfoJSON$1 as a6, type PriceHeuristicJSON as a7, type ScopeConfigurationJSON as a8, type SwitchboardConfigurationJSON as a9, type ValidityGuardRailsJSON as aA, type HistoricalOracleDataJSON as aB, type HistoricalIndexDataJSON as aC, type PoolBalanceJSON as aD, type InsuranceFundJSON as aE, SpotBalanceType as aF, type SpotPositionJSON as aG, type PythConfigurationJSON as aa, type WithdrawalCapsJSON as ab, type ObligationLiquidityJSON as ac, type ObligationCollateralJSON as ad, type ObligationOrderJSON as ae, type ObligationCollateralFields as af, type ObligationLiquidityFields as ag, type ObligationOrderFields as ah, type LastUpdateFields as ai, type BigFractionBytesFields as aj, type LastUpdateJSON as ak, type BigFractionBytesJSON as al, type RewardPerTimeUnitPointFields as am, type RewardScheduleCurveFields as an, type RewardScheduleCurveJSON as ao, type RewardPerTimeUnitPointJSON as ap, type UserFeesJSON as aq, type UserFeesFields as ar, isSpotBalanceTypeVariant as as, type FeeTier as at, type FeeTierJSON as au, type OrderFillerRewardStructure as av, type OrderFillerRewardStructureJSON as aw, type PriceDivergenceGuardRails as ax, type PriceDivergenceGuardRailsJSON as ay, type ValidityGuardRails as az, type ReserveJSON as b, type FarmStateJSON as c, type ObligationRaw as d, type FarmStateRaw as e, type DriftSpotMarketJSON as f, type DriftUserJSON as g, type DriftRewardsJSON as h, type DriftUserStatsJSON as i, type DriftUser as j, type DriftUserStats as k, type JupLendingStateJSON as l, type JupTokenReserveJSON as m, type JupLendingRewardsRateModelJSON as n, type JupRateModelJSON as o, type JupTokenReserve as p, type JupLendingRewardsRateModel as q, type JupRateModel as r, type RewardInfoFields as s, type HistoricalIndexData as t, type FeeStructureJSON as u, type OracleGuardRailsJSON as v, type FeeStructure as w, type OracleGuardRails as x, DriftSpotBalanceType as y, SWITCHBOARD_ONDEMANDE_PRICE_PRECISION as z };
1726
+ export { type ScopeConfigurationJSON as $, type ReserveConfigFields as A, type ReserveFeesFields as B, type CurvePointFields as C, type DriftSpotMarket as D, type BorrowRateCurveFields as E, type FarmStateJSON as F, type PriceHeuristicFields as G, type HistoricalOracleData as H, type InsuranceFund as I, type JupLendingState as J, type ScopeConfigurationFields as K, type SwitchboardConfigurationFields as L, type PythConfigurationFields as M, type ReserveLiquidityJSON as N, type ObligationJSON as O, type PoolBalance as P, type ReserveCollateralJSON as Q, type ReserveRaw as R, type SpotPosition as S, type TokenInfoFields$1 as T, type ReserveConfigJSON as U, type ReserveFeesJSON as V, type WithdrawalCapsFields as W, type BorrowRateCurveJSON as X, type CurvePointJSON as Y, type TokenInfoJSON$1 as Z, type PriceHeuristicJSON as _, type DriftRewards as a, type SwitchboardConfigurationJSON as a0, type PythConfigurationJSON as a1, type WithdrawalCapsJSON as a2, type ObligationLiquidityJSON as a3, type ObligationCollateralJSON as a4, type ObligationOrderJSON as a5, type ObligationCollateralFields as a6, type ObligationLiquidityFields as a7, type ObligationOrderFields as a8, type LastUpdateFields as a9, type BigFractionBytesFields as aa, type LastUpdateJSON as ab, type BigFractionBytesJSON as ac, type RewardPerTimeUnitPointFields as ad, type RewardScheduleCurveFields as ae, type RewardScheduleCurveJSON as af, type RewardPerTimeUnitPointJSON as ag, type UserFeesJSON as ah, type UserFeesFields as ai, isSpotBalanceTypeVariant as aj, type FeeTier as ak, type FeeTierJSON as al, type OrderFillerRewardStructure as am, type OrderFillerRewardStructureJSON as an, type PriceDivergenceGuardRails as ao, type PriceDivergenceGuardRailsJSON as ap, type ValidityGuardRails as aq, type ValidityGuardRailsJSON as ar, type HistoricalOracleDataJSON as as, type HistoricalIndexDataJSON as at, type PoolBalanceJSON as au, type InsuranceFundJSON as av, SpotBalanceType as aw, type SpotPositionJSON as ax, type ReserveJSON as b, type ObligationRaw as c, type FarmStateRaw as d, type DriftSpotMarketJSON as e, type DriftUserJSON as f, type DriftRewardsJSON as g, type DriftUserStatsJSON as h, type DriftUser as i, type DriftUserStats as j, type JupLendingStateJSON as k, type JupTokenReserveJSON as l, type JupLendingRewardsRateModelJSON as m, type JupRateModelJSON as n, type JupTokenReserve as o, type JupLendingRewardsRateModel as p, type JupRateModel as q, type RewardInfoFields as r, type HistoricalIndexData as s, type FeeStructureJSON as t, type OracleGuardRailsJSON as u, type FeeStructure as v, type OracleGuardRails as w, DriftSpotBalanceType as x, type ReserveLiquidityFields as y, type ReserveCollateralFields as z };
@@ -1,49 +1,5 @@
1
- import { BorshCoder, Provider, Program } from '@coral-xyz/anchor';
2
- import BN from 'bn.js';
3
1
  import { PublicKey } from '@solana/web3.js';
4
-
5
- declare const SWITCHBOARD_ONDEMANDE_PRICE_PRECISION = 18;
6
- interface CurrentResult {
7
- value: BN;
8
- std_dev: BN;
9
- mean: BN;
10
- range: BN;
11
- min_value: BN;
12
- max_vaalue: BN;
13
- slot: BN;
14
- min_slot: BN;
15
- max_slot: BN;
16
- }
17
- interface OracleSubmission {
18
- oracle: PublicKey;
19
- slot: BN;
20
- value: BN;
21
- }
22
- interface PullFeedAccountData {
23
- submissions: OracleSubmission[];
24
- authority: PublicKey;
25
- queue: PublicKey;
26
- feed_hash: Buffer;
27
- initialized_at: BN;
28
- permissions: BN;
29
- max_variance: BN;
30
- min_responses: number;
31
- name: Buffer;
32
- sample_size: number;
33
- last_update_timestamp: BN;
34
- lut_slot: BN;
35
- result: CurrentResult;
36
- max_staleness: number;
37
- min_sample_size: number;
38
- }
39
- type CrossbarSimulatePayload = FeedResponse[];
40
- interface FeedResponse {
41
- feedHash: string;
42
- results: number[];
43
- }
44
- declare const switchboardAccountCoder: BorshCoder<string, string>;
45
- declare function getSwitchboardProgram(provider: Provider): Program;
46
- declare function decodeSwitchboardPullFeedData(data: Buffer): PullFeedAccountData;
2
+ import BN from 'bn.js';
47
3
 
48
4
  interface LastUpdateFields {
49
5
  /** Last slot when updated */
@@ -1767,4 +1723,4 @@ interface JupRateModelJSON {
1767
1723
  rateAtKink2: number;
1768
1724
  }
1769
1725
 
1770
- export { type WithdrawalCapsFields as $, type CurrentResult as A, type OracleSubmission as B, type CurvePointFields as C, type DriftSpotMarket as D, type PullFeedAccountData as E, type FeedResponse as F, type CrossbarSimulatePayload as G, type HistoricalOracleData as H, type InsuranceFund as I, type JupLendingState as J, switchboardAccountCoder as K, getSwitchboardProgram as L, decodeSwitchboardPullFeedData as M, type ReserveLiquidityFields as N, type ObligationJSON as O, type PoolBalance as P, type ReserveCollateralFields as Q, type ReserveRaw as R, type SpotPosition as S, type ReserveConfigFields as T, type ReserveFeesFields as U, type BorrowRateCurveFields as V, type TokenInfoFields$1 as W, type PriceHeuristicFields as X, type ScopeConfigurationFields as Y, type SwitchboardConfigurationFields as Z, type PythConfigurationFields as _, type DriftRewards as a, type ReserveLiquidityJSON as a0, type ReserveCollateralJSON as a1, type ReserveConfigJSON as a2, type ReserveFeesJSON as a3, type BorrowRateCurveJSON as a4, type CurvePointJSON as a5, type TokenInfoJSON$1 as a6, type PriceHeuristicJSON as a7, type ScopeConfigurationJSON as a8, type SwitchboardConfigurationJSON as a9, type ValidityGuardRailsJSON as aA, type HistoricalOracleDataJSON as aB, type HistoricalIndexDataJSON as aC, type PoolBalanceJSON as aD, type InsuranceFundJSON as aE, SpotBalanceType as aF, type SpotPositionJSON as aG, type PythConfigurationJSON as aa, type WithdrawalCapsJSON as ab, type ObligationLiquidityJSON as ac, type ObligationCollateralJSON as ad, type ObligationOrderJSON as ae, type ObligationCollateralFields as af, type ObligationLiquidityFields as ag, type ObligationOrderFields as ah, type LastUpdateFields as ai, type BigFractionBytesFields as aj, type LastUpdateJSON as ak, type BigFractionBytesJSON as al, type RewardPerTimeUnitPointFields as am, type RewardScheduleCurveFields as an, type RewardScheduleCurveJSON as ao, type RewardPerTimeUnitPointJSON as ap, type UserFeesJSON as aq, type UserFeesFields as ar, isSpotBalanceTypeVariant as as, type FeeTier as at, type FeeTierJSON as au, type OrderFillerRewardStructure as av, type OrderFillerRewardStructureJSON as aw, type PriceDivergenceGuardRails as ax, type PriceDivergenceGuardRailsJSON as ay, type ValidityGuardRails as az, type ReserveJSON as b, type FarmStateJSON as c, type ObligationRaw as d, type FarmStateRaw as e, type DriftSpotMarketJSON as f, type DriftUserJSON as g, type DriftRewardsJSON as h, type DriftUserStatsJSON as i, type DriftUser as j, type DriftUserStats as k, type JupLendingStateJSON as l, type JupTokenReserveJSON as m, type JupLendingRewardsRateModelJSON as n, type JupRateModelJSON as o, type JupTokenReserve as p, type JupLendingRewardsRateModel as q, type JupRateModel as r, type RewardInfoFields as s, type HistoricalIndexData as t, type FeeStructureJSON as u, type OracleGuardRailsJSON as v, type FeeStructure as w, type OracleGuardRails as x, DriftSpotBalanceType as y, SWITCHBOARD_ONDEMANDE_PRICE_PRECISION as z };
1726
+ export { type ScopeConfigurationJSON as $, type ReserveConfigFields as A, type ReserveFeesFields as B, type CurvePointFields as C, type DriftSpotMarket as D, type BorrowRateCurveFields as E, type FarmStateJSON as F, type PriceHeuristicFields as G, type HistoricalOracleData as H, type InsuranceFund as I, type JupLendingState as J, type ScopeConfigurationFields as K, type SwitchboardConfigurationFields as L, type PythConfigurationFields as M, type ReserveLiquidityJSON as N, type ObligationJSON as O, type PoolBalance as P, type ReserveCollateralJSON as Q, type ReserveRaw as R, type SpotPosition as S, type TokenInfoFields$1 as T, type ReserveConfigJSON as U, type ReserveFeesJSON as V, type WithdrawalCapsFields as W, type BorrowRateCurveJSON as X, type CurvePointJSON as Y, type TokenInfoJSON$1 as Z, type PriceHeuristicJSON as _, type DriftRewards as a, type SwitchboardConfigurationJSON as a0, type PythConfigurationJSON as a1, type WithdrawalCapsJSON as a2, type ObligationLiquidityJSON as a3, type ObligationCollateralJSON as a4, type ObligationOrderJSON as a5, type ObligationCollateralFields as a6, type ObligationLiquidityFields as a7, type ObligationOrderFields as a8, type LastUpdateFields as a9, type BigFractionBytesFields as aa, type LastUpdateJSON as ab, type BigFractionBytesJSON as ac, type RewardPerTimeUnitPointFields as ad, type RewardScheduleCurveFields as ae, type RewardScheduleCurveJSON as af, type RewardPerTimeUnitPointJSON as ag, type UserFeesJSON as ah, type UserFeesFields as ai, isSpotBalanceTypeVariant as aj, type FeeTier as ak, type FeeTierJSON as al, type OrderFillerRewardStructure as am, type OrderFillerRewardStructureJSON as an, type PriceDivergenceGuardRails as ao, type PriceDivergenceGuardRailsJSON as ap, type ValidityGuardRails as aq, type ValidityGuardRailsJSON as ar, type HistoricalOracleDataJSON as as, type HistoricalIndexDataJSON as at, type PoolBalanceJSON as au, type InsuranceFundJSON as av, SpotBalanceType as aw, type SpotPositionJSON as ax, type ReserveJSON as b, type ObligationRaw as c, type FarmStateRaw as d, type DriftSpotMarketJSON as e, type DriftUserJSON as f, type DriftRewardsJSON as g, type DriftUserStatsJSON as h, type DriftUser as i, type DriftUserStats as j, type JupLendingStateJSON as k, type JupTokenReserveJSON as l, type JupLendingRewardsRateModelJSON as m, type JupRateModelJSON as n, type JupTokenReserve as o, type JupLendingRewardsRateModel as p, type JupRateModel as q, type RewardInfoFields as r, type HistoricalIndexData as s, type FeeStructureJSON as t, type OracleGuardRailsJSON as u, type FeeStructure as v, type OracleGuardRails as w, DriftSpotBalanceType as x, type ReserveLiquidityFields as y, type ReserveCollateralFields as z };
@@ -0,0 +1,48 @@
1
+ import { BorshCoder, Provider, Program } from '@coral-xyz/anchor';
2
+ import BN from 'bn.js';
3
+ import { PublicKey } from '@solana/web3.js';
4
+
5
+ declare const SWITCHBOARD_ONDEMANDE_PRICE_PRECISION = 18;
6
+ interface CurrentResult {
7
+ value: BN;
8
+ std_dev: BN;
9
+ mean: BN;
10
+ range: BN;
11
+ min_value: BN;
12
+ max_vaalue: BN;
13
+ slot: BN;
14
+ min_slot: BN;
15
+ max_slot: BN;
16
+ }
17
+ interface OracleSubmission {
18
+ oracle: PublicKey;
19
+ slot: BN;
20
+ value: BN;
21
+ }
22
+ interface PullFeedAccountData {
23
+ submissions: OracleSubmission[];
24
+ authority: PublicKey;
25
+ queue: PublicKey;
26
+ feed_hash: Buffer;
27
+ initialized_at: BN;
28
+ permissions: BN;
29
+ max_variance: BN;
30
+ min_responses: number;
31
+ name: Buffer;
32
+ sample_size: number;
33
+ last_update_timestamp: BN;
34
+ lut_slot: BN;
35
+ result: CurrentResult;
36
+ max_staleness: number;
37
+ min_sample_size: number;
38
+ }
39
+ type CrossbarSimulatePayload = FeedResponse[];
40
+ interface FeedResponse {
41
+ feedHash: string;
42
+ results: number[];
43
+ }
44
+ declare const switchboardAccountCoder: BorshCoder<string, string>;
45
+ declare function getSwitchboardProgram(provider: Provider): Program;
46
+ declare function decodeSwitchboardPullFeedData(data: Buffer): PullFeedAccountData;
47
+
48
+ export { type CurrentResult as C, type FeedResponse as F, type OracleSubmission as O, type PullFeedAccountData as P, SWITCHBOARD_ONDEMANDE_PRICE_PRECISION as S, type CrossbarSimulatePayload as a, decodeSwitchboardPullFeedData as d, getSwitchboardProgram as g, switchboardAccountCoder as s };
@@ -0,0 +1,48 @@
1
+ import { BorshCoder, Provider, Program } from '@coral-xyz/anchor';
2
+ import BN from 'bn.js';
3
+ import { PublicKey } from '@solana/web3.js';
4
+
5
+ declare const SWITCHBOARD_ONDEMANDE_PRICE_PRECISION = 18;
6
+ interface CurrentResult {
7
+ value: BN;
8
+ std_dev: BN;
9
+ mean: BN;
10
+ range: BN;
11
+ min_value: BN;
12
+ max_vaalue: BN;
13
+ slot: BN;
14
+ min_slot: BN;
15
+ max_slot: BN;
16
+ }
17
+ interface OracleSubmission {
18
+ oracle: PublicKey;
19
+ slot: BN;
20
+ value: BN;
21
+ }
22
+ interface PullFeedAccountData {
23
+ submissions: OracleSubmission[];
24
+ authority: PublicKey;
25
+ queue: PublicKey;
26
+ feed_hash: Buffer;
27
+ initialized_at: BN;
28
+ permissions: BN;
29
+ max_variance: BN;
30
+ min_responses: number;
31
+ name: Buffer;
32
+ sample_size: number;
33
+ last_update_timestamp: BN;
34
+ lut_slot: BN;
35
+ result: CurrentResult;
36
+ max_staleness: number;
37
+ min_sample_size: number;
38
+ }
39
+ type CrossbarSimulatePayload = FeedResponse[];
40
+ interface FeedResponse {
41
+ feedHash: string;
42
+ results: number[];
43
+ }
44
+ declare const switchboardAccountCoder: BorshCoder<string, string>;
45
+ declare function getSwitchboardProgram(provider: Provider): Program;
46
+ declare function decodeSwitchboardPullFeedData(data: Buffer): PullFeedAccountData;
47
+
48
+ export { type CurrentResult as C, type FeedResponse as F, type OracleSubmission as O, type PullFeedAccountData as P, SWITCHBOARD_ONDEMANDE_PRICE_PRECISION as S, type CrossbarSimulatePayload as a, decodeSwitchboardPullFeedData as d, getSwitchboardProgram as g, switchboardAccountCoder as s };
package/dist/index.cjs CHANGED
@@ -21374,7 +21374,10 @@ function computeProjectedActiveBalancesNoCpi(balances, instructions2, program, b
21374
21374
  if (!bank) {
21375
21375
  throw Error(`Bank ${targetBank.toBase58()} not found in bankMap`);
21376
21376
  }
21377
- const withdrawShares = getAssetShares(bank, withdrawTokenAmount);
21377
+ const isKaminoWithdraw = decoded.name === "kaminoWithdraw";
21378
+ const assetShareValueMultiplier = isKaminoWithdraw ? new BigNumber3__default.default(1) : assetShareValueMultiplierByBank.get(targetBank.toBase58()) ?? new BigNumber3__default.default(1);
21379
+ const cTokenAmount = withdrawTokenAmount.div(assetShareValueMultiplier);
21380
+ const withdrawShares = getAssetShares(bank, cTokenAmount);
21378
21381
  targetBalance.assetShares = BigNumber3__default.default.max(
21379
21382
  0,
21380
21383
  targetBalance.assetShares.minus(withdrawShares)
@@ -49153,7 +49156,7 @@ function computeMaxWithdrawForBank(params) {
49153
49156
  const maxWithdraw = initUntiedCollateralForBank.div(initWeightedPrice);
49154
49157
  return maxWithdraw;
49155
49158
  }
49156
- var TITAN_FEE_WALLET = new web3_js.PublicKey("6ryqDDCwKFZfSiHQrYRkjTEarbsLjg9TmuFg1RJorBk3");
49159
+ var TITAN_FEE_WALLET = new web3_js.PublicKey("FEES6XLN7dMz2iBwKab9Hri9Kwc4WJ6TmDAiT4BNhyej");
49157
49160
  var getTitanFeeAccount = (mint) => {
49158
49161
  return getAssociatedTokenAddressSync(mint, TITAN_FEE_WALLET, true);
49159
49162
  };