@drift-labs/sdk-browser 2.163.0-beta.11 → 2.163.0-beta.13

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 (482) hide show
  1. package/VERSION +1 -1
  2. package/bun.lock +26 -13
  3. package/lib/browser/accounts/fetch.d.ts +9 -0
  4. package/lib/browser/accounts/fetch.js +14 -1
  5. package/lib/browser/addresses/pda.d.ts +1 -1
  6. package/lib/browser/addresses/pda.js +2 -2
  7. package/lib/browser/adminClient.d.ts +1 -1
  8. package/lib/browser/adminClient.js +2 -2
  9. package/lib/browser/bankrun/bankrunConnection.d.ts +1 -1
  10. package/lib/browser/bankrun/bankrunConnection.js +1 -1
  11. package/lib/browser/clock/clockSubscriber.js +1 -1
  12. package/lib/browser/config.d.ts +1 -1
  13. package/lib/browser/constants/numericConstants.d.ts +1 -1
  14. package/lib/browser/constants/numericConstants.js +1 -1
  15. package/lib/browser/constants/perpMarkets.js +1 -1
  16. package/lib/browser/constants/spotMarkets.d.ts +1 -1
  17. package/lib/browser/constants/spotMarkets.js +4 -3
  18. package/lib/browser/core/DriftCore.d.ts +224 -0
  19. package/lib/browser/core/DriftCore.js +138 -0
  20. package/lib/browser/core/index.d.ts +12 -0
  21. package/lib/browser/core/index.js +28 -0
  22. package/lib/browser/core/instructions/deposit.d.ts +19 -0
  23. package/lib/browser/core/instructions/deposit.js +19 -0
  24. package/lib/browser/core/instructions/fill.d.ts +13 -0
  25. package/lib/browser/core/instructions/fill.js +17 -0
  26. package/lib/browser/core/instructions/funding.d.ts +9 -0
  27. package/lib/browser/core/instructions/funding.js +13 -0
  28. package/lib/browser/core/instructions/liquidation.d.ts +15 -0
  29. package/lib/browser/core/instructions/liquidation.js +17 -0
  30. package/lib/browser/core/instructions/orders.d.ts +22 -0
  31. package/lib/browser/core/instructions/orders.js +27 -0
  32. package/lib/browser/core/instructions/perpOrders.d.ts +78 -0
  33. package/lib/browser/core/instructions/perpOrders.js +99 -0
  34. package/lib/browser/core/instructions/settlement.d.ts +11 -0
  35. package/lib/browser/core/instructions/settlement.js +15 -0
  36. package/lib/browser/core/instructions/trigger.d.ts +11 -0
  37. package/lib/browser/core/instructions/trigger.js +15 -0
  38. package/lib/browser/core/instructions/withdraw.d.ts +20 -0
  39. package/lib/browser/core/instructions/withdraw.js +20 -0
  40. package/lib/browser/core/remainingAccounts.d.ts +27 -0
  41. package/lib/browser/core/remainingAccounts.js +122 -0
  42. package/lib/browser/core/signedMsg.d.ts +17 -0
  43. package/lib/browser/core/signedMsg.js +39 -0
  44. package/lib/browser/decode/customCoder.d.ts +1 -1
  45. package/lib/browser/decode/customCoder.js +1 -1
  46. package/lib/browser/decode/user.js +1 -1
  47. package/lib/browser/dlob/DLOB.d.ts +1 -1
  48. package/lib/browser/dlob/DLOB.js +1 -1
  49. package/lib/browser/dlob/DLOBNode.d.ts +1 -1
  50. package/lib/browser/dlob/DLOBNode.js +1 -1
  51. package/lib/browser/dlob/DLOBSubscriber.d.ts +1 -1
  52. package/lib/browser/dlob/NodeList.d.ts +1 -1
  53. package/lib/browser/dlob/orderBookLevels.d.ts +1 -1
  54. package/lib/browser/dlob/orderBookLevels.js +1 -1
  55. package/lib/browser/driftClient.d.ts +17 -24
  56. package/lib/browser/driftClient.js +192 -291
  57. package/lib/browser/driftClientConfig.d.ts +1 -1
  58. package/lib/browser/events/eventSubscriber.d.ts +1 -1
  59. package/lib/browser/events/fetchLogs.d.ts +1 -1
  60. package/lib/browser/events/parse.d.ts +1 -1
  61. package/lib/browser/factory/bigNum.d.ts +1 -1
  62. package/lib/browser/factory/bigNum.js +1 -1
  63. package/lib/browser/factory/oracleClient.js +1 -1
  64. package/lib/browser/index.d.ts +2 -1
  65. package/lib/browser/index.js +2 -1
  66. package/lib/browser/indicative-quotes/indicativeQuotesSender.d.ts +1 -1
  67. package/lib/browser/isomorphic/anchor.browser.d.ts +24 -0
  68. package/lib/browser/isomorphic/anchor.browser.js +60 -0
  69. package/lib/browser/isomorphic/anchor.d.ts +24 -0
  70. package/lib/browser/isomorphic/anchor.js +60 -0
  71. package/lib/browser/isomorphic/anchor29.browser.d.ts +12 -0
  72. package/lib/browser/isomorphic/anchor29.browser.js +48 -0
  73. package/lib/browser/isomorphic/anchor29.d.ts +12 -0
  74. package/lib/browser/isomorphic/anchor29.js +48 -0
  75. package/lib/browser/jupiter/jupiterClient.d.ts +1 -1
  76. package/lib/browser/marginCalculation.d.ts +1 -1
  77. package/lib/browser/marinade/index.d.ts +1 -1
  78. package/lib/browser/marinade/index.js +2 -2
  79. package/lib/browser/math/amm.d.ts +1 -1
  80. package/lib/browser/math/amm.js +1 -1
  81. package/lib/browser/math/auction.d.ts +1 -1
  82. package/lib/browser/math/auction.js +1 -1
  83. package/lib/browser/math/conversion.d.ts +1 -1
  84. package/lib/browser/math/conversion.js +1 -1
  85. package/lib/browser/math/exchangeStatus.js +1 -1
  86. package/lib/browser/math/fuel.d.ts +1 -1
  87. package/lib/browser/math/fuel.js +1 -1
  88. package/lib/browser/math/funding.d.ts +1 -1
  89. package/lib/browser/math/funding.js +1 -1
  90. package/lib/browser/math/insurance.d.ts +1 -1
  91. package/lib/browser/math/insurance.js +1 -1
  92. package/lib/browser/math/liquidation.d.ts +1 -1
  93. package/lib/browser/math/liquidation.js +1 -1
  94. package/lib/browser/math/margin.d.ts +1 -1
  95. package/lib/browser/math/margin.js +1 -1
  96. package/lib/browser/math/market.d.ts +1 -1
  97. package/lib/browser/math/market.js +1 -1
  98. package/lib/browser/math/oracles.d.ts +1 -1
  99. package/lib/browser/math/oracles.js +1 -1
  100. package/lib/browser/math/orders.d.ts +1 -1
  101. package/lib/browser/math/orders.js +1 -1
  102. package/lib/browser/math/position.d.ts +1 -1
  103. package/lib/browser/math/position.js +1 -1
  104. package/lib/browser/math/protectedMakerParams.js +1 -1
  105. package/lib/browser/math/repeg.d.ts +1 -1
  106. package/lib/browser/math/repeg.js +1 -1
  107. package/lib/browser/math/spotBalance.d.ts +1 -1
  108. package/lib/browser/math/spotBalance.js +1 -1
  109. package/lib/browser/math/spotMarket.d.ts +1 -1
  110. package/lib/browser/math/spotMarket.js +1 -1
  111. package/lib/browser/math/spotPosition.d.ts +1 -1
  112. package/lib/browser/math/spotPosition.js +1 -1
  113. package/lib/browser/math/state.d.ts +1 -1
  114. package/lib/browser/math/state.js +1 -1
  115. package/lib/browser/math/superStake.d.ts +1 -1
  116. package/lib/browser/math/superStake.js +1 -1
  117. package/lib/browser/math/trade.d.ts +1 -1
  118. package/lib/browser/math/trade.js +1 -1
  119. package/lib/browser/math/utils.d.ts +1 -1
  120. package/lib/browser/math/utils.js +1 -1
  121. package/lib/browser/memcmp.js +8 -8
  122. package/lib/browser/openbook/openbookV2Subscriber.d.ts +1 -1
  123. package/lib/browser/openbook/openbookV2Subscriber.js +3 -3
  124. package/lib/browser/oracles/pythClient.d.ts +1 -1
  125. package/lib/browser/oracles/pythClient.js +1 -1
  126. package/lib/browser/oracles/pythLazerClient.d.ts +1 -1
  127. package/lib/browser/oracles/pythLazerClient.js +1 -1
  128. package/lib/browser/oracles/quoteAssetOracleClient.js +1 -1
  129. package/lib/browser/oracles/strictOraclePrice.d.ts +1 -1
  130. package/lib/browser/oracles/strictOraclePrice.js +1 -1
  131. package/lib/browser/oracles/types.d.ts +1 -1
  132. package/lib/browser/oracles/utils.d.ts +1 -1
  133. package/lib/browser/orderParams.d.ts +1 -1
  134. package/lib/browser/orderSubscriber/OrderSubscriber.js +1 -1
  135. package/lib/browser/phoenix/phoenixSubscriber.d.ts +1 -1
  136. package/lib/browser/phoenix/phoenixSubscriber.js +1 -1
  137. package/lib/browser/pyth/types.d.ts +1 -1
  138. package/lib/browser/serum/serumSubscriber.d.ts +1 -1
  139. package/lib/browser/serum/serumSubscriber.js +1 -1
  140. package/lib/browser/slot/SlothashSubscriber.js +6 -3
  141. package/lib/browser/swap/UnifiedSwapClient.d.ts +1 -1
  142. package/lib/browser/titan/titanClient.d.ts +1 -1
  143. package/lib/browser/tokenFaucet.d.ts +3 -3
  144. package/lib/browser/tokenFaucet.js +4 -4
  145. package/lib/browser/types.d.ts +1 -1
  146. package/lib/browser/user.d.ts +1 -1
  147. package/lib/browser/user.js +1 -1
  148. package/lib/browser/userMap/referrerMap.js +7 -4
  149. package/lib/browser/userStats.d.ts +1 -1
  150. package/lib/browser/userStats.js +1 -1
  151. package/lib/node/accounts/fetch.d.ts +9 -0
  152. package/lib/node/accounts/fetch.d.ts.map +1 -1
  153. package/lib/node/accounts/fetch.js +14 -1
  154. package/lib/node/addresses/pda.d.ts +1 -1
  155. package/lib/node/addresses/pda.d.ts.map +1 -1
  156. package/lib/node/addresses/pda.js +2 -2
  157. package/lib/node/adminClient.d.ts +1 -1
  158. package/lib/node/adminClient.d.ts.map +1 -1
  159. package/lib/node/adminClient.js +2 -2
  160. package/lib/node/bankrun/bankrunConnection.d.ts +1 -1
  161. package/lib/node/bankrun/bankrunConnection.d.ts.map +1 -1
  162. package/lib/node/bankrun/bankrunConnection.js +1 -1
  163. package/lib/node/clock/clockSubscriber.js +1 -1
  164. package/lib/node/config.d.ts +1 -1
  165. package/lib/node/config.d.ts.map +1 -1
  166. package/lib/node/constants/numericConstants.d.ts +1 -1
  167. package/lib/node/constants/numericConstants.d.ts.map +1 -1
  168. package/lib/node/constants/numericConstants.js +1 -1
  169. package/lib/node/constants/perpMarkets.js +1 -1
  170. package/lib/node/constants/spotMarkets.d.ts +1 -1
  171. package/lib/node/constants/spotMarkets.d.ts.map +1 -1
  172. package/lib/node/constants/spotMarkets.js +4 -3
  173. package/lib/node/core/DriftCore.d.ts +225 -0
  174. package/lib/node/core/DriftCore.d.ts.map +1 -0
  175. package/lib/node/core/DriftCore.js +138 -0
  176. package/lib/node/core/index.d.ts +13 -0
  177. package/lib/node/core/index.d.ts.map +1 -0
  178. package/lib/node/core/index.js +28 -0
  179. package/lib/node/core/instructions/deposit.d.ts +20 -0
  180. package/lib/node/core/instructions/deposit.d.ts.map +1 -0
  181. package/lib/node/core/instructions/deposit.js +19 -0
  182. package/lib/node/core/instructions/fill.d.ts +14 -0
  183. package/lib/node/core/instructions/fill.d.ts.map +1 -0
  184. package/lib/node/core/instructions/fill.js +17 -0
  185. package/lib/node/core/instructions/funding.d.ts +10 -0
  186. package/lib/node/core/instructions/funding.d.ts.map +1 -0
  187. package/lib/node/core/instructions/funding.js +13 -0
  188. package/lib/node/core/instructions/liquidation.d.ts +16 -0
  189. package/lib/node/core/instructions/liquidation.d.ts.map +1 -0
  190. package/lib/node/core/instructions/liquidation.js +17 -0
  191. package/lib/node/core/instructions/orders.d.ts +23 -0
  192. package/lib/node/core/instructions/orders.d.ts.map +1 -0
  193. package/lib/node/core/instructions/orders.js +27 -0
  194. package/lib/node/core/instructions/perpOrders.d.ts +79 -0
  195. package/lib/node/core/instructions/perpOrders.d.ts.map +1 -0
  196. package/lib/node/core/instructions/perpOrders.js +99 -0
  197. package/lib/node/core/instructions/settlement.d.ts +12 -0
  198. package/lib/node/core/instructions/settlement.d.ts.map +1 -0
  199. package/lib/node/core/instructions/settlement.js +15 -0
  200. package/lib/node/core/instructions/trigger.d.ts +12 -0
  201. package/lib/node/core/instructions/trigger.d.ts.map +1 -0
  202. package/lib/node/core/instructions/trigger.js +15 -0
  203. package/lib/node/core/instructions/withdraw.d.ts +21 -0
  204. package/lib/node/core/instructions/withdraw.d.ts.map +1 -0
  205. package/lib/node/core/instructions/withdraw.js +20 -0
  206. package/lib/node/core/remainingAccounts.d.ts +28 -0
  207. package/lib/node/core/remainingAccounts.d.ts.map +1 -0
  208. package/lib/node/core/remainingAccounts.js +122 -0
  209. package/lib/node/core/signedMsg.d.ts +18 -0
  210. package/lib/node/core/signedMsg.d.ts.map +1 -0
  211. package/lib/node/core/signedMsg.js +39 -0
  212. package/lib/node/decode/customCoder.d.ts +1 -1
  213. package/lib/node/decode/customCoder.d.ts.map +1 -1
  214. package/lib/node/decode/customCoder.js +1 -1
  215. package/lib/node/decode/user.js +1 -1
  216. package/lib/node/dlob/DLOB.d.ts +1 -1
  217. package/lib/node/dlob/DLOB.d.ts.map +1 -1
  218. package/lib/node/dlob/DLOB.js +1 -1
  219. package/lib/node/dlob/DLOBNode.d.ts +1 -1
  220. package/lib/node/dlob/DLOBNode.d.ts.map +1 -1
  221. package/lib/node/dlob/DLOBNode.js +1 -1
  222. package/lib/node/dlob/DLOBSubscriber.d.ts +1 -1
  223. package/lib/node/dlob/DLOBSubscriber.d.ts.map +1 -1
  224. package/lib/node/dlob/NodeList.d.ts +1 -1
  225. package/lib/node/dlob/NodeList.d.ts.map +1 -1
  226. package/lib/node/dlob/orderBookLevels.d.ts +1 -1
  227. package/lib/node/dlob/orderBookLevels.d.ts.map +1 -1
  228. package/lib/node/dlob/orderBookLevels.js +1 -1
  229. package/lib/node/driftClient.d.ts +17 -24
  230. package/lib/node/driftClient.d.ts.map +1 -1
  231. package/lib/node/driftClient.js +192 -291
  232. package/lib/node/driftClientConfig.d.ts +1 -1
  233. package/lib/node/driftClientConfig.d.ts.map +1 -1
  234. package/lib/node/events/eventSubscriber.d.ts +1 -1
  235. package/lib/node/events/eventSubscriber.d.ts.map +1 -1
  236. package/lib/node/events/fetchLogs.d.ts +1 -1
  237. package/lib/node/events/fetchLogs.d.ts.map +1 -1
  238. package/lib/node/events/parse.d.ts +1 -1
  239. package/lib/node/events/parse.d.ts.map +1 -1
  240. package/lib/node/factory/bigNum.d.ts +1 -1
  241. package/lib/node/factory/bigNum.d.ts.map +1 -1
  242. package/lib/node/factory/bigNum.js +1 -1
  243. package/lib/node/factory/oracleClient.js +1 -1
  244. package/lib/node/index.d.ts +2 -1
  245. package/lib/node/index.d.ts.map +1 -1
  246. package/lib/node/index.js +2 -1
  247. package/lib/node/indicative-quotes/indicativeQuotesSender.d.ts +1 -1
  248. package/lib/node/indicative-quotes/indicativeQuotesSender.d.ts.map +1 -1
  249. package/lib/node/isomorphic/anchor.browser.d.ts +25 -0
  250. package/lib/node/isomorphic/anchor.browser.d.ts.map +1 -0
  251. package/lib/node/isomorphic/anchor.browser.js +60 -0
  252. package/lib/node/isomorphic/anchor.d.ts +25 -0
  253. package/lib/node/isomorphic/anchor.d.ts.map +1 -0
  254. package/lib/node/isomorphic/anchor.js +60 -0
  255. package/lib/node/isomorphic/anchor.node.d.ts.map +1 -0
  256. package/lib/node/isomorphic/anchor29.browser.d.ts +13 -0
  257. package/lib/node/isomorphic/anchor29.browser.d.ts.map +1 -0
  258. package/lib/node/isomorphic/anchor29.browser.js +48 -0
  259. package/lib/node/isomorphic/anchor29.d.ts +13 -0
  260. package/lib/node/isomorphic/anchor29.d.ts.map +1 -0
  261. package/lib/node/isomorphic/anchor29.js +48 -0
  262. package/lib/node/isomorphic/anchor29.node.d.ts.map +1 -0
  263. package/lib/node/jupiter/jupiterClient.d.ts +1 -1
  264. package/lib/node/jupiter/jupiterClient.d.ts.map +1 -1
  265. package/lib/node/marginCalculation.d.ts +1 -1
  266. package/lib/node/marginCalculation.d.ts.map +1 -1
  267. package/lib/node/marinade/index.d.ts +1 -1
  268. package/lib/node/marinade/index.d.ts.map +1 -1
  269. package/lib/node/marinade/index.js +2 -2
  270. package/lib/node/math/amm.d.ts +1 -1
  271. package/lib/node/math/amm.d.ts.map +1 -1
  272. package/lib/node/math/amm.js +1 -1
  273. package/lib/node/math/auction.d.ts +1 -1
  274. package/lib/node/math/auction.d.ts.map +1 -1
  275. package/lib/node/math/auction.js +1 -1
  276. package/lib/node/math/conversion.d.ts +1 -1
  277. package/lib/node/math/conversion.d.ts.map +1 -1
  278. package/lib/node/math/conversion.js +1 -1
  279. package/lib/node/math/exchangeStatus.js +1 -1
  280. package/lib/node/math/fuel.d.ts +1 -1
  281. package/lib/node/math/fuel.d.ts.map +1 -1
  282. package/lib/node/math/fuel.js +1 -1
  283. package/lib/node/math/funding.d.ts +1 -1
  284. package/lib/node/math/funding.d.ts.map +1 -1
  285. package/lib/node/math/funding.js +1 -1
  286. package/lib/node/math/insurance.d.ts +1 -1
  287. package/lib/node/math/insurance.d.ts.map +1 -1
  288. package/lib/node/math/insurance.js +1 -1
  289. package/lib/node/math/liquidation.d.ts +1 -1
  290. package/lib/node/math/liquidation.d.ts.map +1 -1
  291. package/lib/node/math/liquidation.js +1 -1
  292. package/lib/node/math/margin.d.ts +1 -1
  293. package/lib/node/math/margin.d.ts.map +1 -1
  294. package/lib/node/math/margin.js +1 -1
  295. package/lib/node/math/market.d.ts +1 -1
  296. package/lib/node/math/market.d.ts.map +1 -1
  297. package/lib/node/math/market.js +1 -1
  298. package/lib/node/math/oracles.d.ts +1 -1
  299. package/lib/node/math/oracles.d.ts.map +1 -1
  300. package/lib/node/math/oracles.js +1 -1
  301. package/lib/node/math/orders.d.ts +1 -1
  302. package/lib/node/math/orders.d.ts.map +1 -1
  303. package/lib/node/math/orders.js +1 -1
  304. package/lib/node/math/position.d.ts +1 -1
  305. package/lib/node/math/position.d.ts.map +1 -1
  306. package/lib/node/math/position.js +1 -1
  307. package/lib/node/math/protectedMakerParams.js +1 -1
  308. package/lib/node/math/repeg.d.ts +1 -1
  309. package/lib/node/math/repeg.d.ts.map +1 -1
  310. package/lib/node/math/repeg.js +1 -1
  311. package/lib/node/math/spotBalance.d.ts +1 -1
  312. package/lib/node/math/spotBalance.d.ts.map +1 -1
  313. package/lib/node/math/spotBalance.js +1 -1
  314. package/lib/node/math/spotMarket.d.ts +1 -1
  315. package/lib/node/math/spotMarket.d.ts.map +1 -1
  316. package/lib/node/math/spotMarket.js +1 -1
  317. package/lib/node/math/spotPosition.d.ts +1 -1
  318. package/lib/node/math/spotPosition.d.ts.map +1 -1
  319. package/lib/node/math/spotPosition.js +1 -1
  320. package/lib/node/math/state.d.ts +1 -1
  321. package/lib/node/math/state.d.ts.map +1 -1
  322. package/lib/node/math/state.js +1 -1
  323. package/lib/node/math/superStake.d.ts +1 -1
  324. package/lib/node/math/superStake.d.ts.map +1 -1
  325. package/lib/node/math/superStake.js +1 -1
  326. package/lib/node/math/trade.d.ts +1 -1
  327. package/lib/node/math/trade.d.ts.map +1 -1
  328. package/lib/node/math/trade.js +1 -1
  329. package/lib/node/math/utils.d.ts +1 -1
  330. package/lib/node/math/utils.d.ts.map +1 -1
  331. package/lib/node/math/utils.js +1 -1
  332. package/lib/node/memcmp.js +8 -8
  333. package/lib/node/openbook/openbookV2Subscriber.d.ts +1 -1
  334. package/lib/node/openbook/openbookV2Subscriber.d.ts.map +1 -1
  335. package/lib/node/openbook/openbookV2Subscriber.js +3 -3
  336. package/lib/node/oracles/pythClient.d.ts +1 -1
  337. package/lib/node/oracles/pythClient.d.ts.map +1 -1
  338. package/lib/node/oracles/pythClient.js +1 -1
  339. package/lib/node/oracles/pythLazerClient.d.ts +1 -1
  340. package/lib/node/oracles/pythLazerClient.d.ts.map +1 -1
  341. package/lib/node/oracles/pythLazerClient.js +1 -1
  342. package/lib/node/oracles/quoteAssetOracleClient.js +1 -1
  343. package/lib/node/oracles/strictOraclePrice.d.ts +1 -1
  344. package/lib/node/oracles/strictOraclePrice.d.ts.map +1 -1
  345. package/lib/node/oracles/strictOraclePrice.js +1 -1
  346. package/lib/node/oracles/types.d.ts +1 -1
  347. package/lib/node/oracles/types.d.ts.map +1 -1
  348. package/lib/node/oracles/utils.d.ts +1 -1
  349. package/lib/node/oracles/utils.d.ts.map +1 -1
  350. package/lib/node/orderParams.d.ts +1 -1
  351. package/lib/node/orderParams.d.ts.map +1 -1
  352. package/lib/node/orderSubscriber/OrderSubscriber.js +1 -1
  353. package/lib/node/phoenix/phoenixSubscriber.d.ts +1 -1
  354. package/lib/node/phoenix/phoenixSubscriber.d.ts.map +1 -1
  355. package/lib/node/phoenix/phoenixSubscriber.js +1 -1
  356. package/lib/node/pyth/types.d.ts +1 -1
  357. package/lib/node/pyth/types.d.ts.map +1 -1
  358. package/lib/node/serum/serumSubscriber.d.ts +1 -1
  359. package/lib/node/serum/serumSubscriber.d.ts.map +1 -1
  360. package/lib/node/serum/serumSubscriber.js +1 -1
  361. package/lib/node/slot/SlothashSubscriber.js +6 -3
  362. package/lib/node/swap/UnifiedSwapClient.d.ts +1 -1
  363. package/lib/node/swap/UnifiedSwapClient.d.ts.map +1 -1
  364. package/lib/node/titan/titanClient.d.ts +1 -1
  365. package/lib/node/titan/titanClient.d.ts.map +1 -1
  366. package/lib/node/tokenFaucet.d.ts +3 -3
  367. package/lib/node/tokenFaucet.d.ts.map +1 -1
  368. package/lib/node/tokenFaucet.js +4 -4
  369. package/lib/node/types.d.ts +1 -1
  370. package/lib/node/types.d.ts.map +1 -1
  371. package/lib/node/user.d.ts +1 -1
  372. package/lib/node/user.d.ts.map +1 -1
  373. package/lib/node/user.js +1 -1
  374. package/lib/node/userMap/referrerMap.js +7 -4
  375. package/lib/node/userStats.d.ts +1 -1
  376. package/lib/node/userStats.d.ts.map +1 -1
  377. package/lib/node/userStats.js +1 -1
  378. package/package.json +4 -2
  379. package/scripts/postbuild.js +1 -1
  380. package/src/accounts/fetch.ts +27 -0
  381. package/src/accounts/webSocketAccountSubscriber.ts +1 -1
  382. package/src/accounts/webSocketAccountSubscriberV2.ts +1 -1
  383. package/src/accounts/webSocketProgramAccountSubscriber.ts +1 -1
  384. package/src/accounts/webSocketProgramAccountSubscriberV2.ts +1 -1
  385. package/src/accounts/webSocketProgramAccountsSubscriberV2.ts +1 -1
  386. package/src/addresses/pda.ts +2 -2
  387. package/src/adminClient.ts +2 -2
  388. package/src/bankrun/bankrunConnection.ts +1 -1
  389. package/src/clock/clockSubscriber.ts +1 -1
  390. package/src/config.ts +1 -1
  391. package/src/constants/numericConstants.ts +1 -1
  392. package/src/constants/perpMarkets.ts +1 -1
  393. package/src/constants/spotMarkets.ts +4 -3
  394. package/src/core/DriftCore.ts +326 -0
  395. package/src/core/index.ts +12 -0
  396. package/src/core/instructions/deposit.ts +42 -0
  397. package/src/core/instructions/fill.ts +34 -0
  398. package/src/core/instructions/funding.ts +21 -0
  399. package/src/core/instructions/liquidation.ts +37 -0
  400. package/src/core/instructions/orders.ts +56 -0
  401. package/src/core/instructions/perpOrders.ts +192 -0
  402. package/src/core/instructions/settlement.ts +26 -0
  403. package/src/core/instructions/trigger.ts +26 -0
  404. package/src/core/instructions/withdraw.ts +44 -0
  405. package/src/core/remainingAccounts.ts +276 -0
  406. package/src/core/signedMsg.ts +71 -0
  407. package/src/decode/customCoder.ts +1 -1
  408. package/src/decode/user.ts +1 -1
  409. package/src/dlob/DLOB.ts +1 -1
  410. package/src/dlob/DLOBNode.ts +1 -1
  411. package/src/dlob/DLOBSubscriber.ts +1 -1
  412. package/src/dlob/NodeList.ts +1 -1
  413. package/src/dlob/orderBookLevels.ts +1 -1
  414. package/src/driftClient.ts +207 -402
  415. package/src/driftClientConfig.ts +1 -1
  416. package/src/events/eventSubscriber.ts +1 -1
  417. package/src/events/fetchLogs.ts +1 -1
  418. package/src/events/parse.ts +1 -1
  419. package/src/factory/bigNum.ts +1 -1
  420. package/src/factory/oracleClient.ts +1 -1
  421. package/src/index.ts +2 -1
  422. package/src/indicative-quotes/indicativeQuotesSender.ts +1 -1
  423. package/src/isomorphic/anchor.browser.ts +44 -0
  424. package/src/isomorphic/anchor.node.ts +1 -0
  425. package/src/isomorphic/anchor.ts +1 -0
  426. package/src/isomorphic/anchor29.browser.ts +24 -0
  427. package/src/isomorphic/anchor29.node.ts +1 -0
  428. package/src/isomorphic/anchor29.ts +1 -0
  429. package/src/jupiter/jupiterClient.ts +1 -1
  430. package/src/marginCalculation.ts +1 -1
  431. package/src/marinade/index.ts +1 -1
  432. package/src/math/amm.ts +1 -1
  433. package/src/math/auction.ts +1 -1
  434. package/src/math/conversion.ts +1 -1
  435. package/src/math/exchangeStatus.ts +1 -1
  436. package/src/math/fuel.ts +1 -1
  437. package/src/math/funding.ts +1 -1
  438. package/src/math/insurance.ts +1 -1
  439. package/src/math/liquidation.ts +1 -1
  440. package/src/math/margin.ts +1 -1
  441. package/src/math/market.ts +1 -1
  442. package/src/math/oracles.ts +1 -1
  443. package/src/math/orders.ts +1 -1
  444. package/src/math/position.ts +1 -1
  445. package/src/math/protectedMakerParams.ts +1 -1
  446. package/src/math/repeg.ts +1 -1
  447. package/src/math/spotBalance.ts +1 -1
  448. package/src/math/spotMarket.ts +1 -1
  449. package/src/math/spotPosition.ts +1 -1
  450. package/src/math/state.ts +1 -1
  451. package/src/math/superStake.ts +1 -1
  452. package/src/math/trade.ts +1 -1
  453. package/src/math/utils.ts +1 -1
  454. package/src/memcmp.ts +1 -1
  455. package/src/openbook/openbookV2Subscriber.ts +7 -1
  456. package/src/oracles/pythClient.ts +1 -1
  457. package/src/oracles/pythLazerClient.ts +1 -1
  458. package/src/oracles/quoteAssetOracleClient.ts +1 -1
  459. package/src/oracles/strictOraclePrice.ts +1 -1
  460. package/src/oracles/types.ts +1 -1
  461. package/src/oracles/utils.ts +1 -1
  462. package/src/orderParams.ts +1 -1
  463. package/src/orderSubscriber/OrderSubscriber.ts +1 -1
  464. package/src/phoenix/phoenixSubscriber.ts +1 -1
  465. package/src/pyth/types.ts +1 -1
  466. package/src/serum/serumSubscriber.ts +1 -1
  467. package/src/slot/SlothashSubscriber.ts +2 -2
  468. package/src/swap/UnifiedSwapClient.ts +1 -1
  469. package/src/titan/titanClient.ts +1 -1
  470. package/src/tokenFaucet.ts +3 -3
  471. package/src/types.ts +1 -1
  472. package/src/user.ts +1 -1
  473. package/src/userMap/referrerMap.ts +1 -1
  474. package/src/userMap/userMap.ts +1 -1
  475. package/src/userStats.ts +1 -1
  476. package/tests/DriftCore/decode.test.ts +16 -0
  477. package/tests/DriftCore/fill_trigger.test.ts +73 -0
  478. package/tests/DriftCore/instructions.test.ts +46 -0
  479. package/tests/DriftCore/pdas.test.ts +29 -0
  480. package/tests/DriftCore/perp_orders.test.ts +205 -0
  481. package/tests/DriftCore/remainingAccounts.test.ts +70 -0
  482. package/tests/DriftCore/settlement_liquidation.test.ts +69 -0
