astra-modal-test 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/README.md +0 -0
  2. package/dist/astra-sdk.es.js +8 -0
  3. package/dist/astra-sdk.umd.js +12576 -0
  4. package/dist/ccip-Bpb4GlU6.mjs +146 -0
  5. package/dist/hooks.module-BBZfodGH.mjs +506 -0
  6. package/dist/index-BTsa09iy.mjs +84805 -0
  7. package/dist/index-CEtKkuP2.mjs +133 -0
  8. package/dist/index-CbWGAz3l.mjs +445 -0
  9. package/dist/index-DRPxIWUd.mjs +13720 -0
  10. package/dist/index-h9_6XS0r.mjs +2929 -0
  11. package/dist/secp256k1-3OC5y4qp.mjs +1578 -0
  12. package/dist/vite.svg +1 -0
  13. package/dist/w3m-modal-R9m1z1SQ.mjs +267 -0
  14. package/eslint.config.js +39 -0
  15. package/index.html +13 -0
  16. package/package.json +50 -0
  17. package/public/vite.svg +1 -0
  18. package/src/App.css +170 -0
  19. package/src/apis/lspApi.js +59 -0
  20. package/src/apis/request.js +59 -0
  21. package/src/assets/arrow-right.svg +3 -0
  22. package/src/assets/astr.svg +13 -0
  23. package/src/assets/bridge-loading.png +0 -0
  24. package/src/assets/network/base.png +0 -0
  25. package/src/assets/network/eth.png +0 -0
  26. package/src/assets/network/lighting.png +0 -0
  27. package/src/assets/network/ligtning.svg +22 -0
  28. package/src/assets/network/solona.png +0 -0
  29. package/src/assets/powerby.svg +14 -0
  30. package/src/assets/react.svg +1 -0
  31. package/src/assets/success.svg +3 -0
  32. package/src/assets/tip.svg +5 -0
  33. package/src/assets/tokens/sol.png +0 -0
  34. package/src/assets/tokens/usdc.png +0 -0
  35. package/src/assets/tokens/usdt.png +0 -0
  36. package/src/comps/AstraImage.jsx +23 -0
  37. package/src/comps/AstraModal.jsx +207 -0
  38. package/src/comps/AstraModalLogo.jsx +53 -0
  39. package/src/comps/AstraNetwork.jsx +115 -0
  40. package/src/comps/CheckErc20Button.jsx +28 -0
  41. package/src/comps/ConnectButton.jsx +37 -0
  42. package/src/comps/EllipsisMiddle.jsx +42 -0
  43. package/src/comps/ResultModal.jsx +307 -0
  44. package/src/comps/ToLightning.jsx +502 -0
  45. package/src/comps/ToToken.jsx +467 -0
  46. package/src/constants/contracts/abi/bridge.js +1246 -0
  47. package/src/constants/contracts/abi/index.js +3 -0
  48. package/src/constants/contracts/abi/usdt.js +130 -0
  49. package/src/constants/contracts/abi/watcher.js +523 -0
  50. package/src/constants/contracts/index.js +37 -0
  51. package/src/constants/index.js +5 -0
  52. package/src/font/ClashDisplay-Variable.ttf +0 -0
  53. package/src/font/ClashDisplay-Variable.woff +0 -0
  54. package/src/font/ClashDisplay-Variable.woff2 +0 -0
  55. package/src/hooks/useContract.js +127 -0
  56. package/src/hooks/useLspApi.js +53 -0
  57. package/src/hooks/useParseInvoice.js +85 -0
  58. package/src/index.css +69 -0
  59. package/src/index.jsx +112 -0
  60. package/src/lib/bolt11.min.js +1 -0
  61. package/src/main.jsx +41 -0
  62. package/src/store/index.js +25 -0
  63. package/src/theme.js +108 -0
  64. package/src/utils/index.js +36 -0
  65. package/vite.config.js +44 -0
