@talken/talkenkit 2.8.1 → 2.8.3
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.
- package/dist/{abcWallet-TMP56C3B.js → abcWallet-7ZZXHG7O.js} +1 -1
- package/dist/{chunk-WEQ3DKBC.js → chunk-HX6JUKSS.js} +0 -6
- package/dist/gasless/types.d.ts +33 -2
- package/dist/gasless/utils/fiatFormatter.d.ts +32 -0
- package/dist/index.css +13 -13
- package/dist/index.d.ts +2 -0
- package/dist/index.js +341 -211
- package/dist/wallets/walletConnectors/abcWallet/abcConnector.js +4 -4
- package/dist/wallets/walletConnectors/abcWallet/abcProvider.js +1 -1
- package/dist/wallets/walletConnectors/abcWallet/abcSolanaProvider.js +2 -2
- package/dist/wallets/walletConnectors/abcWallet/abcWallet.js +5 -5
- package/dist/wallets/walletConnectors/abcWallet/api/TalkenApiClient.js +2 -2
- package/dist/wallets/walletConnectors/abcWallet/api/index.js +2 -2
- package/dist/wallets/walletConnectors/abcWallet/index.js +8 -8
- package/dist/wallets/walletConnectors/abcWallet/kakaoAuth.d.ts +10 -21
- package/dist/wallets/walletConnectors/abcWallet/kakaoAuth.js +118 -141
- package/dist/wallets/walletConnectors/chunk-4K2V7RCL.js +96 -0
- package/dist/wallets/walletConnectors/chunk-76M232IF.js +101 -0
- package/dist/wallets/walletConnectors/{chunk-73ENA2TK.js → chunk-7DLZKN46.js} +1 -1
- package/dist/wallets/walletConnectors/chunk-CTAFZ5RQ.js +71 -0
- package/dist/wallets/walletConnectors/chunk-FE2BFYJB.js +73 -0
- package/dist/wallets/walletConnectors/chunk-GNF5CHDQ.js +102 -0
- package/dist/wallets/walletConnectors/chunk-GZPGNUNF.js +94 -0
- package/dist/wallets/walletConnectors/{chunk-DKWXI7IR.js → chunk-HM73RD2O.js} +0 -6
- package/dist/wallets/walletConnectors/chunk-KNNHGFKJ.js +98 -0
- package/dist/wallets/walletConnectors/chunk-KQROIRBW.js +27 -0
- package/dist/wallets/walletConnectors/chunk-LKNK2KKU.js +76 -0
- package/dist/wallets/walletConnectors/{chunk-R3SLVZUQ.js → chunk-M4YGDOD5.js} +1 -1
- package/dist/wallets/walletConnectors/chunk-NM7YUGLV.js +186 -0
- package/dist/wallets/walletConnectors/chunk-U5UPCM5V.js +66 -0
- package/dist/wallets/walletConnectors/chunk-WZMFQQ6R.js +108 -0
- package/dist/wallets/walletConnectors/chunk-XSJUQHR7.js +95 -0
- package/dist/wallets/walletConnectors/index.js +56 -56
- package/package.json +12 -11
- package/LICENSE +0 -9
- package/dist/wallets/walletConnectors/chunk-24AEUYOZ.js +0 -58
- package/dist/wallets/walletConnectors/chunk-2DROHKQL.js +0 -341
- package/dist/wallets/walletConnectors/chunk-I7QLXYSA.js +0 -341
- package/dist/wallets/walletConnectors/chunk-L7ZETI2T.js +0 -58
- package/dist/wallets/walletConnectors/chunk-PYIAXFRD.js +0 -370
package/dist/index.js
CHANGED
|
@@ -66,7 +66,7 @@ import {
|
|
|
66
66
|
scheduleProactiveRefresh,
|
|
67
67
|
setGaslessConfig,
|
|
68
68
|
setupVisibilityRefresh
|
|
69
|
-
} from "./chunk-
|
|
69
|
+
} from "./chunk-HX6JUKSS.js";
|
|
70
70
|
import {
|
|
71
71
|
en_US_default
|
|
72
72
|
} from "./chunk-X4GSACNW.js";
|
|
@@ -197,7 +197,7 @@ function useBitcoinWallet() {
|
|
|
197
197
|
wallet: bitcoinWallet,
|
|
198
198
|
emptyState: emptyWalletState2,
|
|
199
199
|
requestInterceptor,
|
|
200
|
-
importProvider: async () => (await import("./abcWallet-
|
|
200
|
+
importProvider: async () => (await import("./abcWallet-7ZZXHG7O.js")).AbcBitcoinProvider,
|
|
201
201
|
mapState: (nextWallet, provider) => ({
|
|
202
202
|
address: nextWallet.address,
|
|
203
203
|
publicKey: nextWallet.publicKey,
|
|
@@ -1370,7 +1370,7 @@ function useAbcSolanaState(evmConnected, connector, requestInterceptor) {
|
|
|
1370
1370
|
wallet: solanaWallet,
|
|
1371
1371
|
emptyState: emptyWalletState,
|
|
1372
1372
|
requestInterceptor,
|
|
1373
|
-
importProvider: async () => (await import("./abcWallet-
|
|
1373
|
+
importProvider: async () => (await import("./abcWallet-7ZZXHG7O.js")).AbcSolanaProvider,
|
|
1374
1374
|
mapState: (nextWallet, provider) => ({
|
|
1375
1375
|
address: nextWallet.address,
|
|
1376
1376
|
publicKey: nextWallet.publicKey,
|
|
@@ -2063,7 +2063,7 @@ var ENHANCED_PROVIDER_ENABLED = Boolean(
|
|
|
2063
2063
|
var enhancedProviderHttp = createHttpClient({
|
|
2064
2064
|
baseUrl: "https://enhanced-provider.rainbow.me",
|
|
2065
2065
|
headers: {
|
|
2066
|
-
"x-api-key": typeof process !== "undefined" && typeof process.env !== "undefined" && process.env.RAINBOW_PROVIDER_API_KEY || ""
|
|
2066
|
+
"x-api-key": typeof process !== "undefined" && typeof process.env !== "undefined" && process.env.RAINBOW_PROVIDER_API_KEY || "undefined"
|
|
2067
2067
|
}
|
|
2068
2068
|
});
|
|
2069
2069
|
|
|
@@ -2462,7 +2462,7 @@ function useTronWallet() {
|
|
|
2462
2462
|
wallet: tronWallet,
|
|
2463
2463
|
emptyState: emptyWalletState2,
|
|
2464
2464
|
requestInterceptor,
|
|
2465
|
-
importProvider: async () => (await import("./abcWallet-
|
|
2465
|
+
importProvider: async () => (await import("./abcWallet-7ZZXHG7O.js")).AbcTronProvider,
|
|
2466
2466
|
mapState: (nextWallet, provider) => ({
|
|
2467
2467
|
address: nextWallet.address,
|
|
2468
2468
|
publicKey: nextWallet.publicKey,
|
|
@@ -2539,7 +2539,7 @@ function useXrplWallet() {
|
|
|
2539
2539
|
wallet: xrplWallet,
|
|
2540
2540
|
emptyState: emptyWalletState2,
|
|
2541
2541
|
requestInterceptor,
|
|
2542
|
-
importProvider: async () => (await import("./abcWallet-
|
|
2542
|
+
importProvider: async () => (await import("./abcWallet-7ZZXHG7O.js")).AbcXrplProvider,
|
|
2543
2543
|
mapState: (nextWallet, provider) => ({
|
|
2544
2544
|
address: nextWallet.address,
|
|
2545
2545
|
publicKey: nextWallet.publicKey,
|
|
@@ -4440,7 +4440,9 @@ var usdValue = "_1uoch87b";
|
|
|
4440
4440
|
|
|
4441
4441
|
// src/components/ConfirmationModal/constants.ts
|
|
4442
4442
|
var KNOWN_TOKEN_ICONS = {
|
|
4443
|
-
TALK: `data:image/svg+xml,${encodeURIComponent('<svg width="80" height="81" viewBox="0 0 80 81" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M80 40.3508C80 18.2674 62.0914 0.365234 40 0.365234C17.9086 0.365234 0 18.2674 0 40.3508V40.3796C0 62.4631 17.9086 80.3652 40 80.3652C62.0914 80.3652 80 62.4631 80 40.3796V40.3508Z" fill="url(#paint0_linear_1628_24397)"/><path d="M38.3651 42.6956L38.3187 47.913C38.2899 51.2014 36.7763 52.4377 33.3747 52.4089L30.1475 52.3801C26.2867 52.3466 23.9395 51.2973 23.9715 47.5819C24.0035 43.8504 26.3859 42.8428 30.2307 42.8764L33.9651 42.9084V42.6556C33.9827 40.9155 32.9747 40.1477 30.6659 40.1286C29.5267 40.119 28.4179 40.2981 26.9443 40.586C25.9459 40.7667 25.3491 40.3029 25.3587 39.2921L25.3635 38.7067C25.3715 37.8382 25.8659 37.272 26.8963 37.0753C28.6227 36.7266 29.9395 36.5171 31.3315 36.5299C35.6179 36.5666 38.4035 38.4412 38.3667 42.6956H38.3651ZM33.9235 47.6538L33.9379 46.056L30.4259 46.0256C28.5107 46.0096 28.1123 46.4479 28.1011 47.6187C28.0915 48.7734 28.4835 49.2181 30.3811 49.2357L32.3267 49.2533C33.6867 49.2645 33.9139 48.7143 33.9235 47.6554V47.6538Z" fill="white"/><path d="M44.2202 31.2055L42.4458 31.1895C41.6906 31.1831 41.073 31.7893 41.0666 32.5442L40.9034 51.1071C40.897 51.8621 41.5034 52.4794 42.2586 52.4858L44.033 52.5018C44.7882 52.5082 45.4042 51.902 45.4106 51.1471L45.5738 32.5842C45.5802 31.8293 44.9738 31.2135 44.2202 31.2055Z" fill="white"/><path d="M62.8257 50.9953L62.7441 50.9009L56.9553 44.2985L62.7585 38.7245L62.7985 38.6845C63.4449 38.0096 63.1889 37.3234 62.2273 37.1507C62.0849 37.1251 61.9345 37.1123 61.7809 37.1107H61.7457L60.1857 37.0979C59.5137 37.0931 58.8177 37.3442 58.4001 37.7601L58.3889 37.7745L52.5713 43.3676L52.6657 32.6467C52.6721 31.8918 52.0657 31.276 51.3105 31.268L49.5361 31.252C48.7809 31.2456 48.1633 31.8518 48.1569 32.6067L47.9937 51.1696C47.9873 51.9246 48.5937 52.5419 49.3489 52.5483L51.1233 52.5643C51.8785 52.5707 52.4945 51.9645 52.5009 51.2096L52.5521 45.2885L58.2881 51.8286L58.3249 51.8718C58.7425 52.3644 59.5329 52.6667 60.2785 52.6427H60.1969L61.7553 52.6587L61.6337 52.6555C61.8353 52.6651 62.0321 52.6555 62.2161 52.6219C63.1825 52.4492 63.4561 51.7214 62.8257 50.9969V50.9953Z" fill="white"/><path d="M26.3392 31.0492L11.4368 30.918C10.6816 30.9116 10.0656 31.5178 10.0576 32.2727L10.0464 33.5411C10.04 34.296 10.6464 34.9134 11.4016 34.9198L16.6 34.9646L16.4608 50.8932C16.4544 51.6482 17.0608 52.2655 17.816 52.2719L19.5904 52.2879C20.3456 52.2943 20.9616 51.6881 20.968 50.9332L21.1072 35.0045L26.3024 35.0493C27.0576 35.0557 27.6736 34.4495 27.6816 33.6946L27.6928 32.4263C27.6992 31.6713 27.0928 31.0556 26.3376 31.0476L26.3392 31.0492Z" fill="white"/><path d="M70.2915 32.4699C70.2771 34.0677 68.9699 35.352 67.3715 35.3392C65.7731 35.3248 64.4867 34.0181 64.5011 32.4203C64.5155 30.8208 65.8227 29.5365 67.4227 29.5509C69.0211 29.5653 70.3059 30.872 70.2915 32.4699Z" fill="white"/><defs><linearGradient id="paint0_linear_1628_24397" x1="11.6896" y1="10.6607" x2="71.2767" y2="73.226" gradientUnits="userSpaceOnUse"><stop stop-color="#253C86"/><stop offset="1" stop-color="#142053"/></linearGradient></defs></svg>')}
|
|
4443
|
+
TALK: `data:image/svg+xml,${encodeURIComponent('<svg width="80" height="81" viewBox="0 0 80 81" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M80 40.3508C80 18.2674 62.0914 0.365234 40 0.365234C17.9086 0.365234 0 18.2674 0 40.3508V40.3796C0 62.4631 17.9086 80.3652 40 80.3652C62.0914 80.3652 80 62.4631 80 40.3796V40.3508Z" fill="url(#paint0_linear_1628_24397)"/><path d="M38.3651 42.6956L38.3187 47.913C38.2899 51.2014 36.7763 52.4377 33.3747 52.4089L30.1475 52.3801C26.2867 52.3466 23.9395 51.2973 23.9715 47.5819C24.0035 43.8504 26.3859 42.8428 30.2307 42.8764L33.9651 42.9084V42.6556C33.9827 40.9155 32.9747 40.1477 30.6659 40.1286C29.5267 40.119 28.4179 40.2981 26.9443 40.586C25.9459 40.7667 25.3491 40.3029 25.3587 39.2921L25.3635 38.7067C25.3715 37.8382 25.8659 37.272 26.8963 37.0753C28.6227 36.7266 29.9395 36.5171 31.3315 36.5299C35.6179 36.5666 38.4035 38.4412 38.3667 42.6956H38.3651ZM33.9235 47.6538L33.9379 46.056L30.4259 46.0256C28.5107 46.0096 28.1123 46.4479 28.1011 47.6187C28.0915 48.7734 28.4835 49.2181 30.3811 49.2357L32.3267 49.2533C33.6867 49.2645 33.9139 48.7143 33.9235 47.6554V47.6538Z" fill="white"/><path d="M44.2202 31.2055L42.4458 31.1895C41.6906 31.1831 41.073 31.7893 41.0666 32.5442L40.9034 51.1071C40.897 51.8621 41.5034 52.4794 42.2586 52.4858L44.033 52.5018C44.7882 52.5082 45.4042 51.902 45.4106 51.1471L45.5738 32.5842C45.5802 31.8293 44.9738 31.2135 44.2202 31.2055Z" fill="white"/><path d="M62.8257 50.9953L62.7441 50.9009L56.9553 44.2985L62.7585 38.7245L62.7985 38.6845C63.4449 38.0096 63.1889 37.3234 62.2273 37.1507C62.0849 37.1251 61.9345 37.1123 61.7809 37.1107H61.7457L60.1857 37.0979C59.5137 37.0931 58.8177 37.3442 58.4001 37.7601L58.3889 37.7745L52.5713 43.3676L52.6657 32.6467C52.6721 31.8918 52.0657 31.276 51.3105 31.268L49.5361 31.252C48.7809 31.2456 48.1633 31.8518 48.1569 32.6067L47.9937 51.1696C47.9873 51.9246 48.5937 52.5419 49.3489 52.5483L51.1233 52.5643C51.8785 52.5707 52.4945 51.9645 52.5009 51.2096L52.5521 45.2885L58.2881 51.8286L58.3249 51.8718C58.7425 52.3644 59.5329 52.6667 60.2785 52.6427H60.1969L61.7553 52.6587L61.6337 52.6555C61.8353 52.6651 62.0321 52.6555 62.2161 52.6219C63.1825 52.4492 63.4561 51.7214 62.8257 50.9969V50.9953Z" fill="white"/><path d="M26.3392 31.0492L11.4368 30.918C10.6816 30.9116 10.0656 31.5178 10.0576 32.2727L10.0464 33.5411C10.04 34.296 10.6464 34.9134 11.4016 34.9198L16.6 34.9646L16.4608 50.8932C16.4544 51.6482 17.0608 52.2655 17.816 52.2719L19.5904 52.2879C20.3456 52.2943 20.9616 51.6881 20.968 50.9332L21.1072 35.0045L26.3024 35.0493C27.0576 35.0557 27.6736 34.4495 27.6816 33.6946L27.6928 32.4263C27.6992 31.6713 27.0928 31.0556 26.3376 31.0476L26.3392 31.0492Z" fill="white"/><path d="M70.2915 32.4699C70.2771 34.0677 68.9699 35.352 67.3715 35.3392C65.7731 35.3248 64.4867 34.0181 64.5011 32.4203C64.5155 30.8208 65.8227 29.5365 67.4227 29.5509C69.0211 29.5653 70.3059 30.872 70.2915 32.4699Z" fill="white"/><defs><linearGradient id="paint0_linear_1628_24397" x1="11.6896" y1="10.6607" x2="71.2767" y2="73.226" gradientUnits="userSpaceOnUse"><stop stop-color="#253C86"/><stop offset="1" stop-color="#142053"/></linearGradient></defs></svg>')}`,
|
|
4444
|
+
USDT: `data:image/svg+xml,${encodeURIComponent('<svg width="80" height="80" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"><circle cx="16" cy="16" r="16" fill="#26A17B"/><path d="M17.92 17.94v-.01c-.11.01-.68.04-1.95.04-1.01 0-1.72-.03-1.97-.04v.01c-3.88-.17-6.78-.85-6.78-1.66 0-.81 2.9-1.49 6.78-1.66v2.65c.26.02.99.06 1.99.06 1.21 0 1.82-.05 1.93-.06v-2.65c3.87.17 6.76.85 6.76 1.66 0 .81-2.89 1.48-6.76 1.66m0-3.59v-2.37h5.43V8.36H8.65v3.62h5.43v2.37c-4.41.2-7.73 1.08-7.73 2.13 0 1.05 3.32 1.92 7.73 2.13v7.6h3.84v-7.6c4.4-.2 7.71-1.08 7.71-2.13 0-1.05-3.31-1.92-7.71-2.13" fill="#fff"/></svg>')}`,
|
|
4445
|
+
USDC: `data:image/svg+xml,${encodeURIComponent('<svg width="80" height="80" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"><circle cx="16" cy="16" r="16" fill="#2775CA"/><path d="M20.88 19.18c0-2.59-1.55-3.48-4.66-3.85-2.22-.3-2.66-.89-2.66-1.93 0-1.04.74-1.7 2.22-1.7 1.33 0 2.07.44 2.44 1.55.07.22.3.37.52.37h1.18c.3 0 .52-.22.52-.52v-.07c-.3-1.62-1.62-2.88-3.33-3.03V8.21c0-.3-.22-.52-.59-.59h-1.11c-.3 0-.52.22-.59.59v1.7c-2.22.3-3.62 1.77-3.62 3.62 0 2.44 1.48 3.4 4.59 3.77 2.07.37 2.74.81 2.74 2 0 1.18-1.04 1.99-2.44 1.99-1.92 0-2.59-.81-2.81-1.92-.07-.3-.3-.44-.52-.44h-1.26c-.3 0-.52.22-.52.52v.07c.3 1.85 1.48 3.18 3.92 3.55v1.77c0 .3.22.52.59.59h1.11c.3 0 .52-.22.59-.59v-1.77c2.22-.37 3.7-1.92 3.7-3.92zM12.59 25.53c-3.7-1.33-6.07-4.81-6.07-8.66 0-3.85 2.37-7.32 6.07-8.66.3-.15.44-.37.44-.74v-1.04c0-.3-.15-.52-.44-.59-.07 0-.22 0-.3.07-4.51 1.41-7.77 5.62-7.77 10.66s3.26 9.25 7.77 10.66c.3.15.59 0 .67-.3.07-.07.07-.15.07-.3v-1.04c0-.22-.22-.52-.44-.59zm14.51-7.84c-.3-.15-.59 0-.67.3-.07.07-.07.15-.07.3v1.04c0 .3.22.59.44.66 3.7 1.33 6.07 4.81 6.07 8.66 0 3.85-2.37 7.32-6.07 8.66-.3.15-.44.37-.44.74v1.04c0 .3.15.52.44.59.07 0 .22 0 .3-.07 4.51-1.41 7.77-5.62 7.77-10.66s-3.26-9.25-7.77-10.66z" fill="#fff" transform="scale(0.7) translate(7 7)"/><text x="16" y="22" text-anchor="middle" fill="white" font-family="sans-serif" font-size="14" font-weight="bold">$</text></svg>')}`
|
|
4444
4446
|
};
|
|
4445
4447
|
function getTokenPlaceholderIcon(symbol) {
|
|
4446
4448
|
const upper = symbol?.toUpperCase();
|
|
@@ -5732,7 +5734,7 @@ function TransactionConfirmationModal({
|
|
|
5732
5734
|
);
|
|
5733
5735
|
}
|
|
5734
5736
|
}
|
|
5735
|
-
), /* @__PURE__ */ React36.createElement("span", { className: feeValueHighlight }, gaslessInfo.feeEstimate.feeAmount, " ", gaslessInfo.feeEstimate.feeToken.symbol)), gaslessInfo.feeEstimate.feeAmountUsd && /* @__PURE__ */ React36.createElement("span", { className: feeUsd }, gaslessInfo.feeEstimate.feeAmountUsd))))
|
|
5737
|
+
), /* @__PURE__ */ React36.createElement("span", { className: feeValueHighlight }, gaslessInfo.feeEstimate.feeAmount, " ", gaslessInfo.feeEstimate.feeToken.symbol)), (gaslessInfo.feeEstimate.feeAmountFiat ?? gaslessInfo.feeEstimate.feeAmountUsd) && /* @__PURE__ */ React36.createElement("span", { className: feeUsd }, `(${gaslessInfo.feeEstimate.feeAmountFiat ?? gaslessInfo.feeEstimate.feeAmountUsd})`))))
|
|
5736
5738
|
) : (
|
|
5737
5739
|
/* ── Standard Gas Fee ──────────────────────────────── */
|
|
5738
5740
|
/* @__PURE__ */ React36.createElement(React36.Fragment, null, /* @__PURE__ */ React36.createElement("div", { className: networkFeeSection }, /* @__PURE__ */ React36.createElement("div", { className: networkFeeHeader }, "Network Fee"), /* @__PURE__ */ React36.createElement("div", { className: feeRowWithSub }, /* @__PURE__ */ React36.createElement("span", { className: feeLabel }, "Estimated Gas Fee"), /* @__PURE__ */ React36.createElement("div", { className: feeValueColumn }, /* @__PURE__ */ React36.createElement("div", { className: feeValueRow }, /* @__PURE__ */ React36.createElement(
|
|
@@ -9239,7 +9241,7 @@ function setRainbowKitVersion({ version }) {
|
|
|
9239
9241
|
}
|
|
9240
9242
|
function useFingerprint() {
|
|
9241
9243
|
const fingerprint = useCallback16(() => {
|
|
9242
|
-
setRainbowKitVersion({ version: "2.8.
|
|
9244
|
+
setRainbowKitVersion({ version: "2.8.3" });
|
|
9243
9245
|
}, []);
|
|
9244
9246
|
useEffect25(() => {
|
|
9245
9247
|
fingerprint();
|
|
@@ -11581,7 +11583,7 @@ function AbcWaasAuthSections(props) {
|
|
|
11581
11583
|
const isTelegramMiniApp = typeof window !== "undefined" && (!!window.Telegram?.WebApp && window.Telegram.WebApp.platform !== "unknown" || window.location.hash.includes("tgWebAppData"));
|
|
11582
11584
|
const isGoogleEnabled = !isTelegramMiniApp && typeof process !== "undefined" && process.env && process.env.NEXT_PUBLIC_GOOGLE_OAUTH_ENABLED === "true" && !!process.env.NEXT_PUBLIC_FIREBASE_API_KEY;
|
|
11583
11585
|
const isAppleEnabled = !isTelegramMiniApp && typeof process !== "undefined" && process.env && process.env.NEXT_PUBLIC_APPLE_OAUTH_ENABLED === "true" && !!process.env.NEXT_PUBLIC_APPLE_OAUTH_CLIENT_ID;
|
|
11584
|
-
const isKakaoEnabled = !isTelegramMiniApp && typeof process !== "undefined" && process.env && process.env.NEXT_PUBLIC_KAKAO_OAUTH_ENABLED === "true"
|
|
11586
|
+
const isKakaoEnabled = !isTelegramMiniApp && typeof process !== "undefined" && process.env && process.env.NEXT_PUBLIC_KAKAO_OAUTH_ENABLED === "true";
|
|
11585
11587
|
const hasSocialLogin = isGoogleEnabled || isAppleEnabled || isKakaoEnabled;
|
|
11586
11588
|
const handleEmailFormSubmit = (e) => {
|
|
11587
11589
|
e.preventDefault();
|
|
@@ -12028,46 +12030,61 @@ async function appleLogin() {
|
|
|
12028
12030
|
}
|
|
12029
12031
|
|
|
12030
12032
|
// src/wallets/walletConnectors/abcWallet/kakaoAuth.ts
|
|
12031
|
-
var
|
|
12032
|
-
var
|
|
12033
|
-
var
|
|
12034
|
-
var
|
|
12035
|
-
var KAKAO_EXPIRES_AT_KEY = "kakao_expires_at";
|
|
12033
|
+
var POPUP_TIMEOUT_MS = 3 * 60 * 1e3;
|
|
12034
|
+
var REQUEST_TIMEOUT_MS = 15 * 1e3;
|
|
12035
|
+
var serverEndpoint;
|
|
12036
|
+
var configuredCallbackPath;
|
|
12036
12037
|
var isKakaoLoginInProgress = false;
|
|
12037
|
-
function
|
|
12038
|
-
const
|
|
12039
|
-
if (
|
|
12040
|
-
throw new Error("
|
|
12038
|
+
function configureKakaoAuth(config) {
|
|
12039
|
+
const endpoint = config.serverEndpoint.replace(/\/$/, "");
|
|
12040
|
+
if (!/^\/(?:[a-zA-Z0-9_-]+\/)*[a-zA-Z0-9_-]+$/.test(endpoint)) {
|
|
12041
|
+
throw new Error("Kakao serverEndpoint must be a root-relative path");
|
|
12041
12042
|
}
|
|
12042
|
-
|
|
12043
|
-
|
|
12044
|
-
|
|
12043
|
+
if (config.callbackPath !== void 0 && (config.callbackPath.length > 256 || !/^\/(?:[a-zA-Z0-9_-]+\/)*[a-zA-Z0-9_-]+\/?$/.test(config.callbackPath))) {
|
|
12044
|
+
throw new Error("Kakao callbackPath must be a root-relative path");
|
|
12045
|
+
}
|
|
12046
|
+
serverEndpoint = endpoint;
|
|
12047
|
+
configuredCallbackPath = config.callbackPath;
|
|
12045
12048
|
}
|
|
12046
|
-
function
|
|
12047
|
-
|
|
12048
|
-
|
|
12049
|
-
|
|
12050
|
-
|
|
12051
|
-
|
|
12052
|
-
|
|
12053
|
-
|
|
12054
|
-
|
|
12055
|
-
|
|
12056
|
-
|
|
12057
|
-
|
|
12058
|
-
);
|
|
12059
|
-
if (!
|
|
12060
|
-
|
|
12061
|
-
|
|
12062
|
-
|
|
12063
|
-
|
|
12064
|
-
);
|
|
12065
|
-
return;
|
|
12049
|
+
async function requestServer(endpoint, action, body) {
|
|
12050
|
+
const controller = new AbortController();
|
|
12051
|
+
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS);
|
|
12052
|
+
try {
|
|
12053
|
+
const response = await fetch(`${endpoint}/${action}/`, {
|
|
12054
|
+
method: "POST",
|
|
12055
|
+
credentials: "same-origin",
|
|
12056
|
+
cache: "no-store",
|
|
12057
|
+
redirect: "error",
|
|
12058
|
+
headers: { "Content-Type": "application/json" },
|
|
12059
|
+
body: JSON.stringify(body),
|
|
12060
|
+
signal: controller.signal
|
|
12061
|
+
});
|
|
12062
|
+
if (!response.ok)
|
|
12063
|
+
throw new Error("Kakao authentication failed. Please try again.");
|
|
12064
|
+
const data = await response.json();
|
|
12065
|
+
if (!data || typeof data !== "object" || Array.isArray(data)) {
|
|
12066
|
+
throw new Error("Invalid Kakao server response");
|
|
12066
12067
|
}
|
|
12067
|
-
|
|
12068
|
+
return data;
|
|
12069
|
+
} finally {
|
|
12070
|
+
clearTimeout(timeout);
|
|
12071
|
+
}
|
|
12072
|
+
}
|
|
12073
|
+
function getAuthCodeViaPopup(popup, authorizationUrl, redirectUri, state, callbackPath) {
|
|
12074
|
+
const redirect = new URL(redirectUri);
|
|
12075
|
+
const expectedCallback = new URL(
|
|
12076
|
+
callbackPath ?? redirect.pathname,
|
|
12077
|
+
window.location.origin
|
|
12078
|
+
);
|
|
12079
|
+
const authorize = new URL(authorizationUrl);
|
|
12080
|
+
if (redirect.protocol !== "https:" || redirect.origin !== window.location.origin || redirect.username || redirect.password || redirect.search || redirect.hash || authorize.origin !== "https://kauth.kakao.com" || authorize.pathname !== "/oauth/authorize" || authorize.searchParams.get("state") !== state || authorize.searchParams.get("redirect_uri") !== redirectUri) {
|
|
12081
|
+
throw new Error("Invalid Kakao authorization configuration");
|
|
12082
|
+
}
|
|
12083
|
+
popup.location.href = authorizationUrl;
|
|
12084
|
+
return new Promise((resolve, reject) => {
|
|
12068
12085
|
const startTime = Date.now();
|
|
12069
12086
|
const timer = setInterval(() => {
|
|
12070
|
-
if (Date.now() - startTime
|
|
12087
|
+
if (Date.now() - startTime >= POPUP_TIMEOUT_MS) {
|
|
12071
12088
|
clearInterval(timer);
|
|
12072
12089
|
popup.close();
|
|
12073
12090
|
reject(new Error("KAKAO_TIMEOUT"));
|
|
@@ -12078,126 +12095,90 @@ function getAuthCodeViaPopup(redirectUri) {
|
|
|
12078
12095
|
reject(new Error("KAKAO_CANCELLED"));
|
|
12079
12096
|
return;
|
|
12080
12097
|
}
|
|
12098
|
+
let callback;
|
|
12081
12099
|
try {
|
|
12082
|
-
|
|
12083
|
-
|
|
12084
|
-
|
|
12085
|
-
|
|
12086
|
-
|
|
12087
|
-
|
|
12088
|
-
|
|
12089
|
-
|
|
12090
|
-
|
|
12091
|
-
|
|
12092
|
-
|
|
12093
|
-
|
|
12094
|
-
|
|
12095
|
-
|
|
12096
|
-
|
|
12097
|
-
|
|
12098
|
-
}
|
|
12100
|
+
callback = new URL(popup.location.href);
|
|
12101
|
+
} catch {
|
|
12102
|
+
return;
|
|
12103
|
+
}
|
|
12104
|
+
if (callback.origin !== redirect.origin || callback.pathname !== expectedCallback.pathname)
|
|
12105
|
+
return;
|
|
12106
|
+
clearInterval(timer);
|
|
12107
|
+
popup.close();
|
|
12108
|
+
if (callback.searchParams.getAll("state").length !== 1 || callback.searchParams.get("state") !== state) {
|
|
12109
|
+
reject(new Error("Invalid Kakao authorization state"));
|
|
12110
|
+
} else if (callback.searchParams.has("error")) {
|
|
12111
|
+
reject(
|
|
12112
|
+
new Error(
|
|
12113
|
+
callback.searchParams.get("error") === "access_denied" ? "KAKAO_CANCELLED" : "Kakao authorization failed"
|
|
12114
|
+
)
|
|
12115
|
+
);
|
|
12116
|
+
} else if (callback.searchParams.getAll("code").length === 1 && callback.searchParams.get("code")) {
|
|
12117
|
+
resolve(callback.searchParams.get("code"));
|
|
12118
|
+
} else {
|
|
12119
|
+
reject(new Error("No Kakao authorization code received"));
|
|
12099
12120
|
}
|
|
12100
12121
|
}, 500);
|
|
12101
12122
|
});
|
|
12102
12123
|
}
|
|
12103
|
-
async function exchangeCodeForTokens(code, redirectUri) {
|
|
12104
|
-
const restApiKey = process.env.NEXT_PUBLIC_KAKAO_REST_API_KEY;
|
|
12105
|
-
if (!restApiKey) {
|
|
12106
|
-
throw new Error("NEXT_PUBLIC_KAKAO_REST_API_KEY is not configured");
|
|
12107
|
-
}
|
|
12108
|
-
const response = await fetch("https://kauth.kakao.com/oauth/token", {
|
|
12109
|
-
method: "POST",
|
|
12110
|
-
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
12111
|
-
body: new URLSearchParams({
|
|
12112
|
-
grant_type: "authorization_code",
|
|
12113
|
-
client_id: restApiKey,
|
|
12114
|
-
redirect_uri: redirectUri,
|
|
12115
|
-
code,
|
|
12116
|
-
...process.env.NEXT_PUBLIC_KAKAO_CLIENT_SECRET ? { client_secret: process.env.NEXT_PUBLIC_KAKAO_CLIENT_SECRET } : {}
|
|
12117
|
-
})
|
|
12118
|
-
});
|
|
12119
|
-
if (!response.ok) {
|
|
12120
|
-
const err = await response.json().catch(() => ({}));
|
|
12121
|
-
throw new Error(err.error_description || "Failed to get access token");
|
|
12122
|
-
}
|
|
12123
|
-
const data = await response.json();
|
|
12124
|
-
if (!data.id_token) {
|
|
12125
|
-
throw new Error("No id_token received. Ensure openid scope is enabled.");
|
|
12126
|
-
}
|
|
12127
|
-
return {
|
|
12128
|
-
accessToken: data.access_token,
|
|
12129
|
-
idToken: data.id_token,
|
|
12130
|
-
expiresIn: data.expires_in || 21600
|
|
12131
|
-
};
|
|
12132
|
-
}
|
|
12133
|
-
function tryExistingToken() {
|
|
12134
|
-
const storedIdToken = sessionStorage.getItem(KAKAO_ID_TOKEN_KEY);
|
|
12135
|
-
const storedEmail = sessionStorage.getItem(KAKAO_EMAIL_KEY);
|
|
12136
|
-
const expiresAt = sessionStorage.getItem(KAKAO_EXPIRES_AT_KEY);
|
|
12137
|
-
if (!storedIdToken || !storedEmail || !expiresAt) {
|
|
12138
|
-
return null;
|
|
12139
|
-
}
|
|
12140
|
-
if (Date.now() >= Number(expiresAt)) {
|
|
12141
|
-
clearStoredTokens();
|
|
12142
|
-
return null;
|
|
12143
|
-
}
|
|
12144
|
-
return {
|
|
12145
|
-
email: storedEmail,
|
|
12146
|
-
idToken: storedIdToken,
|
|
12147
|
-
service: "kakao"
|
|
12148
|
-
};
|
|
12149
|
-
}
|
|
12150
|
-
function clearStoredTokens() {
|
|
12151
|
-
sessionStorage.removeItem(KAKAO_TOKEN_KEY);
|
|
12152
|
-
sessionStorage.removeItem(KAKAO_ID_TOKEN_KEY);
|
|
12153
|
-
sessionStorage.removeItem(KAKAO_EMAIL_KEY);
|
|
12154
|
-
sessionStorage.removeItem(KAKAO_EXPIRES_AT_KEY);
|
|
12155
|
-
}
|
|
12156
12124
|
async function kakaoLogin() {
|
|
12157
|
-
if (isKakaoLoginInProgress)
|
|
12125
|
+
if (isKakaoLoginInProgress)
|
|
12158
12126
|
return null;
|
|
12159
|
-
|
|
12127
|
+
if (!serverEndpoint)
|
|
12128
|
+
throw new Error(
|
|
12129
|
+
"Configure a Kakao server authentication endpoint before login"
|
|
12130
|
+
);
|
|
12131
|
+
const endpoint = serverEndpoint;
|
|
12132
|
+
const callbackPath = configuredCallbackPath;
|
|
12160
12133
|
isKakaoLoginInProgress = true;
|
|
12134
|
+
let popup = null;
|
|
12161
12135
|
try {
|
|
12162
|
-
|
|
12163
|
-
|
|
12164
|
-
|
|
12165
|
-
|
|
12166
|
-
const redirectUri = `${window.location.origin}/auth/kakao/callback`;
|
|
12167
|
-
const code = await getAuthCodeViaPopup(redirectUri);
|
|
12168
|
-
const { accessToken, idToken, expiresIn } = await exchangeCodeForTokens(
|
|
12169
|
-
code,
|
|
12170
|
-
redirectUri
|
|
12136
|
+
popup = window.open(
|
|
12137
|
+
"about:blank",
|
|
12138
|
+
"kakao_login",
|
|
12139
|
+
"width=500,height=700,scrollbars=yes"
|
|
12171
12140
|
);
|
|
12172
|
-
|
|
12173
|
-
|
|
12174
|
-
|
|
12175
|
-
|
|
12176
|
-
|
|
12177
|
-
|
|
12141
|
+
if (!popup)
|
|
12142
|
+
throw new Error("KAKAO_POPUP_BLOCKED");
|
|
12143
|
+
for (const key of [
|
|
12144
|
+
"kakao_access_token",
|
|
12145
|
+
"kakao_id_token",
|
|
12146
|
+
"kakao_email",
|
|
12147
|
+
"kakao_expires_at"
|
|
12148
|
+
]) {
|
|
12149
|
+
try {
|
|
12150
|
+
sessionStorage.removeItem(key);
|
|
12151
|
+
} catch {
|
|
12152
|
+
}
|
|
12178
12153
|
}
|
|
12179
|
-
|
|
12180
|
-
|
|
12181
|
-
|
|
12182
|
-
|
|
12183
|
-
|
|
12184
|
-
|
|
12154
|
+
const start = await requestServer(endpoint, "start", {});
|
|
12155
|
+
if (typeof start.authorizationUrl !== "string" || typeof start.redirectUri !== "string" || typeof start.state !== "string" || !/^[a-zA-Z0-9_-]{43}$/.test(start.state))
|
|
12156
|
+
throw new Error("Invalid Kakao server response");
|
|
12157
|
+
const code = await getAuthCodeViaPopup(
|
|
12158
|
+
popup,
|
|
12159
|
+
start.authorizationUrl,
|
|
12160
|
+
start.redirectUri,
|
|
12161
|
+
start.state,
|
|
12162
|
+
callbackPath
|
|
12185
12163
|
);
|
|
12186
|
-
|
|
12187
|
-
|
|
12188
|
-
|
|
12189
|
-
|
|
12190
|
-
|
|
12164
|
+
const result = await requestServer(endpoint, "exchange", {
|
|
12165
|
+
code,
|
|
12166
|
+
state: start.state
|
|
12167
|
+
});
|
|
12168
|
+
if (typeof result.email !== "string" || !result.email || result.email.length > 320 || typeof result.idToken !== "string" || result.idToken.length > 16 * 1024 || result.idToken.split(".").length !== 3)
|
|
12169
|
+
throw new Error("Invalid Kakao server response");
|
|
12170
|
+
return { email: result.email, idToken: result.idToken, service: "kakao" };
|
|
12191
12171
|
} catch (error2) {
|
|
12192
|
-
if (error2
|
|
12172
|
+
if (error2 instanceof Error && error2.message === "KAKAO_CANCELLED")
|
|
12193
12173
|
return null;
|
|
12194
|
-
|
|
12195
|
-
if (error2?.message === "KAKAO_TIMEOUT") {
|
|
12174
|
+
if (error2 instanceof Error && error2.message === "KAKAO_TIMEOUT")
|
|
12196
12175
|
throw new Error("Login timed out. Please try again.");
|
|
12197
|
-
|
|
12198
|
-
|
|
12199
|
-
throw
|
|
12176
|
+
if (error2 instanceof Error && error2.message === "KAKAO_POPUP_BLOCKED")
|
|
12177
|
+
throw new Error("Please allow popups and try again.");
|
|
12178
|
+
throw new Error("Kakao authentication failed. Please try again.");
|
|
12200
12179
|
} finally {
|
|
12180
|
+
if (popup && !popup.closed)
|
|
12181
|
+
popup.close();
|
|
12201
12182
|
isKakaoLoginInProgress = false;
|
|
12202
12183
|
}
|
|
12203
12184
|
}
|
|
@@ -12429,7 +12410,7 @@ function useAbcWaasSocial(props) {
|
|
|
12429
12410
|
}
|
|
12430
12411
|
|
|
12431
12412
|
// src/components/ConnectOptions/AbcWaasAuth/AbcWaasAuthFlow.tsx
|
|
12432
|
-
var
|
|
12413
|
+
var logger17 = createLogger("AbcWaasAuthFlow");
|
|
12433
12414
|
function AbcWaasAuthFlow({
|
|
12434
12415
|
onPinCreateRequired,
|
|
12435
12416
|
onPinVerifyRequired,
|
|
@@ -12443,23 +12424,23 @@ function AbcWaasAuthFlow({
|
|
|
12443
12424
|
});
|
|
12444
12425
|
const socialAuth = useAbcWaasSocial({
|
|
12445
12426
|
onPinRequired: (loginData, email, canVerifyPin) => {
|
|
12446
|
-
|
|
12427
|
+
logger17.info("PIN required for social login");
|
|
12447
12428
|
abcAuth.setEmail(email);
|
|
12448
12429
|
if (canVerifyPin) {
|
|
12449
|
-
|
|
12430
|
+
logger17.info("Social login - routing to verify modal");
|
|
12450
12431
|
onPinVerifyRequired(loginData);
|
|
12451
12432
|
} else {
|
|
12452
|
-
|
|
12433
|
+
logger17.warn("Social login - routing to create modal");
|
|
12453
12434
|
onPinCreateRequired(loginData);
|
|
12454
12435
|
}
|
|
12455
12436
|
},
|
|
12456
12437
|
onEmailSet: (email) => {
|
|
12457
|
-
|
|
12438
|
+
logger17.info("Email set from social login");
|
|
12458
12439
|
abcAuth.setEmail(email);
|
|
12459
12440
|
}
|
|
12460
12441
|
});
|
|
12461
12442
|
const handleSocialLogin = async (provider) => {
|
|
12462
|
-
|
|
12443
|
+
logger17.info("Social login initiated:", provider);
|
|
12463
12444
|
if (provider === "google") {
|
|
12464
12445
|
await socialAuth.handleGoogleLogin();
|
|
12465
12446
|
} else if (provider === "apple") {
|
|
@@ -12969,7 +12950,7 @@ function clearLatestWalletId() {
|
|
|
12969
12950
|
}
|
|
12970
12951
|
|
|
12971
12952
|
// src/components/ConnectOptions/ExternalWallets/hooks/useWalletConnection.ts
|
|
12972
|
-
var
|
|
12953
|
+
var logger18 = createLogger("useWalletConnection");
|
|
12973
12954
|
function useWalletConnection({
|
|
12974
12955
|
onSuccess,
|
|
12975
12956
|
initialWallet
|
|
@@ -13057,7 +13038,7 @@ function useWalletConnection({
|
|
|
13057
13038
|
callOnSuccess();
|
|
13058
13039
|
return;
|
|
13059
13040
|
}
|
|
13060
|
-
|
|
13041
|
+
logger18.error("Connection failed:", error2);
|
|
13061
13042
|
setConnectionError(true);
|
|
13062
13043
|
}
|
|
13063
13044
|
};
|
|
@@ -13363,7 +13344,7 @@ function PinInputModal({
|
|
|
13363
13344
|
|
|
13364
13345
|
// src/components/ConnectOptions/PinAuth/hooks/usePinCreation.ts
|
|
13365
13346
|
import { useState as useState34 } from "react";
|
|
13366
|
-
var
|
|
13347
|
+
var logger19 = createLogger("PinCreation");
|
|
13367
13348
|
function usePinCreation(props) {
|
|
13368
13349
|
const { onPinConfirmed, onShowConfirmModal } = props;
|
|
13369
13350
|
const [pin, setPin] = useState34("");
|
|
@@ -13371,29 +13352,29 @@ function usePinCreation(props) {
|
|
|
13371
13352
|
const [error2, setError] = useState34("");
|
|
13372
13353
|
const [isCreating, setIsCreating] = useState34(false);
|
|
13373
13354
|
const handlePinCreate = async (createdPin) => {
|
|
13374
|
-
|
|
13355
|
+
logger19.info("Creating PIN");
|
|
13375
13356
|
setPin(createdPin);
|
|
13376
13357
|
setError("");
|
|
13377
13358
|
onShowConfirmModal?.();
|
|
13378
13359
|
};
|
|
13379
13360
|
const handlePinConfirm = async (confirmedPin) => {
|
|
13380
|
-
|
|
13361
|
+
logger19.info("Confirming PIN");
|
|
13381
13362
|
if (confirmedPin !== pin) {
|
|
13382
|
-
|
|
13363
|
+
logger19.error("PINs do not match");
|
|
13383
13364
|
setError("PINs do not match. Please try again.");
|
|
13384
13365
|
return;
|
|
13385
13366
|
}
|
|
13386
13367
|
setIsCreating(true);
|
|
13387
13368
|
setError("");
|
|
13388
13369
|
try {
|
|
13389
|
-
|
|
13370
|
+
logger19.debug("Hashing PIN...");
|
|
13390
13371
|
const hashedPin = await hashPin(pin);
|
|
13391
|
-
|
|
13372
|
+
logger19.info("PIN hashed successfully");
|
|
13392
13373
|
await onPinConfirmed(hashedPin);
|
|
13393
13374
|
setPin("");
|
|
13394
13375
|
setConfirmPin("");
|
|
13395
13376
|
} catch (error3) {
|
|
13396
|
-
|
|
13377
|
+
logger19.error("PIN confirmation failed:", error3);
|
|
13397
13378
|
setError(error3.message || "Failed to confirm PIN");
|
|
13398
13379
|
throw error3;
|
|
13399
13380
|
} finally {
|
|
@@ -13401,7 +13382,7 @@ function usePinCreation(props) {
|
|
|
13401
13382
|
}
|
|
13402
13383
|
};
|
|
13403
13384
|
const resetPin = () => {
|
|
13404
|
-
|
|
13385
|
+
logger19.debug("Resetting PIN state");
|
|
13405
13386
|
setPin("");
|
|
13406
13387
|
setConfirmPin("");
|
|
13407
13388
|
setError("");
|
|
@@ -13419,14 +13400,14 @@ function usePinCreation(props) {
|
|
|
13419
13400
|
|
|
13420
13401
|
// src/components/ConnectOptions/PinAuth/hooks/usePinVerification.ts
|
|
13421
13402
|
import { useState as useState35 } from "react";
|
|
13422
|
-
var
|
|
13403
|
+
var logger20 = createLogger("PinVerification");
|
|
13423
13404
|
function usePinVerification(props) {
|
|
13424
13405
|
const { email, onVerified, onSessionExpired } = props;
|
|
13425
13406
|
const [isVerifying, setIsVerifying] = useState35(false);
|
|
13426
13407
|
const [error2, setError] = useState35("");
|
|
13427
13408
|
const [progress, setProgress] = useState35([]);
|
|
13428
13409
|
const handlePinVerify = async (pin) => {
|
|
13429
|
-
|
|
13410
|
+
logger20.info("Verifying PIN");
|
|
13430
13411
|
setProgress([
|
|
13431
13412
|
{ label: "Verifying PIN...", status: "active" },
|
|
13432
13413
|
{ label: "Restoring wallet data...", status: "pending" }
|
|
@@ -13435,15 +13416,15 @@ function usePinVerification(props) {
|
|
|
13435
13416
|
setError("");
|
|
13436
13417
|
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
13437
13418
|
try {
|
|
13438
|
-
|
|
13419
|
+
logger20.debug("Hashing PIN...");
|
|
13439
13420
|
const hashedPin = await hashPin(pin);
|
|
13440
|
-
|
|
13421
|
+
logger20.debug("Decrypting stored data...");
|
|
13441
13422
|
const saltHex = get(STORAGE_NS.ABC, "enc_salt");
|
|
13442
13423
|
const encryptedData = get(STORAGE_NS.ABC, "enc_tokens");
|
|
13443
13424
|
let sensitiveData;
|
|
13444
13425
|
let isExpired = false;
|
|
13445
13426
|
if (!saltHex || !encryptedData) {
|
|
13446
|
-
|
|
13427
|
+
logger20.info("Using fresh tokens from auth_state");
|
|
13447
13428
|
const authStateStr2 = get(STORAGE_NS.ABC, "auth_state");
|
|
13448
13429
|
if (!authStateStr2) {
|
|
13449
13430
|
throw new Error("No auth state found. Please login again.");
|
|
@@ -13459,7 +13440,7 @@ function usePinVerification(props) {
|
|
|
13459
13440
|
};
|
|
13460
13441
|
isExpired = false;
|
|
13461
13442
|
} else {
|
|
13462
|
-
|
|
13443
|
+
logger20.debug("Decrypting stored tokens");
|
|
13463
13444
|
try {
|
|
13464
13445
|
const decrypted = await decryptWithPin(
|
|
13465
13446
|
encryptedData,
|
|
@@ -13467,7 +13448,7 @@ function usePinVerification(props) {
|
|
|
13467
13448
|
saltHex
|
|
13468
13449
|
);
|
|
13469
13450
|
sensitiveData = JSON.parse(decrypted);
|
|
13470
|
-
|
|
13451
|
+
logger20.info("PIN verified successfully");
|
|
13471
13452
|
} catch (_decryptError) {
|
|
13472
13453
|
throw new Error("Incorrect PIN. Please try again.");
|
|
13473
13454
|
}
|
|
@@ -13477,7 +13458,7 @@ function usePinVerification(props) {
|
|
|
13477
13458
|
{ label: "Verifying PIN...", status: "completed" },
|
|
13478
13459
|
{ label: "Restoring wallet data...", status: "active" }
|
|
13479
13460
|
]);
|
|
13480
|
-
|
|
13461
|
+
logger20.info("Restoring wallet data...");
|
|
13481
13462
|
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
13482
13463
|
const authStateStr = get(STORAGE_NS.ABC, "auth_state");
|
|
13483
13464
|
if (!authStateStr) {
|
|
@@ -13488,7 +13469,7 @@ function usePinVerification(props) {
|
|
|
13488
13469
|
authState.refreshToken = sensitiveData.refreshToken;
|
|
13489
13470
|
authState.expiresAt = sensitiveData.expiresAt;
|
|
13490
13471
|
if (isExpired) {
|
|
13491
|
-
|
|
13472
|
+
logger20.info("Access token expired, attempting refresh...");
|
|
13492
13473
|
try {
|
|
13493
13474
|
const refreshToken = sensitiveData.refreshToken;
|
|
13494
13475
|
if (!refreshToken) {
|
|
@@ -13507,7 +13488,7 @@ function usePinVerification(props) {
|
|
|
13507
13488
|
if (!res.accessToken) {
|
|
13508
13489
|
throw new Error("Your session has expired. Please login again.");
|
|
13509
13490
|
}
|
|
13510
|
-
|
|
13491
|
+
logger20.info("Token refreshed successfully");
|
|
13511
13492
|
const newAccessToken = res.accessToken;
|
|
13512
13493
|
const newRefreshToken = res.refreshToken || refreshToken;
|
|
13513
13494
|
const expiresIn = res.expiresIn || 600;
|
|
@@ -13534,9 +13515,9 @@ function usePinVerification(props) {
|
|
|
13534
13515
|
);
|
|
13535
13516
|
set(STORAGE_NS.ABC, "enc_tokens", encryptedTokens);
|
|
13536
13517
|
setJSON(STORAGE_NS.ABC, "auth_state", authState);
|
|
13537
|
-
|
|
13518
|
+
logger20.info("Encrypted tokens updated");
|
|
13538
13519
|
} catch (refreshError) {
|
|
13539
|
-
|
|
13520
|
+
logger20.error("Token refresh failed:", refreshError);
|
|
13540
13521
|
const freshAuthState = getJSON(STORAGE_NS.ABC, "auth_state");
|
|
13541
13522
|
const hasFreshTokens = freshAuthState && (() => {
|
|
13542
13523
|
try {
|
|
@@ -13547,7 +13528,7 @@ function usePinVerification(props) {
|
|
|
13547
13528
|
}
|
|
13548
13529
|
})();
|
|
13549
13530
|
if (!hasFreshTokens) {
|
|
13550
|
-
|
|
13531
|
+
logger20.info("Clearing all auth data");
|
|
13551
13532
|
remove(STORAGE_NS.ABC, "auth_state");
|
|
13552
13533
|
remove(STORAGE_NS.ABC, "enc_tokens");
|
|
13553
13534
|
remove(STORAGE_NS.ABC, "enc_salt");
|
|
@@ -13558,7 +13539,7 @@ function usePinVerification(props) {
|
|
|
13558
13539
|
onSessionExpired?.();
|
|
13559
13540
|
throw new Error("Your session has expired. Please login again.");
|
|
13560
13541
|
}
|
|
13561
|
-
|
|
13542
|
+
logger20.info("Using fresh tokens from login, skipping refresh");
|
|
13562
13543
|
}
|
|
13563
13544
|
}
|
|
13564
13545
|
const user = getJSON(STORAGE_NS.ABC, "user");
|
|
@@ -13583,11 +13564,11 @@ function usePinVerification(props) {
|
|
|
13583
13564
|
{ label: "Verifying PIN...", status: "completed" },
|
|
13584
13565
|
{ label: "Restoring wallet data...", status: "completed" }
|
|
13585
13566
|
]);
|
|
13586
|
-
|
|
13567
|
+
logger20.info("Wallet data restored successfully");
|
|
13587
13568
|
window.dispatchEvent(new Event("talkenkit_storage_update"));
|
|
13588
13569
|
onVerified();
|
|
13589
13570
|
} catch (err) {
|
|
13590
|
-
|
|
13571
|
+
logger20.error("PIN verification failed:", err);
|
|
13591
13572
|
setError(err.message || "Failed to verify PIN");
|
|
13592
13573
|
throw err;
|
|
13593
13574
|
} finally {
|
|
@@ -13595,7 +13576,7 @@ function usePinVerification(props) {
|
|
|
13595
13576
|
}
|
|
13596
13577
|
};
|
|
13597
13578
|
const resetVerification = () => {
|
|
13598
|
-
|
|
13579
|
+
logger20.debug("Resetting verification state");
|
|
13599
13580
|
setError("");
|
|
13600
13581
|
setProgress([]);
|
|
13601
13582
|
};
|
|
@@ -13610,7 +13591,7 @@ function usePinVerification(props) {
|
|
|
13610
13591
|
|
|
13611
13592
|
// src/components/ConnectOptions/PinAuth/hooks/useWalletGeneration.ts
|
|
13612
13593
|
import { useState as useState36 } from "react";
|
|
13613
|
-
var
|
|
13594
|
+
var logger21 = createLogger("useWalletGeneration");
|
|
13614
13595
|
function useWalletGeneration(props) {
|
|
13615
13596
|
const { connectors, connect, onSuccess } = props;
|
|
13616
13597
|
const [isGenerating, setIsGenerating] = useState36(false);
|
|
@@ -13683,7 +13664,7 @@ function useWalletGeneration(props) {
|
|
|
13683
13664
|
if (!xrpAddress)
|
|
13684
13665
|
xrpAddress = addrResponse?.xrp || addrResponse?.xrpAddress || "";
|
|
13685
13666
|
} catch (err) {
|
|
13686
|
-
|
|
13667
|
+
logger21.warn("Failed to derive BTC/TRX/XRP addresses:", err);
|
|
13687
13668
|
}
|
|
13688
13669
|
}
|
|
13689
13670
|
const solMaterial = genResponse.solana;
|
|
@@ -13841,7 +13822,7 @@ function useWalletGeneration(props) {
|
|
|
13841
13822
|
}
|
|
13842
13823
|
|
|
13843
13824
|
// src/components/ConnectOptions/PinAuth/PinAuthFlow.tsx
|
|
13844
|
-
var
|
|
13825
|
+
var logger22 = createLogger("PinAuthFlow");
|
|
13845
13826
|
var PinAuthFlow = forwardRef(
|
|
13846
13827
|
(props, ref) => {
|
|
13847
13828
|
const {
|
|
@@ -13906,7 +13887,7 @@ var PinAuthFlow = forwardRef(
|
|
|
13906
13887
|
if (abcConnector) {
|
|
13907
13888
|
connect({ connector: abcConnector });
|
|
13908
13889
|
} else {
|
|
13909
|
-
|
|
13890
|
+
logger22.error("ABC Wallet connector not found");
|
|
13910
13891
|
}
|
|
13911
13892
|
onComplete();
|
|
13912
13893
|
},
|
|
@@ -15417,7 +15398,7 @@ function useWalletStepMachine({
|
|
|
15417
15398
|
}
|
|
15418
15399
|
|
|
15419
15400
|
// src/components/ConnectOptions/ConnectOptionsModal.tsx
|
|
15420
|
-
var
|
|
15401
|
+
var logger23 = createLogger("ConnectOptionsModal");
|
|
15421
15402
|
function ConnectOptionsModal({
|
|
15422
15403
|
onClose,
|
|
15423
15404
|
solanaWallets,
|
|
@@ -15445,14 +15426,14 @@ function ConnectOptionsModal({
|
|
|
15445
15426
|
(c) => c.id === "abc" || c.id === "abcWallet"
|
|
15446
15427
|
);
|
|
15447
15428
|
if (!abcConnector) {
|
|
15448
|
-
|
|
15429
|
+
logger23.error("ABC connector not found");
|
|
15449
15430
|
return;
|
|
15450
15431
|
}
|
|
15451
15432
|
try {
|
|
15452
15433
|
await connectAsync({ connector: abcConnector });
|
|
15453
15434
|
onClose();
|
|
15454
15435
|
} catch (err) {
|
|
15455
|
-
|
|
15436
|
+
logger23.error("Connect failed after ensure-user:", err);
|
|
15456
15437
|
}
|
|
15457
15438
|
};
|
|
15458
15439
|
const walletConnection = useWalletConnection({
|
|
@@ -16240,7 +16221,7 @@ var MobileStatus = ({ onClose }) => {
|
|
|
16240
16221
|
};
|
|
16241
16222
|
|
|
16242
16223
|
// src/components/ConnectOptions/ConnectOptions.tsx
|
|
16243
|
-
var
|
|
16224
|
+
var logger24 = createLogger("ConnectOptions");
|
|
16244
16225
|
function ConnectOptions({ onClose }) {
|
|
16245
16226
|
const { connector } = useContext27(WalletButtonContext);
|
|
16246
16227
|
const multiChainContext = useContext27(MultiChainContext);
|
|
@@ -16310,7 +16291,7 @@ function ConnectOptions({ onClose }) {
|
|
|
16310
16291
|
setShouldCloseOnConnect(true);
|
|
16311
16292
|
}
|
|
16312
16293
|
} catch (err) {
|
|
16313
|
-
|
|
16294
|
+
logger24.error("Solana connection error:", err);
|
|
16314
16295
|
const isUserRejection2 = err?.name === "WalletConnectionError" || err?.name === "WalletNotReadyError" || err?.message?.includes("User rejected") || err?.message?.includes("User canceled");
|
|
16315
16296
|
if (!isUserRejection2) {
|
|
16316
16297
|
alert(
|
|
@@ -16456,7 +16437,7 @@ var walletName = "lkxkyz8 kwh1ip1a kwh1ip1g";
|
|
|
16456
16437
|
var walletStatus = "lkxkyza kwh1ip19";
|
|
16457
16438
|
|
|
16458
16439
|
// src/components/SolanaWalletList/SolanaWalletList.tsx
|
|
16459
|
-
var
|
|
16440
|
+
var logger25 = createLogger("SolanaWalletList");
|
|
16460
16441
|
function SolanaWalletList2({
|
|
16461
16442
|
onConnect,
|
|
16462
16443
|
onError
|
|
@@ -16475,7 +16456,7 @@ function SolanaWalletList2({
|
|
|
16475
16456
|
await connect();
|
|
16476
16457
|
onConnect?.();
|
|
16477
16458
|
} catch (err) {
|
|
16478
|
-
|
|
16459
|
+
logger25.error("Connection error:", err);
|
|
16479
16460
|
onError?.(err);
|
|
16480
16461
|
} finally {
|
|
16481
16462
|
setConnectingWallet(null);
|
|
@@ -16530,7 +16511,7 @@ function SolanaWalletList2({
|
|
|
16530
16511
|
}
|
|
16531
16512
|
|
|
16532
16513
|
// src/components/ConnectOptions/MultiChainConnectOptions.tsx
|
|
16533
|
-
var
|
|
16514
|
+
var logger26 = createLogger("MultiChainConnectOptions");
|
|
16534
16515
|
function MultiChainConnectOptions({
|
|
16535
16516
|
onClose,
|
|
16536
16517
|
showChainSelector = true
|
|
@@ -16591,7 +16572,7 @@ function UnifiedWalletList({ onClose }) {
|
|
|
16591
16572
|
addRecentSolanaWalletId(walletName2);
|
|
16592
16573
|
}
|
|
16593
16574
|
} catch (err) {
|
|
16594
|
-
|
|
16575
|
+
logger26.error("Solana connection error:", err);
|
|
16595
16576
|
const isUserRejection2 = err?.name === "WalletConnectionError" || err?.name === "WalletNotReadyError" || err?.message?.includes("User rejected") || err?.message?.includes("User canceled");
|
|
16596
16577
|
if (!isUserRejection2) {
|
|
16597
16578
|
alert(
|
|
@@ -17224,7 +17205,7 @@ import React106, {
|
|
|
17224
17205
|
useState as useState46
|
|
17225
17206
|
} from "react";
|
|
17226
17207
|
import { useAccount as useAccount22, useAccountEffect as useAccountEffect4 } from "wagmi";
|
|
17227
|
-
var
|
|
17208
|
+
var logger27 = createLogger("WalletButton");
|
|
17228
17209
|
function WalletButtonRenderer({
|
|
17229
17210
|
// Wallet is the same as `connector.id` which is injected into
|
|
17230
17211
|
// wagmi connectors
|
|
@@ -17266,14 +17247,14 @@ function WalletButtonRenderer({
|
|
|
17266
17247
|
}, [isConnected, firstConnector]);
|
|
17267
17248
|
const connectWallet = async () => {
|
|
17268
17249
|
try {
|
|
17269
|
-
|
|
17250
|
+
logger27.info("Connecting wallet:", firstConnector?.id);
|
|
17270
17251
|
setLoading(true);
|
|
17271
17252
|
if (isError)
|
|
17272
17253
|
setIsError(false);
|
|
17273
17254
|
await firstConnector?.connect?.();
|
|
17274
|
-
|
|
17255
|
+
logger27.info("Wallet connected successfully");
|
|
17275
17256
|
} catch (error2) {
|
|
17276
|
-
|
|
17257
|
+
logger27.error("Connection failed:", error2);
|
|
17277
17258
|
setIsError(true);
|
|
17278
17259
|
} finally {
|
|
17279
17260
|
setLoading(false);
|
|
@@ -18568,7 +18549,7 @@ import React110, {
|
|
|
18568
18549
|
useEffect as useEffect43,
|
|
18569
18550
|
useCallback as useCallback31
|
|
18570
18551
|
} from "react";
|
|
18571
|
-
var
|
|
18552
|
+
var logger28 = createLogger("AbcAuthProvider");
|
|
18572
18553
|
var AbcAuthContext = createContext22(null);
|
|
18573
18554
|
function useAbcAuth() {
|
|
18574
18555
|
const context = useContext36(AbcAuthContext);
|
|
@@ -18615,13 +18596,13 @@ function AbcAuthProvider({ children }) {
|
|
|
18615
18596
|
}, [state.tokens.expiresAt]);
|
|
18616
18597
|
const refreshToken = useCallback31(async () => {
|
|
18617
18598
|
if (!state.tokens.refreshToken) {
|
|
18618
|
-
|
|
18599
|
+
logger28.debug("No refresh token available");
|
|
18619
18600
|
return false;
|
|
18620
18601
|
}
|
|
18621
18602
|
try {
|
|
18622
18603
|
const api = getTalkenApiClient();
|
|
18623
18604
|
if (!api) {
|
|
18624
|
-
|
|
18605
|
+
logger28.error("TalkenApiClient not initialized");
|
|
18625
18606
|
return false;
|
|
18626
18607
|
}
|
|
18627
18608
|
api.setTokens(
|
|
@@ -18645,10 +18626,10 @@ function AbcAuthProvider({ children }) {
|
|
|
18645
18626
|
}
|
|
18646
18627
|
set(STORAGE_NS.ABC, "expires_at", String(expiresAt));
|
|
18647
18628
|
scheduleProactiveRefresh(expiresAt);
|
|
18648
|
-
|
|
18629
|
+
logger28.info("Token refreshed");
|
|
18649
18630
|
return true;
|
|
18650
18631
|
} catch (error2) {
|
|
18651
|
-
|
|
18632
|
+
logger28.error("Token refresh error:", error2);
|
|
18652
18633
|
return false;
|
|
18653
18634
|
}
|
|
18654
18635
|
}, [
|
|
@@ -18695,10 +18676,10 @@ function AbcAuthProvider({ children }) {
|
|
|
18695
18676
|
},
|
|
18696
18677
|
pinHash: hashedPin
|
|
18697
18678
|
}));
|
|
18698
|
-
|
|
18679
|
+
logger28.info("Unlocked with PIN");
|
|
18699
18680
|
return true;
|
|
18700
18681
|
} catch (error2) {
|
|
18701
|
-
|
|
18682
|
+
logger28.error("Unlock failed:", error2);
|
|
18702
18683
|
return false;
|
|
18703
18684
|
}
|
|
18704
18685
|
}, []);
|
|
@@ -18724,7 +18705,7 @@ function AbcAuthProvider({ children }) {
|
|
|
18724
18705
|
getTalkenApiClient4()?.clearSession();
|
|
18725
18706
|
} catch {
|
|
18726
18707
|
}
|
|
18727
|
-
|
|
18708
|
+
logger28.info("Logged out");
|
|
18728
18709
|
}, []);
|
|
18729
18710
|
const setAuthState = useCallback31((partial) => {
|
|
18730
18711
|
setState((prev) => ({ ...prev, ...partial }));
|
|
@@ -18758,7 +18739,7 @@ function AbcAuthProvider({ children }) {
|
|
|
18758
18739
|
},
|
|
18759
18740
|
pinHash: null
|
|
18760
18741
|
});
|
|
18761
|
-
|
|
18742
|
+
logger28.info("Session restored (Access Key mode)");
|
|
18762
18743
|
return;
|
|
18763
18744
|
}
|
|
18764
18745
|
if (accessToken) {
|
|
@@ -18783,19 +18764,19 @@ function AbcAuthProvider({ children }) {
|
|
|
18783
18764
|
},
|
|
18784
18765
|
pinHash: null
|
|
18785
18766
|
});
|
|
18786
|
-
|
|
18767
|
+
logger28.info("Session restored (Bearer mode)", {
|
|
18787
18768
|
hasEvm: !!authState.evmWallet || !!authState.wallet,
|
|
18788
18769
|
hasSolana: !!authState.solanaWallet
|
|
18789
18770
|
});
|
|
18790
18771
|
}
|
|
18791
18772
|
}
|
|
18792
18773
|
} catch (error2) {
|
|
18793
|
-
|
|
18774
|
+
logger28.error("Failed to restore session:", error2);
|
|
18794
18775
|
}
|
|
18795
18776
|
};
|
|
18796
18777
|
restoreSession();
|
|
18797
18778
|
const handleStorageUpdate = () => {
|
|
18798
|
-
|
|
18779
|
+
logger28.debug("Storage updated, restoring session");
|
|
18799
18780
|
restoreSession();
|
|
18800
18781
|
};
|
|
18801
18782
|
window.addEventListener("talkenkit_storage_update", handleStorageUpdate);
|
|
@@ -18808,7 +18789,7 @@ function AbcAuthProvider({ children }) {
|
|
|
18808
18789
|
}, []);
|
|
18809
18790
|
useEffect43(() => {
|
|
18810
18791
|
const handleExpired = () => {
|
|
18811
|
-
|
|
18792
|
+
logger28.info("Access key expired \u2014 logging out");
|
|
18812
18793
|
logout();
|
|
18813
18794
|
};
|
|
18814
18795
|
window.addEventListener("talkenkit:access_key_expired", handleExpired);
|
|
@@ -19161,6 +19142,135 @@ var WagmiSigner = class {
|
|
|
19161
19142
|
}
|
|
19162
19143
|
};
|
|
19163
19144
|
|
|
19145
|
+
// src/gasless/utils/fiatFormatter.ts
|
|
19146
|
+
var PRICE_TTL_MS = 3e4;
|
|
19147
|
+
var priceCache = /* @__PURE__ */ new Map();
|
|
19148
|
+
var inFlight = /* @__PURE__ */ new Map();
|
|
19149
|
+
function priceCacheKey(chainKey, tokenAddress, currency) {
|
|
19150
|
+
return `${chainKey}:${tokenAddress.toLowerCase()}:${currency.toUpperCase()}`;
|
|
19151
|
+
}
|
|
19152
|
+
function getCachedPrice(chainKey, tokenAddress, currency) {
|
|
19153
|
+
const key = priceCacheKey(chainKey, tokenAddress, currency);
|
|
19154
|
+
const entry = priceCache.get(key);
|
|
19155
|
+
if (!entry)
|
|
19156
|
+
return void 0;
|
|
19157
|
+
if (Date.now() >= entry.expiresAt) {
|
|
19158
|
+
priceCache.delete(key);
|
|
19159
|
+
return void 0;
|
|
19160
|
+
}
|
|
19161
|
+
return entry.price;
|
|
19162
|
+
}
|
|
19163
|
+
function setCachedPrice(chainKey, tokenAddress, currency, price) {
|
|
19164
|
+
const key = priceCacheKey(chainKey, tokenAddress, currency);
|
|
19165
|
+
priceCache.set(key, { price, expiresAt: Date.now() + PRICE_TTL_MS });
|
|
19166
|
+
}
|
|
19167
|
+
async function fetchPrice(chainKey, tokenAddress, upper, rawCurrency) {
|
|
19168
|
+
const cached = getCachedPrice(chainKey, tokenAddress, upper);
|
|
19169
|
+
if (cached !== void 0)
|
|
19170
|
+
return cached;
|
|
19171
|
+
const key = priceCacheKey(chainKey, tokenAddress, upper);
|
|
19172
|
+
const pending = inFlight.get(key);
|
|
19173
|
+
if (pending)
|
|
19174
|
+
return pending;
|
|
19175
|
+
const promise = (async () => {
|
|
19176
|
+
try {
|
|
19177
|
+
const api = getTalkenApiClient();
|
|
19178
|
+
if (!api)
|
|
19179
|
+
return null;
|
|
19180
|
+
const tokens = await api.walletscan.getToken({
|
|
19181
|
+
chainKeys: chainKey,
|
|
19182
|
+
contractAddress: tokenAddress
|
|
19183
|
+
});
|
|
19184
|
+
const token = tokens?.[0];
|
|
19185
|
+
const priceMap = token?.price?.coingecko;
|
|
19186
|
+
if (!priceMap)
|
|
19187
|
+
return null;
|
|
19188
|
+
const fetched = priceMap[upper] ?? priceMap[rawCurrency];
|
|
19189
|
+
if (typeof fetched !== "number" || !Number.isFinite(fetched))
|
|
19190
|
+
return null;
|
|
19191
|
+
setCachedPrice(chainKey, tokenAddress, upper, fetched);
|
|
19192
|
+
return fetched;
|
|
19193
|
+
} catch {
|
|
19194
|
+
return null;
|
|
19195
|
+
}
|
|
19196
|
+
})();
|
|
19197
|
+
inFlight.set(key, promise);
|
|
19198
|
+
promise.finally(() => {
|
|
19199
|
+
if (inFlight.get(key) === promise)
|
|
19200
|
+
inFlight.delete(key);
|
|
19201
|
+
});
|
|
19202
|
+
return promise;
|
|
19203
|
+
}
|
|
19204
|
+
var CURRENCY_DEFAULTS = {
|
|
19205
|
+
USD: { locale: "en-US", decimals: 2 },
|
|
19206
|
+
KRW: { locale: "ko-KR", decimals: 0 },
|
|
19207
|
+
EUR: { locale: "en-US", decimals: 2 },
|
|
19208
|
+
JPY: { locale: "ja-JP", decimals: 0 },
|
|
19209
|
+
GBP: { locale: "en-GB", decimals: 2 }
|
|
19210
|
+
};
|
|
19211
|
+
function getCurrencyDefaults(currency) {
|
|
19212
|
+
return CURRENCY_DEFAULTS[currency.toUpperCase()] ?? {
|
|
19213
|
+
locale: "en-US",
|
|
19214
|
+
decimals: 2
|
|
19215
|
+
};
|
|
19216
|
+
}
|
|
19217
|
+
function formatFiat(value2, currency) {
|
|
19218
|
+
if (!Number.isFinite(value2))
|
|
19219
|
+
return "\u2014";
|
|
19220
|
+
const { locale, decimals } = getCurrencyDefaults(currency);
|
|
19221
|
+
const min = 10 ** -decimals;
|
|
19222
|
+
try {
|
|
19223
|
+
if (value2 > 0 && value2 < min) {
|
|
19224
|
+
const formatted = new Intl.NumberFormat(locale, {
|
|
19225
|
+
style: "currency",
|
|
19226
|
+
currency,
|
|
19227
|
+
minimumFractionDigits: decimals,
|
|
19228
|
+
maximumFractionDigits: decimals
|
|
19229
|
+
}).format(min);
|
|
19230
|
+
return `<${formatted}`;
|
|
19231
|
+
}
|
|
19232
|
+
return new Intl.NumberFormat(locale, {
|
|
19233
|
+
style: "currency",
|
|
19234
|
+
currency,
|
|
19235
|
+
minimumFractionDigits: decimals,
|
|
19236
|
+
maximumFractionDigits: decimals
|
|
19237
|
+
}).format(value2);
|
|
19238
|
+
} catch {
|
|
19239
|
+
return `${value2.toFixed(decimals)} ${currency}`;
|
|
19240
|
+
}
|
|
19241
|
+
}
|
|
19242
|
+
function rawToFloat(raw, decimals) {
|
|
19243
|
+
try {
|
|
19244
|
+
const value2 = BigInt(raw);
|
|
19245
|
+
if (decimals <= 0)
|
|
19246
|
+
return Number(value2);
|
|
19247
|
+
const divisor = BigInt(10) ** BigInt(decimals);
|
|
19248
|
+
const whole = value2 / divisor;
|
|
19249
|
+
const fractional = value2 % divisor;
|
|
19250
|
+
const fracStr = fractional.toString().padStart(decimals, "0");
|
|
19251
|
+
return Number(`${whole}.${fracStr}`);
|
|
19252
|
+
} catch {
|
|
19253
|
+
return Number.NaN;
|
|
19254
|
+
}
|
|
19255
|
+
}
|
|
19256
|
+
async function resolveFiatString(feeToken, feeAmountRaw, chainKey, currency) {
|
|
19257
|
+
try {
|
|
19258
|
+
const upper = currency.toUpperCase();
|
|
19259
|
+
const price = await fetchPrice(chainKey, feeToken.address, upper, currency);
|
|
19260
|
+
if (price === null)
|
|
19261
|
+
return null;
|
|
19262
|
+
const amountNum = rawToFloat(feeAmountRaw, feeToken.decimals);
|
|
19263
|
+
if (!Number.isFinite(amountNum))
|
|
19264
|
+
return null;
|
|
19265
|
+
const fiatValue = amountNum * price;
|
|
19266
|
+
if (!Number.isFinite(fiatValue))
|
|
19267
|
+
return null;
|
|
19268
|
+
return formatFiat(fiatValue, upper);
|
|
19269
|
+
} catch {
|
|
19270
|
+
return null;
|
|
19271
|
+
}
|
|
19272
|
+
}
|
|
19273
|
+
|
|
19164
19274
|
// src/gasless/hooks/useGaslessTransfer.ts
|
|
19165
19275
|
function tryGetChainKey2(chainId) {
|
|
19166
19276
|
try {
|
|
@@ -19290,6 +19400,25 @@ function useGaslessTransfer(params) {
|
|
|
19290
19400
|
setCanGasless(true);
|
|
19291
19401
|
setGaslessMode(estimate.gaslessMode);
|
|
19292
19402
|
setUnavailableReason(null);
|
|
19403
|
+
if (gaslessConfig.displayCurrency) {
|
|
19404
|
+
const currency = gaslessConfig.displayCurrency;
|
|
19405
|
+
void resolveFiatString(
|
|
19406
|
+
estimate.feeToken,
|
|
19407
|
+
estimate.feeAmountRaw,
|
|
19408
|
+
chainKey,
|
|
19409
|
+
currency
|
|
19410
|
+
).then((fiat) => {
|
|
19411
|
+
if (abortRef.current !== currentAbort)
|
|
19412
|
+
return;
|
|
19413
|
+
if (!mountedRef.current)
|
|
19414
|
+
return;
|
|
19415
|
+
const fiatStr = fiat ?? "\u2014";
|
|
19416
|
+
const usdAlias = currency.toUpperCase() === "USD" ? fiatStr : void 0;
|
|
19417
|
+
setFeeEstimate(
|
|
19418
|
+
(prev) => prev ? { ...prev, feeAmountFiat: fiatStr, feeAmountUsd: usdAlias } : prev
|
|
19419
|
+
);
|
|
19420
|
+
});
|
|
19421
|
+
}
|
|
19293
19422
|
} else {
|
|
19294
19423
|
setFeeEstimate(null);
|
|
19295
19424
|
setCanGasless(false);
|
|
@@ -19436,6 +19565,7 @@ export {
|
|
|
19436
19565
|
chainIdToNetwork,
|
|
19437
19566
|
checkDelegation,
|
|
19438
19567
|
clearSession,
|
|
19568
|
+
configureKakaoAuth,
|
|
19439
19569
|
configureLogger,
|
|
19440
19570
|
connectorsForWallets,
|
|
19441
19571
|
createAbcSolanaAdapter,
|