@wormhole-foundation/wormhole-connect 3.0.2-beta.0-development → 3.0.2-beta.1-development

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 (290) hide show
  1. package/README.md +1 -1
  2. package/dist/assets/{basic-ChNCp6rI.js → basic-PUjrTVXb.js} +1 -1
  3. package/dist/assets/{evm-DSirgd5b.js → evm-CO5UWnAY.js} +2 -2
  4. package/dist/assets/{index-L-lC4rqb.js → index-1lzfHdT2.js} +1 -1
  5. package/dist/assets/{index-CHfaLf5J.js → index-DBVZDYF7.js} +1 -1
  6. package/dist/assets/index-DKlPX3ZI.js +1 -0
  7. package/dist/assets/{index-BtCrMDAu.js → index-Ddk7n7Ti.js} +1 -1
  8. package/dist/assets/{index-HhyysXFu.js → index-DyUmO4PR.js} +1 -1
  9. package/dist/assets/{index-BiwA3Bbq.js → index-MMzKxP1N.js} +1 -1
  10. package/dist/assets/{secp256k1-Cd7rIav0.js → secp256k1-0LtSM2L1.js} +1 -1
  11. package/dist/assets/{secp256k1-BQBOR8e3.js → secp256k1-DwTU3j1N.js} +1 -1
  12. package/dist/assets/{solana-DcwLWeKT.js → solana-DlGdMBSL.js} +4 -4
  13. package/dist/assets/{w3m-modal-DdptuLHe.js → w3m-modal-DD9Jgepz.js} +1 -1
  14. package/dist/main.js +72 -70
  15. package/dist/src/AppRouter.d.ts.map +1 -1
  16. package/dist/src/config/mainnet/tokens.d.ts.map +1 -1
  17. package/dist/src/config/testnet/tokens.d.ts.map +1 -1
  18. package/dist/src/config/tokens.d.ts +1 -1
  19. package/dist/src/config/tokens.d.ts.map +1 -1
  20. package/dist/src/exports/index.d.ts +2 -2
  21. package/dist/src/exports/index.d.ts.map +1 -1
  22. package/dist/src/hooks/useFetchQuotes.d.ts.map +1 -1
  23. package/dist/src/icons/Chains/PLUME.d.ts.map +1 -1
  24. package/dist/src/icons/PoweredBy.d.ts.map +1 -1
  25. package/dist/src/icons/Routing.d.ts +5 -0
  26. package/dist/src/icons/Routing.d.ts.map +1 -0
  27. package/dist/src/icons/Tokens/PLUME.d.ts.map +1 -1
  28. package/dist/src/store/transferInput.d.ts +1 -1
  29. package/dist/src/store/transferInput.d.ts.map +1 -1
  30. package/dist/src/utils/coingecko.d.ts.map +1 -1
  31. package/dist/src/utils/formatNumber.d.ts +23 -0
  32. package/dist/src/utils/formatNumber.d.ts.map +1 -0
  33. package/dist/src/utils/index.d.ts +3 -1
  34. package/dist/src/utils/index.d.ts.map +1 -1
  35. package/dist/src/utils/routes.d.ts +12 -0
  36. package/dist/src/utils/routes.d.ts.map +1 -0
  37. package/dist/src/views/v2/Bridge/AmountInput/index.d.ts.map +1 -1
  38. package/dist/src/views/v2/Bridge/AssetPicker/TokenItem.d.ts.map +1 -1
  39. package/dist/src/views/v2/Bridge/Routes/SingleRoute.d.ts.map +1 -1
  40. package/dist/src/views/v2/Redeem/TransactionDetails/index.d.ts.map +1 -1
  41. package/dist/src/views/v3/Bridge/AmountInput/index.d.ts.map +1 -1
  42. package/dist/src/views/v3/Bridge/AssetPicker/TokenItem.d.ts.map +1 -1
  43. package/dist/src/views/v3/Bridge/AssetPicker/index.d.ts.map +1 -1
  44. package/dist/src/views/v3/Bridge/GasSlider/index.d.ts.map +1 -1
  45. package/dist/src/views/v3/Bridge/Routes/Eta.d.ts +6 -0
  46. package/dist/src/views/v3/Bridge/Routes/Eta.d.ts.map +1 -0
  47. package/dist/src/views/v3/Bridge/Routes/RouteBadge.d.ts.map +1 -1
  48. package/dist/src/views/v3/Bridge/Routes/RoutesBottomSheet.d.ts +7 -6
  49. package/dist/src/views/v3/Bridge/Routes/RoutesBottomSheet.d.ts.map +1 -1
  50. package/dist/src/views/v3/Bridge/Routes/RoutesLink.d.ts +7 -0
  51. package/dist/src/views/v3/Bridge/Routes/RoutesLink.d.ts.map +1 -0
  52. package/dist/src/views/v3/Bridge/Routes/RoutesList.d.ts +2 -1
  53. package/dist/src/views/v3/Bridge/Routes/RoutesList.d.ts.map +1 -1
  54. package/dist/src/views/v3/Bridge/Routes/RoutesLoader.d.ts +4 -0
  55. package/dist/src/views/v3/Bridge/Routes/RoutesLoader.d.ts.map +1 -0
  56. package/dist/src/views/v3/Bridge/Routes/RoutesModal.d.ts +6 -5
  57. package/dist/src/views/v3/Bridge/Routes/RoutesModal.d.ts.map +1 -1
  58. package/dist/src/views/v3/Bridge/Routes/SingleRoute.d.ts +1 -0
  59. package/dist/src/views/v3/Bridge/Routes/SingleRoute.d.ts.map +1 -1
  60. package/dist/src/views/v3/Bridge/Routes/index.d.ts.map +1 -1
  61. package/dist/src/views/v3/Redeem/TransactionDetails/index.d.ts.map +1 -1
  62. package/lib/account-Br8E7RB6.js +1 -0
  63. package/lib/{account-BTK2b2Fv.mjs → account-CVa_3S2g.mjs} +1 -1
  64. package/lib/{address-8wLqn60W.mjs → address-BApwdEpr.mjs} +96 -96
  65. package/lib/address-BwQqFkyh.js +1 -0
  66. package/lib/address-C2pxq9b2.js +1 -0
  67. package/lib/{address-n0gAFMrZ.mjs → address-f6joE_ig.mjs} +12 -12
  68. package/lib/aptos-CMRGggVs.js +2 -0
  69. package/lib/{aptos-CK-j196x.js → aptos-CTKQNmlP.js} +1 -1
  70. package/lib/{aptos-B-DJQlwt.mjs → aptos-CfFbx7uf.mjs} +9 -9
  71. package/lib/{aptos-Bwcz9wZX.mjs → aptos-fozuppXh.mjs} +3 -3
  72. package/lib/{basic-DHWVLmCq.mjs → basic-BA2aRJJn.mjs} +2 -2
  73. package/lib/{basic-B5ZFelC_.js → basic-DUWaF2I0.js} +1 -1
  74. package/lib/{basic-E2M-9h1u.js → basic-DeiUayOA.js} +1 -1
  75. package/lib/{basic-Pour9Ggp.mjs → basic-DoC8u7J8.mjs} +2 -2
  76. package/lib/{blake2b-C5HyObld.mjs → blake2b-BGxWUAjG.mjs} +23 -23
  77. package/lib/blake2b-Fj1aPKgL.js +1 -0
  78. package/lib/{browser-ponyfill-jK8MKVVg.mjs → browser-ponyfill-D5AN8ZPp.mjs} +1 -1
  79. package/lib/browser-ponyfill-Dn6gsMYK.js +2 -0
  80. package/lib/{chain-Bm6u6eUF.mjs → chain-DAw2I5H8.mjs} +1 -1
  81. package/lib/chain-DnPXlO8g.js +1 -0
  82. package/lib/chunk-KJH4KKG6-BjF7YUcU.js +470 -0
  83. package/lib/{chunk-KJH4KKG6-DJsu-Y-X.mjs → chunk-KJH4KKG6-DmVjhXO7.mjs} +144 -144
  84. package/lib/{constants-Cf2YMjNo.js → constants-BtNs_2F4.js} +1 -1
  85. package/lib/{constants-B7AbX6qr.mjs → constants-Dcc2nVaW.mjs} +3 -3
  86. package/lib/contract-BEHYQLvJ.js +1 -0
  87. package/lib/{contract-llnN6ki0.mjs → contract-BkMAZomO.mjs} +123 -123
  88. package/lib/{core-CF5c7Vev.mjs → core-BHV42Qa0.mjs} +25 -26
  89. package/lib/core-CV23yxnG.js +889 -0
  90. package/lib/create-CHcGblj6.js +1 -0
  91. package/lib/{create-Dm87_0zG.mjs → create-CKLtL7hr.mjs} +1 -1
  92. package/lib/{evm-BYIGg8e4.mjs → evm-Bf7qbM19.mjs} +42 -42
  93. package/lib/{evm-B2hUWkt7.js → evm-ClWkquRx.js} +2 -2
  94. package/lib/{evm-fvvpk-li.mjs → evm-DhMoy8cH.mjs} +6 -6
  95. package/lib/{evm-DFNbMHoa.js → evm-tXmzU9Xp.js} +2 -2
  96. package/lib/executor.js +1 -1
  97. package/lib/executor.mjs +145 -138
  98. package/lib/hosted.js +1 -1
  99. package/lib/hosted.mjs +1 -1
  100. package/lib/{index-Cwo5AKUC.mjs → index-1rCCpdwd.mjs} +5 -5
  101. package/lib/{index-DBCa3k0j.mjs → index-3HvzWPL7.mjs} +9 -9
  102. package/lib/{index-MOwE6ses.mjs → index-B7ztYPhr.mjs} +21 -22
  103. package/lib/index-BM-0SeYB.js +1 -0
  104. package/lib/{index-DiQ8Ytrt.mjs → index-BTnpftLz.mjs} +1 -1
  105. package/lib/{index-BiCMaXJS.js → index-BWQMi6Rj.js} +1 -1
  106. package/lib/index-BbgKw2pu.js +1 -0
  107. package/lib/index-BblcpkoK.js +1 -0
  108. package/lib/index-Bfblsmud.js +1 -0
  109. package/lib/{index-C_0yAOSX.mjs → index-BfkFXEnG.mjs} +25082 -24072
  110. package/lib/{index-fi1sh8vr.mjs → index-BijBPDRn.mjs} +2 -2
  111. package/lib/index-BoquY9R2.js +337 -0
  112. package/lib/index-C2NtsO9Q.js +1 -0
  113. package/lib/{index-CNuk-XLX.mjs → index-C4JmrizV.mjs} +4 -4
  114. package/lib/index-C8TtXpOf.js +1 -0
  115. package/lib/index-CB8kOyIP.js +1 -0
  116. package/lib/index-CInVjUCW.js +1 -0
  117. package/lib/{index-BF11RebI.mjs → index-CLTklDbp.mjs} +1 -1
  118. package/lib/index-CQvgeH_r.js +1 -0
  119. package/lib/{index-DzYjoSJp.mjs → index-CUnOYRFQ.mjs} +23 -24
  120. package/lib/{index-DGh9LzN1.mjs → index-CWe_BTdo.mjs} +31 -31
  121. package/lib/{index-2Bz1Np4K.mjs → index-CZ91lJ9M.mjs} +5 -5
  122. package/lib/{index-Dgy1FO7C.js → index-CgyVnj6U.js} +1 -1
  123. package/lib/{index-BzJcFdt_.mjs → index-Clr2JjoJ.mjs} +44 -44
  124. package/lib/index-CnnCCv6Q.js +1 -0
  125. package/lib/{index-CJnRWlFf.mjs → index-CwxGLNEk.mjs} +48 -49
  126. package/lib/index-D7BLfz05.js +1 -0
  127. package/lib/index-DM7C-wvQ.js +3 -0
  128. package/lib/{index-DhIh3xiW.mjs → index-DNy_sNGr.mjs} +8 -8
  129. package/lib/{index-BZaRg0yd.mjs → index-DVcaDWmz.mjs} +1 -1
  130. package/lib/{index-CsAigASU.mjs → index-DWOP9OBp.mjs} +17 -17
  131. package/lib/{index-CTLz8Fz0.mjs → index-Dda5qc2t.mjs} +13 -14
  132. package/lib/{index-CLBXF_zH.mjs → index-DeaiBvpG.mjs} +16 -16
  133. package/lib/index-HOuGP-7b.js +1 -0
  134. package/lib/{index-Dt2uNp-N.mjs → index-KZve3tYJ.mjs} +4 -4
  135. package/lib/{index-CJDBidKv.mjs → index-SIyXqCAN.mjs} +41 -41
  136. package/lib/index-WhVYPMUr.js +1 -0
  137. package/lib/index-hmjT4xa7.js +1 -0
  138. package/lib/index-ledagFNU.js +1 -0
  139. package/lib/index-pbRVlgcN.js +1 -0
  140. package/lib/{index-BpQXUhR4.mjs → index-qK7AyMAk.mjs} +23 -27
  141. package/lib/index-ttZu99PZ.js +1 -0
  142. package/lib/{index.es-BqRBGIq6.mjs → index.es-BXRQf6Oi.mjs} +25 -26
  143. package/lib/index.es-BjGaOok5.js +11 -0
  144. package/lib/index.es-D6S74vhi.js +27 -0
  145. package/lib/{index.es-DgCZuUzB.mjs → index.es-cOw8juwf.mjs} +741 -737
  146. package/lib/index.js +1 -1
  147. package/lib/index.mjs +17 -16
  148. package/lib/mayan.js +3 -3
  149. package/lib/mayan.mjs +918 -891
  150. package/lib/mint-CL36R6ED.js +1 -0
  151. package/lib/{mint-Dc-VsiAn.mjs → mint-DunEG1jV.mjs} +32 -33
  152. package/lib/ntt.js +1 -1
  153. package/lib/ntt.mjs +2332 -2373
  154. package/lib/platform-7vCWzCny.js +1 -0
  155. package/lib/platform-BKhoO9So.js +1 -0
  156. package/lib/{platform-B95L0Vxv.mjs → platform-BN6LFtXE.mjs} +16 -16
  157. package/lib/{platform-DnP_1wGA.mjs → platform-BYLu9SzP.mjs} +4 -4
  158. package/lib/platform-Bbe26nx7.js +1 -0
  159. package/lib/{platform-DiG7WY9Z.mjs → platform-DCgWqmh1.mjs} +4 -4
  160. package/lib/{provider-jsonrpc-CRABh2gN.mjs → provider-jsonrpc-Bmgnrmpy.mjs} +155 -155
  161. package/lib/provider-jsonrpc-CbtP2Ffg.js +1 -0
  162. package/lib/{secp256k1-zHHDNAlH.mjs → secp256k1-BDQEvyHq.mjs} +1 -1
  163. package/lib/{secp256k1-obBDPYM-.mjs → secp256k1-C77Oh9AA.mjs} +1 -1
  164. package/lib/{secp256k1-2hq3Jk4g.mjs → secp256k1-CCn2vlXj.mjs} +1 -1
  165. package/lib/{secp256k1-B94G4gyy.js → secp256k1-CHAR40au.js} +1 -1
  166. package/lib/{secp256k1-DCcAh19h.js → secp256k1-D-DmPYcJ.js} +1 -1
  167. package/lib/{secp256k1-CjndBUS7.js → secp256k1-DYWDlveU.js} +1 -1
  168. package/lib/{signer-N_ccpPOz.mjs → signer-BIcn81N5.mjs} +18 -18
  169. package/lib/signer-H7atraks.js +1 -0
  170. package/lib/{solana-_Ha4YgiP.mjs → solana-B0QSg7B3.mjs} +30 -30
  171. package/lib/solana-Cs5VyB20.js +900 -0
  172. package/lib/solana-uvHG8JV5.js +1 -0
  173. package/lib/solana-zyfOlbhb.mjs +18 -0
  174. package/lib/{solanaEmbed.esm-DK5RIquB.mjs → solanaEmbed.esm-BqdznDuW.mjs} +623 -622
  175. package/lib/solanaEmbed.esm-D8vtESE6.js +10 -0
  176. package/lib/src/AppRouter.d.ts.map +1 -1
  177. package/lib/src/config/mainnet/tokens.d.ts.map +1 -1
  178. package/lib/src/config/testnet/tokens.d.ts.map +1 -1
  179. package/lib/src/config/tokens.d.ts +1 -1
  180. package/lib/src/config/tokens.d.ts.map +1 -1
  181. package/lib/src/exports/index.d.ts +2 -2
  182. package/lib/src/exports/index.d.ts.map +1 -1
  183. package/lib/src/hooks/useFetchQuotes.d.ts.map +1 -1
  184. package/lib/src/icons/Chains/PLUME.d.ts.map +1 -1
  185. package/lib/src/icons/PoweredBy.d.ts.map +1 -1
  186. package/lib/src/icons/Routing.d.ts +5 -0
  187. package/lib/src/icons/Routing.d.ts.map +1 -0
  188. package/lib/src/icons/Tokens/PLUME.d.ts.map +1 -1
  189. package/lib/src/store/transferInput.d.ts +1 -1
  190. package/lib/src/store/transferInput.d.ts.map +1 -1
  191. package/lib/src/utils/coingecko.d.ts.map +1 -1
  192. package/lib/src/utils/formatNumber.d.ts +23 -0
  193. package/lib/src/utils/formatNumber.d.ts.map +1 -0
  194. package/lib/src/utils/index.d.ts +3 -1
  195. package/lib/src/utils/index.d.ts.map +1 -1
  196. package/lib/src/utils/routes.d.ts +12 -0
  197. package/lib/src/utils/routes.d.ts.map +1 -0
  198. package/lib/src/views/v2/Bridge/AmountInput/index.d.ts.map +1 -1
  199. package/lib/src/views/v2/Bridge/AssetPicker/TokenItem.d.ts.map +1 -1
  200. package/lib/src/views/v2/Bridge/Routes/SingleRoute.d.ts.map +1 -1
  201. package/lib/src/views/v2/Redeem/TransactionDetails/index.d.ts.map +1 -1
  202. package/lib/src/views/v3/Bridge/AmountInput/index.d.ts.map +1 -1
  203. package/lib/src/views/v3/Bridge/AssetPicker/TokenItem.d.ts.map +1 -1
  204. package/lib/src/views/v3/Bridge/AssetPicker/index.d.ts.map +1 -1
  205. package/lib/src/views/v3/Bridge/GasSlider/index.d.ts.map +1 -1
  206. package/lib/src/views/v3/Bridge/Routes/Eta.d.ts +6 -0
  207. package/lib/src/views/v3/Bridge/Routes/Eta.d.ts.map +1 -0
  208. package/lib/src/views/v3/Bridge/Routes/RouteBadge.d.ts.map +1 -1
  209. package/lib/src/views/v3/Bridge/Routes/RoutesBottomSheet.d.ts +7 -6
  210. package/lib/src/views/v3/Bridge/Routes/RoutesBottomSheet.d.ts.map +1 -1
  211. package/lib/src/views/v3/Bridge/Routes/RoutesLink.d.ts +7 -0
  212. package/lib/src/views/v3/Bridge/Routes/RoutesLink.d.ts.map +1 -0
  213. package/lib/src/views/v3/Bridge/Routes/RoutesList.d.ts +2 -1
  214. package/lib/src/views/v3/Bridge/Routes/RoutesList.d.ts.map +1 -1
  215. package/lib/src/views/v3/Bridge/Routes/RoutesLoader.d.ts +4 -0
  216. package/lib/src/views/v3/Bridge/Routes/RoutesLoader.d.ts.map +1 -0
  217. package/lib/src/views/v3/Bridge/Routes/RoutesModal.d.ts +6 -5
  218. package/lib/src/views/v3/Bridge/Routes/RoutesModal.d.ts.map +1 -1
  219. package/lib/src/views/v3/Bridge/Routes/SingleRoute.d.ts +1 -0
  220. package/lib/src/views/v3/Bridge/Routes/SingleRoute.d.ts.map +1 -1
  221. package/lib/src/views/v3/Bridge/Routes/index.d.ts.map +1 -1
  222. package/lib/src/views/v3/Redeem/TransactionDetails/index.d.ts.map +1 -1
  223. package/lib/{sui-CQcQ6w_P.mjs → sui-B38DyOqM.mjs} +44 -44
  224. package/lib/{sui-BplKFZQu.mjs → sui-BpfnZR4f.mjs} +3 -3
  225. package/lib/sui-CT9MWY38.js +1 -0
  226. package/lib/{sui-_hvmCvD8.js → sui-DXQAMRQJ.js} +1 -1
  227. package/lib/{tokens-DNv0ZNvU.js → tokens-CmINcwKk.js} +31 -31
  228. package/lib/{tokens-Dl4YwW18.mjs → tokens-YxAPPVy3.mjs} +1726 -1724
  229. package/lib/transfer-BQ72fByU.js +1 -0
  230. package/lib/transfer-bTW0j9yh.mjs +58 -0
  231. package/lib/units-Ckije3Qv.js +1 -0
  232. package/lib/{units-DPWUSE6J.mjs → units-CtyvuzxQ.mjs} +13 -13
  233. package/lib/unsignedTransaction-C6Qp42VS.js +1 -0
  234. package/lib/{unsignedTransaction-DwcUilyN.mjs → unsignedTransaction-CXB-QCUC.mjs} +18 -18
  235. package/lib/{w3m-modal-BJILsxDp.mjs → w3m-modal-B7LUHLWC.mjs} +2 -2
  236. package/lib/{w3m-modal-D4CpFxO2.mjs → w3m-modal-BOTzBqbc.mjs} +2 -2
  237. package/lib/{w3m-modal-CrfHWSrF.js → w3m-modal-BTb03-7B.js} +1 -1
  238. package/lib/{w3m-modal-CBG2MSPp.js → w3m-modal-xmdf4r6V.js} +1 -1
  239. package/lib/web3-COTIsLs8.js +22 -0
  240. package/lib/{address-B-XN4tFw.mjs → web3-DYVeiqSa.mjs} +6599 -6576
  241. package/package.json +32 -32
  242. package/dist/assets/index-BWPgrXHs.js +0 -1
  243. package/lib/account-cRt2xMoW.js +0 -1
  244. package/lib/address-BGujeWtN.js +0 -22
  245. package/lib/address-C7DIAk4M.js +0 -1
  246. package/lib/address-KNhRm6oe.js +0 -1
  247. package/lib/aptos-f5TqmvqV.js +0 -2
  248. package/lib/blake2b-B-MRXUPb.js +0 -1
  249. package/lib/browser-ponyfill-CE6vRkjp.js +0 -2
  250. package/lib/chain-Hsn22HAP.js +0 -1
  251. package/lib/chunk-KJH4KKG6-CoyI75Ig.js +0 -470
  252. package/lib/contract-D2fTrJgn.js +0 -1
  253. package/lib/core-v0G9f7LX.js +0 -889
  254. package/lib/create-DoZZ7ciL.js +0 -1
  255. package/lib/index-B8-KKWD-.js +0 -1
  256. package/lib/index-BHbvgOMD.js +0 -1
  257. package/lib/index-BHfUgvSV.js +0 -1
  258. package/lib/index-BTKC7Hou.js +0 -1
  259. package/lib/index-BWXglAWd.js +0 -1
  260. package/lib/index-Bpp8C4u8.js +0 -1
  261. package/lib/index-CF2fHBHJ.js +0 -3
  262. package/lib/index-CTPz98nv.js +0 -1
  263. package/lib/index-ClMoiji-.js +0 -1
  264. package/lib/index-ClsVcH6F.js +0 -1
  265. package/lib/index-CqOI6LVu.js +0 -1
  266. package/lib/index-DCz_4mcz.js +0 -1
  267. package/lib/index-DKksdvND.js +0 -335
  268. package/lib/index-DRv3ZpVL.js +0 -1
  269. package/lib/index-DYqo8IhM.js +0 -1
  270. package/lib/index-DZubce9o.js +0 -1
  271. package/lib/index-DprM_IpB.js +0 -1
  272. package/lib/index-DshEQYMA.js +0 -1
  273. package/lib/index-JrM783SN.js +0 -1
  274. package/lib/index.es-C6YhioMN.js +0 -27
  275. package/lib/index.es-D3Xxxr8I.js +0 -11
  276. package/lib/mint-DlXC3sGi.js +0 -1
  277. package/lib/platform-B1XoDKoN.js +0 -1
  278. package/lib/platform-COuZC5Zc.js +0 -1
  279. package/lib/platform-NG3efAb2.js +0 -1
  280. package/lib/provider-jsonrpc-pXNHQF7n.js +0 -1
  281. package/lib/signer-CCa6npZ3.js +0 -1
  282. package/lib/solana-BJ3aReZw.mjs +0 -18
  283. package/lib/solana-BwyVgP30.js +0 -1
  284. package/lib/solana-CanFuMgA.js +0 -900
  285. package/lib/solanaEmbed.esm-C--1F7Lx.js +0 -10
  286. package/lib/sui-Bs83Gy5Z.js +0 -1
  287. package/lib/units-BvcKDiAx.js +0 -1
  288. package/lib/unsignedTransaction-dN_5EJf5.js +0 -1
  289. package/lib/web3-Bu_6UejS.mjs +0 -67
  290. package/lib/web3-Doz_0RHD.js +0 -1
