astra-modal-test 1.0.11 → 1.0.13

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 (110) hide show
  1. package/README.md +224 -122
  2. package/dist/nodeflow-sdk.es.js +12646 -0
  3. package/package.json +10 -10
  4. package/dist/SwapController-Ck3TYcMp.js +0 -447
  5. package/dist/add-BmBLHIEe.js +0 -19
  6. package/dist/all-wallets-H2aaJ2oP.js +0 -10
  7. package/dist/app-store-Bvhe1BkA.js +0 -21
  8. package/dist/apple-BCIKns5c.js +0 -22
  9. package/dist/arrow-bottom-circle-Dpcn0z0p.js +0 -15
  10. package/dist/arrow-bottom-i1ChNkSf.js +0 -12
  11. package/dist/arrow-left-Dj8tzUf6.js +0 -12
  12. package/dist/arrow-right-DVd3R-0K.js +0 -12
  13. package/dist/arrow-top-DcD5wbZL.js +0 -12
  14. package/dist/astra-sdk.es.js +0 -9
  15. package/dist/bank-CToLOTy3.js +0 -18
  16. package/dist/bin-D8m48Dk5.js +0 -8
  17. package/dist/bitcoin-y6S4LO0p.js +0 -17
  18. package/dist/browser-DRhVaQQT.js +0 -18
  19. package/dist/card-BK0q3S4W.js +0 -18
  20. package/dist/ccip-CH1B6Zeh.js +0 -149
  21. package/dist/checkmark-C7H1vH4H.js +0 -15
  22. package/dist/checkmark-bold-DfvIWKpu.js +0 -12
  23. package/dist/chevron-bottom-CcAEP6cD.js +0 -12
  24. package/dist/chevron-left-DMnhSBVl.js +0 -12
  25. package/dist/chevron-right-pPhw9ZBC.js +0 -12
  26. package/dist/chevron-top-DjqOCRAL.js +0 -12
  27. package/dist/chrome-store-B-9bRAPM.js +0 -65
  28. package/dist/circle-SPbxfVZq.js +0 -8
  29. package/dist/clock-BLAT4wv4.js +0 -12
  30. package/dist/close-D1AyyJzy.js +0 -12
  31. package/dist/clsx.m-DCYaa4RU.js +0 -20
  32. package/dist/coinPlaceholder-DGk1in74.js +0 -12
  33. package/dist/compass-C0-SVkSt.js +0 -12
  34. package/dist/copy-CPcvwITz.js +0 -19
  35. package/dist/cursor-ChlOWEcO.js +0 -7
  36. package/dist/cursor-transparent-BJsEpe-G.js +0 -16
  37. package/dist/desktop-Z8iZvVCW.js +0 -13
  38. package/dist/disconnect-DkPQjiLk.js +0 -12
  39. package/dist/discord-CwRdgvGZ.js +0 -21
  40. package/dist/email-DA_5xt-j.js +0 -10
  41. package/dist/embedded-wallet-DYnGl5tL.js +0 -464
  42. package/dist/ethereum-Dwse3Umc.js +0 -14
  43. package/dist/etherscan-CNmwyrRn.js +0 -10
  44. package/dist/exclamation-triangle-CU8gn-bU.js +0 -8
  45. package/dist/extension-rikwXWrg.js +0 -12
  46. package/dist/external-link-mDp8JVE0.js +0 -12
  47. package/dist/facebook-c0IS1D9G.js +0 -30
  48. package/dist/farcaster-DpvSDnGl.js +0 -16
  49. package/dist/filters-B42-1BLn.js +0 -12
  50. package/dist/github-DvjZxkXF.js +0 -22
  51. package/dist/google-CLHf_zAz.js +0 -22
  52. package/dist/help-circle-BI5xgPAz.js +0 -16
  53. package/dist/id-BxI79dX4.js +0 -16
  54. package/dist/image-Cr1qAxG-.js +0 -8
  55. package/dist/index-C0USsgDi.js +0 -15911
  56. package/dist/index-C49-8bCQ.js +0 -709
  57. package/dist/index-CH4T0JAz.js +0 -10785
  58. package/dist/index-CWAoFGd1.js +0 -315
  59. package/dist/index-C_3PUMa7.js +0 -70
  60. package/dist/index-ChxXyuZj.js +0 -572
  61. package/dist/index-D7jufxlk.js +0 -33
  62. package/dist/index-DZiQey0J.js +0 -386
  63. package/dist/index-DtAG8k9M.js +0 -1060
  64. package/dist/index-Zh6wUpmX.js +0 -74596
  65. package/dist/index-utoSbRla.js +0 -21034
  66. package/dist/info-BUp5BYav.js +0 -7
  67. package/dist/info-circle-D5anzkYK.js +0 -16
  68. package/dist/lightbulb-DmuhLv29.js +0 -7
  69. package/dist/mail-D2hRmmgi.js +0 -12
  70. package/dist/mobile-Cq-9uJHv.js +0 -13
  71. package/dist/more-DJMBaB2z.js +0 -15
  72. package/dist/network-placeholder-3ip1roR0.js +0 -18
  73. package/dist/nftPlaceholder-C7r74zYS.js +0 -12
  74. package/dist/off-CJE6Z_MK.js +0 -8
  75. package/dist/onramp-BMRgbt2I.js +0 -917
  76. package/dist/play-store-CxusWynI.js +0 -36
  77. package/dist/plus-Bjkqj5g6.js +0 -17
  78. package/dist/qr-code-4C0zboga.js +0 -10
  79. package/dist/receive-Cc8moHBZ.js +0 -179
  80. package/dist/recycle-horizontal-BdSgk84g.js +0 -13
  81. package/dist/refresh-BsRodAS7.js +0 -12
  82. package/dist/reown-logo-DOVlqCDK.js +0 -16
  83. package/dist/search-BIyHtky-.js +0 -12
  84. package/dist/secp256k1-B2Gq-iIr.js +0 -1257
  85. package/dist/send-9eSi58hW.js +0 -19
  86. package/dist/send-CBFTcYtn.js +0 -1039
  87. package/dist/socials-CeOJULFV.js +0 -589
  88. package/dist/solana-BNptwYvn.js +0 -17
  89. package/dist/swapHorizontal-COlgqyzt.js +0 -12
  90. package/dist/swapHorizontalBold-Odce2JOe.js +0 -12
  91. package/dist/swapHorizontalMedium-B9nkEBPD.js +0 -20
  92. package/dist/swapHorizontalRoundedBold-DPMzz6nz.js +0 -12
  93. package/dist/swapVertical-FqQP9GBP.js +0 -12
  94. package/dist/swaps-BG9GOayX.js +0 -1713
  95. package/dist/telegram-BMY9Hs9Z.js +0 -20
  96. package/dist/three-dots-DDKmexHU.js +0 -9
  97. package/dist/transactions-C_GII6kW.js +0 -35
  98. package/dist/twitch-x_s0neNg.js +0 -22
  99. package/dist/twitterIcon-CKsSxEuJ.js +0 -10
  100. package/dist/ui-CZH-vf5h.js +0 -812
  101. package/dist/user-CZfvQDJ_.js +0 -7
  102. package/dist/verify-Bnvbadnx.js +0 -12
  103. package/dist/verify-filled-CnEopkW-.js +0 -12
  104. package/dist/w3m-modal-DkI2TPJW.js +0 -1041
  105. package/dist/wallet-B3oN4n4q.js +0 -12
  106. package/dist/wallet-placeholder-CI0oiAcd.js +0 -18
  107. package/dist/walletconnect-D4vMcjqO.js +0 -36
  108. package/dist/warning-circle-DjI8aRBs.js +0 -16
  109. package/dist/x-BgRWY62H.js +0 -16
  110. package/dist/x-mark-Cdqd-Hm4.js +0 -7
