@drift-labs/sdk-browser 2.104.0-beta.21

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 (935) hide show
  1. package/README.md +276 -0
  2. package/VERSION +1 -0
  3. package/bun.lockb +0 -0
  4. package/get_events.ts +47 -0
  5. package/lib/browser/accounts/basicUserAccountSubscriber.d.ts +27 -0
  6. package/lib/browser/accounts/basicUserAccountSubscriber.js +38 -0
  7. package/lib/browser/accounts/bulkAccountLoader.d.ts +37 -0
  8. package/lib/browser/accounts/bulkAccountLoader.js +222 -0
  9. package/lib/browser/accounts/bulkUserStatsSubscription.d.ts +7 -0
  10. package/lib/browser/accounts/bulkUserStatsSubscription.js +21 -0
  11. package/lib/browser/accounts/bulkUserSubscription.d.ts +7 -0
  12. package/lib/browser/accounts/bulkUserSubscription.js +21 -0
  13. package/lib/browser/accounts/fetch.d.ts +6 -0
  14. package/lib/browser/accounts/fetch.js +30 -0
  15. package/lib/browser/accounts/grpcAccountSubscriber.d.ts +16 -0
  16. package/lib/browser/accounts/grpcAccountSubscriber.js +154 -0
  17. package/lib/browser/accounts/grpcDriftClientAccountSubscriber.d.ts +12 -0
  18. package/lib/browser/accounts/grpcDriftClientAccountSubscriber.js +98 -0
  19. package/lib/browser/accounts/grpcInsuranceFundStakeAccountSubscriber.d.ts +10 -0
  20. package/lib/browser/accounts/grpcInsuranceFundStakeAccountSubscriber.js +30 -0
  21. package/lib/browser/accounts/grpcProgramAccountSubscriber.d.ts +18 -0
  22. package/lib/browser/accounts/grpcProgramAccountSubscriber.js +171 -0
  23. package/lib/browser/accounts/grpcUserAccountSubscriber.d.ts +10 -0
  24. package/lib/browser/accounts/grpcUserAccountSubscriber.js +28 -0
  25. package/lib/browser/accounts/grpcUserStatsAccountSubscriber.d.ts +10 -0
  26. package/lib/browser/accounts/grpcUserStatsAccountSubscriber.js +28 -0
  27. package/lib/browser/accounts/oneShotUserAccountSubscriber.d.ts +18 -0
  28. package/lib/browser/accounts/oneShotUserAccountSubscriber.js +48 -0
  29. package/lib/browser/accounts/pollingDriftClientAccountSubscriber.d.ts +69 -0
  30. package/lib/browser/accounts/pollingDriftClientAccountSubscriber.js +418 -0
  31. package/lib/browser/accounts/pollingHighLeverageModeConfigAccountSubscriber.d.ts +29 -0
  32. package/lib/browser/accounts/pollingHighLeverageModeConfigAccountSubscriber.js +111 -0
  33. package/lib/browser/accounts/pollingInsuranceFundStakeAccountSubscriber.d.ts +29 -0
  34. package/lib/browser/accounts/pollingInsuranceFundStakeAccountSubscriber.js +110 -0
  35. package/lib/browser/accounts/pollingOracleAccountSubscriber.d.ts +27 -0
  36. package/lib/browser/accounts/pollingOracleAccountSubscriber.js +78 -0
  37. package/lib/browser/accounts/pollingTokenAccountSubscriber.d.ts +26 -0
  38. package/lib/browser/accounts/pollingTokenAccountSubscriber.js +78 -0
  39. package/lib/browser/accounts/pollingUserAccountSubscriber.d.ts +29 -0
  40. package/lib/browser/accounts/pollingUserAccountSubscriber.js +102 -0
  41. package/lib/browser/accounts/pollingUserStatsAccountSubscriber.d.ts +27 -0
  42. package/lib/browser/accounts/pollingUserStatsAccountSubscriber.js +94 -0
  43. package/lib/browser/accounts/testBulkAccountLoader.d.ts +4 -0
  44. package/lib/browser/accounts/testBulkAccountLoader.js +45 -0
  45. package/lib/browser/accounts/types.d.ts +168 -0
  46. package/lib/browser/accounts/types.js +16 -0
  47. package/lib/browser/accounts/utils.d.ts +8 -0
  48. package/lib/browser/accounts/utils.js +49 -0
  49. package/lib/browser/accounts/webSocketAccountSubscriber.d.ts +29 -0
  50. package/lib/browser/accounts/webSocketAccountSubscriber.js +149 -0
  51. package/lib/browser/accounts/webSocketDriftClientAccountSubscriber.d.ts +66 -0
  52. package/lib/browser/accounts/webSocketDriftClientAccountSubscriber.js +358 -0
  53. package/lib/browser/accounts/webSocketHighLeverageModeConfigAccountSubscriber.d.ts +23 -0
  54. package/lib/browser/accounts/webSocketHighLeverageModeConfigAccountSubscriber.js +69 -0
  55. package/lib/browser/accounts/webSocketInsuranceFundStakeAccountSubscriber.d.ts +23 -0
  56. package/lib/browser/accounts/webSocketInsuranceFundStakeAccountSubscriber.js +67 -0
  57. package/lib/browser/accounts/webSocketProgramAccountSubscriber.d.ts +32 -0
  58. package/lib/browser/accounts/webSocketProgramAccountSubscriber.js +120 -0
  59. package/lib/browser/accounts/webSocketUserAccountSubscriber.d.ts +23 -0
  60. package/lib/browser/accounts/webSocketUserAccountSubscriber.js +61 -0
  61. package/lib/browser/accounts/webSocketUserStatsAccountSubsriber.d.ts +22 -0
  62. package/lib/browser/accounts/webSocketUserStatsAccountSubsriber.js +52 -0
  63. package/lib/browser/addresses/marketAddresses.d.ts +2 -0
  64. package/lib/browser/addresses/marketAddresses.js +15 -0
  65. package/lib/browser/addresses/pda.d.ts +32 -0
  66. package/lib/browser/addresses/pda.js +211 -0
  67. package/lib/browser/adminClient.d.ts +206 -0
  68. package/lib/browser/adminClient.js +1858 -0
  69. package/lib/browser/assert/assert.d.ts +1 -0
  70. package/lib/browser/assert/assert.js +9 -0
  71. package/lib/browser/auctionSubscriber/auctionSubscriber.d.ts +14 -0
  72. package/lib/browser/auctionSubscriber/auctionSubscriber.js +32 -0
  73. package/lib/browser/auctionSubscriber/auctionSubscriberGrpc.d.ts +15 -0
  74. package/lib/browser/auctionSubscriber/auctionSubscriberGrpc.js +32 -0
  75. package/lib/browser/auctionSubscriber/index.d.ts +3 -0
  76. package/lib/browser/auctionSubscriber/index.js +19 -0
  77. package/lib/browser/auctionSubscriber/types.d.ts +14 -0
  78. package/lib/browser/auctionSubscriber/types.js +2 -0
  79. package/lib/browser/bankrun/bankrunConnection.d.ts +75 -0
  80. package/lib/browser/bankrun/bankrunConnection.js +332 -0
  81. package/lib/browser/blockhashSubscriber/BlockhashSubscriber.d.ts +27 -0
  82. package/lib/browser/blockhashSubscriber/BlockhashSubscriber.js +89 -0
  83. package/lib/browser/blockhashSubscriber/index.d.ts +1 -0
  84. package/lib/browser/blockhashSubscriber/index.js +17 -0
  85. package/lib/browser/blockhashSubscriber/types.d.ts +7 -0
  86. package/lib/browser/blockhashSubscriber/types.js +2 -0
  87. package/lib/browser/clock/clockSubscriber.d.ts +31 -0
  88. package/lib/browser/clock/clockSubscriber.js +80 -0
  89. package/lib/browser/config.d.ts +60 -0
  90. package/lib/browser/config.js +130 -0
  91. package/lib/browser/constants/numericConstants.d.ts +71 -0
  92. package/lib/browser/constants/numericConstants.js +75 -0
  93. package/lib/browser/constants/perpMarkets.d.ts +19 -0
  94. package/lib/browser/constants/perpMarkets.js +997 -0
  95. package/lib/browser/constants/spotMarkets.d.ts +24 -0
  96. package/lib/browser/constants/spotMarkets.js +470 -0
  97. package/lib/browser/constants/txConstants.d.ts +1 -0
  98. package/lib/browser/constants/txConstants.js +4 -0
  99. package/lib/browser/decode/phoenix.d.ts +7 -0
  100. package/lib/browser/decode/phoenix.js +159 -0
  101. package/lib/browser/decode/user.d.ts +4 -0
  102. package/lib/browser/decode/user.js +339 -0
  103. package/lib/browser/dlob/DLOB.d.ts +186 -0
  104. package/lib/browser/dlob/DLOB.js +1039 -0
  105. package/lib/browser/dlob/DLOBNode.d.ts +68 -0
  106. package/lib/browser/dlob/DLOBNode.js +100 -0
  107. package/lib/browser/dlob/DLOBSubscriber.d.ts +54 -0
  108. package/lib/browser/dlob/DLOBSubscriber.js +139 -0
  109. package/lib/browser/dlob/NodeList.d.ts +25 -0
  110. package/lib/browser/dlob/NodeList.js +126 -0
  111. package/lib/browser/dlob/orderBookLevels.d.ts +72 -0
  112. package/lib/browser/dlob/orderBookLevels.js +438 -0
  113. package/lib/browser/dlob/types.d.ts +18 -0
  114. package/lib/browser/dlob/types.js +2 -0
  115. package/lib/browser/driftClient.d.ts +861 -0
  116. package/lib/browser/driftClient.js +4768 -0
  117. package/lib/browser/driftClientConfig.d.ts +49 -0
  118. package/lib/browser/driftClientConfig.js +2 -0
  119. package/lib/browser/events/eventList.d.ts +22 -0
  120. package/lib/browser/events/eventList.js +80 -0
  121. package/lib/browser/events/eventSubscriber.d.ts +46 -0
  122. package/lib/browser/events/eventSubscriber.js +223 -0
  123. package/lib/browser/events/eventsServerLogProvider.d.ts +21 -0
  124. package/lib/browser/events/eventsServerLogProvider.js +121 -0
  125. package/lib/browser/events/fetchLogs.d.ts +25 -0
  126. package/lib/browser/events/fetchLogs.js +99 -0
  127. package/lib/browser/events/parse.d.ts +6 -0
  128. package/lib/browser/events/parse.js +106 -0
  129. package/lib/browser/events/pollingLogProvider.d.ts +17 -0
  130. package/lib/browser/events/pollingLogProvider.js +58 -0
  131. package/lib/browser/events/sort.d.ts +2 -0
  132. package/lib/browser/events/sort.js +24 -0
  133. package/lib/browser/events/txEventCache.d.ts +24 -0
  134. package/lib/browser/events/txEventCache.js +71 -0
  135. package/lib/browser/events/types.d.ts +79 -0
  136. package/lib/browser/events/types.js +32 -0
  137. package/lib/browser/events/webSocketLogProvider.d.ts +24 -0
  138. package/lib/browser/events/webSocketLogProvider.js +96 -0
  139. package/lib/browser/factory/bigNum.d.ts +122 -0
  140. package/lib/browser/factory/bigNum.js +457 -0
  141. package/lib/browser/factory/oracleClient.d.ts +5 -0
  142. package/lib/browser/factory/oracleClient.js +56 -0
  143. package/lib/browser/idl/drift.json +14440 -0
  144. package/lib/browser/idl/openbook.json +3854 -0
  145. package/lib/browser/idl/pyth_solana_receiver.json +628 -0
  146. package/lib/browser/idl/switchboard.json +8354 -0
  147. package/lib/browser/idl/switchboard_on_demand_30.json +4546 -0
  148. package/lib/browser/idl/token_faucet.json +142 -0
  149. package/lib/browser/index.d.ts +125 -0
  150. package/lib/browser/index.js +147 -0
  151. package/lib/browser/isomorphic/grpc.browser.d.ts +1 -0
  152. package/lib/browser/isomorphic/grpc.browser.js +8 -0
  153. package/lib/browser/isomorphic/grpc.d.ts +1 -0
  154. package/lib/browser/isomorphic/grpc.js +8 -0
  155. package/lib/browser/jupiter/jupiterClient.d.ts +302 -0
  156. package/lib/browser/jupiter/jupiterClient.js +178 -0
  157. package/lib/browser/keypair.d.ts +2 -0
  158. package/lib/browser/keypair.js +28 -0
  159. package/lib/browser/marinade/index.d.ts +12 -0
  160. package/lib/browser/marinade/index.js +36 -0
  161. package/lib/browser/marinade/types.d.ts +1963 -0
  162. package/lib/browser/marinade/types.js +1965 -0
  163. package/lib/browser/math/amm.d.ts +98 -0
  164. package/lib/browser/math/amm.js +626 -0
  165. package/lib/browser/math/auction.d.ts +23 -0
  166. package/lib/browser/math/auction.js +130 -0
  167. package/lib/browser/math/bankruptcy.d.ts +2 -0
  168. package/lib/browser/math/bankruptcy.js +31 -0
  169. package/lib/browser/math/conversion.d.ts +2 -0
  170. package/lib/browser/math/conversion.js +11 -0
  171. package/lib/browser/math/exchangeStatus.d.ts +6 -0
  172. package/lib/browser/math/exchangeStatus.js +77 -0
  173. package/lib/browser/math/fuel.d.ts +6 -0
  174. package/lib/browser/math/fuel.js +55 -0
  175. package/lib/browser/math/funding.d.ts +34 -0
  176. package/lib/browser/math/funding.js +209 -0
  177. package/lib/browser/math/insurance.d.ts +7 -0
  178. package/lib/browser/math/insurance.js +73 -0
  179. package/lib/browser/math/margin.d.ts +39 -0
  180. package/lib/browser/math/margin.js +184 -0
  181. package/lib/browser/math/market.d.ts +39 -0
  182. package/lib/browser/math/market.js +163 -0
  183. package/lib/browser/math/oracles.d.ts +14 -0
  184. package/lib/browser/math/oracles.js +134 -0
  185. package/lib/browser/math/orders.d.ts +23 -0
  186. package/lib/browser/math/orders.js +216 -0
  187. package/lib/browser/math/position.d.ts +70 -0
  188. package/lib/browser/math/position.js +225 -0
  189. package/lib/browser/math/repeg.d.ts +22 -0
  190. package/lib/browser/math/repeg.js +164 -0
  191. package/lib/browser/math/spotBalance.d.ts +83 -0
  192. package/lib/browser/math/spotBalance.js +373 -0
  193. package/lib/browser/math/spotMarket.d.ts +11 -0
  194. package/lib/browser/math/spotMarket.js +49 -0
  195. package/lib/browser/math/spotPosition.d.ts +19 -0
  196. package/lib/browser/math/spotPosition.js +78 -0
  197. package/lib/browser/math/state.d.ts +5 -0
  198. package/lib/browser/math/state.js +30 -0
  199. package/lib/browser/math/superStake.d.ts +167 -0
  200. package/lib/browser/math/superStake.js +306 -0
  201. package/lib/browser/math/tiers.d.ts +4 -0
  202. package/lib/browser/math/tiers.js +52 -0
  203. package/lib/browser/math/trade.d.ts +117 -0
  204. package/lib/browser/math/trade.js +637 -0
  205. package/lib/browser/math/userStatus.d.ts +2 -0
  206. package/lib/browser/math/userStatus.js +8 -0
  207. package/lib/browser/math/utils.d.ts +23 -0
  208. package/lib/browser/math/utils.js +112 -0
  209. package/lib/browser/memcmp.d.ts +11 -0
  210. package/lib/browser/memcmp.js +99 -0
  211. package/lib/browser/openbook/openbookV2FulfillmentConfigMap.d.ts +10 -0
  212. package/lib/browser/openbook/openbookV2FulfillmentConfigMap.js +17 -0
  213. package/lib/browser/openbook/openbookV2Subscriber.d.ts +36 -0
  214. package/lib/browser/openbook/openbookV2Subscriber.js +104 -0
  215. package/lib/browser/oracles/oracleClientCache.d.ts +9 -0
  216. package/lib/browser/oracles/oracleClientCache.js +19 -0
  217. package/lib/browser/oracles/oracleId.d.ts +4 -0
  218. package/lib/browser/oracles/oracleId.js +38 -0
  219. package/lib/browser/oracles/prelaunchOracleClient.d.ts +12 -0
  220. package/lib/browser/oracles/prelaunchOracleClient.js +24 -0
  221. package/lib/browser/oracles/pythClient.d.ts +14 -0
  222. package/lib/browser/oracles/pythClient.js +51 -0
  223. package/lib/browser/oracles/pythLazerClient.d.ts +16 -0
  224. package/lib/browser/oracles/pythLazerClient.js +61 -0
  225. package/lib/browser/oracles/pythPullClient.d.ts +19 -0
  226. package/lib/browser/oracles/pythPullClient.js +60 -0
  227. package/lib/browser/oracles/quoteAssetOracleClient.d.ts +10 -0
  228. package/lib/browser/oracles/quoteAssetOracleClient.js +21 -0
  229. package/lib/browser/oracles/strictOraclePrice.d.ts +9 -0
  230. package/lib/browser/oracles/strictOraclePrice.js +17 -0
  231. package/lib/browser/oracles/switchboardClient.d.ts +12 -0
  232. package/lib/browser/oracles/switchboardClient.js +40 -0
  233. package/lib/browser/oracles/switchboardOnDemandClient.d.ts +12 -0
  234. package/lib/browser/oracles/switchboardOnDemandClient.js +32 -0
  235. package/lib/browser/oracles/types.d.ts +23 -0
  236. package/lib/browser/oracles/types.js +2 -0
  237. package/lib/browser/orderParams.d.ts +29 -0
  238. package/lib/browser/orderParams.js +44 -0
  239. package/lib/browser/orderSubscriber/OrderSubscriber.d.ts +42 -0
  240. package/lib/browser/orderSubscriber/OrderSubscriber.js +172 -0
  241. package/lib/browser/orderSubscriber/PollingSubscription.d.ts +12 -0
  242. package/lib/browser/orderSubscriber/PollingSubscription.js +23 -0
  243. package/lib/browser/orderSubscriber/WebsocketSubscription.d.ts +23 -0
  244. package/lib/browser/orderSubscriber/WebsocketSubscription.js +67 -0
  245. package/lib/browser/orderSubscriber/grpcSubscription.d.ts +22 -0
  246. package/lib/browser/orderSubscriber/grpcSubscription.js +66 -0
  247. package/lib/browser/orderSubscriber/index.d.ts +2 -0
  248. package/lib/browser/orderSubscriber/index.js +18 -0
  249. package/lib/browser/orderSubscriber/types.d.ts +34 -0
  250. package/lib/browser/orderSubscriber/types.js +2 -0
  251. package/lib/browser/phoenix/phoenixFulfillmentConfigMap.d.ts +10 -0
  252. package/lib/browser/phoenix/phoenixFulfillmentConfigMap.js +17 -0
  253. package/lib/browser/phoenix/phoenixSubscriber.d.ts +41 -0
  254. package/lib/browser/phoenix/phoenixSubscriber.js +152 -0
  255. package/lib/browser/priorityFee/averageOverSlotsStrategy.d.ts +5 -0
  256. package/lib/browser/priorityFee/averageOverSlotsStrategy.js +16 -0
  257. package/lib/browser/priorityFee/averageStrategy.d.ts +5 -0
  258. package/lib/browser/priorityFee/averageStrategy.js +11 -0
  259. package/lib/browser/priorityFee/driftPriorityFeeMethod.d.ts +13 -0
  260. package/lib/browser/priorityFee/driftPriorityFeeMethod.js +26 -0
  261. package/lib/browser/priorityFee/ewmaStrategy.d.ts +11 -0
  262. package/lib/browser/priorityFee/ewmaStrategy.js +33 -0
  263. package/lib/browser/priorityFee/heliusPriorityFeeMethod.d.ts +20 -0
  264. package/lib/browser/priorityFee/heliusPriorityFeeMethod.js +46 -0
  265. package/lib/browser/priorityFee/index.d.ts +11 -0
  266. package/lib/browser/priorityFee/index.js +27 -0
  267. package/lib/browser/priorityFee/maxOverSlotsStrategy.d.ts +5 -0
  268. package/lib/browser/priorityFee/maxOverSlotsStrategy.js +17 -0
  269. package/lib/browser/priorityFee/maxStrategy.d.ts +7 -0
  270. package/lib/browser/priorityFee/maxStrategy.js +9 -0
  271. package/lib/browser/priorityFee/priorityFeeSubscriber.d.ts +46 -0
  272. package/lib/browser/priorityFee/priorityFeeSubscriber.js +188 -0
  273. package/lib/browser/priorityFee/priorityFeeSubscriberMap.d.ts +48 -0
  274. package/lib/browser/priorityFee/priorityFeeSubscriberMap.js +88 -0
  275. package/lib/browser/priorityFee/solanaPriorityFeeMethod.d.ts +6 -0
  276. package/lib/browser/priorityFee/solanaPriorityFeeMethod.js +21 -0
  277. package/lib/browser/priorityFee/types.d.ts +31 -0
  278. package/lib/browser/priorityFee/types.js +10 -0
  279. package/lib/browser/serum/serumFulfillmentConfigMap.d.ts +10 -0
  280. package/lib/browser/serum/serumFulfillmentConfigMap.js +17 -0
  281. package/lib/browser/serum/serumSubscriber.d.ts +32 -0
  282. package/lib/browser/serum/serumSubscriber.js +107 -0
  283. package/lib/browser/serum/types.d.ts +13 -0
  284. package/lib/browser/serum/types.js +2 -0
  285. package/lib/browser/slot/SlotSubscriber.d.ts +27 -0
  286. package/lib/browser/slot/SlotSubscriber.js +71 -0
  287. package/lib/browser/slot/SlothashSubscriber.d.ts +26 -0
  288. package/lib/browser/slot/SlothashSubscriber.js +85 -0
  289. package/lib/browser/testClient.d.ts +8 -0
  290. package/lib/browser/testClient.js +23 -0
  291. package/lib/browser/token/index.d.ts +5 -0
  292. package/lib/browser/token/index.js +15 -0
  293. package/lib/browser/tokenFaucet.d.ts +41 -0
  294. package/lib/browser/tokenFaucet.js +188 -0
  295. package/lib/browser/tx/baseTxSender.d.ts +59 -0
  296. package/lib/browser/tx/baseTxSender.js +294 -0
  297. package/lib/browser/tx/blockhashFetcher/baseBlockhashFetcher.d.ts +8 -0
  298. package/lib/browser/tx/blockhashFetcher/baseBlockhashFetcher.js +13 -0
  299. package/lib/browser/tx/blockhashFetcher/cachedBlockhashFetcher.d.ts +28 -0
  300. package/lib/browser/tx/blockhashFetcher/cachedBlockhashFetcher.js +73 -0
  301. package/lib/browser/tx/blockhashFetcher/types.d.ts +4 -0
  302. package/lib/browser/tx/blockhashFetcher/types.js +2 -0
  303. package/lib/browser/tx/fastSingleTxSender.d.ts +41 -0
  304. package/lib/browser/tx/fastSingleTxSender.js +86 -0
  305. package/lib/browser/tx/forwardOnlyTxSender.d.ts +37 -0
  306. package/lib/browser/tx/forwardOnlyTxSender.js +92 -0
  307. package/lib/browser/tx/priorityFeeCalculator.d.ts +44 -0
  308. package/lib/browser/tx/priorityFeeCalculator.js +85 -0
  309. package/lib/browser/tx/reportTransactionError.d.ts +20 -0
  310. package/lib/browser/tx/reportTransactionError.js +103 -0
  311. package/lib/browser/tx/retryTxSender.d.ts +37 -0
  312. package/lib/browser/tx/retryTxSender.js +86 -0
  313. package/lib/browser/tx/txHandler.d.ts +154 -0
  314. package/lib/browser/tx/txHandler.js +453 -0
  315. package/lib/browser/tx/txParamProcessor.d.ts +25 -0
  316. package/lib/browser/tx/txParamProcessor.js +88 -0
  317. package/lib/browser/tx/types.d.ts +29 -0
  318. package/lib/browser/tx/types.js +20 -0
  319. package/lib/browser/tx/utils.d.ts +2 -0
  320. package/lib/browser/tx/utils.js +10 -0
  321. package/lib/browser/tx/whileValidTxSender.d.ts +45 -0
  322. package/lib/browser/tx/whileValidTxSender.js +167 -0
  323. package/lib/browser/types.d.ts +1385 -0
  324. package/lib/browser/types.js +366 -0
  325. package/lib/browser/user.d.ts +411 -0
  326. package/lib/browser/user.js +2151 -0
  327. package/lib/browser/userConfig.d.ts +26 -0
  328. package/lib/browser/userConfig.js +2 -0
  329. package/lib/browser/userMap/PollingSubscription.d.ts +16 -0
  330. package/lib/browser/userMap/PollingSubscription.js +30 -0
  331. package/lib/browser/userMap/WebsocketSubscription.d.ts +27 -0
  332. package/lib/browser/userMap/WebsocketSubscription.js +45 -0
  333. package/lib/browser/userMap/grpcSubscription.d.ts +27 -0
  334. package/lib/browser/userMap/grpcSubscription.js +44 -0
  335. package/lib/browser/userMap/referrerMap.d.ts +45 -0
  336. package/lib/browser/userMap/referrerMap.js +181 -0
  337. package/lib/browser/userMap/userMap.d.ts +90 -0
  338. package/lib/browser/userMap/userMap.js +467 -0
  339. package/lib/browser/userMap/userMapConfig.d.ts +39 -0
  340. package/lib/browser/userMap/userMapConfig.js +2 -0
  341. package/lib/browser/userMap/userStatsMap.d.ts +46 -0
  342. package/lib/browser/userMap/userStatsMap.js +165 -0
  343. package/lib/browser/userName.d.ts +5 -0
  344. package/lib/browser/userName.js +21 -0
  345. package/lib/browser/userStats.d.ts +22 -0
  346. package/lib/browser/userStats.js +91 -0
  347. package/lib/browser/userStatsConfig.d.ts +25 -0
  348. package/lib/browser/userStatsConfig.js +2 -0
  349. package/lib/browser/util/TransactionConfirmationManager.d.ts +16 -0
  350. package/lib/browser/util/TransactionConfirmationManager.js +174 -0
  351. package/lib/browser/util/chainClock.d.ts +17 -0
  352. package/lib/browser/util/chainClock.js +29 -0
  353. package/lib/browser/util/computeUnits.d.ts +8 -0
  354. package/lib/browser/util/computeUnits.js +48 -0
  355. package/lib/browser/util/digest.d.ts +4 -0
  356. package/lib/browser/util/digest.js +14 -0
  357. package/lib/browser/util/promiseTimeout.d.ts +1 -0
  358. package/lib/browser/util/promiseTimeout.js +14 -0
  359. package/lib/browser/util/pythOracleUtils.d.ts +17 -0
  360. package/lib/browser/util/pythOracleUtils.js +107 -0
  361. package/lib/browser/util/tps.d.ts +2 -0
  362. package/lib/browser/util/tps.js +16 -0
  363. package/lib/browser/wallet.d.ts +11 -0
  364. package/lib/browser/wallet.js +32 -0
  365. package/lib/node/accounts/basicUserAccountSubscriber.d.ts +27 -0
  366. package/lib/node/accounts/basicUserAccountSubscriber.js +38 -0
  367. package/lib/node/accounts/bulkAccountLoader.d.ts +37 -0
  368. package/lib/node/accounts/bulkAccountLoader.js +222 -0
  369. package/lib/node/accounts/bulkUserStatsSubscription.d.ts +7 -0
  370. package/lib/node/accounts/bulkUserStatsSubscription.js +21 -0
  371. package/lib/node/accounts/bulkUserSubscription.d.ts +7 -0
  372. package/lib/node/accounts/bulkUserSubscription.js +21 -0
  373. package/lib/node/accounts/fetch.d.ts +6 -0
  374. package/lib/node/accounts/fetch.js +30 -0
  375. package/lib/node/accounts/grpcAccountSubscriber.d.ts +16 -0
  376. package/lib/node/accounts/grpcAccountSubscriber.js +154 -0
  377. package/lib/node/accounts/grpcDriftClientAccountSubscriber.d.ts +12 -0
  378. package/lib/node/accounts/grpcDriftClientAccountSubscriber.js +98 -0
  379. package/lib/node/accounts/grpcInsuranceFundStakeAccountSubscriber.d.ts +10 -0
  380. package/lib/node/accounts/grpcInsuranceFundStakeAccountSubscriber.js +30 -0
  381. package/lib/node/accounts/grpcProgramAccountSubscriber.d.ts +18 -0
  382. package/lib/node/accounts/grpcProgramAccountSubscriber.js +171 -0
  383. package/lib/node/accounts/grpcUserAccountSubscriber.d.ts +10 -0
  384. package/lib/node/accounts/grpcUserAccountSubscriber.js +28 -0
  385. package/lib/node/accounts/grpcUserStatsAccountSubscriber.d.ts +10 -0
  386. package/lib/node/accounts/grpcUserStatsAccountSubscriber.js +28 -0
  387. package/lib/node/accounts/oneShotUserAccountSubscriber.d.ts +18 -0
  388. package/lib/node/accounts/oneShotUserAccountSubscriber.js +48 -0
  389. package/lib/node/accounts/pollingDriftClientAccountSubscriber.d.ts +69 -0
  390. package/lib/node/accounts/pollingDriftClientAccountSubscriber.js +418 -0
  391. package/lib/node/accounts/pollingHighLeverageModeConfigAccountSubscriber.d.ts +29 -0
  392. package/lib/node/accounts/pollingHighLeverageModeConfigAccountSubscriber.js +111 -0
  393. package/lib/node/accounts/pollingInsuranceFundStakeAccountSubscriber.d.ts +29 -0
  394. package/lib/node/accounts/pollingInsuranceFundStakeAccountSubscriber.js +110 -0
  395. package/lib/node/accounts/pollingOracleAccountSubscriber.d.ts +27 -0
  396. package/lib/node/accounts/pollingOracleAccountSubscriber.js +78 -0
  397. package/lib/node/accounts/pollingTokenAccountSubscriber.d.ts +26 -0
  398. package/lib/node/accounts/pollingTokenAccountSubscriber.js +78 -0
  399. package/lib/node/accounts/pollingUserAccountSubscriber.d.ts +29 -0
  400. package/lib/node/accounts/pollingUserAccountSubscriber.js +102 -0
  401. package/lib/node/accounts/pollingUserStatsAccountSubscriber.d.ts +27 -0
  402. package/lib/node/accounts/pollingUserStatsAccountSubscriber.js +94 -0
  403. package/lib/node/accounts/testBulkAccountLoader.d.ts +4 -0
  404. package/lib/node/accounts/testBulkAccountLoader.js +45 -0
  405. package/lib/node/accounts/types.d.ts +168 -0
  406. package/lib/node/accounts/types.js +16 -0
  407. package/lib/node/accounts/utils.d.ts +8 -0
  408. package/lib/node/accounts/utils.js +49 -0
  409. package/lib/node/accounts/webSocketAccountSubscriber.d.ts +29 -0
  410. package/lib/node/accounts/webSocketAccountSubscriber.js +149 -0
  411. package/lib/node/accounts/webSocketDriftClientAccountSubscriber.d.ts +66 -0
  412. package/lib/node/accounts/webSocketDriftClientAccountSubscriber.js +358 -0
  413. package/lib/node/accounts/webSocketHighLeverageModeConfigAccountSubscriber.d.ts +23 -0
  414. package/lib/node/accounts/webSocketHighLeverageModeConfigAccountSubscriber.js +69 -0
  415. package/lib/node/accounts/webSocketInsuranceFundStakeAccountSubscriber.d.ts +23 -0
  416. package/lib/node/accounts/webSocketInsuranceFundStakeAccountSubscriber.js +67 -0
  417. package/lib/node/accounts/webSocketProgramAccountSubscriber.d.ts +32 -0
  418. package/lib/node/accounts/webSocketProgramAccountSubscriber.js +120 -0
  419. package/lib/node/accounts/webSocketUserAccountSubscriber.d.ts +23 -0
  420. package/lib/node/accounts/webSocketUserAccountSubscriber.js +61 -0
  421. package/lib/node/accounts/webSocketUserStatsAccountSubsriber.d.ts +22 -0
  422. package/lib/node/accounts/webSocketUserStatsAccountSubsriber.js +52 -0
  423. package/lib/node/addresses/marketAddresses.d.ts +2 -0
  424. package/lib/node/addresses/marketAddresses.js +15 -0
  425. package/lib/node/addresses/pda.d.ts +32 -0
  426. package/lib/node/addresses/pda.js +211 -0
  427. package/lib/node/adminClient.d.ts +206 -0
  428. package/lib/node/adminClient.js +1858 -0
  429. package/lib/node/assert/assert.d.ts +1 -0
  430. package/lib/node/assert/assert.js +9 -0
  431. package/lib/node/auctionSubscriber/auctionSubscriber.d.ts +14 -0
  432. package/lib/node/auctionSubscriber/auctionSubscriber.js +32 -0
  433. package/lib/node/auctionSubscriber/auctionSubscriberGrpc.d.ts +15 -0
  434. package/lib/node/auctionSubscriber/auctionSubscriberGrpc.js +32 -0
  435. package/lib/node/auctionSubscriber/index.d.ts +3 -0
  436. package/lib/node/auctionSubscriber/index.js +19 -0
  437. package/lib/node/auctionSubscriber/types.d.ts +14 -0
  438. package/lib/node/auctionSubscriber/types.js +2 -0
  439. package/lib/node/bankrun/bankrunConnection.d.ts +75 -0
  440. package/lib/node/bankrun/bankrunConnection.js +332 -0
  441. package/lib/node/blockhashSubscriber/BlockhashSubscriber.d.ts +27 -0
  442. package/lib/node/blockhashSubscriber/BlockhashSubscriber.js +89 -0
  443. package/lib/node/blockhashSubscriber/index.d.ts +1 -0
  444. package/lib/node/blockhashSubscriber/index.js +17 -0
  445. package/lib/node/blockhashSubscriber/types.d.ts +7 -0
  446. package/lib/node/blockhashSubscriber/types.js +2 -0
  447. package/lib/node/clock/clockSubscriber.d.ts +31 -0
  448. package/lib/node/clock/clockSubscriber.js +80 -0
  449. package/lib/node/config.d.ts +60 -0
  450. package/lib/node/config.js +130 -0
  451. package/lib/node/constants/numericConstants.d.ts +71 -0
  452. package/lib/node/constants/numericConstants.js +75 -0
  453. package/lib/node/constants/perpMarkets.d.ts +19 -0
  454. package/lib/node/constants/perpMarkets.js +997 -0
  455. package/lib/node/constants/spotMarkets.d.ts +24 -0
  456. package/lib/node/constants/spotMarkets.js +470 -0
  457. package/lib/node/constants/txConstants.d.ts +1 -0
  458. package/lib/node/constants/txConstants.js +4 -0
  459. package/lib/node/decode/phoenix.d.ts +7 -0
  460. package/lib/node/decode/phoenix.js +159 -0
  461. package/lib/node/decode/user.d.ts +4 -0
  462. package/lib/node/decode/user.js +339 -0
  463. package/lib/node/dlob/DLOB.d.ts +186 -0
  464. package/lib/node/dlob/DLOB.js +1039 -0
  465. package/lib/node/dlob/DLOBNode.d.ts +68 -0
  466. package/lib/node/dlob/DLOBNode.js +100 -0
  467. package/lib/node/dlob/DLOBSubscriber.d.ts +54 -0
  468. package/lib/node/dlob/DLOBSubscriber.js +139 -0
  469. package/lib/node/dlob/NodeList.d.ts +25 -0
  470. package/lib/node/dlob/NodeList.js +126 -0
  471. package/lib/node/dlob/orderBookLevels.d.ts +72 -0
  472. package/lib/node/dlob/orderBookLevels.js +438 -0
  473. package/lib/node/dlob/types.d.ts +18 -0
  474. package/lib/node/dlob/types.js +2 -0
  475. package/lib/node/driftClient.d.ts +861 -0
  476. package/lib/node/driftClient.js +4768 -0
  477. package/lib/node/driftClientConfig.d.ts +49 -0
  478. package/lib/node/driftClientConfig.js +2 -0
  479. package/lib/node/events/eventList.d.ts +22 -0
  480. package/lib/node/events/eventList.js +80 -0
  481. package/lib/node/events/eventSubscriber.d.ts +46 -0
  482. package/lib/node/events/eventSubscriber.js +223 -0
  483. package/lib/node/events/eventsServerLogProvider.d.ts +21 -0
  484. package/lib/node/events/eventsServerLogProvider.js +121 -0
  485. package/lib/node/events/fetchLogs.d.ts +25 -0
  486. package/lib/node/events/fetchLogs.js +99 -0
  487. package/lib/node/events/parse.d.ts +6 -0
  488. package/lib/node/events/parse.js +106 -0
  489. package/lib/node/events/pollingLogProvider.d.ts +17 -0
  490. package/lib/node/events/pollingLogProvider.js +58 -0
  491. package/lib/node/events/sort.d.ts +2 -0
  492. package/lib/node/events/sort.js +24 -0
  493. package/lib/node/events/txEventCache.d.ts +24 -0
  494. package/lib/node/events/txEventCache.js +71 -0
  495. package/lib/node/events/types.d.ts +79 -0
  496. package/lib/node/events/types.js +32 -0
  497. package/lib/node/events/webSocketLogProvider.d.ts +24 -0
  498. package/lib/node/events/webSocketLogProvider.js +96 -0
  499. package/lib/node/factory/bigNum.d.ts +122 -0
  500. package/lib/node/factory/bigNum.js +457 -0
  501. package/lib/node/factory/oracleClient.d.ts +5 -0
  502. package/lib/node/factory/oracleClient.js +56 -0
  503. package/lib/node/idl/drift.json +14440 -0
  504. package/lib/node/idl/openbook.json +3854 -0
  505. package/lib/node/idl/pyth_solana_receiver.json +628 -0
  506. package/lib/node/idl/switchboard.json +8354 -0
  507. package/lib/node/idl/switchboard_on_demand_30.json +4546 -0
  508. package/lib/node/idl/token_faucet.json +142 -0
  509. package/lib/node/index.d.ts +125 -0
  510. package/lib/node/index.js +147 -0
  511. package/lib/node/isomorphic/grpc.browser.d.ts +1 -0
  512. package/lib/node/isomorphic/grpc.browser.js +8 -0
  513. package/lib/node/isomorphic/grpc.d.ts +1 -0
  514. package/lib/node/isomorphic/grpc.js +8 -0
  515. package/lib/node/jupiter/jupiterClient.d.ts +302 -0
  516. package/lib/node/jupiter/jupiterClient.js +178 -0
  517. package/lib/node/keypair.d.ts +2 -0
  518. package/lib/node/keypair.js +28 -0
  519. package/lib/node/marinade/index.d.ts +12 -0
  520. package/lib/node/marinade/index.js +36 -0
  521. package/lib/node/marinade/types.d.ts +1963 -0
  522. package/lib/node/marinade/types.js +1965 -0
  523. package/lib/node/math/amm.d.ts +98 -0
  524. package/lib/node/math/amm.js +626 -0
  525. package/lib/node/math/auction.d.ts +23 -0
  526. package/lib/node/math/auction.js +130 -0
  527. package/lib/node/math/bankruptcy.d.ts +2 -0
  528. package/lib/node/math/bankruptcy.js +31 -0
  529. package/lib/node/math/conversion.d.ts +2 -0
  530. package/lib/node/math/conversion.js +11 -0
  531. package/lib/node/math/exchangeStatus.d.ts +6 -0
  532. package/lib/node/math/exchangeStatus.js +77 -0
  533. package/lib/node/math/fuel.d.ts +6 -0
  534. package/lib/node/math/fuel.js +55 -0
  535. package/lib/node/math/funding.d.ts +34 -0
  536. package/lib/node/math/funding.js +209 -0
  537. package/lib/node/math/insurance.d.ts +7 -0
  538. package/lib/node/math/insurance.js +73 -0
  539. package/lib/node/math/margin.d.ts +39 -0
  540. package/lib/node/math/margin.js +184 -0
  541. package/lib/node/math/market.d.ts +39 -0
  542. package/lib/node/math/market.js +163 -0
  543. package/lib/node/math/oracles.d.ts +14 -0
  544. package/lib/node/math/oracles.js +134 -0
  545. package/lib/node/math/orders.d.ts +23 -0
  546. package/lib/node/math/orders.js +216 -0
  547. package/lib/node/math/position.d.ts +70 -0
  548. package/lib/node/math/position.js +225 -0
  549. package/lib/node/math/repeg.d.ts +22 -0
  550. package/lib/node/math/repeg.js +164 -0
  551. package/lib/node/math/spotBalance.d.ts +83 -0
  552. package/lib/node/math/spotBalance.js +373 -0
  553. package/lib/node/math/spotMarket.d.ts +11 -0
  554. package/lib/node/math/spotMarket.js +49 -0
  555. package/lib/node/math/spotPosition.d.ts +19 -0
  556. package/lib/node/math/spotPosition.js +78 -0
  557. package/lib/node/math/state.d.ts +5 -0
  558. package/lib/node/math/state.js +30 -0
  559. package/lib/node/math/superStake.d.ts +167 -0
  560. package/lib/node/math/superStake.js +306 -0
  561. package/lib/node/math/tiers.d.ts +4 -0
  562. package/lib/node/math/tiers.js +52 -0
  563. package/lib/node/math/trade.d.ts +117 -0
  564. package/lib/node/math/trade.js +637 -0
  565. package/lib/node/math/userStatus.d.ts +2 -0
  566. package/lib/node/math/userStatus.js +8 -0
  567. package/lib/node/math/utils.d.ts +23 -0
  568. package/lib/node/math/utils.js +112 -0
  569. package/lib/node/memcmp.d.ts +11 -0
  570. package/lib/node/memcmp.js +99 -0
  571. package/lib/node/openbook/openbookV2FulfillmentConfigMap.d.ts +10 -0
  572. package/lib/node/openbook/openbookV2FulfillmentConfigMap.js +17 -0
  573. package/lib/node/openbook/openbookV2Subscriber.d.ts +36 -0
  574. package/lib/node/openbook/openbookV2Subscriber.js +104 -0
  575. package/lib/node/oracles/oracleClientCache.d.ts +9 -0
  576. package/lib/node/oracles/oracleClientCache.js +19 -0
  577. package/lib/node/oracles/oracleId.d.ts +4 -0
  578. package/lib/node/oracles/oracleId.js +38 -0
  579. package/lib/node/oracles/prelaunchOracleClient.d.ts +12 -0
  580. package/lib/node/oracles/prelaunchOracleClient.js +24 -0
  581. package/lib/node/oracles/pythClient.d.ts +14 -0
  582. package/lib/node/oracles/pythClient.js +51 -0
  583. package/lib/node/oracles/pythLazerClient.d.ts +16 -0
  584. package/lib/node/oracles/pythLazerClient.js +61 -0
  585. package/lib/node/oracles/pythPullClient.d.ts +19 -0
  586. package/lib/node/oracles/pythPullClient.js +60 -0
  587. package/lib/node/oracles/quoteAssetOracleClient.d.ts +10 -0
  588. package/lib/node/oracles/quoteAssetOracleClient.js +21 -0
  589. package/lib/node/oracles/strictOraclePrice.d.ts +9 -0
  590. package/lib/node/oracles/strictOraclePrice.js +17 -0
  591. package/lib/node/oracles/switchboardClient.d.ts +12 -0
  592. package/lib/node/oracles/switchboardClient.js +40 -0
  593. package/lib/node/oracles/switchboardOnDemandClient.d.ts +12 -0
  594. package/lib/node/oracles/switchboardOnDemandClient.js +32 -0
  595. package/lib/node/oracles/types.d.ts +23 -0
  596. package/lib/node/oracles/types.js +2 -0
  597. package/lib/node/orderParams.d.ts +29 -0
  598. package/lib/node/orderParams.js +44 -0
  599. package/lib/node/orderSubscriber/OrderSubscriber.d.ts +42 -0
  600. package/lib/node/orderSubscriber/OrderSubscriber.js +172 -0
  601. package/lib/node/orderSubscriber/PollingSubscription.d.ts +12 -0
  602. package/lib/node/orderSubscriber/PollingSubscription.js +23 -0
  603. package/lib/node/orderSubscriber/WebsocketSubscription.d.ts +23 -0
  604. package/lib/node/orderSubscriber/WebsocketSubscription.js +67 -0
  605. package/lib/node/orderSubscriber/grpcSubscription.d.ts +22 -0
  606. package/lib/node/orderSubscriber/grpcSubscription.js +66 -0
  607. package/lib/node/orderSubscriber/index.d.ts +2 -0
  608. package/lib/node/orderSubscriber/index.js +18 -0
  609. package/lib/node/orderSubscriber/types.d.ts +34 -0
  610. package/lib/node/orderSubscriber/types.js +2 -0
  611. package/lib/node/phoenix/phoenixFulfillmentConfigMap.d.ts +10 -0
  612. package/lib/node/phoenix/phoenixFulfillmentConfigMap.js +17 -0
  613. package/lib/node/phoenix/phoenixSubscriber.d.ts +41 -0
  614. package/lib/node/phoenix/phoenixSubscriber.js +152 -0
  615. package/lib/node/priorityFee/averageOverSlotsStrategy.d.ts +5 -0
  616. package/lib/node/priorityFee/averageOverSlotsStrategy.js +16 -0
  617. package/lib/node/priorityFee/averageStrategy.d.ts +5 -0
  618. package/lib/node/priorityFee/averageStrategy.js +11 -0
  619. package/lib/node/priorityFee/driftPriorityFeeMethod.d.ts +13 -0
  620. package/lib/node/priorityFee/driftPriorityFeeMethod.js +26 -0
  621. package/lib/node/priorityFee/ewmaStrategy.d.ts +11 -0
  622. package/lib/node/priorityFee/ewmaStrategy.js +33 -0
  623. package/lib/node/priorityFee/heliusPriorityFeeMethod.d.ts +20 -0
  624. package/lib/node/priorityFee/heliusPriorityFeeMethod.js +46 -0
  625. package/lib/node/priorityFee/index.d.ts +11 -0
  626. package/lib/node/priorityFee/index.js +27 -0
  627. package/lib/node/priorityFee/maxOverSlotsStrategy.d.ts +5 -0
  628. package/lib/node/priorityFee/maxOverSlotsStrategy.js +17 -0
  629. package/lib/node/priorityFee/maxStrategy.d.ts +7 -0
  630. package/lib/node/priorityFee/maxStrategy.js +9 -0
  631. package/lib/node/priorityFee/priorityFeeSubscriber.d.ts +46 -0
  632. package/lib/node/priorityFee/priorityFeeSubscriber.js +188 -0
  633. package/lib/node/priorityFee/priorityFeeSubscriberMap.d.ts +48 -0
  634. package/lib/node/priorityFee/priorityFeeSubscriberMap.js +88 -0
  635. package/lib/node/priorityFee/solanaPriorityFeeMethod.d.ts +6 -0
  636. package/lib/node/priorityFee/solanaPriorityFeeMethod.js +21 -0
  637. package/lib/node/priorityFee/types.d.ts +31 -0
  638. package/lib/node/priorityFee/types.js +10 -0
  639. package/lib/node/serum/serumFulfillmentConfigMap.d.ts +10 -0
  640. package/lib/node/serum/serumFulfillmentConfigMap.js +17 -0
  641. package/lib/node/serum/serumSubscriber.d.ts +32 -0
  642. package/lib/node/serum/serumSubscriber.js +107 -0
  643. package/lib/node/serum/types.d.ts +13 -0
  644. package/lib/node/serum/types.js +2 -0
  645. package/lib/node/slot/SlotSubscriber.d.ts +27 -0
  646. package/lib/node/slot/SlotSubscriber.js +71 -0
  647. package/lib/node/slot/SlothashSubscriber.d.ts +26 -0
  648. package/lib/node/slot/SlothashSubscriber.js +85 -0
  649. package/lib/node/testClient.d.ts +8 -0
  650. package/lib/node/testClient.js +23 -0
  651. package/lib/node/token/index.d.ts +5 -0
  652. package/lib/node/token/index.js +15 -0
  653. package/lib/node/tokenFaucet.d.ts +41 -0
  654. package/lib/node/tokenFaucet.js +188 -0
  655. package/lib/node/tx/baseTxSender.d.ts +59 -0
  656. package/lib/node/tx/baseTxSender.js +294 -0
  657. package/lib/node/tx/blockhashFetcher/baseBlockhashFetcher.d.ts +8 -0
  658. package/lib/node/tx/blockhashFetcher/baseBlockhashFetcher.js +13 -0
  659. package/lib/node/tx/blockhashFetcher/cachedBlockhashFetcher.d.ts +28 -0
  660. package/lib/node/tx/blockhashFetcher/cachedBlockhashFetcher.js +73 -0
  661. package/lib/node/tx/blockhashFetcher/types.d.ts +4 -0
  662. package/lib/node/tx/blockhashFetcher/types.js +2 -0
  663. package/lib/node/tx/fastSingleTxSender.d.ts +41 -0
  664. package/lib/node/tx/fastSingleTxSender.js +86 -0
  665. package/lib/node/tx/forwardOnlyTxSender.d.ts +37 -0
  666. package/lib/node/tx/forwardOnlyTxSender.js +92 -0
  667. package/lib/node/tx/priorityFeeCalculator.d.ts +44 -0
  668. package/lib/node/tx/priorityFeeCalculator.js +85 -0
  669. package/lib/node/tx/reportTransactionError.d.ts +20 -0
  670. package/lib/node/tx/reportTransactionError.js +103 -0
  671. package/lib/node/tx/retryTxSender.d.ts +37 -0
  672. package/lib/node/tx/retryTxSender.js +86 -0
  673. package/lib/node/tx/txHandler.d.ts +154 -0
  674. package/lib/node/tx/txHandler.js +453 -0
  675. package/lib/node/tx/txParamProcessor.d.ts +25 -0
  676. package/lib/node/tx/txParamProcessor.js +88 -0
  677. package/lib/node/tx/types.d.ts +29 -0
  678. package/lib/node/tx/types.js +20 -0
  679. package/lib/node/tx/utils.d.ts +2 -0
  680. package/lib/node/tx/utils.js +10 -0
  681. package/lib/node/tx/whileValidTxSender.d.ts +45 -0
  682. package/lib/node/tx/whileValidTxSender.js +167 -0
  683. package/lib/node/types.d.ts +1385 -0
  684. package/lib/node/types.js +366 -0
  685. package/lib/node/user.d.ts +411 -0
  686. package/lib/node/user.js +2151 -0
  687. package/lib/node/userConfig.d.ts +26 -0
  688. package/lib/node/userConfig.js +2 -0
  689. package/lib/node/userMap/PollingSubscription.d.ts +16 -0
  690. package/lib/node/userMap/PollingSubscription.js +30 -0
  691. package/lib/node/userMap/WebsocketSubscription.d.ts +27 -0
  692. package/lib/node/userMap/WebsocketSubscription.js +45 -0
  693. package/lib/node/userMap/grpcSubscription.d.ts +27 -0
  694. package/lib/node/userMap/grpcSubscription.js +44 -0
  695. package/lib/node/userMap/referrerMap.d.ts +45 -0
  696. package/lib/node/userMap/referrerMap.js +181 -0
  697. package/lib/node/userMap/userMap.d.ts +90 -0
  698. package/lib/node/userMap/userMap.js +467 -0
  699. package/lib/node/userMap/userMapConfig.d.ts +39 -0
  700. package/lib/node/userMap/userMapConfig.js +2 -0
  701. package/lib/node/userMap/userStatsMap.d.ts +46 -0
  702. package/lib/node/userMap/userStatsMap.js +165 -0
  703. package/lib/node/userName.d.ts +5 -0
  704. package/lib/node/userName.js +21 -0
  705. package/lib/node/userStats.d.ts +22 -0
  706. package/lib/node/userStats.js +91 -0
  707. package/lib/node/userStatsConfig.d.ts +25 -0
  708. package/lib/node/userStatsConfig.js +2 -0
  709. package/lib/node/util/TransactionConfirmationManager.d.ts +16 -0
  710. package/lib/node/util/TransactionConfirmationManager.js +174 -0
  711. package/lib/node/util/chainClock.d.ts +17 -0
  712. package/lib/node/util/chainClock.js +29 -0
  713. package/lib/node/util/computeUnits.d.ts +8 -0
  714. package/lib/node/util/computeUnits.js +48 -0
  715. package/lib/node/util/digest.d.ts +4 -0
  716. package/lib/node/util/digest.js +14 -0
  717. package/lib/node/util/promiseTimeout.d.ts +1 -0
  718. package/lib/node/util/promiseTimeout.js +14 -0
  719. package/lib/node/util/pythOracleUtils.d.ts +17 -0
  720. package/lib/node/util/pythOracleUtils.js +107 -0
  721. package/lib/node/util/tps.d.ts +2 -0
  722. package/lib/node/util/tps.js +16 -0
  723. package/lib/node/wallet.d.ts +11 -0
  724. package/lib/node/wallet.js +32 -0
  725. package/package.json +92 -0
  726. package/scripts/postbuild.js +95 -0
  727. package/scripts/updateVersion.js +28 -0
  728. package/src/accounts/basicUserAccountSubscriber.ts +59 -0
  729. package/src/accounts/bulkAccountLoader.ts +294 -0
  730. package/src/accounts/bulkUserStatsSubscription.ts +33 -0
  731. package/src/accounts/bulkUserSubscription.ts +33 -0
  732. package/src/accounts/fetch.ts +66 -0
  733. package/src/accounts/grpcAccountSubscriber.ts +160 -0
  734. package/src/accounts/grpcDriftClientAccountSubscriber.ts +203 -0
  735. package/src/accounts/grpcInsuranceFundStakeAccountSubscriber.ts +56 -0
  736. package/src/accounts/grpcProgramAccountSubscriber.ts +190 -0
  737. package/src/accounts/grpcUserAccountSubscriber.ts +48 -0
  738. package/src/accounts/grpcUserStatsAccountSubscriber.ts +50 -0
  739. package/src/accounts/oneShotUserAccountSubscriber.ts +68 -0
  740. package/src/accounts/pollingDriftClientAccountSubscriber.ts +644 -0
  741. package/src/accounts/pollingHighLeverageModeConfigAccountSubscriber.ts +189 -0
  742. package/src/accounts/pollingInsuranceFundStakeAccountSubscriber.ts +185 -0
  743. package/src/accounts/pollingOracleAccountSubscriber.ts +125 -0
  744. package/src/accounts/pollingTokenAccountSubscriber.ts +118 -0
  745. package/src/accounts/pollingUserAccountSubscriber.ts +160 -0
  746. package/src/accounts/pollingUserStatsAccountSubscriber.ts +156 -0
  747. package/src/accounts/testBulkAccountLoader.ts +53 -0
  748. package/src/accounts/types.ts +245 -0
  749. package/src/accounts/utils.ts +62 -0
  750. package/src/accounts/webSocketAccountSubscriber.ts +205 -0
  751. package/src/accounts/webSocketDriftClientAccountSubscriber.ts +621 -0
  752. package/src/accounts/webSocketHighLeverageModeConfigAccountSubscriber.ts +131 -0
  753. package/src/accounts/webSocketInsuranceFundStakeAccountSubscriber.ts +129 -0
  754. package/src/accounts/webSocketProgramAccountSubscriber.ts +182 -0
  755. package/src/accounts/webSocketUserAccountSubscriber.ts +104 -0
  756. package/src/accounts/webSocketUserStatsAccountSubsriber.ts +98 -0
  757. package/src/addresses/marketAddresses.ts +17 -0
  758. package/src/addresses/pda.ts +355 -0
  759. package/src/adminClient.ts +4030 -0
  760. package/src/assert/assert.ts +5 -0
  761. package/src/auctionSubscriber/auctionSubscriber.ts +66 -0
  762. package/src/auctionSubscriber/auctionSubscriberGrpc.ts +70 -0
  763. package/src/auctionSubscriber/index.ts +3 -0
  764. package/src/auctionSubscriber/types.ts +20 -0
  765. package/src/bankrun/bankrunConnection.ts +534 -0
  766. package/src/blockhashSubscriber/BlockhashSubscriber.ts +126 -0
  767. package/src/blockhashSubscriber/index.ts +1 -0
  768. package/src/blockhashSubscriber/types.ts +12 -0
  769. package/src/clock/clockSubscriber.ts +121 -0
  770. package/src/config.ts +212 -0
  771. package/src/constants/numericConstants.ts +113 -0
  772. package/src/constants/perpMarkets.ts +1084 -0
  773. package/src/constants/spotMarkets.ts +565 -0
  774. package/src/constants/txConstants.ts +1 -0
  775. package/src/decode/phoenix.ts +207 -0
  776. package/src/decode/user.ts +368 -0
  777. package/src/dlob/DLOB.ts +1897 -0
  778. package/src/dlob/DLOBNode.ts +197 -0
  779. package/src/dlob/DLOBSubscriber.ts +201 -0
  780. package/src/dlob/NodeList.ts +173 -0
  781. package/src/dlob/orderBookLevels.ts +643 -0
  782. package/src/dlob/types.ts +22 -0
  783. package/src/driftClient.ts +9032 -0
  784. package/src/driftClientConfig.ts +60 -0
  785. package/src/events/eventList.ts +97 -0
  786. package/src/events/eventSubscriber.ts +364 -0
  787. package/src/events/eventsServerLogProvider.ts +152 -0
  788. package/src/events/fetchLogs.ts +169 -0
  789. package/src/events/parse.ts +133 -0
  790. package/src/events/pollingLogProvider.ts +89 -0
  791. package/src/events/sort.ts +39 -0
  792. package/src/events/txEventCache.ts +74 -0
  793. package/src/events/types.ts +185 -0
  794. package/src/events/webSocketLogProvider.ts +121 -0
  795. package/src/factory/bigNum.ts +660 -0
  796. package/src/factory/oracleClient.ts +72 -0
  797. package/src/idl/drift.json +14440 -0
  798. package/src/idl/openbook.json +3854 -0
  799. package/src/idl/pyth.json +142 -0
  800. package/src/idl/pyth_solana_receiver.json +628 -0
  801. package/src/idl/switchboard.json +8354 -0
  802. package/src/idl/switchboard_on_demand_30.json +4546 -0
  803. package/src/idl/token_faucet.json +142 -0
  804. package/src/index.ts +127 -0
  805. package/src/isomorphic/README.md +19 -0
  806. package/src/isomorphic/grpc.browser.ts +4 -0
  807. package/src/isomorphic/grpc.node.ts +23 -0
  808. package/src/isomorphic/grpc.ts +1 -0
  809. package/src/jupiter/jupiterClient.ts +510 -0
  810. package/src/keypair.ts +24 -0
  811. package/src/marinade/idl/idl.json +1962 -0
  812. package/src/marinade/index.ts +64 -0
  813. package/src/marinade/types.ts +3925 -0
  814. package/src/math/amm.ts +1162 -0
  815. package/src/math/auction.ts +173 -0
  816. package/src/math/bankruptcy.ts +34 -0
  817. package/src/math/conversion.ts +13 -0
  818. package/src/math/exchangeStatus.ts +121 -0
  819. package/src/math/fuel.ts +70 -0
  820. package/src/math/funding.ts +342 -0
  821. package/src/math/insurance.ts +110 -0
  822. package/src/math/margin.ts +340 -0
  823. package/src/math/market.ts +336 -0
  824. package/src/math/oracles.ts +228 -0
  825. package/src/math/orders.ts +343 -0
  826. package/src/math/position.ts +324 -0
  827. package/src/math/repeg.ts +214 -0
  828. package/src/math/spotBalance.ts +630 -0
  829. package/src/math/spotMarket.ts +82 -0
  830. package/src/math/spotPosition.ts +184 -0
  831. package/src/math/state.ts +29 -0
  832. package/src/math/superStake.ts +525 -0
  833. package/src/math/tiers.ts +44 -0
  834. package/src/math/trade.ts +993 -0
  835. package/src/math/userStatus.ts +5 -0
  836. package/src/math/utils.ts +120 -0
  837. package/src/memcmp.ts +94 -0
  838. package/src/openbook/openbookV2FulfillmentConfigMap.ts +29 -0
  839. package/src/openbook/openbookV2Subscriber.ts +165 -0
  840. package/src/oracles/oracleClientCache.ts +25 -0
  841. package/src/oracles/oracleId.ts +28 -0
  842. package/src/oracles/prelaunchOracleClient.ts +37 -0
  843. package/src/oracles/pythClient.ts +85 -0
  844. package/src/oracles/pythLazerClient.ts +102 -0
  845. package/src/oracles/pythPullClient.ts +111 -0
  846. package/src/oracles/quoteAssetOracleClient.ts +25 -0
  847. package/src/oracles/strictOraclePrice.ts +19 -0
  848. package/src/oracles/switchboardClient.ts +77 -0
  849. package/src/oracles/switchboardOnDemandClient.ts +56 -0
  850. package/src/oracles/types.ts +23 -0
  851. package/src/orderParams.ts +79 -0
  852. package/src/orderSubscriber/OrderSubscriber.ts +249 -0
  853. package/src/orderSubscriber/PollingSubscription.ts +39 -0
  854. package/src/orderSubscriber/WebsocketSubscription.ts +119 -0
  855. package/src/orderSubscriber/grpcSubscription.ts +121 -0
  856. package/src/orderSubscriber/index.ts +2 -0
  857. package/src/orderSubscriber/types.ts +54 -0
  858. package/src/phoenix/phoenixFulfillmentConfigMap.ts +26 -0
  859. package/src/phoenix/phoenixSubscriber.ts +235 -0
  860. package/src/priorityFee/averageOverSlotsStrategy.ts +16 -0
  861. package/src/priorityFee/averageStrategy.ts +12 -0
  862. package/src/priorityFee/driftPriorityFeeMethod.ts +42 -0
  863. package/src/priorityFee/ewmaStrategy.ts +41 -0
  864. package/src/priorityFee/heliusPriorityFeeMethod.ts +57 -0
  865. package/src/priorityFee/index.ts +11 -0
  866. package/src/priorityFee/maxOverSlotsStrategy.ts +17 -0
  867. package/src/priorityFee/maxStrategy.ts +7 -0
  868. package/src/priorityFee/priorityFeeSubscriber.ts +251 -0
  869. package/src/priorityFee/priorityFeeSubscriberMap.ts +112 -0
  870. package/src/priorityFee/solanaPriorityFeeMethod.ts +34 -0
  871. package/src/priorityFee/types.ts +60 -0
  872. package/src/serum/serumFulfillmentConfigMap.ts +26 -0
  873. package/src/serum/serumSubscriber.ts +169 -0
  874. package/src/serum/types.ts +17 -0
  875. package/src/slot/SlotSubscriber.ts +101 -0
  876. package/src/slot/SlothashSubscriber.ts +126 -0
  877. package/src/testClient.ts +41 -0
  878. package/src/token/index.ts +13 -0
  879. package/src/tokenFaucet.ts +269 -0
  880. package/src/tx/baseTxSender.ts +477 -0
  881. package/src/tx/blockhashFetcher/baseBlockhashFetcher.ts +19 -0
  882. package/src/tx/blockhashFetcher/cachedBlockhashFetcher.ts +90 -0
  883. package/src/tx/blockhashFetcher/types.ts +5 -0
  884. package/src/tx/fastSingleTxSender.ts +142 -0
  885. package/src/tx/forwardOnlyTxSender.ts +145 -0
  886. package/src/tx/priorityFeeCalculator.ts +117 -0
  887. package/src/tx/reportTransactionError.ts +159 -0
  888. package/src/tx/retryTxSender.ts +135 -0
  889. package/src/tx/txHandler.ts +737 -0
  890. package/src/tx/txParamProcessor.ts +155 -0
  891. package/src/tx/types.ts +71 -0
  892. package/src/tx/utils.ts +11 -0
  893. package/src/tx/whileValidTxSender.ts +265 -0
  894. package/src/types.ts +1386 -0
  895. package/src/user.ts +4054 -0
  896. package/src/userConfig.ts +32 -0
  897. package/src/userMap/PollingSubscription.ts +47 -0
  898. package/src/userMap/WebsocketSubscription.ts +84 -0
  899. package/src/userMap/grpcSubscription.ts +85 -0
  900. package/src/userMap/referrerMap.ts +267 -0
  901. package/src/userMap/userMap.ts +654 -0
  902. package/src/userMap/userMapConfig.ts +63 -0
  903. package/src/userMap/userStatsMap.ts +218 -0
  904. package/src/userName.ts +21 -0
  905. package/src/userStats.ts +174 -0
  906. package/src/userStatsConfig.ts +31 -0
  907. package/src/util/TransactionConfirmationManager.ts +292 -0
  908. package/src/util/chainClock.ts +41 -0
  909. package/src/util/computeUnits.ts +65 -0
  910. package/src/util/digest.ts +11 -0
  911. package/src/util/promiseTimeout.ts +14 -0
  912. package/src/util/pythOracleUtils.ts +136 -0
  913. package/src/util/tps.ts +27 -0
  914. package/src/wallet.ts +43 -0
  915. package/tests/amm/test.ts +2092 -0
  916. package/tests/auctions/test.ts +81 -0
  917. package/tests/bn/test.ts +341 -0
  918. package/tests/ci/idl.ts +101 -0
  919. package/tests/ci/verifyConstants.ts +278 -0
  920. package/tests/decode/phoenix.ts +71 -0
  921. package/tests/decode/test.ts +266 -0
  922. package/tests/decode/userAccountBufferStrings.ts +102 -0
  923. package/tests/dlob/helpers.ts +749 -0
  924. package/tests/dlob/test.ts +6623 -0
  925. package/tests/insurance/test.ts +40 -0
  926. package/tests/spot/test.ts +226 -0
  927. package/tests/subscriber/openbook.ts +62 -0
  928. package/tests/tx/TransactionConfirmationManager.test.ts +305 -0
  929. package/tests/tx/cachedBlockhashFetcher.test.ts +96 -0
  930. package/tests/tx/priorityFeeCalculator.ts +77 -0
  931. package/tests/tx/priorityFeeStrategy.ts +95 -0
  932. package/tests/user/helpers.ts +92 -0
  933. package/tests/user/test.ts +517 -0
  934. package/tsconfig.browser.json +13 -0
  935. package/tsconfig.json +13 -0
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ForwardOnlyTxSender = void 0;
7
+ const web3_js_1 = require("@solana/web3.js");
8
+ const bs58_1 = __importDefault(require("bs58"));
9
+ const baseTxSender_1 = require("./baseTxSender");
10
+ const types_1 = require("./types");
11
+ const config_1 = require("../config");
12
+ const DEFAULT_TIMEOUT = 35000;
13
+ const DEFAULT_RETRY = 5000;
14
+ class ForwardOnlyTxSender extends baseTxSender_1.BaseTxSender {
15
+ constructor({ connection, wallet, opts = { ...config_1.DEFAULT_CONFIRMATION_OPTS, maxRetries: 0 }, timeout = DEFAULT_TIMEOUT, retrySleep = DEFAULT_RETRY, confirmationStrategy = types_1.ConfirmationStrategy.Combo, additionalTxSenderCallbacks = [], txHandler, trackTxLandRate, txLandRateLookbackWindowMinutes, landRateToFeeFunc, throwOnTimeoutError = true, }) {
16
+ super({
17
+ connection,
18
+ wallet,
19
+ opts,
20
+ timeout,
21
+ additionalConnections: [],
22
+ confirmationStrategy,
23
+ additionalTxSenderCallbacks,
24
+ txHandler,
25
+ trackTxLandRate,
26
+ txLandRateLookbackWindowMinutes,
27
+ landRateToFeeFunc,
28
+ throwOnTimeoutError,
29
+ });
30
+ this.timoutCount = 0;
31
+ this.connection = connection;
32
+ this.wallet = wallet;
33
+ this.opts = opts;
34
+ this.timeout = timeout;
35
+ this.retrySleep = retrySleep;
36
+ this.additionalConnections = [];
37
+ }
38
+ async sleep(reference) {
39
+ return new Promise((resolve) => {
40
+ reference.resolve = resolve;
41
+ setTimeout(resolve, this.retrySleep);
42
+ });
43
+ }
44
+ sendToAdditionalConnections(rawTx, _opts) {
45
+ var _a;
46
+ (_a = this.additionalTxSenderCallbacks) === null || _a === void 0 ? void 0 : _a.map((callback) => {
47
+ callback(bs58_1.default.encode(rawTx));
48
+ });
49
+ }
50
+ async sendRawTransaction(rawTransaction, opts) {
51
+ var _a, _b, _c;
52
+ const deserializedTx = web3_js_1.VersionedTransaction.deserialize(rawTransaction);
53
+ const txSig = deserializedTx.signatures[0];
54
+ const encodedTxSig = bs58_1.default.encode(txSig);
55
+ const startTime = this.getTimestamp();
56
+ this.sendToAdditionalConnections(rawTransaction, opts);
57
+ (_a = this.txSigCache) === null || _a === void 0 ? void 0 : _a.set(encodedTxSig, false);
58
+ let done = false;
59
+ const resolveReference = {
60
+ resolve: undefined,
61
+ };
62
+ const stopWaiting = () => {
63
+ done = true;
64
+ if (resolveReference.resolve) {
65
+ resolveReference.resolve();
66
+ }
67
+ };
68
+ (async () => {
69
+ while (!done && this.getTimestamp() - startTime < this.timeout) {
70
+ await this.sleep(resolveReference);
71
+ if (!done) {
72
+ this.sendToAdditionalConnections(rawTransaction, opts);
73
+ }
74
+ }
75
+ })();
76
+ let slot;
77
+ try {
78
+ const result = await this.confirmTransaction(encodedTxSig, opts.commitment);
79
+ slot = (_b = result === null || result === void 0 ? void 0 : result.context) === null || _b === void 0 ? void 0 : _b.slot;
80
+ (_c = this.txSigCache) === null || _c === void 0 ? void 0 : _c.set(encodedTxSig, true);
81
+ // eslint-disable-next-line no-useless-catch
82
+ }
83
+ catch (e) {
84
+ throw e;
85
+ }
86
+ finally {
87
+ stopWaiting();
88
+ }
89
+ return { txSig: encodedTxSig, slot };
90
+ }
91
+ }
92
+ exports.ForwardOnlyTxSender = ForwardOnlyTxSender;
@@ -0,0 +1,44 @@
1
+ import { TransactionInstruction } from '@solana/web3.js';
2
+ /**
3
+ * This class determines whether a priority fee needs to be included in a transaction based on
4
+ * a recent history of timed out transactions.
5
+ */
6
+ export declare class PriorityFeeCalculator {
7
+ lastTxTimeoutCount: number;
8
+ priorityFeeTriggered: boolean;
9
+ lastTxTimeoutCountTriggered: number;
10
+ priorityFeeLatchDurationMs: number;
11
+ /**
12
+ * Constructor for the PriorityFeeCalculator class.
13
+ * @param currentTimeMs - The current time in milliseconds.
14
+ * @param priorityFeeLatchDurationMs - The duration for how long to stay in triggered state before resetting. Default value is 10 seconds.
15
+ */
16
+ constructor(currentTimeMs: number, priorityFeeLatchDurationMs?: number);
17
+ /**
18
+ * Update the priority fee state based on the current time and the current timeout count.
19
+ * @param currentTimeMs current time in milliseconds
20
+ * @returns true if priority fee should be included in the next transaction
21
+ */
22
+ updatePriorityFee(currentTimeMs: number, txTimeoutCount: number): boolean;
23
+ /**
24
+ * This method returns a transaction instruction list that sets the compute limit on the ComputeBudget program.
25
+ * @param computeUnitLimit - The maximum number of compute units that can be used by the transaction.
26
+ * @returns An array of transaction instructions.
27
+ */
28
+ generateComputeBudgetIxs(computeUnitLimit: number): Array<TransactionInstruction>;
29
+ /**
30
+ * Calculates the compute unit price to use based on the desired additional fee to pay and the compute unit limit.
31
+ * @param computeUnitLimit desired CU to use
32
+ * @param additionalFeeMicroLamports desired additional fee to pay, in micro lamports
33
+ * @returns the compute unit price to use, in micro lamports
34
+ */
35
+ calculateComputeUnitPrice(computeUnitLimit: number, additionalFeeMicroLamports: number): number;
36
+ /**
37
+ * This method generates a list of transaction instructions for the ComputeBudget program, and includes a priority fee if it's required
38
+ * @param computeUnitLimit - The maximum number of compute units that can be used by the transaction.
39
+ * @param usePriorityFee - A boolean indicating whether to include a priority fee in the transaction, this should be from `this.updatePriorityFee()` or `this.priorityFeeTriggered`.
40
+ * @param additionalFeeMicroLamports - The additional fee to be paid, in micro lamports, the actual price will be calculated.
41
+ * @returns An array of transaction instructions.
42
+ */
43
+ generateComputeBudgetWithPriorityFeeIx(computeUnitLimit: number, usePriorityFee: boolean, additionalFeeMicroLamports: number): Array<TransactionInstruction>;
44
+ }
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PriorityFeeCalculator = void 0;
4
+ const web3_js_1 = require("@solana/web3.js");
5
+ /**
6
+ * This class determines whether a priority fee needs to be included in a transaction based on
7
+ * a recent history of timed out transactions.
8
+ */
9
+ class PriorityFeeCalculator {
10
+ /**
11
+ * Constructor for the PriorityFeeCalculator class.
12
+ * @param currentTimeMs - The current time in milliseconds.
13
+ * @param priorityFeeLatchDurationMs - The duration for how long to stay in triggered state before resetting. Default value is 10 seconds.
14
+ */
15
+ constructor(currentTimeMs, priorityFeeLatchDurationMs = 10 * 1000) {
16
+ this.lastTxTimeoutCount = 0;
17
+ this.priorityFeeTriggered = false;
18
+ this.lastTxTimeoutCountTriggered = currentTimeMs;
19
+ this.priorityFeeLatchDurationMs = priorityFeeLatchDurationMs;
20
+ }
21
+ /**
22
+ * Update the priority fee state based on the current time and the current timeout count.
23
+ * @param currentTimeMs current time in milliseconds
24
+ * @returns true if priority fee should be included in the next transaction
25
+ */
26
+ updatePriorityFee(currentTimeMs, txTimeoutCount) {
27
+ let triggerPriorityFee = false;
28
+ if (txTimeoutCount > this.lastTxTimeoutCount) {
29
+ this.lastTxTimeoutCount = txTimeoutCount;
30
+ this.lastTxTimeoutCountTriggered = currentTimeMs;
31
+ triggerPriorityFee = true;
32
+ }
33
+ else {
34
+ if (!this.priorityFeeTriggered) {
35
+ triggerPriorityFee = false;
36
+ }
37
+ else if (currentTimeMs - this.lastTxTimeoutCountTriggered <
38
+ this.priorityFeeLatchDurationMs) {
39
+ triggerPriorityFee = true;
40
+ }
41
+ }
42
+ this.priorityFeeTriggered = triggerPriorityFee;
43
+ return triggerPriorityFee;
44
+ }
45
+ /**
46
+ * This method returns a transaction instruction list that sets the compute limit on the ComputeBudget program.
47
+ * @param computeUnitLimit - The maximum number of compute units that can be used by the transaction.
48
+ * @returns An array of transaction instructions.
49
+ */
50
+ generateComputeBudgetIxs(computeUnitLimit) {
51
+ const ixs = [
52
+ web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({
53
+ units: computeUnitLimit,
54
+ }),
55
+ ];
56
+ return ixs;
57
+ }
58
+ /**
59
+ * Calculates the compute unit price to use based on the desired additional fee to pay and the compute unit limit.
60
+ * @param computeUnitLimit desired CU to use
61
+ * @param additionalFeeMicroLamports desired additional fee to pay, in micro lamports
62
+ * @returns the compute unit price to use, in micro lamports
63
+ */
64
+ calculateComputeUnitPrice(computeUnitLimit, additionalFeeMicroLamports) {
65
+ return additionalFeeMicroLamports / computeUnitLimit;
66
+ }
67
+ /**
68
+ * This method generates a list of transaction instructions for the ComputeBudget program, and includes a priority fee if it's required
69
+ * @param computeUnitLimit - The maximum number of compute units that can be used by the transaction.
70
+ * @param usePriorityFee - A boolean indicating whether to include a priority fee in the transaction, this should be from `this.updatePriorityFee()` or `this.priorityFeeTriggered`.
71
+ * @param additionalFeeMicroLamports - The additional fee to be paid, in micro lamports, the actual price will be calculated.
72
+ * @returns An array of transaction instructions.
73
+ */
74
+ generateComputeBudgetWithPriorityFeeIx(computeUnitLimit, usePriorityFee, additionalFeeMicroLamports) {
75
+ const ixs = this.generateComputeBudgetIxs(computeUnitLimit);
76
+ if (usePriorityFee) {
77
+ const computeUnitPrice = this.calculateComputeUnitPrice(computeUnitLimit, additionalFeeMicroLamports);
78
+ ixs.push(web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({
79
+ microLamports: computeUnitPrice,
80
+ }));
81
+ }
82
+ return ixs;
83
+ }
84
+ }
85
+ exports.PriorityFeeCalculator = PriorityFeeCalculator;
@@ -0,0 +1,20 @@
1
+ import { Commitment, Connection, SendTransactionError, VersionedTransactionResponse } from '@solana/web3.js';
2
+ /**
3
+ * THROWS if there is an error
4
+ *
5
+ * Should only be used for a txSig that is confirmed has an error. There is a race-condition where sometimes the transaction is not instantly available to fetch after the confirmation has already failed with an error, so this method has retry logic which we don't want to do wastefully. This method will throw a generic error if it can't get the transaction result after a retry period.
6
+ * @param txSig
7
+ * @param connection
8
+ * @returns
9
+ */
10
+ export declare const throwTransactionError: (txSig: string, connection: Connection, commitment?: Commitment) => Promise<void>;
11
+ /**
12
+ * RETURNS an error if there is one
13
+ *
14
+ * Should only be used for a txSig that is confirmed has an error. There is a race-condition where sometimes the transaction is not instantly available to fetch after the confirmation has already failed with an error, so this method has retry logic which we don't want to do wastefully. This method will throw a generic error if it can't get the transaction result after a retry period.
15
+ * @param txSig
16
+ * @param connection
17
+ * @returns
18
+ */
19
+ export declare const getTransactionErrorFromTxSig: (txSig: string, connection: Connection, commitment?: Commitment) => Promise<SendTransactionError>;
20
+ export declare const getTransactionError: (transactionResult: VersionedTransactionResponse) => SendTransactionError;
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getTransactionError = exports.getTransactionErrorFromTxSig = exports.throwTransactionError = void 0;
4
+ const web3_js_1 = require("@solana/web3.js");
5
+ const config_1 = require("../config");
6
+ /**
7
+ * The new getTransaction method expects a Finality type instead of a Commitment type. The only options for Finality are 'confirmed' and 'finalized'.
8
+ * @param commitment
9
+ * @returns
10
+ */
11
+ const commitmentToFinality = (commitment) => {
12
+ switch (commitment) {
13
+ case 'confirmed':
14
+ return 'confirmed';
15
+ case 'finalized':
16
+ return 'finalized';
17
+ default:
18
+ throw new Error(`Invalid commitment when reporting transaction error. The commitment must be 'confirmed' or 'finalized' but was given '${commitment}'. If you're using this commitment for a specific reason, you may need to roll your own logic here.`);
19
+ }
20
+ };
21
+ const getTransactionResult = async (txSig, connection, commitment) => {
22
+ const finality = commitmentToFinality(commitment || connection.commitment || config_1.DEFAULT_CONFIRMATION_OPTS.commitment);
23
+ return await connection.getTransaction(txSig, {
24
+ maxSupportedTransactionVersion: 0,
25
+ commitment: finality,
26
+ });
27
+ };
28
+ const getTransactionResultWithRetry = async (txSig, connection, commitment) => {
29
+ const start = Date.now();
30
+ const retryTimeout = 3000; // Timeout after 3 seconds
31
+ const retryInterval = 800; // Retry with 800ms interval
32
+ const retryCount = 3; // Retry 3 times
33
+ let currentCount = 0;
34
+ let transactionResult = await getTransactionResult(txSig, connection, commitment);
35
+ // Retry 3 times or until timeout as long as we don't have a result yet
36
+ while (!transactionResult &&
37
+ Date.now() - start < retryTimeout &&
38
+ currentCount < retryCount) {
39
+ // Sleep for 1 second :: Do this first so that we don't run the first loop immediately after the initial fetch above
40
+ await new Promise((resolve) => setTimeout(resolve, retryInterval));
41
+ transactionResult = await getTransactionResult(txSig, connection, commitment);
42
+ currentCount++;
43
+ }
44
+ return transactionResult;
45
+ };
46
+ /**
47
+ * THROWS if there is an error
48
+ *
49
+ * Should only be used for a txSig that is confirmed has an error. There is a race-condition where sometimes the transaction is not instantly available to fetch after the confirmation has already failed with an error, so this method has retry logic which we don't want to do wastefully. This method will throw a generic error if it can't get the transaction result after a retry period.
50
+ * @param txSig
51
+ * @param connection
52
+ * @returns
53
+ */
54
+ const throwTransactionError = async (txSig, connection, commitment) => {
55
+ const err = await (0, exports.getTransactionErrorFromTxSig)(txSig, connection, commitment);
56
+ if (err) {
57
+ throw err;
58
+ }
59
+ return;
60
+ };
61
+ exports.throwTransactionError = throwTransactionError;
62
+ /**
63
+ * RETURNS an error if there is one
64
+ *
65
+ * Should only be used for a txSig that is confirmed has an error. There is a race-condition where sometimes the transaction is not instantly available to fetch after the confirmation has already failed with an error, so this method has retry logic which we don't want to do wastefully. This method will throw a generic error if it can't get the transaction result after a retry period.
66
+ * @param txSig
67
+ * @param connection
68
+ * @returns
69
+ */
70
+ const getTransactionErrorFromTxSig = async (txSig, connection, commitment) => {
71
+ var _a;
72
+ const transactionResult = await getTransactionResultWithRetry(txSig, connection, commitment);
73
+ if (!transactionResult) {
74
+ // Throw a generic error because we couldn't get the transaction result for the given txSig
75
+ return new web3_js_1.SendTransactionError({
76
+ action: 'send',
77
+ signature: txSig,
78
+ transactionMessage: `Transaction Failed`,
79
+ });
80
+ }
81
+ if (!((_a = transactionResult === null || transactionResult === void 0 ? void 0 : transactionResult.meta) === null || _a === void 0 ? void 0 : _a.err)) {
82
+ // Assume that the transaction was successful and we are here erroneously because we have a result with no error
83
+ return;
84
+ }
85
+ return (0, exports.getTransactionError)(transactionResult);
86
+ };
87
+ exports.getTransactionErrorFromTxSig = getTransactionErrorFromTxSig;
88
+ const getTransactionError = (transactionResult) => {
89
+ var _a, _b, _c, _d, _e, _f;
90
+ if (!((_a = transactionResult === null || transactionResult === void 0 ? void 0 : transactionResult.meta) === null || _a === void 0 ? void 0 : _a.err)) {
91
+ return;
92
+ }
93
+ const logs = (_c = (_b = transactionResult === null || transactionResult === void 0 ? void 0 : transactionResult.meta) === null || _b === void 0 ? void 0 : _b.logMessages) !== null && _c !== void 0 ? _c : ['No logs'];
94
+ const lastLog = logs[logs.length - 1];
95
+ const friendlyMessage = (_d = lastLog === null || lastLog === void 0 ? void 0 : lastLog.match(/(failed:) (.+)/)) === null || _d === void 0 ? void 0 : _d[2];
96
+ return new web3_js_1.SendTransactionError({
97
+ action: 'send',
98
+ signature: (_f = (_e = transactionResult === null || transactionResult === void 0 ? void 0 : transactionResult.transaction) === null || _e === void 0 ? void 0 : _e.signatures) === null || _f === void 0 ? void 0 : _f[0],
99
+ transactionMessage: `Transaction Failed${friendlyMessage ? `: ${friendlyMessage}` : ''}`,
100
+ logs,
101
+ });
102
+ };
103
+ exports.getTransactionError = getTransactionError;
@@ -0,0 +1,37 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ import { ConfirmationStrategy, TxSigAndSlot } from './types';
4
+ import { ConfirmOptions, Connection } from '@solana/web3.js';
5
+ import { BaseTxSender } from './baseTxSender';
6
+ import { TxHandler } from './txHandler';
7
+ import { IWallet } from '../types';
8
+ type ResolveReference = {
9
+ resolve?: () => void;
10
+ };
11
+ export declare class RetryTxSender extends BaseTxSender {
12
+ connection: Connection;
13
+ wallet: IWallet;
14
+ opts: ConfirmOptions;
15
+ timeout: number;
16
+ retrySleep: number;
17
+ additionalConnections: Connection[];
18
+ timoutCount: number;
19
+ constructor({ connection, wallet, opts, timeout, retrySleep, additionalConnections, confirmationStrategy, additionalTxSenderCallbacks, txHandler, trackTxLandRate, txLandRateLookbackWindowMinutes, landRateToFeeFunc, throwOnTimeoutError, }: {
20
+ connection: Connection;
21
+ wallet: IWallet;
22
+ opts?: ConfirmOptions;
23
+ timeout?: number;
24
+ retrySleep?: number;
25
+ additionalConnections?: any;
26
+ confirmationStrategy?: ConfirmationStrategy;
27
+ additionalTxSenderCallbacks?: ((base58EncodedTx: string) => void)[];
28
+ txHandler?: TxHandler;
29
+ trackTxLandRate?: boolean;
30
+ txLandRateLookbackWindowMinutes?: number;
31
+ landRateToFeeFunc?: (landRate: number) => number;
32
+ throwOnTimeoutError?: boolean;
33
+ });
34
+ sleep(reference: ResolveReference): Promise<void>;
35
+ sendRawTransaction(rawTransaction: Buffer | Uint8Array, opts: ConfirmOptions): Promise<TxSigAndSlot>;
36
+ }
37
+ export {};
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RetryTxSender = void 0;
4
+ const types_1 = require("./types");
5
+ const baseTxSender_1 = require("./baseTxSender");
6
+ const config_1 = require("../config");
7
+ const DEFAULT_TIMEOUT = 35000;
8
+ const DEFAULT_RETRY = 2000;
9
+ class RetryTxSender extends baseTxSender_1.BaseTxSender {
10
+ constructor({ connection, wallet, opts = { ...config_1.DEFAULT_CONFIRMATION_OPTS, maxRetries: 0 }, timeout = DEFAULT_TIMEOUT, retrySleep = DEFAULT_RETRY, additionalConnections = new Array(), confirmationStrategy = types_1.ConfirmationStrategy.Combo, additionalTxSenderCallbacks = [], txHandler, trackTxLandRate, txLandRateLookbackWindowMinutes, landRateToFeeFunc, throwOnTimeoutError = true, }) {
11
+ super({
12
+ connection,
13
+ wallet,
14
+ opts,
15
+ timeout,
16
+ additionalConnections,
17
+ confirmationStrategy,
18
+ additionalTxSenderCallbacks,
19
+ txHandler,
20
+ trackTxLandRate,
21
+ txLandRateLookbackWindowMinutes,
22
+ landRateToFeeFunc,
23
+ throwOnTimeoutError,
24
+ });
25
+ this.timoutCount = 0;
26
+ this.connection = connection;
27
+ this.wallet = wallet;
28
+ this.opts = opts;
29
+ this.timeout = timeout;
30
+ this.retrySleep = retrySleep;
31
+ this.additionalConnections = additionalConnections;
32
+ }
33
+ async sleep(reference) {
34
+ return new Promise((resolve) => {
35
+ reference.resolve = resolve;
36
+ setTimeout(resolve, this.retrySleep);
37
+ });
38
+ }
39
+ async sendRawTransaction(rawTransaction, opts) {
40
+ var _a, _b, _c;
41
+ const startTime = this.getTimestamp();
42
+ const txid = await this.connection.sendRawTransaction(rawTransaction, opts);
43
+ (_a = this.txSigCache) === null || _a === void 0 ? void 0 : _a.set(txid, false);
44
+ this.sendToAdditionalConnections(rawTransaction, opts);
45
+ let done = false;
46
+ const resolveReference = {
47
+ resolve: undefined,
48
+ };
49
+ const stopWaiting = () => {
50
+ done = true;
51
+ if (resolveReference.resolve) {
52
+ resolveReference.resolve();
53
+ }
54
+ };
55
+ (async () => {
56
+ while (!done && this.getTimestamp() - startTime < this.timeout) {
57
+ await this.sleep(resolveReference);
58
+ if (!done) {
59
+ this.connection
60
+ .sendRawTransaction(rawTransaction, opts)
61
+ .catch((e) => {
62
+ console.error(e);
63
+ stopWaiting();
64
+ });
65
+ this.sendToAdditionalConnections(rawTransaction, opts);
66
+ }
67
+ }
68
+ })();
69
+ let slot;
70
+ try {
71
+ const result = await this.confirmTransaction(txid, opts.commitment);
72
+ (_b = this.txSigCache) === null || _b === void 0 ? void 0 : _b.set(txid, true);
73
+ await this.checkConfirmationResultForError(txid, result === null || result === void 0 ? void 0 : result.value);
74
+ slot = (_c = result === null || result === void 0 ? void 0 : result.context) === null || _c === void 0 ? void 0 : _c.slot;
75
+ // eslint-disable-next-line no-useless-catch
76
+ }
77
+ catch (e) {
78
+ throw e;
79
+ }
80
+ finally {
81
+ stopWaiting();
82
+ }
83
+ return { txSig: txid, slot };
84
+ }
85
+ }
86
+ exports.RetryTxSender = RetryTxSender;
@@ -0,0 +1,154 @@
1
+ import { AddressLookupTableAccount, BlockhashWithExpiryBlockHeight, Commitment, ConfirmOptions, Connection, Signer, Transaction, TransactionInstruction, TransactionVersion, VersionedTransaction } from '@solana/web3.js';
2
+ import { DriftClientMetricsEvents, IWallet, MappedRecord, SignedTxData, TxParams } from '../types';
3
+ export declare const COMPUTE_UNITS_DEFAULT = 200000;
4
+ export type TxBuildingProps = {
5
+ instructions: TransactionInstruction | TransactionInstruction[];
6
+ txVersion: TransactionVersion;
7
+ connection: Connection;
8
+ preFlightCommitment: Commitment;
9
+ fetchMarketLookupTableAccount: () => Promise<AddressLookupTableAccount>;
10
+ lookupTables?: AddressLookupTableAccount[];
11
+ forceVersionedTransaction?: boolean;
12
+ txParams?: TxParams;
13
+ recentBlockhash?: BlockhashWithExpiryBlockHeight;
14
+ wallet?: IWallet;
15
+ };
16
+ export type TxHandlerConfig = {
17
+ blockhashCachingEnabled?: boolean;
18
+ blockhashCachingConfig?: {
19
+ retryCount: number;
20
+ retrySleepTimeMs: number;
21
+ staleCacheTimeMs: number;
22
+ };
23
+ };
24
+ /**
25
+ * This class is responsible for creating and signing transactions.
26
+ */
27
+ export declare class TxHandler {
28
+ private blockHashToLastValidBlockHeightLookup;
29
+ private returnBlockHeightsWithSignedTxCallbackData;
30
+ private connection;
31
+ private wallet;
32
+ private confirmationOptions;
33
+ private preSignedCb?;
34
+ private onSignedCb?;
35
+ private blockhashCommitment;
36
+ private blockHashFetcher;
37
+ constructor(props: {
38
+ connection: Connection;
39
+ wallet: IWallet;
40
+ confirmationOptions: ConfirmOptions;
41
+ opts?: {
42
+ returnBlockHeightsWithSignedTxCallbackData?: boolean;
43
+ onSignedCb?: (txSigs: DriftClientMetricsEvents['txSigned']) => void;
44
+ preSignedCb?: () => void;
45
+ };
46
+ config?: TxHandlerConfig;
47
+ });
48
+ private addHashAndExpiryToLookup;
49
+ private getProps;
50
+ updateWallet(wallet: IWallet): void;
51
+ /**
52
+ * 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.
53
+ *
54
+ * https://www.helius.dev/blog/how-to-deal-with-blockhash-errors-on-solana#why-do-blockhash-errors-occur
55
+ *
56
+ * @returns
57
+ */
58
+ getLatestBlockhashForTransaction(): Promise<Readonly<{
59
+ blockhash: string;
60
+ lastValidBlockHeight: number;
61
+ }>>;
62
+ /**
63
+ * Applies recent blockhash and signs a given transaction
64
+ * @param tx
65
+ * @param additionalSigners
66
+ * @param wallet
67
+ * @param confirmationOpts
68
+ * @param preSigned
69
+ * @param recentBlockhash
70
+ * @returns
71
+ */
72
+ prepareTx(tx: Transaction, additionalSigners: Array<Signer>, wallet?: IWallet, confirmationOpts?: ConfirmOptions, preSigned?: boolean, recentBlockhash?: BlockhashWithExpiryBlockHeight): Promise<Transaction>;
73
+ private isVersionedTransaction;
74
+ private isLegacyTransaction;
75
+ private getTxSigFromSignedTx;
76
+ private getBlockhashFromSignedTx;
77
+ private signTx;
78
+ signVersionedTx(tx: VersionedTransaction, additionalSigners: Array<Signer>, recentBlockhash?: BlockhashWithExpiryBlockHeight, wallet?: IWallet): Promise<VersionedTransaction>;
79
+ private handleSignedTxData;
80
+ /**
81
+ * Gets transaction params with extra processing applied, like using the simulated compute units or using a dynamically calculated compute unit price.
82
+ * @param txBuildingProps
83
+ * @returns
84
+ */
85
+ private getProcessedTransactionParams;
86
+ private _generateVersionedTransaction;
87
+ generateLegacyVersionedTransaction(recentBlockhash: BlockhashWithExpiryBlockHeight, ixs: TransactionInstruction[], wallet?: IWallet): VersionedTransaction;
88
+ generateVersionedTransaction(recentBlockhash: BlockhashWithExpiryBlockHeight, ixs: TransactionInstruction[], lookupTableAccounts: AddressLookupTableAccount[], wallet?: IWallet): VersionedTransaction;
89
+ generateLegacyTransaction(ixs: TransactionInstruction[], recentBlockhash?: BlockhashWithExpiryBlockHeight): Transaction;
90
+ /**
91
+ * Accepts multiple instructions and builds a transaction for each. Prevents needing to spam RPC with requests for the same blockhash.
92
+ * @param props
93
+ * @returns
94
+ */
95
+ buildBulkTransactions(props: Omit<TxBuildingProps, 'instructions'> & {
96
+ instructions: (TransactionInstruction | TransactionInstruction[])[];
97
+ }): Promise<(Transaction | VersionedTransaction)[]>;
98
+ /**
99
+ *
100
+ * @param instructions
101
+ * @param txParams
102
+ * @param txVersion
103
+ * @param lookupTables
104
+ * @param forceVersionedTransaction Return a VersionedTransaction instance even if the version of the transaction is Legacy
105
+ * @returns
106
+ */
107
+ buildTransaction(props: TxBuildingProps): Promise<Transaction | VersionedTransaction>;
108
+ wrapInTx(instruction: TransactionInstruction, computeUnits?: number, computeUnitsPrice?: number): Transaction;
109
+ /**
110
+ * Get a map of signed and prepared transactions from an array of legacy transactions
111
+ * @param txsToSign
112
+ * @param keys
113
+ * @param wallet
114
+ * @param commitment
115
+ * @returns
116
+ */
117
+ getPreparedAndSignedLegacyTransactionMap<T extends Record<string, Transaction | undefined>>(txsMap: T, wallet?: IWallet, commitment?: Commitment, recentBlockhash?: BlockhashWithExpiryBlockHeight): Promise<{
118
+ signedTxMap: T;
119
+ signedTxData: SignedTxData[];
120
+ }>;
121
+ /**
122
+ * Get a map of signed transactions from an array of transactions to sign.
123
+ * @param txsToSign
124
+ * @param keys
125
+ * @param wallet
126
+ * @returns
127
+ */
128
+ getSignedTransactionMap<T extends Record<string, Transaction | VersionedTransaction | undefined>>(txsToSignMap: T, wallet?: IWallet): Promise<{
129
+ signedTxMap: T;
130
+ signedTxData: SignedTxData[];
131
+ }>;
132
+ /**
133
+ * Accepts multiple instructions and builds a transaction for each. Prevents needing to spam RPC with requests for the same blockhash.
134
+ * @param props
135
+ * @returns
136
+ */
137
+ buildTransactionsMap<T extends Record<string, TransactionInstruction | TransactionInstruction[]>>(props: Omit<TxBuildingProps, 'instructions'> & {
138
+ instructionsMap: T;
139
+ }): Promise<MappedRecord<T, Transaction | VersionedTransaction>>;
140
+ /**
141
+ * Builds and signs transactions from a given array of instructions for multiple transactions.
142
+ * @param props
143
+ * @returns
144
+ */
145
+ buildAndSignTransactionMap<T extends Record<string, TransactionInstruction | TransactionInstruction[]>>(props: Omit<TxBuildingProps, 'instructions'> & {
146
+ instructionsMap: T;
147
+ }): Promise<{
148
+ signedTxMap: Record<string, Transaction>;
149
+ signedTxData: SignedTxData[];
150
+ } | {
151
+ signedTxMap: MappedRecord<T, Transaction | VersionedTransaction>;
152
+ signedTxData: SignedTxData[];
153
+ }>;
154
+ }