@wormhole-foundation/wormhole-connect 1.0.0-beta.1-development → 1.0.0-beta.3-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 (383) hide show
  1. package/README.md +1 -1
  2. package/dist/assets/{ccip-DqoMCvgC.js → ccip-YN27M9dL.js} +1 -1
  3. package/dist/assets/{evm-B97OP4_W.js → evm-wKiUiV3-.js} +4 -4
  4. package/dist/assets/{index-B4nwQysh.js → index-8fbGA94c.js} +1 -1
  5. package/dist/assets/{index-B3CIvGYj.js → index-B9_Snb-C.js} +2 -2
  6. package/dist/assets/{index-CUWn-lgC.js → index-BBy_QGBB.js} +1 -1
  7. package/dist/assets/{index.es-DMMEjdkD.js → index.es-BY7lrdO_.js} +2 -2
  8. package/dist/main.js +61 -67
  9. package/dist/src/config/index.d.ts.map +1 -1
  10. package/dist/src/config/types.d.ts +0 -8
  11. package/dist/src/config/types.d.ts.map +1 -1
  12. package/dist/src/config/ui.d.ts +1 -0
  13. package/dist/src/config/ui.d.ts.map +1 -1
  14. package/dist/src/hooks/useAmountValidation.d.ts +1 -0
  15. package/dist/src/hooks/useAmountValidation.d.ts.map +1 -1
  16. package/dist/src/hooks/useTransactionHistoryMayan.d.ts.map +1 -1
  17. package/dist/src/hooks/useTransactionHistoryWHScan.d.ts.map +1 -1
  18. package/dist/src/icons/PoweredBy.d.ts.map +1 -1
  19. package/dist/src/icons/Tokens/KLAY.d.ts.map +1 -1
  20. package/dist/src/icons/TxReadyForClaim.d.ts +5 -0
  21. package/dist/src/icons/TxReadyForClaim.d.ts.map +1 -0
  22. package/dist/src/routes/sdkv2/route.d.ts.map +1 -1
  23. package/dist/src/store/index.d.ts +0 -2
  24. package/dist/src/store/index.d.ts.map +1 -1
  25. package/dist/src/store/transferInput.d.ts +1 -3
  26. package/dist/src/store/transferInput.d.ts.map +1 -1
  27. package/dist/src/telemetry/index.d.ts +6 -1
  28. package/dist/src/telemetry/index.d.ts.map +1 -1
  29. package/dist/src/utils/errors.d.ts.map +1 -1
  30. package/dist/src/utils/index.d.ts +2 -0
  31. package/dist/src/utils/index.d.ts.map +1 -1
  32. package/dist/src/utils/style.d.ts +1 -0
  33. package/dist/src/utils/style.d.ts.map +1 -1
  34. package/dist/src/utils/wallet/index.d.ts.map +1 -1
  35. package/dist/src/views/v2/Bridge/AmountInput/index.d.ts.map +1 -1
  36. package/dist/src/views/v2/Bridge/AssetPicker/ChainList.d.ts.map +1 -1
  37. package/dist/src/views/v2/Bridge/AssetPicker/SearchableList/index.d.ts.map +1 -1
  38. package/dist/src/views/v2/Bridge/AssetPicker/TokenList.d.ts.map +1 -1
  39. package/dist/src/views/v2/Bridge/ReviewTransaction/SendError.d.ts +8 -0
  40. package/dist/src/views/v2/Bridge/ReviewTransaction/SendError.d.ts.map +1 -0
  41. package/dist/src/views/v2/Bridge/ReviewTransaction/index.d.ts.map +1 -1
  42. package/dist/src/views/v2/Bridge/Routes/index.d.ts +1 -1
  43. package/dist/src/views/v2/Bridge/Routes/index.d.ts.map +1 -1
  44. package/dist/src/views/v2/Bridge/index.d.ts.map +1 -1
  45. package/dist/src/views/v2/Redeem/TransactionDetails/index.d.ts.map +1 -1
  46. package/dist/src/views/v2/Redeem/index.d.ts.map +1 -1
  47. package/dist/src/views/v2/TxHistory/index.d.ts.map +1 -1
  48. package/lib/{algorand-D-BdPUAb.mjs → algorand-BZLSulqp.mjs} +3 -3
  49. package/lib/{algorand-BgrZh6rH.js → algorand-DIrI8hux.js} +1 -1
  50. package/lib/{aptos-CATrqTpB.js → aptos-B61S9Mku.js} +1 -1
  51. package/lib/{aptos-CmpYdVuv.mjs → aptos-BXyptrTk.mjs} +3 -3
  52. package/lib/{aptos-CeHwTLqC.mjs → aptos-ClFQX748.mjs} +1 -1
  53. package/lib/{aptos-CA8QZDqZ.js → aptos-poOCeL-e.js} +2 -2
  54. package/lib/{ccip-BMQmQT67.mjs → ccip-BcLqF-ov.mjs} +1 -1
  55. package/lib/{ccip-B-v_m1LK.js → ccip-CROSeCCn.js} +1 -1
  56. package/lib/{cosmos-Bh-ZHBp5.mjs → cosmos-B7IowZE9.mjs} +6 -6
  57. package/lib/{cosmos-ksRGnYO-.js → cosmos-D-fRtzTz.js} +1 -1
  58. package/lib/{cosmwasm-o9pLVX_k.js → cosmwasm-BU28GqyN.js} +2 -2
  59. package/lib/{cosmwasm-C-wFDXoO.mjs → cosmwasm-i8-2LBd4.mjs} +7 -7
  60. package/lib/{events-BWa5Dt3J.mjs → events-BIfEV615.mjs} +1 -1
  61. package/lib/{events-DPgA7TqX.js → events-CG085uVS.js} +1 -1
  62. package/lib/{evm-SljAss8Z.mjs → evm-BG4p6wWc.mjs} +7 -7
  63. package/lib/{evm-Bo__7sSE.js → evm-DSo1klm4.js} +4 -4
  64. package/lib/{evm-BD__DIo1.mjs → evm-DqVh4NBz.mjs} +5 -5
  65. package/lib/{evm-DDtxPajQ.js → evm-z72BQwjo.js} +1 -1
  66. package/lib/{index-CRvWgES1.js → index--kQS0wX-.js} +1 -1
  67. package/lib/{index-CFxkimTS.mjs → index--orPBbEs.mjs} +3 -3
  68. package/lib/{index-BNk2jOXm.js → index-2u6Q9y32.js} +1 -1
  69. package/lib/{index-xkiQhLtp.mjs → index-3CEBQmCn.mjs} +2 -2
  70. package/lib/{index-B-MBhpe0.js → index-9Ifk_2V6.js} +1 -1
  71. package/lib/{index-BslyDK6y.mjs → index-B-bMfv9J.mjs} +3 -3
  72. package/lib/{index-DPrVdTMi.mjs → index-B3uNul6-.mjs} +3 -3
  73. package/lib/{index-7CTgJQOQ.mjs → index-B51snNHX.mjs} +1 -1
  74. package/lib/{index-LRaD5GwM.mjs → index-BDhzG0Bz.mjs} +6887 -6755
  75. package/lib/{index-C9d-aAW8.mjs → index-BM3TrHYu.mjs} +7 -7
  76. package/lib/{index-Ddkg7QVK.mjs → index-BUcxdUpo.mjs} +2 -2
  77. package/lib/{index-Cm3OT3uK.js → index-BhfoV5RZ.js} +1 -1
  78. package/lib/{index-CvuTcJSI.mjs → index-Bn9MsO0e.mjs} +2 -2
  79. package/lib/{index-Cpxx41dy.js → index-BrFyHtHO.js} +1 -1
  80. package/lib/{index-DrMU1dLJ.js → index-ByG9EJHX.js} +79 -84
  81. package/lib/{index-BD0yz6tu.js → index-C1XMdJFH.js} +1 -1
  82. package/lib/{index-PaF1hgt3.mjs → index-C1fq1xT0.mjs} +2 -2
  83. package/lib/{index-ByFmI7fl.mjs → index-C1t8_dYP.mjs} +1 -1
  84. package/lib/{index-DnW_8WuE.mjs → index-C262JAz4.mjs} +4 -4
  85. package/lib/{index-BrNN7bqh.mjs → index-C2ZrCXVv.mjs} +2 -2
  86. package/lib/{index-BA87Paw9.mjs → index-C3Ztf7te.mjs} +4 -4
  87. package/lib/{index-BYj4cYE2.mjs → index-C8UyzBg3.mjs} +4 -4
  88. package/lib/{index-CVizGyR3.mjs → index-C8tIBuyM.mjs} +1 -1
  89. package/lib/{index-Bvy2urku.js → index-CGmv-GLf.js} +1 -1
  90. package/lib/{index-BQQ1YCDk.js → index-CJJaUncM.js} +1 -1
  91. package/lib/{index-C9ExQapt.js → index-CLiemfL3.js} +1 -1
  92. package/lib/{index-D2X6frcJ.js → index-CQ_e_FtW.js} +1 -1
  93. package/lib/{index-CGWI5MkA.js → index-CYfEuKEC.js} +1 -1
  94. package/lib/{index-DFUaa0TE.js → index-CdnXAZl6.js} +1 -1
  95. package/lib/{index-Bm-ooA-8.js → index-Cf-xLfst.js} +1 -1
  96. package/lib/{index-BJlBMw-S.mjs → index-Cfu2mlWW.mjs} +2 -2
  97. package/lib/{index-w4I6zC7D.js → index-CkrE6mmF.js} +1 -1
  98. package/lib/{index-ma17SOHh.js → index-Coqx-ZYc.js} +1 -1
  99. package/lib/{index-ZhtSUjN2.js → index-CytdQ1id.js} +1 -1
  100. package/lib/{index-CI4Wimyz.js → index-D1GFc9u_.js} +1 -1
  101. package/lib/{index-CihYnnL-.js → index-DEfagu36.js} +1 -1
  102. package/lib/{index-BU0JH9mJ.mjs → index-DGI2tbSC.mjs} +1 -1
  103. package/lib/{index-wz3LbIKe.mjs → index-DTLOaiZ5.mjs} +2 -2
  104. package/lib/{index-B5qZWsrJ.mjs → index-DTj0BYI6.mjs} +1 -1
  105. package/lib/{index-B-J7cTiK.mjs → index-DTtBAHqC.mjs} +2 -2
  106. package/lib/{index-3mar0UQr.mjs → index-DjSK9SdK.mjs} +2 -2
  107. package/lib/{index-CdREPuOV.js → index-DkmEXbbA.js} +1 -1
  108. package/lib/{index-D2Tw2fd0.js → index-GyFHGs5Z.js} +1 -1
  109. package/lib/{index-pZcxlLhg.mjs → index-Xxsx46yX.mjs} +1 -1
  110. package/lib/{index-W02R6fpy.js → index-eY_q88kc.js} +1 -1
  111. package/lib/{index-CjlxucQW.mjs → index-l3VuXtv4.mjs} +2 -2
  112. package/lib/{index-CQz5TuuG.js → index-x3yNXPc-.js} +1 -1
  113. package/lib/{index-C7jTj2To.js → index-xrevpHY6.js} +1 -1
  114. package/lib/{index.es-tANmFq-b.js → index.es-CTYy3A6V.js} +2 -2
  115. package/lib/{index.es-CKfzoruR.mjs → index.es-zlUSra_a.mjs} +5 -5
  116. package/lib/index.js +1 -1
  117. package/lib/index.mjs +1 -1
  118. package/lib/{libsodium-wrappers-2v8zIqd0.mjs → libsodium-wrappers-BL6m46dv.mjs} +1 -1
  119. package/lib/{libsodium-wrappers-BUvbW9gF.js → libsodium-wrappers-_Sv3nUjE.js} +1 -1
  120. package/lib/{pako.esm-BMyUH3EC.mjs → pako.esm-Bf33_673.mjs} +3 -3
  121. package/lib/{pako.esm-BYIheyHK.js → pako.esm-CEjOh_1P.js} +1 -1
  122. package/lib/{pbkdf2-UD0Tc_gW.js → pbkdf2-BJ3CFykt.js} +1 -1
  123. package/lib/{pbkdf2-Cs0L5Yy1.mjs → pbkdf2-C3vdgkb4.mjs} +1 -1
  124. package/lib/{sei-xJVzoq-b.mjs → sei-BXWrZef6.mjs} +4 -4
  125. package/lib/{sei-SvEHSilI.js → sei-LGYYUG8M.js} +1 -1
  126. package/lib/{signer-DXjyd0up.js → signer-BQ4T60Nz.js} +1 -1
  127. package/lib/{signer-BxofHac_.mjs → signer-DaJj3hCp.mjs} +1 -1
  128. package/lib/solana-6EZacoKb.js +1 -0
  129. package/lib/{solana-ySRMXxyQ.js → solana-AQlZomQ6.js} +1 -1
  130. package/lib/solana-CbB3tRah.mjs +16 -0
  131. package/lib/{solana-DcACAvjT.mjs → solana-Cl4jwD2F.mjs} +4 -4
  132. package/lib/{solanaEmbed.esm-Df1M0bDZ.js → solanaEmbed.esm-B_5axZif.js} +1 -1
  133. package/lib/{solanaEmbed.esm-DBTvwrFj.mjs → solanaEmbed.esm-DEMxZG02.mjs} +4 -4
  134. package/lib/src/config/index.d.ts.map +1 -1
  135. package/lib/src/config/types.d.ts +0 -8
  136. package/lib/src/config/types.d.ts.map +1 -1
  137. package/lib/src/config/ui.d.ts +1 -0
  138. package/lib/src/config/ui.d.ts.map +1 -1
  139. package/lib/src/hooks/useAmountValidation.d.ts +1 -0
  140. package/lib/src/hooks/useAmountValidation.d.ts.map +1 -1
  141. package/lib/src/hooks/useTransactionHistoryMayan.d.ts.map +1 -1
  142. package/lib/src/hooks/useTransactionHistoryWHScan.d.ts.map +1 -1
  143. package/lib/src/icons/PoweredBy.d.ts.map +1 -1
  144. package/lib/src/icons/Tokens/KLAY.d.ts.map +1 -1
  145. package/lib/src/icons/TxReadyForClaim.d.ts +5 -0
  146. package/lib/src/icons/TxReadyForClaim.d.ts.map +1 -0
  147. package/lib/src/routes/sdkv2/route.d.ts.map +1 -1
  148. package/lib/src/store/index.d.ts +0 -2
  149. package/lib/src/store/index.d.ts.map +1 -1
  150. package/lib/src/store/transferInput.d.ts +1 -3
  151. package/lib/src/store/transferInput.d.ts.map +1 -1
  152. package/lib/src/telemetry/index.d.ts +6 -1
  153. package/lib/src/telemetry/index.d.ts.map +1 -1
  154. package/lib/src/utils/errors.d.ts.map +1 -1
  155. package/lib/src/utils/index.d.ts +2 -0
  156. package/lib/src/utils/index.d.ts.map +1 -1
  157. package/lib/src/utils/style.d.ts +1 -0
  158. package/lib/src/utils/style.d.ts.map +1 -1
  159. package/lib/src/utils/wallet/index.d.ts.map +1 -1
  160. package/lib/src/views/v2/Bridge/AmountInput/index.d.ts.map +1 -1
  161. package/lib/src/views/v2/Bridge/AssetPicker/ChainList.d.ts.map +1 -1
  162. package/lib/src/views/v2/Bridge/AssetPicker/SearchableList/index.d.ts.map +1 -1
  163. package/lib/src/views/v2/Bridge/AssetPicker/TokenList.d.ts.map +1 -1
  164. package/lib/src/views/v2/Bridge/ReviewTransaction/SendError.d.ts +8 -0
  165. package/lib/src/views/v2/Bridge/ReviewTransaction/SendError.d.ts.map +1 -0
  166. package/lib/src/views/v2/Bridge/ReviewTransaction/index.d.ts.map +1 -1
  167. package/lib/src/views/v2/Bridge/Routes/index.d.ts +1 -1
  168. package/lib/src/views/v2/Bridge/Routes/index.d.ts.map +1 -1
  169. package/lib/src/views/v2/Bridge/index.d.ts.map +1 -1
  170. package/lib/src/views/v2/Redeem/TransactionDetails/index.d.ts.map +1 -1
  171. package/lib/src/views/v2/Redeem/index.d.ts.map +1 -1
  172. package/lib/src/views/v2/TxHistory/index.d.ts.map +1 -1
  173. package/lib/{sui-Cyoug3Go.mjs → sui-BpKCqOiX.mjs} +4 -4
  174. package/lib/{sui-8gf1B7bO.mjs → sui-DfdFzATl.mjs} +1 -1
  175. package/lib/{sui-Cke2TbcJ.js → sui-IAt2YxVB.js} +2 -2
  176. package/lib/{sui-BnN9t4QC.js → sui-tX-807Bw.js} +1 -1
  177. package/lib/{unsignedTransaction-BxebONkK.mjs → unsignedTransaction-B1rzGa0o.mjs} +2 -2
  178. package/lib/{unsignedTransaction-eEgPAqvi.js → unsignedTransaction-BzNQ2WFS.js} +1 -1
  179. package/lib/{utils-BvaOEETp.js → utils-DZZcQv7V.js} +1 -1
  180. package/lib/{utils-CpUQ2GWl.mjs → utils-Xa6ErDQY.mjs} +2 -2
  181. package/package.json +3 -3
  182. package/dist/src/components/ChainsModal.d.ts +0 -19
  183. package/dist/src/components/ChainsModal.d.ts.map +0 -1
  184. package/dist/src/components/ConnectWallet.d.ts +0 -11
  185. package/dist/src/components/ConnectWallet.d.ts.map +0 -1
  186. package/dist/src/components/Input.d.ts +0 -8
  187. package/dist/src/components/Input.d.ts.map +0 -1
  188. package/dist/src/components/InputContainer.d.ts +0 -11
  189. package/dist/src/components/InputContainer.d.ts.map +0 -1
  190. package/dist/src/components/Menu.d.ts +0 -3
  191. package/dist/src/components/Menu.d.ts.map +0 -1
  192. package/dist/src/components/Options.d.ts +0 -16
  193. package/dist/src/components/Options.d.ts.map +0 -1
  194. package/dist/src/components/Price.d.ts +0 -8
  195. package/dist/src/components/Price.d.ts.map +0 -1
  196. package/dist/src/components/RenderRows.d.ts +0 -9
  197. package/dist/src/components/RenderRows.d.ts.map +0 -1
  198. package/dist/src/components/Scroll.d.ts +0 -9
  199. package/dist/src/components/Scroll.d.ts.map +0 -1
  200. package/dist/src/components/Stepper/Stepper.d.ts +0 -14
  201. package/dist/src/components/Stepper/Stepper.d.ts.map +0 -1
  202. package/dist/src/components/Stepper/StepperContent.d.ts +0 -11
  203. package/dist/src/components/Stepper/StepperContent.d.ts.map +0 -1
  204. package/dist/src/components/Stepper/StepperLabel.d.ts +0 -11
  205. package/dist/src/components/Stepper/StepperLabel.d.ts.map +0 -1
  206. package/dist/src/components/Tabs.d.ts +0 -10
  207. package/dist/src/components/Tabs.d.ts.map +0 -1
  208. package/dist/src/components/TokensModal.d.ts +0 -13
  209. package/dist/src/components/TokensModal.d.ts.map +0 -1
  210. package/dist/src/components/Tooltip.d.ts +0 -9
  211. package/dist/src/components/Tooltip.d.ts.map +0 -1
  212. package/dist/src/hooks/useComputeReceiverNativeBalance.d.ts +0 -10
  213. package/dist/src/hooks/useComputeReceiverNativeBalance.d.ts.map +0 -1
  214. package/dist/src/routes/porticoBridge/utils.d.ts +0 -3
  215. package/dist/src/routes/porticoBridge/utils.d.ts.map +0 -1
  216. package/dist/src/routes/relay/index.d.ts +0 -2
  217. package/dist/src/routes/relay/index.d.ts.map +0 -1
  218. package/dist/src/routes/relay/types.d.ts +0 -14
  219. package/dist/src/routes/relay/types.d.ts.map +0 -1
  220. package/dist/src/store/porticoBridge.d.ts +0 -26
  221. package/dist/src/store/porticoBridge.d.ts.map +0 -1
  222. package/dist/src/views/Bridge/Bridge.d.ts +0 -4
  223. package/dist/src/views/Bridge/Bridge.d.ts.map +0 -1
  224. package/dist/src/views/Bridge/ChainTile.d.ts +0 -11
  225. package/dist/src/views/Bridge/ChainTile.d.ts.map +0 -1
  226. package/dist/src/views/Bridge/Collapse.d.ts +0 -22
  227. package/dist/src/views/Bridge/Collapse.d.ts.map +0 -1
  228. package/dist/src/views/Bridge/Inputs/AmountInput.d.ts +0 -12
  229. package/dist/src/views/Bridge/Inputs/AmountInput.d.ts.map +0 -1
  230. package/dist/src/views/Bridge/Inputs/From.d.ts +0 -4
  231. package/dist/src/views/Bridge/Inputs/From.d.ts.map +0 -1
  232. package/dist/src/views/Bridge/Inputs/Input.d.ts +0 -13
  233. package/dist/src/views/Bridge/Inputs/Input.d.ts.map +0 -1
  234. package/dist/src/views/Bridge/Inputs/Inputs.d.ts +0 -23
  235. package/dist/src/views/Bridge/Inputs/Inputs.d.ts.map +0 -1
  236. package/dist/src/views/Bridge/Inputs/Select.d.ts +0 -19
  237. package/dist/src/views/Bridge/Inputs/Select.d.ts.map +0 -1
  238. package/dist/src/views/Bridge/Inputs/To.d.ts +0 -4
  239. package/dist/src/views/Bridge/Inputs/To.d.ts.map +0 -1
  240. package/dist/src/views/Bridge/Inputs/TokenWarnings.d.ts +0 -8
  241. package/dist/src/views/Bridge/Inputs/TokenWarnings.d.ts.map +0 -1
  242. package/dist/src/views/Bridge/NativeGasSlider.d.ts +0 -6
  243. package/dist/src/views/Bridge/NativeGasSlider.d.ts.map +0 -1
  244. package/dist/src/views/Bridge/Preview.d.ts +0 -6
  245. package/dist/src/views/Bridge/Preview.d.ts.map +0 -1
  246. package/dist/src/views/Bridge/RouteOptions.d.ts +0 -9
  247. package/dist/src/views/Bridge/RouteOptions.d.ts.map +0 -1
  248. package/dist/src/views/Bridge/Send.d.ts +0 -6
  249. package/dist/src/views/Bridge/Send.d.ts.map +0 -1
  250. package/dist/src/views/Bridge/SwapChains.d.ts +0 -4
  251. package/dist/src/views/Bridge/SwapChains.d.ts.map +0 -1
  252. package/dist/src/views/Bridge/ValidationError.d.ts +0 -10
  253. package/dist/src/views/Bridge/ValidationError.d.ts.map +0 -1
  254. package/dist/src/views/Redeem/AddToWallet.d.ts +0 -4
  255. package/dist/src/views/Redeem/AddToWallet.d.ts.map +0 -1
  256. package/dist/src/views/Redeem/BridgeComplete.d.ts +0 -4
  257. package/dist/src/views/Redeem/BridgeComplete.d.ts.map +0 -1
  258. package/dist/src/views/Redeem/Confirmations.d.ts +0 -9
  259. package/dist/src/views/Redeem/Confirmations.d.ts.map +0 -1
  260. package/dist/src/views/Redeem/DestinationQueued.d.ts +0 -4
  261. package/dist/src/views/Redeem/DestinationQueued.d.ts.map +0 -1
  262. package/dist/src/views/Redeem/ExplorerLink.d.ts +0 -20
  263. package/dist/src/views/Redeem/ExplorerLink.d.ts.map +0 -1
  264. package/dist/src/views/Redeem/Header.d.ts +0 -14
  265. package/dist/src/views/Redeem/Header.d.ts.map +0 -1
  266. package/dist/src/views/Redeem/Redeem.d.ts +0 -18
  267. package/dist/src/views/Redeem/Redeem.d.ts.map +0 -1
  268. package/dist/src/views/Redeem/RelayerDeliveryFailed.d.ts +0 -4
  269. package/dist/src/views/Redeem/RelayerDeliveryFailed.d.ts.map +0 -1
  270. package/dist/src/views/Redeem/SendFrom.d.ts +0 -4
  271. package/dist/src/views/Redeem/SendFrom.d.ts.map +0 -1
  272. package/dist/src/views/Redeem/SendTo.d.ts +0 -4
  273. package/dist/src/views/Redeem/SendTo.d.ts.map +0 -1
  274. package/dist/src/views/Redeem/Stepper.d.ts +0 -3
  275. package/dist/src/views/Redeem/Stepper.d.ts.map +0 -1
  276. package/dist/src/views/Redeem/SwitchToManualClaim.d.ts +0 -9
  277. package/dist/src/views/Redeem/SwitchToManualClaim.d.ts.map +0 -1
  278. package/dist/src/views/Redeem/Tag.d.ts +0 -4
  279. package/dist/src/views/Redeem/Tag.d.ts.map +0 -1
  280. package/dist/src/views/WalletModal.d.ts +0 -11
  281. package/dist/src/views/WalletModal.d.ts.map +0 -1
  282. package/lib/solana-B82b4Mp_.js +0 -1
  283. package/lib/solana-BureHx9-.mjs +0 -16
  284. package/lib/src/components/ChainsModal.d.ts +0 -19
  285. package/lib/src/components/ChainsModal.d.ts.map +0 -1
  286. package/lib/src/components/ConnectWallet.d.ts +0 -11
  287. package/lib/src/components/ConnectWallet.d.ts.map +0 -1
  288. package/lib/src/components/Input.d.ts +0 -8
  289. package/lib/src/components/Input.d.ts.map +0 -1
  290. package/lib/src/components/InputContainer.d.ts +0 -11
  291. package/lib/src/components/InputContainer.d.ts.map +0 -1
  292. package/lib/src/components/Menu.d.ts +0 -3
  293. package/lib/src/components/Menu.d.ts.map +0 -1
  294. package/lib/src/components/Options.d.ts +0 -16
  295. package/lib/src/components/Options.d.ts.map +0 -1
  296. package/lib/src/components/Price.d.ts +0 -8
  297. package/lib/src/components/Price.d.ts.map +0 -1
  298. package/lib/src/components/RenderRows.d.ts +0 -9
  299. package/lib/src/components/RenderRows.d.ts.map +0 -1
  300. package/lib/src/components/Scroll.d.ts +0 -9
  301. package/lib/src/components/Scroll.d.ts.map +0 -1
  302. package/lib/src/components/Stepper/Stepper.d.ts +0 -14
  303. package/lib/src/components/Stepper/Stepper.d.ts.map +0 -1
  304. package/lib/src/components/Stepper/StepperContent.d.ts +0 -11
  305. package/lib/src/components/Stepper/StepperContent.d.ts.map +0 -1
  306. package/lib/src/components/Stepper/StepperLabel.d.ts +0 -11
  307. package/lib/src/components/Stepper/StepperLabel.d.ts.map +0 -1
  308. package/lib/src/components/Tabs.d.ts +0 -10
  309. package/lib/src/components/Tabs.d.ts.map +0 -1
  310. package/lib/src/components/TokensModal.d.ts +0 -13
  311. package/lib/src/components/TokensModal.d.ts.map +0 -1
  312. package/lib/src/components/Tooltip.d.ts +0 -9
  313. package/lib/src/components/Tooltip.d.ts.map +0 -1
  314. package/lib/src/hooks/useComputeReceiverNativeBalance.d.ts +0 -10
  315. package/lib/src/hooks/useComputeReceiverNativeBalance.d.ts.map +0 -1
  316. package/lib/src/routes/porticoBridge/utils.d.ts +0 -3
  317. package/lib/src/routes/porticoBridge/utils.d.ts.map +0 -1
  318. package/lib/src/routes/relay/index.d.ts +0 -2
  319. package/lib/src/routes/relay/index.d.ts.map +0 -1
  320. package/lib/src/routes/relay/types.d.ts +0 -14
  321. package/lib/src/routes/relay/types.d.ts.map +0 -1
  322. package/lib/src/store/porticoBridge.d.ts +0 -26
  323. package/lib/src/store/porticoBridge.d.ts.map +0 -1
  324. package/lib/src/views/Bridge/Bridge.d.ts +0 -4
  325. package/lib/src/views/Bridge/Bridge.d.ts.map +0 -1
  326. package/lib/src/views/Bridge/ChainTile.d.ts +0 -11
  327. package/lib/src/views/Bridge/ChainTile.d.ts.map +0 -1
  328. package/lib/src/views/Bridge/Collapse.d.ts +0 -22
  329. package/lib/src/views/Bridge/Collapse.d.ts.map +0 -1
  330. package/lib/src/views/Bridge/Inputs/AmountInput.d.ts +0 -12
  331. package/lib/src/views/Bridge/Inputs/AmountInput.d.ts.map +0 -1
  332. package/lib/src/views/Bridge/Inputs/From.d.ts +0 -4
  333. package/lib/src/views/Bridge/Inputs/From.d.ts.map +0 -1
  334. package/lib/src/views/Bridge/Inputs/Input.d.ts +0 -13
  335. package/lib/src/views/Bridge/Inputs/Input.d.ts.map +0 -1
  336. package/lib/src/views/Bridge/Inputs/Inputs.d.ts +0 -23
  337. package/lib/src/views/Bridge/Inputs/Inputs.d.ts.map +0 -1
  338. package/lib/src/views/Bridge/Inputs/Select.d.ts +0 -19
  339. package/lib/src/views/Bridge/Inputs/Select.d.ts.map +0 -1
  340. package/lib/src/views/Bridge/Inputs/To.d.ts +0 -4
  341. package/lib/src/views/Bridge/Inputs/To.d.ts.map +0 -1
  342. package/lib/src/views/Bridge/Inputs/TokenWarnings.d.ts +0 -8
  343. package/lib/src/views/Bridge/Inputs/TokenWarnings.d.ts.map +0 -1
  344. package/lib/src/views/Bridge/NativeGasSlider.d.ts +0 -6
  345. package/lib/src/views/Bridge/NativeGasSlider.d.ts.map +0 -1
  346. package/lib/src/views/Bridge/Preview.d.ts +0 -6
  347. package/lib/src/views/Bridge/Preview.d.ts.map +0 -1
  348. package/lib/src/views/Bridge/RouteOptions.d.ts +0 -9
  349. package/lib/src/views/Bridge/RouteOptions.d.ts.map +0 -1
  350. package/lib/src/views/Bridge/Send.d.ts +0 -6
  351. package/lib/src/views/Bridge/Send.d.ts.map +0 -1
  352. package/lib/src/views/Bridge/SwapChains.d.ts +0 -4
  353. package/lib/src/views/Bridge/SwapChains.d.ts.map +0 -1
  354. package/lib/src/views/Bridge/ValidationError.d.ts +0 -10
  355. package/lib/src/views/Bridge/ValidationError.d.ts.map +0 -1
  356. package/lib/src/views/Redeem/AddToWallet.d.ts +0 -4
  357. package/lib/src/views/Redeem/AddToWallet.d.ts.map +0 -1
  358. package/lib/src/views/Redeem/BridgeComplete.d.ts +0 -4
  359. package/lib/src/views/Redeem/BridgeComplete.d.ts.map +0 -1
  360. package/lib/src/views/Redeem/Confirmations.d.ts +0 -9
  361. package/lib/src/views/Redeem/Confirmations.d.ts.map +0 -1
  362. package/lib/src/views/Redeem/DestinationQueued.d.ts +0 -4
  363. package/lib/src/views/Redeem/DestinationQueued.d.ts.map +0 -1
  364. package/lib/src/views/Redeem/ExplorerLink.d.ts +0 -20
  365. package/lib/src/views/Redeem/ExplorerLink.d.ts.map +0 -1
  366. package/lib/src/views/Redeem/Header.d.ts +0 -14
  367. package/lib/src/views/Redeem/Header.d.ts.map +0 -1
  368. package/lib/src/views/Redeem/Redeem.d.ts +0 -18
  369. package/lib/src/views/Redeem/Redeem.d.ts.map +0 -1
  370. package/lib/src/views/Redeem/RelayerDeliveryFailed.d.ts +0 -4
  371. package/lib/src/views/Redeem/RelayerDeliveryFailed.d.ts.map +0 -1
  372. package/lib/src/views/Redeem/SendFrom.d.ts +0 -4
  373. package/lib/src/views/Redeem/SendFrom.d.ts.map +0 -1
  374. package/lib/src/views/Redeem/SendTo.d.ts +0 -4
  375. package/lib/src/views/Redeem/SendTo.d.ts.map +0 -1
  376. package/lib/src/views/Redeem/Stepper.d.ts +0 -3
  377. package/lib/src/views/Redeem/Stepper.d.ts.map +0 -1
  378. package/lib/src/views/Redeem/SwitchToManualClaim.d.ts +0 -9
  379. package/lib/src/views/Redeem/SwitchToManualClaim.d.ts.map +0 -1
  380. package/lib/src/views/Redeem/Tag.d.ts +0 -4
  381. package/lib/src/views/Redeem/Tag.d.ts.map +0 -1
  382. package/lib/src/views/WalletModal.d.ts +0 -11
  383. package/lib/src/views/WalletModal.d.ts.map +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-B3CIvGYj.js","main.js","main.css"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-B9_Snb-C.js","main.js","main.css"])))=>i.map(i=>d[i]);
