@velocity-exchange/sdk 0.3.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1127) hide show
  1. package/README.md +3 -3
  2. package/lib/browser/accounts/basicUserAccountSubscriber.d.ts +18 -0
  3. package/lib/browser/accounts/basicUserAccountSubscriber.js +18 -0
  4. package/lib/browser/accounts/basicUserStatsAccountSubscriber.d.ts +18 -0
  5. package/lib/browser/accounts/basicUserStatsAccountSubscriber.js +18 -0
  6. package/lib/browser/accounts/bulkAccountLoader.d.ts +52 -0
  7. package/lib/browser/accounts/bulkAccountLoader.js +51 -0
  8. package/lib/browser/accounts/bulkUserStatsSubscription.d.ts +9 -2
  9. package/lib/browser/accounts/bulkUserStatsSubscription.js +9 -2
  10. package/lib/browser/accounts/bulkUserSubscription.d.ts +8 -2
  11. package/lib/browser/accounts/bulkUserSubscription.js +8 -2
  12. package/lib/browser/accounts/customizedCadenceBulkAccountLoader.d.ts +37 -0
  13. package/lib/browser/accounts/customizedCadenceBulkAccountLoader.js +37 -0
  14. package/lib/browser/accounts/fetch.d.ts +59 -2
  15. package/lib/browser/accounts/fetch.js +57 -2
  16. package/lib/browser/accounts/grpcAccountSubscriber.d.ts +30 -0
  17. package/lib/browser/accounts/grpcAccountSubscriber.js +30 -0
  18. package/lib/browser/accounts/grpcInsuranceFundStakeAccountSubscriber.d.ts +16 -0
  19. package/lib/browser/accounts/grpcInsuranceFundStakeAccountSubscriber.js +16 -0
  20. package/lib/browser/accounts/grpcMultiAccountSubscriber.d.ts +60 -1
  21. package/lib/browser/accounts/grpcMultiAccountSubscriber.js +118 -37
  22. package/lib/browser/accounts/grpcMultiUserAccountSubscriber.d.ts +32 -0
  23. package/lib/browser/accounts/grpcMultiUserAccountSubscriber.js +40 -12
  24. package/lib/browser/accounts/grpcProgramAccountSubscriber.d.ts +33 -0
  25. package/lib/browser/accounts/grpcProgramAccountSubscriber.js +33 -0
  26. package/lib/browser/accounts/grpcUserAccountSubscriber.d.ts +15 -0
  27. package/lib/browser/accounts/grpcUserAccountSubscriber.js +15 -0
  28. package/lib/browser/accounts/grpcUserStatsAccountSubscriber.d.ts +15 -0
  29. package/lib/browser/accounts/grpcUserStatsAccountSubscriber.js +15 -0
  30. package/lib/browser/accounts/grpcVelocityClientAccountSubscriber.d.ts +41 -0
  31. package/lib/browser/accounts/grpcVelocityClientAccountSubscriber.js +41 -0
  32. package/lib/browser/accounts/grpcVelocityClientAccountSubscriberV2.d.ts +116 -0
  33. package/lib/browser/accounts/grpcVelocityClientAccountSubscriberV2.js +152 -1
  34. package/lib/browser/accounts/laserProgramAccountSubscriber.d.ts +34 -0
  35. package/lib/browser/accounts/laserProgramAccountSubscriber.js +34 -0
  36. package/lib/browser/accounts/oneShotUserAccountSubscriber.d.ts +19 -0
  37. package/lib/browser/accounts/oneShotUserAccountSubscriber.js +19 -0
  38. package/lib/browser/accounts/oneShotUserStatsAccountSubscriber.d.ts +19 -0
  39. package/lib/browser/accounts/oneShotUserStatsAccountSubscriber.js +19 -0
  40. package/lib/browser/accounts/pollingInsuranceFundStakeAccountSubscriber.d.ts +31 -0
  41. package/lib/browser/accounts/pollingInsuranceFundStakeAccountSubscriber.js +31 -0
  42. package/lib/browser/accounts/pollingOracleAccountSubscriber.d.ts +19 -0
  43. package/lib/browser/accounts/pollingOracleAccountSubscriber.js +21 -2
  44. package/lib/browser/accounts/pollingTokenAccountSubscriber.d.ts +22 -0
  45. package/lib/browser/accounts/pollingTokenAccountSubscriber.js +22 -0
  46. package/lib/browser/accounts/pollingUserAccountSubscriber.d.ts +32 -0
  47. package/lib/browser/accounts/pollingUserAccountSubscriber.js +32 -0
  48. package/lib/browser/accounts/pollingUserStatsAccountSubscriber.d.ts +22 -0
  49. package/lib/browser/accounts/pollingUserStatsAccountSubscriber.js +22 -0
  50. package/lib/browser/accounts/pollingVelocityClientAccountSubscriber.d.ts +83 -0
  51. package/lib/browser/accounts/pollingVelocityClientAccountSubscriber.js +84 -1
  52. package/lib/browser/accounts/testBulkAccountLoader.d.ts +8 -0
  53. package/lib/browser/accounts/testBulkAccountLoader.js +8 -0
  54. package/lib/browser/accounts/types.d.ts +149 -0
  55. package/lib/browser/accounts/types.js +13 -0
  56. package/lib/browser/accounts/utils.d.ts +18 -0
  57. package/lib/browser/accounts/utils.js +32 -16
  58. package/lib/browser/accounts/webSocketAccountSubscriber.d.ts +41 -0
  59. package/lib/browser/accounts/webSocketAccountSubscriber.js +41 -0
  60. package/lib/browser/accounts/webSocketAccountSubscriberV2.d.ts +31 -0
  61. package/lib/browser/accounts/webSocketAccountSubscriberV2.js +31 -23
  62. package/lib/browser/accounts/webSocketInsuranceFundStakeAccountSubscriber.d.ts +27 -0
  63. package/lib/browser/accounts/webSocketInsuranceFundStakeAccountSubscriber.js +27 -0
  64. package/lib/browser/accounts/webSocketProgramAccountSubscriber.d.ts +36 -0
  65. package/lib/browser/accounts/webSocketProgramAccountSubscriber.js +36 -0
  66. package/lib/browser/accounts/webSocketProgramAccountSubscriberV2.d.ts +21 -0
  67. package/lib/browser/accounts/webSocketProgramAccountSubscriberV2.js +25 -0
  68. package/lib/browser/accounts/webSocketProgramAccountsSubscriberV2.d.ts +21 -0
  69. package/lib/browser/accounts/webSocketProgramAccountsSubscriberV2.js +21 -0
  70. package/lib/browser/accounts/webSocketUserAccountSubscriber.d.ts +26 -0
  71. package/lib/browser/accounts/webSocketUserAccountSubscriber.js +26 -0
  72. package/lib/browser/accounts/webSocketUserStatsAccountSubsriber.d.ts +20 -0
  73. package/lib/browser/accounts/webSocketUserStatsAccountSubsriber.js +20 -0
  74. package/lib/browser/accounts/webSocketVelocityClientAccountSubscriber.d.ts +121 -0
  75. package/lib/browser/accounts/webSocketVelocityClientAccountSubscriber.js +123 -2
  76. package/lib/browser/accounts/webSocketVelocityClientAccountSubscriberV2.d.ts +96 -0
  77. package/lib/browser/accounts/webSocketVelocityClientAccountSubscriberV2.js +108 -0
  78. package/lib/browser/accounts/websocketProgramUserAccountSubscriber.d.ts +28 -0
  79. package/lib/browser/accounts/websocketProgramUserAccountSubscriber.js +33 -0
  80. package/lib/browser/addresses/marketAddresses.d.ts +10 -0
  81. package/lib/browser/addresses/marketAddresses.js +10 -0
  82. package/lib/browser/addresses/pda.d.ts +214 -2
  83. package/lib/browser/addresses/pda.js +217 -5
  84. package/lib/browser/adminClient.d.ts +2171 -4
  85. package/lib/browser/adminClient.js +2215 -4
  86. package/lib/browser/auctionSubscriber/auctionSubscriber.d.ts +15 -0
  87. package/lib/browser/auctionSubscriber/auctionSubscriber.js +15 -0
  88. package/lib/browser/auctionSubscriber/auctionSubscriberGrpc.d.ts +19 -0
  89. package/lib/browser/auctionSubscriber/auctionSubscriberGrpc.js +19 -0
  90. package/lib/browser/auctionSubscriber/index.d.ts +6 -0
  91. package/lib/browser/auctionSubscriber/index.js +6 -0
  92. package/lib/browser/auctionSubscriber/types.d.ts +7 -0
  93. package/lib/browser/blockhashSubscriber/BlockhashSubscriber.d.ts +33 -0
  94. package/lib/browser/blockhashSubscriber/BlockhashSubscriber.js +33 -0
  95. package/lib/browser/blockhashSubscriber/index.d.ts +5 -0
  96. package/lib/browser/blockhashSubscriber/index.js +5 -0
  97. package/lib/browser/blockhashSubscriber/types.d.ts +5 -0
  98. package/lib/browser/clock/clockSubscriber.d.ts +24 -0
  99. package/lib/browser/clock/clockSubscriber.js +22 -0
  100. package/lib/browser/config.d.ts +58 -4
  101. package/lib/browser/config.js +94 -28
  102. package/lib/browser/constants/numericConstants.d.ts +67 -0
  103. package/lib/browser/constants/numericConstants.js +68 -1
  104. package/lib/browser/constants/perpMarkets.d.ts +10 -0
  105. package/lib/browser/constants/perpMarkets.js +40 -908
  106. package/lib/browser/constants/spotMarkets.d.ts +13 -0
  107. package/lib/browser/constants/spotMarkets.js +16 -742
  108. package/lib/browser/constants/txConstants.d.ts +1 -0
  109. package/lib/browser/constants/txConstants.js +1 -0
  110. package/lib/browser/core/VelocityCore.d.ts +285 -8
  111. package/lib/browser/core/VelocityCore.js +281 -8
  112. package/lib/browser/core/instructions/deposit.d.ts +22 -0
  113. package/lib/browser/core/instructions/deposit.js +22 -0
  114. package/lib/browser/core/instructions/fill.d.ts +17 -0
  115. package/lib/browser/core/instructions/fill.js +17 -0
  116. package/lib/browser/core/instructions/funding.d.ts +12 -0
  117. package/lib/browser/core/instructions/funding.js +12 -0
  118. package/lib/browser/core/instructions/liquidation.d.ts +18 -0
  119. package/lib/browser/core/instructions/liquidation.js +18 -0
  120. package/lib/browser/core/instructions/orders.d.ts +28 -0
  121. package/lib/browser/core/instructions/orders.js +28 -0
  122. package/lib/browser/core/instructions/perpOrders.d.ts +106 -0
  123. package/lib/browser/core/instructions/perpOrders.js +106 -0
  124. package/lib/browser/core/instructions/settlement.d.ts +14 -0
  125. package/lib/browser/core/instructions/settlement.js +14 -0
  126. package/lib/browser/core/instructions/trigger.d.ts +15 -0
  127. package/lib/browser/core/instructions/trigger.js +15 -0
  128. package/lib/browser/core/instructions/withdraw.d.ts +21 -0
  129. package/lib/browser/core/instructions/withdraw.js +21 -0
  130. package/lib/browser/core/remainingAccounts.d.ts +47 -3
  131. package/lib/browser/core/remainingAccounts.js +20 -0
  132. package/lib/browser/core/signedMsg.d.ts +38 -0
  133. package/lib/browser/core/signedMsg.js +33 -0
  134. package/lib/browser/decode/customCoder.d.ts +39 -3
  135. package/lib/browser/decode/customCoder.js +45 -3
  136. package/lib/browser/decode/user.d.ts +22 -0
  137. package/lib/browser/decode/user.js +27 -1
  138. package/lib/browser/dlob/DLOB.d.ts +502 -53
  139. package/lib/browser/dlob/DLOB.js +540 -98
  140. package/lib/browser/dlob/DLOBNode.d.ts +86 -4
  141. package/lib/browser/dlob/DLOBNode.js +37 -4
  142. package/lib/browser/dlob/DLOBSubscriber.d.ts +39 -12
  143. package/lib/browser/dlob/DLOBSubscriber.js +42 -12
  144. package/lib/browser/dlob/NodeList.d.ts +69 -0
  145. package/lib/browser/dlob/NodeList.js +66 -0
  146. package/lib/browser/dlob/orderBookLevels.d.ts +106 -13
  147. package/lib/browser/dlob/orderBookLevels.js +84 -14
  148. package/lib/browser/dlob/types.d.ts +15 -0
  149. package/lib/browser/events/eventList.d.ts +14 -0
  150. package/lib/browser/events/eventList.js +14 -0
  151. package/lib/browser/events/eventSubscriber.d.ts +87 -10
  152. package/lib/browser/events/eventSubscriber.js +93 -8
  153. package/lib/browser/events/eventsServerLogProvider.d.ts +22 -0
  154. package/lib/browser/events/eventsServerLogProvider.js +27 -0
  155. package/lib/browser/events/fetchLogs.d.ts +31 -0
  156. package/lib/browser/events/fetchLogs.js +46 -1
  157. package/lib/browser/events/parse.d.ts +23 -0
  158. package/lib/browser/events/parse.js +23 -0
  159. package/lib/browser/events/pollingLogProvider.d.ts +24 -0
  160. package/lib/browser/events/pollingLogProvider.js +24 -0
  161. package/lib/browser/events/sort.d.ts +11 -0
  162. package/lib/browser/events/sort.js +12 -0
  163. package/lib/browser/events/txEventCache.d.ts +13 -3
  164. package/lib/browser/events/txEventCache.js +19 -7
  165. package/lib/browser/events/types.d.ts +118 -2
  166. package/lib/browser/events/types.js +11 -0
  167. package/lib/browser/events/webSocketLogProvider.d.ts +23 -0
  168. package/lib/browser/events/webSocketLogProvider.js +28 -0
  169. package/lib/browser/factory/oracleClient.js +2 -2
  170. package/lib/browser/idl/velocity.d.ts +150 -7
  171. package/lib/browser/idl/velocity.json +151 -8
  172. package/lib/browser/keypair.d.ts +8 -0
  173. package/lib/browser/keypair.js +8 -0
  174. package/lib/browser/marginCalculation.d.ts +134 -2
  175. package/lib/browser/marginCalculation.js +121 -0
  176. package/lib/browser/math/amm.d.ts +348 -29
  177. package/lib/browser/math/amm.js +310 -32
  178. package/lib/browser/math/auction.d.ts +95 -19
  179. package/lib/browser/math/auction.js +118 -28
  180. package/lib/browser/math/bankruptcy.d.ts +46 -0
  181. package/lib/browser/math/bankruptcy.js +89 -1
  182. package/lib/browser/math/builder.d.ts +64 -8
  183. package/lib/browser/math/builder.js +71 -9
  184. package/lib/browser/math/conversion.d.ts +21 -0
  185. package/lib/browser/math/conversion.js +21 -0
  186. package/lib/browser/math/exchangeStatus.d.ts +91 -0
  187. package/lib/browser/math/exchangeStatus.js +106 -3
  188. package/lib/browser/math/funding.d.ts +57 -20
  189. package/lib/browser/math/funding.js +63 -23
  190. package/lib/browser/math/insurance.d.ts +62 -0
  191. package/lib/browser/math/insurance.js +62 -0
  192. package/lib/browser/math/liquidation.d.ts +127 -11
  193. package/lib/browser/math/liquidation.js +182 -19
  194. package/lib/browser/math/margin.d.ts +79 -13
  195. package/lib/browser/math/margin.js +80 -14
  196. package/lib/browser/math/market.d.ts +135 -15
  197. package/lib/browser/math/market.js +145 -17
  198. package/lib/browser/math/oracles.d.ts +113 -0
  199. package/lib/browser/math/oracles.js +118 -1
  200. package/lib/browser/math/orders.d.ts +115 -10
  201. package/lib/browser/math/orders.js +130 -19
  202. package/lib/browser/math/position.d.ts +80 -33
  203. package/lib/browser/math/position.js +80 -33
  204. package/lib/browser/math/repeg.d.ts +48 -10
  205. package/lib/browser/math/repeg.js +48 -10
  206. package/lib/browser/math/spotBalance.d.ts +200 -5
  207. package/lib/browser/math/spotBalance.js +239 -10
  208. package/lib/browser/math/spotMarket.d.ts +36 -3
  209. package/lib/browser/math/spotMarket.js +36 -3
  210. package/lib/browser/math/spotPosition.d.ts +72 -0
  211. package/lib/browser/math/spotPosition.js +62 -0
  212. package/lib/browser/math/state.d.ts +31 -0
  213. package/lib/browser/math/state.js +31 -0
  214. package/lib/browser/math/superStake.d.ts +126 -2
  215. package/lib/browser/math/superStake.js +123 -3
  216. package/lib/browser/math/tiers.d.ts +29 -0
  217. package/lib/browser/math/tiers.js +29 -0
  218. package/lib/browser/math/trade.d.ts +102 -51
  219. package/lib/browser/math/trade.js +101 -55
  220. package/lib/browser/math/utils.d.ts +71 -9
  221. package/lib/browser/math/utils.js +71 -9
  222. package/lib/browser/memcmp.d.ts +94 -0
  223. package/lib/browser/memcmp.js +103 -2
  224. package/lib/browser/oracles/oracleClientCache.d.ts +16 -0
  225. package/lib/browser/oracles/oracleClientCache.js +16 -0
  226. package/lib/browser/oracles/oracleId.d.ts +31 -0
  227. package/lib/browser/oracles/oracleId.js +39 -8
  228. package/lib/browser/oracles/prelaunchOracleClient.d.ts +20 -0
  229. package/lib/browser/oracles/prelaunchOracleClient.js +20 -0
  230. package/lib/browser/oracles/pythClient.d.ts +31 -0
  231. package/lib/browser/oracles/pythClient.js +32 -1
  232. package/lib/browser/oracles/pythLazerClient.d.ts +34 -0
  233. package/lib/browser/oracles/pythLazerClient.js +35 -1
  234. package/lib/browser/oracles/quoteAssetOracleClient.d.ts +18 -0
  235. package/lib/browser/oracles/quoteAssetOracleClient.js +18 -0
  236. package/lib/browser/oracles/strictOraclePrice.d.ts +21 -0
  237. package/lib/browser/oracles/strictOraclePrice.js +21 -0
  238. package/lib/browser/oracles/types.d.ts +45 -0
  239. package/lib/browser/oracles/utils.d.ts +20 -0
  240. package/lib/browser/oracles/utils.js +20 -0
  241. package/lib/browser/orderParams.d.ts +42 -4
  242. package/lib/browser/orderParams.js +42 -4
  243. package/lib/browser/orderSubscriber/OrderSubscriber.d.ts +56 -0
  244. package/lib/browser/orderSubscriber/OrderSubscriber.js +59 -0
  245. package/lib/browser/orderSubscriber/PollingSubscription.d.ts +11 -0
  246. package/lib/browser/orderSubscriber/PollingSubscription.js +11 -0
  247. package/lib/browser/orderSubscriber/WebsocketSubscription.d.ts +18 -0
  248. package/lib/browser/orderSubscriber/WebsocketSubscription.js +18 -0
  249. package/lib/browser/orderSubscriber/grpcSubscription.d.ts +16 -0
  250. package/lib/browser/orderSubscriber/grpcSubscription.js +16 -0
  251. package/lib/browser/orderSubscriber/types.d.ts +9 -0
  252. package/lib/browser/priorityFee/averageOverSlotsStrategy.d.ts +1 -0
  253. package/lib/browser/priorityFee/averageOverSlotsStrategy.js +1 -0
  254. package/lib/browser/priorityFee/averageStrategy.d.ts +1 -0
  255. package/lib/browser/priorityFee/averageStrategy.js +1 -0
  256. package/lib/browser/priorityFee/ewmaStrategy.d.ts +10 -0
  257. package/lib/browser/priorityFee/ewmaStrategy.js +10 -0
  258. package/lib/browser/priorityFee/heliusPriorityFeeMethod.d.ts +13 -0
  259. package/lib/browser/priorityFee/heliusPriorityFeeMethod.js +9 -2
  260. package/lib/browser/priorityFee/maxOverSlotsStrategy.d.ts +1 -0
  261. package/lib/browser/priorityFee/maxOverSlotsStrategy.js +1 -0
  262. package/lib/browser/priorityFee/maxStrategy.d.ts +1 -0
  263. package/lib/browser/priorityFee/maxStrategy.js +1 -0
  264. package/lib/browser/priorityFee/priorityFeeSubscriber.d.ts +39 -0
  265. package/lib/browser/priorityFee/priorityFeeSubscriber.js +39 -0
  266. package/lib/browser/priorityFee/priorityFeeSubscriberMap.d.ts +20 -1
  267. package/lib/browser/priorityFee/priorityFeeSubscriberMap.js +21 -2
  268. package/lib/browser/priorityFee/solanaPriorityFeeMethod.d.ts +12 -0
  269. package/lib/browser/priorityFee/solanaPriorityFeeMethod.js +10 -0
  270. package/lib/browser/priorityFee/types.d.ts +32 -0
  271. package/lib/browser/priorityFee/types.js +5 -0
  272. package/lib/browser/priorityFee/velocityPriorityFeeMethod.d.ts +11 -0
  273. package/lib/browser/priorityFee/velocityPriorityFeeMethod.js +8 -0
  274. package/lib/browser/pyth/pythLazerSubscriber.js +37 -27
  275. package/lib/browser/slot/SlotSubscriber.d.ts +18 -0
  276. package/lib/browser/slot/SlotSubscriber.js +16 -0
  277. package/lib/browser/slot/SlothashSubscriber.d.ts +26 -0
  278. package/lib/browser/slot/SlothashSubscriber.js +25 -1
  279. package/lib/browser/tx/baseTxSender.d.ts +163 -0
  280. package/lib/browser/tx/baseTxSender.js +174 -6
  281. package/lib/browser/tx/blockhashFetcher/baseBlockhashFetcher.d.ts +12 -0
  282. package/lib/browser/tx/blockhashFetcher/baseBlockhashFetcher.js +12 -0
  283. package/lib/browser/tx/blockhashFetcher/cachedBlockhashFetcher.d.ts +15 -0
  284. package/lib/browser/tx/blockhashFetcher/cachedBlockhashFetcher.js +15 -0
  285. package/lib/browser/tx/blockhashFetcher/types.d.ts +4 -0
  286. package/lib/browser/tx/fastSingleTxSender.d.ts +47 -0
  287. package/lib/browser/tx/fastSingleTxSender.js +48 -1
  288. package/lib/browser/tx/forwardOnlyTxSender.d.ts +48 -0
  289. package/lib/browser/tx/forwardOnlyTxSender.js +48 -0
  290. package/lib/browser/tx/reportTransactionError.d.ts +18 -6
  291. package/lib/browser/tx/reportTransactionError.js +18 -6
  292. package/lib/browser/tx/retryTxSender.d.ts +40 -0
  293. package/lib/browser/tx/retryTxSender.js +39 -0
  294. package/lib/browser/tx/txHandler.d.ts +146 -35
  295. package/lib/browser/tx/txHandler.js +132 -32
  296. package/lib/browser/tx/txParamProcessor.d.ts +47 -0
  297. package/lib/browser/tx/txParamProcessor.js +47 -0
  298. package/lib/browser/tx/types.d.ts +46 -0
  299. package/lib/browser/tx/types.js +5 -0
  300. package/lib/browser/tx/utils.d.ts +26 -0
  301. package/lib/browser/tx/utils.js +26 -0
  302. package/lib/browser/tx/whileValidTxSender.d.ts +82 -0
  303. package/lib/browser/tx/whileValidTxSender.js +81 -0
  304. package/lib/browser/types.d.ts +785 -13
  305. package/lib/browser/types.js +126 -9
  306. package/lib/browser/user.d.ts +660 -84
  307. package/lib/browser/user.js +816 -97
  308. package/lib/browser/userMap/PollingSubscription.d.ts +10 -0
  309. package/lib/browser/userMap/PollingSubscription.js +14 -2
  310. package/lib/browser/userMap/WebsocketSubscription.d.ts +9 -0
  311. package/lib/browser/userMap/WebsocketSubscription.js +9 -0
  312. package/lib/browser/userMap/grpcSubscription.d.ts +8 -0
  313. package/lib/browser/userMap/grpcSubscription.js +8 -0
  314. package/lib/browser/userMap/referrerMap.d.ts +72 -2
  315. package/lib/browser/userMap/referrerMap.js +84 -2
  316. package/lib/browser/userMap/revenueShareEscrowMap.d.ts +37 -10
  317. package/lib/browser/userMap/revenueShareEscrowMap.js +38 -11
  318. package/lib/browser/userMap/userMap.d.ts +81 -3
  319. package/lib/browser/userMap/userMap.js +81 -4
  320. package/lib/browser/userMap/userMapConfig.d.ts +23 -0
  321. package/lib/browser/userMap/userStatsMap.d.ts +22 -0
  322. package/lib/browser/userMap/userStatsMap.js +22 -0
  323. package/lib/browser/userName.d.ts +16 -0
  324. package/lib/browser/userName.js +16 -0
  325. package/lib/browser/userStats.d.ts +28 -1
  326. package/lib/browser/userStats.js +28 -1
  327. package/lib/browser/util/TransactionConfirmationManager.d.ts +33 -0
  328. package/lib/browser/util/TransactionConfirmationManager.js +33 -0
  329. package/lib/browser/util/chainClock.d.ts +24 -0
  330. package/lib/browser/util/chainClock.js +20 -0
  331. package/lib/browser/util/computeUnits.d.ts +32 -0
  332. package/lib/browser/util/computeUnits.js +32 -0
  333. package/lib/browser/util/digest.d.ts +17 -0
  334. package/lib/browser/util/digest.js +17 -0
  335. package/lib/browser/util/ed25519Utils.d.ts +12 -2
  336. package/lib/browser/util/ed25519Utils.js +12 -2
  337. package/lib/browser/util/promiseTimeout.d.ts +9 -0
  338. package/lib/browser/util/promiseTimeout.js +9 -0
  339. package/lib/browser/velocityClient.d.ts +3363 -220
  340. package/lib/browser/velocityClient.js +3514 -275
  341. package/lib/browser/wallet.d.ts +37 -0
  342. package/lib/browser/wallet.js +37 -0
  343. package/lib/node/accounts/basicUserAccountSubscriber.d.ts +18 -0
  344. package/lib/node/accounts/basicUserAccountSubscriber.d.ts.map +1 -1
  345. package/lib/node/accounts/basicUserAccountSubscriber.js +18 -0
  346. package/lib/node/accounts/basicUserStatsAccountSubscriber.d.ts +18 -0
  347. package/lib/node/accounts/basicUserStatsAccountSubscriber.d.ts.map +1 -1
  348. package/lib/node/accounts/basicUserStatsAccountSubscriber.js +18 -0
  349. package/lib/node/accounts/bulkAccountLoader.d.ts +52 -0
  350. package/lib/node/accounts/bulkAccountLoader.d.ts.map +1 -1
  351. package/lib/node/accounts/bulkAccountLoader.js +51 -0
  352. package/lib/node/accounts/bulkUserStatsSubscription.d.ts +9 -2
  353. package/lib/node/accounts/bulkUserStatsSubscription.d.ts.map +1 -1
  354. package/lib/node/accounts/bulkUserStatsSubscription.js +9 -2
  355. package/lib/node/accounts/bulkUserSubscription.d.ts +8 -2
  356. package/lib/node/accounts/bulkUserSubscription.d.ts.map +1 -1
  357. package/lib/node/accounts/bulkUserSubscription.js +8 -2
  358. package/lib/node/accounts/customizedCadenceBulkAccountLoader.d.ts +37 -0
  359. package/lib/node/accounts/customizedCadenceBulkAccountLoader.d.ts.map +1 -1
  360. package/lib/node/accounts/customizedCadenceBulkAccountLoader.js +37 -0
  361. package/lib/node/accounts/fetch.d.ts +59 -2
  362. package/lib/node/accounts/fetch.d.ts.map +1 -1
  363. package/lib/node/accounts/fetch.js +57 -2
  364. package/lib/node/accounts/grpcAccountSubscriber.d.ts +30 -0
  365. package/lib/node/accounts/grpcAccountSubscriber.d.ts.map +1 -1
  366. package/lib/node/accounts/grpcAccountSubscriber.js +30 -0
  367. package/lib/node/accounts/grpcInsuranceFundStakeAccountSubscriber.d.ts +16 -0
  368. package/lib/node/accounts/grpcInsuranceFundStakeAccountSubscriber.d.ts.map +1 -1
  369. package/lib/node/accounts/grpcInsuranceFundStakeAccountSubscriber.js +16 -0
  370. package/lib/node/accounts/grpcMultiAccountSubscriber.d.ts +60 -1
  371. package/lib/node/accounts/grpcMultiAccountSubscriber.d.ts.map +1 -1
  372. package/lib/node/accounts/grpcMultiAccountSubscriber.js +118 -37
  373. package/lib/node/accounts/grpcMultiUserAccountSubscriber.d.ts +32 -0
  374. package/lib/node/accounts/grpcMultiUserAccountSubscriber.d.ts.map +1 -1
  375. package/lib/node/accounts/grpcMultiUserAccountSubscriber.js +40 -12
  376. package/lib/node/accounts/grpcProgramAccountSubscriber.d.ts +33 -0
  377. package/lib/node/accounts/grpcProgramAccountSubscriber.d.ts.map +1 -1
  378. package/lib/node/accounts/grpcProgramAccountSubscriber.js +33 -0
  379. package/lib/node/accounts/grpcUserAccountSubscriber.d.ts +15 -0
  380. package/lib/node/accounts/grpcUserAccountSubscriber.d.ts.map +1 -1
  381. package/lib/node/accounts/grpcUserAccountSubscriber.js +15 -0
  382. package/lib/node/accounts/grpcUserStatsAccountSubscriber.d.ts +15 -0
  383. package/lib/node/accounts/grpcUserStatsAccountSubscriber.d.ts.map +1 -1
  384. package/lib/node/accounts/grpcUserStatsAccountSubscriber.js +15 -0
  385. package/lib/node/accounts/grpcVelocityClientAccountSubscriber.d.ts +41 -0
  386. package/lib/node/accounts/grpcVelocityClientAccountSubscriber.d.ts.map +1 -1
  387. package/lib/node/accounts/grpcVelocityClientAccountSubscriber.js +41 -0
  388. package/lib/node/accounts/grpcVelocityClientAccountSubscriberV2.d.ts +116 -0
  389. package/lib/node/accounts/grpcVelocityClientAccountSubscriberV2.d.ts.map +1 -1
  390. package/lib/node/accounts/grpcVelocityClientAccountSubscriberV2.js +152 -1
  391. package/lib/node/accounts/laserProgramAccountSubscriber.d.ts +34 -0
  392. package/lib/node/accounts/laserProgramAccountSubscriber.d.ts.map +1 -1
  393. package/lib/node/accounts/laserProgramAccountSubscriber.js +34 -0
  394. package/lib/node/accounts/oneShotUserAccountSubscriber.d.ts +19 -0
  395. package/lib/node/accounts/oneShotUserAccountSubscriber.d.ts.map +1 -1
  396. package/lib/node/accounts/oneShotUserAccountSubscriber.js +19 -0
  397. package/lib/node/accounts/oneShotUserStatsAccountSubscriber.d.ts +19 -0
  398. package/lib/node/accounts/oneShotUserStatsAccountSubscriber.d.ts.map +1 -1
  399. package/lib/node/accounts/oneShotUserStatsAccountSubscriber.js +19 -0
  400. package/lib/node/accounts/pollingInsuranceFundStakeAccountSubscriber.d.ts +31 -0
  401. package/lib/node/accounts/pollingInsuranceFundStakeAccountSubscriber.d.ts.map +1 -1
  402. package/lib/node/accounts/pollingInsuranceFundStakeAccountSubscriber.js +31 -0
  403. package/lib/node/accounts/pollingOracleAccountSubscriber.d.ts +19 -0
  404. package/lib/node/accounts/pollingOracleAccountSubscriber.d.ts.map +1 -1
  405. package/lib/node/accounts/pollingOracleAccountSubscriber.js +21 -2
  406. package/lib/node/accounts/pollingTokenAccountSubscriber.d.ts +22 -0
  407. package/lib/node/accounts/pollingTokenAccountSubscriber.d.ts.map +1 -1
  408. package/lib/node/accounts/pollingTokenAccountSubscriber.js +22 -0
  409. package/lib/node/accounts/pollingUserAccountSubscriber.d.ts +32 -0
  410. package/lib/node/accounts/pollingUserAccountSubscriber.d.ts.map +1 -1
  411. package/lib/node/accounts/pollingUserAccountSubscriber.js +32 -0
  412. package/lib/node/accounts/pollingUserStatsAccountSubscriber.d.ts +22 -0
  413. package/lib/node/accounts/pollingUserStatsAccountSubscriber.d.ts.map +1 -1
  414. package/lib/node/accounts/pollingUserStatsAccountSubscriber.js +22 -0
  415. package/lib/node/accounts/pollingVelocityClientAccountSubscriber.d.ts +83 -0
  416. package/lib/node/accounts/pollingVelocityClientAccountSubscriber.d.ts.map +1 -1
  417. package/lib/node/accounts/pollingVelocityClientAccountSubscriber.js +84 -1
  418. package/lib/node/accounts/testBulkAccountLoader.d.ts +8 -0
  419. package/lib/node/accounts/testBulkAccountLoader.d.ts.map +1 -1
  420. package/lib/node/accounts/testBulkAccountLoader.js +8 -0
  421. package/lib/node/accounts/types.d.ts +149 -0
  422. package/lib/node/accounts/types.d.ts.map +1 -1
  423. package/lib/node/accounts/types.js +13 -0
  424. package/lib/node/accounts/utils.d.ts +18 -0
  425. package/lib/node/accounts/utils.d.ts.map +1 -1
  426. package/lib/node/accounts/utils.js +32 -16
  427. package/lib/node/accounts/webSocketAccountSubscriber.d.ts +41 -0
  428. package/lib/node/accounts/webSocketAccountSubscriber.d.ts.map +1 -1
  429. package/lib/node/accounts/webSocketAccountSubscriber.js +41 -0
  430. package/lib/node/accounts/webSocketAccountSubscriberV2.d.ts +31 -0
  431. package/lib/node/accounts/webSocketAccountSubscriberV2.d.ts.map +1 -1
  432. package/lib/node/accounts/webSocketAccountSubscriberV2.js +31 -23
  433. package/lib/node/accounts/webSocketInsuranceFundStakeAccountSubscriber.d.ts +27 -0
  434. package/lib/node/accounts/webSocketInsuranceFundStakeAccountSubscriber.d.ts.map +1 -1
  435. package/lib/node/accounts/webSocketInsuranceFundStakeAccountSubscriber.js +27 -0
  436. package/lib/node/accounts/webSocketProgramAccountSubscriber.d.ts +36 -0
  437. package/lib/node/accounts/webSocketProgramAccountSubscriber.d.ts.map +1 -1
  438. package/lib/node/accounts/webSocketProgramAccountSubscriber.js +36 -0
  439. package/lib/node/accounts/webSocketProgramAccountSubscriberV2.d.ts +21 -0
  440. package/lib/node/accounts/webSocketProgramAccountSubscriberV2.d.ts.map +1 -1
  441. package/lib/node/accounts/webSocketProgramAccountSubscriberV2.js +25 -0
  442. package/lib/node/accounts/webSocketProgramAccountsSubscriberV2.d.ts +21 -0
  443. package/lib/node/accounts/webSocketProgramAccountsSubscriberV2.d.ts.map +1 -1
  444. package/lib/node/accounts/webSocketProgramAccountsSubscriberV2.js +21 -0
  445. package/lib/node/accounts/webSocketUserAccountSubscriber.d.ts +26 -0
  446. package/lib/node/accounts/webSocketUserAccountSubscriber.d.ts.map +1 -1
  447. package/lib/node/accounts/webSocketUserAccountSubscriber.js +26 -0
  448. package/lib/node/accounts/webSocketUserStatsAccountSubsriber.d.ts +20 -0
  449. package/lib/node/accounts/webSocketUserStatsAccountSubsriber.d.ts.map +1 -1
  450. package/lib/node/accounts/webSocketUserStatsAccountSubsriber.js +20 -0
  451. package/lib/node/accounts/webSocketVelocityClientAccountSubscriber.d.ts +121 -0
  452. package/lib/node/accounts/webSocketVelocityClientAccountSubscriber.d.ts.map +1 -1
  453. package/lib/node/accounts/webSocketVelocityClientAccountSubscriber.js +123 -2
  454. package/lib/node/accounts/webSocketVelocityClientAccountSubscriberV2.d.ts +96 -0
  455. package/lib/node/accounts/webSocketVelocityClientAccountSubscriberV2.d.ts.map +1 -1
  456. package/lib/node/accounts/webSocketVelocityClientAccountSubscriberV2.js +108 -0
  457. package/lib/node/accounts/websocketProgramUserAccountSubscriber.d.ts +28 -0
  458. package/lib/node/accounts/websocketProgramUserAccountSubscriber.d.ts.map +1 -1
  459. package/lib/node/accounts/websocketProgramUserAccountSubscriber.js +33 -0
  460. package/lib/node/addresses/marketAddresses.d.ts +10 -0
  461. package/lib/node/addresses/marketAddresses.d.ts.map +1 -1
  462. package/lib/node/addresses/marketAddresses.js +10 -0
  463. package/lib/node/addresses/pda.d.ts +214 -2
  464. package/lib/node/addresses/pda.d.ts.map +1 -1
  465. package/lib/node/addresses/pda.js +217 -5
  466. package/lib/node/adminClient.d.ts +2171 -4
  467. package/lib/node/adminClient.d.ts.map +1 -1
  468. package/lib/node/adminClient.js +2215 -4
  469. package/lib/node/auctionSubscriber/auctionSubscriber.d.ts +15 -0
  470. package/lib/node/auctionSubscriber/auctionSubscriber.d.ts.map +1 -1
  471. package/lib/node/auctionSubscriber/auctionSubscriber.js +15 -0
  472. package/lib/node/auctionSubscriber/auctionSubscriberGrpc.d.ts +19 -0
  473. package/lib/node/auctionSubscriber/auctionSubscriberGrpc.d.ts.map +1 -1
  474. package/lib/node/auctionSubscriber/auctionSubscriberGrpc.js +19 -0
  475. package/lib/node/auctionSubscriber/index.d.ts +6 -0
  476. package/lib/node/auctionSubscriber/index.d.ts.map +1 -1
  477. package/lib/node/auctionSubscriber/index.js +6 -0
  478. package/lib/node/auctionSubscriber/types.d.ts +7 -0
  479. package/lib/node/auctionSubscriber/types.d.ts.map +1 -1
  480. package/lib/node/blockhashSubscriber/BlockhashSubscriber.d.ts +33 -0
  481. package/lib/node/blockhashSubscriber/BlockhashSubscriber.d.ts.map +1 -1
  482. package/lib/node/blockhashSubscriber/BlockhashSubscriber.js +33 -0
  483. package/lib/node/blockhashSubscriber/index.d.ts +5 -0
  484. package/lib/node/blockhashSubscriber/index.d.ts.map +1 -1
  485. package/lib/node/blockhashSubscriber/index.js +5 -0
  486. package/lib/node/blockhashSubscriber/types.d.ts +5 -0
  487. package/lib/node/blockhashSubscriber/types.d.ts.map +1 -1
  488. package/lib/node/clock/clockSubscriber.d.ts +24 -0
  489. package/lib/node/clock/clockSubscriber.d.ts.map +1 -1
  490. package/lib/node/clock/clockSubscriber.js +22 -0
  491. package/lib/node/config.d.ts +58 -4
  492. package/lib/node/config.d.ts.map +1 -1
  493. package/lib/node/config.js +94 -28
  494. package/lib/node/constants/numericConstants.d.ts +67 -0
  495. package/lib/node/constants/numericConstants.d.ts.map +1 -1
  496. package/lib/node/constants/numericConstants.js +68 -1
  497. package/lib/node/constants/perpMarkets.d.ts +10 -0
  498. package/lib/node/constants/perpMarkets.d.ts.map +1 -1
  499. package/lib/node/constants/perpMarkets.js +40 -908
  500. package/lib/node/constants/spotMarkets.d.ts +13 -0
  501. package/lib/node/constants/spotMarkets.d.ts.map +1 -1
  502. package/lib/node/constants/spotMarkets.js +16 -742
  503. package/lib/node/constants/txConstants.d.ts +1 -0
  504. package/lib/node/constants/txConstants.d.ts.map +1 -1
  505. package/lib/node/constants/txConstants.js +1 -0
  506. package/lib/node/core/VelocityCore.d.ts +285 -8
  507. package/lib/node/core/VelocityCore.d.ts.map +1 -1
  508. package/lib/node/core/VelocityCore.js +281 -8
  509. package/lib/node/core/instructions/deposit.d.ts +22 -0
  510. package/lib/node/core/instructions/deposit.d.ts.map +1 -1
  511. package/lib/node/core/instructions/deposit.js +22 -0
  512. package/lib/node/core/instructions/fill.d.ts +17 -0
  513. package/lib/node/core/instructions/fill.d.ts.map +1 -1
  514. package/lib/node/core/instructions/fill.js +17 -0
  515. package/lib/node/core/instructions/funding.d.ts +12 -0
  516. package/lib/node/core/instructions/funding.d.ts.map +1 -1
  517. package/lib/node/core/instructions/funding.js +12 -0
  518. package/lib/node/core/instructions/liquidation.d.ts +18 -0
  519. package/lib/node/core/instructions/liquidation.d.ts.map +1 -1
  520. package/lib/node/core/instructions/liquidation.js +18 -0
  521. package/lib/node/core/instructions/orders.d.ts +28 -0
  522. package/lib/node/core/instructions/orders.d.ts.map +1 -1
  523. package/lib/node/core/instructions/orders.js +28 -0
  524. package/lib/node/core/instructions/perpOrders.d.ts +106 -0
  525. package/lib/node/core/instructions/perpOrders.d.ts.map +1 -1
  526. package/lib/node/core/instructions/perpOrders.js +106 -0
  527. package/lib/node/core/instructions/settlement.d.ts +14 -0
  528. package/lib/node/core/instructions/settlement.d.ts.map +1 -1
  529. package/lib/node/core/instructions/settlement.js +14 -0
  530. package/lib/node/core/instructions/trigger.d.ts +15 -0
  531. package/lib/node/core/instructions/trigger.d.ts.map +1 -1
  532. package/lib/node/core/instructions/trigger.js +15 -0
  533. package/lib/node/core/instructions/withdraw.d.ts +21 -0
  534. package/lib/node/core/instructions/withdraw.d.ts.map +1 -1
  535. package/lib/node/core/instructions/withdraw.js +21 -0
  536. package/lib/node/core/remainingAccounts.d.ts +47 -3
  537. package/lib/node/core/remainingAccounts.d.ts.map +1 -1
  538. package/lib/node/core/remainingAccounts.js +20 -0
  539. package/lib/node/core/signedMsg.d.ts +38 -0
  540. package/lib/node/core/signedMsg.d.ts.map +1 -1
  541. package/lib/node/core/signedMsg.js +33 -0
  542. package/lib/node/decode/customCoder.d.ts +39 -3
  543. package/lib/node/decode/customCoder.d.ts.map +1 -1
  544. package/lib/node/decode/customCoder.js +45 -3
  545. package/lib/node/decode/user.d.ts +22 -0
  546. package/lib/node/decode/user.d.ts.map +1 -1
  547. package/lib/node/decode/user.js +27 -1
  548. package/lib/node/dlob/DLOB.d.ts +502 -53
  549. package/lib/node/dlob/DLOB.d.ts.map +1 -1
  550. package/lib/node/dlob/DLOB.js +540 -98
  551. package/lib/node/dlob/DLOBNode.d.ts +86 -4
  552. package/lib/node/dlob/DLOBNode.d.ts.map +1 -1
  553. package/lib/node/dlob/DLOBNode.js +37 -4
  554. package/lib/node/dlob/DLOBSubscriber.d.ts +39 -12
  555. package/lib/node/dlob/DLOBSubscriber.d.ts.map +1 -1
  556. package/lib/node/dlob/DLOBSubscriber.js +42 -12
  557. package/lib/node/dlob/NodeList.d.ts +69 -0
  558. package/lib/node/dlob/NodeList.d.ts.map +1 -1
  559. package/lib/node/dlob/NodeList.js +66 -0
  560. package/lib/node/dlob/orderBookLevels.d.ts +106 -13
  561. package/lib/node/dlob/orderBookLevels.d.ts.map +1 -1
  562. package/lib/node/dlob/orderBookLevels.js +84 -14
  563. package/lib/node/dlob/types.d.ts +15 -0
  564. package/lib/node/dlob/types.d.ts.map +1 -1
  565. package/lib/node/events/eventList.d.ts +14 -0
  566. package/lib/node/events/eventList.d.ts.map +1 -1
  567. package/lib/node/events/eventList.js +14 -0
  568. package/lib/node/events/eventSubscriber.d.ts +87 -10
  569. package/lib/node/events/eventSubscriber.d.ts.map +1 -1
  570. package/lib/node/events/eventSubscriber.js +93 -8
  571. package/lib/node/events/eventsServerLogProvider.d.ts +22 -0
  572. package/lib/node/events/eventsServerLogProvider.d.ts.map +1 -1
  573. package/lib/node/events/eventsServerLogProvider.js +27 -0
  574. package/lib/node/events/fetchLogs.d.ts +31 -0
  575. package/lib/node/events/fetchLogs.d.ts.map +1 -1
  576. package/lib/node/events/fetchLogs.js +46 -1
  577. package/lib/node/events/parse.d.ts +23 -0
  578. package/lib/node/events/parse.d.ts.map +1 -1
  579. package/lib/node/events/parse.js +23 -0
  580. package/lib/node/events/pollingLogProvider.d.ts +24 -0
  581. package/lib/node/events/pollingLogProvider.d.ts.map +1 -1
  582. package/lib/node/events/pollingLogProvider.js +24 -0
  583. package/lib/node/events/sort.d.ts +11 -0
  584. package/lib/node/events/sort.d.ts.map +1 -1
  585. package/lib/node/events/sort.js +12 -0
  586. package/lib/node/events/txEventCache.d.ts +13 -3
  587. package/lib/node/events/txEventCache.d.ts.map +1 -1
  588. package/lib/node/events/txEventCache.js +19 -7
  589. package/lib/node/events/types.d.ts +118 -2
  590. package/lib/node/events/types.d.ts.map +1 -1
  591. package/lib/node/events/types.js +11 -0
  592. package/lib/node/events/webSocketLogProvider.d.ts +23 -0
  593. package/lib/node/events/webSocketLogProvider.d.ts.map +1 -1
  594. package/lib/node/events/webSocketLogProvider.js +28 -0
  595. package/lib/node/factory/oracleClient.js +2 -2
  596. package/lib/node/idl/velocity.d.ts +150 -7
  597. package/lib/node/idl/velocity.d.ts.map +1 -1
  598. package/lib/node/idl/velocity.json +151 -8
  599. package/lib/node/keypair.d.ts +8 -0
  600. package/lib/node/keypair.d.ts.map +1 -1
  601. package/lib/node/keypair.js +8 -0
  602. package/lib/node/marginCalculation.d.ts +134 -2
  603. package/lib/node/marginCalculation.d.ts.map +1 -1
  604. package/lib/node/marginCalculation.js +121 -0
  605. package/lib/node/math/amm.d.ts +348 -29
  606. package/lib/node/math/amm.d.ts.map +1 -1
  607. package/lib/node/math/amm.js +310 -32
  608. package/lib/node/math/auction.d.ts +95 -19
  609. package/lib/node/math/auction.d.ts.map +1 -1
  610. package/lib/node/math/auction.js +118 -28
  611. package/lib/node/math/bankruptcy.d.ts +46 -0
  612. package/lib/node/math/bankruptcy.d.ts.map +1 -1
  613. package/lib/node/math/bankruptcy.js +89 -1
  614. package/lib/node/math/builder.d.ts +64 -8
  615. package/lib/node/math/builder.d.ts.map +1 -1
  616. package/lib/node/math/builder.js +71 -9
  617. package/lib/node/math/conversion.d.ts +21 -0
  618. package/lib/node/math/conversion.d.ts.map +1 -1
  619. package/lib/node/math/conversion.js +21 -0
  620. package/lib/node/math/exchangeStatus.d.ts +91 -0
  621. package/lib/node/math/exchangeStatus.d.ts.map +1 -1
  622. package/lib/node/math/exchangeStatus.js +106 -3
  623. package/lib/node/math/funding.d.ts +57 -20
  624. package/lib/node/math/funding.d.ts.map +1 -1
  625. package/lib/node/math/funding.js +63 -23
  626. package/lib/node/math/insurance.d.ts +62 -0
  627. package/lib/node/math/insurance.d.ts.map +1 -1
  628. package/lib/node/math/insurance.js +62 -0
  629. package/lib/node/math/liquidation.d.ts +127 -11
  630. package/lib/node/math/liquidation.d.ts.map +1 -1
  631. package/lib/node/math/liquidation.js +182 -19
  632. package/lib/node/math/margin.d.ts +79 -13
  633. package/lib/node/math/margin.d.ts.map +1 -1
  634. package/lib/node/math/margin.js +80 -14
  635. package/lib/node/math/market.d.ts +135 -15
  636. package/lib/node/math/market.d.ts.map +1 -1
  637. package/lib/node/math/market.js +145 -17
  638. package/lib/node/math/oracles.d.ts +113 -0
  639. package/lib/node/math/oracles.d.ts.map +1 -1
  640. package/lib/node/math/oracles.js +118 -1
  641. package/lib/node/math/orders.d.ts +115 -10
  642. package/lib/node/math/orders.d.ts.map +1 -1
  643. package/lib/node/math/orders.js +130 -19
  644. package/lib/node/math/position.d.ts +80 -33
  645. package/lib/node/math/position.d.ts.map +1 -1
  646. package/lib/node/math/position.js +80 -33
  647. package/lib/node/math/repeg.d.ts +48 -10
  648. package/lib/node/math/repeg.d.ts.map +1 -1
  649. package/lib/node/math/repeg.js +48 -10
  650. package/lib/node/math/spotBalance.d.ts +200 -5
  651. package/lib/node/math/spotBalance.d.ts.map +1 -1
  652. package/lib/node/math/spotBalance.js +239 -10
  653. package/lib/node/math/spotMarket.d.ts +36 -3
  654. package/lib/node/math/spotMarket.d.ts.map +1 -1
  655. package/lib/node/math/spotMarket.js +36 -3
  656. package/lib/node/math/spotPosition.d.ts +72 -0
  657. package/lib/node/math/spotPosition.d.ts.map +1 -1
  658. package/lib/node/math/spotPosition.js +62 -0
  659. package/lib/node/math/state.d.ts +31 -0
  660. package/lib/node/math/state.d.ts.map +1 -1
  661. package/lib/node/math/state.js +31 -0
  662. package/lib/node/math/superStake.d.ts +126 -2
  663. package/lib/node/math/superStake.d.ts.map +1 -1
  664. package/lib/node/math/superStake.js +123 -3
  665. package/lib/node/math/tiers.d.ts +29 -0
  666. package/lib/node/math/tiers.d.ts.map +1 -1
  667. package/lib/node/math/tiers.js +29 -0
  668. package/lib/node/math/trade.d.ts +102 -51
  669. package/lib/node/math/trade.d.ts.map +1 -1
  670. package/lib/node/math/trade.js +101 -55
  671. package/lib/node/math/utils.d.ts +71 -9
  672. package/lib/node/math/utils.d.ts.map +1 -1
  673. package/lib/node/math/utils.js +71 -9
  674. package/lib/node/memcmp.d.ts +94 -0
  675. package/lib/node/memcmp.d.ts.map +1 -1
  676. package/lib/node/memcmp.js +103 -2
  677. package/lib/node/oracles/oracleClientCache.d.ts +16 -0
  678. package/lib/node/oracles/oracleClientCache.d.ts.map +1 -1
  679. package/lib/node/oracles/oracleClientCache.js +16 -0
  680. package/lib/node/oracles/oracleId.d.ts +31 -0
  681. package/lib/node/oracles/oracleId.d.ts.map +1 -1
  682. package/lib/node/oracles/oracleId.js +39 -8
  683. package/lib/node/oracles/prelaunchOracleClient.d.ts +20 -0
  684. package/lib/node/oracles/prelaunchOracleClient.d.ts.map +1 -1
  685. package/lib/node/oracles/prelaunchOracleClient.js +20 -0
  686. package/lib/node/oracles/pythClient.d.ts +31 -0
  687. package/lib/node/oracles/pythClient.d.ts.map +1 -1
  688. package/lib/node/oracles/pythClient.js +32 -1
  689. package/lib/node/oracles/pythLazerClient.d.ts +34 -0
  690. package/lib/node/oracles/pythLazerClient.d.ts.map +1 -1
  691. package/lib/node/oracles/pythLazerClient.js +35 -1
  692. package/lib/node/oracles/quoteAssetOracleClient.d.ts +18 -0
  693. package/lib/node/oracles/quoteAssetOracleClient.d.ts.map +1 -1
  694. package/lib/node/oracles/quoteAssetOracleClient.js +18 -0
  695. package/lib/node/oracles/strictOraclePrice.d.ts +21 -0
  696. package/lib/node/oracles/strictOraclePrice.d.ts.map +1 -1
  697. package/lib/node/oracles/strictOraclePrice.js +21 -0
  698. package/lib/node/oracles/types.d.ts +45 -0
  699. package/lib/node/oracles/types.d.ts.map +1 -1
  700. package/lib/node/oracles/utils.d.ts +20 -0
  701. package/lib/node/oracles/utils.d.ts.map +1 -1
  702. package/lib/node/oracles/utils.js +20 -0
  703. package/lib/node/orderParams.d.ts +42 -4
  704. package/lib/node/orderParams.d.ts.map +1 -1
  705. package/lib/node/orderParams.js +42 -4
  706. package/lib/node/orderSubscriber/OrderSubscriber.d.ts +56 -0
  707. package/lib/node/orderSubscriber/OrderSubscriber.d.ts.map +1 -1
  708. package/lib/node/orderSubscriber/OrderSubscriber.js +59 -0
  709. package/lib/node/orderSubscriber/PollingSubscription.d.ts +11 -0
  710. package/lib/node/orderSubscriber/PollingSubscription.d.ts.map +1 -1
  711. package/lib/node/orderSubscriber/PollingSubscription.js +11 -0
  712. package/lib/node/orderSubscriber/WebsocketSubscription.d.ts +18 -0
  713. package/lib/node/orderSubscriber/WebsocketSubscription.d.ts.map +1 -1
  714. package/lib/node/orderSubscriber/WebsocketSubscription.js +18 -0
  715. package/lib/node/orderSubscriber/grpcSubscription.d.ts +16 -0
  716. package/lib/node/orderSubscriber/grpcSubscription.d.ts.map +1 -1
  717. package/lib/node/orderSubscriber/grpcSubscription.js +16 -0
  718. package/lib/node/orderSubscriber/types.d.ts +9 -0
  719. package/lib/node/orderSubscriber/types.d.ts.map +1 -1
  720. package/lib/node/priorityFee/averageOverSlotsStrategy.d.ts +1 -0
  721. package/lib/node/priorityFee/averageOverSlotsStrategy.d.ts.map +1 -1
  722. package/lib/node/priorityFee/averageOverSlotsStrategy.js +1 -0
  723. package/lib/node/priorityFee/averageStrategy.d.ts +1 -0
  724. package/lib/node/priorityFee/averageStrategy.d.ts.map +1 -1
  725. package/lib/node/priorityFee/averageStrategy.js +1 -0
  726. package/lib/node/priorityFee/ewmaStrategy.d.ts +10 -0
  727. package/lib/node/priorityFee/ewmaStrategy.d.ts.map +1 -1
  728. package/lib/node/priorityFee/ewmaStrategy.js +10 -0
  729. package/lib/node/priorityFee/heliusPriorityFeeMethod.d.ts +13 -0
  730. package/lib/node/priorityFee/heliusPriorityFeeMethod.d.ts.map +1 -1
  731. package/lib/node/priorityFee/heliusPriorityFeeMethod.js +9 -2
  732. package/lib/node/priorityFee/maxOverSlotsStrategy.d.ts +1 -0
  733. package/lib/node/priorityFee/maxOverSlotsStrategy.d.ts.map +1 -1
  734. package/lib/node/priorityFee/maxOverSlotsStrategy.js +1 -0
  735. package/lib/node/priorityFee/maxStrategy.d.ts +1 -0
  736. package/lib/node/priorityFee/maxStrategy.d.ts.map +1 -1
  737. package/lib/node/priorityFee/maxStrategy.js +1 -0
  738. package/lib/node/priorityFee/priorityFeeSubscriber.d.ts +39 -0
  739. package/lib/node/priorityFee/priorityFeeSubscriber.d.ts.map +1 -1
  740. package/lib/node/priorityFee/priorityFeeSubscriber.js +39 -0
  741. package/lib/node/priorityFee/priorityFeeSubscriberMap.d.ts +20 -1
  742. package/lib/node/priorityFee/priorityFeeSubscriberMap.d.ts.map +1 -1
  743. package/lib/node/priorityFee/priorityFeeSubscriberMap.js +21 -2
  744. package/lib/node/priorityFee/solanaPriorityFeeMethod.d.ts +12 -0
  745. package/lib/node/priorityFee/solanaPriorityFeeMethod.d.ts.map +1 -1
  746. package/lib/node/priorityFee/solanaPriorityFeeMethod.js +10 -0
  747. package/lib/node/priorityFee/types.d.ts +32 -0
  748. package/lib/node/priorityFee/types.d.ts.map +1 -1
  749. package/lib/node/priorityFee/types.js +5 -0
  750. package/lib/node/priorityFee/velocityPriorityFeeMethod.d.ts +11 -0
  751. package/lib/node/priorityFee/velocityPriorityFeeMethod.d.ts.map +1 -1
  752. package/lib/node/priorityFee/velocityPriorityFeeMethod.js +8 -0
  753. package/lib/node/pyth/pythLazerSubscriber.d.ts.map +1 -1
  754. package/lib/node/pyth/pythLazerSubscriber.js +37 -27
  755. package/lib/node/slot/SlotSubscriber.d.ts +18 -0
  756. package/lib/node/slot/SlotSubscriber.d.ts.map +1 -1
  757. package/lib/node/slot/SlotSubscriber.js +16 -0
  758. package/lib/node/slot/SlothashSubscriber.d.ts +26 -0
  759. package/lib/node/slot/SlothashSubscriber.d.ts.map +1 -1
  760. package/lib/node/slot/SlothashSubscriber.js +25 -1
  761. package/lib/node/tx/baseTxSender.d.ts +163 -0
  762. package/lib/node/tx/baseTxSender.d.ts.map +1 -1
  763. package/lib/node/tx/baseTxSender.js +174 -6
  764. package/lib/node/tx/blockhashFetcher/baseBlockhashFetcher.d.ts +12 -0
  765. package/lib/node/tx/blockhashFetcher/baseBlockhashFetcher.d.ts.map +1 -1
  766. package/lib/node/tx/blockhashFetcher/baseBlockhashFetcher.js +12 -0
  767. package/lib/node/tx/blockhashFetcher/cachedBlockhashFetcher.d.ts +15 -0
  768. package/lib/node/tx/blockhashFetcher/cachedBlockhashFetcher.d.ts.map +1 -1
  769. package/lib/node/tx/blockhashFetcher/cachedBlockhashFetcher.js +15 -0
  770. package/lib/node/tx/blockhashFetcher/types.d.ts +4 -0
  771. package/lib/node/tx/blockhashFetcher/types.d.ts.map +1 -1
  772. package/lib/node/tx/fastSingleTxSender.d.ts +47 -0
  773. package/lib/node/tx/fastSingleTxSender.d.ts.map +1 -1
  774. package/lib/node/tx/fastSingleTxSender.js +48 -1
  775. package/lib/node/tx/forwardOnlyTxSender.d.ts +48 -0
  776. package/lib/node/tx/forwardOnlyTxSender.d.ts.map +1 -1
  777. package/lib/node/tx/forwardOnlyTxSender.js +48 -0
  778. package/lib/node/tx/reportTransactionError.d.ts +18 -6
  779. package/lib/node/tx/reportTransactionError.d.ts.map +1 -1
  780. package/lib/node/tx/reportTransactionError.js +18 -6
  781. package/lib/node/tx/retryTxSender.d.ts +40 -0
  782. package/lib/node/tx/retryTxSender.d.ts.map +1 -1
  783. package/lib/node/tx/retryTxSender.js +39 -0
  784. package/lib/node/tx/txHandler.d.ts +146 -35
  785. package/lib/node/tx/txHandler.d.ts.map +1 -1
  786. package/lib/node/tx/txHandler.js +132 -32
  787. package/lib/node/tx/txParamProcessor.d.ts +47 -0
  788. package/lib/node/tx/txParamProcessor.d.ts.map +1 -1
  789. package/lib/node/tx/txParamProcessor.js +47 -0
  790. package/lib/node/tx/types.d.ts +46 -0
  791. package/lib/node/tx/types.d.ts.map +1 -1
  792. package/lib/node/tx/types.js +5 -0
  793. package/lib/node/tx/utils.d.ts +26 -0
  794. package/lib/node/tx/utils.d.ts.map +1 -1
  795. package/lib/node/tx/utils.js +26 -0
  796. package/lib/node/tx/whileValidTxSender.d.ts +82 -0
  797. package/lib/node/tx/whileValidTxSender.d.ts.map +1 -1
  798. package/lib/node/tx/whileValidTxSender.js +81 -0
  799. package/lib/node/types.d.ts +785 -13
  800. package/lib/node/types.d.ts.map +1 -1
  801. package/lib/node/types.js +126 -9
  802. package/lib/node/user.d.ts +660 -84
  803. package/lib/node/user.d.ts.map +1 -1
  804. package/lib/node/user.js +816 -97
  805. package/lib/node/userMap/PollingSubscription.d.ts +10 -0
  806. package/lib/node/userMap/PollingSubscription.d.ts.map +1 -1
  807. package/lib/node/userMap/PollingSubscription.js +14 -2
  808. package/lib/node/userMap/WebsocketSubscription.d.ts +9 -0
  809. package/lib/node/userMap/WebsocketSubscription.d.ts.map +1 -1
  810. package/lib/node/userMap/WebsocketSubscription.js +9 -0
  811. package/lib/node/userMap/grpcSubscription.d.ts +8 -0
  812. package/lib/node/userMap/grpcSubscription.d.ts.map +1 -1
  813. package/lib/node/userMap/grpcSubscription.js +8 -0
  814. package/lib/node/userMap/referrerMap.d.ts +72 -2
  815. package/lib/node/userMap/referrerMap.d.ts.map +1 -1
  816. package/lib/node/userMap/referrerMap.js +84 -2
  817. package/lib/node/userMap/revenueShareEscrowMap.d.ts +37 -10
  818. package/lib/node/userMap/revenueShareEscrowMap.d.ts.map +1 -1
  819. package/lib/node/userMap/revenueShareEscrowMap.js +38 -11
  820. package/lib/node/userMap/userMap.d.ts +81 -3
  821. package/lib/node/userMap/userMap.d.ts.map +1 -1
  822. package/lib/node/userMap/userMap.js +81 -4
  823. package/lib/node/userMap/userMapConfig.d.ts +23 -0
  824. package/lib/node/userMap/userMapConfig.d.ts.map +1 -1
  825. package/lib/node/userMap/userStatsMap.d.ts +22 -0
  826. package/lib/node/userMap/userStatsMap.d.ts.map +1 -1
  827. package/lib/node/userMap/userStatsMap.js +22 -0
  828. package/lib/node/userName.d.ts +16 -0
  829. package/lib/node/userName.d.ts.map +1 -1
  830. package/lib/node/userName.js +16 -0
  831. package/lib/node/userStats.d.ts +28 -1
  832. package/lib/node/userStats.d.ts.map +1 -1
  833. package/lib/node/userStats.js +28 -1
  834. package/lib/node/util/TransactionConfirmationManager.d.ts +33 -0
  835. package/lib/node/util/TransactionConfirmationManager.d.ts.map +1 -1
  836. package/lib/node/util/TransactionConfirmationManager.js +33 -0
  837. package/lib/node/util/chainClock.d.ts +24 -0
  838. package/lib/node/util/chainClock.d.ts.map +1 -1
  839. package/lib/node/util/chainClock.js +20 -0
  840. package/lib/node/util/computeUnits.d.ts +32 -0
  841. package/lib/node/util/computeUnits.d.ts.map +1 -1
  842. package/lib/node/util/computeUnits.js +32 -0
  843. package/lib/node/util/digest.d.ts +17 -0
  844. package/lib/node/util/digest.d.ts.map +1 -1
  845. package/lib/node/util/digest.js +17 -0
  846. package/lib/node/util/ed25519Utils.d.ts +12 -2
  847. package/lib/node/util/ed25519Utils.d.ts.map +1 -1
  848. package/lib/node/util/ed25519Utils.js +12 -2
  849. package/lib/node/util/promiseTimeout.d.ts +9 -0
  850. package/lib/node/util/promiseTimeout.d.ts.map +1 -1
  851. package/lib/node/util/promiseTimeout.js +9 -0
  852. package/lib/node/velocityClient.d.ts +3363 -220
  853. package/lib/node/velocityClient.d.ts.map +1 -1
  854. package/lib/node/velocityClient.js +3514 -275
  855. package/lib/node/wallet.d.ts +37 -0
  856. package/lib/node/wallet.d.ts.map +1 -1
  857. package/lib/node/wallet.js +37 -0
  858. package/package.json +8 -3
  859. package/.prettierignore +0 -1
  860. package/CHANGELOG.md +0 -81
  861. package/build-browser.js +0 -58
  862. package/bunfig.toml +0 -3
  863. package/esbuild-shims.js +0 -12
  864. package/scripts/deposit-isolated-positions.ts +0 -110
  865. package/scripts/find-flagged-users.ts +0 -213
  866. package/scripts/grpc-client-test-comparison.ts +0 -372
  867. package/scripts/grpc-multiuser-client-test-comparison.ts +0 -158
  868. package/scripts/postbuild.js +0 -95
  869. package/scripts/single-grpc-client-test.ts +0 -284
  870. package/scripts/withdraw-isolated-positions.ts +0 -174
  871. package/src/accounts/README_WebSocketAccountSubscriberV2.md +0 -95
  872. package/src/accounts/README_WebSocketProgramAccountSubscriberV2.md +0 -135
  873. package/src/accounts/basicUserAccountSubscriber.ts +0 -61
  874. package/src/accounts/basicUserStatsAccountSubscriber.ts +0 -69
  875. package/src/accounts/bulkAccountLoader.ts +0 -306
  876. package/src/accounts/bulkUserStatsSubscription.ts +0 -33
  877. package/src/accounts/bulkUserSubscription.ts +0 -33
  878. package/src/accounts/customizedCadenceBulkAccountLoader.ts +0 -213
  879. package/src/accounts/fetch.ts +0 -143
  880. package/src/accounts/grpcAccountSubscriber.ts +0 -195
  881. package/src/accounts/grpcInsuranceFundStakeAccountSubscriber.ts +0 -57
  882. package/src/accounts/grpcMultiAccountSubscriber.ts +0 -483
  883. package/src/accounts/grpcMultiUserAccountSubscriber.ts +0 -290
  884. package/src/accounts/grpcProgramAccountSubscriber.ts +0 -231
  885. package/src/accounts/grpcUserAccountSubscriber.ts +0 -48
  886. package/src/accounts/grpcUserStatsAccountSubscriber.ts +0 -50
  887. package/src/accounts/grpcVelocityClientAccountSubscriber.ts +0 -216
  888. package/src/accounts/grpcVelocityClientAccountSubscriberV2.ts +0 -782
  889. package/src/accounts/laserProgramAccountSubscriber.ts +0 -232
  890. package/src/accounts/oneShotUserAccountSubscriber.ts +0 -69
  891. package/src/accounts/oneShotUserStatsAccountSubscriber.ts +0 -75
  892. package/src/accounts/pollingInsuranceFundStakeAccountSubscriber.ts +0 -192
  893. package/src/accounts/pollingOracleAccountSubscriber.ts +0 -132
  894. package/src/accounts/pollingTokenAccountSubscriber.ts +0 -125
  895. package/src/accounts/pollingUserAccountSubscriber.ts +0 -166
  896. package/src/accounts/pollingUserStatsAccountSubscriber.ts +0 -158
  897. package/src/accounts/pollingVelocityClientAccountSubscriber.ts +0 -691
  898. package/src/accounts/testBulkAccountLoader.ts +0 -51
  899. package/src/accounts/types.ts +0 -279
  900. package/src/accounts/utils.ts +0 -72
  901. package/src/accounts/webSocketAccountSubscriber.ts +0 -263
  902. package/src/accounts/webSocketAccountSubscriberV2.ts +0 -528
  903. package/src/accounts/webSocketInsuranceFundStakeAccountSubscriber.ts +0 -144
  904. package/src/accounts/webSocketProgramAccountSubscriber.ts +0 -208
  905. package/src/accounts/webSocketProgramAccountSubscriberV2.ts +0 -1022
  906. package/src/accounts/webSocketProgramAccountsSubscriberV2.ts +0 -1021
  907. package/src/accounts/webSocketUserAccountSubscriber.ts +0 -113
  908. package/src/accounts/webSocketUserStatsAccountSubsriber.ts +0 -111
  909. package/src/accounts/webSocketVelocityClientAccountSubscriber.ts +0 -740
  910. package/src/accounts/webSocketVelocityClientAccountSubscriberV2.ts +0 -787
  911. package/src/accounts/websocketProgramUserAccountSubscriber.ts +0 -94
  912. package/src/addresses/marketAddresses.ts +0 -18
  913. package/src/addresses/pda.ts +0 -404
  914. package/src/adminClient.ts +0 -5984
  915. package/src/assert/assert.ts +0 -5
  916. package/src/auctionSubscriber/auctionSubscriber.ts +0 -71
  917. package/src/auctionSubscriber/auctionSubscriberGrpc.ts +0 -80
  918. package/src/auctionSubscriber/index.ts +0 -3
  919. package/src/auctionSubscriber/types.ts +0 -23
  920. package/src/bankrun/bankrunConnection.ts +0 -630
  921. package/src/blockhashSubscriber/BlockhashSubscriber.ts +0 -127
  922. package/src/blockhashSubscriber/index.ts +0 -1
  923. package/src/blockhashSubscriber/types.ts +0 -12
  924. package/src/clock/clockSubscriber.ts +0 -122
  925. package/src/config.ts +0 -225
  926. package/src/constants/index.ts +0 -9
  927. package/src/constants/numericConstants.ts +0 -124
  928. package/src/constants/perpMarkets.ts +0 -1042
  929. package/src/constants/spotMarkets.ts +0 -874
  930. package/src/constants/txConstants.ts +0 -1
  931. package/src/constituentMap/constituentMap.ts +0 -305
  932. package/src/constituentMap/pollingConstituentAccountSubscriber.ts +0 -99
  933. package/src/constituentMap/webSocketConstituentAccountSubscriber.ts +0 -121
  934. package/src/core/VelocityCore.ts +0 -328
  935. package/src/core/index.ts +0 -12
  936. package/src/core/instructions/deposit.ts +0 -42
  937. package/src/core/instructions/fill.ts +0 -34
  938. package/src/core/instructions/funding.ts +0 -21
  939. package/src/core/instructions/liquidation.ts +0 -37
  940. package/src/core/instructions/orders.ts +0 -56
  941. package/src/core/instructions/perpOrders.ts +0 -206
  942. package/src/core/instructions/settlement.ts +0 -26
  943. package/src/core/instructions/trigger.ts +0 -26
  944. package/src/core/instructions/withdraw.ts +0 -44
  945. package/src/core/remainingAccounts.ts +0 -276
  946. package/src/core/signedMsg.ts +0 -71
  947. package/src/decode/customCoder.ts +0 -105
  948. package/src/decode/user.ts +0 -379
  949. package/src/dlob/DLOB.ts +0 -2222
  950. package/src/dlob/DLOBNode.ts +0 -213
  951. package/src/dlob/DLOBSubscriber.ts +0 -232
  952. package/src/dlob/NodeList.ts +0 -175
  953. package/src/dlob/orderBookLevels.ts +0 -601
  954. package/src/dlob/types.ts +0 -22
  955. package/src/events/eventList.ts +0 -100
  956. package/src/events/eventSubscriber.ts +0 -440
  957. package/src/events/eventsServerLogProvider.ts +0 -161
  958. package/src/events/fetchLogs.ts +0 -169
  959. package/src/events/parse.ts +0 -248
  960. package/src/events/pollingLogProvider.ts +0 -89
  961. package/src/events/sort.ts +0 -39
  962. package/src/events/txEventCache.ts +0 -80
  963. package/src/events/types.ts +0 -217
  964. package/src/events/webSocketLogProvider.ts +0 -123
  965. package/src/factory/bigNum.ts +0 -709
  966. package/src/factory/oracleClient.ts +0 -73
  967. package/src/idl/pyth.json +0 -142
  968. package/src/idl/pyth.ts +0 -97
  969. package/src/idl/pyth_solana_receiver.json +0 -628
  970. package/src/idl/token_faucet.json +0 -229
  971. package/src/idl/token_faucet.ts +0 -197
  972. package/src/idl/velocity.json +0 -23974
  973. package/src/idl/velocity.ts +0 -23980
  974. package/src/index.ts +0 -150
  975. package/src/indicative-quotes/indicativeQuotesSender.ts +0 -233
  976. package/src/isomorphic/README.md +0 -19
  977. package/src/isomorphic/anchor.browser.ts +0 -44
  978. package/src/isomorphic/anchor.node.ts +0 -1
  979. package/src/isomorphic/anchor.ts +0 -1
  980. package/src/isomorphic/anchor29.browser.ts +0 -24
  981. package/src/isomorphic/anchor29.node.ts +0 -1
  982. package/src/isomorphic/anchor29.ts +0 -1
  983. package/src/isomorphic/grpc.browser.ts +0 -4
  984. package/src/isomorphic/grpc.node.ts +0 -130
  985. package/src/isomorphic/grpc.ts +0 -1
  986. package/src/jupiter/jupiterClient.ts +0 -502
  987. package/src/keypair.ts +0 -24
  988. package/src/margin/README.md +0 -138
  989. package/src/marginCalculation.ts +0 -256
  990. package/src/marinade/idl/idl.json +0 -1962
  991. package/src/marinade/index.ts +0 -73
  992. package/src/marinade/types.ts +0 -3925
  993. package/src/math/amm.ts +0 -1423
  994. package/src/math/auction.ts +0 -371
  995. package/src/math/bankruptcy.ts +0 -35
  996. package/src/math/builder.ts +0 -64
  997. package/src/math/conversion.ts +0 -24
  998. package/src/math/exchangeStatus.ts +0 -146
  999. package/src/math/funding.ts +0 -458
  1000. package/src/math/insurance.ts +0 -109
  1001. package/src/math/liquidation.ts +0 -223
  1002. package/src/math/margin.ts +0 -261
  1003. package/src/math/market.ts +0 -356
  1004. package/src/math/oracles.ts +0 -353
  1005. package/src/math/orders.ts +0 -378
  1006. package/src/math/position.ts +0 -334
  1007. package/src/math/repeg.ts +0 -185
  1008. package/src/math/spotBalance.ts +0 -756
  1009. package/src/math/spotMarket.ts +0 -82
  1010. package/src/math/spotPosition.ts +0 -191
  1011. package/src/math/state.ts +0 -40
  1012. package/src/math/superStake.ts +0 -479
  1013. package/src/math/tiers.ts +0 -44
  1014. package/src/math/trade.ts +0 -809
  1015. package/src/math/utils.ts +0 -121
  1016. package/src/memcmp.ts +0 -177
  1017. package/src/oracles/oracleClientCache.ts +0 -25
  1018. package/src/oracles/oracleId.ts +0 -66
  1019. package/src/oracles/prelaunchOracleClient.ts +0 -43
  1020. package/src/oracles/pythClient.ts +0 -94
  1021. package/src/oracles/pythLazerClient.ts +0 -107
  1022. package/src/oracles/quoteAssetOracleClient.ts +0 -25
  1023. package/src/oracles/strictOraclePrice.ts +0 -19
  1024. package/src/oracles/types.ts +0 -37
  1025. package/src/oracles/utils.ts +0 -25
  1026. package/src/orderParams.ts +0 -79
  1027. package/src/orderSubscriber/OrderSubscriber.ts +0 -322
  1028. package/src/orderSubscriber/PollingSubscription.ts +0 -39
  1029. package/src/orderSubscriber/WebsocketSubscription.ts +0 -119
  1030. package/src/orderSubscriber/grpcSubscription.ts +0 -139
  1031. package/src/orderSubscriber/index.ts +0 -7
  1032. package/src/orderSubscriber/types.ts +0 -55
  1033. package/src/priorityFee/averageOverSlotsStrategy.ts +0 -16
  1034. package/src/priorityFee/averageStrategy.ts +0 -12
  1035. package/src/priorityFee/ewmaStrategy.ts +0 -41
  1036. package/src/priorityFee/heliusPriorityFeeMethod.ts +0 -57
  1037. package/src/priorityFee/index.ts +0 -16
  1038. package/src/priorityFee/maxOverSlotsStrategy.ts +0 -17
  1039. package/src/priorityFee/maxStrategy.ts +0 -7
  1040. package/src/priorityFee/priorityFeeSubscriber.ts +0 -289
  1041. package/src/priorityFee/priorityFeeSubscriberMap.ts +0 -115
  1042. package/src/priorityFee/solanaPriorityFeeMethod.ts +0 -34
  1043. package/src/priorityFee/types.ts +0 -64
  1044. package/src/priorityFee/velocityPriorityFeeMethod.ts +0 -42
  1045. package/src/pyth/constants.ts +0 -9
  1046. package/src/pyth/index.ts +0 -15
  1047. package/src/pyth/pythLazerSubscriber.ts +0 -365
  1048. package/src/pyth/types.ts +0 -4451
  1049. package/src/pyth/utils.ts +0 -13
  1050. package/src/slot/SlotSubscriber.ts +0 -108
  1051. package/src/slot/SlothashSubscriber.ts +0 -137
  1052. package/src/swap/UnifiedSwapClient.ts +0 -315
  1053. package/src/swift/grpcSignedMsgUserAccountSubscriber.ts +0 -81
  1054. package/src/swift/index.ts +0 -10
  1055. package/src/swift/signedMsgUserAccountSubscriber.ts +0 -251
  1056. package/src/swift/swiftOrderSubscriber.ts +0 -351
  1057. package/src/testClient.ts +0 -42
  1058. package/src/titan/titanClient.ts +0 -438
  1059. package/src/token/index.ts +0 -13
  1060. package/src/tokenFaucet.ts +0 -296
  1061. package/src/tx/baseTxSender.ts +0 -471
  1062. package/src/tx/blockhashFetcher/baseBlockhashFetcher.ts +0 -19
  1063. package/src/tx/blockhashFetcher/cachedBlockhashFetcher.ts +0 -90
  1064. package/src/tx/blockhashFetcher/types.ts +0 -5
  1065. package/src/tx/fastSingleTxSender.ts +0 -146
  1066. package/src/tx/forwardOnlyTxSender.ts +0 -145
  1067. package/src/tx/priorityFeeCalculator.ts +0 -117
  1068. package/src/tx/reportTransactionError.ts +0 -164
  1069. package/src/tx/retryTxSender.ts +0 -137
  1070. package/src/tx/txHandler.ts +0 -898
  1071. package/src/tx/txParamProcessor.ts +0 -178
  1072. package/src/tx/types.ts +0 -71
  1073. package/src/tx/utils.ts +0 -107
  1074. package/src/tx/whileValidTxSender.ts +0 -295
  1075. package/src/types.ts +0 -1822
  1076. package/src/user.ts +0 -4557
  1077. package/src/userConfig.ts +0 -38
  1078. package/src/userMap/PollingSubscription.ts +0 -47
  1079. package/src/userMap/WebsocketSubscription.ts +0 -84
  1080. package/src/userMap/grpcSubscription.ts +0 -85
  1081. package/src/userMap/referrerMap.ts +0 -271
  1082. package/src/userMap/revenueShareEscrowMap.ts +0 -315
  1083. package/src/userMap/userMap.ts +0 -706
  1084. package/src/userMap/userMapConfig.ts +0 -69
  1085. package/src/userMap/userStatsMap.ts +0 -371
  1086. package/src/userName.ts +0 -21
  1087. package/src/userStats.ts +0 -132
  1088. package/src/userStatsConfig.ts +0 -35
  1089. package/src/util/TransactionConfirmationManager.ts +0 -300
  1090. package/src/util/chainClock.ts +0 -41
  1091. package/src/util/computeUnits.ts +0 -69
  1092. package/src/util/digest.ts +0 -16
  1093. package/src/util/ed25519Utils.ts +0 -85
  1094. package/src/util/promiseTimeout.ts +0 -14
  1095. package/src/velocityClient.ts +0 -11612
  1096. package/src/velocityClientConfig.ts +0 -119
  1097. package/src/wallet.ts +0 -54
  1098. package/tests/VelocityCore/decode.test.ts +0 -16
  1099. package/tests/VelocityCore/fill_trigger.test.ts +0 -73
  1100. package/tests/VelocityCore/instructions.test.ts +0 -46
  1101. package/tests/VelocityCore/pdas.test.ts +0 -30
  1102. package/tests/VelocityCore/perp_orders.test.ts +0 -205
  1103. package/tests/VelocityCore/remainingAccounts.test.ts +0 -72
  1104. package/tests/VelocityCore/settlement_liquidation.test.ts +0 -69
  1105. package/tests/accounts/customizedCadenceBulkAccountLoader.test.ts +0 -211
  1106. package/tests/amm/test.ts +0 -2300
  1107. package/tests/auctions/test.ts +0 -81
  1108. package/tests/bn/test.ts +0 -355
  1109. package/tests/ci/verifyConstants.ts +0 -393
  1110. package/tests/decode/test.ts +0 -262
  1111. package/tests/decode/userAccountBufferStrings.ts +0 -102
  1112. package/tests/dlob/helpers.ts +0 -748
  1113. package/tests/dlob/test.ts +0 -6969
  1114. package/tests/events/parseLogsForCuUsage.ts +0 -139
  1115. package/tests/insurance/test.ts +0 -40
  1116. package/tests/spot/test.ts +0 -226
  1117. package/tests/tx/TransactionConfirmationManager.test.ts +0 -312
  1118. package/tests/tx/cachedBlockhashFetcher.test.ts +0 -96
  1119. package/tests/tx/priorityFeeCalculator.ts +0 -77
  1120. package/tests/tx/priorityFeeStrategy.ts +0 -95
  1121. package/tests/user/getMarginCalculation.ts +0 -361
  1122. package/tests/user/helpers.ts +0 -184
  1123. package/tests/user/liquidations.ts +0 -129
  1124. package/tests/user/marginCalculations.test.ts +0 -321
  1125. package/tests/user/test.ts +0 -829
  1126. package/tsconfig.browser.json +0 -18
  1127. package/tsconfig.json +0 -36
