@reflectmoney/stable.ts 2.8.3 → 2.9.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 (234) hide show
  1. package/dist/helpers/drift/accounts/index.d.ts +10 -0
  2. package/dist/helpers/drift/accounts/index.js +26 -0
  3. package/dist/helpers/drift/accounts/spotMarket.d.ts +541 -0
  4. package/dist/helpers/drift/accounts/spotMarket.js +213 -0
  5. package/dist/helpers/drift/accounts/user.d.ts +193 -0
  6. package/dist/helpers/drift/accounts/user.js +147 -0
  7. package/dist/helpers/drift/accounts/userStats.d.ts +165 -0
  8. package/dist/helpers/drift/accounts/userStats.js +137 -0
  9. package/dist/helpers/drift/index.d.ts +10 -0
  10. package/dist/helpers/drift/index.js +26 -0
  11. package/dist/helpers/drift/mappers.d.ts +14 -0
  12. package/dist/helpers/drift/mappers.js +137 -0
  13. package/dist/helpers/drift/types/aMM.d.ts +656 -0
  14. package/dist/helpers/drift/types/aMM.js +199 -0
  15. package/dist/helpers/drift/types/addAmmConstituentMappingDatum.d.ts +21 -0
  16. package/dist/helpers/drift/types/addAmmConstituentMappingDatum.js +30 -0
  17. package/dist/helpers/drift/types/ammCacheFixed.d.ts +17 -0
  18. package/dist/helpers/drift/types/ammCacheFixed.js +30 -0
  19. package/dist/helpers/drift/types/ammConstituentDatum.d.ts +27 -0
  20. package/dist/helpers/drift/types/ammConstituentDatum.js +34 -0
  21. package/dist/helpers/drift/types/ammConstituentMappingFixed.d.ts +18 -0
  22. package/dist/helpers/drift/types/ammConstituentMappingFixed.js +32 -0
  23. package/dist/helpers/drift/types/assetTier.d.ts +19 -0
  24. package/dist/helpers/drift/types/assetTier.js +31 -0
  25. package/dist/helpers/drift/types/assetType.d.ts +16 -0
  26. package/dist/helpers/drift/types/assetType.js +28 -0
  27. package/dist/helpers/drift/types/builderInfo.d.ts +17 -0
  28. package/dist/helpers/drift/types/builderInfo.js +30 -0
  29. package/dist/helpers/drift/types/cacheInfo.d.ts +59 -0
  30. package/dist/helpers/drift/types/cacheInfo.js +66 -0
  31. package/dist/helpers/drift/types/constituentCorrelationsFixed.d.ts +19 -0
  32. package/dist/helpers/drift/types/constituentCorrelationsFixed.js +32 -0
  33. package/dist/helpers/drift/types/constituentLpOperation.d.ts +17 -0
  34. package/dist/helpers/drift/types/constituentLpOperation.js +29 -0
  35. package/dist/helpers/drift/types/constituentSpotBalance.d.ts +48 -0
  36. package/dist/helpers/drift/types/constituentSpotBalance.js +35 -0
  37. package/dist/helpers/drift/types/constituentStatus.d.ts +16 -0
  38. package/dist/helpers/drift/types/constituentStatus.js +28 -0
  39. package/dist/helpers/drift/types/constituentTargetBaseFixed.d.ts +19 -0
  40. package/dist/helpers/drift/types/constituentTargetBaseFixed.js +32 -0
  41. package/dist/helpers/drift/types/contractTier.d.ts +20 -0
  42. package/dist/helpers/drift/types/contractTier.js +32 -0
  43. package/dist/helpers/drift/types/contractType.d.ts +17 -0
  44. package/dist/helpers/drift/types/contractType.js +29 -0
  45. package/dist/helpers/drift/types/depositDirection.d.ts +16 -0
  46. package/dist/helpers/drift/types/depositDirection.js +28 -0
  47. package/dist/helpers/drift/types/depositExplanation.d.ts +19 -0
  48. package/dist/helpers/drift/types/depositExplanation.js +31 -0
  49. package/dist/helpers/drift/types/driftAction.d.ts +29 -0
  50. package/dist/helpers/drift/types/driftAction.js +41 -0
  51. package/dist/helpers/drift/types/exchangeStatus.d.ts +22 -0
  52. package/dist/helpers/drift/types/exchangeStatus.js +34 -0
  53. package/dist/helpers/drift/types/featureBitFlags.d.ts +18 -0
  54. package/dist/helpers/drift/types/featureBitFlags.js +30 -0
  55. package/dist/helpers/drift/types/feeStructure.d.ts +24 -0
  56. package/dist/helpers/drift/types/feeStructure.js +33 -0
  57. package/dist/helpers/drift/types/feeTier.d.ts +22 -0
  58. package/dist/helpers/drift/types/feeTier.js +40 -0
  59. package/dist/helpers/drift/types/fillMode.d.ts +29 -0
  60. package/dist/helpers/drift/types/fillMode.js +52 -0
  61. package/dist/helpers/drift/types/fuelOverflowStatus.d.ts +15 -0
  62. package/dist/helpers/drift/types/fuelOverflowStatus.js +27 -0
  63. package/dist/helpers/drift/types/historicalIndexData.d.ts +35 -0
  64. package/dist/helpers/drift/types/historicalIndexData.js +34 -0
  65. package/dist/helpers/drift/types/historicalOracleData.d.ts +39 -0
  66. package/dist/helpers/drift/types/historicalOracleData.js +36 -0
  67. package/dist/helpers/drift/types/ifRebalanceConfigParams.d.ts +31 -0
  68. package/dist/helpers/drift/types/ifRebalanceConfigParams.js +40 -0
  69. package/dist/helpers/drift/types/index.d.ts +114 -0
  70. package/dist/helpers/drift/types/index.js +130 -0
  71. package/dist/helpers/drift/types/insuranceClaim.d.ts +63 -0
  72. package/dist/helpers/drift/types/insuranceClaim.js +34 -0
  73. package/dist/helpers/drift/types/insuranceFund.d.ts +33 -0
  74. package/dist/helpers/drift/types/insuranceFund.js +42 -0
  75. package/dist/helpers/drift/types/insuranceFundOperation.d.ts +18 -0
  76. package/dist/helpers/drift/types/insuranceFundOperation.js +30 -0
  77. package/dist/helpers/drift/types/lPAction.d.ts +18 -0
  78. package/dist/helpers/drift/types/lPAction.js +30 -0
  79. package/dist/helpers/drift/types/liquidateBorrowForPerpPnlRecord.d.ts +27 -0
  80. package/dist/helpers/drift/types/liquidateBorrowForPerpPnlRecord.js +36 -0
  81. package/dist/helpers/drift/types/liquidatePerpPnlForDepositRecord.d.ts +27 -0
  82. package/dist/helpers/drift/types/liquidatePerpPnlForDepositRecord.js +36 -0
  83. package/dist/helpers/drift/types/liquidatePerpRecord.d.ts +41 -0
  84. package/dist/helpers/drift/types/liquidatePerpRecord.js +44 -0
  85. package/dist/helpers/drift/types/liquidateSpotRecord.d.ts +33 -0
  86. package/dist/helpers/drift/types/liquidateSpotRecord.js +38 -0
  87. package/dist/helpers/drift/types/liquidationBitFlag.d.ts +15 -0
  88. package/dist/helpers/drift/types/liquidationBitFlag.js +27 -0
  89. package/dist/helpers/drift/types/liquidationMultiplierType.d.ts +16 -0
  90. package/dist/helpers/drift/types/liquidationMultiplierType.js +28 -0
  91. package/dist/helpers/drift/types/liquidationType.d.ts +20 -0
  92. package/dist/helpers/drift/types/liquidationType.js +32 -0
  93. package/dist/helpers/drift/types/logMode.d.ts +19 -0
  94. package/dist/helpers/drift/types/logMode.js +31 -0
  95. package/dist/helpers/drift/types/lpPoolFeatureBitFlags.d.ts +17 -0
  96. package/dist/helpers/drift/types/lpPoolFeatureBitFlags.js +29 -0
  97. package/dist/helpers/drift/types/lpStatus.d.ts +17 -0
  98. package/dist/helpers/drift/types/lpStatus.js +29 -0
  99. package/dist/helpers/drift/types/marginCalculationMode.d.ts +29 -0
  100. package/dist/helpers/drift/types/marginCalculationMode.js +55 -0
  101. package/dist/helpers/drift/types/marginMode.d.ts +17 -0
  102. package/dist/helpers/drift/types/marginMode.js +29 -0
  103. package/dist/helpers/drift/types/marginRequirementType.d.ts +17 -0
  104. package/dist/helpers/drift/types/marginRequirementType.js +29 -0
  105. package/dist/helpers/drift/types/marketIdentifier.d.ts +20 -0
  106. package/dist/helpers/drift/types/marketIdentifier.js +29 -0
  107. package/dist/helpers/drift/types/marketStatus.d.ts +23 -0
  108. package/dist/helpers/drift/types/marketStatus.js +35 -0
  109. package/dist/helpers/drift/types/marketType.d.ts +16 -0
  110. package/dist/helpers/drift/types/marketType.js +28 -0
  111. package/dist/helpers/drift/types/modifyOrderId.d.ts +24 -0
  112. package/dist/helpers/drift/types/modifyOrderId.js +50 -0
  113. package/dist/helpers/drift/types/modifyOrderParams.d.ts +44 -0
  114. package/dist/helpers/drift/types/modifyOrderParams.js +53 -0
  115. package/dist/helpers/drift/types/modifyOrderPolicy.d.ts +16 -0
  116. package/dist/helpers/drift/types/modifyOrderPolicy.js +28 -0
  117. package/dist/helpers/drift/types/oracleGuardRails.d.ts +20 -0
  118. package/dist/helpers/drift/types/oracleGuardRails.js +29 -0
  119. package/dist/helpers/drift/types/oracleSource.d.ts +30 -0
  120. package/dist/helpers/drift/types/oracleSource.js +42 -0
  121. package/dist/helpers/drift/types/oracleValidity.d.ts +39 -0
  122. package/dist/helpers/drift/types/oracleValidity.js +60 -0
  123. package/dist/helpers/drift/types/order.d.ts +178 -0
  124. package/dist/helpers/drift/types/order.js +77 -0
  125. package/dist/helpers/drift/types/orderAction.d.ts +19 -0
  126. package/dist/helpers/drift/types/orderAction.js +31 -0
  127. package/dist/helpers/drift/types/orderActionExplanation.d.ts +35 -0
  128. package/dist/helpers/drift/types/orderActionExplanation.js +47 -0
  129. package/dist/helpers/drift/types/orderBitFlag.d.ts +20 -0
  130. package/dist/helpers/drift/types/orderBitFlag.js +32 -0
  131. package/dist/helpers/drift/types/orderFillerRewardStructure.d.ts +21 -0
  132. package/dist/helpers/drift/types/orderFillerRewardStructure.js +30 -0
  133. package/dist/helpers/drift/types/orderParams.d.ts +50 -0
  134. package/dist/helpers/drift/types/orderParams.js +59 -0
  135. package/dist/helpers/drift/types/orderParamsBitFlag.d.ts +16 -0
  136. package/dist/helpers/drift/types/orderParamsBitFlag.js +28 -0
  137. package/dist/helpers/drift/types/orderStatus.d.ts +18 -0
  138. package/dist/helpers/drift/types/orderStatus.js +30 -0
  139. package/dist/helpers/drift/types/orderTriggerCondition.d.ts +18 -0
  140. package/dist/helpers/drift/types/orderTriggerCondition.js +30 -0
  141. package/dist/helpers/drift/types/orderType.d.ts +19 -0
  142. package/dist/helpers/drift/types/orderType.js +31 -0
  143. package/dist/helpers/drift/types/perpBankruptcyRecord.d.ts +27 -0
  144. package/dist/helpers/drift/types/perpBankruptcyRecord.js +36 -0
  145. package/dist/helpers/drift/types/perpFulfillmentMethod.d.ts +30 -0
  146. package/dist/helpers/drift/types/perpFulfillmentMethod.js +72 -0
  147. package/dist/helpers/drift/types/perpLpOperation.d.ts +16 -0
  148. package/dist/helpers/drift/types/perpLpOperation.js +28 -0
  149. package/dist/helpers/drift/types/perpOperation.d.ts +22 -0
  150. package/dist/helpers/drift/types/perpOperation.js +34 -0
  151. package/dist/helpers/drift/types/perpPosition.d.ts +149 -0
  152. package/dist/helpers/drift/types/perpPosition.js +56 -0
  153. package/dist/helpers/drift/types/placeAndTakeOrderSuccessCondition.d.ts +16 -0
  154. package/dist/helpers/drift/types/placeAndTakeOrderSuccessCondition.js +28 -0
  155. package/dist/helpers/drift/types/poolBalance.d.ts +33 -0
  156. package/dist/helpers/drift/types/poolBalance.js +30 -0
  157. package/dist/helpers/drift/types/positionDirection.d.ts +16 -0
  158. package/dist/helpers/drift/types/positionDirection.js +28 -0
  159. package/dist/helpers/drift/types/positionFlag.d.ts +17 -0
  160. package/dist/helpers/drift/types/positionFlag.js +29 -0
  161. package/dist/helpers/drift/types/positionUpdateType.d.ts +19 -0
  162. package/dist/helpers/drift/types/positionUpdateType.js +31 -0
  163. package/dist/helpers/drift/types/postOnlyParam.d.ts +18 -0
  164. package/dist/helpers/drift/types/postOnlyParam.js +30 -0
  165. package/dist/helpers/drift/types/prelaunchOracleParams.d.ts +21 -0
  166. package/dist/helpers/drift/types/prelaunchOracleParams.js +30 -0
  167. package/dist/helpers/drift/types/priceDivergenceGuardRails.d.ts +19 -0
  168. package/dist/helpers/drift/types/priceDivergenceGuardRails.js +28 -0
  169. package/dist/helpers/drift/types/referrerStatus.d.ts +17 -0
  170. package/dist/helpers/drift/types/referrerStatus.js +29 -0
  171. package/dist/helpers/drift/types/revenueShareEscrowFixed.d.ts +21 -0
  172. package/dist/helpers/drift/types/revenueShareEscrowFixed.js +38 -0
  173. package/dist/helpers/drift/types/revenueShareOrder.d.ts +80 -0
  174. package/dist/helpers/drift/types/revenueShareOrder.js +45 -0
  175. package/dist/helpers/drift/types/revenueShareOrderBitFlag.d.ts +18 -0
  176. package/dist/helpers/drift/types/revenueShareOrderBitFlag.js +30 -0
  177. package/dist/helpers/drift/types/settlePnlExplanation.d.ts +16 -0
  178. package/dist/helpers/drift/types/settlePnlExplanation.js +28 -0
  179. package/dist/helpers/drift/types/settlePnlMode.d.ts +16 -0
  180. package/dist/helpers/drift/types/settlePnlMode.js +28 -0
  181. package/dist/helpers/drift/types/settlementDirection.d.ts +17 -0
  182. package/dist/helpers/drift/types/settlementDirection.js +29 -0
  183. package/dist/helpers/drift/types/signatureVerificationError.d.ts +26 -0
  184. package/dist/helpers/drift/types/signatureVerificationError.js +38 -0
  185. package/dist/helpers/drift/types/signedMsgOrderId.d.ts +23 -0
  186. package/dist/helpers/drift/types/signedMsgOrderId.js +32 -0
  187. package/dist/helpers/drift/types/signedMsgOrderParamsDelegateMessage.d.ts +36 -0
  188. package/dist/helpers/drift/types/signedMsgOrderParamsDelegateMessage.js +57 -0
  189. package/dist/helpers/drift/types/signedMsgOrderParamsMessage.d.ts +36 -0
  190. package/dist/helpers/drift/types/signedMsgOrderParamsMessage.js +57 -0
  191. package/dist/helpers/drift/types/signedMsgTriggerOrderParams.d.ts +19 -0
  192. package/dist/helpers/drift/types/signedMsgTriggerOrderParams.js +28 -0
  193. package/dist/helpers/drift/types/signedMsgUserOrdersFixed.d.ts +17 -0
  194. package/dist/helpers/drift/types/signedMsgUserOrdersFixed.js +30 -0
  195. package/dist/helpers/drift/types/spotBalanceType.d.ts +16 -0
  196. package/dist/helpers/drift/types/spotBalanceType.js +28 -0
  197. package/dist/helpers/drift/types/spotBankruptcyRecord.d.ts +23 -0
  198. package/dist/helpers/drift/types/spotBankruptcyRecord.js +32 -0
  199. package/dist/helpers/drift/types/spotFulfillmentConfigStatus.d.ts +16 -0
  200. package/dist/helpers/drift/types/spotFulfillmentConfigStatus.js +28 -0
  201. package/dist/helpers/drift/types/spotFulfillmentMethod.d.ts +23 -0
  202. package/dist/helpers/drift/types/spotFulfillmentMethod.js +48 -0
  203. package/dist/helpers/drift/types/spotFulfillmentType.d.ts +18 -0
  204. package/dist/helpers/drift/types/spotFulfillmentType.js +30 -0
  205. package/dist/helpers/drift/types/spotOperation.d.ts +19 -0
  206. package/dist/helpers/drift/types/spotOperation.js +31 -0
  207. package/dist/helpers/drift/types/spotPosition.d.ts +72 -0
  208. package/dist/helpers/drift/types/spotPosition.js +41 -0
  209. package/dist/helpers/drift/types/stakeAction.d.ts +21 -0
  210. package/dist/helpers/drift/types/stakeAction.js +33 -0
  211. package/dist/helpers/drift/types/swapDirection.d.ts +16 -0
  212. package/dist/helpers/drift/types/swapDirection.js +28 -0
  213. package/dist/helpers/drift/types/swapReduceOnly.d.ts +16 -0
  214. package/dist/helpers/drift/types/swapReduceOnly.js +28 -0
  215. package/dist/helpers/drift/types/targetsDatum.d.ts +25 -0
  216. package/dist/helpers/drift/types/targetsDatum.js +34 -0
  217. package/dist/helpers/drift/types/tokenProgramFlag.d.ts +16 -0
  218. package/dist/helpers/drift/types/tokenProgramFlag.js +28 -0
  219. package/dist/helpers/drift/types/twapPeriod.d.ts +16 -0
  220. package/dist/helpers/drift/types/twapPeriod.js +28 -0
  221. package/dist/helpers/drift/types/userFees.d.ts +75 -0
  222. package/dist/helpers/drift/types/userFees.js +36 -0
  223. package/dist/helpers/drift/types/userStatsPausedOperations.d.ts +17 -0
  224. package/dist/helpers/drift/types/userStatsPausedOperations.js +29 -0
  225. package/dist/helpers/drift/types/userStatus.d.ts +19 -0
  226. package/dist/helpers/drift/types/userStatus.js +31 -0
  227. package/dist/helpers/drift/types/validityGuardRails.d.ts +23 -0
  228. package/dist/helpers/drift/types/validityGuardRails.js +32 -0
  229. package/dist/helpers/index.d.ts +1 -0
  230. package/dist/helpers/index.js +17 -0
  231. package/dist/stablecoins/UsdcPlusStablecoin.d.ts +2 -3
  232. package/dist/stablecoins/UsdcPlusStablecoin.js +22 -47
  233. package/dist/tsconfig.tsbuildinfo +1 -1
  234. package/package.json +3 -2
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This code was AUTOGENERATED using the Codama library.
3
+ * Please DO NOT EDIT THIS FILE, instead use visitors
4
+ * to add features, then rerun Codama to update it.
5
+ *
6
+ * @see https://github.com/codama-idl/codama
7
+ */
8
+ export * from "./spotMarket";
9
+ export * from "./user";
10
+ export * from "./userStats";
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ /**
3
+ * This code was AUTOGENERATED using the Codama library.
4
+ * Please DO NOT EDIT THIS FILE, instead use visitors
5
+ * to add features, then rerun Codama to update it.
6
+ *
7
+ * @see https://github.com/codama-idl/codama
8
+ */
9
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
16
+ }) : (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ o[k2] = m[k];
19
+ }));
20
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
21
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
22
+ };
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ __exportStar(require("./spotMarket"), exports);
25
+ __exportStar(require("./user"), exports);
26
+ __exportStar(require("./userStats"), exports);
@@ -0,0 +1,541 @@
1
+ /**
2
+ * This code was AUTOGENERATED using the Codama library.
3
+ * Please DO NOT EDIT THIS FILE, instead use visitors
4
+ * to add features, then rerun Codama to update it.
5
+ *
6
+ * @see https://github.com/codama-idl/codama
7
+ */
8
+ import { fetchEncodedAccount, fetchEncodedAccounts, type Account, type Address, type EncodedAccount, type FetchAccountConfig, type FetchAccountsConfig, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type MaybeAccount, type MaybeEncodedAccount, type ReadonlyUint8Array } from "@solana/kit";
9
+ import { type AssetTier, type AssetTierArgs, type HistoricalIndexData, type HistoricalIndexDataArgs, type HistoricalOracleData, type HistoricalOracleDataArgs, type InsuranceFund, type InsuranceFundArgs, type MarketStatus, type MarketStatusArgs, type OracleSource, type OracleSourceArgs, type PoolBalance, type PoolBalanceArgs } from "../types";
10
+ export declare const SPOT_MARKET_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
11
+ export declare function getSpotMarketDiscriminatorBytes(): ReadonlyUint8Array;
12
+ export type SpotMarket = {
13
+ discriminator: ReadonlyUint8Array;
14
+ /** The address of the spot market. It is a pda of the market index */
15
+ pubkey: Address;
16
+ /** The oracle used to price the markets deposits/borrows */
17
+ oracle: Address;
18
+ /** The token mint of the market */
19
+ mint: Address;
20
+ /**
21
+ * The vault used to store the market's deposits
22
+ * The amount in the vault should be equal to or greater than deposits - borrows
23
+ */
24
+ vault: Address;
25
+ /** The encoded display name for the market e.g. SOL */
26
+ name: ReadonlyUint8Array;
27
+ historicalOracleData: HistoricalOracleData;
28
+ historicalIndexData: HistoricalIndexData;
29
+ /**
30
+ * Revenue the protocol has collected in this markets token
31
+ * e.g. for SOL-PERP, funds can be settled in usdc and will flow into the USDC revenue pool
32
+ */
33
+ revenuePool: PoolBalance;
34
+ /**
35
+ * The fees collected from swaps between this market and the quote market
36
+ * Is settled to the quote markets revenue pool
37
+ */
38
+ spotFeePool: PoolBalance;
39
+ /**
40
+ * Details on the insurance fund covering bankruptcies in this markets token
41
+ * Covers bankruptcies for borrows with this markets token and perps settling in this markets token
42
+ */
43
+ insuranceFund: InsuranceFund;
44
+ /**
45
+ * The total spot fees collected for this market
46
+ * precision: QUOTE_PRECISION
47
+ */
48
+ totalSpotFee: bigint;
49
+ /**
50
+ * The sum of the scaled balances for deposits across users and pool balances
51
+ * To convert to the deposit token amount, multiply by the cumulative deposit interest
52
+ * precision: SPOT_BALANCE_PRECISION
53
+ */
54
+ depositBalance: bigint;
55
+ /**
56
+ * The sum of the scaled balances for borrows across users and pool balances
57
+ * To convert to the borrow token amount, multiply by the cumulative borrow interest
58
+ * precision: SPOT_BALANCE_PRECISION
59
+ */
60
+ borrowBalance: bigint;
61
+ /**
62
+ * The cumulative interest earned by depositors
63
+ * Used to calculate the deposit token amount from the deposit balance
64
+ * precision: SPOT_CUMULATIVE_INTEREST_PRECISION
65
+ */
66
+ cumulativeDepositInterest: bigint;
67
+ /**
68
+ * The cumulative interest earned by borrowers
69
+ * Used to calculate the borrow token amount from the borrow balance
70
+ * precision: SPOT_CUMULATIVE_INTEREST_PRECISION
71
+ */
72
+ cumulativeBorrowInterest: bigint;
73
+ /**
74
+ * The total socialized loss from borrows, in the mint's token
75
+ * precision: token mint precision
76
+ */
77
+ totalSocialLoss: bigint;
78
+ /**
79
+ * The total socialized loss from borrows, in the quote market's token
80
+ * preicision: QUOTE_PRECISION
81
+ */
82
+ totalQuoteSocialLoss: bigint;
83
+ /**
84
+ * no withdraw limits/guards when deposits below this threshold
85
+ * precision: token mint precision
86
+ */
87
+ withdrawGuardThreshold: bigint;
88
+ /**
89
+ * The max amount of token deposits in this market
90
+ * 0 if there is no limit
91
+ * precision: token mint precision
92
+ */
93
+ maxTokenDeposits: bigint;
94
+ /**
95
+ * 24hr average of deposit token amount
96
+ * precision: token mint precision
97
+ */
98
+ depositTokenTwap: bigint;
99
+ /**
100
+ * 24hr average of borrow token amount
101
+ * precision: token mint precision
102
+ */
103
+ borrowTokenTwap: bigint;
104
+ /**
105
+ * 24hr average of utilization
106
+ * which is borrow amount over token amount
107
+ * precision: SPOT_UTILIZATION_PRECISION
108
+ */
109
+ utilizationTwap: bigint;
110
+ /** Last time the cumulative deposit and borrow interest was updated */
111
+ lastInterestTs: bigint;
112
+ /** Last time the deposit/borrow/utilization averages were updated */
113
+ lastTwapTs: bigint;
114
+ /** The time the market is set to expire. Only set if market is in reduce only mode */
115
+ expiryTs: bigint;
116
+ /**
117
+ * Spot orders must be a multiple of the step size
118
+ * precision: token mint precision
119
+ */
120
+ orderStepSize: bigint;
121
+ /**
122
+ * Spot orders must be a multiple of the tick size
123
+ * precision: PRICE_PRECISION
124
+ */
125
+ orderTickSize: bigint;
126
+ /**
127
+ * The minimum order size
128
+ * precision: token mint precision
129
+ */
130
+ minOrderSize: bigint;
131
+ /**
132
+ * The maximum spot position size
133
+ * if the limit is 0, there is no limit
134
+ * precision: token mint precision
135
+ */
136
+ maxPositionSize: bigint;
137
+ /** Every spot trade has a fill record id. This is the next id to use */
138
+ nextFillRecordId: bigint;
139
+ /** Every deposit has a deposit record id. This is the next id to use */
140
+ nextDepositRecordId: bigint;
141
+ /**
142
+ * The initial asset weight used to calculate a deposits contribution to a users initial total collateral
143
+ * e.g. if the asset weight is .8, $100 of deposits contributes $80 to the users initial total collateral
144
+ * precision: SPOT_WEIGHT_PRECISION
145
+ */
146
+ initialAssetWeight: number;
147
+ /**
148
+ * The maintenance asset weight used to calculate a deposits contribution to a users maintenance total collateral
149
+ * e.g. if the asset weight is .9, $100 of deposits contributes $90 to the users maintenance total collateral
150
+ * precision: SPOT_WEIGHT_PRECISION
151
+ */
152
+ maintenanceAssetWeight: number;
153
+ /**
154
+ * The initial liability weight used to calculate a borrows contribution to a users initial margin requirement
155
+ * e.g. if the liability weight is .9, $100 of borrows contributes $90 to the users initial margin requirement
156
+ * precision: SPOT_WEIGHT_PRECISION
157
+ */
158
+ initialLiabilityWeight: number;
159
+ /**
160
+ * The maintenance liability weight used to calculate a borrows contribution to a users maintenance margin requirement
161
+ * e.g. if the liability weight is .8, $100 of borrows contributes $80 to the users maintenance margin requirement
162
+ * precision: SPOT_WEIGHT_PRECISION
163
+ */
164
+ maintenanceLiabilityWeight: number;
165
+ /**
166
+ * The initial margin fraction factor. Used to increase liability weight/decrease asset weight for large positions
167
+ * precision: MARGIN_PRECISION
168
+ */
169
+ imfFactor: number;
170
+ /**
171
+ * The fee the liquidator is paid for taking over borrow/deposit
172
+ * precision: LIQUIDATOR_FEE_PRECISION
173
+ */
174
+ liquidatorFee: number;
175
+ /**
176
+ * The fee the insurance fund receives from liquidation
177
+ * precision: LIQUIDATOR_FEE_PRECISION
178
+ */
179
+ ifLiquidationFee: number;
180
+ /**
181
+ * The optimal utilization rate for this market.
182
+ * Used to determine the markets borrow rate
183
+ * precision: SPOT_UTILIZATION_PRECISION
184
+ */
185
+ optimalUtilization: number;
186
+ /**
187
+ * The borrow rate for this market when the market has optimal utilization
188
+ * precision: SPOT_RATE_PRECISION
189
+ */
190
+ optimalBorrowRate: number;
191
+ /**
192
+ * The borrow rate for this market when the market has 1000 utilization
193
+ * precision: SPOT_RATE_PRECISION
194
+ */
195
+ maxBorrowRate: number;
196
+ /** The market's token mint's decimals. To from decimals to a precision, 10^decimals */
197
+ decimals: number;
198
+ marketIndex: number;
199
+ /** Whether or not spot trading is enabled */
200
+ ordersEnabled: boolean;
201
+ oracleSource: OracleSource;
202
+ status: MarketStatus;
203
+ /** The asset tier affects how a deposit can be used as collateral and the priority for a borrow being liquidated */
204
+ assetTier: AssetTier;
205
+ pausedOperations: number;
206
+ ifPausedOperations: number;
207
+ feeAdjustment: number;
208
+ /**
209
+ * What fraction of max_token_deposits
210
+ * disabled when 0, 1 => 1/10000 => .01% of max_token_deposits
211
+ * precision: X/10000
212
+ */
213
+ maxTokenBorrowsFraction: number;
214
+ /**
215
+ * For swaps, the amount of token loaned out in the begin_swap ix
216
+ * precision: token mint precision
217
+ */
218
+ flashLoanAmount: bigint;
219
+ /**
220
+ * For swaps, the amount in the users token account in the begin_swap ix
221
+ * Used to calculate how much of the token left the system in end_swap ix
222
+ * precision: token mint precision
223
+ */
224
+ flashLoanInitialTokenAmount: bigint;
225
+ /**
226
+ * The total fees received from swaps
227
+ * precision: token mint precision
228
+ */
229
+ totalSwapFee: bigint;
230
+ /**
231
+ * When to begin scaling down the initial asset weight
232
+ * disabled when 0
233
+ * precision: QUOTE_PRECISION
234
+ */
235
+ scaleInitialAssetWeightStart: bigint;
236
+ /**
237
+ * The min borrow rate for this market when the market regardless of utilization
238
+ * 1 => 1/200 => .5%
239
+ * precision: X/200
240
+ */
241
+ minBorrowRate: number;
242
+ /**
243
+ * fuel multiplier for spot deposits
244
+ * precision: 10
245
+ */
246
+ fuelBoostDeposits: number;
247
+ /**
248
+ * fuel multiplier for spot borrows
249
+ * precision: 10
250
+ */
251
+ fuelBoostBorrows: number;
252
+ /**
253
+ * fuel multiplier for spot taker
254
+ * precision: 10
255
+ */
256
+ fuelBoostTaker: number;
257
+ /**
258
+ * fuel multiplier for spot maker
259
+ * precision: 10
260
+ */
261
+ fuelBoostMaker: number;
262
+ /**
263
+ * fuel multiplier for spot insurance stake
264
+ * precision: 10
265
+ */
266
+ fuelBoostInsurance: number;
267
+ tokenProgramFlag: number;
268
+ poolId: number;
269
+ padding: ReadonlyUint8Array;
270
+ };
271
+ export type SpotMarketArgs = {
272
+ /** The address of the spot market. It is a pda of the market index */
273
+ pubkey: Address;
274
+ /** The oracle used to price the markets deposits/borrows */
275
+ oracle: Address;
276
+ /** The token mint of the market */
277
+ mint: Address;
278
+ /**
279
+ * The vault used to store the market's deposits
280
+ * The amount in the vault should be equal to or greater than deposits - borrows
281
+ */
282
+ vault: Address;
283
+ /** The encoded display name for the market e.g. SOL */
284
+ name: ReadonlyUint8Array;
285
+ historicalOracleData: HistoricalOracleDataArgs;
286
+ historicalIndexData: HistoricalIndexDataArgs;
287
+ /**
288
+ * Revenue the protocol has collected in this markets token
289
+ * e.g. for SOL-PERP, funds can be settled in usdc and will flow into the USDC revenue pool
290
+ */
291
+ revenuePool: PoolBalanceArgs;
292
+ /**
293
+ * The fees collected from swaps between this market and the quote market
294
+ * Is settled to the quote markets revenue pool
295
+ */
296
+ spotFeePool: PoolBalanceArgs;
297
+ /**
298
+ * Details on the insurance fund covering bankruptcies in this markets token
299
+ * Covers bankruptcies for borrows with this markets token and perps settling in this markets token
300
+ */
301
+ insuranceFund: InsuranceFundArgs;
302
+ /**
303
+ * The total spot fees collected for this market
304
+ * precision: QUOTE_PRECISION
305
+ */
306
+ totalSpotFee: number | bigint;
307
+ /**
308
+ * The sum of the scaled balances for deposits across users and pool balances
309
+ * To convert to the deposit token amount, multiply by the cumulative deposit interest
310
+ * precision: SPOT_BALANCE_PRECISION
311
+ */
312
+ depositBalance: number | bigint;
313
+ /**
314
+ * The sum of the scaled balances for borrows across users and pool balances
315
+ * To convert to the borrow token amount, multiply by the cumulative borrow interest
316
+ * precision: SPOT_BALANCE_PRECISION
317
+ */
318
+ borrowBalance: number | bigint;
319
+ /**
320
+ * The cumulative interest earned by depositors
321
+ * Used to calculate the deposit token amount from the deposit balance
322
+ * precision: SPOT_CUMULATIVE_INTEREST_PRECISION
323
+ */
324
+ cumulativeDepositInterest: number | bigint;
325
+ /**
326
+ * The cumulative interest earned by borrowers
327
+ * Used to calculate the borrow token amount from the borrow balance
328
+ * precision: SPOT_CUMULATIVE_INTEREST_PRECISION
329
+ */
330
+ cumulativeBorrowInterest: number | bigint;
331
+ /**
332
+ * The total socialized loss from borrows, in the mint's token
333
+ * precision: token mint precision
334
+ */
335
+ totalSocialLoss: number | bigint;
336
+ /**
337
+ * The total socialized loss from borrows, in the quote market's token
338
+ * preicision: QUOTE_PRECISION
339
+ */
340
+ totalQuoteSocialLoss: number | bigint;
341
+ /**
342
+ * no withdraw limits/guards when deposits below this threshold
343
+ * precision: token mint precision
344
+ */
345
+ withdrawGuardThreshold: number | bigint;
346
+ /**
347
+ * The max amount of token deposits in this market
348
+ * 0 if there is no limit
349
+ * precision: token mint precision
350
+ */
351
+ maxTokenDeposits: number | bigint;
352
+ /**
353
+ * 24hr average of deposit token amount
354
+ * precision: token mint precision
355
+ */
356
+ depositTokenTwap: number | bigint;
357
+ /**
358
+ * 24hr average of borrow token amount
359
+ * precision: token mint precision
360
+ */
361
+ borrowTokenTwap: number | bigint;
362
+ /**
363
+ * 24hr average of utilization
364
+ * which is borrow amount over token amount
365
+ * precision: SPOT_UTILIZATION_PRECISION
366
+ */
367
+ utilizationTwap: number | bigint;
368
+ /** Last time the cumulative deposit and borrow interest was updated */
369
+ lastInterestTs: number | bigint;
370
+ /** Last time the deposit/borrow/utilization averages were updated */
371
+ lastTwapTs: number | bigint;
372
+ /** The time the market is set to expire. Only set if market is in reduce only mode */
373
+ expiryTs: number | bigint;
374
+ /**
375
+ * Spot orders must be a multiple of the step size
376
+ * precision: token mint precision
377
+ */
378
+ orderStepSize: number | bigint;
379
+ /**
380
+ * Spot orders must be a multiple of the tick size
381
+ * precision: PRICE_PRECISION
382
+ */
383
+ orderTickSize: number | bigint;
384
+ /**
385
+ * The minimum order size
386
+ * precision: token mint precision
387
+ */
388
+ minOrderSize: number | bigint;
389
+ /**
390
+ * The maximum spot position size
391
+ * if the limit is 0, there is no limit
392
+ * precision: token mint precision
393
+ */
394
+ maxPositionSize: number | bigint;
395
+ /** Every spot trade has a fill record id. This is the next id to use */
396
+ nextFillRecordId: number | bigint;
397
+ /** Every deposit has a deposit record id. This is the next id to use */
398
+ nextDepositRecordId: number | bigint;
399
+ /**
400
+ * The initial asset weight used to calculate a deposits contribution to a users initial total collateral
401
+ * e.g. if the asset weight is .8, $100 of deposits contributes $80 to the users initial total collateral
402
+ * precision: SPOT_WEIGHT_PRECISION
403
+ */
404
+ initialAssetWeight: number;
405
+ /**
406
+ * The maintenance asset weight used to calculate a deposits contribution to a users maintenance total collateral
407
+ * e.g. if the asset weight is .9, $100 of deposits contributes $90 to the users maintenance total collateral
408
+ * precision: SPOT_WEIGHT_PRECISION
409
+ */
410
+ maintenanceAssetWeight: number;
411
+ /**
412
+ * The initial liability weight used to calculate a borrows contribution to a users initial margin requirement
413
+ * e.g. if the liability weight is .9, $100 of borrows contributes $90 to the users initial margin requirement
414
+ * precision: SPOT_WEIGHT_PRECISION
415
+ */
416
+ initialLiabilityWeight: number;
417
+ /**
418
+ * The maintenance liability weight used to calculate a borrows contribution to a users maintenance margin requirement
419
+ * e.g. if the liability weight is .8, $100 of borrows contributes $80 to the users maintenance margin requirement
420
+ * precision: SPOT_WEIGHT_PRECISION
421
+ */
422
+ maintenanceLiabilityWeight: number;
423
+ /**
424
+ * The initial margin fraction factor. Used to increase liability weight/decrease asset weight for large positions
425
+ * precision: MARGIN_PRECISION
426
+ */
427
+ imfFactor: number;
428
+ /**
429
+ * The fee the liquidator is paid for taking over borrow/deposit
430
+ * precision: LIQUIDATOR_FEE_PRECISION
431
+ */
432
+ liquidatorFee: number;
433
+ /**
434
+ * The fee the insurance fund receives from liquidation
435
+ * precision: LIQUIDATOR_FEE_PRECISION
436
+ */
437
+ ifLiquidationFee: number;
438
+ /**
439
+ * The optimal utilization rate for this market.
440
+ * Used to determine the markets borrow rate
441
+ * precision: SPOT_UTILIZATION_PRECISION
442
+ */
443
+ optimalUtilization: number;
444
+ /**
445
+ * The borrow rate for this market when the market has optimal utilization
446
+ * precision: SPOT_RATE_PRECISION
447
+ */
448
+ optimalBorrowRate: number;
449
+ /**
450
+ * The borrow rate for this market when the market has 1000 utilization
451
+ * precision: SPOT_RATE_PRECISION
452
+ */
453
+ maxBorrowRate: number;
454
+ /** The market's token mint's decimals. To from decimals to a precision, 10^decimals */
455
+ decimals: number;
456
+ marketIndex: number;
457
+ /** Whether or not spot trading is enabled */
458
+ ordersEnabled: boolean;
459
+ oracleSource: OracleSourceArgs;
460
+ status: MarketStatusArgs;
461
+ /** The asset tier affects how a deposit can be used as collateral and the priority for a borrow being liquidated */
462
+ assetTier: AssetTierArgs;
463
+ pausedOperations: number;
464
+ ifPausedOperations: number;
465
+ feeAdjustment: number;
466
+ /**
467
+ * What fraction of max_token_deposits
468
+ * disabled when 0, 1 => 1/10000 => .01% of max_token_deposits
469
+ * precision: X/10000
470
+ */
471
+ maxTokenBorrowsFraction: number;
472
+ /**
473
+ * For swaps, the amount of token loaned out in the begin_swap ix
474
+ * precision: token mint precision
475
+ */
476
+ flashLoanAmount: number | bigint;
477
+ /**
478
+ * For swaps, the amount in the users token account in the begin_swap ix
479
+ * Used to calculate how much of the token left the system in end_swap ix
480
+ * precision: token mint precision
481
+ */
482
+ flashLoanInitialTokenAmount: number | bigint;
483
+ /**
484
+ * The total fees received from swaps
485
+ * precision: token mint precision
486
+ */
487
+ totalSwapFee: number | bigint;
488
+ /**
489
+ * When to begin scaling down the initial asset weight
490
+ * disabled when 0
491
+ * precision: QUOTE_PRECISION
492
+ */
493
+ scaleInitialAssetWeightStart: number | bigint;
494
+ /**
495
+ * The min borrow rate for this market when the market regardless of utilization
496
+ * 1 => 1/200 => .5%
497
+ * precision: X/200
498
+ */
499
+ minBorrowRate: number;
500
+ /**
501
+ * fuel multiplier for spot deposits
502
+ * precision: 10
503
+ */
504
+ fuelBoostDeposits: number;
505
+ /**
506
+ * fuel multiplier for spot borrows
507
+ * precision: 10
508
+ */
509
+ fuelBoostBorrows: number;
510
+ /**
511
+ * fuel multiplier for spot taker
512
+ * precision: 10
513
+ */
514
+ fuelBoostTaker: number;
515
+ /**
516
+ * fuel multiplier for spot maker
517
+ * precision: 10
518
+ */
519
+ fuelBoostMaker: number;
520
+ /**
521
+ * fuel multiplier for spot insurance stake
522
+ * precision: 10
523
+ */
524
+ fuelBoostInsurance: number;
525
+ tokenProgramFlag: number;
526
+ poolId: number;
527
+ padding: ReadonlyUint8Array;
528
+ };
529
+ /** Gets the encoder for {@link SpotMarketArgs} account data. */
530
+ export declare function getSpotMarketEncoder(): FixedSizeEncoder<SpotMarketArgs>;
531
+ /** Gets the decoder for {@link SpotMarket} account data. */
532
+ export declare function getSpotMarketDecoder(): FixedSizeDecoder<SpotMarket>;
533
+ /** Gets the codec for {@link SpotMarket} account data. */
534
+ export declare function getSpotMarketCodec(): FixedSizeCodec<SpotMarketArgs, SpotMarket>;
535
+ export declare function decodeSpotMarket<TAddress extends string = string>(encodedAccount: EncodedAccount<TAddress>): Account<SpotMarket, TAddress>;
536
+ export declare function decodeSpotMarket<TAddress extends string = string>(encodedAccount: MaybeEncodedAccount<TAddress>): MaybeAccount<SpotMarket, TAddress>;
537
+ export declare function fetchSpotMarket<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<Account<SpotMarket, TAddress>>;
538
+ export declare function fetchMaybeSpotMarket<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<MaybeAccount<SpotMarket, TAddress>>;
539
+ export declare function fetchAllSpotMarket(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<Account<SpotMarket>[]>;
540
+ export declare function fetchAllMaybeSpotMarket(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<MaybeAccount<SpotMarket>[]>;
541
+ export declare function getSpotMarketSize(): number;