2
2
  import{a6 as No,P as dw,i as he,s as fw,_ as gw}from"../main.js";import{e as _t,D as $o}from"./events-DdSQsqMQ.js";import{s as Rh,f as Nh,a as $h,d as Ch,c as z,g as yw,b as Co,e as Ah,h as xh,x as Th,r as Dh,H as mw,i as qh,j as vw}from"./index-D_Ma8HLw.js";import{I as ur,f as dt,t as st,c as bu,C as ww,d as _w,r as bw,a as Cr,g as jh,i as wt,b as Ps,W as Ew,E as ze,y as We,o as Ss,k as Os,h as Iw,e as Eu,j as Pw,s as Sw,l as po,m as Uh,n as Ow,p as Ao,q as Rs,u as xo,v as Kt,w as Rw,x as Iu,z as Nw}from"./index-C4JegU33.js";import{o as Pu}from"./browser-ponyfill-D00zta0o.js";var $w={};(function(a){const t=$h,r=Ch,s=Rh,o=Nh,u=f=>f==null,l=Symbol("encodeFragmentIdentifier");function y(f){switch(f.arrayFormat){case"index":return m=>(w,_)=>{const P=w.length;return _===void 0||f.skipNull&&_===null||f.skipEmptyString&&_===""?w:_===null?[...w,[R(m,f),"[",P,"]"].join("")]:[...w,[R(m,f),"[",R(P,f),"]=",R(_,f)].join("")]};case"bracket":return m=>(w,_)=>_===void 0||f.skipNull&&_===null||f.skipEmptyString&&_===""?w:_===null?[...w,[R(m,f),"[]"].join("")]:[...w,[R(m,f),"[]=",R(_,f)].join("")];case"colon-list-separator":return m=>(w,_)=>_===void 0||f.skipNull&&_===null||f.skipEmptyString&&_===""?w:_===null?[...w,[R(m,f),":list="].join("")]:[...w,[R(m,f),":list=",R(_,f)].join("")];case"comma":case"separator":case"bracket-separator":{const m=f.arrayFormat==="bracket-separator"?"[]=":"=";return w=>(_,P)=>P===void 0||f.skipNull&&P===null||f.skipEmptyString&&P===""?_:(P=P===null?"":P,_.length===0?[[R(w,f),m,R(P,f)].join("")]:[[_,R(P,f)].join(f.arrayFormatSeparator)])}default:return m=>(w,_)=>_===void 0||f.skipNull&&_===null||f.skipEmptyString&&_===""?w:_===null?[...w,R(m,f)]:[...w,[R(m,f),"=",R(_,f)].join("")]}}function I(f){let m;switch(f.arrayFormat){case"index":return(w,_,P)=>{if(m=/\[(\d*)\]$/.exec(w),w=w.replace(/\[\d*\]$/,""),!m){P[w]=_;return}P[w]===void 0&&(P[w]={}),P[w][m[1]]=_};case"bracket":return(w,_,P)=>{if(m=/(\[\])$/.exec(w),w=w.replace(/\[\]$/,""),!m){P[w]=_;return}if(P[w]===void 0){P[w]=[_];return}P[w]=[].concat(P[w],_)};case"colon-list-separator":return(w,_,P)=>{if(m=/(:list)$/.exec(w),w=w.replace(/:list$/,""),!m){P[w]=_;return}if(P[w]===void 0){P[w]=[_];return}P[w]=[].concat(P[w],_)};case"comma":case"separator":return(w,_,P)=>{const j=typeof _=="string"&&_.includes(f.arrayFormatSeparator),T=typeof _=="string"&&!j&&A(_,f).includes(f.arrayFormatSeparator);_=T?A(_,f):_;const Z=j||T?_.split(f.arrayFormatSeparator).map(Ur=>A(Ur,f)):_===null?_:A(_,f);P[w]=Z};case"bracket-separator":return(w,_,P)=>{const j=/(\[\])$/.test(w);if(w=w.replace(/\[\]$/,""),!j){P[w]=_&&A(_,f);return}const T=_===null?[]:_.split(f.arrayFormatSeparator).map(Z=>A(Z,f));if(P[w]===void 0){P[w]=T;return}P[w]=[].concat(P[w],T)};default:return(w,_,P)=>{if(P[w]===void 0){P[w]=_;return}P[w]=[].concat(P[w],_)}}}function S(f){if(typeof f!="string"||f.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function R(f,m){return m.encode?m.strict?t(f):encodeURIComponent(f):f}function A(f,m){return m.decode?r(f):f}function D(f){return Array.isArray(f)?f.sort():typeof f=="object"?D(Object.keys(f)).sort((m,w)=>Number(m)-Number(w)).map(m=>f[m]):f}function K(f){const m=f.indexOf("#");return m!==-1&&(f=f.slice(0,m)),f}function k(f){let m="";const w=f.indexOf("#");return w!==-1&&(m=f.slice(w)),m}function te(f){f=K(f);const m=f.indexOf("?");return m===-1?"":f.slice(m+1)}function ie(f,m){return m.parseNumbers&&!Number.isNaN(Number(f))&&typeof f=="string"&&f.trim()!==""?f=Number(f):m.parseBooleans&&f!==null&&(f.toLowerCase()==="true"||f.toLowerCase()==="false")&&(f=f.toLowerCase()==="true"),f}function se(f,m){m=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},m),S(m.arrayFormatSeparator);const w=I(m),_=Object.create(null);if(typeof f!="string"||(f=f.trim().replace(/^[?#&]/,""),!f))return _;for(const P of f.split("&")){if(P==="")continue;let[j,T]=s(m.decode?P.replace(/\+/g," "):P,"=");T=T===void 0?null:["comma","separator","bracket-separator"].includes(m.arrayFormat)?T:A(T,m),w(A(j,m),T,_)}for(const P of Object.keys(_)){const j=_[P];if(typeof j=="object"&&j!==null)for(const T of Object.keys(j))j[T]=ie(j[T],m);else _[P]=ie(j,m)}return m.sort===!1?_:(m.sort===!0?Object.keys(_).sort():Object.keys(_).sort(m.sort)).reduce((P,j)=>{const T=_[j];return T&&typeof T=="object"&&!Array.isArray(T)?P[j]=D(T):P[j]=T,P},Object.create(null))}a.extract=te,a.parse=se,a.stringify=(f,m)=>{if(!f)return"";m=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},m),S(m.arrayFormatSeparator);const w=T=>m.skipNull&&u(f[T])||m.skipEmptyString&&f[T]==="",_=y(m),P={};for(const T of Object.keys(f))w(T)||(P[T]=f[T]);const j=Object.keys(P);return m.sort!==!1&&j.sort(m.sort),j.map(T=>{const Z=f[T];return Z===void 0?"":Z===null?R(T,m):Array.isArray(Z)?Z.length===0&&m.arrayFormat==="bracket-separator"?R(T,m)+"[]":Z.reduce(_(T),[]).join("&"):R(T,m)+"="+R(Z,m)}).filter(T=>T.length>0).join("&")},a.parseUrl=(f,m)=>{m=Object.assign({decode:!0},m);const[w,_]=s(f,"#");return Object.assign({url:w.split("?")[0]||"",query:se(te(f),m)},m&&m.parseFragmentIdentifier&&_?{fragmentIdentifier:A(_,m)}:{})},a.stringifyUrl=(f,m)=>{m=Object.assign({encode:!0,strict:!0,[l]:!0},m);const w=K(f.url).split("?")[0]||"",_=a.extract(f.url),P=a.parse(_,{sort:!1}),j=Object.assign(P,f.query);let T=a.stringify(j,m);T&&(T=`?${T}`);let Z=k(f.url);return f.fragmentIdentifier&&(Z=`#${m[l]?R(f.fragmentIdentifier,m):f.fragmentIdentifier}`),`${w}${T}${Z}`},a.pick=(f,m,w)=>{w=Object.assign({parseFragmentIdentifier:!0,[l]:!1},w);const{url:_,query:P,fragmentIdentifier:j}=a.parseUrl(f,w);return a.stringifyUrl({url:_,query:o(P,m),fragmentIdentifier:j},w)},a.exclude=(f,m,w)=>{const _=Array.isArray(m)?P=>!m.includes(P):(P,j)=>!m(P,j);return a.pick(f,_,w)}})($w);function Cw(a,t=[]){const r=[];return Object.keys(a).forEach(s=>{if(t.length&&!t.includes(s))return;const o=a[s];r.push(...o.accounts)}),r}const Aw={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}};function xw(a,t){const{message:r,code:s}=Aw[a];return{message:r,code:s}}function fo(a,t){return!!Array.isArray(a)}var Tr={};/*! *****************************************************************************
3
3
  Copyright (c) Microsoft Corporation.
4
4
 
@@ -44,4 +44,4 @@ __p += '`),ee&&(x+=`' +
44
44
  function print() { __p += __j.call(arguments, '') }
45
45
  `:`;
46
46
  `)+x+`return __p
47
- }`;var Q=vu(function(){return re(d,L+"return "+x).apply(r,g)});if(Q.source=x,Hn(Q))throw Q;return Q}function _v(e){return ne(e).toLowerCase()}function bv(e){return ne(e).toUpperCase()}function Ev(e,i,n){if(e=ne(e),e&&(n||i===r))return Ra(e);if(!e||!(i=Ve(i)))return e;var c=at(e),h=at(i),d=Na(c,h),g=$a(c,h)+1;return Vt(c,d,g).join("")}function Iv(e,i,n){if(e=ne(e),e&&(n||i===r))return e.slice(0,Aa(e)+1);if(!e||!(i=Ve(i)))return e;var c=at(e),h=$a(c,at(i))+1;return Vt(c,0,h).join("")}function Pv(e,i,n){if(e=ne(e),e&&(n||i===r))return e.replace(ks,"");if(!e||!(i=Ve(i)))return e;var c=at(e),h=Na(c,at(i));return Vt(c,h).join("")}function Sv(e,i){var n=Ur,c=vl;if(de(i)){var h="separator"in i?i.separator:h;n="length"in i?W(i.length):n,c="omission"in i?Ve(i.omission):c}e=ne(e);var d=e.length;if(yr(e)){var g=at(e);d=g.length}if(n>=d)return e;var v=n-mr(c);if(v<1)return c;var E=g?Vt(g,0,v).join(""):e.slice(0,v);if(h===r)return E+c;if(g&&(v+=E.length-v),Vn(h)){if(e.slice(v).search(h)){var $,C=E;for(h.global||(h=nn(h.source,ne(Qo.exec(h))+"g")),h.lastIndex=0;$=h.exec(C);)var x=$.index;E=E.slice(0,x===r?v:x)}}else if(e.indexOf(Ve(h),v)!=v){var U=E.lastIndexOf(h);U>-1&&(E=E.slice(0,U))}return E+c}function Ov(e){return e=ne(e),e&&jl.test(e)?e.replace(Bo,ed):e}var Rv=Pr(function(e,i,n){return e+(n?" ":"")+i.toUpperCase()}),Bn=wc("toUpperCase");function mu(e,i,n){return e=ne(e),i=n?r:i,i===r?Qp(e)?id(e):zp(e):e.match(i)||[]}var vu=J(function(e,i){try{return ke(e,r,i)}catch(n){return Hn(n)?n:new B(n)}}),Nv=Ot(function(e,i){return Je(i,function(n){n=mt(n),Pt(e,n,zn(e[n],e))}),e});function $v(e){var i=e==null?0:e.length,n=H();return e=i?le(e,function(c){if(typeof c[1]!="function")throw new Ye(l);return[n(c[0]),c[1]]}):[],J(function(c){for(var h=-1;++h<i;){var d=e[h];if(ke(d[0],this,c))return ke(d[1],this,c)}})}function Cv(e){return ef(Xe(e,A))}function Gn(e){return function(){return e}}function Av(e,i){return e==null||e!==e?i:e}var xv=bc(),Tv=bc(!0);function je(e){return e}function Wn(e){return Ya(typeof e=="function"?e:Xe(e,A))}function Dv(e){return Xa(Xe(e,A))}function qv(e,i){return ec(e,Xe(i,A))}var jv=J(function(e,i){return function(n){return Xr(n,e,i)}}),Uv=J(function(e,i){return function(n){return Xr(e,n,i)}});function Qn(e,i,n){var c=be(i),h=Qi(i,c);n==null&&!(de(i)&&(h.length||!c.length))&&(n=i,i=e,e=this,h=Qi(i,be(i)));var d=!(de(n)&&"chain"in n)||!!n.chain,g=Nt(e);return Je(h,function(v){var E=i[v];e[v]=E,g&&(e.prototype[v]=function(){var $=this.__chain__;if(d||$){var C=e(this.__wrapped__),x=C.__actions__=Te(this.__actions__);return x.push({func:E,args:arguments,thisArg:e}),C.__chain__=$,C}return E.apply(e,Ut([this.value()],arguments))})}),e}function Mv(){return Ie._===this&&(Ie._=ud),this}function Jn(){}function Lv(e){return e=W(e),J(function(i){return tc(i,e)})}var zv=Rn(le),kv=Rn(Ea),Hv=Rn(Ys);function wu(e){return Dn(e)?Zs(mt(e)):vf(e)}function Vv(e){return function(i){return e==null?r:rr(e,i)}}var Fv=Ic(),Kv=Ic(!0);function Yn(){return[]}function Zn(){return!1}function Bv(){return{}}function Gv(){return""}function Wv(){return!0}function Qv(e,i){if(e=W(e),e<1||e>qt)return[];var n=ft,c=Oe(e,ft);i=H(i),e-=ft;for(var h=tn(c,i);++n<e;)i(n);return h}function Jv(e){return G(e)?le(e,mt):Fe(e)?[e]:Te(Lc(ne(e)))}function Yv(e){var i=++ad;return ne(e)+i}var Zv=ts(function(e,i){return e+i},0),Xv=Nn("ceil"),ew=ts(function(e,i){return e/i},1),tw=Nn("floor");function rw(e){return e&&e.length?Wi(e,je,dn):r}function iw(e,i){return e&&e.length?Wi(e,H(i,2),dn):r}function sw(e){return Sa(e,je)}function nw(e,i){return Sa(e,H(i,2))}function ow(e){return e&&e.length?Wi(e,je,mn):r}function aw(e,i){return e&&e.length?Wi(e,H(i,2),mn):r}var cw=ts(function(e,i){return e*i},1),uw=Nn("round"),hw=ts(function(e,i){return e-i},0);function lw(e){return e&&e.length?en(e,je):0}function pw(e,i){return e&&e.length?en(e,H(i,2)):0}return p.after=Dy,p.ary=Jc,p.assign=bm,p.assignIn=hu,p.assignInWith=fs,p.assignWith=Em,p.at=Im,p.before=Yc,p.bind=zn,p.bindAll=Nv,p.bindKey=Zc,p.castArray=By,p.chain=Gc,p.chunk=tg,p.compact=rg,p.concat=ig,p.cond=$v,p.conforms=Cv,p.constant=Gn,p.countBy=ly,p.create=Pm,p.curry=Xc,p.curryRight=eu,p.debounce=tu,p.defaults=Sm,p.defaultsDeep=Om,p.defer=qy,p.delay=jy,p.difference=sg,p.differenceBy=ng,p.differenceWith=og,p.drop=ag,p.dropRight=cg,p.dropRightWhile=ug,p.dropWhile=hg,p.fill=lg,p.filter=dy,p.flatMap=yy,p.flatMapDeep=my,p.flatMapDepth=vy,p.flatten=Vc,p.flattenDeep=pg,p.flattenDepth=dg,p.flip=Uy,p.flow=xv,p.flowRight=Tv,p.fromPairs=fg,p.functions=Tm,p.functionsIn=Dm,p.groupBy=wy,p.initial=yg,p.intersection=mg,p.intersectionBy=vg,p.intersectionWith=wg,p.invert=jm,p.invertBy=Um,p.invokeMap=by,p.iteratee=Wn,p.keyBy=Ey,p.keys=be,p.keysIn=qe,p.map=cs,p.mapKeys=Lm,p.mapValues=zm,p.matches=Dv,p.matchesProperty=qv,p.memoize=hs,p.merge=km,p.mergeWith=lu,p.method=jv,p.methodOf=Uv,p.mixin=Qn,p.negate=ls,p.nthArg=Lv,p.omit=Hm,p.omitBy=Vm,p.once=My,p.orderBy=Iy,p.over=zv,p.overArgs=Ly,p.overEvery=kv,p.overSome=Hv,p.partial=kn,p.partialRight=ru,p.partition=Py,p.pick=Fm,p.pickBy=pu,p.property=wu,p.propertyOf=Vv,p.pull=Ig,p.pullAll=Kc,p.pullAllBy=Pg,p.pullAllWith=Sg,p.pullAt=Og,p.range=Fv,p.rangeRight=Kv,p.rearg=zy,p.reject=Ry,p.remove=Rg,p.rest=ky,p.reverse=Mn,p.sampleSize=$y,p.set=Bm,p.setWith=Gm,p.shuffle=Cy,p.slice=Ng,p.sortBy=Ty,p.sortedUniq=qg,p.sortedUniqBy=jg,p.split=yv,p.spread=Hy,p.tail=Ug,p.take=Mg,p.takeRight=Lg,p.takeRightWhile=zg,p.takeWhile=kg,p.tap=ry,p.throttle=Vy,p.thru=as,p.toArray=au,p.toPairs=du,p.toPairsIn=fu,p.toPath=Jv,p.toPlainObject=uu,p.transform=Wm,p.unary=Fy,p.union=Hg,p.unionBy=Vg,p.unionWith=Fg,p.uniq=Kg,p.uniqBy=Bg,p.uniqWith=Gg,p.unset=Qm,p.unzip=Ln,p.unzipWith=Bc,p.update=Jm,p.updateWith=Ym,p.values=Rr,p.valuesIn=Zm,p.without=Wg,p.words=mu,p.wrap=Ky,p.xor=Qg,p.xorBy=Jg,p.xorWith=Yg,p.zip=Zg,p.zipObject=Xg,p.zipObjectDeep=ey,p.zipWith=ty,p.entries=du,p.entriesIn=fu,p.extend=hu,p.extendWith=fs,Qn(p,p),p.add=Zv,p.attempt=vu,p.camelCase=rv,p.capitalize=gu,p.ceil=Xv,p.clamp=Xm,p.clone=Gy,p.cloneDeep=Qy,p.cloneDeepWith=Jy,p.cloneWith=Wy,p.conformsTo=Yy,p.deburr=yu,p.defaultTo=Av,p.divide=ew,p.endsWith=iv,p.eq=ut,p.escape=sv,p.escapeRegExp=nv,p.every=py,p.find=fy,p.findIndex=kc,p.findKey=Rm,p.findLast=gy,p.findLastIndex=Hc,p.findLastKey=Nm,p.floor=tw,p.forEach=Wc,p.forEachRight=Qc,p.forIn=$m,p.forInRight=Cm,p.forOwn=Am,p.forOwnRight=xm,p.get=Fn,p.gt=Zy,p.gte=Xy,p.has=qm,p.hasIn=Kn,p.head=Fc,p.identity=je,p.includes=_y,p.indexOf=gg,p.inRange=ev,p.invoke=Mm,p.isArguments=nr,p.isArray=G,p.isArrayBuffer=em,p.isArrayLike=De,p.isArrayLikeObject=ge,p.isBoolean=tm,p.isBuffer=Ft,p.isDate=rm,p.isElement=im,p.isEmpty=sm,p.isEqual=nm,p.isEqualWith=om,p.isError=Hn,p.isFinite=am,p.isFunction=Nt,p.isInteger=iu,p.isLength=ps,p.isMap=su,p.isMatch=cm,p.isMatchWith=um,p.isNaN=hm,p.isNative=lm,p.isNil=dm,p.isNull=pm,p.isNumber=nu,p.isObject=de,p.isObjectLike=fe,p.isPlainObject=ni,p.isRegExp=Vn,p.isSafeInteger=fm,p.isSet=ou,p.isString=ds,p.isSymbol=Fe,p.isTypedArray=Or,p.isUndefined=gm,p.isWeakMap=ym,p.isWeakSet=mm,p.join=_g,p.kebabCase=ov,p.last=tt,p.lastIndexOf=bg,p.lowerCase=av,p.lowerFirst=cv,p.lt=vm,p.lte=wm,p.max=rw,p.maxBy=iw,p.mean=sw,p.meanBy=nw,p.min=ow,p.minBy=aw,p.stubArray=Yn,p.stubFalse=Zn,p.stubObject=Bv,p.stubString=Gv,p.stubTrue=Wv,p.multiply=cw,p.nth=Eg,p.noConflict=Mv,p.noop=Jn,p.now=us,p.pad=uv,p.padEnd=hv,p.padStart=lv,p.parseInt=pv,p.random=tv,p.reduce=Sy,p.reduceRight=Oy,p.repeat=dv,p.replace=fv,p.result=Km,p.round=uw,p.runInContext=b,p.sample=Ny,p.size=Ay,p.snakeCase=gv,p.some=xy,p.sortedIndex=$g,p.sortedIndexBy=Cg,p.sortedIndexOf=Ag,p.sortedLastIndex=xg,p.sortedLastIndexBy=Tg,p.sortedLastIndexOf=Dg,p.startCase=mv,p.startsWith=vv,p.subtract=hw,p.sum=lw,p.sumBy=pw,p.template=wv,p.times=Qv,p.toFinite=$t,p.toInteger=W,p.toLength=cu,p.toLower=_v,p.toNumber=rt,p.toSafeInteger=_m,p.toString=ne,p.toUpper=bv,p.trim=Ev,p.trimEnd=Iv,p.trimStart=Pv,p.truncate=Sv,p.unescape=Ov,p.uniqueId=Yv,p.upperCase=Rv,p.upperFirst=Bn,p.each=Wc,p.eachRight=Qc,p.first=Fc,Qn(p,function(){var e={};return gt(p,function(i,n){oe.call(p.prototype,n)||(e[n]=i)}),e}(),{chain:!1}),p.VERSION=s,Je(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){p[e].placeholder=p}),Je(["drop","take"],function(e,i){X.prototype[e]=function(n){n=n===r?1:_e(W(n),0);var c=this.__filtered__&&!i?new X(this):this.clone();return c.__filtered__?c.__takeCount__=Oe(n,c.__takeCount__):c.__views__.push({size:Oe(n,ft),type:e+(c.__dir__<0?"Right":"")}),c},X.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),Je(["filter","map","takeWhile"],function(e,i){var n=i+1,c=n==Vo||n==El;X.prototype[e]=function(h){var d=this.clone();return d.__iteratees__.push({iteratee:H(h,3),type:n}),d.__filtered__=d.__filtered__||c,d}}),Je(["head","last"],function(e,i){var n="take"+(i?"Right":"");X.prototype[e]=function(){return this[n](1).value()[0]}}),Je(["initial","tail"],function(e,i){var n="drop"+(i?"":"Right");X.prototype[e]=function(){return this.__filtered__?new X(this):this[n](1)}}),X.prototype.compact=function(){return this.filter(je)},X.prototype.find=function(e){return this.filter(e).head()},X.prototype.findLast=function(e){return this.reverse().find(e)},X.prototype.invokeMap=J(function(e,i){return typeof e=="function"?new X(this):this.map(function(n){return Xr(n,e,i)})}),X.prototype.reject=function(e){return this.filter(ls(H(e)))},X.prototype.slice=function(e,i){e=W(e);var n=this;return n.__filtered__&&(e>0||i<0)?new X(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),i!==r&&(i=W(i),n=i<0?n.dropRight(-i):n.take(i-e)),n)},X.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},X.prototype.toArray=function(){return this.take(ft)},gt(X.prototype,function(e,i){var n=/^(?:filter|find|map|reject)|While$/.test(i),c=/^(?:head|last)$/.test(i),h=p[c?"take"+(i=="last"?"Right":""):i],d=c||/^find/.test(i);h&&(p.prototype[i]=function(){var g=this.__wrapped__,v=c?[1]:arguments,E=g instanceof X,$=v[0],C=E||G(g),x=function(Y){var ee=h.apply(p,Ut([Y],v));return c&&U?ee[0]:ee};C&&n&&typeof $=="function"&&$.length!=1&&(E=C=!1);var U=this.__chain__,L=!!this.__actions__.length,V=d&&!U,Q=E&&!L;if(!d&&C){g=Q?g:new X(this);var F=e.apply(g,v);return F.__actions__.push({func:as,args:[x],thisArg:r}),new Ze(F,U)}return V&&Q?e.apply(this,v):(F=this.thru(x),V?c?F.value()[0]:F.value():F)})}),Je(["pop","push","shift","sort","splice","unshift"],function(e){var i=Ti[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",c=/^(?:pop|shift)$/.test(e);p.prototype[e]=function(){var h=arguments;if(c&&!this.__chain__){var d=this.value();return i.apply(G(d)?d:[],h)}return this[n](function(g){return i.apply(G(g)?g:[],h)})}}),gt(X.prototype,function(e,i){var n=p[i];if(n){var c=n.name+"";oe.call(br,c)||(br[c]=[]),br[c].push({name:i,func:n})}}),br[es(r,se).name]=[{name:"wrapper",func:r}],X.prototype.clone=Sd,X.prototype.reverse=Od,X.prototype.value=Rd,p.prototype.at=iy,p.prototype.chain=sy,p.prototype.commit=ny,p.prototype.next=oy,p.prototype.plant=cy,p.prototype.reverse=uy,p.prototype.toJSON=p.prototype.valueOf=p.prototype.value=hy,p.prototype.first=p.prototype.head,Br&&(p.prototype[Br]=ay),p},vr=sd();Yt?((Yt.exports=vr)._=vr,Gs._=vr):Ie._=vr}).call(pi)})(So,So.exports);var L1=Object.defineProperty,z1=Object.defineProperties,k1=Object.getOwnPropertyDescriptors,wh=Object.getOwnPropertySymbols,H1=Object.prototype.hasOwnProperty,V1=Object.prototype.propertyIsEnumerable,_h=(a,t,r)=>t in a?L1(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r,ms=(a,t)=>{for(var r in t||(t={}))H1.call(t,r)&&_h(a,r,t[r]);if(wh)for(var r of wh(t))V1.call(t,r)&&_h(a,r,t[r]);return a},F1=(a,t)=>z1(a,k1(t));function Wt(a,t,r){var s;const o=m_(a);return((s=t.rpcMap)==null?void 0:s[o.reference])||`${M1}?chainId=${o.namespace}:${o.reference}&projectId=${r}`}function lr(a){return a.includes(":")?a.split(":")[1]:a}function yl(a){return a.map(t=>`${t.split(":")[0]}:${t.split(":")[1]}`)}function K1(a,t){const r=Object.keys(t.namespaces).filter(o=>o.includes(a));if(!r.length)return[];const s=[];return r.forEach(o=>{const u=t.namespaces[o].accounts;s.push(...u)}),s}function B1(a={},t={}){const r=bh(a),s=bh(t);return So.exports.merge(r,s)}function bh(a){var t,r,s,o;const u={};if(!xr(a))return u;for(const[l,y]of Object.entries(a)){const I=jo(l)?[l]:y.chains,S=y.methods||[],R=y.events||[],A=y.rpcMap||{},D=di(l);u[D]=F1(ms(ms({},u[D]),y),{chains:to(I,(t=u[D])==null?void 0:t.chains),methods:to(S,(r=u[D])==null?void 0:r.methods),events:to(R,(s=u[D])==null?void 0:s.events),rpcMap:ms(ms({},A),(o=u[D])==null?void 0:o.rpcMap)})}return u}function G1(a){return a.includes(":")?a.split(":")[2]:a}function W1(a){const t={};for(const[r,s]of Object.entries(a)){const o=s.methods||[],u=s.events||[],l=s.accounts||[],y=jo(r)?[r]:s.chains?s.chains:yl(s.accounts);t[r]={chains:y,methods:o,events:u,accounts:l}}return t}function co(a){return typeof a=="number"?a:a.includes("0x")?parseInt(a,16):a.includes(":")?Number(a.split(":")[1]):Number(a)}const ml={},pe=a=>ml[a],uo=(a,t)=>{ml[a]=t};class Q1{constructor(t){this.name="polkadot",this.namespace=t.namespace,this.events=pe("events"),this.client=pe("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Dt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=lr(r);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Wt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Tt(new Qt(s,pe("disableProviderPing")))}}class J1{constructor(t){this.name="eip155",this.namespace=t.namespace,this.events=pe("events"),this.client=pe("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(t){switch(t.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(t);case"eth_chainId":return parseInt(this.getDefaultChain())}return this.namespace.methods.includes(t.request.method)?await this.client.request(t):this.getHttpProvider().request(t.request)}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(parseInt(t),r),this.chainId=parseInt(t),this.events.emit(Dt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}createHttpProvider(t,r){const s=r||Wt(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Tt(new Qt(s,pe("disableProviderPing")))}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=parseInt(lr(r));t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const t=this.chainId,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}async handleSwitchChain(t){var r,s;let o=t.request.params?(r=t.request.params[0])==null?void 0:r.chainId:"0x0";o=o.startsWith("0x")?o:`0x${o}`;const u=parseInt(o,16);if(this.isChainApproved(u))this.setDefaultChain(`${u}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:t.topic,request:{method:t.request.method,params:[{chainId:o}]},chainId:(s=this.namespace.chains)==null?void 0:s[0]}),this.setDefaultChain(`${u}`);else throw new Error(`Failed to switch to chain 'eip155:${u}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(t){return this.namespace.chains.includes(`${this.name}:${t}`)}}class Y1{constructor(t){this.name="solana",this.namespace=t.namespace,this.events=pe("events"),this.client=pe("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Dt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=lr(r);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Wt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Tt(new Qt(s,pe("disableProviderPing")))}}class Z1{constructor(t){this.name="cosmos",this.namespace=t.namespace,this.events=pe("events"),this.client=pe("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Dt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=lr(r);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Wt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Tt(new Qt(s,pe("disableProviderPing")))}}class X1{constructor(t){this.name="cip34",this.namespace=t.namespace,this.events=pe("events"),this.client=pe("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Dt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{const s=this.getCardanoRPCUrl(r),o=lr(r);t[o]=this.createHttpProvider(o,s)}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}getCardanoRPCUrl(t){const r=this.namespace.rpcMap;if(r)return r[t]}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||this.getCardanoRPCUrl(t);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Tt(new Qt(s,pe("disableProviderPing")))}}class eI{constructor(t){this.name="elrond",this.namespace=t.namespace,this.events=pe("events"),this.client=pe("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Dt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=lr(r);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Wt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Tt(new Qt(s,pe("disableProviderPing")))}}class tI{constructor(t){this.name="multiversx",this.namespace=t.namespace,this.events=pe("events"),this.client=pe("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Dt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=lr(r);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Wt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Tt(new Qt(s,pe("disableProviderPing")))}}class rI{constructor(t){this.name="near",this.namespace=t.namespace,this.events=pe("events"),this.client=pe("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){if(this.chainId=t,!this.httpProviders[t]){const s=r||Wt(`${this.name}:${t}`,this.namespace);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.events.emit(Dt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;t[r]=this.createHttpProvider(r,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Wt(t,this.namespace);return typeof s>"u"?void 0:new Tt(new Qt(s,pe("disableProviderPing")))}}var iI=Object.defineProperty,sI=Object.defineProperties,nI=Object.getOwnPropertyDescriptors,Eh=Object.getOwnPropertySymbols,oI=Object.prototype.hasOwnProperty,aI=Object.prototype.propertyIsEnumerable,Ih=(a,t,r)=>t in a?iI(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r,vs=(a,t)=>{for(var r in t||(t={}))oI.call(t,r)&&Ih(a,r,t[r]);if(Eh)for(var r of Eh(t))aI.call(t,r)&&Ih(a,r,t[r]);return a},ho=(a,t)=>sI(a,nI(t));class ko{constructor(t){this.events=new $o,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=t,this.logger=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:Ss(Os({level:(t==null?void 0:t.logger)||mh})),this.disableProviderPing=(t==null?void 0:t.disableProviderPing)||!1}static async init(t){const r=new ko(t);return await r.initialize(),r}async request(t,r){const[s,o]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(s).request({request:vs({},t),chainId:`${s}:${o}`,topic:this.session.topic})}sendAsync(t,r,s){const o=new Date().getTime();this.request(t,s).then(u=>r(null,Rs(o,u))).catch(u=>r(u,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var t;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(t=this.session)==null?void 0:t.topic,reason:me("USER_DISCONNECTED")}),await this.cleanup()}async connect(t){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(t),await this.cleanupPendingPairings(),!t.skipPairing)return await this.pair(t.pairingTopic)}on(t,r){this.events.on(t,r)}once(t,r){this.events.once(t,r)}removeListener(t,r){this.events.removeListener(t,r)}off(t,r){this.events.off(t,r)}get isWalletConnect(){return!0}async pair(t){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:s,approval:o}=await this.client.connect({pairingTopic:t,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});s&&(this.uri=s,this.events.emit("display_uri",s)),await o().then(u=>{this.session=u,this.namespaces||(this.namespaces=W1(u.namespaces),this.persist("namespaces",this.namespaces))}).catch(u=>{if(u.message!==fl)throw u;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(t,r){try{if(!this.session)return;const[s,o]=this.validateChain(t);this.getProvider(s).setDefaultChain(o,r)}catch(s){if(!/Please call connect/.test(s.message))throw s}}async cleanupPendingPairings(t={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(cr(r)){for(const s of r)t.deletePairings?this.client.core.expirer.set(s.topic,0):await this.client.core.relayer.subscriber.unsubscribe(s.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const t=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[t]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await R1.init({logger:this.providerOpts.logger||mh,relayUrl:this.providerOpts.relayUrl||q1,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const t=[...new Set(Object.keys(this.session.namespaces).map(r=>di(r)))];uo("client",this.client),uo("events",this.events),uo("disableProviderPing",this.disableProviderPing),t.forEach(r=>{if(!this.session)return;const s=K1(r,this.session),o=yl(s),u=B1(this.namespaces,this.optionalNamespaces),l=ho(vs({},u[r]),{accounts:s,chains:o});switch(r){case"eip155":this.rpcProviders[r]=new J1({namespace:l});break;case"solana":this.rpcProviders[r]=new Y1({namespace:l});break;case"cosmos":this.rpcProviders[r]=new Z1({namespace:l});break;case"polkadot":this.rpcProviders[r]=new Q1({namespace:l});break;case"cip34":this.rpcProviders[r]=new X1({namespace:l});break;case"elrond":this.rpcProviders[r]=new eI({namespace:l});break;case"multiversx":this.rpcProviders[r]=new tI({namespace:l});break;case"near":this.rpcProviders[r]=new rI({namespace:l});break}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",t=>{this.events.emit("session_ping",t)}),this.client.on("session_event",t=>{const{params:r}=t,{event:s}=r;if(s.name==="accountsChanged"){const o=s.data;o&&cr(o)&&this.events.emit("accountsChanged",o.map(G1))}else if(s.name==="chainChanged"){const o=r.chainId,u=r.event.data,l=di(o),y=co(o)!==co(u)?`${l}:${co(u)}`:o;this.onChainChanged(y)}else this.events.emit(s.name,s.data);this.events.emit("session_event",t)}),this.client.on("session_update",({topic:t,params:r})=>{var s;const{namespaces:o}=r,u=(s=this.client)==null?void 0:s.session.get(t);this.session=ho(vs({},u),{namespaces:o}),this.onSessionUpdate(),this.events.emit("session_update",{topic:t,params:r})}),this.client.on("session_delete",async t=>{await this.cleanup(),this.events.emit("session_delete",t),this.events.emit("disconnect",ho(vs({},me("USER_DISCONNECTED")),{data:t.topic}))}),this.on(Dt.DEFAULT_CHAIN_CHANGED,t=>{this.onChainChanged(t,!0)})}getProvider(t){if(!this.rpcProviders[t])throw new Error(`Provider not found: ${t}`);return this.rpcProviders[t]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(t=>{var r;this.getProvider(t).updateNamespace((r=this.session)==null?void 0:r.namespaces[t])})}setNamespaces(t){const{namespaces:r,optionalNamespaces:s,sessionProperties:o}=t;r&&Object.keys(r).length&&(this.namespaces=r),s&&Object.keys(s).length&&(this.optionalNamespaces=s),this.sessionProperties=o,this.persist("namespaces",r),this.persist("optionalNamespaces",s)}validateChain(t){const[r,s]=(t==null?void 0:t.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,s];if(r&&!Object.keys(this.namespaces||{}).map(l=>di(l)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&s)return[r,s];const o=di(Object.keys(this.namespaces)[0]),u=this.rpcProviders[o].getDefaultChain();return[o,u]}async requestAccounts(){const[t]=this.validateChain();return await this.getProvider(t).requestAccounts()}onChainChanged(t,r=!1){var s;if(!this.namespaces)return;const[o,u]=this.validateChain(t);r||this.getProvider(o).setDefaultChain(u),((s=this.namespaces[o])!=null?s:this.namespaces[`${o}:${u}`]).defaultChain=u,this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",u)}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(t,r){this.client.core.storage.setItem(`${vh}/${t}`,r)}async getFromStore(t){return await this.client.core.storage.getItem(`${vh}/${t}`)}}const cI=ko,uI="wc",hI="ethereum_provider",lI=`${uI}@2:${hI}:`,pI="https://rpc.walletconnect.com/v1/",Oo=["eth_sendTransaction","personal_sign"],dI=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode"],Ro=["chainChanged","accountsChanged"],fI=["chainChanged","accountsChanged","message","disconnect","connect"];var gI=Object.defineProperty,yI=Object.defineProperties,mI=Object.getOwnPropertyDescriptors,Ph=Object.getOwnPropertySymbols,vI=Object.prototype.hasOwnProperty,wI=Object.prototype.propertyIsEnumerable,Sh=(a,t,r)=>t in a?gI(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r,gi=(a,t)=>{for(var r in t||(t={}))vI.call(t,r)&&Sh(a,r,t[r]);if(Ph)for(var r of Ph(t))wI.call(t,r)&&Sh(a,r,t[r]);return a},Oh=(a,t)=>yI(a,mI(t));function Is(a){return Number(a[0].split(":")[1])}function lo(a){return`0x${a.toString(16)}`}function _I(a){const{chains:t,optionalChains:r,methods:s,optionalMethods:o,events:u,optionalEvents:l,rpcMap:y}=a;if(!fo(t))throw new Error("Invalid chains");const I={chains:t,methods:s||Oo,events:u||Ro,rpcMap:gi({},t.length?{[Is(t)]:y[Is(t)]}:{})},S=u==null?void 0:u.filter(K=>!Ro.includes(K)),R=s==null?void 0:s.filter(K=>!Oo.includes(K));if(!r&&!l&&!o&&!(S!=null&&S.length)&&!(R!=null&&R.length))return{required:t.length?I:void 0};const A=(S==null?void 0:S.length)&&(R==null?void 0:R.length)||!r,D={chains:[...new Set(A?I.chains.concat(r||[]):r)],methods:[...new Set(I.methods.concat(o!=null&&o.length?o:dI))],events:[...new Set(I.events.concat(l!=null&&l.length?l:fI))],rpcMap:y};return{required:t.length?I:void 0,optional:r.length?D:void 0}}class Ho{constructor(){this.events=new _t.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=lI,this.on=(t,r)=>(this.events.on(t,r),this),this.once=(t,r)=>(this.events.once(t,r),this),this.removeListener=(t,r)=>(this.events.removeListener(t,r),this),this.off=(t,r)=>(this.events.off(t,r),this),this.parseAccount=t=>this.isCompatibleChainId(t)?this.parseAccountId(t).address:t,this.signer={},this.rpc={}}static async init(t){const r=new Ho;return await r.initialize(t),r}async request(t){return await this.signer.request(t,this.formatChainId(this.chainId))}sendAsync(t,r){this.signer.sendAsync(t,r,this.formatChainId(this.chainId))}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(t);const{required:r,optional:s}=_I(this.rpc);try{const o=await new Promise(async(l,y)=>{var I;this.rpc.showQrModal&&((I=this.modal)==null||I.subscribeModal(S=>{!S.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),y(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(Oh(gi({namespaces:gi({},r&&{[this.namespace]:r})},s&&{optionalNamespaces:{[this.namespace]:s}}),{pairingTopic:t==null?void 0:t.pairingTopic})).then(S=>{l(S)}).catch(S=>{y(new Error(S.message))})});if(!o)return;const u=Cw(o.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:u),this.setAccounts(u),this.events.emit("connect",{chainId:lo(this.chainId)})}catch(o){throw this.signer.logger.error(o),o}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",t=>{const{params:r}=t,{event:s}=r;s.name==="accountsChanged"?(this.accounts=this.parseAccounts(s.data),this.events.emit("accountsChanged",this.accounts)):s.name==="chainChanged"?this.setChainId(this.formatChainId(s.data)):this.events.emit(s.name,s.data),this.events.emit("session_event",t)}),this.signer.on("chainChanged",t=>{const r=parseInt(t);this.chainId=r,this.events.emit("chainChanged",lo(this.chainId)),this.persist()}),this.signer.on("session_update",t=>{this.events.emit("session_update",t)}),this.signer.on("session_delete",t=>{this.reset(),this.events.emit("session_delete",t),this.events.emit("disconnect",Oh(gi({},xw("USER_DISCONNECTED")),{data:t.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",t=>{var r,s;this.rpc.showQrModal&&((r=this.modal)==null||r.closeModal(),(s=this.modal)==null||s.openModal({uri:t})),this.events.emit("display_uri",t)})}switchEthereumChain(t){this.request({method:"wallet_switchEthereumChain",params:[{chainId:t.toString(16)}]})}isCompatibleChainId(t){return typeof t=="string"?t.startsWith(`${this.namespace}:`):!1}formatChainId(t){return`${this.namespace}:${t}`}parseChainId(t){return Number(t.split(":")[1])}setChainIds(t){const r=t.filter(s=>this.isCompatibleChainId(s)).map(s=>this.parseChainId(s));r.length&&(this.chainId=r[0],this.events.emit("chainChanged",lo(this.chainId)),this.persist())}setChainId(t){if(this.isCompatibleChainId(t)){const r=this.parseChainId(t);this.chainId=r,this.switchEthereumChain(r)}}parseAccountId(t){const[r,s,o]=t.split(":");return{chainId:`${r}:${s}`,address:o}}setAccounts(t){this.accounts=t.filter(r=>this.parseChainId(this.parseAccountId(r).chainId)===this.chainId).map(r=>this.parseAccountId(r).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(t){var r,s;const o=(r=t==null?void 0:t.chains)!=null?r:[],u=(s=t==null?void 0:t.optionalChains)!=null?s:[],l=o.concat(u);if(!l.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const y=o.length?(t==null?void 0:t.methods)||Oo:[],I=o.length?(t==null?void 0:t.events)||Ro:[],S=(t==null?void 0:t.optionalMethods)||[],R=(t==null?void 0:t.optionalEvents)||[],A=(t==null?void 0:t.rpcMap)||this.buildRpcMap(l,t.projectId),D=(t==null?void 0:t.qrModalOptions)||void 0;return{chains:o==null?void 0:o.map(K=>this.formatChainId(K)),optionalChains:u.map(K=>this.formatChainId(K)),methods:y,events:I,optionalMethods:S,optionalEvents:R,rpcMap:A,showQrModal:!!(t!=null&&t.showQrModal),qrModalOptions:D,projectId:t.projectId,metadata:t.metadata}}buildRpcMap(t,r){const s={};return t.forEach(o=>{s[o]=this.getRpcUrl(o,r)}),s}async initialize(t){if(this.rpc=this.getRpcConfig(t),this.chainId=this.rpc.chains.length?Is(this.rpc.chains):Is(this.rpc.optionalChains),this.signer=await cI.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:t.disableProviderPing,relayUrl:t.relayUrl,storageOptions:t.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let r;try{const{WalletConnectModal:s}=await gw(()=>import("./index-B3CIvGYj.js").then(o=>o.i),__vite__mapDeps([0,1,2]));r=s}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(r)try{this.modal=new r(gi({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(s){throw this.signer.logger.error(s),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(t){if(!t)return;const{chains:r,optionalChains:s,rpcMap:o}=t;r&&fo(r)&&(this.rpc.chains=r.map(u=>this.formatChainId(u)),r.forEach(u=>{this.rpc.rpcMap[u]=(o==null?void 0:o[u])||this.getRpcUrl(u)})),s&&fo(s)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=s==null?void 0:s.map(u=>this.formatChainId(u)),s.forEach(u=>{this.rpc.rpcMap[u]=(o==null?void 0:o[u])||this.getRpcUrl(u)}))}getRpcUrl(t,r){var s;return((s=this.rpc.rpcMap)==null?void 0:s[t])||`${pI}?chainId=eip155:${t}&projectId=${r||this.rpc.projectId}`}async loadPersistedSession(){if(!this.session)return;const t=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),r=this.session.namespaces[`${this.namespace}:${t}`]?this.session.namespaces[`${this.namespace}:${t}`]:this.session.namespaces[this.namespace];this.setChainIds(t?[this.formatChainId(t)]:r==null?void 0:r.accounts),this.setAccounts(r==null?void 0:r.accounts)}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(t){return typeof t=="string"||t instanceof String?[this.parseAccount(t)]:t.map(r=>this.parseAccount(r))}}const MI=Ho;export{MI as EthereumProvider,fI as OPTIONAL_EVENTS,dI as OPTIONAL_METHODS,Ro as REQUIRED_EVENTS,Oo as REQUIRED_METHODS,Ho as default};
47
+ }`;var Q=vu(function(){return re(d,L+"return "+x).apply(r,g)});if(Q.source=x,Hn(Q))throw Q;return Q}function _v(e){return ne(e).toLowerCase()}function bv(e){return ne(e).toUpperCase()}function Ev(e,i,n){if(e=ne(e),e&&(n||i===r))return Ra(e);if(!e||!(i=Ve(i)))return e;var c=at(e),h=at(i),d=Na(c,h),g=$a(c,h)+1;return Vt(c,d,g).join("")}function Iv(e,i,n){if(e=ne(e),e&&(n||i===r))return e.slice(0,Aa(e)+1);if(!e||!(i=Ve(i)))return e;var c=at(e),h=$a(c,at(i))+1;return Vt(c,0,h).join("")}function Pv(e,i,n){if(e=ne(e),e&&(n||i===r))return e.replace(ks,"");if(!e||!(i=Ve(i)))return e;var c=at(e),h=Na(c,at(i));return Vt(c,h).join("")}function Sv(e,i){var n=Ur,c=vl;if(de(i)){var h="separator"in i?i.separator:h;n="length"in i?W(i.length):n,c="omission"in i?Ve(i.omission):c}e=ne(e);var d=e.length;if(yr(e)){var g=at(e);d=g.length}if(n>=d)return e;var v=n-mr(c);if(v<1)return c;var E=g?Vt(g,0,v).join(""):e.slice(0,v);if(h===r)return E+c;if(g&&(v+=E.length-v),Vn(h)){if(e.slice(v).search(h)){var $,C=E;for(h.global||(h=nn(h.source,ne(Qo.exec(h))+"g")),h.lastIndex=0;$=h.exec(C);)var x=$.index;E=E.slice(0,x===r?v:x)}}else if(e.indexOf(Ve(h),v)!=v){var U=E.lastIndexOf(h);U>-1&&(E=E.slice(0,U))}return E+c}function Ov(e){return e=ne(e),e&&jl.test(e)?e.replace(Bo,ed):e}var Rv=Pr(function(e,i,n){return e+(n?" ":"")+i.toUpperCase()}),Bn=wc("toUpperCase");function mu(e,i,n){return e=ne(e),i=n?r:i,i===r?Qp(e)?id(e):zp(e):e.match(i)||[]}var vu=J(function(e,i){try{return ke(e,r,i)}catch(n){return Hn(n)?n:new B(n)}}),Nv=Ot(function(e,i){return Je(i,function(n){n=mt(n),Pt(e,n,zn(e[n],e))}),e});function $v(e){var i=e==null?0:e.length,n=H();return e=i?le(e,function(c){if(typeof c[1]!="function")throw new Ye(l);return[n(c[0]),c[1]]}):[],J(function(c){for(var h=-1;++h<i;){var d=e[h];if(ke(d[0],this,c))return ke(d[1],this,c)}})}function Cv(e){return ef(Xe(e,A))}function Gn(e){return function(){return e}}function Av(e,i){return e==null||e!==e?i:e}var xv=bc(),Tv=bc(!0);function je(e){return e}function Wn(e){return Ya(typeof e=="function"?e:Xe(e,A))}function Dv(e){return Xa(Xe(e,A))}function qv(e,i){return ec(e,Xe(i,A))}var jv=J(function(e,i){return function(n){return Xr(n,e,i)}}),Uv=J(function(e,i){return function(n){return Xr(e,n,i)}});function Qn(e,i,n){var c=be(i),h=Qi(i,c);n==null&&!(de(i)&&(h.length||!c.length))&&(n=i,i=e,e=this,h=Qi(i,be(i)));var d=!(de(n)&&"chain"in n)||!!n.chain,g=Nt(e);return Je(h,function(v){var E=i[v];e[v]=E,g&&(e.prototype[v]=function(){var $=this.__chain__;if(d||$){var C=e(this.__wrapped__),x=C.__actions__=Te(this.__actions__);return x.push({func:E,args:arguments,thisArg:e}),C.__chain__=$,C}return E.apply(e,Ut([this.value()],arguments))})}),e}function Mv(){return Ie._===this&&(Ie._=ud),this}function Jn(){}function Lv(e){return e=W(e),J(function(i){return tc(i,e)})}var zv=Rn(le),kv=Rn(Ea),Hv=Rn(Ys);function wu(e){return Dn(e)?Zs(mt(e)):vf(e)}function Vv(e){return function(i){return e==null?r:rr(e,i)}}var Fv=Ic(),Kv=Ic(!0);function Yn(){return[]}function Zn(){return!1}function Bv(){return{}}function Gv(){return""}function Wv(){return!0}function Qv(e,i){if(e=W(e),e<1||e>qt)return[];var n=ft,c=Oe(e,ft);i=H(i),e-=ft;for(var h=tn(c,i);++n<e;)i(n);return h}function Jv(e){return G(e)?le(e,mt):Fe(e)?[e]:Te(Lc(ne(e)))}function Yv(e){var i=++ad;return ne(e)+i}var Zv=ts(function(e,i){return e+i},0),Xv=Nn("ceil"),ew=ts(function(e,i){return e/i},1),tw=Nn("floor");function rw(e){return e&&e.length?Wi(e,je,dn):r}function iw(e,i){return e&&e.length?Wi(e,H(i,2),dn):r}function sw(e){return Sa(e,je)}function nw(e,i){return Sa(e,H(i,2))}function ow(e){return e&&e.length?Wi(e,je,mn):r}function aw(e,i){return e&&e.length?Wi(e,H(i,2),mn):r}var cw=ts(function(e,i){return e*i},1),uw=Nn("round"),hw=ts(function(e,i){return e-i},0);function lw(e){return e&&e.length?en(e,je):0}function pw(e,i){return e&&e.length?en(e,H(i,2)):0}return p.after=Dy,p.ary=Jc,p.assign=bm,p.assignIn=hu,p.assignInWith=fs,p.assignWith=Em,p.at=Im,p.before=Yc,p.bind=zn,p.bindAll=Nv,p.bindKey=Zc,p.castArray=By,p.chain=Gc,p.chunk=tg,p.compact=rg,p.concat=ig,p.cond=$v,p.conforms=Cv,p.constant=Gn,p.countBy=ly,p.create=Pm,p.curry=Xc,p.curryRight=eu,p.debounce=tu,p.defaults=Sm,p.defaultsDeep=Om,p.defer=qy,p.delay=jy,p.difference=sg,p.differenceBy=ng,p.differenceWith=og,p.drop=ag,p.dropRight=cg,p.dropRightWhile=ug,p.dropWhile=hg,p.fill=lg,p.filter=dy,p.flatMap=yy,p.flatMapDeep=my,p.flatMapDepth=vy,p.flatten=Vc,p.flattenDeep=pg,p.flattenDepth=dg,p.flip=Uy,p.flow=xv,p.flowRight=Tv,p.fromPairs=fg,p.functions=Tm,p.functionsIn=Dm,p.groupBy=wy,p.initial=yg,p.intersection=mg,p.intersectionBy=vg,p.intersectionWith=wg,p.invert=jm,p.invertBy=Um,p.invokeMap=by,p.iteratee=Wn,p.keyBy=Ey,p.keys=be,p.keysIn=qe,p.map=cs,p.mapKeys=Lm,p.mapValues=zm,p.matches=Dv,p.matchesProperty=qv,p.memoize=hs,p.merge=km,p.mergeWith=lu,p.method=jv,p.methodOf=Uv,p.mixin=Qn,p.negate=ls,p.nthArg=Lv,p.omit=Hm,p.omitBy=Vm,p.once=My,p.orderBy=Iy,p.over=zv,p.overArgs=Ly,p.overEvery=kv,p.overSome=Hv,p.partial=kn,p.partialRight=ru,p.partition=Py,p.pick=Fm,p.pickBy=pu,p.property=wu,p.propertyOf=Vv,p.pull=Ig,p.pullAll=Kc,p.pullAllBy=Pg,p.pullAllWith=Sg,p.pullAt=Og,p.range=Fv,p.rangeRight=Kv,p.rearg=zy,p.reject=Ry,p.remove=Rg,p.rest=ky,p.reverse=Mn,p.sampleSize=$y,p.set=Bm,p.setWith=Gm,p.shuffle=Cy,p.slice=Ng,p.sortBy=Ty,p.sortedUniq=qg,p.sortedUniqBy=jg,p.split=yv,p.spread=Hy,p.tail=Ug,p.take=Mg,p.takeRight=Lg,p.takeRightWhile=zg,p.takeWhile=kg,p.tap=ry,p.throttle=Vy,p.thru=as,p.toArray=au,p.toPairs=du,p.toPairsIn=fu,p.toPath=Jv,p.toPlainObject=uu,p.transform=Wm,p.unary=Fy,p.union=Hg,p.unionBy=Vg,p.unionWith=Fg,p.uniq=Kg,p.uniqBy=Bg,p.uniqWith=Gg,p.unset=Qm,p.unzip=Ln,p.unzipWith=Bc,p.update=Jm,p.updateWith=Ym,p.values=Rr,p.valuesIn=Zm,p.without=Wg,p.words=mu,p.wrap=Ky,p.xor=Qg,p.xorBy=Jg,p.xorWith=Yg,p.zip=Zg,p.zipObject=Xg,p.zipObjectDeep=ey,p.zipWith=ty,p.entries=du,p.entriesIn=fu,p.extend=hu,p.extendWith=fs,Qn(p,p),p.add=Zv,p.attempt=vu,p.camelCase=rv,p.capitalize=gu,p.ceil=Xv,p.clamp=Xm,p.clone=Gy,p.cloneDeep=Qy,p.cloneDeepWith=Jy,p.cloneWith=Wy,p.conformsTo=Yy,p.deburr=yu,p.defaultTo=Av,p.divide=ew,p.endsWith=iv,p.eq=ut,p.escape=sv,p.escapeRegExp=nv,p.every=py,p.find=fy,p.findIndex=kc,p.findKey=Rm,p.findLast=gy,p.findLastIndex=Hc,p.findLastKey=Nm,p.floor=tw,p.forEach=Wc,p.forEachRight=Qc,p.forIn=$m,p.forInRight=Cm,p.forOwn=Am,p.forOwnRight=xm,p.get=Fn,p.gt=Zy,p.gte=Xy,p.has=qm,p.hasIn=Kn,p.head=Fc,p.identity=je,p.includes=_y,p.indexOf=gg,p.inRange=ev,p.invoke=Mm,p.isArguments=nr,p.isArray=G,p.isArrayBuffer=em,p.isArrayLike=De,p.isArrayLikeObject=ge,p.isBoolean=tm,p.isBuffer=Ft,p.isDate=rm,p.isElement=im,p.isEmpty=sm,p.isEqual=nm,p.isEqualWith=om,p.isError=Hn,p.isFinite=am,p.isFunction=Nt,p.isInteger=iu,p.isLength=ps,p.isMap=su,p.isMatch=cm,p.isMatchWith=um,p.isNaN=hm,p.isNative=lm,p.isNil=dm,p.isNull=pm,p.isNumber=nu,p.isObject=de,p.isObjectLike=fe,p.isPlainObject=ni,p.isRegExp=Vn,p.isSafeInteger=fm,p.isSet=ou,p.isString=ds,p.isSymbol=Fe,p.isTypedArray=Or,p.isUndefined=gm,p.isWeakMap=ym,p.isWeakSet=mm,p.join=_g,p.kebabCase=ov,p.last=tt,p.lastIndexOf=bg,p.lowerCase=av,p.lowerFirst=cv,p.lt=vm,p.lte=wm,p.max=rw,p.maxBy=iw,p.mean=sw,p.meanBy=nw,p.min=ow,p.minBy=aw,p.stubArray=Yn,p.stubFalse=Zn,p.stubObject=Bv,p.stubString=Gv,p.stubTrue=Wv,p.multiply=cw,p.nth=Eg,p.noConflict=Mv,p.noop=Jn,p.now=us,p.pad=uv,p.padEnd=hv,p.padStart=lv,p.parseInt=pv,p.random=tv,p.reduce=Sy,p.reduceRight=Oy,p.repeat=dv,p.replace=fv,p.result=Km,p.round=uw,p.runInContext=b,p.sample=Ny,p.size=Ay,p.snakeCase=gv,p.some=xy,p.sortedIndex=$g,p.sortedIndexBy=Cg,p.sortedIndexOf=Ag,p.sortedLastIndex=xg,p.sortedLastIndexBy=Tg,p.sortedLastIndexOf=Dg,p.startCase=mv,p.startsWith=vv,p.subtract=hw,p.sum=lw,p.sumBy=pw,p.template=wv,p.times=Qv,p.toFinite=$t,p.toInteger=W,p.toLength=cu,p.toLower=_v,p.toNumber=rt,p.toSafeInteger=_m,p.toString=ne,p.toUpper=bv,p.trim=Ev,p.trimEnd=Iv,p.trimStart=Pv,p.truncate=Sv,p.unescape=Ov,p.uniqueId=Yv,p.upperCase=Rv,p.upperFirst=Bn,p.each=Wc,p.eachRight=Qc,p.first=Fc,Qn(p,function(){var e={};return gt(p,function(i,n){oe.call(p.prototype,n)||(e[n]=i)}),e}(),{chain:!1}),p.VERSION=s,Je(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){p[e].placeholder=p}),Je(["drop","take"],function(e,i){X.prototype[e]=function(n){n=n===r?1:_e(W(n),0);var c=this.__filtered__&&!i?new X(this):this.clone();return c.__filtered__?c.__takeCount__=Oe(n,c.__takeCount__):c.__views__.push({size:Oe(n,ft),type:e+(c.__dir__<0?"Right":"")}),c},X.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),Je(["filter","map","takeWhile"],function(e,i){var n=i+1,c=n==Vo||n==El;X.prototype[e]=function(h){var d=this.clone();return d.__iteratees__.push({iteratee:H(h,3),type:n}),d.__filtered__=d.__filtered__||c,d}}),Je(["head","last"],function(e,i){var n="take"+(i?"Right":"");X.prototype[e]=function(){return this[n](1).value()[0]}}),Je(["initial","tail"],function(e,i){var n="drop"+(i?"":"Right");X.prototype[e]=function(){return this.__filtered__?new X(this):this[n](1)}}),X.prototype.compact=function(){return this.filter(je)},X.prototype.find=function(e){return this.filter(e).head()},X.prototype.findLast=function(e){return this.reverse().find(e)},X.prototype.invokeMap=J(function(e,i){return typeof e=="function"?new X(this):this.map(function(n){return Xr(n,e,i)})}),X.prototype.reject=function(e){return this.filter(ls(H(e)))},X.prototype.slice=function(e,i){e=W(e);var n=this;return n.__filtered__&&(e>0||i<0)?new X(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),i!==r&&(i=W(i),n=i<0?n.dropRight(-i):n.take(i-e)),n)},X.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},X.prototype.toArray=function(){return this.take(ft)},gt(X.prototype,function(e,i){var n=/^(?:filter|find|map|reject)|While$/.test(i),c=/^(?:head|last)$/.test(i),h=p[c?"take"+(i=="last"?"Right":""):i],d=c||/^find/.test(i);h&&(p.prototype[i]=function(){var g=this.__wrapped__,v=c?[1]:arguments,E=g instanceof X,$=v[0],C=E||G(g),x=function(Y){var ee=h.apply(p,Ut([Y],v));return c&&U?ee[0]:ee};C&&n&&typeof $=="function"&&$.length!=1&&(E=C=!1);var U=this.__chain__,L=!!this.__actions__.length,V=d&&!U,Q=E&&!L;if(!d&&C){g=Q?g:new X(this);var F=e.apply(g,v);return F.__actions__.push({func:as,args:[x],thisArg:r}),new Ze(F,U)}return V&&Q?e.apply(this,v):(F=this.thru(x),V?c?F.value()[0]:F.value():F)})}),Je(["pop","push","shift","sort","splice","unshift"],function(e){var i=Ti[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",c=/^(?:pop|shift)$/.test(e);p.prototype[e]=function(){var h=arguments;if(c&&!this.__chain__){var d=this.value();return i.apply(G(d)?d:[],h)}return this[n](function(g){return i.apply(G(g)?g:[],h)})}}),gt(X.prototype,function(e,i){var n=p[i];if(n){var c=n.name+"";oe.call(br,c)||(br[c]=[]),br[c].push({name:i,func:n})}}),br[es(r,se).name]=[{name:"wrapper",func:r}],X.prototype.clone=Sd,X.prototype.reverse=Od,X.prototype.value=Rd,p.prototype.at=iy,p.prototype.chain=sy,p.prototype.commit=ny,p.prototype.next=oy,p.prototype.plant=cy,p.prototype.reverse=uy,p.prototype.toJSON=p.prototype.valueOf=p.prototype.value=hy,p.prototype.first=p.prototype.head,Br&&(p.prototype[Br]=ay),p},vr=sd();Yt?((Yt.exports=vr)._=vr,Gs._=vr):Ie._=vr}).call(pi)})(So,So.exports);var L1=Object.defineProperty,z1=Object.defineProperties,k1=Object.getOwnPropertyDescriptors,wh=Object.getOwnPropertySymbols,H1=Object.prototype.hasOwnProperty,V1=Object.prototype.propertyIsEnumerable,_h=(a,t,r)=>t in a?L1(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r,ms=(a,t)=>{for(var r in t||(t={}))H1.call(t,r)&&_h(a,r,t[r]);if(wh)for(var r of wh(t))V1.call(t,r)&&_h(a,r,t[r]);return a},F1=(a,t)=>z1(a,k1(t));function Wt(a,t,r){var s;const o=m_(a);return((s=t.rpcMap)==null?void 0:s[o.reference])||`${M1}?chainId=${o.namespace}:${o.reference}&projectId=${r}`}function lr(a){return a.includes(":")?a.split(":")[1]:a}function yl(a){return a.map(t=>`${t.split(":")[0]}:${t.split(":")[1]}`)}function K1(a,t){const r=Object.keys(t.namespaces).filter(o=>o.includes(a));if(!r.length)return[];const s=[];return r.forEach(o=>{const u=t.namespaces[o].accounts;s.push(...u)}),s}function B1(a={},t={}){const r=bh(a),s=bh(t);return So.exports.merge(r,s)}function bh(a){var t,r,s,o;const u={};if(!xr(a))return u;for(const[l,y]of Object.entries(a)){const I=jo(l)?[l]:y.chains,S=y.methods||[],R=y.events||[],A=y.rpcMap||{},D=di(l);u[D]=F1(ms(ms({},u[D]),y),{chains:to(I,(t=u[D])==null?void 0:t.chains),methods:to(S,(r=u[D])==null?void 0:r.methods),events:to(R,(s=u[D])==null?void 0:s.events),rpcMap:ms(ms({},A),(o=u[D])==null?void 0:o.rpcMap)})}return u}function G1(a){return a.includes(":")?a.split(":")[2]:a}function W1(a){const t={};for(const[r,s]of Object.entries(a)){const o=s.methods||[],u=s.events||[],l=s.accounts||[],y=jo(r)?[r]:s.chains?s.chains:yl(s.accounts);t[r]={chains:y,methods:o,events:u,accounts:l}}return t}function co(a){return typeof a=="number"?a:a.includes("0x")?parseInt(a,16):a.includes(":")?Number(a.split(":")[1]):Number(a)}const ml={},pe=a=>ml[a],uo=(a,t)=>{ml[a]=t};class Q1{constructor(t){this.name="polkadot",this.namespace=t.namespace,this.events=pe("events"),this.client=pe("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Dt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=lr(r);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Wt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Tt(new Qt(s,pe("disableProviderPing")))}}class J1{constructor(t){this.name="eip155",this.namespace=t.namespace,this.events=pe("events"),this.client=pe("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(t){switch(t.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(t);case"eth_chainId":return parseInt(this.getDefaultChain())}return this.namespace.methods.includes(t.request.method)?await this.client.request(t):this.getHttpProvider().request(t.request)}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(parseInt(t),r),this.chainId=parseInt(t),this.events.emit(Dt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}createHttpProvider(t,r){const s=r||Wt(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Tt(new Qt(s,pe("disableProviderPing")))}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=parseInt(lr(r));t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const t=this.chainId,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}async handleSwitchChain(t){var r,s;let o=t.request.params?(r=t.request.params[0])==null?void 0:r.chainId:"0x0";o=o.startsWith("0x")?o:`0x${o}`;const u=parseInt(o,16);if(this.isChainApproved(u))this.setDefaultChain(`${u}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:t.topic,request:{method:t.request.method,params:[{chainId:o}]},chainId:(s=this.namespace.chains)==null?void 0:s[0]}),this.setDefaultChain(`${u}`);else throw new Error(`Failed to switch to chain 'eip155:${u}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(t){return this.namespace.chains.includes(`${this.name}:${t}`)}}class Y1{constructor(t){this.name="solana",this.namespace=t.namespace,this.events=pe("events"),this.client=pe("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Dt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=lr(r);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Wt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Tt(new Qt(s,pe("disableProviderPing")))}}class Z1{constructor(t){this.name="cosmos",this.namespace=t.namespace,this.events=pe("events"),this.client=pe("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Dt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=lr(r);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Wt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Tt(new Qt(s,pe("disableProviderPing")))}}class X1{constructor(t){this.name="cip34",this.namespace=t.namespace,this.events=pe("events"),this.client=pe("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Dt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{const s=this.getCardanoRPCUrl(r),o=lr(r);t[o]=this.createHttpProvider(o,s)}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}getCardanoRPCUrl(t){const r=this.namespace.rpcMap;if(r)return r[t]}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||this.getCardanoRPCUrl(t);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Tt(new Qt(s,pe("disableProviderPing")))}}class eI{constructor(t){this.name="elrond",this.namespace=t.namespace,this.events=pe("events"),this.client=pe("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Dt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=lr(r);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Wt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Tt(new Qt(s,pe("disableProviderPing")))}}class tI{constructor(t){this.name="multiversx",this.namespace=t.namespace,this.events=pe("events"),this.client=pe("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Dt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=lr(r);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Wt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Tt(new Qt(s,pe("disableProviderPing")))}}class rI{constructor(t){this.name="near",this.namespace=t.namespace,this.events=pe("events"),this.client=pe("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){if(this.chainId=t,!this.httpProviders[t]){const s=r||Wt(`${this.name}:${t}`,this.namespace);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.events.emit(Dt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;t[r]=this.createHttpProvider(r,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Wt(t,this.namespace);return typeof s>"u"?void 0:new Tt(new Qt(s,pe("disableProviderPing")))}}var iI=Object.defineProperty,sI=Object.defineProperties,nI=Object.getOwnPropertyDescriptors,Eh=Object.getOwnPropertySymbols,oI=Object.prototype.hasOwnProperty,aI=Object.prototype.propertyIsEnumerable,Ih=(a,t,r)=>t in a?iI(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r,vs=(a,t)=>{for(var r in t||(t={}))oI.call(t,r)&&Ih(a,r,t[r]);if(Eh)for(var r of Eh(t))aI.call(t,r)&&Ih(a,r,t[r]);return a},ho=(a,t)=>sI(a,nI(t));class ko{constructor(t){this.events=new $o,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=t,this.logger=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:Ss(Os({level:(t==null?void 0:t.logger)||mh})),this.disableProviderPing=(t==null?void 0:t.disableProviderPing)||!1}static async init(t){const r=new ko(t);return await r.initialize(),r}async request(t,r){const[s,o]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(s).request({request:vs({},t),chainId:`${s}:${o}`,topic:this.session.topic})}sendAsync(t,r,s){const o=new Date().getTime();this.request(t,s).then(u=>r(null,Rs(o,u))).catch(u=>r(u,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var t;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(t=this.session)==null?void 0:t.topic,reason:me("USER_DISCONNECTED")}),await this.cleanup()}async connect(t){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(t),await this.cleanupPendingPairings(),!t.skipPairing)return await this.pair(t.pairingTopic)}on(t,r){this.events.on(t,r)}once(t,r){this.events.once(t,r)}removeListener(t,r){this.events.removeListener(t,r)}off(t,r){this.events.off(t,r)}get isWalletConnect(){return!0}async pair(t){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:s,approval:o}=await this.client.connect({pairingTopic:t,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});s&&(this.uri=s,this.events.emit("display_uri",s)),await o().then(u=>{this.session=u,this.namespaces||(this.namespaces=W1(u.namespaces),this.persist("namespaces",this.namespaces))}).catch(u=>{if(u.message!==fl)throw u;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(t,r){try{if(!this.session)return;const[s,o]=this.validateChain(t);this.getProvider(s).setDefaultChain(o,r)}catch(s){if(!/Please call connect/.test(s.message))throw s}}async cleanupPendingPairings(t={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(cr(r)){for(const s of r)t.deletePairings?this.client.core.expirer.set(s.topic,0):await this.client.core.relayer.subscriber.unsubscribe(s.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const t=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[t]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await R1.init({logger:this.providerOpts.logger||mh,relayUrl:this.providerOpts.relayUrl||q1,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const t=[...new Set(Object.keys(this.session.namespaces).map(r=>di(r)))];uo("client",this.client),uo("events",this.events),uo("disableProviderPing",this.disableProviderPing),t.forEach(r=>{if(!this.session)return;const s=K1(r,this.session),o=yl(s),u=B1(this.namespaces,this.optionalNamespaces),l=ho(vs({},u[r]),{accounts:s,chains:o});switch(r){case"eip155":this.rpcProviders[r]=new J1({namespace:l});break;case"solana":this.rpcProviders[r]=new Y1({namespace:l});break;case"cosmos":this.rpcProviders[r]=new Z1({namespace:l});break;case"polkadot":this.rpcProviders[r]=new Q1({namespace:l});break;case"cip34":this.rpcProviders[r]=new X1({namespace:l});break;case"elrond":this.rpcProviders[r]=new eI({namespace:l});break;case"multiversx":this.rpcProviders[r]=new tI({namespace:l});break;case"near":this.rpcProviders[r]=new rI({namespace:l});break}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",t=>{this.events.emit("session_ping",t)}),this.client.on("session_event",t=>{const{params:r}=t,{event:s}=r;if(s.name==="accountsChanged"){const o=s.data;o&&cr(o)&&this.events.emit("accountsChanged",o.map(G1))}else if(s.name==="chainChanged"){const o=r.chainId,u=r.event.data,l=di(o),y=co(o)!==co(u)?`${l}:${co(u)}`:o;this.onChainChanged(y)}else this.events.emit(s.name,s.data);this.events.emit("session_event",t)}),this.client.on("session_update",({topic:t,params:r})=>{var s;const{namespaces:o}=r,u=(s=this.client)==null?void 0:s.session.get(t);this.session=ho(vs({},u),{namespaces:o}),this.onSessionUpdate(),this.events.emit("session_update",{topic:t,params:r})}),this.client.on("session_delete",async t=>{await this.cleanup(),this.events.emit("session_delete",t),this.events.emit("disconnect",ho(vs({},me("USER_DISCONNECTED")),{data:t.topic}))}),this.on(Dt.DEFAULT_CHAIN_CHANGED,t=>{this.onChainChanged(t,!0)})}getProvider(t){if(!this.rpcProviders[t])throw new Error(`Provider not found: ${t}`);return this.rpcProviders[t]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(t=>{var r;this.getProvider(t).updateNamespace((r=this.session)==null?void 0:r.namespaces[t])})}setNamespaces(t){const{namespaces:r,optionalNamespaces:s,sessionProperties:o}=t;r&&Object.keys(r).length&&(this.namespaces=r),s&&Object.keys(s).length&&(this.optionalNamespaces=s),this.sessionProperties=o,this.persist("namespaces",r),this.persist("optionalNamespaces",s)}validateChain(t){const[r,s]=(t==null?void 0:t.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,s];if(r&&!Object.keys(this.namespaces||{}).map(l=>di(l)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&s)return[r,s];const o=di(Object.keys(this.namespaces)[0]),u=this.rpcProviders[o].getDefaultChain();return[o,u]}async requestAccounts(){const[t]=this.validateChain();return await this.getProvider(t).requestAccounts()}onChainChanged(t,r=!1){var s;if(!this.namespaces)return;const[o,u]=this.validateChain(t);r||this.getProvider(o).setDefaultChain(u),((s=this.namespaces[o])!=null?s:this.namespaces[`${o}:${u}`]).defaultChain=u,this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",u)}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(t,r){this.client.core.storage.setItem(`${vh}/${t}`,r)}async getFromStore(t){return await this.client.core.storage.getItem(`${vh}/${t}`)}}const cI=ko,uI="wc",hI="ethereum_provider",lI=`${uI}@2:${hI}:`,pI="https://rpc.walletconnect.com/v1/",Oo=["eth_sendTransaction","personal_sign"],dI=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode"],Ro=["chainChanged","accountsChanged"],fI=["chainChanged","accountsChanged","message","disconnect","connect"];var gI=Object.defineProperty,yI=Object.defineProperties,mI=Object.getOwnPropertyDescriptors,Ph=Object.getOwnPropertySymbols,vI=Object.prototype.hasOwnProperty,wI=Object.prototype.propertyIsEnumerable,Sh=(a,t,r)=>t in a?gI(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r,gi=(a,t)=>{for(var r in t||(t={}))vI.call(t,r)&&Sh(a,r,t[r]);if(Ph)for(var r of Ph(t))wI.call(t,r)&&Sh(a,r,t[r]);return a},Oh=(a,t)=>yI(a,mI(t));function Is(a){return Number(a[0].split(":")[1])}function lo(a){return`0x${a.toString(16)}`}function _I(a){const{chains:t,optionalChains:r,methods:s,optionalMethods:o,events:u,optionalEvents:l,rpcMap:y}=a;if(!fo(t))throw new Error("Invalid chains");const I={chains:t,methods:s||Oo,events:u||Ro,rpcMap:gi({},t.length?{[Is(t)]:y[Is(t)]}:{})},S=u==null?void 0:u.filter(K=>!Ro.includes(K)),R=s==null?void 0:s.filter(K=>!Oo.includes(K));if(!r&&!l&&!o&&!(S!=null&&S.length)&&!(R!=null&&R.length))return{required:t.length?I:void 0};const A=(S==null?void 0:S.length)&&(R==null?void 0:R.length)||!r,D={chains:[...new Set(A?I.chains.concat(r||[]):r)],methods:[...new Set(I.methods.concat(o!=null&&o.length?o:dI))],events:[...new Set(I.events.concat(l!=null&&l.length?l:fI))],rpcMap:y};return{required:t.length?I:void 0,optional:r.length?D:void 0}}class Ho{constructor(){this.events=new _t.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=lI,this.on=(t,r)=>(this.events.on(t,r),this),this.once=(t,r)=>(this.events.once(t,r),this),this.removeListener=(t,r)=>(this.events.removeListener(t,r),this),this.off=(t,r)=>(this.events.off(t,r),this),this.parseAccount=t=>this.isCompatibleChainId(t)?this.parseAccountId(t).address:t,this.signer={},this.rpc={}}static async init(t){const r=new Ho;return await r.initialize(t),r}async request(t){return await this.signer.request(t,this.formatChainId(this.chainId))}sendAsync(t,r){this.signer.sendAsync(t,r,this.formatChainId(this.chainId))}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(t);const{required:r,optional:s}=_I(this.rpc);try{const o=await new Promise(async(l,y)=>{var I;this.rpc.showQrModal&&((I=this.modal)==null||I.subscribeModal(S=>{!S.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),y(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(Oh(gi({namespaces:gi({},r&&{[this.namespace]:r})},s&&{optionalNamespaces:{[this.namespace]:s}}),{pairingTopic:t==null?void 0:t.pairingTopic})).then(S=>{l(S)}).catch(S=>{y(new Error(S.message))})});if(!o)return;const u=Cw(o.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:u),this.setAccounts(u),this.events.emit("connect",{chainId:lo(this.chainId)})}catch(o){throw this.signer.logger.error(o),o}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",t=>{const{params:r}=t,{event:s}=r;s.name==="accountsChanged"?(this.accounts=this.parseAccounts(s.data),this.events.emit("accountsChanged",this.accounts)):s.name==="chainChanged"?this.setChainId(this.formatChainId(s.data)):this.events.emit(s.name,s.data),this.events.emit("session_event",t)}),this.signer.on("chainChanged",t=>{const r=parseInt(t);this.chainId=r,this.events.emit("chainChanged",lo(this.chainId)),this.persist()}),this.signer.on("session_update",t=>{this.events.emit("session_update",t)}),this.signer.on("session_delete",t=>{this.reset(),this.events.emit("session_delete",t),this.events.emit("disconnect",Oh(gi({},xw("USER_DISCONNECTED")),{data:t.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",t=>{var r,s;this.rpc.showQrModal&&((r=this.modal)==null||r.closeModal(),(s=this.modal)==null||s.openModal({uri:t})),this.events.emit("display_uri",t)})}switchEthereumChain(t){this.request({method:"wallet_switchEthereumChain",params:[{chainId:t.toString(16)}]})}isCompatibleChainId(t){return typeof t=="string"?t.startsWith(`${this.namespace}:`):!1}formatChainId(t){return`${this.namespace}:${t}`}parseChainId(t){return Number(t.split(":")[1])}setChainIds(t){const r=t.filter(s=>this.isCompatibleChainId(s)).map(s=>this.parseChainId(s));r.length&&(this.chainId=r[0],this.events.emit("chainChanged",lo(this.chainId)),this.persist())}setChainId(t){if(this.isCompatibleChainId(t)){const r=this.parseChainId(t);this.chainId=r,this.switchEthereumChain(r)}}parseAccountId(t){const[r,s,o]=t.split(":");return{chainId:`${r}:${s}`,address:o}}setAccounts(t){this.accounts=t.filter(r=>this.parseChainId(this.parseAccountId(r).chainId)===this.chainId).map(r=>this.parseAccountId(r).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(t){var r,s;const o=(r=t==null?void 0:t.chains)!=null?r:[],u=(s=t==null?void 0:t.optionalChains)!=null?s:[],l=o.concat(u);if(!l.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const y=o.length?(t==null?void 0:t.methods)||Oo:[],I=o.length?(t==null?void 0:t.events)||Ro:[],S=(t==null?void 0:t.optionalMethods)||[],R=(t==null?void 0:t.optionalEvents)||[],A=(t==null?void 0:t.rpcMap)||this.buildRpcMap(l,t.projectId),D=(t==null?void 0:t.qrModalOptions)||void 0;return{chains:o==null?void 0:o.map(K=>this.formatChainId(K)),optionalChains:u.map(K=>this.formatChainId(K)),methods:y,events:I,optionalMethods:S,optionalEvents:R,rpcMap:A,showQrModal:!!(t!=null&&t.showQrModal),qrModalOptions:D,projectId:t.projectId,metadata:t.metadata}}buildRpcMap(t,r){const s={};return t.forEach(o=>{s[o]=this.getRpcUrl(o,r)}),s}async initialize(t){if(this.rpc=this.getRpcConfig(t),this.chainId=this.rpc.chains.length?Is(this.rpc.chains):Is(this.rpc.optionalChains),this.signer=await cI.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:t.disableProviderPing,relayUrl:t.relayUrl,storageOptions:t.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let r;try{const{WalletConnectModal:s}=await gw(()=>import("./index-B9_Snb-C.js").then(o=>o.i),__vite__mapDeps([0,1,2]));r=s}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(r)try{this.modal=new r(gi({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(s){throw this.signer.logger.error(s),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(t){if(!t)return;const{chains:r,optionalChains:s,rpcMap:o}=t;r&&fo(r)&&(this.rpc.chains=r.map(u=>this.formatChainId(u)),r.forEach(u=>{this.rpc.rpcMap[u]=(o==null?void 0:o[u])||this.getRpcUrl(u)})),s&&fo(s)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=s==null?void 0:s.map(u=>this.formatChainId(u)),s.forEach(u=>{this.rpc.rpcMap[u]=(o==null?void 0:o[u])||this.getRpcUrl(u)}))}getRpcUrl(t,r){var s;return((s=this.rpc.rpcMap)==null?void 0:s[t])||`${pI}?chainId=eip155:${t}&projectId=${r||this.rpc.projectId}`}async loadPersistedSession(){if(!this.session)return;const t=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),r=this.session.namespaces[`${this.namespace}:${t}`]?this.session.namespaces[`${this.namespace}:${t}`]:this.session.namespaces[this.namespace];this.setChainIds(t?[this.formatChainId(t)]:r==null?void 0:r.accounts),this.setAccounts(r==null?void 0:r.accounts)}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(t){return typeof t=="string"||t instanceof String?[this.parseAccount(t)]:t.map(r=>this.parseAccount(r))}}const MI=Ho;export{MI as EthereumProvider,fI as OPTIONAL_EVENTS,dI as OPTIONAL_METHODS,Ro as REQUIRED_EVENTS,Oo as REQUIRED_METHODS,Ho as default};