@drift-labs/sdk 2.97.0-beta.21 → 2.97.0-beta.23

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 (738) hide show
  1. package/VERSION +1 -1
  2. package/bun.lockb +0 -0
  3. package/lib/{accounts → browser/accounts}/bulkAccountLoader.d.ts +1 -0
  4. package/lib/browser/accounts/grpcAccountSubscriber.d.ts +16 -0
  5. package/lib/browser/accounts/grpcAccountSubscriber.js +154 -0
  6. package/lib/browser/accounts/grpcDriftClientAccountSubscriber.d.ts +12 -0
  7. package/lib/browser/accounts/grpcDriftClientAccountSubscriber.js +97 -0
  8. package/lib/browser/accounts/grpcInsuranceFundStakeAccountSubscriber.d.ts +10 -0
  9. package/lib/browser/accounts/grpcInsuranceFundStakeAccountSubscriber.js +30 -0
  10. package/lib/browser/accounts/grpcProgramAccountSubscriber.d.ts +18 -0
  11. package/lib/browser/accounts/grpcProgramAccountSubscriber.js +171 -0
  12. package/lib/browser/accounts/grpcUserAccountSubscriber.d.ts +10 -0
  13. package/lib/browser/accounts/grpcUserAccountSubscriber.js +28 -0
  14. package/lib/browser/accounts/grpcUserStatsAccountSubscriber.d.ts +10 -0
  15. package/lib/browser/accounts/grpcUserStatsAccountSubscriber.js +28 -0
  16. package/lib/{accounts → browser/accounts}/types.d.ts +8 -0
  17. package/lib/{accounts → browser/accounts}/webSocketAccountSubscriber.d.ts +2 -1
  18. package/lib/{accounts → browser/accounts}/webSocketDriftClientAccountSubscriber.d.ts +3 -3
  19. package/lib/{accounts → browser/accounts}/webSocketProgramAccountSubscriber.d.ts +2 -1
  20. package/lib/{addresses → browser/addresses}/pda.d.ts +1 -0
  21. package/lib/{addresses → browser/addresses}/pda.js +8 -1
  22. package/lib/browser/auctionSubscriber/auctionSubscriberGrpc.d.ts +15 -0
  23. package/lib/browser/auctionSubscriber/auctionSubscriberGrpc.js +32 -0
  24. package/lib/{auctionSubscriber → browser/auctionSubscriber}/index.d.ts +1 -0
  25. package/lib/browser/auctionSubscriber/index.js +19 -0
  26. package/lib/{auctionSubscriber → browser/auctionSubscriber}/types.d.ts +2 -0
  27. package/lib/{bankrun → browser/bankrun}/bankrunConnection.d.ts +1 -0
  28. package/lib/{decode → browser/decode}/phoenix.d.ts +1 -0
  29. package/lib/{decode → browser/decode}/user.d.ts +1 -0
  30. package/lib/{dlob → browser/dlob}/DLOBOrders.d.ts +1 -0
  31. package/lib/{driftClient.d.ts → browser/driftClient.d.ts} +11 -5
  32. package/lib/{driftClient.js → browser/driftClient.js} +132 -34
  33. package/lib/{driftClientConfig.d.ts → browser/driftClientConfig.d.ts} +6 -1
  34. package/lib/{idl → browser/idl}/drift.json +256 -0
  35. package/lib/browser/isomorphic/grpc.browser.d.ts +1 -0
  36. package/lib/browser/isomorphic/grpc.browser.js +8 -0
  37. package/lib/browser/isomorphic/grpc.d.ts +1 -0
  38. package/lib/browser/isomorphic/grpc.js +8 -0
  39. package/lib/browser/isomorphic/grpc.node.d.ts +5 -0
  40. package/lib/{math → browser/math}/oracles.d.ts +1 -0
  41. package/lib/{oracles → browser/oracles}/prelaunchOracleClient.d.ts +1 -0
  42. package/lib/{oracles → browser/oracles}/pythClient.d.ts +1 -0
  43. package/lib/{oracles → browser/oracles}/pythPullClient.d.ts +1 -0
  44. package/lib/{oracles → browser/oracles}/quoteAssetOracleClient.d.ts +1 -0
  45. package/lib/{oracles → browser/oracles}/switchboardClient.d.ts +1 -0
  46. package/lib/{oracles → browser/oracles}/switchboardOnDemandClient.d.ts +1 -0
  47. package/lib/{oracles → browser/oracles}/types.d.ts +1 -0
  48. package/lib/{orderSubscriber → browser/orderSubscriber}/OrderSubscriber.d.ts +3 -1
  49. package/lib/{orderSubscriber → browser/orderSubscriber}/OrderSubscriber.js +18 -4
  50. package/lib/browser/orderSubscriber/grpcSubscription.d.ts +22 -0
  51. package/lib/browser/orderSubscriber/grpcSubscription.js +66 -0
  52. package/lib/{orderSubscriber → browser/orderSubscriber}/types.d.ts +9 -0
  53. package/lib/{token → browser/token}/index.d.ts +1 -0
  54. package/lib/{tx → browser/tx}/baseTxSender.d.ts +1 -0
  55. package/lib/{tx → browser/tx}/fastSingleTxSender.d.ts +1 -0
  56. package/lib/{tx → browser/tx}/forwardOnlyTxSender.d.ts +1 -0
  57. package/lib/{tx → browser/tx}/retryTxSender.d.ts +1 -0
  58. package/lib/{tx → browser/tx}/types.d.ts +1 -0
  59. package/lib/{tx → browser/tx}/whileValidTxSender.d.ts +1 -0
  60. package/lib/{types.d.ts → browser/types.d.ts} +20 -0
  61. package/lib/{user.js → browser/user.js} +11 -4
  62. package/lib/{userConfig.d.ts → browser/userConfig.d.ts} +6 -1
  63. package/lib/{userMap → browser/userMap}/WebsocketSubscription.d.ts +1 -0
  64. package/lib/browser/userMap/grpcSubscription.d.ts +24 -0
  65. package/lib/browser/userMap/grpcSubscription.js +40 -0
  66. package/lib/{userMap → browser/userMap}/userMap.js +17 -1
  67. package/lib/{userMap → browser/userMap}/userMapConfig.d.ts +6 -0
  68. package/lib/{userStats.js → browser/userStats.js} +11 -4
  69. package/lib/{userStatsConfig.d.ts → browser/userStatsConfig.d.ts} +6 -0
  70. package/lib/node/accounts/basicUserAccountSubscriber.d.ts +27 -0
  71. package/lib/node/accounts/basicUserAccountSubscriber.js +38 -0
  72. package/lib/node/accounts/bulkAccountLoader.d.ts +37 -0
  73. package/lib/node/accounts/bulkAccountLoader.js +222 -0
  74. package/lib/node/accounts/bulkUserStatsSubscription.d.ts +7 -0
  75. package/lib/node/accounts/bulkUserStatsSubscription.js +21 -0
  76. package/lib/node/accounts/bulkUserSubscription.d.ts +7 -0
  77. package/lib/node/accounts/bulkUserSubscription.js +21 -0
  78. package/lib/node/accounts/fetch.d.ts +6 -0
  79. package/lib/node/accounts/fetch.js +30 -0
  80. package/lib/node/accounts/grpcAccountSubscriber.d.ts +16 -0
  81. package/lib/node/accounts/grpcAccountSubscriber.js +154 -0
  82. package/lib/node/accounts/grpcDriftClientAccountSubscriber.d.ts +12 -0
  83. package/lib/node/accounts/grpcDriftClientAccountSubscriber.js +97 -0
  84. package/lib/node/accounts/grpcInsuranceFundStakeAccountSubscriber.d.ts +10 -0
  85. package/lib/node/accounts/grpcInsuranceFundStakeAccountSubscriber.js +30 -0
  86. package/lib/node/accounts/grpcProgramAccountSubscriber.d.ts +18 -0
  87. package/lib/node/accounts/grpcProgramAccountSubscriber.js +171 -0
  88. package/lib/node/accounts/grpcUserAccountSubscriber.d.ts +10 -0
  89. package/lib/node/accounts/grpcUserAccountSubscriber.js +28 -0
  90. package/lib/node/accounts/grpcUserStatsAccountSubscriber.d.ts +10 -0
  91. package/lib/node/accounts/grpcUserStatsAccountSubscriber.js +28 -0
  92. package/lib/node/accounts/oneShotUserAccountSubscriber.d.ts +18 -0
  93. package/lib/node/accounts/oneShotUserAccountSubscriber.js +48 -0
  94. package/lib/node/accounts/pollingDriftClientAccountSubscriber.d.ts +69 -0
  95. package/lib/node/accounts/pollingDriftClientAccountSubscriber.js +415 -0
  96. package/lib/node/accounts/pollingInsuranceFundStakeAccountSubscriber.d.ts +29 -0
  97. package/lib/node/accounts/pollingInsuranceFundStakeAccountSubscriber.js +110 -0
  98. package/lib/node/accounts/pollingOracleAccountSubscriber.d.ts +27 -0
  99. package/lib/node/accounts/pollingOracleAccountSubscriber.js +78 -0
  100. package/lib/node/accounts/pollingTokenAccountSubscriber.d.ts +26 -0
  101. package/lib/node/accounts/pollingTokenAccountSubscriber.js +78 -0
  102. package/lib/node/accounts/pollingUserAccountSubscriber.d.ts +29 -0
  103. package/lib/node/accounts/pollingUserAccountSubscriber.js +102 -0
  104. package/lib/node/accounts/pollingUserStatsAccountSubscriber.d.ts +27 -0
  105. package/lib/node/accounts/pollingUserStatsAccountSubscriber.js +94 -0
  106. package/lib/node/accounts/testBulkAccountLoader.d.ts +4 -0
  107. package/lib/node/accounts/testBulkAccountLoader.js +45 -0
  108. package/lib/node/accounts/types.d.ts +155 -0
  109. package/lib/node/accounts/types.js +16 -0
  110. package/lib/node/accounts/utils.d.ts +8 -0
  111. package/lib/node/accounts/utils.js +39 -0
  112. package/lib/node/accounts/webSocketAccountSubscriber.d.ts +29 -0
  113. package/lib/node/accounts/webSocketAccountSubscriber.js +149 -0
  114. package/lib/node/accounts/webSocketDriftClientAccountSubscriber.d.ts +66 -0
  115. package/lib/node/accounts/webSocketDriftClientAccountSubscriber.js +352 -0
  116. package/lib/node/accounts/webSocketInsuranceFundStakeAccountSubscriber.d.ts +23 -0
  117. package/lib/node/accounts/webSocketInsuranceFundStakeAccountSubscriber.js +67 -0
  118. package/lib/node/accounts/webSocketProgramAccountSubscriber.d.ts +34 -0
  119. package/lib/node/accounts/webSocketProgramAccountSubscriber.js +127 -0
  120. package/lib/node/accounts/webSocketUserAccountSubscriber.d.ts +23 -0
  121. package/lib/node/accounts/webSocketUserAccountSubscriber.js +61 -0
  122. package/lib/node/accounts/webSocketUserStatsAccountSubsriber.d.ts +22 -0
  123. package/lib/node/accounts/webSocketUserStatsAccountSubsriber.js +52 -0
  124. package/lib/node/addresses/marketAddresses.d.ts +2 -0
  125. package/lib/node/addresses/marketAddresses.js +15 -0
  126. package/lib/node/addresses/pda.d.ts +30 -0
  127. package/lib/node/addresses/pda.js +193 -0
  128. package/lib/node/adminClient.d.ts +202 -0
  129. package/lib/node/adminClient.js +1826 -0
  130. package/lib/node/assert/assert.d.ts +1 -0
  131. package/lib/node/assert/assert.js +9 -0
  132. package/lib/node/auctionSubscriber/auctionSubscriber.d.ts +14 -0
  133. package/lib/node/auctionSubscriber/auctionSubscriber.js +32 -0
  134. package/lib/node/auctionSubscriber/auctionSubscriberGrpc.d.ts +15 -0
  135. package/lib/node/auctionSubscriber/auctionSubscriberGrpc.js +32 -0
  136. package/lib/node/auctionSubscriber/index.d.ts +3 -0
  137. package/lib/node/auctionSubscriber/index.js +19 -0
  138. package/lib/node/auctionSubscriber/types.d.ts +14 -0
  139. package/lib/node/auctionSubscriber/types.js +2 -0
  140. package/lib/node/bankrun/bankrunConnection.d.ts +74 -0
  141. package/lib/node/bankrun/bankrunConnection.js +318 -0
  142. package/lib/node/blockhashSubscriber/BlockhashSubscriber.d.ts +27 -0
  143. package/lib/node/blockhashSubscriber/BlockhashSubscriber.js +89 -0
  144. package/lib/node/blockhashSubscriber/index.d.ts +1 -0
  145. package/lib/node/blockhashSubscriber/index.js +17 -0
  146. package/lib/node/blockhashSubscriber/types.d.ts +7 -0
  147. package/lib/node/blockhashSubscriber/types.js +2 -0
  148. package/lib/node/clock/clockSubscriber.d.ts +31 -0
  149. package/lib/node/clock/clockSubscriber.js +80 -0
  150. package/lib/node/config.d.ts +58 -0
  151. package/lib/node/config.js +126 -0
  152. package/lib/node/constants/numericConstants.d.ts +71 -0
  153. package/lib/node/constants/numericConstants.js +75 -0
  154. package/lib/node/constants/perpMarkets.d.ts +19 -0
  155. package/lib/node/constants/perpMarkets.js +868 -0
  156. package/lib/node/constants/spotMarkets.d.ts +23 -0
  157. package/lib/node/constants/spotMarkets.js +361 -0
  158. package/lib/node/constants/txConstants.d.ts +1 -0
  159. package/lib/node/constants/txConstants.js +4 -0
  160. package/lib/node/decode/phoenix.d.ts +7 -0
  161. package/lib/node/decode/phoenix.js +159 -0
  162. package/lib/node/decode/user.d.ts +4 -0
  163. package/lib/node/decode/user.js +339 -0
  164. package/lib/node/dlob/DLOB.d.ts +166 -0
  165. package/lib/node/dlob/DLOB.js +1142 -0
  166. package/lib/node/dlob/DLOBApiClient.d.ts +14 -0
  167. package/lib/node/dlob/DLOBApiClient.js +34 -0
  168. package/lib/node/dlob/DLOBNode.d.ts +57 -0
  169. package/lib/node/dlob/DLOBNode.js +86 -0
  170. package/lib/node/dlob/DLOBOrders.d.ts +17 -0
  171. package/lib/node/dlob/DLOBOrders.js +40 -0
  172. package/lib/node/dlob/DLOBSubscriber.d.ts +54 -0
  173. package/lib/node/dlob/DLOBSubscriber.js +139 -0
  174. package/lib/node/dlob/NodeList.d.ts +27 -0
  175. package/lib/node/dlob/NodeList.js +141 -0
  176. package/lib/node/dlob/dlobIdl.json +248 -0
  177. package/lib/node/dlob/orderBookLevels.d.ts +72 -0
  178. package/lib/node/dlob/orderBookLevels.js +438 -0
  179. package/lib/node/dlob/types.d.ts +18 -0
  180. package/lib/node/dlob/types.js +2 -0
  181. package/lib/node/driftClient.d.ts +820 -0
  182. package/lib/node/driftClient.js +4487 -0
  183. package/lib/node/driftClientConfig.d.ts +49 -0
  184. package/lib/node/driftClientConfig.js +2 -0
  185. package/lib/node/events/eventList.d.ts +22 -0
  186. package/lib/node/events/eventList.js +80 -0
  187. package/lib/node/events/eventSubscriber.d.ts +46 -0
  188. package/lib/node/events/eventSubscriber.js +223 -0
  189. package/lib/node/events/eventsServerLogProvider.d.ts +21 -0
  190. package/lib/node/events/eventsServerLogProvider.js +121 -0
  191. package/lib/node/events/fetchLogs.d.ts +25 -0
  192. package/lib/node/events/fetchLogs.js +99 -0
  193. package/lib/node/events/parse.d.ts +6 -0
  194. package/lib/node/events/parse.js +106 -0
  195. package/lib/node/events/pollingLogProvider.d.ts +17 -0
  196. package/lib/node/events/pollingLogProvider.js +58 -0
  197. package/lib/node/events/sort.d.ts +2 -0
  198. package/lib/node/events/sort.js +24 -0
  199. package/lib/node/events/txEventCache.d.ts +24 -0
  200. package/lib/node/events/txEventCache.js +71 -0
  201. package/lib/node/events/types.d.ts +77 -0
  202. package/lib/node/events/types.js +30 -0
  203. package/lib/node/events/webSocketLogProvider.d.ts +24 -0
  204. package/lib/node/events/webSocketLogProvider.js +96 -0
  205. package/lib/node/factory/bigNum.d.ts +122 -0
  206. package/lib/node/factory/bigNum.js +457 -0
  207. package/lib/node/factory/oracleClient.d.ts +5 -0
  208. package/lib/node/factory/oracleClient.js +52 -0
  209. package/lib/node/idl/drift.json +13651 -0
  210. package/lib/node/idl/openbook.json +3854 -0
  211. package/lib/node/idl/pyth_solana_receiver.json +628 -0
  212. package/lib/node/idl/switchboard.json +8354 -0
  213. package/lib/node/idl/switchboard_on_demand_30.json +4541 -0
  214. package/lib/node/idl/token_faucet.json +142 -0
  215. package/lib/node/index.d.ts +112 -0
  216. package/lib/node/index.js +134 -0
  217. package/lib/node/isomorphic/grpc.browser.d.ts +1 -0
  218. package/lib/node/isomorphic/grpc.d.ts +1 -0
  219. package/lib/node/isomorphic/grpc.js +17 -0
  220. package/lib/node/isomorphic/grpc.node.d.ts +5 -0
  221. package/lib/node/isomorphic/grpc.node.js +17 -0
  222. package/lib/node/jupiter/jupiterClient.d.ts +296 -0
  223. package/lib/node/jupiter/jupiterClient.js +178 -0
  224. package/lib/node/keypair.d.ts +2 -0
  225. package/lib/node/keypair.js +28 -0
  226. package/lib/node/marinade/index.d.ts +12 -0
  227. package/lib/node/marinade/index.js +36 -0
  228. package/lib/node/marinade/types.d.ts +1963 -0
  229. package/lib/node/marinade/types.js +1965 -0
  230. package/lib/node/math/amm.d.ts +98 -0
  231. package/lib/node/math/amm.js +626 -0
  232. package/lib/node/math/auction.d.ts +23 -0
  233. package/lib/node/math/auction.js +127 -0
  234. package/lib/node/math/bankruptcy.d.ts +2 -0
  235. package/lib/node/math/bankruptcy.js +31 -0
  236. package/lib/node/math/conversion.d.ts +2 -0
  237. package/lib/node/math/conversion.js +11 -0
  238. package/lib/node/math/exchangeStatus.d.ts +6 -0
  239. package/lib/node/math/exchangeStatus.js +77 -0
  240. package/lib/node/math/fuel.d.ts +6 -0
  241. package/lib/node/math/fuel.js +55 -0
  242. package/lib/node/math/funding.d.ts +34 -0
  243. package/lib/node/math/funding.js +209 -0
  244. package/lib/node/math/insurance.d.ts +7 -0
  245. package/lib/node/math/insurance.js +73 -0
  246. package/lib/node/math/margin.d.ts +39 -0
  247. package/lib/node/math/margin.js +184 -0
  248. package/lib/node/math/market.d.ts +39 -0
  249. package/lib/node/math/market.js +163 -0
  250. package/lib/node/math/oracles.d.ts +14 -0
  251. package/lib/node/math/oracles.js +134 -0
  252. package/lib/node/math/orders.d.ts +23 -0
  253. package/lib/node/math/orders.js +216 -0
  254. package/lib/node/math/position.d.ts +54 -0
  255. package/lib/node/math/position.js +198 -0
  256. package/lib/node/math/repeg.d.ts +22 -0
  257. package/lib/node/math/repeg.js +164 -0
  258. package/lib/node/math/spotBalance.d.ts +83 -0
  259. package/lib/node/math/spotBalance.js +373 -0
  260. package/lib/node/math/spotMarket.d.ts +11 -0
  261. package/lib/node/math/spotMarket.js +49 -0
  262. package/lib/node/math/spotPosition.d.ts +19 -0
  263. package/lib/node/math/spotPosition.js +78 -0
  264. package/lib/node/math/state.d.ts +5 -0
  265. package/lib/node/math/state.js +30 -0
  266. package/lib/node/math/superStake.d.ts +167 -0
  267. package/lib/node/math/superStake.js +306 -0
  268. package/lib/node/math/tiers.d.ts +4 -0
  269. package/lib/node/math/tiers.js +52 -0
  270. package/lib/node/math/trade.d.ts +117 -0
  271. package/lib/node/math/trade.js +637 -0
  272. package/lib/node/math/utils.d.ts +23 -0
  273. package/lib/node/math/utils.js +112 -0
  274. package/lib/node/memcmp.d.ts +7 -0
  275. package/lib/node/memcmp.js +63 -0
  276. package/lib/node/openbook/openbookV2FulfillmentConfigMap.d.ts +10 -0
  277. package/lib/node/openbook/openbookV2FulfillmentConfigMap.js +17 -0
  278. package/lib/node/openbook/openbookV2Subscriber.d.ts +36 -0
  279. package/lib/node/openbook/openbookV2Subscriber.js +104 -0
  280. package/lib/node/oracles/oracleClientCache.d.ts +9 -0
  281. package/lib/node/oracles/oracleClientCache.js +19 -0
  282. package/lib/node/oracles/prelaunchOracleClient.d.ts +12 -0
  283. package/lib/node/oracles/prelaunchOracleClient.js +24 -0
  284. package/lib/node/oracles/pythClient.d.ts +15 -0
  285. package/lib/node/oracles/pythClient.js +52 -0
  286. package/lib/node/oracles/pythPullClient.d.ts +19 -0
  287. package/lib/node/oracles/pythPullClient.js +60 -0
  288. package/lib/node/oracles/quoteAssetOracleClient.d.ts +10 -0
  289. package/lib/node/oracles/quoteAssetOracleClient.js +21 -0
  290. package/lib/node/oracles/strictOraclePrice.d.ts +9 -0
  291. package/lib/node/oracles/strictOraclePrice.js +17 -0
  292. package/lib/node/oracles/switchboardClient.d.ts +12 -0
  293. package/lib/node/oracles/switchboardClient.js +40 -0
  294. package/lib/node/oracles/switchboardOnDemandClient.d.ts +12 -0
  295. package/lib/node/oracles/switchboardOnDemandClient.js +32 -0
  296. package/lib/node/oracles/types.d.ts +23 -0
  297. package/lib/node/oracles/types.js +2 -0
  298. package/lib/node/orderParams.d.ts +29 -0
  299. package/lib/node/orderParams.js +44 -0
  300. package/lib/node/orderSubscriber/OrderSubscriber.d.ts +42 -0
  301. package/lib/node/orderSubscriber/OrderSubscriber.js +179 -0
  302. package/lib/node/orderSubscriber/PollingSubscription.d.ts +12 -0
  303. package/lib/node/orderSubscriber/PollingSubscription.js +23 -0
  304. package/lib/node/orderSubscriber/WebsocketSubscription.d.ts +23 -0
  305. package/lib/node/orderSubscriber/WebsocketSubscription.js +67 -0
  306. package/lib/node/orderSubscriber/grpcSubscription.d.ts +22 -0
  307. package/lib/node/orderSubscriber/grpcSubscription.js +66 -0
  308. package/lib/node/orderSubscriber/index.d.ts +2 -0
  309. package/lib/{auctionSubscriber → node/orderSubscriber}/index.js +1 -1
  310. package/lib/node/orderSubscriber/types.d.ts +34 -0
  311. package/lib/node/orderSubscriber/types.js +2 -0
  312. package/lib/node/phoenix/phoenixFulfillmentConfigMap.d.ts +10 -0
  313. package/lib/node/phoenix/phoenixFulfillmentConfigMap.js +17 -0
  314. package/lib/node/phoenix/phoenixSubscriber.d.ts +41 -0
  315. package/lib/node/phoenix/phoenixSubscriber.js +152 -0
  316. package/lib/node/priorityFee/averageOverSlotsStrategy.d.ts +5 -0
  317. package/lib/node/priorityFee/averageOverSlotsStrategy.js +16 -0
  318. package/lib/node/priorityFee/averageStrategy.d.ts +5 -0
  319. package/lib/node/priorityFee/averageStrategy.js +11 -0
  320. package/lib/node/priorityFee/driftPriorityFeeMethod.d.ts +13 -0
  321. package/lib/node/priorityFee/driftPriorityFeeMethod.js +26 -0
  322. package/lib/node/priorityFee/ewmaStrategy.d.ts +11 -0
  323. package/lib/node/priorityFee/ewmaStrategy.js +33 -0
  324. package/lib/node/priorityFee/heliusPriorityFeeMethod.d.ts +20 -0
  325. package/lib/node/priorityFee/heliusPriorityFeeMethod.js +46 -0
  326. package/lib/node/priorityFee/index.d.ts +11 -0
  327. package/lib/node/priorityFee/index.js +27 -0
  328. package/lib/node/priorityFee/maxOverSlotsStrategy.d.ts +5 -0
  329. package/lib/node/priorityFee/maxOverSlotsStrategy.js +17 -0
  330. package/lib/node/priorityFee/maxStrategy.d.ts +7 -0
  331. package/lib/node/priorityFee/maxStrategy.js +9 -0
  332. package/lib/node/priorityFee/priorityFeeSubscriber.d.ts +46 -0
  333. package/lib/node/priorityFee/priorityFeeSubscriber.js +188 -0
  334. package/lib/node/priorityFee/priorityFeeSubscriberMap.d.ts +48 -0
  335. package/lib/node/priorityFee/priorityFeeSubscriberMap.js +88 -0
  336. package/lib/node/priorityFee/solanaPriorityFeeMethod.d.ts +6 -0
  337. package/lib/node/priorityFee/solanaPriorityFeeMethod.js +21 -0
  338. package/lib/node/priorityFee/types.d.ts +31 -0
  339. package/lib/node/priorityFee/types.js +10 -0
  340. package/lib/node/serum/serumFulfillmentConfigMap.d.ts +10 -0
  341. package/lib/node/serum/serumFulfillmentConfigMap.js +17 -0
  342. package/lib/node/serum/serumSubscriber.d.ts +32 -0
  343. package/lib/node/serum/serumSubscriber.js +107 -0
  344. package/lib/node/serum/types.d.ts +13 -0
  345. package/lib/node/serum/types.js +2 -0
  346. package/lib/node/slot/SlotSubscriber.d.ts +27 -0
  347. package/lib/node/slot/SlotSubscriber.js +71 -0
  348. package/lib/node/testClient.d.ts +8 -0
  349. package/lib/node/testClient.js +23 -0
  350. package/lib/node/token/index.d.ts +5 -0
  351. package/lib/node/token/index.js +15 -0
  352. package/lib/node/tokenFaucet.d.ts +41 -0
  353. package/lib/node/tokenFaucet.js +188 -0
  354. package/lib/node/tx/baseTxSender.d.ts +55 -0
  355. package/lib/node/tx/baseTxSender.js +288 -0
  356. package/lib/node/tx/blockhashFetcher/baseBlockhashFetcher.d.ts +8 -0
  357. package/lib/node/tx/blockhashFetcher/baseBlockhashFetcher.js +13 -0
  358. package/lib/node/tx/blockhashFetcher/cachedBlockhashFetcher.d.ts +28 -0
  359. package/lib/node/tx/blockhashFetcher/cachedBlockhashFetcher.js +73 -0
  360. package/lib/node/tx/blockhashFetcher/types.d.ts +4 -0
  361. package/lib/node/tx/blockhashFetcher/types.js +2 -0
  362. package/lib/node/tx/fastSingleTxSender.d.ts +40 -0
  363. package/lib/node/tx/fastSingleTxSender.js +85 -0
  364. package/lib/node/tx/forwardOnlyTxSender.d.ts +36 -0
  365. package/lib/node/tx/forwardOnlyTxSender.js +91 -0
  366. package/lib/node/tx/priorityFeeCalculator.d.ts +44 -0
  367. package/lib/node/tx/priorityFeeCalculator.js +85 -0
  368. package/lib/node/tx/reportTransactionError.d.ts +20 -0
  369. package/lib/node/tx/reportTransactionError.js +103 -0
  370. package/lib/node/tx/retryTxSender.d.ts +36 -0
  371. package/lib/node/tx/retryTxSender.js +85 -0
  372. package/lib/node/tx/txHandler.d.ts +154 -0
  373. package/lib/node/tx/txHandler.js +453 -0
  374. package/lib/node/tx/txParamProcessor.d.ts +25 -0
  375. package/lib/node/tx/txParamProcessor.js +88 -0
  376. package/lib/node/tx/types.d.ts +29 -0
  377. package/lib/node/tx/types.js +20 -0
  378. package/lib/node/tx/utils.d.ts +2 -0
  379. package/lib/node/tx/utils.js +10 -0
  380. package/lib/node/tx/whileValidTxSender.d.ts +43 -0
  381. package/lib/node/tx/whileValidTxSender.js +165 -0
  382. package/lib/node/types.d.ts +1351 -0
  383. package/lib/node/types.js +347 -0
  384. package/lib/node/user.d.ts +411 -0
  385. package/lib/node/user.js +2161 -0
  386. package/lib/node/userConfig.d.ts +26 -0
  387. package/lib/node/userConfig.js +2 -0
  388. package/lib/node/userMap/PollingSubscription.d.ts +16 -0
  389. package/lib/node/userMap/PollingSubscription.js +30 -0
  390. package/lib/node/userMap/WebsocketSubscription.d.ts +25 -0
  391. package/lib/node/userMap/WebsocketSubscription.js +41 -0
  392. package/lib/node/userMap/grpcSubscription.d.ts +24 -0
  393. package/lib/node/userMap/grpcSubscription.js +40 -0
  394. package/lib/node/userMap/userMap.d.ts +88 -0
  395. package/lib/node/userMap/userMap.js +455 -0
  396. package/lib/node/userMap/userMapConfig.d.ts +37 -0
  397. package/lib/node/userMap/userMapConfig.js +2 -0
  398. package/lib/node/userMap/userStatsMap.d.ts +46 -0
  399. package/lib/node/userMap/userStatsMap.js +165 -0
  400. package/lib/node/userName.d.ts +5 -0
  401. package/lib/node/userName.js +21 -0
  402. package/lib/node/userStats.d.ts +19 -0
  403. package/lib/node/userStats.js +65 -0
  404. package/lib/node/userStatsConfig.d.ts +25 -0
  405. package/lib/node/userStatsConfig.js +2 -0
  406. package/lib/node/util/TransactionConfirmationManager.d.ts +16 -0
  407. package/lib/node/util/TransactionConfirmationManager.js +174 -0
  408. package/lib/node/util/chainClock.d.ts +17 -0
  409. package/lib/node/util/chainClock.js +29 -0
  410. package/lib/node/util/computeUnits.d.ts +8 -0
  411. package/lib/node/util/computeUnits.js +46 -0
  412. package/lib/node/util/promiseTimeout.d.ts +1 -0
  413. package/lib/node/util/promiseTimeout.js +14 -0
  414. package/lib/node/util/pythPullOracleUtils.d.ts +2 -0
  415. package/lib/node/util/pythPullOracleUtils.js +15 -0
  416. package/lib/node/util/tps.d.ts +2 -0
  417. package/lib/node/util/tps.js +16 -0
  418. package/lib/node/wallet.d.ts +11 -0
  419. package/lib/node/wallet.js +32 -0
  420. package/package.json +8 -4
  421. package/scripts/postbuild.js +61 -0
  422. package/src/accounts/grpcAccountSubscriber.ts +160 -0
  423. package/src/accounts/grpcDriftClientAccountSubscriber.ts +197 -0
  424. package/src/accounts/grpcInsuranceFundStakeAccountSubscriber.ts +56 -0
  425. package/src/accounts/grpcProgramAccountSubscriber.ts +190 -0
  426. package/src/accounts/grpcUserAccountSubscriber.ts +48 -0
  427. package/src/accounts/grpcUserStatsAccountSubscriber.ts +50 -0
  428. package/src/accounts/types.ts +8 -0
  429. package/src/accounts/webSocketAccountSubscriber.ts +1 -1
  430. package/src/accounts/webSocketDriftClientAccountSubscriber.ts +3 -3
  431. package/src/accounts/webSocketProgramAccountSubscriber.ts +1 -1
  432. package/src/addresses/pda.ts +13 -0
  433. package/src/auctionSubscriber/auctionSubscriberGrpc.ts +70 -0
  434. package/src/auctionSubscriber/index.ts +1 -0
  435. package/src/auctionSubscriber/types.ts +2 -0
  436. package/src/driftClient.ts +175 -24
  437. package/src/driftClientConfig.ts +7 -1
  438. package/src/idl/drift.json +256 -0
  439. package/src/isomorphic/README.md +19 -0
  440. package/src/isomorphic/grpc.browser.ts +4 -0
  441. package/src/isomorphic/grpc.node.ts +23 -0
  442. package/src/isomorphic/grpc.ts +1 -0
  443. package/src/orderSubscriber/OrderSubscriber.ts +14 -1
  444. package/src/orderSubscriber/grpcSubscription.ts +121 -0
  445. package/src/orderSubscriber/types.ts +10 -0
  446. package/src/types.ts +23 -0
  447. package/src/user.ts +11 -0
  448. package/src/userConfig.ts +7 -1
  449. package/src/userMap/grpcSubscription.ts +78 -0
  450. package/src/userMap/userMap.ts +21 -2
  451. package/src/userMap/userMapConfig.ts +7 -0
  452. package/src/userStats.ts +11 -0
  453. package/src/userStatsConfig.ts +7 -0
  454. package/tsconfig.browser.json +13 -0
  455. package/tsconfig.json +1 -1
  456. /package/lib/{accounts → browser/accounts}/basicUserAccountSubscriber.d.ts +0 -0
  457. /package/lib/{accounts → browser/accounts}/basicUserAccountSubscriber.js +0 -0
  458. /package/lib/{accounts → browser/accounts}/bulkAccountLoader.js +0 -0
  459. /package/lib/{accounts → browser/accounts}/bulkUserStatsSubscription.d.ts +0 -0
  460. /package/lib/{accounts → browser/accounts}/bulkUserStatsSubscription.js +0 -0
  461. /package/lib/{accounts → browser/accounts}/bulkUserSubscription.d.ts +0 -0
  462. /package/lib/{accounts → browser/accounts}/bulkUserSubscription.js +0 -0
  463. /package/lib/{accounts → browser/accounts}/fetch.d.ts +0 -0
  464. /package/lib/{accounts → browser/accounts}/fetch.js +0 -0
  465. /package/lib/{accounts → browser/accounts}/oneShotUserAccountSubscriber.d.ts +0 -0
  466. /package/lib/{accounts → browser/accounts}/oneShotUserAccountSubscriber.js +0 -0
  467. /package/lib/{accounts → browser/accounts}/pollingDriftClientAccountSubscriber.d.ts +0 -0
  468. /package/lib/{accounts → browser/accounts}/pollingDriftClientAccountSubscriber.js +0 -0
  469. /package/lib/{accounts → browser/accounts}/pollingInsuranceFundStakeAccountSubscriber.d.ts +0 -0
  470. /package/lib/{accounts → browser/accounts}/pollingInsuranceFundStakeAccountSubscriber.js +0 -0
  471. /package/lib/{accounts → browser/accounts}/pollingOracleAccountSubscriber.d.ts +0 -0
  472. /package/lib/{accounts → browser/accounts}/pollingOracleAccountSubscriber.js +0 -0
  473. /package/lib/{accounts → browser/accounts}/pollingTokenAccountSubscriber.d.ts +0 -0
  474. /package/lib/{accounts → browser/accounts}/pollingTokenAccountSubscriber.js +0 -0
  475. /package/lib/{accounts → browser/accounts}/pollingUserAccountSubscriber.d.ts +0 -0
  476. /package/lib/{accounts → browser/accounts}/pollingUserAccountSubscriber.js +0 -0
  477. /package/lib/{accounts → browser/accounts}/pollingUserStatsAccountSubscriber.d.ts +0 -0
  478. /package/lib/{accounts → browser/accounts}/pollingUserStatsAccountSubscriber.js +0 -0
  479. /package/lib/{accounts → browser/accounts}/testBulkAccountLoader.d.ts +0 -0
  480. /package/lib/{accounts → browser/accounts}/testBulkAccountLoader.js +0 -0
  481. /package/lib/{accounts → browser/accounts}/types.js +0 -0
  482. /package/lib/{accounts → browser/accounts}/utils.d.ts +0 -0
  483. /package/lib/{accounts → browser/accounts}/utils.js +0 -0
  484. /package/lib/{accounts → browser/accounts}/webSocketAccountSubscriber.js +0 -0
  485. /package/lib/{accounts → browser/accounts}/webSocketDriftClientAccountSubscriber.js +0 -0
  486. /package/lib/{accounts → browser/accounts}/webSocketInsuranceFundStakeAccountSubscriber.d.ts +0 -0
  487. /package/lib/{accounts → browser/accounts}/webSocketInsuranceFundStakeAccountSubscriber.js +0 -0
  488. /package/lib/{accounts → browser/accounts}/webSocketProgramAccountSubscriber.js +0 -0
  489. /package/lib/{accounts → browser/accounts}/webSocketUserAccountSubscriber.d.ts +0 -0
  490. /package/lib/{accounts → browser/accounts}/webSocketUserAccountSubscriber.js +0 -0
  491. /package/lib/{accounts → browser/accounts}/webSocketUserStatsAccountSubsriber.d.ts +0 -0
  492. /package/lib/{accounts → browser/accounts}/webSocketUserStatsAccountSubsriber.js +0 -0
  493. /package/lib/{addresses → browser/addresses}/marketAddresses.d.ts +0 -0
  494. /package/lib/{addresses → browser/addresses}/marketAddresses.js +0 -0
  495. /package/lib/{adminClient.d.ts → browser/adminClient.d.ts} +0 -0
  496. /package/lib/{adminClient.js → browser/adminClient.js} +0 -0
  497. /package/lib/{assert → browser/assert}/assert.d.ts +0 -0
  498. /package/lib/{assert → browser/assert}/assert.js +0 -0
  499. /package/lib/{auctionSubscriber → browser/auctionSubscriber}/auctionSubscriber.d.ts +0 -0
  500. /package/lib/{auctionSubscriber → browser/auctionSubscriber}/auctionSubscriber.js +0 -0
  501. /package/lib/{auctionSubscriber → browser/auctionSubscriber}/types.js +0 -0
  502. /package/lib/{bankrun → browser/bankrun}/bankrunConnection.js +0 -0
  503. /package/lib/{blockhashSubscriber → browser/blockhashSubscriber}/BlockhashSubscriber.d.ts +0 -0
  504. /package/lib/{blockhashSubscriber → browser/blockhashSubscriber}/BlockhashSubscriber.js +0 -0
  505. /package/lib/{blockhashSubscriber → browser/blockhashSubscriber}/index.d.ts +0 -0
  506. /package/lib/{blockhashSubscriber → browser/blockhashSubscriber}/index.js +0 -0
  507. /package/lib/{blockhashSubscriber → browser/blockhashSubscriber}/types.d.ts +0 -0
  508. /package/lib/{blockhashSubscriber → browser/blockhashSubscriber}/types.js +0 -0
  509. /package/lib/{clock → browser/clock}/clockSubscriber.d.ts +0 -0
  510. /package/lib/{clock → browser/clock}/clockSubscriber.js +0 -0
  511. /package/lib/{config.d.ts → browser/config.d.ts} +0 -0
  512. /package/lib/{config.js → browser/config.js} +0 -0
  513. /package/lib/{constants → browser/constants}/numericConstants.d.ts +0 -0
  514. /package/lib/{constants → browser/constants}/numericConstants.js +0 -0
  515. /package/lib/{constants → browser/constants}/perpMarkets.d.ts +0 -0
  516. /package/lib/{constants → browser/constants}/perpMarkets.js +0 -0
  517. /package/lib/{constants → browser/constants}/spotMarkets.d.ts +0 -0
  518. /package/lib/{constants → browser/constants}/spotMarkets.js +0 -0
  519. /package/lib/{constants → browser/constants}/txConstants.d.ts +0 -0
  520. /package/lib/{constants → browser/constants}/txConstants.js +0 -0
  521. /package/lib/{decode → browser/decode}/phoenix.js +0 -0
  522. /package/lib/{decode → browser/decode}/user.js +0 -0
  523. /package/lib/{dlob → browser/dlob}/DLOB.d.ts +0 -0
  524. /package/lib/{dlob → browser/dlob}/DLOB.js +0 -0
  525. /package/lib/{dlob → browser/dlob}/DLOBApiClient.d.ts +0 -0
  526. /package/lib/{dlob → browser/dlob}/DLOBApiClient.js +0 -0
  527. /package/lib/{dlob → browser/dlob}/DLOBNode.d.ts +0 -0
  528. /package/lib/{dlob → browser/dlob}/DLOBNode.js +0 -0
  529. /package/lib/{dlob → browser/dlob}/DLOBOrders.js +0 -0
  530. /package/lib/{dlob → browser/dlob}/DLOBSubscriber.d.ts +0 -0
  531. /package/lib/{dlob → browser/dlob}/DLOBSubscriber.js +0 -0
  532. /package/lib/{dlob → browser/dlob}/NodeList.d.ts +0 -0
  533. /package/lib/{dlob → browser/dlob}/NodeList.js +0 -0
  534. /package/lib/{dlob → browser/dlob}/dlobIdl.json +0 -0
  535. /package/lib/{dlob → browser/dlob}/orderBookLevels.d.ts +0 -0
  536. /package/lib/{dlob → browser/dlob}/orderBookLevels.js +0 -0
  537. /package/lib/{dlob → browser/dlob}/types.d.ts +0 -0
  538. /package/lib/{dlob → browser/dlob}/types.js +0 -0
  539. /package/lib/{driftClientConfig.js → browser/driftClientConfig.js} +0 -0
  540. /package/lib/{events → browser/events}/eventList.d.ts +0 -0
  541. /package/lib/{events → browser/events}/eventList.js +0 -0
  542. /package/lib/{events → browser/events}/eventSubscriber.d.ts +0 -0
  543. /package/lib/{events → browser/events}/eventSubscriber.js +0 -0
  544. /package/lib/{events → browser/events}/eventsServerLogProvider.d.ts +0 -0
  545. /package/lib/{events → browser/events}/eventsServerLogProvider.js +0 -0
  546. /package/lib/{events → browser/events}/fetchLogs.d.ts +0 -0
  547. /package/lib/{events → browser/events}/fetchLogs.js +0 -0
  548. /package/lib/{events → browser/events}/parse.d.ts +0 -0
  549. /package/lib/{events → browser/events}/parse.js +0 -0
  550. /package/lib/{events → browser/events}/pollingLogProvider.d.ts +0 -0
  551. /package/lib/{events → browser/events}/pollingLogProvider.js +0 -0
  552. /package/lib/{events → browser/events}/sort.d.ts +0 -0
  553. /package/lib/{events → browser/events}/sort.js +0 -0
  554. /package/lib/{events → browser/events}/txEventCache.d.ts +0 -0
  555. /package/lib/{events → browser/events}/txEventCache.js +0 -0
  556. /package/lib/{events → browser/events}/types.d.ts +0 -0
  557. /package/lib/{events → browser/events}/types.js +0 -0
  558. /package/lib/{events → browser/events}/webSocketLogProvider.d.ts +0 -0
  559. /package/lib/{events → browser/events}/webSocketLogProvider.js +0 -0
  560. /package/lib/{factory → browser/factory}/bigNum.d.ts +0 -0
  561. /package/lib/{factory → browser/factory}/bigNum.js +0 -0
  562. /package/lib/{factory → browser/factory}/oracleClient.d.ts +0 -0
  563. /package/lib/{factory → browser/factory}/oracleClient.js +0 -0
  564. /package/lib/{idl → browser/idl}/openbook.json +0 -0
  565. /package/lib/{idl → browser/idl}/pyth_solana_receiver.json +0 -0
  566. /package/lib/{idl → browser/idl}/switchboard.json +0 -0
  567. /package/lib/{idl → browser/idl}/switchboard_on_demand_30.json +0 -0
  568. /package/lib/{idl → browser/idl}/token_faucet.json +0 -0
  569. /package/lib/{index.d.ts → browser/index.d.ts} +0 -0
  570. /package/lib/{index.js → browser/index.js} +0 -0
  571. /package/lib/{jupiter → browser/jupiter}/jupiterClient.d.ts +0 -0
  572. /package/lib/{jupiter → browser/jupiter}/jupiterClient.js +0 -0
  573. /package/lib/{keypair.d.ts → browser/keypair.d.ts} +0 -0
  574. /package/lib/{keypair.js → browser/keypair.js} +0 -0
  575. /package/lib/{marinade → browser/marinade}/index.d.ts +0 -0
  576. /package/lib/{marinade → browser/marinade}/index.js +0 -0
  577. /package/lib/{marinade → browser/marinade}/types.d.ts +0 -0
  578. /package/lib/{marinade → browser/marinade}/types.js +0 -0
  579. /package/lib/{math → browser/math}/amm.d.ts +0 -0
  580. /package/lib/{math → browser/math}/amm.js +0 -0
  581. /package/lib/{math → browser/math}/auction.d.ts +0 -0
  582. /package/lib/{math → browser/math}/auction.js +0 -0
  583. /package/lib/{math → browser/math}/bankruptcy.d.ts +0 -0
  584. /package/lib/{math → browser/math}/bankruptcy.js +0 -0
  585. /package/lib/{math → browser/math}/conversion.d.ts +0 -0
  586. /package/lib/{math → browser/math}/conversion.js +0 -0
  587. /package/lib/{math → browser/math}/exchangeStatus.d.ts +0 -0
  588. /package/lib/{math → browser/math}/exchangeStatus.js +0 -0
  589. /package/lib/{math → browser/math}/fuel.d.ts +0 -0
  590. /package/lib/{math → browser/math}/fuel.js +0 -0
  591. /package/lib/{math → browser/math}/funding.d.ts +0 -0
  592. /package/lib/{math → browser/math}/funding.js +0 -0
  593. /package/lib/{math → browser/math}/insurance.d.ts +0 -0
  594. /package/lib/{math → browser/math}/insurance.js +0 -0
  595. /package/lib/{math → browser/math}/margin.d.ts +0 -0
  596. /package/lib/{math → browser/math}/margin.js +0 -0
  597. /package/lib/{math → browser/math}/market.d.ts +0 -0
  598. /package/lib/{math → browser/math}/market.js +0 -0
  599. /package/lib/{math → browser/math}/oracles.js +0 -0
  600. /package/lib/{math → browser/math}/orders.d.ts +0 -0
  601. /package/lib/{math → browser/math}/orders.js +0 -0
  602. /package/lib/{math → browser/math}/position.d.ts +0 -0
  603. /package/lib/{math → browser/math}/position.js +0 -0
  604. /package/lib/{math → browser/math}/repeg.d.ts +0 -0
  605. /package/lib/{math → browser/math}/repeg.js +0 -0
  606. /package/lib/{math → browser/math}/spotBalance.d.ts +0 -0
  607. /package/lib/{math → browser/math}/spotBalance.js +0 -0
  608. /package/lib/{math → browser/math}/spotMarket.d.ts +0 -0
  609. /package/lib/{math → browser/math}/spotMarket.js +0 -0
  610. /package/lib/{math → browser/math}/spotPosition.d.ts +0 -0
  611. /package/lib/{math → browser/math}/spotPosition.js +0 -0
  612. /package/lib/{math → browser/math}/state.d.ts +0 -0
  613. /package/lib/{math → browser/math}/state.js +0 -0
  614. /package/lib/{math → browser/math}/superStake.d.ts +0 -0
  615. /package/lib/{math → browser/math}/superStake.js +0 -0
  616. /package/lib/{math → browser/math}/tiers.d.ts +0 -0
  617. /package/lib/{math → browser/math}/tiers.js +0 -0
  618. /package/lib/{math → browser/math}/trade.d.ts +0 -0
  619. /package/lib/{math → browser/math}/trade.js +0 -0
  620. /package/lib/{math → browser/math}/utils.d.ts +0 -0
  621. /package/lib/{math → browser/math}/utils.js +0 -0
  622. /package/lib/{memcmp.d.ts → browser/memcmp.d.ts} +0 -0
  623. /package/lib/{memcmp.js → browser/memcmp.js} +0 -0
  624. /package/lib/{openbook → browser/openbook}/openbookV2FulfillmentConfigMap.d.ts +0 -0
  625. /package/lib/{openbook → browser/openbook}/openbookV2FulfillmentConfigMap.js +0 -0
  626. /package/lib/{openbook → browser/openbook}/openbookV2Subscriber.d.ts +0 -0
  627. /package/lib/{openbook → browser/openbook}/openbookV2Subscriber.js +0 -0
  628. /package/lib/{oracles → browser/oracles}/oracleClientCache.d.ts +0 -0
  629. /package/lib/{oracles → browser/oracles}/oracleClientCache.js +0 -0
  630. /package/lib/{oracles → browser/oracles}/prelaunchOracleClient.js +0 -0
  631. /package/lib/{oracles → browser/oracles}/pythClient.js +0 -0
  632. /package/lib/{oracles → browser/oracles}/pythPullClient.js +0 -0
  633. /package/lib/{oracles → browser/oracles}/quoteAssetOracleClient.js +0 -0
  634. /package/lib/{oracles → browser/oracles}/strictOraclePrice.d.ts +0 -0
  635. /package/lib/{oracles → browser/oracles}/strictOraclePrice.js +0 -0
  636. /package/lib/{oracles → browser/oracles}/switchboardClient.js +0 -0
  637. /package/lib/{oracles → browser/oracles}/switchboardOnDemandClient.js +0 -0
  638. /package/lib/{oracles → browser/oracles}/types.js +0 -0
  639. /package/lib/{orderParams.d.ts → browser/orderParams.d.ts} +0 -0
  640. /package/lib/{orderParams.js → browser/orderParams.js} +0 -0
  641. /package/lib/{orderSubscriber → browser/orderSubscriber}/PollingSubscription.d.ts +0 -0
  642. /package/lib/{orderSubscriber → browser/orderSubscriber}/PollingSubscription.js +0 -0
  643. /package/lib/{orderSubscriber → browser/orderSubscriber}/WebsocketSubscription.d.ts +0 -0
  644. /package/lib/{orderSubscriber → browser/orderSubscriber}/WebsocketSubscription.js +0 -0
  645. /package/lib/{orderSubscriber → browser/orderSubscriber}/index.d.ts +0 -0
  646. /package/lib/{orderSubscriber → browser/orderSubscriber}/index.js +0 -0
  647. /package/lib/{orderSubscriber → browser/orderSubscriber}/types.js +0 -0
  648. /package/lib/{phoenix → browser/phoenix}/phoenixFulfillmentConfigMap.d.ts +0 -0
  649. /package/lib/{phoenix → browser/phoenix}/phoenixFulfillmentConfigMap.js +0 -0
  650. /package/lib/{phoenix → browser/phoenix}/phoenixSubscriber.d.ts +0 -0
  651. /package/lib/{phoenix → browser/phoenix}/phoenixSubscriber.js +0 -0
  652. /package/lib/{priorityFee → browser/priorityFee}/averageOverSlotsStrategy.d.ts +0 -0
  653. /package/lib/{priorityFee → browser/priorityFee}/averageOverSlotsStrategy.js +0 -0
  654. /package/lib/{priorityFee → browser/priorityFee}/averageStrategy.d.ts +0 -0
  655. /package/lib/{priorityFee → browser/priorityFee}/averageStrategy.js +0 -0
  656. /package/lib/{priorityFee → browser/priorityFee}/driftPriorityFeeMethod.d.ts +0 -0
  657. /package/lib/{priorityFee → browser/priorityFee}/driftPriorityFeeMethod.js +0 -0
  658. /package/lib/{priorityFee → browser/priorityFee}/ewmaStrategy.d.ts +0 -0
  659. /package/lib/{priorityFee → browser/priorityFee}/ewmaStrategy.js +0 -0
  660. /package/lib/{priorityFee → browser/priorityFee}/heliusPriorityFeeMethod.d.ts +0 -0
  661. /package/lib/{priorityFee → browser/priorityFee}/heliusPriorityFeeMethod.js +0 -0
  662. /package/lib/{priorityFee → browser/priorityFee}/index.d.ts +0 -0
  663. /package/lib/{priorityFee → browser/priorityFee}/index.js +0 -0
  664. /package/lib/{priorityFee → browser/priorityFee}/maxOverSlotsStrategy.d.ts +0 -0
  665. /package/lib/{priorityFee → browser/priorityFee}/maxOverSlotsStrategy.js +0 -0
  666. /package/lib/{priorityFee → browser/priorityFee}/maxStrategy.d.ts +0 -0
  667. /package/lib/{priorityFee → browser/priorityFee}/maxStrategy.js +0 -0
  668. /package/lib/{priorityFee → browser/priorityFee}/priorityFeeSubscriber.d.ts +0 -0
  669. /package/lib/{priorityFee → browser/priorityFee}/priorityFeeSubscriber.js +0 -0
  670. /package/lib/{priorityFee → browser/priorityFee}/priorityFeeSubscriberMap.d.ts +0 -0
  671. /package/lib/{priorityFee → browser/priorityFee}/priorityFeeSubscriberMap.js +0 -0
  672. /package/lib/{priorityFee → browser/priorityFee}/solanaPriorityFeeMethod.d.ts +0 -0
  673. /package/lib/{priorityFee → browser/priorityFee}/solanaPriorityFeeMethod.js +0 -0
  674. /package/lib/{priorityFee → browser/priorityFee}/types.d.ts +0 -0
  675. /package/lib/{priorityFee → browser/priorityFee}/types.js +0 -0
  676. /package/lib/{serum → browser/serum}/serumFulfillmentConfigMap.d.ts +0 -0
  677. /package/lib/{serum → browser/serum}/serumFulfillmentConfigMap.js +0 -0
  678. /package/lib/{serum → browser/serum}/serumSubscriber.d.ts +0 -0
  679. /package/lib/{serum → browser/serum}/serumSubscriber.js +0 -0
  680. /package/lib/{serum → browser/serum}/types.d.ts +0 -0
  681. /package/lib/{serum → browser/serum}/types.js +0 -0
  682. /package/lib/{slot → browser/slot}/SlotSubscriber.d.ts +0 -0
  683. /package/lib/{slot → browser/slot}/SlotSubscriber.js +0 -0
  684. /package/lib/{testClient.d.ts → browser/testClient.d.ts} +0 -0
  685. /package/lib/{testClient.js → browser/testClient.js} +0 -0
  686. /package/lib/{token → browser/token}/index.js +0 -0
  687. /package/lib/{tokenFaucet.d.ts → browser/tokenFaucet.d.ts} +0 -0
  688. /package/lib/{tokenFaucet.js → browser/tokenFaucet.js} +0 -0
  689. /package/lib/{tx → browser/tx}/baseTxSender.js +0 -0
  690. /package/lib/{tx → browser/tx}/blockhashFetcher/baseBlockhashFetcher.d.ts +0 -0
  691. /package/lib/{tx → browser/tx}/blockhashFetcher/baseBlockhashFetcher.js +0 -0
  692. /package/lib/{tx → browser/tx}/blockhashFetcher/cachedBlockhashFetcher.d.ts +0 -0
  693. /package/lib/{tx → browser/tx}/blockhashFetcher/cachedBlockhashFetcher.js +0 -0
  694. /package/lib/{tx → browser/tx}/blockhashFetcher/types.d.ts +0 -0
  695. /package/lib/{tx → browser/tx}/blockhashFetcher/types.js +0 -0
  696. /package/lib/{tx → browser/tx}/fastSingleTxSender.js +0 -0
  697. /package/lib/{tx → browser/tx}/forwardOnlyTxSender.js +0 -0
  698. /package/lib/{tx → browser/tx}/priorityFeeCalculator.d.ts +0 -0
  699. /package/lib/{tx → browser/tx}/priorityFeeCalculator.js +0 -0
  700. /package/lib/{tx → browser/tx}/reportTransactionError.d.ts +0 -0
  701. /package/lib/{tx → browser/tx}/reportTransactionError.js +0 -0
  702. /package/lib/{tx → browser/tx}/retryTxSender.js +0 -0
  703. /package/lib/{tx → browser/tx}/txHandler.d.ts +0 -0
  704. /package/lib/{tx → browser/tx}/txHandler.js +0 -0
  705. /package/lib/{tx → browser/tx}/txParamProcessor.d.ts +0 -0
  706. /package/lib/{tx → browser/tx}/txParamProcessor.js +0 -0
  707. /package/lib/{tx → browser/tx}/types.js +0 -0
  708. /package/lib/{tx → browser/tx}/utils.d.ts +0 -0
  709. /package/lib/{tx → browser/tx}/utils.js +0 -0
  710. /package/lib/{tx → browser/tx}/whileValidTxSender.js +0 -0
  711. /package/lib/{types.js → browser/types.js} +0 -0
  712. /package/lib/{user.d.ts → browser/user.d.ts} +0 -0
  713. /package/lib/{userConfig.js → browser/userConfig.js} +0 -0
  714. /package/lib/{userMap → browser/userMap}/PollingSubscription.d.ts +0 -0
  715. /package/lib/{userMap → browser/userMap}/PollingSubscription.js +0 -0
  716. /package/lib/{userMap → browser/userMap}/WebsocketSubscription.js +0 -0
  717. /package/lib/{userMap → browser/userMap}/userMap.d.ts +0 -0
  718. /package/lib/{userMap → browser/userMap}/userMapConfig.js +0 -0
  719. /package/lib/{userMap → browser/userMap}/userStatsMap.d.ts +0 -0
  720. /package/lib/{userMap → browser/userMap}/userStatsMap.js +0 -0
  721. /package/lib/{userName.d.ts → browser/userName.d.ts} +0 -0
  722. /package/lib/{userName.js → browser/userName.js} +0 -0
  723. /package/lib/{userStats.d.ts → browser/userStats.d.ts} +0 -0
  724. /package/lib/{userStatsConfig.js → browser/userStatsConfig.js} +0 -0
  725. /package/lib/{util → browser/util}/TransactionConfirmationManager.d.ts +0 -0
  726. /package/lib/{util → browser/util}/TransactionConfirmationManager.js +0 -0
  727. /package/lib/{util → browser/util}/chainClock.d.ts +0 -0
  728. /package/lib/{util → browser/util}/chainClock.js +0 -0
  729. /package/lib/{util → browser/util}/computeUnits.d.ts +0 -0
  730. /package/lib/{util → browser/util}/computeUnits.js +0 -0
  731. /package/lib/{util → browser/util}/promiseTimeout.d.ts +0 -0
  732. /package/lib/{util → browser/util}/promiseTimeout.js +0 -0
  733. /package/lib/{util → browser/util}/pythPullOracleUtils.d.ts +0 -0
  734. /package/lib/{util → browser/util}/pythPullOracleUtils.js +0 -0
  735. /package/lib/{util → browser/util}/tps.d.ts +0 -0
  736. /package/lib/{util → browser/util}/tps.js +0 -0
  737. /package/lib/{wallet.d.ts → browser/wallet.d.ts} +0 -0
  738. /package/lib/{wallet.js → browser/wallet.js} +0 -0
