flash-sdk 10.10.6 → 10.100.2-alpha.0

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.
Files changed (57) hide show
  1. package/dist/CustodyAccount.d.ts +2 -2
  2. package/dist/MarketAccount.d.ts +2 -2
  3. package/dist/MarketAccount.js +1 -1
  4. package/dist/OraclePrice.d.ts +4 -2
  5. package/dist/OraclePrice.js +23 -4
  6. package/dist/OrderAccount.d.ts +1 -1
  7. package/dist/PerpetualsClient.d.ts +385 -4332
  8. package/dist/PerpetualsClient.js +6254 -4927
  9. package/dist/PoolAccount.d.ts +3 -0
  10. package/dist/PoolConfig.d.ts +9 -2
  11. package/dist/PoolConfig.js +67 -4
  12. package/dist/PoolConfig.json +87 -4032
  13. package/dist/PoolDataClient.js +12 -11
  14. package/dist/PositionAccount.d.ts +6 -3
  15. package/dist/TokenStakeAccount.d.ts +24 -4
  16. package/dist/TokenStakeAccount.js +44 -2
  17. package/dist/TokenVaultAccount.d.ts +1 -0
  18. package/dist/ViewHelper.d.ts +2 -1
  19. package/dist/ViewHelper.js +17 -20
  20. package/dist/backupOracle.d.ts +0 -1
  21. package/dist/backupOracle.js +26 -5
  22. package/dist/constants/index.d.ts +1 -0
  23. package/dist/constants/index.js +2 -1
  24. package/dist/idl/perpetuals.d.ts +29203 -11085
  25. package/dist/idl/perpetuals.js +0 -16293
  26. package/dist/idl/perpetuals.json +34411 -0
  27. package/dist/index.d.ts +4 -2
  28. package/dist/index.js +7 -3
  29. package/dist/remoraTokensWithPriceIds.d.ts +13 -0
  30. package/dist/remoraTokensWithPriceIds.js +265 -0
  31. package/dist/testPublkey.d.ts +0 -0
  32. package/dist/testPublkey.js +0 -0
  33. package/dist/testSize.d.ts +0 -0
  34. package/dist/testSize.js +0 -0
  35. package/dist/tsconfig.tsbuildinfo +1 -1
  36. package/dist/types/generated.d.ts +2556 -0
  37. package/dist/types/generated.js +2 -0
  38. package/dist/types/index.d.ts +52 -144
  39. package/dist/types/index.js +22 -4
  40. package/dist/utils/IdlCoder.d.ts +3 -2
  41. package/dist/utils/IdlCoder.js +4 -2
  42. package/dist/utils/anchorCpiEvents.d.ts +1 -2
  43. package/dist/utils/anchorCpiEvents.js +10 -6
  44. package/dist/utils/getReferralAccounts.d.ts +1 -1
  45. package/dist/utils/getReferralAccounts.js +3 -8
  46. package/dist/xstocksTokensWithPriceIds.d.ts +13 -0
  47. package/dist/xstocksTokensWithPriceIds.js +369 -0
  48. package/package.json +9 -5
  49. package/readme.md +37 -3
  50. package/dist/TradingAccount.d.ts +0 -24
  51. package/dist/TradingAccount.js +0 -17
  52. package/dist/idl/fbnft_rewards.d.ts +0 -290
  53. package/dist/idl/fbnft_rewards.js +0 -292
  54. package/dist/idl/perp_composability.d.ts +0 -760
  55. package/dist/idl/perp_composability.js +0 -762
  56. package/dist/idl/reward_distribution.d.ts +0 -347
  57. package/dist/idl/reward_distribution.js +0 -349