@@ -1,11 +1,11 @@
1
1
  var Le = Object.defineProperty;
2
2
  var Ue = (r, e, t) => e in r ? Le(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
3
  var u = (r, e, t) => Ue(r, typeof e != "symbol" ? e + "" : e, t);
4
- import { P as p, aK as Te, as as ne, d, a5 as Ce, dv as _e, a0 as M, ch as ke, ay as L, a3 as U, a2 as V, aN as q, b7 as ie, dw as Pe, dx as ve, a1 as re, aO as j, ae as ze, aG as Ke, aP as qe } from "./address-B-XN4tFw.mjs";
5
- import { d as m, P as Fe, c as Ve } from "./index-BZaRg0yd.mjs";
6
- import { d as b, g as z } from "./account-BTK2b2Fv.mjs";
7
- import { a as De, S as Ge } from "./unsignedTransaction-DwcUilyN.mjs";
8
- import { c as Oe } from "./create-Dm87_0zG.mjs";
4
+ import { P as p, aN as Te, av as ne, d, a4 as Ce, dy as ke, $ as M, ck as _e, aB as L, a2 as U, a1 as V, aQ as q, ba as ie, dz as ve, dA as Pe, a0 as re, aR as j, ad as ze, aJ as Ke, aS as qe } from "./web3-DYVeiqSa.mjs";
5
+ import { d as m, P as Fe, c as Ve } from "./index-DVcaDWmz.mjs";
6
+ import { d as b, g as z } from "./account-CVa_3S2g.mjs";
7
+ import { S as De, a as Ge } from "./unsignedTransaction-CXB-QCUC.mjs";
8
+ import { c as Oe } from "./create-CKLtL7hr.mjs";
9
9
  const oe = new p("BPFLoaderUpgradeab1e11111111111111111111111");
10
10
  function Ne(r) {
11
11
  return b([new p(r).toBuffer()], oe);
@@ -87,7 +87,7 @@ function A(r, e) {
87
87
  throw new Error(`Invalid type ${JSON.stringify(e)}`);
88
88
  }
89
89
  }
90
- function k(r) {
90
+ function _(r) {
91
91
  return r.replace(/(?:^\w|[A-Z]|\b\w)/g, function(e, t) {
92
92
  return t === 0 ? e.toLowerCase() : e.toUpperCase();
93
93
  }).replace(/[\s\-_]+/g, "");
@@ -189,7 +189,7 @@ class N {
189
189
  function H(r) {
190
190
  return b([d.Buffer.from("emitter")], r);
191
191
  }
192
- function W(r, e) {
192
+ function J(r, e) {
193
193
  const t = H(r);
194
194
  return {
195
195
  emitter: t,
@@ -202,15 +202,15 @@ async function je(r, e, t, n) {
202
202
  function C(r) {
203
203
  return b([d.Buffer.from("fee_collector")], r);
204
204
  }
205
- const se = 65, P = 20;
205
+ const se = 65, v = 20;
206
206
  function He(r, e, t) {
207
207
  return new Ce({
208
208
  keys: [],
209
- programId: _e.programId,
210
- data: We.serialize(r, e, t)
209
+ programId: ke.programId,
210
+ data: Je.serialize(r, e, t)
211
211
  });
212
212
  }
213
- class We {
213
+ class Je {
214
214
  // https://docs.solana.com/developing/runtime-facilities/programs#secp256k1-program
215
215
  //
216
216
  // struct Secp256k1SignatureOffsets {
@@ -256,17 +256,17 @@ class We {
256
256
  throw Error("signatures.length != keys.length");
257
257
  if (n.length != 32)
258
258
  throw Error("message.length != 32");
259
- const s = e.length, a = 11, i = 1 + s * a, o = se + P, c = i + s * o, f = 32, g = d.Buffer.alloc(c + f);
259
+ const s = e.length, a = 11, i = 1 + s * a, o = se + v, c = i + s * o, f = 32, g = d.Buffer.alloc(c + f);
260
260
  g.writeUInt8(s, 0), g.write(n.toString("hex"), c, "hex");
261
261
  for (let l = 0; l < s; ++l) {
262
262
  const y = e.at(l);
263
263
  if ((y == null ? void 0 : y.length) != se)
264
264
  throw Error(`signatures[${l}].length != 65`);
265
265
  const h = t.at(l);
266
- if ((h == null ? void 0 : h.length) != P)
266
+ if ((h == null ? void 0 : h.length) != v)
267
267
  throw Error(`keys[${l}].length != 20`);
268
- const I = i + o * l, _ = I + 65;
269
- g.writeUInt16LE(I, 1 + l * a), g.writeUInt8(0, 3 + l * a), g.writeUInt16LE(_, 4 + l * a), g.writeUInt8(0, 6 + l * a), g.writeUInt16LE(c, 7 + l * a), g.writeUInt16LE(f, 9 + l * a), g.writeUInt8(0, 10 + l * a), g.write(y.toString("hex"), I, "hex"), g.write(h.toString("hex"), _, "hex");
268
+ const I = i + o * l, k = I + 65;
269
+ g.writeUInt16LE(I, 1 + l * a), g.writeUInt8(0, 3 + l * a), g.writeUInt16LE(k, 4 + l * a), g.writeUInt8(0, 6 + l * a), g.writeUInt16LE(c, 7 + l * a), g.writeUInt16LE(f, 9 + l * a), g.writeUInt8(0, 10 + l * a), g.write(y.toString("hex"), I, "hex"), g.write(h.toString("hex"), k, "hex");
270
270
  }
271
271
  return g;
272
272
  }
@@ -280,7 +280,7 @@ function x(r, e) {
280
280
  })()
281
281
  ], r);
282
282
  }
283
- async function J(r, e, t, n) {
283
+ async function W(r, e, t, n) {
284
284
  return r.getAccountInfo(x(e, t), n).then((s) => R.deserialize(z(s)));
285
285
  }
286
286
  class R {
@@ -292,10 +292,10 @@ class R {
292
292
  this.index = e, this.keys = t, this.creationTime = n, this.expirationTime = s;
293
293
  }
294
294
  static deserialize(e) {
295
- const t = e.readUInt32LE(0), n = e.readUInt32LE(4), s = 8 + n * P, a = e.readUInt32LE(s), i = e.readUInt32LE(4 + s), o = [];
295
+ const t = e.readUInt32LE(0), n = e.readUInt32LE(4), s = 8 + n * v, a = e.readUInt32LE(s), i = e.readUInt32LE(4 + s), o = [];
296
296
  for (let c = 0; c < n; ++c) {
297
- const f = 8 + c * P;
298
- o.push(e.subarray(f, f + P));
297
+ const f = 8 + c * v;
298
+ o.push(e.subarray(f, f + v));
299
299
  }
300
300
  return new R(t, o, a, i);
301
301
  }
@@ -303,7 +303,7 @@ class R {
303
303
  function E(r, e) {
304
304
  return b([d.Buffer.from("PostedVAA"), e], r);
305
305
  }
306
- async function Je(r, e, t) {
306
+ async function We(r, e, t) {
307
307
  return r.getAccountInfo(new p(e), t).then((n) => $.deserialize(z(n)));
308
308
  }
309
309
  class $ {
@@ -372,7 +372,7 @@ class Xe {
372
372
  }
373
373
  class B {
374
374
  static fieldLayout(e, t) {
375
- const n = e.name !== void 0 ? k(e.name) : void 0;
375
+ const n = e.name !== void 0 ? _(e.name) : void 0;
376
376
  switch (e.type) {
377
377
  case "bool":
378
378
  return m.bool(n);
@@ -441,17 +441,17 @@ class Q {
441
441
  static parseIxLayout(e) {
442
442
  const n = (e.instructions ? e.instructions : []).map((s) => {
443
443
  let a = s.args.map((o) => B.fieldLayout(o, Array.from([...e.accounts ?? [], ...e.types ?? []])));
444
- const i = k(s.name);
444
+ const i = _(s.name);
445
445
  return [i, m.struct(a, i)];
446
446
  }).concat(e.instructions.map((s) => {
447
447
  let a = s.args.map((o) => B.fieldLayout(o, Array.from([...e.accounts ?? [], ...e.types ?? []])));
448
- const i = k(s.name);
448
+ const i = _(s.name);
449
449
  return [i, m.struct(a, i)];
450
450
  }));
451
451
  return new Map(n);
452
452
  }
453
453
  encode(e, t) {
454
- const n = d.Buffer.alloc(1e3), s = k(e), a = this.ixLayout.get(s);
454
+ const n = d.Buffer.alloc(1e3), s = _(e), a = this.ixLayout.get(s);
455
455
  if (!a)
456
456
  throw new Error(`Unknown method: ${s}`);
457
457
  const i = a.encode(t, n), o = n.slice(0, i);
@@ -462,8 +462,8 @@ class Q {
462
462
  }
463
463
  decode(e, t = "hex") {
464
464
  var o;
465
- typeof e == "string" && (e = t === "hex" ? d.Buffer.from(e, "hex") : ke.decode(e));
466
- let n = d.Buffer.from(e.slice(0, 1)).readInt8(), s = d.Buffer.from(e.slice(1)), a = k(F[n] ?? "");
465
+ typeof e == "string" && (e = t === "hex" ? d.Buffer.from(e, "hex") : _e.decode(e));
466
+ let n = d.Buffer.from(e.slice(0, 1)).readInt8(), s = d.Buffer.from(e.slice(1)), a = _(F[n] ?? "");
467
467
  return this.ixLayout.get(a) ? { data: (o = this.ixLayout.get(a)) == null ? void 0 : o.decode(s), name: a } : null;
468
468
  }
469
469
  }
@@ -1250,7 +1250,7 @@ function Ie(r, e, t, n, s, a, i) {
1250
1250
  }
1251
1251
  function Z(r, e, t, n) {
1252
1252
  let s;
1253
- return n ? { emitter: n, sequence: s } = W(n, r) : (n = e, s = O(n, r)), {
1253
+ return n ? { emitter: n, sequence: s } = J(n, r) : (n = e, s = O(n, r)), {
1254
1254
  bridge: S(r),
1255
1255
  message: new p(t),
1256
1256
  emitter: new p(n),
@@ -1274,7 +1274,7 @@ function Ae(r, e, t, n, s) {
1274
1274
  new ie(n.sequence.toString()),
1275
1275
  n.consistencyLevel,
1276
1276
  // Note: This _must_ be a Buffer, a Uint8Array does not work
1277
- d.Buffer.from(Pe(n.payloadLiteral, n.payload))
1277
+ d.Buffer.from(ve(n.payloadLiteral, n.payload))
1278
1278
  );
1279
1279
  return a._ixFn(...a._args, {
1280
1280
  accounts: xe(e, t, s, n),
@@ -1298,14 +1298,14 @@ function xe(r, e, t, n) {
1298
1298
  }
1299
1299
  const ut = 19;
1300
1300
  async function Ee(r, e, t, n, s, a) {
1301
- const i = n.guardianSet, o = await J(r, e, i, a), c = n.signatures, f = o.keys, g = 7, l = [];
1301
+ const i = n.guardianSet, o = await W(r, e, i, a), c = n.signatures, f = o.keys, g = 7, l = [];
1302
1302
  for (let y = 0; y < Math.ceil(c.length / g); ++y) {
1303
- const h = y * g, I = Math.min(c.length, (y + 1) * g), _ = new Array(ut).fill(-1), ee = [], te = [];
1303
+ const h = y * g, I = Math.min(c.length, (y + 1) * g), k = new Array(ut).fill(-1), ee = [], te = [];
1304
1304
  for (let K = 0; K < I - h; ++K) {
1305
1305
  const Y = c.at(K + h);
1306
- ee.push(d.Buffer.from(Y.signature.encode())), te.push(f.at(Y.guardianIndex)), _[Y.guardianIndex] = K;
1306
+ ee.push(d.Buffer.from(Y.signature.encode())), te.push(f.at(Y.guardianIndex)), k[Y.guardianIndex] = K;
1307
1307
  }
1308
- l.push(He(ee, te, d.Buffer.from(n.hash))), l.push(ct(r, e, t, n, s, _));
1308
+ l.push(He(ee, te, d.Buffer.from(n.hash))), l.push(ct(r, e, t, n, s, k));
1309
1309
  }
1310
1310
  return l;
1311
1311
  }
@@ -1324,13 +1324,13 @@ function Be(r, e, t, n) {
1324
1324
  payer: new p(e),
1325
1325
  guardianSet: x(r, n.guardianSet),
1326
1326
  signatureSet: new p(t),
1327
- instructions: ve,
1327
+ instructions: Pe,
1328
1328
  rent: U,
1329
1329
  systemProgram: M.programId
1330
1330
  };
1331
1331
  }
1332
1332
  function gt(r, e) {
1333
- const { emitter: t, sequence: n } = W(r, e);
1333
+ const { emitter: t, sequence: n } = J(r, e);
1334
1334
  return {
1335
1335
  wormholeBridge: S(e),
1336
1336
  wormholeEmitter: t,
@@ -1380,8 +1380,8 @@ const ft = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1380
1380
  deriveWormholeBridgeDataKey: S,
1381
1381
  deriveWormholeEmitterKey: H,
1382
1382
  getClaim: Ye,
1383
- getEmitterKeys: W,
1384
- getGuardianSet: J,
1383
+ getEmitterKeys: J,
1384
+ getGuardianSet: W,
1385
1385
  getInitializeAccounts: be,
1386
1386
  getPostMessageAccounts: Z,
1387
1387
  getPostMessageCpiAccounts: dt,
@@ -1389,7 +1389,7 @@ const ft = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1389
1389
  getProgramSequenceTracker: je,
1390
1390
  getSequenceTracker: fe,
1391
1391
  getSetFeesAccounts: he,
1392
- getSignatureSetData: Je,
1392
+ getSignatureSetData: We,
1393
1393
  getTransferFeesAccounts: Se,
1394
1394
  getUpgradeContractAccounts: Me,
1395
1395
  getUpgradeGuardianSetAccounts: we,
@@ -1397,7 +1397,7 @@ const ft = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1397
1397
  getWormholeBridgeData: de,
1398
1398
  getWormholeDerivedAccounts: gt
1399
1399
  }, Symbol.toStringTag, { value: "Module" })), ae = "Program log: Sequence: ";
1400
- class v {
1400
+ class P {
1401
1401
  constructor(e, t, n, s) {
1402
1402
  u(this, "network");
1403
1403
  u(this, "chain");
@@ -1414,7 +1414,7 @@ class v {
1414
1414
  this.address = a, this.coreBridge = w(a, n);
1415
1415
  }
1416
1416
  async getGuardianSet(e) {
1417
- const t = await J(this.connection, this.coreBridge.programId, e);
1417
+ const t = await W(this.connection, this.coreBridge.programId, e);
1418
1418
  return {
1419
1419
  index: t.index,
1420
1420
  keys: t.keys.map((n) => n.toString("hex")),
@@ -1425,7 +1425,7 @@ class v {
1425
1425
  const [n, s] = await De.chainFromRpc(e), a = t[s];
1426
1426
  if (a.network !== n)
1427
1427
  throw new Error(`Network mismatch for chain ${s}: ${a.network} != ${n}`);
1428
- return new v(n, s, e, t[s].contracts);
1428
+ return new P(n, s, e, t[s].contracts);
1429
1429
  }
1430
1430
  async ensureBridgeConfig() {
1431
1431
  this.bridgeData || (this.bridgeData = await de(this.connection, this.coreBridge.programId));
@@ -1530,7 +1530,7 @@ class v {
1530
1530
  if (!t || !t.meta || !t.meta.innerInstructions)
1531
1531
  throw new Error("transaction not found");
1532
1532
  try {
1533
- const i = v.parseSequenceFromLog(this.coreBridge.programId.toBase58(), t);
1533
+ const i = P.parseSequenceFromLog(this.coreBridge.programId.toBase58(), t);
1534
1534
  if (i.length > 0) {
1535
1535
  const [o, c] = i[0];
1536
1536
  return [
@@ -1575,18 +1575,18 @@ class v {
1575
1575
  return new Ge(e, this.network, this.chain, t, n);
1576
1576
  }
1577
1577
  }
1578
- Ke(qe, "WormholeCore", v);
1578
+ Ke(qe, "WormholeCore", P);
1579
1579
  const wt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1580
1580
  __proto__: null,
1581
1581
  IDL: X,
1582
- SolanaWormholeCore: v,
1582
+ SolanaWormholeCore: P,
1583
1583
  deserializePostMessage: ge,
1584
1584
  postMessageLayout: ce,
1585
1585
  utils: ft
1586
1586
  }, Symbol.toStringTag, { value: "Module" }));
1587
1587
  export {
1588
1588
  oe as B,
1589
- v as S,
1589
+ P as S,
1590
1590
  C as a,
1591
1591
  je as b,
1592
1592
  S as c,
@@ -0,0 +1 @@
1
+ "use strict";var Xt=Object.defineProperty;var Jt=(n,t,i)=>t in n?Xt(n,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[t]=i;var l=(n,t,i)=>Jt(n,typeof t!="symbol"?t+"":t,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("./index-BM-0SeYB.js"),e=require("./web3-COTIsLs8.js"),ie=require("./index-DM7C-wvQ.js"),w=require("./account-Br8E7RB6.js"),K=require("./unsignedTransaction-C6Qp42VS.js"),A=new e.PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");new e.PublicKey("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb");const O=new e.PublicKey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"),R=new e.PublicKey("So11111111111111111111111111111111111111112");new e.PublicKey("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP");class X extends Error{constructor(t){super(t)}}class Fe extends X{constructor(){super(...arguments),this.name="TokenAccountNotFoundError"}}class jt extends X{constructor(){super(...arguments),this.name="TokenInvalidAccountError"}}class ft extends X{constructor(){super(...arguments),this.name="TokenInvalidAccountOwnerError"}}class te extends X{constructor(){super(...arguments),this.name="TokenInvalidAccountSizeError"}}class en extends X{constructor(){super(...arguments),this.name="TokenInvalidMintError"}}class gt extends X{constructor(){super(...arguments),this.name="TokenOwnerOffCurveError"}}var H;(function(n){n[n.InitializeMint=0]="InitializeMint",n[n.InitializeAccount=1]="InitializeAccount",n[n.InitializeMultisig=2]="InitializeMultisig",n[n.Transfer=3]="Transfer",n[n.Approve=4]="Approve",n[n.Revoke=5]="Revoke",n[n.SetAuthority=6]="SetAuthority",n[n.MintTo=7]="MintTo",n[n.Burn=8]="Burn",n[n.CloseAccount=9]="CloseAccount",n[n.FreezeAccount=10]="FreezeAccount",n[n.ThawAccount=11]="ThawAccount",n[n.TransferChecked=12]="TransferChecked",n[n.ApproveChecked=13]="ApproveChecked",n[n.MintToChecked=14]="MintToChecked",n[n.BurnChecked=15]="BurnChecked",n[n.InitializeAccount2=16]="InitializeAccount2",n[n.SyncNative=17]="SyncNative",n[n.InitializeAccount3=18]="InitializeAccount3",n[n.InitializeMultisig2=19]="InitializeMultisig2",n[n.InitializeMint2=20]="InitializeMint2",n[n.GetAccountDataSize=21]="GetAccountDataSize",n[n.InitializeImmutableOwner=22]="InitializeImmutableOwner",n[n.AmountToUiAmount=23]="AmountToUiAmount",n[n.UiAmountToAmount=24]="UiAmountToAmount",n[n.InitializeMintCloseAuthority=25]="InitializeMintCloseAuthority",n[n.TransferFeeExtension=26]="TransferFeeExtension",n[n.ConfidentialTransferExtension=27]="ConfidentialTransferExtension",n[n.DefaultAccountStateExtension=28]="DefaultAccountStateExtension",n[n.Reallocate=29]="Reallocate",n[n.MemoTransferExtension=30]="MemoTransferExtension",n[n.CreateNativeMint=31]="CreateNativeMint",n[n.InitializeNonTransferableMint=32]="InitializeNonTransferableMint",n[n.InterestBearingMintExtension=33]="InterestBearingMintExtension",n[n.CpiGuardExtension=34]="CpiGuardExtension",n[n.InitializePermanentDelegate=35]="InitializePermanentDelegate",n[n.TransferHookExtension=36]="TransferHookExtension",n[n.MetadataPointerExtension=39]="MetadataPointerExtension"})(H||(H={}));function xe(n,t,i){if(i.length){n.push({pubkey:t,isSigner:!1,isWritable:!1});for(const r of i)n.push({pubkey:r instanceof e.PublicKey?r:r.publicKey,isSigner:!0,isWritable:!1})}else n.push({pubkey:t,isSigner:!0,isWritable:!1});return n}const nt=e.struct([e.u8("instruction"),e.u64("amount")]);function tn(n,t,i,r,s=[],a=A){const c=xe([{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:t,isSigner:!1,isWritable:!1}],i,s),o=e.dist.Buffer.alloc(nt.span);return nt.encode({instruction:H.Approve,amount:BigInt(r)},o),new e.TransactionInstruction({keys:c,programId:a,data:o})}const rt=e.struct([e.u8("instruction")]);function it(n,t,i,r=[],s=A){const a=xe([{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:t,isSigner:!1,isWritable:!0}],i,r),c=e.dist.Buffer.alloc(rt.span);return rt.encode({instruction:H.CloseAccount},c),new e.TransactionInstruction({keys:a,programId:s,data:c})}var me;(function(n){n[n.Uninitialized=0]="Uninitialized",n[n.Mint=1]="Mint",n[n.Account=2]="Account"})(me||(me={}));const Oe=1,nn=e.struct([e.u8("m"),e.u8("n"),e.bool("isInitialized"),e.publicKey("signer1"),e.publicKey("signer2"),e.publicKey("signer3"),e.publicKey("signer4"),e.publicKey("signer5"),e.publicKey("signer6"),e.publicKey("signer7"),e.publicKey("signer8"),e.publicKey("signer9"),e.publicKey("signer10"),e.publicKey("signer11")]),ze=nn.span;var fe;(function(n){n[n.Uninitialized=0]="Uninitialized",n[n.Initialized=1]="Initialized",n[n.Frozen=2]="Frozen"})(fe||(fe={}));const ht=e.struct([e.publicKey("mint"),e.publicKey("owner"),e.u64("amount"),e.u32("delegateOption"),e.publicKey("delegate"),e.u8("state"),e.u32("isNativeOption"),e.u64("isNative"),e.u64("delegatedAmount"),e.u32("closeAuthorityOption"),e.publicKey("closeAuthority")]),E=ht.span;async function rn(n,t,i,r=A){const s=await n.getAccountInfo(t,i);return an(t,s,r)}async function st(n,t){return await sn(n,[],t)}async function sn(n,t,i){const r=zn(t);return await n.getMinimumBalanceForRentExemption(r,i)}function an(n,t,i=A){if(!t)throw new Fe;if(!t.owner.equals(i))throw new ft;if(t.data.length<E)throw new te;const r=ht.decode(t.data.slice(0,E));let s=e.dist.Buffer.alloc(0);if(t.data.length>E){if(t.data.length===ze)throw new te;if(t.data[E]!=me.Account)throw new jt;s=t.data.slice(E+Oe)}return{address:n,mint:r.mint,owner:r.owner,amount:r.amount,delegate:r.delegateOption?r.delegate:null,delegatedAmount:r.delegatedAmount,isInitialized:r.state!==fe.Uninitialized,isFrozen:r.state===fe.Frozen,isNative:!!r.isNativeOption,rentExemptReserve:r.isNativeOption?r.isNative:null,closeAuthority:r.closeAuthorityOption?r.closeAuthority:null,tlvData:s}}const pt=e.struct([e.u32("mintAuthorityOption"),e.publicKey("mintAuthority"),e.u64("supply"),e.u8("decimals"),e.bool("isInitialized"),e.u32("freezeAuthorityOption"),e.publicKey("freezeAuthority")]),Re=pt.span;async function on(n,t,i,r=A){const s=await n.getAccountInfo(t,i);return cn(t,s,r)}function cn(n,t,i=A){if(!t)throw new Fe;if(!t.owner.equals(i))throw new ft;if(t.data.length<Re)throw new te;const r=pt.decode(t.data.slice(0,Re));let s=e.dist.Buffer.alloc(0);if(t.data.length>Re){if(t.data.length<=E)throw new te;if(t.data.length===ze)throw new te;if(t.data[E]!=me.Mint)throw new en;s=t.data.slice(E+Oe)}return{address:n,mintAuthority:r.mintAuthorityOption?r.mintAuthority:null,supply:r.supply,decimals:r.decimals,isInitialized:r.isInitialized,freezeAuthority:r.freezeAuthorityOption?r.freezeAuthority:null,tlvData:s}}async function at(n,t,i=!1,r=A,s=O){if(!i&&!e.PublicKey.isOnCurve(t.toBuffer()))throw new gt;const[a]=await e.PublicKey.findProgramAddress([t.toBuffer(),r.toBuffer(),n.toBuffer()],s);return a}function F(n,t,i=!1,r=A,s=O){if(!i&&!e.PublicKey.isOnCurve(t.toBuffer()))throw new gt;const[a]=e.PublicKey.findProgramAddressSync([t.toBuffer(),r.toBuffer(),n.toBuffer()],s);return a}const un=e.struct([e.bool("lockCpi")]),dn=un.span,ln=e.struct([e.u8("state")]),mn=ln.span,fn=e.struct([]),gn=fn.span,hn=e.struct([e.publicKey("rateAuthority"),e.ns64("initializationTimestamp"),e.s16("preUpdateAverageRate"),e.ns64("lastUpdateTimestamp"),e.s16("currentRate")]),pn=hn.span,yn=e.struct([e.bool("requireIncomingTransferMemos")]),wn=yn.span,Sn=e.struct([e.publicKey("authority"),e.publicKey("metadataAddress")]),An=Sn.span,Mn=e.struct([e.publicKey("closeAuthority")]),kn=Mn.span,yt=e.struct([]),Tn=yt.span,bn=yt.span,Pn=e.struct([e.publicKey("delegate")]),Bn=Pn.span,Cn=1e4;BigInt(Cn);function ot(n){return e.struct([e.u64("epoch"),e.u64("maximumFee"),e.u16("transferFeeBasisPoints")],n)}const vn=e.struct([e.publicKey("transferFeeConfigAuthority"),e.publicKey("withdrawWithheldAuthority"),e.u64("withheldAmount"),ot("olderTransferFee"),ot("newerTransferFee")]),In=vn.span,Rn=e.struct([e.u64("withheldAmount")]),En=Rn.span,Kn=e.struct([e.publicKey("authority"),e.publicKey("programId")]),Wn=Kn.span,Nn=e.struct([e.bool("transferring")]),_n=Nn.span,ct=e.struct([e.u8("discriminator"),e.blob(32,"addressConfig"),e.bool("isSigner"),e.bool("isWritable")]),Un=e.struct([e.u32("count"),e.seq(ct,e.greedy(ct.span),"extraAccounts")]);e.struct([e.u64("instructionDiscriminator"),e.u32("length"),Un.replicate("extraAccountsList")]);var k;(function(n){n[n.Uninitialized=0]="Uninitialized",n[n.TransferFeeConfig=1]="TransferFeeConfig",n[n.TransferFeeAmount=2]="TransferFeeAmount",n[n.MintCloseAuthority=3]="MintCloseAuthority",n[n.ConfidentialTransferMint=4]="ConfidentialTransferMint",n[n.ConfidentialTransferAccount=5]="ConfidentialTransferAccount",n[n.DefaultAccountState=6]="DefaultAccountState",n[n.ImmutableOwner=7]="ImmutableOwner",n[n.MemoTransfer=8]="MemoTransfer",n[n.NonTransferable=9]="NonTransferable",n[n.InterestBearingConfig=10]="InterestBearingConfig",n[n.CpiGuard=11]="CpiGuard",n[n.PermanentDelegate=12]="PermanentDelegate",n[n.NonTransferableAccount=13]="NonTransferableAccount",n[n.TransferHook=14]="TransferHook",n[n.TransferHookAccount=15]="TransferHookAccount",n[n.MetadataPointer=18]="MetadataPointer"})(k||(k={}));const ut=2,Fn=2;function xn(n){switch(n){case k.Uninitialized:return 0;case k.TransferFeeConfig:return In;case k.TransferFeeAmount:return En;case k.MintCloseAuthority:return kn;case k.ConfidentialTransferMint:return 97;case k.ConfidentialTransferAccount:return 286;case k.CpiGuard:return dn;case k.DefaultAccountState:return mn;case k.ImmutableOwner:return gn;case k.MemoTransfer:return wn;case k.MetadataPointer:return An;case k.NonTransferable:return Tn;case k.InterestBearingConfig:return pn;case k.PermanentDelegate:return Bn;case k.NonTransferableAccount:return bn;case k.TransferHook:return Wn;case k.TransferHookAccount:return _n;default:throw Error(`Unknown extension type: ${n}`)}}function On(n,t){if(n.length===0)return t;{const i=E+Oe+n.filter((r,s)=>s===n.indexOf(r)).map(r=>xn(r)+ut+Fn).reduce((r,s)=>r+s);return i===ze?i+ut:i}}function zn(n){return On(n,E)}const dt=e.struct([e.u8("instruction")]);function lt(n,t,i,r=A){const s=[{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:t,isSigner:!1,isWritable:!1},{pubkey:i,isSigner:!1,isWritable:!1},{pubkey:e.SYSVAR_RENT_PUBKEY,isSigner:!1,isWritable:!1}],a=e.dist.Buffer.alloc(dt.span);return dt.encode({instruction:H.InitializeAccount},a),new e.TransactionInstruction({keys:s,programId:r,data:a})}function wt(n,t,i,r,s=A,a=O){return St(n,t,i,r,e.dist.Buffer.alloc(0),s,a)}function Ln(n,t,i,r,s=A,a=O){return St(n,t,i,r,e.dist.Buffer.from([1]),s,a)}function St(n,t,i,r,s,a=A,c=O){const o=[{pubkey:n,isSigner:!0,isWritable:!0},{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:e.SystemProgram.programId,isSigner:!1,isWritable:!1},{pubkey:a,isSigner:!1,isWritable:!1}];return new e.TransactionInstruction({keys:o,programId:c,data:s})}const mt=e.struct([e.u8("instruction"),e.u64("amount")]);function At(n,t,i,r,s=[],a=A){const c=xe([{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:t,isSigner:!1,isWritable:!0}],i,s),o=e.dist.Buffer.alloc(mt.span);return mt.encode({instruction:H.Transfer,amount:BigInt(r)},o),new e.TransactionInstruction({keys:c,programId:a,data:o})}function pe(n,t){const i=e.dist.Buffer.alloc(2);return i.writeUInt16BE(e.toChainId(t)),w.deriveAddress([e.dist.Buffer.from("foreign_contract"),i],n)}function Mt(n){return w.deriveAddress([e.dist.Buffer.from("redeemer")],n)}function ye(n,t){return w.deriveAddress([e.dist.Buffer.from("mint"),new e.PublicKey(t).toBuffer()],n)}function Le(n){return w.deriveAddress([e.dist.Buffer.from("sender")],n)}function qe(n,t){return w.deriveAddress([e.dist.Buffer.from("tmp"),new e.PublicKey(t).toBuffer()],n)}function De(n,t,i){return w.deriveAddress([e.dist.Buffer.from("bridged"),new e.PublicKey(t).toBuffer(),e.dist.Buffer.from(e.bignum.toBytes(BigInt(i.toString()),8))],n)}function C(n){return w.deriveAddress([e.dist.Buffer.from("config")],n)}async function qn(n,t,i){return n.getAccountInfo(C(t),i).then(r=>we.deserialize(w.getAccountData(r)))}class we{constructor(t){l(this,"wormhole");this.wormhole=new e.PublicKey(t)}static deserialize(t){if(t.length!=32)throw new Error("data.length != 32");const i=t.subarray(0,32);return new we(i)}}function ae(n,t){return w.deriveAddress([new e.PublicKey(t).toBuffer()],n)}function z(n,t,i){const r=typeof i=="string"?new e.UniversalAddress(i).toUint8Array():i;return w.deriveAddress([(()=>{const s=e.dist.Buffer.alloc(2);return s.writeUInt16BE(t),s})(),r],n)}async function Dn(n,t,i){return n.getAccountInfo(new e.PublicKey(t),i).then(r=>Se.deserialize(w.getAccountData(r)))}class Se{constructor(t,i){l(this,"chain");l(this,"contract");this.chain=t,this.contract=i}static deserialize(t){if(t.length!=34)throw new Error("data.length != 34");const i=t.readUInt16LE(0),r=t.subarray(2,34);return new Se(i,r)}}function Ae(n){return w.deriveAddress([e.dist.Buffer.from("sender")],n)}function Me(n){return w.deriveAddress([e.dist.Buffer.from("redeemer")],n)}function q(n){return w.deriveAddress([e.dist.Buffer.from("authority_signer")],n)}function J(n){return w.deriveAddress([e.dist.Buffer.from("custody_signer")],n)}function j(n){return w.deriveAddress([e.dist.Buffer.from("mint_signer")],n)}function D(n,t,i){return w.deriveAddress([e.dist.Buffer.from("wrapped"),(()=>{const r=e.dist.Buffer.alloc(2);return r.writeUInt16BE(t),r})(),i],n)}function _(n,t){return w.deriveAddress([e.dist.Buffer.from("meta"),new e.PublicKey(t).toBuffer()],n)}async function ne(n,t,i,r){return n.getAccountInfo(_(t,i),r).then(s=>ke.deserialize(w.getAccountData(s)))}class ke{constructor(t,i,r,s){l(this,"chain");l(this,"tokenAddress");l(this,"originalDecimals");l(this,"lastUpdatedSequence");this.chain=t,this.tokenAddress=i,this.originalDecimals=r,this.lastUpdatedSequence=s}static deserialize(t){if(t.length!==35&&t.length!==43)throw new Error(`invalid wrapped meta length: ${t.length}`);const i=t.readUInt16LE(0),r=t.subarray(2,34),s=t.readUInt8(34),a=t.length===43?t.readBigUInt64LE(35):void 0;return new ke(i,r,s,a)}}function Ee(n,t,i,r){return tn(new e.PublicKey(t),q(n),new e.PublicKey(i),r)}class Vn{constructor(t){l(this,"idl");this.idl=t}async encode(t,i){switch(t){default:throw new Error(`Invalid account name: ${t}`)}}decode(t,i){return this.decodeUnchecked(t,i)}decodeUnchecked(t,i){switch(t){default:throw new Error(`Invalid account name: ${t}`)}}memcmp(t,i){switch(t){default:throw new Error(`Invalid account name: ${t}`)}}size(t){return y.accountSize(this.idl,t)??0}}class Yn{constructor(t){}decode(t){throw new Error("Token Bridge program does not have events")}}class Gn{constructor(t){}encode(t,i){switch(t){case"initialize":return Zn(i);case"attestToken":return Hn(i);case"completeNative":return Qn(i);case"completeWrapped":return $n(i);case"transferWrapped":return Xn(i);case"transferNative":return Jn(i);case"registerChain":return jn(i);case"createWrapped":return er(i);case"upgradeContract":return tr(i);case"transferWrappedWithPayload":return nr(i);case"transferNativeWithPayload":return rr(i);default:throw new Error(`Invalid instruction: ${t}`)}}encodeState(t,i){throw new Error("Token Bridge program does not have state")}}var v;(function(n){n[n.Initialize=0]="Initialize",n[n.AttestToken=1]="AttestToken",n[n.CompleteNative=2]="CompleteNative",n[n.CompleteWrapped=3]="CompleteWrapped",n[n.TransferWrapped=4]="TransferWrapped",n[n.TransferNative=5]="TransferNative",n[n.RegisterChain=6]="RegisterChain",n[n.CreateWrapped=7]="CreateWrapped",n[n.UpgradeContract=8]="UpgradeContract",n[n.CompleteNativeWithPayload=9]="CompleteNativeWithPayload",n[n.CompleteWrappedWithPayload=10]="CompleteWrappedWithPayload",n[n.TransferWrappedWithPayload=11]="TransferWrappedWithPayload",n[n.TransferNativeWithPayload=12]="TransferNativeWithPayload"})(v||(v={}));function W(n,t){const i=t===void 0?0:t.length,r=e.dist.Buffer.alloc(1+i);return r.writeUInt8(n,0),i>0&&r.write(t.toString("hex"),1,"hex"),r}function Zn({wormhole:n}){const t=e.dist.Buffer.alloc(32);return t.write(new e.PublicKey(n).toBuffer().toString("hex"),0,"hex"),W(v.Initialize,t)}function Hn({nonce:n}){const t=e.dist.Buffer.alloc(4);return t.writeUInt32LE(n,0),W(v.AttestToken,t)}function Qn({}){return W(v.CompleteNative)}function $n({}){return W(v.CompleteWrapped)}function kt({nonce:n,amount:t,fee:i,targetAddress:r,targetChain:s}){if(typeof t!="bigint"&&(t=BigInt(t)),typeof i!="bigint"&&(i=BigInt(i)),!e.dist.Buffer.isBuffer(r))throw new Error("targetAddress must be Buffer");const a=e.dist.Buffer.alloc(54);return a.writeUInt32LE(n,0),a.writeBigUInt64LE(t,4),a.writeBigUInt64LE(i,12),a.write(r.toString("hex"),20,"hex"),a.writeUInt16LE(s,52),a}function Xn({nonce:n,amount:t,fee:i,targetAddress:r,targetChain:s}){return W(v.TransferWrapped,kt({nonce:n,amount:t,fee:i,targetAddress:r,targetChain:s}))}function Jn({nonce:n,amount:t,fee:i,targetAddress:r,targetChain:s}){return W(v.TransferNative,kt({nonce:n,amount:t,fee:i,targetAddress:r,targetChain:s}))}function jn({}){return W(v.RegisterChain)}function er({}){return W(v.CreateWrapped)}function tr({}){return W(v.UpgradeContract)}function Tt({nonce:n,amount:t,targetAddress:i,targetChain:r,payload:s}){if(typeof t!="bigint"&&(t=BigInt(t)),!e.dist.Buffer.isBuffer(i))throw new Error("targetAddress must be Buffer");if(!e.dist.Buffer.isBuffer(s))throw new Error("payload must be Buffer");const a=e.dist.Buffer.alloc(50);return a.writeUInt32LE(n,0),a.writeBigUInt64LE(t,4),a.write(i.toString("hex"),12,"hex"),a.writeUInt16LE(r,44),a.writeUInt32LE(s.length,46),e.dist.Buffer.concat([a,s,e.dist.Buffer.alloc(1)])}function nr({nonce:n,amount:t,fee:i,targetAddress:r,targetChain:s,payload:a}){return W(v.TransferWrappedWithPayload,Tt({nonce:n,amount:t,targetAddress:r,targetChain:s,payload:a}))}function rr({nonce:n,amount:t,fee:i,targetAddress:r,targetChain:s,payload:a}){return W(v.TransferNativeWithPayload,Tt({nonce:n,amount:t,targetAddress:r,targetChain:s,payload:a}))}class ir{constructor(t){}encode(t,i){throw new Error("Token Bridge program does not have state")}decode(t){throw new Error("Token Bridge program does not have state")}}class sr{constructor(t){}encode(t,i){throw new Error("Token Bridge program does not have user-defined types")}decode(t,i){throw new Error("Token Bridge program does not have user-defined types")}}class ar{constructor(t){l(this,"instruction");l(this,"accounts");l(this,"state");l(this,"events");l(this,"types");this.instruction=new Gn(t),this.accounts=new Vn(t),this.state=new ir(t),this.events=new Yn(t),this.types=new sr(t)}}const Ve={version:"0.1.0",name:"wormhole",instructions:[{name:"initialize",accounts:[{name:"payer",isMut:!0,isSigner:!0},{name:"config",isMut:!0,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[{name:"wormhole",type:"publicKey"}]},{name:"attestToken",accounts:[{name:"payer",isMut:!0,isSigner:!0},{name:"config",isMut:!0,isSigner:!1},{name:"mint",isMut:!1,isSigner:!1},{name:"wrappedMeta",isMut:!1,isSigner:!1},{name:"splMetadata",isMut:!1,isSigner:!1},{name:"wormholeBridge",isMut:!0,isSigner:!1},{name:"wormholeMessage",isMut:!0,isSigner:!0},{name:"wormholeEmitter",isMut:!1,isSigner:!1},{name:"wormholeSequence",isMut:!0,isSigner:!1},{name:"wormholeFeeCollector",isMut:!0,isSigner:!1},{name:"clock",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"wormholeProgram",isMut:!1,isSigner:!1}],args:[{name:"nonce",type:"u32"}]},{name:"completeNative",accounts:[{name:"payer",isMut:!0,isSigner:!0},{name:"config",isMut:!1,isSigner:!1},{name:"vaa",isMut:!1,isSigner:!1},{name:"claim",isMut:!0,isSigner:!1},{name:"endpoint",isMut:!1,isSigner:!1},{name:"to",isMut:!0,isSigner:!1},{name:"toFees",isMut:!0,isSigner:!1},{name:"custody",isMut:!0,isSigner:!1},{name:"mint",isMut:!1,isSigner:!1},{name:"custodySigner",isMut:!1,isSigner:!1},{name:"rent",isMut:!0,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"wormholeProgram",isMut:!1,isSigner:!1}],args:[]},{name:"completeWrapped",accounts:[{name:"payer",isMut:!0,isSigner:!0},{name:"config",isMut:!1,isSigner:!1},{name:"vaa",isMut:!1,isSigner:!1},{name:"claim",isMut:!0,isSigner:!1},{name:"endpoint",isMut:!1,isSigner:!1},{name:"to",isMut:!0,isSigner:!1},{name:"toFees",isMut:!0,isSigner:!1},{name:"mint",isMut:!0,isSigner:!1},{name:"wrappedMeta",isMut:!1,isSigner:!1},{name:"mintAuthority",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"wormholeProgram",isMut:!1,isSigner:!1}],args:[]},{name:"transferWrapped",accounts:[{name:"payer",isMut:!0,isSigner:!0},{name:"config",isMut:!1,isSigner:!1},{name:"from",isMut:!0,isSigner:!1},{name:"fromOwner",isMut:!0,isSigner:!0},{name:"mint",isMut:!0,isSigner:!1},{name:"wrappedMeta",isMut:!1,isSigner:!1},{name:"authoritySigner",isMut:!1,isSigner:!1},{name:"wormholeBridge",isMut:!0,isSigner:!1},{name:"wormholeMessage",isMut:!0,isSigner:!0},{name:"wormholeEmitter",isMut:!1,isSigner:!1},{name:"wormholeSequence",isMut:!0,isSigner:!1},{name:"wormholeFeeCollector",isMut:!0,isSigner:!1},{name:"clock",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"wormholeProgram",isMut:!1,isSigner:!1}],args:[{name:"nonce",type:"u32"},{name:"amount",type:"u64"},{name:"fee",type:"u64"},{name:"targetAddress",type:{array:["u8",32]}},{name:"targetChain",type:"u16"}]},{name:"transferNative",accounts:[{name:"payer",isMut:!0,isSigner:!0},{name:"config",isMut:!1,isSigner:!1},{name:"from",isMut:!0,isSigner:!1},{name:"mint",isMut:!0,isSigner:!1},{name:"custody",isMut:!0,isSigner:!1},{name:"authoritySigner",isMut:!1,isSigner:!1},{name:"custodySigner",isMut:!1,isSigner:!1},{name:"wormholeBridge",isMut:!0,isSigner:!1},{name:"wormholeMessage",isMut:!0,isSigner:!0},{name:"wormholeEmitter",isMut:!1,isSigner:!1},{name:"wormholeSequence",isMut:!0,isSigner:!1},{name:"wormholeFeeCollector",isMut:!0,isSigner:!1},{name:"clock",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"wormholeProgram",isMut:!1,isSigner:!1}],args:[{name:"nonce",type:"u32"},{name:"amount",type:"u64"},{name:"fee",type:"u64"},{name:"targetAddress",type:{array:["u8",32]}},{name:"targetChain",type:"u16"}]},{name:"registerChain",accounts:[{name:"payer",isMut:!0,isSigner:!0},{name:"config",isMut:!1,isSigner:!1},{name:"endpoint",isMut:!0,isSigner:!1},{name:"vaa",isMut:!1,isSigner:!1},{name:"claim",isMut:!0,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"wormholeProgram",isMut:!1,isSigner:!1}],args:[]},{name:"createWrapped",accounts:[{name:"payer",isMut:!0,isSigner:!0},{name:"config",isMut:!1,isSigner:!1},{name:"endpoint",isMut:!1,isSigner:!1},{name:"vaa",isMut:!1,isSigner:!1},{name:"claim",isMut:!0,isSigner:!1},{name:"mint",isMut:!0,isSigner:!1},{name:"wrappedMeta",isMut:!0,isSigner:!1},{name:"splMetadata",isMut:!0,isSigner:!1},{name:"mintAuthority",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"splMetadataProgram",isMut:!1,isSigner:!1},{name:"wormholeProgram",isMut:!1,isSigner:!1}],args:[]},{name:"upgradeContract",accounts:[{name:"payer",isMut:!0,isSigner:!0},{name:"vaa",isMut:!1,isSigner:!1},{name:"claim",isMut:!0,isSigner:!1},{name:"upgradeAuthority",isMut:!1,isSigner:!1},{name:"spill",isMut:!0,isSigner:!1},{name:"implementation",isMut:!0,isSigner:!1},{name:"programData",isMut:!0,isSigner:!1},{name:"tokenBridgeProgram",isMut:!0,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1},{name:"clock",isMut:!1,isSigner:!1},{name:"bpfLoaderUpgradeable",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[]},{name:"transferWrappedWithPayload",accounts:[{name:"payer",isMut:!0,isSigner:!0},{name:"config",isMut:!1,isSigner:!1},{name:"from",isMut:!0,isSigner:!1},{name:"fromOwner",isMut:!0,isSigner:!0},{name:"mint",isMut:!0,isSigner:!1},{name:"wrappedMeta",isMut:!1,isSigner:!1},{name:"authoritySigner",isMut:!1,isSigner:!1},{name:"wormholeBridge",isMut:!0,isSigner:!1},{name:"wormholeMessage",isMut:!0,isSigner:!0},{name:"wormholeEmitter",isMut:!1,isSigner:!1},{name:"wormholeSequence",isMut:!0,isSigner:!1},{name:"wormholeFeeCollector",isMut:!0,isSigner:!1},{name:"clock",isMut:!1,isSigner:!1},{name:"sender",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"wormholeProgram",isMut:!1,isSigner:!1}],args:[{name:"nonce",type:"u32"},{name:"amount",type:"u64"},{name:"targetAddress",type:{array:["u8",32]}},{name:"targetChain",type:"u16"},{name:"payload",type:"bytes"},{name:"cpiProgramId",type:{option:"publicKey"}}]},{name:"transferNativeWithPayload",accounts:[{name:"payer",isMut:!0,isSigner:!0},{name:"config",isMut:!1,isSigner:!1},{name:"from",isMut:!0,isSigner:!1},{name:"mint",isMut:!0,isSigner:!1},{name:"custody",isMut:!0,isSigner:!1},{name:"authoritySigner",isMut:!1,isSigner:!1},{name:"custodySigner",isMut:!1,isSigner:!1},{name:"wormholeBridge",isMut:!0,isSigner:!1},{name:"wormholeMessage",isMut:!0,isSigner:!0},{name:"wormholeEmitter",isMut:!1,isSigner:!1},{name:"wormholeSequence",isMut:!0,isSigner:!1},{name:"wormholeFeeCollector",isMut:!0,isSigner:!1},{name:"clock",isMut:!1,isSigner:!1},{name:"sender",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"wormholeProgram",isMut:!1,isSigner:!1}],args:[{name:"nonce",type:"u32"},{name:"amount",type:"u64"},{name:"targetAddress",type:{array:["u8",32]}},{name:"targetChain",type:"u16"},{name:"payload",type:"bytes"},{name:"cpiProgramId",type:{option:"publicKey"}}]}],accounts:[]};function bt(n,t){return new ie.Program(Ve,new e.PublicKey(n),t===void 0?{connection:null}:t,Pt())}function I(n,t){return bt(n,ie.createReadOnlyProvider(t))}function Pt(){return new ar(Ve)}const re=class re{constructor(t,i,r){l(this,"address");l(this,"verified");l(this,"share");this.address=new e.PublicKey(t),this.verified=i,this.share=r}serialize(){const t=e.dist.Buffer.alloc(re.size);return t.write(this.address.toBuffer().toString("hex"),0,"hex"),this.verified&&t.writeUInt8(1,32),t.writeUInt8(this.share,33),t}static deserialize(t){const i=t.subarray(0,32),r=t.readUInt8(32)>0,s=t.readUInt8(33);return new re(i,r,s)}};l(re,"size",34);let x=re;class oe{constructor(t,i,r,s,a){l(this,"name");l(this,"symbol");l(this,"uri");l(this,"sellerFeeBasisPoints");l(this,"creators");this.name=t,this.symbol=i,this.uri=r,this.sellerFeeBasisPoints=s,this.creators=a}serialize(){const t=this.name.length,i=this.symbol.length,r=this.uri.length,s=this.creators,[a,c]=(()=>{if(s===null)return[0,0];const d=s.length;return[d,4+d*x.size]})(),o=e.dist.Buffer.alloc(15+t+i+r+c);if(o.writeUInt32LE(t,0),o.write(this.name,4),o.writeUInt32LE(i,4+t),o.write(this.symbol,8+t),o.writeUInt32LE(r,8+t+i),o.write(this.uri,12+t+i),o.writeUInt16LE(this.sellerFeeBasisPoints,12+t+i+r),s===null)o.writeUInt8(0,14+t+i+r);else{o.writeUInt8(1,14+t+i+r),o.writeUInt32LE(a,15+t+i+r);for(let d=0;d<a;++d){const u=s.at(d),m=19+t+i+r+d*x.size;o.write(u.serialize().toString("hex"),m,"hex")}}return o}static deserialize(t){const i=t.readUInt32LE(0),r=t.subarray(4,4+i).toString(),s=t.readUInt32LE(4+i),a=t.subarray(8+i,8+i+s).toString(),c=t.readUInt32LE(8+i+s),o=t.subarray(12+i+s,12+i+s+c).toString(),d=t.readUInt16LE(12+i+s+c),u=t.readUInt8(14+i+s+c),m=(()=>{if(u==0)return null;const f=[],g=t.readUInt32LE(15+i+s+c);for(let p=0;p<g;++p){const h=19+i+s+c+p*x.size;f.push(x.deserialize(t.subarray(h,h+x.size)))}return f})();return new oe(r,a,o,d,m)}}class se extends oe{constructor(i,r,s,a,c,o){super(i,r,s,a,c);l(this,"isMutable");this.isMutable=o}static serialize(i,r,s,a,c,o){return new se(i,r,s,a,c,o).serialize()}static serializeInstructionData(i,r,s,a,c,o){return e.dist.Buffer.concat([e.dist.Buffer.alloc(1,0),se.serialize(i,r,s,a,c,o)])}serialize(){return e.dist.Buffer.concat([super.serialize(),e.dist.Buffer.alloc(1,this.isMutable?1:0)])}}const he=class he{constructor(){}static createMetadataAccounts(t,i,r,s,a,c,o=!1,d,u,m,f=!1,g=ce(i)){const p=[w.newAccountMeta(g,!1),w.newReadOnlyAccountMeta(i,!1),w.newReadOnlyAccountMeta(r,!0),w.newReadOnlyAccountMeta(t,!0),w.newReadOnlyAccountMeta(c,o),w.newReadOnlyAccountMeta(e.SystemProgram.programId,!1),w.newReadOnlyAccountMeta(e.SYSVAR_RENT_PUBKEY,!1)],h=se.serializeInstructionData(s,a,d===void 0?"":d,m===void 0?0:m,u===void 0?null:u,f);return{programId:he.programId,keys:p,data:h}}};l(he,"programId",new e.PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"));let Q=he;function ce(n){return w.deriveAddress([e.dist.Buffer.from("metadata"),Q.programId.toBuffer(),new e.PublicKey(n).toBuffer()],Q.programId)}exports.Key=void 0;(function(n){n[n.Uninitialized=0]="Uninitialized",n[n.EditionV1=1]="EditionV1",n[n.MasterEditionV1=2]="MasterEditionV1",n[n.ReservationListV1=3]="ReservationListV1",n[n.MetadataV1=4]="MetadataV1",n[n.ReservationListV2=5]="ReservationListV2",n[n.MasterEditionV2=6]="MasterEditionV2",n[n.EditionMarker=7]="EditionMarker"})(exports.Key||(exports.Key={}));class Te{constructor(t,i,r,s,a,c){l(this,"key");l(this,"updateAuthority");l(this,"mint");l(this,"data");l(this,"primarySaleHappened");l(this,"isMutable");this.key=t,this.updateAuthority=new e.PublicKey(i),this.mint=new e.PublicKey(r),this.data=s,this.primarySaleHappened=a,this.isMutable=c}static deserialize(t){const i=t.readUInt8(0),r=t.subarray(1,33),s=t.subarray(33,65),a=oe.deserialize(t.subarray(65)),c=a.serialize().length,o=t.readUInt8(65+c)>0,d=t.readUInt8(66+c)>0;return new Te(i,r,s,a,o,d)}}async function or(n,t,i){return n.getAccountInfo(ce(t),i).then(r=>Te.deserialize(w.getAccountData(r)))}function Bt(n,t,i,r,s,a,c){const o=I(t,n).methods.attestToken(c);return console.log(Ke(t,i,r,s,a)),o._ixFn(...o._args,{accounts:Ke(t,i,r,s,a),signers:void 0,remainingAccounts:void 0,preInstructions:void 0,postInstructions:void 0})}function Ke(n,t,i,r,s){const{bridge:a,emitter:c,sequence:o,feeCollector:d,clock:u,rent:m,systemProgram:f}=y.getPostMessageAccounts(t,i,s,n);return{payer:new e.PublicKey(i),config:C(n),mint:new e.PublicKey(r),wrappedMeta:_(n,r),splMetadata:ce(r),wormholeBridge:a,wormholeMessage:new e.PublicKey(s),wormholeEmitter:c,wormholeSequence:o,wormholeFeeCollector:d,clock:u,rent:m,systemProgram:f,wormholeProgram:new e.PublicKey(t)}}function We(n,t,i,r,s,a){const c=I(t,n).methods.completeNative();return c._ixFn(...c._args,{accounts:Ct(t,i,r,s,a),signers:void 0,remainingAccounts:void 0,preInstructions:void 0,postInstructions:void 0})}function Ct(n,t,i,r,s){const a=new e.PublicKey(r.payload.token.address.toUint8Array());return{payer:new e.PublicKey(i),config:C(n),vaa:y.derivePostedVaaKey(t,e.dist.Buffer.from(r.hash)),claim:y.deriveClaimKey(n,r.emitterAddress.toUint8Array(),e.toChainId(r.emitterChain),r.sequence),endpoint:z(n,e.toChainId(r.emitterChain),r.emitterAddress.toUint8Array()),to:new e.PublicKey(r.payload.to.address.toUint8Array()),toFees:new e.PublicKey(s===void 0?r.payload.to.address.toUint8Array():s),custody:ae(n,a),mint:a,custodySigner:J(n),rent:e.SYSVAR_RENT_PUBKEY,systemProgram:e.SystemProgram.programId,tokenProgram:A,wormholeProgram:new e.PublicKey(t)}}function vt(n,t,i,r,s,a){const c=I(t,n).methods.completeWrapped();return c._ixFn(...c._args,{accounts:It(t,i,r,s,a),signers:void 0,remainingAccounts:void 0,preInstructions:void 0,postInstructions:void 0})}function It(n,t,i,r,s){const a=D(n,e.toChainId(r.payload.token.chain),r.payload.token.address.toUint8Array());return{payer:new e.PublicKey(i),config:C(n),vaa:y.derivePostedVaaKey(t,e.dist.Buffer.from(r.hash)),claim:y.deriveClaimKey(n,r.emitterAddress.toUint8Array(),e.toChainId(r.emitterChain),r.sequence),endpoint:z(n,e.toChainId(r.emitterChain),r.emitterAddress.toUint8Array()),to:new e.PublicKey(r.payload.to.address.toUint8Array()),toFees:new e.PublicKey(s===void 0?r.payload.to.address.toUint8Array():s),mint:a,wrappedMeta:_(n,a),mintAuthority:j(n),rent:e.SYSVAR_RENT_PUBKEY,systemProgram:e.SystemProgram.programId,tokenProgram:A,wormholeProgram:new e.PublicKey(t)}}function Rt(n,t,i,r,s){const a=I(t,n).methods.createWrapped();return a._ixFn(...a._args,{accounts:Et(t,i,r,s),signers:void 0,remainingAccounts:void 0,preInstructions:void 0,postInstructions:void 0})}function Et(n,t,i,r){const s=D(n,e.toChainId(r.payload.token.chain),r.payload.token.address.toUint8Array());return{payer:new e.PublicKey(i),config:C(n),endpoint:z(n,e.toChainId(r.emitterChain),r.emitterAddress.toUint8Array()),vaa:y.derivePostedVaaKey(t,e.dist.Buffer.from(r.hash)),claim:y.deriveClaimKey(n,r.emitterAddress.toUint8Array(),e.toChainId(r.emitterChain),r.sequence),mint:s,wrappedMeta:_(n,s),splMetadata:ce(s),mintAuthority:j(n),rent:e.SYSVAR_RENT_PUBKEY,systemProgram:e.SystemProgram.programId,tokenProgram:A,splMetadataProgram:Q.programId,wormholeProgram:new e.PublicKey(t)}}function cr(n,t,i){const r=I(n).methods.initialize(i);return r._ixFn(...r._args,{accounts:Kt(n,t),signers:void 0,remainingAccounts:void 0,preInstructions:void 0,postInstructions:void 0})}function Kt(n,t){return{payer:new e.PublicKey(t),config:C(n),rent:e.SYSVAR_RENT_PUBKEY,systemProgram:e.SystemProgram.programId}}function ur(n,t,i,r){const s=I(n).methods.registerChain();return s._ixFn(...s._args,{accounts:Wt(n,t,i,r),signers:void 0,remainingAccounts:void 0,preInstructions:void 0,postInstructions:void 0})}function Wt(n,t,i,r){return{payer:new e.PublicKey(i),config:C(n),endpoint:z(n,e.toChainId(r.payload.actionArgs.foreignChain),r.payload.actionArgs.foreignAddress.toUint8Array()),vaa:y.derivePostedVaaKey(t,e.dist.Buffer.from(r.hash)),claim:y.deriveClaimKey(n,r.emitterAddress.toUint8Array(),e.toChainId(r.emitterChain),r.sequence),rent:e.SYSVAR_RENT_PUBKEY,systemProgram:e.SystemProgram.programId,wormholeProgram:new e.PublicKey(t)}}function dr(n,t,i,r,s){const a=I(n).methods.upgradeContract();return a._ixFn(...a._args,{accounts:Nt(n,t,i,r,s),signers:void 0,remainingAccounts:void 0,preInstructions:void 0,postInstructions:void 0})}function Nt(n,t,i,r,s){return{payer:new e.PublicKey(i),vaa:y.derivePostedVaaKey(t,e.dist.Buffer.from(r.hash)),claim:y.deriveClaimKey(n,r.emitterAddress.toUint8Array(),e.toChainId(r.emitterChain),r.sequence),upgradeAuthority:y.deriveUpgradeAuthorityKey(n),spill:new e.PublicKey(s===void 0?i:s),implementation:new e.PublicKey(r.payload.actionArgs.newContract),programData:y.deriveProgramDataAddress(n),tokenBridgeProgram:new e.PublicKey(n),rent:e.SYSVAR_RENT_PUBKEY,clock:e.SYSVAR_CLOCK_PUBKEY,bpfLoaderUpgradeable:y.BPF_LOADER_UPGRADEABLE_PROGRAM_ID,systemProgram:e.SystemProgram.programId}}function Ne(n,t,i,r,s,a,c,o,d,u,m,f){const g=I(t,n).methods.transferNative(o,d,u,e.dist.Buffer.from(m),f);return g._ixFn(...g._args,{accounts:_t(t,i,r,s,a,c),signers:void 0,remainingAccounts:void 0,preInstructions:void 0,postInstructions:void 0})}function _t(n,t,i,r,s,a){const{wormholeBridge:c,wormholeMessage:o,wormholeEmitter:d,wormholeSequence:u,wormholeFeeCollector:m,clock:f,rent:g,systemProgram:p}=y.getPostMessageCpiAccounts(n,t,i,r);return{payer:new e.PublicKey(i),config:C(n),from:new e.PublicKey(s),mint:new e.PublicKey(a),custody:ae(n,a),authoritySigner:q(n),custodySigner:J(n),wormholeBridge:c,wormholeMessage:o,wormholeEmitter:d,wormholeSequence:u,wormholeFeeCollector:m,clock:f,rent:g,systemProgram:p,tokenProgram:A,wormholeProgram:new e.PublicKey(t)}}function _e(n,t,i,r,s,a,c,o,d,u,m,f){const g=I(t,n).methods.transferNativeWithPayload(o,d,e.dist.Buffer.from(u),m,e.dist.Buffer.from(f),null);return g._ixFn(...g._args,{accounts:Ye(t,i,r,s,a,c),signers:void 0,remainingAccounts:void 0,preInstructions:void 0,postInstructions:void 0})}function Ye(n,t,i,r,s,a,c){const{wormholeBridge:o,wormholeMessage:d,wormholeEmitter:u,wormholeSequence:m,wormholeFeeCollector:f,clock:g,rent:p,systemProgram:h}=y.getPostMessageCpiAccounts(n,t,i,r);return{payer:new e.PublicKey(i),config:C(n),from:new e.PublicKey(s),mint:new e.PublicKey(a),custody:ae(n,a),authoritySigner:q(n),custodySigner:J(n),wormholeBridge:o,wormholeMessage:d,wormholeEmitter:u,wormholeSequence:m,wormholeFeeCollector:f,clock:g,sender:new e.PublicKey(c===void 0?i:Ae(c)),rent:p,systemProgram:h,tokenProgram:A,wormholeProgram:new e.PublicKey(t)}}function Ut(n,t,i,r,s,a,c,o,d,u,m,f,g,p){const h=I(t,n).methods.transferWrapped(u,m,f,e.dist.Buffer.from(g),p);return h._ixFn(...h._args,{accounts:Ft(t,i,r,s,a,c,o,d),signers:void 0,remainingAccounts:void 0,preInstructions:void 0,postInstructions:void 0})}function Ft(n,t,i,r,s,a,c,o){const d=D(n,c,o),{wormholeBridge:u,wormholeMessage:m,wormholeEmitter:f,wormholeSequence:g,wormholeFeeCollector:p,clock:h,rent:M,systemProgram:T}=y.getPostMessageCpiAccounts(n,t,i,r);return{payer:new e.PublicKey(i),config:C(n),from:new e.PublicKey(s),fromOwner:new e.PublicKey(a),mint:d,wrappedMeta:_(n,d),authoritySigner:q(n),wormholeBridge:u,wormholeMessage:m,wormholeEmitter:f,wormholeSequence:g,wormholeFeeCollector:p,clock:h,rent:M,systemProgram:T,wormholeProgram:new e.PublicKey(t),tokenProgram:A}}function xt(n,t,i,r,s,a,c,o,d,u,m,f,g,p){const h=I(t,n).methods.transferWrappedWithPayload(u,m,e.dist.Buffer.from(f),g,e.dist.Buffer.from(p),null);return h._ixFn(...h._args,{accounts:Ge(t,i,r,s,a,c,o,d),signers:void 0,remainingAccounts:void 0,preInstructions:void 0,postInstructions:void 0})}function Ge(n,t,i,r,s,a,c,o,d){const u=D(n,c,o),{wormholeBridge:m,wormholeMessage:f,wormholeEmitter:g,wormholeSequence:p,wormholeFeeCollector:h,clock:M,rent:T,systemProgram:B}=y.getPostMessageCpiAccounts(n,t,i,r);return{payer:new e.PublicKey(i),config:C(n),from:new e.PublicKey(s),fromOwner:new e.PublicKey(a),mint:u,wrappedMeta:_(n,u),authoritySigner:q(n),wormholeBridge:m,wormholeMessage:f,wormholeEmitter:g,wormholeSequence:p,wormholeFeeCollector:h,clock:M,sender:new e.PublicKey(d===void 0?i:Ae(d)),rent:T,systemProgram:B,wormholeProgram:new e.PublicKey(t),tokenProgram:A}}function lr(n,t,i){const{wormholeEmitter:r,wormholeBridge:s,wormholeFeeCollector:a,wormholeSequence:c}=y.getWormholeDerivedAccounts(t,i);return{tokenBridgeConfig:C(t),tokenBridgeAuthoritySigner:q(t),tokenBridgeCustodySigner:J(t),tokenBridgeMintAuthority:j(t),tokenBridgeSender:Ae(n),tokenBridgeRedeemer:Me(n),wormholeBridge:s,tokenBridgeEmitter:r,wormholeFeeCollector:a,tokenBridgeSequence:c}}function Ot(n,t,i,r,s,a,c){const o=Ye(t,i,r,s,a,c,n);return{payer:o.payer,tokenBridgeConfig:o.config,fromTokenAccount:o.from,mint:o.mint,tokenBridgeCustody:o.custody,tokenBridgeAuthoritySigner:o.authoritySigner,tokenBridgeCustodySigner:o.custodySigner,wormholeBridge:o.wormholeBridge,wormholeMessage:o.wormholeMessage,tokenBridgeEmitter:o.wormholeEmitter,tokenBridgeSequence:o.wormholeSequence,wormholeFeeCollector:o.wormholeFeeCollector,clock:o.clock,tokenBridgeSender:o.sender,rent:o.rent,systemProgram:o.systemProgram,tokenProgram:o.tokenProgram,wormholeProgram:o.wormholeProgram}}function zt(n,t,i,r,s,a,c,o,d){const u=Ge(t,i,r,s,a,d===void 0?n:d,c,o,n);return{payer:u.payer,tokenBridgeConfig:u.config,fromTokenAccount:u.from,fromTokenAccountOwner:u.fromOwner,tokenBridgeWrappedMint:u.mint,tokenBridgeWrappedMeta:u.wrappedMeta,tokenBridgeAuthoritySigner:u.authoritySigner,wormholeBridge:u.wormholeBridge,wormholeMessage:u.wormholeMessage,tokenBridgeEmitter:u.wormholeEmitter,tokenBridgeSequence:u.wormholeSequence,wormholeFeeCollector:u.wormholeFeeCollector,clock:u.clock,tokenBridgeSender:u.sender,rent:u.rent,systemProgram:u.systemProgram,tokenProgram:u.tokenProgram,wormholeProgram:u.wormholeProgram}}function mr(n,t,i,r,s){const a=new e.PublicKey(r.payload.token.address.toUint8Array()),c=new e.PublicKey(r.payload.to.address.toUint8Array());return{payer:new e.PublicKey(i),tokenBridgeConfig:C(n),vaa:y.derivePostedVaaKey(t,e.dist.Buffer.from(r.hash)),tokenBridgeClaim:y.deriveClaimKey(n,r.emitterAddress.toUint8Array(),e.toChainId(r.emitterChain),r.sequence),tokenBridgeForeignEndpoint:z(n,e.toChainId(r.emitterChain),r.emitterAddress.toUint8Array()),toTokenAccount:new e.PublicKey(s),tokenBridgeRedeemer:Me(c),toFeesTokenAccount:new e.PublicKey(s),tokenBridgeCustody:ae(n,a),mint:a,tokenBridgeCustodySigner:J(n),rent:e.SYSVAR_RENT_PUBKEY,systemProgram:e.SystemProgram.programId,tokenProgram:A,wormholeProgram:new e.PublicKey(t)}}function fr(n,t,i,r,s){const a=D(n,e.toChainId(r.payload.token.chain),r.payload.token.address.toUint8Array()),c=new e.PublicKey(r.payload.to.address.toUint8Array());return{payer:new e.PublicKey(i),tokenBridgeConfig:C(n),vaa:y.derivePostedVaaKey(t,e.dist.Buffer.from(r.hash)),tokenBridgeClaim:y.deriveClaimKey(n,r.emitterAddress.toUint8Array(),e.toChainId(r.emitterChain),r.sequence),tokenBridgeForeignEndpoint:z(n,e.toChainId(r.emitterChain),r.emitterAddress.toUint8Array()),toTokenAccount:new e.PublicKey(s),tokenBridgeRedeemer:Me(c),toFeesTokenAccount:new e.PublicKey(s),tokenBridgeWrappedMint:a,tokenBridgeWrappedMeta:_(n,a),tokenBridgeMintAuthority:j(n),rent:e.SYSVAR_RENT_PUBKEY,systemProgram:e.SystemProgram.programId,tokenProgram:A,wormholeProgram:new e.PublicKey(t)}}const Lt={version:"0.1.0",name:"token_bridge_relayer",constants:[{name:"SEED_PREFIX_BRIDGED",type:"bytes",value:"[98, 114, 105, 100, 103, 101, 100]"},{name:"SEED_PREFIX_TMP",type:"bytes",value:"[116, 109, 112]"},{name:"SWAP_RATE_PRECISION",type:"u32",value:"100_000_000"}],instructions:[{name:"initialize",docs:["This instruction is be used to generate your program's config.","And for convenience, we will store Wormhole-related PDAs in the","config so we can verify these accounts with a simple == constraint.","# Arguments","","* `ctx` - `Initialize` context","* `fee_recipient` - Recipient of all relayer fees and swap proceeds","* `assistant` - Privileged key to manage certain accounts"],accounts:[{name:"owner",isMut:!0,isSigner:!0,docs:["Deployer of the program."]},{name:"senderConfig",isMut:!0,isSigner:!1,docs:["Sender Config account, which saves program data useful for other","instructions, specifically for outbound transfers. Also saves the payer","of the [`initialize`](crate::initialize) instruction as the program's","owner."]},{name:"redeemerConfig",isMut:!0,isSigner:!1,docs:["Redeemer Config account, which saves program data useful for other","instructions, specifically for inbound transfers. Also saves the payer","of the [`initialize`](crate::initialize) instruction as the program's","owner."]},{name:"ownerConfig",isMut:!0,isSigner:!1,docs:["Owner config account, which saves the owner, assistant and","pending owner keys. This account is used to manage the ownership of the","program."]},{name:"tokenBridgeEmitter",isMut:!1,isSigner:!1,docs:["that holds data; it is purely just a signer for posting Wormhole","messages on behalf of the Token Bridge program."]},{name:"tokenBridgeSequence",isMut:!1,isSigner:!1,docs:["Token Bridge emitter's sequence account. Like with all Wormhole","emitters, this account keeps track of the sequence number of the last","posted message."]},{name:"systemProgram",isMut:!1,isSigner:!1,docs:["System program."]},{name:"programData",isMut:!0,isSigner:!1,docs:["upgrade authority. We check this PDA address just in case there is another program that this","deployer has deployed.","","NOTE: Set upgrade authority is scary because any public key can be used to set as the","authority."]},{name:"bpfLoaderUpgradeableProgram",isMut:!1,isSigner:!1}],args:[{name:"feeRecipient",type:"publicKey"},{name:"assistant",type:"publicKey"}]},{name:"registerForeignContract",docs:["This instruction registers a new foreign contract (from another","network) and saves the emitter information in a ForeignEmitter account.","This instruction is owner-only, meaning that only the owner of the","program (defined in the [Config] account) can add and update foreign","contracts.","","# Arguments","","* `ctx` - `RegisterForeignContract` context","* `chain` - Wormhole Chain ID","* `address` - Wormhole Emitter Address","* `relayer_fee` - Relayer fee scaled by the `relayer_fee_precision`"],accounts:[{name:"owner",isMut:!0,isSigner:!0,docs:["Owner of the program set in the [`SenderConfig`] account. Signer for","creating [`ForeignContract`] account."]},{name:"config",isMut:!1,isSigner:!1,docs:["Sender Config account. This program requires that the `owner` specified","in the context equals the pubkey specified in this account. Read-only."]},{name:"foreignContract",isMut:!0,isSigner:!1,docs:["Foreign Contract account. Create this account if an emitter has not been","registered yet for this Wormhole chain ID. If there already is a","contract address saved in this account, overwrite it."]},{name:"tokenBridgeForeignEndpoint",isMut:!1,isSigner:!1,docs:["Token Bridge foreign endpoint. This account should really be one","endpoint per chain, but Token Bridge's PDA allows for multiple","endpoints for each chain. We store the proper endpoint for the","emitter chain."]},{name:"tokenBridgeProgram",isMut:!1,isSigner:!1,docs:["Token Bridge program."]},{name:"systemProgram",isMut:!1,isSigner:!1,docs:["System program."]}],args:[{name:"chain",type:"u16"},{name:"address",type:{array:["u8",32]}},{name:"relayerFee",type:"u64"}]},{name:"registerToken",docs:["This instruction registers a new token and saves the initial `swap_rate`","and `max_native_token_amount` in a RegisteredToken account.","This instruction is owner-only, meaning that only the owner of the","program (defined in the [Config] account) can register a token.","","# Arguments","","* `ctx` - `RegisterToken` context","* `swap_rate`:","- USD conversion rate scaled by the `swap_rate_precision`. For example,","- if the conversion rate is $15 and the `swap_rate_precision` is","- 1000000, the `swap_rate` should be set to 15000000.","* `max_native_swap_amount`:","- Maximum amount of native tokens that can be swapped for this token","- on this chain."],accounts:[{name:"owner",isMut:!0,isSigner:!0,docs:["Owner of the program set in the [`SenderConfig`] account. Signer for","creating [`ForeignContract`] account."]},{name:"config",isMut:!1,isSigner:!1,docs:["Sender Config account. This program requires that the `owner` specified","in the context equals the pubkey specified in this account. Read-only."]},{name:"registeredToken",isMut:!0,isSigner:!1,docs:["Registered Token account. This account stores information about the","token, including the swap rate and max native swap amount. Create this","account if the mint has not been registered yet. Mutable."]},{name:"mint",isMut:!1,isSigner:!1,docs:["Mint info. This is the SPL token that will be bridged over to the","foreign contract."]},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1,docs:["System program."]}],args:[{name:"swapRate",type:"u64"},{name:"maxNativeSwapAmount",type:"u64"}]},{name:"deregisterToken",docs:["This instruction deregisters a token by closing the existing","`RegisteredToken` account for a particular mint. This instruction is","owner-only, meaning that only the owner of the program (defined in the","[Config] account) can deregister a token."],accounts:[{name:"owner",isMut:!1,isSigner:!0,docs:["Owner of the program set in the [`SenderConfig`] account. Signer for","closing [`RegisteredToken`] account."]},{name:"config",isMut:!1,isSigner:!1,docs:["Sender Config account. This program requires that the `owner` specified","in the context equals the pubkey specified in this account. Read-only."]},{name:"mint",isMut:!1,isSigner:!1,docs:["Mint info. This is the SPL token that will be bridged over to the","foreign contract."]},{name:"registeredToken",isMut:!0,isSigner:!1,docs:["Registered Token account. This account stores information about the","token, including the swap rate and max native swap amount. This account","also determines if a mint is registered or not."]}],args:[]},{name:"updateRelayerFee",docs:["This instruction updates the `relayer_fee` in the `ForeignContract` account.","The `relayer_fee` is scaled by the `relayer_fee_precision`. For example,","if the `relayer_fee` is $15 and the `relayer_fee_precision` is 1000000,","the `relayer_fee` should be set to 15000000. This instruction can","only be called by the owner or assistant, which are defined in the","[OwnerConfig] account.","","# Arguments","","* `ctx` - `UpdateRelayerFee` context","* `chain` - Wormhole Chain ID","* `fee` - Relayer fee scaled by the `relayer_fee_precision`"],accounts:[{name:"payer",isMut:!0,isSigner:!0,docs:["Signer of the transaction. Must be the owner or assistant."]},{name:"ownerConfig",isMut:!1,isSigner:!1,docs:["The owner_config is used when updating the swap rate","so that the assistant key can be used in addition to the","owner key."]},{name:"foreignContract",isMut:!0,isSigner:!1,docs:["This account holds the USD denominated relayer fee for the specified","`chain`. This account is used to determine the cost of relaying","a transfer to a target chain. If there already is a relayer fee","saved in this account, overwrite it."]},{name:"systemProgram",isMut:!1,isSigner:!1,docs:["System program."]}],args:[{name:"chain",type:"u16"},{name:"fee",type:"u64"}]},{name:"updateRelayerFeePrecision",docs:["This instruction updates the `relayer_fee_precision` in the","`SenderConfig` and `RedeemerConfig` accounts. The `relayer_fee_precision`","is used to scale the `relayer_fee`. This instruction is owner-only,","meaning that only the owner of the program (defined in the [Config]","account) can register a token.","","# Arguments","","* `ctx` - `UpdatePrecision` context","* `relayer_fee_precision` - Precision used to scale the relayer fee."],accounts:[{name:"owner",isMut:!1,isSigner:!0,docs:["Owner of the program set in the [`RedeemerConfig`] and [`SenderConfig`] account."]},{name:"redeemerConfig",isMut:!0,isSigner:!1,docs:["Redeemer Config account. This program requires that the `owner`","specified in the context equals the pubkey specified in this account.","Mutable."]},{name:"senderConfig",isMut:!0,isSigner:!1,docs:["Sender Config account. This program requires that the `owner`","specified in the context equals the pubkey specified in this account.","Mutable. The `owner` check is redundant here, but we keep it as an","extra protection for future changes to the context. Mutable."]}],args:[{name:"relayerFeePrecision",type:"u32"}]},{name:"updateSwapRate",docs:["This instruction updates the `swap_rate` in the `RegisteredToken`","account. This instruction can only be called by the owner or","assistant, which are defined in the [OwnerConfig] account.","","# Arguments","","* `ctx` - `UpdateSwapRate` context","* `swap_rate` - USD conversion rate for the specified token."],accounts:[{name:"owner",isMut:!1,isSigner:!0,docs:["The signer of the transaction. Must be the owner or assistant."]},{name:"ownerConfig",isMut:!1,isSigner:!1,docs:["The owner_config is used when updating the swap rate so that the","assistant key can be used in additional to the owner key."]},{name:"registeredToken",isMut:!0,isSigner:!1,docs:["Registered Token account. This account stores information about the","token, including the swap rate and max native swap amount. The program","will modify this account to update the swap rate. Mutable."]},{name:"mint",isMut:!1,isSigner:!1,docs:["Mint info. This is the SPL token that will be bridged over to the","foreign contract."]}],args:[{name:"swapRate",type:"u64"}]},{name:"updateMaxNativeSwapAmount",docs:["This instruction updates the `max_native_swap_amount` in the","`RegisteredToken` account. This instruction is owner-only,","meaning that only the owner of the program (defined in the [Config]","account) can register a token.","","# Arguments","","* `ctx` - `UpdateMaxNativeSwapAmount` context","* `max_native_swap_amount`:","- Maximum amount of native tokens that can be swapped for this token","- on this chain."],accounts:[{name:"owner",isMut:!1,isSigner:!0,docs:["Owner of the program set in the [`SenderConfig`] account. Signer for","creating [`ForeignContract`] account."]},{name:"config",isMut:!1,isSigner:!1,docs:["Sender Config account. This program requires that the `owner` specified","in the context equals the pubkey specified in this account. Read-only."]},{name:"registeredToken",isMut:!0,isSigner:!1,docs:["Registered Token account. This account stores information about the","token, including the swap rate and max native swap amount. The program","will modify this account when the swap rate or max native swap amount","changes. Mutable."]},{name:"mint",isMut:!1,isSigner:!1,docs:["Mint info. This is the SPL token that will be bridged over to the","foreign contract."]}],args:[{name:"maxNativeSwapAmount",type:"u64"}]},{name:"setPauseForTransfers",docs:["This instruction updates the `paused` boolean in the `SenderConfig`","account. This instruction is owner-only, meaning that only the owner","of the program (defined in the [Config] account) can pause outbound","transfers.","","# Arguments","","* `ctx` - `PauseOutboundTransfers` context","* `paused` - Boolean indicating whether outbound transfers are paused."],accounts:[{name:"owner",isMut:!1,isSigner:!0,docs:["Owner of the program set in the [`SenderConfig`] account."]},{name:"config",isMut:!0,isSigner:!1,docs:["Sender Config account. This program requires that the `owner` specified","in the context equals the pubkey specified in this account. Mutable."]}],args:[{name:"paused",type:"bool"}]},{name:"submitOwnershipTransferRequest",docs:["This instruction sets the `pending_owner` field in the `OwnerConfig`","account. This instruction is owner-only, meaning that only the owner","of the program (defined in the [Config] account) can submit an","ownership transfer request.","","# Arguments","","* `ctx` - `ManageOwnership` context","* `new_owner` - Pubkey of the pending owner."],accounts:[{name:"owner",isMut:!1,isSigner:!0,docs:["Owner of the program set in the [`OwnerConfig`] account."]},{name:"ownerConfig",isMut:!0,isSigner:!1,docs:["Owner Config account. This program requires that the `owner` specified","in the context equals the pubkey specified in this account. Mutable."]}],args:[{name:"newOwner",type:"publicKey"}]},{name:"confirmOwnershipTransferRequest",docs:["This instruction confirms that the `pending_owner` is the signer of","the transaction and updates the `owner` field in the `SenderConfig`,","`RedeemerConfig`, and `OwnerConfig` accounts."],accounts:[{name:"pendingOwner",isMut:!1,isSigner:!0,docs:["Must be the pending owner of the program set in the [`OwnerConfig`]","account."]},{name:"ownerConfig",isMut:!0,isSigner:!1,docs:["Owner Config account. This program requires that the `pending_owner`","specified in the context equals the pubkey specified in this account."]},{name:"senderConfig",isMut:!0,isSigner:!1,docs:["Sender Config account. This instruction will update the `owner`","specified in this account to the `pending_owner` specified in the","[`OwnerConfig`] account. Mutable."]},{name:"redeemerConfig",isMut:!0,isSigner:!1,docs:["Redeemer Config account. This instruction will update the `owner`","specified in this account to the `pending_owner` specified in the","[`OwnerConfig`] account. Mutable."]}],args:[]},{name:"cancelOwnershipTransferRequest",docs:["This instruction cancels the ownership transfer request by setting","the `pending_owner` field in the `OwnerConfig` account to `None`.","This instruction is owner-only, meaning that only the owner of the","program (defined in the [Config] account) can cancel an ownership","transfer request."],accounts:[{name:"owner",isMut:!1,isSigner:!0,docs:["Owner of the program set in the [`OwnerConfig`] account."]},{name:"ownerConfig",isMut:!0,isSigner:!1,docs:["Owner Config account. This program requires that the `owner` specified","in the context equals the pubkey specified in this account. Mutable."]}],args:[]},{name:"updateAssistant",docs:["This instruction updates the `assistant` field in the `OwnerConfig`","account. This instruction is owner-only, meaning that only the owner","of the program (defined in the [Config] account) can update the","assistant.","","# Arguments","","* `ctx` - `ManageOwnership` context","* `new_assistant` - Pubkey of the new assistant."],accounts:[{name:"owner",isMut:!1,isSigner:!0,docs:["Owner of the program set in the [`OwnerConfig`] account."]},{name:"ownerConfig",isMut:!0,isSigner:!1,docs:["Owner Config account. This program requires that the `owner` specified","in the context equals the pubkey specified in this account. Mutable."]}],args:[{name:"newAssistant",type:"publicKey"}]},{name:"updateFeeRecipient",docs:["This instruction updates the `fee_recipient` field in the `RedeemerConfig`","account. This instruction is owner-only, meaning that only the owner","of the program (defined in the [Config] account) can update the","fee recipient.","","# Arguments","","* `ctx` - `UpdateFeeRecipient` context","* `new_fee_recipient` - Pubkey of the new fee recipient."],accounts:[{name:"owner",isMut:!1,isSigner:!0,docs:["Owner of the program set in the [`RedeemerConfig`] account."]},{name:"redeemerConfig",isMut:!0,isSigner:!1,docs:["Redeemer Config account, which saves program data useful for other","instructions, specifically for inbound transfers. Also saves the payer","of the [`initialize`](crate::initialize) instruction as the program's","owner."]}],args:[{name:"newFeeRecipient",type:"publicKey"}]},{name:"transferNativeTokensWithRelay",docs:["This instruction is used to transfer native tokens from Solana to a","foreign blockchain. The user can optionally specify a","`to_native_token_amount` to swap some of the tokens for the native","asset on the target chain. For a fee, an off-chain relayer will redeem","the transfer on the target chain. If the user is transferring native","SOL, the contract will automatically wrap the lamports into a WSOL.","","# Arguments","","* `ctx` - `TransferNativeWithRelay` context","* `amount` - Amount of tokens to send","* `to_native_token_amount`:","- Amount of tokens to swap for native assets on the target chain","* `recipient_chain` - Chain ID of the target chain","* `recipient_address` - Address of the target wallet on the target chain","* `batch_id` - Nonce of Wormhole message","* `wrap_native` - Whether to wrap native SOL"],accounts:[{name:"payer",isMut:!0,isSigner:!0,docs:["Payer will pay Wormhole fee to transfer tokens and create temporary","token account."]},{name:"payerSequence",isMut:!0,isSigner:!1,docs:["Used to keep track of payer's Wormhole sequence number."]},{name:"config",isMut:!1,isSigner:!1,docs:["Sender Config account. Acts as the signer for the Token Bridge token","transfer. Read-only."]},{name:"foreignContract",isMut:!1,isSigner:!1,docs:["Foreign Contract account. Send tokens to the contract specified in this","account. Funnily enough, the Token Bridge program does not have any","requirements for outbound transfers for the recipient chain to be","registered. This account provides extra protection against sending","tokens to an unregistered Wormhole chain ID. Read-only."]},{name:"mint",isMut:!0,isSigner:!1,docs:["Mint info. This is the SPL token that will be bridged over to the","foreign contract. Mutable."]},{name:"fromTokenAccount",isMut:!0,isSigner:!1,docs:["Payer's associated token account. We may want to make this a generic","token account in the future."]},{name:"registeredToken",isMut:!1,isSigner:!1},{name:"tmpTokenAccount",isMut:!0,isSigner:!1,docs:["Program's temporary token account. This account is created before the","instruction is invoked to temporarily take custody of the payer's","tokens. When the tokens are finally bridged out, the token account","will have zero balance and can be closed."]},{name:"tokenBridgeConfig",isMut:!1,isSigner:!1},{name:"tokenBridgeCustody",isMut:!0,isSigner:!1,docs:["account that holds this mint's balance. This account needs to be","unchecked because a token account may not have been created for this","mint yet. Mutable."]},{name:"tokenBridgeAuthoritySigner",isMut:!1,isSigner:!1},{name:"tokenBridgeCustodySigner",isMut:!1,isSigner:!1},{name:"wormholeBridge",isMut:!0,isSigner:!1},{name:"wormholeMessage",isMut:!0,isSigner:!1,docs:["tokens transferred in this account for our program. Mutable."]},{name:"tokenBridgeEmitter",isMut:!1,isSigner:!1},{name:"tokenBridgeSequence",isMut:!0,isSigner:!1},{name:"wormholeFeeCollector",isMut:!0,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"wormholeProgram",isMut:!1,isSigner:!1},{name:"tokenBridgeProgram",isMut:!1,isSigner:!1},{name:"clock",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1}],args:[{name:"amount",type:"u64"},{name:"toNativeTokenAmount",type:"u64"},{name:"recipientChain",type:"u16"},{name:"recipientAddress",type:{array:["u8",32]}},{name:"batchId",type:"u32"},{name:"wrapNative",type:"bool"}]},{name:"transferWrappedTokensWithRelay",docs:["This instruction is used to transfer wrapped tokens from Solana to a","foreign blockchain. The user can optionally specify a","`to_native_token_amount` to swap some of the tokens for the native","assets on the target chain. For a fee, an off-chain relayer will redeem","the transfer on the target chain. This instruction should only be called","when the user is transferring a wrapped token.","","# Arguments","","* `ctx` - `TransferWrappedWithRelay` context","* `amount` - Amount of tokens to send","* `to_native_token_amount`:","- Amount of tokens to swap for native assets on the target chain","* `recipient_chain` - Chain ID of the target chain","* `recipient_address` - Address of the target wallet on the target chain","* `batch_id` - Nonce of Wormhole message"],accounts:[{name:"payer",isMut:!0,isSigner:!0,docs:["Payer will pay Wormhole fee to transfer tokens."]},{name:"payerSequence",isMut:!0,isSigner:!1,docs:["Used to keep track of payer's Wormhole sequence number."]},{name:"config",isMut:!1,isSigner:!1,docs:["Sender Config account. Acts as the Token Bridge sender PDA. Mutable."]},{name:"foreignContract",isMut:!1,isSigner:!1,docs:["Foreign Contract account. Send tokens to the contract specified in this","account. Funnily enough, the Token Bridge program does not have any","requirements for outbound transfers for the recipient chain to be","registered. This account provides extra protection against sending","tokens to an unregistered Wormhole chain ID. Read-only."]},{name:"tokenBridgeWrappedMint",isMut:!0,isSigner:!1,docs:["Token Bridge wrapped mint info. This is the SPL token that will be","bridged to the foreign contract. The wrapped mint PDA must agree","with the native token's metadata. Mutable."]},{name:"fromTokenAccount",isMut:!0,isSigner:!1,docs:["Payer's associated token account. We may want to make this a generic","token account in the future."]},{name:"registeredToken",isMut:!1,isSigner:!1},{name:"tmpTokenAccount",isMut:!0,isSigner:!1,docs:["Program's temporary token account. This account is created before the","instruction is invoked to temporarily take custody of the payer's","tokens. When the tokens are finally bridged out, the token account","will have zero balance and can be closed."]},{name:"tokenBridgeWrappedMeta",isMut:!1,isSigner:!1,docs:["about the token from its native chain:","* Wormhole Chain ID","* Token's native contract address","* Token's native decimals"]},{name:"tokenBridgeConfig",isMut:!1,isSigner:!1},{name:"tokenBridgeAuthoritySigner",isMut:!1,isSigner:!1},{name:"wormholeBridge",isMut:!0,isSigner:!1},{name:"wormholeMessage",isMut:!0,isSigner:!1,docs:["tokens transferred in this account."]},{name:"tokenBridgeEmitter",isMut:!1,isSigner:!1},{name:"tokenBridgeSequence",isMut:!0,isSigner:!1},{name:"wormholeFeeCollector",isMut:!0,isSigner:!1},{name:"wormholeProgram",isMut:!1,isSigner:!1},{name:"tokenBridgeProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"clock",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1}],args:[{name:"amount",type:"u64"},{name:"toNativeTokenAmount",type:"u64"},{name:"recipientChain",type:"u16"},{name:"recipientAddress",type:{array:["u8",32]}},{name:"batchId",type:"u32"}]},{name:"completeNativeTransferWithRelay",docs:["This instruction is used to redeem token transfers from foreign emitters.","It takes custody of the released native tokens and sends the tokens to the","encoded `recipient`. It pays the `fee_recipient` in the token","denomination. If requested by the user, it will perform a swap with the","off-chain relayer to provide the user with lamports. If the token","being transferred is WSOL, the contract will unwrap the WSOL and send","the lamports to the recipient and pay the relayer in lamports.","","# Arguments","","* `ctx` - `CompleteNativeWithRelay` context","* `vaa_hash` - Hash of the VAA that triggered the transfer"],accounts:[{name:"payer",isMut:!0,isSigner:!0,docs:["Payer will pay Wormhole fee to transfer tokens and create temporary","token account."]},{name:"config",isMut:!1,isSigner:!1,docs:["Redeemer Config account. Acts as the Token Bridge redeemer, which signs","for the complete transfer instruction. Read-only."]},{name:"feeRecipientTokenAccount",isMut:!0,isSigner:!1,docs:["Fee recipient's token account. Must be an associated token account. Mutable."]},{name:"foreignContract",isMut:!1,isSigner:!1,docs:["Foreign Contract account. The registered contract specified in this","account must agree with the target address for the Token Bridge's token","transfer. Read-only."]},{name:"mint",isMut:!1,isSigner:!1,docs:["Mint info. This is the SPL token that will be bridged over from the","foreign contract. This must match the token address specified in the","signed Wormhole message. Read-only."]},{name:"recipientTokenAccount",isMut:!0,isSigner:!1,docs:["Recipient associated token account. The recipient authority check","is necessary to ensure that the recipient is the intended recipient","of the bridged tokens. Mutable."]},{name:"recipient",isMut:!0,isSigner:!1,docs:["transaction. This instruction verifies that the recipient key","passed in this context matches the intended recipient in the vaa."]},{name:"registeredToken",isMut:!1,isSigner:!1},{name:"nativeRegisteredToken",isMut:!1,isSigner:!1},{name:"tmpTokenAccount",isMut:!0,isSigner:!1,docs:["Program's temporary token account. This account is created before the","instruction is invoked to temporarily take custody of the payer's","tokens. When the tokens are finally bridged in, the tokens will be","transferred to the destination token accounts. This account will have","zero balance and can be closed."]},{name:"tokenBridgeConfig",isMut:!1,isSigner:!1},{name:"vaa",isMut:!1,isSigner:!1,docs:["Verified Wormhole message account. The Wormhole program verified","signatures and posted the account data here. Read-only."]},{name:"tokenBridgeClaim",isMut:!0,isSigner:!1,docs:["is true if the bridged assets have been claimed. If the transfer has","not been redeemed, this account will not exist yet.","","NOTE: The Token Bridge program's claim account is only initialized when","a transfer is redeemed (and the boolean value `true` is written as","its data).","","The Token Bridge program will automatically fail if this transfer","is redeemed again. But we choose to short-circuit the failure as the","first evaluation of this instruction."]},{name:"tokenBridgeForeignEndpoint",isMut:!1,isSigner:!1,docs:["endpoint per chain, but the PDA allows for multiple endpoints for each","chain! We store the proper endpoint for the emitter chain."]},{name:"tokenBridgeCustody",isMut:!0,isSigner:!1,docs:["account that holds this mint's balance."]},{name:"tokenBridgeCustodySigner",isMut:!1,isSigner:!1},{name:"wormholeProgram",isMut:!1,isSigner:!1},{name:"tokenBridgeProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1}],args:[{name:"vaaHash",type:{array:["u8",32]}}]},{name:"completeWrappedTransferWithRelay",docs:["This instruction is used to redeem token transfers from foreign emitters.","It takes custody of the minted wrapped tokens and sends the tokens to the","encoded `recipient`. It pays the `fee_recipient` in the wrapped-token","denomination. If requested by the user, it will perform a swap with the","off-chain relayer to provide the user with lamports.","","# Arguments","","* `ctx` - `CompleteWrappedWithRelay` context","* `vaa_hash` - Hash of the VAA that triggered the transfer"],accounts:[{name:"payer",isMut:!0,isSigner:!0,docs:["Payer will pay Wormhole fee to transfer tokens and create temporary","token account."]},{name:"config",isMut:!1,isSigner:!1,docs:["Redeemer Config account. Acts as the Token Bridge redeemer, which signs","for the complete transfer instruction. Read-only."]},{name:"feeRecipientTokenAccount",isMut:!0,isSigner:!1,docs:["Fee recipient's token account. Must be an associated token account. Mutable."]},{name:"foreignContract",isMut:!1,isSigner:!1,docs:["Foreign Contract account. The registered contract specified in this","account must agree with the target address for the Token Bridge's token","transfer. Read-only."]},{name:"tokenBridgeWrappedMint",isMut:!0,isSigner:!1,docs:["Token Bridge wrapped mint info. This is the SPL token that will be","bridged from the foreign contract. The wrapped mint PDA must agree","with the native token's metadata in the wormhole message. Mutable."]},{name:"recipientTokenAccount",isMut:!0,isSigner:!1,docs:["Recipient associated token account. The recipient authority check","is necessary to ensure that the recipient is the intended recipient","of the bridged tokens. Mutable."]},{name:"recipient",isMut:!0,isSigner:!1,docs:["transaction. This instruction verifies that the recipient key","passed in this context matches the intended recipient in the vaa."]},{name:"registeredToken",isMut:!1,isSigner:!1},{name:"nativeRegisteredToken",isMut:!1,isSigner:!1},{name:"tmpTokenAccount",isMut:!0,isSigner:!1,docs:["Program's temporary token account. This account is created before the","instruction is invoked to temporarily take custody of the payer's","tokens. When the tokens are finally bridged in, the tokens will be","transferred to the destination token accounts. This account will have","zero balance and can be closed."]},{name:"tokenBridgeWrappedMeta",isMut:!1,isSigner:!1,docs:["about the token from its native chain:","* Wormhole Chain ID","* Token's native contract address","* Token's native decimals"]},{name:"tokenBridgeConfig",isMut:!1,isSigner:!1},{name:"vaa",isMut:!1,isSigner:!1,docs:["Verified Wormhole message account. The Wormhole program verified","signatures and posted the account data here. Read-only."]},{name:"tokenBridgeClaim",isMut:!0,isSigner:!1,docs:["is true if the bridged assets have been claimed. If the transfer has","not been redeemed, this account will not exist yet.","","NOTE: The Token Bridge program's claim account is only initialized when","a transfer is redeemed (and the boolean value `true` is written as","its data).","","The Token Bridge program will automatically fail if this transfer","is redeemed again. But we choose to short-circuit the failure as the","first evaluation of this instruction."]},{name:"tokenBridgeForeignEndpoint",isMut:!1,isSigner:!1,docs:["endpoint per chain, but the PDA allows for multiple endpoints for each","chain! We store the proper endpoint for the emitter chain."]},{name:"tokenBridgeMintAuthority",isMut:!1,isSigner:!1},{name:"wormholeProgram",isMut:!1,isSigner:!1},{name:"tokenBridgeProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1}],args:[{name:"vaaHash",type:{array:["u8",32]}}]}],accounts:[{name:"foreignContract",docs:["Foreign emitter account data."],type:{kind:"struct",fields:[{name:"chain",docs:["Emitter chain. Cannot equal `1` (Solana's Chain ID)."],type:"u16"},{name:"address",docs:["Emitter address. Cannot be zero address."],type:{array:["u8",32]}},{name:"tokenBridgeForeignEndpoint",docs:["Token Bridge program's foreign endpoint account key."],type:"publicKey"},{name:"fee",docs:["The fee that is paid to the `fee_recipient` upon redeeming a transfer.","This value is set in terms of USD and scaled by the `relayer_fee_precision`.","For example, if the `relayer_fee_precision` is `100000000` and the intended","fee is $5, then the `fee` value should be `500000000`."],type:"u64"}]}},{name:"ownerConfig",docs:["Owner account data."],type:{kind:"struct",fields:[{name:"owner",docs:["Program's owner."],type:"publicKey"},{name:"assistant",docs:["Program's assistant. Can be used to update the relayer fee and swap rate."],type:"publicKey"},{name:"pendingOwner",docs:["Intermediate storage for the pending owner. Is used to transfer ownership."],type:{option:"publicKey"}}]}},{name:"redeemerConfig",type:{kind:"struct",fields:[{name:"owner",docs:["Program's owner."],type:"publicKey"},{name:"bump",docs:["PDA bump."],type:"u8"},{name:"relayerFeePrecision",docs:["Relayer fee and swap rate precision."],type:"u32"},{name:"feeRecipient",docs:["Recipient of all relayer fees and swap proceeds."],type:"publicKey"}]}},{name:"registeredToken",docs:["Registered token account data."],type:{kind:"struct",fields:[{name:"swapRate",docs:["Token swap rate. The swap rate is the USD conversion rate of the token."],type:"u64"},{name:"maxNativeSwapAmount",docs:["Maximum amount of native SOL the contract will swap for each transfer."],type:"u64"}]}},{name:"senderConfig",type:{kind:"struct",fields:[{name:"owner",docs:["Program's owner."],type:"publicKey"},{name:"bump",docs:["PDA bump."],type:"u8"},{name:"tokenBridge",docs:["Token Bridge program's relevant addresses."],type:{defined:"OutboundTokenBridgeAddresses"}},{name:"relayerFeePrecision",docs:["Relayer fee and swap rate precision."],type:"u32"},{name:"paused",docs:["Boolean indicating whether outbound transfers are paused."],type:"bool"}]}},{name:"signerSequence",type:{kind:"struct",fields:[{name:"value",type:"u64"}]}}],types:[{name:"OutboundTokenBridgeAddresses",type:{kind:"struct",fields:[{name:"sequence",type:"publicKey"}]}},{name:"TokenBridgeRelayerMessage",docs:["Expected message types for this program. Only valid payloads are:","* `TransferWithRelay`: Payload ID == 1.","","Payload IDs are encoded as u8."],type:{kind:"enum",variants:[{name:"TransferWithRelay",fields:[{name:"target_relayer_fee",type:"u64"},{name:"to_native_token_amount",type:"u64"},{name:"recipient",type:{array:["u8",32]}}]}]}}],errors:[{code:6e3,name:"InvalidWormholeBridge",msg:"InvalidWormholeBridge"},{code:6001,name:"InvalidWormholeFeeCollector",msg:"InvalidWormholeFeeCollector"},{code:6002,name:"OwnerOnly",msg:"OwnerOnly"},{code:6003,name:"OutboundTransfersPaused",msg:"OutboundTransfersPaused"},{code:6004,name:"OwnerOrAssistantOnly",msg:"OwnerOrAssistantOnly"},{code:6005,name:"NotPendingOwner",msg:"NotPendingOwner"},{code:6006,name:"AlreadyTheOwner",msg:"AlreadyTheOwner"},{code:6007,name:"AlreadyTheAssistant",msg:"AlreadyTheAssistant"},{code:6008,name:"AlreadyTheFeeRecipient",msg:"AlreadyTheFeeRecipient"},{code:6009,name:"BumpNotFound",msg:"BumpNotFound"},{code:6010,name:"FailedToMakeImmutable",msg:"FailedToMakeImmutable"},{code:6011,name:"InvalidForeignContract",msg:"InvalidForeignContract"},{code:6012,name:"ZeroBridgeAmount",msg:"ZeroBridgeAmount"},{code:6013,name:"InvalidToNativeAmount",msg:"InvalidToNativeAmount"},{code:6014,name:"NativeMintRequired",msg:"NativeMintRequired"},{code:6015,name:"SwapsNotAllowedForNativeMint",msg:"SwapsNotAllowedForNativeMint"},{code:6016,name:"InvalidTokenBridgeConfig",msg:"InvalidTokenBridgeConfig"},{code:6017,name:"InvalidTokenBridgeAuthoritySigner",msg:"InvalidTokenBridgeAuthoritySigner"},{code:6018,name:"InvalidTokenBridgeCustodySigner",msg:"InvalidTokenBridgeCustodySigner"},{code:6019,name:"InvalidTokenBridgeEmitter",msg:"InvalidTokenBridgeEmitter"},{code:6020,name:"InvalidTokenBridgeSequence",msg:"InvalidTokenBridgeSequence"},{code:6021,name:"InvalidRecipient",msg:"InvalidRecipient"},{code:6022,name:"InvalidTransferToChain",msg:"InvalidTransferToChain"},{code:6023,name:"InvalidTransferTokenChain",msg:"InvalidTransferTokenChain"},{code:6024,name:"InvalidPrecision",msg:"InvalidPrecision"},{code:6025,name:"InvalidTransferToAddress",msg:"InvalidTransferToAddress"},{code:6026,name:"AlreadyRedeemed",msg:"AlreadyRedeemed"},{code:6027,name:"InvalidTokenBridgeForeignEndpoint",msg:"InvalidTokenBridgeForeignEndpoint"},{code:6028,name:"InvalidTokenBridgeMintAuthority",msg:"InvalidTokenBridgeMintAuthority"},{code:6029,name:"InvalidPublicKey",msg:"InvalidPublicKey"},{code:6030,name:"ZeroSwapRate",msg:"ZeroSwapRate"},{code:6031,name:"TokenNotRegistered",msg:"TokenNotRegistered"},{code:6032,name:"ChainNotRegistered",msg:"ChainNotRegistered"},{code:6033,name:"TokenAlreadyRegistered",msg:"TokenAlreadyRegistered"},{code:6034,name:"FeeCalculationError",msg:"TokenFeeCalculationError"},{code:6035,name:"InvalidSwapCalculation",msg:"InvalidSwapCalculation"},{code:6036,name:"InsufficientFunds",msg:"InsufficientFunds"}]};function be(n,t){return new ie.Program(Lt,new e.PublicKey(n),{connection:t})}function qt(n,t){return w.deriveAddress([e.dist.Buffer.from("seq"),new e.PublicKey(t).toBuffer()],n)}async function Dt(n,t,i,r,s,a,c,o,d,u,m,f){const{methods:{transferNativeTokensWithRelay:g},account:{signerSequence:p}}=be(t,n),h=qt(t,i),M=await p.fetch(h).then(({value:S})=>S).catch(S=>{var P;if((P=S.message)!=null&&P.includes("Account does not exist"))return new e.BN(0);throw S}),T=De(t,i,M),B=F(new e.PublicKey(a),new e.PublicKey(i)),b=qe(t,a),N=Ot(t,r,s,i,T,B,a);return g(new e.BN(c.toString()),new e.BN(o.toString()),e.toChainId(u),[...d],m,f).accounts({config:Le(t),payerSequence:h,foreignContract:pe(t,u),registeredToken:ye(t,a),tmpTokenAccount:b,tokenBridgeProgram:new e.PublicKey(r),...N}).instruction()}async function Vt(n,t,i,r,s,a,c,o,d,u,m){const{methods:{transferWrappedTokensWithRelay:f},account:{signerSequence:g}}=be(t,n),p=qt(t,i),h=await g.fetch(p).then(({value:P})=>P).catch(P=>{var U;if((U=P.message)!=null&&U.includes("Account does not exist"))return new e.BN(0);throw P}),M=De(t,i,h),T=F(new e.PublicKey(a),new e.PublicKey(i)),{chain:B,tokenAddress:b}=await ne(n,r,a),N=qe(t,a),S=zt(t,r,s,i,M,T,B,b);return f(new e.BN(c.toString()),new e.BN(o.toString()),e.toChainId(u),[...d],m).accounts({config:Le(t),payerSequence:p,foreignContract:pe(t,u),registeredToken:ye(t,new e.PublicKey(a)),tmpTokenAccount:N,tokenBridgeProgram:new e.PublicKey(r),...S}).instruction()}class ${constructor(t,i,r,s){l(this,"network");l(this,"chain");l(this,"connection");l(this,"contracts");l(this,"chainId");l(this,"coreBridge");l(this,"tokenBridge");this.network=t,this.chain=i,this.connection=r,this.contracts=s,this.chainId=e.toChainId(i);const a=s.tokenBridge;if(!a)throw new Error(`TokenBridge contract Address for chain ${i} not found`);this.tokenBridge=I(a,r),this.coreBridge=new y.SolanaWormholeCore(t,i,r,s)}static async fromRpc(t,i){const[r,s]=await K.SolanaPlatform.chainFromRpc(t),a=i[s];if(a.network!==r)throw new Error(`Network mismatch for chain ${s}: ${a.network} != ${r}`);return new $(r,s,t,a.contracts)}async isWrappedAsset(t){return ne(this.connection,this.tokenBridge.programId,new e.SolanaAddress(t).toUint8Array()).catch(i=>null).then(i=>i!=null)}async getOriginalAsset(t){if(!await this.isWrappedAsset(t))throw e.ErrNotWrapped(t.toString());const i=new e.SolanaAddress(t).toUint8Array(),r=new e.PublicKey(i);try{const s=await ne(this.connection,this.tokenBridge.programId,i);return s===null?{chain:this.chain,address:new e.SolanaAddress(r.toBytes()).toUniversalAddress()}:{chain:e.toChain(s.chain),address:new e.UniversalAddress(new Uint8Array(s.tokenAddress))}}catch{throw e.ErrNotWrapped(t.toString())}}async getTokenUniversalAddress(t){return new e.SolanaAddress(t).toUniversalAddress()}async getTokenNativeAddress(t,i){return new e.SolanaAddress(i).toNative()}async hasWrappedAsset(t){try{return await this.getWrappedAsset(t),!0}catch{}return!1}async getWrappedAsset(t){if(e.isNative(t.address))throw new Error("Native cannot be a wrapped asset");if(t.chain===this.chain)throw new Error(`Token ${t.address} is already native to chain ${this.chain}`);const i=D(this.tokenBridge.programId,e.toChainId(t.chain),t.address.toUniversalAddress().toUint8Array());try{return await ne(this.connection,this.tokenBridge.programId,i),e.toNative(this.chain,i.toBase58())}catch{}throw e.ErrNotWrapped(`${i}: ${t.address.toUniversalAddress().toString()}`)}async isTransferCompleted(t){return y.getClaim(this.connection,this.tokenBridge.programId,t.emitterAddress.toUint8Array(),e.toChainId(t.emitterChain),t.sequence,this.connection.commitment).catch(()=>!1)}async getWrappedNative(){return e.toNative(this.chain,R.toBase58())}async*createAttestation(t,i){if(!i)throw new Error("Payer required to create attestation");const r=new e.SolanaAddress(i).unwrap(),s=0,a=await this.coreBridge.getMessageFee(),c=y.createBridgeFeeTransferInstruction(this.coreBridge.coreBridge.programId,r,a),o=e.Keypair.generate(),d=Bt(this.connection,this.tokenBridge.programId,this.coreBridge.address,r,new e.SolanaAddress(t).unwrap(),o.publicKey,s),u=new e.Transaction().add(c,d);u.feePayer=r,yield this.createUnsignedTx({transaction:u,signers:[o]},"Solana.AttestToken")}async*submitAttestation(t,i){if(!i)throw new Error("Payer required to create attestation");const r=new e.SolanaAddress(i).unwrap();yield*this.coreBridge.postVaa(r,t);const s=new e.Transaction().add(Rt(this.connection,this.tokenBridge.programId,this.coreBridge.address,r,t));s.feePayer=r,yield this.createUnsignedTx({transaction:s},"Solana.CreateWrapped")}async transferSol(t,i,r,s){const a=new e.SolanaAddress(t).unwrap(),c=a,o=i.address.toUniversalAddress().toUint8Array(),d=e.toChainId(i.chain),u=0,m=0n,f=e.Keypair.generate(),g=e.Keypair.generate(),p=await st(this.connection),h=e.SystemProgram.createAccount({fromPubkey:c,newAccountPubkey:g.publicKey,lamports:p,space:E,programId:A}),M=e.SystemProgram.transfer({fromPubkey:c,lamports:r,toPubkey:g.publicKey}),T=lt(g.publicKey,R,c),B=Ee(this.tokenBridge.programId,g.publicKey,c,r),b=s?_e(this.connection,this.tokenBridge.programId,this.coreBridge.address,a,f.publicKey,g.publicKey,R,u,r,o,d,s):Ne(this.connection,this.tokenBridge.programId,this.coreBridge.address,a,f.publicKey,g.publicKey,R,u,r,m,o,d),N=it(g.publicKey,c,c),S=new e.Transaction;return S.feePayer=c,S.add(h,M,T,B,b,N),this.createUnsignedTx({transaction:S,signers:[f,g]},"TokenBridge.TransferNative")}async*transfer(t,i,r,s,a){if(e.isNative(r)){yield await this.transferSol(t,i,s,a);return}const c=new e.SolanaAddress(r).unwrap(),o=new e.SolanaAddress(t).unwrap(),d=await at(c,o),u=i.address.toUniversalAddress().toUint8Array(),m=e.toChainId(i.chain),f=0,g=0n,p=!await this.isWrappedAsset(r),h=e.Keypair.generate();let M;if(p)M=a?_e(this.connection,this.tokenBridge.programId,this.coreBridge.address,o,h.publicKey,d,c,f,s,u,m,a):Ne(this.connection,this.tokenBridge.programId,this.coreBridge.address,o,h.publicKey,d,c,f,s,g,u,m);else{const b=await this.getOriginalAsset(r);if(e.isNative(b.address))throw new Error("Native cannot be an original asset");M=a?xt(this.connection,this.tokenBridge.programId,this.coreBridge.address,o,h.publicKey,d,o,e.toChainId(b.chain),b.address.toUint8Array(),f,s,u,m,a):Ut(this.connection,this.tokenBridge.programId,this.coreBridge.address,o,h.publicKey,d,o,e.toChainId(b.chain),b.address.toUint8Array(),f,s,g,u,m)}const T=Ee(this.tokenBridge.programId,d,o,s),B=new e.Transaction().add(T,M);B.feePayer=o,yield this.createUnsignedTx({transaction:B,signers:[h]},"TokenBridge.TransferTokens")}async*redeemAndUnwrap(t,i){const r=new e.SolanaAddress(t).unwrap(),s=new e.SolanaAddress(i.payload.to.address).unwrap(),a=await on(this.connection,R).then(h=>i.payload.token.amount*BigInt(Math.pow(10,h.decimals-8))),c=await st(this.connection),o=e.Keypair.generate(),d=We(this.connection,this.tokenBridge.programId,this.coreBridge.address,r,i),u=e.SystemProgram.createAccount({fromPubkey:r,newAccountPubkey:o.publicKey,lamports:c,space:E,programId:A}),m=lt(o.publicKey,R,r),f=At(s,o.publicKey,r,a.valueOf()),g=it(o.publicKey,r,r),p=new e.Transaction;p.feePayer=r,p.add(d,u,m,f,g),yield this.createUnsignedTx({transaction:p,signers:[o]},"TokenBridge.RedeemAndUnwrap")}async*createAta(t,i){const r=new e.SolanaAddress(t).unwrap(),s=new e.SolanaAddress(i).unwrap(),a=await at(s,r);if(await this.connection.getAccountInfo(a)===null){const o=new e.Transaction().add(wt(r,a,r,s));o.feePayer=r,yield this.createUnsignedTx({transaction:o},"Redeem.CreateATA")}}async*redeem(t,i,r=!0){const s=i.payload.token.chain===this.chain?i.payload.token.address:(await this.getWrappedAsset(i.payload.token)).toUniversalAddress();if(yield*this.createAta(t,s),yield*this.coreBridge.postVaa(t,i),r){const d=new e.SolanaAddress(await this.getWrappedNative());if(e.bytes.equals(s.toUint8Array(),d.toUint8Array())){yield*this.redeemAndUnwrap(t,i);return}}const a=new e.SolanaAddress(t).unwrap(),c=i.payload.token.chain==this.chain?We:vt,o=new e.Transaction().add(c(this.connection,this.tokenBridge.programId,this.coreBridge.address,a,i));o.feePayer=a,yield this.createUnsignedTx({transaction:o},"Solana.RedeemTransfer")}createUnsignedTx(t,i,r=!1){return new K.SolanaUnsignedTransaction(t,this.network,this.chain,i,r)}}const gr={Testnet:["7VPWjBhCXrpYYBiRKZh1ubh9tLZZNkZGp2ReRphEV4Mc","3WK3mEDNPrNuQReBvM28NcsqrExMnPxD9pPJmgrUeKKH","BaGfF51MQ3a61papTRDYaNefBgTQ9ywnVne5fCff4bxT","ACbmcQxbbhiXWM1GmapUSMmBYKMvnFLfAAXKqdo8xKwo","GQtMXZxnuacCFTXVeTvyHi6P9F6chbtzhVc8JgD8hv7c","3Ftc5hTz9sG4huk79onufGiebJNDMZNL8HYgdMJ9E7JR","DMw2tLaq1bVoAEKtkoUtieSk9bfCPUvubYLatTMsSVop","84F2QX9278ToDmA98u4A86xSV9hz1ovazr8zwGaX6qjS","So11111111111111111111111111111111111111112","8987WGkYa5viiZ9DD8sS3PB5XghKmWjkEgmzvwDuoAEc","BJZ72CjPQojVoH68mzrd4VQ4nr6KuhbAGnhZEZCujKxY"],Mainnet:["7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs","A9mUU4qviSctJVPJdBJWkb28deg915LYJKrzQ19ji3FM","Dn4noZ5jgGfkntzcQSUZ8czkreiZ1ForXYoV2H8Dm7S1","3NZ9JMVBmGAqocybic2c7LQCJScmgsAZ6vQqTDzcqmJh","9gP2kCy3wA1ctvYWQk75guqXuHfrEomqydHLtcTCqiLa","Gz7VkD4MacbEB6yC5XD3HcumEiYx2EtDYYrfikGsvopG","KgV1GvrHQmRBY8sHQQeUKwTm2r2h8t4C8qt12Cw1HVE","DRQBDBEWmwWGK13fRTLhSPzjbvMSUavhV6nW4RUH8W6T","9kvAcwQbqejuJMd59mKuw2bfSsLRaQ7zuvaTVHEeBBec","7ixSaXGsHAFy34wogPk2YXiUX3BMmQMFdercdaHLnBby","G1vJEgzepqhnVu35BN4jrkv3wVwkujYWFFCxhbEZ1CZr","So11111111111111111111111111111111111111112"],Devnet:[]},G=9,ee=new e.BN(10),Z=new e.BN(1e8);class Pe{constructor(t,i,r,s){l(this,"network");l(this,"chain");l(this,"connection");l(this,"contracts");l(this,"chainId");l(this,"coreBridgeProgramId");l(this,"tokenBridgeProgramId");l(this,"tokenBridgeRelayer");this.network=t,this.chain=i,this.connection=r,this.contracts=s,this.chainId=e.toChainId(i);const a=s.tokenBridgeRelayer;if(!a)throw new Error(`TokenBridge contract Address for chain ${i} not found`);this.tokenBridgeRelayer=be(a,r),this.tokenBridgeProgramId=new e.PublicKey(s.tokenBridge),this.coreBridgeProgramId=new e.PublicKey(s.coreBridge)}static async fromRpc(t,i){const[r,s]=await K.SolanaPlatform.chainFromRpc(t),a=i[s];if(a.network!==r)throw new Error(`Network mismatch for chain ${s}: ${a.network} != ${r}`);return new Pe(r,s,t,a.contracts)}async*transfer(t,i,r,s,a){const o=new e.SolanaAddress(t).unwrap(),d=i.address.toUniversalAddress().toUint8Array(),u=this.mintAddress(r),m=new e.Transaction;if(e.isNative(r)){const h=F(u,o);try{await rn(this.connection,h)}catch(M){if(M instanceof Fe){const T=wt(o,h,o,u);m.add(T)}else throw M}}const f=a||0n,g=e.isNative(r),p=g?await Dt(this.connection,this.tokenBridgeRelayer.programId,o,this.tokenBridgeProgramId,this.coreBridgeProgramId,u,s,f,d,i.chain,0,g):await Vt(this.connection,this.tokenBridgeRelayer.programId,o,this.tokenBridgeProgramId,this.coreBridgeProgramId,u,s,f,d,i.chain,0);m.add(p),m.feePayer=o,yield this.createUnsignedTx({transaction:m},"AutomaticTokenBridge.Transfer")}async*redeem(t,i){const r=new e.Transaction;throw yield this.createUnsignedTx({transaction:r},"AutomaticTokenBridge.Redeem"),new Error("Method not implemented.")}async getRelayerFee(t,i){const r=this.mintAddress(i),[{fee:s},{swapRate:a},{relayerFeePrecision:c}]=await Promise.all([this.getForeignContract(t),this.getRegisteredToken(r),this.getRedeemerConfig()]),o=Number(await K.SolanaPlatform.getDecimals(this.network,this.chain,this.connection,i)),d=ee.pow(new e.BN(o)).mul(s).mul(Z).div(new e.BN(c).mul(a));return BigInt(d.toString())}async maxSwapAmount(t){const i=this.mintAddress(t),[{swapRate:r,maxNativeSwapAmount:s},{swapRate:a}]=await Promise.all([this.getRegisteredToken(i),this.getRegisteredToken(R)]),c=Number(await K.SolanaPlatform.getDecimals(this.network,this.chain,this.connection,t)),o=this.calculateNativeSwapRate(a,r),d=c>G?s.mul(o).mul(ee.pow(new e.BN(c-G))).div(Z):s.mul(o).div(ee.pow(new e.BN(G-c)).mul(Z));return BigInt(d.toString())}async nativeTokenAmount(t,i){if(i===0n)return 0n;const r=this.mintAddress(t),s=Number(await K.SolanaPlatform.getDecimals(this.network,this.chain,this.connection,t)),[{swapRate:a},{swapRate:c}]=await Promise.all([this.getRegisteredToken(r),this.getRegisteredToken(R)]),o=this.calculateNativeSwapRate(c,a),d=s>G?Z.mul(new e.BN(i.toString())).div(o.mul(ee.pow(new e.BN(s-G)))):Z.mul(new e.BN(i.toString())).mul(ee.pow(new e.BN(G-s))).div(o);return BigInt(d.toString())}async isRegisteredToken(t){var r;const i=this.mintAddress(t);try{return await this.getRegisteredToken(i),!0}catch(s){if((r=s.message)!=null&&r.includes("Account does not exist"))return!1;throw s}}mintAddress(t){return e.isNative(t)?new e.PublicKey(R):new e.SolanaAddress(t).unwrap()}async getRegisteredTokens(){return gr[this.network].map(t=>e.toNative(this.chain,t))}calculateNativeSwapRate(t,i){return Z.mul(t).div(i)}async getForeignContract(t){return await this.tokenBridgeRelayer.account.foreignContract.fetch(pe(this.tokenBridgeRelayer.programId,t))}async getRegisteredToken(t){return await this.tokenBridgeRelayer.account.registeredToken.fetch(ye(this.tokenBridgeRelayer.programId,t))}async getRedeemerConfig(){return await this.tokenBridgeRelayer.account.redeemerConfig.fetch(Mt(this.tokenBridgeRelayer.programId))}createUnsignedTx(t,i,r=!1){return new K.SolanaUnsignedTransaction(t,this.network,this.chain,i,r)}}const Ue={version:"0.4.0",name:"tokenBridgeRelayer",instructions:[{name:"completeNativeTransferWithRelay",accounts:[{name:"payer",isMut:!0,isSigner:!0},{name:"config",isMut:!1,isSigner:!1},{name:"mint",isMut:!1,isSigner:!1},{name:"recipientTokenAccount",isMut:!0,isSigner:!1},{name:"recipient",isMut:!0,isSigner:!1},{name:"tmpTokenAccount",isMut:!0,isSigner:!1},{name:"tokenBridgeConfig",isMut:!1,isSigner:!1},{name:"vaa",isMut:!1,isSigner:!1},{name:"tokenBridgeClaim",isMut:!0,isSigner:!1},{name:"tokenBridgeForeignEndpoint",isMut:!1,isSigner:!1},{name:"tokenBridgeCustody",isMut:!0,isSigner:!1},{name:"tokenBridgeCustodySigner",isMut:!1,isSigner:!1},{name:"wormholeProgram",isMut:!1,isSigner:!1},{name:"tokenBridgeProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"associatedTokenProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1}],args:[{name:"vaaHash",type:{array:["u8",32]}}]},{name:"completeWrappedTransferWithRelay",accounts:[{name:"payer",isMut:!0,isSigner:!0},{name:"config",isMut:!1,isSigner:!1},{name:"tokenBridgeWrappedMint",isMut:!0,isSigner:!1},{name:"recipientTokenAccount",isMut:!0,isSigner:!1},{name:"recipient",isMut:!0,isSigner:!1},{name:"tmpTokenAccount",isMut:!0,isSigner:!1},{name:"tokenBridgeWrappedMeta",isMut:!1,isSigner:!1},{name:"tokenBridgeConfig",isMut:!1,isSigner:!1},{name:"vaa",isMut:!1,isSigner:!1},{name:"tokenBridgeClaim",isMut:!0,isSigner:!1},{name:"tokenBridgeForeignEndpoint",isMut:!1,isSigner:!1},{name:"tokenBridgeMintAuthority",isMut:!1,isSigner:!1},{name:"wormholeProgram",isMut:!1,isSigner:!1},{name:"tokenBridgeProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"associatedTokenProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1}],args:[{name:"vaaHash",type:{array:["u8",32]}}]},{name:"initialize",accounts:[{name:"payer",isMut:!0,isSigner:!0},{name:"senderConfig",isMut:!0,isSigner:!1},{name:"redeemerConfig",isMut:!0,isSigner:!1},{name:"authority",isMut:!1,isSigner:!1},{name:"lutAddress",isMut:!0,isSigner:!1},{name:"lut",isMut:!0,isSigner:!1},{name:"lutProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[{name:"recentSlot",type:"u64"}]},{name:"resolveExecuteVaaV1",accounts:[],args:[{name:"vaaBody",type:"bytes"}],returns:{defined:"ResolverInstructionGroups"}},{name:"transferNativeTokensWithRelay",accounts:[{name:"payer",isMut:!0,isSigner:!0},{name:"config",isMut:!1,isSigner:!1},{name:"mint",isMut:!0,isSigner:!1},{name:"fromTokenAccount",isMut:!0,isSigner:!1},{name:"tmpTokenAccount",isMut:!0,isSigner:!1},{name:"tokenBridgeConfig",isMut:!1,isSigner:!1},{name:"tokenBridgeCustody",isMut:!0,isSigner:!1},{name:"tokenBridgeAuthoritySigner",isMut:!1,isSigner:!1},{name:"tokenBridgeCustodySigner",isMut:!1,isSigner:!1},{name:"wormholeBridge",isMut:!0,isSigner:!1},{name:"wormholeMessage",isMut:!0,isSigner:!0},{name:"tokenBridgeEmitter",isMut:!1,isSigner:!1},{name:"tokenBridgeSequence",isMut:!0,isSigner:!1},{name:"wormholeFeeCollector",isMut:!0,isSigner:!1},{name:"payee",isMut:!0,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"wormholeProgram",isMut:!1,isSigner:!1},{name:"tokenBridgeProgram",isMut:!1,isSigner:!1},{name:"associatedTokenProgram",isMut:!1,isSigner:!1},{name:"executorProgram",isMut:!1,isSigner:!1},{name:"clock",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1}],args:[{name:"args",type:{defined:"TransferNativeTokensWithRelayArgs"}}]},{name:"transferWrappedTokensWithRelay",accounts:[{name:"payer",isMut:!0,isSigner:!0},{name:"config",isMut:!1,isSigner:!1},{name:"tokenBridgeWrappedMint",isMut:!0,isSigner:!1},{name:"fromTokenAccount",isMut:!0,isSigner:!1},{name:"tmpTokenAccount",isMut:!0,isSigner:!1},{name:"tokenBridgeWrappedMeta",isMut:!1,isSigner:!1},{name:"tokenBridgeConfig",isMut:!1,isSigner:!1},{name:"tokenBridgeAuthoritySigner",isMut:!1,isSigner:!1},{name:"wormholeBridge",isMut:!0,isSigner:!1},{name:"wormholeMessage",isMut:!0,isSigner:!0},{name:"tokenBridgeEmitter",isMut:!1,isSigner:!1},{name:"tokenBridgeSequence",isMut:!0,isSigner:!1},{name:"wormholeFeeCollector",isMut:!0,isSigner:!1},{name:"payee",isMut:!0,isSigner:!1},{name:"wormholeProgram",isMut:!1,isSigner:!1},{name:"tokenBridgeProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"executorProgram",isMut:!1,isSigner:!1},{name:"clock",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1}],args:[{name:"args",type:{defined:"TransferWrappedTokensWithRelayArgs"}}]}],accounts:[{name:"LUT",type:{kind:"struct",fields:[{name:"bump",type:"u8"},{name:"address",type:"publicKey"}]}},{name:"RedeemerConfig",type:{kind:"struct",fields:[{name:"bump",type:"u8"}]}},{name:"SenderConfig",type:{kind:"struct",fields:[{name:"bump",type:"u8"}]}}],types:[{name:"InstructionGroup",type:{kind:"struct",fields:[{name:"instructions",type:{vec:{defined:"SerializableInstruction"}}},{name:"addressLookupTables",type:{vec:"publicKey"}}]}},{name:"InstructionGroups",type:{kind:"struct",fields:[{name:"groups",type:{vec:{defined:"InstructionGroup"}}}]}},{name:"MissingAccounts",type:{kind:"struct",fields:[{name:"accounts",type:{vec:"publicKey"}},{name:"addressLookupTables",type:{vec:"publicKey"}}]}},{name:"ResolverInstructionGroups",type:{kind:"enum",variants:[{name:"Resolved",fields:[{name:"groups",type:{defined:"InstructionGroups"}}]},{name:"Missing",fields:[{name:"accounts",type:{defined:"MissingAccounts"}}]},{name:"Account"}]}},{name:"SerializableAccountMeta",type:{kind:"struct",fields:[{name:"pubkey",type:"publicKey"},{name:"isSigner",type:"bool"},{name:"isWritable",type:"bool"}]}},{name:"SerializableInstruction",type:{kind:"struct",fields:[{name:"programId",type:"publicKey"},{name:"accounts",type:{vec:{defined:"SerializableAccountMeta"}}},{name:"data",type:"bytes"}]}},{name:"TransferNativeTokensWithRelayArgs",type:{kind:"struct",fields:[{name:"amount",type:"u64"},{name:"recipientChain",type:"u16"},{name:"recipientAddress",type:{array:["u8",32]}},{name:"nonce",type:"u32"},{name:"wrapNative",type:"bool"},{name:"dstTransferRecipient",type:{array:["u8",32]}},{name:"dstExecutionAddress",type:{array:["u8",32]}},{name:"execAmount",type:"u64"},{name:"signedQuoteBytes",type:"bytes"},{name:"relayInstructions",type:"bytes"}]}},{name:"TransferWrappedTokensWithRelayArgs",type:{kind:"struct",fields:[{name:"amount",type:"u64"},{name:"recipientChain",type:"u16"},{name:"recipientAddress",type:{array:["u8",32]}},{name:"nonce",type:"u32"},{name:"dstTransferRecipient",type:{array:["u8",32]}},{name:"dstExecutionAddress",type:{array:["u8",32]}},{name:"execAmount",type:"u64"},{name:"signedQuoteBytes",type:"bytes"},{name:"relayInstructions",type:"bytes"}]}}],errors:[{code:6e3,name:"InvalidWormholeBridge",msg:"invalidWormholeBridge"},{code:6001,name:"InvalidWormholeFeeCollector",msg:"invalidWormholeFeeCollector"},{code:6002,name:"OwnerOnly",msg:"ownerOnly"},{code:6003,name:"OutboundTransfersPaused",msg:"outboundTransfersPaused"},{code:6004,name:"OwnerOrAssistantOnly",msg:"ownerOrAssistantOnly"},{code:6005,name:"NotPendingOwner",msg:"notPendingOwner"},{code:6006,name:"AlreadyTheOwner",msg:"alreadyTheOwner"},{code:6007,name:"AlreadyTheAssistant",msg:"alreadyTheAssistant"},{code:6008,name:"AlreadyTheFeeRecipient",msg:"alreadyTheFeeRecipient"},{code:6009,name:"BumpNotFound",msg:"bumpNotFound"},{code:6010,name:"FailedToMakeImmutable",msg:"failedToMakeImmutable"},{code:6011,name:"InvalidForeignContract",msg:"invalidForeignContract"},{code:6012,name:"ZeroBridgeAmount",msg:"zeroBridgeAmount"},{code:6013,name:"InvalidToNativeAmount",msg:"invalidToNativeAmount"},{code:6014,name:"NativeMintRequired",msg:"nativeMintRequired"},{code:6015,name:"SwapsNotAllowedForNativeMint",msg:"swapsNotAllowedForNativeMint"},{code:6016,name:"InvalidTokenBridgeConfig",msg:"invalidTokenBridgeConfig"},{code:6017,name:"InvalidTokenBridgeAuthoritySigner",msg:"invalidTokenBridgeAuthoritySigner"},{code:6018,name:"InvalidTokenBridgeCustodySigner",msg:"invalidTokenBridgeCustodySigner"},{code:6019,name:"InvalidTokenBridgeEmitter",msg:"invalidTokenBridgeEmitter"},{code:6020,name:"InvalidTokenBridgeSequence",msg:"invalidTokenBridgeSequence"},{code:6021,name:"InvalidRecipient",msg:"invalidRecipient"},{code:6022,name:"InvalidTransferToChain",msg:"invalidTransferToChain"},{code:6023,name:"InvalidTransferTokenChain",msg:"invalidTransferTokenChain"},{code:6024,name:"InvalidPrecision",msg:"invalidPrecision"},{code:6025,name:"InvalidTransferToAddress",msg:"invalidTransferToAddress"},{code:6026,name:"AlreadyRedeemed",msg:"alreadyRedeemed"},{code:6027,name:"InvalidTokenBridgeForeignEndpoint",msg:"invalidTokenBridgeForeignEndpoint"},{code:6028,name:"InvalidTokenBridgeMintAuthority",msg:"invalidTokenBridgeMintAuthority"},{code:6029,name:"InvalidPublicKey",msg:"invalidPublicKey"},{code:6030,name:"ZeroSwapRate",msg:"zeroSwapRate"},{code:6031,name:"TokenNotRegistered",msg:"tokenNotRegistered"},{code:6032,name:"ChainNotRegistered",msg:"chainNotRegistered"},{code:6033,name:"TokenAlreadyRegistered",msg:"tokenAlreadyRegistered"},{code:6034,name:"FeeCalculationError",msg:"tokenFeeCalculationError"},{code:6035,name:"InvalidSwapCalculation",msg:"invalidSwapCalculation"},{code:6036,name:"InsufficientFunds",msg:"insufficientFunds"},{code:6037,name:"FailedToParseVaaBody",msg:"failedToParseVaaBody"}]},L=class L{constructor(t,i,r,s){l(this,"network");l(this,"chain");l(this,"connection");l(this,"contracts");l(this,"relayerProgramId");l(this,"executorProgramId");l(this,"wormholeProgramId");l(this,"tokenBridgeProgramId");l(this,"relayerProgram");if(this.network=t,this.chain=i,this.connection=r,this.contracts=s,!s.executorTokenBridge)throw new Error(`Executor Token Bridge contracts not found for network ${t} and chain ${i}`);this.relayerProgramId=new e.PublicKey(s.executorTokenBridge.relayer),this.executorProgramId=new e.PublicKey(s.executor),this.wormholeProgramId=new e.PublicKey(s.coreBridge),this.tokenBridgeProgramId=new e.PublicKey(s.tokenBridge),this.relayerProgram=new ie.Program(Ue,this.relayerProgramId,{connection:this.connection})}static async fromRpc(t,i){const[r,s]=await K.SolanaPlatform.chainFromRpc(t),a=i[s];if(a.network!==r)throw new Error(`Network mismatch: ${a.network} != ${r}`);return new L(r,s,t,a.contracts)}async*transfer(t,i,r,s,a,c){const o=e.executorTokenBridge.get(this.network,i.chain);if(!o||!o.relayer)throw new Error(`Token Bridge Executor Relayer contract for domain ${i.chain} not found`);const d=o.relayer,u=new e.SolanaAddress(t).unwrap(),m=e.toChainId(i.chain),f=i.address.toUniversalAddress(),{estimatedCost:g,signedQuote:p,relayInstructions:h}=a,M=e.serialize(e.signedQuoteLayout,p),T=e.serialize(e.relayInstructionsLayout,h),B=new $(this.network,this.chain,this.connection,this.contracts),b=e.isNative(r),N=!b&&await B.isWrappedAsset(r),S=b?R:new e.SolanaAddress(r).unwrap(),P=await K.SolanaPlatform.getTokenProgramId(this.connection,S),U=new e.PublicKey(p.quote.payeeAddress),V=e.Keypair.generate(),ue=e.toUniversal(i.chain,d),Be=ue,de=e.PublicKey.findProgramAddressSync([e.dist.Buffer.from("config")],this.tokenBridgeProgramId)[0],Ce=e.PublicKey.findProgramAddressSync([S.toBuffer()],this.tokenBridgeProgramId)[0],le=e.PublicKey.findProgramAddressSync([e.dist.Buffer.from("authority_signer")],this.tokenBridgeProgramId)[0],Yt=e.PublicKey.findProgramAddressSync([e.dist.Buffer.from("custody_signer")],this.tokenBridgeProgramId)[0],{wormholeEmitter:Ze,wormholeSequence:He,wormholeFeeCollector:Qe,wormholeBridge:$e}=y.getWormholeDerivedAccounts(this.tokenBridgeProgramId,this.wormholeProgramId),Xe=e.PublicKey.findProgramAddressSync([e.dist.Buffer.from("sender")],this.relayerProgramId)[0],Je=F(S,u,!1,P),je=e.PublicKey.findProgramAddressSync([e.dist.Buffer.from("tmp"),S.toBytes()],this.relayerProgramId)[0],Y=[];if(c&&c.feeAmount>0n){const ve=new e.PublicKey(c.referrer.address.toString());if(S.equals(R))Y.push(e.SystemProgram.transfer({fromPubkey:u,toPubkey:ve,lamports:c.feeAmount}));else{const Ie=F(S,ve,!0,P),$t=F(S,u,!0,P);await this.connection.getAccountInfo(Ie)||Y.push(Ln(u,Ie,ve,S,P)),Y.push(At($t,Ie,u,c.feeAmount,void 0,P))}}const Gt=c?c.remainingAmount:s,et={amount:new e.BN(Gt.toString()),recipientChain:m,recipientAddress:Array.from(f.toUint8Array()),nonce:0,dstTransferRecipient:Array.from(ue.toUint8Array()),dstExecutionAddress:Array.from(Be.toUint8Array()),execAmount:new e.BN(g.toString()),signedQuoteBytes:e.dist.Buffer.from(M),relayInstructions:e.dist.Buffer.from(T)};N?Y.push(await this.relayerProgram.methods.transferWrappedTokensWithRelay(et).accountsStrict({payer:u,config:Xe,tokenBridgeWrappedMint:S,fromTokenAccount:Je,tmpTokenAccount:je,tokenBridgeWrappedMeta:_(this.tokenBridgeProgramId,S),tokenBridgeConfig:de,tokenBridgeAuthoritySigner:le,wormholeBridge:$e,wormholeMessage:V.publicKey,tokenBridgeEmitter:Ze,tokenBridgeSequence:He,wormholeFeeCollector:Qe,payee:U,wormholeProgram:this.wormholeProgramId,tokenBridgeProgram:this.tokenBridgeProgramId,systemProgram:e.SystemProgram.programId,tokenProgram:P,executorProgram:this.executorProgramId,clock:e.SYSVAR_CLOCK_PUBKEY,rent:e.SYSVAR_RENT_PUBKEY}).instruction()):Y.push(await this.relayerProgram.methods.transferNativeTokensWithRelay({...et,wrapNative:e.isNative(r)}).accountsStrict({payer:u,config:Xe,mint:S,fromTokenAccount:Je,tmpTokenAccount:je,tokenBridgeConfig:de,tokenBridgeCustody:Ce,tokenBridgeAuthoritySigner:le,tokenBridgeCustodySigner:Yt,wormholeBridge:$e,wormholeMessage:V.publicKey,tokenBridgeEmitter:Ze,tokenBridgeSequence:He,wormholeFeeCollector:Qe,payee:U,systemProgram:e.SystemProgram.programId,tokenProgram:P,wormholeProgram:this.wormholeProgramId,tokenBridgeProgram:this.tokenBridgeProgramId,associatedTokenProgram:O,executorProgram:this.executorProgramId,clock:e.SYSVAR_CLOCK_PUBKEY,rent:e.SYSVAR_RENT_PUBKEY}).instruction());const tt=await this.getAddressLookupTable(),{blockhash:Zt}=await this.connection.getLatestBlockhash(),Ht=new e.TransactionMessage({payerKey:u,instructions:Y,recentBlockhash:Zt}).compileToV0Message(tt?[tt]:[]),Qt=new e.VersionedTransaction(Ht);yield this.createUnsignedTx({transaction:Qt,signers:[V]},"ExecutorTokenBridge.transfer")}async*redeem(t,i){const r=new e.SolanaAddress(t).unwrap(),s=new e.SolanaAddress(i.payload.payload.targetRecipient).unwrap(),a=i.payload.token.chain,c=i.payload.token.address,o=a===this.chain;let d;if(o)d=new e.SolanaAddress(c).unwrap();else{const le=await new $(this.network,this.chain,this.connection,this.contracts).getWrappedAsset({chain:a,address:c});d=new e.SolanaAddress(le).unwrap()}const u=await K.SolanaPlatform.getTokenProgramId(this.connection,d),m=F(d,s,!0,u),f=y.derivePostedVaaKey(this.wormholeProgramId,e.dist.Buffer.from(i.hash));await this.connection.getAccountInfo(f)||(yield*new y.SolanaWormholeCore(this.network,this.chain,this.connection,this.contracts).postVaa(r,i));const p=new e.SolanaAddress(i.payload.to.address).unwrap(),h=new ie.Program(Ue,p,{connection:this.connection}),M=e.PublicKey.findProgramAddressSync([e.dist.Buffer.from("redeemer")],h.programId)[0],T=e.PublicKey.findProgramAddressSync([e.dist.Buffer.from("config")],this.tokenBridgeProgramId)[0],B=e.PublicKey.findProgramAddressSync([e.dist.Buffer.from("tmp"),d.toBytes()],h.programId)[0],b=y.deriveClaimKey(this.tokenBridgeProgramId,i.emitterAddress.toUint8Array(),e.toChainId(i.emitterChain),i.sequence),N=z(this.tokenBridgeProgramId,e.toChainId(i.emitterChain),i.emitterAddress.toUint8Array()),S=e.PublicKey.findProgramAddressSync([d.toBuffer()],this.tokenBridgeProgramId)[0],P=e.PublicKey.findProgramAddressSync([e.dist.Buffer.from("custody_signer")],this.tokenBridgeProgramId)[0];let U;const V=Array.from(i.hash);o?U=await h.methods.completeNativeTransferWithRelay(V).accountsStrict({payer:r,config:M,mint:d,recipientTokenAccount:m,recipient:s,tmpTokenAccount:B,tokenBridgeConfig:T,vaa:f,tokenBridgeClaim:b,tokenBridgeForeignEndpoint:N,tokenBridgeCustody:S,tokenBridgeCustodySigner:P,wormholeProgram:this.wormholeProgramId,tokenBridgeProgram:this.tokenBridgeProgramId,tokenProgram:u,associatedTokenProgram:O,systemProgram:e.SystemProgram.programId,rent:e.SYSVAR_RENT_PUBKEY}).instruction():U=await h.methods.completeWrappedTransferWithRelay(V).accountsStrict({payer:r,config:M,tokenBridgeWrappedMint:d,recipientTokenAccount:m,recipient:s,tmpTokenAccount:B,tokenBridgeWrappedMeta:_(this.tokenBridgeProgramId,d),tokenBridgeConfig:T,vaa:f,tokenBridgeClaim:b,tokenBridgeForeignEndpoint:N,tokenBridgeMintAuthority:j(this.tokenBridgeProgramId),wormholeProgram:this.wormholeProgramId,tokenBridgeProgram:this.tokenBridgeProgramId,tokenProgram:u,associatedTokenProgram:O,systemProgram:e.SystemProgram.programId,rent:e.SYSVAR_RENT_PUBKEY}).instruction();const{blockhash:ue}=await this.connection.getLatestBlockhash(),Be=new e.TransactionMessage({payerKey:r,instructions:[U],recentBlockhash:ue}).compileToV0Message(),de=new e.VersionedTransaction(Be);yield this.createUnsignedTx({transaction:de,signers:[]},"ExecutorTokenBridge.redeem")}async getAddressLookupTable(){const t=e.PublicKey.findProgramAddressSync([e.dist.Buffer.from("lut")],this.relayerProgramId)[0];try{const i=(await this.relayerProgram.account.lut.fetch(t)).address,r=await this.connection.getAddressLookupTable(i);if(r.value)return r.value}catch{}return null}async estimateMsgValueAndGasLimit(t,i){let r=0n;if(r+=2n*5000n+7n*5000n+1400000n,r+=2n*5000n+7n*5000n,r+=5000n+3200000n,e.isNative(t.address)||e.canonicalAddress(t)===R.toString()?r+=5000n+5000000n:r+=5000n+1200000n,i){const s=new e.PublicKey(i.address.toString());if(!e.isNative(t.address)){const a=new e.SolanaAddress(t.address).unwrap(),c=await this.connection.getAccountInfo(a);if(c===null)throw new Error("Couldn't determine token program. Mint account is null.");const o=F(a,s,!0,c.owner);await this.connection.getAccountInfo(o)===null&&(L.associatedTokenAccountMinRent||(L.associatedTokenAccountMinRent=BigInt(await this.connection.getMinimumBalanceForRentExemption(165))),r+=L.associatedTokenAccountMinRent)}}return{msgValue:r,gasLimit:310000n}}createUnsignedTx(t,i,r=!1){return new K.SolanaUnsignedTransaction(t,this.network,this.chain,i,r)}};l(L,"associatedTokenAccountMinRent");let ge=L;e.registerProtocol(e._platform$1,"TokenBridge",$);e.registerProtocol(e._platform$1,"AutomaticTokenBridge",Pe);e.registerProtocol(e._platform$1,"ExecutorTokenBridge",ge);exports.CreateMetadataAccountArgs=se;exports.Creator=x;exports.Data=oe;exports.EndpointRegistration=Se;exports.ExecutorTokenBridgeRelayerIdl=Ue;exports.Metadata=Te;exports.SolanaAutomaticTokenBridge=Pe;exports.SolanaExecutorTokenBridge=ge;exports.SolanaTokenBridge=$;exports.SplTokenMetadataProgram=Q;exports.TOKEN_BRIDGE_IDL=Ve;exports.TOKEN_BRIDGE_RELAYER_IDL=Lt;exports.TokenBridgeConfig=we;exports.WrappedMeta=ke;exports.coder=Pt;exports.createApproveAuthoritySignerInstruction=Ee;exports.createAttestTokenInstruction=Bt;exports.createCompleteTransferNativeInstruction=We;exports.createCompleteTransferWrappedInstruction=vt;exports.createCreateWrappedInstruction=Rt;exports.createInitializeInstruction=cr;exports.createReadOnlyTokenBridgeProgramInterface=I;exports.createRegisterChainInstruction=ur;exports.createTokenBridgeProgramInterface=bt;exports.createTokenBridgeRelayerProgramInterface=be;exports.createTransferNativeInstruction=Ne;exports.createTransferNativeTokensWithRelayInstruction=Dt;exports.createTransferNativeWithPayloadInstruction=_e;exports.createTransferWrappedInstruction=Ut;exports.createTransferWrappedTokensWithRelayInstruction=Vt;exports.createTransferWrappedWithPayloadInstruction=xt;exports.createUpgradeContractInstruction=dr;exports.deriveAuthoritySignerKey=q;exports.deriveCustodyKey=ae;exports.deriveCustodySignerKey=J;exports.deriveEndpointKey=z;exports.deriveForeignContractAddress=pe;exports.deriveMintAuthorityKey=j;exports.deriveRedeemerAccountKey=Me;exports.deriveRedeemerConfigAddress=Mt;exports.deriveRegisteredTokenAddress=ye;exports.deriveSenderAccountKey=Ae;exports.deriveSenderConfigAddress=Le;exports.deriveSplTokenMetadataKey=ce;exports.deriveTmpTokenAccountAddress=qe;exports.deriveTokenBridgeConfigKey=C;exports.deriveTokenTransferMessageAddress=De;exports.deriveWrappedMetaKey=_;exports.deriveWrappedMintKey=D;exports.getAttestTokenAccounts=Ke;exports.getCompleteTransferNativeAccounts=Ct;exports.getCompleteTransferNativeWithPayloadCpiAccounts=mr;exports.getCompleteTransferWrappedAccounts=It;exports.getCompleteTransferWrappedWithPayloadCpiAccounts=fr;exports.getCreateWrappedAccounts=Et;exports.getEndpointRegistration=Dn;exports.getInitializeAccounts=Kt;exports.getMetadata=or;exports.getRegisterChainAccounts=Wt;exports.getTokenBridgeConfig=qn;exports.getTokenBridgeDerivedAccounts=lr;exports.getTransferNativeAccounts=_t;exports.getTransferNativeWithPayloadAccounts=Ye;exports.getTransferNativeWithPayloadCpiAccounts=Ot;exports.getTransferWrappedAccounts=Ft;exports.getTransferWrappedWithPayloadAccounts=Ge;exports.getTransferWrappedWithPayloadCpiAccounts=zt;exports.getUpgradeContractAccounts=Nt;exports.getWrappedMeta=ne;