package/src/pyth/types.ts DELETED
@@ -1,4451 +0,0 @@
1
- import type { IdlAccounts } from '../isomorphic/anchor29';
2
-
3
- export type WormholeCoreBridgeSolana = {
4
- version: '0.0.1-alpha.5';
5
- name: 'wormhole_core_bridge_solana';
6
- constants: [
7
- {
8
- name: 'SOLANA_CHAIN';
9
- type: 'u16';
10
- value: '1';
11
- },
12
- {
13
- name: 'FEE_COLLECTOR_SEED_PREFIX';
14
- type: 'bytes';
15
- value: '[102, 101, 101, 95, 99, 111, 108, 108, 101, 99, 116, 111, 114]';
16
- },
17
- {
18
- name: 'UPGRADE_SEED_PREFIX';
19
- type: 'bytes';
20
- value: '[117, 112, 103, 114, 97, 100, 101]';
21
- },
22
- {
23
- name: 'PROGRAM_EMITTER_SEED_PREFIX';
24
- type: 'bytes';
25
- value: '[101, 109, 105, 116, 116, 101, 114]';
26
- },
27
- {
28
- name: 'MAX_MESSAGE_PAYLOAD_SIZE';
29
- type: {
30
- defined: 'usize';
31
- };
32
- value: '30 * 1_024';
33
- },
34
- ];
35
- instructions: [
36
- {
37
- name: 'initMessageV1';
38
- docs: [
39
- 'Processor for initializing a new draft [PostedMessageV1](crate::state::PostedMessageV1)',
40
- 'account for writing. The emitter authority is established at this point and the payload size',
41
- 'is inferred from the size of the created account. This instruction handler also allows an',
42
- "integrator to publish Wormhole messages using his program's ID as the emitter address",
43
- '(by passing `Some(crate::ID)` to the [cpi_program_id](InitMessageV1Args::cpi_program_id)',
44
- 'argument). **Be aware that the emitter authority\'s seeds must only be \\[b"emitter"\\] in this',
45
- 'case.**',
46
- '',
47
- 'This instruction should be followed up with `write_message_v1` and `finalize_message_v1` to',
48
- 'write and indicate that the message is ready for publishing respectively (to prepare it for',
49
- 'publishing via the',
50
- '[post message instruction](crate::legacy::instruction::LegacyInstruction::PostMessage)).',
51
- '',
52
- 'NOTE: If you wish to publish a small message (one where the data does not overflow the',
53
- 'Solana transaction size), it is recommended that you use an [sdk](crate::sdk::cpi) method to',
54
- 'either prepare your message or post a message as a program ID emitter.',
55
- ];
56
- accounts: [
57
- {
58
- name: 'emitterAuthority';
59
- isMut: false;
60
- isSigner: true;
61
- docs: [
62
- 'This authority is the only one who can write to the draft message account.',
63
- ];
64
- },
65
- {
66
- name: 'draftMessage';
67
- isMut: true;
68
- isSigner: false;
69
- docs: ['Bridge.'];
70
- },
71
- ];
72
- args: [
73
- {
74
- name: 'args';
75
- type: {
76
- defined: 'InitMessageV1Args';
77
- };
78
- },
79
- ];
80
- },
81
- {
82
- name: 'writeMessageV1';
83
- docs: [
84
- 'Processor used to write to a draft [PostedMessageV1](crate::state::PostedMessageV1) account.',
85
- 'This instruction requires an authority (the emitter authority) to interact with the message',
86
- 'account.',
87
- ];
88
- accounts: [
89
- {
90
- name: 'emitterAuthority';
91
- isMut: false;
92
- isSigner: true;
93
- },
94
- {
95
- name: 'draftMessage';
96
- isMut: true;
97
- isSigner: false;
98
- docs: ['only be published when the message is finalized.'];
99
- },
100
- ];
101
- args: [
102
- {
103
- name: 'args';
104
- type: {
105
- defined: 'WriteMessageV1Args';
106
- };
107
- },
108
- ];
109
- },
110
- {
111
- name: 'finalizeMessageV1';
112
- docs: [
113
- 'Processor used to finalize a draft [PostedMessageV1](crate::state::PostedMessageV1) account.',
114
- 'Once finalized, this message account cannot be written to again. A finalized message is the',
115
- 'only state the legacy post message instruction can accept before publishing. This',
116
- 'instruction requires an authority (the emitter authority) to interact with the message',
117
- 'account.',
118
- ];
119
- accounts: [
120
- {
121
- name: 'emitterAuthority';
122
- isMut: false;
123
- isSigner: true;
124
- },
125
- {
126
- name: 'draftMessage';
127
- isMut: true;
128
- isSigner: false;
129
- docs: ['only be published when the message is finalized.'];
130
- },
131
- ];
132
- args: [];
133
- },
134
- {
135
- name: 'closeMessageV1';
136
- docs: [
137
- 'Processor used to process a draft [PostedMessageV1](crate::state::PostedMessageV1) account.',
138
- 'This instruction requires an authority (the emitter authority) to interact with the message',
139
- 'account.',
140
- ];
141
- accounts: [
142
- {
143
- name: 'emitterAuthority';
144
- isMut: false;
145
- isSigner: true;
146
- },
147
- {
148
- name: 'draftMessage';
149
- isMut: true;
150
- isSigner: false;
151
- docs: ['only be published when the message is finalized.'];
152
- },
153
- {
154
- name: 'closeAccountDestination';
155
- isMut: true;
156
- isSigner: false;
157
- },
158
- ];
159
- args: [];
160
- },
161
- {
162
- name: 'initEncodedVaa';
163
- docs: [
164
- 'Processor used to intialize a created account as [EncodedVaa](crate::state::EncodedVaa). An',
165
- 'authority (the write authority) is established with this instruction.',
166
- ];
167
- accounts: [
168
- {
169
- name: 'writeAuthority';
170
- isMut: false;
171
- isSigner: true;
172
- docs: [
173
- 'The authority who can write to the VAA account when it is being processed.',
174
- ];
175
- },
176
- {
177
- name: 'encodedVaa';
178
- isMut: true;
179
- isSigner: false;
180
- docs: ['Bridge.'];
181
- },
182
- ];
183
- args: [];
184
- },
185
- {
186
- name: 'closeEncodedVaa';
187
- docs: [
188
- 'Processor used to close an [EncodedVaa](crate::state::EncodedVaa). This instruction requires',
189
- 'an authority (the write authority) to interact witht he encoded VAA account.',
190
- ];
191
- accounts: [
192
- {
193
- name: 'writeAuthority';
194
- isMut: true;
195
- isSigner: true;
196
- docs: [
197
- 'This account is only required to be mutable for the `CloseVaaAccount` directive. This',
198
- 'authority is the same signer that originally created the VAA accounts, so he is the one that',
199
- 'will receive the lamports back for the closed accounts.',
200
- ];
201
- },
202
- {
203
- name: 'encodedVaa';
204
- isMut: true;
205
- isSigner: false;
206
- docs: ['written to and then verified.'];
207
- },
208
- ];
209
- args: [];
210
- },
211
- {
212
- name: 'writeEncodedVaa';
213
- docs: [
214
- 'Processor used to write to an [EncodedVaa](crate::state::EncodedVaa) account. This',
215
- 'instruction requires an authority (the write authority) to interact with the encoded VAA',
216
- 'account.',
217
- ];
218
- accounts: [
219
- {
220
- name: 'writeAuthority';
221
- isMut: false;
222
- isSigner: true;
223
- docs: [
224
- 'The only authority that can write to the encoded VAA account.',
225
- ];
226
- },
227
- {
228
- name: 'draftVaa';
229
- isMut: true;
230
- isSigner: false;
231
- docs: ['written to and then verified.'];
232
- },
233
- ];
234
- args: [
235
- {
236
- name: 'args';
237
- type: {
238
- defined: 'WriteEncodedVaaArgs';
239
- };
240
- },
241
- ];
242
- },
243
- {
244
- name: 'verifyEncodedVaaV1';
245
- docs: [
246
- 'Processor used to verify an [EncodedVaa](crate::state::EncodedVaa) account as a version 1',
247
- 'VAA (guardian signatures attesting to this observation). This instruction requires an',
248
- 'authority (the write authority) to interact with the encoded VAA account.',
249
- ];
250
- accounts: [
251
- {
252
- name: 'writeAuthority';
253
- isMut: false;
254
- isSigner: true;
255
- },
256
- {
257
- name: 'draftVaa';
258
- isMut: true;
259
- isSigner: false;
260
- docs: ['written to and then verified.'];
261
- },
262
- {
263
- name: 'guardianSet';
264
- isMut: false;
265
- isSigner: false;
266
- docs: [
267
- 'Guardian set account, which should be the same one that was used to attest for the VAA. The',
268
- 'signatures in the encoded VAA are verified against this guardian set.',
269
- ];
270
- },
271
- ];
272
- args: [];
273
- },
274
- {
275
- name: 'postVaaV1';
276
- docs: [
277
- 'Processor used to close an [EncodedVaa](crate::state::EncodedVaa) account to create a',
278
- '[PostedMessageV1](crate::state::PostedMessageV1) account in its place.',
279
- '',
280
- 'NOTE: Because the legacy verify signatures instruction was not required for the Posted VAA',
281
- 'account to exist, the encoded [SignatureSet](crate::state::SignatureSet) is the default',
282
- '[Pubkey].',
283
- ];
284
- accounts: [
285
- {
286
- name: 'payer';
287
- isMut: true;
288
- isSigner: true;
289
- docs: [
290
- 'Payer to create the posted VAA account. This instruction allows anyone with an encoded VAA',
291
- 'to create a posted VAA account.',
292
- ];
293
- },
294
- {
295
- name: 'encodedVaa';
296
- isMut: false;
297
- isSigner: false;
298
- docs: [
299
- 'Encoded VAA, whose body will be serialized into the posted VAA account.',
300
- '',
301
- 'NOTE: This instruction handler only exists to support integrators that still rely on posted',
302
- 'VAA accounts. While we encourage integrators to use the encoded VAA account instead, we',
303
- 'allow a pathway to convert the encoded VAA into a posted VAA. However, the payload is',
304
- 'restricted to 9.5KB, which is much larger than what was possible with the old implementation',
305
- 'using the legacy post vaa instruction. The Core Bridge program will not support posting VAAs',
306
- 'larger than this payload size.',
307
- ];
308
- },
309
- {
310
- name: 'postedVaa';
311
- isMut: true;
312
- isSigner: false;
313
- },
314
- {
315
- name: 'systemProgram';
316
- isMut: false;
317
- isSigner: false;
318
- },
319
- ];
320
- args: [];
321
- },
322
- {
323
- name: 'closeSignatureSet';
324
- docs: [
325
- 'Processor used to close a [SignatureSet](crate::state::SignatureSet), which was used to',
326
- 'verify the VAA using the legacy parse and verify procedure.',
327
- ];
328
- accounts: [
329
- {
330
- name: 'solDestination';
331
- isMut: true;
332
- isSigner: true;
333
- },
334
- {
335
- name: 'postedVaa';
336
- isMut: false;
337
- isSigner: false;
338
- docs: ['Posted VAA.'];
339
- },
340
- {
341
- name: 'signatureSet';
342
- isMut: true;
343
- isSigner: false;
344
- docs: [
345
- 'Signature set that may have been used to create the posted VAA account. If the `post_vaa_v1`',
346
- 'instruction were used to create the posted VAA account, then the encoded signature set',
347
- 'pubkey would be all zeroes.',
348
- ];
349
- },
350
- ];
351
- args: [];
352
- },
353
- ];
354
- accounts: [
355
- {
356
- name: 'guardianSet';
357
- docs: [
358
- 'Account used to store a guardian set. The keys encoded in this account are Ethereum pubkeys.',
359
- 'Its expiration time is determined at the time a guardian set is updated to a new set, where the',
360
- 'current network clock time is used with',
361
- '[guardian_set_ttl](crate::state::Config::guardian_set_ttl).',
362
- '',
363
- 'NOTE: The account schema is the same as legacy guardian sets, but this account now has a',
364
- "discriminator generated by Anchor's [account] macro. When the Core Bridge program performs a",
365
- 'guardian set update with this implementation, guardian sets will now have this Anchor-generated',
366
- 'discriminator.',
367
- ];
368
- type: {
369
- kind: 'struct';
370
- fields: [
371
- {
372
- name: 'index';
373
- docs: [
374
- 'Index representing an incrementing version number for this guardian set.',
375
- ];
376
- type: 'u32';
377
- },
378
- {
379
- name: 'keys';
380
- docs: ['Ethereum-style public keys.'];
381
- type: {
382
- vec: {
383
- array: ['u8', 20];
384
- };
385
- };
386
- },
387
- {
388
- name: 'creationTime';
389
- docs: [
390
- 'Timestamp representing the time this guardian became active.',
391
- ];
392
- type: {
393
- defined: 'Timestamp';
394
- };
395
- },
396
- {
397
- name: 'expirationTime';
398
- docs: [
399
- 'Expiration time when VAAs issued by this set are no longer valid.',
400
- ];
401
- type: {
402
- defined: 'Timestamp';
403
- };
404
- },
405
- ];
406
- };
407
- },
408
- {
409
- name: 'signatureSet';
410
- docs: [
411
- 'Account used to store information about a guardian set used to sign a VAA. There is only one',
412
- 'signature set for each verified VAA (associated with a',
413
- '[PostedVaaV1](crate::legacy::state::PostedVaaV1) account). This account is created using the',
414
- 'verify signatures legacy instruction.',
415
- '',
416
- 'NOTE: The account schema is the same as legacy signature sets, but this account now has a',
417
- "discriminator generated by Anchor's [account] macro. When the Core Bridge program upgrades to",
418
- 'this implementation from the old one, integrators in the middle of verifying signatures will',
419
- 'have to use a new keypair for this account and try again.',
420
- ];
421
- type: {
422
- kind: 'struct';
423
- fields: [
424
- {
425
- name: 'sigVerifySuccesses';
426
- docs: ['Signatures of validators'];
427
- type: {
428
- vec: 'bool';
429
- };
430
- },
431
- {
432
- name: 'messageHash';
433
- docs: ['Hash of the VAA message body.'];
434
- type: {
435
- defined: 'MessageHash';
436
- };
437
- },
438
- {
439
- name: 'guardianSetIndex';
440
- docs: ['Index of the guardian set'];
441
- type: 'u32';
442
- },
443
- ];
444
- };
445
- },
446
- {
447
- name: 'encodedVaa';
448
- docs: [
449
- 'Account used to warehouse VAA buffer.',
450
- '',
451
- "NOTE: This account should not be used by an external application unless the header's status is",
452
- '`Verified`. It is encouraged to use the `EncodedVaa` zero-copy account struct instead.',
453
- ];
454
- type: {
455
- kind: 'struct';
456
- fields: [
457
- {
458
- name: 'header';
459
- docs: ['Status, write authority and VAA version.'];
460
- type: {
461
- defined: 'Header';
462
- };
463
- },
464
- {
465
- name: 'buf';
466
- docs: ['VAA buffer.'];
467
- type: 'bytes';
468
- },
469
- ];
470
- };
471
- },
472
- ];
473
- types: [
474
- {
475
- name: 'InitializeArgs';
476
- docs: ['Arguments used to initialize the Core Bridge program.'];
477
- type: {
478
- kind: 'struct';
479
- fields: [
480
- {
481
- name: 'guardianSetTtlSeconds';
482
- type: 'u32';
483
- },
484
- {
485
- name: 'feeLamports';
486
- type: 'u64';
487
- },
488
- {
489
- name: 'initialGuardians';
490
- type: {
491
- vec: {
492
- array: ['u8', 20];
493
- };
494
- };
495
- },
496
- ];
497
- };
498
- },
499
- {
500
- name: 'PostMessageArgs';
501
- docs: [
502
- 'Arguments used to post a new Wormhole (Core Bridge) message either using',
503
- '[post_message](crate::legacy::instruction::post_message) or',
504
- '[post_message_unreliable](crate::legacy::instruction::post_message_unreliable).',
505
- ];
506
- type: {
507
- kind: 'struct';
508
- fields: [
509
- {
510
- name: 'nonce';
511
- docs: ['Unique id for this message.'];
512
- type: 'u32';
513
- },
514
- {
515
- name: 'payload';
516
- docs: ['Encoded message.'];
517
- type: 'bytes';
518
- },
519
- {
520
- name: 'commitment';
521
- docs: ['Solana commitment level for Guardian observation.'];
522
- type: {
523
- defined: 'Commitment';
524
- };
525
- },
526
- ];
527
- };
528
- },
529
- {
530
- name: 'PostVaaArgs';
531
- docs: [
532
- 'Arguments to post new VAA data after signature verification.',
533
- '',
534
- 'NOTE: It is preferred to use the new process of verifying a VAA using the new Core Bridge Anchor',
535
- 'instructions. See [init_encoded_vaa](crate::wormhole_core_bridge_solana::init_encoded_vaa) and',
536
- '[write_encoded_vaa](crate::wormhole_core_bridge_solana::write_encoded_vaa) for more info.',
537
- ];
538
- type: {
539
- kind: 'struct';
540
- fields: [
541
- {
542
- name: 'gap0';
543
- docs: ['Unused data.'];
544
- type: {
545
- array: ['u8', 5];
546
- };
547
- },
548
- {
549
- name: 'timestamp';
550
- docs: ['Time the message was submitted.'];
551
- type: 'u32';
552
- },
553
- {
554
- name: 'nonce';
555
- docs: ['Unique ID for this message.'];
556
- type: 'u32';
557
- },
558
- {
559
- name: 'emitterChain';
560
- docs: [
561
- 'The Wormhole chain ID denoting the origin of this message.',
562
- ];
563
- type: 'u16';
564
- },
565
- {
566
- name: 'emitterAddress';
567
- docs: ['Emitter of the message.'];
568
- type: {
569
- array: ['u8', 32];
570
- };
571
- },
572
- {
573
- name: 'sequence';
574
- docs: ['Sequence number of this message.'];
575
- type: 'u64';
576
- },
577
- {
578
- name: 'consistencyLevel';
579
- docs: ['Level of consistency requested by the emitter.'];
580
- type: 'u8';
581
- },
582
- {
583
- name: 'payload';
584
- docs: ['Message payload.'];
585
- type: 'bytes';
586
- },
587
- ];
588
- };
589
- },
590
- {
591
- name: 'VerifySignaturesArgs';
592
- docs: [
593
- 'Arguments to verify specific guardian indices.',
594
- '',
595
- 'NOTE: It is preferred to use the new process of verifying a VAA using the new Core Bridge Anchor',
596
- 'instructions. See [init_encoded_vaa](crate::wormhole_core_bridge_solana::init_encoded_vaa) and',
597
- '[write_encoded_vaa](crate::wormhole_core_bridge_solana::write_encoded_vaa) for more info.',
598
- ];
599
- type: {
600
- kind: 'struct';
601
- fields: [
602
- {
603
- name: 'signerIndices';
604
- docs: [
605
- 'Indices of verified guardian signatures, where -1 indicates a missing value. There is a',
606
- 'missing value if the guardian at this index is not expected to have its signature verfied by',
607
- 'the Sig Verify native program in the instruction invoked prior).',
608
- '',
609
- 'NOTE: In the legacy implementation, this argument being a fixed-sized array of 19 only',
610
- 'allows the first 19 guardians of any size guardian set to be verified. Because of this, it',
611
- 'is absolutely important to use the new process of verifying a VAA.',
612
- ];
613
- type: {
614
- array: ['i8', 19];
615
- };
616
- },
617
- ];
618
- };
619
- },
620
- {
621
- name: 'EmptyArgs';
622
- docs: ['Unit struct used to represent an empty instruction argument.'];
623
- type: {
624
- kind: 'struct';
625
- fields: [];
626
- };
627
- },
628
- {
629
- name: 'Config';
630
- docs: [
631
- 'Account used to store the current configuration of the bridge, including tracking Wormhole fee',
632
- 'payments. For governance decrees, the guardian set index is used to determine whether a decree',
633
- 'was attested for using the latest guardian set.',
634
- ];
635
- type: {
636
- kind: 'struct';
637
- fields: [
638
- {
639
- name: 'guardianSetIndex';
640
- docs: [
641
- 'The current guardian set index, used to decide which signature sets to accept.',
642
- ];
643
- type: 'u32';
644
- },
645
- {
646
- name: 'gap0';
647
- docs: [
648
- 'Gap. In the old implementation, this was an amount that kept track of message fees that',
649
- "were paid to the program's fee collector.",
650
- ];
651
- type: {
652
- array: ['u8', 8];
653
- };
654
- },
655
- {
656
- name: 'guardianSetTtl';
657
- docs: [
658
- 'Period for how long a guardian set is valid after it has been replaced by a new one. This',
659
- 'guarantees that VAAs issued by that set can still be submitted for a certain period. In',
660
- 'this period we still trust the old guardian set.',
661
- ];
662
- type: {
663
- defined: 'Duration';
664
- };
665
- },
666
- {
667
- name: 'feeLamports';
668
- docs: [
669
- 'Amount of lamports that needs to be paid to the protocol to post a message',
670
- ];
671
- type: 'u64';
672
- },
673
- ];
674
- };
675
- },
676
- {
677
- name: 'LegacyEmitterSequence';
678
- docs: [
679
- 'Account used to store the current sequence number for a given emitter.',
680
- ];
681
- type: {
682
- kind: 'struct';
683
- fields: [
684
- {
685
- name: 'value';
686
- docs: [
687
- 'Current sequence number, which will be used the next time this emitter publishes a message.',
688
- ];
689
- type: 'u64';
690
- },
691
- ];
692
- };
693
- },
694
- {
695
- name: 'EmitterSequence';
696
- type: {
697
- kind: 'struct';
698
- fields: [
699
- {
700
- name: 'legacy';
701
- type: {
702
- defined: 'LegacyEmitterSequence';
703
- };
704
- },
705
- {
706
- name: 'bump';
707
- type: 'u8';
708
- },
709
- {
710
- name: 'emitterType';
711
- type: {
712
- defined: 'EmitterType';
713
- };
714
- },
715
- ];
716
- };
717
- },
718
- {
719
- name: 'PostedMessageV1Unreliable';
720
- docs: ['Account used to store a published (reusable) Wormhole message.'];
721
- type: {
722
- kind: 'struct';
723
- fields: [
724
- {
725
- name: 'data';
726
- type: {
727
- defined: 'PostedMessageV1Data';
728
- };
729
- },
730
- ];
731
- };
732
- },
733
- {
734
- name: 'PostedMessageV1Info';
735
- docs: [
736
- 'Message metadata defining information about a published Wormhole message.',
737
- ];
738
- type: {
739
- kind: 'struct';
740
- fields: [
741
- {
742
- name: 'consistencyLevel';
743
- docs: ['Level of consistency requested by the emitter.'];
744
- type: 'u8';
745
- },
746
- {
747
- name: 'emitterAuthority';
748
- docs: [
749
- 'Authority used to write the message. This field is set to default when the message is',
750
- 'posted.',
751
- ];
752
- type: 'publicKey';
753
- },
754
- {
755
- name: 'status';
756
- docs: [
757
- 'If a message is being written to, this status is used to determine which state this',
758
- 'account is in (e.g. [MessageStatus::Writing] indicates that the emitter authority is still',
759
- 'writing its message to this account). When this message is posted, this value will be',
760
- 'set to [MessageStatus::Published].',
761
- ];
762
- type: {
763
- defined: 'MessageStatus';
764
- };
765
- },
766
- {
767
- name: 'gap0';
768
- docs: ['No data is stored here.'];
769
- type: {
770
- array: ['u8', 3];
771
- };
772
- },
773
- {
774
- name: 'postedTimestamp';
775
- docs: ['Time the posted message was created.'];
776
- type: {
777
- defined: 'Timestamp';
778
- };
779
- },
780
- {
781
- name: 'nonce';
782
- docs: ['Unique id for this message.'];
783
- type: 'u32';
784
- },
785
- {
786
- name: 'sequence';
787
- docs: ['Sequence number of this message.'];
788
- type: 'u64';
789
- },
790
- {
791
- name: 'solanaChainId';
792
- docs: [
793
- 'Always `1`.',
794
- '',
795
- 'NOTE: Saving this value is silly, but we are keeping it to be consistent with how the posted',
796
- 'message account is written.',
797
- ];
798
- type: {
799
- defined: 'ChainIdSolanaOnly';
800
- };
801
- },
802
- {
803
- name: 'emitter';
804
- docs: [
805
- 'Emitter of the message. This may either be the emitter authority or a program ID.',
806
- ];
807
- type: 'publicKey';
808
- },
809
- ];
810
- };
811
- },
812
- {
813
- name: 'PostedMessageV1Data';
814
- docs: [
815
- 'Underlying data for either [PostedMessageV1](crate::legacy::state::PostedMessageV1) or',
816
- '[PostedMessageV1Unreliable](crate::legacy::state::PostedMessageV1Unreliable).',
817
- ];
818
- type: {
819
- kind: 'struct';
820
- fields: [
821
- {
822
- name: 'info';
823
- docs: ['Message metadata.'];
824
- type: {
825
- defined: 'PostedMessageV1Info';
826
- };
827
- },
828
- {
829
- name: 'payload';
830
- docs: ['Encoded message.'];
831
- type: 'bytes';
832
- },
833
- ];
834
- };
835
- },
836
- {
837
- name: 'PostedMessageV1';
838
- docs: [
839
- 'Account used to store a published Wormhole message.',
840
- '',
841
- 'NOTE: If your integration requires reusable message accounts, please see',
842
- '[PostedMessageV1Unreliable](crate::legacy::state::PostedMessageV1Unreliable).',
843
- ];
844
- type: {
845
- kind: 'struct';
846
- fields: [
847
- {
848
- name: 'data';
849
- docs: ['Message data.'];
850
- type: {
851
- defined: 'PostedMessageV1Data';
852
- };
853
- },
854
- ];
855
- };
856
- },
857
- {
858
- name: 'PostedVaaV1Info';
859
- docs: [
860
- 'VAA metadata defining information about a Wormhole message attested for by an active guardian',
861
- 'set.',
862
- ];
863
- type: {
864
- kind: 'struct';
865
- fields: [
866
- {
867
- name: 'consistencyLevel';
868
- docs: ['Level of consistency requested by the emitter.'];
869
- type: 'u8';
870
- },
871
- {
872
- name: 'timestamp';
873
- docs: ['Time the message was submitted.'];
874
- type: {
875
- defined: 'Timestamp';
876
- };
877
- },
878
- {
879
- name: 'signatureSet';
880
- docs: [
881
- "Pubkey of [SignatureSet](crate::state::SignatureSet) account that represents this VAA's",
882
- 'signature verification.',
883
- ];
884
- type: 'publicKey';
885
- },
886
- {
887
- name: 'guardianSetIndex';
888
- docs: [
889
- 'Guardian set index used to verify signatures for [SignatureSet](crate::state::SignatureSet).',
890
- '',
891
- 'NOTE: In the previous implementation, this member was referred to as the "posted timestamp",',
892
- 'which is zero for VAA data (posted messages and VAAs resemble the same account schema). By',
893
- 'changing this to the guardian set index, we patch a bug with verifying governance VAAs for',
894
- 'the Core Bridge (other Core Bridge implementations require that the guardian set that',
895
- 'attested for the governance VAA is the current one).',
896
- ];
897
- type: 'u32';
898
- },
899
- {
900
- name: 'nonce';
901
- docs: ['Unique ID for this message.'];
902
- type: 'u32';
903
- },
904
- {
905
- name: 'sequence';
906
- docs: ['Sequence number of this message.'];
907
- type: 'u64';
908
- },
909
- {
910
- name: 'emitterChain';
911
- docs: [
912
- 'The Wormhole chain ID denoting the origin of this message.',
913
- ];
914
- type: 'u16';
915
- },
916
- {
917
- name: 'emitterAddress';
918
- docs: ['Emitter of the message.'];
919
- type: {
920
- array: ['u8', 32];
921
- };
922
- },
923
- ];
924
- };
925
- },
926
- {
927
- name: 'PostedVaaV1';
928
- docs: ['Account used to store a verified VAA.'];
929
- type: {
930
- kind: 'struct';
931
- fields: [
932
- {
933
- name: 'info';
934
- docs: ['VAA metadata.'];
935
- type: {
936
- defined: 'PostedVaaV1Info';
937
- };
938
- },
939
- {
940
- name: 'payload';
941
- docs: ['Message payload.'];
942
- type: 'bytes';
943
- },
944
- ];
945
- };
946
- },
947
- {
948
- name: 'WriteEncodedVaaArgs';
949
- docs: [
950
- 'Arguments for the [write_encoded_vaa](crate::wormhole_core_bridge_solana::write_encoded_vaa)',
951
- 'instruction.',
952
- ];
953
- type: {
954
- kind: 'struct';
955
- fields: [
956
- {
957
- name: 'index';
958
- docs: ['Index of VAA buffer.'];
959
- type: 'u32';
960
- },
961
- {
962
- name: 'data';
963
- docs: [
964
- 'Data representing subset of VAA buffer starting at specified index.',
965
- ];
966
- type: 'bytes';
967
- },
968
- ];
969
- };
970
- },
971
- {
972
- name: 'InitMessageV1Args';
973
- docs: [
974
- 'Arguments for the [init_message_v1](crate::wormhole_core_bridge_solana::init_message_v1)',
975
- 'instruction.',
976
- ];
977
- type: {
978
- kind: 'struct';
979
- fields: [
980
- {
981
- name: 'nonce';
982
- docs: ['Unique id for this message.'];
983
- type: 'u32';
984
- },
985
- {
986
- name: 'commitment';
987
- docs: ['Solana commitment level for Guardian observation.'];
988
- type: {
989
- defined: 'Commitment';
990
- };
991
- },
992
- {
993
- name: 'cpiProgramId';
994
- docs: [
995
- 'Optional program ID if the emitter address will be your program ID.',
996
- '',
997
- 'NOTE: If `Some(program_id)`, your emitter authority seeds to be \\[b"emitter\\].',
998
- ];
999
- type: {
1000
- option: 'publicKey';
1001
- };
1002
- },
1003
- ];
1004
- };
1005
- },
1006
- {
1007
- name: 'WriteMessageV1Args';
1008
- docs: [
1009
- 'Arguments for the [write_message_v1](crate::wormhole_core_bridge_solana::write_message_v1)',
1010
- 'instruction.',
1011
- ];
1012
- type: {
1013
- kind: 'struct';
1014
- fields: [
1015
- {
1016
- name: 'index';
1017
- docs: ['Index of message buffer.'];
1018
- type: 'u32';
1019
- },
1020
- {
1021
- name: 'data';
1022
- docs: [
1023
- 'Data representing subset of message buffer starting at specified index.',
1024
- ];
1025
- type: 'bytes';
1026
- },
1027
- ];
1028
- };
1029
- },
1030
- {
1031
- name: 'Header';
1032
- docs: ['`EncodedVaa` account header.'];
1033
- type: {
1034
- kind: 'struct';
1035
- fields: [
1036
- {
1037
- name: 'status';
1038
- docs: [
1039
- 'Processing status. **This encoded VAA is only considered usable when this status is set',
1040
- 'to [Verified](ProcessingStatus::Verified).**',
1041
- ];
1042
- type: {
1043
- defined: 'ProcessingStatus';
1044
- };
1045
- },
1046
- {
1047
- name: 'writeAuthority';
1048
- docs: ['The authority that has write privilege to this account.'];
1049
- type: 'publicKey';
1050
- },
1051
- {
1052
- name: 'version';
1053
- docs: [
1054
- 'VAA version. Only when the VAA is verified is this version set to a value.',
1055
- ];
1056
- type: 'u8';
1057
- },
1058
- ];
1059
- };
1060
- },
1061
- {
1062
- name: 'Timestamp';
1063
- docs: [
1064
- 'This struct defines unix timestamp as u32 (as opposed to more modern systems that have adopted',
1065
- "i64). Methods for this struct are meant to convert Solana's clock type to this type assuming we",
1066
- 'are far from year 2038.',
1067
- ];
1068
- type: {
1069
- kind: 'struct';
1070
- fields: [
1071
- {
1072
- name: 'value';
1073
- type: 'u32';
1074
- },
1075
- ];
1076
- };
1077
- },
1078
- {
1079
- name: 'Duration';
1080
- docs: [
1081
- 'To be used with the [Timestamp] type, this struct defines a duration in seconds.',
1082
- ];
1083
- type: {
1084
- kind: 'struct';
1085
- fields: [
1086
- {
1087
- name: 'seconds';
1088
- type: 'u32';
1089
- },
1090
- ];
1091
- };
1092
- },
1093
- {
1094
- name: 'MessageHash';
1095
- docs: ['This type is used to represent a message hash (keccak).'];
1096
- type: {
1097
- kind: 'struct';
1098
- fields: [
1099
- {
1100
- name: 'bytes';
1101
- type: {
1102
- array: ['u8', 32];
1103
- };
1104
- },
1105
- ];
1106
- };
1107
- },
1108
- {
1109
- name: 'ChainIdSolanaOnly';
1110
- docs: [
1111
- 'This type is kind of silly. But because [PostedMessageV1](crate::state::PostedMessageV1) has the',
1112
- "emitter chain ID as a field, which is unnecessary since it is always Solana's chain ID, we use",
1113
- 'this type to guarantee that the encoded chain ID is always `1`.',
1114
- ];
1115
- type: {
1116
- kind: 'struct';
1117
- fields: [
1118
- {
1119
- name: 'chainId';
1120
- type: 'u16';
1121
- },
1122
- ];
1123
- };
1124
- },
1125
- {
1126
- name: 'EmitterInfo';
1127
- type: {
1128
- kind: 'struct';
1129
- fields: [
1130
- {
1131
- name: 'chain';
1132
- type: 'u16';
1133
- },
1134
- {
1135
- name: 'address';
1136
- type: {
1137
- array: ['u8', 32];
1138
- };
1139
- },
1140
- {
1141
- name: 'sequence';
1142
- type: 'u64';
1143
- },
1144
- ];
1145
- };
1146
- },
1147
- {
1148
- name: 'LegacyInstruction';
1149
- docs: [
1150
- 'Legacy instruction selector.',
1151
- '',
1152
- 'NOTE: No more instructions should be added to this enum. Instead, add them as Anchor instruction',
1153
- 'handlers, which will inevitably live in',
1154
- '[wormhole_core_bridge_solana](crate::wormhole_core_bridge_solana).',
1155
- ];
1156
- type: {
1157
- kind: 'enum';
1158
- variants: [
1159
- {
1160
- name: 'Initialize';
1161
- },
1162
- {
1163
- name: 'PostMessage';
1164
- },
1165
- {
1166
- name: 'PostVaa';
1167
- },
1168
- {
1169
- name: 'SetMessageFee';
1170
- },
1171
- {
1172
- name: 'TransferFees';
1173
- },
1174
- {
1175
- name: 'UpgradeContract';
1176
- },
1177
- {
1178
- name: 'GuardianSetUpdate';
1179
- },
1180
- {
1181
- name: 'VerifySignatures';
1182
- },
1183
- {
1184
- name: 'PostMessageUnreliable';
1185
- },
1186
- ];
1187
- };
1188
- },
1189
- {
1190
- name: 'EmitterType';
1191
- type: {
1192
- kind: 'enum';
1193
- variants: [
1194
- {
1195
- name: 'Unset';
1196
- },
1197
- {
1198
- name: 'Legacy';
1199
- },
1200
- {
1201
- name: 'Executable';
1202
- },
1203
- ];
1204
- };
1205
- },
1206
- {
1207
- name: 'MessageStatus';
1208
- docs: [
1209
- 'Status of a message. When a message is posted, its status is',
1210
- '[Published](MessageStatus::Published).',
1211
- ];
1212
- type: {
1213
- kind: 'enum';
1214
- variants: [
1215
- {
1216
- name: 'Published';
1217
- },
1218
- {
1219
- name: 'Writing';
1220
- },
1221
- {
1222
- name: 'ReadyForPublishing';
1223
- },
1224
- ];
1225
- };
1226
- },
1227
- {
1228
- name: 'PublishMessageDirective';
1229
- docs: ['Directive used to determine how to post a Core Bridge message.'];
1230
- type: {
1231
- kind: 'enum';
1232
- variants: [
1233
- {
1234
- name: 'Message';
1235
- fields: [
1236
- {
1237
- name: 'nonce';
1238
- type: 'u32';
1239
- },
1240
- {
1241
- name: 'payload';
1242
- type: 'bytes';
1243
- },
1244
- {
1245
- name: 'commitment';
1246
- type: {
1247
- defined: 'Commitment';
1248
- };
1249
- },
1250
- ];
1251
- },
1252
- {
1253
- name: 'ProgramMessage';
1254
- fields: [
1255
- {
1256
- name: 'programId';
1257
- type: 'publicKey';
1258
- },
1259
- {
1260
- name: 'nonce';
1261
- type: 'u32';
1262
- },
1263
- {
1264
- name: 'payload';
1265
- type: 'bytes';
1266
- },
1267
- {
1268
- name: 'commitment';
1269
- type: {
1270
- defined: 'Commitment';
1271
- };
1272
- },
1273
- ];
1274
- },
1275
- {
1276
- name: 'PreparedMessage';
1277
- },
1278
- ];
1279
- };
1280
- },
1281
- {
1282
- name: 'ProcessingStatus';
1283
- docs: ["Encoded VAA's processing status."];
1284
- type: {
1285
- kind: 'enum';
1286
- variants: [
1287
- {
1288
- name: 'Unset';
1289
- },
1290
- {
1291
- name: 'Writing';
1292
- },
1293
- {
1294
- name: 'Verified';
1295
- },
1296
- ];
1297
- };
1298
- },
1299
- {
1300
- name: 'Commitment';
1301
- docs: [
1302
- "Representation of Solana's commitment levels. This enum is not exhaustive because Wormhole only",
1303
- 'considers these two commitment levels in its Guardian observation.',
1304
- '',
1305
- 'See <https://docs.solana.com/cluster/commitments> for more info.',
1306
- ];
1307
- type: {
1308
- kind: 'enum';
1309
- variants: [
1310
- {
1311
- name: 'Confirmed';
1312
- },
1313
- {
1314
- name: 'Finalized';
1315
- },
1316
- ];
1317
- };
1318
- },
1319
- ];
1320
- errors: [
1321
- {
1322
- code: 6002;
1323
- name: 'InvalidInstructionArgument';
1324
- msg: 'InvalidInstructionArgument';
1325
- },
1326
- {
1327
- code: 6003;
1328
- name: 'AccountNotZeroed';
1329
- msg: 'AccountNotZeroed';
1330
- },
1331
- {
1332
- code: 6004;
1333
- name: 'InvalidDataConversion';
1334
- msg: 'InvalidDataConversion';
1335
- },
1336
- {
1337
- code: 6006;
1338
- name: 'U64Overflow';
1339
- msg: 'U64Overflow';
1340
- },
1341
- {
1342
- code: 6008;
1343
- name: 'InvalidComputeSize';
1344
- msg: 'InvalidComputeSize';
1345
- },
1346
- {
1347
- code: 6016;
1348
- name: 'InvalidChain';
1349
- msg: 'InvalidChain';
1350
- },
1351
- {
1352
- code: 6032;
1353
- name: 'InvalidGovernanceEmitter';
1354
- msg: 'InvalidGovernanceEmitter';
1355
- },
1356
- {
1357
- code: 6034;
1358
- name: 'InvalidGovernanceAction';
1359
- msg: 'InvalidGovernanceAction';
1360
- },
1361
- {
1362
- code: 6036;
1363
- name: 'LatestGuardianSetRequired';
1364
- msg: 'LatestGuardianSetRequired';
1365
- },
1366
- {
1367
- code: 6038;
1368
- name: 'GovernanceForAnotherChain';
1369
- msg: 'GovernanceForAnotherChain';
1370
- },
1371
- {
1372
- code: 6040;
1373
- name: 'InvalidGovernanceVaa';
1374
- msg: 'InvalidGovernanceVaa';
1375
- },
1376
- {
1377
- code: 6256;
1378
- name: 'InsufficientFees';
1379
- msg: 'InsufficientFees';
1380
- },
1381
- {
1382
- code: 6258;
1383
- name: 'EmitterMismatch';
1384
- msg: 'EmitterMismatch';
1385
- },
1386
- {
1387
- code: 6260;
1388
- name: 'NotReadyForPublishing';
1389
- msg: 'NotReadyForPublishing';
1390
- },
1391
- {
1392
- code: 6262;
1393
- name: 'InvalidPreparedMessage';
1394
- msg: 'InvalidPreparedMessage';
1395
- },
1396
- {
1397
- code: 6264;
1398
- name: 'ExecutableEmitter';
1399
- msg: 'ExecutableEmitter';
1400
- },
1401
- {
1402
- code: 6266;
1403
- name: 'LegacyEmitter';
1404
- msg: 'LegacyEmitter';
1405
- },
1406
- {
1407
- code: 6512;
1408
- name: 'InvalidSignatureSet';
1409
- msg: 'InvalidSignatureSet';
1410
- },
1411
- {
1412
- code: 6514;
1413
- name: 'InvalidMessageHash';
1414
- msg: 'InvalidMessageHash';
1415
- },
1416
- {
1417
- code: 6515;
1418
- name: 'NoQuorum';
1419
- msg: 'NoQuorum';
1420
- },
1421
- {
1422
- code: 6516;
1423
- name: 'MessageMismatch';
1424
- msg: 'MessageMismatch';
1425
- },
1426
- {
1427
- code: 7024;
1428
- name: 'NotEnoughLamports';
1429
- msg: 'NotEnoughLamports';
1430
- },
1431
- {
1432
- code: 7026;
1433
- name: 'InvalidFeeRecipient';
1434
- msg: 'InvalidFeeRecipient';
1435
- },
1436
- {
1437
- code: 7280;
1438
- name: 'ImplementationMismatch';
1439
- msg: 'ImplementationMismatch';
1440
- },
1441
- {
1442
- code: 7536;
1443
- name: 'InvalidGuardianSetIndex';
1444
- msg: 'InvalidGuardianSetIndex';
1445
- },
1446
- {
1447
- code: 7792;
1448
- name: 'GuardianSetMismatch';
1449
- msg: 'GuardianSetMismatch';
1450
- },
1451
- {
1452
- code: 7794;
1453
- name: 'InstructionAtWrongIndex';
1454
- msg: 'InstructionAtWrongIndex';
1455
- },
1456
- {
1457
- code: 7795;
1458
- name: 'EmptySigVerifyInstruction';
1459
- msg: 'EmptySigVerifyInstruction';
1460
- },
1461
- {
1462
- code: 7796;
1463
- name: 'InvalidSigVerifyInstruction';
1464
- msg: 'InvalidSigVerifyInstruction';
1465
- },
1466
- {
1467
- code: 7798;
1468
- name: 'GuardianSetExpired';
1469
- msg: 'GuardianSetExpired';
1470
- },
1471
- {
1472
- code: 7800;
1473
- name: 'InvalidGuardianKeyRecovery';
1474
- msg: 'InvalidGuardianKeyRecovery';
1475
- },
1476
- {
1477
- code: 7802;
1478
- name: 'SignerIndicesMismatch';
1479
- msg: 'SignerIndicesMismatch';
1480
- },
1481
- {
1482
- code: 8048;
1483
- name: 'PayloadSizeMismatch';
1484
- msg: 'PayloadSizeMismatch';
1485
- },
1486
- {
1487
- code: 10112;
1488
- name: 'ZeroGuardians';
1489
- msg: 'ZeroGuardians';
1490
- },
1491
- {
1492
- code: 10128;
1493
- name: 'GuardianZeroAddress';
1494
- msg: 'GuardianZeroAddress';
1495
- },
1496
- {
1497
- code: 10144;
1498
- name: 'DuplicateGuardianAddress';
1499
- msg: 'DuplicateGuardianAddress';
1500
- },
1501
- {
1502
- code: 10160;
1503
- name: 'MessageAlreadyPublished';
1504
- msg: 'MessageAlreadyPublished';
1505
- },
1506
- {
1507
- code: 10176;
1508
- name: 'VaaWritingDisallowed';
1509
- msg: 'VaaWritingDisallowed';
1510
- },
1511
- {
1512
- code: 10192;
1513
- name: 'VaaAlreadyVerified';
1514
- msg: 'VaaAlreadyVerified';
1515
- },
1516
- {
1517
- code: 10208;
1518
- name: 'InvalidGuardianIndex';
1519
- msg: 'InvalidGuardianIndex';
1520
- },
1521
- {
1522
- code: 10224;
1523
- name: 'InvalidSignature';
1524
- msg: 'InvalidSignature';
1525
- },
1526
- {
1527
- code: 10256;
1528
- name: 'UnverifiedVaa';
1529
- msg: 'UnverifiedVaa';
1530
- },
1531
- {
1532
- code: 10258;
1533
- name: 'VaaStillProcessing';
1534
- msg: 'VaaStillProcessing';
1535
- },
1536
- {
1537
- code: 10260;
1538
- name: 'InWritingStatus';
1539
- msg: 'InWritingStatus';
1540
- },
1541
- {
1542
- code: 10262;
1543
- name: 'NotInWritingStatus';
1544
- msg: 'NotInWritingStatus';
1545
- },
1546
- {
1547
- code: 10264;
1548
- name: 'InvalidMessageStatus';
1549
- msg: 'InvalidMessageStatus';
1550
- },
1551
- {
1552
- code: 10266;
1553
- name: 'HashNotComputed';
1554
- msg: 'HashNotComputed';
1555
- },
1556
- {
1557
- code: 10268;
1558
- name: 'InvalidVaaVersion';
1559
- msg: 'InvalidVaaVersion';
1560
- },
1561
- {
1562
- code: 10270;
1563
- name: 'InvalidCreatedAccountSize';
1564
- msg: 'InvalidCreatedAccountSize';
1565
- },
1566
- {
1567
- code: 10272;
1568
- name: 'DataOverflow';
1569
- msg: 'DataOverflow';
1570
- },
1571
- {
1572
- code: 10274;
1573
- name: 'ExceedsMaxPayloadSize';
1574
- msg: 'ExceedsMaxPayloadSize (30KB)';
1575
- },
1576
- {
1577
- code: 10276;
1578
- name: 'CannotParseVaa';
1579
- msg: 'CannotParseVaa';
1580
- },
1581
- {
1582
- code: 10278;
1583
- name: 'EmitterAuthorityMismatch';
1584
- msg: 'EmitterAuthorityMismatch';
1585
- },
1586
- {
1587
- code: 10280;
1588
- name: 'InvalidProgramEmitter';
1589
- msg: 'InvalidProgramEmitter';
1590
- },
1591
- {
1592
- code: 10282;
1593
- name: 'WriteAuthorityMismatch';
1594
- msg: 'WriteAuthorityMismatch';
1595
- },
1596
- {
1597
- code: 10284;
1598
- name: 'PostedVaaPayloadTooLarge';
1599
- msg: 'PostedVaaPayloadTooLarge';
1600
- },
1601
- {
1602
- code: 10286;
1603
- name: 'ExecutableDisallowed';
1604
- msg: 'ExecutableDisallowed';
1605
- },
1606
- ];
1607
- };
1608
-
1609
- export const WORMHOLE_CORE_BRIDGE_SOLANA_IDL: WormholeCoreBridgeSolana = {
1610
- version: '0.0.1-alpha.5',
1611
- name: 'wormhole_core_bridge_solana',
1612
- constants: [
1613
- {
1614
- name: 'SOLANA_CHAIN',
1615
- type: 'u16',
1616
- value: '1',
1617
- },
1618
- {
1619
- name: 'FEE_COLLECTOR_SEED_PREFIX',
1620
- type: 'bytes',
1621
- value: '[102, 101, 101, 95, 99, 111, 108, 108, 101, 99, 116, 111, 114]',
1622
- },
1623
- {
1624
- name: 'UPGRADE_SEED_PREFIX',
1625
- type: 'bytes',
1626
- value: '[117, 112, 103, 114, 97, 100, 101]',
1627
- },
1628
- {
1629
- name: 'PROGRAM_EMITTER_SEED_PREFIX',
1630
- type: 'bytes',
1631
- value: '[101, 109, 105, 116, 116, 101, 114]',
1632
- },
1633
- {
1634
- name: 'MAX_MESSAGE_PAYLOAD_SIZE',
1635
- type: {
1636
- defined: 'usize',
1637
- },
1638
- value: '30 * 1_024',
1639
- },
1640
- ],
1641
- instructions: [
1642
- {
1643
- name: 'initMessageV1',
1644
- docs: [
1645
- 'Processor for initializing a new draft [PostedMessageV1](crate::state::PostedMessageV1)',
1646
- 'account for writing. The emitter authority is established at this point and the payload size',
1647
- 'is inferred from the size of the created account. This instruction handler also allows an',
1648
- "integrator to publish Wormhole messages using his program's ID as the emitter address",
1649
- '(by passing `Some(crate::ID)` to the [cpi_program_id](InitMessageV1Args::cpi_program_id)',
1650
- 'argument). **Be aware that the emitter authority\'s seeds must only be \\[b"emitter"\\] in this',
1651
- 'case.**',
1652
- '',
1653
- 'This instruction should be followed up with `write_message_v1` and `finalize_message_v1` to',
1654
- 'write and indicate that the message is ready for publishing respectively (to prepare it for',
1655
- 'publishing via the',
1656
- '[post message instruction](crate::legacy::instruction::LegacyInstruction::PostMessage)).',
1657
- '',
1658
- 'NOTE: If you wish to publish a small message (one where the data does not overflow the',
1659
- 'Solana transaction size), it is recommended that you use an [sdk](crate::sdk::cpi) method to',
1660
- 'either prepare your message or post a message as a program ID emitter.',
1661
- ],
1662
- accounts: [
1663
- {
1664
- name: 'emitterAuthority',
1665
- isMut: false,
1666
- isSigner: true,
1667
- docs: [
1668
- 'This authority is the only one who can write to the draft message account.',
1669
- ],
1670
- },
1671
- {
1672
- name: 'draftMessage',
1673
- isMut: true,
1674
- isSigner: false,
1675
- docs: ['Bridge.'],
1676
- },
1677
- ],
1678
- args: [
1679
- {
1680
- name: 'args',
1681
- type: {
1682
- defined: 'InitMessageV1Args',
1683
- },
1684
- },
1685
- ],
1686
- },
1687
- {
1688
- name: 'writeMessageV1',
1689
- docs: [
1690
- 'Processor used to write to a draft [PostedMessageV1](crate::state::PostedMessageV1) account.',
1691
- 'This instruction requires an authority (the emitter authority) to interact with the message',
1692
- 'account.',
1693
- ],
1694
- accounts: [
1695
- {
1696
- name: 'emitterAuthority',
1697
- isMut: false,
1698
- isSigner: true,
1699
- },
1700
- {
1701
- name: 'draftMessage',
1702
- isMut: true,
1703
- isSigner: false,
1704
- docs: ['only be published when the message is finalized.'],
1705
- },
1706
- ],
1707
- args: [
1708
- {
1709
- name: 'args',
1710
- type: {
1711
- defined: 'WriteMessageV1Args',
1712
- },
1713
- },
1714
- ],
1715
- },
1716
- {
1717
- name: 'finalizeMessageV1',
1718
- docs: [
1719
- 'Processor used to finalize a draft [PostedMessageV1](crate::state::PostedMessageV1) account.',
1720
- 'Once finalized, this message account cannot be written to again. A finalized message is the',
1721
- 'only state the legacy post message instruction can accept before publishing. This',
1722
- 'instruction requires an authority (the emitter authority) to interact with the message',
1723
- 'account.',
1724
- ],
1725
- accounts: [
1726
- {
1727
- name: 'emitterAuthority',
1728
- isMut: false,
1729
- isSigner: true,
1730
- },
1731
- {
1732
- name: 'draftMessage',
1733
- isMut: true,
1734
- isSigner: false,
1735
- docs: ['only be published when the message is finalized.'],
1736
- },
1737
- ],
1738
- args: [],
1739
- },
1740
- {
1741
- name: 'closeMessageV1',
1742
- docs: [
1743
- 'Processor used to process a draft [PostedMessageV1](crate::state::PostedMessageV1) account.',
1744
- 'This instruction requires an authority (the emitter authority) to interact with the message',
1745
- 'account.',
1746
- ],
1747
- accounts: [
1748
- {
1749
- name: 'emitterAuthority',
1750
- isMut: false,
1751
- isSigner: true,
1752
- },
1753
- {
1754
- name: 'draftMessage',
1755
- isMut: true,
1756
- isSigner: false,
1757
- docs: ['only be published when the message is finalized.'],
1758
- },
1759
- {
1760
- name: 'closeAccountDestination',
1761
- isMut: true,
1762
- isSigner: false,
1763
- },
1764
- ],
1765
- args: [],
1766
- },
1767
- {
1768
- name: 'initEncodedVaa',
1769
- docs: [
1770
- 'Processor used to intialize a created account as [EncodedVaa](crate::state::EncodedVaa). An',
1771
- 'authority (the write authority) is established with this instruction.',
1772
- ],
1773
- accounts: [
1774
- {
1775
- name: 'writeAuthority',
1776
- isMut: false,
1777
- isSigner: true,
1778
- docs: [
1779
- 'The authority who can write to the VAA account when it is being processed.',
1780
- ],
1781
- },
1782
- {
1783
- name: 'encodedVaa',
1784
- isMut: true,
1785
- isSigner: false,
1786
- docs: ['Bridge.'],
1787
- },
1788
- ],
1789
- args: [],
1790
- },
1791
- {
1792
- name: 'closeEncodedVaa',
1793
- docs: [
1794
- 'Processor used to close an [EncodedVaa](crate::state::EncodedVaa). This instruction requires',
1795
- 'an authority (the write authority) to interact witht he encoded VAA account.',
1796
- ],
1797
- accounts: [
1798
- {
1799
- name: 'writeAuthority',
1800
- isMut: true,
1801
- isSigner: true,
1802
- docs: [
1803
- 'This account is only required to be mutable for the `CloseVaaAccount` directive. This',
1804
- 'authority is the same signer that originally created the VAA accounts, so he is the one that',
1805
- 'will receive the lamports back for the closed accounts.',
1806
- ],
1807
- },
1808
- {
1809
- name: 'encodedVaa',
1810
- isMut: true,
1811
- isSigner: false,
1812
- docs: ['written to and then verified.'],
1813
- },
1814
- ],
1815
- args: [],
1816
- },
1817
- {
1818
- name: 'writeEncodedVaa',
1819
- docs: [
1820
- 'Processor used to write to an [EncodedVaa](crate::state::EncodedVaa) account. This',
1821
- 'instruction requires an authority (the write authority) to interact with the encoded VAA',
1822
- 'account.',
1823
- ],
1824
- accounts: [
1825
- {
1826
- name: 'writeAuthority',
1827
- isMut: false,
1828
- isSigner: true,
1829
- docs: [
1830
- 'The only authority that can write to the encoded VAA account.',
1831
- ],
1832
- },
1833
- {
1834
- name: 'draftVaa',
1835
- isMut: true,
1836
- isSigner: false,
1837
- docs: ['written to and then verified.'],
1838
- },
1839
- ],
1840
- args: [
1841
- {
1842
- name: 'args',
1843
- type: {
1844
- defined: 'WriteEncodedVaaArgs',
1845
- },
1846
- },
1847
- ],
1848
- },
1849
- {
1850
- name: 'verifyEncodedVaaV1',
1851
- docs: [
1852
- 'Processor used to verify an [EncodedVaa](crate::state::EncodedVaa) account as a version 1',
1853
- 'VAA (guardian signatures attesting to this observation). This instruction requires an',
1854
- 'authority (the write authority) to interact with the encoded VAA account.',
1855
- ],
1856
- accounts: [
1857
- {
1858
- name: 'writeAuthority',
1859
- isMut: false,
1860
- isSigner: true,
1861
- },
1862
- {
1863
- name: 'draftVaa',
1864
- isMut: true,
1865
- isSigner: false,
1866
- docs: ['written to and then verified.'],
1867
- },
1868
- {
1869
- name: 'guardianSet',
1870
- isMut: false,
1871
- isSigner: false,
1872
- docs: [
1873
- 'Guardian set account, which should be the same one that was used to attest for the VAA. The',
1874
- 'signatures in the encoded VAA are verified against this guardian set.',
1875
- ],
1876
- },
1877
- ],
1878
- args: [],
1879
- },
1880
- {
1881
- name: 'postVaaV1',
1882
- docs: [
1883
- 'Processor used to close an [EncodedVaa](crate::state::EncodedVaa) account to create a',
1884
- '[PostedMessageV1](crate::state::PostedMessageV1) account in its place.',
1885
- '',
1886
- 'NOTE: Because the legacy verify signatures instruction was not required for the Posted VAA',
1887
- 'account to exist, the encoded [SignatureSet](crate::state::SignatureSet) is the default',
1888
- '[Pubkey].',
1889
- ],
1890
- accounts: [
1891
- {
1892
- name: 'payer',
1893
- isMut: true,
1894
- isSigner: true,
1895
- docs: [
1896
- 'Payer to create the posted VAA account. This instruction allows anyone with an encoded VAA',
1897
- 'to create a posted VAA account.',
1898
- ],
1899
- },
1900
- {
1901
- name: 'encodedVaa',
1902
- isMut: false,
1903
- isSigner: false,
1904
- docs: [
1905
- 'Encoded VAA, whose body will be serialized into the posted VAA account.',
1906
- '',
1907
- 'NOTE: This instruction handler only exists to support integrators that still rely on posted',
1908
- 'VAA accounts. While we encourage integrators to use the encoded VAA account instead, we',
1909
- 'allow a pathway to convert the encoded VAA into a posted VAA. However, the payload is',
1910
- 'restricted to 9.5KB, which is much larger than what was possible with the old implementation',
1911
- 'using the legacy post vaa instruction. The Core Bridge program will not support posting VAAs',
1912
- 'larger than this payload size.',
1913
- ],
1914
- },
1915
- {
1916
- name: 'postedVaa',
1917
- isMut: true,
1918
- isSigner: false,
1919
- },
1920
- {
1921
- name: 'systemProgram',
1922
- isMut: false,
1923
- isSigner: false,
1924
- },
1925
- ],
1926
- args: [],
1927
- },
1928
- {
1929
- name: 'closeSignatureSet',
1930
- docs: [
1931
- 'Processor used to close a [SignatureSet](crate::state::SignatureSet), which was used to',
1932
- 'verify the VAA using the legacy parse and verify procedure.',
1933
- ],
1934
- accounts: [
1935
- {
1936
- name: 'solDestination',
1937
- isMut: true,
1938
- isSigner: true,
1939
- },
1940
- {
1941
- name: 'postedVaa',
1942
- isMut: false,
1943
- isSigner: false,
1944
- docs: ['Posted VAA.'],
1945
- },
1946
- {
1947
- name: 'signatureSet',
1948
- isMut: true,
1949
- isSigner: false,
1950
- docs: [
1951
- 'Signature set that may have been used to create the posted VAA account. If the `post_vaa_v1`',
1952
- 'instruction were used to create the posted VAA account, then the encoded signature set',
1953
- 'pubkey would be all zeroes.',
1954
- ],
1955
- },
1956
- ],
1957
- args: [],
1958
- },
1959
- ],
1960
- accounts: [
1961
- {
1962
- name: 'guardianSet',
1963
- docs: [
1964
- 'Account used to store a guardian set. The keys encoded in this account are Ethereum pubkeys.',
1965
- 'Its expiration time is determined at the time a guardian set is updated to a new set, where the',
1966
- 'current network clock time is used with',
1967
- '[guardian_set_ttl](crate::state::Config::guardian_set_ttl).',
1968
- '',
1969
- 'NOTE: The account schema is the same as legacy guardian sets, but this account now has a',
1970
- "discriminator generated by Anchor's [account] macro. When the Core Bridge program performs a",
1971
- 'guardian set update with this implementation, guardian sets will now have this Anchor-generated',
1972
- 'discriminator.',
1973
- ],
1974
- type: {
1975
- kind: 'struct',
1976
- fields: [
1977
- {
1978
- name: 'index',
1979
- docs: [
1980
- 'Index representing an incrementing version number for this guardian set.',
1981
- ],
1982
- type: 'u32',
1983
- },
1984
- {
1985
- name: 'keys',
1986
- docs: ['Ethereum-style public keys.'],
1987
- type: {
1988
- vec: {
1989
- array: ['u8', 20],
1990
- },
1991
- },
1992
- },
1993
- {
1994
- name: 'creationTime',
1995
- docs: [
1996
- 'Timestamp representing the time this guardian became active.',
1997
- ],
1998
- type: {
1999
- defined: 'Timestamp',
2000
- },
2001
- },
2002
- {
2003
- name: 'expirationTime',
2004
- docs: [
2005
- 'Expiration time when VAAs issued by this set are no longer valid.',
2006
- ],
2007
- type: {
2008
- defined: 'Timestamp',
2009
- },
2010
- },
2011
- ],
2012
- },
2013
- },
2014
- {
2015
- name: 'signatureSet',
2016
- docs: [
2017
- 'Account used to store information about a guardian set used to sign a VAA. There is only one',
2018
- 'signature set for each verified VAA (associated with a',
2019
- '[PostedVaaV1](crate::legacy::state::PostedVaaV1) account). This account is created using the',
2020
- 'verify signatures legacy instruction.',
2021
- '',
2022
- 'NOTE: The account schema is the same as legacy signature sets, but this account now has a',
2023
- "discriminator generated by Anchor's [account] macro. When the Core Bridge program upgrades to",
2024
- 'this implementation from the old one, integrators in the middle of verifying signatures will',
2025
- 'have to use a new keypair for this account and try again.',
2026
- ],
2027
- type: {
2028
- kind: 'struct',
2029
- fields: [
2030
- {
2031
- name: 'sigVerifySuccesses',
2032
- docs: ['Signatures of validators'],
2033
- type: {
2034
- vec: 'bool',
2035
- },
2036
- },
2037
- {
2038
- name: 'messageHash',
2039
- docs: ['Hash of the VAA message body.'],
2040
- type: {
2041
- defined: 'MessageHash',
2042
- },
2043
- },
2044
- {
2045
- name: 'guardianSetIndex',
2046
- docs: ['Index of the guardian set'],
2047
- type: 'u32',
2048
- },
2049
- ],
2050
- },
2051
- },
2052
- {
2053
- name: 'encodedVaa',
2054
- docs: [
2055
- 'Account used to warehouse VAA buffer.',
2056
- '',
2057
- "NOTE: This account should not be used by an external application unless the header's status is",
2058
- '`Verified`. It is encouraged to use the `EncodedVaa` zero-copy account struct instead.',
2059
- ],
2060
- type: {
2061
- kind: 'struct',
2062
- fields: [
2063
- {
2064
- name: 'header',
2065
- docs: ['Status, write authority and VAA version.'],
2066
- type: {
2067
- defined: 'Header',
2068
- },
2069
- },
2070
- {
2071
- name: 'buf',
2072
- docs: ['VAA buffer.'],
2073
- type: 'bytes',
2074
- },
2075
- ],
2076
- },
2077
- },
2078
- ],
2079
- types: [
2080
- {
2081
- name: 'InitializeArgs',
2082
- docs: ['Arguments used to initialize the Core Bridge program.'],
2083
- type: {
2084
- kind: 'struct',
2085
- fields: [
2086
- {
2087
- name: 'guardianSetTtlSeconds',
2088
- type: 'u32',
2089
- },
2090
- {
2091
- name: 'feeLamports',
2092
- type: 'u64',
2093
- },
2094
- {
2095
- name: 'initialGuardians',
2096
- type: {
2097
- vec: {
2098
- array: ['u8', 20],
2099
- },
2100
- },
2101
- },
2102
- ],
2103
- },
2104
- },
2105
- {
2106
- name: 'PostMessageArgs',
2107
- docs: [
2108
- 'Arguments used to post a new Wormhole (Core Bridge) message either using',
2109
- '[post_message](crate::legacy::instruction::post_message) or',
2110
- '[post_message_unreliable](crate::legacy::instruction::post_message_unreliable).',
2111
- ],
2112
- type: {
2113
- kind: 'struct',
2114
- fields: [
2115
- {
2116
- name: 'nonce',
2117
- docs: ['Unique id for this message.'],
2118
- type: 'u32',
2119
- },
2120
- {
2121
- name: 'payload',
2122
- docs: ['Encoded message.'],
2123
- type: 'bytes',
2124
- },
2125
- {
2126
- name: 'commitment',
2127
- docs: ['Solana commitment level for Guardian observation.'],
2128
- type: {
2129
- defined: 'Commitment',
2130
- },
2131
- },
2132
- ],
2133
- },
2134
- },
2135
- {
2136
- name: 'PostVaaArgs',
2137
- docs: [
2138
- 'Arguments to post new VAA data after signature verification.',
2139
- '',
2140
- 'NOTE: It is preferred to use the new process of verifying a VAA using the new Core Bridge Anchor',
2141
- 'instructions. See [init_encoded_vaa](crate::wormhole_core_bridge_solana::init_encoded_vaa) and',
2142
- '[write_encoded_vaa](crate::wormhole_core_bridge_solana::write_encoded_vaa) for more info.',
2143
- ],
2144
- type: {
2145
- kind: 'struct',
2146
- fields: [
2147
- {
2148
- name: 'gap0',
2149
- docs: ['Unused data.'],
2150
- type: {
2151
- array: ['u8', 5],
2152
- },
2153
- },
2154
- {
2155
- name: 'timestamp',
2156
- docs: ['Time the message was submitted.'],
2157
- type: 'u32',
2158
- },
2159
- {
2160
- name: 'nonce',
2161
- docs: ['Unique ID for this message.'],
2162
- type: 'u32',
2163
- },
2164
- {
2165
- name: 'emitterChain',
2166
- docs: [
2167
- 'The Wormhole chain ID denoting the origin of this message.',
2168
- ],
2169
- type: 'u16',
2170
- },
2171
- {
2172
- name: 'emitterAddress',
2173
- docs: ['Emitter of the message.'],
2174
- type: {
2175
- array: ['u8', 32],
2176
- },
2177
- },
2178
- {
2179
- name: 'sequence',
2180
- docs: ['Sequence number of this message.'],
2181
- type: 'u64',
2182
- },
2183
- {
2184
- name: 'consistencyLevel',
2185
- docs: ['Level of consistency requested by the emitter.'],
2186
- type: 'u8',
2187
- },
2188
- {
2189
- name: 'payload',
2190
- docs: ['Message payload.'],
2191
- type: 'bytes',
2192
- },
2193
- ],
2194
- },
2195
- },
2196
- {
2197
- name: 'VerifySignaturesArgs',
2198
- docs: [
2199
- 'Arguments to verify specific guardian indices.',
2200
- '',
2201
- 'NOTE: It is preferred to use the new process of verifying a VAA using the new Core Bridge Anchor',
2202
- 'instructions. See [init_encoded_vaa](crate::wormhole_core_bridge_solana::init_encoded_vaa) and',
2203
- '[write_encoded_vaa](crate::wormhole_core_bridge_solana::write_encoded_vaa) for more info.',
2204
- ],
2205
- type: {
2206
- kind: 'struct',
2207
- fields: [
2208
- {
2209
- name: 'signerIndices',
2210
- docs: [
2211
- 'Indices of verified guardian signatures, where -1 indicates a missing value. There is a',
2212
- 'missing value if the guardian at this index is not expected to have its signature verfied by',
2213
- 'the Sig Verify native program in the instruction invoked prior).',
2214
- '',
2215
- 'NOTE: In the legacy implementation, this argument being a fixed-sized array of 19 only',
2216
- 'allows the first 19 guardians of any size guardian set to be verified. Because of this, it',
2217
- 'is absolutely important to use the new process of verifying a VAA.',
2218
- ],
2219
- type: {
2220
- array: ['i8', 19],
2221
- },
2222
- },
2223
- ],
2224
- },
2225
- },
2226
- {
2227
- name: 'EmptyArgs',
2228
- docs: ['Unit struct used to represent an empty instruction argument.'],
2229
- type: {
2230
- kind: 'struct',
2231
- fields: [],
2232
- },
2233
- },
2234
- {
2235
- name: 'Config',
2236
- docs: [
2237
- 'Account used to store the current configuration of the bridge, including tracking Wormhole fee',
2238
- 'payments. For governance decrees, the guardian set index is used to determine whether a decree',
2239
- 'was attested for using the latest guardian set.',
2240
- ],
2241
- type: {
2242
- kind: 'struct',
2243
- fields: [
2244
- {
2245
- name: 'guardianSetIndex',
2246
- docs: [
2247
- 'The current guardian set index, used to decide which signature sets to accept.',
2248
- ],
2249
- type: 'u32',
2250
- },
2251
- {
2252
- name: 'gap0',
2253
- docs: [
2254
- 'Gap. In the old implementation, this was an amount that kept track of message fees that',
2255
- "were paid to the program's fee collector.",
2256
- ],
2257
- type: {
2258
- array: ['u8', 8],
2259
- },
2260
- },
2261
- {
2262
- name: 'guardianSetTtl',
2263
- docs: [
2264
- 'Period for how long a guardian set is valid after it has been replaced by a new one. This',
2265
- 'guarantees that VAAs issued by that set can still be submitted for a certain period. In',
2266
- 'this period we still trust the old guardian set.',
2267
- ],
2268
- type: {
2269
- defined: 'Duration',
2270
- },
2271
- },
2272
- {
2273
- name: 'feeLamports',
2274
- docs: [
2275
- 'Amount of lamports that needs to be paid to the protocol to post a message',
2276
- ],
2277
- type: 'u64',
2278
- },
2279
- ],
2280
- },
2281
- },
2282
- {
2283
- name: 'LegacyEmitterSequence',
2284
- docs: [
2285
- 'Account used to store the current sequence number for a given emitter.',
2286
- ],
2287
- type: {
2288
- kind: 'struct',
2289
- fields: [
2290
- {
2291
- name: 'value',
2292
- docs: [
2293
- 'Current sequence number, which will be used the next time this emitter publishes a message.',
2294
- ],
2295
- type: 'u64',
2296
- },
2297
- ],
2298
- },
2299
- },
2300
- {
2301
- name: 'EmitterSequence',
2302
- type: {
2303
- kind: 'struct',
2304
- fields: [
2305
- {
2306
- name: 'legacy',
2307
- type: {
2308
- defined: 'LegacyEmitterSequence',
2309
- },
2310
- },
2311
- {
2312
- name: 'bump',
2313
- type: 'u8',
2314
- },
2315
- {
2316
- name: 'emitterType',
2317
- type: {
2318
- defined: 'EmitterType',
2319
- },
2320
- },
2321
- ],
2322
- },
2323
- },
2324
- {
2325
- name: 'PostedMessageV1Unreliable',
2326
- docs: ['Account used to store a published (reusable) Wormhole message.'],
2327
- type: {
2328
- kind: 'struct',
2329
- fields: [
2330
- {
2331
- name: 'data',
2332
- type: {
2333
- defined: 'PostedMessageV1Data',
2334
- },
2335
- },
2336
- ],
2337
- },
2338
- },
2339
- {
2340
- name: 'PostedMessageV1Info',
2341
- docs: [
2342
- 'Message metadata defining information about a published Wormhole message.',
2343
- ],
2344
- type: {
2345
- kind: 'struct',
2346
- fields: [
2347
- {
2348
- name: 'consistencyLevel',
2349
- docs: ['Level of consistency requested by the emitter.'],
2350
- type: 'u8',
2351
- },
2352
- {
2353
- name: 'emitterAuthority',
2354
- docs: [
2355
- 'Authority used to write the message. This field is set to default when the message is',
2356
- 'posted.',
2357
- ],
2358
- type: 'publicKey',
2359
- },
2360
- {
2361
- name: 'status',
2362
- docs: [
2363
- 'If a message is being written to, this status is used to determine which state this',
2364
- 'account is in (e.g. [MessageStatus::Writing] indicates that the emitter authority is still',
2365
- 'writing its message to this account). When this message is posted, this value will be',
2366
- 'set to [MessageStatus::Published].',
2367
- ],
2368
- type: {
2369
- defined: 'MessageStatus',
2370
- },
2371
- },
2372
- {
2373
- name: 'gap0',
2374
- docs: ['No data is stored here.'],
2375
- type: {
2376
- array: ['u8', 3],
2377
- },
2378
- },
2379
- {
2380
- name: 'postedTimestamp',
2381
- docs: ['Time the posted message was created.'],
2382
- type: {
2383
- defined: 'Timestamp',
2384
- },
2385
- },
2386
- {
2387
- name: 'nonce',
2388
- docs: ['Unique id for this message.'],
2389
- type: 'u32',
2390
- },
2391
- {
2392
- name: 'sequence',
2393
- docs: ['Sequence number of this message.'],
2394
- type: 'u64',
2395
- },
2396
- {
2397
- name: 'solanaChainId',
2398
- docs: [
2399
- 'Always `1`.',
2400
- '',
2401
- 'NOTE: Saving this value is silly, but we are keeping it to be consistent with how the posted',
2402
- 'message account is written.',
2403
- ],
2404
- type: {
2405
- defined: 'ChainIdSolanaOnly',
2406
- },
2407
- },
2408
- {
2409
- name: 'emitter',
2410
- docs: [
2411
- 'Emitter of the message. This may either be the emitter authority or a program ID.',
2412
- ],
2413
- type: 'publicKey',
2414
- },
2415
- ],
2416
- },
2417
- },
2418
- {
2419
- name: 'PostedMessageV1Data',
2420
- docs: [
2421
- 'Underlying data for either [PostedMessageV1](crate::legacy::state::PostedMessageV1) or',
2422
- '[PostedMessageV1Unreliable](crate::legacy::state::PostedMessageV1Unreliable).',
2423
- ],
2424
- type: {
2425
- kind: 'struct',
2426
- fields: [
2427
- {
2428
- name: 'info',
2429
- docs: ['Message metadata.'],
2430
- type: {
2431
- defined: 'PostedMessageV1Info',
2432
- },
2433
- },
2434
- {
2435
- name: 'payload',
2436
- docs: ['Encoded message.'],
2437
- type: 'bytes',
2438
- },
2439
- ],
2440
- },
2441
- },
2442
- {
2443
- name: 'PostedMessageV1',
2444
- docs: [
2445
- 'Account used to store a published Wormhole message.',
2446
- '',
2447
- 'NOTE: If your integration requires reusable message accounts, please see',
2448
- '[PostedMessageV1Unreliable](crate::legacy::state::PostedMessageV1Unreliable).',
2449
- ],
2450
- type: {
2451
- kind: 'struct',
2452
- fields: [
2453
- {
2454
- name: 'data',
2455
- docs: ['Message data.'],
2456
- type: {
2457
- defined: 'PostedMessageV1Data',
2458
- },
2459
- },
2460
- ],
2461
- },
2462
- },
2463
- {
2464
- name: 'PostedVaaV1Info',
2465
- docs: [
2466
- 'VAA metadata defining information about a Wormhole message attested for by an active guardian',
2467
- 'set.',
2468
- ],
2469
- type: {
2470
- kind: 'struct',
2471
- fields: [
2472
- {
2473
- name: 'consistencyLevel',
2474
- docs: ['Level of consistency requested by the emitter.'],
2475
- type: 'u8',
2476
- },
2477
- {
2478
- name: 'timestamp',
2479
- docs: ['Time the message was submitted.'],
2480
- type: {
2481
- defined: 'Timestamp',
2482
- },
2483
- },
2484
- {
2485
- name: 'signatureSet',
2486
- docs: [
2487
- "Pubkey of [SignatureSet](crate::state::SignatureSet) account that represents this VAA's",
2488
- 'signature verification.',
2489
- ],
2490
- type: 'publicKey',
2491
- },
2492
- {
2493
- name: 'guardianSetIndex',
2494
- docs: [
2495
- 'Guardian set index used to verify signatures for [SignatureSet](crate::state::SignatureSet).',
2496
- '',
2497
- 'NOTE: In the previous implementation, this member was referred to as the "posted timestamp",',
2498
- 'which is zero for VAA data (posted messages and VAAs resemble the same account schema). By',
2499
- 'changing this to the guardian set index, we patch a bug with verifying governance VAAs for',
2500
- 'the Core Bridge (other Core Bridge implementations require that the guardian set that',
2501
- 'attested for the governance VAA is the current one).',
2502
- ],
2503
- type: 'u32',
2504
- },
2505
- {
2506
- name: 'nonce',
2507
- docs: ['Unique ID for this message.'],
2508
- type: 'u32',
2509
- },
2510
- {
2511
- name: 'sequence',
2512
- docs: ['Sequence number of this message.'],
2513
- type: 'u64',
2514
- },
2515
- {
2516
- name: 'emitterChain',
2517
- docs: [
2518
- 'The Wormhole chain ID denoting the origin of this message.',
2519
- ],
2520
- type: 'u16',
2521
- },
2522
- {
2523
- name: 'emitterAddress',
2524
- docs: ['Emitter of the message.'],
2525
- type: {
2526
- array: ['u8', 32],
2527
- },
2528
- },
2529
- ],
2530
- },
2531
- },
2532
- {
2533
- name: 'PostedVaaV1',
2534
- docs: ['Account used to store a verified VAA.'],
2535
- type: {
2536
- kind: 'struct',
2537
- fields: [
2538
- {
2539
- name: 'info',
2540
- docs: ['VAA metadata.'],
2541
- type: {
2542
- defined: 'PostedVaaV1Info',
2543
- },
2544
- },
2545
- {
2546
- name: 'payload',
2547
- docs: ['Message payload.'],
2548
- type: 'bytes',
2549
- },
2550
- ],
2551
- },
2552
- },
2553
- {
2554
- name: 'WriteEncodedVaaArgs',
2555
- docs: [
2556
- 'Arguments for the [write_encoded_vaa](crate::wormhole_core_bridge_solana::write_encoded_vaa)',
2557
- 'instruction.',
2558
- ],
2559
- type: {
2560
- kind: 'struct',
2561
- fields: [
2562
- {
2563
- name: 'index',
2564
- docs: ['Index of VAA buffer.'],
2565
- type: 'u32',
2566
- },
2567
- {
2568
- name: 'data',
2569
- docs: [
2570
- 'Data representing subset of VAA buffer starting at specified index.',
2571
- ],
2572
- type: 'bytes',
2573
- },
2574
- ],
2575
- },
2576
- },
2577
- {
2578
- name: 'InitMessageV1Args',
2579
- docs: [
2580
- 'Arguments for the [init_message_v1](crate::wormhole_core_bridge_solana::init_message_v1)',
2581
- 'instruction.',
2582
- ],
2583
- type: {
2584
- kind: 'struct',
2585
- fields: [
2586
- {
2587
- name: 'nonce',
2588
- docs: ['Unique id for this message.'],
2589
- type: 'u32',
2590
- },
2591
- {
2592
- name: 'commitment',
2593
- docs: ['Solana commitment level for Guardian observation.'],
2594
- type: {
2595
- defined: 'Commitment',
2596
- },
2597
- },
2598
- {
2599
- name: 'cpiProgramId',
2600
- docs: [
2601
- 'Optional program ID if the emitter address will be your program ID.',
2602
- '',
2603
- 'NOTE: If `Some(program_id)`, your emitter authority seeds to be \\[b"emitter\\].',
2604
- ],
2605
- type: {
2606
- option: 'publicKey',
2607
- },
2608
- },
2609
- ],
2610
- },
2611
- },
2612
- {
2613
- name: 'WriteMessageV1Args',
2614
- docs: [
2615
- 'Arguments for the [write_message_v1](crate::wormhole_core_bridge_solana::write_message_v1)',
2616
- 'instruction.',
2617
- ],
2618
- type: {
2619
- kind: 'struct',
2620
- fields: [
2621
- {
2622
- name: 'index',
2623
- docs: ['Index of message buffer.'],
2624
- type: 'u32',
2625
- },
2626
- {
2627
- name: 'data',
2628
- docs: [
2629
- 'Data representing subset of message buffer starting at specified index.',
2630
- ],
2631
- type: 'bytes',
2632
- },
2633
- ],
2634
- },
2635
- },
2636
- {
2637
- name: 'Header',
2638
- docs: ['`EncodedVaa` account header.'],
2639
- type: {
2640
- kind: 'struct',
2641
- fields: [
2642
- {
2643
- name: 'status',
2644
- docs: [
2645
- 'Processing status. **This encoded VAA is only considered usable when this status is set',
2646
- 'to [Verified](ProcessingStatus::Verified).**',
2647
- ],
2648
- type: {
2649
- defined: 'ProcessingStatus',
2650
- },
2651
- },
2652
- {
2653
- name: 'writeAuthority',
2654
- docs: ['The authority that has write privilege to this account.'],
2655
- type: 'publicKey',
2656
- },
2657
- {
2658
- name: 'version',
2659
- docs: [
2660
- 'VAA version. Only when the VAA is verified is this version set to a value.',
2661
- ],
2662
- type: 'u8',
2663
- },
2664
- ],
2665
- },
2666
- },
2667
- {
2668
- name: 'Timestamp',
2669
- docs: [
2670
- 'This struct defines unix timestamp as u32 (as opposed to more modern systems that have adopted',
2671
- "i64). Methods for this struct are meant to convert Solana's clock type to this type assuming we",
2672
- 'are far from year 2038.',
2673
- ],
2674
- type: {
2675
- kind: 'struct',
2676
- fields: [
2677
- {
2678
- name: 'value',
2679
- type: 'u32',
2680
- },
2681
- ],
2682
- },
2683
- },
2684
- {
2685
- name: 'Duration',
2686
- docs: [
2687
- 'To be used with the [Timestamp] type, this struct defines a duration in seconds.',
2688
- ],
2689
- type: {
2690
- kind: 'struct',
2691
- fields: [
2692
- {
2693
- name: 'seconds',
2694
- type: 'u32',
2695
- },
2696
- ],
2697
- },
2698
- },
2699
- {
2700
- name: 'MessageHash',
2701
- docs: ['This type is used to represent a message hash (keccak).'],
2702
- type: {
2703
- kind: 'struct',
2704
- fields: [
2705
- {
2706
- name: 'bytes',
2707
- type: {
2708
- array: ['u8', 32],
2709
- },
2710
- },
2711
- ],
2712
- },
2713
- },
2714
- {
2715
- name: 'ChainIdSolanaOnly',
2716
- docs: [
2717
- 'This type is kind of silly. But because [PostedMessageV1](crate::state::PostedMessageV1) has the',
2718
- "emitter chain ID as a field, which is unnecessary since it is always Solana's chain ID, we use",
2719
- 'this type to guarantee that the encoded chain ID is always `1`.',
2720
- ],
2721
- type: {
2722
- kind: 'struct',
2723
- fields: [
2724
- {
2725
- name: 'chainId',
2726
- type: 'u16',
2727
- },
2728
- ],
2729
- },
2730
- },
2731
- {
2732
- name: 'EmitterInfo',
2733
- type: {
2734
- kind: 'struct',
2735
- fields: [
2736
- {
2737
- name: 'chain',
2738
- type: 'u16',
2739
- },
2740
- {
2741
- name: 'address',
2742
- type: {
2743
- array: ['u8', 32],
2744
- },
2745
- },
2746
- {
2747
- name: 'sequence',
2748
- type: 'u64',
2749
- },
2750
- ],
2751
- },
2752
- },
2753
- {
2754
- name: 'LegacyInstruction',
2755
- docs: [
2756
- 'Legacy instruction selector.',
2757
- '',
2758
- 'NOTE: No more instructions should be added to this enum. Instead, add them as Anchor instruction',
2759
- 'handlers, which will inevitably live in',
2760
- '[wormhole_core_bridge_solana](crate::wormhole_core_bridge_solana).',
2761
- ],
2762
- type: {
2763
- kind: 'enum',
2764
- variants: [
2765
- {
2766
- name: 'Initialize',
2767
- },
2768
- {
2769
- name: 'PostMessage',
2770
- },
2771
- {
2772
- name: 'PostVaa',
2773
- },
2774
- {
2775
- name: 'SetMessageFee',
2776
- },
2777
- {
2778
- name: 'TransferFees',
2779
- },
2780
- {
2781
- name: 'UpgradeContract',
2782
- },
2783
- {
2784
- name: 'GuardianSetUpdate',
2785
- },
2786
- {
2787
- name: 'VerifySignatures',
2788
- },
2789
- {
2790
- name: 'PostMessageUnreliable',
2791
- },
2792
- ],
2793
- },
2794
- },
2795
- {
2796
- name: 'EmitterType',
2797
- type: {
2798
- kind: 'enum',
2799
- variants: [
2800
- {
2801
- name: 'Unset',
2802
- },
2803
- {
2804
- name: 'Legacy',
2805
- },
2806
- {
2807
- name: 'Executable',
2808
- },
2809
- ],
2810
- },
2811
- },
2812
- {
2813
- name: 'MessageStatus',
2814
- docs: [
2815
- 'Status of a message. When a message is posted, its status is',
2816
- '[Published](MessageStatus::Published).',
2817
- ],
2818
- type: {
2819
- kind: 'enum',
2820
- variants: [
2821
- {
2822
- name: 'Published',
2823
- },
2824
- {
2825
- name: 'Writing',
2826
- },
2827
- {
2828
- name: 'ReadyForPublishing',
2829
- },
2830
- ],
2831
- },
2832
- },
2833
- {
2834
- name: 'PublishMessageDirective',
2835
- docs: ['Directive used to determine how to post a Core Bridge message.'],
2836
- type: {
2837
- kind: 'enum',
2838
- variants: [
2839
- {
2840
- name: 'Message',
2841
- fields: [
2842
- {
2843
- name: 'nonce',
2844
- type: 'u32',
2845
- },
2846
- {
2847
- name: 'payload',
2848
- type: 'bytes',
2849
- },
2850
- {
2851
- name: 'commitment',
2852
- type: {
2853
- defined: 'Commitment',
2854
- },
2855
- },
2856
- ],
2857
- },
2858
- {
2859
- name: 'ProgramMessage',
2860
- fields: [
2861
- {
2862
- name: 'programId',
2863
- type: 'publicKey',
2864
- },
2865
- {
2866
- name: 'nonce',
2867
- type: 'u32',
2868
- },
2869
- {
2870
- name: 'payload',
2871
- type: 'bytes',
2872
- },
2873
- {
2874
- name: 'commitment',
2875
- type: {
2876
- defined: 'Commitment',
2877
- },
2878
- },
2879
- ],
2880
- },
2881
- {
2882
- name: 'PreparedMessage',
2883
- },
2884
- ],
2885
- },
2886
- },
2887
- {
2888
- name: 'ProcessingStatus',
2889
- docs: ["Encoded VAA's processing status."],
2890
- type: {
2891
- kind: 'enum',
2892
- variants: [
2893
- {
2894
- name: 'Unset',
2895
- },
2896
- {
2897
- name: 'Writing',
2898
- },
2899
- {
2900
- name: 'Verified',
2901
- },
2902
- ],
2903
- },
2904
- },
2905
- {
2906
- name: 'Commitment',
2907
- docs: [
2908
- "Representation of Solana's commitment levels. This enum is not exhaustive because Wormhole only",
2909
- 'considers these two commitment levels in its Guardian observation.',
2910
- '',
2911
- 'See <https://docs.solana.com/cluster/commitments> for more info.',
2912
- ],
2913
- type: {
2914
- kind: 'enum',
2915
- variants: [
2916
- {
2917
- name: 'Confirmed',
2918
- },
2919
- {
2920
- name: 'Finalized',
2921
- },
2922
- ],
2923
- },
2924
- },
2925
- ],
2926
- errors: [
2927
- {
2928
- code: 6002,
2929
- name: 'InvalidInstructionArgument',
2930
- msg: 'InvalidInstructionArgument',
2931
- },
2932
- {
2933
- code: 6003,
2934
- name: 'AccountNotZeroed',
2935
- msg: 'AccountNotZeroed',
2936
- },
2937
- {
2938
- code: 6004,
2939
- name: 'InvalidDataConversion',
2940
- msg: 'InvalidDataConversion',
2941
- },
2942
- {
2943
- code: 6006,
2944
- name: 'U64Overflow',
2945
- msg: 'U64Overflow',
2946
- },
2947
- {
2948
- code: 6008,
2949
- name: 'InvalidComputeSize',
2950
- msg: 'InvalidComputeSize',
2951
- },
2952
- {
2953
- code: 6016,
2954
- name: 'InvalidChain',
2955
- msg: 'InvalidChain',
2956
- },
2957
- {
2958
- code: 6032,
2959
- name: 'InvalidGovernanceEmitter',
2960
- msg: 'InvalidGovernanceEmitter',
2961
- },
2962
- {
2963
- code: 6034,
2964
- name: 'InvalidGovernanceAction',
2965
- msg: 'InvalidGovernanceAction',
2966
- },
2967
- {
2968
- code: 6036,
2969
- name: 'LatestGuardianSetRequired',
2970
- msg: 'LatestGuardianSetRequired',
2971
- },
2972
- {
2973
- code: 6038,
2974
- name: 'GovernanceForAnotherChain',
2975
- msg: 'GovernanceForAnotherChain',
2976
- },
2977
- {
2978
- code: 6040,
2979
- name: 'InvalidGovernanceVaa',
2980
- msg: 'InvalidGovernanceVaa',
2981
- },
2982
- {
2983
- code: 6256,
2984
- name: 'InsufficientFees',
2985
- msg: 'InsufficientFees',
2986
- },
2987
- {
2988
- code: 6258,
2989
- name: 'EmitterMismatch',
2990
- msg: 'EmitterMismatch',
2991
- },
2992
- {
2993
- code: 6260,
2994
- name: 'NotReadyForPublishing',
2995
- msg: 'NotReadyForPublishing',
2996
- },
2997
- {
2998
- code: 6262,
2999
- name: 'InvalidPreparedMessage',
3000
- msg: 'InvalidPreparedMessage',
3001
- },
3002
- {
3003
- code: 6264,
3004
- name: 'ExecutableEmitter',
3005
- msg: 'ExecutableEmitter',
3006
- },
3007
- {
3008
- code: 6266,
3009
- name: 'LegacyEmitter',
3010
- msg: 'LegacyEmitter',
3011
- },
3012
- {
3013
- code: 6512,
3014
- name: 'InvalidSignatureSet',
3015
- msg: 'InvalidSignatureSet',
3016
- },
3017
- {
3018
- code: 6514,
3019
- name: 'InvalidMessageHash',
3020
- msg: 'InvalidMessageHash',
3021
- },
3022
- {
3023
- code: 6515,
3024
- name: 'NoQuorum',
3025
- msg: 'NoQuorum',
3026
- },
3027
- {
3028
- code: 6516,
3029
- name: 'MessageMismatch',
3030
- msg: 'MessageMismatch',
3031
- },
3032
- {
3033
- code: 7024,
3034
- name: 'NotEnoughLamports',
3035
- msg: 'NotEnoughLamports',
3036
- },
3037
- {
3038
- code: 7026,
3039
- name: 'InvalidFeeRecipient',
3040
- msg: 'InvalidFeeRecipient',
3041
- },
3042
- {
3043
- code: 7280,
3044
- name: 'ImplementationMismatch',
3045
- msg: 'ImplementationMismatch',
3046
- },
3047
- {
3048
- code: 7536,
3049
- name: 'InvalidGuardianSetIndex',
3050
- msg: 'InvalidGuardianSetIndex',
3051
- },
3052
- {
3053
- code: 7792,
3054
- name: 'GuardianSetMismatch',
3055
- msg: 'GuardianSetMismatch',
3056
- },
3057
- {
3058
- code: 7794,
3059
- name: 'InstructionAtWrongIndex',
3060
- msg: 'InstructionAtWrongIndex',
3061
- },
3062
- {
3063
- code: 7795,
3064
- name: 'EmptySigVerifyInstruction',
3065
- msg: 'EmptySigVerifyInstruction',
3066
- },
3067
- {
3068
- code: 7796,
3069
- name: 'InvalidSigVerifyInstruction',
3070
- msg: 'InvalidSigVerifyInstruction',
3071
- },
3072
- {
3073
- code: 7798,
3074
- name: 'GuardianSetExpired',
3075
- msg: 'GuardianSetExpired',
3076
- },
3077
- {
3078
- code: 7800,
3079
- name: 'InvalidGuardianKeyRecovery',
3080
- msg: 'InvalidGuardianKeyRecovery',
3081
- },
3082
- {
3083
- code: 7802,
3084
- name: 'SignerIndicesMismatch',
3085
- msg: 'SignerIndicesMismatch',
3086
- },
3087
- {
3088
- code: 8048,
3089
- name: 'PayloadSizeMismatch',
3090
- msg: 'PayloadSizeMismatch',
3091
- },
3092
- {
3093
- code: 10112,
3094
- name: 'ZeroGuardians',
3095
- msg: 'ZeroGuardians',
3096
- },
3097
- {
3098
- code: 10128,
3099
- name: 'GuardianZeroAddress',
3100
- msg: 'GuardianZeroAddress',
3101
- },
3102
- {
3103
- code: 10144,
3104
- name: 'DuplicateGuardianAddress',
3105
- msg: 'DuplicateGuardianAddress',
3106
- },
3107
- {
3108
- code: 10160,
3109
- name: 'MessageAlreadyPublished',
3110
- msg: 'MessageAlreadyPublished',
3111
- },
3112
- {
3113
- code: 10176,
3114
- name: 'VaaWritingDisallowed',
3115
- msg: 'VaaWritingDisallowed',
3116
- },
3117
- {
3118
- code: 10192,
3119
- name: 'VaaAlreadyVerified',
3120
- msg: 'VaaAlreadyVerified',
3121
- },
3122
- {
3123
- code: 10208,
3124
- name: 'InvalidGuardianIndex',
3125
- msg: 'InvalidGuardianIndex',
3126
- },
3127
- {
3128
- code: 10224,
3129
- name: 'InvalidSignature',
3130
- msg: 'InvalidSignature',
3131
- },
3132
- {
3133
- code: 10256,
3134
- name: 'UnverifiedVaa',
3135
- msg: 'UnverifiedVaa',
3136
- },
3137
- {
3138
- code: 10258,
3139
- name: 'VaaStillProcessing',
3140
- msg: 'VaaStillProcessing',
3141
- },
3142
- {
3143
- code: 10260,
3144
- name: 'InWritingStatus',
3145
- msg: 'InWritingStatus',
3146
- },
3147
- {
3148
- code: 10262,
3149
- name: 'NotInWritingStatus',
3150
- msg: 'NotInWritingStatus',
3151
- },
3152
- {
3153
- code: 10264,
3154
- name: 'InvalidMessageStatus',
3155
- msg: 'InvalidMessageStatus',
3156
- },
3157
- {
3158
- code: 10266,
3159
- name: 'HashNotComputed',
3160
- msg: 'HashNotComputed',
3161
- },
3162
- {
3163
- code: 10268,
3164
- name: 'InvalidVaaVersion',
3165
- msg: 'InvalidVaaVersion',
3166
- },
3167
- {
3168
- code: 10270,
3169
- name: 'InvalidCreatedAccountSize',
3170
- msg: 'InvalidCreatedAccountSize',
3171
- },
3172
- {
3173
- code: 10272,
3174
- name: 'DataOverflow',
3175
- msg: 'DataOverflow',
3176
- },
3177
- {
3178
- code: 10274,
3179
- name: 'ExceedsMaxPayloadSize',
3180
- msg: 'ExceedsMaxPayloadSize (30KB)',
3181
- },
3182
- {
3183
- code: 10276,
3184
- name: 'CannotParseVaa',
3185
- msg: 'CannotParseVaa',
3186
- },
3187
- {
3188
- code: 10278,
3189
- name: 'EmitterAuthorityMismatch',
3190
- msg: 'EmitterAuthorityMismatch',
3191
- },
3192
- {
3193
- code: 10280,
3194
- name: 'InvalidProgramEmitter',
3195
- msg: 'InvalidProgramEmitter',
3196
- },
3197
- {
3198
- code: 10282,
3199
- name: 'WriteAuthorityMismatch',
3200
- msg: 'WriteAuthorityMismatch',
3201
- },
3202
- {
3203
- code: 10284,
3204
- name: 'PostedVaaPayloadTooLarge',
3205
- msg: 'PostedVaaPayloadTooLarge',
3206
- },
3207
- {
3208
- code: 10286,
3209
- name: 'ExecutableDisallowed',
3210
- msg: 'ExecutableDisallowed',
3211
- },
3212
- ],
3213
- };
3214
-
3215
- export type PythSolanaReceiver = {
3216
- version: '0.1.0';
3217
- name: 'pyth_solana_receiver';
3218
- instructions: [
3219
- {
3220
- name: 'initialize';
3221
- accounts: [
3222
- {
3223
- name: 'payer';
3224
- isMut: true;
3225
- isSigner: true;
3226
- },
3227
- {
3228
- name: 'config';
3229
- isMut: true;
3230
- isSigner: false;
3231
- },
3232
- {
3233
- name: 'systemProgram';
3234
- isMut: false;
3235
- isSigner: false;
3236
- },
3237
- ];
3238
- args: [
3239
- {
3240
- name: 'initialConfig';
3241
- type: {
3242
- defined: 'Config';
3243
- };
3244
- },
3245
- ];
3246
- },
3247
- {
3248
- name: 'requestGovernanceAuthorityTransfer';
3249
- accounts: [
3250
- {
3251
- name: 'payer';
3252
- isMut: false;
3253
- isSigner: true;
3254
- },
3255
- {
3256
- name: 'config';
3257
- isMut: true;
3258
- isSigner: false;
3259
- },
3260
- ];
3261
- args: [
3262
- {
3263
- name: 'targetGovernanceAuthority';
3264
- type: 'publicKey';
3265
- },
3266
- ];
3267
- },
3268
- {
3269
- name: 'acceptGovernanceAuthorityTransfer';
3270
- accounts: [
3271
- {
3272
- name: 'payer';
3273
- isMut: false;
3274
- isSigner: true;
3275
- },
3276
- {
3277
- name: 'config';
3278
- isMut: true;
3279
- isSigner: false;
3280
- },
3281
- ];
3282
- args: [];
3283
- },
3284
- {
3285
- name: 'setDataSources';
3286
- accounts: [
3287
- {
3288
- name: 'payer';
3289
- isMut: false;
3290
- isSigner: true;
3291
- },
3292
- {
3293
- name: 'config';
3294
- isMut: true;
3295
- isSigner: false;
3296
- },
3297
- ];
3298
- args: [
3299
- {
3300
- name: 'validDataSources';
3301
- type: {
3302
- vec: {
3303
- defined: 'DataSource';
3304
- };
3305
- };
3306
- },
3307
- ];
3308
- },
3309
- {
3310
- name: 'setFee';
3311
- accounts: [
3312
- {
3313
- name: 'payer';
3314
- isMut: false;
3315
- isSigner: true;
3316
- },
3317
- {
3318
- name: 'config';
3319
- isMut: true;
3320
- isSigner: false;
3321
- },
3322
- ];
3323
- args: [
3324
- {
3325
- name: 'singleUpdateFeeInLamports';
3326
- type: 'u64';
3327
- },
3328
- ];
3329
- },
3330
- {
3331
- name: 'setWormholeAddress';
3332
- accounts: [
3333
- {
3334
- name: 'payer';
3335
- isMut: false;
3336
- isSigner: true;
3337
- },
3338
- {
3339
- name: 'config';
3340
- isMut: true;
3341
- isSigner: false;
3342
- },
3343
- ];
3344
- args: [
3345
- {
3346
- name: 'wormhole';
3347
- type: 'publicKey';
3348
- },
3349
- ];
3350
- },
3351
- {
3352
- name: 'setMinimumSignatures';
3353
- accounts: [
3354
- {
3355
- name: 'payer';
3356
- isMut: false;
3357
- isSigner: true;
3358
- },
3359
- {
3360
- name: 'config';
3361
- isMut: true;
3362
- isSigner: false;
3363
- },
3364
- ];
3365
- args: [
3366
- {
3367
- name: 'minimumSignatures';
3368
- type: 'u8';
3369
- },
3370
- ];
3371
- },
3372
- {
3373
- name: 'postUpdateAtomic';
3374
- docs: [
3375
- 'Post a price update using a VAA and a MerklePriceUpdate.',
3376
- 'This function allows you to post a price update in a single transaction.',
3377
- "Compared to post_update, it is less secure since you won't be able to verify all guardian signatures if you use this function because of transaction size limitations.",
3378
- 'Typically, you can fit 5 guardian signatures in a transaction that uses this.',
3379
- ];
3380
- accounts: [
3381
- {
3382
- name: 'payer';
3383
- isMut: true;
3384
- isSigner: true;
3385
- },
3386
- {
3387
- name: 'guardianSet';
3388
- isMut: false;
3389
- isSigner: false;
3390
- docs: [
3391
- 'Instead we do the same steps in deserialize_guardian_set_checked.',
3392
- ];
3393
- },
3394
- {
3395
- name: 'config';
3396
- isMut: false;
3397
- isSigner: false;
3398
- },
3399
- {
3400
- name: 'treasury';
3401
- isMut: true;
3402
- isSigner: false;
3403
- },
3404
- {
3405
- name: 'priceUpdateAccount';
3406
- isMut: true;
3407
- isSigner: true;
3408
- docs: [
3409
- 'The contraint is such that either the price_update_account is uninitialized or the payer is the write_authority.',
3410
- "Pubkey::default() is the SystemProgram on Solana and it can't sign so it's impossible that price_update_account.write_authority == Pubkey::default() once the account is initialized",
3411
- ];
3412
- },
3413
- {
3414
- name: 'systemProgram';
3415
- isMut: false;
3416
- isSigner: false;
3417
- },
3418
- {
3419
- name: 'writeAuthority';
3420
- isMut: false;
3421
- isSigner: true;
3422
- },
3423
- ];
3424
- args: [
3425
- {
3426
- name: 'params';
3427
- type: {
3428
- defined: 'PostUpdateAtomicParams';
3429
- };
3430
- },
3431
- ];
3432
- },
3433
- {
3434
- name: 'postUpdate';
3435
- docs: [
3436
- 'Post a price update using an encoded_vaa account and a MerklePriceUpdate calldata.',
3437
- 'This should be called after the client has already verified the Vaa via the Wormhole contract.',
3438
- 'Check out target_chains/solana/cli/src/main.rs for an example of how to do this.',
3439
- ];
3440
- accounts: [
3441
- {
3442
- name: 'payer';
3443
- isMut: true;
3444
- isSigner: true;
3445
- },
3446
- {
3447
- name: 'encodedVaa';
3448
- isMut: false;
3449
- isSigner: false;
3450
- },
3451
- {
3452
- name: 'config';
3453
- isMut: false;
3454
- isSigner: false;
3455
- },
3456
- {
3457
- name: 'treasury';
3458
- isMut: true;
3459
- isSigner: false;
3460
- },
3461
- {
3462
- name: 'priceUpdateAccount';
3463
- isMut: true;
3464
- isSigner: true;
3465
- docs: [
3466
- 'The contraint is such that either the price_update_account is uninitialized or the payer is the write_authority.',
3467
- "Pubkey::default() is the SystemProgram on Solana and it can't sign so it's impossible that price_update_account.write_authority == Pubkey::default() once the account is initialized",
3468
- ];
3469
- },
3470
- {
3471
- name: 'systemProgram';
3472
- isMut: false;
3473
- isSigner: false;
3474
- },
3475
- {
3476
- name: 'writeAuthority';
3477
- isMut: false;
3478
- isSigner: true;
3479
- },
3480
- ];
3481
- args: [
3482
- {
3483
- name: 'params';
3484
- type: {
3485
- defined: 'PostUpdateParams';
3486
- };
3487
- },
3488
- ];
3489
- },
3490
- {
3491
- name: 'reclaimRent';
3492
- accounts: [
3493
- {
3494
- name: 'payer';
3495
- isMut: true;
3496
- isSigner: true;
3497
- },
3498
- {
3499
- name: 'priceUpdateAccount';
3500
- isMut: true;
3501
- isSigner: false;
3502
- },
3503
- ];
3504
- args: [];
3505
- },
3506
- ];
3507
- accounts: [
3508
- {
3509
- name: 'Config';
3510
- type: {
3511
- kind: 'struct';
3512
- fields: [
3513
- {
3514
- name: 'governanceAuthority';
3515
- type: 'publicKey';
3516
- },
3517
- {
3518
- name: 'targetGovernanceAuthority';
3519
- type: {
3520
- option: 'publicKey';
3521
- };
3522
- },
3523
- {
3524
- name: 'wormhole';
3525
- type: 'publicKey';
3526
- },
3527
- {
3528
- name: 'validDataSources';
3529
- type: {
3530
- vec: {
3531
- defined: 'DataSource';
3532
- };
3533
- };
3534
- },
3535
- {
3536
- name: 'singleUpdateFeeInLamports';
3537
- type: 'u64';
3538
- },
3539
- {
3540
- name: 'minimumSignatures';
3541
- type: 'u8';
3542
- },
3543
- ];
3544
- };
3545
- },
3546
- {
3547
- name: 'priceUpdateV2';
3548
- type: {
3549
- kind: 'struct';
3550
- fields: [
3551
- {
3552
- name: 'writeAuthority';
3553
- type: 'publicKey';
3554
- },
3555
- {
3556
- name: 'verificationLevel';
3557
- type: {
3558
- defined: 'VerificationLevel';
3559
- };
3560
- },
3561
- {
3562
- name: 'priceMessage';
3563
- type: {
3564
- defined: 'PriceFeedMessage';
3565
- };
3566
- },
3567
- {
3568
- name: 'postedSlot';
3569
- type: 'u64';
3570
- },
3571
- ];
3572
- };
3573
- },
3574
- ];
3575
- types: [
3576
- {
3577
- name: 'PriceFeedMessage';
3578
- type: {
3579
- kind: 'struct';
3580
- fields: [
3581
- {
3582
- name: 'feedId';
3583
- type: {
3584
- array: ['u8', 32];
3585
- };
3586
- },
3587
- {
3588
- name: 'price';
3589
- type: 'i64';
3590
- },
3591
- {
3592
- name: 'conf';
3593
- type: 'u64';
3594
- },
3595
- {
3596
- name: 'exponent';
3597
- type: 'i32';
3598
- },
3599
- {
3600
- name: 'publishTime';
3601
- type: 'i64';
3602
- },
3603
- {
3604
- name: 'prevPublishTime';
3605
- type: 'i64';
3606
- },
3607
- {
3608
- name: 'emaPrice';
3609
- type: 'i64';
3610
- },
3611
- {
3612
- name: 'emaConf';
3613
- type: 'u64';
3614
- },
3615
- ];
3616
- };
3617
- },
3618
- {
3619
- name: 'MerklePriceUpdate';
3620
- type: {
3621
- kind: 'struct';
3622
- fields: [
3623
- {
3624
- name: 'message';
3625
- type: 'bytes';
3626
- },
3627
- {
3628
- name: 'proof';
3629
- type: {
3630
- vec: {
3631
- array: ['u8', 20];
3632
- };
3633
- };
3634
- },
3635
- ];
3636
- };
3637
- },
3638
- {
3639
- name: 'DataSource';
3640
- type: {
3641
- kind: 'struct';
3642
- fields: [
3643
- {
3644
- name: 'chain';
3645
- type: 'u16';
3646
- },
3647
- {
3648
- name: 'emitter';
3649
- type: 'publicKey';
3650
- },
3651
- ];
3652
- };
3653
- },
3654
- {
3655
- name: 'PostUpdateAtomicParams';
3656
- type: {
3657
- kind: 'struct';
3658
- fields: [
3659
- {
3660
- name: 'vaa';
3661
- type: 'bytes';
3662
- },
3663
- {
3664
- name: 'merklePriceUpdate';
3665
- type: {
3666
- defined: 'MerklePriceUpdate';
3667
- };
3668
- },
3669
- {
3670
- name: 'treasuryId';
3671
- type: 'u8';
3672
- },
3673
- ];
3674
- };
3675
- },
3676
- {
3677
- name: 'PostUpdateParams';
3678
- type: {
3679
- kind: 'struct';
3680
- fields: [
3681
- {
3682
- name: 'merklePriceUpdate';
3683
- type: {
3684
- defined: 'MerklePriceUpdate';
3685
- };
3686
- },
3687
- {
3688
- name: 'treasuryId';
3689
- type: 'u8';
3690
- },
3691
- ];
3692
- };
3693
- },
3694
- {
3695
- name: 'VerificationLevel';
3696
- docs: [
3697
- '* This enum represents how many guardian signatures were checked for a Pythnet price update\n * If full, guardian quorum has been attained\n * If partial, at least config.minimum signatures have been verified, but in the case config.minimum_signatures changes in the future we also include the number of signatures that were checked',
3698
- ];
3699
- type: {
3700
- kind: 'enum';
3701
- variants: [
3702
- {
3703
- name: 'Partial';
3704
- fields: [
3705
- {
3706
- name: 'numSignatures';
3707
- type: 'u8';
3708
- },
3709
- ];
3710
- },
3711
- {
3712
- name: 'Full';
3713
- },
3714
- ];
3715
- };
3716
- },
3717
- ];
3718
- errors: [
3719
- {
3720
- code: 6000;
3721
- name: 'InvalidWormholeMessage';
3722
- msg: 'Received an invalid wormhole message';
3723
- },
3724
- {
3725
- code: 6001;
3726
- name: 'DeserializeMessageFailed';
3727
- msg: 'An error occurred when deserializing the message';
3728
- },
3729
- {
3730
- code: 6002;
3731
- name: 'InvalidPriceUpdate';
3732
- msg: 'Received an invalid price update';
3733
- },
3734
- {
3735
- code: 6003;
3736
- name: 'UnsupportedMessageType';
3737
- msg: 'This type of message is not supported currently';
3738
- },
3739
- {
3740
- code: 6004;
3741
- name: 'InvalidDataSource';
3742
- msg: "The tuple emitter chain, emitter doesn't match one of the valid data sources.";
3743
- },
3744
- {
3745
- code: 6005;
3746
- name: 'InsufficientFunds';
3747
- msg: 'Funds are insufficient to pay the receiving fee';
3748
- },
3749
- {
3750
- code: 6006;
3751
- name: 'WrongWriteAuthority';
3752
- msg: "This signer can't write to price update account";
3753
- },
3754
- {
3755
- code: 6007;
3756
- name: 'WrongVaaOwner';
3757
- msg: 'The posted VAA account has the wrong owner.';
3758
- },
3759
- {
3760
- code: 6008;
3761
- name: 'DeserializeVaaFailed';
3762
- msg: 'An error occurred when deserializing the VAA.';
3763
- },
3764
- {
3765
- code: 6009;
3766
- name: 'InsufficientGuardianSignatures';
3767
- msg: 'The number of guardian signatures is below the minimum';
3768
- },
3769
- {
3770
- code: 6010;
3771
- name: 'InvalidVaaVersion';
3772
- msg: 'Invalid VAA version';
3773
- },
3774
- {
3775
- code: 6011;
3776
- name: 'GuardianSetMismatch';
3777
- msg: "Guardian set version in the VAA doesn't match the guardian set passed";
3778
- },
3779
- {
3780
- code: 6012;
3781
- name: 'InvalidGuardianOrder';
3782
- msg: 'Guardian signature indices must be increasing';
3783
- },
3784
- {
3785
- code: 6013;
3786
- name: 'InvalidGuardianIndex';
3787
- msg: 'Guardian index exceeds the number of guardians in the set';
3788
- },
3789
- {
3790
- code: 6014;
3791
- name: 'InvalidSignature';
3792
- msg: 'A VAA signature is invalid';
3793
- },
3794
- {
3795
- code: 6015;
3796
- name: 'InvalidGuardianKeyRecovery';
3797
- msg: "The recovered guardian public key doesn't match the guardian set";
3798
- },
3799
- {
3800
- code: 6016;
3801
- name: 'WrongGuardianSetOwner';
3802
- msg: 'The guardian set account is owned by the wrong program';
3803
- },
3804
- {
3805
- code: 6017;
3806
- name: 'InvalidGuardianSetPda';
3807
- msg: "The Guardian Set account doesn't match the PDA derivation";
3808
- },
3809
- {
3810
- code: 6018;
3811
- name: 'GuardianSetExpired';
3812
- msg: 'The Guardian Set is expired';
3813
- },
3814
- {
3815
- code: 6019;
3816
- name: 'GovernanceAuthorityMismatch';
3817
- msg: 'The signer is not authorized to perform this governance action';
3818
- },
3819
- {
3820
- code: 6020;
3821
- name: 'TargetGovernanceAuthorityMismatch';
3822
- msg: 'The signer is not authorized to accept the governance authority';
3823
- },
3824
- {
3825
- code: 6021;
3826
- name: 'NonexistentGovernanceAuthorityTransferRequest';
3827
- msg: 'The governance authority needs to request a transfer first';
3828
- },
3829
- ];
3830
- };
3831
-
3832
- export const IDL: PythSolanaReceiver = {
3833
- version: '0.1.0',
3834
- name: 'pyth_solana_receiver',
3835
- instructions: [
3836
- {
3837
- name: 'initialize',
3838
- accounts: [
3839
- {
3840
- name: 'payer',
3841
- isMut: true,
3842
- isSigner: true,
3843
- },
3844
- {
3845
- name: 'config',
3846
- isMut: true,
3847
- isSigner: false,
3848
- },
3849
- {
3850
- name: 'systemProgram',
3851
- isMut: false,
3852
- isSigner: false,
3853
- },
3854
- ],
3855
- args: [
3856
- {
3857
- name: 'initialConfig',
3858
- type: {
3859
- defined: 'Config',
3860
- },
3861
- },
3862
- ],
3863
- },
3864
- {
3865
- name: 'requestGovernanceAuthorityTransfer',
3866
- accounts: [
3867
- {
3868
- name: 'payer',
3869
- isMut: false,
3870
- isSigner: true,
3871
- },
3872
- {
3873
- name: 'config',
3874
- isMut: true,
3875
- isSigner: false,
3876
- },
3877
- ],
3878
- args: [
3879
- {
3880
- name: 'targetGovernanceAuthority',
3881
- type: 'publicKey',
3882
- },
3883
- ],
3884
- },
3885
- {
3886
- name: 'acceptGovernanceAuthorityTransfer',
3887
- accounts: [
3888
- {
3889
- name: 'payer',
3890
- isMut: false,
3891
- isSigner: true,
3892
- },
3893
- {
3894
- name: 'config',
3895
- isMut: true,
3896
- isSigner: false,
3897
- },
3898
- ],
3899
- args: [],
3900
- },
3901
- {
3902
- name: 'setDataSources',
3903
- accounts: [
3904
- {
3905
- name: 'payer',
3906
- isMut: false,
3907
- isSigner: true,
3908
- },
3909
- {
3910
- name: 'config',
3911
- isMut: true,
3912
- isSigner: false,
3913
- },
3914
- ],
3915
- args: [
3916
- {
3917
- name: 'validDataSources',
3918
- type: {
3919
- vec: {
3920
- defined: 'DataSource',
3921
- },
3922
- },
3923
- },
3924
- ],
3925
- },
3926
- {
3927
- name: 'setFee',
3928
- accounts: [
3929
- {
3930
- name: 'payer',
3931
- isMut: false,
3932
- isSigner: true,
3933
- },
3934
- {
3935
- name: 'config',
3936
- isMut: true,
3937
- isSigner: false,
3938
- },
3939
- ],
3940
- args: [
3941
- {
3942
- name: 'singleUpdateFeeInLamports',
3943
- type: 'u64',
3944
- },
3945
- ],
3946
- },
3947
- {
3948
- name: 'setWormholeAddress',
3949
- accounts: [
3950
- {
3951
- name: 'payer',
3952
- isMut: false,
3953
- isSigner: true,
3954
- },
3955
- {
3956
- name: 'config',
3957
- isMut: true,
3958
- isSigner: false,
3959
- },
3960
- ],
3961
- args: [
3962
- {
3963
- name: 'wormhole',
3964
- type: 'publicKey',
3965
- },
3966
- ],
3967
- },
3968
- {
3969
- name: 'setMinimumSignatures',
3970
- accounts: [
3971
- {
3972
- name: 'payer',
3973
- isMut: false,
3974
- isSigner: true,
3975
- },
3976
- {
3977
- name: 'config',
3978
- isMut: true,
3979
- isSigner: false,
3980
- },
3981
- ],
3982
- args: [
3983
- {
3984
- name: 'minimumSignatures',
3985
- type: 'u8',
3986
- },
3987
- ],
3988
- },
3989
- {
3990
- name: 'postUpdateAtomic',
3991
- docs: [
3992
- 'Post a price update using a VAA and a MerklePriceUpdate.',
3993
- 'This function allows you to post a price update in a single transaction.',
3994
- "Compared to post_update, it is less secure since you won't be able to verify all guardian signatures if you use this function because of transaction size limitations.",
3995
- 'Typically, you can fit 5 guardian signatures in a transaction that uses this.',
3996
- ],
3997
- accounts: [
3998
- {
3999
- name: 'payer',
4000
- isMut: true,
4001
- isSigner: true,
4002
- },
4003
- {
4004
- name: 'guardianSet',
4005
- isMut: false,
4006
- isSigner: false,
4007
- docs: [
4008
- 'Instead we do the same steps in deserialize_guardian_set_checked.',
4009
- ],
4010
- },
4011
- {
4012
- name: 'config',
4013
- isMut: false,
4014
- isSigner: false,
4015
- },
4016
- {
4017
- name: 'treasury',
4018
- isMut: true,
4019
- isSigner: false,
4020
- },
4021
- {
4022
- name: 'priceUpdateAccount',
4023
- isMut: true,
4024
- isSigner: true,
4025
- docs: [
4026
- 'The contraint is such that either the price_update_account is uninitialized or the payer is the write_authority.',
4027
- "Pubkey::default() is the SystemProgram on Solana and it can't sign so it's impossible that price_update_account.write_authority == Pubkey::default() once the account is initialized",
4028
- ],
4029
- },
4030
- {
4031
- name: 'systemProgram',
4032
- isMut: false,
4033
- isSigner: false,
4034
- },
4035
- {
4036
- name: 'writeAuthority',
4037
- isMut: false,
4038
- isSigner: true,
4039
- },
4040
- ],
4041
- args: [
4042
- {
4043
- name: 'params',
4044
- type: {
4045
- defined: 'PostUpdateAtomicParams',
4046
- },
4047
- },
4048
- ],
4049
- },
4050
- {
4051
- name: 'postUpdate',
4052
- docs: [
4053
- 'Post a price update using an encoded_vaa account and a MerklePriceUpdate calldata.',
4054
- 'This should be called after the client has already verified the Vaa via the Wormhole contract.',
4055
- 'Check out target_chains/solana/cli/src/main.rs for an example of how to do this.',
4056
- ],
4057
- accounts: [
4058
- {
4059
- name: 'payer',
4060
- isMut: true,
4061
- isSigner: true,
4062
- },
4063
- {
4064
- name: 'encodedVaa',
4065
- isMut: false,
4066
- isSigner: false,
4067
- },
4068
- {
4069
- name: 'config',
4070
- isMut: false,
4071
- isSigner: false,
4072
- },
4073
- {
4074
- name: 'treasury',
4075
- isMut: true,
4076
- isSigner: false,
4077
- },
4078
- {
4079
- name: 'priceUpdateAccount',
4080
- isMut: true,
4081
- isSigner: true,
4082
- docs: [
4083
- 'The contraint is such that either the price_update_account is uninitialized or the payer is the write_authority.',
4084
- "Pubkey::default() is the SystemProgram on Solana and it can't sign so it's impossible that price_update_account.write_authority == Pubkey::default() once the account is initialized",
4085
- ],
4086
- },
4087
- {
4088
- name: 'systemProgram',
4089
- isMut: false,
4090
- isSigner: false,
4091
- },
4092
- {
4093
- name: 'writeAuthority',
4094
- isMut: false,
4095
- isSigner: true,
4096
- },
4097
- ],
4098
- args: [
4099
- {
4100
- name: 'params',
4101
- type: {
4102
- defined: 'PostUpdateParams',
4103
- },
4104
- },
4105
- ],
4106
- },
4107
- {
4108
- name: 'reclaimRent',
4109
- accounts: [
4110
- {
4111
- name: 'payer',
4112
- isMut: true,
4113
- isSigner: true,
4114
- },
4115
- {
4116
- name: 'priceUpdateAccount',
4117
- isMut: true,
4118
- isSigner: false,
4119
- },
4120
- ],
4121
- args: [],
4122
- },
4123
- ],
4124
- accounts: [
4125
- {
4126
- name: 'Config',
4127
- type: {
4128
- kind: 'struct',
4129
- fields: [
4130
- {
4131
- name: 'governanceAuthority',
4132
- type: 'publicKey',
4133
- },
4134
- {
4135
- name: 'targetGovernanceAuthority',
4136
- type: {
4137
- option: 'publicKey',
4138
- },
4139
- },
4140
- {
4141
- name: 'wormhole',
4142
- type: 'publicKey',
4143
- },
4144
- {
4145
- name: 'validDataSources',
4146
- type: {
4147
- vec: {
4148
- defined: 'DataSource',
4149
- },
4150
- },
4151
- },
4152
- {
4153
- name: 'singleUpdateFeeInLamports',
4154
- type: 'u64',
4155
- },
4156
- {
4157
- name: 'minimumSignatures',
4158
- type: 'u8',
4159
- },
4160
- ],
4161
- },
4162
- },
4163
- {
4164
- name: 'priceUpdateV2',
4165
- type: {
4166
- kind: 'struct',
4167
- fields: [
4168
- {
4169
- name: 'writeAuthority',
4170
- type: 'publicKey',
4171
- },
4172
- {
4173
- name: 'verificationLevel',
4174
- type: {
4175
- defined: 'VerificationLevel',
4176
- },
4177
- },
4178
- {
4179
- name: 'priceMessage',
4180
- type: {
4181
- defined: 'PriceFeedMessage',
4182
- },
4183
- },
4184
- {
4185
- name: 'postedSlot',
4186
- type: 'u64',
4187
- },
4188
- ],
4189
- },
4190
- },
4191
- ],
4192
- types: [
4193
- {
4194
- name: 'PriceFeedMessage',
4195
- type: {
4196
- kind: 'struct',
4197
- fields: [
4198
- {
4199
- name: 'feedId',
4200
- type: {
4201
- array: ['u8', 32],
4202
- },
4203
- },
4204
- {
4205
- name: 'price',
4206
- type: 'i64',
4207
- },
4208
- {
4209
- name: 'conf',
4210
- type: 'u64',
4211
- },
4212
- {
4213
- name: 'exponent',
4214
- type: 'i32',
4215
- },
4216
- {
4217
- name: 'publishTime',
4218
- type: 'i64',
4219
- },
4220
- {
4221
- name: 'prevPublishTime',
4222
- type: 'i64',
4223
- },
4224
- {
4225
- name: 'emaPrice',
4226
- type: 'i64',
4227
- },
4228
- {
4229
- name: 'emaConf',
4230
- type: 'u64',
4231
- },
4232
- ],
4233
- },
4234
- },
4235
- {
4236
- name: 'MerklePriceUpdate',
4237
- type: {
4238
- kind: 'struct',
4239
- fields: [
4240
- {
4241
- name: 'message',
4242
- type: 'bytes',
4243
- },
4244
- {
4245
- name: 'proof',
4246
- type: {
4247
- vec: {
4248
- array: ['u8', 20],
4249
- },
4250
- },
4251
- },
4252
- ],
4253
- },
4254
- },
4255
- {
4256
- name: 'DataSource',
4257
- type: {
4258
- kind: 'struct',
4259
- fields: [
4260
- {
4261
- name: 'chain',
4262
- type: 'u16',
4263
- },
4264
- {
4265
- name: 'emitter',
4266
- type: 'publicKey',
4267
- },
4268
- ],
4269
- },
4270
- },
4271
- {
4272
- name: 'PostUpdateAtomicParams',
4273
- type: {
4274
- kind: 'struct',
4275
- fields: [
4276
- {
4277
- name: 'vaa',
4278
- type: 'bytes',
4279
- },
4280
- {
4281
- name: 'merklePriceUpdate',
4282
- type: {
4283
- defined: 'MerklePriceUpdate',
4284
- },
4285
- },
4286
- {
4287
- name: 'treasuryId',
4288
- type: 'u8',
4289
- },
4290
- ],
4291
- },
4292
- },
4293
- {
4294
- name: 'PostUpdateParams',
4295
- type: {
4296
- kind: 'struct',
4297
- fields: [
4298
- {
4299
- name: 'merklePriceUpdate',
4300
- type: {
4301
- defined: 'MerklePriceUpdate',
4302
- },
4303
- },
4304
- {
4305
- name: 'treasuryId',
4306
- type: 'u8',
4307
- },
4308
- ],
4309
- },
4310
- },
4311
- {
4312
- name: 'VerificationLevel',
4313
- docs: [
4314
- '* This enum represents how many guardian signatures were checked for a Pythnet price update\n * If full, guardian quorum has been attained\n * If partial, at least config.minimum signatures have been verified, but in the case config.minimum_signatures changes in the future we also include the number of signatures that were checked',
4315
- ],
4316
- type: {
4317
- kind: 'enum',
4318
- variants: [
4319
- {
4320
- name: 'Partial',
4321
- fields: [
4322
- {
4323
- name: 'numSignatures',
4324
- type: 'u8',
4325
- },
4326
- ],
4327
- },
4328
- {
4329
- name: 'Full',
4330
- },
4331
- ],
4332
- },
4333
- },
4334
- ],
4335
- errors: [
4336
- {
4337
- code: 6000,
4338
- name: 'InvalidWormholeMessage',
4339
- msg: 'Received an invalid wormhole message',
4340
- },
4341
- {
4342
- code: 6001,
4343
- name: 'DeserializeMessageFailed',
4344
- msg: 'An error occurred when deserializing the message',
4345
- },
4346
- {
4347
- code: 6002,
4348
- name: 'InvalidPriceUpdate',
4349
- msg: 'Received an invalid price update',
4350
- },
4351
- {
4352
- code: 6003,
4353
- name: 'UnsupportedMessageType',
4354
- msg: 'This type of message is not supported currently',
4355
- },
4356
- {
4357
- code: 6004,
4358
- name: 'InvalidDataSource',
4359
- msg: "The tuple emitter chain, emitter doesn't match one of the valid data sources.",
4360
- },
4361
- {
4362
- code: 6005,
4363
- name: 'InsufficientFunds',
4364
- msg: 'Funds are insufficient to pay the receiving fee',
4365
- },
4366
- {
4367
- code: 6006,
4368
- name: 'WrongWriteAuthority',
4369
- msg: "This signer can't write to price update account",
4370
- },
4371
- {
4372
- code: 6007,
4373
- name: 'WrongVaaOwner',
4374
- msg: 'The posted VAA account has the wrong owner.',
4375
- },
4376
- {
4377
- code: 6008,
4378
- name: 'DeserializeVaaFailed',
4379
- msg: 'An error occurred when deserializing the VAA.',
4380
- },
4381
- {
4382
- code: 6009,
4383
- name: 'InsufficientGuardianSignatures',
4384
- msg: 'The number of guardian signatures is below the minimum',
4385
- },
4386
- {
4387
- code: 6010,
4388
- name: 'InvalidVaaVersion',
4389
- msg: 'Invalid VAA version',
4390
- },
4391
- {
4392
- code: 6011,
4393
- name: 'GuardianSetMismatch',
4394
- msg: "Guardian set version in the VAA doesn't match the guardian set passed",
4395
- },
4396
- {
4397
- code: 6012,
4398
- name: 'InvalidGuardianOrder',
4399
- msg: 'Guardian signature indices must be increasing',
4400
- },
4401
- {
4402
- code: 6013,
4403
- name: 'InvalidGuardianIndex',
4404
- msg: 'Guardian index exceeds the number of guardians in the set',
4405
- },
4406
- {
4407
- code: 6014,
4408
- name: 'InvalidSignature',
4409
- msg: 'A VAA signature is invalid',
4410
- },
4411
- {
4412
- code: 6015,
4413
- name: 'InvalidGuardianKeyRecovery',
4414
- msg: "The recovered guardian public key doesn't match the guardian set",
4415
- },
4416
- {
4417
- code: 6016,
4418
- name: 'WrongGuardianSetOwner',
4419
- msg: 'The guardian set account is owned by the wrong program',
4420
- },
4421
- {
4422
- code: 6017,
4423
- name: 'InvalidGuardianSetPda',
4424
- msg: "The Guardian Set account doesn't match the PDA derivation",
4425
- },
4426
- {
4427
- code: 6018,
4428
- name: 'GuardianSetExpired',
4429
- msg: 'The Guardian Set is expired',
4430
- },
4431
- {
4432
- code: 6019,
4433
- name: 'GovernanceAuthorityMismatch',
4434
- msg: 'The signer is not authorized to perform this governance action',
4435
- },
4436
- {
4437
- code: 6020,
4438
- name: 'TargetGovernanceAuthorityMismatch',
4439
- msg: 'The signer is not authorized to accept the governance authority',
4440
- },
4441
- {
4442
- code: 6021,
4443
- name: 'NonexistentGovernanceAuthorityTransferRequest',
4444
- msg: 'The governance authority needs to request a transfer first',
4445
- },
4446
- ],
4447
- };
4448
- //# sourceMappingURL=pyth_solana_receiver.d.ts.map
4449
-
4450
- export type PriceUpdateAccount =
4451
- IdlAccounts<PythSolanaReceiver>['priceUpdateV2'];