@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,330 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
BaseApiClient
|
|
4
|
+
} from "./chunk-XWVM2Y5A.js";
|
|
5
|
+
import {
|
|
6
|
+
getNetworkName
|
|
7
|
+
} from "./chunk-4PCVQBFZ.js";
|
|
8
|
+
import {
|
|
9
|
+
createAbcError,
|
|
10
|
+
loadFromStorage
|
|
11
|
+
} from "./chunk-BLEKTKBN.js";
|
|
12
|
+
import {
|
|
13
|
+
ABC_ENDPOINTS
|
|
14
|
+
} from "./chunk-OBS74J5N.js";
|
|
15
|
+
|
|
16
|
+
// src/wallets/walletConnectors/abcWallet/api/SigningApi.ts
|
|
17
|
+
import { getAddress } from "viem";
|
|
18
|
+
var SigningApi = class extends BaseApiClient {
|
|
19
|
+
/**
|
|
20
|
+
* Sign EVM transaction (EIP-1559)
|
|
21
|
+
*/
|
|
22
|
+
async signTransaction(params) {
|
|
23
|
+
this.loadTokens();
|
|
24
|
+
const wallet = loadFromStorage("wallet" /* WALLET */);
|
|
25
|
+
if (!wallet) {
|
|
26
|
+
throw createAbcError(
|
|
27
|
+
"WALLET_NOT_FOUND" /* WALLET_NOT_FOUND */,
|
|
28
|
+
"Wallet information not found in storage"
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
const encryptedDevicePassword = await this.secure.getEncryptPlain(
|
|
32
|
+
wallet.encryptDevicePassword
|
|
33
|
+
);
|
|
34
|
+
const encryptedPvencstr = await this.secure.getEncryptPlain(
|
|
35
|
+
wallet.pvencstr
|
|
36
|
+
);
|
|
37
|
+
const encryptedWid = await this.secure.getEncryptPlain(wallet.wid);
|
|
38
|
+
const secureChannelId = await this.secure.getSecureChannelId();
|
|
39
|
+
const network = getNetworkName(params.chainId);
|
|
40
|
+
const tx = params.transaction;
|
|
41
|
+
const _isContractDeployment = !params.transaction.to || params.transaction.to === "0x" || params.transaction.to === "0x0";
|
|
42
|
+
const bodyData = {
|
|
43
|
+
network,
|
|
44
|
+
encryptDevicePassword: encryptedDevicePassword,
|
|
45
|
+
pvencstr: encryptedPvencstr,
|
|
46
|
+
uid: wallet.uid,
|
|
47
|
+
wid: encryptedWid,
|
|
48
|
+
sid: getAddress(wallet.address),
|
|
49
|
+
to: tx.to === "0x" ? "0x" : getAddress(tx.to),
|
|
50
|
+
type: "EIP1559",
|
|
51
|
+
ourpubkey: "",
|
|
52
|
+
ucpubkey: ""
|
|
53
|
+
};
|
|
54
|
+
bodyData.from = getAddress(tx.from || wallet.address);
|
|
55
|
+
if (tx.value) {
|
|
56
|
+
let hexValue = tx.value.startsWith("0x") ? tx.value.slice(2) : tx.value;
|
|
57
|
+
if (hexValue.length % 2 !== 0) {
|
|
58
|
+
hexValue = `0${hexValue}`;
|
|
59
|
+
}
|
|
60
|
+
bodyData.value = `0x${hexValue}`;
|
|
61
|
+
}
|
|
62
|
+
if (tx.gasLimit || tx.gas) {
|
|
63
|
+
const gasLimitValue = tx.gasLimit || tx.gas;
|
|
64
|
+
if (gasLimitValue.toString().startsWith("0x")) {
|
|
65
|
+
bodyData.gasLimit = gasLimitValue.toString();
|
|
66
|
+
} else {
|
|
67
|
+
bodyData.gasLimit = `0x${BigInt(gasLimitValue).toString(16)}`;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (tx.maxFeePerGas) {
|
|
71
|
+
if (tx.maxFeePerGas.toString().startsWith("0x")) {
|
|
72
|
+
bodyData.maxFeePerGas = tx.maxFeePerGas.toString();
|
|
73
|
+
} else {
|
|
74
|
+
bodyData.maxFeePerGas = `0x${BigInt(tx.maxFeePerGas).toString(16)}`;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (tx.maxPriorityFeePerGas) {
|
|
78
|
+
if (tx.maxPriorityFeePerGas.toString().startsWith("0x")) {
|
|
79
|
+
bodyData.maxPriorityFeePerGas = tx.maxPriorityFeePerGas.toString();
|
|
80
|
+
} else {
|
|
81
|
+
bodyData.maxPriorityFeePerGas = `0x${BigInt(tx.maxPriorityFeePerGas).toString(16)}`;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
bodyData.data = tx.data || "0x";
|
|
85
|
+
const bodyString = new URLSearchParams(bodyData).toString();
|
|
86
|
+
const url = `${this.baseURL}${ABC_ENDPOINTS.SIGN_TRANSACTION}`;
|
|
87
|
+
const response = await fetch(url, {
|
|
88
|
+
method: "POST",
|
|
89
|
+
headers: {
|
|
90
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
91
|
+
"Secure-Channel": secureChannelId,
|
|
92
|
+
...this.accessToken ? { Authorization: `Bearer ${this.accessToken}` } : {}
|
|
93
|
+
},
|
|
94
|
+
body: bodyString
|
|
95
|
+
});
|
|
96
|
+
const res = await response.json();
|
|
97
|
+
if (response.status === 401 && this.refreshToken) {
|
|
98
|
+
await this.refreshAccessToken();
|
|
99
|
+
const retryResponse = await fetch(url, {
|
|
100
|
+
method: "POST",
|
|
101
|
+
headers: {
|
|
102
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
103
|
+
"Secure-Channel": secureChannelId,
|
|
104
|
+
...this.accessToken ? { Authorization: `Bearer ${this.accessToken}` } : {}
|
|
105
|
+
},
|
|
106
|
+
body: bodyString
|
|
107
|
+
});
|
|
108
|
+
const retryRes = await retryResponse.json();
|
|
109
|
+
if (retryRes.serializedTx && retryRes.rawTx) {
|
|
110
|
+
return {
|
|
111
|
+
signature: retryRes.serializedTx,
|
|
112
|
+
txHash: retryRes.rawTx
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
throw createAbcError(
|
|
116
|
+
"SIGNATURE_FAILED" /* SIGNATURE_FAILED */,
|
|
117
|
+
"Failed to sign transaction after token refresh",
|
|
118
|
+
retryRes
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
if (res.serializedTx && res.rawTx) {
|
|
122
|
+
return {
|
|
123
|
+
signature: res.serializedTx,
|
|
124
|
+
txHash: res.rawTx
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
throw createAbcError(
|
|
128
|
+
"SIGNATURE_FAILED" /* SIGNATURE_FAILED */,
|
|
129
|
+
"Failed to sign transaction",
|
|
130
|
+
res
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Sign message (Personal Sign - EIP-191)
|
|
135
|
+
*/
|
|
136
|
+
async signMessage(params) {
|
|
137
|
+
this.loadTokens();
|
|
138
|
+
const wallet = loadFromStorage("wallet" /* WALLET */);
|
|
139
|
+
if (!wallet) {
|
|
140
|
+
throw createAbcError(
|
|
141
|
+
"WALLET_NOT_FOUND" /* WALLET_NOT_FOUND */,
|
|
142
|
+
"Wallet information not found in storage"
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
const ethers = await import("ethers");
|
|
146
|
+
const messageHash = ethers.utils.hashMessage(params.message);
|
|
147
|
+
const hash = messageHash.startsWith("0x") ? messageHash.slice(2) : messageHash;
|
|
148
|
+
const encryptedDevicePassword = await this.secure.getEncryptPlain(
|
|
149
|
+
wallet.encryptDevicePassword
|
|
150
|
+
);
|
|
151
|
+
const encryptedPvencstr = await this.secure.getEncryptPlain(
|
|
152
|
+
wallet.pvencstr
|
|
153
|
+
);
|
|
154
|
+
const encryptedWid = await this.secure.getEncryptPlain(wallet.wid);
|
|
155
|
+
const secureChannelId = await this.secure.getSecureChannelId();
|
|
156
|
+
const bodyData = {
|
|
157
|
+
hash,
|
|
158
|
+
encryptDevicePassword: encryptedDevicePassword,
|
|
159
|
+
pvencstr: encryptedPvencstr,
|
|
160
|
+
wid: encryptedWid,
|
|
161
|
+
uid: wallet.uid,
|
|
162
|
+
sid: wallet.sid
|
|
163
|
+
};
|
|
164
|
+
const bodyString = new URLSearchParams(bodyData).toString();
|
|
165
|
+
const url = `${this.baseURL}${ABC_ENDPOINTS.SIGN_HASH}`;
|
|
166
|
+
const response = await fetch(url, {
|
|
167
|
+
method: "POST",
|
|
168
|
+
headers: {
|
|
169
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
170
|
+
"Secure-Channel": secureChannelId,
|
|
171
|
+
...this.accessToken ? { Authorization: `Bearer ${this.accessToken}` } : {}
|
|
172
|
+
},
|
|
173
|
+
body: bodyString
|
|
174
|
+
});
|
|
175
|
+
const text = await response.text();
|
|
176
|
+
if (!text) {
|
|
177
|
+
throw createAbcError(
|
|
178
|
+
"SIGNATURE_FAILED" /* SIGNATURE_FAILED */,
|
|
179
|
+
`Empty response from sign API (status: ${response.status})`,
|
|
180
|
+
{ status: response.status }
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
const res = JSON.parse(text);
|
|
184
|
+
if (response.status === 401) {
|
|
185
|
+
if (!this.refreshToken) {
|
|
186
|
+
this.loadTokens();
|
|
187
|
+
}
|
|
188
|
+
if (this.refreshToken) {
|
|
189
|
+
await this.refreshAccessToken();
|
|
190
|
+
const retryResponse = await fetch(url, {
|
|
191
|
+
method: "POST",
|
|
192
|
+
headers: {
|
|
193
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
194
|
+
"Secure-Channel": secureChannelId,
|
|
195
|
+
...this.accessToken ? { Authorization: `Bearer ${this.accessToken}` } : {}
|
|
196
|
+
},
|
|
197
|
+
body: bodyString
|
|
198
|
+
});
|
|
199
|
+
const retryText = await retryResponse.text();
|
|
200
|
+
if (!retryText) {
|
|
201
|
+
throw createAbcError(
|
|
202
|
+
"SIGNATURE_FAILED" /* SIGNATURE_FAILED */,
|
|
203
|
+
`Empty response from retry (status: ${retryResponse.status})`,
|
|
204
|
+
{ status: retryResponse.status }
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
const retryRes = JSON.parse(retryText);
|
|
208
|
+
if (retryRes.status === "success" && retryRes.result?.signstr) {
|
|
209
|
+
return { signature: retryRes.result.signstr };
|
|
210
|
+
}
|
|
211
|
+
throw createAbcError(
|
|
212
|
+
"SIGNATURE_FAILED" /* SIGNATURE_FAILED */,
|
|
213
|
+
"Failed to sign message after token refresh",
|
|
214
|
+
retryRes
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
if (res.signstr) {
|
|
219
|
+
const signData = JSON.parse(res.signstr);
|
|
220
|
+
const sigList = signData.sig_list?.[0];
|
|
221
|
+
if (!sigList || !sigList.r || !sigList.s) {
|
|
222
|
+
throw createAbcError(
|
|
223
|
+
"SIGNATURE_FAILED" /* SIGNATURE_FAILED */,
|
|
224
|
+
"Invalid signature format",
|
|
225
|
+
res
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
const v = (sigList.vsource || 0) + 27;
|
|
229
|
+
const signature = sigList.r + sigList.s.slice(2) + v.toString(16).padStart(2, "0");
|
|
230
|
+
return { signature };
|
|
231
|
+
}
|
|
232
|
+
throw createAbcError(
|
|
233
|
+
"SIGNATURE_FAILED" /* SIGNATURE_FAILED */,
|
|
234
|
+
"Failed to sign message",
|
|
235
|
+
res
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Sign typed data (EIP-712)
|
|
240
|
+
*/
|
|
241
|
+
async signTypedData(params) {
|
|
242
|
+
const wallet = loadFromStorage("wallet" /* WALLET */);
|
|
243
|
+
if (!wallet) {
|
|
244
|
+
throw createAbcError(
|
|
245
|
+
"WALLET_NOT_FOUND" /* WALLET_NOT_FOUND */,
|
|
246
|
+
"Wallet information not found in storage"
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
const encryptedDevicePassword = await this.secure.getEncryptPlain(
|
|
250
|
+
wallet.encryptDevicePassword
|
|
251
|
+
);
|
|
252
|
+
const encryptedPvencstr = await this.secure.getEncryptPlain(
|
|
253
|
+
wallet.pvencstr
|
|
254
|
+
);
|
|
255
|
+
const encryptedWid = await this.secure.getEncryptPlain(wallet.wid);
|
|
256
|
+
const secureChannelId = await this.secure.getSecureChannelId();
|
|
257
|
+
const network = getNetworkName(wallet.chainId);
|
|
258
|
+
const bodyData = {
|
|
259
|
+
messageJson: params.typedData,
|
|
260
|
+
version: "v4",
|
|
261
|
+
network,
|
|
262
|
+
encryptDevicePassword: encryptedDevicePassword,
|
|
263
|
+
pvencstr: encryptedPvencstr,
|
|
264
|
+
wid: encryptedWid,
|
|
265
|
+
uid: wallet.uid,
|
|
266
|
+
sid: wallet.sid
|
|
267
|
+
};
|
|
268
|
+
const bodyString = new URLSearchParams(bodyData).toString();
|
|
269
|
+
const url = `${this.baseURL}${ABC_ENDPOINTS.SIGN_TYPED}`;
|
|
270
|
+
const response = await fetch(url, {
|
|
271
|
+
method: "POST",
|
|
272
|
+
headers: {
|
|
273
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
274
|
+
"Secure-Channel": secureChannelId,
|
|
275
|
+
...this.accessToken ? { Authorization: `Bearer ${this.accessToken}` } : {}
|
|
276
|
+
},
|
|
277
|
+
body: bodyString
|
|
278
|
+
});
|
|
279
|
+
const text = await response.text();
|
|
280
|
+
if (!text) {
|
|
281
|
+
throw createAbcError(
|
|
282
|
+
"SIGNATURE_FAILED" /* SIGNATURE_FAILED */,
|
|
283
|
+
`Empty response from signTypedData API (status: ${response.status})`,
|
|
284
|
+
{ status: response.status }
|
|
285
|
+
);
|
|
286
|
+
}
|
|
287
|
+
const res = JSON.parse(text);
|
|
288
|
+
if (response.status === 401 && this.refreshToken) {
|
|
289
|
+
await this.refreshAccessToken();
|
|
290
|
+
const retryResponse = await fetch(url, {
|
|
291
|
+
method: "POST",
|
|
292
|
+
headers: {
|
|
293
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
294
|
+
"Secure-Channel": secureChannelId,
|
|
295
|
+
...this.accessToken ? { Authorization: `Bearer ${this.accessToken}` } : {}
|
|
296
|
+
},
|
|
297
|
+
body: bodyString
|
|
298
|
+
});
|
|
299
|
+
const retryText = await retryResponse.text();
|
|
300
|
+
if (!retryText) {
|
|
301
|
+
throw createAbcError(
|
|
302
|
+
"SIGNATURE_FAILED" /* SIGNATURE_FAILED */,
|
|
303
|
+
`Empty response after retry (status: ${retryResponse.status})`,
|
|
304
|
+
{ status: retryResponse.status }
|
|
305
|
+
);
|
|
306
|
+
}
|
|
307
|
+
const retryRes = JSON.parse(retryText);
|
|
308
|
+
if (retryRes.serializedTx) {
|
|
309
|
+
return { signature: retryRes.serializedTx };
|
|
310
|
+
}
|
|
311
|
+
throw createAbcError(
|
|
312
|
+
"SIGNATURE_FAILED" /* SIGNATURE_FAILED */,
|
|
313
|
+
"Failed to sign typed data after token refresh",
|
|
314
|
+
retryRes
|
|
315
|
+
);
|
|
316
|
+
}
|
|
317
|
+
if (res.serializedTx) {
|
|
318
|
+
return { signature: res.serializedTx };
|
|
319
|
+
}
|
|
320
|
+
throw createAbcError(
|
|
321
|
+
"SIGNATURE_FAILED" /* SIGNATURE_FAILED */,
|
|
322
|
+
"Failed to sign typed data",
|
|
323
|
+
res
|
|
324
|
+
);
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
export {
|
|
329
|
+
SigningApi
|
|
330
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
BaseApiClient
|
|
4
|
+
} from "./chunk-25V3FW3O.js";
|
|
5
|
+
|
|
6
|
+
// src/wallets/walletConnectors/abcWallet/api/GasApi.ts
|
|
7
|
+
import { getTalkenApiClient } from "@talken/talkenkit";
|
|
8
|
+
var GasApi = class extends BaseApiClient {
|
|
9
|
+
parseGasFees(data) {
|
|
10
|
+
return {
|
|
11
|
+
...data,
|
|
12
|
+
networkCongestion: data.networkCongestion != null ? Number(data.networkCongestion) : void 0
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Get suggested gas fees for EIP-1559 transactions via TalkenApiClient
|
|
17
|
+
*
|
|
18
|
+
* @param network - Network name (ethereum, polygon, klaytn, etc.)
|
|
19
|
+
* @returns Suggested gas fees or null if failed
|
|
20
|
+
*/
|
|
21
|
+
async getSuggestedGasFees(network) {
|
|
22
|
+
const api = getTalkenApiClient();
|
|
23
|
+
if (!api)
|
|
24
|
+
throw new Error("TalkenApiClient not initialized");
|
|
25
|
+
try {
|
|
26
|
+
const gasFees = await api.evm.getGasSuggested(network);
|
|
27
|
+
return this.parseGasFees(gasFees);
|
|
28
|
+
} catch (error) {
|
|
29
|
+
console.warn(
|
|
30
|
+
"[GasApi] TalkenApi getGasSuggested failed:",
|
|
31
|
+
network,
|
|
32
|
+
error
|
|
33
|
+
);
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Estimate gas limit for EIP-1559 transaction via TalkenApiClient
|
|
39
|
+
*
|
|
40
|
+
* @param params - Transaction parameters
|
|
41
|
+
* @returns Gas limit (hex string) or null if failed
|
|
42
|
+
*/
|
|
43
|
+
async estimateGas(params) {
|
|
44
|
+
const api = getTalkenApiClient();
|
|
45
|
+
if (!api)
|
|
46
|
+
throw new Error("TalkenApiClient not initialized");
|
|
47
|
+
try {
|
|
48
|
+
const response = await api.evm.estimateGas({
|
|
49
|
+
network: params.network,
|
|
50
|
+
from: params.from || "",
|
|
51
|
+
to: params.to,
|
|
52
|
+
value: params.value || "0x0",
|
|
53
|
+
data: params.data || "0x"
|
|
54
|
+
});
|
|
55
|
+
return response.result ?? null;
|
|
56
|
+
} catch (error) {
|
|
57
|
+
console.warn("[GasApi] TalkenApi estimateGas failed:", error);
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Get suggested gas fees with timeout
|
|
63
|
+
*
|
|
64
|
+
* @param network - Network name
|
|
65
|
+
* @param timeoutMs - Timeout in milliseconds (default: 5000)
|
|
66
|
+
* @returns Suggested gas fees or null if timeout/failed
|
|
67
|
+
*/
|
|
68
|
+
async getSuggestedGasFeesWithTimeout(network, timeoutMs = 5e3) {
|
|
69
|
+
try {
|
|
70
|
+
const result = await Promise.race([
|
|
71
|
+
this.getSuggestedGasFees(network),
|
|
72
|
+
new Promise(
|
|
73
|
+
(resolve) => setTimeout(() => resolve(null), timeoutMs)
|
|
74
|
+
)
|
|
75
|
+
]);
|
|
76
|
+
return result;
|
|
77
|
+
} catch (_error) {
|
|
78
|
+
console.warn("[GasApi] Gas fees request timed out:", network);
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Estimate gas with timeout
|
|
84
|
+
*
|
|
85
|
+
* @param params - Transaction parameters
|
|
86
|
+
* @param timeoutMs - Timeout in milliseconds (default: 5000)
|
|
87
|
+
* @returns Gas limit (hex string) or null if timeout/failed
|
|
88
|
+
*/
|
|
89
|
+
async estimateGasWithTimeout(params, timeoutMs = 5e3) {
|
|
90
|
+
try {
|
|
91
|
+
const result = await Promise.race([
|
|
92
|
+
this.estimateGas(params),
|
|
93
|
+
new Promise(
|
|
94
|
+
(resolve) => setTimeout(() => resolve(null), timeoutMs)
|
|
95
|
+
)
|
|
96
|
+
]);
|
|
97
|
+
return result;
|
|
98
|
+
} catch (_error) {
|
|
99
|
+
console.warn("[GasApi] Gas estimate request timed out");
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export {
|
|
106
|
+
GasApi
|
|
107
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
abcConnector
|
|
4
|
+
} from "./chunk-MGCRUAHX.js";
|
|
5
|
+
import {
|
|
6
|
+
ABC_WALLET_METADATA
|
|
7
|
+
} from "./chunk-VETRBBA2.js";
|
|
8
|
+
|
|
9
|
+
// src/wallets/walletConnectors/abcWallet/abcWallet.ts
|
|
10
|
+
var abcWallet = (specificOptions) => ({ projectId }) => {
|
|
11
|
+
const waasUrl = specificOptions?.waasUrl || process.env.NEXT_PUBLIC_ABC_WAAS_URL || process.env.VITE_ABC_WAAS_URL;
|
|
12
|
+
if (!waasUrl) {
|
|
13
|
+
throw new Error(
|
|
14
|
+
'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'
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
const config = {
|
|
18
|
+
waasUrl,
|
|
19
|
+
apiKey: specificOptions?.apiKey,
|
|
20
|
+
plain: specificOptions?.plain || "",
|
|
21
|
+
// Deprecated - not used (secure.ts uses random generation)
|
|
22
|
+
environment: specificOptions?.environment || "development",
|
|
23
|
+
defaultChainId: specificOptions?.defaultChainId,
|
|
24
|
+
defaultSolanaNetwork: specificOptions?.defaultSolanaNetwork,
|
|
25
|
+
defaultBitcoinNetwork: specificOptions?.defaultBitcoinNetwork,
|
|
26
|
+
projectId
|
|
27
|
+
};
|
|
28
|
+
return {
|
|
29
|
+
id: ABC_WALLET_METADATA.id,
|
|
30
|
+
name: ABC_WALLET_METADATA.name,
|
|
31
|
+
rdns: ABC_WALLET_METADATA.rdns,
|
|
32
|
+
iconUrl: async () => (await import("./abcWallet-AYWSIGAG.js")).default,
|
|
33
|
+
iconBackground: ABC_WALLET_METADATA.iconBackground,
|
|
34
|
+
// Embedded wallet - no installation required
|
|
35
|
+
installed: void 0,
|
|
36
|
+
// No download URLs for embedded wallet
|
|
37
|
+
downloadUrls: void 0,
|
|
38
|
+
// Create connector - wrapper function required by Wallet type
|
|
39
|
+
createConnector: (_walletDetails) => abcConnector({ config }),
|
|
40
|
+
// Embedded wallet always available
|
|
41
|
+
hidden: () => false
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export {
|
|
46
|
+
abcWallet
|
|
47
|
+
};
|