@velocity-exchange/sdk 0.0.5 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (383) hide show
  1. package/.prettierignore +1 -1
  2. package/CHANGELOG.md +20 -0
  3. package/README.md +30 -30
  4. package/bun.lock +1 -1
  5. package/lib/browser/accounts/grpcProgramAccountSubscriber.js +1 -1
  6. package/lib/browser/accounts/grpcVelocityClientAccountSubscriber.d.ts +0 -4
  7. package/lib/browser/accounts/grpcVelocityClientAccountSubscriber.js +1 -3
  8. package/lib/browser/accounts/grpcVelocityClientAccountSubscriberV2.d.ts +0 -4
  9. package/lib/browser/accounts/grpcVelocityClientAccountSubscriberV2.js +5 -7
  10. package/lib/browser/accounts/laserProgramAccountSubscriber.js +1 -1
  11. package/lib/browser/accounts/pollingVelocityClientAccountSubscriber.d.ts +0 -4
  12. package/lib/browser/accounts/pollingVelocityClientAccountSubscriber.js +5 -7
  13. package/lib/browser/accounts/types.d.ts +2 -8
  14. package/lib/browser/accounts/utils.js +2 -2
  15. package/lib/browser/accounts/webSocketVelocityClientAccountSubscriber.d.ts +0 -4
  16. package/lib/browser/accounts/webSocketVelocityClientAccountSubscriber.js +5 -7
  17. package/lib/browser/accounts/webSocketVelocityClientAccountSubscriberV2.d.ts +0 -4
  18. package/lib/browser/accounts/webSocketVelocityClientAccountSubscriberV2.js +5 -7
  19. package/lib/browser/addresses/pda.d.ts +1 -7
  20. package/lib/browser/addresses/pda.js +4 -10
  21. package/lib/browser/adminClient.d.ts +1 -1
  22. package/lib/browser/adminClient.js +21 -21
  23. package/lib/browser/auctionSubscriber/auctionSubscriber.d.ts +1 -3
  24. package/lib/browser/auctionSubscriber/auctionSubscriber.js +2 -6
  25. package/lib/browser/auctionSubscriber/auctionSubscriberGrpc.d.ts +1 -3
  26. package/lib/browser/auctionSubscriber/auctionSubscriberGrpc.js +2 -6
  27. package/lib/browser/auctionSubscriber/types.d.ts +3 -2
  28. package/lib/browser/config.d.ts +10 -19
  29. package/lib/browser/config.js +6 -33
  30. package/lib/browser/constants/insuranceFund.d.ts +1 -1
  31. package/lib/browser/constants/insuranceFund.js +1 -1
  32. package/lib/browser/constituentMap/constituentMap.d.ts +0 -2
  33. package/lib/browser/constituentMap/constituentMap.js +5 -5
  34. package/lib/browser/core/VelocityCore.d.ts +9 -15
  35. package/lib/browser/core/VelocityCore.js +5 -7
  36. package/lib/browser/core/instructions/withdraw.d.ts +1 -1
  37. package/lib/browser/core/instructions/withdraw.js +1 -1
  38. package/lib/browser/core/remainingAccounts.js +3 -3
  39. package/lib/browser/dlob/DLOB.d.ts +1 -1
  40. package/lib/browser/dlob/DLOB.js +6 -6
  41. package/lib/browser/dlob/DLOBSubscriber.d.ts +0 -2
  42. package/lib/browser/dlob/DLOBSubscriber.js +2 -7
  43. package/lib/browser/dlob/orderBookLevels.js +7 -7
  44. package/lib/browser/dlob/types.d.ts +0 -2
  45. package/lib/browser/events/eventSubscriber.d.ts +1 -1
  46. package/lib/browser/events/eventsServerLogProvider.js +2 -2
  47. package/lib/browser/events/parse.js +14 -14
  48. package/lib/browser/events/types.d.ts +3 -5
  49. package/lib/browser/events/types.js +1 -1
  50. package/lib/browser/idl/{drift.d.ts → velocity.d.ts} +1042 -767
  51. package/lib/browser/idl/{drift.json → velocity.json} +1033 -758
  52. package/lib/browser/index.d.ts +1 -1
  53. package/lib/browser/index.js +1 -2
  54. package/lib/browser/math/amm.d.ts +10 -10
  55. package/lib/browser/math/amm.js +29 -28
  56. package/lib/browser/math/auction.js +16 -12
  57. package/lib/browser/math/builder.d.ts +18 -1
  58. package/lib/browser/math/builder.js +32 -1
  59. package/lib/browser/math/funding.js +26 -26
  60. package/lib/browser/math/margin.d.ts +4 -4
  61. package/lib/browser/math/margin.js +15 -15
  62. package/lib/browser/math/market.js +13 -13
  63. package/lib/browser/math/oracles.d.ts +4 -4
  64. package/lib/browser/math/oracles.js +23 -23
  65. package/lib/browser/math/orders.d.ts +2 -2
  66. package/lib/browser/math/orders.js +9 -9
  67. package/lib/browser/math/position.js +4 -4
  68. package/lib/browser/math/superStake.d.ts +8 -10
  69. package/lib/browser/math/superStake.js +18 -20
  70. package/lib/browser/math/trade.js +5 -5
  71. package/lib/browser/math/utils.d.ts +1 -1
  72. package/lib/browser/math/utils.js +1 -1
  73. package/lib/browser/oracles/pythLazerClient.js +2 -2
  74. package/lib/browser/orderSubscriber/OrderSubscriber.d.ts +0 -2
  75. package/lib/browser/orderSubscriber/OrderSubscriber.js +8 -12
  76. package/lib/browser/orderSubscriber/WebsocketSubscription.js +1 -1
  77. package/lib/browser/orderSubscriber/grpcSubscription.js +2 -2
  78. package/lib/browser/orderSubscriber/types.d.ts +0 -2
  79. package/lib/browser/priorityFee/priorityFeeSubscriber.d.ts +1 -5
  80. package/lib/browser/priorityFee/priorityFeeSubscriber.js +7 -15
  81. package/lib/browser/priorityFee/priorityFeeSubscriberMap.d.ts +0 -4
  82. package/lib/browser/priorityFee/priorityFeeSubscriberMap.js +3 -11
  83. package/lib/browser/priorityFee/types.d.ts +3 -8
  84. package/lib/browser/priorityFee/velocityPriorityFeeMethod.d.ts +0 -8
  85. package/lib/browser/priorityFee/velocityPriorityFeeMethod.js +1 -3
  86. package/lib/browser/pyth/pythLazerSubscriber.d.ts +1 -1
  87. package/lib/browser/pyth/pythLazerSubscriber.js +1 -1
  88. package/lib/browser/swap/UnifiedSwapClient.js +1 -1
  89. package/lib/browser/swift/signedMsgUserAccountSubscriber.d.ts +4 -5
  90. package/lib/browser/swift/signedMsgUserAccountSubscriber.js +2 -6
  91. package/lib/browser/swift/swiftOrderSubscriber.d.ts +6 -5
  92. package/lib/browser/swift/swiftOrderSubscriber.js +5 -11
  93. package/lib/browser/types.d.ts +79 -91
  94. package/lib/browser/types.js +4 -0
  95. package/lib/browser/user.d.ts +1 -3
  96. package/lib/browser/user.js +19 -23
  97. package/lib/browser/userConfig.d.ts +3 -2
  98. package/lib/browser/userMap/WebsocketSubscription.js +1 -1
  99. package/lib/browser/userMap/grpcSubscription.js +1 -1
  100. package/lib/browser/userMap/referrerMap.d.ts +0 -2
  101. package/lib/browser/userMap/referrerMap.js +0 -4
  102. package/lib/browser/userMap/revenueShareEscrowMap.d.ts +0 -2
  103. package/lib/browser/userMap/revenueShareEscrowMap.js +0 -4
  104. package/lib/browser/userMap/userMap.d.ts +2 -4
  105. package/lib/browser/userMap/userMap.js +10 -14
  106. package/lib/browser/userMap/userMapConfig.d.ts +3 -2
  107. package/lib/browser/userMap/userStatsMap.d.ts +0 -2
  108. package/lib/browser/userMap/userStatsMap.js +0 -4
  109. package/lib/browser/userStats.d.ts +0 -2
  110. package/lib/browser/userStats.js +10 -14
  111. package/lib/browser/userStatsConfig.d.ts +3 -2
  112. package/lib/browser/util/ed25519Utils.d.ts +1 -1
  113. package/lib/browser/util/ed25519Utils.js +1 -1
  114. package/lib/browser/velocityClient.d.ts +53 -38
  115. package/lib/browser/velocityClient.js +258 -196
  116. package/lib/browser/velocityClientConfig.d.ts +0 -8
  117. package/lib/node/accounts/grpcProgramAccountSubscriber.js +1 -1
  118. package/lib/node/accounts/grpcVelocityClientAccountSubscriber.d.ts +0 -4
  119. package/lib/node/accounts/grpcVelocityClientAccountSubscriber.d.ts.map +1 -1
  120. package/lib/node/accounts/grpcVelocityClientAccountSubscriber.js +1 -3
  121. package/lib/node/accounts/grpcVelocityClientAccountSubscriberV2.d.ts +0 -4
  122. package/lib/node/accounts/grpcVelocityClientAccountSubscriberV2.d.ts.map +1 -1
  123. package/lib/node/accounts/grpcVelocityClientAccountSubscriberV2.js +5 -7
  124. package/lib/node/accounts/laserProgramAccountSubscriber.js +1 -1
  125. package/lib/node/accounts/pollingVelocityClientAccountSubscriber.d.ts +0 -4
  126. package/lib/node/accounts/pollingVelocityClientAccountSubscriber.d.ts.map +1 -1
  127. package/lib/node/accounts/pollingVelocityClientAccountSubscriber.js +5 -7
  128. package/lib/node/accounts/types.d.ts +2 -8
  129. package/lib/node/accounts/types.d.ts.map +1 -1
  130. package/lib/node/accounts/utils.js +2 -2
  131. package/lib/node/accounts/webSocketVelocityClientAccountSubscriber.d.ts +0 -4
  132. package/lib/node/accounts/webSocketVelocityClientAccountSubscriber.d.ts.map +1 -1
  133. package/lib/node/accounts/webSocketVelocityClientAccountSubscriber.js +5 -7
  134. package/lib/node/accounts/webSocketVelocityClientAccountSubscriberV2.d.ts +0 -4
  135. package/lib/node/accounts/webSocketVelocityClientAccountSubscriberV2.d.ts.map +1 -1
  136. package/lib/node/accounts/webSocketVelocityClientAccountSubscriberV2.js +5 -7
  137. package/lib/node/addresses/pda.d.ts +1 -7
  138. package/lib/node/addresses/pda.d.ts.map +1 -1
  139. package/lib/node/addresses/pda.js +4 -10
  140. package/lib/node/adminClient.d.ts +1 -1
  141. package/lib/node/adminClient.js +21 -21
  142. package/lib/node/auctionSubscriber/auctionSubscriber.d.ts +1 -3
  143. package/lib/node/auctionSubscriber/auctionSubscriber.d.ts.map +1 -1
  144. package/lib/node/auctionSubscriber/auctionSubscriber.js +2 -6
  145. package/lib/node/auctionSubscriber/auctionSubscriberGrpc.d.ts +1 -3
  146. package/lib/node/auctionSubscriber/auctionSubscriberGrpc.d.ts.map +1 -1
  147. package/lib/node/auctionSubscriber/auctionSubscriberGrpc.js +2 -6
  148. package/lib/node/auctionSubscriber/types.d.ts +3 -2
  149. package/lib/node/auctionSubscriber/types.d.ts.map +1 -1
  150. package/lib/node/config.d.ts +10 -19
  151. package/lib/node/config.d.ts.map +1 -1
  152. package/lib/node/config.js +6 -33
  153. package/lib/node/constants/insuranceFund.d.ts +1 -1
  154. package/lib/node/constants/insuranceFund.js +1 -1
  155. package/lib/node/constituentMap/constituentMap.d.ts +0 -2
  156. package/lib/node/constituentMap/constituentMap.d.ts.map +1 -1
  157. package/lib/node/constituentMap/constituentMap.js +5 -5
  158. package/lib/node/core/VelocityCore.d.ts +9 -15
  159. package/lib/node/core/VelocityCore.d.ts.map +1 -1
  160. package/lib/node/core/VelocityCore.js +5 -7
  161. package/lib/node/core/instructions/withdraw.d.ts +1 -1
  162. package/lib/node/core/instructions/withdraw.d.ts.map +1 -1
  163. package/lib/node/core/instructions/withdraw.js +1 -1
  164. package/lib/node/core/remainingAccounts.js +3 -3
  165. package/lib/node/dlob/DLOB.d.ts +1 -1
  166. package/lib/node/dlob/DLOB.d.ts.map +1 -1
  167. package/lib/node/dlob/DLOB.js +6 -6
  168. package/lib/node/dlob/DLOBSubscriber.d.ts +0 -2
  169. package/lib/node/dlob/DLOBSubscriber.d.ts.map +1 -1
  170. package/lib/node/dlob/DLOBSubscriber.js +2 -7
  171. package/lib/node/dlob/orderBookLevels.d.ts.map +1 -1
  172. package/lib/node/dlob/orderBookLevels.js +7 -7
  173. package/lib/node/dlob/types.d.ts +0 -2
  174. package/lib/node/dlob/types.d.ts.map +1 -1
  175. package/lib/node/events/eventSubscriber.d.ts +1 -1
  176. package/lib/node/events/eventsServerLogProvider.js +2 -2
  177. package/lib/node/events/parse.d.ts.map +1 -1
  178. package/lib/node/events/parse.js +14 -14
  179. package/lib/node/events/types.d.ts +3 -5
  180. package/lib/node/events/types.d.ts.map +1 -1
  181. package/lib/node/events/types.js +1 -1
  182. package/lib/node/idl/{drift.d.ts → velocity.d.ts} +1043 -768
  183. package/lib/node/idl/velocity.d.ts.map +1 -0
  184. package/lib/node/idl/{drift.json → velocity.json} +1033 -758
  185. package/lib/node/index.d.ts +1 -1
  186. package/lib/node/index.d.ts.map +1 -1
  187. package/lib/node/index.js +1 -2
  188. package/lib/node/math/amm.d.ts +10 -10
  189. package/lib/node/math/amm.d.ts.map +1 -1
  190. package/lib/node/math/amm.js +29 -28
  191. package/lib/node/math/auction.d.ts.map +1 -1
  192. package/lib/node/math/auction.js +16 -12
  193. package/lib/node/math/builder.d.ts +18 -1
  194. package/lib/node/math/builder.d.ts.map +1 -1
  195. package/lib/node/math/builder.js +32 -1
  196. package/lib/node/math/funding.d.ts.map +1 -1
  197. package/lib/node/math/funding.js +26 -26
  198. package/lib/node/math/margin.d.ts +4 -4
  199. package/lib/node/math/margin.d.ts.map +1 -1
  200. package/lib/node/math/margin.js +15 -15
  201. package/lib/node/math/market.d.ts.map +1 -1
  202. package/lib/node/math/market.js +13 -13
  203. package/lib/node/math/oracles.d.ts +4 -4
  204. package/lib/node/math/oracles.d.ts.map +1 -1
  205. package/lib/node/math/oracles.js +23 -23
  206. package/lib/node/math/orders.d.ts +2 -2
  207. package/lib/node/math/orders.d.ts.map +1 -1
  208. package/lib/node/math/orders.js +9 -9
  209. package/lib/node/math/position.d.ts.map +1 -1
  210. package/lib/node/math/position.js +4 -4
  211. package/lib/node/math/superStake.d.ts +8 -10
  212. package/lib/node/math/superStake.d.ts.map +1 -1
  213. package/lib/node/math/superStake.js +18 -20
  214. package/lib/node/math/trade.d.ts.map +1 -1
  215. package/lib/node/math/trade.js +5 -5
  216. package/lib/node/math/utils.d.ts +1 -1
  217. package/lib/node/math/utils.js +1 -1
  218. package/lib/node/oracles/pythLazerClient.js +2 -2
  219. package/lib/node/orderSubscriber/OrderSubscriber.d.ts +0 -2
  220. package/lib/node/orderSubscriber/OrderSubscriber.d.ts.map +1 -1
  221. package/lib/node/orderSubscriber/OrderSubscriber.js +8 -12
  222. package/lib/node/orderSubscriber/WebsocketSubscription.js +1 -1
  223. package/lib/node/orderSubscriber/grpcSubscription.js +2 -2
  224. package/lib/node/orderSubscriber/types.d.ts +0 -2
  225. package/lib/node/orderSubscriber/types.d.ts.map +1 -1
  226. package/lib/node/priorityFee/priorityFeeSubscriber.d.ts +1 -5
  227. package/lib/node/priorityFee/priorityFeeSubscriber.d.ts.map +1 -1
  228. package/lib/node/priorityFee/priorityFeeSubscriber.js +7 -15
  229. package/lib/node/priorityFee/priorityFeeSubscriberMap.d.ts +0 -4
  230. package/lib/node/priorityFee/priorityFeeSubscriberMap.d.ts.map +1 -1
  231. package/lib/node/priorityFee/priorityFeeSubscriberMap.js +3 -11
  232. package/lib/node/priorityFee/types.d.ts +3 -8
  233. package/lib/node/priorityFee/types.d.ts.map +1 -1
  234. package/lib/node/priorityFee/velocityPriorityFeeMethod.d.ts +0 -8
  235. package/lib/node/priorityFee/velocityPriorityFeeMethod.d.ts.map +1 -1
  236. package/lib/node/priorityFee/velocityPriorityFeeMethod.js +1 -3
  237. package/lib/node/pyth/pythLazerSubscriber.d.ts +1 -1
  238. package/lib/node/pyth/pythLazerSubscriber.js +1 -1
  239. package/lib/node/swap/UnifiedSwapClient.js +1 -1
  240. package/lib/node/swift/signedMsgUserAccountSubscriber.d.ts +4 -5
  241. package/lib/node/swift/signedMsgUserAccountSubscriber.d.ts.map +1 -1
  242. package/lib/node/swift/signedMsgUserAccountSubscriber.js +2 -6
  243. package/lib/node/swift/swiftOrderSubscriber.d.ts +6 -5
  244. package/lib/node/swift/swiftOrderSubscriber.d.ts.map +1 -1
  245. package/lib/node/swift/swiftOrderSubscriber.js +5 -11
  246. package/lib/node/types.d.ts +79 -91
  247. package/lib/node/types.d.ts.map +1 -1
  248. package/lib/node/types.js +4 -0
  249. package/lib/node/user.d.ts +1 -3
  250. package/lib/node/user.d.ts.map +1 -1
  251. package/lib/node/user.js +19 -23
  252. package/lib/node/userConfig.d.ts +3 -2
  253. package/lib/node/userConfig.d.ts.map +1 -1
  254. package/lib/node/userMap/WebsocketSubscription.js +1 -1
  255. package/lib/node/userMap/grpcSubscription.js +1 -1
  256. package/lib/node/userMap/referrerMap.d.ts +0 -2
  257. package/lib/node/userMap/referrerMap.d.ts.map +1 -1
  258. package/lib/node/userMap/referrerMap.js +0 -4
  259. package/lib/node/userMap/revenueShareEscrowMap.d.ts +0 -2
  260. package/lib/node/userMap/revenueShareEscrowMap.d.ts.map +1 -1
  261. package/lib/node/userMap/revenueShareEscrowMap.js +0 -4
  262. package/lib/node/userMap/userMap.d.ts +2 -4
  263. package/lib/node/userMap/userMap.d.ts.map +1 -1
  264. package/lib/node/userMap/userMap.js +10 -14
  265. package/lib/node/userMap/userMapConfig.d.ts +3 -2
  266. package/lib/node/userMap/userMapConfig.d.ts.map +1 -1
  267. package/lib/node/userMap/userStatsMap.d.ts +0 -2
  268. package/lib/node/userMap/userStatsMap.d.ts.map +1 -1
  269. package/lib/node/userMap/userStatsMap.js +0 -4
  270. package/lib/node/userStats.d.ts +0 -2
  271. package/lib/node/userStats.d.ts.map +1 -1
  272. package/lib/node/userStats.js +10 -14
  273. package/lib/node/userStatsConfig.d.ts +3 -2
  274. package/lib/node/userStatsConfig.d.ts.map +1 -1
  275. package/lib/node/util/ed25519Utils.d.ts +1 -1
  276. package/lib/node/util/ed25519Utils.js +1 -1
  277. package/lib/node/velocityClient.d.ts +53 -38
  278. package/lib/node/velocityClient.d.ts.map +1 -1
  279. package/lib/node/velocityClient.js +258 -196
  280. package/lib/node/velocityClientConfig.d.ts +0 -8
  281. package/lib/node/velocityClientConfig.d.ts.map +1 -1
  282. package/package.json +6 -7
  283. package/scripts/deposit-isolated-positions.ts +2 -2
  284. package/scripts/find-flagged-users.ts +1 -1
  285. package/scripts/grpc-client-test-comparison.ts +4 -4
  286. package/scripts/grpc-multiuser-client-test-comparison.ts +2 -2
  287. package/scripts/single-grpc-client-test.ts +3 -3
  288. package/scripts/updateVersion.js +4 -4
  289. package/scripts/withdraw-isolated-positions.ts +2 -2
  290. package/src/accounts/grpcProgramAccountSubscriber.ts +1 -1
  291. package/src/accounts/grpcVelocityClientAccountSubscriber.ts +0 -7
  292. package/src/accounts/grpcVelocityClientAccountSubscriberV2.ts +4 -11
  293. package/src/accounts/laserProgramAccountSubscriber.ts +1 -1
  294. package/src/accounts/pollingVelocityClientAccountSubscriber.ts +4 -11
  295. package/src/accounts/types.ts +2 -9
  296. package/src/accounts/utils.ts +2 -2
  297. package/src/accounts/webSocketVelocityClientAccountSubscriber.ts +4 -11
  298. package/src/accounts/webSocketVelocityClientAccountSubscriberV2.ts +4 -11
  299. package/src/addresses/pda.ts +3 -13
  300. package/src/adminClient.ts +21 -21
  301. package/src/auctionSubscriber/auctionSubscriber.ts +1 -6
  302. package/src/auctionSubscriber/auctionSubscriberGrpc.ts +1 -6
  303. package/src/auctionSubscriber/types.ts +3 -3
  304. package/src/config.ts +8 -67
  305. package/src/constants/insuranceFund.ts +1 -1
  306. package/src/constituentMap/constituentMap.ts +2 -6
  307. package/src/core/VelocityCore.ts +11 -20
  308. package/src/core/instructions/withdraw.ts +2 -2
  309. package/src/core/remainingAccounts.ts +3 -3
  310. package/src/dlob/DLOB.ts +6 -6
  311. package/src/dlob/DLOBSubscriber.ts +2 -8
  312. package/src/dlob/orderBookLevels.ts +12 -6
  313. package/src/dlob/types.ts +0 -2
  314. package/src/events/eventSubscriber.ts +1 -1
  315. package/src/events/eventsServerLogProvider.ts +2 -2
  316. package/src/events/parse.ts +14 -14
  317. package/src/events/types.ts +4 -7
  318. package/src/idl/{drift.json → velocity.json} +1033 -758
  319. package/src/idl/{drift.ts → velocity.ts} +1035 -760
  320. package/src/index.ts +1 -4
  321. package/src/margin/README.md +2 -2
  322. package/src/math/amm.ts +43 -21
  323. package/src/math/auction.ts +16 -12
  324. package/src/math/builder.ts +45 -1
  325. package/src/math/funding.ts +46 -43
  326. package/src/math/margin.ts +15 -15
  327. package/src/math/market.ts +21 -13
  328. package/src/math/oracles.ts +29 -26
  329. package/src/math/orders.ts +18 -5
  330. package/src/math/position.ts +9 -3
  331. package/src/math/superStake.ts +21 -24
  332. package/src/math/trade.ts +9 -1
  333. package/src/math/utils.ts +1 -1
  334. package/src/oracles/pythLazerClient.ts +3 -3
  335. package/src/orderSubscriber/OrderSubscriber.ts +2 -8
  336. package/src/orderSubscriber/WebsocketSubscription.ts +1 -1
  337. package/src/orderSubscriber/grpcSubscription.ts +2 -2
  338. package/src/orderSubscriber/types.ts +0 -2
  339. package/src/priorityFee/priorityFeeSubscriber.ts +5 -12
  340. package/src/priorityFee/priorityFeeSubscriberMap.ts +2 -10
  341. package/src/priorityFee/types.ts +3 -13
  342. package/src/priorityFee/velocityPriorityFeeMethod.ts +0 -12
  343. package/src/pyth/pythLazerSubscriber.ts +1 -1
  344. package/src/swap/UnifiedSwapClient.ts +1 -1
  345. package/src/swift/signedMsgUserAccountSubscriber.ts +2 -8
  346. package/src/swift/swiftOrderSubscriber.ts +7 -12
  347. package/src/types.ts +84 -102
  348. package/src/user.ts +9 -14
  349. package/src/userConfig.ts +1 -3
  350. package/src/userMap/WebsocketSubscription.ts +1 -1
  351. package/src/userMap/grpcSubscription.ts +1 -1
  352. package/src/userMap/referrerMap.ts +0 -4
  353. package/src/userMap/revenueShareEscrowMap.ts +0 -4
  354. package/src/userMap/userMap.ts +3 -7
  355. package/src/userMap/userMapConfig.ts +3 -3
  356. package/src/userMap/userStatsMap.ts +0 -4
  357. package/src/userStats.ts +1 -5
  358. package/src/userStatsConfig.ts +3 -3
  359. package/src/util/ed25519Utils.ts +1 -1
  360. package/src/velocityClient.ts +339 -225
  361. package/src/velocityClientConfig.ts +0 -10
  362. package/tests/{DriftCore → VelocityCore}/decode.test.ts +1 -1
  363. package/tests/{DriftCore → VelocityCore}/fill_trigger.test.ts +1 -1
  364. package/tests/{DriftCore → VelocityCore}/instructions.test.ts +1 -1
  365. package/tests/{DriftCore → VelocityCore}/pdas.test.ts +4 -2
  366. package/tests/ci/verifyConstants.ts +24 -27
  367. package/tests/decode/test.ts +2 -2
  368. package/tests/dlob/helpers.ts +5 -9
  369. package/tests/events/parseLogsForCuUsage.ts +15 -15
  370. package/tests/user/helpers.ts +9 -9
  371. package/tests/user/test.ts +13 -10
  372. package/lib/browser/util/deprecatedAlias.d.ts +0 -26
  373. package/lib/browser/util/deprecatedAlias.js +0 -10
  374. package/lib/node/idl/drift.d.ts.map +0 -1
  375. package/lib/node/util/deprecatedAlias.d.ts +0 -27
  376. package/lib/node/util/deprecatedAlias.d.ts.map +0 -1
  377. package/lib/node/util/deprecatedAlias.js +0 -10
  378. package/src/util/deprecatedAlias.ts +0 -21
  379. /package/lib/browser/idl/{drift.js → velocity.js} +0 -0
  380. /package/lib/node/idl/{drift.js → velocity.js} +0 -0
  381. /package/tests/{DriftCore → VelocityCore}/perp_orders.test.ts +0 -0
  382. /package/tests/{DriftCore → VelocityCore}/remainingAccounts.test.ts +0 -0
  383. /package/tests/{DriftCore → VelocityCore}/settlement_liquidation.test.ts +0 -0