@@ -12,8 +12,8 @@
12
12
  *
13
13
  * Instruction → on-chain handler mapping: see ARCHITECTURE.md § SDK↔Instruction Mapping.
14
14
  */
15
- import * as anchor from '@coral-xyz/anchor';
16
- import { AnchorProvider, BN, Program, ProgramAccount } from '@coral-xyz/anchor';
15
+ import { AnchorProvider, BN, Program } from './isomorphic/anchor';
16
+ import type { ProgramAccount } from '@coral-xyz/anchor';
17
17
  import bs58 from 'bs58';
18
18
  import {
19
19
  ASSOCIATED_TOKEN_PROGRAM_ID,
@@ -76,7 +76,7 @@ import {
76
76
  ConstituentTargetBaseAccount,
77
77
  AmmCache,
78
78
  } from './types';
79
- import driftIDL from './idl/drift.json';
79
+ import { DriftCore } from './core/DriftCore';
80
80
 
81
81
  /** Client-side guardrail; mirrors on-chain `ErrorCode::SpotDlobTradingDisabled`. */
82
82
  const SPOT_DLOB_TRADING_DISABLED_MSG =
@@ -95,6 +95,7 @@ import {
95
95
  SystemProgram,
96
96
  SYSVAR_CLOCK_PUBKEY,
97
97
  SYSVAR_INSTRUCTIONS_PUBKEY,
98
+ SYSVAR_RENT_PUBKEY,
98
99
  Transaction,
99
100
  TransactionInstruction,
100
101
  TransactionSignature,
@@ -205,8 +206,6 @@ import nacl from 'tweetnacl';
205
206
  import { getOracleId } from './oracles/oracleId';
206
207
  import { SignedMsgOrderParams } from './types';
207
208
  import { TakerInfo } from './types';
208
- // BN is already imported globally in this file via other imports
209
- import { sha256 } from '@noble/hashes/sha256';
210
209
  import { getOracleConfidenceFromMMOracleData } from './oracles/utils';
211
210
  import { ConstituentMap } from './constituentMap/constituentMap';
212
211
  import { hasBuilder } from './math/orders';
@@ -223,14 +222,8 @@ import { UnifiedSwapClient } from './swap/UnifiedSwapClient';
223
222
  */
224
223
  export type SwapClient = TitanClient | JupiterClient;
225
224
 
226
- type RemainingAccountParams = {
227
- userAccounts: UserAccount[];
228
- writablePerpMarketIndexes?: number[];
229
- writableSpotMarketIndexes?: number[];
230
- readablePerpMarketIndex?: number | number[];
231
- readableSpotMarketIndexes?: number[];
232
- useMarketLastSlotCache?: boolean;
233
- };
225
+ type RemainingAccountParams =
226
+ import('./core/remainingAccounts').RemainingAccountParams;
234
227
 
235
228
  /**
236
229
  * # DriftClient
@@ -348,7 +341,7 @@ export class DriftClient {
348
341
  this.opts
349
342
  );
350
343
  this.program = new Program<Drift>(
351
- driftIDL as Drift,
344
+ DriftCore.defaultIdl() as unknown as Drift,
352
345
  this.provider,
353
346
  config.coder
354
347
  );
@@ -859,7 +852,10 @@ export class DriftClient {
859
852
  newWallet,
860
853
  this.opts
861
854
  );
862
- const newProgram = new Program<Drift>(driftIDL as Drift, newProvider);
855
+ const newProgram = new Program<Drift>(
856
+ DriftCore.defaultIdl() as unknown as Drift,
857
+ newProvider
858
+ );
863
859
 
864
860
  this.skipLoadUsers = false;
865
861
  // Update provider for txSender with new wallet details
@@ -1178,8 +1174,8 @@ export class DriftClient {
1178
1174
  ),
1179
1175
  authority,
1180
1176
  payer,
1181
- rent: anchor.web3.SYSVAR_RENT_PUBKEY,
1182
- systemProgram: anchor.web3.SystemProgram.programId,
1177
+ rent: SYSVAR_RENT_PUBKEY,
1178
+ systemProgram: SystemProgram.programId,
1183
1179
  state: await this.getStatePublicKey(),
1184
1180
  },
1185
1181
  });
@@ -1226,8 +1222,8 @@ export class DriftClient {
1226
1222
  signedMsgUserOrders: signedMsgUserAccountPublicKey,
1227
1223
  authority,
1228
1224
  payer,
1229
- rent: anchor.web3.SYSVAR_RENT_PUBKEY,
1230
- systemProgram: anchor.web3.SystemProgram.programId,
1225
+ rent: SYSVAR_RENT_PUBKEY,
1226
+ systemProgram: SystemProgram.programId,
1231
1227
  },
1232
1228
  });
1233
1229
 
@@ -1267,7 +1263,7 @@ export class DriftClient {
1267
1263
  signedMsgUserOrders: signedMsgUserAccountPublicKey,
1268
1264
  authority,
1269
1265
  payer: this.wallet.publicKey,
1270
- systemProgram: anchor.web3.SystemProgram.programId,
1266
+ systemProgram: SystemProgram.programId,
1271
1267
  user: await getUserAccountPublicKey(
1272
1268
  this.program.programId,
1273
1269
  authority,
@@ -1307,8 +1303,8 @@ export class DriftClient {
1307
1303
  accounts: {
1308
1304
  signedMsgWsDelegates,
1309
1305
  authority: this.wallet.publicKey,
1310
- rent: anchor.web3.SYSVAR_RENT_PUBKEY,
1311
- systemProgram: anchor.web3.SystemProgram.programId,
1306
+ rent: SYSVAR_RENT_PUBKEY,
1307
+ systemProgram: SystemProgram.programId,
1312
1308
  },
1313
1309
  }
1314
1310
  );
@@ -1340,8 +1336,8 @@ export class DriftClient {
1340
1336
  revenueShare,
1341
1337
  authority,
1342
1338
  payer: overrides?.payer ?? this.wallet.publicKey,
1343
- rent: anchor.web3.SYSVAR_RENT_PUBKEY,
1344
- systemProgram: anchor.web3.SystemProgram.programId,
1339
+ rent: SYSVAR_RENT_PUBKEY,
1340
+ systemProgram: SystemProgram.programId,
1345
1341
  },
1346
1342
  });
1347
1343
  }
@@ -1381,8 +1377,8 @@ export class DriftClient {
1381
1377
  authority
1382
1378
  ),
1383
1379
  state: await this.getStatePublicKey(),
1384
- rent: anchor.web3.SYSVAR_RENT_PUBKEY,
1385
- systemProgram: anchor.web3.SystemProgram.programId,
1380
+ rent: SYSVAR_RENT_PUBKEY,
1381
+ systemProgram: SystemProgram.programId,
1386
1382
  },
1387
1383
  });
1388
1384
  }
@@ -1445,7 +1441,7 @@ export class DriftClient {
1445
1441
  escrow,
1446
1442
  authority,
1447
1443
  payer: this.wallet.publicKey,
1448
- systemProgram: anchor.web3.SystemProgram.programId,
1444
+ systemProgram: SystemProgram.programId,
1449
1445
  },
1450
1446
  });
1451
1447
  }
@@ -1509,7 +1505,7 @@ export class DriftClient {
1509
1505
  escrow,
1510
1506
  authority,
1511
1507
  payer,
1512
- systemProgram: anchor.web3.SystemProgram.programId,
1508
+ systemProgram: SystemProgram.programId,
1513
1509
  },
1514
1510
  }
1515
1511
  );
@@ -1541,7 +1537,7 @@ export class DriftClient {
1541
1537
  accounts: {
1542
1538
  signedMsgWsDelegates,
1543
1539
  authority: this.wallet.publicKey,
1544
- systemProgram: anchor.web3.SystemProgram.programId,
1540
+ systemProgram: SystemProgram.programId,
1545
1541
  },
1546
1542
  }
1547
1543
  );
@@ -1574,7 +1570,7 @@ export class DriftClient {
1574
1570
  accounts: {
1575
1571
  signedMsgWsDelegates,
1576
1572
  authority: this.wallet.publicKey,
1577
- systemProgram: anchor.web3.SystemProgram.programId,
1573
+ systemProgram: SystemProgram.programId,
1578
1574
  },
1579
1575
  }
1580
1576
  );
@@ -1605,8 +1601,8 @@ export class DriftClient {
1605
1601
  ),
1606
1602
  authority: authority ?? this.wallet.publicKey,
1607
1603
  payer: this.wallet.publicKey,
1608
- rent: anchor.web3.SYSVAR_RENT_PUBKEY,
1609
- systemProgram: anchor.web3.SystemProgram.programId,
1604
+ rent: SYSVAR_RENT_PUBKEY,
1605
+ systemProgram: SystemProgram.programId,
1610
1606
  },
1611
1607
  });
1612
1608
  }
@@ -1699,8 +1695,8 @@ export class DriftClient {
1699
1695
  userStats: this.getUserStatsAccountPublicKey(),
1700
1696
  authority: accountAuthority,
1701
1697
  payer: payer,
1702
- rent: anchor.web3.SYSVAR_RENT_PUBKEY,
1703
- systemProgram: anchor.web3.SystemProgram.programId,
1698
+ rent: SYSVAR_RENT_PUBKEY,
1699
+ systemProgram: SystemProgram.programId,
1704
1700
  state: await this.getStatePublicKey(),
1705
1701
  },
1706
1702
  remainingAccounts,
@@ -1749,8 +1745,8 @@ export class DriftClient {
1749
1745
  authority: this.wallet.publicKey,
1750
1746
  userStats: this.getUserStatsAccountPublicKey(),
1751
1747
  payer: this.wallet.publicKey,
1752
- rent: anchor.web3.SYSVAR_RENT_PUBKEY,
1753
- systemProgram: anchor.web3.SystemProgram.programId,
1748
+ rent: SYSVAR_RENT_PUBKEY,
1749
+ systemProgram: SystemProgram.programId,
1754
1750
  },
1755
1751
  }
1756
1752
  );
@@ -2407,7 +2403,7 @@ export class DriftClient {
2407
2403
  userStats: this.getUserStatsAccountPublicKey(),
2408
2404
  authority: this.wallet.publicKey,
2409
2405
  state: await this.getStatePublicKey(),
2410
- rent: anchor.web3.SYSVAR_RENT_PUBKEY,
2406
+ rent: SYSVAR_RENT_PUBKEY,
2411
2407
  },
2412
2408
  });
2413
2409
  }
@@ -2608,132 +2604,7 @@ export class DriftClient {
2608
2604
  });
2609
2605
  }
2610
2606
  getRemainingAccounts(params: RemainingAccountParams): AccountMeta[] {
2611
- const { oracleAccountMap, spotMarketAccountMap, perpMarketAccountMap } =
2612
- this.getRemainingAccountMapsForUsers(params.userAccounts);
2613
-
2614
- if (params.useMarketLastSlotCache) {
2615
- const lastUserSlot = this.getUserAccountAndSlot(
2616
- params.userAccounts.length > 0
2617
- ? params.userAccounts[0].subAccountId
2618
- : this.activeSubAccountId,
2619
- params.userAccounts.length > 0
2620
- ? params.userAccounts[0].authority
2621
- : this.authority
2622
- )?.slot;
2623
-
2624
- for (const [
2625
- marketIndex,
2626
- slot,
2627
- ] of this.perpMarketLastSlotCache.entries()) {
2628
- // if cache has more recent slot than user positions account slot, add market to remaining accounts
2629
- // otherwise remove from slot
2630
- if (slot > lastUserSlot) {
2631
- this.addPerpMarketToRemainingAccountMaps(
2632
- marketIndex,
2633
- false,
2634
- oracleAccountMap,
2635
- spotMarketAccountMap,
2636
- perpMarketAccountMap
2637
- );
2638
- } else {
2639
- this.perpMarketLastSlotCache.delete(marketIndex);
2640
- }
2641
- }
2642
-
2643
- for (const [
2644
- marketIndex,
2645
- slot,
2646
- ] of this.spotMarketLastSlotCache.entries()) {
2647
- // if cache has more recent slot than user positions account slot, add market to remaining accounts
2648
- // otherwise remove from slot
2649
- if (slot > lastUserSlot) {
2650
- this.addSpotMarketToRemainingAccountMaps(
2651
- marketIndex,
2652
- false,
2653
- oracleAccountMap,
2654
- spotMarketAccountMap
2655
- );
2656
- } else {
2657
- this.spotMarketLastSlotCache.delete(marketIndex);
2658
- }
2659
- }
2660
- }
2661
-
2662
- if (params.readablePerpMarketIndex !== undefined) {
2663
- const readablePerpMarketIndexes = Array.isArray(
2664
- params.readablePerpMarketIndex
2665
- )
2666
- ? params.readablePerpMarketIndex
2667
- : [params.readablePerpMarketIndex];
2668
- for (const marketIndex of readablePerpMarketIndexes) {
2669
- this.addPerpMarketToRemainingAccountMaps(
2670
- marketIndex,
2671
- false,
2672
- oracleAccountMap,
2673
- spotMarketAccountMap,
2674
- perpMarketAccountMap
2675
- );
2676
- }
2677
- }
2678
-
2679
- for (const perpMarketIndex of this.mustIncludePerpMarketIndexes.values()) {
2680
- this.addPerpMarketToRemainingAccountMaps(
2681
- perpMarketIndex,
2682
- false,
2683
- oracleAccountMap,
2684
- spotMarketAccountMap,
2685
- perpMarketAccountMap
2686
- );
2687
- }
2688
-
2689
- if (params.readableSpotMarketIndexes !== undefined) {
2690
- for (const readableSpotMarketIndex of params.readableSpotMarketIndexes) {
2691
- this.addSpotMarketToRemainingAccountMaps(
2692
- readableSpotMarketIndex,
2693
- false,
2694
- oracleAccountMap,
2695
- spotMarketAccountMap
2696
- );
2697
- }
2698
- }
2699
-
2700
- for (const spotMarketIndex of this.mustIncludeSpotMarketIndexes.values()) {
2701
- this.addSpotMarketToRemainingAccountMaps(
2702
- spotMarketIndex,
2703
- false,
2704
- oracleAccountMap,
2705
- spotMarketAccountMap
2706
- );
2707
- }
2708
-
2709
- if (params.writablePerpMarketIndexes !== undefined) {
2710
- for (const writablePerpMarketIndex of params.writablePerpMarketIndexes) {
2711
- this.addPerpMarketToRemainingAccountMaps(
2712
- writablePerpMarketIndex,
2713
- true,
2714
- oracleAccountMap,
2715
- spotMarketAccountMap,
2716
- perpMarketAccountMap
2717
- );
2718
- }
2719
- }
2720
-
2721
- if (params.writableSpotMarketIndexes !== undefined) {
2722
- for (const writableSpotMarketIndex of params.writableSpotMarketIndexes) {
2723
- this.addSpotMarketToRemainingAccountMaps(
2724
- writableSpotMarketIndex,
2725
- true,
2726
- oracleAccountMap,
2727
- spotMarketAccountMap
2728
- );
2729
- }
2730
- }
2731
-
2732
- return [
2733
- ...oracleAccountMap.values(),
2734
- ...spotMarketAccountMap.values(),
2735
- ...perpMarketAccountMap.values(),
2736
- ];
2607
+ return DriftCore.remainingAccounts.getRemainingAccounts(this, params);
2737
2608
  }
2738
2609
 
2739
2610
  addPerpMarketToRemainingAccountMaps(
@@ -2921,7 +2792,7 @@ export class DriftClient {
2921
2792
  { pubkey: owner, isSigner: false, isWritable: false },
2922
2793
  { pubkey: mint, isSigner: false, isWritable: false },
2923
2794
  {
2924
- pubkey: anchor.web3.SystemProgram.programId,
2795
+ pubkey: SystemProgram.programId,
2925
2796
  isSigner: false,
2926
2797
  isWritable: false,
2927
2798
  },
@@ -3173,24 +3044,21 @@ export class DriftClient {
3173
3044
 
3174
3045
  const authority = overrides?.authority ?? this.wallet.publicKey;
3175
3046
  const tokenProgram = this.getTokenProgramForSpotMarket(spotMarketAccount);
3176
- return await (this.program.instruction as any).deposit(
3047
+ return await DriftCore.buildDepositInstruction({
3048
+ program: this.program,
3177
3049
  marketIndex,
3178
3050
  amount,
3179
3051
  reduceOnly,
3180
- {
3181
- accounts: {
3182
- state: await this.getStatePublicKey(),
3183
- spotMarket: spotMarketAccount.pubkey,
3184
- spotMarketVault: spotMarketAccount.vault,
3185
- user: userAccountPublicKey,
3186
- userStats: this.getUserStatsAccountPublicKey(),
3187
- userTokenAccount: userTokenAccount,
3188
- authority,
3189
- tokenProgram,
3190
- },
3191
- remainingAccounts,
3192
- }
3193
- );
3052
+ state: await this.getStatePublicKey(),
3053
+ spotMarket: spotMarketAccount.pubkey,
3054
+ spotMarketVault: spotMarketAccount.vault,
3055
+ user: userAccountPublicKey,
3056
+ userStats: this.getUserStatsAccountPublicKey(),
3057
+ userTokenAccount,
3058
+ authority,
3059
+ tokenProgram,
3060
+ remainingAccounts,
3061
+ });
3194
3062
  }
3195
3063
 
3196
3064
  private async checkIfAccountExists(account: PublicKey): Promise<boolean> {
@@ -3210,7 +3078,7 @@ export class DriftClient {
3210
3078
  authority?: PublicKey;
3211
3079
  }
3212
3080
  ): Promise<{
3213
- ixs: anchor.web3.TransactionInstruction[];
3081
+ ixs: TransactionInstruction[];
3214
3082
  /** @deprecated - this array is always going to be empty, in the current implementation */
3215
3083
  signers: Signer[];
3216
3084
  pubkey: PublicKey;
@@ -3346,7 +3214,7 @@ export class DriftClient {
3346
3214
  tokenMintAddress: PublicKey,
3347
3215
  associatedTokenAddress: PublicKey,
3348
3216
  tokenProgram: PublicKey
3349
- ): anchor.web3.TransactionInstruction {
3217
+ ): TransactionInstruction {
3350
3218
  return createAssociatedTokenAccountInstruction(
3351
3219
  this.wallet.publicKey,
3352
3220
  associatedTokenAddress,
@@ -3692,7 +3560,7 @@ export class DriftClient {
3692
3560
  subAccountId?: number,
3693
3561
  _updateFuel = false
3694
3562
  ): Promise<TransactionInstruction[]> {
3695
- const withdrawIxs: anchor.web3.TransactionInstruction[] = [];
3563
+ const withdrawIxs: TransactionInstruction[] = [];
3696
3564
 
3697
3565
  const spotMarketAccount = this.getSpotMarketAccount(marketIndex);
3698
3566
 
@@ -3817,7 +3685,7 @@ export class DriftClient {
3817
3685
 
3818
3686
  opts?.dustPositionCountCallback?.(dustPositionSpotMarketAccounts.length);
3819
3687
 
3820
- let allWithdrawIxs: anchor.web3.TransactionInstruction[] = [];
3688
+ let allWithdrawIxs: TransactionInstruction[] = [];
3821
3689
 
3822
3690
  for (const position of dustPositionSpotMarketAccounts) {
3823
3691
  const tokenAccount = await getAssociatedTokenAddress(
@@ -3876,25 +3744,22 @@ export class DriftClient {
3876
3744
 
3877
3745
  const tokenProgram = this.getTokenProgramForSpotMarket(spotMarketAccount);
3878
3746
 
3879
- return await (this.program.instruction as any).withdraw(
3747
+ return await DriftCore.buildWithdrawInstruction({
3748
+ program: this.program,
3880
3749
  marketIndex,
3881
3750
  amount,
3882
3751
  reduceOnly,
3883
- {
3884
- accounts: {
3885
- state: await this.getStatePublicKey(),
3886
- spotMarket: spotMarketAccount.pubkey,
3887
- spotMarketVault: spotMarketAccount.vault,
3888
- driftSigner: this.getSignerPublicKey(),
3889
- user,
3890
- userStats: this.getUserStatsAccountPublicKey(),
3891
- userTokenAccount: userTokenAccount,
3892
- authority: this.wallet.publicKey,
3893
- tokenProgram,
3894
- },
3895
- remainingAccounts,
3896
- }
3897
- );
3752
+ state: await this.getStatePublicKey(),
3753
+ spotMarket: spotMarketAccount.pubkey,
3754
+ spotMarketVault: spotMarketAccount.vault,
3755
+ driftSigner: this.getSignerPublicKey(),
3756
+ user,
3757
+ userStats: this.getUserStatsAccountPublicKey(),
3758
+ userTokenAccount,
3759
+ authority: this.wallet.publicKey,
3760
+ tokenProgram,
3761
+ remainingAccounts,
3762
+ });
3898
3763
  }
3899
3764
 
3900
3765
  /**
@@ -5044,13 +4909,13 @@ export class DriftClient {
5044
4909
  : undefined,
5045
4910
  });
5046
4911
 
5047
- return await (this.program.instruction as any).placePerpOrder(orderParams, {
5048
- accounts: {
5049
- state: await this.getStatePublicKey(),
5050
- user,
5051
- userStats: this.getUserStatsAccountPublicKey(),
5052
- authority: this.wallet.publicKey,
5053
- },
4912
+ return await DriftCore.buildPlacePerpOrderInstruction({
4913
+ program: this.program,
4914
+ orderParams,
4915
+ state: await this.getStatePublicKey(),
4916
+ user,
4917
+ userStats: this.getUserStatsAccountPublicKey(),
4918
+ authority: this.wallet.publicKey,
5054
4919
  remainingAccounts,
5055
4920
  });
5056
4921
  }
@@ -5226,12 +5091,12 @@ export class DriftClient {
5226
5091
  useMarketLastSlotCache: true,
5227
5092
  });
5228
5093
 
5229
- return await this.program.instruction.cancelOrder(orderId ?? null, {
5230
- accounts: {
5231
- state: await this.getStatePublicKey(),
5232
- user,
5233
- authority: this.wallet.publicKey,
5234
- },
5094
+ return await DriftCore.buildCancelOrderInstruction({
5095
+ program: this.program,
5096
+ orderId: orderId ?? null,
5097
+ state: await this.getStatePublicKey(),
5098
+ user,
5099
+ authority: this.wallet.publicKey,
5235
5100
  remainingAccounts,
5236
5101
  });
5237
5102
  }
@@ -5266,18 +5131,15 @@ export class DriftClient {
5266
5131
  useMarketLastSlotCache: true,
5267
5132
  });
5268
5133
 
5269
- return await (this.program.instruction as any).cancelOrderByUserId(
5134
+ return await DriftCore.buildCancelOrderByUserIdInstruction({
5135
+ program: this.program,
5270
5136
  userOrderId,
5271
- {
5272
- accounts: {
5273
- state: await this.getStatePublicKey(),
5274
- user,
5275
- authority: this.wallet.publicKey,
5276
- oracle,
5277
- },
5278
- remainingAccounts,
5279
- }
5280
- );
5137
+ state: await this.getStatePublicKey(),
5138
+ user,
5139
+ authority: this.wallet.publicKey,
5140
+ oracle,
5141
+ remainingAccounts,
5142
+ });
5281
5143
  }
5282
5144
 
5283
5145
  /**
@@ -5343,12 +5205,12 @@ export class DriftClient {
5343
5205
 
5344
5206
  const authority = overrides?.authority ?? this.wallet.publicKey;
5345
5207
 
5346
- return await this.program.instruction.cancelOrdersByIds(orderIds, {
5347
- accounts: {
5348
- state: await this.getStatePublicKey(),
5349
- user: userAccountPubKey,
5350
- authority,
5351
- },
5208
+ return await DriftCore.buildCancelOrdersByIdsInstruction({
5209
+ program: this.program,
5210
+ orderIds,
5211
+ state: await this.getStatePublicKey(),
5212
+ user: userAccountPubKey,
5213
+ authority,
5352
5214
  remainingAccounts,
5353
5215
  });
5354
5216
  }
@@ -5402,19 +5264,17 @@ export class DriftClient {
5402
5264
  useMarketLastSlotCache: true,
5403
5265
  });
5404
5266
 
5405
- return await this.program.instruction.cancelOrders(
5406
- marketType ?? null,
5407
- marketIndex ?? null,
5408
- direction ?? null,
5409
- {
5410
- accounts: {
5411
- state: await this.getStatePublicKey(),
5412
- user,
5413
- authority: this.wallet.publicKey,
5414
- },
5415
- remainingAccounts,
5416
- }
5417
- );
5267
+ return await DriftCore.buildCancelOrdersInstruction({
5268
+ program: this.program,
5269
+ marketType: marketType ?? null,
5270
+ marketIndex: marketIndex ?? null,
5271
+ direction: direction ?? null,
5272
+ user,
5273
+ state: await this.getStatePublicKey(),
5274
+ userStats: this.getUserStatsAccountPublicKey(),
5275
+ authority: this.wallet.publicKey,
5276
+ remainingAccounts,
5277
+ });
5418
5278
  }
5419
5279
 
5420
5280
  public async cancelAndPlaceOrders(
@@ -5538,18 +5398,15 @@ export class DriftClient {
5538
5398
  const formattedParams = params.map((item) => getOrderParams(item));
5539
5399
  const authority = overrides?.authority ?? this.wallet.publicKey;
5540
5400
 
5541
- return await (this.program.instruction as any).placeOrders(
5401
+ return await DriftCore.buildPlaceOrdersInstruction({
5402
+ program: this.program,
5542
5403
  formattedParams,
5543
- {
5544
- accounts: {
5545
- state: await this.getStatePublicKey(),
5546
- user,
5547
- userStats: this.getUserStatsAccountPublicKey(),
5548
- authority,
5549
- },
5550
- remainingAccounts,
5551
- }
5552
- );
5404
+ state: await this.getStatePublicKey(),
5405
+ user,
5406
+ userStats: this.getUserStatsAccountPublicKey(),
5407
+ authority,
5408
+ remainingAccounts,
5409
+ });
5553
5410
  }
5554
5411
 
5555
5412
  public async getPlaceOrdersAndSetPositionMaxLevIx(
@@ -5847,15 +5704,15 @@ export class DriftClient {
5847
5704
  }
5848
5705
 
5849
5706
  const orderId = isSignedMsg ? null : order.orderId;
5850
- return await this.program.instruction.fillPerpOrder(orderId, null, {
5851
- accounts: {
5852
- state: await this.getStatePublicKey(),
5853
- filler,
5854
- fillerStats: fillerStatsPublicKey,
5855
- user: userAccountPublicKey,
5856
- userStats: userStatsPublicKey,
5857
- authority: this.wallet.publicKey,
5858
- },
5707
+ return await DriftCore.buildFillPerpOrderInstruction({
5708
+ program: this.program,
5709
+ orderId,
5710
+ state: await this.getStatePublicKey(),
5711
+ filler,
5712
+ fillerStats: fillerStatsPublicKey,
5713
+ user: userAccountPublicKey,
5714
+ userStats: userStatsPublicKey,
5715
+ authority: this.wallet.publicKey,
5859
5716
  remainingAccounts,
5860
5717
  });
5861
5718
  }
@@ -6718,7 +6575,7 @@ export class DriftClient {
6718
6575
  outTokenAccount,
6719
6576
  tokenProgram: inTokenProgram,
6720
6577
  driftSigner: this.getStateAccount().signer,
6721
- instructions: anchor.web3.SYSVAR_INSTRUCTIONS_PUBKEY,
6578
+ instructions: SYSVAR_INSTRUCTIONS_PUBKEY,
6722
6579
  },
6723
6580
  remainingAccounts,
6724
6581
  }
@@ -6741,7 +6598,7 @@ export class DriftClient {
6741
6598
  outTokenAccount,
6742
6599
  tokenProgram: inTokenProgram,
6743
6600
  driftSigner: this.getStateAccount().signer,
6744
- instructions: anchor.web3.SYSVAR_INSTRUCTIONS_PUBKEY,
6601
+ instructions: SYSVAR_INSTRUCTIONS_PUBKEY,
6745
6602
  },
6746
6603
  remainingAccounts,
6747
6604
  }
@@ -7002,13 +6859,13 @@ export class DriftClient {
7002
6859
  );
7003
6860
 
7004
6861
  const orderId = order.orderId;
7005
- return await this.program.instruction.triggerOrder(orderId, {
7006
- accounts: {
7007
- state: await this.getStatePublicKey(),
7008
- filler,
7009
- user: userAccountPublicKey,
7010
- authority: this.wallet.publicKey,
7011
- },
6862
+ return await DriftCore.buildTriggerOrderInstruction({
6863
+ program: this.program,
6864
+ orderId,
6865
+ state: await this.getStatePublicKey(),
6866
+ filler,
6867
+ user: userAccountPublicKey,
6868
+ authority: this.wallet.publicKey,
7012
6869
  remainingAccounts,
7013
6870
  });
7014
6871
  }
@@ -7609,19 +7466,16 @@ export class DriftClient {
7609
7466
 
7610
7467
  const authority = overrides?.authority ?? this.wallet.publicKey;
7611
7468
 
7612
- return await this.program.instruction.placeAndTakePerpOrder(
7469
+ return await DriftCore.buildPlaceAndTakePerpOrderInstruction({
7470
+ program: this.program,
7613
7471
  orderParams,
7614
7472
  optionalParams,
7615
- {
7616
- accounts: {
7617
- state: await this.getStatePublicKey(),
7618
- user,
7619
- userStats: userStatsPublicKey,
7620
- authority,
7621
- },
7622
- remainingAccounts,
7623
- }
7624
- );
7473
+ state: await this.getStatePublicKey(),
7474
+ user,
7475
+ userStats: userStatsPublicKey,
7476
+ authority,
7477
+ remainingAccounts,
7478
+ });
7625
7479
  }
7626
7480
 
7627
7481
  public async placeAndMakePerpOrder(
@@ -7693,21 +7547,18 @@ export class DriftClient {
7693
7547
  isSigner: false,
7694
7548
  });
7695
7549
  }
7696
- return await this.program.instruction.placeAndMakePerpOrder(
7550
+ return await DriftCore.buildPlaceAndMakePerpOrderInstruction({
7551
+ program: this.program,
7697
7552
  orderParams,
7698
7553
  takerOrderId,
7699
- {
7700
- accounts: {
7701
- state: await this.getStatePublicKey(),
7702
- user,
7703
- userStats: userStatsPublicKey,
7704
- taker: takerInfo.taker,
7705
- takerStats: takerInfo.takerStats,
7706
- authority: this.wallet.publicKey,
7707
- },
7708
- remainingAccounts,
7709
- }
7710
- );
7554
+ state: await this.getStatePublicKey(),
7555
+ user,
7556
+ userStats: userStatsPublicKey,
7557
+ taker: takerInfo.taker,
7558
+ takerStats: takerInfo.takerStats,
7559
+ authority: this.wallet.publicKey,
7560
+ remainingAccounts,
7561
+ });
7711
7562
  }
7712
7563
 
7713
7564
  public signSignedMsgOrderParamsMessage(
@@ -7770,43 +7621,11 @@ export class DriftClient {
7770
7621
  | SignedMsgOrderParamsDelegateMessage,
7771
7622
  delegateSigner?: boolean
7772
7623
  ): Buffer {
7773
- if (orderParamsMessage.maxMarginRatio === undefined) {
7774
- orderParamsMessage.maxMarginRatio = null;
7775
- }
7776
- if (orderParamsMessage.isolatedPositionDeposit === undefined) {
7777
- orderParamsMessage.isolatedPositionDeposit = null;
7778
- }
7779
-
7780
- const anchorIxName = delegateSigner
7781
- ? 'global' + ':' + 'SignedMsgOrderParamsDelegateMessage'
7782
- : 'global' + ':' + 'SignedMsgOrderParamsMessage';
7783
- const prefix = Buffer.from(sha256(anchorIxName).slice(0, 8));
7784
-
7785
- // Backwards-compat: normalize optional builder fields to null for encoding
7786
- const withBuilderDefaults = {
7787
- ...orderParamsMessage,
7788
- builderIdx:
7789
- orderParamsMessage.builderIdx !== undefined
7790
- ? orderParamsMessage.builderIdx
7791
- : null,
7792
- builderFeeTenthBps:
7793
- orderParamsMessage.builderFeeTenthBps !== undefined
7794
- ? orderParamsMessage.builderFeeTenthBps
7795
- : null,
7796
- };
7797
- const buf = Buffer.concat([
7798
- prefix,
7799
- delegateSigner
7800
- ? this.program.coder.types.encode(
7801
- 'signedMsgOrderParamsDelegateMessage',
7802
- withBuilderDefaults as SignedMsgOrderParamsDelegateMessage
7803
- )
7804
- : this.program.coder.types.encode(
7805
- 'signedMsgOrderParamsMessage',
7806
- withBuilderDefaults as SignedMsgOrderParamsMessage
7807
- ),
7808
- ]);
7809
- return buf;
7624
+ return DriftCore.signedMsg.encodeSignedMsgOrderParamsMessage({
7625
+ coderTypes: this.program.coder.types as any,
7626
+ orderParamsMessage,
7627
+ delegateSigner,
7628
+ });
7810
7629
  }
7811
7630
 
7812
7631
  /*
@@ -7819,16 +7638,11 @@ export class DriftClient {
7819
7638
  encodedMessage: Buffer,
7820
7639
  delegateSigner?: boolean
7821
7640
  ): SignedMsgOrderParamsMessage | SignedMsgOrderParamsDelegateMessage {
7822
- const decodeStr = delegateSigner
7823
- ? 'signedMsgOrderParamsDelegateMessage'
7824
- : 'signedMsgOrderParamsMessage';
7825
- return this.program.coder.types.decode(
7826
- decodeStr,
7827
- Buffer.concat([
7828
- encodedMessage.slice(8), // strip out discriminator
7829
- Buffer.alloc(128), // pad on 128 bytes, this is most efficient way to messages that are too small
7830
- ])
7831
- );
7641
+ return DriftCore.signedMsg.decodeSignedMsgOrderParamsMessage({
7642
+ coderTypes: this.program.coder.types as any,
7643
+ encodedMessage,
7644
+ delegateSigner,
7645
+ });
7832
7646
  }
7833
7647
 
7834
7648
  public signMessage(
@@ -8359,19 +8173,16 @@ export class DriftClient {
8359
8173
  overrides?.authority ??
8360
8174
  overrides?.user?.getUserAccount().authority ??
8361
8175
  this.wallet.publicKey;
8362
- return await (this.program.instruction as any).modifyOrder(
8176
+ return await DriftCore.buildModifyOrderInstruction({
8177
+ program: this.program,
8363
8178
  orderId,
8364
- orderParams,
8365
- {
8366
- accounts: {
8367
- state: await this.getStatePublicKey(),
8368
- user: userPubKey,
8369
- userStats: this.getUserStatsAccountPublicKey(),
8370
- authority,
8371
- },
8372
- remainingAccounts,
8373
- }
8374
- );
8179
+ modifyParams: orderParams,
8180
+ state: await this.getStatePublicKey(),
8181
+ user: userPubKey,
8182
+ userStats: this.getUserStatsAccountPublicKey(),
8183
+ authority,
8184
+ remainingAccounts,
8185
+ });
8375
8186
  }
8376
8187
 
8377
8188
  /**
@@ -8484,19 +8295,16 @@ export class DriftClient {
8484
8295
  maxTs: maxTs || null,
8485
8296
  };
8486
8297
 
8487
- return await (this.program.instruction as any).modifyOrderByUserId(
8298
+ return await DriftCore.buildModifyOrderByUserIdInstruction({
8299
+ program: this.program,
8488
8300
  userOrderId,
8489
- orderParams,
8490
- {
8491
- accounts: {
8492
- state: await this.getStatePublicKey(),
8493
- user,
8494
- userStats: this.getUserStatsAccountPublicKey(),
8495
- authority: this.wallet.publicKey,
8496
- },
8497
- remainingAccounts,
8498
- }
8499
- );
8301
+ modifyParams: orderParams,
8302
+ state: await this.getStatePublicKey(),
8303
+ user,
8304
+ userStats: this.getUserStatsAccountPublicKey(),
8305
+ authority: this.wallet.publicKey,
8306
+ remainingAccounts,
8307
+ });
8500
8308
  }
8501
8309
 
8502
8310
  public async settlePNLs(
@@ -8703,14 +8511,14 @@ export class DriftClient {
8703
8511
  }
8704
8512
  }
8705
8513
 
8706
- return await this.program.instruction.settlePnl(marketIndex, {
8707
- accounts: {
8708
- state: await this.getStatePublicKey(),
8709
- authority: this.wallet.publicKey,
8710
- user: settleeUserAccountPublicKey,
8711
- spotMarketVault: this.getQuoteSpotMarketAccount().vault,
8712
- },
8713
- remainingAccounts: remainingAccounts,
8514
+ return await DriftCore.buildSettlePnlInstruction({
8515
+ program: this.program,
8516
+ marketIndex,
8517
+ state: await this.getStatePublicKey(),
8518
+ authority: this.wallet.publicKey,
8519
+ user: settleeUserAccountPublicKey,
8520
+ spotMarketVault: this.getQuoteSpotMarketAccount().vault,
8521
+ remainingAccounts,
8714
8522
  });
8715
8523
  }
8716
8524
 
@@ -9006,22 +8814,19 @@ export class DriftClient {
9006
8814
  writablePerpMarketIndexes: [marketIndex],
9007
8815
  });
9008
8816
 
9009
- return await this.program.instruction.liquidatePerp(
8817
+ return await DriftCore.buildLiquidatePerpInstruction({
8818
+ program: this.program,
9010
8819
  marketIndex,
9011
8820
  maxBaseAssetAmount,
9012
- limitPrice ?? null,
9013
- {
9014
- accounts: {
9015
- state: await this.getStatePublicKey(),
9016
- authority: this.wallet.publicKey,
9017
- user: userAccountPublicKey,
9018
- userStats: userStatsPublicKey,
9019
- liquidator,
9020
- liquidatorStats: liquidatorStatsPublicKey,
9021
- },
9022
- remainingAccounts: remainingAccounts,
9023
- }
9024
- );
8821
+ limitPrice: limitPrice ?? null,
8822
+ state: await this.getStatePublicKey(),
8823
+ authority: this.wallet.publicKey,
8824
+ user: userAccountPublicKey,
8825
+ userStats: userStatsPublicKey,
8826
+ liquidator,
8827
+ liquidatorStats: liquidatorStatsPublicKey,
8828
+ remainingAccounts,
8829
+ });
9025
8830
  }
9026
8831
 
9027
8832
  public async liquidatePerpWithFill(
@@ -9157,7 +8962,7 @@ export class DriftClient {
9157
8962
  writableSpotMarketIndexes: [liabilityMarketIndex, assetMarketIndex],
9158
8963
  });
9159
8964
 
9160
- return await this.program.instruction.liquidateSpot(
8965
+ return await (this.program.instruction as any).liquidateSpot(
9161
8966
  assetMarketIndex,
9162
8967
  liabilityMarketIndex,
9163
8968
  maxLiabilityTransfer,
@@ -9171,7 +8976,7 @@ export class DriftClient {
9171
8976
  liquidator,
9172
8977
  liquidatorStats: liquidatorStatsPublicKey,
9173
8978
  },
9174
- remainingAccounts: remainingAccounts,
8979
+ remainingAccounts,
9175
8980
  }
9176
8981
  );
9177
8982
  }
@@ -9424,7 +9229,7 @@ export class DriftClient {
9424
9229
  liabilityTokenAccount: liabilityTokenAccount,
9425
9230
  tokenProgram: assetTokenProgram,
9426
9231
  driftSigner: this.getStateAccount().signer,
9427
- instructions: anchor.web3.SYSVAR_INSTRUCTIONS_PUBKEY,
9232
+ instructions: SYSVAR_INSTRUCTIONS_PUBKEY,
9428
9233
  },
9429
9234
  remainingAccounts,
9430
9235
  }
@@ -9447,7 +9252,7 @@ export class DriftClient {
9447
9252
  liabilityTokenAccount: liabilityTokenAccount,
9448
9253
  tokenProgram: assetTokenProgram,
9449
9254
  driftSigner: this.getStateAccount().signer,
9450
- instructions: anchor.web3.SYSVAR_INSTRUCTIONS_PUBKEY,
9255
+ instructions: SYSVAR_INSTRUCTIONS_PUBKEY,
9451
9256
  },
9452
9257
  remainingAccounts,
9453
9258
  }
@@ -9526,7 +9331,7 @@ export class DriftClient {
9526
9331
  ifRebalanceConfig: ifRebalanceConfig,
9527
9332
  tokenProgram: TOKEN_PROGRAM_ID,
9528
9333
  driftSigner: this.getStateAccount().signer,
9529
- instructions: anchor.web3.SYSVAR_INSTRUCTIONS_PUBKEY,
9334
+ instructions: SYSVAR_INSTRUCTIONS_PUBKEY,
9530
9335
  },
9531
9336
  remainingAccounts,
9532
9337
  }
@@ -9546,7 +9351,7 @@ export class DriftClient {
9546
9351
  ifRebalanceConfig: ifRebalanceConfig,
9547
9352
  tokenProgram: TOKEN_PROGRAM_ID,
9548
9353
  driftSigner: this.getStateAccount().signer,
9549
- instructions: anchor.web3.SYSVAR_INSTRUCTIONS_PUBKEY,
9354
+ instructions: SYSVAR_INSTRUCTIONS_PUBKEY,
9550
9355
  },
9551
9356
  remainingAccounts,
9552
9357
  }
@@ -9868,12 +9673,12 @@ export class DriftClient {
9868
9673
  this.program.programId,
9869
9674
  perpMarketIndex
9870
9675
  );
9871
- return await this.program.instruction.updateFundingRate(perpMarketIndex, {
9872
- accounts: {
9873
- state: await this.getStatePublicKey(),
9874
- perpMarket: perpMarketPublicKey,
9875
- oracle: oracle,
9876
- },
9676
+ return await DriftCore.buildUpdateFundingRateInstruction({
9677
+ program: this.program,
9678
+ perpMarketIndex,
9679
+ state: await this.getStatePublicKey(),
9680
+ perpMarket: perpMarketPublicKey,
9681
+ oracle,
9877
9682
  });
9878
9683
  }
9879
9684
 
@@ -10118,8 +9923,8 @@ export class DriftClient {
10118
9923
  ),
10119
9924
  authority: this.wallet.publicKey,
10120
9925
  payer: this.wallet.publicKey,
10121
- rent: anchor.web3.SYSVAR_RENT_PUBKEY,
10122
- systemProgram: anchor.web3.SystemProgram.programId,
9926
+ rent: SYSVAR_RENT_PUBKEY,
9927
+ systemProgram: SystemProgram.programId,
10123
9928
  state: await this.getStatePublicKey(),
10124
9929
  };
10125
9930