@@ -0,0 +1,820 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="bn.js" />
3
+ /// <reference types="node" />
4
+ /// <reference types="node" />
5
+ import * as anchor from '@coral-xyz/anchor';
6
+ import { AnchorProvider, BN, Program, ProgramAccount } from '@coral-xyz/anchor';
7
+ import { Idl as Idl30, Program as Program30 } from '@coral-xyz/anchor-30';
8
+ import { DriftClientMetricsEvents, HighLeverageModeConfig, IWallet, MakerInfo, MappedRecord, MarketType, ModifyOrderPolicy, OpenbookV2FulfillmentConfigAccount, OptionalOrderParams, Order, OrderParams, OrderTriggerCondition, PerpMarketAccount, PerpMarketExtendedInfo, PhoenixV1FulfillmentConfigAccount, PlaceAndTakeOrderSuccessCondition, PositionDirection, ReferrerInfo, ReferrerNameAccount, RFQMakerOrderParams, RFQMatch, SerumV3FulfillmentConfigAccount, SettlePnlMode, SignedTxData, SpotMarketAccount, SpotPosition, StateAccount, SwapReduceOnly, SwiftOrderParamsMessage, SwiftServerMessage, TakerInfo, TxParams, UserAccount, UserStatsAccount } from './types';
9
+ import { AccountMeta, AddressLookupTableAccount, BlockhashWithExpiryBlockHeight, ConfirmOptions, Connection, Keypair, PublicKey, Signer, Transaction, TransactionInstruction, TransactionSignature, TransactionVersion, VersionedTransaction } from '@solana/web3.js';
10
+ import { TokenFaucet } from './tokenFaucet';
11
+ import { EventEmitter } from 'events';
12
+ import StrictEventEmitter from 'strict-event-emitter-types';
13
+ import { DataAndSlot, DriftClientAccountEvents, DriftClientAccountSubscriber } from './accounts/types';
14
+ import { TxSender, TxSigAndSlot } from './tx/types';
15
+ import { OraclePriceData } from './oracles/types';
16
+ import { DriftClientConfig } from './driftClientConfig';
17
+ import { User } from './user';
18
+ import { UserSubscriptionConfig } from './userConfig';
19
+ import { UserStats } from './userStats';
20
+ import { JupiterClient, QuoteResponse, Route, SwapMode } from './jupiter/jupiterClient';
21
+ import { UserStatsSubscriptionConfig } from './userStatsConfig';
22
+ import { TxHandler } from './tx/txHandler';
23
+ import { WormholeCoreBridgeSolana } from '@pythnetwork/pyth-solana-receiver/lib/idl/wormhole_core_bridge_solana';
24
+ import { PythSolanaReceiver } from '@pythnetwork/pyth-solana-receiver/lib/idl/pyth_solana_receiver';
25
+ type RemainingAccountParams = {
26
+ userAccounts: UserAccount[];
27
+ writablePerpMarketIndexes?: number[];
28
+ writableSpotMarketIndexes?: number[];
29
+ readablePerpMarketIndex?: number | number[];
30
+ readableSpotMarketIndexes?: number[];
31
+ useMarketLastSlotCache?: boolean;
32
+ };
33
+ /**
34
+ * # DriftClient
35
+ * This class is the main way to interact with Drift Protocol. It allows you to subscribe to the various accounts where the Market's state is stored, as well as: opening positions, liquidating, settling funding, depositing & withdrawing, and more.
36
+ */
37
+ export declare class DriftClient {
38
+ connection: Connection;
39
+ wallet: IWallet;
40
+ program: Program;
41
+ swiftID: PublicKey;
42
+ provider: AnchorProvider;
43
+ opts?: ConfirmOptions;
44
+ users: Map<string, User>;
45
+ userStats?: UserStats;
46
+ activeSubAccountId: number;
47
+ userAccountSubscriptionConfig: UserSubscriptionConfig;
48
+ userStatsAccountSubscriptionConfig: UserStatsSubscriptionConfig;
49
+ accountSubscriber: DriftClientAccountSubscriber;
50
+ eventEmitter: StrictEventEmitter<EventEmitter, DriftClientAccountEvents>;
51
+ metricsEventEmitter: StrictEventEmitter<EventEmitter, DriftClientMetricsEvents>;
52
+ _isSubscribed: boolean;
53
+ txSender: TxSender;
54
+ perpMarketLastSlotCache: Map<number, number>;
55
+ spotMarketLastSlotCache: Map<number, number>;
56
+ mustIncludePerpMarketIndexes: Set<number>;
57
+ mustIncludeSpotMarketIndexes: Set<number>;
58
+ authority: PublicKey;
59
+ marketLookupTable: PublicKey;
60
+ lookupTableAccount: AddressLookupTableAccount;
61
+ includeDelegates?: boolean;
62
+ authoritySubAccountMap?: Map<string, number[]>;
63
+ skipLoadUsers?: boolean;
64
+ txVersion: TransactionVersion;
65
+ txParams: TxParams;
66
+ enableMetricsEvents?: boolean;
67
+ txHandler: TxHandler;
68
+ receiverProgram?: Program<PythSolanaReceiver>;
69
+ wormholeProgram?: Program<WormholeCoreBridgeSolana>;
70
+ sbOnDemandProgramdId: PublicKey;
71
+ sbOnDemandProgram?: Program30<Idl30>;
72
+ sbProgramFeedConfigs?: Map<string, any>;
73
+ get isSubscribed(): boolean;
74
+ set isSubscribed(val: boolean);
75
+ constructor(config: DriftClientConfig);
76
+ getUserMapKey(subAccountId: number, authority: PublicKey): string;
77
+ createUser(subAccountId: number, accountSubscriptionConfig: UserSubscriptionConfig, authority?: PublicKey): User;
78
+ subscribe(): Promise<boolean>;
79
+ subscribeUsers(): Promise<boolean>[];
80
+ /**
81
+ * Forces the accountSubscriber to fetch account updates from rpc
82
+ */
83
+ fetchAccounts(): Promise<void>;
84
+ unsubscribe(): Promise<void>;
85
+ unsubscribeUsers(): Promise<void>[];
86
+ statePublicKey?: PublicKey;
87
+ getStatePublicKey(): Promise<PublicKey>;
88
+ signerPublicKey?: PublicKey;
89
+ getSignerPublicKey(): PublicKey;
90
+ getStateAccount(): StateAccount;
91
+ /**
92
+ * Forces a fetch to rpc before returning accounts. Useful for anchor tests.
93
+ */
94
+ forceGetStateAccount(): Promise<StateAccount>;
95
+ getPerpMarketAccount(marketIndex: number): PerpMarketAccount | undefined;
96
+ /**
97
+ * Forces a fetch to rpc before returning accounts. Useful for anchor tests.
98
+ * @param marketIndex
99
+ */
100
+ forceGetPerpMarketAccount(marketIndex: number): Promise<PerpMarketAccount | undefined>;
101
+ getPerpMarketAccounts(): PerpMarketAccount[];
102
+ getSpotMarketAccount(marketIndex: number): SpotMarketAccount | undefined;
103
+ /**
104
+ * Forces a fetch to rpc before returning accounts. Useful for anchor tests.
105
+ * @param marketIndex
106
+ */
107
+ forceGetSpotMarketAccount(marketIndex: number): Promise<SpotMarketAccount | undefined>;
108
+ getSpotMarketAccounts(): SpotMarketAccount[];
109
+ getQuoteSpotMarketAccount(): SpotMarketAccount;
110
+ getOraclePriceDataAndSlot(oraclePublicKey: PublicKey): DataAndSlot<OraclePriceData> | undefined;
111
+ getSerumV3FulfillmentConfig(serumMarket: PublicKey): Promise<SerumV3FulfillmentConfigAccount>;
112
+ getSerumV3FulfillmentConfigs(): Promise<SerumV3FulfillmentConfigAccount[]>;
113
+ getPhoenixV1FulfillmentConfig(phoenixMarket: PublicKey): Promise<PhoenixV1FulfillmentConfigAccount>;
114
+ getPhoenixV1FulfillmentConfigs(): Promise<PhoenixV1FulfillmentConfigAccount[]>;
115
+ getOpenbookV2FulfillmentConfig(openbookMarket: PublicKey): Promise<OpenbookV2FulfillmentConfigAccount>;
116
+ getOpenbookV2FulfillmentConfigs(): Promise<OpenbookV2FulfillmentConfigAccount[]>;
117
+ fetchMarketLookupTableAccount(): Promise<AddressLookupTableAccount>;
118
+ /**
119
+ * Update the wallet to use for drift transactions and linked user account
120
+ * @param newWallet
121
+ * @param subAccountIds
122
+ * @param activeSubAccountId
123
+ * @param includeDelegates
124
+ */
125
+ updateWallet(newWallet: IWallet, subAccountIds?: number[], activeSubAccountId?: number, includeDelegates?: boolean, authoritySubaccountMap?: Map<string, number[]>): Promise<boolean>;
126
+ /**
127
+ * Update the subscribed accounts to a given authority, while leaving the
128
+ * connected wallet intact. This allows a user to emulate another user's
129
+ * account on the UI and sign permissionless transactions with their own wallet.
130
+ * @param emulateAuthority
131
+ */
132
+ emulateAccount(emulateAuthority: PublicKey): Promise<boolean>;
133
+ switchActiveUser(subAccountId: number, authority?: PublicKey): Promise<void>;
134
+ addUser(subAccountId: number, authority?: PublicKey, userAccount?: UserAccount): Promise<boolean>;
135
+ /**
136
+ * Adds and subscribes to users based on params set by the constructor or by updateWallet.
137
+ */
138
+ addAndSubscribeToUsers(authority?: PublicKey): Promise<boolean>;
139
+ initializeUserAccount(subAccountId?: number, name?: string, referrerInfo?: ReferrerInfo, txParams?: TxParams): Promise<[TransactionSignature, PublicKey]>;
140
+ getInitializeUserStatsIx(): Promise<TransactionInstruction>;
141
+ initializeRFQUser(userAccountPublicKey: PublicKey, txParams?: TxParams): Promise<[TransactionSignature, PublicKey]>;
142
+ getInitializeRFQUserInstruction(userAccountPublicKey: PublicKey): Promise<[PublicKey, TransactionInstruction]>;
143
+ getInitializeUserInstructions(subAccountId?: number, name?: string, referrerInfo?: ReferrerInfo): Promise<[PublicKey, TransactionInstruction]>;
144
+ getNextSubAccountId(): Promise<number>;
145
+ initializeReferrerName(name: string): Promise<TransactionSignature>;
146
+ updateUserName(name: string, subAccountId?: number): Promise<TransactionSignature>;
147
+ updateUserCustomMarginRatio(updates: {
148
+ marginRatio: number;
149
+ subAccountId: number;
150
+ }[], txParams?: TxParams): Promise<TransactionSignature>;
151
+ getUpdateUserCustomMarginRatioIx(marginRatio: number, subAccountId?: number): Promise<TransactionInstruction>;
152
+ getUpdateUserMarginTradingEnabledIx(marginTradingEnabled: boolean, subAccountId?: number, userAccountPublicKey?: PublicKey): Promise<TransactionInstruction>;
153
+ updateUserMarginTradingEnabled(updates: {
154
+ marginTradingEnabled: boolean;
155
+ subAccountId: number;
156
+ }[]): Promise<TransactionSignature>;
157
+ updateUserDelegate(delegate: PublicKey, subAccountId?: number): Promise<TransactionSignature>;
158
+ updateUserAdvancedLp(updates: {
159
+ advancedLp: boolean;
160
+ subAccountId: number;
161
+ }[]): Promise<TransactionSignature>;
162
+ getUpdateAdvancedDlpIx(advancedLp: boolean, subAccountId: number): Promise<anchor.web3.TransactionInstruction>;
163
+ updateUserReduceOnly(updates: {
164
+ reduceOnly: boolean;
165
+ subAccountId: number;
166
+ }[]): Promise<TransactionSignature>;
167
+ getUpdateUserReduceOnlyIx(reduceOnly: boolean, subAccountId: number): Promise<anchor.web3.TransactionInstruction>;
168
+ fetchAllUserAccounts(includeIdle?: boolean): Promise<ProgramAccount<UserAccount>[]>;
169
+ getUserAccountsForDelegate(delegate: PublicKey): Promise<UserAccount[]>;
170
+ getUserAccountsAndAddressesForAuthority(authority: PublicKey): Promise<ProgramAccount<UserAccount>[]>;
171
+ getUserAccountsForAuthority(authority: PublicKey): Promise<UserAccount[]>;
172
+ getReferredUserStatsAccountsByReferrer(referrer: PublicKey): Promise<UserStatsAccount[]>;
173
+ getReferrerNameAccountsForAuthority(authority: PublicKey): Promise<ReferrerNameAccount[]>;
174
+ deleteUser(subAccountId?: number, txParams?: TxParams): Promise<TransactionSignature>;
175
+ getUserDeletionIx(userAccountPublicKey: PublicKey): Promise<anchor.web3.TransactionInstruction>;
176
+ reclaimRent(subAccountId?: number, txParams?: TxParams): Promise<TransactionSignature>;
177
+ getReclaimRentIx(userAccountPublicKey: PublicKey): Promise<anchor.web3.TransactionInstruction>;
178
+ getUser(subAccountId?: number, authority?: PublicKey): User;
179
+ hasUser(subAccountId?: number, authority?: PublicKey): boolean;
180
+ getUsers(): User[];
181
+ getUserStats(): UserStats;
182
+ fetchReferrerNameAccount(name: string): Promise<ReferrerNameAccount | undefined>;
183
+ userStatsAccountPublicKey: PublicKey;
184
+ getUserStatsAccountPublicKey(): PublicKey;
185
+ getUserAccountPublicKey(subAccountId?: number, authority?: PublicKey): Promise<PublicKey>;
186
+ getUserAccount(subAccountId?: number, authority?: PublicKey): UserAccount | undefined;
187
+ /**
188
+ * Forces a fetch to rpc before returning accounts. Useful for anchor tests.
189
+ * @param subAccountId
190
+ */
191
+ forceGetUserAccount(subAccountId?: number): Promise<UserAccount | undefined>;
192
+ getUserAccountAndSlot(subAccountId?: number): DataAndSlot<UserAccount> | undefined;
193
+ getSpotPosition(marketIndex: number, subAccountId?: number): SpotPosition | undefined;
194
+ getQuoteAssetTokenAmount(): BN;
195
+ /**
196
+ * Returns the token amount for a given market. The spot market precision is based on the token mint decimals.
197
+ * Positive if it is a deposit, negative if it is a borrow.
198
+ * @param marketIndex
199
+ */
200
+ getTokenAmount(marketIndex: number): BN;
201
+ /**
202
+ * Converts an amount to the spot precision for a given market. The spot market precision is based on the token mint decimals.
203
+ * @param marketIndex
204
+ * @param amount
205
+ */
206
+ convertToSpotPrecision(marketIndex: number, amount: BN | number): BN;
207
+ /**
208
+ * Converts an amount to the perp precision. The perp market precision is {@link BASE_PRECISION} (1e9).
209
+ * @param amount
210
+ */
211
+ convertToPerpPrecision(amount: BN | number): BN;
212
+ /**
213
+ * Converts an amount to the price precision. The perp market precision is {@link PRICE_PRECISION} (1e6).
214
+ * @param amount
215
+ */
216
+ convertToPricePrecision(amount: BN | number): BN;
217
+ /**
218
+ * Each drift instruction must include perp and sport market accounts in the ix remaining accounts.
219
+ * Use this function to force a subset of markets to be included in the remaining accounts for every ix
220
+ *
221
+ * @param perpMarketIndexes
222
+ * @param spotMarketIndexes
223
+ */
224
+ mustIncludeMarketsInIx({ perpMarketIndexes, spotMarketIndexes, }: {
225
+ perpMarketIndexes: number[];
226
+ spotMarketIndexes: number[];
227
+ }): void;
228
+ getRemainingAccounts(params: RemainingAccountParams): AccountMeta[];
229
+ addPerpMarketToRemainingAccountMaps(marketIndex: number, writable: boolean, oracleAccountMap: Map<string, AccountMeta>, spotMarketAccountMap: Map<number, AccountMeta>, perpMarketAccountMap: Map<number, AccountMeta>): void;
230
+ addSpotMarketToRemainingAccountMaps(marketIndex: number, writable: boolean, oracleAccountMap: Map<string, AccountMeta>, spotMarketAccountMap: Map<number, AccountMeta>): void;
231
+ getRemainingAccountMapsForUsers(userAccounts: UserAccount[]): {
232
+ oracleAccountMap: Map<string, AccountMeta>;
233
+ spotMarketAccountMap: Map<number, AccountMeta>;
234
+ perpMarketAccountMap: Map<number, AccountMeta>;
235
+ };
236
+ getOrder(orderId: number, subAccountId?: number): Order | undefined;
237
+ getOrderByUserId(userOrderId: number, subAccountId?: number): Order | undefined;
238
+ /**
239
+ * Get the associated token address for the given spot market
240
+ * @param marketIndex
241
+ * @param useNative
242
+ * @param tokenProgram
243
+ */
244
+ getAssociatedTokenAccount(marketIndex: number, useNative?: boolean, tokenProgram?: anchor.web3.PublicKey): Promise<PublicKey>;
245
+ createAssociatedTokenAccountIdempotentInstruction(account: PublicKey, payer: PublicKey, owner: PublicKey, mint: PublicKey, tokenProgram?: anchor.web3.PublicKey): TransactionInstruction;
246
+ getDepositTxnIx(amount: BN, marketIndex: number, associatedTokenAccount: PublicKey, subAccountId?: number, reduceOnly?: boolean): Promise<TransactionInstruction[]>;
247
+ createDepositTxn(amount: BN, marketIndex: number, associatedTokenAccount: PublicKey, subAccountId?: number, reduceOnly?: boolean, txParams?: TxParams): Promise<VersionedTransaction | Transaction>;
248
+ /**
249
+ * Deposit funds into the given spot market
250
+ *
251
+ * @param amount to deposit
252
+ * @param marketIndex spot market index to deposit into
253
+ * @param associatedTokenAccount can be the wallet public key if using native sol
254
+ * @param subAccountId subaccountId to deposit
255
+ * @param reduceOnly if true, deposit must not increase account risk
256
+ */
257
+ deposit(amount: BN, marketIndex: number, associatedTokenAccount: PublicKey, subAccountId?: number, reduceOnly?: boolean, txParams?: TxParams): Promise<TransactionSignature>;
258
+ getDepositInstruction(amount: BN, marketIndex: number, userTokenAccount: PublicKey, subAccountId?: number, reduceOnly?: boolean, userInitialized?: boolean): Promise<TransactionInstruction>;
259
+ private checkIfAccountExists;
260
+ getWrappedSolAccountCreationIxs(amount: BN, includeRent?: boolean): Promise<{
261
+ ixs: anchor.web3.TransactionInstruction[];
262
+ /** @deprecated - this array is always going to be empty, in the current implementation */
263
+ signers: Signer[];
264
+ pubkey: PublicKey;
265
+ }>;
266
+ getTokenProgramForSpotMarket(spotMarketAccount: SpotMarketAccount): PublicKey;
267
+ addTokenMintToRemainingAccounts(spotMarketAccount: SpotMarketAccount, remainingAccounts: AccountMeta[]): void;
268
+ getAssociatedTokenAccountCreationIx(tokenMintAddress: PublicKey, associatedTokenAddress: PublicKey, tokenProgram: PublicKey): anchor.web3.TransactionInstruction;
269
+ createInitializeUserAccountAndDepositCollateralIxs(amount: BN, userTokenAccount: PublicKey, marketIndex?: number, subAccountId?: number, name?: string, fromSubAccountId?: number, referrerInfo?: ReferrerInfo, donateAmount?: BN, customMaxMarginRatio?: number): Promise<{
270
+ ixs: TransactionInstruction[];
271
+ userAccountPublicKey: PublicKey;
272
+ }>;
273
+ createInitializeUserAccountAndDepositCollateral(amount: BN, userTokenAccount: PublicKey, marketIndex?: number, subAccountId?: number, name?: string, fromSubAccountId?: number, referrerInfo?: ReferrerInfo, donateAmount?: BN, txParams?: TxParams, customMaxMarginRatio?: number): Promise<[Transaction | VersionedTransaction, PublicKey]>;
274
+ /**
275
+ * Creates the User account for a user, and deposits some initial collateral
276
+ * @param amount
277
+ * @param userTokenAccount
278
+ * @param marketIndex
279
+ * @param subAccountId
280
+ * @param name
281
+ * @param fromSubAccountId
282
+ * @param referrerInfo
283
+ * @param donateAmount
284
+ * @param txParams
285
+ * @returns
286
+ */
287
+ initializeUserAccountAndDepositCollateral(amount: BN, userTokenAccount: PublicKey, marketIndex?: number, subAccountId?: number, name?: string, fromSubAccountId?: number, referrerInfo?: ReferrerInfo, donateAmount?: BN, txParams?: TxParams, customMaxMarginRatio?: number): Promise<[TransactionSignature, PublicKey]>;
288
+ initializeUserAccountForDevnet(subAccountId: number, name: string, marketIndex: number, tokenFaucet: TokenFaucet, amount: BN, referrerInfo?: ReferrerInfo, txParams?: TxParams): Promise<[TransactionSignature, PublicKey]>;
289
+ private getWithdrawalIxs;
290
+ /**
291
+ * Withdraws from a user account. If deposit doesn't already exist, creates a borrow
292
+ * @param amount
293
+ * @param marketIndex
294
+ * @param associatedTokenAddress - the token account to withdraw to. can be the wallet public key if using native sol
295
+ * @param reduceOnly
296
+ */
297
+ withdraw(amount: BN, marketIndex: number, associatedTokenAddress: PublicKey, reduceOnly?: boolean, subAccountId?: number, txParams?: TxParams): Promise<TransactionSignature>;
298
+ withdrawAllDustPositions(subAccountId?: number, txParams?: TxParams, opts?: {
299
+ dustPositionCountCallback?: (count: number) => void;
300
+ }): Promise<TransactionSignature | undefined>;
301
+ getWithdrawIx(amount: BN, marketIndex: number, userTokenAccount: PublicKey, reduceOnly?: boolean, subAccountId?: number): Promise<TransactionInstruction>;
302
+ /**
303
+ * Withdraws from the fromSubAccount and deposits into the toSubAccount
304
+ * @param amount
305
+ * @param marketIndex
306
+ * @param fromSubAccountId
307
+ * @param toSubAccountId
308
+ * @param txParams
309
+ */
310
+ transferDeposit(amount: BN, marketIndex: number, fromSubAccountId: number, toSubAccountId: number, txParams?: TxParams): Promise<TransactionSignature>;
311
+ getTransferDepositIx(amount: BN, marketIndex: number, fromSubAccountId: number, toSubAccountId: number): Promise<TransactionInstruction>;
312
+ updateSpotMarketCumulativeInterest(marketIndex: number, txParams?: TxParams): Promise<TransactionSignature>;
313
+ updateSpotMarketCumulativeInterestIx(marketIndex: number): Promise<TransactionInstruction>;
314
+ settleLP(settleeUserAccountPublicKey: PublicKey, marketIndex: number, txParams?: TxParams): Promise<TransactionSignature>;
315
+ settleLPIx(settleeUserAccountPublicKey: PublicKey, marketIndex: number): Promise<TransactionInstruction>;
316
+ removePerpLpShares(marketIndex: number, sharesToBurn?: BN, txParams?: TxParams, subAccountId?: number): Promise<TransactionSignature>;
317
+ removePerpLpSharesInExpiringMarket(marketIndex: number, userAccountPublicKey: PublicKey, sharesToBurn?: BN, txParams?: TxParams): Promise<TransactionSignature>;
318
+ getRemovePerpLpSharesInExpiringMarket(marketIndex: number, userAccountPublicKey: PublicKey, sharesToBurn?: BN): Promise<TransactionInstruction>;
319
+ getRemovePerpLpSharesIx(marketIndex: number, sharesToBurn?: BN, subAccountId?: number): Promise<TransactionInstruction>;
320
+ addPerpLpShares(amount: BN, marketIndex: number, txParams?: TxParams, subAccountId?: number): Promise<TransactionSignature>;
321
+ getAddPerpLpSharesIx(amount: BN, marketIndex: number, subAccountId?: number): Promise<TransactionInstruction>;
322
+ getQuoteValuePerLpShare(marketIndex: number): BN;
323
+ /**
324
+ * @deprecated use {@link placePerpOrder} or {@link placeAndTakePerpOrder} instead
325
+ */
326
+ openPosition(direction: PositionDirection, amount: BN, marketIndex: number, limitPrice?: BN, subAccountId?: number): Promise<TransactionSignature>;
327
+ sendSignedTx(tx: Transaction | VersionedTransaction, opts?: ConfirmOptions): Promise<TransactionSignature>;
328
+ prepareMarketOrderTxs(orderParams: OptionalOrderParams, userAccountPublicKey: PublicKey, userAccount: UserAccount, makerInfo?: MakerInfo | MakerInfo[], txParams?: TxParams, bracketOrdersParams?: OptionalOrderParams[], referrerInfo?: ReferrerInfo, cancelExistingOrders?: boolean, settlePnl?: boolean): Promise<{
329
+ cancelExistingOrdersTx?: Transaction | VersionedTransaction;
330
+ settlePnlTx?: Transaction | VersionedTransaction;
331
+ fillTx?: Transaction | VersionedTransaction;
332
+ marketOrderTx: Transaction | VersionedTransaction;
333
+ }>;
334
+ /**
335
+ * Sends a market order and returns a signed tx which can fill the order against the vamm, which the caller can use to fill their own order if required.
336
+ * @param orderParams
337
+ * @param userAccountPublicKey
338
+ * @param userAccount
339
+ * @param makerInfo
340
+ * @param txParams
341
+ * @param bracketOrdersParams
342
+ * @param cancelExistingOrders - Builds and returns an extra transaciton to cancel the existing orders in the same perp market. Intended use is to auto-cancel TP/SL orders when closing a position. Ignored if orderParams.marketType is not MarketType.PERP
343
+ * @returns
344
+ */
345
+ sendMarketOrderAndGetSignedFillTx(orderParams: OptionalOrderParams, userAccountPublicKey: PublicKey, userAccount: UserAccount, makerInfo?: MakerInfo | MakerInfo[], txParams?: TxParams, bracketOrdersParams?: OptionalOrderParams[], referrerInfo?: ReferrerInfo, cancelExistingOrders?: boolean, settlePnl?: boolean): Promise<{
346
+ txSig: TransactionSignature;
347
+ signedFillTx?: Transaction;
348
+ signedCancelExistingOrdersTx?: Transaction;
349
+ signedSettlePnlTx?: Transaction;
350
+ }>;
351
+ placePerpOrder(orderParams: OptionalOrderParams, txParams?: TxParams, subAccountId?: number): Promise<TransactionSignature>;
352
+ getPlacePerpOrderIx(orderParams: OptionalOrderParams, subAccountId?: number, depositToTradeArgs?: {
353
+ isMakingNewAccount: boolean;
354
+ depositMarketIndex: number;
355
+ }): Promise<TransactionInstruction>;
356
+ updateAMMs(marketIndexes: number[], txParams?: TxParams): Promise<TransactionSignature>;
357
+ getUpdateAMMsIx(marketIndexes: number[]): Promise<TransactionInstruction>;
358
+ settleExpiredMarket(marketIndex: number, txParams?: TxParams): Promise<TransactionSignature>;
359
+ getSettleExpiredMarketIx(marketIndex: number): Promise<TransactionInstruction>;
360
+ settleExpiredMarketPoolsToRevenuePool(marketIndex: number, txParams?: TxParams): Promise<TransactionSignature>;
361
+ getSettleExpiredMarketPoolsToRevenuePoolIx(perpMarketIndex: number): Promise<TransactionInstruction>;
362
+ cancelOrder(orderId?: number, txParams?: TxParams, subAccountId?: number): Promise<TransactionSignature>;
363
+ getCancelOrderIx(orderId?: number, subAccountId?: number): Promise<TransactionInstruction>;
364
+ cancelOrderByUserId(userOrderId: number, txParams?: TxParams, subAccountId?: number): Promise<TransactionSignature>;
365
+ getCancelOrderByUserIdIx(userOrderId: number, subAccountId?: number): Promise<TransactionInstruction>;
366
+ cancelOrdersByIds(orderIds?: number[], txParams?: TxParams, subAccountId?: number): Promise<TransactionSignature>;
367
+ getCancelOrdersByIdsIx(orderIds?: number[], subAccountId?: number): Promise<TransactionInstruction>;
368
+ cancelOrders(marketType?: MarketType, marketIndex?: number, direction?: PositionDirection, txParams?: TxParams, subAccountId?: number): Promise<TransactionSignature>;
369
+ getCancelOrdersIx(marketType: MarketType | null, marketIndex: number | null, direction: PositionDirection | null, subAccountId?: number): Promise<TransactionInstruction>;
370
+ cancelAndPlaceOrders(cancelOrderParams: {
371
+ marketType?: MarketType;
372
+ marketIndex?: number;
373
+ direction?: PositionDirection;
374
+ }, placeOrderParams: OrderParams[], txParams?: TxParams, subAccountId?: number): Promise<TransactionSignature>;
375
+ placeOrders(params: OrderParams[], txParams?: TxParams, subAccountId?: number): Promise<TransactionSignature>;
376
+ preparePlaceOrdersTx(params: OrderParams[], txParams?: TxParams, subAccountId?: number): Promise<{
377
+ placeOrdersTx: anchor.web3.Transaction | anchor.web3.VersionedTransaction;
378
+ }>;
379
+ getPlaceOrdersIx(params: OptionalOrderParams[], subAccountId?: number): Promise<TransactionInstruction>;
380
+ fillPerpOrder(userAccountPublicKey: PublicKey, user: UserAccount, order?: Pick<Order, 'marketIndex' | 'orderId'>, makerInfo?: MakerInfo | MakerInfo[], referrerInfo?: ReferrerInfo, txParams?: TxParams, fillerPublicKey?: number): Promise<TransactionSignature>;
381
+ getFillPerpOrderIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, order: Pick<Order, 'marketIndex' | 'orderId'>, makerInfo?: MakerInfo | MakerInfo[], referrerInfo?: ReferrerInfo, fillerSubAccountId?: number): Promise<TransactionInstruction>;
382
+ getRevertFillIx(fillerPublicKey?: PublicKey): Promise<TransactionInstruction>;
383
+ placeSpotOrder(orderParams: OptionalOrderParams, txParams?: TxParams, subAccountId?: number): Promise<TransactionSignature>;
384
+ preparePlaceSpotOrderTx(orderParams: OptionalOrderParams, txParams?: TxParams, subAccountId?: number): Promise<{
385
+ placeSpotOrderTx: anchor.web3.Transaction | anchor.web3.VersionedTransaction;
386
+ }>;
387
+ getPlaceSpotOrderIx(orderParams: OptionalOrderParams, subAccountId?: number): Promise<TransactionInstruction>;
388
+ fillSpotOrder(userAccountPublicKey: PublicKey, user: UserAccount, order?: Order, fulfillmentConfig?: SerumV3FulfillmentConfigAccount | PhoenixV1FulfillmentConfigAccount | OpenbookV2FulfillmentConfigAccount, makerInfo?: MakerInfo | MakerInfo[], referrerInfo?: ReferrerInfo, txParams?: TxParams): Promise<TransactionSignature>;
389
+ getFillSpotOrderIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, order?: Order, fulfillmentConfig?: SerumV3FulfillmentConfigAccount | PhoenixV1FulfillmentConfigAccount | OpenbookV2FulfillmentConfigAccount, makerInfo?: MakerInfo | MakerInfo[], referrerInfo?: ReferrerInfo, fillerPublicKey?: PublicKey): Promise<TransactionInstruction>;
390
+ addSpotFulfillmentAccounts(marketIndex: number, remainingAccounts: AccountMeta[], fulfillmentConfig?: SerumV3FulfillmentConfigAccount | PhoenixV1FulfillmentConfigAccount | OpenbookV2FulfillmentConfigAccount): void;
391
+ addSerumRemainingAccounts(marketIndex: number, remainingAccounts: AccountMeta[], fulfillmentConfig: SerumV3FulfillmentConfigAccount): void;
392
+ addPhoenixRemainingAccounts(marketIndex: number, remainingAccounts: AccountMeta[], fulfillmentConfig: PhoenixV1FulfillmentConfigAccount): void;
393
+ addOpenbookRemainingAccounts(marketIndex: number, remainingAccounts: AccountMeta[], fulfillmentConfig: OpenbookV2FulfillmentConfigAccount): void;
394
+ /**
395
+ * Swap tokens in drift account using jupiter
396
+ * @param jupiterClient jupiter client to find routes and jupiter instructions
397
+ * @param outMarketIndex the market index of the token you're buying
398
+ * @param inMarketIndex the market index of the token you're selling
399
+ * @param outAssociatedTokenAccount the token account to receive the token being sold on jupiter
400
+ * @param inAssociatedTokenAccount the token account to
401
+ * @param amount the amount of TokenIn, regardless of swapMode
402
+ * @param slippageBps the max slippage passed to jupiter api
403
+ * @param swapMode jupiter swapMode (ExactIn or ExactOut), default is ExactIn
404
+ * @param route the jupiter route to use for the swap
405
+ * @param reduceOnly specify if In or Out token on the drift account must reduceOnly, checked at end of swap
406
+ * @param txParams
407
+ */
408
+ swap({ jupiterClient, outMarketIndex, inMarketIndex, outAssociatedTokenAccount, inAssociatedTokenAccount, amount, slippageBps, swapMode, route, reduceOnly, txParams, v6, onlyDirectRoutes, }: {
409
+ jupiterClient: JupiterClient;
410
+ outMarketIndex: number;
411
+ inMarketIndex: number;
412
+ outAssociatedTokenAccount?: PublicKey;
413
+ inAssociatedTokenAccount?: PublicKey;
414
+ amount: BN;
415
+ slippageBps?: number;
416
+ swapMode?: SwapMode;
417
+ route?: Route;
418
+ reduceOnly?: SwapReduceOnly;
419
+ txParams?: TxParams;
420
+ onlyDirectRoutes?: boolean;
421
+ v6?: {
422
+ quote?: QuoteResponse;
423
+ };
424
+ }): Promise<TransactionSignature>;
425
+ getJupiterSwapIx({ jupiterClient, outMarketIndex, inMarketIndex, outAssociatedTokenAccount, inAssociatedTokenAccount, amount, slippageBps, swapMode, onlyDirectRoutes, route, reduceOnly, userAccountPublicKey, }: {
426
+ jupiterClient: JupiterClient;
427
+ outMarketIndex: number;
428
+ inMarketIndex: number;
429
+ outAssociatedTokenAccount?: PublicKey;
430
+ inAssociatedTokenAccount?: PublicKey;
431
+ amount: BN;
432
+ slippageBps?: number;
433
+ swapMode?: SwapMode;
434
+ onlyDirectRoutes?: boolean;
435
+ route?: Route;
436
+ reduceOnly?: SwapReduceOnly;
437
+ userAccountPublicKey?: PublicKey;
438
+ }): Promise<{
439
+ ixs: TransactionInstruction[];
440
+ lookupTables: AddressLookupTableAccount[];
441
+ }>;
442
+ getJupiterSwapIxV6({ jupiterClient, outMarketIndex, inMarketIndex, outAssociatedTokenAccount, inAssociatedTokenAccount, amount, slippageBps, swapMode, onlyDirectRoutes, quote, reduceOnly, userAccountPublicKey, }: {
443
+ jupiterClient: JupiterClient;
444
+ outMarketIndex: number;
445
+ inMarketIndex: number;
446
+ outAssociatedTokenAccount?: PublicKey;
447
+ inAssociatedTokenAccount?: PublicKey;
448
+ amount: BN;
449
+ slippageBps?: number;
450
+ swapMode?: SwapMode;
451
+ onlyDirectRoutes?: boolean;
452
+ quote?: QuoteResponse;
453
+ reduceOnly?: SwapReduceOnly;
454
+ userAccountPublicKey?: PublicKey;
455
+ }): Promise<{
456
+ ixs: TransactionInstruction[];
457
+ lookupTables: AddressLookupTableAccount[];
458
+ }>;
459
+ /**
460
+ * Get the drift begin_swap and end_swap instructions
461
+ *
462
+ * @param outMarketIndex the market index of the token you're buying
463
+ * @param inMarketIndex the market index of the token you're selling
464
+ * @param amountIn the amount of the token to sell
465
+ * @param inTokenAccount the token account to move the tokens being sold
466
+ * @param outTokenAccount the token account to receive the tokens being bought
467
+ * @param limitPrice the limit price of the swap
468
+ * @param reduceOnly
469
+ * @param userAccountPublicKey optional, specify a custom userAccountPublicKey to use instead of getting the current user account; can be helpful if the account is being created within the current tx
470
+ */
471
+ getSwapIx({ outMarketIndex, inMarketIndex, amountIn, inTokenAccount, outTokenAccount, limitPrice, reduceOnly, userAccountPublicKey, }: {
472
+ outMarketIndex: number;
473
+ inMarketIndex: number;
474
+ amountIn: BN;
475
+ inTokenAccount: PublicKey;
476
+ outTokenAccount: PublicKey;
477
+ limitPrice?: BN;
478
+ reduceOnly?: SwapReduceOnly;
479
+ userAccountPublicKey?: PublicKey;
480
+ }): Promise<{
481
+ beginSwapIx: TransactionInstruction;
482
+ endSwapIx: TransactionInstruction;
483
+ }>;
484
+ stakeForMSOL({ amount }: {
485
+ amount: BN;
486
+ }): Promise<TxSigAndSlot>;
487
+ getStakeForMSOLIx({ amount, userAccountPublicKey, }: {
488
+ amount: BN;
489
+ userAccountPublicKey?: PublicKey;
490
+ }): Promise<TransactionInstruction[]>;
491
+ triggerOrder(userAccountPublicKey: PublicKey, user: UserAccount, order: Order, txParams?: TxParams, fillerPublicKey?: PublicKey): Promise<TransactionSignature>;
492
+ getTriggerOrderIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, order: Order, fillerPublicKey?: PublicKey): Promise<TransactionInstruction>;
493
+ forceCancelOrders(userAccountPublicKey: PublicKey, user: UserAccount, txParams?: TxParams, fillerPublicKey?: PublicKey): Promise<TransactionSignature>;
494
+ getForceCancelOrdersIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, fillerPublicKey?: PublicKey): Promise<TransactionInstruction>;
495
+ updateUserIdle(userAccountPublicKey: PublicKey, user: UserAccount, txParams?: TxParams, fillerPublicKey?: PublicKey): Promise<TransactionSignature>;
496
+ getUpdateUserIdleIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, fillerPublicKey?: PublicKey): Promise<TransactionInstruction>;
497
+ updateUserFuelBonus(userAccountPublicKey: PublicKey, user: UserAccount, userAuthority: PublicKey, txParams?: TxParams): Promise<TransactionSignature>;
498
+ getUpdateUserFuelBonusIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, userAuthority: PublicKey): Promise<TransactionInstruction>;
499
+ updateUserStatsReferrerInfo(userStatsAccountPublicKey: PublicKey, txParams?: TxParams): Promise<TransactionSignature>;
500
+ getUpdateUserStatsReferrerInfoIx(userStatsAccountPublicKey: PublicKey): Promise<TransactionInstruction>;
501
+ updateUserOpenOrdersCount(userAccountPublicKey: PublicKey, user: UserAccount, txParams?: TxParams, fillerPublicKey?: PublicKey): Promise<TransactionSignature>;
502
+ getUpdateUserOpenOrdersCountIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, fillerPublicKey?: PublicKey): Promise<TransactionInstruction>;
503
+ placeAndTakePerpOrder(orderParams: OptionalOrderParams, makerInfo?: MakerInfo | MakerInfo[], referrerInfo?: ReferrerInfo, successCondition?: PlaceAndTakeOrderSuccessCondition, txParams?: TxParams, subAccountId?: number): Promise<TransactionSignature>;
504
+ preparePlaceAndTakePerpOrderWithAdditionalOrders(orderParams: OptionalOrderParams, makerInfo?: MakerInfo | MakerInfo[], referrerInfo?: ReferrerInfo, bracketOrdersParams?: OptionalOrderParams[], txParams?: TxParams, subAccountId?: number, cancelExistingOrders?: boolean, settlePnl?: boolean, exitEarlyIfSimFails?: boolean): Promise<{
505
+ placeAndTakeTx: Transaction | VersionedTransaction;
506
+ cancelExistingOrdersTx: Transaction | VersionedTransaction;
507
+ settlePnlTx: Transaction | VersionedTransaction;
508
+ }>;
509
+ placeAndTakePerpWithAdditionalOrders(orderParams: OptionalOrderParams, makerInfo?: MakerInfo | MakerInfo[], referrerInfo?: ReferrerInfo, bracketOrdersParams?: OptionalOrderParams[], txParams?: TxParams, subAccountId?: number, cancelExistingOrders?: boolean, settlePnl?: boolean, exitEarlyIfSimFails?: boolean): Promise<{
510
+ txSig: TransactionSignature;
511
+ signedCancelExistingOrdersTx?: Transaction;
512
+ signedSettlePnlTx?: Transaction;
513
+ }>;
514
+ getPlaceAndTakePerpOrderIx(orderParams: OptionalOrderParams, makerInfo?: MakerInfo | MakerInfo[], referrerInfo?: ReferrerInfo, successCondition?: PlaceAndTakeOrderSuccessCondition, subAccountId?: number): Promise<TransactionInstruction>;
515
+ placeAndMakePerpOrder(orderParams: OptionalOrderParams, takerInfo: TakerInfo, referrerInfo?: ReferrerInfo, txParams?: TxParams, subAccountId?: number): Promise<TransactionSignature>;
516
+ getPlaceAndMakePerpOrderIx(orderParams: OptionalOrderParams, takerInfo: TakerInfo, referrerInfo?: ReferrerInfo, subAccountId?: number): Promise<TransactionInstruction>;
517
+ encodeSwiftServerMessage(message: SwiftServerMessage): Buffer;
518
+ decodeSwiftServerMessage(encodedMessage: Buffer): SwiftServerMessage;
519
+ signSwiftServerMessage(message: SwiftServerMessage): Buffer;
520
+ signSwiftOrderParamsMessage(orderParamsMessage: SwiftOrderParamsMessage): Buffer;
521
+ encodeSwiftOrderParamsMessage(orderParamsMessage: SwiftOrderParamsMessage): Buffer;
522
+ decodeSwiftOrderParamsMessage(encodedMessage: Buffer): SwiftOrderParamsMessage;
523
+ signMessage(message: Uint8Array, keypair?: Keypair): Buffer;
524
+ placeSwiftTakerOrder(swiftServerMessage: Buffer, swiftSignature: Buffer, swiftOrderParamsMessage: Buffer, swiftOrderParamsSignature: Buffer, marketIndex: number, takerInfo: {
525
+ taker: PublicKey;
526
+ takerStats: PublicKey;
527
+ takerUserAccount: UserAccount;
528
+ }, txParams?: TxParams): Promise<TransactionSignature>;
529
+ getPlaceSwiftTakerPerpOrderIxs(encodedSwiftServerMessage: Buffer, swiftSignature: Buffer, encodedSwiftOrderParamsMessage: Buffer, swiftOrderParamsSignature: Buffer, marketIndex: number, takerInfo: {
530
+ taker: PublicKey;
531
+ takerStats: PublicKey;
532
+ takerUserAccount: UserAccount;
533
+ }): Promise<TransactionInstruction[]>;
534
+ placeAndMakeSwiftPerpOrder(encodedSwiftMessage: Buffer, swiftSignature: Buffer, encodedSwiftOrderParamsMessage: Buffer, swiftOrderParamsSignature: Buffer, takerExpectedOrderId: number, takerInfo: {
535
+ taker: PublicKey;
536
+ takerStats: PublicKey;
537
+ takerUserAccount: UserAccount;
538
+ }, orderParams: OptionalOrderParams, referrerInfo?: ReferrerInfo, txParams?: TxParams, subAccountId?: number): Promise<TransactionSignature>;
539
+ getPlaceAndMakeSwiftPerpOrderIxs(encodedSwiftMessage: Buffer, swiftSignature: Buffer, encodedSwiftOrderParamsMessage: Buffer, swiftOrderParamsSignature: Buffer, takerExpectedOrderId: number, takerInfo: {
540
+ taker: PublicKey;
541
+ takerStats: PublicKey;
542
+ takerUserAccount: UserAccount;
543
+ }, orderParams: OptionalOrderParams, referrerInfo?: ReferrerInfo, subAccountId?: number): Promise<TransactionInstruction[]>;
544
+ encodeRFQMakerOrderParams(message: RFQMakerOrderParams): Buffer;
545
+ placeAndMatchRFQOrders(rfqMatches: RFQMatch[], txParams?: TxParams): Promise<TransactionSignature>;
546
+ getPlaceAndMatchRFQOrdersIxs(rfqMatches: RFQMatch[]): Promise<TransactionInstruction[]>;
547
+ preparePlaceAndTakeSpotOrder(orderParams: OptionalOrderParams, fulfillmentConfig?: SerumV3FulfillmentConfigAccount, makerInfo?: MakerInfo, referrerInfo?: ReferrerInfo, txParams?: TxParams, subAccountId?: number): Promise<{
548
+ placeAndTakeSpotOrderTx: anchor.web3.Transaction | anchor.web3.VersionedTransaction;
549
+ }>;
550
+ placeAndTakeSpotOrder(orderParams: OptionalOrderParams, fulfillmentConfig?: SerumV3FulfillmentConfigAccount, makerInfo?: MakerInfo, referrerInfo?: ReferrerInfo, txParams?: TxParams, subAccountId?: number): Promise<TransactionSignature>;
551
+ getPlaceAndTakeSpotOrderIx(orderParams: OptionalOrderParams, fulfillmentConfig?: SerumV3FulfillmentConfigAccount, makerInfo?: MakerInfo, referrerInfo?: ReferrerInfo, subAccountId?: number): Promise<TransactionInstruction>;
552
+ placeAndMakeSpotOrder(orderParams: OptionalOrderParams, takerInfo: TakerInfo, fulfillmentConfig?: SerumV3FulfillmentConfigAccount, referrerInfo?: ReferrerInfo, txParams?: TxParams, subAccountId?: number): Promise<TransactionSignature>;
553
+ getPlaceAndMakeSpotOrderIx(orderParams: OptionalOrderParams, takerInfo: TakerInfo, fulfillmentConfig?: SerumV3FulfillmentConfigAccount, referrerInfo?: ReferrerInfo, subAccountId?: number): Promise<TransactionInstruction>;
554
+ /**
555
+ * @deprecated use {@link placePerpOrder} or {@link placeAndTakePerpOrder} instead
556
+ */
557
+ closePosition(marketIndex: number, limitPrice?: BN, subAccountId?: number): Promise<TransactionSignature>;
558
+ /**
559
+ * Modifies an open order by closing it and replacing it with a new order.
560
+ * @deprecated use modifyOrder instead
561
+ * @param orderId: The open order to modify
562
+ * @param newBaseAmount: The new base amount for the order. One of [newBaseAmount|newLimitPrice|newOraclePriceOffset] must be provided.
563
+ * @param newLimitPice: The new limit price for the order. One of [newBaseAmount|newLimitPrice|newOraclePriceOffset] must be provided.
564
+ * @param newOraclePriceOffset: The new oracle price offset for the order. One of [newBaseAmount|newLimitPrice|newOraclePriceOffset] must be provided.
565
+ * @returns
566
+ */
567
+ modifyPerpOrder(orderId: number, newBaseAmount?: BN, newLimitPrice?: BN, newOraclePriceOffset?: number): Promise<TransactionSignature>;
568
+ /**
569
+ * Modifies an open order by closing it and replacing it with a new order.
570
+ * @deprecated use modifyOrderByUserOrderId instead
571
+ * @param userOrderId: The open order to modify
572
+ * @param newBaseAmount: The new base amount for the order. One of [newBaseAmount|newLimitPrice|newOraclePriceOffset] must be provided.
573
+ * @param newLimitPice: The new limit price for the order. One of [newBaseAmount|newLimitPrice|newOraclePriceOffset] must be provided.
574
+ * @param newOraclePriceOffset: The new oracle price offset for the order. One of [newBaseAmount|newLimitPrice|newOraclePriceOffset] must be provided.
575
+ * @returns
576
+ */
577
+ modifyPerpOrderByUserOrderId(userOrderId: number, newBaseAmount?: BN, newLimitPrice?: BN, newOraclePriceOffset?: number): Promise<TransactionSignature>;
578
+ /**
579
+ * Modifies an open order (spot or perp) by closing it and replacing it with a new order.
580
+ * @param orderParams.orderId: The open order to modify
581
+ * @param orderParams.newDirection: The new direction for the order
582
+ * @param orderParams.newBaseAmount: The new base amount for the order
583
+ * @param orderParams.newLimitPice: The new limit price for the order
584
+ * @param orderParams.newOraclePriceOffset: The new oracle price offset for the order
585
+ * @param orderParams.newTriggerPrice: Optional - Thew new trigger price for the order.
586
+ * @param orderParams.auctionDuration:
587
+ * @param orderParams.auctionStartPrice:
588
+ * @param orderParams.auctionEndPrice:
589
+ * @param orderParams.reduceOnly:
590
+ * @param orderParams.postOnly:
591
+ * @param orderParams.immediateOrCancel:
592
+ * @param orderParams.policy:
593
+ * @param orderParams.maxTs:
594
+ * @returns
595
+ */
596
+ modifyOrder(orderParams: {
597
+ orderId: number;
598
+ newDirection?: PositionDirection;
599
+ newBaseAmount?: BN;
600
+ newLimitPrice?: BN;
601
+ newOraclePriceOffset?: number;
602
+ newTriggerPrice?: BN;
603
+ newTriggerCondition?: OrderTriggerCondition;
604
+ auctionDuration?: number;
605
+ auctionStartPrice?: BN;
606
+ auctionEndPrice?: BN;
607
+ reduceOnly?: boolean;
608
+ postOnly?: boolean;
609
+ immediateOrCancel?: boolean;
610
+ maxTs?: BN;
611
+ policy?: ModifyOrderPolicy;
612
+ }, txParams?: TxParams, subAccountId?: number): Promise<TransactionSignature>;
613
+ getModifyOrderIx({ orderId, newDirection, newBaseAmount, newLimitPrice, newOraclePriceOffset, newTriggerPrice, newTriggerCondition, auctionDuration, auctionStartPrice, auctionEndPrice, reduceOnly, postOnly, immediateOrCancel, maxTs, policy, }: {
614
+ orderId: number;
615
+ newDirection?: PositionDirection;
616
+ newBaseAmount?: BN;
617
+ newLimitPrice?: BN;
618
+ newOraclePriceOffset?: number;
619
+ newTriggerPrice?: BN;
620
+ newTriggerCondition?: OrderTriggerCondition;
621
+ auctionDuration?: number;
622
+ auctionStartPrice?: BN;
623
+ auctionEndPrice?: BN;
624
+ reduceOnly?: boolean;
625
+ postOnly?: boolean;
626
+ immediateOrCancel?: boolean;
627
+ maxTs?: BN;
628
+ policy?: ModifyOrderPolicy;
629
+ }, subAccountId?: number): Promise<TransactionInstruction>;
630
+ /**
631
+ * Modifies an open order by closing it and replacing it with a new order.
632
+ * @param orderParams.userOrderId: The open order to modify
633
+ * @param orderParams.newDirection: The new direction for the order
634
+ * @param orderParams.newBaseAmount: The new base amount for the order
635
+ * @param orderParams.newLimitPice: The new limit price for the order
636
+ * @param orderParams.newOraclePriceOffset: The new oracle price offset for the order
637
+ * @param orderParams.newTriggerPrice: Optional - Thew new trigger price for the order.
638
+ * @param orderParams.auctionDuration: Only required if order type changed to market from something else
639
+ * @param orderParams.auctionStartPrice: Only required if order type changed to market from something else
640
+ * @param orderParams.auctionEndPrice: Only required if order type changed to market from something else
641
+ * @param orderParams.reduceOnly:
642
+ * @param orderParams.postOnly:
643
+ * @param orderParams.immediateOrCancel:
644
+ * @param orderParams.policy:
645
+ * @param orderParams.maxTs:
646
+ * @returns
647
+ */
648
+ modifyOrderByUserOrderId(orderParams: {
649
+ userOrderId: number;
650
+ newDirection?: PositionDirection;
651
+ newBaseAmount?: BN;
652
+ newLimitPrice?: BN;
653
+ newOraclePriceOffset?: number;
654
+ newTriggerPrice?: BN;
655
+ newTriggerCondition?: OrderTriggerCondition;
656
+ auctionDuration?: number;
657
+ auctionStartPrice?: BN;
658
+ auctionEndPrice?: BN;
659
+ reduceOnly?: boolean;
660
+ postOnly?: boolean;
661
+ immediateOrCancel?: boolean;
662
+ policy?: ModifyOrderPolicy;
663
+ maxTs?: BN;
664
+ }, txParams?: TxParams, subAccountId?: number): Promise<TransactionSignature>;
665
+ getModifyOrderByUserIdIx({ userOrderId, newDirection, newBaseAmount, newLimitPrice, newOraclePriceOffset, newTriggerPrice, newTriggerCondition, auctionDuration, auctionStartPrice, auctionEndPrice, reduceOnly, postOnly, immediateOrCancel, maxTs, policy, }: {
666
+ userOrderId: number;
667
+ newDirection?: PositionDirection;
668
+ newBaseAmount?: BN;
669
+ newLimitPrice?: BN;
670
+ newOraclePriceOffset?: number;
671
+ newTriggerPrice?: BN;
672
+ newTriggerCondition?: OrderTriggerCondition;
673
+ auctionDuration?: number;
674
+ auctionStartPrice?: BN;
675
+ auctionEndPrice?: BN;
676
+ reduceOnly?: boolean;
677
+ postOnly?: boolean;
678
+ immediateOrCancel?: boolean;
679
+ policy?: ModifyOrderPolicy;
680
+ maxTs?: BN;
681
+ txParams?: TxParams;
682
+ }, subAccountId?: number): Promise<TransactionInstruction>;
683
+ settlePNLs(users: {
684
+ settleeUserAccountPublicKey: PublicKey;
685
+ settleeUserAccount: UserAccount;
686
+ }[], marketIndexes: number[], opts?: {
687
+ filterInvalidMarkets?: boolean;
688
+ }, txParams?: TxParams): Promise<TransactionSignature>;
689
+ getSettlePNLsIxs(users: {
690
+ settleeUserAccountPublicKey: PublicKey;
691
+ settleeUserAccount: UserAccount;
692
+ }[], marketIndexes: number[]): Promise<Array<TransactionInstruction>>;
693
+ settlePNL(settleeUserAccountPublicKey: PublicKey, settleeUserAccount: UserAccount, marketIndex: number, txParams?: TxParams): Promise<TransactionSignature>;
694
+ settlePNLIx(settleeUserAccountPublicKey: PublicKey, settleeUserAccount: UserAccount, marketIndex: number): Promise<TransactionInstruction>;
695
+ settleMultiplePNLs(settleeUserAccountPublicKey: PublicKey, settleeUserAccount: UserAccount, marketIndexes: number[], mode: SettlePnlMode, txParams?: TxParams): Promise<TransactionSignature>;
696
+ settleMultiplePNLsIx(settleeUserAccountPublicKey: PublicKey, settleeUserAccount: UserAccount, marketIndexes: number[], mode: SettlePnlMode): Promise<TransactionInstruction>;
697
+ getSetUserStatusToBeingLiquidatedIx(userAccountPublicKey: PublicKey, userAccount: UserAccount): Promise<TransactionInstruction>;
698
+ setUserStatusToBeingLiquidated(userAccountPublicKey: PublicKey, userAccount: UserAccount): Promise<TransactionSignature>;
699
+ liquidatePerp(userAccountPublicKey: PublicKey, userAccount: UserAccount, marketIndex: number, maxBaseAssetAmount: BN, limitPrice?: BN, txParams?: TxParams, liquidatorSubAccountId?: number): Promise<TransactionSignature>;
700
+ getLiquidatePerpIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, marketIndex: number, maxBaseAssetAmount: BN, limitPrice?: BN, liquidatorSubAccountId?: number): Promise<TransactionInstruction>;
701
+ liquidatePerpWithFill(userAccountPublicKey: PublicKey, userAccount: UserAccount, marketIndex: number, makerInfos: MakerInfo[], txParams?: TxParams, liquidatorSubAccountId?: number): Promise<TransactionSignature>;
702
+ getLiquidatePerpWithFillIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, marketIndex: number, makerInfos: MakerInfo[], liquidatorSubAccountId?: number): Promise<TransactionInstruction>;
703
+ liquidateSpot(userAccountPublicKey: PublicKey, userAccount: UserAccount, assetMarketIndex: number, liabilityMarketIndex: number, maxLiabilityTransfer: BN, limitPrice?: BN, txParams?: TxParams, liquidatorSubAccountId?: number): Promise<TransactionSignature>;
704
+ getLiquidateSpotIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, assetMarketIndex: number, liabilityMarketIndex: number, maxLiabilityTransfer: BN, limitPrice?: BN, liquidatorSubAccountId?: number): Promise<TransactionInstruction>;
705
+ liquidateBorrowForPerpPnl(userAccountPublicKey: PublicKey, userAccount: UserAccount, perpMarketIndex: number, liabilityMarketIndex: number, maxLiabilityTransfer: BN, limitPrice?: BN, txParams?: TxParams, liquidatorSubAccountId?: number): Promise<TransactionSignature>;
706
+ getLiquidateBorrowForPerpPnlIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, perpMarketIndex: number, liabilityMarketIndex: number, maxLiabilityTransfer: BN, limitPrice?: BN, liquidatorSubAccountId?: number): Promise<TransactionInstruction>;
707
+ liquidatePerpPnlForDeposit(userAccountPublicKey: PublicKey, userAccount: UserAccount, perpMarketIndex: number, assetMarketIndex: number, maxPnlTransfer: BN, limitPrice?: BN, txParams?: TxParams, liquidatorSubAccountId?: number): Promise<TransactionSignature>;
708
+ getLiquidatePerpPnlForDepositIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, perpMarketIndex: number, assetMarketIndex: number, maxPnlTransfer: BN, limitPrice?: BN, liquidatorSubAccountId?: number): Promise<TransactionInstruction>;
709
+ resolvePerpBankruptcy(userAccountPublicKey: PublicKey, userAccount: UserAccount, marketIndex: number, txParams?: TxParams, liquidatorSubAccountId?: number): Promise<TransactionSignature>;
710
+ getResolvePerpBankruptcyIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, marketIndex: number, liquidatorSubAccountId?: number): Promise<TransactionInstruction>;
711
+ resolveSpotBankruptcy(userAccountPublicKey: PublicKey, userAccount: UserAccount, marketIndex: number, txParams?: TxParams, liquidatorSubAccountId?: number): Promise<TransactionSignature>;
712
+ getResolveSpotBankruptcyIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, marketIndex: number, liquidatorSubAccountId?: number): Promise<TransactionInstruction>;
713
+ updateFundingRate(perpMarketIndex: number, oracle: PublicKey, txParams?: TxParams): Promise<TransactionSignature>;
714
+ getUpdateFundingRateIx(perpMarketIndex: number, oracle: PublicKey): Promise<TransactionInstruction>;
715
+ updatePrelaunchOracle(perpMarketIndex: number, txParams?: TxParams): Promise<TransactionSignature>;
716
+ getUpdatePrelaunchOracleIx(perpMarketIndex: number): Promise<TransactionInstruction>;
717
+ updatePerpBidAskTwap(perpMarketIndex: number, makers: [PublicKey, PublicKey][], txParams?: TxParams): Promise<TransactionSignature>;
718
+ getUpdatePerpBidAskTwapIx(perpMarketIndex: number, makers: [PublicKey, PublicKey][]): Promise<TransactionInstruction>;
719
+ settleFundingPayment(userAccountPublicKey: PublicKey, txParams?: TxParams): Promise<TransactionSignature>;
720
+ getSettleFundingPaymentIx(userAccountPublicKey: PublicKey): Promise<TransactionInstruction>;
721
+ triggerEvent(eventName: keyof DriftClientAccountEvents, data?: any): void;
722
+ getOracleDataForPerpMarket(marketIndex: number): OraclePriceData;
723
+ getOracleDataForSpotMarket(marketIndex: number): OraclePriceData;
724
+ initializeInsuranceFundStake(marketIndex: number, txParams?: TxParams): Promise<TransactionSignature>;
725
+ getInitializeInsuranceFundStakeIx(marketIndex: number): Promise<TransactionInstruction>;
726
+ getAddInsuranceFundStakeIx(marketIndex: number, amount: BN, collateralAccountPublicKey: PublicKey): Promise<TransactionInstruction>;
727
+ /**
728
+ * Add to an insurance fund stake and optionally initialize the account
729
+ */
730
+ addInsuranceFundStake({ marketIndex, amount, collateralAccountPublicKey, initializeStakeAccount, fromSubaccount, txParams, }: {
731
+ /**
732
+ * Spot market index
733
+ */
734
+ marketIndex: number;
735
+ amount: BN;
736
+ /**
737
+ * The account where the funds to stake come from. Usually an associated token account
738
+ */
739
+ collateralAccountPublicKey: PublicKey;
740
+ /**
741
+ * Add instructions to initialize the staking account -- required if its the first time the currrent authority has staked in this market
742
+ */
743
+ initializeStakeAccount?: boolean;
744
+ /**
745
+ * Optional -- withdraw from current subaccount to fund stake amount, instead of wallet balance
746
+ */
747
+ fromSubaccount?: boolean;
748
+ txParams?: TxParams;
749
+ }): Promise<TransactionSignature>;
750
+ requestRemoveInsuranceFundStake(marketIndex: number, amount: BN, txParams?: TxParams): Promise<TransactionSignature>;
751
+ cancelRequestRemoveInsuranceFundStake(marketIndex: number, txParams?: TxParams): Promise<TransactionSignature>;
752
+ removeInsuranceFundStake(marketIndex: number, collateralAccountPublicKey: PublicKey, txParams?: TxParams): Promise<TransactionSignature>;
753
+ updateUserQuoteAssetInsuranceStake(authority: PublicKey, txParams?: TxParams): Promise<TransactionSignature>;
754
+ getUpdateUserQuoteAssetInsuranceStakeIx(authority: PublicKey): Promise<TransactionInstruction>;
755
+ updateUserGovTokenInsuranceStake(authority: PublicKey, txParams?: TxParams): Promise<TransactionSignature>;
756
+ getUpdateUserGovTokenInsuranceStakeIx(authority: PublicKey): Promise<TransactionInstruction>;
757
+ settleRevenueToInsuranceFund(spotMarketIndex: number, txParams?: TxParams): Promise<TransactionSignature>;
758
+ getSettleRevenueToInsuranceFundIx(spotMarketIndex: number): Promise<TransactionInstruction>;
759
+ resolvePerpPnlDeficit(spotMarketIndex: number, perpMarketIndex: number, txParams?: TxParams): Promise<TransactionSignature>;
760
+ getResolvePerpPnlDeficitIx(spotMarketIndex: number, perpMarketIndex: number): Promise<TransactionInstruction>;
761
+ getDepositIntoSpotMarketRevenuePoolIx(marketIndex: number, amount: BN, userTokenAccountPublicKey: PublicKey): Promise<TransactionInstruction>;
762
+ depositIntoSpotMarketRevenuePool(marketIndex: number, amount: BN, userTokenAccountPublicKey: PublicKey): Promise<TransactionSignature>;
763
+ getPerpMarketExtendedInfo(marketIndex: number): PerpMarketExtendedInfo;
764
+ /**
765
+ * Calculates taker / maker fee (as a percentage, e.g. .001 = 10 basis points) for particular marketType
766
+ * @param marketType
767
+ * @param positionMarketIndex
768
+ * @returns : {takerFee: number, makerFee: number} Precision None
769
+ */
770
+ getMarketFees(marketType: MarketType, marketIndex?: number, user?: User): {
771
+ takerFee: number;
772
+ makerFee: number;
773
+ };
774
+ /**
775
+ * Returns the market index and type for a given market name
776
+ * E.g. "SOL-PERP" -> { marketIndex: 0, marketType: MarketType.PERP }
777
+ *
778
+ * @param name
779
+ */
780
+ getMarketIndexAndType(name: string): {
781
+ marketIndex: number;
782
+ marketType: MarketType;
783
+ } | undefined;
784
+ getReceiverProgram(): Program<PythSolanaReceiver>;
785
+ getSwitchboardOnDemandProgram(): Promise<Program30<Idl30>>;
786
+ postPythPullOracleUpdateAtomic(vaaString: string, feedId: string): Promise<TransactionSignature>;
787
+ postMultiPythPullOracleUpdatesAtomic(vaaString: string, feedIds: string[]): Promise<TransactionSignature>;
788
+ getPostPythPullOracleUpdateAtomicIxs(vaaString: string, feedIds: string | string[], numSignatures?: number): Promise<TransactionInstruction[]>;
789
+ private getSinglePostPythPullOracleAtomicIx;
790
+ updatePythPullOracle(vaaString: string, feedId: string): Promise<TransactionSignature>;
791
+ getUpdatePythPullOracleIxs(params: {
792
+ merklePriceUpdate: {
793
+ message: Buffer;
794
+ proof: number[][];
795
+ };
796
+ }, feedId: string, encodedVaaAddress: PublicKey): Promise<TransactionInstruction>;
797
+ getPostSwitchboardOnDemandUpdateAtomicIx(feed: PublicKey, numSignatures?: number): Promise<TransactionInstruction | undefined>;
798
+ postSwitchboardOnDemandUpdate(feed: PublicKey, numSignatures?: number): Promise<TransactionSignature>;
799
+ private getBuildEncodedVaaIxs;
800
+ enableUserHighLeverageMode(subAccountId: number, txParams?: TxParams): Promise<TransactionSignature>;
801
+ getEnableHighLeverageModeIx(subAccountId: number): Promise<anchor.web3.TransactionInstruction>;
802
+ disableUserHighLeverageMode(user: PublicKey, userAccount?: UserAccount, txParams?: TxParams): Promise<TransactionSignature>;
803
+ getDisableHighLeverageModeIx(user: PublicKey, userAccount?: UserAccount): Promise<anchor.web3.TransactionInstruction>;
804
+ fetchHighLeverageModeConfig(): Promise<HighLeverageModeConfig>;
805
+ private handleSignedTransaction;
806
+ private handlePreSignedTransaction;
807
+ private isVersionedTransaction;
808
+ sendTransaction(tx: Transaction | VersionedTransaction, additionalSigners?: Array<Signer>, opts?: ConfirmOptions, preSigned?: boolean): Promise<TxSigAndSlot>;
809
+ buildTransaction(instructions: TransactionInstruction | TransactionInstruction[], txParams?: TxParams, txVersion?: TransactionVersion, lookupTables?: AddressLookupTableAccount[], forceVersionedTransaction?: boolean, recentBlockhash?: BlockhashWithExpiryBlockHeight): Promise<Transaction | VersionedTransaction>;
810
+ buildBulkTransactions(instructions: (TransactionInstruction | TransactionInstruction[])[], txParams?: TxParams, txVersion?: TransactionVersion, lookupTables?: AddressLookupTableAccount[], forceVersionedTransaction?: boolean): Promise<(Transaction | VersionedTransaction)[]>;
811
+ buildTransactionsMap(instructionsMap: Record<string, TransactionInstruction | TransactionInstruction[]>, txParams?: TxParams, txVersion?: TransactionVersion, lookupTables?: AddressLookupTableAccount[], forceVersionedTransaction?: boolean): Promise<MappedRecord<Record<string, anchor.web3.TransactionInstruction | anchor.web3.TransactionInstruction[]>, anchor.web3.Transaction | anchor.web3.VersionedTransaction>>;
812
+ buildAndSignTransactionsMap(instructionsMap: Record<string, TransactionInstruction | TransactionInstruction[]>, txParams?: TxParams, txVersion?: TransactionVersion, lookupTables?: AddressLookupTableAccount[], forceVersionedTransaction?: boolean): Promise<{
813
+ signedTxMap: Record<string, anchor.web3.Transaction>;
814
+ signedTxData: SignedTxData[];
815
+ } | {
816
+ signedTxMap: MappedRecord<Record<string, anchor.web3.TransactionInstruction | anchor.web3.TransactionInstruction[]>, anchor.web3.Transaction | anchor.web3.VersionedTransaction>;
817
+ signedTxData: SignedTxData[];
818
+ }>;
819
+ }
820
+ export {};