@talken/talkenkit 2.4.15 → 2.4.17
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-54KUGWUZ.js +192 -0
- package/dist/abcWallet-KZHOADBJ.js +192 -0
- package/dist/abcWallet-NZAVB4PI.js +190 -0
- package/dist/chunk-5X3ROW3U.js +8777 -0
- package/dist/chunk-DKA3NVFM.js +8497 -0
- package/dist/chunk-QNZ5HSPM.js +8339 -0
- package/dist/chunk-VE53ZNZV.js +331 -0
- package/dist/components/ConfirmationModal/ApproveSection.css.d.ts +16 -0
- package/dist/components/ConfirmationModal/ApproveSection.d.ts +8 -0
- package/dist/components/ConfirmationModal/NFTPlaceholder.css.d.ts +7 -0
- package/dist/components/ConfirmationModal/NFTPlaceholder.d.ts +8 -0
- package/dist/components/ConfirmationModal/NftApprovalSection.css.d.ts +10 -0
- package/dist/components/ConfirmationModal/NftApprovalSection.d.ts +7 -0
- package/dist/components/ConfirmationModal/SignConfirmationModal.css.d.ts +35 -0
- package/dist/components/ConfirmationModal/SignConfirmationModal.d.ts +17 -0
- package/dist/components/ConfirmationModal/SwapSection.css.d.ts +17 -0
- package/dist/components/ConfirmationModal/SwapSection.d.ts +7 -0
- package/dist/components/ConfirmationModal/TransactionConfirmationModal.css.d.ts +49 -0
- package/dist/components/ConfirmationModal/TransactionConfirmationModal.d.ts +12 -0
- package/dist/components/ConfirmationModal/TransferSection.css.d.ts +17 -0
- package/dist/components/ConfirmationModal/TransferSection.d.ts +7 -0
- package/dist/components/ConfirmationModal/commonStyles.css.d.ts +37 -0
- package/dist/components/ConfirmationModal/constants.d.ts +16 -0
- package/dist/components/ConfirmationModal/index.d.ts +9 -0
- package/dist/components/ConfirmationModal/modalTheme.css.d.ts +20 -0
- package/dist/components/ConfirmationModal/transactionUIRegistry.d.ts +134 -0
- package/dist/components/ConfirmationModal/utils.d.ts +37 -0
- package/dist/components/ConnectOptions/AbcWaasAuth/AbcWaasAuthSections.css.d.ts +1 -0
- package/dist/components/ConnectOptions/AbcWaasAuth/AbcWaasAuthSections.d.ts +1 -1
- package/dist/components/ConnectOptions/AbcWaasAuth/hooks/useAbcWaasAuth.d.ts +2 -25
- package/dist/components/ConnectOptions/AbcWaasAuth/hooks/useAbcWaasSocial.d.ts +1 -47
- package/dist/components/ConnectOptions/PinAuth/hooks/useWalletGeneration.d.ts +4 -21
- package/dist/components/GasFeeModal/GasFeeEditModal.css.d.ts +32 -0
- package/dist/components/GasFeeModal/GasFeeEditModal.d.ts +21 -0
- package/dist/components/GasFeeModal/index.d.ts +3 -0
- package/dist/components/GasFeeModal/modalTheme.css.d.ts +19 -0
- package/dist/components/Icons/Close2.d.ts +7 -0
- package/dist/components/Icons/Copy2.d.ts +4 -0
- package/dist/components/Icons/Dropdown2.d.ts +4 -0
- package/dist/components/Icons/Edit.d.ts +4 -0
- package/dist/components/Icons/InfoCircle.d.ts +4 -0
- package/dist/components/Icons/Kakao.d.ts +2 -0
- package/dist/components/Icons/Minus.d.ts +4 -0
- package/dist/components/Icons/Plus.d.ts +4 -0
- package/dist/components/Icons/SettingsGear.d.ts +4 -0
- package/dist/components/Icons/SpeedHigh.d.ts +4 -0
- package/dist/components/Icons/SpeedLow.d.ts +4 -0
- package/dist/components/Icons/SpeedMedium.d.ts +4 -0
- package/dist/components/RainbowKitProvider/InternalPinProvider.d.ts +7 -9
- package/dist/components/RainbowKitProvider/RainbowKitConfigProvider.d.ts +1 -6
- package/dist/components/RainbowKitProvider/RainbowKitProvider.d.ts +7 -7
- package/dist/components/Toast/Toast.css.d.ts +2 -0
- package/dist/components/Toast/Toast.d.ts +6 -0
- package/dist/components/Toast/index.d.ts +4 -0
- package/dist/components/Toast/useToast.d.ts +10 -0
- package/dist/config/networks.d.ts +10 -0
- package/dist/css/sprinkles.css.d.ts +1 -1
- package/dist/hooks/useSolanaWallet.d.ts +5 -23
- package/dist/hooks/useTronWallet.d.ts +63 -0
- package/dist/index.css +1903 -236
- package/dist/index.d.ts +8 -3
- package/dist/index.js +7557 -3592
- package/dist/klipWallet-RD5Y4UEK.js +8 -0
- package/dist/providers/SignConfirmationProvider/SignConfirmationProvider.d.ts +22 -0
- package/dist/providers/SignConfirmationProvider/index.d.ts +6 -0
- package/dist/providers/SignConfirmationProvider/requestParsers.d.ts +24 -0
- package/dist/providers/SignConfirmationProvider/types.d.ts +91 -0
- package/dist/providers/SignConfirmationProvider/useApiClient.d.ts +15 -0
- package/dist/providers/SignConfirmationProvider/useTransactionResolver.d.ts +18 -0
- package/dist/secure-AEBFSVWE.js +8 -0
- package/dist/services/AbcAgenticWalletService.d.ts +111 -0
- package/dist/services/AbcAuthService.d.ts +26 -20
- package/dist/types/index.d.ts +3 -0
- package/dist/types/token.d.ts +82 -0
- package/dist/utils/abi/abiDecoder.d.ts +144 -0
- package/dist/utils/apiClientFactory.d.ts +21 -0
- package/dist/utils/blockies.d.ts +12 -0
- package/dist/utils/tokenMapper.d.ts +10 -0
- package/dist/wallets/walletConnectors/abcWallet/abcApi.d.ts +4 -1
- package/dist/wallets/walletConnectors/abcWallet/abcApi.js +7 -7
- package/dist/wallets/walletConnectors/abcWallet/abcBitcoinConnector.js +5 -5
- package/dist/wallets/walletConnectors/abcWallet/abcBitcoinProvider.d.ts +6 -8
- package/dist/wallets/walletConnectors/abcWallet/abcBitcoinProvider.js +1 -1
- package/dist/wallets/walletConnectors/abcWallet/abcConnector.js +9 -9
- package/dist/wallets/walletConnectors/abcWallet/abcProvider.d.ts +17 -6
- package/dist/wallets/walletConnectors/abcWallet/abcProvider.js +5 -4
- package/dist/wallets/walletConnectors/abcWallet/abcSolanaProvider.d.ts +11 -34
- package/dist/wallets/walletConnectors/abcWallet/abcSolanaProvider.js +1 -1
- package/dist/wallets/walletConnectors/abcWallet/abcSolanaWalletAdapter.d.ts +3 -11
- package/dist/wallets/walletConnectors/abcWallet/abcSolanaWalletAdapter.js +17 -80
- package/dist/wallets/walletConnectors/abcWallet/abcTronProvider.d.ts +112 -0
- package/dist/wallets/walletConnectors/abcWallet/abcTronProvider.js +11 -0
- package/dist/wallets/walletConnectors/abcWallet/abcWallet.d.ts +2 -0
- package/dist/wallets/walletConnectors/abcWallet/abcWallet.js +11 -10
- package/dist/wallets/walletConnectors/abcWallet/api/AuthApi.d.ts +9 -11
- package/dist/wallets/walletConnectors/abcWallet/api/AuthApi.js +6 -6
- package/dist/wallets/walletConnectors/abcWallet/api/BaseApiClient.d.ts +1 -1
- package/dist/wallets/walletConnectors/abcWallet/api/BaseApiClient.js +5 -5
- package/dist/wallets/walletConnectors/abcWallet/api/BitcoinApi.js +6 -6
- package/dist/wallets/walletConnectors/abcWallet/api/GasApi.d.ts +45 -0
- package/dist/wallets/walletConnectors/abcWallet/api/GasApi.js +12 -0
- package/dist/wallets/walletConnectors/abcWallet/api/SigningApi.js +7 -7
- package/dist/wallets/walletConnectors/abcWallet/api/SolanaApi.d.ts +9 -1
- package/dist/wallets/walletConnectors/abcWallet/api/SolanaApi.js +7 -7
- package/dist/wallets/walletConnectors/abcWallet/api/TalkenApiClient.d.ts +333 -0
- package/dist/wallets/walletConnectors/abcWallet/api/TalkenApiClient.js +11 -0
- package/dist/wallets/walletConnectors/abcWallet/api/TalkenApiSingleton.d.ts +18 -0
- package/dist/wallets/walletConnectors/abcWallet/api/TalkenApiSingleton.js +14 -0
- package/dist/wallets/walletConnectors/abcWallet/api/TransactionApi.d.ts +2 -2
- package/dist/wallets/walletConnectors/abcWallet/api/TransactionApi.js +7 -7
- package/dist/wallets/walletConnectors/abcWallet/api/TronApi.d.ts +102 -0
- package/dist/wallets/walletConnectors/abcWallet/api/TronApi.js +12 -0
- package/dist/wallets/walletConnectors/abcWallet/api/WalletApi.d.ts +4 -2
- package/dist/wallets/walletConnectors/abcWallet/api/WalletApi.js +7 -7
- package/dist/wallets/walletConnectors/abcWallet/api/WalletscanApi.d.ts +60 -0
- package/dist/wallets/walletConnectors/abcWallet/api/WalletscanApi.js +12 -0
- package/dist/wallets/walletConnectors/abcWallet/api/index.d.ts +24 -0
- package/dist/wallets/walletConnectors/abcWallet/api/index.js +35 -17
- package/dist/wallets/walletConnectors/abcWallet/constants.d.ts +39 -1
- package/dist/wallets/walletConnectors/abcWallet/constants.js +5 -1
- package/dist/wallets/walletConnectors/abcWallet/googleAuth.d.ts +6 -0
- package/dist/wallets/walletConnectors/abcWallet/googleAuth.js +37 -1
- package/dist/wallets/walletConnectors/abcWallet/index.d.ts +5 -3
- package/dist/wallets/walletConnectors/abcWallet/index.js +44 -31
- package/dist/wallets/walletConnectors/abcWallet/kakaoAuth.d.ts +27 -0
- package/dist/wallets/walletConnectors/abcWallet/kakaoAuth.js +290 -0
- package/dist/wallets/walletConnectors/abcWallet/networkConfig.d.ts +39 -3
- package/dist/wallets/walletConnectors/abcWallet/networkConfig.js +11 -3
- package/dist/wallets/walletConnectors/abcWallet/secure.js +2 -2
- package/dist/wallets/walletConnectors/abcWallet/sessionUtils.js +1 -1
- package/dist/wallets/walletConnectors/abcWallet/types.d.ts +369 -7
- package/dist/wallets/walletConnectors/abcWallet/types.js +5 -3
- package/dist/wallets/walletConnectors/abcWallet/utils.js +3 -3
- package/dist/wallets/walletConnectors/abcWallet/walletGeneration.d.ts +10 -19
- package/dist/wallets/walletConnectors/abcWallet/walletGeneration.js +2 -2
- package/dist/wallets/walletConnectors/berasigWallet/berasigWallet.js +2 -2
- package/dist/wallets/walletConnectors/bifrostWallet/bifrostWallet.js +2 -2
- package/dist/wallets/walletConnectors/binanceWallet/binanceWallet.js +2 -2
- package/dist/wallets/walletConnectors/bitgetWallet/bitgetWallet.js +2 -2
- package/dist/wallets/walletConnectors/bybitWallet/bybitWallet.js +2 -2
- package/dist/wallets/walletConnectors/chunk-25V3FW3O.js +282 -0
- package/dist/wallets/walletConnectors/chunk-27346T3J.js +134 -0
- package/dist/wallets/walletConnectors/chunk-5CNLMOB2.js +75 -0
- package/dist/wallets/walletConnectors/chunk-5K45TCAM.js +333 -0
- package/dist/wallets/walletConnectors/chunk-5VDSMZC4.js +286 -0
- package/dist/wallets/walletConnectors/chunk-5W7RBMPH.js +351 -0
- package/dist/wallets/walletConnectors/chunk-5XORKEWE.js +326 -0
- package/dist/wallets/walletConnectors/chunk-63WBO52A.js +77 -0
- package/dist/wallets/walletConnectors/chunk-7IRF225N.js +75 -0
- package/dist/wallets/walletConnectors/chunk-7QHCSJDN.js +726 -0
- package/dist/wallets/walletConnectors/chunk-A27H6PEU.js +739 -0
- package/dist/wallets/walletConnectors/chunk-A4WR3CFN.js +130 -0
- package/dist/wallets/walletConnectors/chunk-A6FUNQWF.js +572 -0
- package/dist/wallets/walletConnectors/chunk-AF4OCS7N.js +46 -0
- package/dist/wallets/walletConnectors/chunk-AFWBXEEC.js +66 -0
- package/dist/wallets/walletConnectors/chunk-AUGP2LJR.js +182 -0
- package/dist/wallets/walletConnectors/chunk-AWLDVQXC.js +317 -0
- package/dist/wallets/walletConnectors/chunk-BLEKTKBN.js +479 -0
- package/dist/wallets/walletConnectors/chunk-BVL6G5HI.js +1757 -0
- package/dist/wallets/walletConnectors/chunk-CMTGEHDI.js +485 -0
- package/dist/wallets/walletConnectors/chunk-D5EFTEOM.js +56 -0
- package/dist/wallets/walletConnectors/chunk-DM5NLSWD.js +346 -0
- package/dist/wallets/walletConnectors/chunk-EBGI4D2T.js +69 -0
- package/dist/wallets/walletConnectors/chunk-EEH2HMFG.js +47 -0
- package/dist/wallets/walletConnectors/chunk-F5JWDBKK.js +47 -0
- package/dist/wallets/walletConnectors/chunk-FN67MIIH.js +75 -0
- package/dist/wallets/walletConnectors/chunk-FWYVBX5F.js +75 -0
- package/dist/wallets/walletConnectors/chunk-GH6ZDY4K.js +58 -0
- package/dist/wallets/walletConnectors/chunk-GIJZMIBD.js +63 -0
- package/dist/wallets/walletConnectors/chunk-GO6OLTNF.js +479 -0
- package/dist/wallets/walletConnectors/chunk-HKXBK3NY.js +75 -0
- package/dist/wallets/walletConnectors/chunk-HMD2WWFQ.js +75 -0
- package/dist/wallets/walletConnectors/chunk-HO5Z2CTL.js +280 -0
- package/dist/wallets/walletConnectors/chunk-I3GFVK5O.js +151 -0
- package/dist/wallets/walletConnectors/chunk-IUHZ5ZCE.js +121 -0
- package/dist/wallets/walletConnectors/chunk-JODNZWWG.js +330 -0
- package/dist/wallets/walletConnectors/chunk-JTST3KMW.js +75 -0
- package/dist/wallets/walletConnectors/chunk-KH2L3ONV.js +1599 -0
- package/dist/wallets/walletConnectors/chunk-LHV22375.js +182 -0
- package/dist/wallets/walletConnectors/chunk-LZZE462U.js +315 -0
- package/dist/wallets/walletConnectors/chunk-MGCRUAHX.js +276 -0
- package/dist/wallets/walletConnectors/chunk-MURSKRMJ.js +63 -0
- package/dist/wallets/walletConnectors/chunk-NG7PSAPX.js +115 -0
- package/dist/wallets/walletConnectors/chunk-NHP6D6AH.js +204 -0
- package/dist/wallets/walletConnectors/chunk-O4AU63LK.js +181 -0
- package/dist/wallets/walletConnectors/chunk-OBS74J5N.js +221 -0
- package/dist/wallets/walletConnectors/chunk-ON4U54WO.js +115 -0
- package/dist/wallets/walletConnectors/chunk-PPYBE5TV.js +276 -0
- package/dist/wallets/walletConnectors/chunk-PWWSAM4G.js +309 -0
- package/dist/wallets/walletConnectors/chunk-QB5GDLRU.js +330 -0
- package/dist/wallets/walletConnectors/chunk-QMLG7MAP.js +107 -0
- package/dist/wallets/walletConnectors/chunk-RGIB7FFH.js +47 -0
- package/dist/wallets/walletConnectors/chunk-SHJBMDP4.js +278 -0
- package/dist/wallets/walletConnectors/chunk-SOBJYYIX.js +484 -0
- package/dist/wallets/walletConnectors/chunk-T66U3ADD.js +58 -0
- package/dist/wallets/walletConnectors/chunk-THCKLFSJ.js +75 -0
- package/dist/wallets/walletConnectors/chunk-TS466TDR.js +286 -0
- package/dist/wallets/walletConnectors/chunk-UJGFYQEV.js +459 -0
- package/dist/wallets/walletConnectors/chunk-UXNEBBUV.js +224 -0
- package/dist/wallets/walletConnectors/chunk-VRCNFVPM.js +276 -0
- package/dist/wallets/walletConnectors/chunk-WODNUC65.js +333 -0
- package/dist/wallets/walletConnectors/chunk-X6A2FSHK.js +484 -0
- package/dist/wallets/walletConnectors/chunk-XVRNEES5.js +1541 -0
- package/dist/wallets/walletConnectors/chunk-XWVM2Y5A.js +306 -0
- package/dist/wallets/walletConnectors/chunk-XXG7ABSJ.js +328 -0
- package/dist/wallets/walletConnectors/chunk-YJH4BHSB.js +254 -0
- package/dist/wallets/walletConnectors/chunk-YRDNIP2H.js +90 -0
- package/dist/wallets/walletConnectors/chunk-YTPAWPCA.js +156 -0
- package/dist/wallets/walletConnectors/chunk-ZCSHD7UG.js +562 -0
- package/dist/wallets/walletConnectors/chunk-ZZCZ3RJU.js +272 -0
- package/dist/wallets/walletConnectors/clvWallet/clvWallet.js +2 -2
- package/dist/wallets/walletConnectors/coin98Wallet/coin98Wallet.js +2 -2
- package/dist/wallets/walletConnectors/coreWallet/coreWallet.js +2 -2
- package/dist/wallets/walletConnectors/foxWallet/foxWallet.js +2 -2
- package/dist/wallets/walletConnectors/frontierWallet/frontierWallet.js +2 -2
- package/dist/wallets/walletConnectors/gateWallet/gateWallet.js +2 -2
- package/dist/wallets/walletConnectors/index.js +62 -61
- package/dist/wallets/walletConnectors/iopayWallet/iopayWallet.js +2 -2
- package/dist/wallets/walletConnectors/kaiaWallet/kaiaWallet.js +2 -2
- package/dist/wallets/walletConnectors/kaikasWallet/kaikasWallet.js +2 -2
- package/dist/wallets/walletConnectors/klipWallet/klipWallet.d.ts +3 -0
- package/dist/wallets/walletConnectors/klipWallet/klipWallet.js +8 -0
- package/dist/wallets/walletConnectors/klipWallet-PPTYYB5G.js +7 -0
- package/dist/wallets/walletConnectors/metaMaskWallet/metaMaskWallet.js +2 -2
- package/dist/wallets/walletConnectors/okxWallet/okxWallet.js +2 -2
- package/dist/wallets/walletConnectors/rainbowWallet/rainbowWallet.js +2 -2
- package/dist/wallets/walletConnectors/roninWallet/roninWallet.js +2 -2
- package/dist/wallets/walletConnectors/safepalWallet/safepalWallet.js +2 -2
- package/dist/wallets/walletConnectors/subWallet/subWallet.js +2 -2
- package/dist/wallets/walletConnectors/tokenPocketWallet/tokenPocketWallet.js +2 -2
- package/dist/wallets/walletConnectors/trustWallet/trustWallet.js +2 -2
- package/dist/wallets/walletConnectors/zealWallet/zealWallet.js +2 -2
- package/dist/wallets/walletConnectors/zerionWallet/zerionWallet.js +2 -2
- package/package.json +2 -1
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
createTalkenApiClient
|
|
4
|
+
} from "./chunk-A27H6PEU.js";
|
|
5
|
+
import {
|
|
6
|
+
abcConnector
|
|
7
|
+
} from "./chunk-5VDSMZC4.js";
|
|
8
|
+
import {
|
|
9
|
+
ABC_WALLET_METADATA
|
|
10
|
+
} from "./chunk-YJH4BHSB.js";
|
|
11
|
+
|
|
12
|
+
// src/wallets/walletConnectors/abcWallet/abcWallet.ts
|
|
13
|
+
import { setTalkenApiClient } from "@talken/talkenkit";
|
|
14
|
+
var abcWallet = (specificOptions) => ({ projectId }) => {
|
|
15
|
+
if (specificOptions?.talkenApiUrl) {
|
|
16
|
+
const talkenApi = createTalkenApiClient({
|
|
17
|
+
baseUrl: specificOptions.talkenApiUrl,
|
|
18
|
+
debug: specificOptions?.environment === "development"
|
|
19
|
+
});
|
|
20
|
+
setTalkenApiClient(talkenApi);
|
|
21
|
+
}
|
|
22
|
+
const waasUrl = specificOptions?.waasUrl || process.env.NEXT_PUBLIC_ABC_WAAS_URL || process.env.VITE_ABC_WAAS_URL;
|
|
23
|
+
if (!waasUrl) {
|
|
24
|
+
throw new Error(
|
|
25
|
+
'ABC WaaS URL is required. Please provide it via:\n1. abcWallet({ waasUrl: "..." }) options, or\n2. NEXT_PUBLIC_ABC_WAAS_URL environment variable, or\n3. VITE_ABC_WAAS_URL environment variable'
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
const config = {
|
|
29
|
+
waasUrl,
|
|
30
|
+
apiKey: specificOptions?.apiKey,
|
|
31
|
+
plain: specificOptions?.plain || "",
|
|
32
|
+
// Deprecated - not used (secure.ts uses random generation)
|
|
33
|
+
environment: specificOptions?.environment || "development",
|
|
34
|
+
defaultChainId: specificOptions?.defaultChainId,
|
|
35
|
+
defaultSolanaNetwork: specificOptions?.defaultSolanaNetwork,
|
|
36
|
+
defaultBitcoinNetwork: specificOptions?.defaultBitcoinNetwork,
|
|
37
|
+
projectId
|
|
38
|
+
};
|
|
39
|
+
return {
|
|
40
|
+
id: ABC_WALLET_METADATA.id,
|
|
41
|
+
name: ABC_WALLET_METADATA.name,
|
|
42
|
+
rdns: ABC_WALLET_METADATA.rdns,
|
|
43
|
+
iconUrl: async () => (await import("./abcWallet-AYWSIGAG.js")).default,
|
|
44
|
+
iconBackground: ABC_WALLET_METADATA.iconBackground,
|
|
45
|
+
// Embedded wallet - no installation required
|
|
46
|
+
installed: void 0,
|
|
47
|
+
// No download URLs for embedded wallet
|
|
48
|
+
downloadUrls: void 0,
|
|
49
|
+
// Create connector - wrapper function required by Wallet type
|
|
50
|
+
createConnector: (_walletDetails) => abcConnector({ config }),
|
|
51
|
+
// Embedded wallet always available
|
|
52
|
+
hidden: () => false
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export {
|
|
57
|
+
abcWallet
|
|
58
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
TransactionApi
|
|
4
|
+
} from "./chunk-B56IHEUP.js";
|
|
5
|
+
import {
|
|
6
|
+
WalletApi
|
|
7
|
+
} from "./chunk-MPNSYA4E.js";
|
|
8
|
+
import {
|
|
9
|
+
AuthApi
|
|
10
|
+
} from "./chunk-QCIIXMAZ.js";
|
|
11
|
+
import {
|
|
12
|
+
BitcoinApi
|
|
13
|
+
} from "./chunk-KB7OGAUC.js";
|
|
14
|
+
import {
|
|
15
|
+
SigningApi
|
|
16
|
+
} from "./chunk-2HAU36T2.js";
|
|
17
|
+
import {
|
|
18
|
+
SolanaApi
|
|
19
|
+
} from "./chunk-WODNUC65.js";
|
|
20
|
+
|
|
21
|
+
// src/wallets/walletConnectors/abcWallet/api/index.ts
|
|
22
|
+
var AbcWaasApiClient = class {
|
|
23
|
+
constructor(config) {
|
|
24
|
+
this.auth = new AuthApi(config);
|
|
25
|
+
this.wallet = new WalletApi(config);
|
|
26
|
+
this.transaction = new TransactionApi(config);
|
|
27
|
+
this.signing = new SigningApi(config);
|
|
28
|
+
this.solana = new SolanaApi(config);
|
|
29
|
+
this.bitcoin = new BitcoinApi(config);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Check if user is authenticated
|
|
33
|
+
*/
|
|
34
|
+
isAuthenticated() {
|
|
35
|
+
return this.auth.isAuthenticated();
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Check if access token is expired
|
|
39
|
+
*/
|
|
40
|
+
isTokenExpired() {
|
|
41
|
+
return this.auth.isTokenExpired();
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Get current access token
|
|
45
|
+
*/
|
|
46
|
+
getAccessToken() {
|
|
47
|
+
return this.auth.getAccessToken();
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Logout (clear tokens)
|
|
51
|
+
*/
|
|
52
|
+
async logout() {
|
|
53
|
+
await this.auth.logout();
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
function createAbcWaasApiClient(config) {
|
|
57
|
+
return new AbcWaasApiClient(config);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export {
|
|
61
|
+
AbcWaasApiClient,
|
|
62
|
+
createAbcWaasApiClient
|
|
63
|
+
};
|
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
AbcError,
|
|
4
|
+
AbcStorageKey
|
|
5
|
+
} from "./chunk-D5EFTEOM.js";
|
|
6
|
+
import {
|
|
7
|
+
PIN_CONFIG,
|
|
8
|
+
STORAGE_PREFIX,
|
|
9
|
+
TOKEN_EXPIRY
|
|
10
|
+
} from "./chunk-YJH4BHSB.js";
|
|
11
|
+
|
|
12
|
+
// src/wallets/walletConnectors/abcWallet/utils.ts
|
|
13
|
+
import CryptoJS from "crypto-js";
|
|
14
|
+
async function hashPin(pin) {
|
|
15
|
+
if (typeof window === "undefined" || !window.crypto?.subtle) {
|
|
16
|
+
return btoa(pin);
|
|
17
|
+
}
|
|
18
|
+
const encoder = new TextEncoder();
|
|
19
|
+
const data = encoder.encode(pin);
|
|
20
|
+
const hashBuffer = await window.crypto.subtle.digest("SHA-256", data);
|
|
21
|
+
const hashArray = Array.from(new Uint8Array(hashBuffer));
|
|
22
|
+
const hashHex = hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
23
|
+
return hashHex;
|
|
24
|
+
}
|
|
25
|
+
function validatePin(pin) {
|
|
26
|
+
if (!pin || typeof pin !== "string") {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
const pinLength = pin.length;
|
|
30
|
+
if (pinLength < PIN_CONFIG.MIN_LENGTH || pinLength > PIN_CONFIG.MAX_LENGTH) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
return /^\d+$/.test(pin);
|
|
34
|
+
}
|
|
35
|
+
function validateEmail(email) {
|
|
36
|
+
if (!email || typeof email !== "string") {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
40
|
+
return emailRegex.test(email);
|
|
41
|
+
}
|
|
42
|
+
function getStorageKey(key) {
|
|
43
|
+
return `${STORAGE_PREFIX}${key}`;
|
|
44
|
+
}
|
|
45
|
+
function saveToStorage(key, value) {
|
|
46
|
+
if (typeof window === "undefined")
|
|
47
|
+
return;
|
|
48
|
+
try {
|
|
49
|
+
const storageKey = getStorageKey(key);
|
|
50
|
+
const serialized = JSON.stringify(value);
|
|
51
|
+
localStorage.setItem(storageKey, serialized);
|
|
52
|
+
} catch (error) {
|
|
53
|
+
console.error("Failed to save to storage:", error);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function loadFromStorage(key) {
|
|
57
|
+
if (typeof window === "undefined")
|
|
58
|
+
return null;
|
|
59
|
+
try {
|
|
60
|
+
const storageKey = getStorageKey(key);
|
|
61
|
+
const serialized = localStorage.getItem(storageKey);
|
|
62
|
+
if (!serialized)
|
|
63
|
+
return null;
|
|
64
|
+
try {
|
|
65
|
+
return JSON.parse(serialized);
|
|
66
|
+
} catch {
|
|
67
|
+
return serialized;
|
|
68
|
+
}
|
|
69
|
+
} catch (error) {
|
|
70
|
+
console.error("Failed to load from storage:", error);
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function removeFromStorage(key) {
|
|
75
|
+
if (typeof window === "undefined")
|
|
76
|
+
return;
|
|
77
|
+
try {
|
|
78
|
+
const storageKey = getStorageKey(key);
|
|
79
|
+
localStorage.removeItem(storageKey);
|
|
80
|
+
} catch (error) {
|
|
81
|
+
console.error("Failed to remove from storage:", error);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function clearStorage() {
|
|
85
|
+
if (typeof window === "undefined")
|
|
86
|
+
return;
|
|
87
|
+
for (const key of Object.values(AbcStorageKey)) {
|
|
88
|
+
removeFromStorage(key);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function isTokenExpired(expiresAt) {
|
|
92
|
+
if (!expiresAt)
|
|
93
|
+
return true;
|
|
94
|
+
return Date.now() >= expiresAt - TOKEN_EXPIRY.REFRESH_BUFFER;
|
|
95
|
+
}
|
|
96
|
+
function calculateExpiryTimestamp(expiresIn) {
|
|
97
|
+
return Date.now() + expiresIn * 1e3;
|
|
98
|
+
}
|
|
99
|
+
function saveAuthState(state) {
|
|
100
|
+
saveToStorage("auth_state" /* AUTH_STATE */, state);
|
|
101
|
+
if (state.user) {
|
|
102
|
+
saveToStorage("user" /* USER */, state.user);
|
|
103
|
+
}
|
|
104
|
+
if (state.wallet) {
|
|
105
|
+
saveToStorage("wallet" /* WALLET */, state.wallet);
|
|
106
|
+
}
|
|
107
|
+
if (state.solanaWallet) {
|
|
108
|
+
saveToStorage("solana_wallet" /* SOLANA_WALLET */, state.solanaWallet);
|
|
109
|
+
}
|
|
110
|
+
if (state.bitcoinWallet) {
|
|
111
|
+
saveToStorage("bitcoin_wallet" /* BITCOIN_WALLET */, state.bitcoinWallet);
|
|
112
|
+
}
|
|
113
|
+
if (state.accessToken) {
|
|
114
|
+
saveToStorage("access_token" /* ACCESS_TOKEN */, state.accessToken);
|
|
115
|
+
}
|
|
116
|
+
if (state.refreshToken) {
|
|
117
|
+
saveToStorage("refresh_token" /* REFRESH_TOKEN */, state.refreshToken);
|
|
118
|
+
}
|
|
119
|
+
if (state.expiresAt) {
|
|
120
|
+
saveToStorage("expires_at" /* EXPIRES_AT */, state.expiresAt);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
function loadAuthState() {
|
|
124
|
+
const state = loadFromStorage("auth_state" /* AUTH_STATE */);
|
|
125
|
+
if (state) {
|
|
126
|
+
if (state.accessToken && isTokenExpired(state.expiresAt)) {
|
|
127
|
+
clearStorage();
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
return state;
|
|
131
|
+
}
|
|
132
|
+
const user = loadFromStorage("user" /* USER */);
|
|
133
|
+
const wallet = loadFromStorage("wallet" /* WALLET */);
|
|
134
|
+
const solanaWallet = loadFromStorage("solana_wallet" /* SOLANA_WALLET */);
|
|
135
|
+
const accessToken = loadFromStorage("access_token" /* ACCESS_TOKEN */);
|
|
136
|
+
const refreshToken = loadFromStorage("refresh_token" /* REFRESH_TOKEN */);
|
|
137
|
+
const expiresAt = loadFromStorage("expires_at" /* EXPIRES_AT */);
|
|
138
|
+
if (!user || !accessToken) {
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
const bitcoinWallet = loadFromStorage("bitcoin_wallet" /* BITCOIN_WALLET */);
|
|
142
|
+
const tronWallet = loadFromStorage("tron_wallet" /* TRON_WALLET */);
|
|
143
|
+
return {
|
|
144
|
+
isAuthenticated: true,
|
|
145
|
+
user,
|
|
146
|
+
wallet,
|
|
147
|
+
solanaWallet,
|
|
148
|
+
bitcoinWallet,
|
|
149
|
+
tronWallet,
|
|
150
|
+
accessToken,
|
|
151
|
+
refreshToken,
|
|
152
|
+
expiresAt
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
function clearAuthState() {
|
|
156
|
+
clearStorage();
|
|
157
|
+
}
|
|
158
|
+
function getChainType(chainId) {
|
|
159
|
+
if (chainId === 900)
|
|
160
|
+
return "solana";
|
|
161
|
+
if (chainId === 800)
|
|
162
|
+
return "bitcoin";
|
|
163
|
+
return "evm";
|
|
164
|
+
}
|
|
165
|
+
function formatAddress(address, startLength = 6, endLength = 4) {
|
|
166
|
+
if (!address || address.length <= startLength + endLength) {
|
|
167
|
+
return address;
|
|
168
|
+
}
|
|
169
|
+
const start = address.substring(0, startLength);
|
|
170
|
+
const end = address.substring(address.length - endLength);
|
|
171
|
+
return `${start}...${end}`;
|
|
172
|
+
}
|
|
173
|
+
function createAbcError(code, message, details, statusCode) {
|
|
174
|
+
return new AbcError(code, message, details, statusCode);
|
|
175
|
+
}
|
|
176
|
+
function sleep(ms) {
|
|
177
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
178
|
+
}
|
|
179
|
+
async function retry(fn, maxRetries = 3, delay = 1e3, backoffMultiplier = 2) {
|
|
180
|
+
let lastError = null;
|
|
181
|
+
for (let attempt = 0; attempt < maxRetries; attempt++) {
|
|
182
|
+
try {
|
|
183
|
+
return await fn();
|
|
184
|
+
} catch (error) {
|
|
185
|
+
lastError = error;
|
|
186
|
+
if (attempt < maxRetries - 1) {
|
|
187
|
+
const waitTime = delay * backoffMultiplier ** attempt;
|
|
188
|
+
await sleep(waitTime);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
throw lastError || new Error("Retry failed");
|
|
193
|
+
}
|
|
194
|
+
function parseApiError(error) {
|
|
195
|
+
if (error instanceof AbcError) {
|
|
196
|
+
return error;
|
|
197
|
+
}
|
|
198
|
+
if (!error.response) {
|
|
199
|
+
return createAbcError(
|
|
200
|
+
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
201
|
+
"Network error occurred",
|
|
202
|
+
error
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
const response = error.response;
|
|
206
|
+
const data = response.data;
|
|
207
|
+
const statusCode = response.status;
|
|
208
|
+
if (statusCode === 401) {
|
|
209
|
+
return createAbcError(
|
|
210
|
+
"TOKEN_EXPIRED" /* TOKEN_EXPIRED */,
|
|
211
|
+
"Authentication token expired",
|
|
212
|
+
data,
|
|
213
|
+
401
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
if (statusCode === 409) {
|
|
217
|
+
return createAbcError(
|
|
218
|
+
"WALLET_NOT_FOUND" /* WALLET_NOT_FOUND */,
|
|
219
|
+
// Will trigger recovery
|
|
220
|
+
data?.error || "Resource already exists",
|
|
221
|
+
data,
|
|
222
|
+
409
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
if (typeof data === "object" && "iserr" in data) {
|
|
226
|
+
const bitcoinData = data;
|
|
227
|
+
if (bitcoinData.iserr === true) {
|
|
228
|
+
return createAbcError(
|
|
229
|
+
"SIGNATURE_FAILED" /* SIGNATURE_FAILED */,
|
|
230
|
+
bitcoinData.errmsg || "Bitcoin signature failed",
|
|
231
|
+
data,
|
|
232
|
+
statusCode
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
if (!bitcoinData.signstr) {
|
|
236
|
+
return createAbcError(
|
|
237
|
+
"SIGNATURE_FAILED" /* SIGNATURE_FAILED */,
|
|
238
|
+
"Bitcoin signature missing in response",
|
|
239
|
+
data,
|
|
240
|
+
statusCode
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
return createAbcError(
|
|
244
|
+
"UNKNOWN_ERROR" /* UNKNOWN_ERROR */,
|
|
245
|
+
"Unexpected success response in error parser",
|
|
246
|
+
data,
|
|
247
|
+
statusCode
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
if (data?.error) {
|
|
251
|
+
return createAbcError(
|
|
252
|
+
"UNKNOWN_ERROR" /* UNKNOWN_ERROR */,
|
|
253
|
+
data.error.message || data.error || "API error occurred",
|
|
254
|
+
data,
|
|
255
|
+
statusCode
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
if (data?.message) {
|
|
259
|
+
return createAbcError(
|
|
260
|
+
"UNKNOWN_ERROR" /* UNKNOWN_ERROR */,
|
|
261
|
+
data.message.text || "API error occurred",
|
|
262
|
+
data,
|
|
263
|
+
statusCode
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
return createAbcError(
|
|
267
|
+
"UNKNOWN_ERROR" /* UNKNOWN_ERROR */,
|
|
268
|
+
"An unknown error occurred",
|
|
269
|
+
error,
|
|
270
|
+
statusCode
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
function isBrowser() {
|
|
274
|
+
return typeof window !== "undefined";
|
|
275
|
+
}
|
|
276
|
+
function isWeb3Available() {
|
|
277
|
+
return isBrowser() && typeof window.ethereum !== "undefined";
|
|
278
|
+
}
|
|
279
|
+
function generateId() {
|
|
280
|
+
return `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
|
|
281
|
+
}
|
|
282
|
+
function deepClone(obj) {
|
|
283
|
+
return JSON.parse(JSON.stringify(obj));
|
|
284
|
+
}
|
|
285
|
+
function isEmpty(obj) {
|
|
286
|
+
if (obj == null)
|
|
287
|
+
return true;
|
|
288
|
+
if (Array.isArray(obj))
|
|
289
|
+
return obj.length === 0;
|
|
290
|
+
if (typeof obj === "object")
|
|
291
|
+
return Object.keys(obj).length === 0;
|
|
292
|
+
return false;
|
|
293
|
+
}
|
|
294
|
+
function debounce(func, wait) {
|
|
295
|
+
let timeout = null;
|
|
296
|
+
return function(...args) {
|
|
297
|
+
if (timeout) {
|
|
298
|
+
clearTimeout(timeout);
|
|
299
|
+
}
|
|
300
|
+
timeout = setTimeout(() => {
|
|
301
|
+
func.apply(this, args);
|
|
302
|
+
}, wait);
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
function throttle(func, limit) {
|
|
306
|
+
let inThrottle = false;
|
|
307
|
+
return function(...args) {
|
|
308
|
+
if (!inThrottle) {
|
|
309
|
+
func.apply(this, args);
|
|
310
|
+
inThrottle = true;
|
|
311
|
+
setTimeout(() => {
|
|
312
|
+
inThrottle = false;
|
|
313
|
+
}, limit);
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
function hexToNumber(hex) {
|
|
318
|
+
return Number.parseInt(hex, 16);
|
|
319
|
+
}
|
|
320
|
+
function numberToHex(num) {
|
|
321
|
+
return `0x${num.toString(16)}`;
|
|
322
|
+
}
|
|
323
|
+
function isValidEthereumAddress(address) {
|
|
324
|
+
return /^0x[a-fA-F0-9]{40}$/.test(address);
|
|
325
|
+
}
|
|
326
|
+
function isValidSolanaAddress(address) {
|
|
327
|
+
return /^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(address);
|
|
328
|
+
}
|
|
329
|
+
function getExplorerUrl(chainId, txHash) {
|
|
330
|
+
const explorers = {
|
|
331
|
+
1: "https://etherscan.io/tx/",
|
|
332
|
+
5: "https://goerli.etherscan.io/tx/",
|
|
333
|
+
137: "https://polygonscan.com/tx/",
|
|
334
|
+
56: "https://bscscan.com/tx/",
|
|
335
|
+
900: "https://explorer.solana.com/tx/"
|
|
336
|
+
// Solana
|
|
337
|
+
};
|
|
338
|
+
const baseUrl = explorers[chainId];
|
|
339
|
+
return baseUrl ? `${baseUrl}${txHash}` : null;
|
|
340
|
+
}
|
|
341
|
+
function generateSalt() {
|
|
342
|
+
const array = new Uint8Array(16);
|
|
343
|
+
crypto.getRandomValues(array);
|
|
344
|
+
return Array.from(array, (byte) => byte.toString(16).padStart(2, "0")).join(
|
|
345
|
+
""
|
|
346
|
+
);
|
|
347
|
+
}
|
|
348
|
+
function deriveKeyFromPin(pin, salt) {
|
|
349
|
+
return CryptoJS.PBKDF2(pin, salt, {
|
|
350
|
+
keySize: 256 / 32,
|
|
351
|
+
iterations: 1e5
|
|
352
|
+
}).toString();
|
|
353
|
+
}
|
|
354
|
+
function encryptWithPin(data, pin, salt) {
|
|
355
|
+
const key = deriveKeyFromPin(pin, salt);
|
|
356
|
+
const encrypted = CryptoJS.AES.encrypt(data, key).toString();
|
|
357
|
+
return encrypted;
|
|
358
|
+
}
|
|
359
|
+
function decryptWithPin(encrypted, pin, salt) {
|
|
360
|
+
try {
|
|
361
|
+
const key = deriveKeyFromPin(pin, salt);
|
|
362
|
+
const decrypted = CryptoJS.AES.decrypt(encrypted, key);
|
|
363
|
+
const decryptedText = decrypted.toString(CryptoJS.enc.Utf8);
|
|
364
|
+
if (!decryptedText) {
|
|
365
|
+
return null;
|
|
366
|
+
}
|
|
367
|
+
return decryptedText;
|
|
368
|
+
} catch (error) {
|
|
369
|
+
console.error("Decryption failed:", error);
|
|
370
|
+
return null;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
function hasEncryptedTokens() {
|
|
374
|
+
if (typeof window === "undefined")
|
|
375
|
+
return false;
|
|
376
|
+
const encrypted = loadFromStorage("encrypted_tokens" /* ENCRYPTED_TOKENS */);
|
|
377
|
+
const salt = loadFromStorage("token_salt" /* TOKEN_SALT */);
|
|
378
|
+
return !!encrypted && !!salt;
|
|
379
|
+
}
|
|
380
|
+
function saveEncryptedTokens(accessToken, refreshToken, expiresIn, hashedPin) {
|
|
381
|
+
if (typeof window === "undefined")
|
|
382
|
+
return;
|
|
383
|
+
try {
|
|
384
|
+
let salt = loadFromStorage("token_salt" /* TOKEN_SALT */);
|
|
385
|
+
if (!salt) {
|
|
386
|
+
salt = generateSalt();
|
|
387
|
+
saveToStorage("token_salt" /* TOKEN_SALT */, salt);
|
|
388
|
+
}
|
|
389
|
+
const expiresAt = Date.now() + expiresIn * 1e3;
|
|
390
|
+
const tokenData = {
|
|
391
|
+
accessToken,
|
|
392
|
+
refreshToken,
|
|
393
|
+
expiresAt
|
|
394
|
+
};
|
|
395
|
+
const encrypted = encryptWithPin(
|
|
396
|
+
JSON.stringify(tokenData),
|
|
397
|
+
hashedPin,
|
|
398
|
+
salt
|
|
399
|
+
);
|
|
400
|
+
saveToStorage("encrypted_tokens" /* ENCRYPTED_TOKENS */, encrypted);
|
|
401
|
+
removeFromStorage("access_token" /* ACCESS_TOKEN */);
|
|
402
|
+
removeFromStorage("refresh_token" /* REFRESH_TOKEN */);
|
|
403
|
+
removeFromStorage("expires_at" /* EXPIRES_AT */);
|
|
404
|
+
} catch (error) {
|
|
405
|
+
console.error("Failed to save encrypted tokens:", error);
|
|
406
|
+
throw new AbcError(
|
|
407
|
+
"ENCRYPTION_FAILED" /* ENCRYPTION_FAILED */,
|
|
408
|
+
"Failed to encrypt tokens"
|
|
409
|
+
);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
function loadEncryptedTokens(hashedPin) {
|
|
413
|
+
if (typeof window === "undefined")
|
|
414
|
+
return null;
|
|
415
|
+
try {
|
|
416
|
+
const encrypted = loadFromStorage("encrypted_tokens" /* ENCRYPTED_TOKENS */);
|
|
417
|
+
const salt = loadFromStorage("token_salt" /* TOKEN_SALT */);
|
|
418
|
+
if (!encrypted || !salt) {
|
|
419
|
+
return null;
|
|
420
|
+
}
|
|
421
|
+
const decrypted = decryptWithPin(encrypted, hashedPin, salt);
|
|
422
|
+
if (!decrypted) {
|
|
423
|
+
throw new AbcError("INVALID_PIN" /* INVALID_PIN */, "Incorrect PIN");
|
|
424
|
+
}
|
|
425
|
+
const tokenData = JSON.parse(decrypted);
|
|
426
|
+
return tokenData;
|
|
427
|
+
} catch (error) {
|
|
428
|
+
console.error("Failed to load encrypted tokens:", error);
|
|
429
|
+
if (error instanceof AbcError) {
|
|
430
|
+
throw error;
|
|
431
|
+
}
|
|
432
|
+
throw new AbcError(
|
|
433
|
+
"DECRYPTION_FAILED" /* DECRYPTION_FAILED */,
|
|
434
|
+
"Failed to decrypt tokens"
|
|
435
|
+
);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
function clearEncryptedTokens() {
|
|
439
|
+
removeFromStorage("encrypted_tokens" /* ENCRYPTED_TOKENS */);
|
|
440
|
+
removeFromStorage("token_salt" /* TOKEN_SALT */);
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
export {
|
|
444
|
+
hashPin,
|
|
445
|
+
validatePin,
|
|
446
|
+
validateEmail,
|
|
447
|
+
getStorageKey,
|
|
448
|
+
saveToStorage,
|
|
449
|
+
loadFromStorage,
|
|
450
|
+
removeFromStorage,
|
|
451
|
+
clearStorage,
|
|
452
|
+
isTokenExpired,
|
|
453
|
+
calculateExpiryTimestamp,
|
|
454
|
+
saveAuthState,
|
|
455
|
+
loadAuthState,
|
|
456
|
+
clearAuthState,
|
|
457
|
+
getChainType,
|
|
458
|
+
formatAddress,
|
|
459
|
+
createAbcError,
|
|
460
|
+
sleep,
|
|
461
|
+
retry,
|
|
462
|
+
parseApiError,
|
|
463
|
+
isBrowser,
|
|
464
|
+
isWeb3Available,
|
|
465
|
+
generateId,
|
|
466
|
+
deepClone,
|
|
467
|
+
isEmpty,
|
|
468
|
+
debounce,
|
|
469
|
+
throttle,
|
|
470
|
+
hexToNumber,
|
|
471
|
+
numberToHex,
|
|
472
|
+
isValidEthereumAddress,
|
|
473
|
+
isValidSolanaAddress,
|
|
474
|
+
getExplorerUrl,
|
|
475
|
+
hasEncryptedTokens,
|
|
476
|
+
saveEncryptedTokens,
|
|
477
|
+
loadEncryptedTokens,
|
|
478
|
+
clearEncryptedTokens
|
|
479
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
SigningApi
|
|
4
|
+
} from "./chunk-QB5GDLRU.js";
|
|
5
|
+
import {
|
|
6
|
+
TransactionApi
|
|
7
|
+
} from "./chunk-LHV22375.js";
|
|
8
|
+
import {
|
|
9
|
+
TronApi
|
|
10
|
+
} from "./chunk-DM5NLSWD.js";
|
|
11
|
+
import {
|
|
12
|
+
WalletApi
|
|
13
|
+
} from "./chunk-YTPAWPCA.js";
|
|
14
|
+
import {
|
|
15
|
+
WalletscanApi
|
|
16
|
+
} from "./chunk-UXNEBBUV.js";
|
|
17
|
+
import {
|
|
18
|
+
AuthApi
|
|
19
|
+
} from "./chunk-PWWSAM4G.js";
|
|
20
|
+
import {
|
|
21
|
+
GasApi
|
|
22
|
+
} from "./chunk-A4WR3CFN.js";
|
|
23
|
+
import {
|
|
24
|
+
BitcoinApi
|
|
25
|
+
} from "./chunk-X6A2FSHK.js";
|
|
26
|
+
import {
|
|
27
|
+
SolanaApi
|
|
28
|
+
} from "./chunk-5K45TCAM.js";
|
|
29
|
+
|
|
30
|
+
// src/wallets/walletConnectors/abcWallet/api/index.ts
|
|
31
|
+
var AbcWaasApiClient = class {
|
|
32
|
+
constructor(config) {
|
|
33
|
+
this.auth = new AuthApi(config);
|
|
34
|
+
this.wallet = new WalletApi(config);
|
|
35
|
+
this.transaction = new TransactionApi(config);
|
|
36
|
+
this.signing = new SigningApi(config);
|
|
37
|
+
this.solana = new SolanaApi(config);
|
|
38
|
+
this.bitcoin = new BitcoinApi(config);
|
|
39
|
+
this.tron = new TronApi(config);
|
|
40
|
+
this.walletscan = new WalletscanApi(config);
|
|
41
|
+
this.gas = new GasApi(config);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Check if user is authenticated
|
|
45
|
+
*/
|
|
46
|
+
isAuthenticated() {
|
|
47
|
+
return this.auth.isAuthenticated();
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Check if access token is expired
|
|
51
|
+
*/
|
|
52
|
+
isTokenExpired() {
|
|
53
|
+
return this.auth.isTokenExpired();
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Get current access token
|
|
57
|
+
*/
|
|
58
|
+
getAccessToken() {
|
|
59
|
+
return this.auth.getAccessToken();
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Logout (clear tokens)
|
|
63
|
+
*/
|
|
64
|
+
async logout() {
|
|
65
|
+
await this.auth.logout();
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
function createAbcWaasApiClient(config) {
|
|
69
|
+
return new AbcWaasApiClient(config);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export {
|
|
73
|
+
AbcWaasApiClient,
|
|
74
|
+
createAbcWaasApiClient
|
|
75
|
+
};
|