@velocity-exchange/sdk 0.0.3 → 0.1.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 (393) hide show
  1. package/.prettierignore +1 -1
  2. package/CHANGELOG.md +35 -0
  3. package/README.md +30 -30
  4. package/bun.lock +1 -1
  5. package/lib/browser/accounts/grpcProgramAccountSubscriber.js +1 -1
  6. package/lib/browser/accounts/grpcVelocityClientAccountSubscriber.d.ts +0 -4
  7. package/lib/browser/accounts/grpcVelocityClientAccountSubscriber.js +1 -3
  8. package/lib/browser/accounts/grpcVelocityClientAccountSubscriberV2.d.ts +0 -4
  9. package/lib/browser/accounts/grpcVelocityClientAccountSubscriberV2.js +5 -7
  10. package/lib/browser/accounts/laserProgramAccountSubscriber.js +1 -1
  11. package/lib/browser/accounts/pollingVelocityClientAccountSubscriber.d.ts +0 -4
  12. package/lib/browser/accounts/pollingVelocityClientAccountSubscriber.js +5 -7
  13. package/lib/browser/accounts/types.d.ts +2 -8
  14. package/lib/browser/accounts/utils.js +2 -2
  15. package/lib/browser/accounts/webSocketVelocityClientAccountSubscriber.d.ts +0 -4
  16. package/lib/browser/accounts/webSocketVelocityClientAccountSubscriber.js +5 -7
  17. package/lib/browser/accounts/webSocketVelocityClientAccountSubscriberV2.d.ts +0 -4
  18. package/lib/browser/accounts/webSocketVelocityClientAccountSubscriberV2.js +5 -7
  19. package/lib/browser/addresses/pda.d.ts +1 -7
  20. package/lib/browser/addresses/pda.js +4 -10
  21. package/lib/browser/adminClient.d.ts +1 -1
  22. package/lib/browser/adminClient.js +21 -21
  23. package/lib/browser/auctionSubscriber/auctionSubscriber.d.ts +1 -3
  24. package/lib/browser/auctionSubscriber/auctionSubscriber.js +2 -6
  25. package/lib/browser/auctionSubscriber/auctionSubscriberGrpc.d.ts +1 -3
  26. package/lib/browser/auctionSubscriber/auctionSubscriberGrpc.js +2 -6
  27. package/lib/browser/auctionSubscriber/types.d.ts +3 -2
  28. package/lib/browser/config.d.ts +10 -19
  29. package/lib/browser/config.js +6 -33
  30. package/lib/browser/constants/insuranceFund.d.ts +1 -1
  31. package/lib/browser/constants/insuranceFund.js +1 -1
  32. package/lib/browser/constituentMap/constituentMap.d.ts +0 -2
  33. package/lib/browser/constituentMap/constituentMap.js +5 -5
  34. package/lib/browser/core/VelocityCore.d.ts +9 -15
  35. package/lib/browser/core/VelocityCore.js +5 -7
  36. package/lib/browser/core/instructions/withdraw.d.ts +1 -1
  37. package/lib/browser/core/instructions/withdraw.js +1 -1
  38. package/lib/browser/core/remainingAccounts.js +3 -3
  39. package/lib/browser/decode/user.js +5 -5
  40. package/lib/browser/dlob/DLOB.d.ts +1 -1
  41. package/lib/browser/dlob/DLOB.js +7 -7
  42. package/lib/browser/dlob/DLOBNode.js +1 -2
  43. package/lib/browser/dlob/DLOBSubscriber.d.ts +0 -2
  44. package/lib/browser/dlob/DLOBSubscriber.js +2 -7
  45. package/lib/browser/dlob/orderBookLevels.js +7 -7
  46. package/lib/browser/dlob/types.d.ts +0 -2
  47. package/lib/browser/events/eventSubscriber.d.ts +1 -1
  48. package/lib/browser/events/eventsServerLogProvider.js +2 -2
  49. package/lib/browser/events/parse.js +14 -14
  50. package/lib/browser/events/types.d.ts +3 -5
  51. package/lib/browser/events/types.js +1 -1
  52. package/lib/browser/idl/{drift.d.ts → velocity.d.ts} +1043 -768
  53. package/lib/browser/idl/{drift.json → velocity.json} +1034 -759
  54. package/lib/browser/index.d.ts +1 -1
  55. package/lib/browser/index.js +1 -2
  56. package/lib/browser/math/amm.d.ts +10 -10
  57. package/lib/browser/math/amm.js +29 -28
  58. package/lib/browser/math/auction.d.ts +1 -1
  59. package/lib/browser/math/auction.js +18 -21
  60. package/lib/browser/math/builder.d.ts +18 -1
  61. package/lib/browser/math/builder.js +32 -1
  62. package/lib/browser/math/funding.js +26 -26
  63. package/lib/browser/math/margin.d.ts +4 -4
  64. package/lib/browser/math/margin.js +15 -15
  65. package/lib/browser/math/market.js +13 -13
  66. package/lib/browser/math/oracles.d.ts +4 -4
  67. package/lib/browser/math/oracles.js +23 -23
  68. package/lib/browser/math/orders.d.ts +2 -2
  69. package/lib/browser/math/orders.js +12 -12
  70. package/lib/browser/math/position.js +4 -4
  71. package/lib/browser/math/superStake.d.ts +8 -10
  72. package/lib/browser/math/superStake.js +18 -20
  73. package/lib/browser/math/trade.js +5 -5
  74. package/lib/browser/math/utils.d.ts +1 -1
  75. package/lib/browser/math/utils.js +1 -1
  76. package/lib/browser/oracles/pythLazerClient.js +2 -2
  77. package/lib/browser/orderSubscriber/OrderSubscriber.d.ts +0 -2
  78. package/lib/browser/orderSubscriber/OrderSubscriber.js +8 -12
  79. package/lib/browser/orderSubscriber/WebsocketSubscription.js +1 -1
  80. package/lib/browser/orderSubscriber/grpcSubscription.js +2 -2
  81. package/lib/browser/orderSubscriber/types.d.ts +0 -2
  82. package/lib/browser/priorityFee/priorityFeeSubscriber.d.ts +1 -5
  83. package/lib/browser/priorityFee/priorityFeeSubscriber.js +7 -15
  84. package/lib/browser/priorityFee/priorityFeeSubscriberMap.d.ts +0 -4
  85. package/lib/browser/priorityFee/priorityFeeSubscriberMap.js +3 -11
  86. package/lib/browser/priorityFee/types.d.ts +3 -8
  87. package/lib/browser/priorityFee/velocityPriorityFeeMethod.d.ts +0 -8
  88. package/lib/browser/priorityFee/velocityPriorityFeeMethod.js +1 -3
  89. package/lib/browser/pyth/pythLazerSubscriber.d.ts +1 -1
  90. package/lib/browser/pyth/pythLazerSubscriber.js +1 -1
  91. package/lib/browser/swap/UnifiedSwapClient.js +1 -1
  92. package/lib/browser/swift/signedMsgUserAccountSubscriber.d.ts +4 -5
  93. package/lib/browser/swift/signedMsgUserAccountSubscriber.js +2 -6
  94. package/lib/browser/swift/swiftOrderSubscriber.d.ts +6 -5
  95. package/lib/browser/swift/swiftOrderSubscriber.js +5 -11
  96. package/lib/browser/types.d.ts +81 -93
  97. package/lib/browser/types.js +4 -0
  98. package/lib/browser/user.d.ts +1 -3
  99. package/lib/browser/user.js +19 -23
  100. package/lib/browser/userConfig.d.ts +3 -2
  101. package/lib/browser/userMap/WebsocketSubscription.js +1 -1
  102. package/lib/browser/userMap/grpcSubscription.js +1 -1
  103. package/lib/browser/userMap/referrerMap.d.ts +0 -2
  104. package/lib/browser/userMap/referrerMap.js +0 -4
  105. package/lib/browser/userMap/revenueShareEscrowMap.d.ts +0 -2
  106. package/lib/browser/userMap/revenueShareEscrowMap.js +0 -4
  107. package/lib/browser/userMap/userMap.d.ts +2 -4
  108. package/lib/browser/userMap/userMap.js +10 -14
  109. package/lib/browser/userMap/userMapConfig.d.ts +3 -2
  110. package/lib/browser/userMap/userStatsMap.d.ts +0 -2
  111. package/lib/browser/userMap/userStatsMap.js +0 -4
  112. package/lib/browser/userStats.d.ts +0 -2
  113. package/lib/browser/userStats.js +10 -14
  114. package/lib/browser/userStatsConfig.d.ts +3 -2
  115. package/lib/browser/util/ed25519Utils.d.ts +1 -1
  116. package/lib/browser/util/ed25519Utils.js +1 -1
  117. package/lib/browser/velocityClient.d.ts +59 -44
  118. package/lib/browser/velocityClient.js +259 -197
  119. package/lib/browser/velocityClientConfig.d.ts +0 -8
  120. package/lib/node/accounts/grpcProgramAccountSubscriber.js +1 -1
  121. package/lib/node/accounts/grpcVelocityClientAccountSubscriber.d.ts +0 -4
  122. package/lib/node/accounts/grpcVelocityClientAccountSubscriber.d.ts.map +1 -1
  123. package/lib/node/accounts/grpcVelocityClientAccountSubscriber.js +1 -3
  124. package/lib/node/accounts/grpcVelocityClientAccountSubscriberV2.d.ts +0 -4
  125. package/lib/node/accounts/grpcVelocityClientAccountSubscriberV2.d.ts.map +1 -1
  126. package/lib/node/accounts/grpcVelocityClientAccountSubscriberV2.js +5 -7
  127. package/lib/node/accounts/laserProgramAccountSubscriber.js +1 -1
  128. package/lib/node/accounts/pollingVelocityClientAccountSubscriber.d.ts +0 -4
  129. package/lib/node/accounts/pollingVelocityClientAccountSubscriber.d.ts.map +1 -1
  130. package/lib/node/accounts/pollingVelocityClientAccountSubscriber.js +5 -7
  131. package/lib/node/accounts/types.d.ts +2 -8
  132. package/lib/node/accounts/types.d.ts.map +1 -1
  133. package/lib/node/accounts/utils.js +2 -2
  134. package/lib/node/accounts/webSocketVelocityClientAccountSubscriber.d.ts +0 -4
  135. package/lib/node/accounts/webSocketVelocityClientAccountSubscriber.d.ts.map +1 -1
  136. package/lib/node/accounts/webSocketVelocityClientAccountSubscriber.js +5 -7
  137. package/lib/node/accounts/webSocketVelocityClientAccountSubscriberV2.d.ts +0 -4
  138. package/lib/node/accounts/webSocketVelocityClientAccountSubscriberV2.d.ts.map +1 -1
  139. package/lib/node/accounts/webSocketVelocityClientAccountSubscriberV2.js +5 -7
  140. package/lib/node/addresses/pda.d.ts +1 -7
  141. package/lib/node/addresses/pda.d.ts.map +1 -1
  142. package/lib/node/addresses/pda.js +4 -10
  143. package/lib/node/adminClient.d.ts +1 -1
  144. package/lib/node/adminClient.js +21 -21
  145. package/lib/node/auctionSubscriber/auctionSubscriber.d.ts +1 -3
  146. package/lib/node/auctionSubscriber/auctionSubscriber.d.ts.map +1 -1
  147. package/lib/node/auctionSubscriber/auctionSubscriber.js +2 -6
  148. package/lib/node/auctionSubscriber/auctionSubscriberGrpc.d.ts +1 -3
  149. package/lib/node/auctionSubscriber/auctionSubscriberGrpc.d.ts.map +1 -1
  150. package/lib/node/auctionSubscriber/auctionSubscriberGrpc.js +2 -6
  151. package/lib/node/auctionSubscriber/types.d.ts +3 -2
  152. package/lib/node/auctionSubscriber/types.d.ts.map +1 -1
  153. package/lib/node/config.d.ts +10 -19
  154. package/lib/node/config.d.ts.map +1 -1
  155. package/lib/node/config.js +6 -33
  156. package/lib/node/constants/insuranceFund.d.ts +1 -1
  157. package/lib/node/constants/insuranceFund.js +1 -1
  158. package/lib/node/constituentMap/constituentMap.d.ts +0 -2
  159. package/lib/node/constituentMap/constituentMap.d.ts.map +1 -1
  160. package/lib/node/constituentMap/constituentMap.js +5 -5
  161. package/lib/node/core/VelocityCore.d.ts +9 -15
  162. package/lib/node/core/VelocityCore.d.ts.map +1 -1
  163. package/lib/node/core/VelocityCore.js +5 -7
  164. package/lib/node/core/instructions/withdraw.d.ts +1 -1
  165. package/lib/node/core/instructions/withdraw.d.ts.map +1 -1
  166. package/lib/node/core/instructions/withdraw.js +1 -1
  167. package/lib/node/core/remainingAccounts.js +3 -3
  168. package/lib/node/decode/user.js +5 -5
  169. package/lib/node/dlob/DLOB.d.ts +1 -1
  170. package/lib/node/dlob/DLOB.d.ts.map +1 -1
  171. package/lib/node/dlob/DLOB.js +7 -7
  172. package/lib/node/dlob/DLOBNode.js +1 -2
  173. package/lib/node/dlob/DLOBSubscriber.d.ts +0 -2
  174. package/lib/node/dlob/DLOBSubscriber.d.ts.map +1 -1
  175. package/lib/node/dlob/DLOBSubscriber.js +2 -7
  176. package/lib/node/dlob/orderBookLevels.d.ts.map +1 -1
  177. package/lib/node/dlob/orderBookLevels.js +7 -7
  178. package/lib/node/dlob/types.d.ts +0 -2
  179. package/lib/node/dlob/types.d.ts.map +1 -1
  180. package/lib/node/events/eventSubscriber.d.ts +1 -1
  181. package/lib/node/events/eventsServerLogProvider.js +2 -2
  182. package/lib/node/events/parse.d.ts.map +1 -1
  183. package/lib/node/events/parse.js +14 -14
  184. package/lib/node/events/types.d.ts +3 -5
  185. package/lib/node/events/types.d.ts.map +1 -1
  186. package/lib/node/events/types.js +1 -1
  187. package/lib/node/idl/{drift.d.ts → velocity.d.ts} +1044 -769
  188. package/lib/node/idl/velocity.d.ts.map +1 -0
  189. package/lib/node/idl/{drift.json → velocity.json} +1034 -759
  190. package/lib/node/index.d.ts +1 -1
  191. package/lib/node/index.d.ts.map +1 -1
  192. package/lib/node/index.js +1 -2
  193. package/lib/node/math/amm.d.ts +10 -10
  194. package/lib/node/math/amm.d.ts.map +1 -1
  195. package/lib/node/math/amm.js +29 -28
  196. package/lib/node/math/auction.d.ts +1 -1
  197. package/lib/node/math/auction.d.ts.map +1 -1
  198. package/lib/node/math/auction.js +18 -21
  199. package/lib/node/math/builder.d.ts +18 -1
  200. package/lib/node/math/builder.d.ts.map +1 -1
  201. package/lib/node/math/builder.js +32 -1
  202. package/lib/node/math/funding.d.ts.map +1 -1
  203. package/lib/node/math/funding.js +26 -26
  204. package/lib/node/math/margin.d.ts +4 -4
  205. package/lib/node/math/margin.d.ts.map +1 -1
  206. package/lib/node/math/margin.js +15 -15
  207. package/lib/node/math/market.d.ts.map +1 -1
  208. package/lib/node/math/market.js +13 -13
  209. package/lib/node/math/oracles.d.ts +4 -4
  210. package/lib/node/math/oracles.d.ts.map +1 -1
  211. package/lib/node/math/oracles.js +23 -23
  212. package/lib/node/math/orders.d.ts +2 -2
  213. package/lib/node/math/orders.d.ts.map +1 -1
  214. package/lib/node/math/orders.js +12 -12
  215. package/lib/node/math/position.d.ts.map +1 -1
  216. package/lib/node/math/position.js +4 -4
  217. package/lib/node/math/superStake.d.ts +8 -10
  218. package/lib/node/math/superStake.d.ts.map +1 -1
  219. package/lib/node/math/superStake.js +18 -20
  220. package/lib/node/math/trade.d.ts.map +1 -1
  221. package/lib/node/math/trade.js +5 -5
  222. package/lib/node/math/utils.d.ts +1 -1
  223. package/lib/node/math/utils.js +1 -1
  224. package/lib/node/oracles/pythLazerClient.js +2 -2
  225. package/lib/node/orderSubscriber/OrderSubscriber.d.ts +0 -2
  226. package/lib/node/orderSubscriber/OrderSubscriber.d.ts.map +1 -1
  227. package/lib/node/orderSubscriber/OrderSubscriber.js +8 -12
  228. package/lib/node/orderSubscriber/WebsocketSubscription.js +1 -1
  229. package/lib/node/orderSubscriber/grpcSubscription.js +2 -2
  230. package/lib/node/orderSubscriber/types.d.ts +0 -2
  231. package/lib/node/orderSubscriber/types.d.ts.map +1 -1
  232. package/lib/node/priorityFee/priorityFeeSubscriber.d.ts +1 -5
  233. package/lib/node/priorityFee/priorityFeeSubscriber.d.ts.map +1 -1
  234. package/lib/node/priorityFee/priorityFeeSubscriber.js +7 -15
  235. package/lib/node/priorityFee/priorityFeeSubscriberMap.d.ts +0 -4
  236. package/lib/node/priorityFee/priorityFeeSubscriberMap.d.ts.map +1 -1
  237. package/lib/node/priorityFee/priorityFeeSubscriberMap.js +3 -11
  238. package/lib/node/priorityFee/types.d.ts +3 -8
  239. package/lib/node/priorityFee/types.d.ts.map +1 -1
  240. package/lib/node/priorityFee/velocityPriorityFeeMethod.d.ts +0 -8
  241. package/lib/node/priorityFee/velocityPriorityFeeMethod.d.ts.map +1 -1
  242. package/lib/node/priorityFee/velocityPriorityFeeMethod.js +1 -3
  243. package/lib/node/pyth/pythLazerSubscriber.d.ts +1 -1
  244. package/lib/node/pyth/pythLazerSubscriber.js +1 -1
  245. package/lib/node/swap/UnifiedSwapClient.js +1 -1
  246. package/lib/node/swift/signedMsgUserAccountSubscriber.d.ts +4 -5
  247. package/lib/node/swift/signedMsgUserAccountSubscriber.d.ts.map +1 -1
  248. package/lib/node/swift/signedMsgUserAccountSubscriber.js +2 -6
  249. package/lib/node/swift/swiftOrderSubscriber.d.ts +6 -5
  250. package/lib/node/swift/swiftOrderSubscriber.d.ts.map +1 -1
  251. package/lib/node/swift/swiftOrderSubscriber.js +5 -11
  252. package/lib/node/types.d.ts +81 -93
  253. package/lib/node/types.d.ts.map +1 -1
  254. package/lib/node/types.js +4 -0
  255. package/lib/node/user.d.ts +1 -3
  256. package/lib/node/user.d.ts.map +1 -1
  257. package/lib/node/user.js +19 -23
  258. package/lib/node/userConfig.d.ts +3 -2
  259. package/lib/node/userConfig.d.ts.map +1 -1
  260. package/lib/node/userMap/WebsocketSubscription.js +1 -1
  261. package/lib/node/userMap/grpcSubscription.js +1 -1
  262. package/lib/node/userMap/referrerMap.d.ts +0 -2
  263. package/lib/node/userMap/referrerMap.d.ts.map +1 -1
  264. package/lib/node/userMap/referrerMap.js +0 -4
  265. package/lib/node/userMap/revenueShareEscrowMap.d.ts +0 -2
  266. package/lib/node/userMap/revenueShareEscrowMap.d.ts.map +1 -1
  267. package/lib/node/userMap/revenueShareEscrowMap.js +0 -4
  268. package/lib/node/userMap/userMap.d.ts +2 -4
  269. package/lib/node/userMap/userMap.d.ts.map +1 -1
  270. package/lib/node/userMap/userMap.js +10 -14
  271. package/lib/node/userMap/userMapConfig.d.ts +3 -2
  272. package/lib/node/userMap/userMapConfig.d.ts.map +1 -1
  273. package/lib/node/userMap/userStatsMap.d.ts +0 -2
  274. package/lib/node/userMap/userStatsMap.d.ts.map +1 -1
  275. package/lib/node/userMap/userStatsMap.js +0 -4
  276. package/lib/node/userStats.d.ts +0 -2
  277. package/lib/node/userStats.d.ts.map +1 -1
  278. package/lib/node/userStats.js +10 -14
  279. package/lib/node/userStatsConfig.d.ts +3 -2
  280. package/lib/node/userStatsConfig.d.ts.map +1 -1
  281. package/lib/node/util/ed25519Utils.d.ts +1 -1
  282. package/lib/node/util/ed25519Utils.js +1 -1
  283. package/lib/node/velocityClient.d.ts +59 -44
  284. package/lib/node/velocityClient.d.ts.map +1 -1
  285. package/lib/node/velocityClient.js +259 -197
  286. package/lib/node/velocityClientConfig.d.ts +0 -8
  287. package/lib/node/velocityClientConfig.d.ts.map +1 -1
  288. package/package.json +6 -7
  289. package/scripts/deposit-isolated-positions.ts +2 -2
  290. package/scripts/find-flagged-users.ts +1 -1
  291. package/scripts/grpc-client-test-comparison.ts +4 -4
  292. package/scripts/grpc-multiuser-client-test-comparison.ts +2 -2
  293. package/scripts/single-grpc-client-test.ts +3 -3
  294. package/scripts/updateVersion.js +4 -4
  295. package/scripts/withdraw-isolated-positions.ts +2 -2
  296. package/src/accounts/grpcProgramAccountSubscriber.ts +1 -1
  297. package/src/accounts/grpcVelocityClientAccountSubscriber.ts +0 -7
  298. package/src/accounts/grpcVelocityClientAccountSubscriberV2.ts +4 -11
  299. package/src/accounts/laserProgramAccountSubscriber.ts +1 -1
  300. package/src/accounts/pollingVelocityClientAccountSubscriber.ts +4 -11
  301. package/src/accounts/types.ts +2 -9
  302. package/src/accounts/utils.ts +2 -2
  303. package/src/accounts/webSocketVelocityClientAccountSubscriber.ts +4 -11
  304. package/src/accounts/webSocketVelocityClientAccountSubscriberV2.ts +4 -11
  305. package/src/addresses/pda.ts +3 -13
  306. package/src/adminClient.ts +21 -21
  307. package/src/auctionSubscriber/auctionSubscriber.ts +1 -6
  308. package/src/auctionSubscriber/auctionSubscriberGrpc.ts +1 -6
  309. package/src/auctionSubscriber/types.ts +3 -3
  310. package/src/config.ts +8 -64
  311. package/src/constants/insuranceFund.ts +1 -1
  312. package/src/constituentMap/constituentMap.ts +2 -6
  313. package/src/core/VelocityCore.ts +11 -20
  314. package/src/core/instructions/withdraw.ts +2 -2
  315. package/src/core/remainingAccounts.ts +3 -3
  316. package/src/decode/user.ts +5 -5
  317. package/src/dlob/DLOB.ts +7 -7
  318. package/src/dlob/DLOBNode.ts +1 -1
  319. package/src/dlob/DLOBSubscriber.ts +2 -8
  320. package/src/dlob/orderBookLevels.ts +12 -6
  321. package/src/dlob/types.ts +0 -2
  322. package/src/events/eventSubscriber.ts +1 -1
  323. package/src/events/eventsServerLogProvider.ts +2 -2
  324. package/src/events/parse.ts +14 -14
  325. package/src/events/types.ts +4 -7
  326. package/src/idl/{drift.json → velocity.json} +1034 -759
  327. package/src/idl/{drift.ts → velocity.ts} +1036 -761
  328. package/src/index.ts +1 -4
  329. package/src/margin/README.md +2 -2
  330. package/src/math/amm.ts +43 -21
  331. package/src/math/auction.ts +19 -22
  332. package/src/math/builder.ts +45 -1
  333. package/src/math/funding.ts +46 -43
  334. package/src/math/margin.ts +15 -15
  335. package/src/math/market.ts +21 -13
  336. package/src/math/oracles.ts +29 -26
  337. package/src/math/orders.ts +21 -11
  338. package/src/math/position.ts +9 -3
  339. package/src/math/superStake.ts +21 -24
  340. package/src/math/trade.ts +9 -1
  341. package/src/math/utils.ts +1 -1
  342. package/src/oracles/pythLazerClient.ts +3 -3
  343. package/src/orderSubscriber/OrderSubscriber.ts +2 -8
  344. package/src/orderSubscriber/WebsocketSubscription.ts +1 -1
  345. package/src/orderSubscriber/grpcSubscription.ts +2 -2
  346. package/src/orderSubscriber/types.ts +0 -2
  347. package/src/priorityFee/priorityFeeSubscriber.ts +5 -12
  348. package/src/priorityFee/priorityFeeSubscriberMap.ts +2 -10
  349. package/src/priorityFee/types.ts +4 -9
  350. package/src/priorityFee/velocityPriorityFeeMethod.ts +0 -12
  351. package/src/pyth/pythLazerSubscriber.ts +1 -1
  352. package/src/swap/UnifiedSwapClient.ts +1 -1
  353. package/src/swift/signedMsgUserAccountSubscriber.ts +2 -8
  354. package/src/swift/swiftOrderSubscriber.ts +7 -12
  355. package/src/types.ts +86 -104
  356. package/src/user.ts +9 -14
  357. package/src/userConfig.ts +1 -3
  358. package/src/userMap/WebsocketSubscription.ts +1 -1
  359. package/src/userMap/grpcSubscription.ts +1 -1
  360. package/src/userMap/referrerMap.ts +0 -4
  361. package/src/userMap/revenueShareEscrowMap.ts +0 -4
  362. package/src/userMap/userMap.ts +3 -7
  363. package/src/userMap/userMapConfig.ts +3 -3
  364. package/src/userMap/userStatsMap.ts +0 -4
  365. package/src/userStats.ts +1 -5
  366. package/src/userStatsConfig.ts +3 -3
  367. package/src/util/ed25519Utils.ts +1 -1
  368. package/src/velocityClient.ts +345 -231
  369. package/src/velocityClientConfig.ts +3 -11
  370. package/tests/{DriftCore → VelocityCore}/decode.test.ts +1 -1
  371. package/tests/{DriftCore → VelocityCore}/fill_trigger.test.ts +1 -1
  372. package/tests/{DriftCore → VelocityCore}/instructions.test.ts +1 -1
  373. package/tests/{DriftCore → VelocityCore}/pdas.test.ts +4 -2
  374. package/tests/auctions/test.ts +4 -4
  375. package/tests/ci/verifyConstants.ts +24 -27
  376. package/tests/decode/test.ts +3 -3
  377. package/tests/dlob/helpers.ts +5 -9
  378. package/tests/dlob/test.ts +5 -5
  379. package/tests/events/parseLogsForCuUsage.ts +15 -15
  380. package/tests/user/helpers.ts +10 -10
  381. package/tests/user/test.ts +13 -10
  382. package/lib/browser/util/deprecatedAlias.d.ts +0 -26
  383. package/lib/browser/util/deprecatedAlias.js +0 -10
  384. package/lib/node/idl/drift.d.ts.map +0 -1
  385. package/lib/node/util/deprecatedAlias.d.ts +0 -27
  386. package/lib/node/util/deprecatedAlias.d.ts.map +0 -1
  387. package/lib/node/util/deprecatedAlias.js +0 -10
  388. package/src/util/deprecatedAlias.ts +0 -25
  389. /package/lib/browser/idl/{drift.js → velocity.js} +0 -0
  390. /package/lib/node/idl/{drift.js → velocity.js} +0 -0
  391. /package/tests/{DriftCore → VelocityCore}/perp_orders.test.ts +0 -0
  392. /package/tests/{DriftCore → VelocityCore}/remainingAccounts.test.ts +0 -0
  393. /package/tests/{DriftCore → VelocityCore}/settlement_liquidation.test.ts +0 -0