@@ -10,13 +10,13 @@ export declare class CustodyAccount implements Custody {
10
10
  isStable: boolean;
11
11
  depegAdjustment: boolean;
12
12
  isVirtual: boolean;
13
- distributeRewards: boolean;
13
+ inversePrice: boolean;
14
14
  oracle: OracleParams;
15
15
  pricing: PricingParams;
16
16
  permissions: Permissions;
17
17
  fees: Fees;
18
18
  borrowRate: BorrowRateParams;
19
- rewardThreshold: BN;
19
+ tokenAmountMultiplier: BN;
20
20
  assets: Assets;
21
21
  feesStats: FeesStats;
22
22
  borrowRateState: BorrowRateState;
@@ -1,5 +1,5 @@
1
1
  import { PublicKey } from "@solana/web3.js";
2
- import { Market, MarketPermissions, PositionStats, Side } from "./types";
2
+ import { Market, MarketPermissions, PositionStats } from "./types";
3
3
  import BN from "bn.js";
4
4
  import { PositionAccount } from "./PositionAccount";
5
5
  export declare class MarketAccount implements Market {
@@ -7,7 +7,7 @@ export declare class MarketAccount implements Market {
7
7
  pool: PublicKey;
8
8
  targetCustody: PublicKey;
9
9
  collateralCustody: PublicKey;
10
- side: Side;
10
+ side: Market["side"];
11
11
  correlation: boolean;
12
12
  maxPayoffBps: BN;
13
13
  permissions: MarketPermissions;
@@ -29,7 +29,7 @@ var MarketAccount = (function () {
29
29
  };
30
30
  MarketAccount.prototype.getCollectivePosition = function () {
31
31
  if (this.collectivePosition.openPositions.gt(constants_1.BN_ZERO)) {
32
- var obj = __assign({ entryPrice: this.collectivePosition.averageEntryPrice, sizeAmount: this.collectivePosition.sizeAmount, sizeUsd: this.collectivePosition.sizeUsd, collateralAmount: this.collectivePosition.collateralAmount, collateralUsd: this.collectivePosition.collateralUsd, lockedAmount: this.collectivePosition.lockedAmount, lockedUsd: this.collectivePosition.lockedUsd, unsettledFeesUsd: this.collectivePosition.unsettledFeeUsd, cumulativeLockFeeSnapshot: this.collectivePosition.cumulativeLockFeeSnapshot }, types_1.DEFAULT_POSITION);
32
+ var obj = __assign({ entryPrice: this.collectivePosition.averageEntryPrice, sizeAmount: this.collectivePosition.sizeAmount, sizeUsd: this.collectivePosition.sizeUsd, collateralAmount: this.collectivePosition.collateralAmount, collateralUsd: this.collectivePosition.collateralLiabilityUsd, lockedAmount: this.collectivePosition.lockedAmount, lockedUsd: this.collectivePosition.lockedUsd, unsettledFeesUsd: this.collectivePosition.unsettledFeeUsd, cumulativeLockFeeSnapshot: this.collectivePosition.cumulativeLockFeeSnapshot }, types_1.DEFAULT_POSITION);
33
33
  return new PositionAccount_1.PositionAccount(web3_js_1.PublicKey.default, obj);
34
34
  }
35
35
  else {
@@ -22,7 +22,9 @@ export declare class OraclePrice {
22
22
  cmp(other: OraclePrice): -1 | 0 | 1;
23
23
  getDivergenceFactor(other: OraclePrice): BN;
24
24
  scale_to_exponent(target_exponent: BN): OraclePrice;
25
- getTokenAmount(asset_amount_usd: BN, token_decimals: number): BN;
26
- getAssetAmountUsd(token_amount: BN, token_decimals: number): BN;
25
+ private applyRateMultiplier;
26
+ withMultiplier(multiplier: BN): OraclePrice;
27
+ getTokenAmount(asset_amount_usd: BN, token_decimals: number, multiplier?: BN): BN;
28
+ getAssetAmountUsd(token_amount: BN, token_decimals: number, multiplier?: BN): BN;
27
29
  toUiPrice(precision: number): string;
28
30
  }
@@ -4,6 +4,7 @@ exports.OraclePrice = void 0;
4
4
  var anchor_1 = require("@coral-xyz/anchor");
5
5
  var constants_1 = require("./constants");
6
6
  var utils_1 = require("./utils");
7
+ var NEG_RATE_EXPONENT = new anchor_1.BN(-1 * constants_1.RATE_DECIMALS);
7
8
  var OraclePrice = (function () {
8
9
  function OraclePrice(parseData) {
9
10
  Object.assign(this, parseData);
@@ -86,17 +87,35 @@ var OraclePrice = (function () {
86
87
  });
87
88
  }
88
89
  };
89
- OraclePrice.prototype.getTokenAmount = function (asset_amount_usd, token_decimals) {
90
+ OraclePrice.prototype.applyRateMultiplier = function (multiplier) {
91
+ if (multiplier.isZero()) {
92
+ return this.price;
93
+ }
94
+ return (0, utils_1.checkedDecimalMul)(this.price, this.exponent, multiplier, NEG_RATE_EXPONENT, this.exponent);
95
+ };
96
+ OraclePrice.prototype.withMultiplier = function (multiplier) {
97
+ return new OraclePrice({
98
+ price: this.applyRateMultiplier(multiplier),
99
+ exponent: this.exponent,
100
+ confidence: this.confidence,
101
+ timestamp: this.timestamp,
102
+ });
103
+ };
104
+ OraclePrice.prototype.getTokenAmount = function (asset_amount_usd, token_decimals, multiplier) {
105
+ if (multiplier === void 0) { multiplier = constants_1.BN_ZERO; }
90
106
  if (asset_amount_usd.isZero() || this.price.isZero()) {
91
107
  return constants_1.BN_ZERO;
92
108
  }
93
- return (0, utils_1.checkedDecimalDiv)(asset_amount_usd, new anchor_1.BN(-1 * constants_1.USD_DECIMALS), this.price, this.exponent, new anchor_1.BN(-1 * token_decimals));
109
+ var effectivePrice = this.applyRateMultiplier(multiplier);
110
+ return (0, utils_1.checkedDecimalDiv)(asset_amount_usd, new anchor_1.BN(-1 * constants_1.USD_DECIMALS), effectivePrice, this.exponent, new anchor_1.BN(-1 * token_decimals));
94
111
  };
95
- OraclePrice.prototype.getAssetAmountUsd = function (token_amount, token_decimals) {
112
+ OraclePrice.prototype.getAssetAmountUsd = function (token_amount, token_decimals, multiplier) {
113
+ if (multiplier === void 0) { multiplier = constants_1.BN_ZERO; }
96
114
  if (token_amount.isZero() || this.price.isZero()) {
97
115
  return constants_1.BN_ZERO;
98
116
  }
99
- return (0, utils_1.checkedDecimalMul)(token_amount, new anchor_1.BN(-1 * token_decimals), this.price, this.exponent, new anchor_1.BN(-1 * constants_1.USD_DECIMALS));
117
+ var effectivePrice = this.applyRateMultiplier(multiplier);
118
+ return (0, utils_1.checkedDecimalMul)(token_amount, new anchor_1.BN(-1 * token_decimals), effectivePrice, this.exponent, new anchor_1.BN(-1 * constants_1.USD_DECIMALS));
100
119
  };
101
120
  OraclePrice.prototype.toUiPrice = function (precision) {
102
121
  return (0, utils_1.nativeToUiDecimals)(this.price, this.exponent.toNumber() * -1, precision);
@@ -10,7 +10,7 @@ export declare class OrderAccount implements Order {
10
10
  takeProfitOrders: TriggerOrder[];
11
11
  stopLossOrders: TriggerOrder[];
12
12
  isInitialised: boolean;
13
- openOrders: number;
13
+ isActive: boolean;
14
14
  openSl: number;
15
15
  openTp: number;
16
16
  inactiveSl: number;