@@ -0,0 +1,133 @@
1
+ import { j as a } from "./index-BTsa09iy.mjs";
2
+ import { k as e, T as n, U as o, D as L, ak as W, F as l, G as r, aA as M, aF as Z, aG as V, H as d, o as H, K as c, I as p, aS as m, aQ as k, L as h, aD as _, aE as I, P as g, X as B, Z as T, _ as v, $ as w, a0 as S, a1 as b, aT as f, aU as x, q as A, a2 as N, aM as D, a3 as P, t as U, aJ as E, a4 as G, a5 as z, a6 as F, a7 as j, av as q, aL as y, aN as K, aw as O, aI as Q, a8 as J, ax as R, aO as X, aH as $, ab as Y, ay as a1, u as i1, v as s1, w as C1, ad as u1, ac as t1, ae as e1, af as n1, au as o1, ag as L1, aK as W1, aB as l1, aC as r1, az as M1, ah as Z1, ai as V1, aP as d1, aV as H1, y as c1, aj as p1, aR as m1, al as k1, an as h1, z as _1, am as I1, ap as g1, ao as B1, a9 as T1, aa as v1, aq as w1, B as S1, ar as b1, at as f1, as as x1, c as A1, l as N1, m as D1, n as P1 } from "./index-BTsa09iy.mjs";
3
+ const s = a`<svg class="input_mask" width="328" height="100" viewBox="0 0 328 100" fill="none">
4
+ <mask id="path-1-inside-1_18299_4189">
5
+ <path
6
+ class="input_mask__border"
7
+ fill-rule="evenodd"
8
+ clip-rule="evenodd"
9
+ d="M138.008 0H40C21.1438 0 11.7157 0 5.85786 5.85786C0 11.7157 0 21.1438 0 40V60C0 78.8562 0 88.2843 5.85786 94.1421C11.7157 100 21.1438 100 40 100H288C306.856 100 316.284 100 322.142 94.1421C328 88.2843 328 78.8562 328 60V40C328 21.1438 328 11.7157 322.142 5.85786C316.284 0 306.856 0 288 0H189.992C189.958 4.89122 189.786 7.76279 188.914 10.1564C187.095 15.1562 183.156 19.0947 178.156 20.9145C175.174 22 171.449 22 164 22C156.551 22 152.826 22 149.844 20.9145C144.844 19.0947 140.905 15.1562 139.086 10.1564C138.214 7.76279 138.042 4.89122 138.008 0Z"
10
+ />
11
+ </mask>
12
+ <path
13
+ class="input_mask__background"
14
+ fill-rule="evenodd"
15
+ clip-rule="evenodd"
16
+ d="M138.008 0H40C21.1438 0 11.7157 0 5.85786 5.85786C0 11.7157 0 21.1438 0 40V60C0 78.8562 0 88.2843 5.85786 94.1421C11.7157 100 21.1438 100 40 100H288C306.856 100 316.284 100 322.142 94.1421C328 88.2843 328 78.8562 328 60V40C328 21.1438 328 11.7157 322.142 5.85786C316.284 0 306.856 0 288 0H189.992C189.958 4.89122 189.786 7.76279 188.914 10.1564C187.095 15.1562 183.156 19.0947 178.156 20.9145C175.174 22 171.449 22 164 22C156.551 22 152.826 22 149.844 20.9145C144.844 19.0947 140.905 15.1562 139.086 10.1564C138.214 7.76279 138.042 4.89122 138.008 0Z"
17
+ />
18
+ <path
19
+ class="input_mask__border"
20
+ d="M138.008 0L139.008 -0.00694413L139.001 -1H138.008V0ZM322.142 94.1421L322.849 94.8492H322.849L322.142 94.1421ZM322.142 5.85786L322.849 5.15076L322.849 5.15076L322.142 5.85786ZM189.992 0V-1H188.999L188.992 -0.00694413L189.992 0ZM188.914 10.1564L189.854 10.4984V10.4984L188.914 10.1564ZM178.156 20.9145L177.814 19.9748V19.9748L178.156 20.9145ZM149.844 20.9145L150.186 19.9748V19.9748L149.844 20.9145ZM139.086 10.1564L138.146 10.4984V10.4984L139.086 10.1564ZM40 1H138.008V-1H40V1ZM6.56497 6.56497C9.27713 3.85281 12.8524 2.44064 18.1878 1.72332C23.552 1.00212 30.5436 1 40 1V-1C30.6002 -1 23.4497 -1.00212 17.9213 -0.25885C12.3641 0.488292 8.29646 2.00506 5.15076 5.15076L6.56497 6.56497ZM1 40C1 30.5436 1.00212 23.552 1.72332 18.1878C2.44064 12.8524 3.85281 9.27713 6.56497 6.56497L5.15076 5.15076C2.00506 8.29646 0.488292 12.3641 -0.25885 17.9213C-1.00212 23.4497 -1 30.6002 -1 40H1ZM1 60V40H-1V60H1ZM6.56497 93.435C3.85281 90.7229 2.44064 87.1476 1.72332 81.8122C1.00212 76.448 1 69.4564 1 60H-1C-1 69.3998 -1.00212 76.5503 -0.25885 82.0787C0.488292 87.6358 2.00506 91.7035 5.15076 94.8492L6.56497 93.435ZM40 99C30.5436 99 23.552 98.9979 18.1878 98.2767C12.8524 97.5594 9.27713 96.1472 6.56497 93.435L5.15076 94.8492C8.29646 97.9949 12.3641 99.5117 17.9213 100.259C23.4497 101.002 30.6002 101 40 101V99ZM288 99H40V101H288V99ZM321.435 93.435C318.723 96.1472 315.148 97.5594 309.812 98.2767C304.448 98.9979 297.456 99 288 99V101C297.4 101 304.55 101.002 310.079 100.259C315.636 99.5117 319.704 97.9949 322.849 94.8492L321.435 93.435ZM327 60C327 69.4564 326.998 76.448 326.277 81.8122C325.559 87.1476 324.147 90.7229 321.435 93.435L322.849 94.8492C325.995 91.7035 327.512 87.6358 328.259 82.0787C329.002 76.5503 329 69.3998 329 60H327ZM327 40V60H329V40H327ZM321.435 6.56497C324.147 9.27713 325.559 12.8524 326.277 18.1878C326.998 23.552 327 30.5436 327 40H329C329 30.6002 329.002 23.4497 328.259 17.9213C327.512 12.3642 325.995 8.29646 322.849 5.15076L321.435 6.56497ZM288 1C297.456 1 304.448 1.00212 309.812 1.72332C315.148 2.44064 318.723 3.85281 321.435 6.56497L322.849 5.15076C319.704 2.00506 315.636 0.488292 310.079 -0.25885C304.55 -1.00212 297.4 -1 288 -1V1ZM189.992 1H288V-1H189.992V1ZM188.992 -0.00694413C188.958 4.90792 188.778 7.60788 187.975 9.81434L189.854 10.4984C190.793 7.9177 190.958 4.87452 190.992 0.00694413L188.992 -0.00694413ZM187.975 9.81434C186.256 14.5364 182.536 18.2561 177.814 19.9748L178.498 21.8542C183.776 19.9333 187.933 15.7759 189.854 10.4984L187.975 9.81434ZM177.814 19.9748C175.039 20.9848 171.536 21 164 21V23C171.362 23 175.308 23.0152 178.498 21.8542L177.814 19.9748ZM164 21C156.464 21 152.961 20.9848 150.186 19.9748L149.502 21.8542C152.692 23.0152 156.638 23 164 23V21ZM150.186 19.9748C145.464 18.2561 141.744 14.5364 140.025 9.81434L138.146 10.4984C140.067 15.7759 144.224 19.9333 149.502 21.8542L150.186 19.9748ZM140.025 9.81434C139.222 7.60788 139.042 4.90792 139.008 -0.00694413L137.008 0.00694413C137.042 4.87452 137.207 7.9177 138.146 10.4984L140.025 9.81434Z"
21
+ mask="url(#path-1-inside-1_18299_4189)"
22
+ />
23
+ </svg>`, C = a`<svg class="input_mask" width="328" height="100" viewBox="0 0 328 100" fill="none">
24
+ <mask id="path-1-inside-1_18299_4168">
25
+ <path
26
+ class="input_mask__border"
27
+ fill-rule="evenodd"
28
+ clip-rule="evenodd"
29
+ d="M5.85786 5.85786C0 11.7157 0 21.1438 0 40V60C0 78.8562 0 88.2843 5.85786 94.1421C11.7157 100 21.1438 100 40 100H138.008C138.042 95.1088 138.214 92.2372 139.086 89.8436C140.905 84.8438 144.844 80.9053 149.844 79.0855C152.826 78 156.551 78 164 78C171.449 78 175.174 78 178.156 79.0855C183.156 80.9053 187.095 84.8438 188.914 89.8436C189.786 92.2372 189.958 95.1088 189.992 100H288C306.856 100 316.284 100 322.142 94.1421C328 88.2843 328 78.8562 328 60V40C328 21.1438 328 11.7157 322.142 5.85786C316.284 0 306.856 0 288 0H40C21.1438 0 11.7157 0 5.85786 5.85786Z"
30
+ />
31
+ </mask>
32
+ <path
33
+ class="input_mask__background"
34
+ fill-rule="evenodd"
35
+ clip-rule="evenodd"
36
+ d="M5.85786 5.85786C0 11.7157 0 21.1438 0 40V60C0 78.8562 0 88.2843 5.85786 94.1421C11.7157 100 21.1438 100 40 100H138.008C138.042 95.1088 138.214 92.2372 139.086 89.8436C140.905 84.8438 144.844 80.9053 149.844 79.0855C152.826 78 156.551 78 164 78C171.449 78 175.174 78 178.156 79.0855C183.156 80.9053 187.095 84.8438 188.914 89.8436C189.786 92.2372 189.958 95.1088 189.992 100H288C306.856 100 316.284 100 322.142 94.1421C328 88.2843 328 78.8562 328 60V40C328 21.1438 328 11.7157 322.142 5.85786C316.284 0 306.856 0 288 0H40C21.1438 0 11.7157 0 5.85786 5.85786Z"
37
+ />
38
+ <path
39
+ class="input_mask__border"
40
+ d="M138.008 100V101H139.001L139.008 100.007L138.008 100ZM139.086 89.8436L138.146 89.5016L139.086 89.8436ZM149.844 79.0855L150.186 80.0252L149.844 79.0855ZM178.156 79.0855L177.814 80.0252L178.156 79.0855ZM188.914 89.8436L189.854 89.5016L188.914 89.8436ZM189.992 100L188.992 100.007L188.999 101H189.992V100ZM322.142 94.1421L322.849 94.8492H322.849L322.142 94.1421ZM322.142 5.85786L322.849 5.15076L322.849 5.15076L322.142 5.85786ZM1 40C1 30.5436 1.00212 23.552 1.72332 18.1878C2.44064 12.8524 3.85281 9.27713 6.56497 6.56497L5.15076 5.15076C2.00506 8.29646 0.488292 12.3641 -0.25885 17.9213C-1.00212 23.4497 -1 30.6002 -1 40H1ZM1 60V40H-1V60H1ZM6.56497 93.435C3.85281 90.7229 2.44064 87.1476 1.72332 81.8122C1.00212 76.448 1 69.4564 1 60H-1C-1 69.3998 -1.00212 76.5503 -0.25885 82.0787C0.488292 87.6358 2.00506 91.7035 5.15076 94.8492L6.56497 93.435ZM40 99C30.5436 99 23.552 98.9979 18.1878 98.2767C12.8524 97.5594 9.27713 96.1472 6.56497 93.435L5.15076 94.8492C8.29646 97.9949 12.3641 99.5117 17.9213 100.259C23.4497 101.002 30.6002 101 40 101V99ZM138.008 99H40V101H138.008V99ZM139.008 100.007C139.042 95.0921 139.222 92.3921 140.025 90.1857L138.146 89.5016C137.207 92.0823 137.042 95.1255 137.008 99.9931L139.008 100.007ZM140.025 90.1857C141.744 85.4636 145.464 81.7439 150.186 80.0252L149.502 78.1458C144.224 80.0667 140.067 84.2241 138.146 89.5016L140.025 90.1857ZM150.186 80.0252C152.961 79.0152 156.464 79 164 79V77C156.638 77 152.692 76.9848 149.502 78.1458L150.186 80.0252ZM164 79C171.536 79 175.039 79.0152 177.814 80.0252L178.498 78.1458C175.308 76.9848 171.362 77 164 77V79ZM177.814 80.0252C182.536 81.7439 186.256 85.4636 187.975 90.1857L189.854 89.5016C187.933 84.2241 183.776 80.0667 178.498 78.1458L177.814 80.0252ZM187.975 90.1857C188.778 92.3921 188.958 95.0921 188.992 100.007L190.992 99.9931C190.958 95.1255 190.793 92.0823 189.854 89.5016L187.975 90.1857ZM288 99H189.992V101H288V99ZM321.435 93.435C318.723 96.1472 315.148 97.5594 309.812 98.2767C304.448 98.9979 297.456 99 288 99V101C297.4 101 304.55 101.002 310.079 100.259C315.636 99.5117 319.704 97.9949 322.849 94.8492L321.435 93.435ZM327 60C327 69.4564 326.998 76.448 326.277 81.8122C325.559 87.1476 324.147 90.7229 321.435 93.435L322.849 94.8492C325.995 91.7035 327.512 87.6358 328.259 82.0787C329.002 76.5503 329 69.3998 329 60H327ZM327 40V60H329V40H327ZM321.435 6.56497C324.147 9.27713 325.559 12.8524 326.277 18.1878C326.998 23.552 327 30.5436 327 40H329C329 30.6002 329.002 23.4497 328.259 17.9213C327.512 12.3642 325.995 8.29646 322.849 5.15076L321.435 6.56497ZM288 1C297.456 1 304.448 1.00212 309.812 1.72332C315.148 2.44064 318.723 3.85281 321.435 6.56497L322.849 5.15076C319.704 2.00506 315.636 0.488292 310.079 -0.25885C304.55 -1.00212 297.4 -1 288 -1V1ZM40 1H288V-1H40V1ZM6.56497 6.56497C9.27713 3.85281 12.8524 2.44064 18.1878 1.72332C23.552 1.00212 30.5436 1 40 1V-1C30.6002 -1 23.4497 -1.00212 17.9213 -0.25885C12.3641 0.488292 8.29646 2.00506 5.15076 5.15076L6.56497 6.56497Z"
41
+ mask="url(#path-1-inside-1_18299_4168)"
42
+ />
43
+ </svg>`;
44
+ export {
45
+ e as MathUtil,
46
+ n as TransactionUtil,
47
+ o as UiHelperUtil,
48
+ L as WuiAccountButton,
49
+ W as WuiAlertBar,
50
+ l as WuiAllWalletsImage,
51
+ r as WuiAvatar,
52
+ M as WuiBalance,
53
+ Z as WuiBanner,
54
+ V as WuiBannerImg,
55
+ d as WuiButton,
56
+ H as WuiCard,
57
+ c as WuiCardSelect,
58
+ p as WuiCardSelectLoader,
59
+ m as WuiCertifiedSwitch,
60
+ k as WuiCheckBox,
61
+ h as WuiChip,
62
+ _ as WuiChipButton,
63
+ I as WuiCompatibleNetwork,
64
+ g as WuiConnectButton,
65
+ B as WuiCtaButton,
66
+ T as WuiDetailsGroup,
67
+ v as WuiDetailsGroupItem,
68
+ w as WuiDropdownMenu,
69
+ S as WuiEmailInput,
70
+ b as WuiEnsInput,
71
+ f as WuiFlex,
72
+ x as WuiGrid,
73
+ A as WuiIcon,
74
+ N as WuiIconBox,
75
+ D as WuiIconButton,
76
+ P as WuiIconLink,
77
+ U as WuiImage,
78
+ E as WuiInputAmount,
79
+ G as WuiInputElement,
80
+ z as WuiInputNumeric,
81
+ F as WuiInputText,
82
+ j as WuiLink,
83
+ q as WuiListAccordion,
84
+ y as WuiListAccount,
85
+ K as WuiListButton,
86
+ O as WuiListContent,
87
+ Q as WuiListDescription,
88
+ J as WuiListItem,
89
+ R as WuiListNetwork,
90
+ X as WuiListSocial,
91
+ $ as WuiListToken,
92
+ Y as WuiListWallet,
93
+ a1 as WuiListWalletTransaction,
94
+ i1 as WuiLoadingHexagon,
95
+ s1 as WuiLoadingSpinner,
96
+ C1 as WuiLoadingThumbnail,
97
+ u1 as WuiLogo,
98
+ t1 as WuiLogoSelect,
99
+ e1 as WuiNetworkButton,
100
+ n1 as WuiNetworkImage,
101
+ o1 as WuiNoticeCard,
102
+ L1 as WuiOtp,
103
+ W1 as WuiPreviewItem,
104
+ l1 as WuiProfileButton,
105
+ r1 as WuiProfileButtonV2,
106
+ M1 as WuiPromo,
107
+ Z1 as WuiQrCode,
108
+ V1 as WuiSearchBar,
109
+ d1 as WuiSelect,
110
+ H1 as WuiSeparator,
111
+ c1 as WuiShimmer,
112
+ p1 as WuiSnackbar,
113
+ m1 as WuiSwitch,
114
+ k1 as WuiTabs,
115
+ h1 as WuiTag,
116
+ _1 as WuiText,
117
+ I1 as WuiTokenButton,
118
+ g1 as WuiTokenListItem,
119
+ B1 as WuiTooltip,
120
+ T1 as WuiTransactionListItem,
121
+ v1 as WuiTransactionListItemLoader,
122
+ w1 as WuiTransactionVisual,
123
+ S1 as WuiVisual,
124
+ b1 as WuiVisualThumbnail,
125
+ f1 as WuiWalletButton,
126
+ x1 as WuiWalletImage,
127
+ A1 as customElement,
128
+ N1 as initializeTheming,
129
+ D1 as setColorTheme,
130
+ P1 as setThemeVariables,
131
+ s as swapInputMaskBottomSvg,
132
+ C as swapInputMaskTopSvg
133
+ };
@@ -0,0 +1,445 @@
1
+ import { p as T, s as M, a as W, r as R, S as I, Q as U, J as k, i as $, b as _, O as N, A as g, x as v, c as b, E as f, C as l, W as h, d as y, e as D, M as P, R as j, f as O, N as w, g as K } from "./index-BTsa09iy.mjs";
2
+ import { h as ne, V as se, Y as ie } from "./index-BTsa09iy.mjs";
3
+ const c = T({
4
+ status: "uninitialized"
5
+ }), p = {
6
+ state: c,
7
+ subscribeKey(t, e) {
8
+ return M(c, t, e);
9
+ },
10
+ subscribe(t) {
11
+ return W(c, () => t(c));
12
+ },
13
+ _getClient() {
14
+ if (!c._client)
15
+ throw new Error("SIWEController client not set");
16
+ return c._client;
17
+ },
18
+ async getNonce(t) {
19
+ const s = await this._getClient().getNonce(t);
20
+ return this.setNonce(s), s;
21
+ },
22
+ async getSession() {
23
+ try {
24
+ const e = await this._getClient().getSession();
25
+ return e && (this.setSession(e), this.setStatus("success")), e || void 0;
26
+ } catch {
27
+ return;
28
+ }
29
+ },
30
+ createMessage(t) {
31
+ const s = this._getClient().createMessage(t);
32
+ return this.setMessage(s), s;
33
+ },
34
+ async verifyMessage(t) {
35
+ return await this._getClient().verifyMessage(t);
36
+ },
37
+ async signIn() {
38
+ return await this._getClient().signIn();
39
+ },
40
+ async signOut() {
41
+ var e;
42
+ const t = this._getClient();
43
+ await t.signOut(), this.setStatus("ready"), this.setSession(void 0), (e = t.onSignOut) == null || e.call(t);
44
+ },
45
+ onSignIn(t) {
46
+ var s;
47
+ const e = this._getClient();
48
+ (s = e.onSignIn) == null || s.call(e, t);
49
+ },
50
+ onSignOut() {
51
+ var e;
52
+ const t = this._getClient();
53
+ (e = t.onSignOut) == null || e.call(t);
54
+ },
55
+ async setSIWEClient(t) {
56
+ c._client = R(t), c.session = await this.getSession(), c.status = c.session ? "success" : "ready";
57
+ },
58
+ setNonce(t) {
59
+ c.nonce = t;
60
+ },
61
+ setStatus(t) {
62
+ c.status = t;
63
+ },
64
+ setMessage(t) {
65
+ c.message = t;
66
+ },
67
+ setSession(t) {
68
+ c.session = t, c.status = t ? "success" : "ready";
69
+ }
70
+ }, A = {
71
+ FIVE_MINUTES_IN_MS: 3e5
72
+ };
73
+ class V {
74
+ constructor(e) {
75
+ const { enabled: s = !0, nonceRefetchIntervalMs: n = A.FIVE_MINUTES_IN_MS, sessionRefetchIntervalMs: i = A.FIVE_MINUTES_IN_MS, signOutOnAccountChange: r = !0, signOutOnDisconnect: a = !0, signOutOnNetworkChange: o = !0, ...u } = e;
76
+ this.options = {
77
+ enabled: s,
78
+ nonceRefetchIntervalMs: n,
79
+ sessionRefetchIntervalMs: i,
80
+ signOutOnDisconnect: a,
81
+ signOutOnAccountChange: r,
82
+ signOutOnNetworkChange: o
83
+ }, this.methods = u;
84
+ }
85
+ async getNonce(e) {
86
+ const s = await this.methods.getNonce(e);
87
+ if (!s)
88
+ throw new Error("siweControllerClient:getNonce - nonce is undefined");
89
+ return s;
90
+ }
91
+ async getMessageParams() {
92
+ var e, s;
93
+ return await ((s = (e = this.methods).getMessageParams) == null ? void 0 : s.call(e)) || {};
94
+ }
95
+ createMessage(e) {
96
+ const s = this.methods.createMessage(e);
97
+ if (!s)
98
+ throw new Error("siweControllerClient:createMessage - message is undefined");
99
+ return s;
100
+ }
101
+ async verifyMessage(e) {
102
+ return await this.methods.verifyMessage(e);
103
+ }
104
+ async getSession() {
105
+ const e = await this.methods.getSession();
106
+ if (!e)
107
+ throw new Error("siweControllerClient:getSession - session is undefined");
108
+ return e;
109
+ }
110
+ async signIn() {
111
+ await I.requestSignMessage();
112
+ const e = await this.methods.getSession();
113
+ if (!e)
114
+ throw new Error("Error verifying SIWE signature");
115
+ return e;
116
+ }
117
+ async signOut() {
118
+ const e = I.getSIWX();
119
+ return e ? (await e.setSessions([]), !0) : !1;
120
+ }
121
+ }
122
+ const F = /0x[a-fA-F0-9]{40}/u, X = /Chain ID: (?<temp1>\d+)/u;
123
+ function Y(t) {
124
+ var e;
125
+ return ((e = t.match(F)) == null ? void 0 : e[0]) || "";
126
+ }
127
+ function q(t) {
128
+ var e;
129
+ return `eip155:${((e = t.match(X)) == null ? void 0 : e[1]) || 1}`;
130
+ }
131
+ async function G({ address: t, message: e, signature: s, chainId: n, projectId: i }) {
132
+ let r = U(t, e, s);
133
+ return r || (r = await k(t, e, s, n, i)), r;
134
+ }
135
+ const L = $`
136
+ :host {
137
+ display: flex;
138
+ justify-content: center;
139
+ gap: var(--wui-spacing-2xl);
140
+ }
141
+
142
+ wui-visual-thumbnail:nth-child(1) {
143
+ z-index: 1;
144
+ }
145
+ `;
146
+ var H = function(t, e, s, n) {
147
+ var i = arguments.length, r = i < 3 ? e : n === null ? n = Object.getOwnPropertyDescriptor(e, s) : n, a;
148
+ if (typeof Reflect == "object" && typeof Reflect.decorate == "function") r = Reflect.decorate(t, e, s, n);
149
+ else for (var o = t.length - 1; o >= 0; o--) (a = t[o]) && (r = (i < 3 ? a(r) : i > 3 ? a(e, s, r) : a(e, s)) || r);
150
+ return i > 3 && r && Object.defineProperty(e, s, r), r;
151
+ };
152
+ let m = class extends _ {
153
+ constructor() {
154
+ var e, s;
155
+ super(...arguments), this.dappImageUrl = (e = N.state.metadata) == null ? void 0 : e.icons, this.walletImageUrl = (s = g.state.connectedWalletInfo) == null ? void 0 : s.icon;
156
+ }
157
+ firstUpdated() {
158
+ var s;
159
+ const e = (s = this.shadowRoot) == null ? void 0 : s.querySelectorAll("wui-visual-thumbnail");
160
+ e != null && e[0] && this.createAnimation(e[0], "translate(18px)"), e != null && e[1] && this.createAnimation(e[1], "translate(-18px)");
161
+ }
162
+ render() {
163
+ var e;
164
+ return v`
165
+ <wui-visual-thumbnail
166
+ ?borderRadiusFull=${!0}
167
+ .imageSrc=${(e = this.dappImageUrl) == null ? void 0 : e[0]}
168
+ ></wui-visual-thumbnail>
169
+ <wui-visual-thumbnail .imageSrc=${this.walletImageUrl}></wui-visual-thumbnail>
170
+ `;
171
+ }
172
+ createAnimation(e, s) {
173
+ e.animate([{ transform: "translateX(0px)" }, { transform: s }], {
174
+ duration: 1600,
175
+ easing: "cubic-bezier(0.56, 0, 0.48, 1)",
176
+ direction: "alternate",
177
+ iterations: 1 / 0
178
+ });
179
+ }
180
+ };
181
+ m.styles = L;
182
+ m = H([
183
+ b("w3m-connecting-siwe")
184
+ ], m);
185
+ var C = function(t, e, s, n) {
186
+ var i = arguments.length, r = i < 3 ? e : n === null ? n = Object.getOwnPropertyDescriptor(e, s) : n, a;
187
+ if (typeof Reflect == "object" && typeof Reflect.decorate == "function") r = Reflect.decorate(t, e, s, n);
188
+ else for (var o = t.length - 1; o >= 0; o--) (a = t[o]) && (r = (i < 3 ? a(r) : i > 3 ? a(e, s, r) : a(e, s)) || r);
189
+ return i > 3 && r && Object.defineProperty(e, s, r), r;
190
+ };
191
+ let S = class extends _ {
192
+ constructor() {
193
+ var e;
194
+ super(...arguments), this.dappName = (e = N.state.metadata) == null ? void 0 : e.name, this.isSigning = !1, this.isCancelling = !1;
195
+ }
196
+ render() {
197
+ return v`
198
+ <wui-flex justifyContent="center" .padding=${["2xl", "0", "xxl", "0"]}>
199
+ <w3m-connecting-siwe></w3m-connecting-siwe>
200
+ </wui-flex>
201
+ <wui-flex
202
+ .padding=${["0", "4xl", "l", "4xl"]}
203
+ gap="s"
204
+ justifyContent="space-between"
205
+ >
206
+ <wui-text variant="paragraph-500" align="center" color="fg-100"
207
+ >${this.dappName ?? "Dapp"} needs to connect to your wallet</wui-text
208
+ >
209
+ </wui-flex>
210
+ <wui-flex
211
+ .padding=${["0", "3xl", "l", "3xl"]}
212
+ gap="s"
213
+ justifyContent="space-between"
214
+ >
215
+ <wui-text variant="small-400" align="center" color="fg-200"
216
+ >Sign this message to prove you own this wallet and proceed. Canceling will disconnect
217
+ you.</wui-text
218
+ >
219
+ </wui-flex>
220
+ <wui-flex .padding=${["l", "xl", "xl", "xl"]} gap="s" justifyContent="space-between">
221
+ <wui-button
222
+ size="lg"
223
+ borderRadius="xs"
224
+ fullWidth
225
+ variant="neutral"
226
+ ?loading=${this.isCancelling}
227
+ @click=${this.onCancel.bind(this)}
228
+ data-testid="w3m-connecting-siwe-cancel"
229
+ >
230
+ Cancel
231
+ </wui-button>
232
+ <wui-button
233
+ size="lg"
234
+ borderRadius="xs"
235
+ fullWidth
236
+ variant="main"
237
+ @click=${this.onSign.bind(this)}
238
+ ?loading=${this.isSigning}
239
+ data-testid="w3m-connecting-siwe-sign"
240
+ >
241
+ ${this.isSigning ? "Signing..." : "Sign"}
242
+ </wui-button>
243
+ </wui-flex>
244
+ `;
245
+ }
246
+ async onSign() {
247
+ var e, s, n;
248
+ this.isSigning = !0, f.sendEvent({
249
+ event: "CLICK_SIGN_SIWX_MESSAGE",
250
+ type: "track",
251
+ properties: {
252
+ network: ((e = l.state.activeCaipNetwork) == null ? void 0 : e.caipNetworkId) || "",
253
+ isSmartAccount: g.state.preferredAccountType === h.ACCOUNT_TYPES.SMART_ACCOUNT
254
+ }
255
+ });
256
+ try {
257
+ p.setStatus("loading");
258
+ const i = await p.signIn();
259
+ return p.setStatus("success"), f.sendEvent({
260
+ event: "SIWX_AUTH_SUCCESS",
261
+ type: "track",
262
+ properties: {
263
+ network: ((s = l.state.activeCaipNetwork) == null ? void 0 : s.caipNetworkId) || "",
264
+ isSmartAccount: g.state.preferredAccountType === h.ACCOUNT_TYPES.SMART_ACCOUNT
265
+ }
266
+ }), i;
267
+ } catch {
268
+ const a = g.state.preferredAccountType === h.ACCOUNT_TYPES.SMART_ACCOUNT;
269
+ return a ? y.showError("This application might not support Smart Accounts") : y.showError("Signature declined"), p.setStatus("error"), f.sendEvent({
270
+ event: "SIWX_AUTH_ERROR",
271
+ type: "track",
272
+ properties: {
273
+ network: ((n = l.state.activeCaipNetwork) == null ? void 0 : n.caipNetworkId) || "",
274
+ isSmartAccount: a
275
+ }
276
+ });
277
+ } finally {
278
+ this.isSigning = !1;
279
+ }
280
+ }
281
+ async onCancel() {
282
+ var s;
283
+ this.isCancelling = !0, l.state.activeCaipAddress ? (await D.disconnect(), P.close()) : j.push("Connect"), this.isCancelling = !1, f.sendEvent({
284
+ event: "CLICK_CANCEL_SIWX",
285
+ type: "track",
286
+ properties: {
287
+ network: ((s = l.state.activeCaipNetwork) == null ? void 0 : s.caipNetworkId) || "",
288
+ isSmartAccount: g.state.preferredAccountType === h.ACCOUNT_TYPES.SMART_ACCOUNT
289
+ }
290
+ });
291
+ }
292
+ };
293
+ C([
294
+ O()
295
+ ], S.prototype, "isSigning", void 0);
296
+ C([
297
+ O()
298
+ ], S.prototype, "isCancelling", void 0);
299
+ S = C([
300
+ b("w3m-connecting-siwe-view")
301
+ ], S);
302
+ const E = [];
303
+ function B(t) {
304
+ async function e() {
305
+ try {
306
+ const n = await t.methods.getSession();
307
+ if (!n)
308
+ return;
309
+ if (!(n != null && n.address))
310
+ throw new Error("SIWE session is missing address");
311
+ if (!(n != null && n.chainId))
312
+ throw new Error("SIWE session is missing chainId");
313
+ return n;
314
+ } catch (n) {
315
+ console.warn("AppKit:SIWE:getSession - error:", n);
316
+ return;
317
+ }
318
+ }
319
+ async function s() {
320
+ var n, i;
321
+ await t.methods.signOut(), (i = (n = t.methods).onSignOut) == null || i.call(n);
322
+ }
323
+ return E.forEach((n) => n()), E.push(l.subscribeKey("activeCaipNetwork", async (n) => {
324
+ if (!t.options.signOutOnNetworkChange)
325
+ return;
326
+ const i = await e();
327
+ i && i.chainId !== w.caipNetworkIdToNumber(n == null ? void 0 : n.caipNetworkId) && await s();
328
+ }), l.subscribeKey("activeCaipAddress", async (n) => {
329
+ var i, r, a;
330
+ if (t.options.signOutOnDisconnect && !n) {
331
+ await e() && await s();
332
+ return;
333
+ }
334
+ if (t.options.signOutOnAccountChange) {
335
+ const o = await e(), u = (i = o == null ? void 0 : o.address) == null ? void 0 : i.toLowerCase(), d = (a = (r = K) == null ? void 0 : r.getPlainAddress(n)) == null ? void 0 : a.toLowerCase();
336
+ o && u !== d && await s();
337
+ }
338
+ })), {
339
+ async createMessage(n) {
340
+ var u, d;
341
+ const i = await ((d = (u = t.methods).getMessageParams) == null ? void 0 : d.call(u));
342
+ if (!i)
343
+ throw new Error("Failed to get message params!");
344
+ const r = await t.getNonce(n.accountAddress), a = i.iat || (/* @__PURE__ */ new Date()).toISOString(), o = "1";
345
+ return {
346
+ nonce: r,
347
+ version: o,
348
+ requestId: i.requestId,
349
+ accountAddress: n.accountAddress,
350
+ chainId: n.chainId,
351
+ domain: i.domain,
352
+ uri: i.uri,
353
+ notBefore: i.nbf,
354
+ resources: i.resources,
355
+ statement: i.statement,
356
+ expirationTime: i.exp,
357
+ issuedAt: a,
358
+ toString: () => t.createMessage({
359
+ ...i,
360
+ chainId: w.caipNetworkIdToNumber(n.chainId) || 1,
361
+ address: `did:pkh:${n.chainId}:${n.accountAddress}`,
362
+ nonce: r,
363
+ version: o,
364
+ iat: a
365
+ })
366
+ };
367
+ },
368
+ async addSession(n) {
369
+ var r, a;
370
+ if (!w.parseEvmChainId(n.data.chainId))
371
+ return Promise.resolve();
372
+ if (await t.methods.verifyMessage(n))
373
+ return (a = (r = t.methods).onSignIn) == null || a.call(r, {
374
+ address: n.data.accountAddress,
375
+ chainId: w.parseEvmChainId(n.data.chainId)
376
+ }), Promise.resolve();
377
+ throw new Error("Failed to verify message");
378
+ },
379
+ async revokeSession(n, i) {
380
+ try {
381
+ await s();
382
+ } catch (r) {
383
+ console.warn("AppKit:SIWE:revokeSession - signOut error", r);
384
+ }
385
+ },
386
+ async setSessions(n) {
387
+ if (n.length === 0)
388
+ try {
389
+ await s();
390
+ } catch (i) {
391
+ console.warn("AppKit:SIWE:setSessions - signOut error", i);
392
+ }
393
+ else {
394
+ const i = n.find((r) => {
395
+ var a;
396
+ return r.data.chainId === ((a = l.getActiveCaipNetwork()) == null ? void 0 : a.caipNetworkId);
397
+ }) || n[0];
398
+ await this.addSession(i);
399
+ }
400
+ },
401
+ async getSessions(n, i) {
402
+ var r;
403
+ try {
404
+ if (!n.startsWith("eip155:"))
405
+ return [
406
+ {
407
+ data: {
408
+ accountAddress: i,
409
+ chainId: n
410
+ },
411
+ message: "",
412
+ signature: ""
413
+ }
414
+ ];
415
+ const a = await e(), o = `eip155:${a == null ? void 0 : a.chainId}`, u = (r = a == null ? void 0 : a.address) == null ? void 0 : r.toLowerCase(), d = i == null ? void 0 : i.toLowerCase();
416
+ return !a || u !== d || o !== n ? [] : [{
417
+ data: {
418
+ accountAddress: a.address,
419
+ chainId: o
420
+ },
421
+ message: "",
422
+ signature: ""
423
+ }];
424
+ } catch (a) {
425
+ return console.warn("AppKit:SIWE:getSessions - error:", a), [];
426
+ }
427
+ }
428
+ };
429
+ }
430
+ function Z(t) {
431
+ return new V(t);
432
+ }
433
+ export {
434
+ p as SIWEController,
435
+ m as W3mConnectingSiwe,
436
+ S as W3mConnectingSiweView,
437
+ Z as createSIWEConfig,
438
+ ne as formatMessage,
439
+ Y as getAddressFromMessage,
440
+ q as getChainIdFromMessage,
441
+ se as getDidAddress,
442
+ ie as getDidChainId,
443
+ B as mapToSIWX,
444
+ G as verifySignature
445
+ };