@talken/talkenkit 2.4.17 → 2.4.18
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-NZAVB4PI.js → abcWallet-7XAGJUQT.js} +1 -3
- package/dist/{abcWallet-54KUGWUZ.js → abcWallet-FSUKHVIW.js} +24 -28
- package/dist/{abcWallet-KZHOADBJ.js → abcWallet-GYSVK4YG.js} +24 -28
- package/dist/{abcWallet-25AKGPRG.js → abcWallet-NRFXVTKK.js} +34 -30
- package/dist/abcWallet-VPEWH5VC.js +188 -0
- package/dist/abcWallet-ZC4B5742.js +188 -0
- package/dist/{chunk-KCMRHCAB.js → chunk-5IC2HV5I.js} +3153 -2929
- package/dist/{chunk-7FKWLUOV.js → chunk-6G2FPET7.js} +3138 -2898
- package/dist/{chunk-JZQXBVCJ.js → chunk-BOURCK5E.js} +3137 -2899
- package/dist/{chunk-5X3ROW3U.js → chunk-R4FDCYJX.js} +602 -2269
- package/dist/{chunk-5524HDQP.js → chunk-SUUJYVW2.js} +3033 -2761
- package/dist/chunk-UX7ZGWNT.js +7110 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +59 -47
- package/dist/wallets/walletConnectors/abcWallet/abcApi.d.ts +15 -23
- package/dist/wallets/walletConnectors/abcWallet/abcApi.js +3 -5
- package/dist/wallets/walletConnectors/abcWallet/abcBitcoinConnector.js +3 -3
- package/dist/wallets/walletConnectors/abcWallet/abcBitcoinProvider.d.ts +9 -6
- package/dist/wallets/walletConnectors/abcWallet/abcBitcoinProvider.js +1 -1
- package/dist/wallets/walletConnectors/abcWallet/abcConnector.js +5 -6
- package/dist/wallets/walletConnectors/abcWallet/abcProvider.js +3 -3
- package/dist/wallets/walletConnectors/abcWallet/abcSolanaProvider.js +1 -1
- package/dist/wallets/walletConnectors/abcWallet/abcSolanaWalletAdapter.js +15 -12
- package/dist/wallets/walletConnectors/abcWallet/abcTronProvider.js +1 -1
- package/dist/wallets/walletConnectors/abcWallet/abcWallet.js +7 -8
- package/dist/wallets/walletConnectors/abcWallet/api/AuthApi.js +4 -5
- package/dist/wallets/walletConnectors/abcWallet/api/BaseApiClient.d.ts +0 -6
- package/dist/wallets/walletConnectors/abcWallet/api/BaseApiClient.js +3 -4
- package/dist/wallets/walletConnectors/abcWallet/api/BitcoinApi.d.ts +4 -82
- package/dist/wallets/walletConnectors/abcWallet/api/BitcoinApi.js +4 -5
- package/dist/wallets/walletConnectors/abcWallet/api/GasApi.js +4 -5
- package/dist/wallets/walletConnectors/abcWallet/api/SolanaApi.d.ts +2 -4
- package/dist/wallets/walletConnectors/abcWallet/api/SolanaApi.js +4 -5
- package/dist/wallets/walletConnectors/abcWallet/api/TalkenApiClient.d.ts +35 -3
- package/dist/wallets/walletConnectors/abcWallet/api/TalkenApiClient.js +2 -2
- package/dist/wallets/walletConnectors/abcWallet/api/TransactionApi.d.ts +0 -6
- package/dist/wallets/walletConnectors/abcWallet/api/TransactionApi.js +4 -6
- package/dist/wallets/walletConnectors/abcWallet/api/TronApi.d.ts +2 -80
- package/dist/wallets/walletConnectors/abcWallet/api/TronApi.js +4 -5
- package/dist/wallets/walletConnectors/abcWallet/api/WalletApi.js +4 -5
- package/dist/wallets/walletConnectors/abcWallet/api/WalletscanApi.js +4 -5
- package/dist/wallets/walletConnectors/abcWallet/api/index.d.ts +0 -3
- package/dist/wallets/walletConnectors/abcWallet/api/index.js +18 -24
- package/dist/wallets/walletConnectors/abcWallet/constants.d.ts +2 -0
- package/dist/wallets/walletConnectors/abcWallet/constants.js +1 -1
- package/dist/wallets/walletConnectors/abcWallet/index.d.ts +0 -1
- package/dist/wallets/walletConnectors/abcWallet/index.js +28 -33
- package/dist/wallets/walletConnectors/abcWallet/types.d.ts +8 -20
- package/dist/wallets/walletConnectors/abcWallet/utils.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-6KJQ2GQZ.js → chunk-4AINEBMQ.js} +13 -8
- package/dist/wallets/walletConnectors/{chunk-5CNLMOB2.js → chunk-6BVNBUEI.js} +12 -16
- package/dist/wallets/walletConnectors/{chunk-UCKLTSEQ.js → chunk-6ICR4O35.js} +60 -155
- package/dist/wallets/walletConnectors/{chunk-GO6OLTNF.js → chunk-6LH6ZME2.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-CMTGEHDI.js → chunk-7K4BL7CY.js} +118 -87
- package/dist/wallets/walletConnectors/{chunk-I3GFVK5O.js → chunk-7MDXHYMB.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-BWVC6F6J.js → chunk-7RSNIMBB.js} +61 -156
- package/dist/wallets/walletConnectors/{chunk-25V3FW3O.js → chunk-7ZCM4DCC.js} +2 -12
- package/dist/wallets/walletConnectors/{chunk-A27H6PEU.js → chunk-BBD77PEX.js} +31 -9
- package/dist/wallets/walletConnectors/chunk-BDM7TUVM.js +874 -0
- package/dist/wallets/walletConnectors/{chunk-LZZE462U.js → chunk-C4L5XI6N.js} +37 -50
- package/dist/wallets/walletConnectors/{chunk-5VDSMZC4.js → chunk-C6G5FPD6.js} +5 -5
- package/dist/wallets/walletConnectors/{chunk-7IRF225N.js → chunk-CJOFM6CV.js} +14 -18
- package/dist/wallets/walletConnectors/chunk-CPAYLZZL.js +205 -0
- package/dist/wallets/walletConnectors/{chunk-YJH4BHSB.js → chunk-DHHVIM22.js} +6 -1
- package/dist/wallets/walletConnectors/{chunk-A6FUNQWF.js → chunk-F5C6OZYF.js} +10 -5
- package/dist/wallets/walletConnectors/{chunk-FN67MIIH.js → chunk-GRN6YAJC.js} +13 -17
- package/dist/wallets/walletConnectors/{chunk-AWLDVQXC.js → chunk-H2RCMAOR.js} +42 -70
- package/dist/wallets/walletConnectors/{chunk-QMLG7MAP.js → chunk-IX6DQDRE.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-ZZCZ3RJU.js → chunk-IXEXMODE.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-XHOWI6QG.js → chunk-KBSO4UER.js} +101 -128
- package/dist/wallets/walletConnectors/{chunk-2KHZAE46.js → chunk-MRFTCMBN.js} +13 -8
- package/dist/wallets/walletConnectors/chunk-NBEDPUHX.js +91 -0
- package/dist/wallets/walletConnectors/{chunk-NHP6D6AH.js → chunk-O47OQDRJ.js} +2 -2
- package/dist/wallets/walletConnectors/{chunk-UJGFYQEV.js → chunk-OA57GKKV.js} +66 -11
- package/dist/wallets/walletConnectors/{chunk-TS466TDR.js → chunk-OTES5NGR.js} +5 -5
- package/dist/wallets/walletConnectors/chunk-PGOYWXV2.js +874 -0
- package/dist/wallets/walletConnectors/{chunk-64TRAZ6V.js → chunk-QA3NATYL.js} +13 -8
- package/dist/wallets/walletConnectors/{chunk-IUHZ5ZCE.js → chunk-QHCLOJYA.js} +3 -6
- package/dist/wallets/walletConnectors/chunk-RS36ZX4P.js +36 -0
- package/dist/wallets/walletConnectors/{chunk-FWYVBX5F.js → chunk-W7EGSTIU.js} +12 -16
- package/dist/wallets/walletConnectors/chunk-YWP2ASJM.js +71 -0
- package/dist/wallets/walletConnectors/{chunk-PPYBE5TV.js → chunk-ZQJIAY3X.js} +15 -5
- package/dist/wallets/walletConnectors/{chunk-A2AVZXFM.js → chunk-ZTNC64G5.js} +61 -156
- 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 +60 -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/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 +1 -1
- package/dist/Arc-YV22FANA.js +0 -8
- package/dist/Brave-VWDHFYI5.js +0 -8
- package/dist/Browser-2ZOVSFMK.js +0 -8
- package/dist/Chrome-VL7CYHGL.js +0 -8
- package/dist/Edge-6GQGEL5X.js +0 -8
- package/dist/Firefox-SY6PCZK3.js +0 -8
- package/dist/Linux-OP3H6PHU.js +0 -8
- package/dist/Macos-ZENZDYKP.js +0 -8
- package/dist/Opera-H2VDEHSS.js +0 -8
- package/dist/Safari-5BYQNFM3.js +0 -8
- package/dist/Windows-PHGTMIC7.js +0 -8
- package/dist/abcWallet-2SXWQ2M6.js +0 -184
- package/dist/abcWallet-3CKLCZZC.js +0 -184
- package/dist/abcWallet-3E6Y5QS4.js +0 -184
- package/dist/abcWallet-3HKYSDOS.js +0 -184
- package/dist/abcWallet-4Y7KXZBE.js +0 -184
- package/dist/abcWallet-6M2KDUY5.js +0 -184
- package/dist/abcWallet-6VIUP4H3.js +0 -184
- package/dist/abcWallet-7CXDTXHX.js +0 -184
- package/dist/abcWallet-A3PX6AEW.js +0 -184
- package/dist/abcWallet-A6CRIFP2.js +0 -184
- package/dist/abcWallet-ACAOT2F3.js +0 -184
- package/dist/abcWallet-AWALYVJ7.js +0 -184
- package/dist/abcWallet-BUUIREII.js +0 -184
- package/dist/abcWallet-CEW3E2AX.js +0 -184
- package/dist/abcWallet-CEZAQ3ES.js +0 -184
- package/dist/abcWallet-CURD64AW.js +0 -184
- package/dist/abcWallet-DRHY5BUW.js +0 -184
- package/dist/abcWallet-E2A433S3.js +0 -184
- package/dist/abcWallet-ER37COEQ.js +0 -184
- package/dist/abcWallet-ETWMKZKD.js +0 -184
- package/dist/abcWallet-F6JAVHHQ.js +0 -184
- package/dist/abcWallet-GEHOIOZN.js +0 -184
- package/dist/abcWallet-H22OANDE.js +0 -184
- package/dist/abcWallet-H4S47MXU.js +0 -184
- package/dist/abcWallet-H5BBPLGS.js +0 -184
- package/dist/abcWallet-I5BENZSH.js +0 -184
- package/dist/abcWallet-KBANX52Y.js +0 -8
- package/dist/abcWallet-KPGRZYCP.js +0 -184
- package/dist/abcWallet-KWKFWA2B.js +0 -184
- package/dist/abcWallet-LABFRLNR.js +0 -184
- package/dist/abcWallet-LSRIJG4P.js +0 -184
- package/dist/abcWallet-MB2IAXV5.js +0 -184
- package/dist/abcWallet-MH6OGFBO.js +0 -184
- package/dist/abcWallet-NJGYOH52.js +0 -184
- package/dist/abcWallet-NTVWBYWF.js +0 -184
- package/dist/abcWallet-OG6ZQORS.js +0 -184
- package/dist/abcWallet-OJ7VCWHZ.js +0 -184
- package/dist/abcWallet-OQWH4ES2.js +0 -184
- package/dist/abcWallet-PBEQA5UT.js +0 -184
- package/dist/abcWallet-PMJEDGRW.js +0 -184
- package/dist/abcWallet-PP2WTSDI.js +0 -184
- package/dist/abcWallet-S7EO644R.js +0 -184
- package/dist/abcWallet-SX35BIXB.js +0 -184
- package/dist/abcWallet-TQTXUPJZ.js +0 -184
- package/dist/abcWallet-U5ZRWNFY.js +0 -184
- package/dist/abcWallet-UHMZ3SBV.js +0 -184
- package/dist/abcWallet-VKVKBQYN.js +0 -184
- package/dist/abcWallet-VSM7O7LO.js +0 -184
- package/dist/abcWallet-W6OZE7QD.js +0 -184
- package/dist/abcWallet-WH2J2YAV.js +0 -184
- package/dist/abcWallet-X2GWIVEI.js +0 -184
- package/dist/abcWallet-X7NZ6VBW.js +0 -180
- package/dist/abcWallet-XA5DX7XK.js +0 -184
- package/dist/abcWallet-XANCTLMU.js +0 -184
- package/dist/abcWallet-XDP764EW.js +0 -184
- package/dist/abcWallet-Y3DONK5H.js +0 -184
- package/dist/abcWallet-YLBGJ5K6.js +0 -184
- package/dist/abcWallet-YOPLVWVE.js +0 -184
- package/dist/abcWallet-ZSL4HH7M.js +0 -184
- package/dist/ar_AR-MAB4J7H2.js +0 -8
- package/dist/arbitrum-27LBECSN.js +0 -8
- package/dist/argentWallet-GX5VSJWF.js +0 -8
- package/dist/assets-GIFIMHMU.js +0 -8
- package/dist/avalanche-KSIA64PC.js +0 -8
- package/dist/base-SIBF7BBU.js +0 -8
- package/dist/berasigWallet-JO4Q4MSU.js +0 -8
- package/dist/bestWallet-LTW5DIP4.js +0 -8
- package/dist/bifrostWallet-JL6ZAC3C.js +0 -8
- package/dist/binanceWallet-ZNNDYS5Q.js +0 -8
- package/dist/bitgetWallet-A4DL5PUY.js +0 -8
- package/dist/bitskiWallet-274FSC74.js +0 -8
- package/dist/bitverseWallet-7DVG7NHE.js +0 -8
- package/dist/blast-RE46OGNS.js +0 -8
- package/dist/bloomWallet-DOYLILHG.js +0 -8
- package/dist/braveWallet-YZYG53SC.js +0 -8
- package/dist/bsc-LKNCKWB7.js +0 -8
- package/dist/bybitWallet-SZ7ZIJOM.js +0 -8
- package/dist/celo-3UGAQ3FA.js +0 -8
- package/dist/chunk-2D6TXDN2.js +0 -7450
- package/dist/chunk-3K7INMEV.js +0 -7470
- package/dist/chunk-5FE4YAGR.js +0 -7423
- package/dist/chunk-5LD4QGWP.js +0 -7423
- package/dist/chunk-5NAGRWKN.js +0 -6991
- package/dist/chunk-64RMUCRE.js +0 -7447
- package/dist/chunk-6KTOC6CY.js +0 -7464
- package/dist/chunk-6QW7GFF5.js +0 -7450
- package/dist/chunk-6RCVLZFG.js +0 -7462
- package/dist/chunk-7Y3M3LG3.js +0 -7446
- package/dist/chunk-A3EBU637.js +0 -7441
- package/dist/chunk-A73PPSQU.js +0 -6842
- package/dist/chunk-AIBVBASK.js +0 -35
- package/dist/chunk-BVBWXZCX.js +0 -7450
- package/dist/chunk-CAXCHVY2.js +0 -7469
- package/dist/chunk-CBJW7X7O.js +0 -7382
- package/dist/chunk-CD36XA5S.js +0 -7417
- package/dist/chunk-DFWCI4QG.js +0 -326
- package/dist/chunk-DKA3NVFM.js +0 -8497
- package/dist/chunk-EAKUQPJO.js +0 -7463
- package/dist/chunk-EGN5IX3Q.js +0 -6817
- package/dist/chunk-ER7H33CO.js +0 -7450
- package/dist/chunk-FCENPWP5.js +0 -7452
- package/dist/chunk-FPMB7NJE.js +0 -7366
- package/dist/chunk-GG57EUYL.js +0 -7132
- package/dist/chunk-GWIJVQBX.js +0 -7420
- package/dist/chunk-HGOFSTGT.js +0 -7474
- package/dist/chunk-HSRSDVH7.js +0 -6817
- package/dist/chunk-IAY4522B.js +0 -6894
- package/dist/chunk-J6OAJTP7.js +0 -6818
- package/dist/chunk-JJ4CTD2J.js +0 -7428
- package/dist/chunk-JMBGLDYV.js +0 -7368
- package/dist/chunk-JSDMSWIV.js +0 -6631
- package/dist/chunk-JSDVJD3R.js +0 -6834
- package/dist/chunk-KBMHNBKL.js +0 -7449
- package/dist/chunk-KZRFIJW2.js +0 -7452
- package/dist/chunk-KZZG24U5.js +0 -7015
- package/dist/chunk-L46ONWXN.js +0 -6880
- package/dist/chunk-L6TCA4IF.js +0 -7378
- package/dist/chunk-LTRXFRER.js +0 -7472
- package/dist/chunk-MLJXZ6R2.js +0 -7130
- package/dist/chunk-MRLTYAPE.js +0 -7451
- package/dist/chunk-N3QOWEYR.js +0 -7393
- package/dist/chunk-NII34OZB.js +0 -7442
- package/dist/chunk-NWF5NI55.js +0 -7130
- package/dist/chunk-OAHLI7TU.js +0 -7368
- package/dist/chunk-OJUAVARC.js +0 -6880
- package/dist/chunk-QNZ5HSPM.js +0 -8339
- package/dist/chunk-RFJBWB7F.js +0 -7467
- package/dist/chunk-RQ637EP3.js +0 -224
- package/dist/chunk-SBRDMKB6.js +0 -7408
- package/dist/chunk-SDRSLETV.js +0 -7428
- package/dist/chunk-SWO7BZQD.js +0 -7463
- package/dist/chunk-TR4Q6WOC.js +0 -7427
- package/dist/chunk-UBBAWTXE.js +0 -7370
- package/dist/chunk-VE53ZNZV.js +0 -331
- package/dist/chunk-VEOSJOVN.js +0 -7377
- package/dist/chunk-VGF34W25.js +0 -7370
- package/dist/chunk-VXSGQUAL.js +0 -7458
- package/dist/chunk-Z3FKXPV6.js +0 -7430
- package/dist/chunk-ZRBHEE5W.js +0 -7130
- package/dist/clvWallet-AW3FLKWV.js +0 -8
- package/dist/coin98Wallet-O6REX7DQ.js +0 -8
- package/dist/coinbaseWallet-LVQLZHBK.js +0 -8
- package/dist/compassWallet-65OSMTR2.js +0 -8
- package/dist/connect-CICKFS4L.js +0 -8
- package/dist/coreWallet-YSDA53EY.js +0 -8
- package/dist/create-5SJIEM24.js +0 -8
- package/dist/cronos-ZQWFYR7X.js +0 -8
- package/dist/dawnWallet-J36CF4FH.js +0 -8
- package/dist/de_DE-EG7KMNLA.js +0 -8
- package/dist/desigWallet-XGQ7234L.js +0 -8
- package/dist/en_US-FB5NGCIS.js +0 -8
- package/dist/enkryptWallet-ROHOLP4S.js +0 -8
- package/dist/es_419-3B34TR7B.js +0 -8
- package/dist/ethereum-EQ5JF37Q.js +0 -8
- package/dist/flow-SZDAO7RI.js +0 -8
- package/dist/foxWallet-3N4ERZ2Y.js +0 -8
- package/dist/fr_FR-R75UI3J6.js +0 -1356
- package/dist/frameWallet-AIE2VFHW.js +0 -8
- package/dist/frontierWallet-VZSDJHLV.js +0 -8
- package/dist/gateWallet-T2EK3VMK.js +0 -8
- package/dist/gnosis-JNLUBWJA.js +0 -8
- package/dist/hardhat-ZXHXXZ4F.js +0 -8
- package/dist/hi_IN-UE2ZBDLM.js +0 -8
- package/dist/hooks/useSolSignMessage.d.ts +0 -17
- package/dist/hooks/useSolSignTransaction.d.ts +0 -20
- package/dist/id_ID-WQSMTXEJ.js +0 -8
- package/dist/imTokenWallet-EZIOYBYU.js +0 -8
- package/dist/injectedWallet-AKTBXQHX.js +0 -8
- package/dist/iopayWallet-W7H23ECM.js +0 -8
- package/dist/ja_JP-O4XT7PNY.js +0 -8
- package/dist/kaia-LDZMGDTS.js +0 -8
- package/dist/kaiaWallet-IIGUMKV2.js +0 -8
- package/dist/kaikasWallet-XFICIF6T.js +0 -8
- package/dist/klipWallet-RD5Y4UEK.js +0 -8
- package/dist/ko_KR-7DRM32ZL.js +0 -8
- package/dist/krakenWallet-JQX7ML3V.js +0 -8
- package/dist/kresusWallet-X76YOSCS.js +0 -8
- package/dist/ledgerWallet-LUOIK2NO.js +0 -8
- package/dist/login-L2V76XPP.js +0 -8
- package/dist/magicEden-PNA2N7LE.js +0 -8
- package/dist/manta-AXWSHRGV.js +0 -8
- package/dist/mantle-I27DZFXF.js +0 -8
- package/dist/metaMaskWallet-ZOW7SFN3.js +0 -8
- package/dist/mewWallet-NNOKYJGO.js +0 -8
- package/dist/ms_MY-QJAJAMMS.js +0 -8
- package/dist/nestWallet-PJ4UAPAM.js +0 -8
- package/dist/oktoWallet-IPI4NUPS.js +0 -8
- package/dist/okxWallet-BKIE62N5.js +0 -8
- package/dist/omniWallet-5MXTZQTD.js +0 -8
- package/dist/oneInchWallet-SUMUIBDE.js +0 -8
- package/dist/oneKeyWallet-W7XOJBFP.js +0 -8
- package/dist/optimism-7KW4YXCD.js +0 -8
- package/dist/paraSwapWallet-O7YFTXSA.js +0 -8
- package/dist/phantomWallet-JL7CK5LT.js +0 -8
- package/dist/polygon-O6VNIW2F.js +0 -8
- package/dist/pt_BR-CUVZKVMO.js +0 -8
- package/dist/rabbyWallet-QZAAFNR5.js +0 -8
- package/dist/rainbowWallet-3H5RIOTG.js +0 -8
- package/dist/ramperWallet-PADEB35A.js +0 -8
- package/dist/refresh-HBSYGKAX.js +0 -8
- package/dist/ronin-NIBR3M4Q.js +0 -8
- package/dist/roninWallet-VBWRYBSY.js +0 -8
- package/dist/ru_RU-DLZ46RWL.js +0 -1356
- package/dist/safeWallet-5S6VLRXL.js +0 -8
- package/dist/safeheronWallet-PK6H4FAC.js +0 -8
- package/dist/safepalWallet-OG53AE3J.js +0 -8
- package/dist/scan-QFKMQ54Z.js +0 -8
- package/dist/scroll-7LCBO5E3.js +0 -8
- package/dist/secure-4HM7LOQ7.js +0 -8
- package/dist/secure-AEBFSVWE.js +0 -8
- package/dist/secure-I6UQYL5P.js +0 -8
- package/dist/secure-X6ZSGFOB.js +0 -8
- package/dist/seifWallet-W5POSWSQ.js +0 -8
- package/dist/services/AbcAgenticWalletService.d.ts +0 -111
- package/dist/sign-TGZ6C3LW.js +0 -8
- package/dist/subWallet-EMI73DDU.js +0 -8
- package/dist/tahoWallet-BI5WGGIE.js +0 -8
- package/dist/talismanWallet-FSJ7PIII.js +0 -8
- package/dist/th_TH-AXZSCUYS.js +0 -1356
- package/dist/tokenPocketWallet-24CJ7CMD.js +0 -8
- package/dist/tokenaryWallet-253RCSOV.js +0 -8
- package/dist/tr_TR-WUMEEWNJ.js +0 -1356
- package/dist/trustWallet-2I5U2KE2.js +0 -8
- package/dist/uk_UA-BVWUMQ6Z.js +0 -1356
- package/dist/uniswapWallet-G4F52I6Y.js +0 -8
- package/dist/valoraWallet-JEACHQB4.js +0 -8
- package/dist/vi_VN-AI2OTA4F.js +0 -8
- package/dist/walletConnectWallet-NRHPTNNN.js +0 -8
- package/dist/wallets/walletConnectors/abcWallet/api/SigningApi.d.ts +0 -28
- package/dist/wallets/walletConnectors/abcWallet/api/SigningApi.js +0 -13
- package/dist/wallets/walletConnectors/abcWallet/secure.d.ts +0 -31
- package/dist/wallets/walletConnectors/abcWallet/secure.js +0 -8
- package/dist/wallets/walletConnectors/chunk-2FUWP3CE.js +0 -330
- package/dist/wallets/walletConnectors/chunk-2GNL2GNB.js +0 -154
- package/dist/wallets/walletConnectors/chunk-2HAU36T2.js +0 -330
- package/dist/wallets/walletConnectors/chunk-2HZI5GNW.js +0 -422
- package/dist/wallets/walletConnectors/chunk-2NAY6X3G.js +0 -280
- package/dist/wallets/walletConnectors/chunk-2NHQTZGS.js +0 -276
- package/dist/wallets/walletConnectors/chunk-2NVHWZUE.js +0 -436
- package/dist/wallets/walletConnectors/chunk-2OTYM5YW.js +0 -461
- package/dist/wallets/walletConnectors/chunk-2PVZZB7V.js +0 -179
- package/dist/wallets/walletConnectors/chunk-2QBCWLD2.js +0 -207
- package/dist/wallets/walletConnectors/chunk-2SKUK3XZ.js +0 -336
- package/dist/wallets/walletConnectors/chunk-2THGB26Q.js +0 -483
- package/dist/wallets/walletConnectors/chunk-353AHAZG.js +0 -420
- package/dist/wallets/walletConnectors/chunk-36J4NGMW.js +0 -276
- package/dist/wallets/walletConnectors/chunk-3AV4L2Z3.js +0 -63
- package/dist/wallets/walletConnectors/chunk-3CTIR723.js +0 -47
- package/dist/wallets/walletConnectors/chunk-3DMYAF74.js +0 -495
- package/dist/wallets/walletConnectors/chunk-3EVUNPYA.js +0 -63
- package/dist/wallets/walletConnectors/chunk-3WLUH24A.js +0 -63
- package/dist/wallets/walletConnectors/chunk-45FLFWVV.js +0 -473
- package/dist/wallets/walletConnectors/chunk-4JRATGCT.js +0 -484
- package/dist/wallets/walletConnectors/chunk-4PCVQBFZ.js +0 -667
- package/dist/wallets/walletConnectors/chunk-4Q7XTNTE.js +0 -63
- package/dist/wallets/walletConnectors/chunk-4RMNGZR2.js +0 -253
- package/dist/wallets/walletConnectors/chunk-4SAGH6IS.js +0 -63
- package/dist/wallets/walletConnectors/chunk-4SCX34NL.js +0 -276
- package/dist/wallets/walletConnectors/chunk-53LPTQ6J.js +0 -309
- package/dist/wallets/walletConnectors/chunk-57YTMSPW.js +0 -63
- package/dist/wallets/walletConnectors/chunk-5AL2CK6V.js +0 -336
- package/dist/wallets/walletConnectors/chunk-5CZGFT24.js +0 -63
- package/dist/wallets/walletConnectors/chunk-5FSXV7UD.js +0 -63
- package/dist/wallets/walletConnectors/chunk-5JHX6GDO.js +0 -63
- package/dist/wallets/walletConnectors/chunk-5JIPWC5W.js +0 -272
- package/dist/wallets/walletConnectors/chunk-5K45TCAM.js +0 -333
- package/dist/wallets/walletConnectors/chunk-5LPD35BU.js +0 -63
- package/dist/wallets/walletConnectors/chunk-5QGNWYOO.js +0 -63
- package/dist/wallets/walletConnectors/chunk-5RSS3SRV.js +0 -477
- package/dist/wallets/walletConnectors/chunk-5XORKEWE.js +0 -326
- package/dist/wallets/walletConnectors/chunk-63WBO52A.js +0 -77
- package/dist/wallets/walletConnectors/chunk-664WS6CQ.js +0 -267
- package/dist/wallets/walletConnectors/chunk-6BAXMYSN.js +0 -345
- package/dist/wallets/walletConnectors/chunk-6I7AIIUA.js +0 -330
- package/dist/wallets/walletConnectors/chunk-6MSXHRIK.js +0 -47
- package/dist/wallets/walletConnectors/chunk-7MOCKWA7.js +0 -1729
- package/dist/wallets/walletConnectors/chunk-7TYZCXIR.js +0 -63
- package/dist/wallets/walletConnectors/chunk-7UIXGYOT.js +0 -269
- package/dist/wallets/walletConnectors/chunk-7UQQKSV7.js +0 -47
- package/dist/wallets/walletConnectors/chunk-7VZDITAJ.js +0 -330
- package/dist/wallets/walletConnectors/chunk-A4WR3CFN.js +0 -130
- package/dist/wallets/walletConnectors/chunk-A7FIBI6X.js +0 -147
- package/dist/wallets/walletConnectors/chunk-AB6IIS4Y.js +0 -359
- package/dist/wallets/walletConnectors/chunk-AB6NV5DJ.js +0 -469
- package/dist/wallets/walletConnectors/chunk-AF4OCS7N.js +0 -46
- package/dist/wallets/walletConnectors/chunk-AFWBXEEC.js +0 -66
- package/dist/wallets/walletConnectors/chunk-AGC7JS5M.js +0 -47
- package/dist/wallets/walletConnectors/chunk-AIKTQX6B.js +0 -194
- package/dist/wallets/walletConnectors/chunk-AO24PU7X.js +0 -104
- package/dist/wallets/walletConnectors/chunk-APLOMU6R.js +0 -47
- package/dist/wallets/walletConnectors/chunk-AUGP2LJR.js +0 -182
- package/dist/wallets/walletConnectors/chunk-AYAW5CRA.js +0 -459
- package/dist/wallets/walletConnectors/chunk-AZAV5URB.js +0 -267
- package/dist/wallets/walletConnectors/chunk-B56IHEUP.js +0 -179
- package/dist/wallets/walletConnectors/chunk-B6GPEHW7.js +0 -47
- package/dist/wallets/walletConnectors/chunk-BCO6YLPB.js +0 -505
- package/dist/wallets/walletConnectors/chunk-BH2VZAMQ.js +0 -259
- package/dist/wallets/walletConnectors/chunk-BK65Y46D.js +0 -494
- package/dist/wallets/walletConnectors/chunk-BKJVG4GQ.js +0 -463
- package/dist/wallets/walletConnectors/chunk-BLEKTKBN.js +0 -479
- package/dist/wallets/walletConnectors/chunk-BO6OI7XU.js +0 -63
- package/dist/wallets/walletConnectors/chunk-BV3DCJXA.js +0 -276
- package/dist/wallets/walletConnectors/chunk-BVL6G5HI.js +0 -1757
- package/dist/wallets/walletConnectors/chunk-CMJ4DIIQ.js +0 -63
- package/dist/wallets/walletConnectors/chunk-CNRPEVLV.js +0 -305
- package/dist/wallets/walletConnectors/chunk-COPAK5YT.js +0 -345
- package/dist/wallets/walletConnectors/chunk-CZ7WCJW5.js +0 -63
- package/dist/wallets/walletConnectors/chunk-CZVBS7QE.js +0 -436
- package/dist/wallets/walletConnectors/chunk-D3USECVX.js +0 -333
- package/dist/wallets/walletConnectors/chunk-DA5J6GHZ.js +0 -484
- package/dist/wallets/walletConnectors/chunk-DCBHTSF2.js +0 -63
- package/dist/wallets/walletConnectors/chunk-DCW43Y5T.js +0 -190
- package/dist/wallets/walletConnectors/chunk-DJKN2MCI.js +0 -179
- package/dist/wallets/walletConnectors/chunk-DM5NLSWD.js +0 -346
- package/dist/wallets/walletConnectors/chunk-DNSC37SU.js +0 -47
- package/dist/wallets/walletConnectors/chunk-DNYWTUT5.js +0 -63
- package/dist/wallets/walletConnectors/chunk-DSTCYPGN.js +0 -314
- package/dist/wallets/walletConnectors/chunk-DWPUUKA4.js +0 -63
- package/dist/wallets/walletConnectors/chunk-E33VQYPO.js +0 -302
- package/dist/wallets/walletConnectors/chunk-EBBETASF.js +0 -424
- package/dist/wallets/walletConnectors/chunk-EBGI4D2T.js +0 -69
- package/dist/wallets/walletConnectors/chunk-EEH2HMFG.js +0 -47
- package/dist/wallets/walletConnectors/chunk-EN5R4RRF.js +0 -47
- package/dist/wallets/walletConnectors/chunk-F5BORFRG.js +0 -63
- package/dist/wallets/walletConnectors/chunk-F5JWDBKK.js +0 -47
- package/dist/wallets/walletConnectors/chunk-FCRLSDVW.js +0 -513
- package/dist/wallets/walletConnectors/chunk-FEUW4SKR.js +0 -63
- package/dist/wallets/walletConnectors/chunk-FKPSLKA7.js +0 -63
- package/dist/wallets/walletConnectors/chunk-FLCBPO5T.js +0 -276
- package/dist/wallets/walletConnectors/chunk-FMDSZ2CE.js +0 -63
- package/dist/wallets/walletConnectors/chunk-FQTLYAWT.js +0 -194
- package/dist/wallets/walletConnectors/chunk-FTGER5ZB.js +0 -196
- package/dist/wallets/walletConnectors/chunk-FUOQBONI.js +0 -47
- package/dist/wallets/walletConnectors/chunk-FWCS4HBL.js +0 -1695
- package/dist/wallets/walletConnectors/chunk-FY7UDC3W.js +0 -63
- package/dist/wallets/walletConnectors/chunk-GH6ZDY4K.js +0 -58
- package/dist/wallets/walletConnectors/chunk-GIJZMIBD.js +0 -63
- package/dist/wallets/walletConnectors/chunk-GMEXP6OH.js +0 -314
- package/dist/wallets/walletConnectors/chunk-GYJYTYIG.js +0 -63
- package/dist/wallets/walletConnectors/chunk-GZFBNALD.js +0 -47
- package/dist/wallets/walletConnectors/chunk-GZUP3M2X.js +0 -63
- package/dist/wallets/walletConnectors/chunk-H52W4ZFE.js +0 -272
- package/dist/wallets/walletConnectors/chunk-HB7QT3ZB.js +0 -332
- package/dist/wallets/walletConnectors/chunk-HDXQ7BO6.js +0 -314
- package/dist/wallets/walletConnectors/chunk-HEQZLRTH.js +0 -309
- package/dist/wallets/walletConnectors/chunk-HFC4AK72.js +0 -194
- package/dist/wallets/walletConnectors/chunk-HIRSPIIU.js +0 -1760
- package/dist/wallets/walletConnectors/chunk-HJFZF4V3.js +0 -276
- package/dist/wallets/walletConnectors/chunk-HKIV22NT.js +0 -63
- package/dist/wallets/walletConnectors/chunk-HKXBK3NY.js +0 -75
- package/dist/wallets/walletConnectors/chunk-HLC24OGS.js +0 -63
- package/dist/wallets/walletConnectors/chunk-HMD2WWFQ.js +0 -75
- package/dist/wallets/walletConnectors/chunk-HO5Z2CTL.js +0 -280
- package/dist/wallets/walletConnectors/chunk-HQQESMZJ.js +0 -299
- package/dist/wallets/walletConnectors/chunk-HTD7IRKM.js +0 -345
- package/dist/wallets/walletConnectors/chunk-HWWFK52B.js +0 -63
- package/dist/wallets/walletConnectors/chunk-HYADQWNX.js +0 -47
- package/dist/wallets/walletConnectors/chunk-I56RJQOO.js +0 -63
- package/dist/wallets/walletConnectors/chunk-IKAN72JZ.js +0 -253
- package/dist/wallets/walletConnectors/chunk-IL4WOWNJ.js +0 -327
- package/dist/wallets/walletConnectors/chunk-IQJWD4IN.js +0 -269
- package/dist/wallets/walletConnectors/chunk-IZUAJRJ4.js +0 -311
- package/dist/wallets/walletConnectors/chunk-J6VUIOSE.js +0 -314
- package/dist/wallets/walletConnectors/chunk-JH2SJPEY.js +0 -63
- package/dist/wallets/walletConnectors/chunk-JKDAQWPW.js +0 -47
- package/dist/wallets/walletConnectors/chunk-JODNZWWG.js +0 -330
- package/dist/wallets/walletConnectors/chunk-JQ57SCY6.js +0 -313
- package/dist/wallets/walletConnectors/chunk-JTST3KMW.js +0 -75
- package/dist/wallets/walletConnectors/chunk-JW3YCANT.js +0 -464
- package/dist/wallets/walletConnectors/chunk-JY4WWUAC.js +0 -503
- package/dist/wallets/walletConnectors/chunk-K42FR6F7.js +0 -513
- package/dist/wallets/walletConnectors/chunk-K7WCM7JL.js +0 -513
- package/dist/wallets/walletConnectors/chunk-KB7OGAUC.js +0 -484
- package/dist/wallets/walletConnectors/chunk-KH2L3ONV.js +0 -1599
- package/dist/wallets/walletConnectors/chunk-KIKTI2QW.js +0 -313
- package/dist/wallets/walletConnectors/chunk-KKCRCQNN.js +0 -276
- package/dist/wallets/walletConnectors/chunk-KLQJJI76.js +0 -215
- package/dist/wallets/walletConnectors/chunk-KPXEV65I.js +0 -481
- package/dist/wallets/walletConnectors/chunk-KXEAFXAA.js +0 -226
- package/dist/wallets/walletConnectors/chunk-KXRUCXYG.js +0 -63
- package/dist/wallets/walletConnectors/chunk-L2ICV2P2.js +0 -276
- package/dist/wallets/walletConnectors/chunk-L3ZUQ2FT.js +0 -494
- package/dist/wallets/walletConnectors/chunk-LHV22375.js +0 -182
- package/dist/wallets/walletConnectors/chunk-LKM4HFVX.js +0 -63
- package/dist/wallets/walletConnectors/chunk-LKSMH5O4.js +0 -63
- package/dist/wallets/walletConnectors/chunk-LLWI2QWC.js +0 -1689
- package/dist/wallets/walletConnectors/chunk-LQ2U33WM.js +0 -306
- package/dist/wallets/walletConnectors/chunk-LQWC2NEM.js +0 -63
- package/dist/wallets/walletConnectors/chunk-LVODOLXE.js +0 -47
- package/dist/wallets/walletConnectors/chunk-M7KXDTM6.js +0 -484
- package/dist/wallets/walletConnectors/chunk-MGCRUAHX.js +0 -276
- package/dist/wallets/walletConnectors/chunk-MKAXMNZM.js +0 -156
- package/dist/wallets/walletConnectors/chunk-MNRRJSFM.js +0 -272
- package/dist/wallets/walletConnectors/chunk-MOQSXFIP.js +0 -47
- package/dist/wallets/walletConnectors/chunk-MPFE6GP2.js +0 -306
- package/dist/wallets/walletConnectors/chunk-MPNSYA4E.js +0 -156
- package/dist/wallets/walletConnectors/chunk-MSK4NN2E.js +0 -47
- package/dist/wallets/walletConnectors/chunk-MURSKRMJ.js +0 -63
- package/dist/wallets/walletConnectors/chunk-NDLQSZ2F.js +0 -63
- package/dist/wallets/walletConnectors/chunk-NDYGTKP5.js +0 -115
- package/dist/wallets/walletConnectors/chunk-NG7PSAPX.js +0 -115
- package/dist/wallets/walletConnectors/chunk-NLBRSN6Q.js +0 -63
- package/dist/wallets/walletConnectors/chunk-NPF7NOA7.js +0 -1729
- package/dist/wallets/walletConnectors/chunk-NSAHMWXK.js +0 -468
- package/dist/wallets/walletConnectors/chunk-NUAZNCMH.js +0 -1590
- package/dist/wallets/walletConnectors/chunk-NUJ6VD2U.js +0 -223
- package/dist/wallets/walletConnectors/chunk-NY2MBDVO.js +0 -276
- package/dist/wallets/walletConnectors/chunk-NY3HZ7C7.js +0 -428
- package/dist/wallets/walletConnectors/chunk-OA6D52JF.js +0 -303
- package/dist/wallets/walletConnectors/chunk-OBS74J5N.js +0 -221
- package/dist/wallets/walletConnectors/chunk-ODL6WVZK.js +0 -63
- package/dist/wallets/walletConnectors/chunk-OJMVWBYG.js +0 -191
- package/dist/wallets/walletConnectors/chunk-ON4U54WO.js +0 -115
- package/dist/wallets/walletConnectors/chunk-OSJ2GO4U.js +0 -63
- package/dist/wallets/walletConnectors/chunk-OYDALF2T.js +0 -63
- package/dist/wallets/walletConnectors/chunk-P5CZ24LM.js +0 -312
- package/dist/wallets/walletConnectors/chunk-PE6CXY5F.js +0 -513
- package/dist/wallets/walletConnectors/chunk-PER2ACFG.js +0 -443
- package/dist/wallets/walletConnectors/chunk-PGMVGAXJ.js +0 -63
- package/dist/wallets/walletConnectors/chunk-PGPH245S.js +0 -63
- package/dist/wallets/walletConnectors/chunk-PNE3IGZM.js +0 -63
- package/dist/wallets/walletConnectors/chunk-PPTSQD3J.js +0 -276
- package/dist/wallets/walletConnectors/chunk-PQDQUIIL.js +0 -276
- package/dist/wallets/walletConnectors/chunk-PSRATZTN.js +0 -47
- package/dist/wallets/walletConnectors/chunk-PWWSAM4G.js +0 -309
- package/dist/wallets/walletConnectors/chunk-Q2WYW3LQ.js +0 -63
- package/dist/wallets/walletConnectors/chunk-Q3KCTIZB.js +0 -458
- package/dist/wallets/walletConnectors/chunk-Q3W2LKFS.js +0 -498
- package/dist/wallets/walletConnectors/chunk-QAD7DCJI.js +0 -473
- package/dist/wallets/walletConnectors/chunk-QB5GDLRU.js +0 -330
- package/dist/wallets/walletConnectors/chunk-QCIIXMAZ.js +0 -309
- package/dist/wallets/walletConnectors/chunk-QELXKYHW.js +0 -196
- package/dist/wallets/walletConnectors/chunk-QG6HVKA7.js +0 -458
- package/dist/wallets/walletConnectors/chunk-QHCY3K35.js +0 -466
- package/dist/wallets/walletConnectors/chunk-QHRV2IC7.js +0 -63
- package/dist/wallets/walletConnectors/chunk-QOZL4BMA.js +0 -513
- package/dist/wallets/walletConnectors/chunk-QWEA3UTQ.js +0 -313
- package/dist/wallets/walletConnectors/chunk-QYUVI6LM.js +0 -500
- package/dist/wallets/walletConnectors/chunk-RCI7QYCZ.js +0 -221
- package/dist/wallets/walletConnectors/chunk-RFNPDZJ5.js +0 -299
- package/dist/wallets/walletConnectors/chunk-RGIB7FFH.js +0 -47
- package/dist/wallets/walletConnectors/chunk-RHQXGWIW.js +0 -223
- package/dist/wallets/walletConnectors/chunk-RPOLRZ4N.js +0 -276
- package/dist/wallets/walletConnectors/chunk-RQIUWXDF.js +0 -45
- package/dist/wallets/walletConnectors/chunk-RWJX5CRR.js +0 -276
- package/dist/wallets/walletConnectors/chunk-S6LSALLS.js +0 -47
- package/dist/wallets/walletConnectors/chunk-SCD35IRD.js +0 -485
- package/dist/wallets/walletConnectors/chunk-SOBJYYIX.js +0 -484
- package/dist/wallets/walletConnectors/chunk-SOCVQ5N3.js +0 -156
- package/dist/wallets/walletConnectors/chunk-SUBWGTWM.js +0 -459
- package/dist/wallets/walletConnectors/chunk-T3KJ4NFX.js +0 -276
- package/dist/wallets/walletConnectors/chunk-T66U3ADD.js +0 -58
- package/dist/wallets/walletConnectors/chunk-TASM5LUN.js +0 -276
- package/dist/wallets/walletConnectors/chunk-THCKLFSJ.js +0 -75
- package/dist/wallets/walletConnectors/chunk-TTRSCIGA.js +0 -194
- package/dist/wallets/walletConnectors/chunk-TYUEB4VT.js +0 -477
- package/dist/wallets/walletConnectors/chunk-U4DSASHD.js +0 -63
- package/dist/wallets/walletConnectors/chunk-URJDAG63.js +0 -190
- package/dist/wallets/walletConnectors/chunk-UTRMKLD5.js +0 -1683
- package/dist/wallets/walletConnectors/chunk-UWC6AXPI.js +0 -63
- package/dist/wallets/walletConnectors/chunk-UX4IUIRD.js +0 -515
- package/dist/wallets/walletConnectors/chunk-UXNEBBUV.js +0 -224
- package/dist/wallets/walletConnectors/chunk-UYFNIOUH.js +0 -475
- package/dist/wallets/walletConnectors/chunk-UZXTNCDO.js +0 -330
- package/dist/wallets/walletConnectors/chunk-V33I7JGZ.js +0 -156
- package/dist/wallets/walletConnectors/chunk-V4Q3GNBX.js +0 -484
- package/dist/wallets/walletConnectors/chunk-V5LV4P2L.js +0 -63
- package/dist/wallets/walletConnectors/chunk-VCCTIYUJ.js +0 -63
- package/dist/wallets/walletConnectors/chunk-VDVBAWB4.js +0 -1670
- package/dist/wallets/walletConnectors/chunk-VETRBBA2.js +0 -216
- package/dist/wallets/walletConnectors/chunk-VGOISIH3.js +0 -223
- package/dist/wallets/walletConnectors/chunk-VP6SWGCN.js +0 -63
- package/dist/wallets/walletConnectors/chunk-VRCNFVPM.js +0 -276
- package/dist/wallets/walletConnectors/chunk-W4MD4LZF.js +0 -464
- package/dist/wallets/walletConnectors/chunk-WCHG2Q2N.js +0 -276
- package/dist/wallets/walletConnectors/chunk-WODNUC65.js +0 -333
- package/dist/wallets/walletConnectors/chunk-X6A2FSHK.js +0 -484
- package/dist/wallets/walletConnectors/chunk-XFGVJOQL.js +0 -223
- package/dist/wallets/walletConnectors/chunk-XHNXMXXX.js +0 -493
- package/dist/wallets/walletConnectors/chunk-XIOPKI2F.js +0 -47
- package/dist/wallets/walletConnectors/chunk-XJ4SP35I.js +0 -485
- package/dist/wallets/walletConnectors/chunk-XKGUE56S.js +0 -226
- package/dist/wallets/walletConnectors/chunk-XKNVF62K.js +0 -276
- package/dist/wallets/walletConnectors/chunk-XQEAXENJ.js +0 -63
- package/dist/wallets/walletConnectors/chunk-XVRNEES5.js +0 -1541
- package/dist/wallets/walletConnectors/chunk-XWVM2Y5A.js +0 -306
- package/dist/wallets/walletConnectors/chunk-XXG7ABSJ.js +0 -328
- package/dist/wallets/walletConnectors/chunk-YCZ4CZQ6.js +0 -280
- package/dist/wallets/walletConnectors/chunk-YDCQB2MV.js +0 -309
- package/dist/wallets/walletConnectors/chunk-YTPAWPCA.js +0 -156
- package/dist/wallets/walletConnectors/chunk-YX4O33NC.js +0 -1590
- package/dist/wallets/walletConnectors/chunk-Z2DC2J7S.js +0 -345
- package/dist/wallets/walletConnectors/chunk-Z2IWGNDA.js +0 -515
- package/dist/wallets/walletConnectors/chunk-Z2K3RHWK.js +0 -47
- package/dist/wallets/walletConnectors/chunk-Z34L5C76.js +0 -1760
- package/dist/wallets/walletConnectors/chunk-Z4LE4R6P.js +0 -63
- package/dist/wallets/walletConnectors/chunk-ZASMSEC3.js +0 -63
- package/dist/wallets/walletConnectors/chunk-ZCSHD7UG.js +0 -562
- package/dist/wallets/walletConnectors/chunk-ZE3USY6D.js +0 -156
- package/dist/wallets/walletConnectors/chunk-ZG4ZZVOW.js +0 -63
- package/dist/wallets/walletConnectors/chunk-ZHHPZPSF.js +0 -489
- package/dist/wallets/walletConnectors/chunk-ZNBWRE3K.js +0 -309
- package/dist/wallets/walletConnectors/chunk-ZNVFM2J2.js +0 -156
- package/dist/wallets/walletConnectors/chunk-ZOJTTG4G.js +0 -63
- package/dist/wallets/walletConnectors/chunk-ZQLQELFC.js +0 -309
- package/dist/wallets/walletConnectors/chunk-ZR7CEF64.js +0 -63
- package/dist/wallets/walletConnectors/chunk-ZSGFDK77.js +0 -63
- package/dist/wallets/walletConnectors/chunk-ZUIY2TRJ.js +0 -1695
- package/dist/wallets/walletConnectors/klipWallet/klipWallet.d.ts +0 -3
- package/dist/wallets/walletConnectors/klipWallet/klipWallet.js +0 -8
- package/dist/wallets/walletConnectors/klipWallet-PPTYYB5G.js +0 -7
- package/dist/wigwamWallet-R4AVGQ5E.js +0 -8
- package/dist/xdc-KO37AHY2.js +0 -8
- package/dist/xdefiWallet-Y273RRLT.js +0 -8
- package/dist/zealWallet-CQHZEJUT.js +0 -8
- package/dist/zerionWallet-67WXXHBG.js +0 -8
- package/dist/zetachain-CULDO7MF.js +0 -8
- package/dist/zh_CN-HBK3E2T5.js +0 -8
- package/dist/zh_HK-ZQP4TGHU.js +0 -8
- package/dist/zh_TW-DSHZXVLV.js +0 -8
- package/dist/zkSync-VZ5E5WP6.js +0 -8
- package/dist/zora-GXTHZKII.js +0 -8
|
@@ -816,90 +816,6 @@ import { createConnector } from "wagmi";
|
|
|
816
816
|
// src/wallets/walletConnectors/abcWallet/abcApi.ts
|
|
817
817
|
init_networks();
|
|
818
818
|
import { getTalkenApiClient } from "@talken/talkenkit";
|
|
819
|
-
import { parseGwei } from "viem";
|
|
820
|
-
|
|
821
|
-
// src/wallets/walletConnectors/abcWallet/networkConfig.ts
|
|
822
|
-
var SolanaNetwork = /* @__PURE__ */ ((SolanaNetwork4) => {
|
|
823
|
-
SolanaNetwork4["Mainnet"] = "solana";
|
|
824
|
-
SolanaNetwork4["Devnet"] = "solana_devnet";
|
|
825
|
-
SolanaNetwork4["Testnet"] = "solana_testnet";
|
|
826
|
-
return SolanaNetwork4;
|
|
827
|
-
})(SolanaNetwork || {});
|
|
828
|
-
var BitcoinNetwork = /* @__PURE__ */ ((BitcoinNetwork2) => {
|
|
829
|
-
BitcoinNetwork2["Mainnet"] = "bitcoin";
|
|
830
|
-
BitcoinNetwork2["Testnet"] = "bitcoin_testnet";
|
|
831
|
-
return BitcoinNetwork2;
|
|
832
|
-
})(BitcoinNetwork || {});
|
|
833
|
-
var TronNetwork = /* @__PURE__ */ ((TronNetwork2) => {
|
|
834
|
-
TronNetwork2["Mainnet"] = "tron";
|
|
835
|
-
TronNetwork2["Nile"] = "tron_nile";
|
|
836
|
-
return TronNetwork2;
|
|
837
|
-
})(TronNetwork || {});
|
|
838
|
-
var DEFAULT_NETWORK_CONFIG = {
|
|
839
|
-
evm: {
|
|
840
|
-
mainnet: 1,
|
|
841
|
-
// Ethereum Mainnet
|
|
842
|
-
testnet: 11155111
|
|
843
|
-
// Sepolia Testnet
|
|
844
|
-
},
|
|
845
|
-
solana: {
|
|
846
|
-
mainnet: "solana" /* Mainnet */,
|
|
847
|
-
devnet: "solana_devnet" /* Devnet */
|
|
848
|
-
},
|
|
849
|
-
bitcoin: {
|
|
850
|
-
mainnet: "bitcoin" /* Mainnet */,
|
|
851
|
-
testnet: "bitcoin_testnet" /* Testnet */
|
|
852
|
-
},
|
|
853
|
-
tron: {
|
|
854
|
-
mainnet: "tron" /* Mainnet */,
|
|
855
|
-
testnet: "tron_nile" /* Nile */
|
|
856
|
-
}
|
|
857
|
-
};
|
|
858
|
-
var globalDefaultChainId;
|
|
859
|
-
var globalDefaultSolanaNetwork;
|
|
860
|
-
var globalDefaultBitcoinNetwork;
|
|
861
|
-
var globalDefaultTronNetwork;
|
|
862
|
-
function setGlobalDefaultChainId(chainId) {
|
|
863
|
-
globalDefaultChainId = chainId;
|
|
864
|
-
}
|
|
865
|
-
function setGlobalDefaultSolanaNetwork(network) {
|
|
866
|
-
globalDefaultSolanaNetwork = network;
|
|
867
|
-
}
|
|
868
|
-
function setGlobalDefaultBitcoinNetwork(network) {
|
|
869
|
-
globalDefaultBitcoinNetwork = network;
|
|
870
|
-
}
|
|
871
|
-
function getEvmNetwork(customChainId) {
|
|
872
|
-
if (customChainId !== void 0) {
|
|
873
|
-
return customChainId;
|
|
874
|
-
}
|
|
875
|
-
if (globalDefaultChainId !== void 0) {
|
|
876
|
-
return globalDefaultChainId;
|
|
877
|
-
}
|
|
878
|
-
const isProduction = typeof process !== "undefined" && process.env.NEXT_PUBLIC_ENVIRONMENT === "production";
|
|
879
|
-
const fallbackChainId = isProduction ? DEFAULT_NETWORK_CONFIG.evm.mainnet : DEFAULT_NETWORK_CONFIG.evm.testnet;
|
|
880
|
-
return fallbackChainId;
|
|
881
|
-
}
|
|
882
|
-
function getSolanaNetwork() {
|
|
883
|
-
if (globalDefaultSolanaNetwork !== void 0) {
|
|
884
|
-
return globalDefaultSolanaNetwork;
|
|
885
|
-
}
|
|
886
|
-
const isProduction = typeof process !== "undefined" && process.env.NEXT_PUBLIC_ENVIRONMENT === "production";
|
|
887
|
-
return isProduction ? DEFAULT_NETWORK_CONFIG.solana.mainnet : DEFAULT_NETWORK_CONFIG.solana.devnet;
|
|
888
|
-
}
|
|
889
|
-
function getBitcoinNetwork() {
|
|
890
|
-
if (globalDefaultBitcoinNetwork !== void 0) {
|
|
891
|
-
return globalDefaultBitcoinNetwork;
|
|
892
|
-
}
|
|
893
|
-
const isProduction = typeof process !== "undefined" && process.env.NEXT_PUBLIC_ENVIRONMENT === "production";
|
|
894
|
-
return isProduction ? DEFAULT_NETWORK_CONFIG.bitcoin.mainnet : DEFAULT_NETWORK_CONFIG.bitcoin.testnet;
|
|
895
|
-
}
|
|
896
|
-
function getTronNetwork() {
|
|
897
|
-
if (globalDefaultTronNetwork !== void 0) {
|
|
898
|
-
return globalDefaultTronNetwork;
|
|
899
|
-
}
|
|
900
|
-
const isProduction = typeof process !== "undefined" && process.env.NEXT_PUBLIC_ENVIRONMENT === "production";
|
|
901
|
-
return isProduction ? DEFAULT_NETWORK_CONFIG.tron.mainnet : DEFAULT_NETWORK_CONFIG.tron.testnet;
|
|
902
|
-
}
|
|
903
819
|
|
|
904
820
|
// src/wallets/walletConnectors/abcWallet/types.ts
|
|
905
821
|
var AbcStorageKey = /* @__PURE__ */ ((AbcStorageKey2) => {
|
|
@@ -952,7 +868,8 @@ var TalkenApiError = class extends Error {
|
|
|
952
868
|
// src/wallets/walletConnectors/abcWallet/constants.ts
|
|
953
869
|
var DEFAULT_ABC_CONFIG = {
|
|
954
870
|
environment: "development",
|
|
955
|
-
waasUrl:
|
|
871
|
+
waasUrl: ""
|
|
872
|
+
// All operations routed through TalkenApiClient
|
|
956
873
|
};
|
|
957
874
|
var TOKEN_EXPIRY = {
|
|
958
875
|
ACCESS_TOKEN: 10 * 60 * 1e3,
|
|
@@ -1158,6 +1075,10 @@ var TALKEN_API_ENDPOINTS = {
|
|
|
1158
1075
|
SIGN_EVM: "/wallet/sign/evm",
|
|
1159
1076
|
SIGN_TYPED: "/wallet/sign/typed",
|
|
1160
1077
|
SIGN_PERSONAL: "/wallet/sign/personal",
|
|
1078
|
+
// ── Hash Sign (secp256k1, universal: EVM/BTC/TVM) ───────────────────
|
|
1079
|
+
SIGN_HASH: "/wallet/sign/hash",
|
|
1080
|
+
// ── SOL Sign (WaaS proxy) ───────────────────────────────────────────
|
|
1081
|
+
SIGN_SVM: "/wallet/sign/sol",
|
|
1161
1082
|
// ── TX ──────────────────────────────────────────────────────────────
|
|
1162
1083
|
TX_RAW: "/wallet/tx/raw",
|
|
1163
1084
|
TX_EVM: "/wallet/tx/evm",
|
|
@@ -1508,116 +1429,6 @@ function clearEncryptedTokens() {
|
|
|
1508
1429
|
removeFromStorage("token_salt" /* TOKEN_SALT */);
|
|
1509
1430
|
}
|
|
1510
1431
|
|
|
1511
|
-
// src/wallets/walletConnectors/abcWallet/abcApi.ts
|
|
1512
|
-
import { getAddress } from "viem";
|
|
1513
|
-
|
|
1514
|
-
// src/wallets/walletConnectors/abcWallet/secure.ts
|
|
1515
|
-
import CryptoJS2 from "crypto-js";
|
|
1516
|
-
import elliptic from "elliptic";
|
|
1517
|
-
var EC = elliptic.ec;
|
|
1518
|
-
var SecureService = class {
|
|
1519
|
-
constructor(baseURL) {
|
|
1520
|
-
this.secureChannel = null;
|
|
1521
|
-
this.channelExpiry = 0;
|
|
1522
|
-
this.baseURL = baseURL;
|
|
1523
|
-
}
|
|
1524
|
-
async getSecureChannel() {
|
|
1525
|
-
if (this.secureChannel && Date.now() < this.channelExpiry) {
|
|
1526
|
-
return this.secureChannel;
|
|
1527
|
-
}
|
|
1528
|
-
const result = {};
|
|
1529
|
-
const plain = Array.from(crypto.getRandomValues(new Uint8Array(32))).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
1530
|
-
const ec = new EC("p256");
|
|
1531
|
-
const myKey = ec.genKeyPair();
|
|
1532
|
-
const pubkey = myKey.getPublic().encode("hex", false);
|
|
1533
|
-
const url = `${this.baseURL}${ABC_ENDPOINTS.SECURE_CHANNEL_CREATE}`;
|
|
1534
|
-
const bodyString = new URLSearchParams({ pubkey, plain }).toString();
|
|
1535
|
-
const response = await fetch(url, {
|
|
1536
|
-
method: "POST",
|
|
1537
|
-
headers: {
|
|
1538
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
|
1539
|
-
},
|
|
1540
|
-
body: bodyString
|
|
1541
|
-
});
|
|
1542
|
-
if (!response.ok) {
|
|
1543
|
-
const errorText = await response.text();
|
|
1544
|
-
console.error(
|
|
1545
|
-
`\u274C Secure channel HTTP error: ${response.status} ${response.statusText}`
|
|
1546
|
-
);
|
|
1547
|
-
console.error("Response body:", errorText);
|
|
1548
|
-
throw new Error(
|
|
1549
|
-
`Failed to create secure channel: HTTP ${response.status} - ${errorText}`
|
|
1550
|
-
);
|
|
1551
|
-
}
|
|
1552
|
-
const res = await response.json();
|
|
1553
|
-
const resData = res;
|
|
1554
|
-
if (resData.channelid && resData.publickey) {
|
|
1555
|
-
const serverKey = ec.keyFromPublic(resData.publickey, "hex");
|
|
1556
|
-
const sharedSecret = serverKey.getPublic().mul(myKey.getPrivate()).getX();
|
|
1557
|
-
const secretKey = sharedSecret.toString(16).padStart(64, "0");
|
|
1558
|
-
result.response = resData;
|
|
1559
|
-
result.myKey = myKey;
|
|
1560
|
-
result.secretKey = secretKey;
|
|
1561
|
-
this.secureChannel = result;
|
|
1562
|
-
this.channelExpiry = Date.now() + 20 * 60 * 1e3;
|
|
1563
|
-
} else if (res.status === "success" && res.result) {
|
|
1564
|
-
const result_data = res.result;
|
|
1565
|
-
const serverKey = ec.keyFromPublic(result_data.publickey, "hex");
|
|
1566
|
-
const sharedSecret = serverKey.getPublic().mul(myKey.getPrivate()).getX();
|
|
1567
|
-
const secretKey = sharedSecret.toString(16).padStart(64, "0");
|
|
1568
|
-
result.response = result_data;
|
|
1569
|
-
result.myKey = myKey;
|
|
1570
|
-
result.secretKey = secretKey;
|
|
1571
|
-
this.secureChannel = result;
|
|
1572
|
-
this.channelExpiry = Date.now() + 20 * 60 * 1e3;
|
|
1573
|
-
console.log("\u2705 Secure channel created successfully (wrapped format)");
|
|
1574
|
-
} else {
|
|
1575
|
-
const errorMsg = res.message || res.detail || "Unknown error";
|
|
1576
|
-
console.error("\u274C Failed to create secure channel:", res);
|
|
1577
|
-
throw new Error(`Failed to create secure channel: ${errorMsg}`);
|
|
1578
|
-
}
|
|
1579
|
-
return result;
|
|
1580
|
-
}
|
|
1581
|
-
async encrypt(plain) {
|
|
1582
|
-
const secureChannel = await this.getSecureChannel();
|
|
1583
|
-
if (!secureChannel.secretKey || !secureChannel.response) {
|
|
1584
|
-
throw new Error("Secure channel not established");
|
|
1585
|
-
}
|
|
1586
|
-
const secretKey = secureChannel.secretKey;
|
|
1587
|
-
const key = secretKey.substring(0, 32);
|
|
1588
|
-
const iv = secretKey.substring(32);
|
|
1589
|
-
const encrypted = CryptoJS2.AES.encrypt(plain, CryptoJS2.enc.Hex.parse(key), {
|
|
1590
|
-
iv: CryptoJS2.enc.Hex.parse(iv),
|
|
1591
|
-
padding: CryptoJS2.pad.Pkcs7,
|
|
1592
|
-
mode: CryptoJS2.mode.CBC
|
|
1593
|
-
});
|
|
1594
|
-
return {
|
|
1595
|
-
encryptPlain: encrypted.toString(),
|
|
1596
|
-
secureChannel: secureChannel.response.channelid
|
|
1597
|
-
};
|
|
1598
|
-
}
|
|
1599
|
-
async getSecureChannelId() {
|
|
1600
|
-
const channel = await this.getSecureChannel();
|
|
1601
|
-
if (!channel.response?.channelid) {
|
|
1602
|
-
throw new Error("Secure channel not established");
|
|
1603
|
-
}
|
|
1604
|
-
return channel.response.channelid;
|
|
1605
|
-
}
|
|
1606
|
-
async getEncryptPlain(plain) {
|
|
1607
|
-
const result = await this.encrypt(plain);
|
|
1608
|
-
return result.encryptPlain;
|
|
1609
|
-
}
|
|
1610
|
-
/**
|
|
1611
|
-
* Clear cached secure channel (for testing or reset)
|
|
1612
|
-
*/
|
|
1613
|
-
clearCache() {
|
|
1614
|
-
this.secureChannel = null;
|
|
1615
|
-
this.channelExpiry = 0;
|
|
1616
|
-
console.log("\u{1F504} Secure channel cache cleared");
|
|
1617
|
-
}
|
|
1618
|
-
};
|
|
1619
|
-
var secure_default = SecureService;
|
|
1620
|
-
|
|
1621
1432
|
// src/wallets/walletConnectors/abcWallet/abcApi.ts
|
|
1622
1433
|
var AbcWaasClient = class {
|
|
1623
1434
|
constructor(config) {
|
|
@@ -1626,14 +1437,13 @@ var AbcWaasClient = class {
|
|
|
1626
1437
|
this.expiresAt = null;
|
|
1627
1438
|
this.isRefreshing = false;
|
|
1628
1439
|
this.refreshPromise = null;
|
|
1629
|
-
this.talkenAuthPath = "/
|
|
1440
|
+
this.talkenAuthPath = "/wallet/auth";
|
|
1630
1441
|
this.config = config;
|
|
1631
1442
|
this.baseURL = config.waasUrl;
|
|
1632
|
-
this.secure = new secure_default(this.baseURL);
|
|
1633
1443
|
this.loadTokens();
|
|
1634
1444
|
}
|
|
1635
1445
|
getTalkenApiUrl() {
|
|
1636
|
-
return process.env.
|
|
1446
|
+
return process.env.NEXT_PUBLIC_API_URL || "http://localhost:3001/api/v1";
|
|
1637
1447
|
}
|
|
1638
1448
|
async requestWalletAuth(body) {
|
|
1639
1449
|
const response = await fetch(
|
|
@@ -2119,7 +1929,7 @@ var AbcWaasClient = class {
|
|
|
2119
1929
|
*/
|
|
2120
1930
|
async registerSnsUser(params) {
|
|
2121
1931
|
const talkenApiUrl = this.getTalkenApiUrl();
|
|
2122
|
-
const response = await fetch(`${talkenApiUrl}/
|
|
1932
|
+
const response = await fetch(`${talkenApiUrl}/auth/signup`, {
|
|
2123
1933
|
method: "POST",
|
|
2124
1934
|
headers: {
|
|
2125
1935
|
...DEFAULT_HEADERS
|
|
@@ -2173,31 +1983,13 @@ var AbcWaasClient = class {
|
|
|
2173
1983
|
);
|
|
2174
1984
|
if (response.status === "success" && response.data) {
|
|
2175
1985
|
const raw = response.data;
|
|
2176
|
-
console.log("[AbcWaasClient] Raw wallet API response:", {
|
|
2177
|
-
hasUid: !!raw.uid,
|
|
2178
|
-
hasSid: !!raw.sid,
|
|
2179
|
-
hasKeyId: !!raw.key_id,
|
|
2180
|
-
hasWid: !!raw.wid,
|
|
2181
|
-
hasPvencstr: !!raw.pvencstr,
|
|
2182
|
-
hasEncryptDevicePassword: !!raw.encryptDevicePassword,
|
|
2183
|
-
hasEncryptedShare: !!raw.encrypted_share,
|
|
2184
|
-
hasPubkey: !!raw.pubkey,
|
|
2185
|
-
allKeys: Object.keys(raw)
|
|
2186
|
-
});
|
|
2187
1986
|
return {
|
|
2188
1987
|
address: raw.sid || "",
|
|
2189
|
-
//
|
|
1988
|
+
// sid is the EVM address
|
|
2190
1989
|
keyId: raw.key_id || raw.keyId || raw.sid,
|
|
2191
1990
|
encryptedShare: raw.encrypted_share || raw.key_id || "",
|
|
2192
|
-
// Use key_id as fallback
|
|
2193
1991
|
uid: raw.uid,
|
|
2194
1992
|
sid: raw.sid,
|
|
2195
|
-
wid: raw.wid,
|
|
2196
|
-
// Preserve for Bitcoin signing
|
|
2197
|
-
pvencstr: raw.pvencstr,
|
|
2198
|
-
// Preserve for Bitcoin signing
|
|
2199
|
-
encryptDevicePassword: raw.encryptDevicePassword,
|
|
2200
|
-
// Preserve for Bitcoin signing
|
|
2201
1993
|
pubkey: raw.pubkey || null
|
|
2202
1994
|
};
|
|
2203
1995
|
}
|
|
@@ -2207,553 +1999,102 @@ var AbcWaasClient = class {
|
|
|
2207
1999
|
response
|
|
2208
2000
|
);
|
|
2209
2001
|
}
|
|
2002
|
+
// v2 signing methods removed (signTransaction, signMessage, signTypedData, sendRawTransaction)
|
|
2003
|
+
// All signing now routes through TalkenApiClient → talken-api backend.
|
|
2210
2004
|
/**
|
|
2211
|
-
*
|
|
2212
|
-
* Based on ABC WaaS official documentation
|
|
2005
|
+
* @deprecated v2 signing removed. Use TalkenApiClient.evm.sendTransaction() instead.
|
|
2213
2006
|
*/
|
|
2214
|
-
async signTransaction(
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
throw createAbcError(
|
|
2219
|
-
"WALLET_NOT_FOUND" /* WALLET_NOT_FOUND */,
|
|
2220
|
-
"Wallet information not found in storage"
|
|
2221
|
-
);
|
|
2222
|
-
}
|
|
2223
|
-
const encryptedDevicePassword = await this.secure.getEncryptPlain(
|
|
2224
|
-
wallet.encryptDevicePassword
|
|
2225
|
-
);
|
|
2226
|
-
const encryptedPvencstr = await this.secure.getEncryptPlain(
|
|
2227
|
-
wallet.pvencstr
|
|
2007
|
+
async signTransaction(_params) {
|
|
2008
|
+
throw createAbcError(
|
|
2009
|
+
"SIGNATURE_FAILED" /* SIGNATURE_FAILED */,
|
|
2010
|
+
"v2 signing removed. Use TalkenApiClient.evm.sendTransaction() instead."
|
|
2228
2011
|
);
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
try {
|
|
2235
|
-
const api = getTalkenApiClient();
|
|
2236
|
-
if (api && (!tx.maxFeePerGas || !tx.maxPriorityFeePerGas)) {
|
|
2237
|
-
try {
|
|
2238
|
-
const gasData = await api.evm.getGasSuggested(network);
|
|
2239
|
-
if (gasData.medium) {
|
|
2240
|
-
if (!tx.maxFeePerGas) {
|
|
2241
|
-
tx.maxFeePerGas = parseGwei(
|
|
2242
|
-
gasData.medium.suggestedMaxFeePerGas
|
|
2243
|
-
).toString();
|
|
2244
|
-
}
|
|
2245
|
-
if (!tx.maxPriorityFeePerGas) {
|
|
2246
|
-
tx.maxPriorityFeePerGas = parseGwei(
|
|
2247
|
-
gasData.medium.suggestedMaxPriorityFeePerGas
|
|
2248
|
-
).toString();
|
|
2249
|
-
}
|
|
2250
|
-
}
|
|
2251
|
-
} catch (gasError) {
|
|
2252
|
-
console.warn("[AbcWaasClient] Failed to fetch gas fees:", gasError);
|
|
2253
|
-
}
|
|
2254
|
-
}
|
|
2255
|
-
if (api && !tx.gasLimit && !tx.gas) {
|
|
2256
|
-
try {
|
|
2257
|
-
const estimateResult = await api.evm.estimateGas({
|
|
2258
|
-
network,
|
|
2259
|
-
from: tx.from || "",
|
|
2260
|
-
to: tx.to || "0x",
|
|
2261
|
-
value: tx.value,
|
|
2262
|
-
data: tx.data && tx.data !== "0x" ? tx.data : void 0
|
|
2263
|
-
});
|
|
2264
|
-
if (estimateResult.result) {
|
|
2265
|
-
tx.gasLimit = estimateResult.result;
|
|
2266
|
-
} else {
|
|
2267
|
-
tx.gasLimit = "0x2dc6c0";
|
|
2268
|
-
}
|
|
2269
|
-
} catch (estimateError) {
|
|
2270
|
-
console.warn(
|
|
2271
|
-
"[AbcWaasClient] Failed to estimate gas:",
|
|
2272
|
-
estimateError
|
|
2273
|
-
);
|
|
2274
|
-
tx.gasLimit = "0x2dc6c0";
|
|
2275
|
-
}
|
|
2276
|
-
}
|
|
2277
|
-
} catch (error) {
|
|
2278
|
-
console.warn("[AbcWaasClient] Failed to fetch gas parameters:", error);
|
|
2279
|
-
}
|
|
2280
|
-
}
|
|
2281
|
-
const bodyData = {
|
|
2282
|
-
network,
|
|
2283
|
-
encryptDevicePassword: encryptedDevicePassword,
|
|
2284
|
-
pvencstr: encryptedPvencstr,
|
|
2285
|
-
uid: wallet.uid,
|
|
2286
|
-
wid: encryptedWid,
|
|
2287
|
-
sid: getAddress(wallet.address),
|
|
2288
|
-
// EIP-55 checksum format
|
|
2289
|
-
// For contract deployment, 'to' is '0x' (ABC WaaS convention)
|
|
2290
|
-
// Reference: talken-nft-drops/src/libs/abc-waas-provider/index.ts:800 - to: to ?? '0x'
|
|
2291
|
-
to: tx.to === "0x" ? "0x" : getAddress(tx.to),
|
|
2292
|
-
// Required by ABC WaaS API
|
|
2293
|
-
// Always use EIP1559 type (ABC WaaS handles network-specific conversion)
|
|
2294
|
-
type: "EIP1559",
|
|
2295
|
-
// ourpubkey and ucpubkey are required by ABC WaaS (empty strings for now)
|
|
2296
|
-
// Based on successful tg-wallet payload analysis
|
|
2297
|
-
ourpubkey: "",
|
|
2298
|
-
ucpubkey: ""
|
|
2299
|
-
};
|
|
2300
|
-
bodyData.from = getAddress(tx.from || wallet.address);
|
|
2301
|
-
if (tx.value) {
|
|
2302
|
-
let hexValue = tx.value.startsWith("0x") ? tx.value.slice(2) : tx.value;
|
|
2303
|
-
if (hexValue.length % 2 !== 0) {
|
|
2304
|
-
hexValue = `0${hexValue}`;
|
|
2305
|
-
}
|
|
2306
|
-
bodyData.value = `0x${hexValue}`;
|
|
2307
|
-
} else {
|
|
2308
|
-
bodyData.value = "0x0";
|
|
2309
|
-
}
|
|
2310
|
-
if (tx.gasLimit || tx.gas) {
|
|
2311
|
-
const gasLimitValue = tx.gasLimit || tx.gas;
|
|
2312
|
-
if (gasLimitValue.toString().startsWith("0x")) {
|
|
2313
|
-
bodyData.gasLimit = gasLimitValue.toString();
|
|
2314
|
-
} else {
|
|
2315
|
-
bodyData.gasLimit = `0x${BigInt(gasLimitValue).toString(16)}`;
|
|
2316
|
-
}
|
|
2317
|
-
}
|
|
2318
|
-
if (tx.maxFeePerGas) {
|
|
2319
|
-
if (tx.maxFeePerGas.toString().startsWith("0x")) {
|
|
2320
|
-
bodyData.maxFeePerGas = tx.maxFeePerGas.toString();
|
|
2321
|
-
} else {
|
|
2322
|
-
bodyData.maxFeePerGas = `0x${BigInt(tx.maxFeePerGas).toString(16)}`;
|
|
2323
|
-
}
|
|
2324
|
-
}
|
|
2325
|
-
if (tx.maxPriorityFeePerGas) {
|
|
2326
|
-
if (tx.maxPriorityFeePerGas.toString().startsWith("0x")) {
|
|
2327
|
-
bodyData.maxPriorityFeePerGas = tx.maxPriorityFeePerGas.toString();
|
|
2328
|
-
} else {
|
|
2329
|
-
bodyData.maxPriorityFeePerGas = `0x${BigInt(tx.maxPriorityFeePerGas).toString(16)}`;
|
|
2330
|
-
}
|
|
2331
|
-
}
|
|
2332
|
-
if (tx.gasPrice) {
|
|
2333
|
-
if (tx.gasPrice.toString().startsWith("0x")) {
|
|
2334
|
-
bodyData.gasPrice = tx.gasPrice.toString();
|
|
2335
|
-
} else {
|
|
2336
|
-
bodyData.gasPrice = `0x${BigInt(tx.gasPrice).toString(16)}`;
|
|
2337
|
-
}
|
|
2338
|
-
}
|
|
2339
|
-
if (tx.data !== void 0 && tx.data !== null) {
|
|
2340
|
-
bodyData.data = tx.data || "0x";
|
|
2341
|
-
} else {
|
|
2342
|
-
bodyData.data = "0x";
|
|
2343
|
-
}
|
|
2344
|
-
const bodyString = new URLSearchParams(bodyData).toString();
|
|
2345
|
-
const url = `${this.baseURL}${ABC_ENDPOINTS.SIGN_TRANSACTION}`;
|
|
2346
|
-
const response = await fetch(url, {
|
|
2347
|
-
method: "POST",
|
|
2348
|
-
headers: {
|
|
2349
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
2350
|
-
"Secure-Channel": secureChannelId,
|
|
2351
|
-
...this.accessToken ? { Authorization: `Bearer ${this.accessToken}` } : {}
|
|
2352
|
-
},
|
|
2353
|
-
body: bodyString
|
|
2354
|
-
});
|
|
2355
|
-
const res = await response.json();
|
|
2356
|
-
console.log("\u{1F4E1} ABC WaaS /sign response:", {
|
|
2357
|
-
status: response.status,
|
|
2358
|
-
ok: response.ok,
|
|
2359
|
-
response: res
|
|
2360
|
-
});
|
|
2361
|
-
if (!response.ok) {
|
|
2362
|
-
console.error("\u274C ABC WaaS API error details:", {
|
|
2363
|
-
status: response.status,
|
|
2364
|
-
statusText: response.statusText,
|
|
2365
|
-
errorCode: res.code,
|
|
2366
|
-
errorMessage: res.msg || res.message || res.detail,
|
|
2367
|
-
fullResponse: res
|
|
2368
|
-
});
|
|
2369
|
-
}
|
|
2370
|
-
if (response.status === 401 && this.refreshToken) {
|
|
2371
|
-
try {
|
|
2372
|
-
await this.refreshAccessToken();
|
|
2373
|
-
const retryResponse = await fetch(url, {
|
|
2374
|
-
method: "POST",
|
|
2375
|
-
headers: {
|
|
2376
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
2377
|
-
"Secure-Channel": secureChannelId,
|
|
2378
|
-
...this.accessToken ? { Authorization: `Bearer ${this.accessToken}` } : {}
|
|
2379
|
-
},
|
|
2380
|
-
body: bodyString
|
|
2381
|
-
});
|
|
2382
|
-
const retryRes = await retryResponse.json();
|
|
2383
|
-
if (retryRes.serializedTx && retryRes.rawTx) {
|
|
2384
|
-
return {
|
|
2385
|
-
signature: retryRes.serializedTx,
|
|
2386
|
-
txHash: retryRes.rawTx
|
|
2387
|
-
};
|
|
2388
|
-
}
|
|
2389
|
-
throw createAbcError(
|
|
2390
|
-
"SIGNATURE_FAILED" /* SIGNATURE_FAILED */,
|
|
2391
|
-
"Failed to sign transaction after token refresh",
|
|
2392
|
-
retryRes
|
|
2393
|
-
);
|
|
2394
|
-
} catch (refreshError) {
|
|
2395
|
-
console.error("Token refresh failed in signTransaction:", refreshError);
|
|
2396
|
-
throw refreshError;
|
|
2397
|
-
}
|
|
2398
|
-
}
|
|
2399
|
-
if (res.serializedTx && res.rawTx) {
|
|
2400
|
-
return {
|
|
2401
|
-
signature: res.serializedTx,
|
|
2402
|
-
txHash: res.rawTx
|
|
2403
|
-
};
|
|
2404
|
-
}
|
|
2012
|
+
}
|
|
2013
|
+
/**
|
|
2014
|
+
* @deprecated v2 signing removed. Use TalkenApiClient.evm.personalSign() instead.
|
|
2015
|
+
*/
|
|
2016
|
+
async signMessage(_params) {
|
|
2405
2017
|
throw createAbcError(
|
|
2406
2018
|
"SIGNATURE_FAILED" /* SIGNATURE_FAILED */,
|
|
2407
|
-
"
|
|
2408
|
-
res
|
|
2019
|
+
"v2 signing removed. Use TalkenApiClient.evm.personalSign() instead."
|
|
2409
2020
|
);
|
|
2410
2021
|
}
|
|
2411
2022
|
/**
|
|
2412
|
-
*
|
|
2413
|
-
* Based on tg-wallet-frontend reference implementation
|
|
2023
|
+
* @deprecated v2 signing removed. Use TalkenApiClient.evm.signTypedData() instead.
|
|
2414
2024
|
*/
|
|
2415
|
-
async
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
throw createAbcError(
|
|
2420
|
-
"WALLET_NOT_FOUND" /* WALLET_NOT_FOUND */,
|
|
2421
|
-
"Wallet information not found in storage"
|
|
2422
|
-
);
|
|
2423
|
-
}
|
|
2424
|
-
const ethers = await import("ethers");
|
|
2425
|
-
const messageHash = ethers.utils.hashMessage(params.message);
|
|
2426
|
-
const hash = messageHash.startsWith("0x") ? messageHash.slice(2) : messageHash;
|
|
2427
|
-
const encryptedDevicePassword = await this.secure.getEncryptPlain(
|
|
2428
|
-
wallet.encryptDevicePassword
|
|
2025
|
+
async signTypedData(_params) {
|
|
2026
|
+
throw createAbcError(
|
|
2027
|
+
"SIGNATURE_FAILED" /* SIGNATURE_FAILED */,
|
|
2028
|
+
"v2 signing removed. Use TalkenApiClient.evm.signTypedData() instead."
|
|
2429
2029
|
);
|
|
2430
|
-
|
|
2431
|
-
|
|
2030
|
+
}
|
|
2031
|
+
/**
|
|
2032
|
+
* @deprecated v2 sendRawTransaction removed. Use TalkenApiClient.evm.sendRawTransaction() instead.
|
|
2033
|
+
*/
|
|
2034
|
+
async sendRawTransaction(_chainId, _signedTransaction) {
|
|
2035
|
+
throw createAbcError(
|
|
2036
|
+
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
2037
|
+
"v2 sendRawTransaction removed. Use TalkenApiClient.evm.sendRawTransaction() instead."
|
|
2432
2038
|
);
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
};
|
|
2443
|
-
const bodyString = new URLSearchParams(bodyData).toString();
|
|
2444
|
-
const url = `${this.baseURL}${ABC_ENDPOINTS.SIGN_HASH}`;
|
|
2445
|
-
const response = await fetch(url, {
|
|
2446
|
-
method: "POST",
|
|
2447
|
-
headers: {
|
|
2448
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
2449
|
-
"Secure-Channel": secureChannelId,
|
|
2450
|
-
...this.accessToken ? { Authorization: `Bearer ${this.accessToken}` } : {}
|
|
2451
|
-
},
|
|
2452
|
-
body: bodyString
|
|
2453
|
-
});
|
|
2454
|
-
const text = await response.text();
|
|
2455
|
-
if (!text) {
|
|
2039
|
+
}
|
|
2040
|
+
/**
|
|
2041
|
+
* Estimate gas for EIP-1559 transaction
|
|
2042
|
+
* Routes through TalkenApiClient (talken-api proxy)
|
|
2043
|
+
*/
|
|
2044
|
+
async estimateGas(params) {
|
|
2045
|
+
const network = getNetworkName(params.chainId);
|
|
2046
|
+
const api = getTalkenApiClient();
|
|
2047
|
+
if (!api) {
|
|
2456
2048
|
throw createAbcError(
|
|
2457
|
-
"
|
|
2458
|
-
|
|
2459
|
-
{ status: response.status }
|
|
2049
|
+
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
2050
|
+
"TalkenApiClient not initialized"
|
|
2460
2051
|
);
|
|
2461
2052
|
}
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
headers: {
|
|
2473
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
2474
|
-
"Secure-Channel": secureChannelId,
|
|
2475
|
-
...this.accessToken ? { Authorization: `Bearer ${this.accessToken}` } : {}
|
|
2476
|
-
},
|
|
2477
|
-
body: bodyString
|
|
2478
|
-
});
|
|
2479
|
-
const retryText = await retryResponse.text();
|
|
2480
|
-
if (!retryText) {
|
|
2481
|
-
throw createAbcError(
|
|
2482
|
-
"SIGNATURE_FAILED" /* SIGNATURE_FAILED */,
|
|
2483
|
-
`Empty response from retry (status: ${retryResponse.status})`,
|
|
2484
|
-
{ status: retryResponse.status }
|
|
2485
|
-
);
|
|
2486
|
-
}
|
|
2487
|
-
const retryRes = JSON.parse(retryText);
|
|
2488
|
-
if (retryRes.status === "success" && retryRes.result?.signstr) {
|
|
2489
|
-
return { signature: retryRes.result.signstr };
|
|
2490
|
-
}
|
|
2491
|
-
throw createAbcError(
|
|
2492
|
-
"SIGNATURE_FAILED" /* SIGNATURE_FAILED */,
|
|
2493
|
-
"Failed to sign message after token refresh",
|
|
2494
|
-
retryRes
|
|
2495
|
-
);
|
|
2496
|
-
} catch (refreshError) {
|
|
2497
|
-
console.error("Token refresh failed in signMessage:", refreshError);
|
|
2498
|
-
throw refreshError;
|
|
2499
|
-
}
|
|
2053
|
+
try {
|
|
2054
|
+
const result = await api.evm.estimateGas({
|
|
2055
|
+
network,
|
|
2056
|
+
from: params.from || "",
|
|
2057
|
+
to: params.to,
|
|
2058
|
+
value: params.value,
|
|
2059
|
+
data: params.data
|
|
2060
|
+
});
|
|
2061
|
+
if (result.result) {
|
|
2062
|
+
return result.result;
|
|
2500
2063
|
}
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
"Invalid signature format",
|
|
2509
|
-
res
|
|
2510
|
-
);
|
|
2064
|
+
throw createAbcError(
|
|
2065
|
+
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
2066
|
+
"No result in gas estimate response"
|
|
2067
|
+
);
|
|
2068
|
+
} catch (error) {
|
|
2069
|
+
if (error?.code === "NETWORK_ERROR" /* NETWORK_ERROR */) {
|
|
2070
|
+
throw error;
|
|
2511
2071
|
}
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2072
|
+
throw createAbcError(
|
|
2073
|
+
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
2074
|
+
error.message || "Failed to estimate gas"
|
|
2075
|
+
);
|
|
2515
2076
|
}
|
|
2516
|
-
throw createAbcError(
|
|
2517
|
-
"SIGNATURE_FAILED" /* SIGNATURE_FAILED */,
|
|
2518
|
-
"Failed to sign message",
|
|
2519
|
-
res
|
|
2520
|
-
);
|
|
2521
2077
|
}
|
|
2522
2078
|
/**
|
|
2523
|
-
*
|
|
2524
|
-
* Reference: tg-wallet-frontend src/features/wallet/api/index.ts sign_typed_data()
|
|
2079
|
+
* Get transaction count (nonce) via TalkenApiClient
|
|
2525
2080
|
*/
|
|
2526
|
-
async
|
|
2527
|
-
|
|
2528
|
-
const
|
|
2529
|
-
if (!
|
|
2081
|
+
async getTransactionCount(params) {
|
|
2082
|
+
const network = getNetworkName(params.chainId);
|
|
2083
|
+
const api = getTalkenApiClient();
|
|
2084
|
+
if (!api) {
|
|
2530
2085
|
throw createAbcError(
|
|
2531
|
-
"
|
|
2532
|
-
"
|
|
2533
|
-
);
|
|
2534
|
-
}
|
|
2535
|
-
const encryptedDevicePassword = await this.secure.getEncryptPlain(
|
|
2536
|
-
wallet.encryptDevicePassword
|
|
2537
|
-
);
|
|
2538
|
-
const encryptedPvencstr = await this.secure.getEncryptPlain(
|
|
2539
|
-
wallet.pvencstr
|
|
2540
|
-
);
|
|
2541
|
-
const encryptedWid = await this.secure.getEncryptPlain(wallet.wid);
|
|
2542
|
-
const secureChannelId = await this.secure.getSecureChannelId();
|
|
2543
|
-
const network = getNetworkName(wallet.chainId);
|
|
2544
|
-
const bodyData = {
|
|
2545
|
-
messageJson: params.typedData,
|
|
2546
|
-
// Server expects "messageJson" field
|
|
2547
|
-
version: "v4",
|
|
2548
|
-
// EIP-712 version
|
|
2549
|
-
network,
|
|
2550
|
-
// Network name (required for JSON-RPC)
|
|
2551
|
-
encryptDevicePassword: encryptedDevicePassword,
|
|
2552
|
-
pvencstr: encryptedPvencstr,
|
|
2553
|
-
wid: encryptedWid,
|
|
2554
|
-
uid: wallet.uid,
|
|
2555
|
-
sid: wallet.sid
|
|
2556
|
-
};
|
|
2557
|
-
const bodyString = new URLSearchParams(bodyData).toString();
|
|
2558
|
-
const url = `${this.baseURL}${ABC_ENDPOINTS.SIGN_TYPED}`;
|
|
2559
|
-
const response = await fetch(url, {
|
|
2560
|
-
method: "POST",
|
|
2561
|
-
headers: {
|
|
2562
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
2563
|
-
"Secure-Channel": secureChannelId,
|
|
2564
|
-
...this.accessToken ? { Authorization: `Bearer ${this.accessToken}` } : {}
|
|
2565
|
-
},
|
|
2566
|
-
body: bodyString
|
|
2567
|
-
});
|
|
2568
|
-
const text = await response.text();
|
|
2569
|
-
if (!text) {
|
|
2570
|
-
throw createAbcError(
|
|
2571
|
-
"SIGNATURE_FAILED" /* SIGNATURE_FAILED */,
|
|
2572
|
-
`Empty response from signTypedData API (status: ${response.status})`,
|
|
2573
|
-
{ status: response.status }
|
|
2574
|
-
);
|
|
2575
|
-
}
|
|
2576
|
-
const res = JSON.parse(text);
|
|
2577
|
-
if (response.status === 401 && this.refreshToken) {
|
|
2578
|
-
try {
|
|
2579
|
-
await this.refreshAccessToken();
|
|
2580
|
-
const retryResponse = await fetch(url, {
|
|
2581
|
-
method: "POST",
|
|
2582
|
-
headers: {
|
|
2583
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
2584
|
-
"Secure-Channel": secureChannelId,
|
|
2585
|
-
...this.accessToken ? { Authorization: `Bearer ${this.accessToken}` } : {}
|
|
2586
|
-
},
|
|
2587
|
-
body: bodyString
|
|
2588
|
-
});
|
|
2589
|
-
const retryText = await retryResponse.text();
|
|
2590
|
-
if (!retryText) {
|
|
2591
|
-
throw createAbcError(
|
|
2592
|
-
"SIGNATURE_FAILED" /* SIGNATURE_FAILED */,
|
|
2593
|
-
`Empty response after retry (status: ${retryResponse.status})`,
|
|
2594
|
-
{ status: retryResponse.status }
|
|
2595
|
-
);
|
|
2596
|
-
}
|
|
2597
|
-
const retryRes = JSON.parse(retryText);
|
|
2598
|
-
if (retryRes.serializedTx) {
|
|
2599
|
-
return { signature: retryRes.serializedTx };
|
|
2600
|
-
}
|
|
2601
|
-
throw createAbcError(
|
|
2602
|
-
"SIGNATURE_FAILED" /* SIGNATURE_FAILED */,
|
|
2603
|
-
"Failed to sign typed data after token refresh",
|
|
2604
|
-
retryRes
|
|
2605
|
-
);
|
|
2606
|
-
} catch (refreshError) {
|
|
2607
|
-
console.error("Token refresh failed in signTypedData:", refreshError);
|
|
2608
|
-
throw refreshError;
|
|
2609
|
-
}
|
|
2610
|
-
}
|
|
2611
|
-
if (res.serializedTx) {
|
|
2612
|
-
return { signature: res.serializedTx };
|
|
2613
|
-
}
|
|
2614
|
-
throw createAbcError(
|
|
2615
|
-
"SIGNATURE_FAILED" /* SIGNATURE_FAILED */,
|
|
2616
|
-
"Failed to sign typed data",
|
|
2617
|
-
res
|
|
2618
|
-
);
|
|
2619
|
-
}
|
|
2620
|
-
/**
|
|
2621
|
-
* Send raw transaction
|
|
2622
|
-
* Reference: tg-wallet-frontend src/features/wallet/api/index.ts sendRawTx()
|
|
2623
|
-
*/
|
|
2624
|
-
async sendRawTransaction(chainId, signedTransaction) {
|
|
2625
|
-
const wallet = loadFromStorage("wallet" /* WALLET */);
|
|
2626
|
-
if (!wallet) {
|
|
2627
|
-
throw createAbcError(
|
|
2628
|
-
"WALLET_NOT_FOUND" /* WALLET_NOT_FOUND */,
|
|
2629
|
-
"Wallet information not found in storage"
|
|
2630
|
-
);
|
|
2631
|
-
}
|
|
2632
|
-
const network = getNetworkName(chainId);
|
|
2633
|
-
const secureChannelId = await this.secure.getSecureChannelId();
|
|
2634
|
-
const bodyData = {
|
|
2635
|
-
signedSerializeTx: signedTransaction,
|
|
2636
|
-
network
|
|
2637
|
-
// rpc parameter
|
|
2638
|
-
};
|
|
2639
|
-
const bodyString = new URLSearchParams(bodyData).toString();
|
|
2640
|
-
const url = `${this.baseURL}${ABC_ENDPOINTS.SEND_RAW_TX}`;
|
|
2641
|
-
const response = await fetch(url, {
|
|
2642
|
-
method: "POST",
|
|
2643
|
-
headers: {
|
|
2644
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
2645
|
-
"Secure-Channel": secureChannelId,
|
|
2646
|
-
...this.accessToken ? { Authorization: `Bearer ${this.accessToken}` } : {}
|
|
2647
|
-
},
|
|
2648
|
-
body: bodyString
|
|
2649
|
-
});
|
|
2650
|
-
const text = await response.text();
|
|
2651
|
-
if (!text) {
|
|
2652
|
-
throw createAbcError(
|
|
2653
|
-
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
2654
|
-
`Empty response from sendRawTx API (status: ${response.status})`,
|
|
2655
|
-
{ status: response.status }
|
|
2656
|
-
);
|
|
2657
|
-
}
|
|
2658
|
-
const res = JSON.parse(text);
|
|
2659
|
-
console.log("\u{1F4E1} sendRawTransaction response:", {
|
|
2660
|
-
status: response.status,
|
|
2661
|
-
ok: response.ok,
|
|
2662
|
-
response: res
|
|
2663
|
-
});
|
|
2664
|
-
if (!response.ok) {
|
|
2665
|
-
console.error("\u274C sendRawTransaction error:", {
|
|
2666
|
-
status: response.status,
|
|
2667
|
-
errorMessage: res.errorMessage || res.msg || res.message,
|
|
2668
|
-
fullResponse: res
|
|
2669
|
-
});
|
|
2670
|
-
}
|
|
2671
|
-
if (response.status === 401 && this.refreshToken) {
|
|
2672
|
-
try {
|
|
2673
|
-
await this.refreshAccessToken();
|
|
2674
|
-
const retryResponse = await fetch(url, {
|
|
2675
|
-
method: "POST",
|
|
2676
|
-
headers: {
|
|
2677
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
2678
|
-
"Secure-Channel": secureChannelId,
|
|
2679
|
-
...this.accessToken ? { Authorization: `Bearer ${this.accessToken}` } : {}
|
|
2680
|
-
},
|
|
2681
|
-
body: bodyString
|
|
2682
|
-
});
|
|
2683
|
-
const retryText = await retryResponse.text();
|
|
2684
|
-
if (!retryText) {
|
|
2685
|
-
throw createAbcError(
|
|
2686
|
-
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
2687
|
-
`Empty response after retry (status: ${retryResponse.status})`,
|
|
2688
|
-
{ status: retryResponse.status }
|
|
2689
|
-
);
|
|
2690
|
-
}
|
|
2691
|
-
const retryRes = JSON.parse(retryText);
|
|
2692
|
-
if (retryRes.item || retryRes.txHash || retryRes.result?.txHash) {
|
|
2693
|
-
const txHash = retryRes.item || retryRes.txHash || retryRes.result.txHash;
|
|
2694
|
-
return { txHash };
|
|
2695
|
-
}
|
|
2696
|
-
throw createAbcError(
|
|
2697
|
-
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
2698
|
-
"Failed to send transaction after token refresh",
|
|
2699
|
-
retryRes
|
|
2700
|
-
);
|
|
2701
|
-
} catch (refreshError) {
|
|
2702
|
-
console.error(
|
|
2703
|
-
"Token refresh failed in sendRawTransaction:",
|
|
2704
|
-
refreshError
|
|
2705
|
-
);
|
|
2706
|
-
throw refreshError;
|
|
2707
|
-
}
|
|
2708
|
-
}
|
|
2709
|
-
if (res.result) {
|
|
2710
|
-
if (typeof res.result === "string") {
|
|
2711
|
-
console.log("\u2705 Transaction hash from result:", res.result);
|
|
2712
|
-
return { txHash: res.result };
|
|
2713
|
-
}
|
|
2714
|
-
if (res.result.txHash) {
|
|
2715
|
-
return { txHash: res.result.txHash };
|
|
2716
|
-
}
|
|
2717
|
-
}
|
|
2718
|
-
if (res.item) {
|
|
2719
|
-
return { txHash: res.item };
|
|
2720
|
-
}
|
|
2721
|
-
if (res.txHash) {
|
|
2722
|
-
return { txHash: res.txHash };
|
|
2723
|
-
}
|
|
2724
|
-
throw createAbcError(
|
|
2725
|
-
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
2726
|
-
"Failed to send transaction",
|
|
2727
|
-
res
|
|
2728
|
-
);
|
|
2729
|
-
}
|
|
2730
|
-
/**
|
|
2731
|
-
* Estimate gas for EIP-1559 transaction
|
|
2732
|
-
* Routes through TalkenApiClient (talken-api proxy)
|
|
2733
|
-
*/
|
|
2734
|
-
async estimateGas(params) {
|
|
2735
|
-
const network = getNetworkName(params.chainId);
|
|
2736
|
-
const api = getTalkenApiClient();
|
|
2737
|
-
if (!api) {
|
|
2738
|
-
throw createAbcError(
|
|
2739
|
-
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
2740
|
-
"TalkenApiClient not initialized"
|
|
2086
|
+
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
2087
|
+
"TalkenApiClient not initialized"
|
|
2741
2088
|
);
|
|
2742
2089
|
}
|
|
2743
2090
|
try {
|
|
2744
|
-
const
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
to: params.to,
|
|
2748
|
-
value: params.value,
|
|
2749
|
-
data: params.data
|
|
2750
|
-
});
|
|
2751
|
-
if (result.result) {
|
|
2752
|
-
return result.result;
|
|
2091
|
+
const res = await api.evm.getNonce(network, params.address);
|
|
2092
|
+
if (res.result !== void 0) {
|
|
2093
|
+
return typeof res.result === "number" ? `0x${res.result.toString(16)}` : res.result;
|
|
2753
2094
|
}
|
|
2754
2095
|
throw createAbcError(
|
|
2755
2096
|
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
2756
|
-
"No result in
|
|
2097
|
+
"No result in nonce response"
|
|
2757
2098
|
);
|
|
2758
2099
|
} catch (error) {
|
|
2759
2100
|
if (error?.code === "NETWORK_ERROR" /* NETWORK_ERROR */) {
|
|
@@ -2761,86 +2102,9 @@ var AbcWaasClient = class {
|
|
|
2761
2102
|
}
|
|
2762
2103
|
throw createAbcError(
|
|
2763
2104
|
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
2764
|
-
error.message || "Failed to
|
|
2765
|
-
);
|
|
2766
|
-
}
|
|
2767
|
-
}
|
|
2768
|
-
/**
|
|
2769
|
-
* Get transaction count (nonce)
|
|
2770
|
-
* Reference: ABC WaaS API - /wapi/v2/transactions/count
|
|
2771
|
-
*/
|
|
2772
|
-
async getTransactionCount(params) {
|
|
2773
|
-
const network = getNetworkName(params.chainId);
|
|
2774
|
-
const secureChannelId = await this.secure.getSecureChannelId();
|
|
2775
|
-
const bodyData = {
|
|
2776
|
-
network,
|
|
2777
|
-
address: params.address
|
|
2778
|
-
};
|
|
2779
|
-
const bodyString = new URLSearchParams(bodyData).toString();
|
|
2780
|
-
const url = `${this.baseURL}${ABC_ENDPOINTS.TRANSACTION_COUNT}`;
|
|
2781
|
-
const response = await fetch(url, {
|
|
2782
|
-
method: "POST",
|
|
2783
|
-
headers: {
|
|
2784
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
2785
|
-
"Secure-Channel": secureChannelId,
|
|
2786
|
-
...this.accessToken ? { Authorization: `Bearer ${this.accessToken}` } : {}
|
|
2787
|
-
},
|
|
2788
|
-
body: bodyString
|
|
2789
|
-
});
|
|
2790
|
-
const text = await response.text();
|
|
2791
|
-
if (!text) {
|
|
2792
|
-
throw createAbcError(
|
|
2793
|
-
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
2794
|
-
`Empty response from transaction count API (status: ${response.status})`,
|
|
2795
|
-
{ status: response.status }
|
|
2105
|
+
error.message || "Failed to get transaction count"
|
|
2796
2106
|
);
|
|
2797
2107
|
}
|
|
2798
|
-
const res = JSON.parse(text);
|
|
2799
|
-
if (response.status === 401 && this.refreshToken) {
|
|
2800
|
-
try {
|
|
2801
|
-
await this.refreshAccessToken();
|
|
2802
|
-
const retryResponse = await fetch(url, {
|
|
2803
|
-
method: "POST",
|
|
2804
|
-
headers: {
|
|
2805
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
2806
|
-
"Secure-Channel": secureChannelId,
|
|
2807
|
-
...this.accessToken ? { Authorization: `Bearer ${this.accessToken}` } : {}
|
|
2808
|
-
},
|
|
2809
|
-
body: bodyString
|
|
2810
|
-
});
|
|
2811
|
-
const retryText = await retryResponse.text();
|
|
2812
|
-
if (!retryText) {
|
|
2813
|
-
throw createAbcError(
|
|
2814
|
-
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
2815
|
-
`Empty response after retry (status: ${retryResponse.status})`,
|
|
2816
|
-
{ status: retryResponse.status }
|
|
2817
|
-
);
|
|
2818
|
-
}
|
|
2819
|
-
const retryRes = JSON.parse(retryText);
|
|
2820
|
-
if (retryRes.result !== void 0) {
|
|
2821
|
-
return typeof retryRes.result === "number" ? `0x${retryRes.result.toString(16)}` : retryRes.result;
|
|
2822
|
-
}
|
|
2823
|
-
throw createAbcError(
|
|
2824
|
-
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
2825
|
-
"Failed to get transaction count after token refresh",
|
|
2826
|
-
retryRes
|
|
2827
|
-
);
|
|
2828
|
-
} catch (refreshError) {
|
|
2829
|
-
console.error(
|
|
2830
|
-
"Token refresh failed in getTransactionCount:",
|
|
2831
|
-
refreshError
|
|
2832
|
-
);
|
|
2833
|
-
throw refreshError;
|
|
2834
|
-
}
|
|
2835
|
-
}
|
|
2836
|
-
if (res.result !== void 0) {
|
|
2837
|
-
return typeof res.result === "number" ? `0x${res.result.toString(16)}` : res.result;
|
|
2838
|
-
}
|
|
2839
|
-
throw createAbcError(
|
|
2840
|
-
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
2841
|
-
res.errorMessage || res.msg || "Failed to get transaction count",
|
|
2842
|
-
res
|
|
2843
|
-
);
|
|
2844
2108
|
}
|
|
2845
2109
|
/**
|
|
2846
2110
|
* Get wallet info
|
|
@@ -2909,217 +2173,105 @@ var AbcWaasClient = class {
|
|
|
2909
2173
|
* Reference: SigningService.ts:56-72, wallet/api/index.ts:56-72
|
|
2910
2174
|
*/
|
|
2911
2175
|
async generateSolanaWallet(pin, isRecover = false) {
|
|
2912
|
-
const
|
|
2913
|
-
|
|
2914
|
-
method: "POST",
|
|
2915
|
-
headers: {
|
|
2916
|
-
"Content-Type": "application/json",
|
|
2917
|
-
// V3 API requires JSON, not form-urlencoded
|
|
2918
|
-
Accept: "application/json",
|
|
2919
|
-
...this.accessToken ? { Authorization: `Bearer ${this.accessToken}` } : {}
|
|
2920
|
-
},
|
|
2921
|
-
body: JSON.stringify({
|
|
2922
|
-
curve: "ed25519",
|
|
2923
|
-
password: pin
|
|
2924
|
-
// PIN will be encrypted by Secure Channel
|
|
2925
|
-
// Note: network parameter not needed for v3 API
|
|
2926
|
-
})
|
|
2927
|
-
});
|
|
2928
|
-
let data;
|
|
2929
|
-
try {
|
|
2930
|
-
data = await response.json();
|
|
2931
|
-
} catch (e) {
|
|
2932
|
-
console.error(`[AbcWaasClient] Failed to parse response from ${url}:`, e);
|
|
2933
|
-
throw createAbcError(
|
|
2934
|
-
"WALLET_NOT_FOUND" /* WALLET_NOT_FOUND */,
|
|
2935
|
-
`Failed to ${isRecover ? "recover" : "generate"} Solana wallet - invalid response`,
|
|
2936
|
-
{ status: response.status }
|
|
2937
|
-
);
|
|
2938
|
-
}
|
|
2939
|
-
if (!response.ok) {
|
|
2940
|
-
if (!isRecover && response.status === 409) {
|
|
2941
|
-
const error = createAbcError(
|
|
2942
|
-
"WALLET_NOT_FOUND" /* WALLET_NOT_FOUND */,
|
|
2943
|
-
"Wallet already exists",
|
|
2944
|
-
data
|
|
2945
|
-
);
|
|
2946
|
-
error.response = { status: 409 };
|
|
2947
|
-
throw error;
|
|
2948
|
-
}
|
|
2949
|
-
console.error(
|
|
2950
|
-
`[AbcWaasClient] ${isRecover ? "Recover" : "Generate"} failed:`,
|
|
2951
|
-
data
|
|
2952
|
-
);
|
|
2176
|
+
const api = getTalkenApiClient();
|
|
2177
|
+
if (!api) {
|
|
2953
2178
|
throw createAbcError(
|
|
2954
|
-
"
|
|
2955
|
-
|
|
2956
|
-
data
|
|
2179
|
+
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
2180
|
+
"TalkenApiClient not initialized"
|
|
2957
2181
|
);
|
|
2958
2182
|
}
|
|
2959
|
-
const
|
|
2960
|
-
if (!
|
|
2961
|
-
console.error(
|
|
2962
|
-
"[AbcWaasClient] Invalid wallet response, missing required fields:",
|
|
2963
|
-
result
|
|
2964
|
-
);
|
|
2183
|
+
const response = isRecover ? await api.wallet.recover(pin) : await api.wallet.generate(pin);
|
|
2184
|
+
if (!response.solana) {
|
|
2965
2185
|
throw createAbcError(
|
|
2966
2186
|
"WALLET_NOT_FOUND" /* WALLET_NOT_FOUND */,
|
|
2967
|
-
`
|
|
2968
|
-
data
|
|
2187
|
+
`Solana wallet not returned from ${isRecover ? "recovery" : "generation"}`
|
|
2969
2188
|
);
|
|
2970
2189
|
}
|
|
2971
|
-
|
|
2972
|
-
const addressResult = await this.getSolanaAddress(
|
|
2973
|
-
result.public_key,
|
|
2974
|
-
solanaNetwork
|
|
2975
|
-
);
|
|
2976
|
-
return {
|
|
2977
|
-
uid: result.uid || "",
|
|
2978
|
-
sessionId: result.share_id || result.key_id,
|
|
2979
|
-
shareId: result.share_id || result.key_id,
|
|
2980
|
-
publicKey: result.public_key,
|
|
2981
|
-
address: addressResult,
|
|
2982
|
-
keyId: result.key_id,
|
|
2983
|
-
encryptedShare: result.encrypted_share || "",
|
|
2984
|
-
secretStore: result.secret_store || "",
|
|
2985
|
-
network: solanaNetwork
|
|
2986
|
-
};
|
|
2190
|
+
return response.solana;
|
|
2987
2191
|
}
|
|
2988
2192
|
/**
|
|
2989
2193
|
* Get Solana address from Ed25519 public key
|
|
2990
2194
|
* Reference: wallet/api/index.ts:74-82
|
|
2991
2195
|
*/
|
|
2992
|
-
async getSolanaAddress(publicKey,
|
|
2993
|
-
const
|
|
2994
|
-
|
|
2995
|
-
network,
|
|
2996
|
-
publicKey
|
|
2997
|
-
}).toString();
|
|
2998
|
-
const response = await fetch(url, {
|
|
2999
|
-
method: "POST",
|
|
3000
|
-
headers: {
|
|
3001
|
-
...DEFAULT_HEADERS,
|
|
3002
|
-
// Contains 'Content-Type': 'application/x-www-form-urlencoded'
|
|
3003
|
-
...this.accessToken ? { Authorization: `Bearer ${this.accessToken}` } : {}
|
|
3004
|
-
},
|
|
3005
|
-
body
|
|
3006
|
-
});
|
|
3007
|
-
const data = await response.json();
|
|
3008
|
-
if (!response.ok || data.status !== "success") {
|
|
2196
|
+
async getSolanaAddress(publicKey, _network) {
|
|
2197
|
+
const api = getTalkenApiClient();
|
|
2198
|
+
if (!api) {
|
|
3009
2199
|
throw createAbcError(
|
|
3010
2200
|
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
3011
|
-
"
|
|
3012
|
-
data
|
|
2201
|
+
"TalkenApiClient not initialized"
|
|
3013
2202
|
);
|
|
3014
2203
|
}
|
|
3015
|
-
|
|
2204
|
+
const addresses = await api.wallet.getAddresses();
|
|
2205
|
+
if (!addresses.solana) {
|
|
2206
|
+
throw createAbcError(
|
|
2207
|
+
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
2208
|
+
"Solana address not available"
|
|
2209
|
+
);
|
|
2210
|
+
}
|
|
2211
|
+
return addresses.solana;
|
|
3016
2212
|
}
|
|
3017
2213
|
/**
|
|
3018
|
-
* Sign Solana transaction with Ed25519
|
|
3019
|
-
* Reference: SigningService.ts:587-626, wallet/api/index.ts:114-122
|
|
2214
|
+
* Sign Solana transaction with Ed25519 (via talken-api proxy)
|
|
3020
2215
|
*/
|
|
3021
2216
|
async signSolanaTransaction(params) {
|
|
3022
|
-
const
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
"
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
message: params.message,
|
|
3037
|
-
// Hex-encoded transaction
|
|
3038
|
-
password: params.pin,
|
|
3039
|
-
// PIN will be encrypted
|
|
3040
|
-
network: params.network
|
|
3041
|
-
// Required: 'solana' or 'solana_devnet'
|
|
3042
|
-
})
|
|
2217
|
+
const api = getTalkenApiClient();
|
|
2218
|
+
if (!api) {
|
|
2219
|
+
throw createAbcError(
|
|
2220
|
+
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
2221
|
+
"TalkenApiClient not initialized"
|
|
2222
|
+
);
|
|
2223
|
+
}
|
|
2224
|
+
const result = await api.solana.sign({
|
|
2225
|
+
message: params.message,
|
|
2226
|
+
pin: params.pin,
|
|
2227
|
+
keyId: params.keyId,
|
|
2228
|
+
encryptedShare: params.encryptedShare,
|
|
2229
|
+
secretStore: params.secretStore,
|
|
2230
|
+
network: params.network
|
|
3043
2231
|
});
|
|
3044
|
-
|
|
3045
|
-
if (!response.ok || data.status !== "success") {
|
|
2232
|
+
if (!result.signature) {
|
|
3046
2233
|
throw createAbcError(
|
|
3047
2234
|
"SIGNATURE_FAILED" /* SIGNATURE_FAILED */,
|
|
3048
|
-
"Failed to sign Solana transaction"
|
|
3049
|
-
data
|
|
2235
|
+
"Failed to sign Solana transaction"
|
|
3050
2236
|
);
|
|
3051
2237
|
}
|
|
3052
|
-
return {
|
|
3053
|
-
signature: data.result?.signature
|
|
3054
|
-
};
|
|
2238
|
+
return { signature: result.signature };
|
|
3055
2239
|
}
|
|
3056
2240
|
/**
|
|
3057
|
-
* Sign Solana message with Ed25519
|
|
3058
|
-
* Reference: SigningService.ts:546-579
|
|
2241
|
+
* Sign Solana message with Ed25519 (via talken-api proxy)
|
|
3059
2242
|
*/
|
|
3060
2243
|
async signSolanaMessage(params) {
|
|
3061
|
-
const
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
"
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
public_key: params.publicKey,
|
|
3075
|
-
message: params.message,
|
|
3076
|
-
// Hex-encoded message
|
|
3077
|
-
password: params.pin,
|
|
3078
|
-
network: params.network
|
|
3079
|
-
// Required: 'solana' or 'solana_devnet'
|
|
3080
|
-
})
|
|
2244
|
+
const api = getTalkenApiClient();
|
|
2245
|
+
if (!api) {
|
|
2246
|
+
throw createAbcError(
|
|
2247
|
+
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
2248
|
+
"TalkenApiClient not initialized"
|
|
2249
|
+
);
|
|
2250
|
+
}
|
|
2251
|
+
const result = await api.solana.sign({
|
|
2252
|
+
message: params.message,
|
|
2253
|
+
keyId: params.keyId,
|
|
2254
|
+
encryptedShare: params.encryptedShare,
|
|
2255
|
+
secretStore: params.secretStore,
|
|
2256
|
+
network: params.network
|
|
3081
2257
|
});
|
|
3082
|
-
|
|
3083
|
-
if (!response.ok || data.status !== "success") {
|
|
2258
|
+
if (!result.signature) {
|
|
3084
2259
|
throw createAbcError(
|
|
3085
2260
|
"SIGNATURE_FAILED" /* SIGNATURE_FAILED */,
|
|
3086
|
-
"Failed to sign Solana message"
|
|
3087
|
-
data
|
|
2261
|
+
"Failed to sign Solana message"
|
|
3088
2262
|
);
|
|
3089
2263
|
}
|
|
3090
|
-
return {
|
|
3091
|
-
signature: data.result?.signature
|
|
3092
|
-
};
|
|
2264
|
+
return { signature: result.signature };
|
|
3093
2265
|
}
|
|
3094
2266
|
/**
|
|
3095
|
-
* Send Solana transaction
|
|
3096
|
-
*
|
|
2267
|
+
* Send Solana transaction (via talken-api proxy)
|
|
2268
|
+
* @deprecated Use TalkenApiClient.solana.transfer() for integrated flow
|
|
3097
2269
|
*/
|
|
3098
|
-
async sendSolanaTransaction(
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
...DEFAULT_HEADERS,
|
|
3104
|
-
...this.accessToken ? { Authorization: `Bearer ${this.accessToken}` } : {}
|
|
3105
|
-
},
|
|
3106
|
-
body: JSON.stringify({
|
|
3107
|
-
network: params.network,
|
|
3108
|
-
serializedTX: params.serializedTX,
|
|
3109
|
-
signatures: params.signatures
|
|
3110
|
-
})
|
|
3111
|
-
});
|
|
3112
|
-
const data = await response.json();
|
|
3113
|
-
if (!response.ok || data.status !== "success") {
|
|
3114
|
-
throw createAbcError(
|
|
3115
|
-
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
3116
|
-
"Failed to send Solana transaction",
|
|
3117
|
-
data
|
|
3118
|
-
);
|
|
3119
|
-
}
|
|
3120
|
-
return {
|
|
3121
|
-
txHash: data.result?.data
|
|
3122
|
-
};
|
|
2270
|
+
async sendSolanaTransaction(_params) {
|
|
2271
|
+
throw createAbcError(
|
|
2272
|
+
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
2273
|
+
"sendSolanaTransaction is deprecated. Use TalkenApiClient.solana.transfer() instead."
|
|
2274
|
+
);
|
|
3123
2275
|
}
|
|
3124
2276
|
};
|
|
3125
2277
|
function createAbcWaasClient(config) {
|
|
@@ -3129,7 +2281,7 @@ function createAbcWaasClient(config) {
|
|
|
3129
2281
|
// src/wallets/walletConnectors/abcWallet/abcProvider.ts
|
|
3130
2282
|
init_networks();
|
|
3131
2283
|
import { getTalkenApiClient as getTalkenApiClient2 } from "@talken/talkenkit";
|
|
3132
|
-
import { parseGwei
|
|
2284
|
+
import { parseGwei } from "viem";
|
|
3133
2285
|
var EventEmitter = class {
|
|
3134
2286
|
constructor() {
|
|
3135
2287
|
this.events = /* @__PURE__ */ new Map();
|
|
@@ -3366,7 +2518,7 @@ var AbcEvmProvider = class extends EventEmitter {
|
|
|
3366
2518
|
}
|
|
3367
2519
|
if (resolved.gasFee?.maxFeePerGas) {
|
|
3368
2520
|
try {
|
|
3369
|
-
const maxFeeWei =
|
|
2521
|
+
const maxFeeWei = parseGwei(resolved.gasFee.maxFeePerGas);
|
|
3370
2522
|
tx.maxFeePerGas = `0x${maxFeeWei.toString(16)}`;
|
|
3371
2523
|
} catch (error) {
|
|
3372
2524
|
console.error(
|
|
@@ -3377,7 +2529,7 @@ var AbcEvmProvider = class extends EventEmitter {
|
|
|
3377
2529
|
}
|
|
3378
2530
|
if (resolved.gasFee?.maxPriorityFeePerGas) {
|
|
3379
2531
|
try {
|
|
3380
|
-
const priorityFeeWei =
|
|
2532
|
+
const priorityFeeWei = parseGwei(
|
|
3381
2533
|
resolved.gasFee.maxPriorityFeePerGas
|
|
3382
2534
|
);
|
|
3383
2535
|
tx.maxPriorityFeePerGas = `0x${priorityFeeWei.toString(16)}`;
|
|
@@ -3410,7 +2562,7 @@ var AbcEvmProvider = class extends EventEmitter {
|
|
|
3410
2562
|
const api = this.talkenApi || getTalkenApiClient2();
|
|
3411
2563
|
const result = await api.evm.sendTransaction({
|
|
3412
2564
|
chainKey: getChainKey(this.chainId),
|
|
3413
|
-
|
|
2565
|
+
to: tx.to,
|
|
3414
2566
|
amountWei,
|
|
3415
2567
|
pin: pinHash,
|
|
3416
2568
|
data: tx.data || "0x",
|
|
@@ -3444,7 +2596,7 @@ var AbcEvmProvider = class extends EventEmitter {
|
|
|
3444
2596
|
}
|
|
3445
2597
|
if (resolved.gasFee?.maxFeePerGas) {
|
|
3446
2598
|
try {
|
|
3447
|
-
const maxFeeWei =
|
|
2599
|
+
const maxFeeWei = parseGwei(resolved.gasFee.maxFeePerGas);
|
|
3448
2600
|
tx.maxFeePerGas = `0x${maxFeeWei.toString(16)}`;
|
|
3449
2601
|
} catch (error) {
|
|
3450
2602
|
console.error(
|
|
@@ -3455,7 +2607,7 @@ var AbcEvmProvider = class extends EventEmitter {
|
|
|
3455
2607
|
}
|
|
3456
2608
|
if (resolved.gasFee?.maxPriorityFeePerGas) {
|
|
3457
2609
|
try {
|
|
3458
|
-
const priorityFeeWei =
|
|
2610
|
+
const priorityFeeWei = parseGwei(
|
|
3459
2611
|
resolved.gasFee.maxPriorityFeePerGas
|
|
3460
2612
|
);
|
|
3461
2613
|
tx.maxPriorityFeePerGas = `0x${priorityFeeWei.toString(16)}`;
|
|
@@ -3508,10 +2660,13 @@ var AbcEvmProvider = class extends EventEmitter {
|
|
|
3508
2660
|
);
|
|
3509
2661
|
}
|
|
3510
2662
|
const api = this.talkenApi || getTalkenApiClient2();
|
|
2663
|
+
const network = getNetworkName(this.chainId);
|
|
2664
|
+
const pinHash = localStorage.getItem("talkenkit_abc_pin_hash") || void 0;
|
|
3511
2665
|
const result = await api.evm.signPersonal({
|
|
3512
|
-
network
|
|
2666
|
+
network,
|
|
3513
2667
|
message,
|
|
3514
|
-
address
|
|
2668
|
+
address,
|
|
2669
|
+
pin: pinHash
|
|
3515
2670
|
});
|
|
3516
2671
|
return result.signature;
|
|
3517
2672
|
}
|
|
@@ -3554,9 +2709,11 @@ var AbcEvmProvider = class extends EventEmitter {
|
|
|
3554
2709
|
}
|
|
3555
2710
|
const api = this.talkenApi || getTalkenApiClient2();
|
|
3556
2711
|
const network = getNetworkName(this.chainId);
|
|
2712
|
+
const pinHash = localStorage.getItem("talkenkit_abc_pin_hash") || void 0;
|
|
3557
2713
|
const result = await api.evm.signTypedData({
|
|
3558
2714
|
network,
|
|
3559
|
-
typedData: typeof typedData === "string" ? typedData : JSON.stringify(typedData)
|
|
2715
|
+
typedData: typeof typedData === "string" ? typedData : JSON.stringify(typedData),
|
|
2716
|
+
pin: pinHash
|
|
3560
2717
|
});
|
|
3561
2718
|
return result.signature;
|
|
3562
2719
|
}
|
|
@@ -3684,6 +2841,89 @@ function createAbcEvmProvider(client, talkenApi) {
|
|
|
3684
2841
|
}
|
|
3685
2842
|
var createAbcProvider = createAbcEvmProvider;
|
|
3686
2843
|
|
|
2844
|
+
// src/wallets/walletConnectors/abcWallet/networkConfig.ts
|
|
2845
|
+
var SolanaNetwork = /* @__PURE__ */ ((SolanaNetwork3) => {
|
|
2846
|
+
SolanaNetwork3["Mainnet"] = "solana";
|
|
2847
|
+
SolanaNetwork3["Devnet"] = "solana_devnet";
|
|
2848
|
+
SolanaNetwork3["Testnet"] = "solana_testnet";
|
|
2849
|
+
return SolanaNetwork3;
|
|
2850
|
+
})(SolanaNetwork || {});
|
|
2851
|
+
var BitcoinNetwork = /* @__PURE__ */ ((BitcoinNetwork2) => {
|
|
2852
|
+
BitcoinNetwork2["Mainnet"] = "bitcoin";
|
|
2853
|
+
BitcoinNetwork2["Testnet"] = "bitcoin_testnet";
|
|
2854
|
+
return BitcoinNetwork2;
|
|
2855
|
+
})(BitcoinNetwork || {});
|
|
2856
|
+
var TronNetwork = /* @__PURE__ */ ((TronNetwork2) => {
|
|
2857
|
+
TronNetwork2["Mainnet"] = "tron";
|
|
2858
|
+
TronNetwork2["Nile"] = "tron_nile";
|
|
2859
|
+
return TronNetwork2;
|
|
2860
|
+
})(TronNetwork || {});
|
|
2861
|
+
var DEFAULT_NETWORK_CONFIG = {
|
|
2862
|
+
evm: {
|
|
2863
|
+
mainnet: 1,
|
|
2864
|
+
// Ethereum Mainnet
|
|
2865
|
+
testnet: 11155111
|
|
2866
|
+
// Sepolia Testnet
|
|
2867
|
+
},
|
|
2868
|
+
solana: {
|
|
2869
|
+
mainnet: "solana" /* Mainnet */,
|
|
2870
|
+
devnet: "solana_devnet" /* Devnet */
|
|
2871
|
+
},
|
|
2872
|
+
bitcoin: {
|
|
2873
|
+
mainnet: "bitcoin" /* Mainnet */,
|
|
2874
|
+
testnet: "bitcoin_testnet" /* Testnet */
|
|
2875
|
+
},
|
|
2876
|
+
tron: {
|
|
2877
|
+
mainnet: "tron" /* Mainnet */,
|
|
2878
|
+
testnet: "tron_nile" /* Nile */
|
|
2879
|
+
}
|
|
2880
|
+
};
|
|
2881
|
+
var globalDefaultChainId;
|
|
2882
|
+
var globalDefaultSolanaNetwork;
|
|
2883
|
+
var globalDefaultBitcoinNetwork;
|
|
2884
|
+
var globalDefaultTronNetwork;
|
|
2885
|
+
function setGlobalDefaultChainId(chainId) {
|
|
2886
|
+
globalDefaultChainId = chainId;
|
|
2887
|
+
}
|
|
2888
|
+
function setGlobalDefaultSolanaNetwork(network) {
|
|
2889
|
+
globalDefaultSolanaNetwork = network;
|
|
2890
|
+
}
|
|
2891
|
+
function setGlobalDefaultBitcoinNetwork(network) {
|
|
2892
|
+
globalDefaultBitcoinNetwork = network;
|
|
2893
|
+
}
|
|
2894
|
+
function getEvmNetwork(customChainId) {
|
|
2895
|
+
if (customChainId !== void 0) {
|
|
2896
|
+
return customChainId;
|
|
2897
|
+
}
|
|
2898
|
+
if (globalDefaultChainId !== void 0) {
|
|
2899
|
+
return globalDefaultChainId;
|
|
2900
|
+
}
|
|
2901
|
+
const isProduction = typeof process !== "undefined" && process.env.NEXT_PUBLIC_ENVIRONMENT === "production";
|
|
2902
|
+
const fallbackChainId = isProduction ? DEFAULT_NETWORK_CONFIG.evm.mainnet : DEFAULT_NETWORK_CONFIG.evm.testnet;
|
|
2903
|
+
return fallbackChainId;
|
|
2904
|
+
}
|
|
2905
|
+
function getSolanaNetwork() {
|
|
2906
|
+
if (globalDefaultSolanaNetwork !== void 0) {
|
|
2907
|
+
return globalDefaultSolanaNetwork;
|
|
2908
|
+
}
|
|
2909
|
+
const isProduction = typeof process !== "undefined" && process.env.NEXT_PUBLIC_ENVIRONMENT === "production";
|
|
2910
|
+
return isProduction ? DEFAULT_NETWORK_CONFIG.solana.mainnet : DEFAULT_NETWORK_CONFIG.solana.devnet;
|
|
2911
|
+
}
|
|
2912
|
+
function getBitcoinNetwork() {
|
|
2913
|
+
if (globalDefaultBitcoinNetwork !== void 0) {
|
|
2914
|
+
return globalDefaultBitcoinNetwork;
|
|
2915
|
+
}
|
|
2916
|
+
const isProduction = typeof process !== "undefined" && process.env.NEXT_PUBLIC_ENVIRONMENT === "production";
|
|
2917
|
+
return isProduction ? DEFAULT_NETWORK_CONFIG.bitcoin.mainnet : DEFAULT_NETWORK_CONFIG.bitcoin.testnet;
|
|
2918
|
+
}
|
|
2919
|
+
function getTronNetwork() {
|
|
2920
|
+
if (globalDefaultTronNetwork !== void 0) {
|
|
2921
|
+
return globalDefaultTronNetwork;
|
|
2922
|
+
}
|
|
2923
|
+
const isProduction = typeof process !== "undefined" && process.env.NEXT_PUBLIC_ENVIRONMENT === "production";
|
|
2924
|
+
return isProduction ? DEFAULT_NETWORK_CONFIG.tron.mainnet : DEFAULT_NETWORK_CONFIG.tron.testnet;
|
|
2925
|
+
}
|
|
2926
|
+
|
|
3687
2927
|
// src/wallets/walletConnectors/abcWallet/abcConnector.ts
|
|
3688
2928
|
function abcConnector(options) {
|
|
3689
2929
|
const { config } = options;
|
|
@@ -4124,7 +3364,7 @@ var TalkenWalletModule = class {
|
|
|
4124
3364
|
}
|
|
4125
3365
|
/**
|
|
4126
3366
|
* Generate/recover MPC wallets (create = idempotent generate/recover)
|
|
4127
|
-
* POST /wallet/mpc { action: 'create', email?,
|
|
3367
|
+
* POST /wallet/mpc { action: 'create', email?, pin }
|
|
4128
3368
|
*
|
|
4129
3369
|
* @param pin - SHA-256 hashed PIN
|
|
4130
3370
|
* @param email - User email (optional; server resolves from bearer token if omitted)
|
|
@@ -4133,7 +3373,7 @@ var TalkenWalletModule = class {
|
|
|
4133
3373
|
return this.client.post(TALKEN_API_ENDPOINTS.WALLET_MPC, {
|
|
4134
3374
|
action: "create",
|
|
4135
3375
|
...email && { email },
|
|
4136
|
-
|
|
3376
|
+
pin
|
|
4137
3377
|
});
|
|
4138
3378
|
}
|
|
4139
3379
|
/**
|
|
@@ -4223,7 +3463,7 @@ var TalkenEvmModule = class {
|
|
|
4223
3463
|
}
|
|
4224
3464
|
/**
|
|
4225
3465
|
* Integrated EVM transfer (sign + broadcast)
|
|
4226
|
-
* POST /wallet/tx/evm { chainKey,
|
|
3466
|
+
* POST /wallet/tx/evm { chainKey, to, amountWei, pin, ... }
|
|
4227
3467
|
*/
|
|
4228
3468
|
async sendTransaction(params) {
|
|
4229
3469
|
return this.client.post(
|
|
@@ -4267,8 +3507,6 @@ var TalkenEvmModule = class {
|
|
|
4267
3507
|
const qs = new URLSearchParams({ network, address }).toString();
|
|
4268
3508
|
return this.client.get(`${TALKEN_API_ENDPOINTS.NONCE}?${qs}`);
|
|
4269
3509
|
}
|
|
4270
|
-
// NOTE: signPersonal (EIP-191) is NOT proxied by talken-api.
|
|
4271
|
-
// Use the existing WaaS direct call in abcApi.ts.
|
|
4272
3510
|
};
|
|
4273
3511
|
var TalkenSolanaModule = class {
|
|
4274
3512
|
constructor(client) {
|
|
@@ -4286,8 +3524,22 @@ var TalkenSolanaModule = class {
|
|
|
4286
3524
|
params
|
|
4287
3525
|
);
|
|
4288
3526
|
}
|
|
4289
|
-
|
|
4290
|
-
|
|
3527
|
+
/**
|
|
3528
|
+
* Sign Solana transaction or message (sign-only, no broadcast)
|
|
3529
|
+
* POST /wallet/sign/sol
|
|
3530
|
+
*
|
|
3531
|
+
* Two modes:
|
|
3532
|
+
* - PIN mode: { message, pin } — server resolves signing material
|
|
3533
|
+
* - Share mode: { message, keyId, encryptedShare } — no PIN required (for signMessage)
|
|
3534
|
+
*
|
|
3535
|
+
* @returns Ed25519 signature (hex) and optionally public key
|
|
3536
|
+
*/
|
|
3537
|
+
async sign(params) {
|
|
3538
|
+
return this.client.post(
|
|
3539
|
+
TALKEN_API_ENDPOINTS.SIGN_SVM,
|
|
3540
|
+
params
|
|
3541
|
+
);
|
|
3542
|
+
}
|
|
4291
3543
|
};
|
|
4292
3544
|
var TalkenBitcoinModule = class {
|
|
4293
3545
|
constructor(client) {
|
|
@@ -4370,6 +3622,16 @@ var TalkenBitcoinModule = class {
|
|
|
4370
3622
|
params
|
|
4371
3623
|
);
|
|
4372
3624
|
}
|
|
3625
|
+
/**
|
|
3626
|
+
* Sign raw hash via secp256k1 MPC (universal: EVM/BTC/TVM)
|
|
3627
|
+
* POST /wallet/sign/hash { hash, pin, network? }
|
|
3628
|
+
*/
|
|
3629
|
+
async signHash(params) {
|
|
3630
|
+
return this.client.post(
|
|
3631
|
+
TALKEN_API_ENDPOINTS.SIGN_HASH,
|
|
3632
|
+
params
|
|
3633
|
+
);
|
|
3634
|
+
}
|
|
4373
3635
|
/**
|
|
4374
3636
|
* Broadcast raw BTC transaction
|
|
4375
3637
|
* POST /wallet/tx/raw { network, signedSerializeTx }
|
|
@@ -4620,7 +3882,7 @@ var TalkenApiClient = class {
|
|
|
4620
3882
|
errCode,
|
|
4621
3883
|
errMsg,
|
|
4622
3884
|
response.status,
|
|
4623
|
-
data.error?.details
|
|
3885
|
+
data.error?.details || data.details
|
|
4624
3886
|
);
|
|
4625
3887
|
}
|
|
4626
3888
|
return data.data ?? data;
|
|
@@ -4671,19 +3933,13 @@ function createTalkenApiClient(config) {
|
|
|
4671
3933
|
|
|
4672
3934
|
// src/wallets/walletConnectors/abcWallet/abcWallet.ts
|
|
4673
3935
|
var abcWallet = (specificOptions) => ({ projectId }) => {
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
const waasUrl = specificOptions?.waasUrl || process.env.NEXT_PUBLIC_ABC_WAAS_URL || process.env.VITE_ABC_WAAS_URL;
|
|
4682
|
-
if (!waasUrl) {
|
|
4683
|
-
throw new Error(
|
|
4684
|
-
'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'
|
|
4685
|
-
);
|
|
4686
|
-
}
|
|
3936
|
+
const talkenApiUrl = specificOptions?.talkenApiUrl || process.env.NEXT_PUBLIC_API_URL || "http://localhost:3001/api/v1";
|
|
3937
|
+
const talkenApi = createTalkenApiClient({
|
|
3938
|
+
baseUrl: talkenApiUrl,
|
|
3939
|
+
debug: specificOptions?.environment === "development"
|
|
3940
|
+
});
|
|
3941
|
+
setTalkenApiClient(talkenApi);
|
|
3942
|
+
const waasUrl = specificOptions?.waasUrl || process.env.NEXT_PUBLIC_ABC_WAAS_URL || process.env.VITE_ABC_WAAS_URL || "";
|
|
4687
3943
|
const config = {
|
|
4688
3944
|
waasUrl,
|
|
4689
3945
|
apiKey: specificOptions?.apiKey,
|
|
@@ -4723,7 +3979,6 @@ var BaseApiClient = class {
|
|
|
4723
3979
|
this.refreshPromise = null;
|
|
4724
3980
|
this.config = config;
|
|
4725
3981
|
this.baseURL = config.waasUrl;
|
|
4726
|
-
this.secure = new secure_default(this.baseURL);
|
|
4727
3982
|
this.loadTokens();
|
|
4728
3983
|
}
|
|
4729
3984
|
/**
|
|
@@ -4965,12 +4220,6 @@ var BaseApiClient = class {
|
|
|
4965
4220
|
async logout() {
|
|
4966
4221
|
this.clearTokens();
|
|
4967
4222
|
}
|
|
4968
|
-
/**
|
|
4969
|
-
* Get secure service instance
|
|
4970
|
-
*/
|
|
4971
|
-
getSecureService() {
|
|
4972
|
-
return this.secure;
|
|
4973
|
-
}
|
|
4974
4223
|
};
|
|
4975
4224
|
|
|
4976
4225
|
// src/wallets/walletConnectors/abcWallet/api/AuthApi.ts
|
|
@@ -5185,9 +4434,6 @@ var WalletApi = class extends BaseApiClient {
|
|
|
5185
4434
|
encryptedShare: evm.encryptedShare || "",
|
|
5186
4435
|
uid: evm.uid,
|
|
5187
4436
|
sid: evm.sid,
|
|
5188
|
-
wid: evm.wid,
|
|
5189
|
-
pvencstr: evm.pvencstr,
|
|
5190
|
-
encryptDevicePassword: evm.encryptDevicePassword,
|
|
5191
4437
|
pubkey: evm.pubkey || null
|
|
5192
4438
|
};
|
|
5193
4439
|
}
|
|
@@ -5271,96 +4517,7 @@ var WalletApi = class extends BaseApiClient {
|
|
|
5271
4517
|
};
|
|
5272
4518
|
|
|
5273
4519
|
// src/wallets/walletConnectors/abcWallet/api/TransactionApi.ts
|
|
5274
|
-
init_networks();
|
|
5275
4520
|
var TransactionApi = class extends BaseApiClient {
|
|
5276
|
-
/**
|
|
5277
|
-
* Send raw transaction
|
|
5278
|
-
*/
|
|
5279
|
-
async sendRawTransaction(chainId, signedTransaction) {
|
|
5280
|
-
const network = getNetworkName(chainId);
|
|
5281
|
-
const secureChannelId = await this.secure.getSecureChannelId();
|
|
5282
|
-
const bodyData = {
|
|
5283
|
-
signedSerializeTx: signedTransaction,
|
|
5284
|
-
network
|
|
5285
|
-
};
|
|
5286
|
-
const bodyString = new URLSearchParams(bodyData).toString();
|
|
5287
|
-
const url = `${this.baseURL}${ABC_ENDPOINTS.SEND_RAW_TX}`;
|
|
5288
|
-
const response = await fetch(url, {
|
|
5289
|
-
method: "POST",
|
|
5290
|
-
headers: {
|
|
5291
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
5292
|
-
"Secure-Channel": secureChannelId,
|
|
5293
|
-
...this.accessToken ? { Authorization: `Bearer ${this.accessToken}` } : {}
|
|
5294
|
-
},
|
|
5295
|
-
body: bodyString
|
|
5296
|
-
});
|
|
5297
|
-
const text = await response.text();
|
|
5298
|
-
if (!text) {
|
|
5299
|
-
throw createAbcError(
|
|
5300
|
-
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
5301
|
-
`Empty response from sendRawTx API (status: ${response.status})`,
|
|
5302
|
-
{ status: response.status }
|
|
5303
|
-
);
|
|
5304
|
-
}
|
|
5305
|
-
const res = JSON.parse(text);
|
|
5306
|
-
if (response.status === 401 && this.refreshToken) {
|
|
5307
|
-
try {
|
|
5308
|
-
await this.refreshAccessToken();
|
|
5309
|
-
const retryResponse = await fetch(url, {
|
|
5310
|
-
method: "POST",
|
|
5311
|
-
headers: {
|
|
5312
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
5313
|
-
"Secure-Channel": secureChannelId,
|
|
5314
|
-
...this.accessToken ? { Authorization: `Bearer ${this.accessToken}` } : {}
|
|
5315
|
-
},
|
|
5316
|
-
body: bodyString
|
|
5317
|
-
});
|
|
5318
|
-
const retryText = await retryResponse.text();
|
|
5319
|
-
if (!retryText) {
|
|
5320
|
-
throw createAbcError(
|
|
5321
|
-
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
5322
|
-
`Empty response after retry (status: ${retryResponse.status})`,
|
|
5323
|
-
{ status: retryResponse.status }
|
|
5324
|
-
);
|
|
5325
|
-
}
|
|
5326
|
-
const retryRes = JSON.parse(retryText);
|
|
5327
|
-
if (retryRes.item || retryRes.txHash || retryRes.result?.txHash) {
|
|
5328
|
-
const txHash = retryRes.item || retryRes.txHash || retryRes.result.txHash;
|
|
5329
|
-
return { txHash };
|
|
5330
|
-
}
|
|
5331
|
-
throw createAbcError(
|
|
5332
|
-
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
5333
|
-
"Failed to send transaction after token refresh",
|
|
5334
|
-
retryRes
|
|
5335
|
-
);
|
|
5336
|
-
} catch (refreshError) {
|
|
5337
|
-
console.error(
|
|
5338
|
-
"Token refresh failed in sendRawTransaction:",
|
|
5339
|
-
refreshError
|
|
5340
|
-
);
|
|
5341
|
-
throw refreshError;
|
|
5342
|
-
}
|
|
5343
|
-
}
|
|
5344
|
-
if (res.result) {
|
|
5345
|
-
if (typeof res.result === "string") {
|
|
5346
|
-
return { txHash: res.result };
|
|
5347
|
-
}
|
|
5348
|
-
if (res.result.txHash) {
|
|
5349
|
-
return { txHash: res.result.txHash };
|
|
5350
|
-
}
|
|
5351
|
-
}
|
|
5352
|
-
if (res.item) {
|
|
5353
|
-
return { txHash: res.item };
|
|
5354
|
-
}
|
|
5355
|
-
if (res.txHash) {
|
|
5356
|
-
return { txHash: res.txHash };
|
|
5357
|
-
}
|
|
5358
|
-
throw createAbcError(
|
|
5359
|
-
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
5360
|
-
"Failed to send transaction",
|
|
5361
|
-
res
|
|
5362
|
-
);
|
|
5363
|
-
}
|
|
5364
4521
|
/**
|
|
5365
4522
|
* Get transaction count (nonce)
|
|
5366
4523
|
*/
|
|
@@ -5436,452 +4593,126 @@ var TransactionApi = class extends BaseApiClient {
|
|
|
5436
4593
|
}
|
|
5437
4594
|
};
|
|
5438
4595
|
|
|
5439
|
-
// src/wallets/walletConnectors/abcWallet/api/
|
|
5440
|
-
|
|
5441
|
-
import {
|
|
5442
|
-
var
|
|
4596
|
+
// src/wallets/walletConnectors/abcWallet/api/SolanaApi.ts
|
|
4597
|
+
import { PublicKey } from "@solana/web3.js";
|
|
4598
|
+
import { getTalkenApiClient as getTalkenApiClient7 } from "@talken/talkenkit";
|
|
4599
|
+
var SolanaApi = class extends BaseApiClient {
|
|
5443
4600
|
/**
|
|
5444
|
-
*
|
|
4601
|
+
* Generate Solana wallet (Ed25519)
|
|
4602
|
+
* Delegates to TalkenApiClient unified wallet endpoint.
|
|
4603
|
+
*
|
|
4604
|
+
* @param pin - Hashed PIN (SHA-256)
|
|
4605
|
+
* @param isRecover - Whether to recover existing wallet (default: false)
|
|
4606
|
+
* @returns Solana wallet information
|
|
5445
4607
|
*/
|
|
5446
|
-
async
|
|
5447
|
-
|
|
5448
|
-
|
|
5449
|
-
|
|
4608
|
+
async generateSolanaWallet(pin, isRecover = false) {
|
|
4609
|
+
const api = getTalkenApiClient7();
|
|
4610
|
+
if (!api)
|
|
4611
|
+
throw new Error("TalkenApiClient not initialized");
|
|
4612
|
+
const response = isRecover ? await api.wallet.recover(pin) : await api.wallet.generate(pin);
|
|
4613
|
+
if (!response.solana) {
|
|
5450
4614
|
throw createAbcError(
|
|
5451
4615
|
"WALLET_NOT_FOUND" /* WALLET_NOT_FOUND */,
|
|
5452
|
-
|
|
4616
|
+
`Solana wallet not returned from TalkenApiClient ${isRecover ? "recovery" : "generation"}`
|
|
5453
4617
|
);
|
|
5454
4618
|
}
|
|
5455
|
-
|
|
5456
|
-
|
|
5457
|
-
|
|
5458
|
-
|
|
5459
|
-
|
|
4619
|
+
return response.solana;
|
|
4620
|
+
}
|
|
4621
|
+
/**
|
|
4622
|
+
* Recover Solana wallet (alias for generateSolanaWallet with isRecover=true)
|
|
4623
|
+
* When TalkenApiClient is available, delegates to the unified recovery endpoint.
|
|
4624
|
+
*
|
|
4625
|
+
* @param pin - Hashed PIN (SHA-256)
|
|
4626
|
+
* @returns Recovered Solana wallet information
|
|
4627
|
+
*/
|
|
4628
|
+
async recoverSolanaWallet(pin) {
|
|
4629
|
+
return this.generateSolanaWallet(pin, true);
|
|
4630
|
+
}
|
|
4631
|
+
/**
|
|
4632
|
+
* Get Solana address from wallet addresses endpoint
|
|
4633
|
+
* Retrieves from TalkenApiClient unified addresses endpoint.
|
|
4634
|
+
*
|
|
4635
|
+
* @returns Solana address string or null if not available
|
|
4636
|
+
*/
|
|
4637
|
+
async getSolanaAddress() {
|
|
4638
|
+
const api = getTalkenApiClient7();
|
|
4639
|
+
if (!api)
|
|
4640
|
+
throw new Error("TalkenApiClient not initialized");
|
|
4641
|
+
const addresses = await api.wallet.getAddresses();
|
|
4642
|
+
return addresses.solana || null;
|
|
4643
|
+
}
|
|
4644
|
+
/**
|
|
4645
|
+
* Derive Solana address from Ed25519 public key
|
|
4646
|
+
* @param publicKey - Ed25519 public key (hex)
|
|
4647
|
+
* @returns Solana address (base58)
|
|
4648
|
+
*/
|
|
4649
|
+
deriveAddressFromPublicKey(publicKey) {
|
|
4650
|
+
const cleanKey = publicKey.startsWith("0x") ? publicKey.slice(2) : publicKey;
|
|
4651
|
+
const bytes = new Uint8Array(
|
|
4652
|
+
cleanKey.match(/.{1,2}/g)?.map((byte) => Number.parseInt(byte, 16)) || []
|
|
5460
4653
|
);
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
|
|
5467
|
-
network,
|
|
5468
|
-
encryptDevicePassword: encryptedDevicePassword,
|
|
5469
|
-
pvencstr: encryptedPvencstr,
|
|
5470
|
-
uid: wallet.uid,
|
|
5471
|
-
wid: encryptedWid,
|
|
5472
|
-
sid: getAddress2(wallet.address),
|
|
5473
|
-
to: tx.to === "0x" ? "0x" : getAddress2(tx.to),
|
|
5474
|
-
type: "EIP1559",
|
|
5475
|
-
ourpubkey: "",
|
|
5476
|
-
ucpubkey: ""
|
|
5477
|
-
};
|
|
5478
|
-
bodyData.from = getAddress2(tx.from || wallet.address);
|
|
5479
|
-
if (tx.value) {
|
|
5480
|
-
let hexValue = tx.value.startsWith("0x") ? tx.value.slice(2) : tx.value;
|
|
5481
|
-
if (hexValue.length % 2 !== 0) {
|
|
5482
|
-
hexValue = `0${hexValue}`;
|
|
5483
|
-
}
|
|
5484
|
-
bodyData.value = `0x${hexValue}`;
|
|
5485
|
-
}
|
|
5486
|
-
if (tx.gasLimit || tx.gas) {
|
|
5487
|
-
const gasLimitValue = tx.gasLimit || tx.gas;
|
|
5488
|
-
if (gasLimitValue.toString().startsWith("0x")) {
|
|
5489
|
-
bodyData.gasLimit = gasLimitValue.toString();
|
|
5490
|
-
} else {
|
|
5491
|
-
bodyData.gasLimit = `0x${BigInt(gasLimitValue).toString(16)}`;
|
|
5492
|
-
}
|
|
5493
|
-
}
|
|
5494
|
-
if (tx.maxFeePerGas) {
|
|
5495
|
-
if (tx.maxFeePerGas.toString().startsWith("0x")) {
|
|
5496
|
-
bodyData.maxFeePerGas = tx.maxFeePerGas.toString();
|
|
5497
|
-
} else {
|
|
5498
|
-
bodyData.maxFeePerGas = `0x${BigInt(tx.maxFeePerGas).toString(16)}`;
|
|
5499
|
-
}
|
|
4654
|
+
try {
|
|
4655
|
+
const pubkey = new PublicKey(bytes);
|
|
4656
|
+
return pubkey.toBase58();
|
|
4657
|
+
} catch (error) {
|
|
4658
|
+
console.error("[SolanaApi] Failed to encode address:", error);
|
|
4659
|
+
return cleanKey;
|
|
5500
4660
|
}
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
5506
|
-
|
|
4661
|
+
}
|
|
4662
|
+
/**
|
|
4663
|
+
* Sign Solana transaction with Ed25519 (via talken-api proxy, PIN mode)
|
|
4664
|
+
*/
|
|
4665
|
+
async signSolanaTransaction(params) {
|
|
4666
|
+
const api = getTalkenApiClient7();
|
|
4667
|
+
if (!api) {
|
|
4668
|
+
throw createAbcError(
|
|
4669
|
+
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
4670
|
+
"TalkenApiClient not initialized"
|
|
4671
|
+
);
|
|
5507
4672
|
}
|
|
5508
|
-
|
|
5509
|
-
const
|
|
5510
|
-
|
|
5511
|
-
|
|
5512
|
-
|
|
5513
|
-
|
|
5514
|
-
|
|
5515
|
-
|
|
5516
|
-
...this.accessToken ? { Authorization: `Bearer ${this.accessToken}` } : {}
|
|
5517
|
-
},
|
|
5518
|
-
body: bodyString
|
|
4673
|
+
const network = getSolanaNetwork();
|
|
4674
|
+
const result = await api.solana.sign({
|
|
4675
|
+
message: params.message,
|
|
4676
|
+
pin: params.pin,
|
|
4677
|
+
keyId: params.keyId,
|
|
4678
|
+
encryptedShare: params.encryptedShare,
|
|
4679
|
+
secretStore: params.secretStore,
|
|
4680
|
+
network
|
|
5519
4681
|
});
|
|
5520
|
-
|
|
5521
|
-
if (response.status === 401 && this.refreshToken) {
|
|
5522
|
-
await this.refreshAccessToken();
|
|
5523
|
-
const retryResponse = await fetch(url, {
|
|
5524
|
-
method: "POST",
|
|
5525
|
-
headers: {
|
|
5526
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
5527
|
-
"Secure-Channel": secureChannelId,
|
|
5528
|
-
...this.accessToken ? { Authorization: `Bearer ${this.accessToken}` } : {}
|
|
5529
|
-
},
|
|
5530
|
-
body: bodyString
|
|
5531
|
-
});
|
|
5532
|
-
const retryRes = await retryResponse.json();
|
|
5533
|
-
if (retryRes.serializedTx && retryRes.rawTx) {
|
|
5534
|
-
return {
|
|
5535
|
-
signature: retryRes.serializedTx,
|
|
5536
|
-
txHash: retryRes.rawTx
|
|
5537
|
-
};
|
|
5538
|
-
}
|
|
5539
|
-
throw createAbcError(
|
|
5540
|
-
"SIGNATURE_FAILED" /* SIGNATURE_FAILED */,
|
|
5541
|
-
"Failed to sign transaction after token refresh",
|
|
5542
|
-
retryRes
|
|
5543
|
-
);
|
|
5544
|
-
}
|
|
5545
|
-
if (res.serializedTx && res.rawTx) {
|
|
5546
|
-
return {
|
|
5547
|
-
signature: res.serializedTx,
|
|
5548
|
-
txHash: res.rawTx
|
|
5549
|
-
};
|
|
5550
|
-
}
|
|
5551
|
-
throw createAbcError(
|
|
5552
|
-
"SIGNATURE_FAILED" /* SIGNATURE_FAILED */,
|
|
5553
|
-
"Failed to sign transaction",
|
|
5554
|
-
res
|
|
5555
|
-
);
|
|
5556
|
-
}
|
|
5557
|
-
/**
|
|
5558
|
-
* Sign message (Personal Sign - EIP-191)
|
|
5559
|
-
*/
|
|
5560
|
-
async signMessage(params) {
|
|
5561
|
-
this.loadTokens();
|
|
5562
|
-
const wallet = loadFromStorage("wallet" /* WALLET */);
|
|
5563
|
-
if (!wallet) {
|
|
5564
|
-
throw createAbcError(
|
|
5565
|
-
"WALLET_NOT_FOUND" /* WALLET_NOT_FOUND */,
|
|
5566
|
-
"Wallet information not found in storage"
|
|
5567
|
-
);
|
|
5568
|
-
}
|
|
5569
|
-
const ethers = await import("ethers");
|
|
5570
|
-
const messageHash = ethers.utils.hashMessage(params.message);
|
|
5571
|
-
const hash = messageHash.startsWith("0x") ? messageHash.slice(2) : messageHash;
|
|
5572
|
-
const encryptedDevicePassword = await this.secure.getEncryptPlain(
|
|
5573
|
-
wallet.encryptDevicePassword
|
|
5574
|
-
);
|
|
5575
|
-
const encryptedPvencstr = await this.secure.getEncryptPlain(
|
|
5576
|
-
wallet.pvencstr
|
|
5577
|
-
);
|
|
5578
|
-
const encryptedWid = await this.secure.getEncryptPlain(wallet.wid);
|
|
5579
|
-
const secureChannelId = await this.secure.getSecureChannelId();
|
|
5580
|
-
const bodyData = {
|
|
5581
|
-
hash,
|
|
5582
|
-
encryptDevicePassword: encryptedDevicePassword,
|
|
5583
|
-
pvencstr: encryptedPvencstr,
|
|
5584
|
-
wid: encryptedWid,
|
|
5585
|
-
uid: wallet.uid,
|
|
5586
|
-
sid: wallet.sid
|
|
5587
|
-
};
|
|
5588
|
-
const bodyString = new URLSearchParams(bodyData).toString();
|
|
5589
|
-
const url = `${this.baseURL}${ABC_ENDPOINTS.SIGN_HASH}`;
|
|
5590
|
-
const response = await fetch(url, {
|
|
5591
|
-
method: "POST",
|
|
5592
|
-
headers: {
|
|
5593
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
5594
|
-
"Secure-Channel": secureChannelId,
|
|
5595
|
-
...this.accessToken ? { Authorization: `Bearer ${this.accessToken}` } : {}
|
|
5596
|
-
},
|
|
5597
|
-
body: bodyString
|
|
5598
|
-
});
|
|
5599
|
-
const text = await response.text();
|
|
5600
|
-
if (!text) {
|
|
4682
|
+
if (!result.signature) {
|
|
5601
4683
|
throw createAbcError(
|
|
5602
4684
|
"SIGNATURE_FAILED" /* SIGNATURE_FAILED */,
|
|
5603
|
-
|
|
5604
|
-
{ status: response.status }
|
|
4685
|
+
"Failed to sign Solana transaction"
|
|
5605
4686
|
);
|
|
5606
4687
|
}
|
|
5607
|
-
|
|
5608
|
-
if (response.status === 401) {
|
|
5609
|
-
if (!this.refreshToken) {
|
|
5610
|
-
this.loadTokens();
|
|
5611
|
-
}
|
|
5612
|
-
if (this.refreshToken) {
|
|
5613
|
-
await this.refreshAccessToken();
|
|
5614
|
-
const retryResponse = await fetch(url, {
|
|
5615
|
-
method: "POST",
|
|
5616
|
-
headers: {
|
|
5617
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
5618
|
-
"Secure-Channel": secureChannelId,
|
|
5619
|
-
...this.accessToken ? { Authorization: `Bearer ${this.accessToken}` } : {}
|
|
5620
|
-
},
|
|
5621
|
-
body: bodyString
|
|
5622
|
-
});
|
|
5623
|
-
const retryText = await retryResponse.text();
|
|
5624
|
-
if (!retryText) {
|
|
5625
|
-
throw createAbcError(
|
|
5626
|
-
"SIGNATURE_FAILED" /* SIGNATURE_FAILED */,
|
|
5627
|
-
`Empty response from retry (status: ${retryResponse.status})`,
|
|
5628
|
-
{ status: retryResponse.status }
|
|
5629
|
-
);
|
|
5630
|
-
}
|
|
5631
|
-
const retryRes = JSON.parse(retryText);
|
|
5632
|
-
if (retryRes.status === "success" && retryRes.result?.signstr) {
|
|
5633
|
-
return { signature: retryRes.result.signstr };
|
|
5634
|
-
}
|
|
5635
|
-
throw createAbcError(
|
|
5636
|
-
"SIGNATURE_FAILED" /* SIGNATURE_FAILED */,
|
|
5637
|
-
"Failed to sign message after token refresh",
|
|
5638
|
-
retryRes
|
|
5639
|
-
);
|
|
5640
|
-
}
|
|
5641
|
-
}
|
|
5642
|
-
if (res.signstr) {
|
|
5643
|
-
const signData = JSON.parse(res.signstr);
|
|
5644
|
-
const sigList = signData.sig_list?.[0];
|
|
5645
|
-
if (!sigList || !sigList.r || !sigList.s) {
|
|
5646
|
-
throw createAbcError(
|
|
5647
|
-
"SIGNATURE_FAILED" /* SIGNATURE_FAILED */,
|
|
5648
|
-
"Invalid signature format",
|
|
5649
|
-
res
|
|
5650
|
-
);
|
|
5651
|
-
}
|
|
5652
|
-
const v = (sigList.vsource || 0) + 27;
|
|
5653
|
-
const signature = sigList.r + sigList.s.slice(2) + v.toString(16).padStart(2, "0");
|
|
5654
|
-
return { signature };
|
|
5655
|
-
}
|
|
5656
|
-
throw createAbcError(
|
|
5657
|
-
"SIGNATURE_FAILED" /* SIGNATURE_FAILED */,
|
|
5658
|
-
"Failed to sign message",
|
|
5659
|
-
res
|
|
5660
|
-
);
|
|
4688
|
+
return { signature: result.signature };
|
|
5661
4689
|
}
|
|
5662
4690
|
/**
|
|
5663
|
-
* Sign
|
|
4691
|
+
* Sign Solana message with Ed25519 (via talken-api proxy, Share mode — no PIN)
|
|
5664
4692
|
*/
|
|
5665
|
-
async
|
|
5666
|
-
const wallet = loadFromStorage("wallet" /* WALLET */);
|
|
5667
|
-
if (!wallet) {
|
|
5668
|
-
throw createAbcError(
|
|
5669
|
-
"WALLET_NOT_FOUND" /* WALLET_NOT_FOUND */,
|
|
5670
|
-
"Wallet information not found in storage"
|
|
5671
|
-
);
|
|
5672
|
-
}
|
|
5673
|
-
const encryptedDevicePassword = await this.secure.getEncryptPlain(
|
|
5674
|
-
wallet.encryptDevicePassword
|
|
5675
|
-
);
|
|
5676
|
-
const encryptedPvencstr = await this.secure.getEncryptPlain(
|
|
5677
|
-
wallet.pvencstr
|
|
5678
|
-
);
|
|
5679
|
-
const encryptedWid = await this.secure.getEncryptPlain(wallet.wid);
|
|
5680
|
-
const secureChannelId = await this.secure.getSecureChannelId();
|
|
5681
|
-
const network = getNetworkName(wallet.chainId);
|
|
5682
|
-
const bodyData = {
|
|
5683
|
-
messageJson: params.typedData,
|
|
5684
|
-
version: "v4",
|
|
5685
|
-
network,
|
|
5686
|
-
encryptDevicePassword: encryptedDevicePassword,
|
|
5687
|
-
pvencstr: encryptedPvencstr,
|
|
5688
|
-
wid: encryptedWid,
|
|
5689
|
-
uid: wallet.uid,
|
|
5690
|
-
sid: wallet.sid
|
|
5691
|
-
};
|
|
5692
|
-
const bodyString = new URLSearchParams(bodyData).toString();
|
|
5693
|
-
const url = `${this.baseURL}${ABC_ENDPOINTS.SIGN_TYPED}`;
|
|
5694
|
-
const response = await fetch(url, {
|
|
5695
|
-
method: "POST",
|
|
5696
|
-
headers: {
|
|
5697
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
5698
|
-
"Secure-Channel": secureChannelId,
|
|
5699
|
-
...this.accessToken ? { Authorization: `Bearer ${this.accessToken}` } : {}
|
|
5700
|
-
},
|
|
5701
|
-
body: bodyString
|
|
5702
|
-
});
|
|
5703
|
-
const text = await response.text();
|
|
5704
|
-
if (!text) {
|
|
5705
|
-
throw createAbcError(
|
|
5706
|
-
"SIGNATURE_FAILED" /* SIGNATURE_FAILED */,
|
|
5707
|
-
`Empty response from signTypedData API (status: ${response.status})`,
|
|
5708
|
-
{ status: response.status }
|
|
5709
|
-
);
|
|
5710
|
-
}
|
|
5711
|
-
const res = JSON.parse(text);
|
|
5712
|
-
if (response.status === 401 && this.refreshToken) {
|
|
5713
|
-
await this.refreshAccessToken();
|
|
5714
|
-
const retryResponse = await fetch(url, {
|
|
5715
|
-
method: "POST",
|
|
5716
|
-
headers: {
|
|
5717
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
5718
|
-
"Secure-Channel": secureChannelId,
|
|
5719
|
-
...this.accessToken ? { Authorization: `Bearer ${this.accessToken}` } : {}
|
|
5720
|
-
},
|
|
5721
|
-
body: bodyString
|
|
5722
|
-
});
|
|
5723
|
-
const retryText = await retryResponse.text();
|
|
5724
|
-
if (!retryText) {
|
|
5725
|
-
throw createAbcError(
|
|
5726
|
-
"SIGNATURE_FAILED" /* SIGNATURE_FAILED */,
|
|
5727
|
-
`Empty response after retry (status: ${retryResponse.status})`,
|
|
5728
|
-
{ status: retryResponse.status }
|
|
5729
|
-
);
|
|
5730
|
-
}
|
|
5731
|
-
const retryRes = JSON.parse(retryText);
|
|
5732
|
-
if (retryRes.serializedTx) {
|
|
5733
|
-
return { signature: retryRes.serializedTx };
|
|
5734
|
-
}
|
|
5735
|
-
throw createAbcError(
|
|
5736
|
-
"SIGNATURE_FAILED" /* SIGNATURE_FAILED */,
|
|
5737
|
-
"Failed to sign typed data after token refresh",
|
|
5738
|
-
retryRes
|
|
5739
|
-
);
|
|
5740
|
-
}
|
|
5741
|
-
if (res.serializedTx) {
|
|
5742
|
-
return { signature: res.serializedTx };
|
|
5743
|
-
}
|
|
5744
|
-
throw createAbcError(
|
|
5745
|
-
"SIGNATURE_FAILED" /* SIGNATURE_FAILED */,
|
|
5746
|
-
"Failed to sign typed data",
|
|
5747
|
-
res
|
|
5748
|
-
);
|
|
5749
|
-
}
|
|
5750
|
-
};
|
|
5751
|
-
|
|
5752
|
-
// src/wallets/walletConnectors/abcWallet/api/SolanaApi.ts
|
|
5753
|
-
import { PublicKey } from "@solana/web3.js";
|
|
5754
|
-
import { getTalkenApiClient as getTalkenApiClient7 } from "@talken/talkenkit";
|
|
5755
|
-
var SolanaApi = class extends BaseApiClient {
|
|
5756
|
-
/**
|
|
5757
|
-
* Generate Solana wallet (Ed25519)
|
|
5758
|
-
* Delegates to TalkenApiClient unified wallet endpoint.
|
|
5759
|
-
*
|
|
5760
|
-
* @param pin - Hashed PIN (SHA-256)
|
|
5761
|
-
* @param isRecover - Whether to recover existing wallet (default: false)
|
|
5762
|
-
* @returns Solana wallet information
|
|
5763
|
-
*/
|
|
5764
|
-
async generateSolanaWallet(pin, isRecover = false) {
|
|
5765
|
-
const api = getTalkenApiClient7();
|
|
5766
|
-
if (!api)
|
|
5767
|
-
throw new Error("TalkenApiClient not initialized");
|
|
5768
|
-
const response = isRecover ? await api.wallet.recover(pin) : await api.wallet.generate(pin);
|
|
5769
|
-
if (!response.solana) {
|
|
5770
|
-
throw createAbcError(
|
|
5771
|
-
"WALLET_NOT_FOUND" /* WALLET_NOT_FOUND */,
|
|
5772
|
-
`Solana wallet not returned from TalkenApiClient ${isRecover ? "recovery" : "generation"}`
|
|
5773
|
-
);
|
|
5774
|
-
}
|
|
5775
|
-
return response.solana;
|
|
5776
|
-
}
|
|
5777
|
-
/**
|
|
5778
|
-
* Recover Solana wallet (alias for generateSolanaWallet with isRecover=true)
|
|
5779
|
-
* When TalkenApiClient is available, delegates to the unified recovery endpoint.
|
|
5780
|
-
*
|
|
5781
|
-
* @param pin - Hashed PIN (SHA-256)
|
|
5782
|
-
* @returns Recovered Solana wallet information
|
|
5783
|
-
*/
|
|
5784
|
-
async recoverSolanaWallet(pin) {
|
|
5785
|
-
return this.generateSolanaWallet(pin, true);
|
|
5786
|
-
}
|
|
5787
|
-
/**
|
|
5788
|
-
* Get Solana address from wallet addresses endpoint
|
|
5789
|
-
* Retrieves from TalkenApiClient unified addresses endpoint.
|
|
5790
|
-
*
|
|
5791
|
-
* @returns Solana address string or null if not available
|
|
5792
|
-
*/
|
|
5793
|
-
async getSolanaAddress() {
|
|
4693
|
+
async signSolanaMessage(params) {
|
|
5794
4694
|
const api = getTalkenApiClient7();
|
|
5795
|
-
if (!api)
|
|
5796
|
-
throw new Error("TalkenApiClient not initialized");
|
|
5797
|
-
const addresses = await api.wallet.getAddresses();
|
|
5798
|
-
return addresses.solana || null;
|
|
5799
|
-
}
|
|
5800
|
-
/**
|
|
5801
|
-
* Derive Solana address from Ed25519 public key
|
|
5802
|
-
* @param publicKey - Ed25519 public key (hex)
|
|
5803
|
-
* @returns Solana address (base58)
|
|
5804
|
-
*/
|
|
5805
|
-
deriveAddressFromPublicKey(publicKey) {
|
|
5806
|
-
const cleanKey = publicKey.startsWith("0x") ? publicKey.slice(2) : publicKey;
|
|
5807
|
-
const bytes = new Uint8Array(
|
|
5808
|
-
cleanKey.match(/.{1,2}/g)?.map((byte) => Number.parseInt(byte, 16)) || []
|
|
5809
|
-
);
|
|
5810
|
-
try {
|
|
5811
|
-
const pubkey = new PublicKey(bytes);
|
|
5812
|
-
return pubkey.toBase58();
|
|
5813
|
-
} catch (error) {
|
|
5814
|
-
console.error("[SolanaApi] Failed to encode address:", error);
|
|
5815
|
-
return cleanKey;
|
|
5816
|
-
}
|
|
5817
|
-
}
|
|
5818
|
-
/**
|
|
5819
|
-
* Sign Solana transaction with Ed25519
|
|
5820
|
-
* Reference: /v3/wallet/sign API requires only 5 fields
|
|
5821
|
-
*/
|
|
5822
|
-
async signSolanaTransaction(params) {
|
|
5823
|
-
const network = getSolanaNetwork();
|
|
5824
|
-
const response = await this.request("/v3/wallet/sign", {
|
|
5825
|
-
method: "POST",
|
|
5826
|
-
contentType: "json",
|
|
5827
|
-
body: {
|
|
5828
|
-
curve: "ed25519",
|
|
5829
|
-
network,
|
|
5830
|
-
key_id: params.keyId,
|
|
5831
|
-
encrypted_share: params.encryptedShare,
|
|
5832
|
-
secret_store: params.secretStore || "",
|
|
5833
|
-
message: params.message
|
|
5834
|
-
}
|
|
5835
|
-
});
|
|
5836
|
-
let signature;
|
|
5837
|
-
if (response.status === "success" && response.result?.signature) {
|
|
5838
|
-
signature = response.result.signature;
|
|
5839
|
-
} else if (response.signature) {
|
|
5840
|
-
signature = response.signature;
|
|
5841
|
-
} else {
|
|
4695
|
+
if (!api) {
|
|
5842
4696
|
throw createAbcError(
|
|
5843
|
-
"
|
|
5844
|
-
"
|
|
5845
|
-
response
|
|
4697
|
+
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
4698
|
+
"TalkenApiClient not initialized"
|
|
5846
4699
|
);
|
|
5847
4700
|
}
|
|
5848
|
-
return {
|
|
5849
|
-
signature
|
|
5850
|
-
};
|
|
5851
|
-
}
|
|
5852
|
-
/**
|
|
5853
|
-
* Sign Solana message with Ed25519
|
|
5854
|
-
* Reference: /v3/wallet/sign API requires only 5 fields
|
|
5855
|
-
*/
|
|
5856
|
-
async signSolanaMessage(params) {
|
|
5857
4701
|
const network = getSolanaNetwork();
|
|
5858
|
-
const
|
|
5859
|
-
|
|
5860
|
-
|
|
5861
|
-
|
|
5862
|
-
|
|
5863
|
-
|
|
5864
|
-
key_id: params.keyId,
|
|
5865
|
-
encrypted_share: params.encryptedShare,
|
|
5866
|
-
secret_store: params.secretStore || "",
|
|
5867
|
-
message: params.message
|
|
5868
|
-
}
|
|
4702
|
+
const result = await api.solana.sign({
|
|
4703
|
+
message: params.message,
|
|
4704
|
+
keyId: params.keyId,
|
|
4705
|
+
encryptedShare: params.encryptedShare,
|
|
4706
|
+
secretStore: params.secretStore,
|
|
4707
|
+
network
|
|
5869
4708
|
});
|
|
5870
|
-
|
|
5871
|
-
if (response.status === "success" && response.result?.signature) {
|
|
5872
|
-
signature = response.result.signature;
|
|
5873
|
-
} else if (response.signature) {
|
|
5874
|
-
signature = response.signature;
|
|
5875
|
-
} else {
|
|
4709
|
+
if (!result.signature) {
|
|
5876
4710
|
throw createAbcError(
|
|
5877
4711
|
"SIGNATURE_FAILED" /* SIGNATURE_FAILED */,
|
|
5878
|
-
"Failed to sign Solana message"
|
|
5879
|
-
response
|
|
4712
|
+
"Failed to sign Solana message"
|
|
5880
4713
|
);
|
|
5881
4714
|
}
|
|
5882
|
-
return {
|
|
5883
|
-
signature
|
|
5884
|
-
};
|
|
4715
|
+
return { signature: result.signature };
|
|
5885
4716
|
}
|
|
5886
4717
|
/**
|
|
5887
4718
|
* Generate Solana transfer transaction via ABC WaaS API
|
|
@@ -6062,778 +4893,207 @@ var BitcoinApi = class extends BaseApiClient {
|
|
|
6062
4893
|
* @returns Bitcoin wallet information
|
|
6063
4894
|
*/
|
|
6064
4895
|
async generateBitcoinWallet(pin, network = "bitcoin", addressType = "bech32") {
|
|
6065
|
-
console.log("[BitcoinApi]
|
|
6066
|
-
network,
|
|
6067
|
-
addressType
|
|
6068
|
-
});
|
|
6069
|
-
const response = await this.request("/v3/wallet/generate", {
|
|
6070
|
-
method: "POST",
|
|
6071
|
-
contentType: "json",
|
|
6072
|
-
body: {
|
|
6073
|
-
curve: "secp256k1",
|
|
6074
|
-
// Same as EVM but compressed public key
|
|
6075
|
-
password: pin,
|
|
6076
|
-
network
|
|
6077
|
-
}
|
|
6078
|
-
});
|
|
6079
|
-
if (response.status !== "success" || !response.result) {
|
|
6080
|
-
console.error("[BitcoinApi] \u274C Generation failed:", response);
|
|
6081
|
-
throw createAbcError(
|
|
6082
|
-
"WALLET_NOT_FOUND" /* WALLET_NOT_FOUND */,
|
|
6083
|
-
"Failed to generate Bitcoin wallet",
|
|
6084
|
-
response
|
|
6085
|
-
);
|
|
6086
|
-
}
|
|
6087
|
-
const result = response.result;
|
|
6088
|
-
const addressResult = await this.getBitcoinAddress(
|
|
6089
|
-
result.public_key,
|
|
4896
|
+
console.log("[BitcoinApi] Generating Bitcoin wallet...", {
|
|
6090
4897
|
network,
|
|
6091
|
-
addressType
|
|
6092
|
-
);
|
|
6093
|
-
|
|
6094
|
-
|
|
6095
|
-
|
|
6096
|
-
|
|
6097
|
-
|
|
6098
|
-
|
|
6099
|
-
|
|
6100
|
-
|
|
6101
|
-
|
|
6102
|
-
|
|
6103
|
-
|
|
6104
|
-
|
|
6105
|
-
keyId: result.key_id || result.share_id,
|
|
6106
|
-
encryptedShare: result.encrypted_share || "",
|
|
6107
|
-
network
|
|
6108
|
-
};
|
|
6109
|
-
}
|
|
6110
|
-
/**
|
|
6111
|
-
* Recover Bitcoin wallet
|
|
6112
|
-
* Uses V3 API wallet recovery endpoint
|
|
6113
|
-
*
|
|
6114
|
-
* @param pin - Hashed PIN (SHA-256)
|
|
6115
|
-
* @param network - Bitcoin network
|
|
6116
|
-
* @param addressType - Bitcoin address type
|
|
6117
|
-
* @returns Recovered Bitcoin wallet information
|
|
6118
|
-
*/
|
|
6119
|
-
async recoverBitcoinWallet(pin, network = "bitcoin", addressType = "bech32") {
|
|
6120
|
-
console.log("[BitcoinApi] \u{1F527} Recovering Bitcoin wallet...", {
|
|
6121
|
-
network,
|
|
6122
|
-
addressType
|
|
6123
|
-
});
|
|
6124
|
-
const response = await this.request("/v3/wallet/recover", {
|
|
6125
|
-
method: "POST",
|
|
6126
|
-
contentType: "json",
|
|
6127
|
-
body: {
|
|
6128
|
-
curve: "secp256k1",
|
|
6129
|
-
password: pin,
|
|
6130
|
-
network
|
|
6131
|
-
}
|
|
6132
|
-
});
|
|
6133
|
-
if (response.status !== "success" || !response.result) {
|
|
6134
|
-
console.error("[BitcoinApi] \u274C Recovery failed:", response);
|
|
6135
|
-
throw createAbcError(
|
|
6136
|
-
"WALLET_NOT_FOUND" /* WALLET_NOT_FOUND */,
|
|
6137
|
-
"Failed to recover Bitcoin wallet",
|
|
6138
|
-
response
|
|
6139
|
-
);
|
|
6140
|
-
}
|
|
6141
|
-
const result = response.result;
|
|
6142
|
-
const addressResult = await this.getBitcoinAddress(
|
|
6143
|
-
result.public_key,
|
|
6144
|
-
network,
|
|
6145
|
-
addressType
|
|
6146
|
-
);
|
|
6147
|
-
console.log(
|
|
6148
|
-
"[BitcoinApi] \u2705 Bitcoin wallet recovered:",
|
|
6149
|
-
`${addressResult.substring(0, 6)}...${addressResult.substring(addressResult.length - 4)}`
|
|
6150
|
-
);
|
|
6151
|
-
return {
|
|
6152
|
-
uid: result.uid || "",
|
|
6153
|
-
sessionId: result.share_id,
|
|
6154
|
-
shareId: result.share_id,
|
|
6155
|
-
publicKey: result.public_key,
|
|
6156
|
-
address: addressResult,
|
|
6157
|
-
addressType,
|
|
6158
|
-
keyId: result.key_id || result.share_id,
|
|
6159
|
-
encryptedShare: result.encrypted_share || "",
|
|
6160
|
-
network
|
|
6161
|
-
};
|
|
6162
|
-
}
|
|
6163
|
-
/**
|
|
6164
|
-
* Get Bitcoin address from compressed public key
|
|
6165
|
-
* Converts compressed public key to Bitcoin address based on address type
|
|
6166
|
-
*
|
|
6167
|
-
* @param publicKey - Compressed public key (33 bytes, hex)
|
|
6168
|
-
* @param network - Bitcoin network
|
|
6169
|
-
* @param addressType - Address format type (currently not used by API)
|
|
6170
|
-
* @returns Bitcoin address
|
|
6171
|
-
*/
|
|
6172
|
-
async getBitcoinAddress(publicKey, network, _addressType = "bech32") {
|
|
6173
|
-
const url = `${this.baseURL}/wapi/v2/btc/address`;
|
|
6174
|
-
const params = new URLSearchParams({
|
|
6175
|
-
pubkey: publicKey,
|
|
6176
|
-
network
|
|
6177
|
-
});
|
|
6178
|
-
const response = await fetch(`${url}?${params}`, {
|
|
6179
|
-
method: "GET",
|
|
6180
|
-
headers: {
|
|
6181
|
-
...this.accessToken ? { Authorization: `Bearer ${this.accessToken}` } : {}
|
|
6182
|
-
}
|
|
6183
|
-
});
|
|
6184
|
-
const data = await response.json();
|
|
6185
|
-
if (!response.ok) {
|
|
6186
|
-
throw createAbcError(
|
|
6187
|
-
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
6188
|
-
"Failed to get Bitcoin address",
|
|
6189
|
-
data
|
|
6190
|
-
);
|
|
6191
|
-
}
|
|
6192
|
-
return data.address;
|
|
6193
|
-
}
|
|
6194
|
-
/**
|
|
6195
|
-
* Get UTXOs (Unspent Transaction Outputs) for address
|
|
6196
|
-
* Bitcoin uses UTXO model unlike EVM/Solana account model
|
|
6197
|
-
*
|
|
6198
|
-
* @param address - Bitcoin address
|
|
6199
|
-
* @param network - Bitcoin network
|
|
6200
|
-
* @returns Array of UTXOs
|
|
6201
|
-
*/
|
|
6202
|
-
async getUtxos(address, network) {
|
|
6203
|
-
console.log(
|
|
6204
|
-
"[BitcoinApi] \u{1F50D} Fetching UTXOs for:",
|
|
6205
|
-
`${address.substring(0, 6)}...${address.substring(address.length - 4)}`
|
|
6206
|
-
);
|
|
6207
|
-
const url = `${this.baseURL}/wapi/v2/bitcoin/utxo/list`;
|
|
6208
|
-
const params = new URLSearchParams({ network, address });
|
|
6209
|
-
console.log("[BitcoinApi] \u{1F50D} Fetching UTXOs for:", address);
|
|
6210
|
-
const response = await fetch(`${url}?${params}`, {
|
|
6211
|
-
method: "GET",
|
|
6212
|
-
headers: {
|
|
6213
|
-
...DEFAULT_HEADERS,
|
|
6214
|
-
...this.accessToken ? { Authorization: `Bearer ${this.accessToken}` } : {}
|
|
6215
|
-
}
|
|
6216
|
-
});
|
|
6217
|
-
const data = await response.json();
|
|
6218
|
-
if (!response.ok || data.status !== "success") {
|
|
6219
|
-
throw createAbcError(
|
|
6220
|
-
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
6221
|
-
"Failed to get UTXOs",
|
|
6222
|
-
data
|
|
6223
|
-
);
|
|
6224
|
-
}
|
|
6225
|
-
const utxos = data.result?.utxos || [];
|
|
6226
|
-
console.log(`[BitcoinApi] \u2705 Found ${utxos.length} UTXOs`);
|
|
6227
|
-
return utxos;
|
|
6228
|
-
}
|
|
6229
|
-
/**
|
|
6230
|
-
* Send Bitcoin transaction
|
|
6231
|
-
* Broadcasts signed transaction to Bitcoin network
|
|
6232
|
-
*
|
|
6233
|
-
* @param params - Transaction broadcast parameters
|
|
6234
|
-
* @returns Transaction hash
|
|
6235
|
-
*/
|
|
6236
|
-
async sendBitcoinTransaction(params) {
|
|
6237
|
-
const url = `${this.baseURL}/wapi/v2/bitcoin/tx/sendTransaction`;
|
|
6238
|
-
console.log("[BitcoinApi] \u{1F4E1} Broadcasting Bitcoin transaction...");
|
|
6239
|
-
const response = await fetch(url, {
|
|
6240
|
-
method: "POST",
|
|
6241
|
-
headers: {
|
|
6242
|
-
...DEFAULT_HEADERS,
|
|
6243
|
-
...this.accessToken ? { Authorization: `Bearer ${this.accessToken}` } : {}
|
|
6244
|
-
},
|
|
6245
|
-
body: JSON.stringify({
|
|
6246
|
-
network: params.network,
|
|
6247
|
-
rawTransaction: params.rawTransaction,
|
|
6248
|
-
...params.psbt && { psbt: params.psbt }
|
|
6249
|
-
})
|
|
6250
|
-
});
|
|
6251
|
-
const data = await response.json();
|
|
6252
|
-
if (!response.ok || data.status !== "success") {
|
|
6253
|
-
console.error("[BitcoinApi] \u274C Transaction broadcast failed:", data);
|
|
6254
|
-
throw createAbcError(
|
|
6255
|
-
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
6256
|
-
"Failed to send Bitcoin transaction",
|
|
6257
|
-
data
|
|
6258
|
-
);
|
|
6259
|
-
}
|
|
6260
|
-
const txHash = data.result?.data;
|
|
6261
|
-
console.log("[BitcoinApi] \u2705 Transaction broadcasted:", txHash);
|
|
6262
|
-
return {
|
|
6263
|
-
txHash
|
|
6264
|
-
};
|
|
6265
|
-
}
|
|
6266
|
-
/**
|
|
6267
|
-
* Generate Bitcoin transaction (Step 1 of 3)
|
|
6268
|
-
* Creates PSBT and returns hashes to sign
|
|
6269
|
-
*
|
|
6270
|
-
* @param params - Transaction parameters
|
|
6271
|
-
* @returns Transaction data with hashes to sign
|
|
6272
|
-
*/
|
|
6273
|
-
async generateTransaction(params) {
|
|
6274
|
-
const url = `${this.baseURL}/wapi/v2/btc/transaction/generate`;
|
|
6275
|
-
console.log("[BitcoinApi] \u{1F527} Generating transaction...", params);
|
|
6276
|
-
const response = await fetch(url, {
|
|
6277
|
-
method: "POST",
|
|
6278
|
-
headers: {
|
|
6279
|
-
"Content-Type": "application/json",
|
|
6280
|
-
...this.accessToken ? { Authorization: `Bearer ${this.accessToken}` } : {}
|
|
6281
|
-
},
|
|
6282
|
-
body: JSON.stringify(params)
|
|
6283
|
-
});
|
|
6284
|
-
const data = await response.json();
|
|
6285
|
-
if (!response.ok || !data.hashes) {
|
|
6286
|
-
const errorMsg = typeof data.error === "string" ? data.error : JSON.stringify(data.error || data);
|
|
6287
|
-
console.error("[BitcoinApi] \u274C Generate failed:", errorMsg);
|
|
6288
|
-
throw createAbcError(
|
|
6289
|
-
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
6290
|
-
`Failed to generate transaction: ${errorMsg}`,
|
|
6291
|
-
data
|
|
6292
|
-
);
|
|
6293
|
-
}
|
|
6294
|
-
console.log(
|
|
6295
|
-
`[BitcoinApi] \u2705 Generated ${data.hashes.length} hashes to sign`
|
|
6296
|
-
);
|
|
6297
|
-
return data;
|
|
6298
|
-
}
|
|
6299
|
-
/**
|
|
6300
|
-
* Sign transaction hash (Step 2 of 3)
|
|
6301
|
-
* Uses Secure Channel encryption for signing
|
|
6302
|
-
* Based on tg-wallet-frontend reference implementation
|
|
6303
|
-
*
|
|
6304
|
-
* @param hash - Transaction hash to sign
|
|
6305
|
-
* @param wallet - Full wallet object with Bitcoin signing fields
|
|
6306
|
-
* @param pinHash - Hashed PIN for device password
|
|
6307
|
-
* @param secureService - Secure service instance for encryption
|
|
6308
|
-
* @returns Signature hex string (r + s without 0x prefix on s)
|
|
6309
|
-
*/
|
|
6310
|
-
async signHash(hash, wallet, pinHash, secureService) {
|
|
6311
|
-
console.log("[BitcoinApi] \u{1F510} Signing hash:", `${hash.substring(0, 20)}...`);
|
|
6312
|
-
if (!wallet.wid || !wallet.pvencstr) {
|
|
6313
|
-
console.error("[BitcoinApi] \u274C Missing Bitcoin signing fields:", {
|
|
6314
|
-
hasWid: !!wallet.wid,
|
|
6315
|
-
hasPvencstr: !!wallet.pvencstr,
|
|
6316
|
-
hasSid: !!wallet.sid,
|
|
6317
|
-
hasUid: !!wallet.uid
|
|
6318
|
-
});
|
|
6319
|
-
throw createAbcError(
|
|
6320
|
-
"WALLET_NOT_FOUND" /* WALLET_NOT_FOUND */,
|
|
6321
|
-
"Wallet missing required fields for Bitcoin signing (wid, pvencstr)",
|
|
6322
|
-
{ hasWid: !!wallet.wid, hasPvencstr: !!wallet.pvencstr }
|
|
6323
|
-
);
|
|
6324
|
-
}
|
|
6325
|
-
const encryptDevicePassword = await secureService.getEncryptPlain(
|
|
6326
|
-
wallet.encryptDevicePassword || pinHash
|
|
6327
|
-
);
|
|
6328
|
-
const pvencstr = await secureService.getEncryptPlain(wallet.pvencstr);
|
|
6329
|
-
const wid = await secureService.getEncryptPlain(wallet.wid);
|
|
6330
|
-
const secureChannelId = await secureService.getSecureChannelId();
|
|
6331
|
-
const params = new URLSearchParams({
|
|
6332
|
-
uid: wallet.uid,
|
|
6333
|
-
sid: wallet.sid || "",
|
|
6334
|
-
// Handle optional sid
|
|
6335
|
-
hash,
|
|
6336
|
-
pvencstr,
|
|
6337
|
-
wid,
|
|
6338
|
-
encryptDevicePassword
|
|
6339
|
-
});
|
|
6340
|
-
const url = `${this.baseURL}/wapi/v2/sign/hash`;
|
|
6341
|
-
const response = await fetch(url, {
|
|
6342
|
-
method: "POST",
|
|
6343
|
-
headers: {
|
|
6344
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
6345
|
-
"Secure-Channel": secureChannelId,
|
|
6346
|
-
...this.accessToken ? { Authorization: `Bearer ${this.accessToken}` } : {}
|
|
6347
|
-
},
|
|
6348
|
-
body: params.toString()
|
|
6349
|
-
});
|
|
6350
|
-
const responseText = await response.text();
|
|
6351
|
-
if (!responseText) {
|
|
6352
|
-
throw createAbcError(
|
|
6353
|
-
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
6354
|
-
"Empty response from sign hash API",
|
|
6355
|
-
{ status: response.status }
|
|
6356
|
-
);
|
|
6357
|
-
}
|
|
6358
|
-
let data;
|
|
6359
|
-
try {
|
|
6360
|
-
data = JSON.parse(responseText);
|
|
6361
|
-
} catch (parseError) {
|
|
6362
|
-
console.error("[BitcoinApi] \u274C JSON parse error:", parseError);
|
|
6363
|
-
throw createAbcError(
|
|
6364
|
-
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
6365
|
-
"Invalid JSON response from sign hash API",
|
|
6366
|
-
{ responseText, parseError }
|
|
6367
|
-
);
|
|
6368
|
-
}
|
|
6369
|
-
if (!response.ok || data.iserr === true || !data.signstr) {
|
|
6370
|
-
const errorDetails = data.errmsg || data.errors?.[0] || data.message || data;
|
|
6371
|
-
console.error("[BitcoinApi] \u274C Sign failed:", errorDetails);
|
|
6372
|
-
throw createAbcError(
|
|
6373
|
-
"SIGNATURE_FAILED" /* SIGNATURE_FAILED */,
|
|
6374
|
-
`Failed to sign hash: ${JSON.stringify(errorDetails)}`,
|
|
6375
|
-
data
|
|
6376
|
-
);
|
|
6377
|
-
}
|
|
6378
|
-
const signstr = JSON.parse(data.signstr);
|
|
6379
|
-
const sig_list = signstr.sig_list;
|
|
6380
|
-
const signatures = [];
|
|
6381
|
-
for (const sig of sig_list) {
|
|
6382
|
-
const r = sig.r;
|
|
6383
|
-
const s = sig.s.startsWith("0x") ? sig.s.substring(2) : sig.s;
|
|
6384
|
-
const combinedSig = r + s;
|
|
6385
|
-
signatures.push(combinedSig);
|
|
6386
|
-
}
|
|
6387
|
-
console.log(
|
|
6388
|
-
"[BitcoinApi] \u2705 Signature generated:",
|
|
6389
|
-
`${signatures[0].substring(0, 32)}...`
|
|
6390
|
-
);
|
|
6391
|
-
return signatures[0];
|
|
6392
|
-
}
|
|
6393
|
-
/**
|
|
6394
|
-
* Finalize and broadcast transaction (Step 3 of 3)
|
|
6395
|
-
* Broadcasts signed transaction to Bitcoin network
|
|
6396
|
-
*
|
|
6397
|
-
* @param params - Transaction parameters with signatures
|
|
6398
|
-
* @returns Transaction hash
|
|
6399
|
-
*/
|
|
6400
|
-
async finalizeTransaction(params) {
|
|
6401
|
-
const url = `${this.baseURL}/wapi/v2/btc/transaction/finalize`;
|
|
6402
|
-
const response = await fetch(url, {
|
|
6403
|
-
method: "POST",
|
|
6404
|
-
headers: {
|
|
6405
|
-
"Content-Type": "application/json",
|
|
6406
|
-
...this.accessToken ? { Authorization: `Bearer ${this.accessToken}` } : {}
|
|
6407
|
-
},
|
|
6408
|
-
body: JSON.stringify(params)
|
|
6409
|
-
});
|
|
6410
|
-
const responseText = await response.text();
|
|
6411
|
-
if (!responseText) {
|
|
6412
|
-
throw createAbcError(
|
|
6413
|
-
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
6414
|
-
"Empty response from finalize API",
|
|
6415
|
-
{ status: response.status }
|
|
6416
|
-
);
|
|
6417
|
-
}
|
|
6418
|
-
let data;
|
|
6419
|
-
try {
|
|
6420
|
-
data = JSON.parse(responseText);
|
|
6421
|
-
} catch (parseError) {
|
|
6422
|
-
console.error("[BitcoinApi] \u274C JSON parse error:", parseError);
|
|
6423
|
-
throw createAbcError(
|
|
6424
|
-
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
6425
|
-
"Invalid JSON response from finalize API",
|
|
6426
|
-
{ responseText, parseError }
|
|
6427
|
-
);
|
|
6428
|
-
}
|
|
6429
|
-
if (!response.ok) {
|
|
6430
|
-
const errorMsg = data.error || data.message || data.errmsg || "Unknown error";
|
|
6431
|
-
console.error("[BitcoinApi] \u274C Finalize failed:", errorMsg);
|
|
6432
|
-
throw createAbcError(
|
|
6433
|
-
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
6434
|
-
`Failed to finalize transaction: ${errorMsg}`,
|
|
6435
|
-
data
|
|
6436
|
-
);
|
|
6437
|
-
}
|
|
6438
|
-
const txHash = data.result?.tx_hash || data.tx_hash || data.result?.txHash || data.txHash;
|
|
6439
|
-
if (!txHash) {
|
|
6440
|
-
console.error("[BitcoinApi] \u274C No tx_hash in response:", data);
|
|
6441
|
-
throw createAbcError(
|
|
6442
|
-
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
6443
|
-
"Transaction hash not found in response",
|
|
6444
|
-
data
|
|
6445
|
-
);
|
|
6446
|
-
}
|
|
6447
|
-
console.log("[BitcoinApi] \u2705 Transaction sent:", txHash);
|
|
6448
|
-
return txHash;
|
|
6449
|
-
}
|
|
6450
|
-
/**
|
|
6451
|
-
* Send Bitcoin transaction (Complete flow: generate → sign → finalize)
|
|
6452
|
-
* High-level API that handles all 3 steps
|
|
6453
|
-
*
|
|
6454
|
-
* @param params - Transaction parameters
|
|
6455
|
-
* @param wallet - EVM wallet credentials
|
|
6456
|
-
* @param pinHash - Hashed PIN
|
|
6457
|
-
* @param secureService - Secure service instance
|
|
6458
|
-
* @returns Transaction hash
|
|
6459
|
-
*/
|
|
6460
|
-
async sendTransaction(params, wallet, pinHash, secureService) {
|
|
6461
|
-
console.log("[BitcoinApi] \u{1F4B8} Starting Bitcoin transaction flow...");
|
|
6462
|
-
const generateData = await this.generateTransaction({
|
|
6463
|
-
amount: params.amount,
|
|
6464
|
-
pubkey: params.pubkey,
|
|
6465
|
-
to: params.to,
|
|
6466
|
-
feeRate: "2"
|
|
6467
|
-
// Default fee rate
|
|
6468
|
-
});
|
|
6469
|
-
const { hashes, fee_rate } = generateData;
|
|
6470
|
-
const signatureHex = [];
|
|
6471
|
-
for (let i = 0; i < hashes.length; i++) {
|
|
6472
|
-
const signature = await this.signHash(
|
|
6473
|
-
hashes[i],
|
|
6474
|
-
wallet,
|
|
6475
|
-
pinHash,
|
|
6476
|
-
secureService
|
|
6477
|
-
);
|
|
6478
|
-
signatureHex.push(signature);
|
|
6479
|
-
}
|
|
6480
|
-
const txHash = await this.finalizeTransaction({
|
|
6481
|
-
network: params.network,
|
|
6482
|
-
signatureHex,
|
|
6483
|
-
feeRate: fee_rate,
|
|
6484
|
-
amount: params.amount,
|
|
6485
|
-
pubkey: params.pubkey,
|
|
6486
|
-
to: params.to
|
|
6487
|
-
});
|
|
6488
|
-
console.log("[BitcoinApi] \u2705 Transaction complete:", txHash);
|
|
6489
|
-
return txHash;
|
|
6490
|
-
}
|
|
6491
|
-
/**
|
|
6492
|
-
* Estimate Bitcoin transaction fee
|
|
6493
|
-
* Gets recommended fee rate (satoshis per byte) for target confirmation blocks
|
|
6494
|
-
*
|
|
6495
|
-
* @param network - Bitcoin network
|
|
6496
|
-
* @param targetBlocks - Target confirmation blocks (default: 6)
|
|
6497
|
-
* @returns Fee rate in satoshis per byte
|
|
6498
|
-
*/
|
|
6499
|
-
async estimateFee(network, targetBlocks = 6) {
|
|
6500
|
-
const url = `${this.baseURL}/wapi/v2/bitcoin/fee/estimate`;
|
|
6501
|
-
const params = new URLSearchParams({
|
|
6502
|
-
network,
|
|
6503
|
-
targetBlocks: targetBlocks.toString()
|
|
6504
|
-
});
|
|
6505
|
-
const response = await fetch(`${url}?${params}`, {
|
|
6506
|
-
method: "GET",
|
|
6507
|
-
headers: {
|
|
6508
|
-
...DEFAULT_HEADERS,
|
|
6509
|
-
...this.accessToken ? { Authorization: `Bearer ${this.accessToken}` } : {}
|
|
6510
|
-
}
|
|
6511
|
-
});
|
|
6512
|
-
const data = await response.json();
|
|
6513
|
-
if (!response.ok || data.status !== "success") {
|
|
6514
|
-
console.warn("[BitcoinApi] \u26A0\uFE0F Fee estimation failed, using fallback");
|
|
6515
|
-
return 1;
|
|
6516
|
-
}
|
|
6517
|
-
const feeRate = data.result?.feeRate || 1;
|
|
6518
|
-
console.log(`[BitcoinApi] \u26FD Estimated fee rate: ${feeRate} sat/byte`);
|
|
6519
|
-
return feeRate;
|
|
6520
|
-
}
|
|
6521
|
-
};
|
|
6522
|
-
|
|
6523
|
-
// src/wallets/walletConnectors/abcWallet/api/TronApi.ts
|
|
6524
|
-
import { getTalkenApiClient as getTalkenApiClient8 } from "@talken/talkenkit";
|
|
6525
|
-
var TronApi = class extends BaseApiClient {
|
|
6526
|
-
/**
|
|
6527
|
-
* Get TRON address from TalkenApiClient unified addresses endpoint.
|
|
6528
|
-
*
|
|
6529
|
-
* @param _publicKey - Compressed public key (unused, TalkenApiClient resolves internally)
|
|
6530
|
-
* @param _network - TRON network (unused, TalkenApiClient resolves internally)
|
|
6531
|
-
* @returns TRON address (starts with 'T')
|
|
6532
|
-
*/
|
|
6533
|
-
async getTronAddress(_publicKey, _network) {
|
|
6534
|
-
const api = getTalkenApiClient8();
|
|
6535
|
-
if (!api)
|
|
6536
|
-
throw new Error("TalkenApiClient not initialized");
|
|
6537
|
-
const addresses = await api.wallet.getAddresses();
|
|
6538
|
-
if (!addresses.tron) {
|
|
4898
|
+
addressType
|
|
4899
|
+
});
|
|
4900
|
+
const response = await this.request("/v3/wallet/generate", {
|
|
4901
|
+
method: "POST",
|
|
4902
|
+
contentType: "json",
|
|
4903
|
+
body: {
|
|
4904
|
+
curve: "secp256k1",
|
|
4905
|
+
// Same as EVM but compressed public key
|
|
4906
|
+
password: pin,
|
|
4907
|
+
network
|
|
4908
|
+
}
|
|
4909
|
+
});
|
|
4910
|
+
if (response.status !== "success" || !response.result) {
|
|
4911
|
+
console.error("[BitcoinApi] Generation failed:", response);
|
|
6539
4912
|
throw createAbcError(
|
|
6540
4913
|
"WALLET_NOT_FOUND" /* WALLET_NOT_FOUND */,
|
|
6541
|
-
"
|
|
4914
|
+
"Failed to generate Bitcoin wallet",
|
|
4915
|
+
response
|
|
6542
4916
|
);
|
|
6543
4917
|
}
|
|
6544
|
-
|
|
4918
|
+
const result = response.result;
|
|
4919
|
+
const addressResult = await this.getBitcoinAddress(
|
|
4920
|
+
result.public_key,
|
|
4921
|
+
network,
|
|
4922
|
+
addressType
|
|
4923
|
+
);
|
|
4924
|
+
return {
|
|
4925
|
+
uid: result.uid || "",
|
|
4926
|
+
sessionId: result.share_id,
|
|
4927
|
+
shareId: result.share_id,
|
|
4928
|
+
publicKey: result.public_key,
|
|
4929
|
+
// Compressed (33 bytes, 0x02 or 0x03 prefix)
|
|
4930
|
+
address: addressResult,
|
|
4931
|
+
addressType,
|
|
4932
|
+
keyId: result.key_id || result.share_id,
|
|
4933
|
+
encryptedShare: result.encrypted_share || "",
|
|
4934
|
+
network
|
|
4935
|
+
};
|
|
6545
4936
|
}
|
|
6546
4937
|
/**
|
|
6547
|
-
*
|
|
4938
|
+
* Recover Bitcoin wallet
|
|
4939
|
+
* Uses V3 API wallet recovery endpoint
|
|
6548
4940
|
*
|
|
6549
|
-
* @param
|
|
6550
|
-
* @
|
|
4941
|
+
* @param pin - Hashed PIN (SHA-256)
|
|
4942
|
+
* @param network - Bitcoin network
|
|
4943
|
+
* @param addressType - Bitcoin address type
|
|
4944
|
+
* @returns Recovered Bitcoin wallet information
|
|
6551
4945
|
*/
|
|
6552
|
-
async
|
|
6553
|
-
|
|
6554
|
-
|
|
6555
|
-
|
|
6556
|
-
to: `${params.toAddress.substring(0, 6)}...`,
|
|
6557
|
-
amount: params.amount
|
|
4946
|
+
async recoverBitcoinWallet(pin, network = "bitcoin", addressType = "bech32") {
|
|
4947
|
+
console.log("[BitcoinApi] Recovering Bitcoin wallet...", {
|
|
4948
|
+
network,
|
|
4949
|
+
addressType
|
|
6558
4950
|
});
|
|
6559
|
-
const response = await
|
|
4951
|
+
const response = await this.request("/v3/wallet/recover", {
|
|
6560
4952
|
method: "POST",
|
|
6561
|
-
|
|
6562
|
-
|
|
6563
|
-
|
|
6564
|
-
|
|
6565
|
-
|
|
6566
|
-
|
|
6567
|
-
from_address: params.fromAddress,
|
|
6568
|
-
to_address: params.toAddress,
|
|
6569
|
-
amount: params.amount
|
|
6570
|
-
})
|
|
4953
|
+
contentType: "json",
|
|
4954
|
+
body: {
|
|
4955
|
+
curve: "secp256k1",
|
|
4956
|
+
password: pin,
|
|
4957
|
+
network
|
|
4958
|
+
}
|
|
6571
4959
|
});
|
|
6572
|
-
|
|
6573
|
-
|
|
6574
|
-
console.error("[TronApi] \u274C Transfer creation failed:", data);
|
|
6575
|
-
throw createAbcError(
|
|
6576
|
-
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
6577
|
-
"Failed to create TRX transfer",
|
|
6578
|
-
data
|
|
6579
|
-
);
|
|
6580
|
-
}
|
|
6581
|
-
const result = data.result || data;
|
|
6582
|
-
const txData = result.transaction || result;
|
|
6583
|
-
const rawData = txData.raw_data;
|
|
6584
|
-
const txID = txData.txID;
|
|
6585
|
-
if (!rawData || !txID) {
|
|
4960
|
+
if (response.status !== "success" || !response.result) {
|
|
4961
|
+
console.error("[BitcoinApi] Recovery failed:", response);
|
|
6586
4962
|
throw createAbcError(
|
|
6587
|
-
"
|
|
6588
|
-
"
|
|
6589
|
-
|
|
4963
|
+
"WALLET_NOT_FOUND" /* WALLET_NOT_FOUND */,
|
|
4964
|
+
"Failed to recover Bitcoin wallet",
|
|
4965
|
+
response
|
|
6590
4966
|
);
|
|
6591
4967
|
}
|
|
6592
|
-
|
|
6593
|
-
|
|
6594
|
-
|
|
4968
|
+
const result = response.result;
|
|
4969
|
+
const addressResult = await this.getBitcoinAddress(
|
|
4970
|
+
result.public_key,
|
|
4971
|
+
network,
|
|
4972
|
+
addressType
|
|
6595
4973
|
);
|
|
6596
|
-
return {
|
|
4974
|
+
return {
|
|
4975
|
+
uid: result.uid || "",
|
|
4976
|
+
sessionId: result.share_id,
|
|
4977
|
+
shareId: result.share_id,
|
|
4978
|
+
publicKey: result.public_key,
|
|
4979
|
+
address: addressResult,
|
|
4980
|
+
addressType,
|
|
4981
|
+
keyId: result.key_id || result.share_id,
|
|
4982
|
+
encryptedShare: result.encrypted_share || "",
|
|
4983
|
+
network
|
|
4984
|
+
};
|
|
6597
4985
|
}
|
|
6598
4986
|
/**
|
|
6599
|
-
*
|
|
4987
|
+
* Get Bitcoin address from compressed public key
|
|
6600
4988
|
*
|
|
6601
|
-
* @param
|
|
6602
|
-
* @
|
|
6603
|
-
|
|
6604
|
-
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
|
|
4989
|
+
* @param publicKey - Compressed public key (33 bytes, hex)
|
|
4990
|
+
* @param network - Bitcoin network
|
|
4991
|
+
* @param addressType - Address format type (currently not used by API)
|
|
4992
|
+
* @returns Bitcoin address
|
|
4993
|
+
*/
|
|
4994
|
+
async getBitcoinAddress(publicKey, network, _addressType = "bech32") {
|
|
4995
|
+
const url = `${this.baseURL}/wapi/v2/btc/address`;
|
|
4996
|
+
const params = new URLSearchParams({
|
|
4997
|
+
pubkey: publicKey,
|
|
4998
|
+
network
|
|
6610
4999
|
});
|
|
6611
|
-
const response = await fetch(url
|
|
6612
|
-
method: "
|
|
5000
|
+
const response = await fetch(`${url}?${params}`, {
|
|
5001
|
+
method: "GET",
|
|
6613
5002
|
headers: {
|
|
6614
|
-
"Content-Type": "application/json",
|
|
6615
5003
|
...this.accessToken ? { Authorization: `Bearer ${this.accessToken}` } : {}
|
|
6616
|
-
}
|
|
6617
|
-
body: JSON.stringify({
|
|
6618
|
-
network: params.network,
|
|
6619
|
-
from_address: params.fromAddress,
|
|
6620
|
-
to_address: params.toAddress,
|
|
6621
|
-
amount: params.amount,
|
|
6622
|
-
contract_address: params.contractAddress,
|
|
6623
|
-
fee_limit: params.feeLimit || 1e8
|
|
6624
|
-
})
|
|
5004
|
+
}
|
|
6625
5005
|
});
|
|
6626
5006
|
const data = await response.json();
|
|
6627
|
-
if (!response.ok
|
|
6628
|
-
console.error("[TronApi] \u274C TRC20 transfer creation failed:", data);
|
|
6629
|
-
throw createAbcError(
|
|
6630
|
-
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
6631
|
-
"Failed to create TRC20 transfer",
|
|
6632
|
-
data
|
|
6633
|
-
);
|
|
6634
|
-
}
|
|
6635
|
-
const result = data.result || data;
|
|
6636
|
-
const txData = result.transaction || result;
|
|
6637
|
-
const rawData = txData.raw_data;
|
|
6638
|
-
const txID = txData.txID;
|
|
6639
|
-
if (!rawData || !txID) {
|
|
5007
|
+
if (!response.ok) {
|
|
6640
5008
|
throw createAbcError(
|
|
6641
5009
|
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
6642
|
-
"
|
|
5010
|
+
"Failed to get Bitcoin address",
|
|
6643
5011
|
data
|
|
6644
5012
|
);
|
|
6645
5013
|
}
|
|
6646
|
-
|
|
6647
|
-
"[TronApi] \u2705 TRC20 transfer created:",
|
|
6648
|
-
`${txID.substring(0, 16)}...`
|
|
6649
|
-
);
|
|
6650
|
-
return { txID, rawData };
|
|
5014
|
+
return data.address;
|
|
6651
5015
|
}
|
|
6652
5016
|
/**
|
|
6653
|
-
*
|
|
6654
|
-
* Same signing flow as Bitcoin - uses EVM wallet credentials via Secure Channel encryption
|
|
5017
|
+
* Get UTXOs (Unspent Transaction Outputs) for address
|
|
6655
5018
|
*
|
|
6656
|
-
* @param
|
|
6657
|
-
* @param
|
|
6658
|
-
* @
|
|
6659
|
-
* @param secureService - SecureService instance for ECDH encryption
|
|
6660
|
-
* @returns Array of signature strings (r + s without 0x prefix)
|
|
5019
|
+
* @param address - Bitcoin address
|
|
5020
|
+
* @param network - Bitcoin network
|
|
5021
|
+
* @returns Array of UTXOs
|
|
6661
5022
|
*/
|
|
6662
|
-
async
|
|
6663
|
-
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
if (!wallet.wid || !wallet.pvencstr) {
|
|
6668
|
-
console.error("[TronApi] \u274C Missing signing fields:", {
|
|
6669
|
-
hasWid: !!wallet.wid,
|
|
6670
|
-
hasPvencstr: !!wallet.pvencstr,
|
|
6671
|
-
hasSid: !!wallet.sid,
|
|
6672
|
-
hasUid: !!wallet.uid
|
|
6673
|
-
});
|
|
6674
|
-
throw createAbcError(
|
|
6675
|
-
"WALLET_NOT_FOUND" /* WALLET_NOT_FOUND */,
|
|
6676
|
-
"Wallet missing required fields for TRON signing (wid, pvencstr)",
|
|
6677
|
-
{ hasWid: !!wallet.wid, hasPvencstr: !!wallet.pvencstr }
|
|
6678
|
-
);
|
|
6679
|
-
}
|
|
6680
|
-
const encryptDevicePassword = await secureService.getEncryptPlain(
|
|
6681
|
-
wallet.encryptDevicePassword || pinHash
|
|
6682
|
-
);
|
|
6683
|
-
const pvencstr = await secureService.getEncryptPlain(wallet.pvencstr);
|
|
6684
|
-
const wid = await secureService.getEncryptPlain(wallet.wid);
|
|
6685
|
-
const secureChannelId = await secureService.getSecureChannelId();
|
|
6686
|
-
const params = new URLSearchParams({
|
|
6687
|
-
uid: wallet.uid,
|
|
6688
|
-
sid: wallet.sid || "",
|
|
6689
|
-
hash,
|
|
6690
|
-
pvencstr,
|
|
6691
|
-
wid,
|
|
6692
|
-
encryptDevicePassword,
|
|
6693
|
-
network: "tron"
|
|
6694
|
-
});
|
|
6695
|
-
const url = `${this.baseURL}/wapi/v2/sign/hash`;
|
|
6696
|
-
const response = await fetch(url, {
|
|
6697
|
-
method: "POST",
|
|
5023
|
+
async getUtxos(address, network) {
|
|
5024
|
+
const url = `${this.baseURL}/wapi/v2/bitcoin/utxo/list`;
|
|
5025
|
+
const params = new URLSearchParams({ network, address });
|
|
5026
|
+
const response = await fetch(`${url}?${params}`, {
|
|
5027
|
+
method: "GET",
|
|
6698
5028
|
headers: {
|
|
6699
|
-
|
|
6700
|
-
"Secure-Channel": secureChannelId,
|
|
5029
|
+
...DEFAULT_HEADERS,
|
|
6701
5030
|
...this.accessToken ? { Authorization: `Bearer ${this.accessToken}` } : {}
|
|
6702
|
-
}
|
|
6703
|
-
body: params.toString()
|
|
5031
|
+
}
|
|
6704
5032
|
});
|
|
6705
|
-
const
|
|
6706
|
-
if (!
|
|
6707
|
-
throw createAbcError(
|
|
6708
|
-
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
6709
|
-
"Empty response from sign hash API",
|
|
6710
|
-
{ status: response.status }
|
|
6711
|
-
);
|
|
6712
|
-
}
|
|
6713
|
-
let data;
|
|
6714
|
-
try {
|
|
6715
|
-
data = JSON.parse(responseText);
|
|
6716
|
-
} catch (parseError) {
|
|
6717
|
-
console.error("[TronApi] \u274C JSON parse error:", parseError);
|
|
5033
|
+
const data = await response.json();
|
|
5034
|
+
if (!response.ok || data.status !== "success") {
|
|
6718
5035
|
throw createAbcError(
|
|
6719
5036
|
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
6720
|
-
"
|
|
6721
|
-
{ responseText, parseError }
|
|
6722
|
-
);
|
|
6723
|
-
}
|
|
6724
|
-
if (!response.ok || data.iserr === true || !data.signstr) {
|
|
6725
|
-
const errorDetails = data.errmsg || data.errors?.[0] || data.message || data;
|
|
6726
|
-
console.error("[TronApi] \u274C Sign failed:", errorDetails);
|
|
6727
|
-
throw createAbcError(
|
|
6728
|
-
"SIGNATURE_FAILED" /* SIGNATURE_FAILED */,
|
|
6729
|
-
`Failed to sign hash: ${JSON.stringify(errorDetails)}`,
|
|
5037
|
+
"Failed to get UTXOs",
|
|
6730
5038
|
data
|
|
6731
5039
|
);
|
|
6732
5040
|
}
|
|
6733
|
-
|
|
6734
|
-
const sigList = signstr.sig_list;
|
|
6735
|
-
const signatures = [];
|
|
6736
|
-
for (const sig of sigList) {
|
|
6737
|
-
const r = sig.r.startsWith("0x") ? sig.r.substring(2) : sig.r;
|
|
6738
|
-
const s = sig.s.startsWith("0x") ? sig.s.substring(2) : sig.s;
|
|
6739
|
-
const v = (27 + (sig.vsource || 0)).toString(16);
|
|
6740
|
-
signatures.push(r + s + v);
|
|
6741
|
-
}
|
|
6742
|
-
console.log(
|
|
6743
|
-
"[TronApi] \u2705 Signature generated:",
|
|
6744
|
-
`${signatures[0].length / 2} bytes,`,
|
|
6745
|
-
`${signatures[0].substring(0, 16)}...${signatures[0].substring(signatures[0].length - 4)}`
|
|
6746
|
-
);
|
|
6747
|
-
return signatures;
|
|
5041
|
+
return data.result?.utxos || [];
|
|
6748
5042
|
}
|
|
6749
5043
|
/**
|
|
6750
|
-
* Broadcast signed
|
|
5044
|
+
* Broadcast signed Bitcoin transaction
|
|
6751
5045
|
*
|
|
6752
|
-
* @param
|
|
6753
|
-
* @
|
|
6754
|
-
|
|
6755
|
-
|
|
6756
|
-
|
|
6757
|
-
async broadcast(rawData, signatures, network) {
|
|
6758
|
-
const url = `${this.baseURL}/wapi/v2/tron/send/transaction`;
|
|
6759
|
-
console.log("[TronApi] \u{1F4E1} Broadcasting TRON transaction...");
|
|
5046
|
+
* @param params - Transaction broadcast parameters
|
|
5047
|
+
* @returns Transaction hash
|
|
5048
|
+
*/
|
|
5049
|
+
async sendBitcoinTransaction(params) {
|
|
5050
|
+
const url = `${this.baseURL}/wapi/v2/bitcoin/tx/sendTransaction`;
|
|
6760
5051
|
const response = await fetch(url, {
|
|
6761
5052
|
method: "POST",
|
|
6762
5053
|
headers: {
|
|
6763
|
-
|
|
5054
|
+
...DEFAULT_HEADERS,
|
|
6764
5055
|
...this.accessToken ? { Authorization: `Bearer ${this.accessToken}` } : {}
|
|
6765
5056
|
},
|
|
6766
5057
|
body: JSON.stringify({
|
|
6767
|
-
network,
|
|
6768
|
-
|
|
6769
|
-
|
|
5058
|
+
network: params.network,
|
|
5059
|
+
rawTransaction: params.rawTransaction,
|
|
5060
|
+
...params.psbt && { psbt: params.psbt }
|
|
6770
5061
|
})
|
|
6771
5062
|
});
|
|
6772
5063
|
const data = await response.json();
|
|
6773
|
-
if (!response.ok || data.status
|
|
6774
|
-
console.error("[TronApi] \u274C Broadcast failed:", data);
|
|
6775
|
-
throw createAbcError(
|
|
6776
|
-
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
6777
|
-
"Failed to broadcast TRON transaction",
|
|
6778
|
-
data
|
|
6779
|
-
);
|
|
6780
|
-
}
|
|
6781
|
-
const txHash = data.txid || data.txID || data.tx_hash;
|
|
6782
|
-
if (!txHash) {
|
|
6783
|
-
console.error("[TronApi] \u274C No txid in response:", data);
|
|
5064
|
+
if (!response.ok || data.status !== "success") {
|
|
6784
5065
|
throw createAbcError(
|
|
6785
5066
|
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
6786
|
-
"
|
|
5067
|
+
"Failed to send Bitcoin transaction",
|
|
6787
5068
|
data
|
|
6788
5069
|
);
|
|
6789
5070
|
}
|
|
6790
|
-
|
|
6791
|
-
return txHash;
|
|
5071
|
+
return { txHash: data.result?.data };
|
|
6792
5072
|
}
|
|
5073
|
+
};
|
|
5074
|
+
|
|
5075
|
+
// src/wallets/walletConnectors/abcWallet/api/TronApi.ts
|
|
5076
|
+
import { getTalkenApiClient as getTalkenApiClient8 } from "@talken/talkenkit";
|
|
5077
|
+
var TronApi = class extends BaseApiClient {
|
|
6793
5078
|
/**
|
|
6794
|
-
*
|
|
6795
|
-
* High-level API that handles all 3 steps
|
|
5079
|
+
* Get TRON address from TalkenApiClient unified addresses endpoint.
|
|
6796
5080
|
*
|
|
6797
|
-
* @param
|
|
6798
|
-
* @param
|
|
6799
|
-
* @
|
|
6800
|
-
* @param secureService - SecureService instance
|
|
6801
|
-
* @returns Transaction hash
|
|
5081
|
+
* @param _publicKey - Compressed public key (unused, TalkenApiClient resolves internally)
|
|
5082
|
+
* @param _network - TRON network (unused, TalkenApiClient resolves internally)
|
|
5083
|
+
* @returns TRON address (starts with 'T')
|
|
6802
5084
|
*/
|
|
6803
|
-
async
|
|
6804
|
-
|
|
6805
|
-
|
|
6806
|
-
|
|
6807
|
-
|
|
6808
|
-
|
|
6809
|
-
|
|
6810
|
-
|
|
6811
|
-
|
|
6812
|
-
|
|
6813
|
-
|
|
6814
|
-
|
|
6815
|
-
});
|
|
6816
|
-
txID = result.txID;
|
|
6817
|
-
rawData = result.rawData;
|
|
6818
|
-
} else {
|
|
6819
|
-
const result = await this.transfer({
|
|
6820
|
-
fromAddress: params.fromAddress,
|
|
6821
|
-
toAddress: params.toAddress,
|
|
6822
|
-
amount: Number(params.amount),
|
|
6823
|
-
network: params.network
|
|
6824
|
-
});
|
|
6825
|
-
txID = result.txID;
|
|
6826
|
-
rawData = result.rawData;
|
|
6827
|
-
}
|
|
6828
|
-
const signatures = await this.signHash(
|
|
6829
|
-
txID,
|
|
6830
|
-
wallet,
|
|
6831
|
-
pinHash,
|
|
6832
|
-
secureService
|
|
6833
|
-
);
|
|
6834
|
-
const txHash = await this.broadcast(rawData, signatures, params.network);
|
|
6835
|
-
console.log("[TronApi] \u2705 Transaction complete:", txHash);
|
|
6836
|
-
return txHash;
|
|
5085
|
+
async getTronAddress(_publicKey, _network) {
|
|
5086
|
+
const api = getTalkenApiClient8();
|
|
5087
|
+
if (!api)
|
|
5088
|
+
throw new Error("TalkenApiClient not initialized");
|
|
5089
|
+
const addresses = await api.wallet.getAddresses();
|
|
5090
|
+
if (!addresses.tron) {
|
|
5091
|
+
throw createAbcError(
|
|
5092
|
+
"WALLET_NOT_FOUND" /* WALLET_NOT_FOUND */,
|
|
5093
|
+
"TRON address not found in TalkenApiClient response"
|
|
5094
|
+
);
|
|
5095
|
+
}
|
|
5096
|
+
return addresses.tron;
|
|
6837
5097
|
}
|
|
6838
5098
|
};
|
|
6839
5099
|
|
|
@@ -7085,7 +5345,6 @@ var AbcWaasApiClient = class {
|
|
|
7085
5345
|
this.auth = new AuthApi(config);
|
|
7086
5346
|
this.wallet = new WalletApi(config);
|
|
7087
5347
|
this.transaction = new TransactionApi(config);
|
|
7088
|
-
this.signing = new SigningApi(config);
|
|
7089
5348
|
this.solana = new SolanaApi(config);
|
|
7090
5349
|
this.bitcoin = new BitcoinApi(config);
|
|
7091
5350
|
this.tron = new TronApi(config);
|
|
@@ -7503,19 +5762,74 @@ var AbcBitcoinProvider = class extends EventEmitter2 {
|
|
|
7503
5762
|
}
|
|
7504
5763
|
}
|
|
7505
5764
|
/**
|
|
7506
|
-
* Sign Bitcoin message (
|
|
7507
|
-
*
|
|
7508
|
-
* Only transaction signing is supported via PSBT
|
|
5765
|
+
* Sign Bitcoin message (Bitcoin Signed Message format)
|
|
5766
|
+
* Uses secp256k1 sign/hash endpoint with double-SHA256 of prefixed message.
|
|
7509
5767
|
*
|
|
7510
|
-
*
|
|
7511
|
-
*
|
|
5768
|
+
* Format: SHA256(SHA256("\x18Bitcoin Signed Message:\n" + varint(len) + message))
|
|
5769
|
+
*
|
|
5770
|
+
* @param message - Message to sign (string)
|
|
5771
|
+
* @returns Signature in hex format (compact: r + s + v)
|
|
7512
5772
|
*/
|
|
7513
|
-
async signMessage(
|
|
7514
|
-
|
|
7515
|
-
|
|
7516
|
-
|
|
7517
|
-
|
|
7518
|
-
|
|
5773
|
+
async signMessage(message) {
|
|
5774
|
+
if (!this.wallet) {
|
|
5775
|
+
throw new BitcoinProviderError(
|
|
5776
|
+
BitcoinErrorCode.DISCONNECTED,
|
|
5777
|
+
"Wallet not connected"
|
|
5778
|
+
);
|
|
5779
|
+
}
|
|
5780
|
+
console.log("[BitcoinProvider] \u{1F4DD} Signing Bitcoin message...");
|
|
5781
|
+
const prefix = "Bitcoin Signed Message:\n";
|
|
5782
|
+
const msgBytes = new TextEncoder().encode(message);
|
|
5783
|
+
const varint = this.encodeVarint(msgBytes.length);
|
|
5784
|
+
const prefixBytes = new TextEncoder().encode(prefix);
|
|
5785
|
+
const preimage = new Uint8Array(prefixBytes.length + varint.length + msgBytes.length);
|
|
5786
|
+
preimage.set(prefixBytes, 0);
|
|
5787
|
+
preimage.set(varint, prefixBytes.length);
|
|
5788
|
+
preimage.set(msgBytes, prefixBytes.length + varint.length);
|
|
5789
|
+
const hash1 = await crypto.subtle.digest("SHA-256", preimage);
|
|
5790
|
+
const hash2 = await crypto.subtle.digest("SHA-256", hash1);
|
|
5791
|
+
const hashHex = Array.from(new Uint8Array(hash2)).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
5792
|
+
const api = getTalkenApiClient12();
|
|
5793
|
+
if (!api) {
|
|
5794
|
+
throw new BitcoinProviderError(
|
|
5795
|
+
BitcoinErrorCode.INTERNAL_ERROR,
|
|
5796
|
+
"TalkenApiClient not initialized"
|
|
5797
|
+
);
|
|
5798
|
+
}
|
|
5799
|
+
const pinHash = localStorage.getItem("talkenkit_abc_pin_hash") || "";
|
|
5800
|
+
const result = await api.bitcoin.signHash({
|
|
5801
|
+
hash: hashHex,
|
|
5802
|
+
pin: pinHash,
|
|
5803
|
+
network: this.network.type
|
|
5804
|
+
});
|
|
5805
|
+
const signstr = result?.signstr || result?.data?.signstr || "";
|
|
5806
|
+
if (!signstr) {
|
|
5807
|
+
throw new BitcoinProviderError(
|
|
5808
|
+
BitcoinErrorCode.INTERNAL_ERROR,
|
|
5809
|
+
"Empty signature from sign/hash"
|
|
5810
|
+
);
|
|
5811
|
+
}
|
|
5812
|
+
console.log("[BitcoinProvider] \u2705 Message signed successfully");
|
|
5813
|
+
return signstr;
|
|
5814
|
+
}
|
|
5815
|
+
/** Encode integer as Bitcoin varint */
|
|
5816
|
+
encodeVarint(n) {
|
|
5817
|
+
if (n < 253)
|
|
5818
|
+
return new Uint8Array([n]);
|
|
5819
|
+
if (n <= 65535) {
|
|
5820
|
+
const buf2 = new Uint8Array(3);
|
|
5821
|
+
buf2[0] = 253;
|
|
5822
|
+
buf2[1] = n & 255;
|
|
5823
|
+
buf2[2] = n >> 8 & 255;
|
|
5824
|
+
return buf2;
|
|
5825
|
+
}
|
|
5826
|
+
const buf = new Uint8Array(5);
|
|
5827
|
+
buf[0] = 254;
|
|
5828
|
+
buf[1] = n & 255;
|
|
5829
|
+
buf[2] = n >> 8 & 255;
|
|
5830
|
+
buf[3] = n >> 16 & 255;
|
|
5831
|
+
buf[4] = n >> 24 & 255;
|
|
5832
|
+
return buf;
|
|
7519
5833
|
}
|
|
7520
5834
|
/**
|
|
7521
5835
|
* High-level transaction sending (like Solana pattern)
|
|
@@ -8159,6 +6473,14 @@ var AbcSolanaProvider = class extends EventEmitter3 {
|
|
|
8159
6473
|
"PIN hash not found. Please login again."
|
|
8160
6474
|
);
|
|
8161
6475
|
}
|
|
6476
|
+
console.log(`[AbcSolanaProvider] transfer START`, {
|
|
6477
|
+
kind: params.mintAddress ? "spl" : "native",
|
|
6478
|
+
toAddress: params.toAddress,
|
|
6479
|
+
amount: params.amount,
|
|
6480
|
+
mintAddress: params.mintAddress || null,
|
|
6481
|
+
network: this.wallet.network,
|
|
6482
|
+
hasPinHash: !!pinHash
|
|
6483
|
+
});
|
|
8162
6484
|
const api = this.talkenApi || getTalkenApiClient13();
|
|
8163
6485
|
if (params.mintAddress) {
|
|
8164
6486
|
const apiNetwork = this.wallet.network === "solana" ? "solana_mainnet" : this.wallet.network;
|
|
@@ -8177,18 +6499,31 @@ var AbcSolanaProvider = class extends EventEmitter3 {
|
|
|
8177
6499
|
network: apiNetwork,
|
|
8178
6500
|
pin: pinHash
|
|
8179
6501
|
});
|
|
6502
|
+
console.log(`[AbcSolanaProvider] SPL transfer result:`, result2);
|
|
8180
6503
|
return { signature: result2.txHash };
|
|
8181
6504
|
}
|
|
8182
6505
|
const { LAMPORTS_PER_SOL } = await import("@solana/web3.js");
|
|
8183
6506
|
const amountLamports = params.amount * LAMPORTS_PER_SOL;
|
|
6507
|
+
console.log(`[AbcSolanaProvider] native transfer request:`, {
|
|
6508
|
+
toAddress: params.toAddress,
|
|
6509
|
+
amountLamports: String(amountLamports),
|
|
6510
|
+
amountSOL: params.amount
|
|
6511
|
+
});
|
|
8184
6512
|
const result = await api.solana.transfer({
|
|
8185
6513
|
kind: "native",
|
|
8186
6514
|
toAddress: params.toAddress,
|
|
8187
6515
|
amountLamports: String(amountLamports),
|
|
8188
6516
|
pin: pinHash
|
|
8189
6517
|
});
|
|
6518
|
+
console.log(`[AbcSolanaProvider] native transfer result:`, result);
|
|
8190
6519
|
return { signature: result.txHash };
|
|
8191
6520
|
} catch (error) {
|
|
6521
|
+
console.error(`[AbcSolanaProvider] transfer FAILED:`, {
|
|
6522
|
+
message: error.message,
|
|
6523
|
+
code: error.code,
|
|
6524
|
+
status: error.status,
|
|
6525
|
+
details: error.details || error.data
|
|
6526
|
+
});
|
|
8192
6527
|
if (error.code === 4001 || error.cancelled) {
|
|
8193
6528
|
throw error;
|
|
8194
6529
|
}
|
|
@@ -8674,13 +7009,6 @@ export {
|
|
|
8674
7009
|
getSupportedNetworks,
|
|
8675
7010
|
networks_exports,
|
|
8676
7011
|
init_networks,
|
|
8677
|
-
SolanaNetwork,
|
|
8678
|
-
BitcoinNetwork,
|
|
8679
|
-
TronNetwork,
|
|
8680
|
-
getEvmNetwork,
|
|
8681
|
-
getSolanaNetwork,
|
|
8682
|
-
getBitcoinNetwork,
|
|
8683
|
-
getTronNetwork,
|
|
8684
7012
|
AbcStorageKey,
|
|
8685
7013
|
AbcErrorCode,
|
|
8686
7014
|
AbcError,
|
|
@@ -8738,19 +7066,24 @@ export {
|
|
|
8738
7066
|
isValidEthereumAddress,
|
|
8739
7067
|
isValidSolanaAddress,
|
|
8740
7068
|
getExplorerUrl,
|
|
8741
|
-
secure_default,
|
|
8742
7069
|
AbcWaasClient,
|
|
8743
7070
|
createAbcWaasClient,
|
|
8744
7071
|
AbcEvmProvider,
|
|
8745
7072
|
createAbcEvmProvider,
|
|
8746
7073
|
createAbcProvider,
|
|
7074
|
+
SolanaNetwork,
|
|
7075
|
+
BitcoinNetwork,
|
|
7076
|
+
TronNetwork,
|
|
7077
|
+
getEvmNetwork,
|
|
7078
|
+
getSolanaNetwork,
|
|
7079
|
+
getBitcoinNetwork,
|
|
7080
|
+
getTronNetwork,
|
|
8747
7081
|
abcConnector,
|
|
8748
7082
|
abcWallet,
|
|
8749
7083
|
BaseApiClient,
|
|
8750
7084
|
AuthApi,
|
|
8751
7085
|
WalletApi,
|
|
8752
7086
|
TransactionApi,
|
|
8753
|
-
SigningApi,
|
|
8754
7087
|
SolanaApi,
|
|
8755
7088
|
WalletscanApi,
|
|
8756
7089
|
GasApi,
|