@@ -7,10 +7,6 @@ const bulkAccountLoader_1 = require("../accounts/bulkAccountLoader");
7
7
  const memcmp_1 = require("../memcmp");
8
8
  const web3_js_1 = require("@solana/web3.js");
9
9
  class UserStatsMap {
10
- /** @deprecated Use `velocityClient` instead. `driftClient` will be removed in a future major. */
11
- get driftClient() {
12
- return this.velocityClient;
13
- }
14
10
  /**
15
11
  * Creates a new UserStatsMap instance.
16
12
  *
@@ -10,8 +10,6 @@ import { UserStatsConfig } from './userStatsConfig';
10
10
  import { ReferrerInfo, UserStatsAccount } from './types';
11
11
  export declare class UserStats {
12
12
  velocityClient: VelocityClient;
13
- /** @deprecated Use `velocityClient` instead. `driftClient` will be removed in a future major. */
14
- get driftClient(): VelocityClient;
15
13
  userStatsAccountPublicKey: PublicKey;
16
14
  accountSubscriber: UserStatsAccountSubscriber;
17
15
  isSubscribed: boolean;
@@ -7,32 +7,28 @@ const webSocketUserStatsAccountSubsriber_1 = require("./accounts/webSocketUserSt
7
7
  const pda_1 = require("./addresses/pda");
8
8
  const grpcUserStatsAccountSubscriber_1 = require("./accounts/grpcUserStatsAccountSubscriber");
9
9
  class UserStats {
10
- /** @deprecated Use `velocityClient` instead. `driftClient` will be removed in a future major. */
11
- get driftClient() {
12
- return this.velocityClient;
13
- }
14
10
  constructor(config) {
15
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
11
+ var _a, _b, _c, _d, _e, _f, _g, _h;
16
12
  // Type-system guarantees at least one of the two is supplied.
17
- const velocityClient = ((_a = config.velocityClient) !== null && _a !== void 0 ? _a : config.driftClient);
13
+ const velocityClient = config.velocityClient;
18
14
  this.velocityClient = velocityClient;
19
15
  this.userStatsAccountPublicKey = config.userStatsAccountPublicKey;
20
- if (((_b = config.accountSubscription) === null || _b === void 0 ? void 0 : _b.type) === 'polling') {
16
+ if (((_a = config.accountSubscription) === null || _a === void 0 ? void 0 : _a.type) === 'polling') {
21
17
  this.accountSubscriber = new pollingUserStatsAccountSubscriber_1.PollingUserStatsAccountSubscriber(velocityClient.program, config.userStatsAccountPublicKey, config.accountSubscription.accountLoader);
22
18
  }
23
- else if (((_c = config.accountSubscription) === null || _c === void 0 ? void 0 : _c.type) === 'grpc') {
19
+ else if (((_b = config.accountSubscription) === null || _b === void 0 ? void 0 : _b.type) === 'grpc') {
24
20
  this.accountSubscriber = new grpcUserStatsAccountSubscriber_1.grpcUserStatsAccountSubscriber(config.accountSubscription.grpcConfigs, velocityClient.program, config.userStatsAccountPublicKey, {
25
- resubTimeoutMs: (_d = config.accountSubscription) === null || _d === void 0 ? void 0 : _d.resubTimeoutMs,
26
- logResubMessages: (_e = config.accountSubscription) === null || _e === void 0 ? void 0 : _e.logResubMessages,
21
+ resubTimeoutMs: (_c = config.accountSubscription) === null || _c === void 0 ? void 0 : _c.resubTimeoutMs,
22
+ logResubMessages: (_d = config.accountSubscription) === null || _d === void 0 ? void 0 : _d.logResubMessages,
27
23
  });
28
24
  }
29
- else if (((_f = config.accountSubscription) === null || _f === void 0 ? void 0 : _f.type) === 'websocket') {
25
+ else if (((_e = config.accountSubscription) === null || _e === void 0 ? void 0 : _e.type) === 'websocket') {
30
26
  this.accountSubscriber = new webSocketUserStatsAccountSubsriber_1.WebSocketUserStatsAccountSubscriber(velocityClient.program, config.userStatsAccountPublicKey, {
31
- resubTimeoutMs: (_g = config.accountSubscription) === null || _g === void 0 ? void 0 : _g.resubTimeoutMs,
32
- logResubMessages: (_h = config.accountSubscription) === null || _h === void 0 ? void 0 : _h.logResubMessages,
27
+ resubTimeoutMs: (_f = config.accountSubscription) === null || _f === void 0 ? void 0 : _f.resubTimeoutMs,
28
+ logResubMessages: (_g = config.accountSubscription) === null || _g === void 0 ? void 0 : _g.logResubMessages,
33
29
  }, config.accountSubscription.commitment);
34
30
  }
35
- else if (((_j = config.accountSubscription) === null || _j === void 0 ? void 0 : _j.type) === 'custom') {
31
+ else if (((_h = config.accountSubscription) === null || _h === void 0 ? void 0 : _h.type) === 'custom') {
36
32
  this.accountSubscriber =
37
33
  config.accountSubscription.userStatsAccountSubscriber;
38
34
  }
@@ -2,12 +2,13 @@ import { VelocityClient } from './velocityClient';
2
2
  import { Commitment, PublicKey } from '@solana/web3.js';
3
3
  import { BulkAccountLoader } from './accounts/bulkAccountLoader';
4
4
  import { GrpcConfigs, UserStatsAccountSubscriber } from './accounts/types';
5
- import { AtLeastOne } from './util/deprecatedAlias';
6
5
  type UserStatsConfigBase = {
7
6
  accountSubscription?: UserStatsSubscriptionConfig;
8
7
  userStatsAccountPublicKey: PublicKey;
9
8
  };
10
- export type UserStatsConfig = UserStatsConfigBase & AtLeastOne<'velocityClient', 'driftClient', VelocityClient>;
9
+ export type UserStatsConfig = UserStatsConfigBase & {
10
+ velocityClient: VelocityClient;
11
+ };
11
12
  export type UserStatsSubscriptionConfig = {
12
13
  type: 'websocket';
13
14
  resubTimeoutMs?: number;
@@ -1,7 +1,7 @@
1
1
  import { TransactionInstruction } from '@solana/web3.js';
2
2
  /**
3
3
  * Constructs a minimal Ed25519 verification instruction that references the data
4
- * inside the drift custom instruction (e.g. postPythLazerOracleUpdate, placeSignedMsgTakerOrder).
4
+ * inside the velocity custom instruction (e.g. postPythLazerOracleUpdate, placeSignedMsgTakerOrder).
5
5
  *
6
6
  * @param customInstructionIndex The index of the custom instruction in the transaction (e.g. if tx contains compute budget limit, compute budget price, ed25519 verify, custom ix, this would be 3).
7
7
  * @param messageOffset The offset within the custom instruction data where the signed message begins.
@@ -47,7 +47,7 @@ const ED25519_INSTRUCTION_LAYOUT = BufferLayout.struct([
47
47
  ]);
48
48
  /**
49
49
  * Constructs a minimal Ed25519 verification instruction that references the data
50
- * inside the drift custom instruction (e.g. postPythLazerOracleUpdate, placeSignedMsgTakerOrder).
50
+ * inside the velocity custom instruction (e.g. postPythLazerOracleUpdate, placeSignedMsgTakerOrder).
51
51
  *
52
52
  * @param customInstructionIndex The index of the custom instruction in the transaction (e.g. if tx contains compute budget limit, compute budget price, ed25519 verify, custom ix, this would be 3).
53
53
  * @param messageOffset The offset within the custom instruction data where the signed message begins.
@@ -18,7 +18,7 @@
18
18
  */
19
19
  import { AnchorProvider, BN } from './isomorphic/anchor';
20
20
  import type { ProgramAccount } from '@coral-xyz/anchor';
21
- import { VelocityClientMetricsEvents, IWallet, MakerInfo, MappedRecord, MarketType, ModifyOrderPolicy, OptionalOrderParams, OracleSource, Order, OrderParams, OrderTriggerCondition, PerpMarketAccount, PerpMarketExtendedInfo, PlaceAndTakeOrderSuccessCondition, PositionDirection, ReferrerInfo, ReferrerNameAccount, ScaleOrderParams, SettlePnlMode, SignedTxData, SpotMarketAccount, SpotPosition, StateAccount, SwapReduceOnly, SignedMsgOrderParamsMessage, TxParams, UserAccount, UserStatsAccount, SignedMsgOrderParamsDelegateMessage, PostOnlyParams, LPPoolAccount, ConstituentAccount, ConstituentTargetBaseAccount, AmmCache } from './types';
21
+ import { VelocityClientMetricsEvents, IWallet, MakerInfo, MappedRecord, MarketType, ModifyOrderPolicy, OptionalOrderParams, OracleSource, Order, OrderParams, OrderTriggerCondition, PerpMarketAccount, PerpMarketExtendedInfo, PlaceAndTakeOrderSuccessCondition, PositionDirection, ReferrerInfo, ReferrerNameAccount, RevenueShareEscrowAccount, ScaleOrderParams, SettlePnlMode, SignedTxData, SpotMarketAccount, SpotPosition, StateAccount, SwapReduceOnly, SignedMsgOrderParamsMessage, TxParams, UserAccount, UserStatsAccount, SignedMsgOrderParamsDelegateMessage, PostOnlyParams, LPPoolAccount, ConstituentAccount, ConstituentTargetBaseAccount, AmmCache } from './types';
22
22
  import { AccountMeta, AddressLookupTableAccount, BlockhashWithExpiryBlockHeight, ConfirmOptions, Connection, Keypair, PublicKey, Signer, Transaction, TransactionInstruction, TransactionSignature, TransactionVersion, VersionedTransaction } from '@solana/web3.js';
23
23
  import { TokenFaucet } from './tokenFaucet';
24
24
  import { EventEmitter } from 'events';
@@ -131,7 +131,7 @@ export declare class VelocityClient {
131
131
  fetchAllLookupTableAccounts(): Promise<AddressLookupTableAccount[]>;
132
132
  private getTxVersionForNewWallet;
133
133
  /**
134
- * Update the wallet to use for drift transactions and linked user account
134
+ * Update the wallet to use for velocity transactions and linked user account
135
135
  * @param newWallet
136
136
  * @param subAccountIds
137
137
  * @param activeSubAccountId
@@ -253,6 +253,8 @@ export declare class VelocityClient {
253
253
  authority?: PublicKey;
254
254
  }): Promise<TransactionInstruction>;
255
255
  updateUserDelegate(delegate: PublicKey, subAccountId?: number): Promise<TransactionSignature>;
256
+ getUpdateUserAllowDelegateTransferIx(allowDelegateTransfer: boolean): Promise<TransactionInstruction>;
257
+ updateUserAllowDelegateTransfer(allowDelegateTransfer: boolean): Promise<TransactionSignature>;
256
258
  updateUserAdvancedLp(updates: {
257
259
  advancedLp: boolean;
258
260
  subAccountId: number;
@@ -332,7 +334,7 @@ export declare class VelocityClient {
332
334
  */
333
335
  convertToPricePrecision(amount: BN | number): BN;
334
336
  /**
335
- * Each drift instruction must include perp and sport market accounts in the ix remaining accounts.
337
+ * Each velocity instruction must include perp and sport market accounts in the ix remaining accounts.
336
338
  * Use this function to force a subset of markets to be included in the remaining accounts for every ix
337
339
  *
338
340
  * @param perpMarketIndexes
@@ -462,6 +464,8 @@ export declare class VelocityClient {
462
464
  */
463
465
  transferDeposit(amount: BN, marketIndex: number, fromSubAccountId: number, toSubAccountId: number, txParams?: TxParams): Promise<TransactionSignature>;
464
466
  getTransferDepositIx(amount: BN, marketIndex: number, fromSubAccountId: number, toSubAccountId: number): Promise<TransactionInstruction>;
467
+ transferDepositByDelegate(amount: BN, marketIndex: number, fromSubAccountId: number, toSubAccountId: number, txParams?: TxParams): Promise<TransactionSignature>;
468
+ getTransferDepositByDelegateIx(amount: BN, marketIndex: number, fromSubAccountId: number, toSubAccountId: number): Promise<TransactionInstruction>;
465
469
  transferPools(depositFromMarketIndex: number, depositToMarketIndex: number, borrowFromMarketIndex: number, borrowToMarketIndex: number, depositAmount: BN | undefined, borrowAmount: BN | undefined, fromSubAccountId: number, toSubAccountId: number, txParams?: TxParams): Promise<TransactionSignature>;
466
470
  getTransferPoolsIx(depositFromMarketIndex: number, depositToMarketIndex: number, borrowFromMarketIndex: number, borrowToMarketIndex: number, depositAmount: BN | undefined, borrowAmount: BN | undefined, fromSubAccountId: number, toSubAccountId: number, isToNewSubAccount?: boolean): Promise<TransactionInstruction>;
467
471
  transferPerpPosition(fromSubAccountId: number, toSubAccountId: number, marketIndex: number, amount: BN, txParams?: TxParams): Promise<TransactionSignature>;
@@ -482,7 +486,7 @@ export declare class VelocityClient {
482
486
  */
483
487
  openPosition(direction: PositionDirection, amount: BN, marketIndex: number, limitPrice?: BN, subAccountId?: number): Promise<TransactionSignature>;
484
488
  sendSignedTx(tx: Transaction | VersionedTransaction, opts?: ConfirmOptions): Promise<TransactionSignature>;
485
- prepareMarketOrderTxs(orderParams: OptionalOrderParams, userAccountPublicKey: PublicKey, userAccount: UserAccount, makerInfo?: MakerInfo | MakerInfo[], txParams?: TxParams, bracketOrdersParams?: OptionalOrderParams[], referrerInfo?: ReferrerInfo, cancelExistingOrders?: boolean, settlePnl?: boolean, positionMaxLev?: number, isolatedPositionDepositAmount?: BN): Promise<{
489
+ prepareMarketOrderTxs(orderParams: OptionalOrderParams, userAccountPublicKey: PublicKey, userAccount: UserAccount, makerInfo?: MakerInfo | MakerInfo[], txParams?: TxParams, bracketOrdersParams?: OptionalOrderParams[], cancelExistingOrders?: boolean, settlePnl?: boolean, positionMaxLev?: number, isolatedPositionDepositAmount?: BN): Promise<{
486
490
  cancelExistingOrdersTx?: Transaction | VersionedTransaction;
487
491
  settlePnlTx?: Transaction | VersionedTransaction;
488
492
  fillTx?: Transaction | VersionedTransaction;
@@ -499,13 +503,31 @@ export declare class VelocityClient {
499
503
  * @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
500
504
  * @returns
501
505
  */
502
- sendMarketOrderAndGetSignedFillTx(orderParams: OptionalOrderParams, userAccountPublicKey: PublicKey, userAccount: UserAccount, makerInfo?: MakerInfo | MakerInfo[], txParams?: TxParams, bracketOrdersParams?: OptionalOrderParams[], referrerInfo?: ReferrerInfo, cancelExistingOrders?: boolean, settlePnl?: boolean): Promise<{
506
+ sendMarketOrderAndGetSignedFillTx(orderParams: OptionalOrderParams, userAccountPublicKey: PublicKey, userAccount: UserAccount, makerInfo?: MakerInfo | MakerInfo[], txParams?: TxParams, bracketOrdersParams?: OptionalOrderParams[], cancelExistingOrders?: boolean, settlePnl?: boolean): Promise<{
503
507
  txSig: TransactionSignature;
504
508
  signedFillTx?: Transaction;
505
509
  signedCancelExistingOrdersTx?: Transaction;
506
510
  signedSettlePnlTx?: Transaction;
507
511
  }>;
508
512
  placePerpOrder(orderParams: OptionalOrderParams, txParams?: TxParams, subAccountId?: number, isolatedPositionDepositAmount?: BN): Promise<TransactionSignature>;
513
+ /**
514
+ * Returns the RevenueShareEscrow account meta for the placing user when `orderParams`
515
+ * carries a builder code (`builderIdx` + `builderFeeTenthBps`), otherwise `undefined`.
516
+ * The on-chain handlers peek for this account last in `remaining_accounts`, so callers
517
+ * must push it after the market/oracle/maker accounts.
518
+ */
519
+ private getBuilderEscrowAccountMeta;
520
+ /**
521
+ * Returns the AccountMeta for the taker's RevenueShareEscrow when a fill of the
522
+ * taker's order must include it: the order carries a builder code, or the taker
523
+ * is referred (their escrow was initialized with a referrer). Returns `undefined`
524
+ * when neither applies so no account meta is added to the transaction. The
525
+ * on-chain handlers peek for this account last in `remaining_accounts`, so
526
+ * callers must push it after the market/oracle/maker accounts.
527
+ *
528
+ * Throws when `takerEscrow` does not belong to `takerAuthority`.
529
+ */
530
+ private getTakerEscrowAccountMeta;
509
531
  getPlacePerpOrderIx(orderParams: OptionalOrderParams, subAccountId?: number, depositToTradeArgs?: {
510
532
  isMakingNewAccount: boolean;
511
533
  depositMarketIndex: number;
@@ -572,18 +594,18 @@ export declare class VelocityClient {
572
594
  placeScaleOrdersTx: Transaction | VersionedTransaction;
573
595
  }>;
574
596
  getPlaceScaleOrdersIx(params: ScaleOrderParams, subAccountId?: number): Promise<TransactionInstruction>;
575
- fillPerpOrder(userAccountPublicKey: PublicKey, user: UserAccount, order?: Pick<Order, 'marketIndex' | 'orderId'>, makerInfo?: MakerInfo | MakerInfo[], referrerInfo?: ReferrerInfo, txParams?: TxParams, fillerSubAccountId?: number, fillerAuthority?: PublicKey, hasBuilderFee?: boolean): Promise<TransactionSignature>;
576
- getFillPerpOrderIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, order: Pick<Order, 'marketIndex' | 'orderId'>, makerInfo?: MakerInfo | MakerInfo[], referrerInfo?: ReferrerInfo, fillerSubAccountId?: number, isSignedMsg?: boolean, fillerAuthority?: PublicKey, hasBuilderFee?: boolean): Promise<TransactionInstruction>;
597
+ fillPerpOrder(userAccountPublicKey: PublicKey, user: UserAccount, order?: Pick<Order, 'marketIndex' | 'orderId'>, makerInfo?: MakerInfo | MakerInfo[], txParams?: TxParams, fillerSubAccountId?: number, fillerAuthority?: PublicKey, hasBuilderFee?: boolean, takerEscrow?: RevenueShareEscrowAccount): Promise<TransactionSignature>;
598
+ getFillPerpOrderIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, order: Pick<Order, 'marketIndex' | 'orderId'>, makerInfo?: MakerInfo | MakerInfo[], fillerSubAccountId?: number, isSignedMsg?: boolean, fillerAuthority?: PublicKey, hasBuilderFee?: boolean, takerEscrow?: RevenueShareEscrowAccount): Promise<TransactionInstruction>;
577
599
  getRevertFillIx(fillerPublicKey?: PublicKey): Promise<TransactionInstruction>;
578
600
  placeSpotOrder(_orderParams: OptionalOrderParams, _txParams?: TxParams, _subAccountId?: number): Promise<TransactionSignature>;
579
601
  preparePlaceSpotOrderTx(_orderParams: OptionalOrderParams, _txParams?: TxParams, _subAccountId?: number): Promise<void>;
580
602
  getPlaceSpotOrderIx(_orderParams: OptionalOrderParams, _subAccountId?: number, _overrides?: {
581
603
  authority?: PublicKey;
582
604
  }): Promise<TransactionInstruction>;
583
- fillSpotOrder(_userAccountPublicKey: PublicKey, _user: UserAccount, _order?: Pick<Order, 'marketIndex' | 'orderId'>, _fulfillmentConfig?: unknown, _makerInfo?: MakerInfo | MakerInfo[], _referrerInfo?: ReferrerInfo, _txParams?: TxParams): Promise<TransactionSignature>;
584
- getFillSpotOrderIx(_userAccountPublicKey: PublicKey, _userAccount: UserAccount, _order?: Pick<Order, 'marketIndex' | 'orderId'>, _fulfillmentConfig?: unknown, _makerInfo?: MakerInfo | MakerInfo[], _referrerInfo?: ReferrerInfo, _fillerPublicKey?: PublicKey): Promise<TransactionInstruction>;
605
+ fillSpotOrder(_userAccountPublicKey: PublicKey, _user: UserAccount, _order?: Pick<Order, 'marketIndex' | 'orderId'>, _fulfillmentConfig?: unknown, _makerInfo?: MakerInfo | MakerInfo[], _txParams?: TxParams): Promise<TransactionSignature>;
606
+ getFillSpotOrderIx(_userAccountPublicKey: PublicKey, _userAccount: UserAccount, _order?: Pick<Order, 'marketIndex' | 'orderId'>, _fulfillmentConfig?: unknown, _makerInfo?: MakerInfo | MakerInfo[], _fillerPublicKey?: PublicKey): Promise<TransactionInstruction>;
585
607
  /**
586
- * Swap tokens in drift account using titan or jupiter
608
+ * Swap tokens in velocity account using titan or jupiter
587
609
  * @param swapClient swap client to find routes and instructions (Titan or Jupiter)
588
610
  * @param jupiterClient @deprecated Use swapClient instead. Legacy parameter for backward compatibility
589
611
  * @param outMarketIndex the market index of the token you're buying
@@ -594,7 +616,7 @@ export declare class VelocityClient {
594
616
  * @param slippageBps the max slippage passed to the swap provider api
595
617
  * @param swapMode swap provider swapMode (ExactIn or ExactOut), default is ExactIn
596
618
  * @param route the swap provider route to use for the swap
597
- * @param reduceOnly specify if In or Out token on the drift account must reduceOnly, checked at end of swap
619
+ * @param reduceOnly specify if In or Out token on the velocity account must reduceOnly, checked at end of swap
598
620
  * @param v6 pass in the quote response from swap provider quote's API (deprecated, use quote instead)
599
621
  * @param quote pass in the quote response from swap provider quote's API
600
622
  * @param txParams
@@ -652,7 +674,7 @@ export declare class VelocityClient {
652
674
  lookupTables: AddressLookupTableAccount[];
653
675
  }>;
654
676
  /**
655
- * Get the drift begin_swap and end_swap instructions
677
+ * Get the velocity begin_swap and end_swap instructions
656
678
  *
657
679
  * @param outMarketIndex the market index of the token you're buying
658
680
  * @param inMarketIndex the market index of the token you're selling
@@ -715,27 +737,27 @@ export declare class VelocityClient {
715
737
  getUpdateUserStatsReferrerStatusIx(userAuthority: PublicKey): Promise<TransactionInstruction>;
716
738
  updateUserOpenOrdersCount(userAccountPublicKey: PublicKey, user: UserAccount, txParams?: TxParams, fillerPublicKey?: PublicKey): Promise<TransactionSignature>;
717
739
  getUpdateUserOpenOrdersCountIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, fillerPublicKey?: PublicKey): Promise<TransactionInstruction>;
718
- placeAndTakePerpOrder(orderParams: OptionalOrderParams, makerInfo?: MakerInfo | MakerInfo[], referrerInfo?: ReferrerInfo, successCondition?: PlaceAndTakeOrderSuccessCondition, auctionDurationPercentage?: number, txParams?: TxParams, subAccountId?: number): Promise<TransactionSignature>;
719
- preparePlaceAndTakePerpOrderWithAdditionalOrders(orderParams: OptionalOrderParams, makerInfo?: MakerInfo | MakerInfo[], referrerInfo?: ReferrerInfo, bracketOrdersParams?: OptionalOrderParams[], txParams?: TxParams, subAccountId?: number, cancelExistingOrders?: boolean, settlePnl?: boolean, exitEarlyIfSimFails?: boolean, auctionDurationPercentage?: number, optionalIxs?: TransactionInstruction[], isolatedPositionDepositAmount?: BN): Promise<{
740
+ placeAndTakePerpOrder(orderParams: OptionalOrderParams, makerInfo?: MakerInfo | MakerInfo[], successCondition?: PlaceAndTakeOrderSuccessCondition, auctionDurationPercentage?: number, txParams?: TxParams, subAccountId?: number, takerEscrow?: RevenueShareEscrowAccount): Promise<TransactionSignature>;
741
+ preparePlaceAndTakePerpOrderWithAdditionalOrders(orderParams: OptionalOrderParams, makerInfo?: MakerInfo | MakerInfo[], bracketOrdersParams?: OptionalOrderParams[], txParams?: TxParams, subAccountId?: number, cancelExistingOrders?: boolean, settlePnl?: boolean, exitEarlyIfSimFails?: boolean, auctionDurationPercentage?: number, optionalIxs?: TransactionInstruction[], isolatedPositionDepositAmount?: BN): Promise<{
720
742
  placeAndTakeTx: Transaction | VersionedTransaction;
721
743
  cancelExistingOrdersTx: Transaction | VersionedTransaction;
722
744
  settlePnlTx: Transaction | VersionedTransaction;
723
745
  }>;
724
- placeAndTakePerpWithAdditionalOrders(orderParams: OptionalOrderParams, makerInfo?: MakerInfo | MakerInfo[], referrerInfo?: ReferrerInfo, bracketOrdersParams?: OptionalOrderParams[], txParams?: TxParams, subAccountId?: number, cancelExistingOrders?: boolean, settlePnl?: boolean, exitEarlyIfSimFails?: boolean): Promise<{
746
+ placeAndTakePerpWithAdditionalOrders(orderParams: OptionalOrderParams, makerInfo?: MakerInfo | MakerInfo[], bracketOrdersParams?: OptionalOrderParams[], txParams?: TxParams, subAccountId?: number, cancelExistingOrders?: boolean, settlePnl?: boolean, exitEarlyIfSimFails?: boolean): Promise<{
725
747
  txSig: TransactionSignature;
726
748
  signedCancelExistingOrdersTx?: Transaction;
727
749
  signedSettlePnlTx?: Transaction;
728
750
  }>;
729
- getPlaceAndTakePerpOrderIx(orderParams: OptionalOrderParams, makerInfo?: MakerInfo | MakerInfo[], referrerInfo?: ReferrerInfo, successCondition?: PlaceAndTakeOrderSuccessCondition, auctionDurationPercentage?: number, subAccountId?: number, overrides?: {
751
+ getPlaceAndTakePerpOrderIx(orderParams: OptionalOrderParams, makerInfo?: MakerInfo | MakerInfo[], successCondition?: PlaceAndTakeOrderSuccessCondition, auctionDurationPercentage?: number, subAccountId?: number, overrides?: {
730
752
  authority?: PublicKey;
731
- }): Promise<TransactionInstruction>;
732
- placeAndMakePerpOrder(orderParams: OptionalOrderParams, takerInfo: TakerInfo, referrerInfo?: ReferrerInfo, txParams?: TxParams, subAccountId?: number): Promise<TransactionSignature>;
733
- getPlaceAndMakePerpOrderIx(orderParams: OptionalOrderParams, takerInfo: TakerInfo, referrerInfo?: ReferrerInfo, subAccountId?: number): Promise<TransactionInstruction>;
753
+ }, takerEscrow?: RevenueShareEscrowAccount): Promise<TransactionInstruction>;
754
+ placeAndMakePerpOrder(orderParams: OptionalOrderParams, takerInfo: TakerInfo, txParams?: TxParams, subAccountId?: number, takerEscrow?: RevenueShareEscrowAccount): Promise<TransactionSignature>;
755
+ getPlaceAndMakePerpOrderIx(orderParams: OptionalOrderParams, takerInfo: TakerInfo, subAccountId?: number, takerEscrow?: RevenueShareEscrowAccount): Promise<TransactionInstruction>;
734
756
  signSignedMsgOrderParamsMessage(orderParamsMessage: SignedMsgOrderParamsMessage | SignedMsgOrderParamsDelegateMessage, delegateSigner?: boolean): SignedMsgOrderParams;
735
757
  /**
736
758
  * Builds a deposit and place request for Swift service
737
759
  *
738
- * @param depositTx - The signed tx containing a drift deposit (e.g. see `buildSwiftDepositTx`)
760
+ * @param depositTx - The signed tx containing a velocity deposit (e.g. see `buildSwiftDepositTx`)
739
761
  * @param orderParamsMessage - The order parameters message to sign
740
762
  * @param delegateSigner - Whether this is a delegate signer
741
763
  *
@@ -765,18 +787,18 @@ export declare class VelocityClient {
765
787
  takerStats: PublicKey;
766
788
  takerUserAccount: UserAccount;
767
789
  signingAuthority: PublicKey;
768
- }, orderParams: OptionalOrderParams, referrerInfo?: ReferrerInfo, txParams?: TxParams, subAccountId?: number, precedingIxs?: TransactionInstruction[], overrideCustomIxIndex?: number): Promise<TransactionSignature>;
790
+ }, orderParams: OptionalOrderParams, txParams?: TxParams, subAccountId?: number, precedingIxs?: TransactionInstruction[], overrideCustomIxIndex?: number, takerEscrow?: RevenueShareEscrowAccount): Promise<TransactionSignature>;
769
791
  getPlaceAndMakeSignedMsgPerpOrderIxs(signedSignedMsgOrderParams: SignedMsgOrderParams, signedMsgOrderUuid: Uint8Array, takerInfo: {
770
792
  taker: PublicKey;
771
793
  takerStats: PublicKey;
772
794
  takerUserAccount: UserAccount;
773
795
  signingAuthority: PublicKey;
774
- }, orderParams: OptionalOrderParams, referrerInfo?: ReferrerInfo, subAccountId?: number, precedingIxs?: TransactionInstruction[], overrideCustomIxIndex?: number): Promise<TransactionInstruction[]>;
775
- preparePlaceAndTakeSpotOrder(_orderParams: OptionalOrderParams, _fulfillmentConfig?: unknown, _makerInfo?: MakerInfo, _referrerInfo?: ReferrerInfo, _txParams?: TxParams, _subAccountId?: number): Promise<void>;
776
- placeAndTakeSpotOrder(_orderParams: OptionalOrderParams, _fulfillmentConfig?: unknown, _makerInfo?: MakerInfo, _referrerInfo?: ReferrerInfo, _txParams?: TxParams, _subAccountId?: number): Promise<TransactionSignature>;
777
- getPlaceAndTakeSpotOrderIx(_orderParams: OptionalOrderParams, _fulfillmentConfig?: unknown, _makerInfo?: MakerInfo, _referrerInfo?: ReferrerInfo, _subAccountId?: number): Promise<TransactionInstruction>;
778
- placeAndMakeSpotOrder(_orderParams: OptionalOrderParams, _takerInfo: TakerInfo, _fulfillmentConfig?: unknown, _referrerInfo?: ReferrerInfo, _txParams?: TxParams, _subAccountId?: number): Promise<TransactionSignature>;
779
- getPlaceAndMakeSpotOrderIx(_orderParams: OptionalOrderParams, _takerInfo: TakerInfo, _fulfillmentConfig?: unknown, _referrerInfo?: ReferrerInfo, _subAccountId?: number): Promise<TransactionInstruction>;
796
+ }, orderParams: OptionalOrderParams, subAccountId?: number, precedingIxs?: TransactionInstruction[], overrideCustomIxIndex?: number, takerEscrow?: RevenueShareEscrowAccount): Promise<TransactionInstruction[]>;
797
+ preparePlaceAndTakeSpotOrder(_orderParams: OptionalOrderParams, _fulfillmentConfig?: unknown, _makerInfo?: MakerInfo, _txParams?: TxParams, _subAccountId?: number): Promise<void>;
798
+ placeAndTakeSpotOrder(_orderParams: OptionalOrderParams, _fulfillmentConfig?: unknown, _makerInfo?: MakerInfo, _txParams?: TxParams, _subAccountId?: number): Promise<TransactionSignature>;
799
+ getPlaceAndTakeSpotOrderIx(_orderParams: OptionalOrderParams, _fulfillmentConfig?: unknown, _makerInfo?: MakerInfo, _subAccountId?: number): Promise<TransactionInstruction>;
800
+ placeAndMakeSpotOrder(_orderParams: OptionalOrderParams, _takerInfo: TakerInfo, _fulfillmentConfig?: unknown, _txParams?: TxParams, _subAccountId?: number): Promise<TransactionSignature>;
801
+ getPlaceAndMakeSpotOrderIx(_orderParams: OptionalOrderParams, _takerInfo: TakerInfo, _fulfillmentConfig?: unknown, _subAccountId?: number): Promise<TransactionInstruction>;
780
802
  /**
781
803
  * @deprecated use {@link placePerpOrder} or {@link placeAndTakePerpOrder} instead
782
804
  */
@@ -939,7 +961,7 @@ export declare class VelocityClient {
939
961
  getLiquidatePerpWithFillIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, marketIndex: number, makerInfos: MakerInfo[], liquidatorSubAccountId?: number): Promise<TransactionInstruction>;
940
962
  liquidateSpot(userAccountPublicKey: PublicKey, userAccount: UserAccount, assetMarketIndex: number, liabilityMarketIndex: number, maxLiabilityTransfer: BN, limitPrice?: BN, txParams?: TxParams, liquidatorSubAccountId?: number): Promise<TransactionSignature>;
941
963
  getLiquidateSpotIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, assetMarketIndex: number, liabilityMarketIndex: number, maxLiabilityTransfer: BN, limitPrice?: BN, liquidatorSubAccountId?: number): Promise<TransactionInstruction>;
942
- getJupiterLiquidateSpotWithSwapIxV6({ jupiterClient, liabilityMarketIndex, assetMarketIndex, swapAmount, assetTokenAccount, liabilityTokenAccount, slippageBps, swapMode, onlyDirectRoutes, quote, userAccount, userAccountPublicKey, userStatsAccountPublicKey, liquidatorSubAccountId, maxAccounts, }: {
964
+ getJupiterLiquidateSpotWithSwapIxV6({ jupiterClient, liabilityMarketIndex, assetMarketIndex, swapAmount, assetTokenAccount, liabilityTokenAccount, slippageBps, swapMode, onlyDirectRoutes, quote, userAccount, userAccountPublicKey, liquidatorSubAccountId, maxAccounts, }: {
943
965
  jupiterClient: JupiterClient;
944
966
  liabilityMarketIndex: number;
945
967
  assetMarketIndex: number;
@@ -952,7 +974,6 @@ export declare class VelocityClient {
952
974
  quote?: QuoteResponse;
953
975
  userAccount: UserAccount;
954
976
  userAccountPublicKey: PublicKey;
955
- userStatsAccountPublicKey: PublicKey;
956
977
  liquidatorSubAccountId?: number;
957
978
  maxAccounts?: number;
958
979
  }): Promise<{
@@ -960,7 +981,7 @@ export declare class VelocityClient {
960
981
  lookupTables: AddressLookupTableAccount[];
961
982
  }>;
962
983
  /**
963
- * Get the drift liquidate_spot_with_swap instructions
984
+ * Get the velocity liquidate_spot_with_swap instructions
964
985
  *
965
986
  * @param liabilityMarketIndex the market index of the token you're buying
966
987
  * @param assetMarketIndex the market index of the token you're selling
@@ -969,9 +990,8 @@ export declare class VelocityClient {
969
990
  * @param liabilityTokenAccount the token account to receive the tokens being bought
970
991
  * @param userAccount
971
992
  * @param userAccountPublicKey
972
- * @param userStatsAccountPublicKey
973
993
  */
974
- getLiquidateSpotWithSwapIx({ liabilityMarketIndex, assetMarketIndex, swapAmount: swapAmount, assetTokenAccount, liabilityTokenAccount, userAccount, userAccountPublicKey, userStatsAccountPublicKey, liquidatorSubAccountId, }: {
994
+ getLiquidateSpotWithSwapIx({ liabilityMarketIndex, assetMarketIndex, swapAmount: swapAmount, assetTokenAccount, liabilityTokenAccount, userAccount, userAccountPublicKey, liquidatorSubAccountId, }: {
975
995
  liabilityMarketIndex: number;
976
996
  assetMarketIndex: number;
977
997
  swapAmount: BN;
@@ -979,7 +999,6 @@ export declare class VelocityClient {
979
999
  liabilityTokenAccount: PublicKey;
980
1000
  userAccount: UserAccount;
981
1001
  userAccountPublicKey: PublicKey;
982
- userStatsAccountPublicKey: PublicKey;
983
1002
  liquidatorSubAccountId?: number;
984
1003
  }): Promise<{
985
1004
  beginSwapIx: TransactionInstruction;
@@ -1076,7 +1095,7 @@ export declare class VelocityClient {
1076
1095
  getResolvePerpPnlDeficitIx(spotMarketIndex: number, perpMarketIndex: number): Promise<TransactionInstruction>;
1077
1096
  getDepositIntoSpotMarketRevenuePoolIx(marketIndex: number, amount: BN, userTokenAccountPublicKey: PublicKey): Promise<TransactionInstruction>;
1078
1097
  /**
1079
- * This ix will donate your funds to drift revenue pool. It does not deposit into your user account
1098
+ * This ix will donate your funds to velocity revenue pool. It does not deposit into your user account
1080
1099
  * @param marketIndex
1081
1100
  * @param amount
1082
1101
  * @param userTokenAccountPublicKey
@@ -1223,8 +1242,4 @@ export declare class VelocityClient {
1223
1242
  }>;
1224
1243
  isOrderIncreasingPosition(orderParams: OptionalOrderParams, subAccountId: number): boolean;
1225
1244
  }
1226
- /** @deprecated Use `VelocityClient` instead. `DriftClient` will be removed in a future major. */
1227
- export declare const DriftClient: typeof VelocityClient;
1228
- /** @deprecated Use `VelocityClient` instead. `DriftClient` will be removed in a future major. */
1229
- export type DriftClient = VelocityClient;
1230
1245
  export {};