@drift-labs/sdk-browser 2.162.0-beta.2 → 2.163.0-beta.9

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 (500) hide show
  1. package/.prettierignore +1 -0
  2. package/.yarn/install-state.gz +0 -0
  3. package/README.md +2 -2
  4. package/VERSION +1 -1
  5. package/bun.lock +47 -79
  6. package/lib/browser/accounts/fetch.d.ts +6 -6
  7. package/lib/browser/accounts/fetch.js +4 -4
  8. package/lib/browser/accounts/grpcAccountSubscriber.d.ts +2 -2
  9. package/lib/browser/accounts/grpcDriftClientAccountSubscriber.d.ts +2 -2
  10. package/lib/browser/accounts/grpcDriftClientAccountSubscriberV2.d.ts +3 -3
  11. package/lib/browser/accounts/grpcDriftClientAccountSubscriberV2.js +2 -2
  12. package/lib/browser/accounts/grpcInsuranceFundStakeAccountSubscriber.d.ts +2 -2
  13. package/lib/browser/accounts/grpcMultiAccountSubscriber.d.ts +2 -2
  14. package/lib/browser/accounts/grpcMultiUserAccountSubscriber.d.ts +2 -2
  15. package/lib/browser/accounts/grpcProgramAccountSubscriber.d.ts +2 -2
  16. package/lib/browser/accounts/grpcUserAccountSubscriber.d.ts +2 -2
  17. package/lib/browser/accounts/grpcUserStatsAccountSubscriber.d.ts +2 -2
  18. package/lib/browser/accounts/laserProgramAccountSubscriber.d.ts +2 -2
  19. package/lib/browser/accounts/oneShotUserAccountSubscriber.d.ts +3 -3
  20. package/lib/browser/accounts/oneShotUserStatsAccountSubscriber.d.ts +3 -3
  21. package/lib/browser/accounts/pollingDriftClientAccountSubscriber.d.ts +3 -3
  22. package/lib/browser/accounts/pollingDriftClientAccountSubscriber.js +2 -2
  23. package/lib/browser/accounts/pollingInsuranceFundStakeAccountSubscriber.d.ts +3 -3
  24. package/lib/browser/accounts/pollingInsuranceFundStakeAccountSubscriber.js +1 -1
  25. package/lib/browser/accounts/pollingOracleAccountSubscriber.d.ts +2 -2
  26. package/lib/browser/accounts/pollingTokenAccountSubscriber.d.ts +2 -2
  27. package/lib/browser/accounts/pollingUserAccountSubscriber.js +2 -2
  28. package/lib/browser/accounts/pollingUserStatsAccountSubscriber.d.ts +3 -3
  29. package/lib/browser/accounts/pollingUserStatsAccountSubscriber.js +1 -1
  30. package/lib/browser/accounts/testBulkAccountLoader.js +3 -5
  31. package/lib/browser/accounts/types.d.ts +11 -14
  32. package/lib/browser/accounts/webSocketAccountSubscriber.d.ts +3 -3
  33. package/lib/browser/accounts/webSocketAccountSubscriber.js +1 -2
  34. package/lib/browser/accounts/webSocketAccountSubscriberV2.d.ts +3 -3
  35. package/lib/browser/accounts/webSocketDriftClientAccountSubscriber.d.ts +5 -5
  36. package/lib/browser/accounts/webSocketDriftClientAccountSubscriber.js +2 -2
  37. package/lib/browser/accounts/webSocketDriftClientAccountSubscriberV2.d.ts +3 -3
  38. package/lib/browser/accounts/webSocketDriftClientAccountSubscriberV2.js +2 -2
  39. package/lib/browser/accounts/webSocketInsuranceFundStakeAccountSubscriber.d.ts +3 -3
  40. package/lib/browser/accounts/webSocketProgramAccountSubscriber.d.ts +3 -3
  41. package/lib/browser/accounts/webSocketProgramAccountSubscriberV2.d.ts +3 -3
  42. package/lib/browser/accounts/webSocketProgramAccountsSubscriberV2.d.ts +3 -3
  43. package/lib/browser/accounts/webSocketUserAccountSubscriber.d.ts +3 -3
  44. package/lib/browser/accounts/webSocketUserStatsAccountSubsriber.d.ts +3 -3
  45. package/lib/browser/accounts/websocketProgramUserAccountSubscriber.d.ts +2 -2
  46. package/lib/browser/addresses/pda.d.ts +6 -2
  47. package/lib/browser/addresses/pda.js +7 -12
  48. package/lib/browser/adminClient.d.ts +11 -9
  49. package/lib/browser/adminClient.js +30 -72
  50. package/lib/browser/auctionSubscriber/auctionSubscriber.js +1 -1
  51. package/lib/browser/auctionSubscriber/auctionSubscriberGrpc.js +1 -1
  52. package/lib/browser/config.d.ts +7 -3
  53. package/lib/browser/config.js +9 -7
  54. package/lib/browser/constants/index.d.ts +5 -0
  55. package/lib/browser/constants/index.js +5 -0
  56. package/lib/browser/constants/numericConstants.d.ts +1 -1
  57. package/lib/browser/constants/numericConstants.js +3 -3
  58. package/lib/browser/constants/perpMarkets.js +3 -412
  59. package/lib/browser/constants/spotMarkets.js +7 -91
  60. package/lib/browser/constituentMap/constituentMap.js +2 -2
  61. package/lib/browser/constituentMap/pollingConstituentAccountSubscriber.d.ts +3 -3
  62. package/lib/browser/constituentMap/webSocketConstituentAccountSubscriber.d.ts +3 -3
  63. package/lib/browser/constituentMap/webSocketConstituentAccountSubscriber.js +1 -1
  64. package/lib/browser/decode/customCoder.d.ts +7 -9
  65. package/lib/browser/decode/customCoder.js +17 -28
  66. package/lib/browser/decode/user.js +7 -25
  67. package/lib/browser/dlob/DLOB.d.ts +12 -0
  68. package/lib/browser/dlob/DLOB.js +12 -0
  69. package/lib/browser/dlob/orderBookLevels.js +1 -1
  70. package/lib/browser/driftClient.d.ts +32 -59
  71. package/lib/browser/driftClient.js +85 -562
  72. package/lib/browser/driftClientConfig.d.ts +7 -0
  73. package/lib/browser/events/eventSubscriber.d.ts +8 -0
  74. package/lib/browser/events/eventSubscriber.js +5 -2
  75. package/lib/browser/events/parse.d.ts +1 -1
  76. package/lib/browser/factory/oracleClient.d.ts +2 -2
  77. package/lib/browser/factory/oracleClient.js +9 -21
  78. package/lib/browser/idl/drift.d.ts +25708 -0
  79. package/lib/browser/idl/drift.js +2 -0
  80. package/lib/browser/idl/drift.json +20850 -15287
  81. package/lib/browser/idl/pyth.d.ts +97 -0
  82. package/lib/browser/idl/pyth.js +2 -0
  83. package/lib/browser/idl/token_faucet.d.ts +197 -0
  84. package/lib/browser/idl/token_faucet.js +2 -0
  85. package/lib/browser/idl/token_faucet.json +148 -61
  86. package/lib/browser/index.d.ts +13 -6
  87. package/lib/browser/index.js +12 -5
  88. package/lib/browser/marinade/index.d.ts +1 -1
  89. package/lib/browser/marinade/index.js +2 -2
  90. package/lib/browser/math/amm.d.ts +4 -5
  91. package/lib/browser/math/amm.js +8 -35
  92. package/lib/browser/math/funding.js +6 -1
  93. package/lib/browser/math/margin.d.ts +3 -4
  94. package/lib/browser/math/margin.js +16 -47
  95. package/lib/browser/math/market.d.ts +2 -2
  96. package/lib/browser/math/market.js +10 -42
  97. package/lib/browser/math/oracles.js +14 -19
  98. package/lib/browser/math/position.js +1 -1
  99. package/lib/browser/math/trade.js +4 -4
  100. package/lib/browser/memcmp.js +8 -8
  101. package/lib/browser/openbook/openbookV2Subscriber.d.ts +1 -1
  102. package/lib/browser/openbook/openbookV2Subscriber.js +3 -3
  103. package/lib/browser/oracles/oracleClientCache.d.ts +2 -2
  104. package/lib/browser/oracles/prelaunchOracleClient.d.ts +2 -2
  105. package/lib/browser/oracles/prelaunchOracleClient.js +1 -1
  106. package/lib/browser/oracles/pythLazerClient.js +3 -5
  107. package/lib/browser/oracles/types.d.ts +6 -0
  108. package/lib/browser/orderParams.d.ts +0 -1
  109. package/lib/browser/orderParams.js +1 -5
  110. package/lib/browser/orderSubscriber/OrderSubscriber.js +3 -4
  111. package/lib/browser/orderSubscriber/WebsocketSubscription.js +1 -1
  112. package/lib/browser/orderSubscriber/grpcSubscription.js +2 -2
  113. package/lib/browser/orderSubscriber/index.d.ts +5 -0
  114. package/lib/browser/orderSubscriber/index.js +5 -0
  115. package/lib/browser/priorityFee/index.d.ts +5 -0
  116. package/lib/browser/priorityFee/index.js +5 -0
  117. package/lib/browser/pyth/index.d.ts +2 -2
  118. package/lib/browser/pyth/types.d.ts +1 -1
  119. package/lib/browser/swift/grpcSignedMsgUserAccountSubscriber.js +1 -1
  120. package/lib/browser/swift/index.d.ts +7 -0
  121. package/lib/browser/swift/index.js +7 -0
  122. package/lib/browser/swift/signedMsgUserAccountSubscriber.js +4 -3
  123. package/lib/browser/tokenFaucet.d.ts +2 -2
  124. package/lib/browser/tokenFaucet.js +4 -4
  125. package/lib/browser/tx/txHandler.d.ts +12 -0
  126. package/lib/browser/tx/txHandler.js +12 -0
  127. package/lib/browser/types.d.ts +19 -31
  128. package/lib/browser/types.js +6 -11
  129. package/lib/browser/user.d.ts +27 -18
  130. package/lib/browser/user.js +64 -100
  131. package/lib/browser/userMap/WebsocketSubscription.js +1 -1
  132. package/lib/browser/userMap/grpcSubscription.js +1 -1
  133. package/lib/browser/userMap/revenueShareEscrowMap.js +4 -4
  134. package/lib/browser/userMap/userMap.js +4 -5
  135. package/lib/browser/userMap/userStatsMap.js +2 -3
  136. package/lib/browser/userStats.d.ts +5 -0
  137. package/lib/node/accounts/fetch.d.ts +6 -6
  138. package/lib/node/accounts/fetch.d.ts.map +1 -1
  139. package/lib/node/accounts/fetch.js +4 -4
  140. package/lib/node/accounts/grpcAccountSubscriber.d.ts +2 -2
  141. package/lib/node/accounts/grpcAccountSubscriber.d.ts.map +1 -1
  142. package/lib/node/accounts/grpcDriftClientAccountSubscriber.d.ts +2 -2
  143. package/lib/node/accounts/grpcDriftClientAccountSubscriber.d.ts.map +1 -1
  144. package/lib/node/accounts/grpcDriftClientAccountSubscriberV2.d.ts +3 -3
  145. package/lib/node/accounts/grpcDriftClientAccountSubscriberV2.d.ts.map +1 -1
  146. package/lib/node/accounts/grpcDriftClientAccountSubscriberV2.js +2 -2
  147. package/lib/node/accounts/grpcInsuranceFundStakeAccountSubscriber.d.ts +2 -2
  148. package/lib/node/accounts/grpcInsuranceFundStakeAccountSubscriber.d.ts.map +1 -1
  149. package/lib/node/accounts/grpcMultiAccountSubscriber.d.ts +2 -2
  150. package/lib/node/accounts/grpcMultiAccountSubscriber.d.ts.map +1 -1
  151. package/lib/node/accounts/grpcMultiUserAccountSubscriber.d.ts +2 -2
  152. package/lib/node/accounts/grpcMultiUserAccountSubscriber.d.ts.map +1 -1
  153. package/lib/node/accounts/grpcProgramAccountSubscriber.d.ts +2 -2
  154. package/lib/node/accounts/grpcProgramAccountSubscriber.d.ts.map +1 -1
  155. package/lib/node/accounts/grpcUserAccountSubscriber.d.ts +2 -2
  156. package/lib/node/accounts/grpcUserAccountSubscriber.d.ts.map +1 -1
  157. package/lib/node/accounts/grpcUserStatsAccountSubscriber.d.ts +2 -2
  158. package/lib/node/accounts/grpcUserStatsAccountSubscriber.d.ts.map +1 -1
  159. package/lib/node/accounts/laserProgramAccountSubscriber.d.ts +2 -2
  160. package/lib/node/accounts/laserProgramAccountSubscriber.d.ts.map +1 -1
  161. package/lib/node/accounts/oneShotUserAccountSubscriber.d.ts +3 -3
  162. package/lib/node/accounts/oneShotUserAccountSubscriber.d.ts.map +1 -1
  163. package/lib/node/accounts/oneShotUserStatsAccountSubscriber.d.ts +3 -3
  164. package/lib/node/accounts/oneShotUserStatsAccountSubscriber.d.ts.map +1 -1
  165. package/lib/node/accounts/pollingDriftClientAccountSubscriber.d.ts +3 -3
  166. package/lib/node/accounts/pollingDriftClientAccountSubscriber.d.ts.map +1 -1
  167. package/lib/node/accounts/pollingDriftClientAccountSubscriber.js +2 -2
  168. package/lib/node/accounts/pollingInsuranceFundStakeAccountSubscriber.d.ts +3 -3
  169. package/lib/node/accounts/pollingInsuranceFundStakeAccountSubscriber.d.ts.map +1 -1
  170. package/lib/node/accounts/pollingInsuranceFundStakeAccountSubscriber.js +1 -1
  171. package/lib/node/accounts/pollingOracleAccountSubscriber.d.ts +2 -2
  172. package/lib/node/accounts/pollingOracleAccountSubscriber.d.ts.map +1 -1
  173. package/lib/node/accounts/pollingTokenAccountSubscriber.d.ts +2 -2
  174. package/lib/node/accounts/pollingTokenAccountSubscriber.d.ts.map +1 -1
  175. package/lib/node/accounts/pollingUserAccountSubscriber.js +2 -2
  176. package/lib/node/accounts/pollingUserStatsAccountSubscriber.d.ts +3 -3
  177. package/lib/node/accounts/pollingUserStatsAccountSubscriber.d.ts.map +1 -1
  178. package/lib/node/accounts/pollingUserStatsAccountSubscriber.js +1 -1
  179. package/lib/node/accounts/testBulkAccountLoader.d.ts.map +1 -1
  180. package/lib/node/accounts/testBulkAccountLoader.js +3 -5
  181. package/lib/node/accounts/types.d.ts +11 -14
  182. package/lib/node/accounts/types.d.ts.map +1 -1
  183. package/lib/node/accounts/webSocketAccountSubscriber.d.ts +3 -3
  184. package/lib/node/accounts/webSocketAccountSubscriber.d.ts.map +1 -1
  185. package/lib/node/accounts/webSocketAccountSubscriber.js +1 -2
  186. package/lib/node/accounts/webSocketAccountSubscriberV2.d.ts +3 -3
  187. package/lib/node/accounts/webSocketAccountSubscriberV2.d.ts.map +1 -1
  188. package/lib/node/accounts/webSocketDriftClientAccountSubscriber.d.ts +5 -5
  189. package/lib/node/accounts/webSocketDriftClientAccountSubscriber.d.ts.map +1 -1
  190. package/lib/node/accounts/webSocketDriftClientAccountSubscriber.js +2 -2
  191. package/lib/node/accounts/webSocketDriftClientAccountSubscriberV2.d.ts +3 -3
  192. package/lib/node/accounts/webSocketDriftClientAccountSubscriberV2.d.ts.map +1 -1
  193. package/lib/node/accounts/webSocketDriftClientAccountSubscriberV2.js +2 -2
  194. package/lib/node/accounts/webSocketInsuranceFundStakeAccountSubscriber.d.ts +3 -3
  195. package/lib/node/accounts/webSocketInsuranceFundStakeAccountSubscriber.d.ts.map +1 -1
  196. package/lib/node/accounts/webSocketProgramAccountSubscriber.d.ts +3 -3
  197. package/lib/node/accounts/webSocketProgramAccountSubscriber.d.ts.map +1 -1
  198. package/lib/node/accounts/webSocketProgramAccountSubscriberV2.d.ts +3 -3
  199. package/lib/node/accounts/webSocketProgramAccountSubscriberV2.d.ts.map +1 -1
  200. package/lib/node/accounts/webSocketProgramAccountsSubscriberV2.d.ts +3 -3
  201. package/lib/node/accounts/webSocketProgramAccountsSubscriberV2.d.ts.map +1 -1
  202. package/lib/node/accounts/webSocketUserAccountSubscriber.d.ts +3 -3
  203. package/lib/node/accounts/webSocketUserAccountSubscriber.d.ts.map +1 -1
  204. package/lib/node/accounts/webSocketUserStatsAccountSubsriber.d.ts +3 -3
  205. package/lib/node/accounts/webSocketUserStatsAccountSubsriber.d.ts.map +1 -1
  206. package/lib/node/accounts/websocketProgramUserAccountSubscriber.d.ts +2 -2
  207. package/lib/node/accounts/websocketProgramUserAccountSubscriber.d.ts.map +1 -1
  208. package/lib/node/addresses/pda.d.ts +6 -2
  209. package/lib/node/addresses/pda.d.ts.map +1 -1
  210. package/lib/node/addresses/pda.js +7 -12
  211. package/lib/node/adminClient.d.ts +11 -9
  212. package/lib/node/adminClient.d.ts.map +1 -1
  213. package/lib/node/adminClient.js +30 -72
  214. package/lib/node/auctionSubscriber/auctionSubscriber.d.ts.map +1 -1
  215. package/lib/node/auctionSubscriber/auctionSubscriber.js +1 -1
  216. package/lib/node/auctionSubscriber/auctionSubscriberGrpc.d.ts.map +1 -1
  217. package/lib/node/auctionSubscriber/auctionSubscriberGrpc.js +1 -1
  218. package/lib/node/config.d.ts +7 -3
  219. package/lib/node/config.d.ts.map +1 -1
  220. package/lib/node/config.js +9 -7
  221. package/lib/node/constants/index.d.ts +5 -0
  222. package/lib/node/constants/index.d.ts.map +1 -1
  223. package/lib/node/constants/index.js +5 -0
  224. package/lib/node/constants/numericConstants.d.ts +1 -1
  225. package/lib/node/constants/numericConstants.d.ts.map +1 -1
  226. package/lib/node/constants/numericConstants.js +3 -3
  227. package/lib/node/constants/perpMarkets.d.ts.map +1 -1
  228. package/lib/node/constants/perpMarkets.js +3 -412
  229. package/lib/node/constants/spotMarkets.d.ts.map +1 -1
  230. package/lib/node/constants/spotMarkets.js +7 -91
  231. package/lib/node/constituentMap/constituentMap.d.ts.map +1 -1
  232. package/lib/node/constituentMap/constituentMap.js +2 -2
  233. package/lib/node/constituentMap/pollingConstituentAccountSubscriber.d.ts +3 -3
  234. package/lib/node/constituentMap/pollingConstituentAccountSubscriber.d.ts.map +1 -1
  235. package/lib/node/constituentMap/webSocketConstituentAccountSubscriber.d.ts +3 -3
  236. package/lib/node/constituentMap/webSocketConstituentAccountSubscriber.d.ts.map +1 -1
  237. package/lib/node/constituentMap/webSocketConstituentAccountSubscriber.js +1 -1
  238. package/lib/node/decode/customCoder.d.ts +7 -9
  239. package/lib/node/decode/customCoder.d.ts.map +1 -1
  240. package/lib/node/decode/customCoder.js +17 -28
  241. package/lib/node/decode/user.d.ts.map +1 -1
  242. package/lib/node/decode/user.js +7 -25
  243. package/lib/node/dlob/DLOB.d.ts +12 -0
  244. package/lib/node/dlob/DLOB.d.ts.map +1 -1
  245. package/lib/node/dlob/DLOB.js +12 -0
  246. package/lib/node/dlob/orderBookLevels.d.ts.map +1 -1
  247. package/lib/node/dlob/orderBookLevels.js +1 -1
  248. package/lib/node/driftClient.d.ts +32 -59
  249. package/lib/node/driftClient.d.ts.map +1 -1
  250. package/lib/node/driftClient.js +85 -562
  251. package/lib/node/driftClientConfig.d.ts +7 -0
  252. package/lib/node/driftClientConfig.d.ts.map +1 -1
  253. package/lib/node/events/eventSubscriber.d.ts +8 -0
  254. package/lib/node/events/eventSubscriber.d.ts.map +1 -1
  255. package/lib/node/events/eventSubscriber.js +5 -2
  256. package/lib/node/events/parse.d.ts +1 -1
  257. package/lib/node/events/parse.d.ts.map +1 -1
  258. package/lib/node/factory/oracleClient.d.ts +2 -2
  259. package/lib/node/factory/oracleClient.d.ts.map +1 -1
  260. package/lib/node/factory/oracleClient.js +9 -21
  261. package/lib/node/idl/drift.d.ts +25709 -0
  262. package/lib/node/idl/drift.d.ts.map +1 -0
  263. package/lib/node/idl/drift.js +2 -0
  264. package/lib/node/idl/drift.json +20850 -15287
  265. package/lib/node/idl/pyth.d.ts +98 -0
  266. package/lib/node/idl/pyth.d.ts.map +1 -0
  267. package/lib/node/idl/pyth.js +2 -0
  268. package/lib/node/idl/token_faucet.d.ts +198 -0
  269. package/lib/node/idl/token_faucet.d.ts.map +1 -0
  270. package/lib/node/idl/token_faucet.js +2 -0
  271. package/lib/node/idl/token_faucet.json +148 -61
  272. package/lib/node/index.d.ts +13 -6
  273. package/lib/node/index.d.ts.map +1 -1
  274. package/lib/node/index.js +12 -5
  275. package/lib/node/marinade/index.d.ts +1 -1
  276. package/lib/node/marinade/index.d.ts.map +1 -1
  277. package/lib/node/marinade/index.js +2 -2
  278. package/lib/node/math/amm.d.ts +4 -5
  279. package/lib/node/math/amm.d.ts.map +1 -1
  280. package/lib/node/math/amm.js +8 -35
  281. package/lib/node/math/funding.d.ts.map +1 -1
  282. package/lib/node/math/funding.js +6 -1
  283. package/lib/node/math/margin.d.ts +3 -4
  284. package/lib/node/math/margin.d.ts.map +1 -1
  285. package/lib/node/math/margin.js +16 -47
  286. package/lib/node/math/market.d.ts +2 -2
  287. package/lib/node/math/market.d.ts.map +1 -1
  288. package/lib/node/math/market.js +10 -42
  289. package/lib/node/math/oracles.d.ts.map +1 -1
  290. package/lib/node/math/oracles.js +14 -19
  291. package/lib/node/math/position.d.ts.map +1 -1
  292. package/lib/node/math/position.js +1 -1
  293. package/lib/node/math/trade.d.ts.map +1 -1
  294. package/lib/node/math/trade.js +4 -4
  295. package/lib/node/memcmp.js +8 -8
  296. package/lib/node/openbook/openbookV2Subscriber.d.ts +1 -1
  297. package/lib/node/openbook/openbookV2Subscriber.d.ts.map +1 -1
  298. package/lib/node/openbook/openbookV2Subscriber.js +3 -3
  299. package/lib/node/oracles/oracleClientCache.d.ts +2 -2
  300. package/lib/node/oracles/oracleClientCache.d.ts.map +1 -1
  301. package/lib/node/oracles/prelaunchOracleClient.d.ts +2 -2
  302. package/lib/node/oracles/prelaunchOracleClient.d.ts.map +1 -1
  303. package/lib/node/oracles/prelaunchOracleClient.js +1 -1
  304. package/lib/node/oracles/pythLazerClient.d.ts.map +1 -1
  305. package/lib/node/oracles/pythLazerClient.js +3 -5
  306. package/lib/node/oracles/types.d.ts +6 -0
  307. package/lib/node/oracles/types.d.ts.map +1 -1
  308. package/lib/node/orderParams.d.ts +0 -1
  309. package/lib/node/orderParams.d.ts.map +1 -1
  310. package/lib/node/orderParams.js +1 -5
  311. package/lib/node/orderSubscriber/OrderSubscriber.d.ts.map +1 -1
  312. package/lib/node/orderSubscriber/OrderSubscriber.js +3 -4
  313. package/lib/node/orderSubscriber/WebsocketSubscription.js +1 -1
  314. package/lib/node/orderSubscriber/grpcSubscription.js +2 -2
  315. package/lib/node/orderSubscriber/index.d.ts +5 -0
  316. package/lib/node/orderSubscriber/index.d.ts.map +1 -1
  317. package/lib/node/orderSubscriber/index.js +5 -0
  318. package/lib/node/priorityFee/index.d.ts +5 -0
  319. package/lib/node/priorityFee/index.d.ts.map +1 -1
  320. package/lib/node/priorityFee/index.js +5 -0
  321. package/lib/node/pyth/index.d.ts +2 -2
  322. package/lib/node/pyth/index.d.ts.map +1 -1
  323. package/lib/node/pyth/types.d.ts +1 -1
  324. package/lib/node/pyth/types.d.ts.map +1 -1
  325. package/lib/node/swift/grpcSignedMsgUserAccountSubscriber.js +1 -1
  326. package/lib/node/swift/index.d.ts +7 -0
  327. package/lib/node/swift/index.d.ts.map +1 -1
  328. package/lib/node/swift/index.js +7 -0
  329. package/lib/node/swift/signedMsgUserAccountSubscriber.d.ts.map +1 -1
  330. package/lib/node/swift/signedMsgUserAccountSubscriber.js +4 -3
  331. package/lib/node/tokenFaucet.d.ts +2 -2
  332. package/lib/node/tokenFaucet.d.ts.map +1 -1
  333. package/lib/node/tokenFaucet.js +4 -4
  334. package/lib/node/tx/txHandler.d.ts +12 -0
  335. package/lib/node/tx/txHandler.d.ts.map +1 -1
  336. package/lib/node/tx/txHandler.js +12 -0
  337. package/lib/node/types.d.ts +19 -31
  338. package/lib/node/types.d.ts.map +1 -1
  339. package/lib/node/types.js +6 -11
  340. package/lib/node/user.d.ts +27 -18
  341. package/lib/node/user.d.ts.map +1 -1
  342. package/lib/node/user.js +64 -100
  343. package/lib/node/userMap/WebsocketSubscription.js +1 -1
  344. package/lib/node/userMap/grpcSubscription.js +1 -1
  345. package/lib/node/userMap/revenueShareEscrowMap.d.ts.map +1 -1
  346. package/lib/node/userMap/revenueShareEscrowMap.js +4 -4
  347. package/lib/node/userMap/userMap.d.ts.map +1 -1
  348. package/lib/node/userMap/userMap.js +4 -5
  349. package/lib/node/userMap/userStatsMap.d.ts.map +1 -1
  350. package/lib/node/userMap/userStatsMap.js +2 -3
  351. package/lib/node/userStats.d.ts +5 -0
  352. package/lib/node/userStats.d.ts.map +1 -1
  353. package/package.json +5 -7
  354. package/src/accounts/fetch.ts +18 -17
  355. package/src/accounts/grpcAccountSubscriber.ts +3 -3
  356. package/src/accounts/grpcDriftClientAccountSubscriber.ts +2 -3
  357. package/src/accounts/grpcDriftClientAccountSubscriberV2.ts +5 -6
  358. package/src/accounts/grpcInsuranceFundStakeAccountSubscriber.ts +2 -2
  359. package/src/accounts/grpcMultiAccountSubscriber.ts +4 -4
  360. package/src/accounts/grpcMultiUserAccountSubscriber.ts +4 -4
  361. package/src/accounts/grpcProgramAccountSubscriber.ts +3 -3
  362. package/src/accounts/grpcUserAccountSubscriber.ts +2 -2
  363. package/src/accounts/grpcUserStatsAccountSubscriber.ts +2 -2
  364. package/src/accounts/laserProgramAccountSubscriber.ts +3 -3
  365. package/src/accounts/oneShotUserAccountSubscriber.ts +6 -7
  366. package/src/accounts/oneShotUserStatsAccountSubscriber.ts +10 -9
  367. package/src/accounts/pollingDriftClientAccountSubscriber.ts +12 -11
  368. package/src/accounts/pollingInsuranceFundStakeAccountSubscriber.ts +11 -10
  369. package/src/accounts/pollingOracleAccountSubscriber.ts +2 -2
  370. package/src/accounts/pollingTokenAccountSubscriber.ts +2 -2
  371. package/src/accounts/pollingUserAccountSubscriber.ts +2 -2
  372. package/src/accounts/pollingUserStatsAccountSubscriber.ts +14 -14
  373. package/src/accounts/testBulkAccountLoader.ts +3 -5
  374. package/src/accounts/types.ts +10 -25
  375. package/src/accounts/webSocketAccountSubscriber.ts +5 -5
  376. package/src/accounts/webSocketAccountSubscriberV2.ts +4 -3
  377. package/src/accounts/webSocketDriftClientAccountSubscriber.ts +9 -10
  378. package/src/accounts/webSocketDriftClientAccountSubscriberV2.ts +13 -10
  379. package/src/accounts/webSocketInsuranceFundStakeAccountSubscriber.ts +3 -3
  380. package/src/accounts/webSocketProgramAccountSubscriber.ts +4 -3
  381. package/src/accounts/webSocketProgramAccountSubscriberV2.ts +4 -3
  382. package/src/accounts/webSocketProgramAccountsSubscriberV2.ts +4 -3
  383. package/src/accounts/webSocketUserAccountSubscriber.ts +3 -3
  384. package/src/accounts/webSocketUserStatsAccountSubsriber.ts +3 -3
  385. package/src/accounts/websocketProgramUserAccountSubscriber.ts +4 -4
  386. package/src/addresses/pda.ts +6 -22
  387. package/src/adminClient.ts +154 -239
  388. package/src/auctionSubscriber/auctionSubscriber.ts +5 -3
  389. package/src/auctionSubscriber/auctionSubscriberGrpc.ts +5 -3
  390. package/src/config.ts +24 -16
  391. package/src/constants/index.ts +5 -0
  392. package/src/constants/numericConstants.ts +2 -3
  393. package/src/constants/perpMarkets.ts +3 -445
  394. package/src/constants/spotMarkets.ts +7 -102
  395. package/src/constituentMap/constituentMap.ts +5 -6
  396. package/src/constituentMap/pollingConstituentAccountSubscriber.ts +3 -3
  397. package/src/constituentMap/webSocketConstituentAccountSubscriber.ts +6 -6
  398. package/src/decode/customCoder.ts +26 -35
  399. package/src/decode/user.ts +7 -25
  400. package/src/dlob/DLOB.ts +12 -0
  401. package/src/dlob/orderBookLevels.ts +0 -1
  402. package/src/driftClient.ts +245 -1091
  403. package/src/driftClientConfig.ts +7 -0
  404. package/src/events/eventSubscriber.ts +14 -2
  405. package/src/events/parse.ts +2 -2
  406. package/src/factory/oracleClient.ts +17 -28
  407. package/src/idl/drift.json +20850 -15287
  408. package/src/idl/drift.ts +25708 -0
  409. package/src/idl/pyth.ts +97 -0
  410. package/src/idl/token_faucet.json +148 -61
  411. package/src/idl/token_faucet.ts +197 -0
  412. package/src/index.ts +13 -12
  413. package/src/margin/README.md +0 -1
  414. package/src/marinade/index.ts +2 -2
  415. package/src/math/amm.ts +2 -48
  416. package/src/math/funding.ts +8 -3
  417. package/src/math/margin.ts +12 -67
  418. package/src/math/market.ts +15 -69
  419. package/src/math/oracles.ts +14 -30
  420. package/src/math/position.ts +0 -1
  421. package/src/math/trade.ts +0 -4
  422. package/src/memcmp.ts +1 -1
  423. package/src/openbook/openbookV2Subscriber.ts +1 -1
  424. package/src/oracles/oracleClientCache.ts +2 -2
  425. package/src/oracles/prelaunchOracleClient.ts +9 -8
  426. package/src/oracles/pythLazerClient.ts +10 -12
  427. package/src/oracles/types.ts +6 -0
  428. package/src/orderParams.ts +0 -5
  429. package/src/orderSubscriber/OrderSubscriber.ts +7 -6
  430. package/src/orderSubscriber/WebsocketSubscription.ts +1 -1
  431. package/src/orderSubscriber/grpcSubscription.ts +2 -2
  432. package/src/orderSubscriber/index.ts +5 -0
  433. package/src/priorityFee/index.ts +5 -0
  434. package/src/pyth/index.ts +4 -4
  435. package/src/pyth/types.ts +1 -1
  436. package/src/swift/grpcSignedMsgUserAccountSubscriber.ts +1 -1
  437. package/src/swift/index.ts +7 -0
  438. package/src/swift/signedMsgUserAccountSubscriber.ts +7 -4
  439. package/src/tokenFaucet.ts +8 -4
  440. package/src/tx/txHandler.ts +12 -0
  441. package/src/types.ts +16 -20
  442. package/src/user.ts +66 -144
  443. package/src/userMap/WebsocketSubscription.ts +1 -1
  444. package/src/userMap/grpcSubscription.ts +1 -1
  445. package/src/userMap/revenueShareEscrowMap.ts +24 -20
  446. package/src/userMap/userMap.ts +8 -7
  447. package/src/userMap/userStatsMap.ts +6 -5
  448. package/src/userStats.ts +5 -0
  449. package/tests/accounts/customizedCadenceBulkAccountLoader.test.ts +5 -4
  450. package/tests/amm/test.ts +45 -64
  451. package/tests/ci/verifyConstants.ts +23 -26
  452. package/tests/decode/test.ts +2 -4
  453. package/tests/dlob/helpers.ts +8 -15
  454. package/tests/user/helpers.ts +0 -2
  455. package/tests/user/marginCalculations.test.ts +2 -3
  456. package/tests/user/test.ts +18 -15
  457. package/lib/browser/accounts/pollingHighLeverageModeConfigAccountSubscriber.d.ts +0 -29
  458. package/lib/browser/accounts/pollingHighLeverageModeConfigAccountSubscriber.js +0 -111
  459. package/lib/browser/accounts/webSocketHighLeverageModeConfigAccountSubscriber.d.ts +0 -23
  460. package/lib/browser/accounts/webSocketHighLeverageModeConfigAccountSubscriber.js +0 -69
  461. package/lib/browser/idl/pyth_solana_receiver.json +0 -628
  462. package/lib/browser/idl/switchboard.json +0 -8354
  463. package/lib/browser/idl/switchboard_on_demand_30.json +0 -5849
  464. package/lib/browser/oracles/pythPullClient.d.ts +0 -19
  465. package/lib/browser/oracles/pythPullClient.js +0 -65
  466. package/lib/browser/oracles/switchboardClient.d.ts +0 -12
  467. package/lib/browser/oracles/switchboardClient.js +0 -40
  468. package/lib/browser/oracles/switchboardOnDemandClient.d.ts +0 -12
  469. package/lib/browser/oracles/switchboardOnDemandClient.js +0 -33
  470. package/lib/browser/util/pythOracleUtils.d.ts +0 -2
  471. package/lib/browser/util/pythOracleUtils.js +0 -15
  472. package/lib/node/accounts/pollingHighLeverageModeConfigAccountSubscriber.d.ts +0 -30
  473. package/lib/node/accounts/pollingHighLeverageModeConfigAccountSubscriber.d.ts.map +0 -1
  474. package/lib/node/accounts/pollingHighLeverageModeConfigAccountSubscriber.js +0 -111
  475. package/lib/node/accounts/webSocketHighLeverageModeConfigAccountSubscriber.d.ts +0 -24
  476. package/lib/node/accounts/webSocketHighLeverageModeConfigAccountSubscriber.d.ts.map +0 -1
  477. package/lib/node/accounts/webSocketHighLeverageModeConfigAccountSubscriber.js +0 -69
  478. package/lib/node/idl/pyth_solana_receiver.json +0 -628
  479. package/lib/node/idl/switchboard.json +0 -8354
  480. package/lib/node/idl/switchboard_on_demand_30.json +0 -5849
  481. package/lib/node/oracles/pythPullClient.d.ts +0 -20
  482. package/lib/node/oracles/pythPullClient.d.ts.map +0 -1
  483. package/lib/node/oracles/pythPullClient.js +0 -65
  484. package/lib/node/oracles/switchboardClient.d.ts +0 -13
  485. package/lib/node/oracles/switchboardClient.d.ts.map +0 -1
  486. package/lib/node/oracles/switchboardClient.js +0 -40
  487. package/lib/node/oracles/switchboardOnDemandClient.d.ts +0 -13
  488. package/lib/node/oracles/switchboardOnDemandClient.d.ts.map +0 -1
  489. package/lib/node/oracles/switchboardOnDemandClient.js +0 -33
  490. package/lib/node/util/pythOracleUtils.d.ts +0 -3
  491. package/lib/node/util/pythOracleUtils.d.ts.map +0 -1
  492. package/lib/node/util/pythOracleUtils.js +0 -15
  493. package/src/accounts/pollingHighLeverageModeConfigAccountSubscriber.ts +0 -189
  494. package/src/accounts/webSocketHighLeverageModeConfigAccountSubscriber.ts +0 -131
  495. package/src/idl/switchboard.json +0 -8354
  496. package/src/idl/switchboard_on_demand_30.json +0 -5849
  497. package/src/oracles/pythPullClient.ts +0 -112
  498. package/src/oracles/switchboardClient.ts +0 -77
  499. package/src/oracles/switchboardOnDemandClient.ts +0 -64
  500. package/src/util/pythOracleUtils.ts +0 -11
