@velocity-exchange/sdk 0.0.1

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 (1368) hide show
  1. package/.prettierignore +1 -0
  2. package/.yarn/install-state.gz +0 -0
  3. package/README.md +275 -0
  4. package/VERSION +1 -0
  5. package/build-browser.js +58 -0
  6. package/bun.lock +1885 -0
  7. package/esbuild-shims.js +12 -0
  8. package/lib/browser/accounts/basicUserAccountSubscriber.d.ts +27 -0
  9. package/lib/browser/accounts/basicUserAccountSubscriber.js +38 -0
  10. package/lib/browser/accounts/basicUserStatsAccountSubscriber.d.ts +27 -0
  11. package/lib/browser/accounts/basicUserStatsAccountSubscriber.js +38 -0
  12. package/lib/browser/accounts/bulkAccountLoader.d.ts +37 -0
  13. package/lib/browser/accounts/bulkAccountLoader.js +222 -0
  14. package/lib/browser/accounts/bulkUserStatsSubscription.d.ts +7 -0
  15. package/lib/browser/accounts/bulkUserStatsSubscription.js +21 -0
  16. package/lib/browser/accounts/bulkUserSubscription.d.ts +7 -0
  17. package/lib/browser/accounts/bulkUserSubscription.js +21 -0
  18. package/lib/browser/accounts/customizedCadenceBulkAccountLoader.d.ts +44 -0
  19. package/lib/browser/accounts/customizedCadenceBulkAccountLoader.js +152 -0
  20. package/lib/browser/accounts/fetch.d.ts +17 -0
  21. package/lib/browser/accounts/fetch.js +60 -0
  22. package/lib/browser/accounts/grpcAccountSubscriber.d.ts +17 -0
  23. package/lib/browser/accounts/grpcAccountSubscriber.js +162 -0
  24. package/lib/browser/accounts/grpcInsuranceFundStakeAccountSubscriber.d.ts +10 -0
  25. package/lib/browser/accounts/grpcInsuranceFundStakeAccountSubscriber.js +31 -0
  26. package/lib/browser/accounts/grpcMultiAccountSubscriber.d.ts +37 -0
  27. package/lib/browser/accounts/grpcMultiAccountSubscriber.js +378 -0
  28. package/lib/browser/accounts/grpcMultiUserAccountSubscriber.d.ts +25 -0
  29. package/lib/browser/accounts/grpcMultiUserAccountSubscriber.js +203 -0
  30. package/lib/browser/accounts/grpcProgramAccountSubscriber.d.ts +18 -0
  31. package/lib/browser/accounts/grpcProgramAccountSubscriber.js +179 -0
  32. package/lib/browser/accounts/grpcUserAccountSubscriber.d.ts +10 -0
  33. package/lib/browser/accounts/grpcUserAccountSubscriber.js +28 -0
  34. package/lib/browser/accounts/grpcUserStatsAccountSubscriber.d.ts +10 -0
  35. package/lib/browser/accounts/grpcUserStatsAccountSubscriber.js +28 -0
  36. package/lib/browser/accounts/grpcVelocityClientAccountSubscriber.d.ts +16 -0
  37. package/lib/browser/accounts/grpcVelocityClientAccountSubscriber.js +101 -0
  38. package/lib/browser/accounts/grpcVelocityClientAccountSubscriberV2.d.ts +69 -0
  39. package/lib/browser/accounts/grpcVelocityClientAccountSubscriberV2.js +457 -0
  40. package/lib/browser/accounts/laserProgramAccountSubscriber.d.ts +23 -0
  41. package/lib/browser/accounts/laserProgramAccountSubscriber.js +162 -0
  42. package/lib/browser/accounts/oneShotUserAccountSubscriber.d.ts +18 -0
  43. package/lib/browser/accounts/oneShotUserAccountSubscriber.js +48 -0
  44. package/lib/browser/accounts/oneShotUserStatsAccountSubscriber.d.ts +18 -0
  45. package/lib/browser/accounts/oneShotUserStatsAccountSubscriber.js +48 -0
  46. package/lib/browser/accounts/pollingInsuranceFundStakeAccountSubscriber.d.ts +29 -0
  47. package/lib/browser/accounts/pollingInsuranceFundStakeAccountSubscriber.js +110 -0
  48. package/lib/browser/accounts/pollingOracleAccountSubscriber.d.ts +27 -0
  49. package/lib/browser/accounts/pollingOracleAccountSubscriber.js +78 -0
  50. package/lib/browser/accounts/pollingTokenAccountSubscriber.d.ts +26 -0
  51. package/lib/browser/accounts/pollingTokenAccountSubscriber.js +78 -0
  52. package/lib/browser/accounts/pollingUserAccountSubscriber.d.ts +29 -0
  53. package/lib/browser/accounts/pollingUserAccountSubscriber.js +102 -0
  54. package/lib/browser/accounts/pollingUserStatsAccountSubscriber.d.ts +27 -0
  55. package/lib/browser/accounts/pollingUserStatsAccountSubscriber.js +94 -0
  56. package/lib/browser/accounts/pollingVelocityClientAccountSubscriber.d.ts +73 -0
  57. package/lib/browser/accounts/pollingVelocityClientAccountSubscriber.js +420 -0
  58. package/lib/browser/accounts/testBulkAccountLoader.d.ts +4 -0
  59. package/lib/browser/accounts/testBulkAccountLoader.js +43 -0
  60. package/lib/browser/accounts/types.d.ts +205 -0
  61. package/lib/browser/accounts/types.js +16 -0
  62. package/lib/browser/accounts/utils.d.ts +8 -0
  63. package/lib/browser/accounts/utils.js +49 -0
  64. package/lib/browser/accounts/webSocketAccountSubscriber.d.ts +29 -0
  65. package/lib/browser/accounts/webSocketAccountSubscriber.js +170 -0
  66. package/lib/browser/accounts/webSocketAccountSubscriberV2.d.ts +109 -0
  67. package/lib/browser/accounts/webSocketAccountSubscriberV2.js +395 -0
  68. package/lib/browser/accounts/webSocketInsuranceFundStakeAccountSubscriber.d.ts +23 -0
  69. package/lib/browser/accounts/webSocketInsuranceFundStakeAccountSubscriber.js +67 -0
  70. package/lib/browser/accounts/webSocketProgramAccountSubscriber.d.ts +31 -0
  71. package/lib/browser/accounts/webSocketProgramAccountSubscriber.js +120 -0
  72. package/lib/browser/accounts/webSocketProgramAccountSubscriberV2.d.ts +145 -0
  73. package/lib/browser/accounts/webSocketProgramAccountSubscriberV2.js +744 -0
  74. package/lib/browser/accounts/webSocketProgramAccountsSubscriberV2.d.ts +145 -0
  75. package/lib/browser/accounts/webSocketProgramAccountsSubscriberV2.js +744 -0
  76. package/lib/browser/accounts/webSocketUserAccountSubscriber.d.ts +23 -0
  77. package/lib/browser/accounts/webSocketUserAccountSubscriber.js +61 -0
  78. package/lib/browser/accounts/webSocketUserStatsAccountSubsriber.d.ts +22 -0
  79. package/lib/browser/accounts/webSocketUserStatsAccountSubsriber.js +52 -0
  80. package/lib/browser/accounts/webSocketVelocityClientAccountSubscriber.d.ts +77 -0
  81. package/lib/browser/accounts/webSocketVelocityClientAccountSubscriber.js +400 -0
  82. package/lib/browser/accounts/webSocketVelocityClientAccountSubscriberV2.d.ts +91 -0
  83. package/lib/browser/accounts/webSocketVelocityClientAccountSubscriberV2.js +446 -0
  84. package/lib/browser/accounts/websocketProgramUserAccountSubscriber.d.ts +22 -0
  85. package/lib/browser/accounts/websocketProgramUserAccountSubscriber.js +54 -0
  86. package/lib/browser/addresses/marketAddresses.d.ts +2 -0
  87. package/lib/browser/addresses/marketAddresses.js +15 -0
  88. package/lib/browser/addresses/pda.d.ts +47 -0
  89. package/lib/browser/addresses/pda.js +263 -0
  90. package/lib/browser/adminClient.d.ts +402 -0
  91. package/lib/browser/adminClient.js +2798 -0
  92. package/lib/browser/assert/assert.d.ts +1 -0
  93. package/lib/browser/assert/assert.js +9 -0
  94. package/lib/browser/auctionSubscriber/auctionSubscriber.d.ts +14 -0
  95. package/lib/browser/auctionSubscriber/auctionSubscriber.js +32 -0
  96. package/lib/browser/auctionSubscriber/auctionSubscriberGrpc.d.ts +15 -0
  97. package/lib/browser/auctionSubscriber/auctionSubscriberGrpc.js +32 -0
  98. package/lib/browser/auctionSubscriber/index.d.ts +3 -0
  99. package/lib/browser/auctionSubscriber/index.js +19 -0
  100. package/lib/browser/auctionSubscriber/types.d.ts +14 -0
  101. package/lib/browser/auctionSubscriber/types.js +2 -0
  102. package/lib/browser/bankrun/bankrunConnection.d.ts +76 -0
  103. package/lib/browser/bankrun/bankrunConnection.js +348 -0
  104. package/lib/browser/blockhashSubscriber/BlockhashSubscriber.d.ts +27 -0
  105. package/lib/browser/blockhashSubscriber/BlockhashSubscriber.js +89 -0
  106. package/lib/browser/blockhashSubscriber/index.d.ts +1 -0
  107. package/lib/browser/blockhashSubscriber/index.js +17 -0
  108. package/lib/browser/blockhashSubscriber/types.d.ts +7 -0
  109. package/lib/browser/blockhashSubscriber/types.js +2 -0
  110. package/lib/browser/clock/clockSubscriber.d.ts +31 -0
  111. package/lib/browser/clock/clockSubscriber.js +80 -0
  112. package/lib/browser/config.d.ts +75 -0
  113. package/lib/browser/config.js +164 -0
  114. package/lib/browser/constants/index.d.ts +10 -0
  115. package/lib/browser/constants/index.js +26 -0
  116. package/lib/browser/constants/insuranceFund.d.ts +5 -0
  117. package/lib/browser/constants/insuranceFund.js +9 -0
  118. package/lib/browser/constants/numericConstants.d.ts +73 -0
  119. package/lib/browser/constants/numericConstants.js +79 -0
  120. package/lib/browser/constants/perpMarkets.d.ts +21 -0
  121. package/lib/browser/constants/perpMarkets.js +971 -0
  122. package/lib/browser/constants/spotMarkets.d.ts +24 -0
  123. package/lib/browser/constants/spotMarkets.js +797 -0
  124. package/lib/browser/constants/txConstants.d.ts +1 -0
  125. package/lib/browser/constants/txConstants.js +4 -0
  126. package/lib/browser/constituentMap/constituentMap.d.ts +66 -0
  127. package/lib/browser/constituentMap/constituentMap.js +177 -0
  128. package/lib/browser/constituentMap/pollingConstituentAccountSubscriber.d.ts +24 -0
  129. package/lib/browser/constituentMap/pollingConstituentAccountSubscriber.js +60 -0
  130. package/lib/browser/constituentMap/webSocketConstituentAccountSubscriber.d.ts +24 -0
  131. package/lib/browser/constituentMap/webSocketConstituentAccountSubscriber.js +58 -0
  132. package/lib/browser/core/VelocityCore.d.ts +226 -0
  133. package/lib/browser/core/VelocityCore.js +138 -0
  134. package/lib/browser/core/index.d.ts +12 -0
  135. package/lib/browser/core/index.js +28 -0
  136. package/lib/browser/core/instructions/deposit.d.ts +19 -0
  137. package/lib/browser/core/instructions/deposit.js +19 -0
  138. package/lib/browser/core/instructions/fill.d.ts +13 -0
  139. package/lib/browser/core/instructions/fill.js +17 -0
  140. package/lib/browser/core/instructions/funding.d.ts +9 -0
  141. package/lib/browser/core/instructions/funding.js +13 -0
  142. package/lib/browser/core/instructions/liquidation.d.ts +15 -0
  143. package/lib/browser/core/instructions/liquidation.js +17 -0
  144. package/lib/browser/core/instructions/orders.d.ts +22 -0
  145. package/lib/browser/core/instructions/orders.js +27 -0
  146. package/lib/browser/core/instructions/perpOrders.d.ts +78 -0
  147. package/lib/browser/core/instructions/perpOrders.js +99 -0
  148. package/lib/browser/core/instructions/settlement.d.ts +11 -0
  149. package/lib/browser/core/instructions/settlement.js +15 -0
  150. package/lib/browser/core/instructions/trigger.d.ts +11 -0
  151. package/lib/browser/core/instructions/trigger.js +15 -0
  152. package/lib/browser/core/instructions/withdraw.d.ts +20 -0
  153. package/lib/browser/core/instructions/withdraw.js +20 -0
  154. package/lib/browser/core/remainingAccounts.d.ts +27 -0
  155. package/lib/browser/core/remainingAccounts.js +122 -0
  156. package/lib/browser/core/signedMsg.d.ts +17 -0
  157. package/lib/browser/core/signedMsg.js +39 -0
  158. package/lib/browser/decode/customCoder.d.ts +44 -0
  159. package/lib/browser/decode/customCoder.js +64 -0
  160. package/lib/browser/decode/user.d.ts +4 -0
  161. package/lib/browser/decode/user.js +337 -0
  162. package/lib/browser/dlob/DLOB.d.ts +253 -0
  163. package/lib/browser/dlob/DLOB.js +1137 -0
  164. package/lib/browser/dlob/DLOBNode.d.ts +70 -0
  165. package/lib/browser/dlob/DLOBNode.js +103 -0
  166. package/lib/browser/dlob/DLOBSubscriber.d.ts +57 -0
  167. package/lib/browser/dlob/DLOBSubscriber.js +143 -0
  168. package/lib/browser/dlob/NodeList.d.ts +27 -0
  169. package/lib/browser/dlob/NodeList.js +126 -0
  170. package/lib/browser/dlob/orderBookLevels.d.ts +77 -0
  171. package/lib/browser/dlob/orderBookLevels.js +404 -0
  172. package/lib/browser/dlob/types.d.ts +18 -0
  173. package/lib/browser/dlob/types.js +2 -0
  174. package/lib/browser/events/eventList.d.ts +22 -0
  175. package/lib/browser/events/eventList.js +80 -0
  176. package/lib/browser/events/eventSubscriber.d.ts +55 -0
  177. package/lib/browser/events/eventSubscriber.js +229 -0
  178. package/lib/browser/events/eventsServerLogProvider.d.ts +21 -0
  179. package/lib/browser/events/eventsServerLogProvider.js +121 -0
  180. package/lib/browser/events/fetchLogs.d.ts +25 -0
  181. package/lib/browser/events/fetchLogs.js +99 -0
  182. package/lib/browser/events/parse.d.ts +8 -0
  183. package/lib/browser/events/parse.js +199 -0
  184. package/lib/browser/events/pollingLogProvider.d.ts +17 -0
  185. package/lib/browser/events/pollingLogProvider.js +58 -0
  186. package/lib/browser/events/sort.d.ts +2 -0
  187. package/lib/browser/events/sort.js +24 -0
  188. package/lib/browser/events/txEventCache.d.ts +24 -0
  189. package/lib/browser/events/txEventCache.js +71 -0
  190. package/lib/browser/events/types.d.ts +104 -0
  191. package/lib/browser/events/types.js +36 -0
  192. package/lib/browser/events/webSocketLogProvider.d.ts +24 -0
  193. package/lib/browser/events/webSocketLogProvider.js +96 -0
  194. package/lib/browser/factory/bigNum.d.ts +122 -0
  195. package/lib/browser/factory/bigNum.js +500 -0
  196. package/lib/browser/factory/oracleClient.d.ts +5 -0
  197. package/lib/browser/factory/oracleClient.js +53 -0
  198. package/lib/browser/idl/drift.d.ts +23894 -0
  199. package/lib/browser/idl/drift.js +2 -0
  200. package/lib/browser/idl/drift.json +18698 -0
  201. package/lib/browser/idl/pyth.d.ts +97 -0
  202. package/lib/browser/idl/pyth.js +2 -0
  203. package/lib/browser/idl/token_faucet.d.ts +197 -0
  204. package/lib/browser/idl/token_faucet.js +2 -0
  205. package/lib/browser/idl/token_faucet.json +229 -0
  206. package/lib/browser/index.d.ts +144 -0
  207. package/lib/browser/index.js +175 -0
  208. package/lib/browser/indicative-quotes/indicativeQuotesSender.d.ts +35 -0
  209. package/lib/browser/indicative-quotes/indicativeQuotesSender.js +192 -0
  210. package/lib/browser/isomorphic/anchor.browser.d.ts +24 -0
  211. package/lib/browser/isomorphic/anchor.browser.js +60 -0
  212. package/lib/browser/isomorphic/anchor.d.ts +24 -0
  213. package/lib/browser/isomorphic/anchor.js +60 -0
  214. package/lib/browser/isomorphic/anchor29.browser.d.ts +12 -0
  215. package/lib/browser/isomorphic/anchor29.browser.js +48 -0
  216. package/lib/browser/isomorphic/anchor29.d.ts +12 -0
  217. package/lib/browser/isomorphic/anchor29.js +48 -0
  218. package/lib/browser/isomorphic/grpc.browser.d.ts +1 -0
  219. package/lib/browser/isomorphic/grpc.browser.js +8 -0
  220. package/lib/browser/isomorphic/grpc.d.ts +1 -0
  221. package/lib/browser/isomorphic/grpc.js +8 -0
  222. package/lib/browser/jupiter/jupiterClient.d.ts +291 -0
  223. package/lib/browser/jupiter/jupiterClient.js +164 -0
  224. package/lib/browser/keypair.d.ts +2 -0
  225. package/lib/browser/keypair.js +28 -0
  226. package/lib/browser/marginCalculation.d.ts +67 -0
  227. package/lib/browser/marginCalculation.js +176 -0
  228. package/lib/browser/marinade/index.d.ts +12 -0
  229. package/lib/browser/marinade/index.js +36 -0
  230. package/lib/browser/marinade/types.d.ts +1963 -0
  231. package/lib/browser/marinade/types.js +1965 -0
  232. package/lib/browser/math/amm.d.ts +98 -0
  233. package/lib/browser/math/amm.js +671 -0
  234. package/lib/browser/math/auction.d.ts +65 -0
  235. package/lib/browser/math/auction.js +261 -0
  236. package/lib/browser/math/bankruptcy.d.ts +2 -0
  237. package/lib/browser/math/bankruptcy.js +32 -0
  238. package/lib/browser/math/builder.d.ts +5 -0
  239. package/lib/browser/math/builder.js +22 -0
  240. package/lib/browser/math/conversion.d.ts +4 -0
  241. package/lib/browser/math/conversion.js +21 -0
  242. package/lib/browser/math/exchangeStatus.d.ts +8 -0
  243. package/lib/browser/math/exchangeStatus.js +85 -0
  244. package/lib/browser/math/funding.d.ts +44 -0
  245. package/lib/browser/math/funding.js +260 -0
  246. package/lib/browser/math/insurance.d.ts +8 -0
  247. package/lib/browser/math/insurance.js +74 -0
  248. package/lib/browser/math/liquidation.d.ts +7 -0
  249. package/lib/browser/math/liquidation.js +134 -0
  250. package/lib/browser/math/margin.d.ts +45 -0
  251. package/lib/browser/math/margin.js +205 -0
  252. package/lib/browser/math/market.d.ts +50 -0
  253. package/lib/browser/math/market.js +234 -0
  254. package/lib/browser/math/oracles.d.ts +19 -0
  255. package/lib/browser/math/oracles.js +215 -0
  256. package/lib/browser/math/orders.d.ts +36 -0
  257. package/lib/browser/math/orders.js +294 -0
  258. package/lib/browser/math/position.d.ts +71 -0
  259. package/lib/browser/math/position.js +232 -0
  260. package/lib/browser/math/repeg.d.ts +22 -0
  261. package/lib/browser/math/repeg.js +164 -0
  262. package/lib/browser/math/spotBalance.d.ts +85 -0
  263. package/lib/browser/math/spotBalance.js +438 -0
  264. package/lib/browser/math/spotMarket.d.ts +11 -0
  265. package/lib/browser/math/spotMarket.js +49 -0
  266. package/lib/browser/math/spotPosition.d.ts +19 -0
  267. package/lib/browser/math/spotPosition.js +79 -0
  268. package/lib/browser/math/state.d.ts +8 -0
  269. package/lib/browser/math/state.js +44 -0
  270. package/lib/browser/math/superStake.d.ts +168 -0
  271. package/lib/browser/math/superStake.js +308 -0
  272. package/lib/browser/math/tiers.d.ts +4 -0
  273. package/lib/browser/math/tiers.js +52 -0
  274. package/lib/browser/math/trade.d.ts +93 -0
  275. package/lib/browser/math/trade.js +503 -0
  276. package/lib/browser/math/utils.d.ts +23 -0
  277. package/lib/browser/math/utils.js +113 -0
  278. package/lib/browser/memcmp.d.ts +18 -0
  279. package/lib/browser/memcmp.js +162 -0
  280. package/lib/browser/oracles/oracleClientCache.d.ts +9 -0
  281. package/lib/browser/oracles/oracleClientCache.js +19 -0
  282. package/lib/browser/oracles/oracleId.d.ts +9 -0
  283. package/lib/browser/oracles/oracleId.js +89 -0
  284. package/lib/browser/oracles/prelaunchOracleClient.d.ts +12 -0
  285. package/lib/browser/oracles/prelaunchOracleClient.js +24 -0
  286. package/lib/browser/oracles/pythClient.d.ts +14 -0
  287. package/lib/browser/oracles/pythClient.js +51 -0
  288. package/lib/browser/oracles/pythLazerClient.d.ts +16 -0
  289. package/lib/browser/oracles/pythLazerClient.js +61 -0
  290. package/lib/browser/oracles/quoteAssetOracleClient.d.ts +10 -0
  291. package/lib/browser/oracles/quoteAssetOracleClient.js +21 -0
  292. package/lib/browser/oracles/strictOraclePrice.d.ts +9 -0
  293. package/lib/browser/oracles/strictOraclePrice.js +17 -0
  294. package/lib/browser/oracles/types.d.ts +33 -0
  295. package/lib/browser/oracles/types.js +2 -0
  296. package/lib/browser/oracles/utils.d.ts +4 -0
  297. package/lib/browser/oracles/utils.js +8 -0
  298. package/lib/browser/orderParams.d.ts +29 -0
  299. package/lib/browser/orderParams.js +44 -0
  300. package/lib/browser/orderSubscriber/OrderSubscriber.d.ts +45 -0
  301. package/lib/browser/orderSubscriber/OrderSubscriber.js +193 -0
  302. package/lib/browser/orderSubscriber/PollingSubscription.d.ts +12 -0
  303. package/lib/browser/orderSubscriber/PollingSubscription.js +23 -0
  304. package/lib/browser/orderSubscriber/WebsocketSubscription.d.ts +23 -0
  305. package/lib/browser/orderSubscriber/WebsocketSubscription.js +67 -0
  306. package/lib/browser/orderSubscriber/grpcSubscription.d.ts +22 -0
  307. package/lib/browser/orderSubscriber/grpcSubscription.js +75 -0
  308. package/lib/browser/orderSubscriber/index.d.ts +7 -0
  309. package/lib/browser/orderSubscriber/index.js +23 -0
  310. package/lib/browser/orderSubscriber/types.d.ts +35 -0
  311. package/lib/browser/orderSubscriber/types.js +2 -0
  312. package/lib/browser/priorityFee/averageOverSlotsStrategy.d.ts +5 -0
  313. package/lib/browser/priorityFee/averageOverSlotsStrategy.js +16 -0
  314. package/lib/browser/priorityFee/averageStrategy.d.ts +5 -0
  315. package/lib/browser/priorityFee/averageStrategy.js +11 -0
  316. package/lib/browser/priorityFee/ewmaStrategy.d.ts +11 -0
  317. package/lib/browser/priorityFee/ewmaStrategy.js +33 -0
  318. package/lib/browser/priorityFee/heliusPriorityFeeMethod.d.ts +20 -0
  319. package/lib/browser/priorityFee/heliusPriorityFeeMethod.js +46 -0
  320. package/lib/browser/priorityFee/index.d.ts +16 -0
  321. package/lib/browser/priorityFee/index.js +32 -0
  322. package/lib/browser/priorityFee/maxOverSlotsStrategy.d.ts +5 -0
  323. package/lib/browser/priorityFee/maxOverSlotsStrategy.js +17 -0
  324. package/lib/browser/priorityFee/maxStrategy.d.ts +7 -0
  325. package/lib/browser/priorityFee/maxStrategy.js +9 -0
  326. package/lib/browser/priorityFee/priorityFeeSubscriber.d.ts +48 -0
  327. package/lib/browser/priorityFee/priorityFeeSubscriber.js +193 -0
  328. package/lib/browser/priorityFee/priorityFeeSubscriberMap.d.ts +50 -0
  329. package/lib/browser/priorityFee/priorityFeeSubscriberMap.js +96 -0
  330. package/lib/browser/priorityFee/solanaPriorityFeeMethod.d.ts +6 -0
  331. package/lib/browser/priorityFee/solanaPriorityFeeMethod.js +21 -0
  332. package/lib/browser/priorityFee/types.d.ts +35 -0
  333. package/lib/browser/priorityFee/types.js +10 -0
  334. package/lib/browser/priorityFee/velocityPriorityFeeMethod.d.ts +21 -0
  335. package/lib/browser/priorityFee/velocityPriorityFeeMethod.js +28 -0
  336. package/lib/browser/pyth/constants.d.ts +3 -0
  337. package/lib/browser/pyth/constants.js +6 -0
  338. package/lib/browser/pyth/index.d.ts +4 -0
  339. package/lib/browser/pyth/index.js +12 -0
  340. package/lib/browser/pyth/pythLazerSubscriber.d.ts +91 -0
  341. package/lib/browser/pyth/pythLazerSubscriber.js +276 -0
  342. package/lib/browser/pyth/types.d.ts +2226 -0
  343. package/lib/browser/pyth/types.js +2224 -0
  344. package/lib/browser/pyth/utils.d.ts +2 -0
  345. package/lib/browser/pyth/utils.js +10 -0
  346. package/lib/browser/slot/SlotSubscriber.d.ts +27 -0
  347. package/lib/browser/slot/SlotSubscriber.js +76 -0
  348. package/lib/browser/slot/SlothashSubscriber.d.ts +25 -0
  349. package/lib/browser/slot/SlothashSubscriber.js +88 -0
  350. package/lib/browser/swap/UnifiedSwapClient.d.ts +120 -0
  351. package/lib/browser/swap/UnifiedSwapClient.js +179 -0
  352. package/lib/browser/swift/grpcSignedMsgUserAccountSubscriber.d.ts +22 -0
  353. package/lib/browser/swift/grpcSignedMsgUserAccountSubscriber.js +57 -0
  354. package/lib/browser/swift/index.d.ts +10 -0
  355. package/lib/browser/swift/index.js +26 -0
  356. package/lib/browser/swift/signedMsgUserAccountSubscriber.d.ts +42 -0
  357. package/lib/browser/swift/signedMsgUserAccountSubscriber.js +118 -0
  358. package/lib/browser/swift/swiftOrderSubscriber.d.ts +63 -0
  359. package/lib/browser/swift/swiftOrderSubscriber.js +187 -0
  360. package/lib/browser/testClient.d.ts +8 -0
  361. package/lib/browser/testClient.js +24 -0
  362. package/lib/browser/titan/titanClient.d.ts +90 -0
  363. package/lib/browser/titan/titanClient.js +227 -0
  364. package/lib/browser/token/index.d.ts +5 -0
  365. package/lib/browser/token/index.js +15 -0
  366. package/lib/browser/tokenFaucet.d.ts +41 -0
  367. package/lib/browser/tokenFaucet.js +188 -0
  368. package/lib/browser/tx/baseTxSender.d.ts +59 -0
  369. package/lib/browser/tx/baseTxSender.js +292 -0
  370. package/lib/browser/tx/blockhashFetcher/baseBlockhashFetcher.d.ts +8 -0
  371. package/lib/browser/tx/blockhashFetcher/baseBlockhashFetcher.js +13 -0
  372. package/lib/browser/tx/blockhashFetcher/cachedBlockhashFetcher.d.ts +28 -0
  373. package/lib/browser/tx/blockhashFetcher/cachedBlockhashFetcher.js +73 -0
  374. package/lib/browser/tx/blockhashFetcher/types.d.ts +4 -0
  375. package/lib/browser/tx/blockhashFetcher/types.js +2 -0
  376. package/lib/browser/tx/fastSingleTxSender.d.ts +41 -0
  377. package/lib/browser/tx/fastSingleTxSender.js +86 -0
  378. package/lib/browser/tx/forwardOnlyTxSender.d.ts +37 -0
  379. package/lib/browser/tx/forwardOnlyTxSender.js +92 -0
  380. package/lib/browser/tx/priorityFeeCalculator.d.ts +44 -0
  381. package/lib/browser/tx/priorityFeeCalculator.js +85 -0
  382. package/lib/browser/tx/reportTransactionError.d.ts +20 -0
  383. package/lib/browser/tx/reportTransactionError.js +103 -0
  384. package/lib/browser/tx/retryTxSender.d.ts +37 -0
  385. package/lib/browser/tx/retryTxSender.js +86 -0
  386. package/lib/browser/tx/txHandler.d.ts +173 -0
  387. package/lib/browser/tx/txHandler.js +522 -0
  388. package/lib/browser/tx/txParamProcessor.d.ts +26 -0
  389. package/lib/browser/tx/txParamProcessor.js +92 -0
  390. package/lib/browser/tx/types.d.ts +29 -0
  391. package/lib/browser/tx/types.js +20 -0
  392. package/lib/browser/tx/utils.d.ts +6 -0
  393. package/lib/browser/tx/utils.js +78 -0
  394. package/lib/browser/tx/whileValidTxSender.d.ts +45 -0
  395. package/lib/browser/tx/whileValidTxSender.js +168 -0
  396. package/lib/browser/types.d.ts +1747 -0
  397. package/lib/browser/types.js +427 -0
  398. package/lib/browser/user.d.ts +446 -0
  399. package/lib/browser/user.js +2372 -0
  400. package/lib/browser/userConfig.d.ts +31 -0
  401. package/lib/browser/userConfig.js +2 -0
  402. package/lib/browser/userMap/PollingSubscription.d.ts +15 -0
  403. package/lib/browser/userMap/PollingSubscription.js +30 -0
  404. package/lib/browser/userMap/WebsocketSubscription.d.ts +27 -0
  405. package/lib/browser/userMap/WebsocketSubscription.js +45 -0
  406. package/lib/browser/userMap/grpcSubscription.d.ts +27 -0
  407. package/lib/browser/userMap/grpcSubscription.js +44 -0
  408. package/lib/browser/userMap/referrerMap.d.ts +45 -0
  409. package/lib/browser/userMap/referrerMap.js +184 -0
  410. package/lib/browser/userMap/revenueShareEscrowMap.d.ts +66 -0
  411. package/lib/browser/userMap/revenueShareEscrowMap.js +210 -0
  412. package/lib/browser/userMap/userMap.d.ts +114 -0
  413. package/lib/browser/userMap/userMap.js +486 -0
  414. package/lib/browser/userMap/userMapConfig.d.ts +40 -0
  415. package/lib/browser/userMap/userMapConfig.js +2 -0
  416. package/lib/browser/userMap/userStatsMap.d.ts +66 -0
  417. package/lib/browser/userMap/userStatsMap.js +266 -0
  418. package/lib/browser/userName.d.ts +5 -0
  419. package/lib/browser/userName.js +21 -0
  420. package/lib/browser/userStats.d.ts +24 -0
  421. package/lib/browser/userStats.js +70 -0
  422. package/lib/browser/userStatsConfig.d.ts +26 -0
  423. package/lib/browser/userStatsConfig.js +2 -0
  424. package/lib/browser/util/TransactionConfirmationManager.d.ts +16 -0
  425. package/lib/browser/util/TransactionConfirmationManager.js +174 -0
  426. package/lib/browser/util/chainClock.d.ts +17 -0
  427. package/lib/browser/util/chainClock.js +29 -0
  428. package/lib/browser/util/computeUnits.d.ts +8 -0
  429. package/lib/browser/util/computeUnits.js +48 -0
  430. package/lib/browser/util/digest.d.ts +5 -0
  431. package/lib/browser/util/digest.js +19 -0
  432. package/lib/browser/util/ed25519Utils.d.ts +10 -0
  433. package/lib/browser/util/ed25519Utils.js +80 -0
  434. package/lib/browser/util/promiseTimeout.d.ts +1 -0
  435. package/lib/browser/util/promiseTimeout.js +14 -0
  436. package/lib/browser/util/tps.d.ts +2 -0
  437. package/lib/browser/util/tps.js +16 -0
  438. package/lib/browser/velocityClient.d.ts +1230 -0
  439. package/lib/browser/velocityClient.js +5778 -0
  440. package/lib/browser/velocityClientConfig.d.ts +84 -0
  441. package/lib/browser/velocityClientConfig.js +2 -0
  442. package/lib/browser/wallet.d.ts +16 -0
  443. package/lib/browser/wallet.js +46 -0
  444. package/lib/node/accounts/basicUserAccountSubscriber.d.ts +28 -0
  445. package/lib/node/accounts/basicUserAccountSubscriber.d.ts.map +1 -0
  446. package/lib/node/accounts/basicUserAccountSubscriber.js +38 -0
  447. package/lib/node/accounts/basicUserStatsAccountSubscriber.d.ts +28 -0
  448. package/lib/node/accounts/basicUserStatsAccountSubscriber.d.ts.map +1 -0
  449. package/lib/node/accounts/basicUserStatsAccountSubscriber.js +38 -0
  450. package/lib/node/accounts/bulkAccountLoader.d.ts +38 -0
  451. package/lib/node/accounts/bulkAccountLoader.d.ts.map +1 -0
  452. package/lib/node/accounts/bulkAccountLoader.js +222 -0
  453. package/lib/node/accounts/bulkUserStatsSubscription.d.ts +8 -0
  454. package/lib/node/accounts/bulkUserStatsSubscription.d.ts.map +1 -0
  455. package/lib/node/accounts/bulkUserStatsSubscription.js +21 -0
  456. package/lib/node/accounts/bulkUserSubscription.d.ts +8 -0
  457. package/lib/node/accounts/bulkUserSubscription.d.ts.map +1 -0
  458. package/lib/node/accounts/bulkUserSubscription.js +21 -0
  459. package/lib/node/accounts/customizedCadenceBulkAccountLoader.d.ts +45 -0
  460. package/lib/node/accounts/customizedCadenceBulkAccountLoader.d.ts.map +1 -0
  461. package/lib/node/accounts/customizedCadenceBulkAccountLoader.js +152 -0
  462. package/lib/node/accounts/fetch.d.ts +18 -0
  463. package/lib/node/accounts/fetch.d.ts.map +1 -0
  464. package/lib/node/accounts/fetch.js +60 -0
  465. package/lib/node/accounts/grpcAccountSubscriber.d.ts +18 -0
  466. package/lib/node/accounts/grpcAccountSubscriber.d.ts.map +1 -0
  467. package/lib/node/accounts/grpcAccountSubscriber.js +162 -0
  468. package/lib/node/accounts/grpcInsuranceFundStakeAccountSubscriber.d.ts +11 -0
  469. package/lib/node/accounts/grpcInsuranceFundStakeAccountSubscriber.d.ts.map +1 -0
  470. package/lib/node/accounts/grpcInsuranceFundStakeAccountSubscriber.js +31 -0
  471. package/lib/node/accounts/grpcMultiAccountSubscriber.d.ts +38 -0
  472. package/lib/node/accounts/grpcMultiAccountSubscriber.d.ts.map +1 -0
  473. package/lib/node/accounts/grpcMultiAccountSubscriber.js +378 -0
  474. package/lib/node/accounts/grpcMultiUserAccountSubscriber.d.ts +26 -0
  475. package/lib/node/accounts/grpcMultiUserAccountSubscriber.d.ts.map +1 -0
  476. package/lib/node/accounts/grpcMultiUserAccountSubscriber.js +203 -0
  477. package/lib/node/accounts/grpcProgramAccountSubscriber.d.ts +19 -0
  478. package/lib/node/accounts/grpcProgramAccountSubscriber.d.ts.map +1 -0
  479. package/lib/node/accounts/grpcProgramAccountSubscriber.js +179 -0
  480. package/lib/node/accounts/grpcUserAccountSubscriber.d.ts +11 -0
  481. package/lib/node/accounts/grpcUserAccountSubscriber.d.ts.map +1 -0
  482. package/lib/node/accounts/grpcUserAccountSubscriber.js +28 -0
  483. package/lib/node/accounts/grpcUserStatsAccountSubscriber.d.ts +11 -0
  484. package/lib/node/accounts/grpcUserStatsAccountSubscriber.d.ts.map +1 -0
  485. package/lib/node/accounts/grpcUserStatsAccountSubscriber.js +28 -0
  486. package/lib/node/accounts/grpcVelocityClientAccountSubscriber.d.ts +17 -0
  487. package/lib/node/accounts/grpcVelocityClientAccountSubscriber.d.ts.map +1 -0
  488. package/lib/node/accounts/grpcVelocityClientAccountSubscriber.js +101 -0
  489. package/lib/node/accounts/grpcVelocityClientAccountSubscriberV2.d.ts +70 -0
  490. package/lib/node/accounts/grpcVelocityClientAccountSubscriberV2.d.ts.map +1 -0
  491. package/lib/node/accounts/grpcVelocityClientAccountSubscriberV2.js +457 -0
  492. package/lib/node/accounts/laserProgramAccountSubscriber.d.ts +24 -0
  493. package/lib/node/accounts/laserProgramAccountSubscriber.d.ts.map +1 -0
  494. package/lib/node/accounts/laserProgramAccountSubscriber.js +162 -0
  495. package/lib/node/accounts/oneShotUserAccountSubscriber.d.ts +19 -0
  496. package/lib/node/accounts/oneShotUserAccountSubscriber.d.ts.map +1 -0
  497. package/lib/node/accounts/oneShotUserAccountSubscriber.js +48 -0
  498. package/lib/node/accounts/oneShotUserStatsAccountSubscriber.d.ts +19 -0
  499. package/lib/node/accounts/oneShotUserStatsAccountSubscriber.d.ts.map +1 -0
  500. package/lib/node/accounts/oneShotUserStatsAccountSubscriber.js +48 -0
  501. package/lib/node/accounts/pollingInsuranceFundStakeAccountSubscriber.d.ts +30 -0
  502. package/lib/node/accounts/pollingInsuranceFundStakeAccountSubscriber.d.ts.map +1 -0
  503. package/lib/node/accounts/pollingInsuranceFundStakeAccountSubscriber.js +110 -0
  504. package/lib/node/accounts/pollingOracleAccountSubscriber.d.ts +28 -0
  505. package/lib/node/accounts/pollingOracleAccountSubscriber.d.ts.map +1 -0
  506. package/lib/node/accounts/pollingOracleAccountSubscriber.js +78 -0
  507. package/lib/node/accounts/pollingTokenAccountSubscriber.d.ts +27 -0
  508. package/lib/node/accounts/pollingTokenAccountSubscriber.d.ts.map +1 -0
  509. package/lib/node/accounts/pollingTokenAccountSubscriber.js +78 -0
  510. package/lib/node/accounts/pollingUserAccountSubscriber.d.ts +30 -0
  511. package/lib/node/accounts/pollingUserAccountSubscriber.d.ts.map +1 -0
  512. package/lib/node/accounts/pollingUserAccountSubscriber.js +102 -0
  513. package/lib/node/accounts/pollingUserStatsAccountSubscriber.d.ts +28 -0
  514. package/lib/node/accounts/pollingUserStatsAccountSubscriber.d.ts.map +1 -0
  515. package/lib/node/accounts/pollingUserStatsAccountSubscriber.js +94 -0
  516. package/lib/node/accounts/pollingVelocityClientAccountSubscriber.d.ts +74 -0
  517. package/lib/node/accounts/pollingVelocityClientAccountSubscriber.d.ts.map +1 -0
  518. package/lib/node/accounts/pollingVelocityClientAccountSubscriber.js +420 -0
  519. package/lib/node/accounts/testBulkAccountLoader.d.ts +5 -0
  520. package/lib/node/accounts/testBulkAccountLoader.d.ts.map +1 -0
  521. package/lib/node/accounts/testBulkAccountLoader.js +43 -0
  522. package/lib/node/accounts/types.d.ts +206 -0
  523. package/lib/node/accounts/types.d.ts.map +1 -0
  524. package/lib/node/accounts/types.js +16 -0
  525. package/lib/node/accounts/utils.d.ts +9 -0
  526. package/lib/node/accounts/utils.d.ts.map +1 -0
  527. package/lib/node/accounts/utils.js +49 -0
  528. package/lib/node/accounts/webSocketAccountSubscriber.d.ts +30 -0
  529. package/lib/node/accounts/webSocketAccountSubscriber.d.ts.map +1 -0
  530. package/lib/node/accounts/webSocketAccountSubscriber.js +170 -0
  531. package/lib/node/accounts/webSocketAccountSubscriberV2.d.ts +110 -0
  532. package/lib/node/accounts/webSocketAccountSubscriberV2.d.ts.map +1 -0
  533. package/lib/node/accounts/webSocketAccountSubscriberV2.js +395 -0
  534. package/lib/node/accounts/webSocketInsuranceFundStakeAccountSubscriber.d.ts +24 -0
  535. package/lib/node/accounts/webSocketInsuranceFundStakeAccountSubscriber.d.ts.map +1 -0
  536. package/lib/node/accounts/webSocketInsuranceFundStakeAccountSubscriber.js +67 -0
  537. package/lib/node/accounts/webSocketProgramAccountSubscriber.d.ts +32 -0
  538. package/lib/node/accounts/webSocketProgramAccountSubscriber.d.ts.map +1 -0
  539. package/lib/node/accounts/webSocketProgramAccountSubscriber.js +120 -0
  540. package/lib/node/accounts/webSocketProgramAccountSubscriberV2.d.ts +146 -0
  541. package/lib/node/accounts/webSocketProgramAccountSubscriberV2.d.ts.map +1 -0
  542. package/lib/node/accounts/webSocketProgramAccountSubscriberV2.js +744 -0
  543. package/lib/node/accounts/webSocketProgramAccountsSubscriberV2.d.ts +146 -0
  544. package/lib/node/accounts/webSocketProgramAccountsSubscriberV2.d.ts.map +1 -0
  545. package/lib/node/accounts/webSocketProgramAccountsSubscriberV2.js +744 -0
  546. package/lib/node/accounts/webSocketUserAccountSubscriber.d.ts +24 -0
  547. package/lib/node/accounts/webSocketUserAccountSubscriber.d.ts.map +1 -0
  548. package/lib/node/accounts/webSocketUserAccountSubscriber.js +61 -0
  549. package/lib/node/accounts/webSocketUserStatsAccountSubsriber.d.ts +23 -0
  550. package/lib/node/accounts/webSocketUserStatsAccountSubsriber.d.ts.map +1 -0
  551. package/lib/node/accounts/webSocketUserStatsAccountSubsriber.js +52 -0
  552. package/lib/node/accounts/webSocketVelocityClientAccountSubscriber.d.ts +78 -0
  553. package/lib/node/accounts/webSocketVelocityClientAccountSubscriber.d.ts.map +1 -0
  554. package/lib/node/accounts/webSocketVelocityClientAccountSubscriber.js +400 -0
  555. package/lib/node/accounts/webSocketVelocityClientAccountSubscriberV2.d.ts +92 -0
  556. package/lib/node/accounts/webSocketVelocityClientAccountSubscriberV2.d.ts.map +1 -0
  557. package/lib/node/accounts/webSocketVelocityClientAccountSubscriberV2.js +446 -0
  558. package/lib/node/accounts/websocketProgramUserAccountSubscriber.d.ts +23 -0
  559. package/lib/node/accounts/websocketProgramUserAccountSubscriber.d.ts.map +1 -0
  560. package/lib/node/accounts/websocketProgramUserAccountSubscriber.js +54 -0
  561. package/lib/node/addresses/marketAddresses.d.ts +3 -0
  562. package/lib/node/addresses/marketAddresses.d.ts.map +1 -0
  563. package/lib/node/addresses/marketAddresses.js +15 -0
  564. package/lib/node/addresses/pda.d.ts +48 -0
  565. package/lib/node/addresses/pda.d.ts.map +1 -0
  566. package/lib/node/addresses/pda.js +263 -0
  567. package/lib/node/adminClient.d.ts +403 -0
  568. package/lib/node/adminClient.d.ts.map +1 -0
  569. package/lib/node/adminClient.js +2798 -0
  570. package/lib/node/assert/assert.d.ts +2 -0
  571. package/lib/node/assert/assert.d.ts.map +1 -0
  572. package/lib/node/assert/assert.js +9 -0
  573. package/lib/node/auctionSubscriber/auctionSubscriber.d.ts +15 -0
  574. package/lib/node/auctionSubscriber/auctionSubscriber.d.ts.map +1 -0
  575. package/lib/node/auctionSubscriber/auctionSubscriber.js +32 -0
  576. package/lib/node/auctionSubscriber/auctionSubscriberGrpc.d.ts +16 -0
  577. package/lib/node/auctionSubscriber/auctionSubscriberGrpc.d.ts.map +1 -0
  578. package/lib/node/auctionSubscriber/auctionSubscriberGrpc.js +32 -0
  579. package/lib/node/auctionSubscriber/index.d.ts +4 -0
  580. package/lib/node/auctionSubscriber/index.d.ts.map +1 -0
  581. package/lib/node/auctionSubscriber/index.js +19 -0
  582. package/lib/node/auctionSubscriber/types.d.ts +15 -0
  583. package/lib/node/auctionSubscriber/types.d.ts.map +1 -0
  584. package/lib/node/auctionSubscriber/types.js +2 -0
  585. package/lib/node/bankrun/bankrunConnection.d.ts +77 -0
  586. package/lib/node/bankrun/bankrunConnection.d.ts.map +1 -0
  587. package/lib/node/bankrun/bankrunConnection.js +348 -0
  588. package/lib/node/blockhashSubscriber/BlockhashSubscriber.d.ts +28 -0
  589. package/lib/node/blockhashSubscriber/BlockhashSubscriber.d.ts.map +1 -0
  590. package/lib/node/blockhashSubscriber/BlockhashSubscriber.js +89 -0
  591. package/lib/node/blockhashSubscriber/index.d.ts +2 -0
  592. package/lib/node/blockhashSubscriber/index.d.ts.map +1 -0
  593. package/lib/node/blockhashSubscriber/index.js +17 -0
  594. package/lib/node/blockhashSubscriber/types.d.ts +8 -0
  595. package/lib/node/blockhashSubscriber/types.d.ts.map +1 -0
  596. package/lib/node/blockhashSubscriber/types.js +2 -0
  597. package/lib/node/clock/clockSubscriber.d.ts +32 -0
  598. package/lib/node/clock/clockSubscriber.d.ts.map +1 -0
  599. package/lib/node/clock/clockSubscriber.js +80 -0
  600. package/lib/node/config.d.ts +76 -0
  601. package/lib/node/config.d.ts.map +1 -0
  602. package/lib/node/config.js +164 -0
  603. package/lib/node/constants/index.d.ts +11 -0
  604. package/lib/node/constants/index.d.ts.map +1 -0
  605. package/lib/node/constants/index.js +26 -0
  606. package/lib/node/constants/insuranceFund.d.ts +6 -0
  607. package/lib/node/constants/insuranceFund.d.ts.map +1 -0
  608. package/lib/node/constants/insuranceFund.js +9 -0
  609. package/lib/node/constants/numericConstants.d.ts +74 -0
  610. package/lib/node/constants/numericConstants.d.ts.map +1 -0
  611. package/lib/node/constants/numericConstants.js +79 -0
  612. package/lib/node/constants/perpMarkets.d.ts +22 -0
  613. package/lib/node/constants/perpMarkets.d.ts.map +1 -0
  614. package/lib/node/constants/perpMarkets.js +971 -0
  615. package/lib/node/constants/spotMarkets.d.ts +25 -0
  616. package/lib/node/constants/spotMarkets.d.ts.map +1 -0
  617. package/lib/node/constants/spotMarkets.js +797 -0
  618. package/lib/node/constants/txConstants.d.ts +2 -0
  619. package/lib/node/constants/txConstants.d.ts.map +1 -0
  620. package/lib/node/constants/txConstants.js +4 -0
  621. package/lib/node/constituentMap/constituentMap.d.ts +67 -0
  622. package/lib/node/constituentMap/constituentMap.d.ts.map +1 -0
  623. package/lib/node/constituentMap/constituentMap.js +177 -0
  624. package/lib/node/constituentMap/pollingConstituentAccountSubscriber.d.ts +25 -0
  625. package/lib/node/constituentMap/pollingConstituentAccountSubscriber.d.ts.map +1 -0
  626. package/lib/node/constituentMap/pollingConstituentAccountSubscriber.js +60 -0
  627. package/lib/node/constituentMap/webSocketConstituentAccountSubscriber.d.ts +25 -0
  628. package/lib/node/constituentMap/webSocketConstituentAccountSubscriber.d.ts.map +1 -0
  629. package/lib/node/constituentMap/webSocketConstituentAccountSubscriber.js +58 -0
  630. package/lib/node/core/VelocityCore.d.ts +227 -0
  631. package/lib/node/core/VelocityCore.d.ts.map +1 -0
  632. package/lib/node/core/VelocityCore.js +138 -0
  633. package/lib/node/core/index.d.ts +13 -0
  634. package/lib/node/core/index.d.ts.map +1 -0
  635. package/lib/node/core/index.js +28 -0
  636. package/lib/node/core/instructions/deposit.d.ts +20 -0
  637. package/lib/node/core/instructions/deposit.d.ts.map +1 -0
  638. package/lib/node/core/instructions/deposit.js +19 -0
  639. package/lib/node/core/instructions/fill.d.ts +14 -0
  640. package/lib/node/core/instructions/fill.d.ts.map +1 -0
  641. package/lib/node/core/instructions/fill.js +17 -0
  642. package/lib/node/core/instructions/funding.d.ts +10 -0
  643. package/lib/node/core/instructions/funding.d.ts.map +1 -0
  644. package/lib/node/core/instructions/funding.js +13 -0
  645. package/lib/node/core/instructions/liquidation.d.ts +16 -0
  646. package/lib/node/core/instructions/liquidation.d.ts.map +1 -0
  647. package/lib/node/core/instructions/liquidation.js +17 -0
  648. package/lib/node/core/instructions/orders.d.ts +23 -0
  649. package/lib/node/core/instructions/orders.d.ts.map +1 -0
  650. package/lib/node/core/instructions/orders.js +27 -0
  651. package/lib/node/core/instructions/perpOrders.d.ts +79 -0
  652. package/lib/node/core/instructions/perpOrders.d.ts.map +1 -0
  653. package/lib/node/core/instructions/perpOrders.js +99 -0
  654. package/lib/node/core/instructions/settlement.d.ts +12 -0
  655. package/lib/node/core/instructions/settlement.d.ts.map +1 -0
  656. package/lib/node/core/instructions/settlement.js +15 -0
  657. package/lib/node/core/instructions/trigger.d.ts +12 -0
  658. package/lib/node/core/instructions/trigger.d.ts.map +1 -0
  659. package/lib/node/core/instructions/trigger.js +15 -0
  660. package/lib/node/core/instructions/withdraw.d.ts +21 -0
  661. package/lib/node/core/instructions/withdraw.d.ts.map +1 -0
  662. package/lib/node/core/instructions/withdraw.js +20 -0
  663. package/lib/node/core/remainingAccounts.d.ts +28 -0
  664. package/lib/node/core/remainingAccounts.d.ts.map +1 -0
  665. package/lib/node/core/remainingAccounts.js +122 -0
  666. package/lib/node/core/signedMsg.d.ts +18 -0
  667. package/lib/node/core/signedMsg.d.ts.map +1 -0
  668. package/lib/node/core/signedMsg.js +39 -0
  669. package/lib/node/decode/customCoder.d.ts +45 -0
  670. package/lib/node/decode/customCoder.d.ts.map +1 -0
  671. package/lib/node/decode/customCoder.js +64 -0
  672. package/lib/node/decode/user.d.ts +5 -0
  673. package/lib/node/decode/user.d.ts.map +1 -0
  674. package/lib/node/decode/user.js +337 -0
  675. package/lib/node/dlob/DLOB.d.ts +254 -0
  676. package/lib/node/dlob/DLOB.d.ts.map +1 -0
  677. package/lib/node/dlob/DLOB.js +1137 -0
  678. package/lib/node/dlob/DLOBNode.d.ts +71 -0
  679. package/lib/node/dlob/DLOBNode.d.ts.map +1 -0
  680. package/lib/node/dlob/DLOBNode.js +103 -0
  681. package/lib/node/dlob/DLOBSubscriber.d.ts +58 -0
  682. package/lib/node/dlob/DLOBSubscriber.d.ts.map +1 -0
  683. package/lib/node/dlob/DLOBSubscriber.js +143 -0
  684. package/lib/node/dlob/NodeList.d.ts +28 -0
  685. package/lib/node/dlob/NodeList.d.ts.map +1 -0
  686. package/lib/node/dlob/NodeList.js +126 -0
  687. package/lib/node/dlob/orderBookLevels.d.ts +78 -0
  688. package/lib/node/dlob/orderBookLevels.d.ts.map +1 -0
  689. package/lib/node/dlob/orderBookLevels.js +404 -0
  690. package/lib/node/dlob/types.d.ts +19 -0
  691. package/lib/node/dlob/types.d.ts.map +1 -0
  692. package/lib/node/dlob/types.js +2 -0
  693. package/lib/node/events/eventList.d.ts +23 -0
  694. package/lib/node/events/eventList.d.ts.map +1 -0
  695. package/lib/node/events/eventList.js +80 -0
  696. package/lib/node/events/eventSubscriber.d.ts +56 -0
  697. package/lib/node/events/eventSubscriber.d.ts.map +1 -0
  698. package/lib/node/events/eventSubscriber.js +229 -0
  699. package/lib/node/events/eventsServerLogProvider.d.ts +22 -0
  700. package/lib/node/events/eventsServerLogProvider.d.ts.map +1 -0
  701. package/lib/node/events/eventsServerLogProvider.js +121 -0
  702. package/lib/node/events/fetchLogs.d.ts +26 -0
  703. package/lib/node/events/fetchLogs.d.ts.map +1 -0
  704. package/lib/node/events/fetchLogs.js +99 -0
  705. package/lib/node/events/parse.d.ts +9 -0
  706. package/lib/node/events/parse.d.ts.map +1 -0
  707. package/lib/node/events/parse.js +199 -0
  708. package/lib/node/events/pollingLogProvider.d.ts +18 -0
  709. package/lib/node/events/pollingLogProvider.d.ts.map +1 -0
  710. package/lib/node/events/pollingLogProvider.js +58 -0
  711. package/lib/node/events/sort.d.ts +3 -0
  712. package/lib/node/events/sort.d.ts.map +1 -0
  713. package/lib/node/events/sort.js +24 -0
  714. package/lib/node/events/txEventCache.d.ts +25 -0
  715. package/lib/node/events/txEventCache.d.ts.map +1 -0
  716. package/lib/node/events/txEventCache.js +71 -0
  717. package/lib/node/events/types.d.ts +105 -0
  718. package/lib/node/events/types.d.ts.map +1 -0
  719. package/lib/node/events/types.js +36 -0
  720. package/lib/node/events/webSocketLogProvider.d.ts +25 -0
  721. package/lib/node/events/webSocketLogProvider.d.ts.map +1 -0
  722. package/lib/node/events/webSocketLogProvider.js +96 -0
  723. package/lib/node/factory/bigNum.d.ts +123 -0
  724. package/lib/node/factory/bigNum.d.ts.map +1 -0
  725. package/lib/node/factory/bigNum.js +500 -0
  726. package/lib/node/factory/oracleClient.d.ts +6 -0
  727. package/lib/node/factory/oracleClient.d.ts.map +1 -0
  728. package/lib/node/factory/oracleClient.js +53 -0
  729. package/lib/node/idl/drift.d.ts +23895 -0
  730. package/lib/node/idl/drift.d.ts.map +1 -0
  731. package/lib/node/idl/drift.js +2 -0
  732. package/lib/node/idl/drift.json +18698 -0
  733. package/lib/node/idl/pyth.d.ts +98 -0
  734. package/lib/node/idl/pyth.d.ts.map +1 -0
  735. package/lib/node/idl/pyth.js +2 -0
  736. package/lib/node/idl/token_faucet.d.ts +198 -0
  737. package/lib/node/idl/token_faucet.d.ts.map +1 -0
  738. package/lib/node/idl/token_faucet.js +2 -0
  739. package/lib/node/idl/token_faucet.json +229 -0
  740. package/lib/node/index.d.ts +145 -0
  741. package/lib/node/index.d.ts.map +1 -0
  742. package/lib/node/index.js +175 -0
  743. package/lib/node/indicative-quotes/indicativeQuotesSender.d.ts +36 -0
  744. package/lib/node/indicative-quotes/indicativeQuotesSender.d.ts.map +1 -0
  745. package/lib/node/indicative-quotes/indicativeQuotesSender.js +192 -0
  746. package/lib/node/isomorphic/anchor.browser.d.ts.map +1 -0
  747. package/lib/node/isomorphic/anchor.d.ts +2 -0
  748. package/lib/node/isomorphic/anchor.d.ts.map +1 -0
  749. package/lib/node/isomorphic/anchor.js +17 -0
  750. package/lib/node/isomorphic/anchor.node.d.ts +2 -0
  751. package/lib/node/isomorphic/anchor.node.d.ts.map +1 -0
  752. package/lib/node/isomorphic/anchor.node.js +17 -0
  753. package/lib/node/isomorphic/anchor29.browser.d.ts.map +1 -0
  754. package/lib/node/isomorphic/anchor29.d.ts +2 -0
  755. package/lib/node/isomorphic/anchor29.d.ts.map +1 -0
  756. package/lib/node/isomorphic/anchor29.js +17 -0
  757. package/lib/node/isomorphic/anchor29.node.d.ts +2 -0
  758. package/lib/node/isomorphic/anchor29.node.d.ts.map +1 -0
  759. package/lib/node/isomorphic/anchor29.node.js +17 -0
  760. package/lib/node/isomorphic/grpc.browser.d.ts.map +1 -0
  761. package/lib/node/isomorphic/grpc.d.ts +18 -0
  762. package/lib/node/isomorphic/grpc.d.ts.map +1 -0
  763. package/lib/node/isomorphic/grpc.js +109 -0
  764. package/lib/node/isomorphic/grpc.node.d.ts +18 -0
  765. package/lib/node/isomorphic/grpc.node.d.ts.map +1 -0
  766. package/lib/node/isomorphic/grpc.node.js +109 -0
  767. package/lib/node/jupiter/jupiterClient.d.ts +292 -0
  768. package/lib/node/jupiter/jupiterClient.d.ts.map +1 -0
  769. package/lib/node/jupiter/jupiterClient.js +164 -0
  770. package/lib/node/keypair.d.ts +3 -0
  771. package/lib/node/keypair.d.ts.map +1 -0
  772. package/lib/node/keypair.js +28 -0
  773. package/lib/node/marginCalculation.d.ts +68 -0
  774. package/lib/node/marginCalculation.d.ts.map +1 -0
  775. package/lib/node/marginCalculation.js +176 -0
  776. package/lib/node/marinade/index.d.ts +13 -0
  777. package/lib/node/marinade/index.d.ts.map +1 -0
  778. package/lib/node/marinade/index.js +36 -0
  779. package/lib/node/marinade/types.d.ts +1964 -0
  780. package/lib/node/marinade/types.d.ts.map +1 -0
  781. package/lib/node/marinade/types.js +1965 -0
  782. package/lib/node/math/amm.d.ts +99 -0
  783. package/lib/node/math/amm.d.ts.map +1 -0
  784. package/lib/node/math/amm.js +671 -0
  785. package/lib/node/math/auction.d.ts +66 -0
  786. package/lib/node/math/auction.d.ts.map +1 -0
  787. package/lib/node/math/auction.js +261 -0
  788. package/lib/node/math/bankruptcy.d.ts +3 -0
  789. package/lib/node/math/bankruptcy.d.ts.map +1 -0
  790. package/lib/node/math/bankruptcy.js +32 -0
  791. package/lib/node/math/builder.d.ts +6 -0
  792. package/lib/node/math/builder.d.ts.map +1 -0
  793. package/lib/node/math/builder.js +22 -0
  794. package/lib/node/math/conversion.d.ts +5 -0
  795. package/lib/node/math/conversion.d.ts.map +1 -0
  796. package/lib/node/math/conversion.js +21 -0
  797. package/lib/node/math/exchangeStatus.d.ts +9 -0
  798. package/lib/node/math/exchangeStatus.d.ts.map +1 -0
  799. package/lib/node/math/exchangeStatus.js +85 -0
  800. package/lib/node/math/funding.d.ts +45 -0
  801. package/lib/node/math/funding.d.ts.map +1 -0
  802. package/lib/node/math/funding.js +260 -0
  803. package/lib/node/math/insurance.d.ts +9 -0
  804. package/lib/node/math/insurance.d.ts.map +1 -0
  805. package/lib/node/math/insurance.js +74 -0
  806. package/lib/node/math/liquidation.d.ts +8 -0
  807. package/lib/node/math/liquidation.d.ts.map +1 -0
  808. package/lib/node/math/liquidation.js +134 -0
  809. package/lib/node/math/margin.d.ts +46 -0
  810. package/lib/node/math/margin.d.ts.map +1 -0
  811. package/lib/node/math/margin.js +205 -0
  812. package/lib/node/math/market.d.ts +51 -0
  813. package/lib/node/math/market.d.ts.map +1 -0
  814. package/lib/node/math/market.js +234 -0
  815. package/lib/node/math/oracles.d.ts +20 -0
  816. package/lib/node/math/oracles.d.ts.map +1 -0
  817. package/lib/node/math/oracles.js +215 -0
  818. package/lib/node/math/orders.d.ts +37 -0
  819. package/lib/node/math/orders.d.ts.map +1 -0
  820. package/lib/node/math/orders.js +294 -0
  821. package/lib/node/math/position.d.ts +72 -0
  822. package/lib/node/math/position.d.ts.map +1 -0
  823. package/lib/node/math/position.js +232 -0
  824. package/lib/node/math/repeg.d.ts +23 -0
  825. package/lib/node/math/repeg.d.ts.map +1 -0
  826. package/lib/node/math/repeg.js +164 -0
  827. package/lib/node/math/spotBalance.d.ts +86 -0
  828. package/lib/node/math/spotBalance.d.ts.map +1 -0
  829. package/lib/node/math/spotBalance.js +438 -0
  830. package/lib/node/math/spotMarket.d.ts +12 -0
  831. package/lib/node/math/spotMarket.d.ts.map +1 -0
  832. package/lib/node/math/spotMarket.js +49 -0
  833. package/lib/node/math/spotPosition.d.ts +20 -0
  834. package/lib/node/math/spotPosition.d.ts.map +1 -0
  835. package/lib/node/math/spotPosition.js +79 -0
  836. package/lib/node/math/state.d.ts +9 -0
  837. package/lib/node/math/state.d.ts.map +1 -0
  838. package/lib/node/math/state.js +44 -0
  839. package/lib/node/math/superStake.d.ts +169 -0
  840. package/lib/node/math/superStake.d.ts.map +1 -0
  841. package/lib/node/math/superStake.js +308 -0
  842. package/lib/node/math/tiers.d.ts +5 -0
  843. package/lib/node/math/tiers.d.ts.map +1 -0
  844. package/lib/node/math/tiers.js +52 -0
  845. package/lib/node/math/trade.d.ts +94 -0
  846. package/lib/node/math/trade.d.ts.map +1 -0
  847. package/lib/node/math/trade.js +503 -0
  848. package/lib/node/math/utils.d.ts +24 -0
  849. package/lib/node/math/utils.d.ts.map +1 -0
  850. package/lib/node/math/utils.js +113 -0
  851. package/lib/node/memcmp.d.ts +19 -0
  852. package/lib/node/memcmp.d.ts.map +1 -0
  853. package/lib/node/memcmp.js +162 -0
  854. package/lib/node/oracles/oracleClientCache.d.ts +10 -0
  855. package/lib/node/oracles/oracleClientCache.d.ts.map +1 -0
  856. package/lib/node/oracles/oracleClientCache.js +19 -0
  857. package/lib/node/oracles/oracleId.d.ts +10 -0
  858. package/lib/node/oracles/oracleId.d.ts.map +1 -0
  859. package/lib/node/oracles/oracleId.js +89 -0
  860. package/lib/node/oracles/prelaunchOracleClient.d.ts +13 -0
  861. package/lib/node/oracles/prelaunchOracleClient.d.ts.map +1 -0
  862. package/lib/node/oracles/prelaunchOracleClient.js +24 -0
  863. package/lib/node/oracles/pythClient.d.ts +15 -0
  864. package/lib/node/oracles/pythClient.d.ts.map +1 -0
  865. package/lib/node/oracles/pythClient.js +51 -0
  866. package/lib/node/oracles/pythLazerClient.d.ts +17 -0
  867. package/lib/node/oracles/pythLazerClient.d.ts.map +1 -0
  868. package/lib/node/oracles/pythLazerClient.js +61 -0
  869. package/lib/node/oracles/quoteAssetOracleClient.d.ts +11 -0
  870. package/lib/node/oracles/quoteAssetOracleClient.d.ts.map +1 -0
  871. package/lib/node/oracles/quoteAssetOracleClient.js +21 -0
  872. package/lib/node/oracles/strictOraclePrice.d.ts +10 -0
  873. package/lib/node/oracles/strictOraclePrice.d.ts.map +1 -0
  874. package/lib/node/oracles/strictOraclePrice.js +17 -0
  875. package/lib/node/oracles/types.d.ts +34 -0
  876. package/lib/node/oracles/types.d.ts.map +1 -0
  877. package/lib/node/oracles/types.js +2 -0
  878. package/lib/node/oracles/utils.d.ts +5 -0
  879. package/lib/node/oracles/utils.d.ts.map +1 -0
  880. package/lib/node/oracles/utils.js +8 -0
  881. package/lib/node/orderParams.d.ts +30 -0
  882. package/lib/node/orderParams.d.ts.map +1 -0
  883. package/lib/node/orderParams.js +44 -0
  884. package/lib/node/orderSubscriber/OrderSubscriber.d.ts +46 -0
  885. package/lib/node/orderSubscriber/OrderSubscriber.d.ts.map +1 -0
  886. package/lib/node/orderSubscriber/OrderSubscriber.js +193 -0
  887. package/lib/node/orderSubscriber/PollingSubscription.d.ts +13 -0
  888. package/lib/node/orderSubscriber/PollingSubscription.d.ts.map +1 -0
  889. package/lib/node/orderSubscriber/PollingSubscription.js +23 -0
  890. package/lib/node/orderSubscriber/WebsocketSubscription.d.ts +24 -0
  891. package/lib/node/orderSubscriber/WebsocketSubscription.d.ts.map +1 -0
  892. package/lib/node/orderSubscriber/WebsocketSubscription.js +67 -0
  893. package/lib/node/orderSubscriber/grpcSubscription.d.ts +23 -0
  894. package/lib/node/orderSubscriber/grpcSubscription.d.ts.map +1 -0
  895. package/lib/node/orderSubscriber/grpcSubscription.js +75 -0
  896. package/lib/node/orderSubscriber/index.d.ts +8 -0
  897. package/lib/node/orderSubscriber/index.d.ts.map +1 -0
  898. package/lib/node/orderSubscriber/index.js +23 -0
  899. package/lib/node/orderSubscriber/types.d.ts +36 -0
  900. package/lib/node/orderSubscriber/types.d.ts.map +1 -0
  901. package/lib/node/orderSubscriber/types.js +2 -0
  902. package/lib/node/priorityFee/averageOverSlotsStrategy.d.ts +6 -0
  903. package/lib/node/priorityFee/averageOverSlotsStrategy.d.ts.map +1 -0
  904. package/lib/node/priorityFee/averageOverSlotsStrategy.js +16 -0
  905. package/lib/node/priorityFee/averageStrategy.d.ts +6 -0
  906. package/lib/node/priorityFee/averageStrategy.d.ts.map +1 -0
  907. package/lib/node/priorityFee/averageStrategy.js +11 -0
  908. package/lib/node/priorityFee/ewmaStrategy.d.ts +12 -0
  909. package/lib/node/priorityFee/ewmaStrategy.d.ts.map +1 -0
  910. package/lib/node/priorityFee/ewmaStrategy.js +33 -0
  911. package/lib/node/priorityFee/heliusPriorityFeeMethod.d.ts +21 -0
  912. package/lib/node/priorityFee/heliusPriorityFeeMethod.d.ts.map +1 -0
  913. package/lib/node/priorityFee/heliusPriorityFeeMethod.js +46 -0
  914. package/lib/node/priorityFee/index.d.ts +17 -0
  915. package/lib/node/priorityFee/index.d.ts.map +1 -0
  916. package/lib/node/priorityFee/index.js +32 -0
  917. package/lib/node/priorityFee/maxOverSlotsStrategy.d.ts +6 -0
  918. package/lib/node/priorityFee/maxOverSlotsStrategy.d.ts.map +1 -0
  919. package/lib/node/priorityFee/maxOverSlotsStrategy.js +17 -0
  920. package/lib/node/priorityFee/maxStrategy.d.ts +8 -0
  921. package/lib/node/priorityFee/maxStrategy.d.ts.map +1 -0
  922. package/lib/node/priorityFee/maxStrategy.js +9 -0
  923. package/lib/node/priorityFee/priorityFeeSubscriber.d.ts +49 -0
  924. package/lib/node/priorityFee/priorityFeeSubscriber.d.ts.map +1 -0
  925. package/lib/node/priorityFee/priorityFeeSubscriber.js +193 -0
  926. package/lib/node/priorityFee/priorityFeeSubscriberMap.d.ts +51 -0
  927. package/lib/node/priorityFee/priorityFeeSubscriberMap.d.ts.map +1 -0
  928. package/lib/node/priorityFee/priorityFeeSubscriberMap.js +96 -0
  929. package/lib/node/priorityFee/solanaPriorityFeeMethod.d.ts +7 -0
  930. package/lib/node/priorityFee/solanaPriorityFeeMethod.d.ts.map +1 -0
  931. package/lib/node/priorityFee/solanaPriorityFeeMethod.js +21 -0
  932. package/lib/node/priorityFee/types.d.ts +36 -0
  933. package/lib/node/priorityFee/types.d.ts.map +1 -0
  934. package/lib/node/priorityFee/types.js +10 -0
  935. package/lib/node/priorityFee/velocityPriorityFeeMethod.d.ts +22 -0
  936. package/lib/node/priorityFee/velocityPriorityFeeMethod.d.ts.map +1 -0
  937. package/lib/node/priorityFee/velocityPriorityFeeMethod.js +28 -0
  938. package/lib/node/pyth/constants.d.ts +4 -0
  939. package/lib/node/pyth/constants.d.ts.map +1 -0
  940. package/lib/node/pyth/constants.js +6 -0
  941. package/lib/node/pyth/index.d.ts +5 -0
  942. package/lib/node/pyth/index.d.ts.map +1 -0
  943. package/lib/node/pyth/index.js +12 -0
  944. package/lib/node/pyth/pythLazerSubscriber.d.ts +92 -0
  945. package/lib/node/pyth/pythLazerSubscriber.d.ts.map +1 -0
  946. package/lib/node/pyth/pythLazerSubscriber.js +276 -0
  947. package/lib/node/pyth/types.d.ts +2227 -0
  948. package/lib/node/pyth/types.d.ts.map +1 -0
  949. package/lib/node/pyth/types.js +2224 -0
  950. package/lib/node/pyth/utils.d.ts +3 -0
  951. package/lib/node/pyth/utils.d.ts.map +1 -0
  952. package/lib/node/pyth/utils.js +10 -0
  953. package/lib/node/slot/SlotSubscriber.d.ts +28 -0
  954. package/lib/node/slot/SlotSubscriber.d.ts.map +1 -0
  955. package/lib/node/slot/SlotSubscriber.js +76 -0
  956. package/lib/node/slot/SlothashSubscriber.d.ts +26 -0
  957. package/lib/node/slot/SlothashSubscriber.d.ts.map +1 -0
  958. package/lib/node/slot/SlothashSubscriber.js +88 -0
  959. package/lib/node/swap/UnifiedSwapClient.d.ts +121 -0
  960. package/lib/node/swap/UnifiedSwapClient.d.ts.map +1 -0
  961. package/lib/node/swap/UnifiedSwapClient.js +179 -0
  962. package/lib/node/swift/grpcSignedMsgUserAccountSubscriber.d.ts +23 -0
  963. package/lib/node/swift/grpcSignedMsgUserAccountSubscriber.d.ts.map +1 -0
  964. package/lib/node/swift/grpcSignedMsgUserAccountSubscriber.js +57 -0
  965. package/lib/node/swift/index.d.ts +11 -0
  966. package/lib/node/swift/index.d.ts.map +1 -0
  967. package/lib/node/swift/index.js +26 -0
  968. package/lib/node/swift/signedMsgUserAccountSubscriber.d.ts +43 -0
  969. package/lib/node/swift/signedMsgUserAccountSubscriber.d.ts.map +1 -0
  970. package/lib/node/swift/signedMsgUserAccountSubscriber.js +118 -0
  971. package/lib/node/swift/swiftOrderSubscriber.d.ts +64 -0
  972. package/lib/node/swift/swiftOrderSubscriber.d.ts.map +1 -0
  973. package/lib/node/swift/swiftOrderSubscriber.js +187 -0
  974. package/lib/node/testClient.d.ts +9 -0
  975. package/lib/node/testClient.d.ts.map +1 -0
  976. package/lib/node/testClient.js +24 -0
  977. package/lib/node/titan/titanClient.d.ts +91 -0
  978. package/lib/node/titan/titanClient.d.ts.map +1 -0
  979. package/lib/node/titan/titanClient.js +227 -0
  980. package/lib/node/token/index.d.ts +6 -0
  981. package/lib/node/token/index.d.ts.map +1 -0
  982. package/lib/node/token/index.js +15 -0
  983. package/lib/node/tokenFaucet.d.ts +42 -0
  984. package/lib/node/tokenFaucet.d.ts.map +1 -0
  985. package/lib/node/tokenFaucet.js +188 -0
  986. package/lib/node/tx/baseTxSender.d.ts +60 -0
  987. package/lib/node/tx/baseTxSender.d.ts.map +1 -0
  988. package/lib/node/tx/baseTxSender.js +292 -0
  989. package/lib/node/tx/blockhashFetcher/baseBlockhashFetcher.d.ts +9 -0
  990. package/lib/node/tx/blockhashFetcher/baseBlockhashFetcher.d.ts.map +1 -0
  991. package/lib/node/tx/blockhashFetcher/baseBlockhashFetcher.js +13 -0
  992. package/lib/node/tx/blockhashFetcher/cachedBlockhashFetcher.d.ts +29 -0
  993. package/lib/node/tx/blockhashFetcher/cachedBlockhashFetcher.d.ts.map +1 -0
  994. package/lib/node/tx/blockhashFetcher/cachedBlockhashFetcher.js +73 -0
  995. package/lib/node/tx/blockhashFetcher/types.d.ts +5 -0
  996. package/lib/node/tx/blockhashFetcher/types.d.ts.map +1 -0
  997. package/lib/node/tx/blockhashFetcher/types.js +2 -0
  998. package/lib/node/tx/fastSingleTxSender.d.ts +42 -0
  999. package/lib/node/tx/fastSingleTxSender.d.ts.map +1 -0
  1000. package/lib/node/tx/fastSingleTxSender.js +86 -0
  1001. package/lib/node/tx/forwardOnlyTxSender.d.ts +38 -0
  1002. package/lib/node/tx/forwardOnlyTxSender.d.ts.map +1 -0
  1003. package/lib/node/tx/forwardOnlyTxSender.js +92 -0
  1004. package/lib/node/tx/priorityFeeCalculator.d.ts +45 -0
  1005. package/lib/node/tx/priorityFeeCalculator.d.ts.map +1 -0
  1006. package/lib/node/tx/priorityFeeCalculator.js +85 -0
  1007. package/lib/node/tx/reportTransactionError.d.ts +21 -0
  1008. package/lib/node/tx/reportTransactionError.d.ts.map +1 -0
  1009. package/lib/node/tx/reportTransactionError.js +103 -0
  1010. package/lib/node/tx/retryTxSender.d.ts +38 -0
  1011. package/lib/node/tx/retryTxSender.d.ts.map +1 -0
  1012. package/lib/node/tx/retryTxSender.js +86 -0
  1013. package/lib/node/tx/txHandler.d.ts +174 -0
  1014. package/lib/node/tx/txHandler.d.ts.map +1 -0
  1015. package/lib/node/tx/txHandler.js +522 -0
  1016. package/lib/node/tx/txParamProcessor.d.ts +27 -0
  1017. package/lib/node/tx/txParamProcessor.d.ts.map +1 -0
  1018. package/lib/node/tx/txParamProcessor.js +92 -0
  1019. package/lib/node/tx/types.d.ts +30 -0
  1020. package/lib/node/tx/types.d.ts.map +1 -0
  1021. package/lib/node/tx/types.js +20 -0
  1022. package/lib/node/tx/utils.d.ts +7 -0
  1023. package/lib/node/tx/utils.d.ts.map +1 -0
  1024. package/lib/node/tx/utils.js +78 -0
  1025. package/lib/node/tx/whileValidTxSender.d.ts +46 -0
  1026. package/lib/node/tx/whileValidTxSender.d.ts.map +1 -0
  1027. package/lib/node/tx/whileValidTxSender.js +168 -0
  1028. package/lib/node/types.d.ts +1748 -0
  1029. package/lib/node/types.d.ts.map +1 -0
  1030. package/lib/node/types.js +427 -0
  1031. package/lib/node/user.d.ts +447 -0
  1032. package/lib/node/user.d.ts.map +1 -0
  1033. package/lib/node/user.js +2372 -0
  1034. package/lib/node/userConfig.d.ts +32 -0
  1035. package/lib/node/userConfig.d.ts.map +1 -0
  1036. package/lib/node/userConfig.js +2 -0
  1037. package/lib/node/userMap/PollingSubscription.d.ts +16 -0
  1038. package/lib/node/userMap/PollingSubscription.d.ts.map +1 -0
  1039. package/lib/node/userMap/PollingSubscription.js +30 -0
  1040. package/lib/node/userMap/WebsocketSubscription.d.ts +28 -0
  1041. package/lib/node/userMap/WebsocketSubscription.d.ts.map +1 -0
  1042. package/lib/node/userMap/WebsocketSubscription.js +45 -0
  1043. package/lib/node/userMap/grpcSubscription.d.ts +28 -0
  1044. package/lib/node/userMap/grpcSubscription.d.ts.map +1 -0
  1045. package/lib/node/userMap/grpcSubscription.js +44 -0
  1046. package/lib/node/userMap/referrerMap.d.ts +46 -0
  1047. package/lib/node/userMap/referrerMap.d.ts.map +1 -0
  1048. package/lib/node/userMap/referrerMap.js +184 -0
  1049. package/lib/node/userMap/revenueShareEscrowMap.d.ts +67 -0
  1050. package/lib/node/userMap/revenueShareEscrowMap.d.ts.map +1 -0
  1051. package/lib/node/userMap/revenueShareEscrowMap.js +210 -0
  1052. package/lib/node/userMap/userMap.d.ts +115 -0
  1053. package/lib/node/userMap/userMap.d.ts.map +1 -0
  1054. package/lib/node/userMap/userMap.js +486 -0
  1055. package/lib/node/userMap/userMapConfig.d.ts +41 -0
  1056. package/lib/node/userMap/userMapConfig.d.ts.map +1 -0
  1057. package/lib/node/userMap/userMapConfig.js +2 -0
  1058. package/lib/node/userMap/userStatsMap.d.ts +67 -0
  1059. package/lib/node/userMap/userStatsMap.d.ts.map +1 -0
  1060. package/lib/node/userMap/userStatsMap.js +266 -0
  1061. package/lib/node/userName.d.ts +6 -0
  1062. package/lib/node/userName.d.ts.map +1 -0
  1063. package/lib/node/userName.js +21 -0
  1064. package/lib/node/userStats.d.ts +25 -0
  1065. package/lib/node/userStats.d.ts.map +1 -0
  1066. package/lib/node/userStats.js +70 -0
  1067. package/lib/node/userStatsConfig.d.ts +27 -0
  1068. package/lib/node/userStatsConfig.d.ts.map +1 -0
  1069. package/lib/node/userStatsConfig.js +2 -0
  1070. package/lib/node/util/TransactionConfirmationManager.d.ts +17 -0
  1071. package/lib/node/util/TransactionConfirmationManager.d.ts.map +1 -0
  1072. package/lib/node/util/TransactionConfirmationManager.js +174 -0
  1073. package/lib/node/util/chainClock.d.ts +18 -0
  1074. package/lib/node/util/chainClock.d.ts.map +1 -0
  1075. package/lib/node/util/chainClock.js +29 -0
  1076. package/lib/node/util/computeUnits.d.ts +9 -0
  1077. package/lib/node/util/computeUnits.d.ts.map +1 -0
  1078. package/lib/node/util/computeUnits.js +48 -0
  1079. package/lib/node/util/digest.d.ts +6 -0
  1080. package/lib/node/util/digest.d.ts.map +1 -0
  1081. package/lib/node/util/digest.js +19 -0
  1082. package/lib/node/util/ed25519Utils.d.ts +11 -0
  1083. package/lib/node/util/ed25519Utils.d.ts.map +1 -0
  1084. package/lib/node/util/ed25519Utils.js +80 -0
  1085. package/lib/node/util/promiseTimeout.d.ts +2 -0
  1086. package/lib/node/util/promiseTimeout.d.ts.map +1 -0
  1087. package/lib/node/util/promiseTimeout.js +14 -0
  1088. package/lib/node/util/tps.d.ts +3 -0
  1089. package/lib/node/util/tps.d.ts.map +1 -0
  1090. package/lib/node/util/tps.js +16 -0
  1091. package/lib/node/velocityClient.d.ts +1231 -0
  1092. package/lib/node/velocityClient.d.ts.map +1 -0
  1093. package/lib/node/velocityClient.js +5778 -0
  1094. package/lib/node/velocityClientConfig.d.ts +85 -0
  1095. package/lib/node/velocityClientConfig.d.ts.map +1 -0
  1096. package/lib/node/velocityClientConfig.js +2 -0
  1097. package/lib/node/wallet.d.ts +17 -0
  1098. package/lib/node/wallet.d.ts.map +1 -0
  1099. package/lib/node/wallet.js +46 -0
  1100. package/package.json +157 -0
  1101. package/scripts/deposit-isolated-positions.ts +110 -0
  1102. package/scripts/find-flagged-users.ts +213 -0
  1103. package/scripts/grpc-client-test-comparison.ts +372 -0
  1104. package/scripts/grpc-multiuser-client-test-comparison.ts +158 -0
  1105. package/scripts/postbuild.js +95 -0
  1106. package/scripts/single-grpc-client-test.ts +284 -0
  1107. package/scripts/updateVersion.js +28 -0
  1108. package/scripts/withdraw-isolated-positions.ts +174 -0
  1109. package/src/accounts/README_WebSocketAccountSubscriberV2.md +95 -0
  1110. package/src/accounts/README_WebSocketProgramAccountSubscriberV2.md +135 -0
  1111. package/src/accounts/basicUserAccountSubscriber.ts +59 -0
  1112. package/src/accounts/basicUserStatsAccountSubscriber.ts +65 -0
  1113. package/src/accounts/bulkAccountLoader.ts +293 -0
  1114. package/src/accounts/bulkUserStatsSubscription.ts +33 -0
  1115. package/src/accounts/bulkUserSubscription.ts +33 -0
  1116. package/src/accounts/customizedCadenceBulkAccountLoader.ts +213 -0
  1117. package/src/accounts/fetch.ts +143 -0
  1118. package/src/accounts/grpcAccountSubscriber.ts +187 -0
  1119. package/src/accounts/grpcInsuranceFundStakeAccountSubscriber.ts +57 -0
  1120. package/src/accounts/grpcMultiAccountSubscriber.ts +476 -0
  1121. package/src/accounts/grpcMultiUserAccountSubscriber.ts +281 -0
  1122. package/src/accounts/grpcProgramAccountSubscriber.ts +223 -0
  1123. package/src/accounts/grpcUserAccountSubscriber.ts +48 -0
  1124. package/src/accounts/grpcUserStatsAccountSubscriber.ts +50 -0
  1125. package/src/accounts/grpcVelocityClientAccountSubscriber.ts +213 -0
  1126. package/src/accounts/grpcVelocityClientAccountSubscriberV2.ts +762 -0
  1127. package/src/accounts/laserProgramAccountSubscriber.ts +229 -0
  1128. package/src/accounts/oneShotUserAccountSubscriber.ts +67 -0
  1129. package/src/accounts/oneShotUserStatsAccountSubscriber.ts +70 -0
  1130. package/src/accounts/pollingInsuranceFundStakeAccountSubscriber.ts +186 -0
  1131. package/src/accounts/pollingOracleAccountSubscriber.ts +125 -0
  1132. package/src/accounts/pollingTokenAccountSubscriber.ts +118 -0
  1133. package/src/accounts/pollingUserAccountSubscriber.ts +160 -0
  1134. package/src/accounts/pollingUserStatsAccountSubscriber.ts +156 -0
  1135. package/src/accounts/pollingVelocityClientAccountSubscriber.ts +652 -0
  1136. package/src/accounts/testBulkAccountLoader.ts +51 -0
  1137. package/src/accounts/types.ts +284 -0
  1138. package/src/accounts/utils.ts +62 -0
  1139. package/src/accounts/webSocketAccountSubscriber.ts +250 -0
  1140. package/src/accounts/webSocketAccountSubscriberV2.ts +517 -0
  1141. package/src/accounts/webSocketInsuranceFundStakeAccountSubscriber.ts +129 -0
  1142. package/src/accounts/webSocketProgramAccountSubscriber.ts +183 -0
  1143. package/src/accounts/webSocketProgramAccountSubscriberV2.ts +996 -0
  1144. package/src/accounts/webSocketProgramAccountsSubscriberV2.ts +996 -0
  1145. package/src/accounts/webSocketUserAccountSubscriber.ts +104 -0
  1146. package/src/accounts/webSocketUserStatsAccountSubsriber.ts +98 -0
  1147. package/src/accounts/webSocketVelocityClientAccountSubscriber.ts +719 -0
  1148. package/src/accounts/webSocketVelocityClientAccountSubscriberV2.ts +755 -0
  1149. package/src/accounts/websocketProgramUserAccountSubscriber.ts +94 -0
  1150. package/src/addresses/marketAddresses.ts +17 -0
  1151. package/src/addresses/pda.ts +439 -0
  1152. package/src/adminClient.ts +5936 -0
  1153. package/src/assert/assert.ts +5 -0
  1154. package/src/auctionSubscriber/auctionSubscriber.ts +68 -0
  1155. package/src/auctionSubscriber/auctionSubscriberGrpc.ts +72 -0
  1156. package/src/auctionSubscriber/index.ts +3 -0
  1157. package/src/auctionSubscriber/types.ts +20 -0
  1158. package/src/bankrun/bankrunConnection.ts +560 -0
  1159. package/src/blockhashSubscriber/BlockhashSubscriber.ts +126 -0
  1160. package/src/blockhashSubscriber/index.ts +1 -0
  1161. package/src/blockhashSubscriber/types.ts +12 -0
  1162. package/src/clock/clockSubscriber.ts +121 -0
  1163. package/src/config.ts +268 -0
  1164. package/src/constants/index.ts +10 -0
  1165. package/src/constants/insuranceFund.ts +8 -0
  1166. package/src/constants/numericConstants.ts +119 -0
  1167. package/src/constants/perpMarkets.ts +1042 -0
  1168. package/src/constants/spotMarkets.ts +874 -0
  1169. package/src/constants/txConstants.ts +1 -0
  1170. package/src/constituentMap/constituentMap.ts +294 -0
  1171. package/src/constituentMap/pollingConstituentAccountSubscriber.ts +97 -0
  1172. package/src/constituentMap/webSocketConstituentAccountSubscriber.ts +112 -0
  1173. package/src/core/VelocityCore.ts +331 -0
  1174. package/src/core/index.ts +12 -0
  1175. package/src/core/instructions/deposit.ts +42 -0
  1176. package/src/core/instructions/fill.ts +34 -0
  1177. package/src/core/instructions/funding.ts +21 -0
  1178. package/src/core/instructions/liquidation.ts +37 -0
  1179. package/src/core/instructions/orders.ts +56 -0
  1180. package/src/core/instructions/perpOrders.ts +192 -0
  1181. package/src/core/instructions/settlement.ts +26 -0
  1182. package/src/core/instructions/trigger.ts +26 -0
  1183. package/src/core/instructions/withdraw.ts +44 -0
  1184. package/src/core/remainingAccounts.ts +276 -0
  1185. package/src/core/signedMsg.ts +71 -0
  1186. package/src/decode/customCoder.ts +105 -0
  1187. package/src/decode/user.ts +372 -0
  1188. package/src/dlob/DLOB.ts +2098 -0
  1189. package/src/dlob/DLOBNode.ts +193 -0
  1190. package/src/dlob/DLOBSubscriber.ts +211 -0
  1191. package/src/dlob/NodeList.ts +174 -0
  1192. package/src/dlob/orderBookLevels.ts +575 -0
  1193. package/src/dlob/types.ts +22 -0
  1194. package/src/events/eventList.ts +97 -0
  1195. package/src/events/eventSubscriber.ts +382 -0
  1196. package/src/events/eventsServerLogProvider.ts +152 -0
  1197. package/src/events/fetchLogs.ts +169 -0
  1198. package/src/events/parse.ts +248 -0
  1199. package/src/events/pollingLogProvider.ts +89 -0
  1200. package/src/events/sort.ts +39 -0
  1201. package/src/events/txEventCache.ts +74 -0
  1202. package/src/events/types.ts +228 -0
  1203. package/src/events/webSocketLogProvider.ts +121 -0
  1204. package/src/factory/bigNum.ts +709 -0
  1205. package/src/factory/oracleClient.ts +73 -0
  1206. package/src/idl/drift.json +18698 -0
  1207. package/src/idl/drift.ts +23894 -0
  1208. package/src/idl/pyth.json +142 -0
  1209. package/src/idl/pyth.ts +97 -0
  1210. package/src/idl/pyth_solana_receiver.json +628 -0
  1211. package/src/idl/token_faucet.json +229 -0
  1212. package/src/idl/token_faucet.ts +197 -0
  1213. package/src/index.ts +150 -0
  1214. package/src/indicative-quotes/indicativeQuotesSender.ts +233 -0
  1215. package/src/isomorphic/README.md +19 -0
  1216. package/src/isomorphic/anchor.browser.ts +44 -0
  1217. package/src/isomorphic/anchor.node.ts +1 -0
  1218. package/src/isomorphic/anchor.ts +1 -0
  1219. package/src/isomorphic/anchor29.browser.ts +24 -0
  1220. package/src/isomorphic/anchor29.node.ts +1 -0
  1221. package/src/isomorphic/anchor29.ts +1 -0
  1222. package/src/isomorphic/grpc.browser.ts +4 -0
  1223. package/src/isomorphic/grpc.node.ts +130 -0
  1224. package/src/isomorphic/grpc.ts +1 -0
  1225. package/src/jupiter/jupiterClient.ts +482 -0
  1226. package/src/keypair.ts +24 -0
  1227. package/src/margin/README.md +138 -0
  1228. package/src/marginCalculation.ts +255 -0
  1229. package/src/marinade/idl/idl.json +1962 -0
  1230. package/src/marinade/index.ts +64 -0
  1231. package/src/marinade/types.ts +3925 -0
  1232. package/src/math/amm.ts +1246 -0
  1233. package/src/math/auction.ts +374 -0
  1234. package/src/math/bankruptcy.ts +35 -0
  1235. package/src/math/builder.ts +20 -0
  1236. package/src/math/conversion.ts +24 -0
  1237. package/src/math/exchangeStatus.ts +136 -0
  1238. package/src/math/funding.ts +436 -0
  1239. package/src/math/insurance.ts +111 -0
  1240. package/src/math/liquidation.ts +209 -0
  1241. package/src/math/margin.ts +368 -0
  1242. package/src/math/market.ts +438 -0
  1243. package/src/math/oracles.ts +367 -0
  1244. package/src/math/orders.ts +473 -0
  1245. package/src/math/position.ts +340 -0
  1246. package/src/math/repeg.ts +214 -0
  1247. package/src/math/spotBalance.ts +752 -0
  1248. package/src/math/spotMarket.ts +82 -0
  1249. package/src/math/spotPosition.ts +191 -0
  1250. package/src/math/state.ts +48 -0
  1251. package/src/math/superStake.ts +528 -0
  1252. package/src/math/tiers.ts +44 -0
  1253. package/src/math/trade.ts +805 -0
  1254. package/src/math/utils.ts +121 -0
  1255. package/src/memcmp.ts +164 -0
  1256. package/src/oracles/oracleClientCache.ts +25 -0
  1257. package/src/oracles/oracleId.ts +66 -0
  1258. package/src/oracles/prelaunchOracleClient.ts +38 -0
  1259. package/src/oracles/pythClient.ts +85 -0
  1260. package/src/oracles/pythLazerClient.ts +102 -0
  1261. package/src/oracles/quoteAssetOracleClient.ts +25 -0
  1262. package/src/oracles/strictOraclePrice.ts +19 -0
  1263. package/src/oracles/types.ts +37 -0
  1264. package/src/oracles/utils.ts +10 -0
  1265. package/src/orderParams.ts +79 -0
  1266. package/src/orderSubscriber/OrderSubscriber.ts +296 -0
  1267. package/src/orderSubscriber/PollingSubscription.ts +39 -0
  1268. package/src/orderSubscriber/WebsocketSubscription.ts +119 -0
  1269. package/src/orderSubscriber/grpcSubscription.ts +139 -0
  1270. package/src/orderSubscriber/index.ts +7 -0
  1271. package/src/orderSubscriber/types.ts +55 -0
  1272. package/src/priorityFee/averageOverSlotsStrategy.ts +16 -0
  1273. package/src/priorityFee/averageStrategy.ts +12 -0
  1274. package/src/priorityFee/ewmaStrategy.ts +41 -0
  1275. package/src/priorityFee/heliusPriorityFeeMethod.ts +57 -0
  1276. package/src/priorityFee/index.ts +16 -0
  1277. package/src/priorityFee/maxOverSlotsStrategy.ts +17 -0
  1278. package/src/priorityFee/maxStrategy.ts +7 -0
  1279. package/src/priorityFee/priorityFeeSubscriber.ts +256 -0
  1280. package/src/priorityFee/priorityFeeSubscriberMap.ts +125 -0
  1281. package/src/priorityFee/solanaPriorityFeeMethod.ts +34 -0
  1282. package/src/priorityFee/types.ts +64 -0
  1283. package/src/priorityFee/velocityPriorityFeeMethod.ts +54 -0
  1284. package/src/pyth/constants.ts +9 -0
  1285. package/src/pyth/index.ts +15 -0
  1286. package/src/pyth/pythLazerSubscriber.ts +365 -0
  1287. package/src/pyth/types.ts +4453 -0
  1288. package/src/pyth/utils.ts +13 -0
  1289. package/src/slot/SlotSubscriber.ts +108 -0
  1290. package/src/slot/SlothashSubscriber.ts +126 -0
  1291. package/src/swap/UnifiedSwapClient.ts +315 -0
  1292. package/src/swift/grpcSignedMsgUserAccountSubscriber.ts +95 -0
  1293. package/src/swift/index.ts +10 -0
  1294. package/src/swift/signedMsgUserAccountSubscriber.ts +241 -0
  1295. package/src/swift/swiftOrderSubscriber.ts +347 -0
  1296. package/src/testClient.ts +42 -0
  1297. package/src/titan/titanClient.ts +438 -0
  1298. package/src/token/index.ts +13 -0
  1299. package/src/tokenFaucet.ts +274 -0
  1300. package/src/tx/baseTxSender.ts +471 -0
  1301. package/src/tx/blockhashFetcher/baseBlockhashFetcher.ts +19 -0
  1302. package/src/tx/blockhashFetcher/cachedBlockhashFetcher.ts +90 -0
  1303. package/src/tx/blockhashFetcher/types.ts +5 -0
  1304. package/src/tx/fastSingleTxSender.ts +142 -0
  1305. package/src/tx/forwardOnlyTxSender.ts +145 -0
  1306. package/src/tx/priorityFeeCalculator.ts +117 -0
  1307. package/src/tx/reportTransactionError.ts +159 -0
  1308. package/src/tx/retryTxSender.ts +135 -0
  1309. package/src/tx/txHandler.ts +853 -0
  1310. package/src/tx/txParamProcessor.ts +163 -0
  1311. package/src/tx/types.ts +71 -0
  1312. package/src/tx/utils.ts +107 -0
  1313. package/src/tx/whileValidTxSender.ts +266 -0
  1314. package/src/types.ts +1793 -0
  1315. package/src/user.ts +4487 -0
  1316. package/src/userConfig.ts +37 -0
  1317. package/src/userMap/PollingSubscription.ts +47 -0
  1318. package/src/userMap/WebsocketSubscription.ts +84 -0
  1319. package/src/userMap/grpcSubscription.ts +85 -0
  1320. package/src/userMap/referrerMap.ts +267 -0
  1321. package/src/userMap/revenueShareEscrowMap.ts +310 -0
  1322. package/src/userMap/userMap.ts +683 -0
  1323. package/src/userMap/userMapConfig.ts +66 -0
  1324. package/src/userMap/userStatsMap.ts +358 -0
  1325. package/src/userName.ts +21 -0
  1326. package/src/userStats.ts +117 -0
  1327. package/src/userStatsConfig.ts +32 -0
  1328. package/src/util/TransactionConfirmationManager.ts +292 -0
  1329. package/src/util/chainClock.ts +41 -0
  1330. package/src/util/computeUnits.ts +65 -0
  1331. package/src/util/digest.ts +16 -0
  1332. package/src/util/ed25519Utils.ts +85 -0
  1333. package/src/util/promiseTimeout.ts +14 -0
  1334. package/src/util/tps.ts +27 -0
  1335. package/src/velocityClient.ts +11364 -0
  1336. package/src/velocityClientConfig.ts +144 -0
  1337. package/src/wallet.ts +54 -0
  1338. package/tests/DriftCore/decode.test.ts +16 -0
  1339. package/tests/DriftCore/fill_trigger.test.ts +73 -0
  1340. package/tests/DriftCore/instructions.test.ts +46 -0
  1341. package/tests/DriftCore/pdas.test.ts +28 -0
  1342. package/tests/DriftCore/perp_orders.test.ts +205 -0
  1343. package/tests/DriftCore/remainingAccounts.test.ts +73 -0
  1344. package/tests/DriftCore/settlement_liquidation.test.ts +69 -0
  1345. package/tests/accounts/customizedCadenceBulkAccountLoader.test.ts +203 -0
  1346. package/tests/amm/test.ts +2095 -0
  1347. package/tests/auctions/test.ts +81 -0
  1348. package/tests/bn/test.ts +355 -0
  1349. package/tests/ci/verifyConstants.ts +396 -0
  1350. package/tests/decode/phoenix.ts +71 -0
  1351. package/tests/decode/test.ts +262 -0
  1352. package/tests/decode/userAccountBufferStrings.ts +102 -0
  1353. package/tests/dlob/helpers.ts +740 -0
  1354. package/tests/dlob/test.ts +6920 -0
  1355. package/tests/events/parseLogsForCuUsage.ts +139 -0
  1356. package/tests/insurance/test.ts +40 -0
  1357. package/tests/spot/test.ts +226 -0
  1358. package/tests/tx/TransactionConfirmationManager.test.ts +305 -0
  1359. package/tests/tx/cachedBlockhashFetcher.test.ts +96 -0
  1360. package/tests/tx/priorityFeeCalculator.ts +77 -0
  1361. package/tests/tx/priorityFeeStrategy.ts +95 -0
  1362. package/tests/user/getMarginCalculation.ts +361 -0
  1363. package/tests/user/helpers.ts +185 -0
  1364. package/tests/user/liquidations.ts +129 -0
  1365. package/tests/user/marginCalculations.test.ts +321 -0
  1366. package/tests/user/test.ts +826 -0
  1367. package/tsconfig.browser.json +16 -0
  1368. package/tsconfig.json +17 -0
