@talken/talkenkit 2.4.16 → 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/RainbowKitProvider.d.ts +7 -1
- 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 +7970 -4015
- 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 +57 -56
- 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,46 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/wallets/walletConnectors/abcWallet/types.ts
|
|
4
|
+
var AbcStorageKey = /* @__PURE__ */ ((AbcStorageKey2) => {
|
|
5
|
+
AbcStorageKey2["USER"] = "user";
|
|
6
|
+
AbcStorageKey2["WALLET"] = "wallet";
|
|
7
|
+
AbcStorageKey2["SOLANA_WALLET"] = "solana_wallet";
|
|
8
|
+
AbcStorageKey2["BITCOIN_WALLET"] = "bitcoin_wallet";
|
|
9
|
+
AbcStorageKey2["TRON_WALLET"] = "tron_wallet";
|
|
10
|
+
AbcStorageKey2["ACCESS_TOKEN"] = "access_token";
|
|
11
|
+
AbcStorageKey2["REFRESH_TOKEN"] = "refresh_token";
|
|
12
|
+
AbcStorageKey2["EXPIRES_AT"] = "expires_at";
|
|
13
|
+
AbcStorageKey2["PIN"] = "pin";
|
|
14
|
+
AbcStorageKey2["AUTH_STATE"] = "auth_state";
|
|
15
|
+
AbcStorageKey2["ENCRYPTED_TOKENS"] = "encrypted_tokens";
|
|
16
|
+
AbcStorageKey2["TOKEN_SALT"] = "token_salt";
|
|
17
|
+
return AbcStorageKey2;
|
|
18
|
+
})(AbcStorageKey || {});
|
|
19
|
+
var AbcErrorCode = /* @__PURE__ */ ((AbcErrorCode2) => {
|
|
20
|
+
AbcErrorCode2["INVALID_CREDENTIALS"] = "INVALID_CREDENTIALS";
|
|
21
|
+
AbcErrorCode2["TOKEN_EXPIRED"] = "TOKEN_EXPIRED";
|
|
22
|
+
AbcErrorCode2["WALLET_NOT_FOUND"] = "WALLET_NOT_FOUND";
|
|
23
|
+
AbcErrorCode2["INVALID_PIN"] = "INVALID_PIN";
|
|
24
|
+
AbcErrorCode2["NETWORK_ERROR"] = "NETWORK_ERROR";
|
|
25
|
+
AbcErrorCode2["SIGNATURE_FAILED"] = "SIGNATURE_FAILED";
|
|
26
|
+
AbcErrorCode2["USER_CANCELLED"] = "USER_CANCELLED";
|
|
27
|
+
AbcErrorCode2["UNKNOWN_ERROR"] = "UNKNOWN_ERROR";
|
|
28
|
+
AbcErrorCode2["ENCRYPTION_FAILED"] = "ENCRYPTION_FAILED";
|
|
29
|
+
AbcErrorCode2["DECRYPTION_FAILED"] = "DECRYPTION_FAILED";
|
|
30
|
+
return AbcErrorCode2;
|
|
31
|
+
})(AbcErrorCode || {});
|
|
32
|
+
var AbcError = class extends Error {
|
|
33
|
+
constructor(code, message, details, statusCode) {
|
|
34
|
+
super(message);
|
|
35
|
+
this.name = "AbcError";
|
|
36
|
+
this.code = code;
|
|
37
|
+
this.details = details;
|
|
38
|
+
this.statusCode = statusCode;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export {
|
|
43
|
+
AbcStorageKey,
|
|
44
|
+
AbcErrorCode,
|
|
45
|
+
AbcError
|
|
46
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
getWalletConnectConnector
|
|
4
|
+
} from "./chunk-PODFK4OS.js";
|
|
5
|
+
import {
|
|
6
|
+
hasInjectedProvider
|
|
7
|
+
} from "./chunk-MBBGZGXF.js";
|
|
8
|
+
|
|
9
|
+
// src/wallets/walletConnectors/klipWallet/klipWallet.ts
|
|
10
|
+
var klipWallet = ({
|
|
11
|
+
projectId,
|
|
12
|
+
walletConnectParameters
|
|
13
|
+
}) => {
|
|
14
|
+
const isKlipWalletInjected = hasInjectedProvider({
|
|
15
|
+
namespace: "klip"
|
|
16
|
+
});
|
|
17
|
+
const shouldUseWalletConnect = true;
|
|
18
|
+
const getUri = (uri) => {
|
|
19
|
+
return `klip://walletconnect?uri=${encodeURIComponent(uri)}`;
|
|
20
|
+
};
|
|
21
|
+
return {
|
|
22
|
+
id: "klip",
|
|
23
|
+
name: "Klip Wallet",
|
|
24
|
+
iconUrl: async () => (await import("./klipWallet-PPTYYB5G.js")).default,
|
|
25
|
+
installed: isKlipWalletInjected || void 0,
|
|
26
|
+
iconBackground: "#FEE500",
|
|
27
|
+
downloadUrls: {
|
|
28
|
+
ios: "https://apps.apple.com/kr/app/klip/id1627665524",
|
|
29
|
+
android: "https://play.google.com/store/apps/details?id=com.klipwallet.app",
|
|
30
|
+
mobile: "https://klipwallet.com",
|
|
31
|
+
qrCode: "https://klipwallet.com"
|
|
32
|
+
},
|
|
33
|
+
mobile: { getUri: shouldUseWalletConnect ? getUri : void 0 },
|
|
34
|
+
qrCode: shouldUseWalletConnect ? {
|
|
35
|
+
getUri: (uri) => uri,
|
|
36
|
+
instructions: {
|
|
37
|
+
learnMoreUrl: "https://klipwallet.com",
|
|
38
|
+
steps: [
|
|
39
|
+
{
|
|
40
|
+
description: "wallet_connectors.klip.qr_code.step1.description",
|
|
41
|
+
step: "install",
|
|
42
|
+
title: "wallet_connectors.klip.qr_code.step1.title"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
description: "wallet_connectors.klip.qr_code.step2.description",
|
|
46
|
+
step: "create",
|
|
47
|
+
title: "wallet_connectors.klip.qr_code.step2.title"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
description: "wallet_connectors.klip.qr_code.step3.description",
|
|
51
|
+
step: "refresh",
|
|
52
|
+
title: "wallet_connectors.klip.qr_code.step3.title"
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
} : void 0,
|
|
57
|
+
createConnector: getWalletConnectConnector({
|
|
58
|
+
projectId,
|
|
59
|
+
walletConnectParameters
|
|
60
|
+
})
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export {
|
|
65
|
+
klipWallet
|
|
66
|
+
};
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
BaseApiClient
|
|
4
|
+
} from "./chunk-25V3FW3O.js";
|
|
5
|
+
import {
|
|
6
|
+
getNetworkName
|
|
7
|
+
} from "./chunk-7QHCSJDN.js";
|
|
8
|
+
import {
|
|
9
|
+
createAbcError
|
|
10
|
+
} from "./chunk-GO6OLTNF.js";
|
|
11
|
+
import {
|
|
12
|
+
ABC_ENDPOINTS
|
|
13
|
+
} from "./chunk-YJH4BHSB.js";
|
|
14
|
+
|
|
15
|
+
// src/wallets/walletConnectors/abcWallet/api/TransactionApi.ts
|
|
16
|
+
var TransactionApi = class extends BaseApiClient {
|
|
17
|
+
/**
|
|
18
|
+
* Send raw transaction
|
|
19
|
+
*/
|
|
20
|
+
async sendRawTransaction(chainId, signedTransaction) {
|
|
21
|
+
const network = getNetworkName(chainId);
|
|
22
|
+
const secureChannelId = await this.secure.getSecureChannelId();
|
|
23
|
+
const bodyData = {
|
|
24
|
+
signedSerializeTx: signedTransaction,
|
|
25
|
+
network
|
|
26
|
+
};
|
|
27
|
+
const bodyString = new URLSearchParams(bodyData).toString();
|
|
28
|
+
const url = `${this.baseURL}${ABC_ENDPOINTS.SEND_RAW_TX}`;
|
|
29
|
+
const response = await fetch(url, {
|
|
30
|
+
method: "POST",
|
|
31
|
+
headers: {
|
|
32
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
33
|
+
"Secure-Channel": secureChannelId,
|
|
34
|
+
...this.accessToken ? { Authorization: `Bearer ${this.accessToken}` } : {}
|
|
35
|
+
},
|
|
36
|
+
body: bodyString
|
|
37
|
+
});
|
|
38
|
+
const text = await response.text();
|
|
39
|
+
if (!text) {
|
|
40
|
+
throw createAbcError(
|
|
41
|
+
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
42
|
+
`Empty response from sendRawTx API (status: ${response.status})`,
|
|
43
|
+
{ status: response.status }
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
const res = JSON.parse(text);
|
|
47
|
+
if (response.status === 401 && this.refreshToken) {
|
|
48
|
+
try {
|
|
49
|
+
await this.refreshAccessToken();
|
|
50
|
+
const retryResponse = await fetch(url, {
|
|
51
|
+
method: "POST",
|
|
52
|
+
headers: {
|
|
53
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
54
|
+
"Secure-Channel": secureChannelId,
|
|
55
|
+
...this.accessToken ? { Authorization: `Bearer ${this.accessToken}` } : {}
|
|
56
|
+
},
|
|
57
|
+
body: bodyString
|
|
58
|
+
});
|
|
59
|
+
const retryText = await retryResponse.text();
|
|
60
|
+
if (!retryText) {
|
|
61
|
+
throw createAbcError(
|
|
62
|
+
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
63
|
+
`Empty response after retry (status: ${retryResponse.status})`,
|
|
64
|
+
{ status: retryResponse.status }
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
const retryRes = JSON.parse(retryText);
|
|
68
|
+
if (retryRes.item || retryRes.txHash || retryRes.result?.txHash) {
|
|
69
|
+
const txHash = retryRes.item || retryRes.txHash || retryRes.result.txHash;
|
|
70
|
+
return { txHash };
|
|
71
|
+
}
|
|
72
|
+
throw createAbcError(
|
|
73
|
+
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
74
|
+
"Failed to send transaction after token refresh",
|
|
75
|
+
retryRes
|
|
76
|
+
);
|
|
77
|
+
} catch (refreshError) {
|
|
78
|
+
console.error(
|
|
79
|
+
"Token refresh failed in sendRawTransaction:",
|
|
80
|
+
refreshError
|
|
81
|
+
);
|
|
82
|
+
throw refreshError;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (res.result) {
|
|
86
|
+
if (typeof res.result === "string") {
|
|
87
|
+
return { txHash: res.result };
|
|
88
|
+
}
|
|
89
|
+
if (res.result.txHash) {
|
|
90
|
+
return { txHash: res.result.txHash };
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if (res.item) {
|
|
94
|
+
return { txHash: res.item };
|
|
95
|
+
}
|
|
96
|
+
if (res.txHash) {
|
|
97
|
+
return { txHash: res.txHash };
|
|
98
|
+
}
|
|
99
|
+
throw createAbcError(
|
|
100
|
+
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
101
|
+
"Failed to send transaction",
|
|
102
|
+
res
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Get transaction count (nonce)
|
|
107
|
+
*/
|
|
108
|
+
async getTransactionCount(address, network, block = "latest") {
|
|
109
|
+
const nonceUrl = `${this.baseURL}${ABC_ENDPOINTS.TRANSACTION_COUNT}?address=${address}&network=${network}&block=${block}`;
|
|
110
|
+
const response = await fetch(nonceUrl, {
|
|
111
|
+
method: "GET",
|
|
112
|
+
headers: {
|
|
113
|
+
...this.accessToken ? { Authorization: `Bearer ${this.accessToken}` } : {}
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
if (response.ok) {
|
|
117
|
+
const data = await response.json();
|
|
118
|
+
return Number.parseInt(data.result, 16);
|
|
119
|
+
}
|
|
120
|
+
throw createAbcError(
|
|
121
|
+
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
122
|
+
"Failed to get transaction count"
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Get suggested gas fees for EIP-1559
|
|
127
|
+
*/
|
|
128
|
+
async getSuggestedGasFees(network) {
|
|
129
|
+
const url = `${this.baseURL}${ABC_ENDPOINTS.GAS_SUGGESTED_FEES}?network=${network}`;
|
|
130
|
+
const response = await fetch(url, {
|
|
131
|
+
method: "GET",
|
|
132
|
+
headers: {
|
|
133
|
+
...this.accessToken ? { Authorization: `Bearer ${this.accessToken}` } : {}
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
if (response.ok) {
|
|
137
|
+
const data = await response.json();
|
|
138
|
+
return data;
|
|
139
|
+
}
|
|
140
|
+
throw createAbcError(
|
|
141
|
+
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
142
|
+
"Failed to get suggested gas fees"
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Estimate gas limit for EIP-1559 transaction
|
|
147
|
+
*/
|
|
148
|
+
async estimateGas(params) {
|
|
149
|
+
const estimateBody = new URLSearchParams({
|
|
150
|
+
network: params.network,
|
|
151
|
+
to: params.to || "0x",
|
|
152
|
+
...params.from ? { from: params.from } : {},
|
|
153
|
+
...params.value ? { value: params.value } : {},
|
|
154
|
+
...params.data && params.data !== "0x" ? { data: params.data } : {},
|
|
155
|
+
...params.maxFeePerGas ? { maxFeePerGas: params.maxFeePerGas } : {},
|
|
156
|
+
...params.maxPriorityFeePerGas ? { maxPriorityFeePerGas: params.maxPriorityFeePerGas } : {}
|
|
157
|
+
});
|
|
158
|
+
const url = `${this.baseURL}${ABC_ENDPOINTS.GAS_ESTIMATE_EIP1559}`;
|
|
159
|
+
const response = await fetch(url, {
|
|
160
|
+
method: "POST",
|
|
161
|
+
headers: {
|
|
162
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
163
|
+
...this.accessToken ? { Authorization: `Bearer ${this.accessToken}` } : {}
|
|
164
|
+
},
|
|
165
|
+
body: estimateBody.toString()
|
|
166
|
+
});
|
|
167
|
+
const data = await response.json();
|
|
168
|
+
if (response.ok && data.result) {
|
|
169
|
+
return data.result;
|
|
170
|
+
}
|
|
171
|
+
const fallbackGasLimit = "0x2dc6c0";
|
|
172
|
+
console.warn("\u26A0\uFE0F Gas estimate failed, using fallback:", {
|
|
173
|
+
error: data.errorMessage || data.msg,
|
|
174
|
+
fallbackGasLimit
|
|
175
|
+
});
|
|
176
|
+
return fallbackGasLimit;
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
export {
|
|
181
|
+
TransactionApi
|
|
182
|
+
};
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/wallets/walletConnectors/abcWallet/abcTronProvider.ts
|
|
4
|
+
var TronErrorCode = {
|
|
5
|
+
USER_REJECTED: 4001,
|
|
6
|
+
UNAUTHORIZED: 4100,
|
|
7
|
+
UNSUPPORTED_METHOD: 4200,
|
|
8
|
+
DISCONNECTED: 4900,
|
|
9
|
+
INVALID_PARAMS: -32602,
|
|
10
|
+
INTERNAL_ERROR: -32603,
|
|
11
|
+
INSUFFICIENT_FUNDS: 5001
|
|
12
|
+
};
|
|
13
|
+
var TronProviderError = class extends Error {
|
|
14
|
+
constructor(code, message, data) {
|
|
15
|
+
super(message);
|
|
16
|
+
this.code = code;
|
|
17
|
+
this.data = data;
|
|
18
|
+
this.name = "TronProviderError";
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
var TRON_NETWORKS = {
|
|
22
|
+
mainnet: {
|
|
23
|
+
name: "TRON Mainnet",
|
|
24
|
+
type: "tron",
|
|
25
|
+
explorer: "https://tronscan.org"
|
|
26
|
+
},
|
|
27
|
+
nile: {
|
|
28
|
+
name: "TRON Nile Testnet",
|
|
29
|
+
type: "tron_nile",
|
|
30
|
+
explorer: "https://nile.tronscan.org"
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
var EventEmitter = class {
|
|
34
|
+
constructor() {
|
|
35
|
+
this.events = /* @__PURE__ */ new Map();
|
|
36
|
+
}
|
|
37
|
+
on(event, listener) {
|
|
38
|
+
if (!this.events.has(event)) {
|
|
39
|
+
this.events.set(event, []);
|
|
40
|
+
}
|
|
41
|
+
this.events.get(event).push(listener);
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
44
|
+
off(event, listener) {
|
|
45
|
+
const listeners = this.events.get(event);
|
|
46
|
+
if (listeners) {
|
|
47
|
+
const index = listeners.indexOf(listener);
|
|
48
|
+
if (index !== -1) {
|
|
49
|
+
listeners.splice(index, 1);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return this;
|
|
53
|
+
}
|
|
54
|
+
emit(event, ...args) {
|
|
55
|
+
const listeners = this.events.get(event);
|
|
56
|
+
if (listeners) {
|
|
57
|
+
for (const listener of listeners) {
|
|
58
|
+
listener(...args);
|
|
59
|
+
}
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
removeAllListeners(event) {
|
|
65
|
+
if (event) {
|
|
66
|
+
this.events.delete(event);
|
|
67
|
+
} else {
|
|
68
|
+
this.events.clear();
|
|
69
|
+
}
|
|
70
|
+
return this;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
var AbcTronProvider = class extends EventEmitter {
|
|
74
|
+
constructor(client) {
|
|
75
|
+
super();
|
|
76
|
+
this.wallet = null;
|
|
77
|
+
this.network = TRON_NETWORKS.mainnet;
|
|
78
|
+
this.connected = false;
|
|
79
|
+
this.client = client;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Set wallet information
|
|
83
|
+
*/
|
|
84
|
+
setWallet(wallet) {
|
|
85
|
+
const previousAddress = this.wallet?.address;
|
|
86
|
+
this.wallet = wallet;
|
|
87
|
+
this.connected = true;
|
|
88
|
+
if (wallet.network === "tron") {
|
|
89
|
+
this.network = TRON_NETWORKS.mainnet;
|
|
90
|
+
} else {
|
|
91
|
+
this.network = TRON_NETWORKS.nile;
|
|
92
|
+
}
|
|
93
|
+
if (previousAddress !== wallet.address) {
|
|
94
|
+
this.emit("accountsChanged", [wallet.address]);
|
|
95
|
+
}
|
|
96
|
+
this.emit("connect", {
|
|
97
|
+
address: wallet.address,
|
|
98
|
+
network: this.network.type
|
|
99
|
+
});
|
|
100
|
+
console.log(
|
|
101
|
+
"[TronProvider] \u2705 Wallet connected:",
|
|
102
|
+
`${wallet.address.substring(0, 6)}...${wallet.address.substring(wallet.address.length - 6)}`
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Clear wallet (disconnect)
|
|
107
|
+
*/
|
|
108
|
+
clearWallet() {
|
|
109
|
+
this.wallet = null;
|
|
110
|
+
this.connected = false;
|
|
111
|
+
this.emit("disconnect");
|
|
112
|
+
this.emit("accountsChanged", []);
|
|
113
|
+
console.log("[TronProvider] \u{1F50C} Wallet disconnected");
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Set PIN request callback for transaction signing
|
|
117
|
+
*/
|
|
118
|
+
setRequestPinCallback(callback) {
|
|
119
|
+
this.requestPinCallback = callback;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Request PIN from user
|
|
123
|
+
*/
|
|
124
|
+
async requestPin() {
|
|
125
|
+
const globalRequestPin = window.__TALKENKIT_REQUEST_PIN__;
|
|
126
|
+
if (globalRequestPin && typeof globalRequestPin === "function") {
|
|
127
|
+
return globalRequestPin("transaction");
|
|
128
|
+
}
|
|
129
|
+
if (!this.requestPinCallback) {
|
|
130
|
+
throw new TronProviderError(
|
|
131
|
+
TronErrorCode.INTERNAL_ERROR,
|
|
132
|
+
"PIN request callback not configured. Make sure RainbowKitProvider is rendered."
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
return this.requestPinCallback();
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Check if connected
|
|
139
|
+
*/
|
|
140
|
+
isConnected() {
|
|
141
|
+
return this.connected && this.wallet !== null;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Get TRON address
|
|
145
|
+
*/
|
|
146
|
+
async getAddress() {
|
|
147
|
+
if (!this.wallet) {
|
|
148
|
+
throw new TronProviderError(
|
|
149
|
+
TronErrorCode.DISCONNECTED,
|
|
150
|
+
"Wallet not connected"
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
return this.wallet.address;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Get public key
|
|
157
|
+
*/
|
|
158
|
+
async getPublicKey() {
|
|
159
|
+
if (!this.wallet) {
|
|
160
|
+
throw new TronProviderError(
|
|
161
|
+
TronErrorCode.DISCONNECTED,
|
|
162
|
+
"Wallet not connected"
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
return this.wallet.publicKey;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Get current network
|
|
169
|
+
*/
|
|
170
|
+
getNetwork() {
|
|
171
|
+
return this.network;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Sign TRON message (not supported)
|
|
175
|
+
*/
|
|
176
|
+
async signMessage(_message) {
|
|
177
|
+
throw new TronProviderError(
|
|
178
|
+
TronErrorCode.UNSUPPORTED_METHOD,
|
|
179
|
+
"TRON message signing is not supported. Use sendTransaction() instead."
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Send TRON transaction (TRX native or TRC20)
|
|
184
|
+
* Complete flow: create unsigned tx -> request PIN -> sign -> broadcast
|
|
185
|
+
*
|
|
186
|
+
* @param params - Transaction parameters
|
|
187
|
+
* @returns Transaction hash
|
|
188
|
+
*/
|
|
189
|
+
async sendTransaction(params) {
|
|
190
|
+
if (!this.wallet) {
|
|
191
|
+
throw new TronProviderError(
|
|
192
|
+
TronErrorCode.DISCONNECTED,
|
|
193
|
+
"Wallet not connected"
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
try {
|
|
197
|
+
console.log("[TronProvider] \u{1F4B8} Starting TRON transaction...");
|
|
198
|
+
const authStateKey = "talkenkit_abc_auth_state";
|
|
199
|
+
const authState = typeof window !== "undefined" ? localStorage.getItem(authStateKey) : null;
|
|
200
|
+
if (!authState) {
|
|
201
|
+
throw new TronProviderError(
|
|
202
|
+
TronErrorCode.UNAUTHORIZED,
|
|
203
|
+
"Not authenticated - auth state not found"
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
const parsed = JSON.parse(authState);
|
|
207
|
+
const evmWallet = parsed.wallet;
|
|
208
|
+
if (!evmWallet?.uid || !evmWallet?.sid || !evmWallet?.pvencstr || !evmWallet?.wid) {
|
|
209
|
+
throw new TronProviderError(
|
|
210
|
+
TronErrorCode.UNAUTHORIZED,
|
|
211
|
+
"EVM wallet data not found (required for TRON signing)"
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
console.log(
|
|
215
|
+
"[TronProvider] \u{1F510} Requesting PIN for TRON transaction..."
|
|
216
|
+
);
|
|
217
|
+
const pin = await this.requestPin();
|
|
218
|
+
const encoder = new TextEncoder();
|
|
219
|
+
const data = encoder.encode(pin);
|
|
220
|
+
const hashBuffer = await crypto.subtle.digest("SHA-256", data);
|
|
221
|
+
const hashArray = Array.from(new Uint8Array(hashBuffer));
|
|
222
|
+
const pinHash = hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
223
|
+
const SecureService = (await import("./abcWallet/secure.js")).default;
|
|
224
|
+
const secureService = new SecureService(this.client.tron.getBaseURL());
|
|
225
|
+
const walletData = {
|
|
226
|
+
address: evmWallet.address,
|
|
227
|
+
keyId: evmWallet.keyId,
|
|
228
|
+
encryptedShare: evmWallet.encryptedShare,
|
|
229
|
+
uid: evmWallet.uid,
|
|
230
|
+
sid: evmWallet.sid,
|
|
231
|
+
wid: evmWallet.wid,
|
|
232
|
+
pvencstr: evmWallet.pvencstr,
|
|
233
|
+
encryptDevicePassword: evmWallet.encryptDevicePassword,
|
|
234
|
+
pubkey: evmWallet.pubkey
|
|
235
|
+
};
|
|
236
|
+
const txType = params.contractAddress ? "TRC20" : "NATIVE";
|
|
237
|
+
let amountRaw;
|
|
238
|
+
if (txType === "NATIVE") {
|
|
239
|
+
amountRaw = Math.floor(
|
|
240
|
+
Number.parseFloat(params.amount) * 1e6
|
|
241
|
+
).toString();
|
|
242
|
+
console.log(
|
|
243
|
+
`[TronProvider] Converting ${params.amount} TRX -> ${amountRaw} SUN`
|
|
244
|
+
);
|
|
245
|
+
} else {
|
|
246
|
+
const decimals = params.decimals ?? 6;
|
|
247
|
+
amountRaw = Math.floor(
|
|
248
|
+
Number.parseFloat(params.amount) * 10 ** decimals
|
|
249
|
+
).toString();
|
|
250
|
+
console.log(
|
|
251
|
+
`[TronProvider] Converting ${params.amount} -> ${amountRaw} (decimals: ${decimals})`
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
const txHash = await this.client.tron.sendTransaction(
|
|
255
|
+
{
|
|
256
|
+
fromAddress: this.wallet.address,
|
|
257
|
+
toAddress: params.toAddress,
|
|
258
|
+
amount: amountRaw,
|
|
259
|
+
network: this.network.type,
|
|
260
|
+
contractAddress: params.contractAddress,
|
|
261
|
+
feeLimit: params.feeLimit,
|
|
262
|
+
type: txType
|
|
263
|
+
},
|
|
264
|
+
walletData,
|
|
265
|
+
pinHash,
|
|
266
|
+
secureService
|
|
267
|
+
);
|
|
268
|
+
console.log("[TronProvider] \u2705 Transaction complete:", txHash);
|
|
269
|
+
this.emit("transactionBroadcasted", {
|
|
270
|
+
txHash,
|
|
271
|
+
explorerUrl: `${this.network.explorer}/#/transaction/${txHash}`
|
|
272
|
+
});
|
|
273
|
+
return txHash;
|
|
274
|
+
} catch (error) {
|
|
275
|
+
if (error.message?.includes("cancelled") || error.message?.includes("rejected")) {
|
|
276
|
+
console.log("[TronProvider] \u2139\uFE0F User cancelled transaction");
|
|
277
|
+
throw new TronProviderError(
|
|
278
|
+
TronErrorCode.USER_REJECTED,
|
|
279
|
+
"User rejected transaction",
|
|
280
|
+
error
|
|
281
|
+
);
|
|
282
|
+
}
|
|
283
|
+
console.error("[TronProvider] \u274C Transaction failed:", error.message);
|
|
284
|
+
if (error.message?.includes("insufficient")) {
|
|
285
|
+
throw new TronProviderError(
|
|
286
|
+
TronErrorCode.INSUFFICIENT_FUNDS,
|
|
287
|
+
"Insufficient TRX balance",
|
|
288
|
+
error
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
this.emit("error", error);
|
|
292
|
+
throw new TronProviderError(
|
|
293
|
+
TronErrorCode.INTERNAL_ERROR,
|
|
294
|
+
error.message || "Failed to send TRON transaction",
|
|
295
|
+
error
|
|
296
|
+
);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Get wallet info
|
|
301
|
+
*/
|
|
302
|
+
getWalletInfo() {
|
|
303
|
+
if (!this.wallet)
|
|
304
|
+
return null;
|
|
305
|
+
return {
|
|
306
|
+
address: this.wallet.address,
|
|
307
|
+
publicKey: this.wallet.publicKey,
|
|
308
|
+
network: this.network.type
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
export {
|
|
314
|
+
TronProviderError,
|
|
315
|
+
TRON_NETWORKS,
|
|
316
|
+
AbcTronProvider
|
|
317
|
+
};
|