@@ -56,10 +56,7 @@ function getOracleValidity(market, oraclePriceData, oracleGuardRails, slot, orac
56
56
  isStaleForAmmLowRisk = oracleDelay.gt(oracleGuardRails.validity.slotsBeforeStaleForAmm);
57
57
  }
58
58
  let isStaleForMargin = oracleDelay.gt(new anchor_1.BN(oracleGuardRails.validity.slotsBeforeStaleForMargin));
59
- if ((0, types_1.isOneOfVariant)(market.amm.oracleSource, [
60
- 'pythStableCoinPull',
61
- 'pythLazerStableCoin',
62
- ])) {
59
+ if ((0, types_1.isVariant)(market.amm.oracleSource, 'pythLazerStableCoin')) {
63
60
  isStaleForMargin = oracleDelay.gt(new anchor_1.BN(oracleGuardRails.validity.slotsBeforeStaleForMargin).muln(3));
64
61
  }
65
62
  if (isNonPositive) {
@@ -183,21 +180,19 @@ function trimVaaSignatures(vaa, n = 3) {
183
180
  }
184
181
  exports.trimVaaSignatures = trimVaaSignatures;
185
182
  function getMultipleBetweenOracleSources(firstOracleSource, secondOracleSource) {
186
- if ((0, types_1.isVariant)(firstOracleSource, 'pythPull') &&
187
- (0, types_1.isVariant)(secondOracleSource, 'pyth1MPull')) {
188
- return { numerator: new anchor_1.BN(1000000), denominator: new anchor_1.BN(1) };
189
- }
190
- if ((0, types_1.isVariant)(firstOracleSource, 'pythPull') &&
191
- (0, types_1.isVariant)(secondOracleSource, 'pyth1KPull')) {
192
- return { numerator: new anchor_1.BN(1000), denominator: new anchor_1.BN(1) };
193
- }
194
- if ((0, types_1.isVariant)(firstOracleSource, 'pyth1MPull') &&
195
- (0, types_1.isVariant)(secondOracleSource, 'pythPull')) {
196
- return { numerator: new anchor_1.BN(1), denominator: new anchor_1.BN(1000000) };
197
- }
198
- if ((0, types_1.isVariant)(firstOracleSource, 'pyth1KPull') &&
199
- (0, types_1.isVariant)(secondOracleSource, 'pythPull')) {
200
- return { numerator: new anchor_1.BN(1), denominator: new anchor_1.BN(1000) };
183
+ if ((0, types_1.isOneOfVariant)(firstOracleSource, [
184
+ 'pythPull',
185
+ 'pyth1KPull',
186
+ 'pyth1MPull',
187
+ 'pythStableCoinPull',
188
+ ]) ||
189
+ (0, types_1.isOneOfVariant)(secondOracleSource, [
190
+ 'pythPull',
191
+ 'pyth1KPull',
192
+ 'pyth1MPull',
193
+ 'pythStableCoinPull',
194
+ ])) {
195
+ throw new Error('Pyth pull oracle support has been removed from the SDK');
201
196
  }
202
197
  if ((0, types_1.isVariant)(firstOracleSource, 'pythLazer') &&
203
198
  (0, types_1.isVariant)(secondOracleSource, 'pythLazer1M')) {
@@ -1 +1 @@
1
- {"version":3,"file":"position.d.ts","sourceRoot":"","sources":["../../../src/math/position.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AAUvC,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EACN,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EAEjB,MAAM,UAAU,CAAC;AAUlB;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACtC,MAAM,EAAE,iBAAiB,EACzB,YAAY,EAAE,YAAY,EAC1B,iBAAiB,EAAE,iBAAiB,EACpC,SAAS,UAAO,EAChB,UAAU,UAAQ,EAClB,UAAU,CAAC,EAAE,EAAE,G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B,EAAE,CAoBJ;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAC1C,MAAM,EAAE,iBAAiB,EACzB,YAAY,EAAE,YAAY,GACxB,EAAE,CAEJ;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CASnE;AAED,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CAMzE;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,YAAY,EAAE,YAAY,GAAG,EAAE,CAUtE;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,YAAY,GAAG,EAAE,CAUlE;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CACjC,YAAY,EAAE,YAAY,EAC1B,iBAAiB,UAAQ,GACvB,EAAE,CAWJ;AAED,wBAAgB,oBAAoB,CACnC,YAAY,EAAE,YAAY,GACxB,iBAAiB,CAInB;AAED,wBAAgB,wBAAwB,CACvC,YAAY,EAAE,YAAY,GACxB,iBAAiB,CAInB;AAED,wBAAgB,eAAe,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAEnE;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CAM7D"}
@@ -23,7 +23,7 @@ function calculateBaseAssetValue(market, userPosition, mmOraclePriceData, useSpr
23
23
  let prepegAmm;
24
24
  if (!skipUpdate) {
25
25
  if (market.amm.baseSpread > 0 && useSpread) {
26
- const { baseAssetReserve, quoteAssetReserve, sqrtK, newPeg } = (0, amm_1.calculateUpdatedAMMSpreadReserves)(market.amm, directionToClose, mmOraclePriceData, undefined, latestSlot);
26
+ const { baseAssetReserve, quoteAssetReserve, sqrtK, newPeg } = (0, amm_1.calculateUpdatedAMMSpreadReserves)(market.amm, directionToClose, mmOraclePriceData, latestSlot);
27
27
  prepegAmm = {
28
28
  baseAssetReserve,
29
29
  quoteAssetReserve,
@@ -1 +1 @@
1
- {"version":3,"file":"trade.d.ts","sour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CAChB,CAmRA;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gCAAgC,CAC/C,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,EAAE,EACV,SAAS,EAAE,iBAAiB,EAC5B,MAAM,EAAE,iBAAiB,EACzB,eAAe,EAAE,eAAe,EAChC,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,MAAM,EACZ,WAAW,0BAAgC,GACzC;IACF,UAAU,EAAE,EAAE,CAAC;IACf,WAAW,EAAE,EAAE,CAAC;IAChB,SAAS,EAAE,EAAE,CAAC;IACd,UAAU,EAAE,EAAE,CAAC;IACf,UAAU,EAAE,EAAE,CAAC;IACf,WAAW,EAAE,EAAE,CAAC;CAChB,CA8KA;AAED,wBAAgB,kCAAkC,CACjD,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,EAAE,EACV,SAAS,EAAE,iBAAiB,EAC5B,aAAa,EAAE,EAAE,EACjB,EAAE,EAAE,WAAW,GACb;IACF,UAAU,EAAE,EAAE,CAAC;IACf,WAAW,EAAE,EAAE,CAAC;IAChB,SAAS,EAAE,EAAE,CAAC;IACd,UAAU,EAAE,EAAE,CAAC;IACf,UAAU,EAAE,EAAE,CAAC;IACf,WAAW,EAAE,EAAE,CAAC;CAChB,CAwEA;AAED,wBAAgB,+BAA+B,CAC9C,gBAAgB,EAAE,gBAAgB,EAClC,GAAG,CAAC,EAAE,EAAE,MAsBR"}
@@ -53,7 +53,7 @@ function calculateTradeSlippage(direction, amount, market, inputAssetType = 'quo
53
53
  .div(acquiredBaseReserve.abs());
54
54
  let amm;
55
55
  if (useSpread && market.amm.baseSpread > 0) {
56
- const { baseAssetReserve, quoteAssetReserve, sqrtK, newPeg } = (0, amm_1.calculateUpdatedAMMSpreadReserves)(market.amm, direction, mmOraclePriceData, undefined, latestSlot);
56
+ const { baseAssetReserve, quoteAssetReserve, sqrtK, newPeg } = (0, amm_1.calculateUpdatedAMMSpreadReserves)(market.amm, direction, mmOraclePriceData, latestSlot);
57
57
  amm = {
58
58
  baseAssetReserve,
59
59
  quoteAssetReserve,
@@ -102,7 +102,7 @@ function calculateTradeAcquiredAmounts(direction, amount, market, inputAssetType
102
102
  const swapDirection = (0, amm_1.getSwapDirection)(inputAssetType, direction);
103
103
  let amm;
104
104
  if (useSpread && market.amm.baseSpread > 0) {
105
- const { baseAssetReserve, quoteAssetReserve, sqrtK, newPeg } = (0, amm_1.calculateUpdatedAMMSpreadReserves)(market.amm, direction, mmOraclePriceData, undefined, latestSlot);
105
+ const { baseAssetReserve, quoteAssetReserve, sqrtK, newPeg } = (0, amm_1.calculateUpdatedAMMSpreadReserves)(market.amm, direction, mmOraclePriceData, latestSlot);
106
106
  amm = {
107
107
  baseAssetReserve,
108
108
  quoteAssetReserve,
@@ -166,7 +166,7 @@ function calculateTargetPriceTrade(market, targetPrice, pct = MAXPCT, outputAsse
166
166
  let quoteAssetReserveBefore;
167
167
  let peg = market.amm.pegMultiplier;
168
168
  if (useSpread && market.amm.baseSpread > 0) {
169
- const { baseAssetReserve, quoteAssetReserve, newPeg } = (0, amm_1.calculateUpdatedAMMSpreadReserves)(market.amm, direction, mmOraclePriceData, undefined, latestSlot);
169
+ const { baseAssetReserve, quoteAssetReserve, newPeg } = (0, amm_1.calculateUpdatedAMMSpreadReserves)(market.amm, direction, mmOraclePriceData, latestSlot);
170
170
  baseAssetReserveBefore = baseAssetReserve;
171
171
  quoteAssetReserveBefore = quoteAssetReserve;
172
172
  peg = newPeg;
@@ -280,7 +280,7 @@ function calculateEstimatedPerpEntryPrice(assetType, amount, direction, market,
280
280
  const takerIsLong = (0, types_2.isVariant)(direction, 'long');
281
281
  const limitOrders = dlob[takerIsLong ? 'getRestingLimitAsks' : 'getRestingLimitBids'](market.marketIndex, slot, types_1.MarketType.PERP, mmOraclePriceData);
282
282
  const swapDirection = (0, amm_1.getSwapDirection)(assetType, direction);
283
- const { baseAssetReserve, quoteAssetReserve, sqrtK, newPeg } = (0, amm_1.calculateUpdatedAMMSpreadReserves)(market.amm, direction, mmOraclePriceData, undefined, new anchor_1.BN(slot));
283
+ const { baseAssetReserve, quoteAssetReserve, sqrtK, newPeg } = (0, amm_1.calculateUpdatedAMMSpreadReserves)(market.amm, direction, mmOraclePriceData, new anchor_1.BN(slot));
284
284
  const amm = {
285
285
  baseAssetReserve,
286
286
  quoteAssetReserve,
@@ -5,13 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getConstituentLpPoolFilter = exports.getConstituentFilter = exports.getRevenueShareEscrowFilter = exports.getSpotMarketAccountsFilter = exports.getPerpMarketAccountsFilter = exports.getSignedMsgUserOrdersFilter = exports.getUserStatsIsReferredOrReferrerFilter = exports.getUserStatsIsReferredFilter = exports.getUserStatsFilter = exports.getUsersWithPoolId = exports.getUserWithName = exports.getUserThatHasBeenLP = exports.getUserWithAuctionFilter = exports.getUserWithoutOrderFilter = exports.getUserWithOrderFilter = exports.getNonIdleUserFilter = exports.getUserFilter = void 0;
7
7
  const bs58_1 = __importDefault(require("bs58"));
8
- const anchor_1 = require("@coral-xyz/anchor");
8
+ const anchor_29_1 = require("@coral-xyz/anchor-29");
9
9
  const userName_1 = require("./userName");
10
10
  function getUserFilter() {
11
11
  return {
12
12
  memcmp: {
13
13
  offset: 0,
14
- bytes: bs58_1.default.encode(anchor_1.BorshAccountsCoder.accountDiscriminator('User')),
14
+ bytes: bs58_1.default.encode(anchor_29_1.BorshAccountsCoder.accountDiscriminator('User')),
15
15
  },
16
16
  };
17
17
  }
@@ -83,7 +83,7 @@ function getUserStatsFilter() {
83
83
  return {
84
84
  memcmp: {
85
85
  offset: 0,
86
- bytes: bs58_1.default.encode(anchor_1.BorshAccountsCoder.accountDiscriminator('UserStats')),
86
+ bytes: bs58_1.default.encode(anchor_29_1.BorshAccountsCoder.accountDiscriminator('UserStats')),
87
87
  },
88
88
  };
89
89
  }
@@ -110,7 +110,7 @@ function getSignedMsgUserOrdersFilter() {
110
110
  return {
111
111
  memcmp: {
112
112
  offset: 0,
113
- bytes: bs58_1.default.encode(anchor_1.BorshAccountsCoder.accountDiscriminator('SignedMsgUserOrders')),
113
+ bytes: bs58_1.default.encode(anchor_29_1.BorshAccountsCoder.accountDiscriminator('SignedMsgUserOrders')),
114
114
  },
115
115
  };
116
116
  }
@@ -119,7 +119,7 @@ function getPerpMarketAccountsFilter() {
119
119
  return {
120
120
  memcmp: {
121
121
  offset: 0,
122
- bytes: bs58_1.default.encode(anchor_1.BorshAccountsCoder.accountDiscriminator('PerpMarket')),
122
+ bytes: bs58_1.default.encode(anchor_29_1.BorshAccountsCoder.accountDiscriminator('PerpMarket')),
123
123
  },
124
124
  };
125
125
  }
@@ -128,7 +128,7 @@ function getSpotMarketAccountsFilter() {
128
128
  return {
129
129
  memcmp: {
130
130
  offset: 0,
131
- bytes: bs58_1.default.encode(anchor_1.BorshAccountsCoder.accountDiscriminator('SpotMarket')),
131
+ bytes: bs58_1.default.encode(anchor_29_1.BorshAccountsCoder.accountDiscriminator('SpotMarket')),
132
132
  },
133
133
  };
134
134
  }
@@ -137,7 +137,7 @@ function getRevenueShareEscrowFilter() {
137
137
  return {
138
138
  memcmp: {
139
139
  offset: 0,
140
- bytes: bs58_1.default.encode(anchor_1.BorshAccountsCoder.accountDiscriminator('RevenueShareEscrow')),
140
+ bytes: bs58_1.default.encode(anchor_29_1.BorshAccountsCoder.accountDiscriminator('RevenueShareEscrow')),
141
141
  },
142
142
  };
143
143
  }
@@ -146,7 +146,7 @@ function getConstituentFilter() {
146
146
  return {
147
147
  memcmp: {
148
148
  offset: 0,
149
- bytes: bs58_1.default.encode(anchor_1.BorshAccountsCoder.accountDiscriminator('Constituent')),
149
+ bytes: bs58_1.default.encode(anchor_29_1.BorshAccountsCoder.accountDiscriminator('Constituent')),
150
150
  },
151
151
  };
152
152
  }
@@ -1,7 +1,7 @@
1
1
  /// <reference types="bn.js" />
2
2
  import { Connection, PublicKey } from '@solana/web3.js';
3
3
  import { BulkAccountLoader } from '../accounts/bulkAccountLoader';
4
- import { BN } from '@coral-xyz/anchor';
4
+ import { BN } from '@coral-xyz/anchor-29';
5
5
  import { L2Level, L2OrderBookGenerator } from '../dlob/orderBookLevels';
6
6
  import { Market, OpenBookV2Client } from '@openbook-dex/openbook-v2';
7
7
  export type OpenbookV2SubscriberConfig = {
@@ -1 +1 @@
1
- {"version":3,"file":"openbookV2Subscriber.d.ts","sourceRoot":"","sources":["../../../src/openbook/openbookV2Subscriber.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAW,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,EAAkB,EAAE,EAAwB,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAGrE,MAAM,MAAM,0BAA0B,GAAG;IACxC,UAAU,EAAE,UAAU,CAAC;IACvB,SAAS,EAAE,SAAS,CAAC;IACrB,aAAa,EAAE,SAAS,CAAC;IACzB,mBAAmB,EAChB;QAEA,IAAI,EAAE,SAAS,CAAC;QAChB,aAAa,EAAE,iBAAiB,CAAC;KAChC,GACD;QACA,IAAI,EAAE,WAAW,CAAC;KACjB,CAAC;CACL,CAAC;AAEF,qBAAa,oBAAqB,YAAW,oBAAoB;IAChE,UAAU,EAAE,UAAU,CAAC;IACvB,SAAS,EAAE,SAAS,CAAC;IACrB,aAAa,EAAE,SAAS,CAAC;IACzB,gBAAgB,EAAE,SAAS,GAAG,WAAW,CAAC;IAC1C,aAAa,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAC7C,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE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UAAU,EAAE,UAAU,CAAC;IACvB,SAAS,EAAE,SAAS,CAAC;IACrB,aAAa,EAAE,SAAS,CAAC;IACzB,gBAAgB,EAAE,SAAS,GAAG,WAAW,CAAC;IAC1C,aAAa,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAC7C,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,MAAM,GAAG,MAAM,CAAC;IAClC,MAAM,EAAE,gBAAgB,CAAC;gBAEN,MAAM,EAAE,0BAA0B;IAaxC,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAkDhC,UAAU,IAAI,EAAE,GAAG,SAAS;IAU5B,UAAU,IAAI,EAAE,GAAG,SAAS;IAU5B,SAAS,IAAI,SAAS,CAAC,OAAO,CAAC;IAI/B,SAAS,IAAI,SAAS,CAAC,OAAO,CAAC;IAI/B,sCAAsC,CAAC,UAAU,EAAE,EAAE,GAAG,EAAE;IAI1D,kCAAkC,CAAC,WAAW,EAAE,EAAE,GAAG,EAAE;IAY7D,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC;IAe1C,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;CAkBzC"}
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.OpenbookV2Subscriber = void 0;
7
7
  const web3_js_1 = require("@solana/web3.js");
8
8
  const numericConstants_1 = require("../constants/numericConstants");
9
- const anchor_1 = require("@coral-xyz/anchor");
9
+ const anchor_29_1 = require("@coral-xyz/anchor-29");
10
10
  const openbook_v2_1 = require("@openbook-dex/openbook-v2");
11
11
  const openbook_json_1 = __importDefault(require("../idl/openbook.json"));
12
12
  class OpenbookV2Subscriber {
@@ -27,8 +27,8 @@ class OpenbookV2Subscriber {
27
27
  if (this.subscribed === true) {
28
28
  return;
29
29
  }
30
- const anchorProvider = new anchor_1.AnchorProvider(this.connection, new anchor_1.Wallet(web3_js_1.Keypair.generate()), {});
31
- const openbookV2Program = new anchor_1.Program(openbook_json_1.default, this.programId, anchorProvider);
30
+ const anchorProvider = new anchor_29_1.AnchorProvider(this.connection, new anchor_29_1.Wallet(web3_js_1.Keypair.generate()), {});
31
+ const openbookV2Program = new anchor_29_1.Program(openbook_json_1.default, this.programId, anchorProvider);
32
32
  this.client = new openbook_v2_1.OpenBookV2Client(anchorProvider);
33
33
  const market = await openbook_v2_1.Market.load(this.client, this.marketAddress);
34
34
  this.market = await market.loadOrderBook();
@@ -1,10 +1,10 @@
1
1
  import { OracleClient } from './types';
2
2
  import { OracleSource } from '../types';
3
3
  import { Connection } from '@solana/web3.js';
4
- import { Program } from '@coral-xyz/anchor';
4
+ import { DriftProgram } from '../config';
5
5
  export declare class OracleClientCache {
6
6
  cache: Map<string, OracleClient>;
7
7
  constructor();
8
- get(oracleSource: OracleSource, connection: Connection, program: Program): OracleClient;
8
+ get(oracleSource: OracleSource, connection: Connection, program: DriftProgram): OracleClient;
9
9
  }
10
10
  //# sourceMappingURL=oracleClientCache.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"oracleClientCache.d.ts","sourceRoot":"","sources":["../../../src/oracles/oracleClientCache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,qBAAa,iBAAiB;IAC7B,KAAK,4BAAmC;;IAGjC,GAAG,CACT,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,OAAO;CAWjB"}
1
+ {"version":3,"file":"oracleClientCache.d.ts","sourceRoot":"","sources":["../../../src/oracles/oracleClientCache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,qBAAa,iBAAiB;IAC7B,KAAK,4BAAmC;;IAGjC,GAAG,CACT,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,YAAY;CAWtB"}
@@ -2,11 +2,11 @@
2
2
  /// <reference types="node" />
3
3
  import { Connection, PublicKey } from '@solana/web3.js';
4
4
  import { OracleClient, OraclePriceData } from './types';
5
- import { Program } from '@coral-xyz/anchor';
5
+ import { DriftProgram } from '../config';
6
6
  export declare class PrelaunchOracleClient implements OracleClient {
7
7
  private connection;
8
8
  private program;
9
- constructor(connection: Connection, program: Program);
9
+ constructor(connection: Connection, program: DriftProgram);
10
10
  getOraclePriceData(pricePublicKey: PublicKey): Promise<OraclePriceData>;
11
11
  getOraclePriceDataFromBuffer(buffer: Buffer): OraclePriceData;
12
12
  }
@@ -1 +1 @@
1
- {"version":3,"file":"prelaunchOracleClient.d.ts","sourceRoot":"","sources":["../../../src/oracles/prelaunchOracleClient.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAG5C,qBAAa,qBAAsB,YAAW,YAAY;IACzD,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,OAAO,CAAU;gBAEN,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO;IAK9C,kBAAkB,CAC9B,cAAc,EAAE,SAAS,GACvB,OAAO,CAAC,eAAe,CAAC;IAKpB,4BAA4B,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe;CAepE"}
1
+ {"version":3,"file":"prelaunchOracleClient.d.ts","sourceRoot":"","sources":["../../../src/oracles/prelaunchOracleClient.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAGzC,qBAAa,qBAAsB,YAAW,YAAY;IACzD,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,OAAO,CAAe;gBAEX,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY;IAKnD,kBAAkB,CAC9B,cAAc,EAAE,SAAS,GACvB,OAAO,CAAC,eAAe,CAAC;IAKpB,4BAA4B,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe;CAgBpE"}
@@ -11,7 +11,7 @@ class PrelaunchOracleClient {
11
11
  return this.getOraclePriceDataFromBuffer(accountInfo.data);
12
12
  }
13
13
  getOraclePriceDataFromBuffer(buffer) {
14
- const prelaunchOracle = this.program.account.prelaunchOracle.coder.accounts.decodeUnchecked('PrelaunchOracle', buffer);
14
+ const prelaunchOracle = this.program.account.prelaunchOracle.coder.accounts.decodeUnchecked('prelaunchOracle', buffer);
15
15
  return {
16
16
  price: prelaunchOracle.price,
17
17
  slot: prelaunchOracle.ammLastUpdateSlot,
@@ -1 +1 @@
1
- {"version":3,"file":"pythLazerClient.d.ts","sourceRoot":"","sources":["../../../src/oracles/pythLazerClient.ts"],"names":[],"mappings":";;;AAAA,OAAO,EAAE,UAAU,EAAW,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,EAAkB,EAAE,EAAgB,MAAM,mBAAmB,CAAC;AAWrE,qBAAa,eAAgB,YAAW,YAAY;IACnD,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,QAAQ,CAAK;IACrB,OAAO,CAAC,UAAU,CAAU;IAC5B,OAAO,CAAC,OAAO,CAAU;IACzB,QAAQ,CAAC,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,GAAG,CAAC;gBAGxD,UAAU,EAAE,UAAU,EACtB,QAAQ,KAAM,EACd,UAAU,UAAQ;IAwBN,kBAAkB,CAC9B,cAAc,EAAE,SAAS,GACvB,OAAO,CAAC,eAAe,CAAC;IAKpB,4BAA4B,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe;CAkCpE"}
1
+ {"version":3,"file":"pythLazerClient.d.ts","sourceRoot":"","sources":["../../../src/oracles/pythLazerClient.ts"],"names":[],"mappings":";;;AAAA,OAAO,EAAE,UAAU,EAAW,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,EAAkB,EAAE,EAAW,MAAM,mBAAmB,CAAC;AAYhE,qBAAa,eAAgB,YAAW,YAAY;IACnD,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,QAAQ,CAAK;IACrB,OAAO,CAAC,UAAU,CAAU;IAC5B,OAAO,CAAC,OAAO,CAAe;IAC9B,QAAQ,CAAC,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,GAAG,CAAC;gBAGxD,UAAU,EAAE,UAAU,EACtB,QAAQ,KAAM,EACd,UAAU,UAAQ;IAqBN,kBAAkB,CAC9B,cAAc,EAAE,SAAS,GACvB,OAAO,CAAC,eAAe,CAAC;IAKpB,4BAA4B,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe;CAkCpE"}
@@ -7,7 +7,6 @@ exports.PythLazerClient = void 0;
7
7
  const web3_js_1 = require("@solana/web3.js");
8
8
  const anchor_1 = require("@coral-xyz/anchor");
9
9
  const numericConstants_1 = require("../constants/numericConstants");
10
- const config_1 = require("../config");
11
10
  const wallet_1 = require("../wallet");
12
11
  const drift_json_1 = __importDefault(require("../idl/drift.json"));
13
12
  class PythLazerClient {
@@ -20,16 +19,15 @@ class PythLazerClient {
20
19
  new wallet_1.Wallet(new web3_js_1.Keypair()), {
21
20
  commitment: connection.commitment,
22
21
  });
23
- this.program = new anchor_1.Program(drift_json_1.default, new web3_js_1.PublicKey(config_1.DRIFT_PROGRAM_ID), provider);
24
- this.decodeFunc =
25
- this.program.account.pythLazerOracle.coder.accounts.decodeUnchecked.bind(this.program.account.pythLazerOracle.coder.accounts);
22
+ this.program = new anchor_1.Program(drift_json_1.default, provider);
23
+ this.decodeFunc = this.program.account.pythLazerOracle.coder.accounts.decodeUnchecked.bind(this.program.account.pythLazerOracle.coder.accounts);
26
24
  }
27
25
  async getOraclePriceData(pricePublicKey) {
28
26
  const accountInfo = await this.connection.getAccountInfo(pricePublicKey);
29
27
  return this.getOraclePriceDataFromBuffer(accountInfo.data);
30
28
  }
31
29
  getOraclePriceDataFromBuffer(buffer) {
32
- const priceData = this.decodeFunc('PythLazerOracle', buffer);
30
+ const priceData = this.decodeFunc('pythLazerOracle', buffer);
33
31
  const confidence = convertPythPrice(priceData.conf, priceData.exponent, this.multiple);
34
32
  let price = convertPythPrice(priceData.price, priceData.exponent, this.multiple);
35
33
  if (this.stableCoin) {
@@ -1,6 +1,12 @@
1
1
  /// <reference types="bn.js" />
2
2
  /// <reference types="node" />
3
3
  /// <reference types="node" />
4
+ /**
5
+ * Oracle types and the OraclePriceData interface used throughout the SDK.
6
+ * Each oracle source (Pyth, Switchboard, Pyth Lazer, Prelaunch) has a client adapter
7
+ * in this directory that fetches and normalises prices into OraclePriceData.
8
+ * Oracle client selection is configured via DriftClientConfig and cached in OracleClientCache.
9
+ */
4
10
  import { BN } from '@coral-xyz/anchor';
5
11
  import { PublicKey } from '@solana/web3.js';
6
12
  import { OracleSource } from '../types';
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/oracles/types.ts"],"names":[],"mappings":";;;AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,MAAM,iBAAiB,GAAG,IAAI,CACnC,eAAe,EACf,MAAM,GAAG,gBAAgB,GAAG,UAAU,CACtC,GAAG;IACH,gBAAgB,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC7B,KAAK,EAAE,EAAE,CAAC;IACV,IAAI,EAAE,EAAE,CAAC;IACT,UAAU,EAAE,EAAE,CAAC;IACf,+BAA+B,EAAE,OAAO,CAAC;IACzC,IAAI,CAAC,EAAE,EAAE,CAAC;IACV,cAAc,CAAC,EAAE,EAAE,CAAC;IACpB,QAAQ,CAAC,EAAE,EAAE,CAAC;IACd,UAAU,CAAC,EAAE,EAAE,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACxB,SAAS,EAAE,SAAS,CAAC;IACrB,MAAM,EAAE,YAAY,CAAC;CACrB,CAAC;AAEF,MAAM,WAAW,YAAY;IAC5B,4BAA4B,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe,CAAC;IAC9D,kBAAkB,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;CACnE"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/oracles/types.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,OAAO,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,MAAM,iBAAiB,GAAG,IAAI,CACnC,eAAe,EACf,MAAM,GAAG,gBAAgB,GAAG,UAAU,CACtC,GAAG;IACH,gBAAgB,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC7B,KAAK,EAAE,EAAE,CAAC;IACV,IAAI,EAAE,EAAE,CAAC;IACT,UAAU,EAAE,EAAE,CAAC;IACf,+BAA+B,EAAE,OAAO,CAAC;IACzC,IAAI,CAAC,EAAE,EAAE,CAAC;IACV,cAAc,CAAC,EAAE,EAAE,CAAC;IACpB,QAAQ,CAAC,EAAE,EAAE,CAAC;IACd,UAAU,CAAC,EAAE,EAAE,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACxB,SAAS,EAAE,SAAS,CAAC;IACrB,MAAM,EAAE,YAAY,CAAC;CACrB,CAAC;AAEF,MAAM,WAAW,YAAY;IAC5B,4BAA4B,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe,CAAC;IAC9D,kBAAkB,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;CACnE"}
@@ -27,5 +27,4 @@ export declare function getMarketOrderParams(params: Omit<OptionalOrderParams, '
27
27
  * @returns
28
28
  */
29
29
  export declare function getOrderParams(optionalOrderParams: OptionalOrderParams, overridingParams?: Record<string, any>): OrderParams;
30
- export declare function isUpdateHighLeverageMode(bitFlags: number): boolean;
31
30
  //# sourceMappingURL=orderParams.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"orderParams.d.ts","sourceRoot":"","sources":["../../src/orderParams.ts"],"names":[],"mappings":";AAAA,OAAO,EAEN,mBAAmB,EACnB,WAAW,EAEX,qBAAqB,EAErB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AAEvC,wBAAgB,mBAAmB,CAClC,MAAM,EAAE,IAAI,CAAC,mBAAmB,EAAE,WAAW,CAAC,GAAG;IAAE,KAAK,EAAE,EAAE,CAAA;CAAE,GAC5D,mBAAmB,CAMrB;AAED,wBAAgB,2BAA2B,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AAE,IAAI,CAAC,mBAAmB,EAAE,WAAW,CAAC,GAAG;IAChD,gBAAgB,EAAE,qBAAqB,CAAC;IACxC,YAAY,EAAE,EAAE,CAAC;IACjB,KAAK,EAAE,EAAE,CAAC;CACV,GACC,mBAAmB,CAMrB;AAED,wBAAgB,oBAAoB,CACnC,MAAM,EAAE,IAAI,CAAC,mBAAmB,EAAE,WAAW,CAAC,GAC5C,mBAAmB,CAMrB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAC7B,mBAAmB,EAAE,mBAAmB,EACxC,gBAAgB,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,GACxC,WAAW,CAOb"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isUpdateHighLeverageMode = exports.getOrderParams = exports.getMarketOrderParams = exports.getTriggerLimitOrderParams = exports.getTriggerMarketOrderParams = exports.getLimitOrderParams = void 0;
3
+ exports.getOrderParams = exports.getMarketOrderParams = exports.getTriggerLimitOrderParams = exports.getTriggerMarketOrderParams = exports.getLimitOrderParams = void 0;
4
4
  const types_1 = require("./types");
5
5
  function getLimitOrderParams(params) {
6
6
  return getOrderParams(Object.assign({}, params, {
@@ -42,7 +42,3 @@ function getOrderParams(optionalOrderParams, overridingParams = {}) {
42
42
  return Object.assign({}, types_1.DefaultOrderParams, optionalOrderParams, overridingParams);
43
43
  }
44
44
  exports.getOrderParams = getOrderParams;
45
- function isUpdateHighLeverageMode(bitFlags) {
46
- return (bitFlags & types_1.OrderParamsBitFlag.UpdateHighLeverageMode) !== 0;
47
- }
48
- exports.isUpdateHighLeverageMode = isUpdateHighLeverageMode;
@@ -1 +1 @@
1
- {"version":3,"file":"OrderSubscriber.d.ts","sourceRoot":"","sources":["../../../src/orderSubscriber/OrderSubscriber.ts"],"names":[],"mappings":";;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,WAAW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AAG,OAAO,CAAC,WAAW,CAAC;IAOrD,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;CAIzC"}
@@ -56,8 +56,7 @@ class OrderSubscriber {
56
56
  this.decodeFn = (name, data) => (0, user_1.decodeUser)(data);
57
57
  }
58
58
  else {
59
- this.decodeFn =
60
- this.driftClient.program.account.user.coder.accounts.decodeUnchecked.bind(this.driftClient.program.account.user.coder.accounts);
59
+ this.decodeFn = this.driftClient.program.account.user.coder.accounts.decodeUnchecked.bind(this.driftClient.program.account.user.coder.accounts);
61
60
  }
62
61
  this.eventEmitter = new events_1.EventEmitter();
63
62
  this.fetchAllNonIdleUsers = config.fetchAllNonIdleUsers;
@@ -122,7 +121,7 @@ class OrderSubscriber {
122
121
  slotAndUserAccount.userAccount.lastActiveSlot.gt(newLastActiveSlot)) {
123
122
  return;
124
123
  }
125
- userAccount = this.decodeFn('User', buffer);
124
+ userAccount = this.decodeFn('user', buffer);
126
125
  }
127
126
  else if (dataType === 'buffer') {
128
127
  const buffer = data;
@@ -131,7 +130,7 @@ class OrderSubscriber {
131
130
  slotAndUserAccount.userAccount.lastActiveSlot.gt(newLastActiveSlot)) {
132
131
  return;
133
132
  }
134
- userAccount = this.decodeFn('User', data);
133
+ userAccount = this.decodeFn('user', data);
135
134
  }
136
135
  else {
137
136
  userAccount = data;
@@ -16,7 +16,7 @@ class WebsocketSubscription {
16
16
  if (this.subscriber) {
17
17
  return;
18
18
  }
19
- this.subscriber = new webSocketProgramAccountSubscriber_1.WebSocketProgramAccountSubscriber('OrderSubscriber', 'User', this.orderSubscriber.driftClient.program, this.orderSubscriber.decodeFn, {
19
+ this.subscriber = new webSocketProgramAccountSubscriber_1.WebSocketProgramAccountSubscriber('OrderSubscriber', 'user', this.orderSubscriber.driftClient.program, this.orderSubscriber.decodeFn, {
20
20
  filters: [(0, memcmp_1.getUserFilter)(), (0, memcmp_1.getNonIdleUserFilter)()],
21
21
  commitment: this.commitment,
22
22
  }, this.resubOpts);
@@ -19,12 +19,12 @@ class grpcSubscription {
19
19
  }
20
20
  if (this.grpcConfigs.client === 'laser') {
21
21
  this.subscriber =
22
- await laserProgramAccountSubscriber_1.LaserstreamProgramAccountSubscriber.create(this.grpcConfigs, 'OrderSubscriber', 'User', this.orderSubscriber.driftClient.program, this.orderSubscriber.decodeFn, {
22
+ await laserProgramAccountSubscriber_1.LaserstreamProgramAccountSubscriber.create(this.grpcConfigs, 'OrderSubscriber', 'user', this.orderSubscriber.driftClient.program, this.orderSubscriber.decodeFn, {
23
23
  filters: [(0, memcmp_1.getUserFilter)(), (0, memcmp_1.getNonIdleUserFilter)()],
24
24
  }, this.resubOpts);
25
25
  }
26
26
  else {
27
- this.subscriber = await grpcProgramAccountSubscriber_1.grpcProgramAccountSubscriber.create(this.grpcConfigs, 'OrderSubscriber', 'User', this.orderSubscriber.driftClient.program, this.orderSubscriber.decodeFn, {
27
+ this.subscriber = await grpcProgramAccountSubscriber_1.grpcProgramAccountSubscriber.create(this.grpcConfigs, 'OrderSubscriber', 'user', this.orderSubscriber.driftClient.program, this.orderSubscriber.decodeFn, {
28
28
  filters: [(0, memcmp_1.getUserFilter)(), (0, memcmp_1.getNonIdleUserFilter)()],
29
29
  }, this.resubOpts);
30
30
  }
@@ -1,3 +1,8 @@
1
+ /**
2
+ * OrderSubscriber — streams all open orders across all users from on-chain state.
3
+ * Used by keeper bots and the DLOB to maintain a live view of the full order book
4
+ * without subscribing to every individual User account separately.
5
+ */
1
6
  export * from './OrderSubscriber';
2
7
  export * from './types';
3
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/orderSubscriber/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/orderSubscriber/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC"}
@@ -14,5 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ /**
18
+ * OrderSubscriber — streams all open orders across all users from on-chain state.
19
+ * Used by keeper bots and the DLOB to maintain a live view of the full order book
20
+ * without subscribing to every individual User account separately.
21
+ */
17
22
  __exportStar(require("./OrderSubscriber"), exports);
18
23
  __exportStar(require("./types"), exports);
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Priority fee estimation strategies for Solana transactions.
3
+ * Implementations: average, EWMA, max-over-slots, max. Injected via DriftClientConfig.
4
+ * Select a strategy based on congestion tolerance vs. cost sensitivity.
5
+ */
1
6
  export * from './averageOverSlotsStrategy';
2
7
  export * from './averageStrategy';
3
8
  export * from './ewmaStrategy';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/priorityFee/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,eAAe,CAAC;AAC9B,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/priorityFee/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,eAAe,CAAC;AAC9B,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,SAAS,CAAC"}
@@ -14,6 +14,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ /**
18
+ * Priority fee estimation strategies for Solana transactions.
19
+ * Implementations: average, EWMA, max-over-slots, max. Injected via DriftClientConfig.
20
+ * Select a strategy based on congestion tolerance vs. cost sensitivity.
21
+ */
17
22
  __exportStar(require("./averageOverSlotsStrategy"), exports);
18
23
  __exportStar(require("./averageStrategy"), exports);
19
24
  __exportStar(require("./ewmaStrategy"), exports);
@@ -1,5 +1,5 @@
1
- export { WormholeCoreBridgeSolana, WORMHOLE_CORE_BRIDGE_SOLANA_IDL, PythSolanaReceiver, PriceUpdateAccount, } from './types';
1
+ export { type WormholeCoreBridgeSolana, WORMHOLE_CORE_BRIDGE_SOLANA_IDL, type PythSolanaReceiver, type PriceUpdateAccount, } from './types';
2
2
  export { DEFAULT_WORMHOLE_PROGRAM_ID, DEFAULT_RECEIVER_PROGRAM_ID, } from './constants';
3
3
  export { getGuardianSetPda } from './utils';
4
- export { PythLazerSubscriber, PythLazerPriceFeedArray, } from './pythLazerSubscriber';
4
+ export { PythLazerSubscriber, type PythLazerPriceFeedArray, } from './pythLazerSubscriber';
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pyth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,wBAAwB,EACxB,+BAA+B,EAC/B,kBAAkB,EAClB,kBAAkB,GAClB,MAAM,SAAS,CAAC;AACjB,OAAO,EACN,2BAA2B,EAC3B,2BAA2B,GAC3B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EACN,mBAAmB,EACnB,uBAAuB,GACvB,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pyth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,wBAAwB,EAC7B,+BAA+B,EAC/B,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,GACvB,MAAM,SAAS,CAAC;AACjB,OAAO,EACN,2BAA2B,EAC3B,2BAA2B,GAC3B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EACN,mBAAmB,EACnB,KAAK,uBAAuB,GAC5B,MAAM,uBAAuB,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { IdlAccounts } from '@coral-xyz/anchor';
1
+ import type { IdlAccounts } from '@coral-xyz/anchor-29';
2
2
  export type WormholeCoreBridgeSolana = {
3
3
  version: '0.0.1-alpha.5';
4
4
  name: 'wormhole_core_bridge_solana';