@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,656 @@
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 { type Address, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type ReadonlyUint8Array } from "@solana/kit";
9
+ import { type HistoricalOracleData, type HistoricalOracleDataArgs, type OracleSource, type OracleSourceArgs, type PoolBalance, type PoolBalanceArgs } from ".";
10
+ export type AMM = {
11
+ /** oracle price data public key */
12
+ oracle: Address;
13
+ /** stores historically witnessed oracle data */
14
+ historicalOracleData: HistoricalOracleData;
15
+ /**
16
+ * accumulated base asset amount since inception per lp share
17
+ * precision: QUOTE_PRECISION
18
+ */
19
+ baseAssetAmountPerLp: bigint;
20
+ /**
21
+ * accumulated quote asset amount since inception per lp share
22
+ * precision: QUOTE_PRECISION
23
+ */
24
+ quoteAssetAmountPerLp: bigint;
25
+ /** partition of fees from perp market trading moved from pnl settlements */
26
+ feePool: PoolBalance;
27
+ /**
28
+ * `x` reserves for constant product mm formula (x * y = k)
29
+ * precision: AMM_RESERVE_PRECISION
30
+ */
31
+ baseAssetReserve: bigint;
32
+ /**
33
+ * `y` reserves for constant product mm formula (x * y = k)
34
+ * precision: AMM_RESERVE_PRECISION
35
+ */
36
+ quoteAssetReserve: bigint;
37
+ /**
38
+ * determines how close the min/max base asset reserve sit vs base reserves
39
+ * allow for decreasing slippage without increasing liquidity and v.v.
40
+ * precision: PERCENTAGE_PRECISION
41
+ */
42
+ concentrationCoef: bigint;
43
+ /**
44
+ * minimum base_asset_reserve allowed before AMM is unavailable
45
+ * precision: AMM_RESERVE_PRECISION
46
+ */
47
+ minBaseAssetReserve: bigint;
48
+ /**
49
+ * maximum base_asset_reserve allowed before AMM is unavailable
50
+ * precision: AMM_RESERVE_PRECISION
51
+ */
52
+ maxBaseAssetReserve: bigint;
53
+ /**
54
+ * `sqrt(k)` in constant product mm formula (x * y = k). stored to avoid drift caused by integer math issues
55
+ * precision: AMM_RESERVE_PRECISION
56
+ */
57
+ sqrtK: bigint;
58
+ /**
59
+ * normalizing numerical factor for y, its use offers lowest slippage in cp-curve when market is balanced
60
+ * precision: PEG_PRECISION
61
+ */
62
+ pegMultiplier: bigint;
63
+ /**
64
+ * y when market is balanced. stored to save computation
65
+ * precision: AMM_RESERVE_PRECISION
66
+ */
67
+ terminalQuoteAssetReserve: bigint;
68
+ /**
69
+ * always non-negative. tracks number of total longs in market (regardless of counterparty)
70
+ * precision: BASE_PRECISION
71
+ */
72
+ baseAssetAmountLong: bigint;
73
+ /**
74
+ * always non-positive. tracks number of total shorts in market (regardless of counterparty)
75
+ * precision: BASE_PRECISION
76
+ */
77
+ baseAssetAmountShort: bigint;
78
+ /**
79
+ * tracks net position (longs-shorts) in market with AMM as counterparty
80
+ * precision: BASE_PRECISION
81
+ */
82
+ baseAssetAmountWithAmm: bigint;
83
+ /**
84
+ * tracks net position (longs-shorts) in market with LPs as counterparty
85
+ * precision: BASE_PRECISION
86
+ */
87
+ baseAssetAmountWithUnsettledLp: bigint;
88
+ /**
89
+ * max allowed open interest, blocks trades that breach this value
90
+ * precision: BASE_PRECISION
91
+ */
92
+ maxOpenInterest: bigint;
93
+ /**
94
+ * sum of all user's perp quote_asset_amount in market
95
+ * precision: QUOTE_PRECISION
96
+ */
97
+ quoteAssetAmount: bigint;
98
+ /**
99
+ * sum of all long user's quote_entry_amount in market
100
+ * precision: QUOTE_PRECISION
101
+ */
102
+ quoteEntryAmountLong: bigint;
103
+ /**
104
+ * sum of all short user's quote_entry_amount in market
105
+ * precision: QUOTE_PRECISION
106
+ */
107
+ quoteEntryAmountShort: bigint;
108
+ /**
109
+ * sum of all long user's quote_break_even_amount in market
110
+ * precision: QUOTE_PRECISION
111
+ */
112
+ quoteBreakEvenAmountLong: bigint;
113
+ /**
114
+ * sum of all short user's quote_break_even_amount in market
115
+ * precision: QUOTE_PRECISION
116
+ */
117
+ quoteBreakEvenAmountShort: bigint;
118
+ /**
119
+ * total user lp shares of sqrt_k (protocol owned liquidity = sqrt_k - last_funding_rate)
120
+ * precision: AMM_RESERVE_PRECISION
121
+ */
122
+ userLpShares: bigint;
123
+ /**
124
+ * last funding rate in this perp market (unit is quote per base)
125
+ * precision: FUNDING_RATE_PRECISION
126
+ */
127
+ lastFundingRate: bigint;
128
+ /**
129
+ * last funding rate for longs in this perp market (unit is quote per base)
130
+ * precision: FUNDING_RATE_PRECISION
131
+ */
132
+ lastFundingRateLong: bigint;
133
+ /**
134
+ * last funding rate for shorts in this perp market (unit is quote per base)
135
+ * precision: QUOTE_PRECISION
136
+ */
137
+ lastFundingRateShort: bigint;
138
+ /**
139
+ * estimate of last 24h of funding rate perp market (unit is quote per base)
140
+ * precision: QUOTE_PRECISION
141
+ */
142
+ last24hAvgFundingRate: bigint;
143
+ /**
144
+ * total fees collected by this perp market
145
+ * precision: QUOTE_PRECISION
146
+ */
147
+ totalFee: bigint;
148
+ /**
149
+ * total fees collected by the vAMM's bid/ask spread
150
+ * precision: QUOTE_PRECISION
151
+ */
152
+ totalMmFee: bigint;
153
+ /**
154
+ * total fees collected by exchange fee schedule
155
+ * precision: QUOTE_PRECISION
156
+ */
157
+ totalExchangeFee: bigint;
158
+ /**
159
+ * total fees minus any recognized upnl and pool withdraws
160
+ * precision: QUOTE_PRECISION
161
+ */
162
+ totalFeeMinusDistributions: bigint;
163
+ /**
164
+ * sum of all fees from fee pool withdrawn to revenue pool
165
+ * precision: QUOTE_PRECISION
166
+ */
167
+ totalFeeWithdrawn: bigint;
168
+ /**
169
+ * all fees collected by market for liquidations
170
+ * precision: QUOTE_PRECISION
171
+ */
172
+ totalLiquidationFee: bigint;
173
+ /** accumulated funding rate for longs since inception in market */
174
+ cumulativeFundingRateLong: bigint;
175
+ /** accumulated funding rate for shorts since inception in market */
176
+ cumulativeFundingRateShort: bigint;
177
+ /** accumulated social loss paid by users since inception in market */
178
+ totalSocialLoss: bigint;
179
+ /**
180
+ * transformed base_asset_reserve for users going long
181
+ * precision: AMM_RESERVE_PRECISION
182
+ */
183
+ askBaseAssetReserve: bigint;
184
+ /**
185
+ * transformed quote_asset_reserve for users going long
186
+ * precision: AMM_RESERVE_PRECISION
187
+ */
188
+ askQuoteAssetReserve: bigint;
189
+ /**
190
+ * transformed base_asset_reserve for users going short
191
+ * precision: AMM_RESERVE_PRECISION
192
+ */
193
+ bidBaseAssetReserve: bigint;
194
+ /**
195
+ * transformed quote_asset_reserve for users going short
196
+ * precision: AMM_RESERVE_PRECISION
197
+ */
198
+ bidQuoteAssetReserve: bigint;
199
+ /**
200
+ * the last seen oracle price partially shrunk toward the amm reserve price
201
+ * precision: PRICE_PRECISION
202
+ */
203
+ lastOracleNormalisedPrice: bigint;
204
+ /** the gap between the oracle price and the reserve price = y * peg_multiplier / x */
205
+ lastOracleReservePriceSpreadPct: bigint;
206
+ /**
207
+ * average estimate of bid price over funding_period
208
+ * precision: PRICE_PRECISION
209
+ */
210
+ lastBidPriceTwap: bigint;
211
+ /**
212
+ * average estimate of ask price over funding_period
213
+ * precision: PRICE_PRECISION
214
+ */
215
+ lastAskPriceTwap: bigint;
216
+ /**
217
+ * average estimate of (bid+ask)/2 price over funding_period
218
+ * precision: PRICE_PRECISION
219
+ */
220
+ lastMarkPriceTwap: bigint;
221
+ /** average estimate of (bid+ask)/2 price over FIVE_MINUTES */
222
+ lastMarkPriceTwap5min: bigint;
223
+ /** the last blockchain slot the amm was updated */
224
+ lastUpdateSlot: bigint;
225
+ /**
226
+ * the pct size of the oracle confidence interval
227
+ * precision: PERCENTAGE_PRECISION
228
+ */
229
+ lastOracleConfPct: bigint;
230
+ /**
231
+ * the total_fee_minus_distribution change since the last funding update
232
+ * precision: QUOTE_PRECISION
233
+ */
234
+ netRevenueSinceLastFunding: bigint;
235
+ /** the last funding rate update unix_timestamp */
236
+ lastFundingRateTs: bigint;
237
+ /** the peridocity of the funding rate updates */
238
+ fundingPeriod: bigint;
239
+ /**
240
+ * the base step size (increment) of orders
241
+ * precision: BASE_PRECISION
242
+ */
243
+ orderStepSize: bigint;
244
+ /**
245
+ * the price tick size of orders
246
+ * precision: PRICE_PRECISION
247
+ */
248
+ orderTickSize: bigint;
249
+ /**
250
+ * the minimum base size of an order
251
+ * precision: BASE_PRECISION
252
+ */
253
+ minOrderSize: bigint;
254
+ /**
255
+ * the max base size a single user can have
256
+ * precision: BASE_PRECISION
257
+ */
258
+ mmOracleSlot: bigint;
259
+ /**
260
+ * estimated total of volume in market
261
+ * QUOTE_PRECISION
262
+ */
263
+ volume24h: bigint;
264
+ /** the volume intensity of long fills against AMM */
265
+ longIntensityVolume: bigint;
266
+ /** the volume intensity of short fills against AMM */
267
+ shortIntensityVolume: bigint;
268
+ /** the blockchain unix timestamp at the time of the last trade */
269
+ lastTradeTs: bigint;
270
+ /**
271
+ * estimate of standard deviation of the fill (mark) prices
272
+ * precision: PRICE_PRECISION
273
+ */
274
+ markStd: bigint;
275
+ /**
276
+ * estimate of standard deviation of the oracle price at each update
277
+ * precision: PRICE_PRECISION
278
+ */
279
+ oracleStd: bigint;
280
+ /** the last unix_timestamp the mark twap was updated */
281
+ lastMarkPriceTwapTs: bigint;
282
+ /** the minimum spread the AMM can quote. also used as step size for some spread logic increases. */
283
+ baseSpread: number;
284
+ /** the maximum spread the AMM can quote */
285
+ maxSpread: number;
286
+ /** the spread for asks vs the reserve price */
287
+ longSpread: number;
288
+ /** the spread for bids vs the reserve price */
289
+ shortSpread: number;
290
+ /** MM oracle price */
291
+ mmOraclePrice: bigint;
292
+ /** the fraction of total available liquidity a single fill on the AMM can consume */
293
+ maxFillReserveFraction: number;
294
+ /** the maximum slippage a single fill on the AMM can push */
295
+ maxSlippageRatio: number;
296
+ /** the update intensity of AMM formulaic updates (adjusting k). 0-100 */
297
+ curveUpdateIntensity: number;
298
+ /**
299
+ * the jit intensity of AMM. larger intensity means larger participation in jit. 0 means no jit participation.
300
+ * (0, 100] is intensity for protocol-owned AMM. (100, 200] is intensity for user LP-owned AMM.
301
+ */
302
+ ammJitIntensity: number;
303
+ /** the oracle provider information. used to decode/scale the oracle public key */
304
+ oracleSource: OracleSource;
305
+ /** tracks whether the oracle was considered valid at the last AMM update */
306
+ lastOracleValid: boolean;
307
+ /**
308
+ * the target value for `base_asset_amount_per_lp`, used during AMM JIT with LP split
309
+ * precision: BASE_PRECISION
310
+ */
311
+ targetBaseAssetAmountPerLp: number;
312
+ /** expo for unit of per_lp, base 10 (if per_lp_base=X, then per_lp unit is 10^X) */
313
+ perLpBase: number;
314
+ /**
315
+ * the override for the state.min_perp_auction_duration
316
+ * 0 is no override, -1 is disable speed bump, 1-100 is literal speed bump
317
+ */
318
+ oracleLowRiskSlotDelayOverride: number;
319
+ /** signed scale amm_spread similar to fee_adjustment logic (-100 = 0, 100 = double) */
320
+ ammSpreadAdjustment: number;
321
+ oracleSlotDelayOverride: number;
322
+ mmOracleSequenceId: bigint;
323
+ netUnsettledFundingPnl: bigint;
324
+ quoteAssetAmountWithUnsettledLp: bigint;
325
+ referencePriceOffset: number;
326
+ /** signed scale amm_spread similar to fee_adjustment logic (-100 = 0, 100 = double) */
327
+ ammInventorySpreadAdjustment: number;
328
+ referencePriceOffsetDeadbandPct: number;
329
+ padding: ReadonlyUint8Array;
330
+ lastFundingOracleTwap: bigint;
331
+ };
332
+ export type AMMArgs = {
333
+ /** oracle price data public key */
334
+ oracle: Address;
335
+ /** stores historically witnessed oracle data */
336
+ historicalOracleData: HistoricalOracleDataArgs;
337
+ /**
338
+ * accumulated base asset amount since inception per lp share
339
+ * precision: QUOTE_PRECISION
340
+ */
341
+ baseAssetAmountPerLp: number | bigint;
342
+ /**
343
+ * accumulated quote asset amount since inception per lp share
344
+ * precision: QUOTE_PRECISION
345
+ */
346
+ quoteAssetAmountPerLp: number | bigint;
347
+ /** partition of fees from perp market trading moved from pnl settlements */
348
+ feePool: PoolBalanceArgs;
349
+ /**
350
+ * `x` reserves for constant product mm formula (x * y = k)
351
+ * precision: AMM_RESERVE_PRECISION
352
+ */
353
+ baseAssetReserve: number | bigint;
354
+ /**
355
+ * `y` reserves for constant product mm formula (x * y = k)
356
+ * precision: AMM_RESERVE_PRECISION
357
+ */
358
+ quoteAssetReserve: number | bigint;
359
+ /**
360
+ * determines how close the min/max base asset reserve sit vs base reserves
361
+ * allow for decreasing slippage without increasing liquidity and v.v.
362
+ * precision: PERCENTAGE_PRECISION
363
+ */
364
+ concentrationCoef: number | bigint;
365
+ /**
366
+ * minimum base_asset_reserve allowed before AMM is unavailable
367
+ * precision: AMM_RESERVE_PRECISION
368
+ */
369
+ minBaseAssetReserve: number | bigint;
370
+ /**
371
+ * maximum base_asset_reserve allowed before AMM is unavailable
372
+ * precision: AMM_RESERVE_PRECISION
373
+ */
374
+ maxBaseAssetReserve: number | bigint;
375
+ /**
376
+ * `sqrt(k)` in constant product mm formula (x * y = k). stored to avoid drift caused by integer math issues
377
+ * precision: AMM_RESERVE_PRECISION
378
+ */
379
+ sqrtK: number | bigint;
380
+ /**
381
+ * normalizing numerical factor for y, its use offers lowest slippage in cp-curve when market is balanced
382
+ * precision: PEG_PRECISION
383
+ */
384
+ pegMultiplier: number | bigint;
385
+ /**
386
+ * y when market is balanced. stored to save computation
387
+ * precision: AMM_RESERVE_PRECISION
388
+ */
389
+ terminalQuoteAssetReserve: number | bigint;
390
+ /**
391
+ * always non-negative. tracks number of total longs in market (regardless of counterparty)
392
+ * precision: BASE_PRECISION
393
+ */
394
+ baseAssetAmountLong: number | bigint;
395
+ /**
396
+ * always non-positive. tracks number of total shorts in market (regardless of counterparty)
397
+ * precision: BASE_PRECISION
398
+ */
399
+ baseAssetAmountShort: number | bigint;
400
+ /**
401
+ * tracks net position (longs-shorts) in market with AMM as counterparty
402
+ * precision: BASE_PRECISION
403
+ */
404
+ baseAssetAmountWithAmm: number | bigint;
405
+ /**
406
+ * tracks net position (longs-shorts) in market with LPs as counterparty
407
+ * precision: BASE_PRECISION
408
+ */
409
+ baseAssetAmountWithUnsettledLp: number | bigint;
410
+ /**
411
+ * max allowed open interest, blocks trades that breach this value
412
+ * precision: BASE_PRECISION
413
+ */
414
+ maxOpenInterest: number | bigint;
415
+ /**
416
+ * sum of all user's perp quote_asset_amount in market
417
+ * precision: QUOTE_PRECISION
418
+ */
419
+ quoteAssetAmount: number | bigint;
420
+ /**
421
+ * sum of all long user's quote_entry_amount in market
422
+ * precision: QUOTE_PRECISION
423
+ */
424
+ quoteEntryAmountLong: number | bigint;
425
+ /**
426
+ * sum of all short user's quote_entry_amount in market
427
+ * precision: QUOTE_PRECISION
428
+ */
429
+ quoteEntryAmountShort: number | bigint;
430
+ /**
431
+ * sum of all long user's quote_break_even_amount in market
432
+ * precision: QUOTE_PRECISION
433
+ */
434
+ quoteBreakEvenAmountLong: number | bigint;
435
+ /**
436
+ * sum of all short user's quote_break_even_amount in market
437
+ * precision: QUOTE_PRECISION
438
+ */
439
+ quoteBreakEvenAmountShort: number | bigint;
440
+ /**
441
+ * total user lp shares of sqrt_k (protocol owned liquidity = sqrt_k - last_funding_rate)
442
+ * precision: AMM_RESERVE_PRECISION
443
+ */
444
+ userLpShares: number | bigint;
445
+ /**
446
+ * last funding rate in this perp market (unit is quote per base)
447
+ * precision: FUNDING_RATE_PRECISION
448
+ */
449
+ lastFundingRate: number | bigint;
450
+ /**
451
+ * last funding rate for longs in this perp market (unit is quote per base)
452
+ * precision: FUNDING_RATE_PRECISION
453
+ */
454
+ lastFundingRateLong: number | bigint;
455
+ /**
456
+ * last funding rate for shorts in this perp market (unit is quote per base)
457
+ * precision: QUOTE_PRECISION
458
+ */
459
+ lastFundingRateShort: number | bigint;
460
+ /**
461
+ * estimate of last 24h of funding rate perp market (unit is quote per base)
462
+ * precision: QUOTE_PRECISION
463
+ */
464
+ last24hAvgFundingRate: number | bigint;
465
+ /**
466
+ * total fees collected by this perp market
467
+ * precision: QUOTE_PRECISION
468
+ */
469
+ totalFee: number | bigint;
470
+ /**
471
+ * total fees collected by the vAMM's bid/ask spread
472
+ * precision: QUOTE_PRECISION
473
+ */
474
+ totalMmFee: number | bigint;
475
+ /**
476
+ * total fees collected by exchange fee schedule
477
+ * precision: QUOTE_PRECISION
478
+ */
479
+ totalExchangeFee: number | bigint;
480
+ /**
481
+ * total fees minus any recognized upnl and pool withdraws
482
+ * precision: QUOTE_PRECISION
483
+ */
484
+ totalFeeMinusDistributions: number | bigint;
485
+ /**
486
+ * sum of all fees from fee pool withdrawn to revenue pool
487
+ * precision: QUOTE_PRECISION
488
+ */
489
+ totalFeeWithdrawn: number | bigint;
490
+ /**
491
+ * all fees collected by market for liquidations
492
+ * precision: QUOTE_PRECISION
493
+ */
494
+ totalLiquidationFee: number | bigint;
495
+ /** accumulated funding rate for longs since inception in market */
496
+ cumulativeFundingRateLong: number | bigint;
497
+ /** accumulated funding rate for shorts since inception in market */
498
+ cumulativeFundingRateShort: number | bigint;
499
+ /** accumulated social loss paid by users since inception in market */
500
+ totalSocialLoss: number | bigint;
501
+ /**
502
+ * transformed base_asset_reserve for users going long
503
+ * precision: AMM_RESERVE_PRECISION
504
+ */
505
+ askBaseAssetReserve: number | bigint;
506
+ /**
507
+ * transformed quote_asset_reserve for users going long
508
+ * precision: AMM_RESERVE_PRECISION
509
+ */
510
+ askQuoteAssetReserve: number | bigint;
511
+ /**
512
+ * transformed base_asset_reserve for users going short
513
+ * precision: AMM_RESERVE_PRECISION
514
+ */
515
+ bidBaseAssetReserve: number | bigint;
516
+ /**
517
+ * transformed quote_asset_reserve for users going short
518
+ * precision: AMM_RESERVE_PRECISION
519
+ */
520
+ bidQuoteAssetReserve: number | bigint;
521
+ /**
522
+ * the last seen oracle price partially shrunk toward the amm reserve price
523
+ * precision: PRICE_PRECISION
524
+ */
525
+ lastOracleNormalisedPrice: number | bigint;
526
+ /** the gap between the oracle price and the reserve price = y * peg_multiplier / x */
527
+ lastOracleReservePriceSpreadPct: number | bigint;
528
+ /**
529
+ * average estimate of bid price over funding_period
530
+ * precision: PRICE_PRECISION
531
+ */
532
+ lastBidPriceTwap: number | bigint;
533
+ /**
534
+ * average estimate of ask price over funding_period
535
+ * precision: PRICE_PRECISION
536
+ */
537
+ lastAskPriceTwap: number | bigint;
538
+ /**
539
+ * average estimate of (bid+ask)/2 price over funding_period
540
+ * precision: PRICE_PRECISION
541
+ */
542
+ lastMarkPriceTwap: number | bigint;
543
+ /** average estimate of (bid+ask)/2 price over FIVE_MINUTES */
544
+ lastMarkPriceTwap5min: number | bigint;
545
+ /** the last blockchain slot the amm was updated */
546
+ lastUpdateSlot: number | bigint;
547
+ /**
548
+ * the pct size of the oracle confidence interval
549
+ * precision: PERCENTAGE_PRECISION
550
+ */
551
+ lastOracleConfPct: number | bigint;
552
+ /**
553
+ * the total_fee_minus_distribution change since the last funding update
554
+ * precision: QUOTE_PRECISION
555
+ */
556
+ netRevenueSinceLastFunding: number | bigint;
557
+ /** the last funding rate update unix_timestamp */
558
+ lastFundingRateTs: number | bigint;
559
+ /** the peridocity of the funding rate updates */
560
+ fundingPeriod: number | bigint;
561
+ /**
562
+ * the base step size (increment) of orders
563
+ * precision: BASE_PRECISION
564
+ */
565
+ orderStepSize: number | bigint;
566
+ /**
567
+ * the price tick size of orders
568
+ * precision: PRICE_PRECISION
569
+ */
570
+ orderTickSize: number | bigint;
571
+ /**
572
+ * the minimum base size of an order
573
+ * precision: BASE_PRECISION
574
+ */
575
+ minOrderSize: number | bigint;
576
+ /**
577
+ * the max base size a single user can have
578
+ * precision: BASE_PRECISION
579
+ */
580
+ mmOracleSlot: number | bigint;
581
+ /**
582
+ * estimated total of volume in market
583
+ * QUOTE_PRECISION
584
+ */
585
+ volume24h: number | bigint;
586
+ /** the volume intensity of long fills against AMM */
587
+ longIntensityVolume: number | bigint;
588
+ /** the volume intensity of short fills against AMM */
589
+ shortIntensityVolume: number | bigint;
590
+ /** the blockchain unix timestamp at the time of the last trade */
591
+ lastTradeTs: number | bigint;
592
+ /**
593
+ * estimate of standard deviation of the fill (mark) prices
594
+ * precision: PRICE_PRECISION
595
+ */
596
+ markStd: number | bigint;
597
+ /**
598
+ * estimate of standard deviation of the oracle price at each update
599
+ * precision: PRICE_PRECISION
600
+ */
601
+ oracleStd: number | bigint;
602
+ /** the last unix_timestamp the mark twap was updated */
603
+ lastMarkPriceTwapTs: number | bigint;
604
+ /** the minimum spread the AMM can quote. also used as step size for some spread logic increases. */
605
+ baseSpread: number;
606
+ /** the maximum spread the AMM can quote */
607
+ maxSpread: number;
608
+ /** the spread for asks vs the reserve price */
609
+ longSpread: number;
610
+ /** the spread for bids vs the reserve price */
611
+ shortSpread: number;
612
+ /** MM oracle price */
613
+ mmOraclePrice: number | bigint;
614
+ /** the fraction of total available liquidity a single fill on the AMM can consume */
615
+ maxFillReserveFraction: number;
616
+ /** the maximum slippage a single fill on the AMM can push */
617
+ maxSlippageRatio: number;
618
+ /** the update intensity of AMM formulaic updates (adjusting k). 0-100 */
619
+ curveUpdateIntensity: number;
620
+ /**
621
+ * the jit intensity of AMM. larger intensity means larger participation in jit. 0 means no jit participation.
622
+ * (0, 100] is intensity for protocol-owned AMM. (100, 200] is intensity for user LP-owned AMM.
623
+ */
624
+ ammJitIntensity: number;
625
+ /** the oracle provider information. used to decode/scale the oracle public key */
626
+ oracleSource: OracleSourceArgs;
627
+ /** tracks whether the oracle was considered valid at the last AMM update */
628
+ lastOracleValid: boolean;
629
+ /**
630
+ * the target value for `base_asset_amount_per_lp`, used during AMM JIT with LP split
631
+ * precision: BASE_PRECISION
632
+ */
633
+ targetBaseAssetAmountPerLp: number;
634
+ /** expo for unit of per_lp, base 10 (if per_lp_base=X, then per_lp unit is 10^X) */
635
+ perLpBase: number;
636
+ /**
637
+ * the override for the state.min_perp_auction_duration
638
+ * 0 is no override, -1 is disable speed bump, 1-100 is literal speed bump
639
+ */
640
+ oracleLowRiskSlotDelayOverride: number;
641
+ /** signed scale amm_spread similar to fee_adjustment logic (-100 = 0, 100 = double) */
642
+ ammSpreadAdjustment: number;
643
+ oracleSlotDelayOverride: number;
644
+ mmOracleSequenceId: number | bigint;
645
+ netUnsettledFundingPnl: number | bigint;
646
+ quoteAssetAmountWithUnsettledLp: number | bigint;
647
+ referencePriceOffset: number;
648
+ /** signed scale amm_spread similar to fee_adjustment logic (-100 = 0, 100 = double) */
649
+ ammInventorySpreadAdjustment: number;
650
+ referencePriceOffsetDeadbandPct: number;
651
+ padding: ReadonlyUint8Array;
652
+ lastFundingOracleTwap: number | bigint;
653
+ };
654
+ export declare function getAMMEncoder(): FixedSizeEncoder<AMMArgs>;
655
+ export declare function getAMMDecoder(): FixedSizeDecoder<AMM>;
656
+ export declare function getAMMCodec(): FixedSizeCodec<AMMArgs, AMM>;