package/package.json CHANGED
@@ -1,8 +1,10 @@
1
1
  {
2
2
  "name": "astra-modal-test",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "license": "MIT",
5
- "main": "dist/astra-sdk.es.js",
5
+ "main": "dist/nodeflow-sdk.es.js",
6
+ "module": "dist/nodeflow-sdk.es.js",
7
+ "types": "dist/index.d.ts",
6
8
  "type": "module",
7
9
  "scripts": {
8
10
  "dev": "vite",
@@ -17,6 +19,7 @@
17
19
  ],
18
20
  "dependencies": {
19
21
  "@ant-design/icons": "^5.5.2",
22
+ "@lnfi-network/nodeflow-api": "^1.0.0-alpha.3",
20
23
  "@reown/appkit": "^1.6.4",
21
24
  "@reown/appkit-adapter-wagmi": "^1.6.4",
22
25
  "@tanstack/react-query": "^5.64.1",
@@ -26,19 +29,14 @@
26
29
  "consola": "^3.4.2",
27
30
  "dayjs": "^1.11.13",
28
31
  "decimal.js": "^10.4.3",
29
- "react": "^18.3.1",
30
- "react-dom": "^18.3.1",
31
32
  "styled-components": "^6.1.13",
32
33
  "viem": "^2.22.9",
33
34
  "wagmi": "^2.14.8",
34
35
  "zustand": "^5.0.2"
35
36
  },
36
37
  "peerDependencies": {
37
- "@reown/appkit": "^1.6.4",
38
- "@reown/appkit-adapter-wagmi": "^1.6.4",
39
- "@tanstack/react-query": "^5.64.1",
40
- "viem": "^2.22.9",
41
- "wagmi": "^2.14.8"
38
+ "react": ">=17.0.0",
39
+ "react-dom": ">=17.0.0"
42
40
  },
43
41
  "devDependencies": {
44
42
  "@eslint/js": "^9.15.0",
@@ -50,8 +48,10 @@
50
48
  "eslint-plugin-react-hooks": "^5.1.0",
51
49
  "eslint-plugin-react-refresh": "^0.4.14",
52
50
  "globals": "^15.12.0",
51
+ "react": "^19.2.4",
52
+ "react-dom": "^19.2.4",
53
53
  "vite": "^6.0.3",
54
54
  "vite-plugin-node-polyfills": "^0.24.0",
55
55
  "vite-plugin-style-import": "^2.0.0"
56
56
  }
57
- }
57
+ }
@@ -1,447 +0,0 @@
1
- import { N as l, L as G, M as O, R as f, S as g, O as E, P as S, Q as U, T as D, U as B, V as P, X as b, Y as M, Z as C, _ as z, $ as R, a0 as V, a1 as x, a2 as H, a3 as $, a4 as Q, a5 as q } from "./index-Zh6wUpmX.js";
2
- const I = {
3
- getGasPriceInEther(n, t) {
4
- const o = t * n;
5
- return Number(o) / 1e18;
6
- },
7
- getGasPriceInUSD(n, t, o) {
8
- const s = I.getGasPriceInEther(t, o);
9
- return l.bigNumber(n).times(s).toNumber();
10
- },
11
- getPriceImpact({ sourceTokenAmount: n, sourceTokenPriceInUSD: t, toTokenPriceInUSD: o, toTokenAmount: s }) {
12
- const r = l.bigNumber(n).times(t), i = l.bigNumber(s).times(o);
13
- return r.minus(i).div(r).times(100).toNumber();
14
- },
15
- getMaxSlippage(n, t) {
16
- const o = l.bigNumber(n).div(100);
17
- return l.multiply(t, o).toNumber();
18
- },
19
- getProviderFee(n, t = 85e-4) {
20
- return l.bigNumber(n).times(t).toString();
21
- },
22
- isInsufficientNetworkTokenForGas(n, t) {
23
- const o = t || "0";
24
- return l.bigNumber(n).eq(0) ? !0 : l.bigNumber(l.bigNumber(o)).gt(n);
25
- },
26
- isInsufficientSourceTokenForSwap(n, t, o) {
27
- var i, u;
28
- const s = (u = (i = o == null ? void 0 : o.find((d) => d.address === t)) == null ? void 0 : i.quantity) == null ? void 0 : u.numeric;
29
- return l.bigNumber(s || "0").lt(n);
30
- }
31
- }, _ = 15e4, Y = 6, T = {
32
- // Loading states
33
- initializing: !1,
34
- initialized: !1,
35
- loadingPrices: !1,
36
- loadingQuote: !1,
37
- loadingApprovalTransaction: !1,
38
- loadingBuildTransaction: !1,
39
- loadingTransaction: !1,
40
- // Error states
41
- fetchError: !1,
42
- // Approval & Swap transaction states
43
- approvalTransaction: void 0,
44
- swapTransaction: void 0,
45
- transactionError: void 0,
46
- // Input values
47
- sourceToken: void 0,
48
- sourceTokenAmount: "",
49
- sourceTokenPriceInUSD: 0,
50
- toToken: void 0,
51
- toTokenAmount: "",
52
- toTokenPriceInUSD: 0,
53
- networkPrice: "0",
54
- networkBalanceInUSD: "0",
55
- networkTokenSymbol: "",
56
- inputError: void 0,
57
- // Request values
58
- slippage: x.CONVERT_SLIPPAGE_TOLERANCE,
59
- // Tokens
60
- tokens: void 0,
61
- popularTokens: void 0,
62
- suggestedTokens: void 0,
63
- foundTokens: void 0,
64
- myTokensWithBalance: void 0,
65
- tokensPriceMap: {},
66
- // Calculations
67
- gasFee: "0",
68
- gasPriceInUSD: 0,
69
- priceImpact: void 0,
70
- maxSlippage: void 0,
71
- providerFee: void 0
72
- }, e = O({ ...T }), v = {
73
- state: e,
74
- subscribe(n) {
75
- return q(e, () => n(e));
76
- },
77
- subscribeKey(n, t) {
78
- return Q(e, n, t);
79
- },
80
- getParams() {
81
- var d, c, p, m, A, w, y, h;
82
- const n = P.state.activeCaipAddress, t = M.getPlainAddress(n), o = H(), s = $.getConnectorId(P.state.activeChain);
83
- if (!t)
84
- throw new Error("No address found to swap the tokens from.");
85
- const r = !((d = e.toToken) != null && d.address) || !((c = e.toToken) != null && c.decimals), i = !((p = e.sourceToken) != null && p.address) || !((m = e.sourceToken) != null && m.decimals) || !l.bigNumber(e.sourceTokenAmount).gt(0), u = !e.sourceTokenAmount;
86
- return {
87
- networkAddress: o,
88
- fromAddress: t,
89
- fromCaipAddress: n,
90
- sourceTokenAddress: (A = e.sourceToken) == null ? void 0 : A.address,
91
- toTokenAddress: (w = e.toToken) == null ? void 0 : w.address,
92
- toTokenAmount: e.toTokenAmount,
93
- toTokenDecimals: (y = e.toToken) == null ? void 0 : y.decimals,
94
- sourceTokenAmount: e.sourceTokenAmount,
95
- sourceTokenDecimals: (h = e.sourceToken) == null ? void 0 : h.decimals,
96
- invalidToToken: r,
97
- invalidSourceToken: i,
98
- invalidSourceTokenAmount: u,
99
- availableToSwap: n && !r && !i && !u,
100
- isAuthConnector: s === S.CONNECTOR_ID.AUTH
101
- };
102
- },
103
- setSourceToken(n) {
104
- if (!n) {
105
- e.sourceToken = n, e.sourceTokenAmount = "", e.sourceTokenPriceInUSD = 0;
106
- return;
107
- }
108
- e.sourceToken = n, a.setTokenPrice(n.address, "sourceToken");
109
- },
110
- setSourceTokenAmount(n) {
111
- e.sourceTokenAmount = n;
112
- },
113
- setToToken(n) {
114
- if (!n) {
115
- e.toToken = n, e.toTokenAmount = "", e.toTokenPriceInUSD = 0;
116
- return;
117
- }
118
- e.toToken = n, a.setTokenPrice(n.address, "toToken");
119
- },
120
- setToTokenAmount(n) {
121
- e.toTokenAmount = n ? l.toFixed(n, Y) : "";
122
- },
123
- async setTokenPrice(n, t) {
124
- let o = e.tokensPriceMap[n] || 0;
125
- o || (e.loadingPrices = !0, o = await a.getAddressPrice(n)), t === "sourceToken" ? e.sourceTokenPriceInUSD = o : t === "toToken" && (e.toTokenPriceInUSD = o), e.loadingPrices && (e.loadingPrices = !1), a.getParams().availableToSwap && a.swapTokens();
126
- },
127
- switchTokens() {
128
- if (e.initializing || !e.initialized)
129
- return;
130
- const n = e.toToken ? { ...e.toToken } : void 0, t = e.sourceToken ? { ...e.sourceToken } : void 0, o = n && e.toTokenAmount === "" ? "1" : e.toTokenAmount;
131
- a.setSourceToken(n), a.setToToken(t), a.setSourceTokenAmount(o), a.setToTokenAmount(""), a.swapTokens();
132
- },
133
- resetState() {
134
- e.myTokensWithBalance = T.myTokensWithBalance, e.tokensPriceMap = T.tokensPriceMap, e.initialized = T.initialized, e.initializing = T.initializing, e.sourceToken = T.sourceToken, e.sourceTokenAmount = T.sourceTokenAmount, e.sourceTokenPriceInUSD = T.sourceTokenPriceInUSD, e.toToken = T.toToken, e.toTokenAmount = T.toTokenAmount, e.toTokenPriceInUSD = T.toTokenPriceInUSD, e.networkPrice = T.networkPrice, e.networkTokenSymbol = T.networkTokenSymbol, e.networkBalanceInUSD = T.networkBalanceInUSD, e.inputError = T.inputError;
135
- },
136
- resetValues() {
137
- var o;
138
- const { networkAddress: n } = a.getParams(), t = (o = e.tokens) == null ? void 0 : o.find((s) => s.address === n);
139
- a.setSourceToken(t), a.setToToken(void 0);
140
- },
141
- getApprovalLoadingState() {
142
- return e.loadingApprovalTransaction;
143
- },
144
- clearError() {
145
- e.transactionError = void 0;
146
- },
147
- async initializeState() {
148
- if (!e.initializing) {
149
- if (e.initializing = !0, !e.initialized)
150
- try {
151
- await a.fetchTokens(), e.initialized = !0;
152
- } catch {
153
- e.initialized = !1, g.showError("Failed to initialize swap"), f.goBack();
154
- }
155
- e.initializing = !1;
156
- }
157
- },
158
- async fetchTokens() {
159
- var o;
160
- const { networkAddress: n } = a.getParams();
161
- await a.getNetworkTokenPrice(), await a.getMyTokensWithBalance();
162
- const t = (o = e.myTokensWithBalance) == null ? void 0 : o.find((s) => s.address === n);
163
- t && (e.networkTokenSymbol = t.symbol, a.setSourceToken(t), a.setSourceTokenAmount("0"));
164
- },
165
- async getTokenList() {
166
- var t;
167
- const n = (t = P.state.activeCaipNetwork) == null ? void 0 : t.caipNetworkId;
168
- if (!(e.caipNetworkId === n && e.tokens))
169
- try {
170
- e.tokensLoading = !0;
171
- const o = await C.getTokenList(n);
172
- e.tokens = o, e.caipNetworkId = n, e.popularTokens = o.sort((s, r) => s.symbol < r.symbol ? -1 : s.symbol > r.symbol ? 1 : 0), e.suggestedTokens = o.filter((s) => !!x.SWAP_SUGGESTED_TOKENS.includes(s.symbol));
173
- } catch {
174
- e.tokens = [], e.popularTokens = [], e.suggestedTokens = [];
175
- } finally {
176
- e.tokensLoading = !1;
177
- }
178
- },
179
- async getAddressPrice(n) {
180
- var c, p;
181
- const t = e.tokensPriceMap[n];
182
- if (t)
183
- return t;
184
- const o = await b.fetchTokenPrice({
185
- addresses: [n]
186
- }), s = (o == null ? void 0 : o.fungibles) || [], r = [...e.tokens || [], ...e.myTokensWithBalance || []], i = (c = r == null ? void 0 : r.find((m) => m.address === n)) == null ? void 0 : c.symbol, u = ((p = s.find((m) => m.symbol.toLowerCase() === (i == null ? void 0 : i.toLowerCase()))) == null ? void 0 : p.price) || 0, d = parseFloat(u.toString());
187
- return e.tokensPriceMap[n] = d, d;
188
- },
189
- async getNetworkTokenPrice() {
190
- var r;
191
- const { networkAddress: n } = a.getParams(), o = (r = (await b.fetchTokenPrice({
192
- addresses: [n]
193
- }).catch(() => (g.showError("Failed to fetch network token price"), { fungibles: [] }))).fungibles) == null ? void 0 : r[0], s = (o == null ? void 0 : o.price.toString()) || "0";
194
- e.tokensPriceMap[n] = parseFloat(s), e.networkTokenSymbol = (o == null ? void 0 : o.symbol) || "", e.networkPrice = s;
195
- },
196
- async getMyTokensWithBalance(n) {
197
- const t = await V.getMyTokensWithBalance(n), o = C.mapBalancesToSwapTokens(t);
198
- o && (await a.getInitialGasPrice(), a.setBalances(o));
199
- },
200
- setBalances(n) {
201
- const { networkAddress: t } = a.getParams(), o = P.state.activeCaipNetwork;
202
- if (!o)
203
- return;
204
- const s = n.find((r) => r.address === t);
205
- n.forEach((r) => {
206
- e.tokensPriceMap[r.address] = r.price || 0;
207
- }), e.myTokensWithBalance = n.filter((r) => r.address.startsWith(o.caipNetworkId)), e.networkBalanceInUSD = s ? l.multiply(s.quantity.numeric, s.price).toString() : "0";
208
- },
209
- async getInitialGasPrice() {
210
- var t, o;
211
- const n = await C.fetchGasPrice();
212
- if (!n)
213
- return { gasPrice: null, gasPriceInUSD: null };
214
- switch ((o = (t = P.state) == null ? void 0 : t.activeCaipNetwork) == null ? void 0 : o.chainNamespace) {
215
- case S.CHAIN.SOLANA:
216
- return e.gasFee = n.standard ?? "0", e.gasPriceInUSD = l.multiply(n.standard, e.networkPrice).div(1e9).toNumber(), {
217
- gasPrice: BigInt(e.gasFee),
218
- gasPriceInUSD: Number(e.gasPriceInUSD)
219
- };
220
- case S.CHAIN.EVM:
221
- default:
222
- const s = n.standard ?? "0", r = BigInt(s), i = BigInt(_), u = I.getGasPriceInUSD(e.networkPrice, i, r);
223
- return e.gasFee = s, e.gasPriceInUSD = u, { gasPrice: r, gasPriceInUSD: u };
224
- }
225
- },
226
- // -- Swap -------------------------------------- //
227
- async swapTokens() {
228
- var i, u;
229
- const n = z.state.address, t = e.sourceToken, o = e.toToken, s = l.bigNumber(e.sourceTokenAmount).gt(0);
230
- if (s || a.setToTokenAmount(""), !o || !t || e.loadingPrices || !s)
231
- return;
232
- e.loadingQuote = !0;
233
- const r = l.bigNumber(e.sourceTokenAmount).times(10 ** t.decimals).round(0);
234
- try {
235
- const d = await b.fetchSwapQuote({
236
- userAddress: n,
237
- from: t.address,
238
- to: o.address,
239
- gasPrice: e.gasFee,
240
- amount: r.toString()
241
- });
242
- e.loadingQuote = !1;
243
- const c = (u = (i = d == null ? void 0 : d.quotes) == null ? void 0 : i[0]) == null ? void 0 : u.toAmount;
244
- if (!c) {
245
- R.open({
246
- displayMessage: "Incorrect amount",
247
- debugMessage: "Please enter a valid amount"
248
- }, "error");
249
- return;
250
- }
251
- const p = l.bigNumber(c).div(10 ** o.decimals).toString();
252
- a.setToTokenAmount(p), a.hasInsufficientToken(e.sourceTokenAmount, t.address) ? e.inputError = "Insufficient balance" : (e.inputError = void 0, a.setTransactionDetails());
253
- } catch {
254
- e.loadingQuote = !1, e.inputError = "Insufficient balance";
255
- }
256
- },
257
- // -- Create Transactions -------------------------------------- //
258
- async getTransaction() {
259
- const { fromCaipAddress: n, availableToSwap: t } = a.getParams(), o = e.sourceToken, s = e.toToken;
260
- if (!(!n || !t || !o || !s || e.loadingQuote))
261
- try {
262
- e.loadingBuildTransaction = !0;
263
- const r = await C.fetchSwapAllowance({
264
- userAddress: n,
265
- tokenAddress: o.address,
266
- sourceTokenAmount: e.sourceTokenAmount,
267
- sourceTokenDecimals: o.decimals
268
- });
269
- let i;
270
- return r ? i = await a.createSwapTransaction() : i = await a.createAllowanceTransaction(), e.loadingBuildTransaction = !1, e.fetchError = !1, i;
271
- } catch {
272
- f.goBack(), g.showError("Failed to check allowance"), e.loadingBuildTransaction = !1, e.approvalTransaction = void 0, e.swapTransaction = void 0, e.fetchError = !0;
273
- return;
274
- }
275
- },
276
- async createAllowanceTransaction() {
277
- const { fromCaipAddress: n, sourceTokenAddress: t, toTokenAddress: o } = a.getParams();
278
- if (!(!n || !o)) {
279
- if (!t)
280
- throw new Error("createAllowanceTransaction - No source token address found.");
281
- try {
282
- const s = await b.generateApproveCalldata({
283
- from: t,
284
- to: o,
285
- userAddress: n
286
- }), r = M.getPlainAddress(s.tx.from);
287
- if (!r)
288
- throw new Error("SwapController:createAllowanceTransaction - address is required");
289
- const i = {
290
- data: s.tx.data,
291
- to: r,
292
- gasPrice: BigInt(s.tx.eip155.gasPrice),
293
- value: BigInt(s.tx.value),
294
- toAmount: e.toTokenAmount
295
- };
296
- return e.swapTransaction = void 0, e.approvalTransaction = {
297
- data: i.data,
298
- to: i.to,
299
- gasPrice: i.gasPrice,
300
- value: i.value,
301
- toAmount: i.toAmount
302
- }, {
303
- data: i.data,
304
- to: i.to,
305
- gasPrice: i.gasPrice,
306
- value: i.value,
307
- toAmount: i.toAmount
308
- };
309
- } catch {
310
- f.goBack(), g.showError("Failed to create approval transaction"), e.approvalTransaction = void 0, e.swapTransaction = void 0, e.fetchError = !0;
311
- return;
312
- }
313
- }
314
- },
315
- async createSwapTransaction() {
316
- var u;
317
- const { networkAddress: n, fromCaipAddress: t, sourceTokenAmount: o } = a.getParams(), s = e.sourceToken, r = e.toToken;
318
- if (!t || !o || !s || !r)
319
- return;
320
- const i = (u = E.parseUnits(o, s.decimals)) == null ? void 0 : u.toString();
321
- try {
322
- const d = await b.generateSwapCalldata({
323
- userAddress: t,
324
- from: s.address,
325
- to: r.address,
326
- amount: i,
327
- disableEstimate: !0
328
- }), c = s.address === n, p = BigInt(d.tx.eip155.gas), m = BigInt(d.tx.eip155.gasPrice), A = M.getPlainAddress(d.tx.to);
329
- if (!A)
330
- throw new Error("SwapController:createSwapTransaction - address is required");
331
- const w = {
332
- data: d.tx.data,
333
- to: A,
334
- gas: p,
335
- gasPrice: m,
336
- value: BigInt(c ? i ?? "0" : "0"),
337
- toAmount: e.toTokenAmount
338
- };
339
- return e.gasPriceInUSD = I.getGasPriceInUSD(e.networkPrice, p, m), e.approvalTransaction = void 0, e.swapTransaction = w, w;
340
- } catch {
341
- f.goBack(), g.showError("Failed to create transaction"), e.approvalTransaction = void 0, e.swapTransaction = void 0, e.fetchError = !0;
342
- return;
343
- }
344
- },
345
- onEmbeddedWalletApprovalSuccess() {
346
- g.showLoading("Approve limit increase in your wallet"), f.replace("SwapPreview");
347
- },
348
- // -- Send Transactions --------------------------------- //
349
- async sendTransactionForApproval(n) {
350
- var r, i, u;
351
- const { fromAddress: t, isAuthConnector: o } = a.getParams();
352
- e.loadingApprovalTransaction = !0, o ? f.pushTransactionStack({
353
- onSuccess: a.onEmbeddedWalletApprovalSuccess
354
- }) : g.showLoading("Approve limit increase in your wallet");
355
- try {
356
- await E.sendTransaction({
357
- address: t,
358
- to: n.to,
359
- data: n.data,
360
- value: n.value,
361
- chainNamespace: S.CHAIN.EVM
362
- }), await a.swapTokens(), await a.getTransaction(), e.approvalTransaction = void 0, e.loadingApprovalTransaction = !1;
363
- } catch (d) {
364
- const c = d;
365
- e.transactionError = c == null ? void 0 : c.displayMessage, e.loadingApprovalTransaction = !1, g.showError((c == null ? void 0 : c.displayMessage) || "Transaction error"), U.sendEvent({
366
- type: "track",
367
- event: "SWAP_APPROVAL_ERROR",
368
- properties: {
369
- message: (c == null ? void 0 : c.displayMessage) || (c == null ? void 0 : c.message) || "Unknown",
370
- network: ((r = P.state.activeCaipNetwork) == null ? void 0 : r.caipNetworkId) || "",
371
- swapFromToken: ((i = a.state.sourceToken) == null ? void 0 : i.symbol) || "",
372
- swapToToken: ((u = a.state.toToken) == null ? void 0 : u.symbol) || "",
373
- swapFromAmount: a.state.sourceTokenAmount || "",
374
- swapToAmount: a.state.toTokenAmount || "",
375
- isSmartAccount: D(S.CHAIN.EVM) === B.ACCOUNT_TYPES.SMART_ACCOUNT
376
- }
377
- });
378
- }
379
- },
380
- async sendTransactionForSwap(n) {
381
- var u, d, c, p, m, A, w, y, h, F, L, W;
382
- if (!n)
383
- return;
384
- const { fromAddress: t, toTokenAmount: o, isAuthConnector: s } = a.getParams();
385
- e.loadingTransaction = !0;
386
- const r = `Swapping ${(u = e.sourceToken) == null ? void 0 : u.symbol} to ${l.formatNumberToLocalString(o, 3)} ${(d = e.toToken) == null ? void 0 : d.symbol}`, i = `Swapped ${(c = e.sourceToken) == null ? void 0 : c.symbol} to ${l.formatNumberToLocalString(o, 3)} ${(p = e.toToken) == null ? void 0 : p.symbol}`;
387
- s ? f.pushTransactionStack({
388
- onSuccess() {
389
- f.replace("Account"), g.showLoading(r), v.resetState();
390
- }
391
- }) : g.showLoading("Confirm transaction in your wallet");
392
- try {
393
- const N = [(m = e.sourceToken) == null ? void 0 : m.address, (A = e.toToken) == null ? void 0 : A.address].join(","), k = await E.sendTransaction({
394
- address: t,
395
- to: n.to,
396
- data: n.data,
397
- value: n.value,
398
- chainNamespace: S.CHAIN.EVM
399
- });
400
- return e.loadingTransaction = !1, g.showSuccess(i), U.sendEvent({
401
- type: "track",
402
- event: "SWAP_SUCCESS",
403
- properties: {
404
- network: ((w = P.state.activeCaipNetwork) == null ? void 0 : w.caipNetworkId) || "",
405
- swapFromToken: ((y = a.state.sourceToken) == null ? void 0 : y.symbol) || "",
406
- swapToToken: ((h = a.state.toToken) == null ? void 0 : h.symbol) || "",
407
- swapFromAmount: a.state.sourceTokenAmount || "",
408
- swapToAmount: a.state.toTokenAmount || "",
409
- isSmartAccount: D(S.CHAIN.EVM) === B.ACCOUNT_TYPES.SMART_ACCOUNT
410
- }
411
- }), v.resetState(), s || f.replace("Account"), v.getMyTokensWithBalance(N), k;
412
- } catch (N) {
413
- const k = N;
414
- e.transactionError = k == null ? void 0 : k.displayMessage, e.loadingTransaction = !1, g.showError((k == null ? void 0 : k.displayMessage) || "Transaction error"), U.sendEvent({
415
- type: "track",
416
- event: "SWAP_ERROR",
417
- properties: {
418
- message: (k == null ? void 0 : k.displayMessage) || (k == null ? void 0 : k.message) || "Unknown",
419
- network: ((F = P.state.activeCaipNetwork) == null ? void 0 : F.caipNetworkId) || "",
420
- swapFromToken: ((L = a.state.sourceToken) == null ? void 0 : L.symbol) || "",
421
- swapToToken: ((W = a.state.toToken) == null ? void 0 : W.symbol) || "",
422
- swapFromAmount: a.state.sourceTokenAmount || "",
423
- swapToAmount: a.state.toTokenAmount || "",
424
- isSmartAccount: D(S.CHAIN.EVM) === B.ACCOUNT_TYPES.SMART_ACCOUNT
425
- }
426
- });
427
- return;
428
- }
429
- },
430
- // -- Checks -------------------------------------------- //
431
- hasInsufficientToken(n, t) {
432
- return I.isInsufficientSourceTokenForSwap(n, t, e.myTokensWithBalance);
433
- },
434
- // -- Calculations -------------------------------------- //
435
- setTransactionDetails() {
436
- const { toTokenAddress: n, toTokenDecimals: t } = a.getParams();
437
- !n || !t || (e.gasPriceInUSD = I.getGasPriceInUSD(e.networkPrice, BigInt(e.gasFee), BigInt(_)), e.priceImpact = I.getPriceImpact({
438
- sourceTokenAmount: e.sourceTokenAmount,
439
- sourceTokenPriceInUSD: e.sourceTokenPriceInUSD,
440
- toTokenPriceInUSD: e.toTokenPriceInUSD,
441
- toTokenAmount: e.toTokenAmount
442
- }), e.maxSlippage = I.getMaxSlippage(e.slippage, e.toTokenAmount), e.providerFee = I.getProviderFee(e.sourceTokenAmount));
443
- }
444
- }, a = G(v);
445
- export {
446
- a as S
447
- };
@@ -1,19 +0,0 @@
1
- import { D as l } from "./index-Zh6wUpmX.js";
2
- const o = l`<svg
3
- width="14"
4
- height="14"
5
- viewBox="0 0 14 14"
6
- fill="none"
7
- xmlns="http://www.w3.org/2000/svg"
8
- >
9
- <path
10
- fill="currentColor"
11
- fill-rule="evenodd"
12
- clip-rule="evenodd"
13
- d="M7.0023 0.875C7.48571 0.875 7.8776 1.26675 7.8776 1.75V6.125H12.2541C12.7375 6.125 13.1294 6.51675 13.1294 7C13.1294 7.48325 12.7375 7.875 12.2541 7.875H7.8776V12.25C7.8776 12.7332 7.48571 13.125 7.0023 13.125C6.51889 13.125 6.12701 12.7332 6.12701 12.25V7.875H1.75054C1.26713 7.875 0.875244 7.48325 0.875244 7C0.875244 6.51675 1.26713 6.125 1.75054 6.125H6.12701V1.75C6.12701 1.26675 6.51889 0.875 7.0023 0.875Z"
14
- fill="#667dff"
15
- /></svg
16
- >`;
17
- export {
18
- o as addSvg
19
- };
@@ -1,10 +0,0 @@
1
- import { D as a } from "./index-Zh6wUpmX.js";
2
- const o = a`<svg fill="none" viewBox="0 0 24 24">
3
- <path
4
- style="fill: var(--wui-color-accent-100);"
5
- d="M10.2 6.6a3.6 3.6 0 1 1-7.2 0 3.6 3.6 0 0 1 7.2 0ZM21 6.6a3.6 3.6 0 1 1-7.2 0 3.6 3.6 0 0 1 7.2 0ZM10.2 17.4a3.6 3.6 0 1 1-7.2 0 3.6 3.6 0 0 1 7.2 0ZM21 17.4a3.6 3.6 0 1 1-7.2 0 3.6 3.6 0 0 1 7.2 0Z"
6
- />
7
- </svg>`;
8
- export {
9
- o as allWalletsSvg
10
- };
@@ -1,21 +0,0 @@
1
- import { D as a } from "./index-Zh6wUpmX.js";
2
- const e = a`
3
- <svg width="36" height="36">
4
- <path
5
- d="M28.724 0H7.271A7.269 7.269 0 0 0 0 7.272v21.46A7.268 7.268 0 0 0 7.271 36H28.73A7.272 7.272 0 0 0 36 28.728V7.272A7.275 7.275 0 0 0 28.724 0Z"
6
- fill="url(#a)"
7
- />
8
- <path
9
- d="m17.845 8.271.729-1.26a1.64 1.64 0 1 1 2.843 1.638l-7.023 12.159h5.08c1.646 0 2.569 1.935 1.853 3.276H6.434a1.632 1.632 0 0 1-1.638-1.638c0-.909.73-1.638 1.638-1.638h4.176l5.345-9.265-1.67-2.898a1.642 1.642 0 0 1 2.844-1.638l.716 1.264Zm-6.317 17.5-1.575 2.732a1.64 1.64 0 1 1-2.844-1.638l1.17-2.025c1.323-.41 2.398-.095 3.249.931Zm13.56-4.954h4.262c.909 0 1.638.729 1.638 1.638 0 .909-.73 1.638-1.638 1.638h-2.367l1.597 2.772c.45.788.185 1.782-.602 2.241a1.642 1.642 0 0 1-2.241-.603c-2.69-4.666-4.711-8.159-6.052-10.485-1.372-2.367-.391-4.743.576-5.549 1.075 1.846 2.682 4.631 4.828 8.348Z"
10
- fill="#fff"
11
- />
12
- <defs>
13
- <linearGradient id="a" x1="18" y1="0" x2="18" y2="36" gradientUnits="userSpaceOnUse">
14
- <stop stop-color="#18BFFB" />
15
- <stop offset="1" stop-color="#2072F3" />
16
- </linearGradient>
17
- </defs>
18
- </svg>`;
19
- export {
20
- e as appStoreSvg
21
- };
@@ -1,22 +0,0 @@
1
- import { D as l } from "./index-Zh6wUpmX.js";
2
- const f = l`<svg fill="none" viewBox="0 0 40 40">
3
- <g clip-path="url(#a)">
4
- <g clip-path="url(#b)">
5
- <circle cx="20" cy="19.89" r="20" fill="#000" />
6
- <g clip-path="url(#c)">
7
- <path
8
- fill="#fff"
9
- d="M28.77 23.3c-.69 1.99-2.75 5.52-4.87 5.56-1.4.03-1.86-.84-3.46-.84-1.61 0-2.12.81-3.45.86-2.25.1-5.72-5.1-5.72-9.62 0-4.15 2.9-6.2 5.42-6.25 1.36-.02 2.64.92 3.47.92.83 0 2.38-1.13 4.02-.97.68.03 2.6.28 3.84 2.08-3.27 2.14-2.76 6.61.75 8.25ZM24.2 7.88c-2.47.1-4.49 2.69-4.2 4.84 2.28.17 4.47-2.39 4.2-4.84Z"
10
- />
11
- </g>
12
- </g>
13
- </g>
14
- <defs>
15
- <clipPath id="a"><rect width="40" height="40" fill="#fff" rx="20" /></clipPath>
16
- <clipPath id="b"><path fill="#fff" d="M0 0h40v40H0z" /></clipPath>
17
- <clipPath id="c"><path fill="#fff" d="M8 7.89h24v24H8z" /></clipPath>
18
- </defs>
19
- </svg>`;
20
- export {
21
- f as appleSvg
22
- };
@@ -1,15 +0,0 @@
1
- import { D as C } from "./index-Zh6wUpmX.js";
2
- const e = C`<svg
3
- fill="none"
4
- viewBox="0 0 21 20"
5
- >
6
- <path
7
- fill="currentColor"
8
- fill-rule="evenodd"
9
- d="M10.5 2.42908C6.31875 2.42908 2.92859 5.81989 2.92859 10.0034C2.92859 14.1869 6.31875 17.5777 10.5 17.5777C14.6813 17.5777 18.0714 14.1869 18.0714 10.0034C18.0714 5.81989 14.6813 2.42908 10.5 2.42908ZM0.928589 10.0034C0.928589 4.71596 5.21355 0.429077 10.5 0.429077C15.7865 0.429077 20.0714 4.71596 20.0714 10.0034C20.0714 15.2908 15.7865 19.5777 10.5 19.5777C5.21355 19.5777 0.928589 15.2908 0.928589 10.0034ZM10.5 5.75003C11.0523 5.75003 11.5 6.19774 11.5 6.75003L11.5 10.8343L12.7929 9.54137C13.1834 9.15085 13.8166 9.15085 14.2071 9.54137C14.5976 9.9319 14.5976 10.5651 14.2071 10.9556L11.2071 13.9556C10.8166 14.3461 10.1834 14.3461 9.79291 13.9556L6.79291 10.9556C6.40239 10.5651 6.40239 9.9319 6.79291 9.54137C7.18343 9.15085 7.8166 9.15085 8.20712 9.54137L9.50002 10.8343L9.50002 6.75003C9.50002 6.19774 9.94773 5.75003 10.5 5.75003Z"
10
- clip-rule="evenodd"
11
- /></svg
12
- >`;
13
- export {
14
- e as arrowBottomCircleSvg
15
- };
@@ -1,12 +0,0 @@
1
- import { D as o } from "./index-Zh6wUpmX.js";
2
- const e = o`<svg fill="none" viewBox="0 0 14 15">
3
- <path
4
- fill="currentColor"
5
- fill-rule="evenodd"
6
- d="M7 1.99a1 1 0 0 1 1 1v7.58l2.46-2.46a1 1 0 0 1 1.41 1.42L7.7 13.69a1 1 0 0 1-1.41 0L2.12 9.53A1 1 0 0 1 3.54 8.1L6 10.57V3a1 1 0 0 1 1-1Z"
7
- clip-rule="evenodd"
8
- />
9
- </svg>`;
10
- export {
11
- e as arrowBottomSvg
12
- };
@@ -1,12 +0,0 @@
1
- import { D as e } from "./index-Zh6wUpmX.js";
2
- const o = e`<svg fill="none" viewBox="0 0 14 15">
3
- <path
4
- fill="currentColor"
5
- fill-rule="evenodd"
6
- d="M13 7.99a1 1 0 0 1-1 1H4.4l2.46 2.46a1 1 0 1 1-1.41 1.41L1.29 8.7a1 1 0 0 1 0-1.41L5.46 3.1a1 1 0 0 1 1.41 1.42L4.41 6.99H12a1 1 0 0 1 1 1Z"
7
- clip-rule="evenodd"
8
- />
9
- </svg>`;
10
- export {
11
- o as arrowLeftSvg
12
- };
@@ -1,12 +0,0 @@
1
- import { D as l } from "./index-Zh6wUpmX.js";
2
- const e = l`<svg fill="none" viewBox="0 0 14 15">
3
- <path
4
- fill="currentColor"
5
- fill-rule="evenodd"
6
- d="M1 7.99a1 1 0 0 1 1-1h7.58L7.12 4.53A1 1 0 1 1 8.54 3.1l4.16 4.17a1 1 0 0 1 0 1.41l-4.16 4.17a1 1 0 1 1-1.42-1.41l2.46-2.46H2a1 1 0 0 1-1-1Z"
7
- clip-rule="evenodd"
8
- />
9
- </svg>`;
10
- export {
11
- e as arrowRightSvg
12
- };
@@ -1,12 +0,0 @@
1
- import { D as o } from "./index-Zh6wUpmX.js";
2
- const e = o`<svg fill="none" viewBox="0 0 14 15">
3
- <path
4
- fill="currentColor"
5
- fill-rule="evenodd"
6
- d="M7 13.99a1 1 0 0 1-1-1V5.4L3.54 7.86a1 1 0 0 1-1.42-1.41L6.3 2.28a1 1 0 0 1 1.41 0l4.17 4.17a1 1 0 1 1-1.41 1.41L8 5.4v7.59a1 1 0 0 1-1 1Z"
7
- clip-rule="evenodd"
8
- />
9
- </svg>`;
10
- export {
11
- e as arrowTopSvg
12
- };
@@ -1,9 +0,0 @@
1
- import { ch as e, ci as c, cj as o, cg as i } from "./index-Zh6wUpmX.js";
2
- import "antd";
3
- import "react";
4
- export {
5
- e as AstraModal,
6
- c as astraReceive,
7
- o as astraSend,
8
- i as default
9
- };