@@ -2,12 +2,12 @@
2
2
  * Program IDL in camelCase format in order to be used in JS/TS.
3
3
  *
4
4
  * Note that this is only a type helper and is not the actual IDL. The original
5
- * IDL can be found at `target/idl/drift.json`.
5
+ * IDL can be found at `target/idl/velocity.json`.
6
6
  */
7
- export type Drift = {
7
+ export type Velocity = {
8
8
  "address": "vELoC1audYbSYVRXn1vPaV8Axoa9oU6BYmNGZZBDZ1P",
9
9
  "metadata": {
10
- "name": "drift",
10
+ "name": "velocity",
11
11
  "version": "2.162.0",
12
12
  "spec": "0.1.0",
13
13
  "description": "Created with Anchor"
@@ -256,7 +256,7 @@ export type Drift = {
256
256
  }
257
257
  },
258
258
  {
259
- "name": "driftSigner"
259
+ "name": "velocitySigner"
260
260
  },
261
261
  {
262
262
  "name": "userTokenAccount",
@@ -543,7 +543,7 @@ export type Drift = {
543
543
  "name": "tokenProgram"
544
544
  },
545
545
  {
546
- "name": "driftSigner"
546
+ "name": "velocitySigner"
547
547
  }
548
548
  ],
549
549
  "args": [
@@ -668,7 +668,7 @@ export type Drift = {
668
668
  "name": "tokenProgram"
669
669
  },
670
670
  {
671
- "name": "driftSigner"
671
+ "name": "velocitySigner"
672
672
  },
673
673
  {
674
674
  "name": "instructions",
@@ -940,7 +940,7 @@ export type Drift = {
940
940
  "name": "tokenProgram"
941
941
  },
942
942
  {
943
- "name": "driftSigner"
943
+ "name": "velocitySigner"
944
944
  },
945
945
  {
946
946
  "name": "instructions",
@@ -1540,7 +1540,7 @@ export type Drift = {
1540
1540
  }
1541
1541
  },
1542
1542
  {
1543
- "name": "driftSigner"
1543
+ "name": "velocitySigner"
1544
1544
  },
1545
1545
  {
1546
1546
  "name": "tokenProgram"
@@ -1964,7 +1964,7 @@ export type Drift = {
1964
1964
  "name": "tokenProgram"
1965
1965
  },
1966
1966
  {
1967
- "name": "driftSigner"
1967
+ "name": "velocitySigner"
1968
1968
  }
1969
1969
  ],
1970
1970
  "args": [
@@ -2093,7 +2093,7 @@ export type Drift = {
2093
2093
  "writable": true
2094
2094
  },
2095
2095
  {
2096
- "name": "driftSigner"
2096
+ "name": "velocitySigner"
2097
2097
  },
2098
2098
  {
2099
2099
  "name": "quoteSpotMarket",
@@ -2456,7 +2456,7 @@ export type Drift = {
2456
2456
  "name": "tokenProgram"
2457
2457
  },
2458
2458
  {
2459
- "name": "driftSigner"
2459
+ "name": "velocitySigner"
2460
2460
  },
2461
2461
  {
2462
2462
  "name": "instructions",
@@ -2720,7 +2720,7 @@ export type Drift = {
2720
2720
  "name": "tokenProgram"
2721
2721
  },
2722
2722
  {
2723
- "name": "driftSigner"
2723
+ "name": "velocitySigner"
2724
2724
  },
2725
2725
  {
2726
2726
  "name": "instructions",
@@ -2879,7 +2879,7 @@ export type Drift = {
2879
2879
  "signer": true
2880
2880
  },
2881
2881
  {
2882
- "name": "driftSigner"
2882
+ "name": "velocitySigner"
2883
2883
  }
2884
2884
  ],
2885
2885
  "args": []
@@ -2890,11 +2890,11 @@ export type Drift = {
2890
2890
  "Devnet-only escape hatch: cleans up accounts stranded by a layout-breaking",
2891
2891
  "program upgrade (or by a partial re-init). For each account passed via",
2892
2892
  "`remaining_accounts`:",
2893
- "- drift-owned PDA → drain lamports (runtime GCs at end of tx)",
2894
- "- token-program owned vault (drift_signer close-authority) → CPI",
2893
+ "- velocity-owned PDA → drain lamports (runtime GCs at end of tx)",
2894
+ "- token-program owned vault (velocity_signer close-authority) → CPI",
2895
2895
  "`close_account`, rent refunded to admin",
2896
2896
  "Admin gate reads State's first pubkey field at raw offset 8..40 so it",
2897
- "works regardless of the State layout currently on chain. `drift_signer_nonce`",
2897
+ "works regardless of the State layout currently on chain. `velocity_signer_nonce`",
2898
2898
  "must match `State.signer_nonce`; mismatch fails the token CPI signature.",
2899
2899
  "Stripped from mainnet builds via `mainnet-beta`."
2900
2900
  ],
@@ -2921,7 +2921,7 @@ export type Drift = {
2921
2921
  ]
2922
2922
  },
2923
2923
  {
2924
- "name": "driftSigner",
2924
+ "name": "velocitySigner",
2925
2925
  "docs": [
2926
2926
  "at CPI time when closing token vaults; ignored otherwise."
2927
2927
  ]
@@ -2932,7 +2932,7 @@ export type Drift = {
2932
2932
  ],
2933
2933
  "args": [
2934
2934
  {
2935
- "name": "driftSignerNonce",
2935
+ "name": "velocitySignerNonce",
2936
2936
  "type": "u8"
2937
2937
  }
2938
2938
  ]
@@ -2963,11 +2963,14 @@ export type Drift = {
2963
2963
  {
2964
2964
  "kind": "const",
2965
2965
  "value": [
2966
- 100,
2967
- 114,
2966
+ 118,
2967
+ 101,
2968
+ 108,
2969
+ 111,
2970
+ 99,
2968
2971
  105,
2969
- 102,
2970
2972
  116,
2973
+ 121,
2971
2974
  95,
2972
2975
  115,
2973
2976
  116,
@@ -2983,7 +2986,7 @@ export type Drift = {
2983
2986
  "name": "quoteAssetMint"
2984
2987
  },
2985
2988
  {
2986
- "name": "driftSigner"
2989
+ "name": "velocitySigner"
2987
2990
  },
2988
2991
  {
2989
2992
  "name": "rent",
@@ -4558,7 +4561,7 @@ export type Drift = {
4558
4561
  }
4559
4562
  },
4560
4563
  {
4561
- "name": "driftSigner"
4564
+ "name": "velocitySigner"
4562
4565
  },
4563
4566
  {
4564
4567
  "name": "state",
@@ -5059,17 +5062,9 @@ export type Drift = {
5059
5062
  "name": "liquidator",
5060
5063
  "writable": true
5061
5064
  },
5062
- {
5063
- "name": "liquidatorStats",
5064
- "writable": true
5065
- },
5066
5065
  {
5067
5066
  "name": "user",
5068
5067
  "writable": true
5069
- },
5070
- {
5071
- "name": "userStats",
5072
- "writable": true
5073
5068
  }
5074
5069
  ],
5075
5070
  "args": [
@@ -5117,18 +5112,10 @@ export type Drift = {
5117
5112
  "name": "liquidator",
5118
5113
  "writable": true
5119
5114
  },
5120
- {
5121
- "name": "liquidatorStats",
5122
- "writable": true
5123
- },
5124
5115
  {
5125
5116
  "name": "user",
5126
5117
  "writable": true
5127
5118
  },
5128
- {
5129
- "name": "userStats",
5130
- "writable": true
5131
- },
5132
5119
  {
5133
5120
  "name": "liabilitySpotMarketVault",
5134
5121
  "writable": true,
@@ -5209,7 +5196,7 @@ export type Drift = {
5209
5196
  "name": "tokenProgram"
5210
5197
  },
5211
5198
  {
5212
- "name": "driftSigner"
5199
+ "name": "velocitySigner"
5213
5200
  },
5214
5201
  {
5215
5202
  "name": "instructions",
@@ -5258,18 +5245,10 @@ export type Drift = {
5258
5245
  "name": "liquidator",
5259
5246
  "writable": true
5260
5247
  },
5261
- {
5262
- "name": "liquidatorStats",
5263
- "writable": true
5264
- },
5265
5248
  {
5266
5249
  "name": "user",
5267
5250
  "writable": true
5268
5251
  },
5269
- {
5270
- "name": "userStats",
5271
- "writable": true
5272
- },
5273
5252
  {
5274
5253
  "name": "liabilitySpotMarketVault",
5275
5254
  "writable": true,
@@ -5350,7 +5329,7 @@ export type Drift = {
5350
5329
  "name": "tokenProgram"
5351
5330
  },
5352
5331
  {
5353
- "name": "driftSigner"
5332
+ "name": "velocitySigner"
5354
5333
  },
5355
5334
  {
5356
5335
  "name": "instructions",
@@ -5582,7 +5561,7 @@ export type Drift = {
5582
5561
  "name": "state"
5583
5562
  },
5584
5563
  {
5585
- "name": "driftSigner"
5564
+ "name": "velocitySigner"
5586
5565
  },
5587
5566
  {
5588
5567
  "name": "lpPool",
@@ -6881,7 +6860,7 @@ export type Drift = {
6881
6860
  }
6882
6861
  },
6883
6862
  {
6884
- "name": "driftSigner"
6863
+ "name": "velocitySigner"
6885
6864
  },
6886
6865
  {
6887
6866
  "name": "userTokenAccount",
@@ -7306,7 +7285,7 @@ export type Drift = {
7306
7285
  }
7307
7286
  },
7308
7287
  {
7309
- "name": "driftSigner"
7288
+ "name": "velocitySigner"
7310
7289
  },
7311
7290
  {
7312
7291
  "name": "tokenProgram"
@@ -7415,7 +7394,7 @@ export type Drift = {
7415
7394
  }
7416
7395
  },
7417
7396
  {
7418
- "name": "driftSigner"
7397
+ "name": "velocitySigner"
7419
7398
  },
7420
7399
  {
7421
7400
  "name": "tokenProgram"
@@ -7540,7 +7519,7 @@ export type Drift = {
7540
7519
  }
7541
7520
  },
7542
7521
  {
7543
- "name": "driftSigner"
7522
+ "name": "velocitySigner"
7544
7523
  },
7545
7524
  {
7546
7525
  "name": "tokenProgram"
@@ -7909,7 +7888,7 @@ export type Drift = {
7909
7888
  "name": "tokenProgram"
7910
7889
  },
7911
7890
  {
7912
- "name": "driftSigner"
7891
+ "name": "velocitySigner"
7913
7892
  }
7914
7893
  ],
7915
7894
  "args": []
@@ -8061,7 +8040,7 @@ export type Drift = {
8061
8040
  }
8062
8041
  },
8063
8042
  {
8064
- "name": "driftSigner"
8043
+ "name": "velocitySigner"
8065
8044
  },
8066
8045
  {
8067
8046
  "name": "insuranceFundVault",
@@ -8231,6 +8210,86 @@ export type Drift = {
8231
8210
  }
8232
8211
  ]
8233
8212
  },
8213
+ {
8214
+ "name": "transferDepositByDelegate",
8215
+ "discriminator": [
8216
+ 141,
8217
+ 171,
8218
+ 241,
8219
+ 161,
8220
+ 17,
8221
+ 31,
8222
+ 135,
8223
+ 29
8224
+ ],
8225
+ "accounts": [
8226
+ {
8227
+ "name": "fromUser",
8228
+ "writable": true
8229
+ },
8230
+ {
8231
+ "name": "toUser",
8232
+ "writable": true
8233
+ },
8234
+ {
8235
+ "name": "userStats"
8236
+ },
8237
+ {
8238
+ "name": "delegate",
8239
+ "signer": true,
8240
+ "relations": [
8241
+ "fromUser",
8242
+ "toUser"
8243
+ ]
8244
+ },
8245
+ {
8246
+ "name": "state"
8247
+ },
8248
+ {
8249
+ "name": "spotMarketVault",
8250
+ "pda": {
8251
+ "seeds": [
8252
+ {
8253
+ "kind": "const",
8254
+ "value": [
8255
+ 115,
8256
+ 112,
8257
+ 111,
8258
+ 116,
8259
+ 95,
8260
+ 109,
8261
+ 97,
8262
+ 114,
8263
+ 107,
8264
+ 101,
8265
+ 116,
8266
+ 95,
8267
+ 118,
8268
+ 97,
8269
+ 117,
8270
+ 108,
8271
+ 116
8272
+ ]
8273
+ },
8274
+ {
8275
+ "kind": "arg",
8276
+ "path": "marketIndex"
8277
+ }
8278
+ ]
8279
+ }
8280
+ }
8281
+ ],
8282
+ "args": [
8283
+ {
8284
+ "name": "marketIndex",
8285
+ "type": "u16"
8286
+ },
8287
+ {
8288
+ "name": "amount",
8289
+ "type": "u64"
8290
+ }
8291
+ ]
8292
+ },
8234
8293
  {
8235
8294
  "name": "transferFeeAndPnlPool",
8236
8295
  "discriminator": [
@@ -8640,7 +8699,7 @@ export type Drift = {
8640
8699
  }
8641
8700
  },
8642
8701
  {
8643
- "name": "driftSigner"
8702
+ "name": "velocitySigner"
8644
8703
  }
8645
8704
  ],
8646
8705
  "args": [
@@ -8774,7 +8833,7 @@ export type Drift = {
8774
8833
  "name": "tokenProgram"
8775
8834
  },
8776
8835
  {
8777
- "name": "driftSigner"
8836
+ "name": "velocitySigner"
8778
8837
  }
8779
8838
  ],
8780
8839
  "args": [
@@ -12625,6 +12684,61 @@ export type Drift = {
12625
12684
  }
12626
12685
  ]
12627
12686
  },
12687
+ {
12688
+ "name": "updateUserAllowDelegateTransfer",
12689
+ "discriminator": [
12690
+ 235,
12691
+ 106,
12692
+ 172,
12693
+ 39,
12694
+ 223,
12695
+ 238,
12696
+ 167,
12697
+ 204
12698
+ ],
12699
+ "accounts": [
12700
+ {
12701
+ "name": "userStats",
12702
+ "writable": true,
12703
+ "pda": {
12704
+ "seeds": [
12705
+ {
12706
+ "kind": "const",
12707
+ "value": [
12708
+ 117,
12709
+ 115,
12710
+ 101,
12711
+ 114,
12712
+ 95,
12713
+ 115,
12714
+ 116,
12715
+ 97,
12716
+ 116,
12717
+ 115
12718
+ ]
12719
+ },
12720
+ {
12721
+ "kind": "account",
12722
+ "path": "authority"
12723
+ }
12724
+ ]
12725
+ }
12726
+ },
12727
+ {
12728
+ "name": "authority",
12729
+ "signer": true,
12730
+ "relations": [
12731
+ "userStats"
12732
+ ]
12733
+ }
12734
+ ],
12735
+ "args": [
12736
+ {
12737
+ "name": "allowDelegateTransfer",
12738
+ "type": "bool"
12739
+ }
12740
+ ]
12741
+ },
12628
12742
  {
12629
12743
  "name": "updateUserCustomMarginRatio",
12630
12744
  "discriminator": [
@@ -13478,7 +13592,7 @@ export type Drift = {
13478
13592
  ],
13479
13593
  "accounts": [
13480
13594
  {
13481
- "name": "driftSigner"
13595
+ "name": "velocitySigner"
13482
13596
  },
13483
13597
  {
13484
13598
  "name": "state"
@@ -13662,7 +13776,7 @@ export type Drift = {
13662
13776
  }
13663
13777
  },
13664
13778
  {
13665
- "name": "driftSigner"
13779
+ "name": "velocitySigner"
13666
13780
  },
13667
13781
  {
13668
13782
  "name": "userTokenAccount",
@@ -13754,7 +13868,7 @@ export type Drift = {
13754
13868
  }
13755
13869
  },
13756
13870
  {
13757
- "name": "driftSigner"
13871
+ "name": "velocitySigner"
13758
13872
  },
13759
13873
  {
13760
13874
  "name": "userTokenAccount",
@@ -13801,7 +13915,7 @@ export type Drift = {
13801
13915
  "signer": true
13802
13916
  },
13803
13917
  {
13804
- "name": "driftSigner"
13918
+ "name": "velocitySigner"
13805
13919
  },
13806
13920
  {
13807
13921
  "name": "constituent",
@@ -14141,16 +14255,16 @@ export type Drift = {
14141
14255
  ]
14142
14256
  },
14143
14257
  {
14144
- "name": "curveRecord",
14258
+ "name": "ammCurveChanged",
14145
14259
  "discriminator": [
14146
- 101,
14147
- 238,
14148
- 40,
14149
- 228,
14150
- 70,
14151
- 46,
14152
- 61,
14153
- 117
14260
+ 116,
14261
+ 12,
14262
+ 114,
14263
+ 18,
14264
+ 175,
14265
+ 31,
14266
+ 153,
14267
+ 5
14154
14268
  ]
14155
14269
  },
14156
14270
  {
@@ -15840,7 +15954,7 @@ export type Drift = {
15840
15954
  {
15841
15955
  "code": 6274,
15842
15956
  "name": "oracleWrongWriteAuthority",
15843
- "msg": "Oracle post update atomic price feed account must be drift program"
15957
+ "msg": "Oracle post update atomic price feed account must be velocity program"
15844
15958
  },
15845
15959
  {
15846
15960
  "code": 6275,
@@ -16238,24 +16352,6 @@ export type Drift = {
16238
16352
  "type": {
16239
16353
  "kind": "struct",
16240
16354
  "fields": [
16241
- {
16242
- "name": "oracle",
16243
- "docs": [
16244
- "oracle price data public key"
16245
- ],
16246
- "type": "pubkey"
16247
- },
16248
- {
16249
- "name": "historicalOracleData",
16250
- "docs": [
16251
- "stores historically witnessed oracle data"
16252
- ],
16253
- "type": {
16254
- "defined": {
16255
- "name": "historicalOracleData"
16256
- }
16257
- }
16258
- },
16259
16355
  {
16260
16356
  "name": "feePool",
16261
16357
  "docs": [
@@ -16311,7 +16407,7 @@ export type Drift = {
16311
16407
  {
16312
16408
  "name": "sqrtK",
16313
16409
  "docs": [
16314
- "`sqrt(k)` in constant product mm formula (x * y = k). stored to avoid drift caused by integer math issues",
16410
+ "`sqrt(k)` in constant product mm formula (x * y = k). stored to avoid velocity caused by integer math issues",
16315
16411
  "precision: AMM_RESERVE_PRECISION"
16316
16412
  ],
16317
16413
  "type": "u128"
@@ -16332,22 +16428,6 @@ export type Drift = {
16332
16428
  ],
16333
16429
  "type": "u128"
16334
16430
  },
16335
- {
16336
- "name": "baseAssetAmountLong",
16337
- "docs": [
16338
- "always non-negative. tracks number of total longs in market (regardless of counterparty)",
16339
- "precision: BASE_PRECISION"
16340
- ],
16341
- "type": "i128"
16342
- },
16343
- {
16344
- "name": "baseAssetAmountShort",
16345
- "docs": [
16346
- "always non-positive. tracks number of total shorts in market (regardless of counterparty)",
16347
- "precision: BASE_PRECISION"
16348
- ],
16349
- "type": "i128"
16350
- },
16351
16431
  {
16352
16432
  "name": "baseAssetAmountWithAmm",
16353
16433
  "docs": [
@@ -16357,232 +16437,71 @@ export type Drift = {
16357
16437
  "type": "i128"
16358
16438
  },
16359
16439
  {
16360
- "name": "maxOpenInterest",
16440
+ "name": "totalFee",
16361
16441
  "docs": [
16362
- "max allowed open interest, blocks trades that breach this value",
16363
- "precision: BASE_PRECISION"
16442
+ "total fees collected by this perp market",
16443
+ "precision: QUOTE_PRECISION"
16364
16444
  ],
16365
- "type": "u128"
16445
+ "type": "i128"
16366
16446
  },
16367
16447
  {
16368
- "name": "quoteAssetAmount",
16448
+ "name": "totalMmFee",
16369
16449
  "docs": [
16370
- "sum of all user's perp quote_asset_amount in market",
16450
+ "total fees collected by the vAMM's bid/ask spread",
16371
16451
  "precision: QUOTE_PRECISION"
16372
16452
  ],
16373
16453
  "type": "i128"
16374
16454
  },
16375
16455
  {
16376
- "name": "quoteEntryAmountLong",
16456
+ "name": "totalFeeMinusDistributions",
16377
16457
  "docs": [
16378
- "sum of all long user's quote_entry_amount in market",
16458
+ "total fees minus any recognized upnl and pool withdraws",
16379
16459
  "precision: QUOTE_PRECISION"
16380
16460
  ],
16381
16461
  "type": "i128"
16382
16462
  },
16383
16463
  {
16384
- "name": "quoteEntryAmountShort",
16464
+ "name": "totalFeeWithdrawn",
16385
16465
  "docs": [
16386
- "sum of all short user's quote_entry_amount in market",
16466
+ "sum of all fees from fee pool withdrawn to revenue pool",
16387
16467
  "precision: QUOTE_PRECISION"
16388
16468
  ],
16389
- "type": "i128"
16469
+ "type": "u128"
16390
16470
  },
16391
16471
  {
16392
- "name": "quoteBreakEvenAmountLong",
16472
+ "name": "askBaseAssetReserve",
16393
16473
  "docs": [
16394
- "sum of all long user's quote_break_even_amount in market",
16395
- "precision: QUOTE_PRECISION"
16474
+ "Cached spread-adjusted reserves for the ask (long-take) side, derived",
16475
+ "from `long_spread` + `reference_price_offset`. Refreshed by",
16476
+ "[`crate::vlp::amm::math::spread::update_amm_quote_state`] on every AMM crank",
16477
+ "/ fill `setup`; quote/fill paths read these directly instead of",
16478
+ "recomputing per quote. Also surfaced to dashboards/tracking.",
16479
+ "precision: AMM_RESERVE_PRECISION"
16396
16480
  ],
16397
- "type": "i128"
16481
+ "type": "u128"
16398
16482
  },
16399
16483
  {
16400
- "name": "quoteBreakEvenAmountShort",
16484
+ "name": "askQuoteAssetReserve",
16401
16485
  "docs": [
16402
- "sum of all short user's quote_break_even_amount in market",
16403
- "precision: QUOTE_PRECISION"
16486
+ "precision: AMM_RESERVE_PRECISION"
16404
16487
  ],
16405
- "type": "i128"
16488
+ "type": "u128"
16406
16489
  },
16407
16490
  {
16408
- "name": "lastFundingRate",
16491
+ "name": "bidBaseAssetReserve",
16409
16492
  "docs": [
16410
- "last funding rate in this perp market (unit is quote per base)",
16411
- "precision: FUNDING_RATE_PRECISION"
16493
+ "Cached spread-adjusted reserves for the bid (short-take) side.",
16494
+ "precision: AMM_RESERVE_PRECISION"
16412
16495
  ],
16413
- "type": "i64"
16496
+ "type": "u128"
16414
16497
  },
16415
16498
  {
16416
- "name": "lastFundingRateLong",
16499
+ "name": "bidQuoteAssetReserve",
16417
16500
  "docs": [
16418
- "last funding rate for longs in this perp market (unit is quote per base)",
16419
- "precision: FUNDING_RATE_PRECISION"
16420
- ],
16421
- "type": "i64"
16422
- },
16423
- {
16424
- "name": "lastFundingRateShort",
16425
- "docs": [
16426
- "last funding rate for shorts in this perp market (unit is quote per base)",
16427
- "precision: QUOTE_PRECISION"
16428
- ],
16429
- "type": "i64"
16430
- },
16431
- {
16432
- "name": "last24hAvgFundingRate",
16433
- "docs": [
16434
- "estimate of last 24h of funding rate perp market (unit is quote per base)",
16435
- "precision: QUOTE_PRECISION"
16436
- ],
16437
- "type": "i64"
16438
- },
16439
- {
16440
- "name": "totalFee",
16441
- "docs": [
16442
- "total fees collected by this perp market",
16443
- "precision: QUOTE_PRECISION"
16444
- ],
16445
- "type": "i128"
16446
- },
16447
- {
16448
- "name": "totalMmFee",
16449
- "docs": [
16450
- "total fees collected by the vAMM's bid/ask spread",
16451
- "precision: QUOTE_PRECISION"
16452
- ],
16453
- "type": "i128"
16454
- },
16455
- {
16456
- "name": "totalExchangeFee",
16457
- "docs": [
16458
- "total fees collected by exchange fee schedule",
16459
- "precision: QUOTE_PRECISION"
16460
- ],
16461
- "type": "u128"
16462
- },
16463
- {
16464
- "name": "totalFeeMinusDistributions",
16465
- "docs": [
16466
- "total fees minus any recognized upnl and pool withdraws",
16467
- "precision: QUOTE_PRECISION"
16468
- ],
16469
- "type": "i128"
16470
- },
16471
- {
16472
- "name": "totalFeeWithdrawn",
16473
- "docs": [
16474
- "sum of all fees from fee pool withdrawn to revenue pool",
16475
- "precision: QUOTE_PRECISION"
16476
- ],
16477
- "type": "u128"
16478
- },
16479
- {
16480
- "name": "totalLiquidationFee",
16481
- "docs": [
16482
- "all fees collected by market for liquidations",
16483
- "precision: QUOTE_PRECISION"
16484
- ],
16485
- "type": "u128"
16486
- },
16487
- {
16488
- "name": "cumulativeFundingRateLong",
16489
- "docs": [
16490
- "accumulated funding rate for longs since inception in market"
16491
- ],
16492
- "type": "i128"
16493
- },
16494
- {
16495
- "name": "cumulativeFundingRateShort",
16496
- "docs": [
16497
- "accumulated funding rate for shorts since inception in market"
16498
- ],
16499
- "type": "i128"
16500
- },
16501
- {
16502
- "name": "totalSocialLoss",
16503
- "docs": [
16504
- "accumulated social loss paid by users since inception in market"
16505
- ],
16506
- "type": "u128"
16507
- },
16508
- {
16509
- "name": "askBaseAssetReserve",
16510
- "docs": [
16511
- "transformed base_asset_reserve for users going long",
16512
16501
  "precision: AMM_RESERVE_PRECISION"
16513
16502
  ],
16514
16503
  "type": "u128"
16515
16504
  },
16516
- {
16517
- "name": "askQuoteAssetReserve",
16518
- "docs": [
16519
- "transformed quote_asset_reserve for users going long",
16520
- "precision: AMM_RESERVE_PRECISION"
16521
- ],
16522
- "type": "u128"
16523
- },
16524
- {
16525
- "name": "bidBaseAssetReserve",
16526
- "docs": [
16527
- "transformed base_asset_reserve for users going short",
16528
- "precision: AMM_RESERVE_PRECISION"
16529
- ],
16530
- "type": "u128"
16531
- },
16532
- {
16533
- "name": "bidQuoteAssetReserve",
16534
- "docs": [
16535
- "transformed quote_asset_reserve for users going short",
16536
- "precision: AMM_RESERVE_PRECISION"
16537
- ],
16538
- "type": "u128"
16539
- },
16540
- {
16541
- "name": "lastOracleNormalisedPrice",
16542
- "docs": [
16543
- "the last seen oracle price partially shrunk toward the amm reserve price",
16544
- "precision: PRICE_PRECISION"
16545
- ],
16546
- "type": "i64"
16547
- },
16548
- {
16549
- "name": "lastOracleReservePriceSpreadPct",
16550
- "docs": [
16551
- "the gap between the oracle price and the reserve price = y * peg_multiplier / x"
16552
- ],
16553
- "type": "i64"
16554
- },
16555
- {
16556
- "name": "lastBidPriceTwap",
16557
- "docs": [
16558
- "average estimate of bid price over funding_period",
16559
- "precision: PRICE_PRECISION"
16560
- ],
16561
- "type": "u64"
16562
- },
16563
- {
16564
- "name": "lastAskPriceTwap",
16565
- "docs": [
16566
- "average estimate of ask price over funding_period",
16567
- "precision: PRICE_PRECISION"
16568
- ],
16569
- "type": "u64"
16570
- },
16571
- {
16572
- "name": "lastMarkPriceTwap",
16573
- "docs": [
16574
- "average estimate of (bid+ask)/2 price over funding_period",
16575
- "precision: PRICE_PRECISION"
16576
- ],
16577
- "type": "u64"
16578
- },
16579
- {
16580
- "name": "lastMarkPriceTwap5min",
16581
- "docs": [
16582
- "average estimate of (bid+ask)/2 price over FIVE_MINUTES"
16583
- ],
16584
- "type": "u64"
16585
- },
16586
16505
  {
16587
16506
  "name": "lastUpdateSlot",
16588
16507
  "docs": [
@@ -16590,14 +16509,6 @@ export type Drift = {
16590
16509
  ],
16591
16510
  "type": "u64"
16592
16511
  },
16593
- {
16594
- "name": "lastOracleConfPct",
16595
- "docs": [
16596
- "the pct size of the oracle confidence interval",
16597
- "precision: PERCENTAGE_PRECISION"
16598
- ],
16599
- "type": "u64"
16600
- },
16601
16512
  {
16602
16513
  "name": "netRevenueSinceLastFunding",
16603
16514
  "docs": [
@@ -16607,103 +16518,44 @@ export type Drift = {
16607
16518
  "type": "i64"
16608
16519
  },
16609
16520
  {
16610
- "name": "lastFundingRateTs",
16521
+ "name": "lastCumulativeFundingRateLong",
16611
16522
  "docs": [
16612
- "the last funding rate update unix_timestamp"
16523
+ "AMM's last-seen cumulative funding rates. Mirrors",
16524
+ "`PerpPosition::last_cumulative_funding_rate` on user positions —",
16525
+ "the AMM settles its own funding payment from",
16526
+ "`(market.cumulative_funding_rate_* − own_last) ×",
16527
+ "counterparty_position`, same math shape user positions use. The",
16528
+ "AMM is the counterparty for the net imbalance, so the relevant",
16529
+ "cum rate is the LONG one when the AMM is net long",
16530
+ "(base_asset_amount_with_amm < 0, i.e. users net short) and the",
16531
+ "SHORT one when the AMM is net short."
16613
16532
  ],
16614
16533
  "type": "i64"
16615
16534
  },
16616
16535
  {
16617
- "name": "fundingPeriod",
16618
- "docs": [
16619
- "the peridocity of the funding rate updates"
16620
- ],
16536
+ "name": "lastCumulativeFundingRateShort",
16621
16537
  "type": "i64"
16622
16538
  },
16623
16539
  {
16624
- "name": "orderStepSize",
16625
- "docs": [
16626
- "the base step size (increment) of orders",
16627
- "precision: BASE_PRECISION"
16628
- ],
16629
- "type": "u64"
16630
- },
16631
- {
16632
- "name": "orderTickSize",
16633
- "docs": [
16634
- "the price tick size of orders",
16635
- "precision: PRICE_PRECISION"
16636
- ],
16637
- "type": "u64"
16638
- },
16639
- {
16640
- "name": "minOrderSize",
16641
- "docs": [
16642
- "the minimum base size of an order",
16643
- "precision: BASE_PRECISION"
16644
- ],
16645
- "type": "u64"
16646
- },
16647
- {
16648
- "name": "mmOracleSlot",
16649
- "docs": [
16650
- "the max base size a single user can have",
16651
- "precision: BASE_PRECISION"
16652
- ],
16653
- "type": "u64"
16654
- },
16655
- {
16656
- "name": "volume24h",
16657
- "docs": [
16658
- "estimated total of volume in market",
16659
- "QUOTE_PRECISION"
16660
- ],
16661
- "type": "u64"
16662
- },
16663
- {
16664
- "name": "longIntensityVolume",
16665
- "docs": [
16666
- "the volume intensity of long fills against AMM"
16667
- ],
16668
- "type": "u64"
16669
- },
16670
- {
16671
- "name": "shortIntensityVolume",
16672
- "docs": [
16673
- "the volume intensity of short fills against AMM"
16674
- ],
16675
- "type": "u64"
16676
- },
16677
- {
16678
- "name": "lastTradeTs",
16540
+ "name": "lastOracleReservePriceSpreadPct",
16679
16541
  "docs": [
16680
- "the blockchain unix timestamp at the time of the last trade"
16542
+ "Cached oracle-vs-reserve price spread (signed, BID_ASK_SPREAD_PRECISION),",
16543
+ "the spread input that seeds `calculate_spread`. Refreshed alongside the",
16544
+ "other cached spread fields by `update_amm_quote_state`."
16681
16545
  ],
16682
16546
  "type": "i64"
16683
16547
  },
16684
16548
  {
16685
- "name": "markStd",
16549
+ "name": "lastSpreadUpdateSlot",
16686
16550
  "docs": [
16687
- "estimate of standard deviation of the fill (mark) prices",
16688
- "precision: PRICE_PRECISION"
16551
+ "Blockchain slot at which the cached spread state (`long_spread`,",
16552
+ "`short_spread`, `reference_price_offset`, the ask/bid reserves, and",
16553
+ "`last_oracle_reserve_price_spread_pct`) was last refreshed. Lets",
16554
+ "quote paths skip recompute within a slot and lets dashboards reason",
16555
+ "about cache staleness independently of `last_update_slot`."
16689
16556
  ],
16690
16557
  "type": "u64"
16691
16558
  },
16692
- {
16693
- "name": "oracleStd",
16694
- "docs": [
16695
- "estimate of standard deviation of the oracle price at each update",
16696
- "precision: PRICE_PRECISION"
16697
- ],
16698
- "type": "u64"
16699
- },
16700
- {
16701
- "name": "lastMarkPriceTwapTs",
16702
- "docs": [
16703
- "the last unix_timestamp the mark twap was updated"
16704
- ],
16705
- "type": "i64"
16706
- },
16707
16559
  {
16708
16560
  "name": "baseSpread",
16709
16561
  "docs": [
@@ -16721,23 +16573,26 @@ export type Drift = {
16721
16573
  {
16722
16574
  "name": "longSpread",
16723
16575
  "docs": [
16724
- "the spread for asks vs the reserve price"
16576
+ "Cached spread applied to the ask (long-take) side, in",
16577
+ "BID_ASK_SPREAD_PRECISION. Refreshed by `update_amm_quote_state`."
16725
16578
  ],
16726
16579
  "type": "u32"
16727
16580
  },
16728
16581
  {
16729
16582
  "name": "shortSpread",
16730
16583
  "docs": [
16731
- "the spread for bids vs the reserve price"
16584
+ "Cached spread applied to the bid (short-take) side, in",
16585
+ "BID_ASK_SPREAD_PRECISION. Refreshed by `update_amm_quote_state`."
16732
16586
  ],
16733
16587
  "type": "u32"
16734
16588
  },
16735
16589
  {
16736
- "name": "mmOraclePrice",
16590
+ "name": "referencePriceOffset",
16737
16591
  "docs": [
16738
- "MM oracle price"
16592
+ "Cached reference-price offset (signed, PRICE_PRECISION) applied to both",
16593
+ "sides' quotes. Refreshed by `update_amm_quote_state`."
16739
16594
  ],
16740
- "type": "i64"
16595
+ "type": "i32"
16741
16596
  },
16742
16597
  {
16743
16598
  "name": "maxFillReserveFraction",
@@ -16768,32 +16623,6 @@ export type Drift = {
16768
16623
  ],
16769
16624
  "type": "u8"
16770
16625
  },
16771
- {
16772
- "name": "oracleSource",
16773
- "docs": [
16774
- "the oracle provider information. used to decode/scale the oracle public key"
16775
- ],
16776
- "type": {
16777
- "defined": {
16778
- "name": "oracleSource"
16779
- }
16780
- }
16781
- },
16782
- {
16783
- "name": "lastOracleValid",
16784
- "docs": [
16785
- "tracks whether the oracle was considered valid at the last AMM update"
16786
- ],
16787
- "type": "bool"
16788
- },
16789
- {
16790
- "name": "oracleLowRiskSlotDelayOverride",
16791
- "docs": [
16792
- "the override for the state.min_perp_auction_duration",
16793
- "0 is no override, -1 is disable speed bump, 1-100 is literal speed bump"
16794
- ],
16795
- "type": "i8"
16796
- },
16797
16626
  {
16798
16627
  "name": "ammSpreadAdjustment",
16799
16628
  "docs": [
@@ -16801,34 +16630,6 @@ export type Drift = {
16801
16630
  ],
16802
16631
  "type": "i8"
16803
16632
  },
16804
- {
16805
- "name": "oracleSlotDelayOverride",
16806
- "type": "i8"
16807
- },
16808
- {
16809
- "name": "paddingPreMmOracleSequence",
16810
- "docs": [
16811
- "alignment padding for the following u64 (Rust would otherwise insert 5 implicit bytes here)"
16812
- ],
16813
- "type": {
16814
- "array": [
16815
- "u8",
16816
- 5
16817
- ]
16818
- }
16819
- },
16820
- {
16821
- "name": "mmOracleSequenceId",
16822
- "type": "u64"
16823
- },
16824
- {
16825
- "name": "netUnsettledFundingPnl",
16826
- "type": "i64"
16827
- },
16828
- {
16829
- "name": "referencePriceOffset",
16830
- "type": "i32"
16831
- },
16832
16633
  {
16833
16634
  "name": "ammInventorySpreadAdjustment",
16834
16635
  "docs": [
@@ -16841,27 +16642,11 @@ export type Drift = {
16841
16642
  "type": "u8"
16842
16643
  },
16843
16644
  {
16844
- "name": "paddingPreLastFunding",
16845
- "type": {
16846
- "array": [
16847
- "u8",
16848
- 2
16849
- ]
16850
- }
16851
- },
16852
- {
16853
- "name": "lastFundingOracleTwap",
16854
- "type": "i64"
16855
- },
16856
- {
16857
- "name": "paddingTrailing",
16858
- "docs": [
16859
- "trailing alignment padding (struct alignment is 16 due to u128 fields)"
16860
- ],
16645
+ "name": "paddingPostAmm",
16861
16646
  "type": {
16862
16647
  "array": [
16863
16648
  "u8",
16864
- 8
16649
+ 3
16865
16650
  ]
16866
16651
  }
16867
16652
  }
@@ -17038,6 +16823,84 @@ export type Drift = {
17038
16823
  ]
17039
16824
  }
17040
16825
  },
16826
+ {
16827
+ "name": "ammCurveChanged",
16828
+ "docs": [
16829
+ "AMM-side curve change: peg / reserves / sqrt_k moved, and the AMM",
16830
+ "debited the adjustment cost from its books. Emitted by the AMM itself",
16831
+ "(from `on_market_event(FundingUpdated)`'s k-update branch, from",
16832
+ "`snap_to_oracle`, and from the admin `repeg` ix). PerpMarket-side",
16833
+ "state at the time of the change (`base_asset_amount_long/short`,",
16834
+ "`number_of_users`) lives on a separate `FundingRateRecord` or can be",
16835
+ "queried by consumers correlating on `(ts, market_index)`."
16836
+ ],
16837
+ "type": {
16838
+ "kind": "struct",
16839
+ "fields": [
16840
+ {
16841
+ "name": "ts",
16842
+ "type": "i64"
16843
+ },
16844
+ {
16845
+ "name": "marketIndex",
16846
+ "type": "u16"
16847
+ },
16848
+ {
16849
+ "name": "pegMultiplierBefore",
16850
+ "type": "u128"
16851
+ },
16852
+ {
16853
+ "name": "baseAssetReserveBefore",
16854
+ "type": "u128"
16855
+ },
16856
+ {
16857
+ "name": "quoteAssetReserveBefore",
16858
+ "type": "u128"
16859
+ },
16860
+ {
16861
+ "name": "sqrtKBefore",
16862
+ "type": "u128"
16863
+ },
16864
+ {
16865
+ "name": "pegMultiplierAfter",
16866
+ "type": "u128"
16867
+ },
16868
+ {
16869
+ "name": "baseAssetReserveAfter",
16870
+ "type": "u128"
16871
+ },
16872
+ {
16873
+ "name": "quoteAssetReserveAfter",
16874
+ "type": "u128"
16875
+ },
16876
+ {
16877
+ "name": "sqrtKAfter",
16878
+ "type": "u128"
16879
+ },
16880
+ {
16881
+ "name": "adjustmentCost",
16882
+ "docs": [
16883
+ "precision: QUOTE_PRECISION"
16884
+ ],
16885
+ "type": "i128"
16886
+ },
16887
+ {
16888
+ "name": "totalFeeMinusDistributionsAfter",
16889
+ "docs": [
16890
+ "precision: QUOTE_PRECISION — AMM's TFMD after the change."
16891
+ ],
16892
+ "type": "i128"
16893
+ },
16894
+ {
16895
+ "name": "oraclePrice",
16896
+ "docs": [
16897
+ "precision: PRICE_PRECISION"
16898
+ ],
16899
+ "type": "i64"
16900
+ }
16901
+ ]
16902
+ }
16903
+ },
17041
16904
  {
17042
16905
  "name": "assetTier",
17043
16906
  "type": {
@@ -17601,145 +17464,36 @@ export type Drift = {
17601
17464
  "name": "a"
17602
17465
  },
17603
17466
  {
17604
- "name": "b"
17605
- },
17606
- {
17607
- "name": "c"
17608
- },
17609
- {
17610
- "name": "speculative"
17611
- },
17612
- {
17613
- "name": "highlySpeculative"
17614
- },
17615
- {
17616
- "name": "isolated"
17617
- }
17618
- ]
17619
- }
17620
- },
17621
- {
17622
- "name": "contractType",
17623
- "type": {
17624
- "kind": "enum",
17625
- "variants": [
17626
- {
17627
- "name": "perpetual"
17628
- },
17629
- {
17630
- "name": "deprecatedFuture"
17631
- },
17632
- {
17633
- "name": "deprecatedPrediction"
17634
- }
17635
- ]
17636
- }
17637
- },
17638
- {
17639
- "name": "curveRecord",
17640
- "type": {
17641
- "kind": "struct",
17642
- "fields": [
17643
- {
17644
- "name": "ts",
17645
- "type": "i64"
17646
- },
17647
- {
17648
- "name": "recordId",
17649
- "type": "u64"
17650
- },
17651
- {
17652
- "name": "pegMultiplierBefore",
17653
- "type": "u128"
17654
- },
17655
- {
17656
- "name": "baseAssetReserveBefore",
17657
- "type": "u128"
17658
- },
17659
- {
17660
- "name": "quoteAssetReserveBefore",
17661
- "type": "u128"
17662
- },
17663
- {
17664
- "name": "sqrtKBefore",
17665
- "type": "u128"
17666
- },
17667
- {
17668
- "name": "pegMultiplierAfter",
17669
- "type": "u128"
17670
- },
17671
- {
17672
- "name": "baseAssetReserveAfter",
17673
- "type": "u128"
17674
- },
17675
- {
17676
- "name": "quoteAssetReserveAfter",
17677
- "type": "u128"
17678
- },
17679
- {
17680
- "name": "sqrtKAfter",
17681
- "type": "u128"
17682
- },
17683
- {
17684
- "name": "baseAssetAmountLong",
17685
- "docs": [
17686
- "precision: BASE_PRECISION"
17687
- ],
17688
- "type": "u128"
17689
- },
17690
- {
17691
- "name": "baseAssetAmountShort",
17692
- "docs": [
17693
- "precision: BASE_PRECISION"
17694
- ],
17695
- "type": "u128"
17696
- },
17697
- {
17698
- "name": "baseAssetAmountWithAmm",
17699
- "docs": [
17700
- "precision: BASE_PRECISION"
17701
- ],
17702
- "type": "i128"
17703
- },
17704
- {
17705
- "name": "totalFee",
17706
- "docs": [
17707
- "precision: QUOTE_PRECISION"
17708
- ],
17709
- "type": "i128"
17467
+ "name": "b"
17710
17468
  },
17711
17469
  {
17712
- "name": "totalFeeMinusDistributions",
17713
- "docs": [
17714
- "precision: QUOTE_PRECISION"
17715
- ],
17716
- "type": "i128"
17470
+ "name": "c"
17717
17471
  },
17718
17472
  {
17719
- "name": "adjustmentCost",
17720
- "docs": [
17721
- "precision: QUOTE_PRECISION"
17722
- ],
17723
- "type": "i128"
17473
+ "name": "speculative"
17724
17474
  },
17725
17475
  {
17726
- "name": "oraclePrice",
17727
- "docs": [
17728
- "precision: PRICE_PRECISION"
17729
- ],
17730
- "type": "i64"
17476
+ "name": "highlySpeculative"
17731
17477
  },
17732
17478
  {
17733
- "name": "fillRecord",
17734
- "type": "u128"
17479
+ "name": "isolated"
17480
+ }
17481
+ ]
17482
+ }
17483
+ },
17484
+ {
17485
+ "name": "contractType",
17486
+ "type": {
17487
+ "kind": "enum",
17488
+ "variants": [
17489
+ {
17490
+ "name": "perpetual"
17735
17491
  },
17736
17492
  {
17737
- "name": "numberOfUsers",
17738
- "type": "u32"
17493
+ "name": "deprecatedFuture"
17739
17494
  },
17740
17495
  {
17741
- "name": "marketIndex",
17742
- "type": "u16"
17496
+ "name": "deprecatedPrediction"
17743
17497
  }
17744
17498
  ]
17745
17499
  }
@@ -17972,11 +17726,16 @@ export type Drift = {
17972
17726
  }
17973
17727
  },
17974
17728
  {
17975
- "name": "referrerRewardEpochUpperBound",
17729
+ "name": "flatFillerFee",
17976
17730
  "type": "u64"
17977
17731
  },
17978
17732
  {
17979
- "name": "flatFillerFee",
17733
+ "name": "padding",
17734
+ "docs": [
17735
+ "Reserved padding. Kept so `size_of::<FeeStructure>()` stays a multiple of 16",
17736
+ "(OrderFillerRewardStructure's u128 forces 16-byte alignment on host x86_64);",
17737
+ "removing it would diverge host vs. SBF layout."
17738
+ ],
17980
17739
  "type": "u64"
17981
17740
  }
17982
17741
  ]
@@ -18151,18 +17910,74 @@ export type Drift = {
18151
17910
  "type": "u64"
18152
17911
  },
18153
17912
  {
18154
- "name": "periodRevenue",
17913
+ "name": "baseAssetAmountWithAmm",
18155
17914
  "docs": [
18156
- "precision: QUOTE_PRECISION"
17915
+ "precision: BASE_PRECISION"
18157
17916
  ],
18158
- "type": "i64"
17917
+ "type": "i128"
17918
+ }
17919
+ ]
17920
+ }
17921
+ },
17922
+ {
17923
+ "name": "hedgeConfig",
17924
+ "docs": [
17925
+ "Per-market configuration of a perp market's relationship to its hedge (LP)",
17926
+ "pool: which pool it routes to, whether hedging is enabled, which hedge",
17927
+ "operations are paused, and the fee-routing scalars. Admin-set; never mutated",
17928
+ "per fill. Embedded at the tail of `PerpMarket` next to `amm` so the whole VLP",
17929
+ "region is contiguous."
17930
+ ],
17931
+ "serialization": "bytemuckunsafe",
17932
+ "repr": {
17933
+ "kind": "c"
17934
+ },
17935
+ "type": {
17936
+ "kind": "struct",
17937
+ "fields": [
17938
+ {
17939
+ "name": "poolId",
17940
+ "docs": [
17941
+ "The LP pool this market hedges into (`LPPool.pool_id`)."
17942
+ ],
17943
+ "type": "u8"
18159
17944
  },
18160
17945
  {
18161
- "name": "baseAssetAmountWithAmm",
17946
+ "name": "status",
18162
17947
  "docs": [
18163
- "precision: BASE_PRECISION"
17948
+ "Hedging enabled for this market; 0 disables it."
18164
17949
  ],
18165
- "type": "i128"
17950
+ "type": "u8"
17951
+ },
17952
+ {
17953
+ "name": "pausedOperations",
17954
+ "docs": [
17955
+ "Bitflags of paused `ConstituentLpOperation`s."
17956
+ ],
17957
+ "type": "u8"
17958
+ },
17959
+ {
17960
+ "name": "exchangeFeeExclusionScalar",
17961
+ "docs": [
17962
+ "Scalar excluding a share of exchange fees from hedge routing."
17963
+ ],
17964
+ "type": "u8"
17965
+ },
17966
+ {
17967
+ "name": "feeTransferScalar",
17968
+ "docs": [
17969
+ "Scalar for the share of fees transferred to the hedge pool."
17970
+ ],
17971
+ "type": "u8"
17972
+ },
17973
+ {
17974
+ "name": "padding",
17975
+ "type": {
17976
+ "array": [
17977
+ "u8",
17978
+ 11
17979
+ ]
17980
+ }
18166
17981
  }
18167
17982
  ]
18168
17983
  }
@@ -19569,101 +19384,322 @@ export type Drift = {
19569
19384
  }
19570
19385
  },
19571
19386
  {
19572
- "name": "liquidatePerpPnlForDeposit",
19573
- "type": {
19574
- "defined": {
19575
- "name": "liquidatePerpPnlForDepositRecord"
19576
- }
19577
- }
19387
+ "name": "liquidatePerpPnlForDeposit",
19388
+ "type": {
19389
+ "defined": {
19390
+ "name": "liquidatePerpPnlForDepositRecord"
19391
+ }
19392
+ }
19393
+ },
19394
+ {
19395
+ "name": "perpBankruptcy",
19396
+ "type": {
19397
+ "defined": {
19398
+ "name": "perpBankruptcyRecord"
19399
+ }
19400
+ }
19401
+ },
19402
+ {
19403
+ "name": "spotBankruptcy",
19404
+ "type": {
19405
+ "defined": {
19406
+ "name": "spotBankruptcyRecord"
19407
+ }
19408
+ }
19409
+ },
19410
+ {
19411
+ "name": "bitFlags",
19412
+ "type": "u8"
19413
+ }
19414
+ ]
19415
+ }
19416
+ },
19417
+ {
19418
+ "name": "liquidationType",
19419
+ "type": {
19420
+ "kind": "enum",
19421
+ "variants": [
19422
+ {
19423
+ "name": "liquidatePerp"
19424
+ },
19425
+ {
19426
+ "name": "liquidateSpot"
19427
+ },
19428
+ {
19429
+ "name": "liquidateBorrowForPerpPnl"
19430
+ },
19431
+ {
19432
+ "name": "liquidatePerpPnlForDeposit"
19433
+ },
19434
+ {
19435
+ "name": "perpBankruptcy"
19436
+ },
19437
+ {
19438
+ "name": "spotBankruptcy"
19439
+ }
19440
+ ]
19441
+ }
19442
+ },
19443
+ {
19444
+ "name": "lpPoolParams",
19445
+ "type": {
19446
+ "kind": "struct",
19447
+ "fields": [
19448
+ {
19449
+ "name": "maxSettleQuoteAmount",
19450
+ "type": {
19451
+ "option": "u64"
19452
+ }
19453
+ },
19454
+ {
19455
+ "name": "volatility",
19456
+ "type": {
19457
+ "option": "u64"
19458
+ }
19459
+ },
19460
+ {
19461
+ "name": "gammaExecution",
19462
+ "type": {
19463
+ "option": "u8"
19464
+ }
19465
+ },
19466
+ {
19467
+ "name": "xi",
19468
+ "type": {
19469
+ "option": "u8"
19470
+ }
19471
+ },
19472
+ {
19473
+ "name": "maxAum",
19474
+ "type": {
19475
+ "option": "u128"
19476
+ }
19477
+ },
19478
+ {
19479
+ "name": "whitelistMint",
19480
+ "type": {
19481
+ "option": "pubkey"
19482
+ }
19483
+ }
19484
+ ]
19485
+ }
19486
+ },
19487
+ {
19488
+ "name": "marketStats",
19489
+ "docs": [
19490
+ "Historic market data shared across all makers, updated on every fill",
19491
+ "regardless of which maker filled (vAMM, DLOB resting order, JIT participant,",
19492
+ "future quoter types). Holds mark/oracle TWAPs, rolling std, volume,",
19493
+ "intensity, mm-oracle snapshot, `historical_oracle_data`,",
19494
+ "`last_oracle_normalised_price`, `last_oracle_valid`.",
19495
+ "",
19496
+ "Update-cadence rule: anything that needs to refresh on every market event",
19497
+ "lives here. Anything AMM-private (reserves, peg, spreads — only matters",
19498
+ "when the AMM specifically is the counterparty) lives on `AMM`. See",
19499
+ "`docs/amm-decoupling-and-maker-interface.md`."
19500
+ ],
19501
+ "serialization": "bytemuckunsafe",
19502
+ "repr": {
19503
+ "kind": "c"
19504
+ },
19505
+ "type": {
19506
+ "kind": "struct",
19507
+ "fields": [
19508
+ {
19509
+ "name": "lastMarkPriceTwap",
19510
+ "docs": [
19511
+ "Average estimate of (bid+ask)/2 price over funding_period.",
19512
+ "precision: PRICE_PRECISION"
19513
+ ],
19514
+ "type": "u64"
19515
+ },
19516
+ {
19517
+ "name": "lastMarkPriceTwap5min",
19518
+ "docs": [
19519
+ "Average estimate of (bid+ask)/2 price over FIVE_MINUTES."
19520
+ ],
19521
+ "type": "u64"
19522
+ },
19523
+ {
19524
+ "name": "lastMarkPriceTwapTs",
19525
+ "docs": [
19526
+ "The last unix_timestamp the mark twap was updated."
19527
+ ],
19528
+ "type": "i64"
19529
+ },
19530
+ {
19531
+ "name": "lastBidPriceTwap",
19532
+ "docs": [
19533
+ "Average estimate of bid price over funding_period.",
19534
+ "precision: PRICE_PRECISION"
19535
+ ],
19536
+ "type": "u64"
19537
+ },
19538
+ {
19539
+ "name": "lastAskPriceTwap",
19540
+ "docs": [
19541
+ "Average estimate of ask price over funding_period.",
19542
+ "precision: PRICE_PRECISION"
19543
+ ],
19544
+ "type": "u64"
19545
+ },
19546
+ {
19547
+ "name": "markStd",
19548
+ "docs": [
19549
+ "Estimate of standard deviation of fill (mark) prices.",
19550
+ "precision: PRICE_PRECISION"
19551
+ ],
19552
+ "type": "u64"
19553
+ },
19554
+ {
19555
+ "name": "oracleStd",
19556
+ "docs": [
19557
+ "Estimate of standard deviation of the oracle price at each update.",
19558
+ "precision: PRICE_PRECISION"
19559
+ ],
19560
+ "type": "u64"
19561
+ },
19562
+ {
19563
+ "name": "lastOracleConfPct",
19564
+ "docs": [
19565
+ "The pct size of the oracle confidence interval.",
19566
+ "precision: PERCENTAGE_PRECISION"
19567
+ ],
19568
+ "type": "u64"
19578
19569
  },
19579
19570
  {
19580
- "name": "perpBankruptcy",
19581
- "type": {
19582
- "defined": {
19583
- "name": "perpBankruptcyRecord"
19584
- }
19585
- }
19571
+ "name": "volume24h",
19572
+ "docs": [
19573
+ "Estimated total of volume in market.",
19574
+ "QUOTE_PRECISION"
19575
+ ],
19576
+ "type": "u64"
19586
19577
  },
19587
19578
  {
19588
- "name": "spotBankruptcy",
19589
- "type": {
19590
- "defined": {
19591
- "name": "spotBankruptcyRecord"
19592
- }
19593
- }
19579
+ "name": "longIntensityVolume",
19580
+ "docs": [
19581
+ "The volume intensity of long fills (across all makers)."
19582
+ ],
19583
+ "type": "u64"
19594
19584
  },
19595
19585
  {
19596
- "name": "bitFlags",
19597
- "type": "u8"
19598
- }
19599
- ]
19600
- }
19601
- },
19602
- {
19603
- "name": "liquidationType",
19604
- "type": {
19605
- "kind": "enum",
19606
- "variants": [
19586
+ "name": "shortIntensityVolume",
19587
+ "docs": [
19588
+ "The volume intensity of short fills (across all makers)."
19589
+ ],
19590
+ "type": "u64"
19591
+ },
19607
19592
  {
19608
- "name": "liquidatePerp"
19593
+ "name": "lastTradeTs",
19594
+ "docs": [
19595
+ "The blockchain unix_timestamp at the time of the last trade."
19596
+ ],
19597
+ "type": "i64"
19609
19598
  },
19610
19599
  {
19611
- "name": "liquidateSpot"
19600
+ "name": "last24hAvgFundingRate",
19601
+ "docs": [
19602
+ "estimate of last 24h of funding rate perp market (unit is quote per base)",
19603
+ "Market-wide config / rolling stat — read by the AMM when computing",
19604
+ "`reference_price_offset` and by funding-rate updates. Migrated from",
19605
+ "`PerpMarket` so the AMM reads only from `MarketStats`.",
19606
+ "precision: QUOTE_PRECISION"
19607
+ ],
19608
+ "type": "i64"
19612
19609
  },
19613
19610
  {
19614
- "name": "liquidateBorrowForPerpPnl"
19611
+ "name": "fundingPeriod",
19612
+ "docs": [
19613
+ "the periodicity of the funding rate updates. Market-wide config used",
19614
+ "across the funding path. Migrated from `PerpMarket`."
19615
+ ],
19616
+ "type": "i64"
19615
19617
  },
19616
19618
  {
19617
- "name": "liquidatePerpPnlForDeposit"
19619
+ "name": "minOrderSize",
19620
+ "docs": [
19621
+ "the minimum base size of an order. Market-wide config read by the AMM",
19622
+ "when computing fallback prices / spread reserves. Migrated from",
19623
+ "`PerpMarket`.",
19624
+ "precision: BASE_PRECISION"
19625
+ ],
19626
+ "type": "u64"
19618
19627
  },
19619
19628
  {
19620
- "name": "perpBankruptcy"
19629
+ "name": "mmOraclePrice",
19630
+ "docs": [
19631
+ "MM oracle price snapshot (set by the native handler)."
19632
+ ],
19633
+ "type": "i64"
19621
19634
  },
19622
19635
  {
19623
- "name": "spotBankruptcy"
19624
- }
19625
- ]
19626
- }
19627
- },
19628
- {
19629
- "name": "lpPoolParams",
19630
- "type": {
19631
- "kind": "struct",
19632
- "fields": [
19636
+ "name": "mmOracleSlot",
19637
+ "docs": [
19638
+ "Slot at which the mm_oracle_* fields were last updated."
19639
+ ],
19640
+ "type": "u64"
19641
+ },
19633
19642
  {
19634
- "name": "maxSettleQuoteAmount",
19635
- "type": {
19636
- "option": "u64"
19637
- }
19643
+ "name": "mmOracleSequenceId",
19644
+ "docs": [
19645
+ "Monotonically increasing sequence id for mm_oracle updates."
19646
+ ],
19647
+ "type": "u64"
19638
19648
  },
19639
19649
  {
19640
- "name": "volatility",
19641
- "type": {
19642
- "option": "u64"
19643
- }
19650
+ "name": "lastOracleNormalisedPrice",
19651
+ "docs": [
19652
+ "Canonical sanitised/clamped oracle price — the latest oracle reading",
19653
+ "after normalisation (any quoter's view, not AMM-specific)."
19654
+ ],
19655
+ "type": "i64"
19644
19656
  },
19645
19657
  {
19646
- "name": "gammaExecution",
19647
- "type": {
19648
- "option": "u8"
19649
- }
19658
+ "name": "lastReferencePriceOffset",
19659
+ "docs": [
19660
+ "Previous reference price offset, written by `_update_amm` after a",
19661
+ "successful repeg/k_update. Read by `update_amm_quote_state` to",
19662
+ "implement the legacy time-decayed reference-price-offset smoothing",
19663
+ "transition — when the freshly computed offset's sign flips relative",
19664
+ "to this cached value AND `curve_update_intensity > 100`, the",
19665
+ "transition is clamped per-slot rather than snapping. Migrated from",
19666
+ "`AMM.reference_price_offset` (which was deleted in the AMM-decoupling",
19667
+ "refactor) so the smoothing behaviour is preserved across cranks.",
19668
+ "precision: PRICE_PRECISION"
19669
+ ],
19670
+ "type": "i32"
19650
19671
  },
19651
19672
  {
19652
- "name": "xi",
19653
- "type": {
19654
- "option": "u8"
19655
- }
19673
+ "name": "lastOracleValid",
19674
+ "docs": [
19675
+ "Whether the oracle was valid at the most recent `_update_amm`.",
19676
+ "Read by settlement and fill paths to gate operations."
19677
+ ],
19678
+ "type": "bool"
19656
19679
  },
19657
19680
  {
19658
- "name": "maxAum",
19681
+ "name": "padding",
19682
+ "docs": [
19683
+ "Padding so historical_oracle_data is 8-aligned."
19684
+ ],
19659
19685
  "type": {
19660
- "option": "u128"
19686
+ "array": [
19687
+ "u8",
19688
+ 11
19689
+ ]
19661
19690
  }
19662
19691
  },
19663
19692
  {
19664
- "name": "whitelistMint",
19693
+ "name": "historicalOracleData",
19694
+ "docs": [
19695
+ "Historical oracle readings — TWAPs, last raw price, confidence, delay,",
19696
+ "timestamp. Market-wide data (any quoter would want it), updated by",
19697
+ "`_update_amm` / funding paths. Migrated from AMM."
19698
+ ],
19665
19699
  "type": {
19666
- "option": "pubkey"
19700
+ "defined": {
19701
+ "name": "historicalOracleData"
19702
+ }
19667
19703
  }
19668
19704
  }
19669
19705
  ]
@@ -19780,7 +19816,7 @@ export type Drift = {
19780
19816
  {
19781
19817
  "name": "oraclePriceOffset",
19782
19818
  "type": {
19783
- "option": "i32"
19819
+ "option": "i64"
19784
19820
  }
19785
19821
  },
19786
19822
  {
@@ -20021,7 +20057,7 @@ export type Drift = {
20021
20057
  "If set, the order limit price is the oracle price + this offset",
20022
20058
  "precision: PRICE_PRECISION"
20023
20059
  ],
20024
- "type": "i32"
20060
+ "type": "i64"
20025
20061
  },
20026
20062
  {
20027
20063
  "name": "orderId",
@@ -20158,7 +20194,7 @@ export type Drift = {
20158
20194
  "type": {
20159
20195
  "array": [
20160
20196
  "u8",
20161
- 1
20197
+ 5
20162
20198
  ]
20163
20199
  }
20164
20200
  }
@@ -20684,7 +20720,7 @@ export type Drift = {
20684
20720
  {
20685
20721
  "name": "oraclePriceOffset",
20686
20722
  "type": {
20687
- "option": "i32"
20723
+ "option": "i64"
20688
20724
  }
20689
20725
  },
20690
20726
  {
@@ -20704,6 +20740,26 @@ export type Drift = {
20704
20740
  "type": {
20705
20741
  "option": "i64"
20706
20742
  }
20743
+ },
20744
+ {
20745
+ "name": "builderIdx",
20746
+ "docs": [
20747
+ "the index into the placing user's RevenueShareEscrow.approved_builders list, if this order",
20748
+ "carries a builder code. Only honored for non-swift orders; swift orders carry the builder",
20749
+ "info in the signed message envelope instead."
20750
+ ],
20751
+ "type": {
20752
+ "option": "u8"
20753
+ }
20754
+ },
20755
+ {
20756
+ "name": "builderFeeTenthBps",
20757
+ "docs": [
20758
+ "the builder fee on this order, in tenths of a bps, e.g. 100 = 0.01%"
20759
+ ],
20760
+ "type": {
20761
+ "option": "u16"
20762
+ }
20707
20763
  }
20708
20764
  ]
20709
20765
  }
@@ -20849,58 +20905,156 @@ export type Drift = {
20849
20905
  "type": "u16"
20850
20906
  },
20851
20907
  {
20852
- "name": "pnl",
20908
+ "name": "pnl",
20909
+ "type": "i128"
20910
+ },
20911
+ {
20912
+ "name": "ifPayment",
20913
+ "type": "u128"
20914
+ },
20915
+ {
20916
+ "name": "clawbackUser",
20917
+ "type": {
20918
+ "option": "pubkey"
20919
+ }
20920
+ },
20921
+ {
20922
+ "name": "clawbackUserPayment",
20923
+ "type": {
20924
+ "option": "u128"
20925
+ }
20926
+ },
20927
+ {
20928
+ "name": "cumulativeFundingRateDelta",
20929
+ "type": "i128"
20930
+ }
20931
+ ]
20932
+ }
20933
+ },
20934
+ {
20935
+ "name": "perpMarket",
20936
+ "serialization": "bytemuckunsafe",
20937
+ "repr": {
20938
+ "kind": "c"
20939
+ },
20940
+ "type": {
20941
+ "kind": "struct",
20942
+ "fields": [
20943
+ {
20944
+ "name": "pubkey",
20945
+ "docs": [
20946
+ "The perp market's address. It is a pda of the market index"
20947
+ ],
20948
+ "type": "pubkey"
20949
+ },
20950
+ {
20951
+ "name": "baseAssetAmountLong",
20952
+ "docs": [
20953
+ "always non-negative. tracks number of total longs in market (regardless of counterparty)",
20954
+ "precision: BASE_PRECISION"
20955
+ ],
20956
+ "type": "i128"
20957
+ },
20958
+ {
20959
+ "name": "baseAssetAmountShort",
20960
+ "docs": [
20961
+ "always non-positive. tracks number of total shorts in market (regardless of counterparty)",
20962
+ "precision: BASE_PRECISION"
20963
+ ],
20964
+ "type": "i128"
20965
+ },
20966
+ {
20967
+ "name": "quoteAssetAmount",
20968
+ "docs": [
20969
+ "sum of all user's perp quote_asset_amount in market",
20970
+ "precision: QUOTE_PRECISION"
20971
+ ],
20972
+ "type": "i128"
20973
+ },
20974
+ {
20975
+ "name": "quoteEntryAmountLong",
20976
+ "docs": [
20977
+ "sum of all long user's quote_entry_amount in market",
20978
+ "precision: QUOTE_PRECISION"
20979
+ ],
20980
+ "type": "i128"
20981
+ },
20982
+ {
20983
+ "name": "quoteEntryAmountShort",
20984
+ "docs": [
20985
+ "sum of all short user's quote_entry_amount in market",
20986
+ "precision: QUOTE_PRECISION"
20987
+ ],
20988
+ "type": "i128"
20989
+ },
20990
+ {
20991
+ "name": "quoteBreakEvenAmountLong",
20992
+ "docs": [
20993
+ "sum of all long user's quote_break_even_amount in market",
20994
+ "precision: QUOTE_PRECISION"
20995
+ ],
20996
+ "type": "i128"
20997
+ },
20998
+ {
20999
+ "name": "quoteBreakEvenAmountShort",
21000
+ "docs": [
21001
+ "sum of all short user's quote_break_even_amount in market",
21002
+ "precision: QUOTE_PRECISION"
21003
+ ],
20853
21004
  "type": "i128"
20854
21005
  },
20855
21006
  {
20856
- "name": "ifPayment",
21007
+ "name": "maxOpenInterest",
21008
+ "docs": [
21009
+ "max allowed open interest, blocks trades that breach this value",
21010
+ "precision: BASE_PRECISION"
21011
+ ],
20857
21012
  "type": "u128"
20858
21013
  },
20859
21014
  {
20860
- "name": "clawbackUser",
20861
- "type": {
20862
- "option": "pubkey"
20863
- }
21015
+ "name": "totalSocialLoss",
21016
+ "docs": [
21017
+ "accumulated social loss paid by users since inception in market",
21018
+ "precision: QUOTE_PRECISION"
21019
+ ],
21020
+ "type": "u128"
20864
21021
  },
20865
21022
  {
20866
- "name": "clawbackUserPayment",
20867
- "type": {
20868
- "option": "u128"
20869
- }
21023
+ "name": "cumulativeFundingRateLong",
21024
+ "docs": [
21025
+ "accumulated funding rate for longs since inception in market"
21026
+ ],
21027
+ "type": "i128"
20870
21028
  },
20871
21029
  {
20872
- "name": "cumulativeFundingRateDelta",
21030
+ "name": "cumulativeFundingRateShort",
21031
+ "docs": [
21032
+ "accumulated funding rate for shorts since inception in market"
21033
+ ],
20873
21034
  "type": "i128"
20874
- }
20875
- ]
20876
- }
20877
- },
20878
- {
20879
- "name": "perpMarket",
20880
- "serialization": "bytemuckunsafe",
20881
- "repr": {
20882
- "kind": "c"
20883
- },
20884
- "type": {
20885
- "kind": "struct",
20886
- "fields": [
21035
+ },
20887
21036
  {
20888
- "name": "pubkey",
21037
+ "name": "totalExchangeFee",
20889
21038
  "docs": [
20890
- "The perp market's address. It is a pda of the market index"
21039
+ "total fees collected by exchange fee schedule",
21040
+ "precision: QUOTE_PRECISION"
20891
21041
  ],
20892
- "type": "pubkey"
21042
+ "type": "u128"
20893
21043
  },
20894
21044
  {
20895
- "name": "amm",
21045
+ "name": "totalLiquidationFee",
20896
21046
  "docs": [
20897
- "The automated market maker"
21047
+ "all fees collected by market for liquidations",
21048
+ "precision: QUOTE_PRECISION"
20898
21049
  ],
20899
- "type": {
20900
- "defined": {
20901
- "name": "amm"
20902
- }
20903
- }
21050
+ "type": "u128"
21051
+ },
21052
+ {
21053
+ "name": "oracle",
21054
+ "docs": [
21055
+ "oracle price data public key"
21056
+ ],
21057
+ "type": "pubkey"
20904
21058
  },
20905
21059
  {
20906
21060
  "name": "pnlPool",
@@ -20937,6 +21091,67 @@ export type Drift = {
20937
21091
  }
20938
21092
  }
20939
21093
  },
21094
+ {
21095
+ "name": "lastFundingRate",
21096
+ "docs": [
21097
+ "last funding rate in this perp market (unit is quote per base)",
21098
+ "precision: FUNDING_RATE_PRECISION"
21099
+ ],
21100
+ "type": "i64"
21101
+ },
21102
+ {
21103
+ "name": "lastFundingRateLong",
21104
+ "docs": [
21105
+ "last funding rate for longs in this perp market (unit is quote per base)",
21106
+ "precision: FUNDING_RATE_PRECISION"
21107
+ ],
21108
+ "type": "i64"
21109
+ },
21110
+ {
21111
+ "name": "lastFundingRateShort",
21112
+ "docs": [
21113
+ "last funding rate for shorts in this perp market (unit is quote per base)",
21114
+ "precision: QUOTE_PRECISION"
21115
+ ],
21116
+ "type": "i64"
21117
+ },
21118
+ {
21119
+ "name": "lastFundingRateTs",
21120
+ "docs": [
21121
+ "the last funding rate update unix_timestamp"
21122
+ ],
21123
+ "type": "i64"
21124
+ },
21125
+ {
21126
+ "name": "netUnsettledFundingPnl",
21127
+ "docs": [
21128
+ "unsettled funding pnl across the market (protocol-wide)"
21129
+ ],
21130
+ "type": "i64"
21131
+ },
21132
+ {
21133
+ "name": "lastFundingOracleTwap",
21134
+ "docs": [
21135
+ "oracle TWAP captured at last funding update"
21136
+ ],
21137
+ "type": "i64"
21138
+ },
21139
+ {
21140
+ "name": "orderStepSize",
21141
+ "docs": [
21142
+ "the base step size (increment) of orders",
21143
+ "precision: BASE_PRECISION"
21144
+ ],
21145
+ "type": "u64"
21146
+ },
21147
+ {
21148
+ "name": "orderTickSize",
21149
+ "docs": [
21150
+ "the price tick size of orders",
21151
+ "precision: PRICE_PRECISION"
21152
+ ],
21153
+ "type": "u64"
21154
+ },
20940
21155
  {
20941
21156
  "name": "unrealizedPnlMaxImbalance",
20942
21157
  "docs": [
@@ -20976,13 +21191,6 @@ export type Drift = {
20976
21191
  ],
20977
21192
  "type": "u64"
20978
21193
  },
20979
- {
20980
- "name": "nextCurveRecordId",
20981
- "docs": [
20982
- "Every amm k updated has a record id. This is the next id to be used"
20983
- ],
20984
- "type": "u64"
20985
- },
20986
21194
  {
20987
21195
  "name": "imfFactor",
20988
21196
  "docs": [
@@ -21123,6 +21331,21 @@ export type Drift = {
21123
21331
  ],
21124
21332
  "type": "i16"
21125
21333
  },
21334
+ {
21335
+ "name": "paddingAlignLfp",
21336
+ "docs": [
21337
+ "Explicit padding so the IDL records the 6 bytes the Rust compiler",
21338
+ "inserts to 8-align `last_fill_price`. Without this the JS borsh",
21339
+ "decoder (which reads sequentially after the variable-span enum",
21340
+ "`status`) reads every field past `fee_adjustment` 6 bytes early."
21341
+ ],
21342
+ "type": {
21343
+ "array": [
21344
+ "u8",
21345
+ 6
21346
+ ]
21347
+ }
21348
+ },
21126
21349
  {
21127
21350
  "name": "lastFillPrice",
21128
21351
  "type": "u64"
@@ -21141,37 +21364,122 @@ export type Drift = {
21141
21364
  }
21142
21365
  },
21143
21366
  {
21144
- "name": "lpFeeTransferScalar",
21145
- "type": "u8"
21367
+ "name": "paddingHedge",
21368
+ "docs": [
21369
+ "Was `lp_fee_transfer_scalar`, `lp_status`, `lp_paused_operations`,",
21370
+ "`lp_exchange_fee_excluscion_scalar`, `lp_pool_id` (5×u8). Relocated into",
21371
+ "`hedge_config` at the tail; kept as reserved bytes so existing account",
21372
+ "byte offsets (and snapshots) are undisturbed."
21373
+ ],
21374
+ "type": {
21375
+ "array": [
21376
+ "u8",
21377
+ 5
21378
+ ]
21379
+ }
21146
21380
  },
21147
21381
  {
21148
- "name": "lpStatus",
21382
+ "name": "marketConfig",
21149
21383
  "type": "u8"
21150
21384
  },
21151
21385
  {
21152
- "name": "lpPausedOperations",
21153
- "type": "u8"
21386
+ "name": "oracleSource",
21387
+ "docs": [
21388
+ "the oracle provider information. used to decode/scale the oracle public key"
21389
+ ],
21390
+ "type": {
21391
+ "defined": {
21392
+ "name": "oracleSource"
21393
+ }
21394
+ }
21154
21395
  },
21155
21396
  {
21156
- "name": "lpExchangeFeeExcluscionScalar",
21157
- "type": "u8"
21397
+ "name": "oracleSlotDelayOverride",
21398
+ "docs": [
21399
+ "override for the per-fill slot delay required from the oracle (default -1 = use state default)"
21400
+ ],
21401
+ "type": "i8"
21158
21402
  },
21159
21403
  {
21160
- "name": "lpPoolId",
21161
- "type": "u8"
21404
+ "name": "oracleLowRiskSlotDelayOverride",
21405
+ "docs": [
21406
+ "the override for the state.min_perp_auction_duration",
21407
+ "0 is no override, -1 is disable speed bump, 1-100 is literal speed bump"
21408
+ ],
21409
+ "type": "i8"
21162
21410
  },
21163
21411
  {
21164
- "name": "marketConfig",
21165
- "type": "u8"
21412
+ "name": "padding",
21413
+ "docs": [
21414
+ "Trailing padding so `market_stats` lands at the offset Rust naturally",
21415
+ "computes via `repr(C)` alignment and the `(SIZE - 8) % 16 == 0`",
21416
+ "invariant holds. Bumped to 36 bytes (was 28) when `next_curve_record_id`",
21417
+ "was removed."
21418
+ ],
21419
+ "type": {
21420
+ "array": [
21421
+ "u8",
21422
+ 36
21423
+ ]
21424
+ }
21166
21425
  },
21167
21426
  {
21168
- "name": "padding",
21427
+ "name": "marketStats",
21428
+ "docs": [
21429
+ "Market-wide stats shared across all makers: mark/oracle TWAPs, std,",
21430
+ "volume, intensity, mm-oracle snapshot, `historical_oracle_data`,",
21431
+ "`last_oracle_normalised_price`, `last_oracle_valid`. Writers (e.g.",
21432
+ "`MarketStats::update_mark_std`, `update_volume_24h`, native",
21433
+ "`handle_update_mm_oracle_native`) update this directly."
21434
+ ],
21435
+ "type": {
21436
+ "defined": {
21437
+ "name": "marketStats"
21438
+ }
21439
+ }
21440
+ },
21441
+ {
21442
+ "name": "paddingAlignAmm",
21443
+ "docs": [
21444
+ "8 bytes of explicit padding so MarketStats (216 bytes) plus this",
21445
+ "padding equals 224 bytes — the offset Rust naturally inserts to",
21446
+ "16-align AMM's leading u128. Making it explicit keeps the IDL byte",
21447
+ "layout aligned with `repr(C)`."
21448
+ ],
21169
21449
  "type": {
21170
21450
  "array": [
21171
21451
  "u8",
21172
- 30
21452
+ 8
21173
21453
  ]
21174
21454
  }
21455
+ },
21456
+ {
21457
+ "name": "amm",
21458
+ "docs": [
21459
+ "The automated market maker. Last field so future quoter modules can",
21460
+ "land in the trailing region without disturbing earlier byte offsets",
21461
+ "— in the target architecture this account holds back-to-back",
21462
+ "per-quoter state slices (AMM, DLOB-maker state, future propAMM-style",
21463
+ "participants, …) and each module owns a contiguous span starting at",
21464
+ "a known offset."
21465
+ ],
21466
+ "type": {
21467
+ "defined": {
21468
+ "name": "amm"
21469
+ }
21470
+ }
21471
+ },
21472
+ {
21473
+ "name": "hedgeConfig",
21474
+ "docs": [
21475
+ "This market's hedge (LP pool) configuration. Sits immediately after `amm`",
21476
+ "so the trailing `[amm, hedge_config]` span is the contiguous VLP region."
21477
+ ],
21478
+ "type": {
21479
+ "defined": {
21480
+ "name": "hedgeConfig"
21481
+ }
21482
+ }
21175
21483
  }
21176
21484
  ]
21177
21485
  }
@@ -21579,28 +21887,12 @@ export type Drift = {
21579
21887
  "name": "referrer",
21580
21888
  "type": "pubkey"
21581
21889
  },
21582
- {
21583
- "name": "referrerBoostExpireTs",
21584
- "type": "u32"
21585
- },
21586
- {
21587
- "name": "referrerRewardOffset",
21588
- "type": "i8"
21589
- },
21590
- {
21591
- "name": "refereeFeeNumeratorOffset",
21592
- "type": "i8"
21593
- },
21594
- {
21595
- "name": "referrerBoostNumerator",
21596
- "type": "i8"
21597
- },
21598
21890
  {
21599
21891
  "name": "reservedFixed",
21600
21892
  "type": {
21601
21893
  "array": [
21602
21894
  "u8",
21603
- 17
21895
+ 24
21604
21896
  ]
21605
21897
  }
21606
21898
  },
@@ -21866,7 +22158,7 @@ export type Drift = {
21866
22158
  {
21867
22159
  "name": "bitFlags",
21868
22160
  "docs": [
21869
- "Bit flags (e.g., for high leverage mode)"
22161
+ "Order bit flags"
21870
22162
  ],
21871
22163
  "type": "u8"
21872
22164
  },
@@ -23724,22 +24016,6 @@ export type Drift = {
23724
24016
  "precision: QUOTE_PRECISION"
23725
24017
  ],
23726
24018
  "type": "u64"
23727
- },
23728
- {
23729
- "name": "totalReferrerReward",
23730
- "docs": [
23731
- "Total reward to referrer",
23732
- "precision: QUOTE_PRECISION"
23733
- ],
23734
- "type": "u64"
23735
- },
23736
- {
23737
- "name": "currentEpochReferrerReward",
23738
- "docs": [
23739
- "Total reward to referrer this epoch",
23740
- "precision: QUOTE_PRECISION"
23741
- ],
23742
- "type": "u64"
23743
24019
  }
23744
24020
  ]
23745
24021
  }
@@ -23778,14 +24054,6 @@ export type Drift = {
23778
24054
  }
23779
24055
  }
23780
24056
  },
23781
- {
23782
- "name": "nextEpochTs",
23783
- "docs": [
23784
- "The timestamp of the next epoch",
23785
- "Epoch is used to limit referrer rewards earned in single epoch"
23786
- ],
23787
- "type": "i64"
23788
- },
23789
24057
  {
23790
24058
  "name": "makerVolume30d",
23791
24059
  "docs": [
@@ -23877,12 +24145,19 @@ export type Drift = {
23877
24145
  ],
23878
24146
  "type": "u64"
23879
24147
  },
24148
+ {
24149
+ "name": "delegatePermissions",
24150
+ "docs": [
24151
+ "Delegate permissions across all sub accounts"
24152
+ ],
24153
+ "type": "u8"
24154
+ },
23880
24155
  {
23881
24156
  "name": "padding",
23882
24157
  "type": {
23883
24158
  "array": [
23884
24159
  "u8",
23885
- 40
24160
+ 63
23886
24161
  ]
23887
24162
  }
23888
24163
  }
@@ -23919,7 +24194,7 @@ export type Drift = {
23919
24194
  {
23920
24195
  "name": "signedMsgOrderParamsExport",
23921
24196
  "docs": [
23922
- "unusued placeholder event to force include signed msg types into drift IDL"
24197
+ "unusued placeholder event to force include signed msg types into velocity IDL"
23923
24198
  ],
23924
24199
  "type": {
23925
24200
  "kind": "struct",