@@ -0,0 +1,853 @@
1
+ /**
2
+ * Transaction building and sending infrastructure.
3
+ *
4
+ * `txHandler.ts` — base class for building versioned/legacy transactions with ALT support.
5
+ * `retryTxSender.ts` — retry loop with confirmation polling (default for most clients).
6
+ * `fastSingleTxSender.ts` — fire-and-forget path for latency-sensitive keeper bots.
7
+ * `priorityFeeCalculator.ts` — computes dynamic priority fees from recent fee estimates.
8
+ * `txParamProcessor.ts` — resolves CU limits and priority fees before send.
9
+ *
10
+ * Transaction sender is injected via VelocityClientConfig; swap implementations to tune
11
+ * confirmation strategy without changing instruction-building code.
12
+ */
13
+ import {
14
+ AddressLookupTableAccount,
15
+ BlockhashWithExpiryBlockHeight,
16
+ Commitment,
17
+ ComputeBudgetProgram,
18
+ ConfirmOptions,
19
+ Connection,
20
+ Message,
21
+ MessageV0,
22
+ Signer,
23
+ SimulatedTransactionResponse,
24
+ Transaction,
25
+ TransactionInstruction,
26
+ TransactionMessage,
27
+ TransactionVersion,
28
+ VersionedTransaction,
29
+ } from '@solana/web3.js';
30
+ import { TransactionParamProcessor } from './txParamProcessor';
31
+ import bs58 from 'bs58';
32
+ import {
33
+ BaseTxParams,
34
+ VelocityClientMetricsEvents,
35
+ IWallet,
36
+ MappedRecord,
37
+ SignedTxData,
38
+ TxParams,
39
+ } from '../types';
40
+ import { containsComputeUnitIxs } from '../util/computeUnits';
41
+ import { CachedBlockhashFetcher } from './blockhashFetcher/cachedBlockhashFetcher';
42
+ import { BaseBlockhashFetcher } from './blockhashFetcher/baseBlockhashFetcher';
43
+ import { BlockhashFetcher } from './blockhashFetcher/types';
44
+ import {
45
+ getSizeOfTransaction,
46
+ isVersionedTransaction,
47
+ MAX_TX_BYTE_SIZE,
48
+ } from './utils';
49
+ import { DEFAULT_CONFIRMATION_OPTS } from '../config';
50
+
51
+ /**
52
+ * Explanation for SIGNATURE_BLOCK_AND_EXPIRY:
53
+ *
54
+ * When the whileValidTxSender waits for confirmation of a given transaction, it needs the last available blockheight and blockhash used in the signature to do so. For pre-signed transactions, these values aren't attached to the transaction object by default. For a "scrappy" workaround which doesn't break backwards compatibility, the SIGNATURE_BLOCK_AND_EXPIRY property is simply attached to the transaction objects as they are created or signed in this handler despite a mismatch in the typescript types. If the values are attached to the transaction when they reach the whileValidTxSender, it can opt-in to use these values.
55
+ */
56
+
57
+ const DEV_TRY_FORCE_TX_TIMEOUTS =
58
+ process.env.DEV_TRY_FORCE_TX_TIMEOUTS === 'true' || false;
59
+
60
+ export const COMPUTE_UNITS_DEFAULT = 200_000;
61
+
62
+ const BLOCKHASH_FETCH_RETRY_COUNT = 3;
63
+ const BLOCKHASH_FETCH_RETRY_SLEEP = 200;
64
+ const RECENT_BLOCKHASH_STALE_TIME_MS = 2_000; // Reuse blockhashes within this timeframe during bursts of tx contruction
65
+
66
+ export type TxBuildingProps = {
67
+ instructions: TransactionInstruction | TransactionInstruction[];
68
+ txVersion: TransactionVersion;
69
+ connection: Connection;
70
+ preFlightCommitment: Commitment;
71
+ fetchAllMarketLookupTableAccounts: () => Promise<AddressLookupTableAccount[]>;
72
+ lookupTables?: AddressLookupTableAccount[];
73
+ forceVersionedTransaction?: boolean;
74
+ txParams?: TxParams;
75
+ recentBlockhash?: BlockhashWithExpiryBlockHeight;
76
+ wallet?: IWallet;
77
+ optionalIxs?: TransactionInstruction[]; // additional instructions to add to the front of ixs if there's enough room, such as oracle cranks
78
+ simulatedTx?: SimulatedTransactionResponse; // we could have pre-simulated the tx and we can use this later to get compute units
79
+ };
80
+
81
+ export type TxHandlerConfig = {
82
+ blockhashCachingEnabled?: boolean;
83
+ blockhashCachingConfig?: {
84
+ retryCount: number;
85
+ retrySleepTimeMs: number;
86
+ staleCacheTimeMs: number;
87
+ };
88
+ };
89
+
90
+ /**
91
+ * This class is responsible for creating and signing transactions.
92
+ */
93
+ export class TxHandler {
94
+ private blockHashToLastValidBlockHeightLookup: Record<string, number> = {};
95
+ private returnBlockHeightsWithSignedTxCallbackData = false;
96
+
97
+ private connection: Connection;
98
+ private wallet: IWallet;
99
+ private confirmationOptions: ConfirmOptions;
100
+
101
+ private preSignedCb?: () => void;
102
+ private onSignedCb?: (
103
+ txSigs: VelocityClientMetricsEvents['txSigned']
104
+ ) => void;
105
+
106
+ private blockhashCommitment: Commitment =
107
+ DEFAULT_CONFIRMATION_OPTS.commitment;
108
+ private blockHashFetcher: BlockhashFetcher;
109
+
110
+ constructor(props: {
111
+ connection: Connection;
112
+ wallet: IWallet;
113
+ confirmationOptions: ConfirmOptions;
114
+ opts?: {
115
+ returnBlockHeightsWithSignedTxCallbackData?: boolean;
116
+ onSignedCb?: (txSigs: VelocityClientMetricsEvents['txSigned']) => void;
117
+ preSignedCb?: () => void;
118
+ };
119
+ config?: TxHandlerConfig;
120
+ }) {
121
+ this.connection = props.connection;
122
+ this.wallet = props.wallet;
123
+ this.confirmationOptions = props.confirmationOptions;
124
+ this.blockhashCommitment =
125
+ props.confirmationOptions?.preflightCommitment ??
126
+ props?.connection?.commitment ??
127
+ this.blockhashCommitment ??
128
+ 'confirmed';
129
+
130
+ this.blockHashFetcher = props?.config?.blockhashCachingEnabled
131
+ ? new CachedBlockhashFetcher(
132
+ this.connection,
133
+ this.blockhashCommitment,
134
+ props?.config?.blockhashCachingConfig?.retryCount ??
135
+ BLOCKHASH_FETCH_RETRY_COUNT,
136
+ props?.config?.blockhashCachingConfig?.retrySleepTimeMs ??
137
+ BLOCKHASH_FETCH_RETRY_SLEEP,
138
+ props?.config?.blockhashCachingConfig?.staleCacheTimeMs ??
139
+ RECENT_BLOCKHASH_STALE_TIME_MS
140
+ )
141
+ : new BaseBlockhashFetcher(this.connection, this.blockhashCommitment);
142
+
143
+ // #Optionals
144
+ this.returnBlockHeightsWithSignedTxCallbackData =
145
+ props.opts?.returnBlockHeightsWithSignedTxCallbackData ?? false;
146
+ this.onSignedCb = props.opts?.onSignedCb;
147
+ this.preSignedCb = props.opts?.preSignedCb;
148
+ }
149
+
150
+ public getWallet() {
151
+ return this.wallet;
152
+ }
153
+
154
+ private addHashAndExpiryToLookup(
155
+ hashAndExpiry: BlockhashWithExpiryBlockHeight
156
+ ) {
157
+ if (!this.returnBlockHeightsWithSignedTxCallbackData) return;
158
+
159
+ this.blockHashToLastValidBlockHeightLookup[hashAndExpiry.blockhash] =
160
+ hashAndExpiry.lastValidBlockHeight;
161
+ }
162
+
163
+ private getProps = (wallet?: IWallet, confirmationOpts?: ConfirmOptions) =>
164
+ [wallet ?? this.wallet, confirmationOpts ?? this.confirmationOptions] as [
165
+ IWallet,
166
+ ConfirmOptions,
167
+ ];
168
+
169
+ public updateWallet(wallet: IWallet) {
170
+ this.wallet = wallet;
171
+ }
172
+
173
+ /**
174
+ * Created this to prevent non-finalized blockhashes being used when building transactions. We want to always use finalized because otherwise it's easy to get the BlockHashNotFound error (RPC uses finalized to validate a transaction). Using an older blockhash when building transactions should never really be a problem right now.
175
+ *
176
+ * https://www.helius.dev/blog/how-to-deal-with-blockhash-errors-on-solana#why-do-blockhash-errors-occur
177
+ *
178
+ * @returns
179
+ */
180
+ public async getLatestBlockhashForTransaction() {
181
+ return this.blockHashFetcher.getLatestBlockhash();
182
+ }
183
+
184
+ /**
185
+ * Applies recent blockhash and signs a given transaction
186
+ * @param tx
187
+ * @param additionalSigners
188
+ * @param wallet
189
+ * @param confirmationOpts
190
+ * @param preSigned
191
+ * @param recentBlockhash
192
+ * @returns
193
+ */
194
+ public async prepareTx(
195
+ tx: Transaction,
196
+ additionalSigners: Array<Signer>,
197
+ wallet?: IWallet,
198
+ confirmationOpts?: ConfirmOptions,
199
+ preSigned?: boolean,
200
+ recentBlockhash?: BlockhashWithExpiryBlockHeight
201
+ ): Promise<Transaction> {
202
+ if (preSigned) {
203
+ return tx;
204
+ }
205
+
206
+ [wallet, confirmationOpts] = this.getProps(wallet, confirmationOpts);
207
+
208
+ tx.feePayer = wallet.publicKey;
209
+ recentBlockhash = recentBlockhash
210
+ ? recentBlockhash
211
+ : await this.getLatestBlockhashForTransaction();
212
+ tx.recentBlockhash = recentBlockhash.blockhash;
213
+
214
+ this.addHashAndExpiryToLookup(recentBlockhash);
215
+
216
+ const signedTx = await this.signTx(tx, additionalSigners);
217
+
218
+ // @ts-ignore
219
+ signedTx.SIGNATURE_BLOCK_AND_EXPIRY = recentBlockhash;
220
+
221
+ return signedTx;
222
+ }
223
+
224
+ private isVersionedTransaction(
225
+ tx: Transaction | VersionedTransaction
226
+ ): boolean {
227
+ return isVersionedTransaction(tx);
228
+ }
229
+
230
+ private isLegacyTransaction(tx: Transaction | VersionedTransaction) {
231
+ return !this.isVersionedTransaction(tx);
232
+ }
233
+
234
+ private getTxSigFromSignedTx(signedTx: Transaction | VersionedTransaction) {
235
+ if (this.isVersionedTransaction(signedTx)) {
236
+ return bs58.encode(
237
+ Buffer.from((signedTx as VersionedTransaction).signatures[0])
238
+ ) as string;
239
+ } else {
240
+ return bs58.encode(
241
+ Buffer.from((signedTx as Transaction).signature)
242
+ ) as string;
243
+ }
244
+ }
245
+
246
+ private getBlockhashFromSignedTx(
247
+ signedTx: Transaction | VersionedTransaction
248
+ ) {
249
+ if (this.isVersionedTransaction(signedTx)) {
250
+ return (signedTx as VersionedTransaction).message.recentBlockhash;
251
+ } else {
252
+ return (signedTx as Transaction).recentBlockhash;
253
+ }
254
+ }
255
+
256
+ private async signTx(
257
+ tx: Transaction,
258
+ additionalSigners: Array<Signer>,
259
+ wallet?: IWallet
260
+ ): Promise<Transaction> {
261
+ [wallet] = this.getProps(wallet);
262
+
263
+ additionalSigners
264
+ .filter((s): s is Signer => s !== undefined)
265
+ .forEach((kp) => {
266
+ tx.partialSign(kp);
267
+ });
268
+
269
+ this.preSignedCb?.();
270
+
271
+ const signedTx = await wallet.signTransaction(tx);
272
+
273
+ // Turn txSig Buffer into base58 string
274
+ const txSig = this.getTxSigFromSignedTx(signedTx);
275
+
276
+ this.handleSignedTxData([
277
+ {
278
+ txSig,
279
+ signedTx,
280
+ blockHash: this.getBlockhashFromSignedTx(signedTx),
281
+ },
282
+ ]);
283
+
284
+ return signedTx;
285
+ }
286
+
287
+ public async signVersionedTx(
288
+ tx: VersionedTransaction,
289
+ additionalSigners: Array<Signer>,
290
+ recentBlockhash?: BlockhashWithExpiryBlockHeight,
291
+ wallet?: IWallet
292
+ ): Promise<VersionedTransaction> {
293
+ [wallet] = this.getProps(wallet);
294
+
295
+ if (recentBlockhash) {
296
+ tx.message.recentBlockhash = recentBlockhash.blockhash;
297
+
298
+ this.addHashAndExpiryToLookup(recentBlockhash);
299
+
300
+ // @ts-ignore
301
+ tx.SIGNATURE_BLOCK_AND_EXPIRY = recentBlockhash;
302
+ }
303
+
304
+ additionalSigners
305
+ ?.filter((s): s is Signer => s !== undefined)
306
+ .forEach((kp) => {
307
+ tx.sign([kp]);
308
+ });
309
+
310
+ this.preSignedCb?.();
311
+
312
+ //@ts-ignore
313
+ const signedTx = (await wallet.signTransaction(tx)) as VersionedTransaction;
314
+
315
+ // Turn txSig Buffer into base58 string
316
+ const txSig = this.getTxSigFromSignedTx(signedTx);
317
+
318
+ this.handleSignedTxData([
319
+ {
320
+ txSig,
321
+ signedTx,
322
+ blockHash: this.getBlockhashFromSignedTx(signedTx),
323
+ },
324
+ ]);
325
+
326
+ return signedTx;
327
+ }
328
+
329
+ private handleSignedTxData(
330
+ txData: Omit<SignedTxData, 'lastValidBlockHeight'>[]
331
+ ) {
332
+ if (!this.returnBlockHeightsWithSignedTxCallbackData) {
333
+ if (this.onSignedCb) {
334
+ this.onSignedCb(txData);
335
+ }
336
+
337
+ return;
338
+ }
339
+
340
+ const signedTxData = txData.map((tx) => {
341
+ const lastValidBlockHeight =
342
+ this.blockHashToLastValidBlockHeightLookup[tx.blockHash];
343
+
344
+ return {
345
+ ...tx,
346
+ lastValidBlockHeight,
347
+ };
348
+ });
349
+
350
+ if (this.onSignedCb) {
351
+ this.onSignedCb(signedTxData);
352
+ }
353
+
354
+ return signedTxData;
355
+ }
356
+
357
+ /**
358
+ * Gets transaction params with extra processing applied, like using the simulated compute units or using a dynamically calculated compute unit price.
359
+ * @param txBuildingProps
360
+ * @returns
361
+ */
362
+ private async getProcessedTransactionParams(
363
+ txBuildingProps: TxBuildingProps
364
+ ): Promise<BaseTxParams> {
365
+ const baseTxParams: BaseTxParams = {
366
+ computeUnits: txBuildingProps?.txParams?.computeUnits,
367
+ computeUnitsPrice: txBuildingProps?.txParams?.computeUnitsPrice,
368
+ };
369
+
370
+ const processedTxParams = await TransactionParamProcessor.process({
371
+ baseTxParams,
372
+ txBuilder: (updatedTxParams) =>
373
+ this.buildTransaction({
374
+ ...txBuildingProps,
375
+ txParams: updatedTxParams.txParams ?? baseTxParams,
376
+ forceVersionedTransaction: true,
377
+ }) as Promise<VersionedTransaction>,
378
+ processConfig: {
379
+ useSimulatedComputeUnits:
380
+ txBuildingProps.txParams.useSimulatedComputeUnits,
381
+ computeUnitsBufferMultiplier:
382
+ txBuildingProps.txParams.computeUnitsBufferMultiplier,
383
+ useSimulatedComputeUnitsForCUPriceCalculation:
384
+ txBuildingProps.txParams
385
+ .useSimulatedComputeUnitsForCUPriceCalculation,
386
+ getCUPriceFromComputeUnits:
387
+ txBuildingProps.txParams.getCUPriceFromComputeUnits,
388
+ },
389
+ processParams: {
390
+ connection: this.connection,
391
+ simulatedTx: txBuildingProps.simulatedTx,
392
+ },
393
+ });
394
+
395
+ return processedTxParams;
396
+ }
397
+
398
+ private _generateVersionedTransaction(
399
+ recentBlockhash: BlockhashWithExpiryBlockHeight,
400
+ message: Message | MessageV0
401
+ ) {
402
+ this.addHashAndExpiryToLookup(recentBlockhash);
403
+
404
+ return new VersionedTransaction(message);
405
+ }
406
+
407
+ public generateLegacyVersionedTransaction(
408
+ recentBlockhash: BlockhashWithExpiryBlockHeight,
409
+ ixs: TransactionInstruction[],
410
+ wallet?: IWallet
411
+ ) {
412
+ [wallet] = this.getProps(wallet);
413
+
414
+ const message = new TransactionMessage({
415
+ payerKey: wallet.publicKey,
416
+ recentBlockhash: recentBlockhash.blockhash,
417
+ instructions: ixs,
418
+ }).compileToLegacyMessage();
419
+
420
+ const tx = this._generateVersionedTransaction(recentBlockhash, message);
421
+
422
+ // @ts-ignore
423
+ tx.SIGNATURE_BLOCK_AND_EXPIRY = recentBlockhash;
424
+
425
+ return tx;
426
+ }
427
+
428
+ public generateVersionedTransaction(
429
+ recentBlockhash: BlockhashWithExpiryBlockHeight,
430
+ ixs: TransactionInstruction[],
431
+ lookupTableAccounts: AddressLookupTableAccount[],
432
+ wallet?: IWallet
433
+ ) {
434
+ [wallet] = this.getProps(wallet);
435
+
436
+ const message = new TransactionMessage({
437
+ payerKey: wallet.publicKey,
438
+ recentBlockhash: recentBlockhash.blockhash,
439
+ instructions: ixs,
440
+ }).compileToV0Message(lookupTableAccounts);
441
+
442
+ const tx = this._generateVersionedTransaction(recentBlockhash, message);
443
+
444
+ // @ts-ignore
445
+ tx.SIGNATURE_BLOCK_AND_EXPIRY = recentBlockhash;
446
+
447
+ return tx;
448
+ }
449
+
450
+ public generateLegacyTransaction(
451
+ ixs: TransactionInstruction[],
452
+ recentBlockhash?: BlockhashWithExpiryBlockHeight
453
+ ) {
454
+ const tx = new Transaction().add(...ixs);
455
+ if (recentBlockhash) {
456
+ tx.recentBlockhash = recentBlockhash.blockhash;
457
+ }
458
+ return tx;
459
+ }
460
+
461
+ /**
462
+ * Accepts multiple instructions and builds a transaction for each. Prevents needing to spam RPC with requests for the same blockhash.
463
+ * @param props
464
+ * @returns
465
+ */
466
+ public async buildBulkTransactions(
467
+ props: Omit<TxBuildingProps, 'instructions'> & {
468
+ instructions: (TransactionInstruction | TransactionInstruction[])[];
469
+ }
470
+ ) {
471
+ const recentBlockhash =
472
+ props?.recentBlockhash ?? (await this.getLatestBlockhashForTransaction());
473
+
474
+ return await Promise.all(
475
+ props.instructions.map((ix) => {
476
+ if (!ix) return undefined;
477
+ return this.buildTransaction({
478
+ ...props,
479
+ instructions: ix,
480
+ recentBlockhash,
481
+ });
482
+ })
483
+ );
484
+ }
485
+
486
+ /**
487
+ *
488
+ * @param instructions
489
+ * @param txParams
490
+ * @param txVersion
491
+ * @param lookupTables
492
+ * @param forceVersionedTransaction Return a VersionedTransaction instance even if the version of the transaction is Legacy
493
+ * @returns
494
+ */
495
+ public async buildTransaction(
496
+ props: TxBuildingProps
497
+ ): Promise<Transaction | VersionedTransaction> {
498
+ const {
499
+ txVersion,
500
+ txParams,
501
+ connection: _connection,
502
+ preFlightCommitment: _preFlightCommitment,
503
+ fetchAllMarketLookupTableAccounts,
504
+ forceVersionedTransaction,
505
+ instructions,
506
+ } = props;
507
+
508
+ let { lookupTables } = props;
509
+
510
+ const marketLookupTables = await fetchAllMarketLookupTableAccounts();
511
+
512
+ // Combine and filter out any null/undefined lookup tables
513
+ const combinedLookupTables = lookupTables
514
+ ? [...lookupTables, ...marketLookupTables]
515
+ : marketLookupTables;
516
+ lookupTables = combinedLookupTables.filter(
517
+ (table): table is AddressLookupTableAccount =>
518
+ table !== null && table !== undefined
519
+ );
520
+
521
+ // # Collect and process Tx Params
522
+ let baseTxParams: BaseTxParams = {
523
+ computeUnits: txParams?.computeUnits,
524
+ computeUnitsPrice: txParams?.computeUnitsPrice,
525
+ };
526
+
527
+ const instructionsArray = Array.isArray(instructions)
528
+ ? instructions
529
+ : [instructions];
530
+
531
+ let instructionsToUse: TransactionInstruction[];
532
+ let simulatedTx: SimulatedTransactionResponse | undefined;
533
+ // add optional ixs if there's room and it doesn't fail simulation (usually oracle cranks)
534
+ if (props.optionalIxs && txVersion === 0) {
535
+ [instructionsToUse, simulatedTx] =
536
+ await this.simulateAndCalculateInstructions(
537
+ {
538
+ ...props,
539
+ instructions: instructionsArray,
540
+ txVersion,
541
+ lookupTables,
542
+ },
543
+ props.optionalIxs,
544
+ txVersion === 0,
545
+ lookupTables
546
+ );
547
+ } else {
548
+ instructionsToUse = instructionsArray;
549
+ }
550
+
551
+ if (txParams?.useSimulatedComputeUnits) {
552
+ const processedTxParams = await this.getProcessedTransactionParams({
553
+ ...props,
554
+ instructions: instructionsToUse,
555
+ simulatedTx: simulatedTx,
556
+ });
557
+
558
+ baseTxParams = {
559
+ ...baseTxParams,
560
+ ...processedTxParams,
561
+ };
562
+ }
563
+
564
+ const { hasSetComputeUnitLimitIx, hasSetComputeUnitPriceIx } =
565
+ containsComputeUnitIxs(instructionsToUse);
566
+
567
+ // # Create Tx Instructions
568
+ const allIx = [];
569
+ const computeUnits = baseTxParams?.computeUnits;
570
+ if (computeUnits > 0 && !hasSetComputeUnitLimitIx) {
571
+ allIx.push(
572
+ ComputeBudgetProgram.setComputeUnitLimit({
573
+ units: computeUnits,
574
+ })
575
+ );
576
+ }
577
+
578
+ const computeUnitsPrice = baseTxParams?.computeUnitsPrice;
579
+
580
+ if (DEV_TRY_FORCE_TX_TIMEOUTS) {
581
+ allIx.push(
582
+ ComputeBudgetProgram.setComputeUnitPrice({
583
+ microLamports: 0,
584
+ })
585
+ );
586
+ } else if (computeUnitsPrice > 0 && !hasSetComputeUnitPriceIx) {
587
+ allIx.push(
588
+ ComputeBudgetProgram.setComputeUnitPrice({
589
+ microLamports: computeUnitsPrice,
590
+ })
591
+ );
592
+ }
593
+
594
+ allIx.push(...instructionsToUse);
595
+
596
+ const recentBlockhash =
597
+ props?.recentBlockhash ?? (await this.getLatestBlockhashForTransaction());
598
+
599
+ // # Create and return Transaction
600
+ if (txVersion === 'legacy') {
601
+ if (forceVersionedTransaction) {
602
+ return this.generateLegacyVersionedTransaction(recentBlockhash, allIx);
603
+ } else {
604
+ return this.generateLegacyTransaction(allIx, recentBlockhash);
605
+ }
606
+ } else {
607
+ return this.generateVersionedTransaction(
608
+ recentBlockhash,
609
+ allIx,
610
+ lookupTables
611
+ );
612
+ }
613
+ }
614
+
615
+ public wrapInTx(
616
+ instruction: TransactionInstruction,
617
+ computeUnits = 600_000,
618
+ computeUnitsPrice = 0
619
+ ): Transaction {
620
+ const tx = new Transaction();
621
+ if (computeUnits != COMPUTE_UNITS_DEFAULT) {
622
+ tx.add(
623
+ ComputeBudgetProgram.setComputeUnitLimit({
624
+ units: computeUnits,
625
+ })
626
+ );
627
+ }
628
+
629
+ if (DEV_TRY_FORCE_TX_TIMEOUTS) {
630
+ tx.add(
631
+ ComputeBudgetProgram.setComputeUnitPrice({
632
+ microLamports: 0,
633
+ })
634
+ );
635
+ } else if (computeUnitsPrice != 0) {
636
+ tx.add(
637
+ ComputeBudgetProgram.setComputeUnitPrice({
638
+ microLamports: computeUnitsPrice,
639
+ })
640
+ );
641
+ }
642
+
643
+ return tx.add(instruction);
644
+ }
645
+
646
+ /**
647
+ * Get a map of signed and prepared transactions from an array of legacy transactions
648
+ * @param txsToSign
649
+ * @param keys
650
+ * @param wallet
651
+ * @param commitment
652
+ * @returns
653
+ */
654
+ public async getPreparedAndSignedLegacyTransactionMap<
655
+ T extends Record<string, Transaction | undefined>,
656
+ >(
657
+ txsMap: T,
658
+ wallet?: IWallet,
659
+ commitment?: Commitment,
660
+ recentBlockhash?: BlockhashWithExpiryBlockHeight
661
+ ) {
662
+ recentBlockhash = recentBlockhash
663
+ ? recentBlockhash
664
+ : await this.getLatestBlockhashForTransaction();
665
+
666
+ this.addHashAndExpiryToLookup(recentBlockhash);
667
+
668
+ for (const tx of Object.values(txsMap)) {
669
+ if (!tx) continue;
670
+ tx.recentBlockhash = recentBlockhash.blockhash;
671
+ tx.feePayer = wallet?.publicKey ?? this.wallet?.publicKey;
672
+
673
+ // @ts-ignore
674
+ tx.SIGNATURE_BLOCK_AND_EXPIRY = recentBlockhash;
675
+ }
676
+
677
+ return this.getSignedTransactionMap(txsMap, wallet);
678
+ }
679
+
680
+ /**
681
+ * Get a map of signed transactions from an array of transactions to sign.
682
+ * @param txsToSign
683
+ * @param keys
684
+ * @param wallet
685
+ * @returns
686
+ */
687
+ public async getSignedTransactionMap<
688
+ T extends Record<string, Transaction | VersionedTransaction | undefined>,
689
+ >(
690
+ txsToSignMap: T,
691
+ wallet?: IWallet
692
+ ): Promise<{
693
+ signedTxMap: T;
694
+ signedTxData: SignedTxData[];
695
+ }> {
696
+ [wallet] = this.getProps(wallet);
697
+
698
+ const txsToSignEntries = Object.entries(txsToSignMap);
699
+
700
+ // Create a map of the same keys as the input map, but with the values set to undefined. We'll populate the filtered (non-undefined) values with signed transactions.
701
+ const signedTxMap = txsToSignEntries.reduce((acc, [key]) => {
702
+ acc[key] = undefined;
703
+ return acc;
704
+ }, {}) as T;
705
+
706
+ const filteredTxEntries = txsToSignEntries.filter(([_, tx]) => !!tx);
707
+
708
+ // Extra handling for legacy transactions
709
+ for (const [_key, tx] of filteredTxEntries) {
710
+ if (this.isLegacyTransaction(tx)) {
711
+ (tx as Transaction).feePayer = wallet.publicKey;
712
+ }
713
+ }
714
+
715
+ this.preSignedCb?.();
716
+
717
+ const signedFilteredTxs = await wallet.signAllTransactions(
718
+ filteredTxEntries.map(([_, tx]) => tx as Transaction)
719
+ );
720
+
721
+ signedFilteredTxs.forEach((signedTx, index) => {
722
+ // @ts-ignore
723
+ signedTx.SIGNATURE_BLOCK_AND_EXPIRY =
724
+ // @ts-ignore
725
+ filteredTxEntries[index][1]?.SIGNATURE_BLOCK_AND_EXPIRY;
726
+ });
727
+
728
+ const signedTxData = this.handleSignedTxData(
729
+ signedFilteredTxs.map((signedTx) => {
730
+ return {
731
+ txSig: this.getTxSigFromSignedTx(signedTx),
732
+ signedTx,
733
+ blockHash: this.getBlockhashFromSignedTx(signedTx),
734
+ };
735
+ })
736
+ );
737
+
738
+ filteredTxEntries.forEach(([key], index) => {
739
+ const signedTx = signedFilteredTxs[index];
740
+ // @ts-ignore
741
+ signedTxMap[key] = signedTx;
742
+ });
743
+
744
+ return { signedTxMap, signedTxData };
745
+ }
746
+
747
+ /**
748
+ * Accepts multiple instructions and builds a transaction for each. Prevents needing to spam RPC with requests for the same blockhash.
749
+ * @param props
750
+ * @returns
751
+ */
752
+ public async buildTransactionsMap<
753
+ T extends Record<string, TransactionInstruction | TransactionInstruction[]>,
754
+ >(
755
+ props: Omit<TxBuildingProps, 'instructions'> & {
756
+ instructionsMap: T;
757
+ }
758
+ ): Promise<MappedRecord<T, Transaction | VersionedTransaction>> {
759
+ const builtTxs = await this.buildBulkTransactions({
760
+ ...props,
761
+ instructions: Object.values(props.instructionsMap),
762
+ });
763
+
764
+ return Object.keys(props.instructionsMap).reduce((acc, key, index) => {
765
+ acc[key] = builtTxs[index];
766
+ return acc;
767
+ }, {}) as MappedRecord<T, Transaction | VersionedTransaction>;
768
+ }
769
+
770
+ /**
771
+ * Builds and signs transactions from a given array of instructions for multiple transactions.
772
+ * @param props
773
+ * @returns
774
+ */
775
+ public async buildAndSignTransactionMap<
776
+ T extends Record<string, TransactionInstruction | TransactionInstruction[]>,
777
+ >(
778
+ props: Omit<TxBuildingProps, 'instructions'> & {
779
+ instructionsMap: T;
780
+ }
781
+ ) {
782
+ const builtTxs = await this.buildTransactionsMap(props);
783
+
784
+ const preppedTransactions = await (props.txVersion === 'legacy'
785
+ ? this.getPreparedAndSignedLegacyTransactionMap(
786
+ builtTxs as Record<string, Transaction>,
787
+ props.wallet,
788
+ props.preFlightCommitment
789
+ )
790
+ : this.getSignedTransactionMap(builtTxs, props.wallet));
791
+
792
+ return preppedTransactions;
793
+ }
794
+
795
+ public async simulateAndCalculateInstructions(
796
+ txBuildingProps: TxBuildingProps,
797
+ optionalInstructions: TransactionInstruction[] = [],
798
+ versionedTransaction = true,
799
+ addressLookupTables: AddressLookupTableAccount[] = []
800
+ ): Promise<
801
+ [TransactionInstruction[], SimulatedTransactionResponse | undefined]
802
+ > {
803
+ const baseInstructions = Array.isArray(txBuildingProps.instructions)
804
+ ? txBuildingProps.instructions
805
+ : [txBuildingProps.instructions];
806
+ if (optionalInstructions.length === 0) {
807
+ return [baseInstructions, undefined];
808
+ }
809
+
810
+ let allInstructions = [...optionalInstructions, ...baseInstructions];
811
+
812
+ let txSize = getSizeOfTransaction(
813
+ allInstructions,
814
+ versionedTransaction,
815
+ addressLookupTables
816
+ );
817
+
818
+ while (
819
+ txSize > MAX_TX_BYTE_SIZE &&
820
+ allInstructions.length > baseInstructions.length
821
+ ) {
822
+ allInstructions = allInstructions.slice(1);
823
+ txSize = getSizeOfTransaction(
824
+ allInstructions,
825
+ versionedTransaction,
826
+ addressLookupTables
827
+ );
828
+ }
829
+
830
+ const tx = await this.buildTransaction({
831
+ ...txBuildingProps,
832
+ optionalIxs: undefined,
833
+ instructions: allInstructions,
834
+ });
835
+
836
+ const simulatedTx = await this.connection.simulateTransaction(
837
+ tx as VersionedTransaction
838
+ );
839
+
840
+ if (simulatedTx.value?.err) {
841
+ const tx = await this.buildTransaction({
842
+ ...txBuildingProps,
843
+ optionalIxs: undefined,
844
+ instructions: baseInstructions,
845
+ });
846
+ const simulationWithoutOptionalIxs =
847
+ await this.connection.simulateTransaction(tx as VersionedTransaction);
848
+ return [baseInstructions, simulationWithoutOptionalIxs.value];
849
+ }
850
+
851
+ return [allInstructions, simulatedTx.value];
852
+ }
853
+ }