@talken/talkenkit 2.8.4 → 2.8.6
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-4PXYWHYM.js → abcWallet-RPQPYWWR.js} +22 -25
- package/dist/{chunk-ZISAJ7BZ.js → chunk-GS4L4ZIS.js} +3354 -1012
- package/dist/config/networks.d.ts +12 -0
- package/dist/gasless/index.d.ts +1 -1
- package/dist/gasless/services/GaslessTransferService.d.ts +2 -1
- package/dist/gasless/signer/AbcWaasSigner.d.ts +9 -0
- package/dist/gasless/signer/GaslessSigner.d.ts +10 -0
- package/dist/gasless/signer/WagmiSigner.d.ts +40 -0
- package/dist/gasless/signer/index.d.ts +1 -1
- package/dist/gasless/utils/delegationGuard.d.ts +11 -11
- package/dist/gasless/utils/revokeDelegation.d.ts +23 -23
- package/dist/hooks/useMultiChainBalances.d.ts +2 -0
- package/dist/index.css +17 -15
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1287 -586
- package/dist/services/AbcAuthService.d.ts +12 -1
- package/dist/solana/clusterIdentity.d.ts +5 -0
- package/dist/utils/amount.d.ts +17 -0
- package/dist/wallets/walletConnectors/abcWallet/AbcCredentialManager.d.ts +0 -1
- package/dist/wallets/walletConnectors/abcWallet/AbcCredentialManager.js +3 -3
- package/dist/wallets/walletConnectors/abcWallet/AbcEvmAutoConnector.js +5 -5
- package/dist/wallets/walletConnectors/abcWallet/AbstractChainProvider.d.ts +11 -0
- package/dist/wallets/walletConnectors/abcWallet/AbstractChainProvider.js +5 -2
- package/dist/wallets/walletConnectors/abcWallet/ProviderError.d.ts +7 -0
- package/dist/wallets/walletConnectors/abcWallet/StorageService.js +2 -2
- package/dist/wallets/walletConnectors/abcWallet/abcBitcoinConnector.d.ts +2 -0
- package/dist/wallets/walletConnectors/abcWallet/abcBitcoinConnector.js +8 -6
- package/dist/wallets/walletConnectors/abcWallet/abcBitcoinProvider.d.ts +1 -0
- package/dist/wallets/walletConnectors/abcWallet/abcBitcoinProvider.js +16 -6
- package/dist/wallets/walletConnectors/abcWallet/abcConnector.js +24 -21
- package/dist/wallets/walletConnectors/abcWallet/abcProvider.d.ts +4 -4
- package/dist/wallets/walletConnectors/abcWallet/abcProvider.js +13 -9
- package/dist/wallets/walletConnectors/abcWallet/abcSolanaProvider.js +28 -24
- package/dist/wallets/walletConnectors/abcWallet/abcSolanaWalletAdapter.d.ts +3 -0
- package/dist/wallets/walletConnectors/abcWallet/abcSolanaWalletAdapter.js +183 -62
- package/dist/wallets/walletConnectors/abcWallet/abcTronProvider.d.ts +2 -1
- package/dist/wallets/walletConnectors/abcWallet/abcTronProvider.js +16 -6
- package/dist/wallets/walletConnectors/abcWallet/abcWallet.js +25 -22
- package/dist/wallets/walletConnectors/abcWallet/abcXrplProvider.d.ts +19 -1
- package/dist/wallets/walletConnectors/abcWallet/abcXrplProvider.js +20 -8
- package/dist/wallets/walletConnectors/abcWallet/api/AccessKeySessionBinding.d.ts +10 -0
- package/dist/wallets/walletConnectors/abcWallet/api/AccessKeySessionBinding.js +13 -0
- package/dist/wallets/walletConnectors/abcWallet/api/ConfigApi.js +5 -2
- package/dist/wallets/walletConnectors/abcWallet/api/GasApi.js +5 -1
- package/dist/wallets/walletConnectors/abcWallet/api/SolanaApi.js +5 -1
- package/dist/wallets/walletConnectors/abcWallet/api/TalkenApiClient.d.ts +34 -12
- package/dist/wallets/walletConnectors/abcWallet/api/TalkenApiClient.js +20 -16
- package/dist/wallets/walletConnectors/abcWallet/api/TalkenApiSingleton.d.ts +6 -0
- package/dist/wallets/walletConnectors/abcWallet/api/TalkenApiSingleton.js +10 -1
- package/dist/wallets/walletConnectors/abcWallet/api/TokenApi.js +5 -2
- package/dist/wallets/walletConnectors/abcWallet/api/WalletscanApi.js +13 -3
- package/dist/wallets/walletConnectors/abcWallet/api/index.js +29 -25
- package/dist/wallets/walletConnectors/abcWallet/api/modules/auth.d.ts +20 -10
- package/dist/wallets/walletConnectors/abcWallet/api/modules/auth.js +4 -4
- package/dist/wallets/walletConnectors/abcWallet/api/modules/bitcoin.d.ts +16 -2
- package/dist/wallets/walletConnectors/abcWallet/api/modules/bitcoin.js +12 -9
- package/dist/wallets/walletConnectors/abcWallet/api/modules/evm.d.ts +20 -4
- package/dist/wallets/walletConnectors/abcWallet/api/modules/evm.js +11 -8
- package/dist/wallets/walletConnectors/abcWallet/api/modules/executeBodies.d.ts +79 -0
- package/dist/wallets/walletConnectors/abcWallet/api/modules/executeBodies.js +33 -0
- package/dist/wallets/walletConnectors/abcWallet/api/modules/signBodies.d.ts +4 -1
- package/dist/wallets/walletConnectors/abcWallet/api/modules/signBodies.js +7 -3
- package/dist/wallets/walletConnectors/abcWallet/api/modules/signingRefresh.d.ts +6 -2
- package/dist/wallets/walletConnectors/abcWallet/api/modules/signingRefresh.js +7 -6
- package/dist/wallets/walletConnectors/abcWallet/api/modules/solana.d.ts +9 -3
- package/dist/wallets/walletConnectors/abcWallet/api/modules/solana.js +7 -5
- package/dist/wallets/walletConnectors/abcWallet/api/modules/tron.d.ts +10 -4
- package/dist/wallets/walletConnectors/abcWallet/api/modules/tron.js +15 -2
- package/dist/wallets/walletConnectors/abcWallet/api/modules/wallet.d.ts +2 -1
- package/dist/wallets/walletConnectors/abcWallet/api/modules/wallet.js +2 -2
- package/dist/wallets/walletConnectors/abcWallet/api/modules/walletscan.js +2 -2
- package/dist/wallets/walletConnectors/abcWallet/api/modules/xrp.d.ts +13 -3
- package/dist/wallets/walletConnectors/abcWallet/api/modules/xrp.js +15 -2
- package/dist/wallets/walletConnectors/abcWallet/constants.d.ts +17 -5
- package/dist/wallets/walletConnectors/abcWallet/constants.js +3 -1
- package/dist/wallets/walletConnectors/abcWallet/index.d.ts +1 -0
- package/dist/wallets/walletConnectors/abcWallet/index.js +49 -45
- package/dist/wallets/walletConnectors/abcWallet/sendFailure.d.ts +10 -0
- package/dist/wallets/walletConnectors/abcWallet/sendFailure.js +7 -0
- package/dist/wallets/walletConnectors/abcWallet/sessionUtils.js +11 -3
- package/dist/wallets/walletConnectors/abcWallet/types/api.types.d.ts +76 -1
- package/dist/wallets/walletConnectors/abcWallet/types/auth.types.d.ts +75 -0
- package/dist/wallets/walletConnectors/abcWallet/types/config.types.d.ts +4 -0
- package/dist/wallets/walletConnectors/abcWallet/types/error.types.d.ts +16 -1
- package/dist/wallets/walletConnectors/abcWallet/types/error.types.js +5 -3
- package/dist/wallets/walletConnectors/abcWallet/types.js +8 -6
- package/dist/wallets/walletConnectors/abcWallet/utils.js +5 -5
- package/dist/wallets/walletConnectors/abcWallet/walletGeneration.js +7 -6
- 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-4K2V7RCL.js +96 -0
- package/dist/wallets/walletConnectors/{chunk-CCUNTMLD.js → chunk-4MCD2P7Q.js} +79 -30
- package/dist/wallets/walletConnectors/chunk-4UMY2AY7.js +414 -0
- package/dist/wallets/walletConnectors/{chunk-YECMDMEA.js → chunk-5IY2JM5V.js} +3 -3
- package/dist/wallets/walletConnectors/chunk-5KPLYJOO.js +820 -0
- package/dist/wallets/walletConnectors/chunk-64X6Z6JH.js +390 -0
- package/dist/wallets/walletConnectors/chunk-74OE3YZX.js +739 -0
- package/dist/wallets/walletConnectors/chunk-76M232IF.js +101 -0
- package/dist/wallets/walletConnectors/chunk-CEOJSQAI.js +66 -0
- package/dist/wallets/walletConnectors/chunk-CMSHILRF.js +71 -0
- package/dist/wallets/walletConnectors/chunk-CNKRIZ6T.js +246 -0
- package/dist/wallets/walletConnectors/{chunk-5SHN7JNR.js → chunk-CO5DIPSI.js} +4 -5
- package/dist/wallets/walletConnectors/chunk-CTAFZ5RQ.js +71 -0
- package/dist/wallets/walletConnectors/chunk-DHWJ3552.js +93 -0
- package/dist/wallets/walletConnectors/{chunk-6HR6CEOY.js → chunk-DMZ3PH25.js} +7 -3
- package/dist/wallets/walletConnectors/{chunk-ZTIRW7TR.js → chunk-DUEQONAP.js} +3 -1
- package/dist/wallets/walletConnectors/{chunk-CIAVEXOY.js → chunk-EJWP6MEK.js} +527 -955
- package/dist/wallets/walletConnectors/{chunk-5E7TNMON.js → chunk-EMNOGQO2.js} +18 -7
- package/dist/wallets/walletConnectors/{chunk-6LPMWYFM.js → chunk-EUHXX2SF.js} +151 -83
- package/dist/wallets/walletConnectors/{chunk-OTLZVWY7.js → chunk-EZVOMG73.js} +3 -1
- package/dist/wallets/walletConnectors/{chunk-HXYOWG5P.js → chunk-F2OS4PE2.js} +58 -7
- package/dist/wallets/walletConnectors/chunk-FE2BFYJB.js +73 -0
- package/dist/wallets/walletConnectors/chunk-FGYJTUYV.js +94 -0
- package/dist/wallets/walletConnectors/chunk-FVA6H2VF.js +95 -0
- package/dist/wallets/walletConnectors/chunk-GNF5CHDQ.js +102 -0
- package/dist/wallets/walletConnectors/{chunk-TXB6KXPR.js → chunk-GOUMVJSK.js} +101 -63
- package/dist/wallets/walletConnectors/{chunk-DPYQH3WE.js → chunk-GUXCFLV3.js} +130 -72
- package/dist/wallets/walletConnectors/chunk-GZPGNUNF.js +94 -0
- package/dist/wallets/walletConnectors/chunk-H63QJV3U.js +84 -0
- package/dist/wallets/walletConnectors/chunk-HALTGRQW.js +87 -0
- package/dist/wallets/walletConnectors/{chunk-F6EG7H2O.js → chunk-ICDXVAE5.js} +72 -20
- package/dist/wallets/walletConnectors/{chunk-75H6DQT6.js → chunk-KHBX3RMO.js} +4 -2
- package/dist/wallets/walletConnectors/chunk-KNNHGFKJ.js +98 -0
- package/dist/wallets/walletConnectors/chunk-KQDFRZT4.js +65 -0
- package/dist/wallets/walletConnectors/chunk-KQROIRBW.js +27 -0
- package/dist/wallets/walletConnectors/chunk-LKNK2KKU.js +76 -0
- package/dist/wallets/walletConnectors/{chunk-HFW2XV2R.js → chunk-LS4W2YJJ.js} +28 -7
- package/dist/wallets/walletConnectors/chunk-NM7YUGLV.js +186 -0
- package/dist/wallets/walletConnectors/chunk-NVJA6FA7.js +79 -0
- package/dist/wallets/walletConnectors/chunk-NXLLPSM4.js +53 -0
- package/dist/wallets/walletConnectors/{chunk-HMMEOZDT.js → chunk-PGV5K26R.js} +6 -4
- package/dist/wallets/walletConnectors/{chunk-F6AHT6K4.js → chunk-PL56SINL.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-YUBS7MJ6.js → chunk-Q66E4NTB.js} +53 -14
- package/dist/wallets/walletConnectors/chunk-QRU6XFHH.js +110 -0
- package/dist/wallets/walletConnectors/{chunk-FWKMNVWU.js → chunk-RVLR562W.js} +39 -9
- package/dist/wallets/walletConnectors/{chunk-XQTK7NGN.js → chunk-SUMQUG76.js} +35 -10
- package/dist/wallets/walletConnectors/chunk-TA4DDCKN.js +96 -0
- package/dist/wallets/walletConnectors/chunk-TWVKSPTP.js +91 -0
- package/dist/wallets/walletConnectors/chunk-U5UPCM5V.js +66 -0
- package/dist/wallets/walletConnectors/{chunk-BUAWEYGV.js → chunk-UVPRZEPJ.js} +10 -2
- package/dist/wallets/walletConnectors/chunk-V5LGED4F.js +103 -0
- package/dist/wallets/walletConnectors/{chunk-ZITVWA4X.js → chunk-V6R6WDOQ.js} +1 -1
- package/dist/wallets/walletConnectors/chunk-WBVDGWKA.js +60 -0
- package/dist/wallets/walletConnectors/{chunk-RQYBKCWA.js → chunk-WMDTUVBI.js} +4 -2
- package/dist/wallets/walletConnectors/{chunk-OEZE4GBQ.js → chunk-WXLW3QUZ.js} +66 -12
- package/dist/wallets/walletConnectors/chunk-WZMFQQ6R.js +108 -0
- package/dist/wallets/walletConnectors/{chunk-QTBJ6WNZ.js → chunk-X3P74Y3M.js} +110 -59
- package/dist/wallets/walletConnectors/{chunk-7GBAUSQJ.js → chunk-XPZCOEQL.js} +13 -6
- package/dist/wallets/walletConnectors/chunk-XS6GJRRA.js +98 -0
- package/dist/wallets/walletConnectors/{chunk-2OHHFQQ7.js → chunk-XSH5KJQV.js} +3 -1
- package/dist/wallets/walletConnectors/chunk-XSJUQHR7.js +95 -0
- package/dist/wallets/walletConnectors/chunk-XSX5EECZ.js +96 -0
- package/dist/wallets/walletConnectors/chunk-Z66ETAKN.js +20 -0
- package/dist/wallets/walletConnectors/{chunk-UNLWNVSN.js → chunk-ZJCV4QR4.js} +40 -11
- 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/dawnWallet/dawnWallet.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 +94 -91
- 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/AbcCredentialManager-QM2BNLSR.js +0 -7
- package/dist/TalkenApiSingleton-TECFDCT4.js +0 -9
- package/dist/chunk-PS5CBMY5.js +0 -453
- package/dist/chunk-R6ZE7JAZ.js +0 -15
- package/dist/wallets/walletConnectors/chunk-3DHUDD4U.js +0 -132
- package/dist/wallets/walletConnectors/chunk-6BHMNR5X.js +0 -46
- package/dist/wallets/walletConnectors/chunk-FLBJ7T4Q.js +0 -44
- package/dist/wallets/walletConnectors/chunk-KX3IFHJQ.js +0 -370
- package/dist/wallets/walletConnectors/chunk-R6ZE7JAZ.js +0 -15
|
@@ -3,14 +3,19 @@ import {
|
|
|
3
3
|
resolveEvmSignType
|
|
4
4
|
} from "./chunk-OESFVVLA.js";
|
|
5
5
|
import {
|
|
6
|
-
|
|
7
|
-
} from "./chunk-
|
|
6
|
+
isSigningCredentialError
|
|
7
|
+
} from "./chunk-NVJA6FA7.js";
|
|
8
8
|
import {
|
|
9
|
-
|
|
10
|
-
} from "./chunk-
|
|
9
|
+
toBroadcastBody
|
|
10
|
+
} from "./chunk-4UMY2AY7.js";
|
|
11
|
+
import {
|
|
12
|
+
getChainKey,
|
|
13
|
+
getExplorerTxUrl,
|
|
14
|
+
getNetworkName
|
|
15
|
+
} from "./chunk-5KPLYJOO.js";
|
|
11
16
|
import {
|
|
12
|
-
|
|
13
|
-
} from "./chunk-
|
|
17
|
+
AbstractChainProvider
|
|
18
|
+
} from "./chunk-CNKRIZ6T.js";
|
|
14
19
|
import {
|
|
15
20
|
ProviderErrorCode,
|
|
16
21
|
ProviderRpcError
|
|
@@ -21,790 +26,25 @@ import {
|
|
|
21
26
|
import {
|
|
22
27
|
hexToNumber,
|
|
23
28
|
numberToHex
|
|
24
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-5IY2JM5V.js";
|
|
25
30
|
import {
|
|
26
31
|
TalkenApiError
|
|
27
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-UVPRZEPJ.js";
|
|
33
|
+
import {
|
|
34
|
+
getTalkenApiClient,
|
|
35
|
+
ownsTalkenApiStorage
|
|
36
|
+
} from "./chunk-NXLLPSM4.js";
|
|
37
|
+
import {
|
|
38
|
+
getCredentialManager
|
|
39
|
+
} from "./chunk-CO5DIPSI.js";
|
|
28
40
|
import {
|
|
41
|
+
SEND_REQUEST_TIMEOUT,
|
|
29
42
|
TALKEN_API_ENDPOINTS
|
|
30
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-XPZCOEQL.js";
|
|
31
44
|
|
|
32
45
|
// src/wallets/walletConnectors/abcWallet/abcProvider.ts
|
|
33
46
|
import { parseGwei } from "viem";
|
|
34
47
|
|
|
35
|
-
// src/config/networks.ts
|
|
36
|
-
var NETWORK_CONFIGS = {
|
|
37
|
-
// Ethereum Mainnet
|
|
38
|
-
1: {
|
|
39
|
-
chainId: 1,
|
|
40
|
-
network: "ethereum",
|
|
41
|
-
name: "Ethereum",
|
|
42
|
-
type: "EVM" /* EVM */,
|
|
43
|
-
isTestnet: false,
|
|
44
|
-
explorer: "https://etherscan.io",
|
|
45
|
-
website: "https://ethereum.org",
|
|
46
|
-
nativeCurrency: {
|
|
47
|
-
name: "Ether",
|
|
48
|
-
symbol: "ETH",
|
|
49
|
-
decimals: 18
|
|
50
|
-
},
|
|
51
|
-
apiSupport: { tokens: true, nft: true, transactions: true },
|
|
52
|
-
signSupport: { legacy: true, eip1559: true }
|
|
53
|
-
},
|
|
54
|
-
// Ethereum Sepolia Testnet
|
|
55
|
-
11155111: {
|
|
56
|
-
chainId: 11155111,
|
|
57
|
-
network: "ethereum_sepolia",
|
|
58
|
-
name: "Ethereum Sepolia",
|
|
59
|
-
type: "EVM" /* EVM */,
|
|
60
|
-
isTestnet: true,
|
|
61
|
-
explorer: "https://sepolia.etherscan.io",
|
|
62
|
-
website: "https://ethereum.org",
|
|
63
|
-
nativeCurrency: {
|
|
64
|
-
name: "Sepolia Ether",
|
|
65
|
-
symbol: "ETH",
|
|
66
|
-
decimals: 18
|
|
67
|
-
},
|
|
68
|
-
apiSupport: { tokens: true, nft: true, transactions: true },
|
|
69
|
-
signSupport: { legacy: true, eip1559: true }
|
|
70
|
-
},
|
|
71
|
-
// Ethereum Holesky Testnet
|
|
72
|
-
17e3: {
|
|
73
|
-
chainId: 17e3,
|
|
74
|
-
network: "ethereum_holesky",
|
|
75
|
-
name: "Ethereum Holesky",
|
|
76
|
-
type: "EVM" /* EVM */,
|
|
77
|
-
isTestnet: true,
|
|
78
|
-
explorer: "https://holesky.etherscan.io",
|
|
79
|
-
website: "https://ethereum.org",
|
|
80
|
-
nativeCurrency: {
|
|
81
|
-
name: "Holesky Ether",
|
|
82
|
-
symbol: "ETH",
|
|
83
|
-
decimals: 18
|
|
84
|
-
},
|
|
85
|
-
apiSupport: { tokens: true, nft: true, transactions: true },
|
|
86
|
-
signSupport: { legacy: true, eip1559: true }
|
|
87
|
-
},
|
|
88
|
-
// Kaia Mainnet (formerly Klaytn)
|
|
89
|
-
8217: {
|
|
90
|
-
chainId: 8217,
|
|
91
|
-
network: "kaia",
|
|
92
|
-
name: "Kaia Mainnet",
|
|
93
|
-
type: "EVM" /* EVM */,
|
|
94
|
-
isTestnet: false,
|
|
95
|
-
explorer: "https://kaiascan.io",
|
|
96
|
-
website: "https://kaia.io",
|
|
97
|
-
nativeCurrency: {
|
|
98
|
-
name: "Kaia",
|
|
99
|
-
symbol: "KAIA",
|
|
100
|
-
decimals: 18
|
|
101
|
-
},
|
|
102
|
-
apiSupport: { tokens: true, nft: true, transactions: true },
|
|
103
|
-
signSupport: { legacy: true, eip1559: true }
|
|
104
|
-
},
|
|
105
|
-
// Kaia Kairos Testnet
|
|
106
|
-
1001: {
|
|
107
|
-
chainId: 1001,
|
|
108
|
-
network: "kaia_kairos",
|
|
109
|
-
name: "Kaia Kairos Testnet",
|
|
110
|
-
type: "EVM" /* EVM */,
|
|
111
|
-
isTestnet: true,
|
|
112
|
-
explorer: "https://kairos.kaiascan.io",
|
|
113
|
-
website: "https://kaia.io",
|
|
114
|
-
nativeCurrency: {
|
|
115
|
-
name: "Kaia",
|
|
116
|
-
symbol: "KAIA",
|
|
117
|
-
decimals: 18
|
|
118
|
-
},
|
|
119
|
-
apiSupport: { tokens: true, nft: true, transactions: true },
|
|
120
|
-
signSupport: { legacy: true, eip1559: true }
|
|
121
|
-
},
|
|
122
|
-
// Polygon Mainnet
|
|
123
|
-
137: {
|
|
124
|
-
chainId: 137,
|
|
125
|
-
network: "polygon",
|
|
126
|
-
name: "Polygon",
|
|
127
|
-
type: "EVM" /* EVM */,
|
|
128
|
-
isTestnet: false,
|
|
129
|
-
explorer: "https://polygonscan.com",
|
|
130
|
-
website: "https://polygon.technology",
|
|
131
|
-
nativeCurrency: {
|
|
132
|
-
name: "MATIC",
|
|
133
|
-
symbol: "MATIC",
|
|
134
|
-
decimals: 18
|
|
135
|
-
},
|
|
136
|
-
apiSupport: { tokens: true, nft: true, transactions: true },
|
|
137
|
-
signSupport: { legacy: true, eip1559: true }
|
|
138
|
-
},
|
|
139
|
-
// Polygon Amoy Testnet
|
|
140
|
-
80002: {
|
|
141
|
-
chainId: 80002,
|
|
142
|
-
network: "polygon_amoy",
|
|
143
|
-
name: "Polygon Amoy Testnet",
|
|
144
|
-
type: "EVM" /* EVM */,
|
|
145
|
-
isTestnet: true,
|
|
146
|
-
explorer: "https://amoy.polygonscan.com",
|
|
147
|
-
website: "https://polygon.technology",
|
|
148
|
-
nativeCurrency: {
|
|
149
|
-
name: "MATIC",
|
|
150
|
-
symbol: "MATIC",
|
|
151
|
-
decimals: 18
|
|
152
|
-
},
|
|
153
|
-
apiSupport: { tokens: true, nft: true, transactions: true },
|
|
154
|
-
signSupport: { legacy: true, eip1559: true }
|
|
155
|
-
},
|
|
156
|
-
// Binance Smart Chain Mainnet
|
|
157
|
-
56: {
|
|
158
|
-
chainId: 56,
|
|
159
|
-
network: "binance",
|
|
160
|
-
name: "Binance Smart Chain Mainnet",
|
|
161
|
-
type: "EVM" /* EVM */,
|
|
162
|
-
isTestnet: false,
|
|
163
|
-
explorer: "https://bscscan.com",
|
|
164
|
-
website: "https://www.bnbchain.org/en/bnb-smart-chain",
|
|
165
|
-
nativeCurrency: {
|
|
166
|
-
name: "BNB",
|
|
167
|
-
symbol: "BNB",
|
|
168
|
-
decimals: 18
|
|
169
|
-
},
|
|
170
|
-
apiSupport: { tokens: true, nft: true, transactions: true },
|
|
171
|
-
signSupport: { legacy: true, eip1559: true }
|
|
172
|
-
},
|
|
173
|
-
// Binance Smart Chain Testnet
|
|
174
|
-
97: {
|
|
175
|
-
chainId: 97,
|
|
176
|
-
network: "binance_testnet",
|
|
177
|
-
name: "Binance Smart Chain Testnet",
|
|
178
|
-
type: "EVM" /* EVM */,
|
|
179
|
-
isTestnet: true,
|
|
180
|
-
explorer: "https://testnet.bscscan.com",
|
|
181
|
-
website: "https://www.bnbchain.org/en/bnb-smart-chain",
|
|
182
|
-
nativeCurrency: {
|
|
183
|
-
name: "BNB",
|
|
184
|
-
symbol: "BNB",
|
|
185
|
-
decimals: 18
|
|
186
|
-
},
|
|
187
|
-
apiSupport: { tokens: true, nft: true, transactions: true },
|
|
188
|
-
signSupport: { legacy: true, eip1559: true }
|
|
189
|
-
},
|
|
190
|
-
// Arbitrum One
|
|
191
|
-
42161: {
|
|
192
|
-
chainId: 42161,
|
|
193
|
-
network: "arbitrum",
|
|
194
|
-
name: "Arbitrum One",
|
|
195
|
-
type: "EVM" /* EVM */,
|
|
196
|
-
isTestnet: false,
|
|
197
|
-
explorer: "https://arbiscan.io",
|
|
198
|
-
website: "https://arbitrum.io",
|
|
199
|
-
nativeCurrency: {
|
|
200
|
-
name: "Ether",
|
|
201
|
-
symbol: "ETH",
|
|
202
|
-
decimals: 18
|
|
203
|
-
},
|
|
204
|
-
apiSupport: { tokens: true, nft: true, transactions: true },
|
|
205
|
-
signSupport: { legacy: true, eip1559: true }
|
|
206
|
-
},
|
|
207
|
-
// Arbitrum Sepolia
|
|
208
|
-
421614: {
|
|
209
|
-
chainId: 421614,
|
|
210
|
-
network: "arbitrum_sepolia",
|
|
211
|
-
name: "Arbitrum Sepolia",
|
|
212
|
-
type: "EVM" /* EVM */,
|
|
213
|
-
isTestnet: true,
|
|
214
|
-
explorer: "https://sepolia.arbiscan.io",
|
|
215
|
-
website: "https://arbitrum.io",
|
|
216
|
-
nativeCurrency: {
|
|
217
|
-
name: "Ether",
|
|
218
|
-
symbol: "ETH",
|
|
219
|
-
decimals: 18
|
|
220
|
-
},
|
|
221
|
-
apiSupport: { tokens: true, nft: true, transactions: true },
|
|
222
|
-
signSupport: { legacy: true, eip1559: true }
|
|
223
|
-
},
|
|
224
|
-
// Optimism Mainnet
|
|
225
|
-
10: {
|
|
226
|
-
chainId: 10,
|
|
227
|
-
network: "optimism",
|
|
228
|
-
name: "Optimism",
|
|
229
|
-
type: "EVM" /* EVM */,
|
|
230
|
-
isTestnet: false,
|
|
231
|
-
explorer: "https://optimistic.etherscan.io",
|
|
232
|
-
website: "https://optimism.io",
|
|
233
|
-
nativeCurrency: {
|
|
234
|
-
name: "Ether",
|
|
235
|
-
symbol: "ETH",
|
|
236
|
-
decimals: 18
|
|
237
|
-
},
|
|
238
|
-
apiSupport: { tokens: true, nft: true, transactions: true },
|
|
239
|
-
signSupport: { legacy: true, eip1559: true }
|
|
240
|
-
},
|
|
241
|
-
// Optimism Sepolia
|
|
242
|
-
420: {
|
|
243
|
-
chainId: 420,
|
|
244
|
-
network: "optimism_sepolia",
|
|
245
|
-
name: "Optimism Sepolia",
|
|
246
|
-
type: "EVM" /* EVM */,
|
|
247
|
-
isTestnet: true,
|
|
248
|
-
explorer: "https://sepolia-optimism.etherscan.io",
|
|
249
|
-
website: "https://optimism.io",
|
|
250
|
-
nativeCurrency: {
|
|
251
|
-
name: "Ether",
|
|
252
|
-
symbol: "ETH",
|
|
253
|
-
decimals: 18
|
|
254
|
-
},
|
|
255
|
-
apiSupport: { tokens: true, nft: true, transactions: true },
|
|
256
|
-
signSupport: { legacy: true, eip1559: true }
|
|
257
|
-
},
|
|
258
|
-
// Avalanche C-Chain
|
|
259
|
-
43114: {
|
|
260
|
-
chainId: 43114,
|
|
261
|
-
network: "avalanche",
|
|
262
|
-
name: "Avalanche C-Chain",
|
|
263
|
-
type: "EVM" /* EVM */,
|
|
264
|
-
isTestnet: false,
|
|
265
|
-
explorer: "https://avascan.info/blockchain/c/home",
|
|
266
|
-
website: "https://avax.network",
|
|
267
|
-
nativeCurrency: {
|
|
268
|
-
name: "Avalanche",
|
|
269
|
-
symbol: "AVAX",
|
|
270
|
-
decimals: 18
|
|
271
|
-
},
|
|
272
|
-
apiSupport: { tokens: true, nft: true, transactions: true },
|
|
273
|
-
signSupport: { legacy: true, eip1559: true }
|
|
274
|
-
},
|
|
275
|
-
// Avalanche Fuji Testnet
|
|
276
|
-
43113: {
|
|
277
|
-
chainId: 43113,
|
|
278
|
-
network: "avalanche_fuji",
|
|
279
|
-
name: "Avalanche Fuji Testnet",
|
|
280
|
-
type: "EVM" /* EVM */,
|
|
281
|
-
isTestnet: true,
|
|
282
|
-
explorer: "https://testnet.avascan.info",
|
|
283
|
-
website: "https://avax.network",
|
|
284
|
-
nativeCurrency: {
|
|
285
|
-
name: "Avalanche",
|
|
286
|
-
symbol: "AVAX",
|
|
287
|
-
decimals: 18
|
|
288
|
-
},
|
|
289
|
-
apiSupport: { tokens: false, nft: false, transactions: false },
|
|
290
|
-
signSupport: { legacy: true, eip1559: true }
|
|
291
|
-
},
|
|
292
|
-
// Mantle Mainnet
|
|
293
|
-
5e3: {
|
|
294
|
-
chainId: 5e3,
|
|
295
|
-
network: "mantle",
|
|
296
|
-
name: "Mantle Mainnet",
|
|
297
|
-
type: "EVM" /* EVM */,
|
|
298
|
-
isTestnet: false,
|
|
299
|
-
explorer: "https://explorer.mantle.xyz",
|
|
300
|
-
website: "https://www.mantle.xyz",
|
|
301
|
-
nativeCurrency: {
|
|
302
|
-
name: "Mantle",
|
|
303
|
-
symbol: "MNT",
|
|
304
|
-
decimals: 18
|
|
305
|
-
},
|
|
306
|
-
apiSupport: { tokens: true, nft: true, transactions: true },
|
|
307
|
-
signSupport: { legacy: true, eip1559: true }
|
|
308
|
-
},
|
|
309
|
-
// Mantle Testnet
|
|
310
|
-
5001: {
|
|
311
|
-
chainId: 5001,
|
|
312
|
-
network: "mantle_testnet",
|
|
313
|
-
name: "Mantle Testnet",
|
|
314
|
-
type: "EVM" /* EVM */,
|
|
315
|
-
isTestnet: true,
|
|
316
|
-
explorer: "https://sepolia.mantlescan.xyz",
|
|
317
|
-
website: "https://www.mantle.xyz",
|
|
318
|
-
nativeCurrency: {
|
|
319
|
-
name: "Mantle",
|
|
320
|
-
symbol: "MNT",
|
|
321
|
-
decimals: 18
|
|
322
|
-
},
|
|
323
|
-
apiSupport: { tokens: true, nft: true, transactions: true },
|
|
324
|
-
signSupport: { legacy: true, eip1559: true }
|
|
325
|
-
},
|
|
326
|
-
// Moonbeam
|
|
327
|
-
1284: {
|
|
328
|
-
chainId: 1284,
|
|
329
|
-
network: "moonbeam",
|
|
330
|
-
name: "Moonbeam",
|
|
331
|
-
type: "EVM" /* EVM */,
|
|
332
|
-
isTestnet: false,
|
|
333
|
-
explorer: "https://moonbeam.moonscan.io",
|
|
334
|
-
website: "https://moonbeam.network",
|
|
335
|
-
nativeCurrency: {
|
|
336
|
-
name: "Glimmer",
|
|
337
|
-
symbol: "GLMR",
|
|
338
|
-
decimals: 18
|
|
339
|
-
},
|
|
340
|
-
apiSupport: { tokens: true, nft: true, transactions: true },
|
|
341
|
-
signSupport: { legacy: true, eip1559: true }
|
|
342
|
-
},
|
|
343
|
-
// Moonriver
|
|
344
|
-
1285: {
|
|
345
|
-
chainId: 1285,
|
|
346
|
-
network: "moonriver",
|
|
347
|
-
name: "Moonriver",
|
|
348
|
-
type: "EVM" /* EVM */,
|
|
349
|
-
isTestnet: false,
|
|
350
|
-
explorer: "https://moonriver.moonscan.io",
|
|
351
|
-
website: "https://moonbeam.network/networks/moonriver",
|
|
352
|
-
nativeCurrency: {
|
|
353
|
-
name: "Moonriver",
|
|
354
|
-
symbol: "MOVR",
|
|
355
|
-
decimals: 18
|
|
356
|
-
},
|
|
357
|
-
apiSupport: { tokens: true, nft: true, transactions: true },
|
|
358
|
-
signSupport: { legacy: true, eip1559: true }
|
|
359
|
-
},
|
|
360
|
-
// Scroll Mainnet
|
|
361
|
-
534352: {
|
|
362
|
-
chainId: 534352,
|
|
363
|
-
network: "scroll",
|
|
364
|
-
name: "Scroll",
|
|
365
|
-
type: "EVM" /* EVM */,
|
|
366
|
-
isTestnet: false,
|
|
367
|
-
explorer: "https://scrollscan.co",
|
|
368
|
-
website: "https://scroll.io",
|
|
369
|
-
nativeCurrency: {
|
|
370
|
-
name: "Ether",
|
|
371
|
-
symbol: "ETH",
|
|
372
|
-
decimals: 18
|
|
373
|
-
},
|
|
374
|
-
apiSupport: { tokens: true, nft: true, transactions: true },
|
|
375
|
-
signSupport: { legacy: true, eip1559: true }
|
|
376
|
-
},
|
|
377
|
-
// Scroll Testnet
|
|
378
|
-
534351: {
|
|
379
|
-
chainId: 534351,
|
|
380
|
-
network: "scroll_testnet",
|
|
381
|
-
name: "Scroll Testnet",
|
|
382
|
-
type: "EVM" /* EVM */,
|
|
383
|
-
isTestnet: true,
|
|
384
|
-
explorer: "https://sepolia.scrollscan.com",
|
|
385
|
-
website: "https://scroll.io",
|
|
386
|
-
nativeCurrency: {
|
|
387
|
-
name: "Ether",
|
|
388
|
-
symbol: "ETH",
|
|
389
|
-
decimals: 18
|
|
390
|
-
},
|
|
391
|
-
apiSupport: { tokens: true, nft: true, transactions: true },
|
|
392
|
-
signSupport: { legacy: true, eip1559: true }
|
|
393
|
-
},
|
|
394
|
-
// Silicon Mainnet
|
|
395
|
-
2355: {
|
|
396
|
-
chainId: 2355,
|
|
397
|
-
network: "silicon",
|
|
398
|
-
name: "Silicon",
|
|
399
|
-
type: "EVM" /* EVM */,
|
|
400
|
-
isTestnet: false,
|
|
401
|
-
explorer: "https://scope.silicon.network",
|
|
402
|
-
website: "https://silicon.network",
|
|
403
|
-
nativeCurrency: {
|
|
404
|
-
name: "Ether",
|
|
405
|
-
symbol: "ETH",
|
|
406
|
-
decimals: 18
|
|
407
|
-
},
|
|
408
|
-
apiSupport: { tokens: true, nft: true, transactions: true },
|
|
409
|
-
signSupport: { legacy: true, eip1559: true }
|
|
410
|
-
},
|
|
411
|
-
// Silicon Sepolia
|
|
412
|
-
1722641160: {
|
|
413
|
-
chainId: 1722641160,
|
|
414
|
-
network: "silicon_sepolia",
|
|
415
|
-
name: "Silicon Sepolia",
|
|
416
|
-
type: "EVM" /* EVM */,
|
|
417
|
-
isTestnet: true,
|
|
418
|
-
explorer: "https://scope-sepolia.silicon.network",
|
|
419
|
-
website: "https://silicon.network",
|
|
420
|
-
nativeCurrency: {
|
|
421
|
-
name: "Ether",
|
|
422
|
-
symbol: "ETH",
|
|
423
|
-
decimals: 18
|
|
424
|
-
},
|
|
425
|
-
apiSupport: { tokens: true, nft: true, transactions: true },
|
|
426
|
-
signSupport: { legacy: true, eip1559: true }
|
|
427
|
-
},
|
|
428
|
-
// Six Protocol
|
|
429
|
-
98: {
|
|
430
|
-
chainId: 98,
|
|
431
|
-
network: "six_evm",
|
|
432
|
-
name: "Six Protocol",
|
|
433
|
-
type: "EVM" /* EVM */,
|
|
434
|
-
isTestnet: false,
|
|
435
|
-
explorer: "https://v2.sixscan.io",
|
|
436
|
-
website: "https://www.six.network",
|
|
437
|
-
nativeCurrency: {
|
|
438
|
-
name: "SIX",
|
|
439
|
-
symbol: "SIX",
|
|
440
|
-
decimals: 18
|
|
441
|
-
},
|
|
442
|
-
apiSupport: { tokens: true, nft: false, transactions: true },
|
|
443
|
-
signSupport: { legacy: true, eip1559: false }
|
|
444
|
-
},
|
|
445
|
-
// Six Protocol Testnet
|
|
446
|
-
150: {
|
|
447
|
-
chainId: 150,
|
|
448
|
-
network: "six_evm_testnet",
|
|
449
|
-
name: "Six Protocol Testnet",
|
|
450
|
-
type: "EVM" /* EVM */,
|
|
451
|
-
isTestnet: true,
|
|
452
|
-
explorer: "https://v2.fivenet.sixscan.io",
|
|
453
|
-
website: "https://www.six.network",
|
|
454
|
-
nativeCurrency: {
|
|
455
|
-
name: "SIX",
|
|
456
|
-
symbol: "SIX",
|
|
457
|
-
decimals: 18
|
|
458
|
-
},
|
|
459
|
-
apiSupport: { tokens: true, nft: false, transactions: true },
|
|
460
|
-
signSupport: { legacy: true, eip1559: false }
|
|
461
|
-
},
|
|
462
|
-
// Wemix Mainnet
|
|
463
|
-
1111: {
|
|
464
|
-
chainId: 1111,
|
|
465
|
-
network: "wemix",
|
|
466
|
-
name: "Wemix3.0 Mainnet",
|
|
467
|
-
type: "EVM" /* EVM */,
|
|
468
|
-
isTestnet: false,
|
|
469
|
-
explorer: "https://explorer.wemix.com",
|
|
470
|
-
website: "https://wemix.com",
|
|
471
|
-
nativeCurrency: {
|
|
472
|
-
name: "WEMIX",
|
|
473
|
-
symbol: "WEMIX",
|
|
474
|
-
decimals: 18
|
|
475
|
-
},
|
|
476
|
-
apiSupport: { tokens: true, nft: true, transactions: true },
|
|
477
|
-
signSupport: { legacy: true, eip1559: true }
|
|
478
|
-
},
|
|
479
|
-
// Wemix Testnet
|
|
480
|
-
1112: {
|
|
481
|
-
chainId: 1112,
|
|
482
|
-
network: "wemix_testnet",
|
|
483
|
-
name: "Wemix3.0 Testnet",
|
|
484
|
-
type: "EVM" /* EVM */,
|
|
485
|
-
isTestnet: true,
|
|
486
|
-
explorer: "https://explorer.test.wemix.com",
|
|
487
|
-
website: "https://wemix.com",
|
|
488
|
-
nativeCurrency: {
|
|
489
|
-
name: "WEMIX",
|
|
490
|
-
symbol: "WEMIX",
|
|
491
|
-
decimals: 18
|
|
492
|
-
},
|
|
493
|
-
apiSupport: { tokens: true, nft: true, transactions: true },
|
|
494
|
-
signSupport: { legacy: true, eip1559: true }
|
|
495
|
-
},
|
|
496
|
-
// Taiko Mainnet
|
|
497
|
-
167e3: {
|
|
498
|
-
chainId: 167e3,
|
|
499
|
-
network: "taiko",
|
|
500
|
-
name: "Taiko Mainnet",
|
|
501
|
-
type: "EVM" /* EVM */,
|
|
502
|
-
isTestnet: false,
|
|
503
|
-
explorer: "https://taikoscan.io",
|
|
504
|
-
website: "https://taiko.xyz",
|
|
505
|
-
nativeCurrency: {
|
|
506
|
-
name: "Ether",
|
|
507
|
-
symbol: "ETH",
|
|
508
|
-
decimals: 18
|
|
509
|
-
},
|
|
510
|
-
apiSupport: { tokens: true, nft: true, transactions: true },
|
|
511
|
-
signSupport: { legacy: true, eip1559: true }
|
|
512
|
-
},
|
|
513
|
-
// Taiko Hekla Testnet
|
|
514
|
-
167009: {
|
|
515
|
-
chainId: 167009,
|
|
516
|
-
network: "taiko_hekla",
|
|
517
|
-
name: "Taiko Hekla Testnet",
|
|
518
|
-
type: "EVM" /* EVM */,
|
|
519
|
-
isTestnet: true,
|
|
520
|
-
explorer: "https://hekla.taikoscan.io",
|
|
521
|
-
website: "https://taiko.xyz",
|
|
522
|
-
nativeCurrency: {
|
|
523
|
-
name: "Ether",
|
|
524
|
-
symbol: "ETH",
|
|
525
|
-
decimals: 18
|
|
526
|
-
},
|
|
527
|
-
apiSupport: { tokens: true, nft: true, transactions: true },
|
|
528
|
-
signSupport: { legacy: true, eip1559: true }
|
|
529
|
-
},
|
|
530
|
-
// Base Mainnet
|
|
531
|
-
8453: {
|
|
532
|
-
chainId: 8453,
|
|
533
|
-
network: "base",
|
|
534
|
-
name: "Base",
|
|
535
|
-
type: "EVM" /* EVM */,
|
|
536
|
-
isTestnet: false,
|
|
537
|
-
explorer: "https://basescan.org",
|
|
538
|
-
website: "https://base.org",
|
|
539
|
-
nativeCurrency: {
|
|
540
|
-
name: "Ether",
|
|
541
|
-
symbol: "ETH",
|
|
542
|
-
decimals: 18
|
|
543
|
-
},
|
|
544
|
-
apiSupport: { tokens: true, nft: true, transactions: true },
|
|
545
|
-
signSupport: { legacy: true, eip1559: true }
|
|
546
|
-
},
|
|
547
|
-
// Base Sepolia Testnet
|
|
548
|
-
84532: {
|
|
549
|
-
chainId: 84532,
|
|
550
|
-
network: "base_sepolia",
|
|
551
|
-
name: "Base Sepolia",
|
|
552
|
-
type: "EVM" /* EVM */,
|
|
553
|
-
isTestnet: true,
|
|
554
|
-
explorer: "https://sepolia.basescan.org",
|
|
555
|
-
website: "https://base.org",
|
|
556
|
-
nativeCurrency: {
|
|
557
|
-
name: "Ether",
|
|
558
|
-
symbol: "ETH",
|
|
559
|
-
decimals: 18
|
|
560
|
-
},
|
|
561
|
-
apiSupport: { tokens: true, nft: true, transactions: true },
|
|
562
|
-
signSupport: { legacy: true, eip1559: true }
|
|
563
|
-
},
|
|
564
|
-
// ChainBounty Mainnet
|
|
565
|
-
51828: {
|
|
566
|
-
chainId: 51828,
|
|
567
|
-
network: "chainbounty",
|
|
568
|
-
name: "ChainBounty Mainnet",
|
|
569
|
-
type: "EVM" /* EVM */,
|
|
570
|
-
isTestnet: false,
|
|
571
|
-
explorer: "https://scan.chainbounty.io",
|
|
572
|
-
website: "https://chainbounty.io",
|
|
573
|
-
nativeCurrency: {
|
|
574
|
-
name: "ChainBounty",
|
|
575
|
-
symbol: "CBY",
|
|
576
|
-
decimals: 18
|
|
577
|
-
},
|
|
578
|
-
apiSupport: { tokens: true, nft: true, transactions: true },
|
|
579
|
-
signSupport: { legacy: true, eip1559: true }
|
|
580
|
-
},
|
|
581
|
-
// ChainBounty Testnet
|
|
582
|
-
56580: {
|
|
583
|
-
chainId: 56580,
|
|
584
|
-
network: "chainbounty_testnet",
|
|
585
|
-
name: "ChainBounty Testnet",
|
|
586
|
-
type: "EVM" /* EVM */,
|
|
587
|
-
isTestnet: true,
|
|
588
|
-
explorer: "https://test.scan.chainbounty.io",
|
|
589
|
-
website: "https://chainbounty.io",
|
|
590
|
-
nativeCurrency: {
|
|
591
|
-
name: "ChainBounty",
|
|
592
|
-
symbol: "CBY",
|
|
593
|
-
decimals: 18
|
|
594
|
-
},
|
|
595
|
-
apiSupport: { tokens: true, nft: true, transactions: true },
|
|
596
|
-
signSupport: { legacy: true, eip1559: true }
|
|
597
|
-
},
|
|
598
|
-
// Aptos Mainnet (Non-EVM)
|
|
599
|
-
aptos: {
|
|
600
|
-
chainId: null,
|
|
601
|
-
network: "aptos",
|
|
602
|
-
name: "Aptos",
|
|
603
|
-
type: "Non-EVM" /* NON_EVM */,
|
|
604
|
-
isTestnet: false,
|
|
605
|
-
explorer: "https://explorer.aptoslabs.com/?network=mainnet",
|
|
606
|
-
website: "https://aptos.dev",
|
|
607
|
-
nativeCurrency: {
|
|
608
|
-
name: "Aptos",
|
|
609
|
-
symbol: "APT",
|
|
610
|
-
decimals: 8
|
|
611
|
-
},
|
|
612
|
-
apiSupport: { tokens: true, nft: true, transactions: true },
|
|
613
|
-
signSupport: { legacy: true, eip1559: false }
|
|
614
|
-
},
|
|
615
|
-
// Aptos Testnet (Non-EVM)
|
|
616
|
-
aptos_testnet: {
|
|
617
|
-
chainId: null,
|
|
618
|
-
network: "aptos_testnet",
|
|
619
|
-
name: "Aptos Testnet",
|
|
620
|
-
type: "Non-EVM" /* NON_EVM */,
|
|
621
|
-
isTestnet: true,
|
|
622
|
-
explorer: "https://explorer.aptoslabs.com/?network=testnet",
|
|
623
|
-
website: "https://aptos.dev",
|
|
624
|
-
nativeCurrency: {
|
|
625
|
-
name: "Aptos",
|
|
626
|
-
symbol: "APT",
|
|
627
|
-
decimals: 8
|
|
628
|
-
},
|
|
629
|
-
apiSupport: { tokens: true, nft: true, transactions: true },
|
|
630
|
-
signSupport: { legacy: true, eip1559: false }
|
|
631
|
-
},
|
|
632
|
-
// Bitcoin Mainnet
|
|
633
|
-
bitcoin: {
|
|
634
|
-
chainId: null,
|
|
635
|
-
network: "bitcoin",
|
|
636
|
-
name: "Bitcoin Mainnet",
|
|
637
|
-
type: "Bitcoin" /* BITCOIN */,
|
|
638
|
-
isTestnet: false,
|
|
639
|
-
explorer: "https://blockstream.info",
|
|
640
|
-
website: "https://bitcoin.org",
|
|
641
|
-
nativeCurrency: {
|
|
642
|
-
name: "Bitcoin",
|
|
643
|
-
symbol: "BTC",
|
|
644
|
-
decimals: 8
|
|
645
|
-
},
|
|
646
|
-
apiSupport: { tokens: true, nft: false, transactions: true },
|
|
647
|
-
signSupport: { legacy: true, eip1559: false }
|
|
648
|
-
},
|
|
649
|
-
// Bitcoin Testnet
|
|
650
|
-
bitcoin_testnet: {
|
|
651
|
-
chainId: null,
|
|
652
|
-
network: "bitcoin_testnet",
|
|
653
|
-
name: "Bitcoin Testnet",
|
|
654
|
-
type: "Bitcoin" /* BITCOIN */,
|
|
655
|
-
isTestnet: true,
|
|
656
|
-
explorer: "https://blockstream.info/testnet",
|
|
657
|
-
website: "https://bitcoin.org",
|
|
658
|
-
nativeCurrency: {
|
|
659
|
-
name: "Bitcoin",
|
|
660
|
-
symbol: "BTC",
|
|
661
|
-
decimals: 8
|
|
662
|
-
},
|
|
663
|
-
apiSupport: { tokens: true, nft: false, transactions: true },
|
|
664
|
-
signSupport: { legacy: true, eip1559: false }
|
|
665
|
-
},
|
|
666
|
-
// Tron Mainnet
|
|
667
|
-
tron: {
|
|
668
|
-
chainId: null,
|
|
669
|
-
network: "tron",
|
|
670
|
-
name: "Tron Mainnet",
|
|
671
|
-
type: "TRX" /* TRON */,
|
|
672
|
-
isTestnet: false,
|
|
673
|
-
explorer: "https://tronscan.org",
|
|
674
|
-
website: "https://tron.network",
|
|
675
|
-
nativeCurrency: {
|
|
676
|
-
name: "Tronix",
|
|
677
|
-
symbol: "TRX",
|
|
678
|
-
decimals: 6
|
|
679
|
-
},
|
|
680
|
-
apiSupport: { tokens: true, nft: true, transactions: true },
|
|
681
|
-
signSupport: { legacy: true, eip1559: true }
|
|
682
|
-
},
|
|
683
|
-
// Tron Nile Testnet
|
|
684
|
-
tron_nile: {
|
|
685
|
-
chainId: null,
|
|
686
|
-
network: "tron_nile",
|
|
687
|
-
name: "Tron Nile Testnet",
|
|
688
|
-
type: "TRX" /* TRON */,
|
|
689
|
-
isTestnet: true,
|
|
690
|
-
explorer: "https://nile.tronscan.org",
|
|
691
|
-
website: "https://tron.network",
|
|
692
|
-
nativeCurrency: {
|
|
693
|
-
name: "Tronix",
|
|
694
|
-
symbol: "TRX",
|
|
695
|
-
decimals: 6
|
|
696
|
-
},
|
|
697
|
-
apiSupport: { tokens: true, nft: true, transactions: true },
|
|
698
|
-
signSupport: { legacy: true, eip1559: true }
|
|
699
|
-
},
|
|
700
|
-
// ICP Mainnet
|
|
701
|
-
icp: {
|
|
702
|
-
chainId: null,
|
|
703
|
-
network: "icp",
|
|
704
|
-
name: "Internet Computer",
|
|
705
|
-
type: "ICP" /* ICP */,
|
|
706
|
-
isTestnet: false,
|
|
707
|
-
explorer: "https://dashboard.internetcomputer.org",
|
|
708
|
-
website: "https://internetcomputer.org",
|
|
709
|
-
nativeCurrency: {
|
|
710
|
-
name: "ICP",
|
|
711
|
-
symbol: "ICP",
|
|
712
|
-
decimals: 8
|
|
713
|
-
},
|
|
714
|
-
apiSupport: { tokens: true, nft: true, transactions: true },
|
|
715
|
-
signSupport: { legacy: true, eip1559: true }
|
|
716
|
-
},
|
|
717
|
-
// XRP
|
|
718
|
-
xrpl: {
|
|
719
|
-
chainId: null,
|
|
720
|
-
network: "xrpl",
|
|
721
|
-
name: "XRP",
|
|
722
|
-
type: "XRPL" /* XRPL */,
|
|
723
|
-
isTestnet: false,
|
|
724
|
-
explorer: "https://xrpscan.com",
|
|
725
|
-
website: "https://xrpl.org",
|
|
726
|
-
nativeCurrency: {
|
|
727
|
-
name: "XRP",
|
|
728
|
-
symbol: "XRP",
|
|
729
|
-
decimals: 6
|
|
730
|
-
},
|
|
731
|
-
apiSupport: { tokens: true, nft: true, transactions: true },
|
|
732
|
-
signSupport: { legacy: true, eip1559: false }
|
|
733
|
-
},
|
|
734
|
-
// XRP Testnet
|
|
735
|
-
xrpl_testnet: {
|
|
736
|
-
chainId: null,
|
|
737
|
-
network: "xrpl_testnet",
|
|
738
|
-
name: "XRP Testnet",
|
|
739
|
-
type: "XRPL" /* XRPL */,
|
|
740
|
-
isTestnet: true,
|
|
741
|
-
explorer: "https://testnet.xrpscan.com",
|
|
742
|
-
website: "https://xrpl.org",
|
|
743
|
-
nativeCurrency: {
|
|
744
|
-
name: "XRP",
|
|
745
|
-
symbol: "XRP",
|
|
746
|
-
decimals: 6
|
|
747
|
-
},
|
|
748
|
-
apiSupport: { tokens: true, nft: true, transactions: true },
|
|
749
|
-
signSupport: { legacy: true, eip1559: false }
|
|
750
|
-
}
|
|
751
|
-
};
|
|
752
|
-
var NETWORK_BY_PARAM = Object.values(
|
|
753
|
-
NETWORK_CONFIGS
|
|
754
|
-
).reduce(
|
|
755
|
-
(acc, config) => {
|
|
756
|
-
acc[config.network] = config;
|
|
757
|
-
return acc;
|
|
758
|
-
},
|
|
759
|
-
{}
|
|
760
|
-
);
|
|
761
|
-
function getNetworkByChainId(chainId) {
|
|
762
|
-
return NETWORK_CONFIGS[chainId];
|
|
763
|
-
}
|
|
764
|
-
function getNetworkByParam(network) {
|
|
765
|
-
return NETWORK_BY_PARAM[network];
|
|
766
|
-
}
|
|
767
|
-
function getNetworkName(chainId, fallback = "ethereum") {
|
|
768
|
-
return NETWORK_CONFIGS[chainId]?.network ?? fallback;
|
|
769
|
-
}
|
|
770
|
-
var CHAIN_ID_TO_KEY = {
|
|
771
|
-
// Mainnet
|
|
772
|
-
1: "ethereum",
|
|
773
|
-
42161: "arbitrum",
|
|
774
|
-
8217: "kaia",
|
|
775
|
-
56: "bsc",
|
|
776
|
-
8453: "base",
|
|
777
|
-
137: "polygon",
|
|
778
|
-
43114: "avalanche",
|
|
779
|
-
5e3: "mantle",
|
|
780
|
-
51828: "chainbounty",
|
|
781
|
-
// Testnet
|
|
782
|
-
11155111: "sepolia",
|
|
783
|
-
421614: "arbitrumSepolia",
|
|
784
|
-
1001: "kaiaKairos",
|
|
785
|
-
97: "bscTestnet",
|
|
786
|
-
84532: "baseSepolia",
|
|
787
|
-
80002: "polygonAmoy",
|
|
788
|
-
43113: "avalancheFuji",
|
|
789
|
-
5003: "mantleSepolia",
|
|
790
|
-
56580: "chainbountyTestnet",
|
|
791
|
-
998: "hyperevmTestnet"
|
|
792
|
-
};
|
|
793
|
-
function getChainKey(chainId) {
|
|
794
|
-
const key = CHAIN_ID_TO_KEY[chainId];
|
|
795
|
-
if (!key) {
|
|
796
|
-
throw new Error(`Unsupported chainId for tx endpoint: ${chainId}`);
|
|
797
|
-
}
|
|
798
|
-
return key;
|
|
799
|
-
}
|
|
800
|
-
function getExplorerTxUrl(chainIdOrNetwork, txHash) {
|
|
801
|
-
const config = typeof chainIdOrNetwork === "number" ? getNetworkByChainId(chainIdOrNetwork) : getNetworkByParam(chainIdOrNetwork);
|
|
802
|
-
if (!config) {
|
|
803
|
-
throw new Error(`Unknown network: ${chainIdOrNetwork}`);
|
|
804
|
-
}
|
|
805
|
-
return `${config.explorer}/tx/${txHash}`;
|
|
806
|
-
}
|
|
807
|
-
|
|
808
48
|
// src/gasless/GaslessConfigSingleton.ts
|
|
809
49
|
var _gaslessConfig = null;
|
|
810
50
|
function getGaslessConfig() {
|
|
@@ -1356,15 +596,26 @@ async function recoverYParity(hash, r, s, expectedAddress) {
|
|
|
1356
596
|
}
|
|
1357
597
|
throw new Error("Failed to recover yParity from tx signature");
|
|
1358
598
|
}
|
|
1359
|
-
async function sendRevokeTx(userAddress,
|
|
599
|
+
async function sendRevokeTx(userAddress, chainKey, chainId, assertOrigin) {
|
|
600
|
+
assertOrigin?.();
|
|
1360
601
|
const api = getTalkenApiClient();
|
|
1361
602
|
if (!api)
|
|
1362
603
|
throw new Error("TalkenApiClient not initialized");
|
|
604
|
+
const revision = api.getSessionRevision();
|
|
605
|
+
const assertCurrent = () => {
|
|
606
|
+
assertOrigin?.();
|
|
607
|
+
if (getTalkenApiClient() !== api || api.getSessionRevision() !== revision || !ownsTalkenApiStorage(api))
|
|
608
|
+
throw new Error("AUTH_SESSION_CHANGED");
|
|
609
|
+
if (api.isAccessKeyMode() && api.getAuthenticatedWalletSession()?.wallets.evm !== userAddress.toLowerCase())
|
|
610
|
+
throw new Error("AUTH_SESSION_CHANGED");
|
|
611
|
+
};
|
|
612
|
+
assertCurrent();
|
|
1363
613
|
const credentialManager = getCredentialManager();
|
|
1364
614
|
const pinHash = credentialManager.getPinHash() || "";
|
|
1365
|
-
const email = credentialManager.getEmail() ?? void 0;
|
|
615
|
+
const email = api.isAccessKeyMode() ? api.getAuthenticatedWalletSession()?.user.email ?? void 0 : credentialManager.getEmail() ?? void 0;
|
|
1366
616
|
const network = getNetworkName(chainId);
|
|
1367
617
|
const nonceResult = await api.evm.getNonce(network, userAddress);
|
|
618
|
+
assertCurrent();
|
|
1368
619
|
const nonceRaw = nonceResult?.data?.result ?? nonceResult?.nonce ?? nonceResult?.result ?? nonceResult;
|
|
1369
620
|
const currentNonce = Number(nonceRaw);
|
|
1370
621
|
if (!Number.isFinite(currentNonce)) {
|
|
@@ -1381,6 +632,7 @@ async function sendRevokeTx(userAddress, _chainKey, chainId) {
|
|
|
1381
632
|
pin: pinHash,
|
|
1382
633
|
...email && { email }
|
|
1383
634
|
});
|
|
635
|
+
assertCurrent();
|
|
1384
636
|
const auth = authResult?.authorization ?? authResult;
|
|
1385
637
|
if (!auth?.r || !auth?.s) {
|
|
1386
638
|
throw new Error("signAuthorization returned empty r/s for revoke");
|
|
@@ -1393,6 +645,7 @@ async function sendRevokeTx(userAddress, _chainKey, chainId) {
|
|
|
1393
645
|
let maxPriorityFeePerGas = DEFAULT_MAX_PRIORITY_FEE;
|
|
1394
646
|
try {
|
|
1395
647
|
const suggested = await api.evm.getGasSuggested(network);
|
|
648
|
+
assertCurrent();
|
|
1396
649
|
if (suggested?.high) {
|
|
1397
650
|
maxPriorityFeePerGas = BigInt(
|
|
1398
651
|
Math.round(Number(suggested.high.suggestedMaxPriorityFeePerGas) * 1e9)
|
|
@@ -1402,6 +655,7 @@ async function sendRevokeTx(userAddress, _chainKey, chainId) {
|
|
|
1402
655
|
);
|
|
1403
656
|
}
|
|
1404
657
|
} catch {
|
|
658
|
+
assertCurrent();
|
|
1405
659
|
}
|
|
1406
660
|
const authEntry = [
|
|
1407
661
|
rlpUint(chainId),
|
|
@@ -1435,6 +689,7 @@ async function sendRevokeTx(userAddress, _chainKey, chainId) {
|
|
|
1435
689
|
...network && { network },
|
|
1436
690
|
...email && { email }
|
|
1437
691
|
});
|
|
692
|
+
assertCurrent();
|
|
1438
693
|
const signStr = signResult?.signstr ?? signResult?.signature ?? "";
|
|
1439
694
|
if (!signStr)
|
|
1440
695
|
throw new Error("signHash returned empty signature");
|
|
@@ -1462,43 +717,145 @@ async function sendRevokeTx(userAddress, _chainKey, chainId) {
|
|
|
1462
717
|
txSRaw,
|
|
1463
718
|
userAddress
|
|
1464
719
|
);
|
|
720
|
+
assertCurrent();
|
|
1465
721
|
const signedFields = [...unsignedFields, txYParity ? "0x01" : "0x", txR, txS];
|
|
1466
722
|
const signedTx = `0x04${toRlp(signedFields).slice(2)}`;
|
|
1467
|
-
const
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
network,
|
|
1472
|
-
signedSerializeTx: signedTx,
|
|
1473
|
-
waitForConfirmation: true
|
|
1474
|
-
}
|
|
723
|
+
const { txHash } = await api.post(
|
|
724
|
+
TALKEN_API_ENDPOINTS.EXECUTE_BROADCAST,
|
|
725
|
+
toBroadcastBody(chainKey, signedTx),
|
|
726
|
+
{ timeout: SEND_REQUEST_TIMEOUT }
|
|
1475
727
|
);
|
|
1476
|
-
|
|
1477
|
-
console.log(`[RevokeDelegation] Revoke tx
|
|
728
|
+
assertCurrent();
|
|
729
|
+
console.log(`[RevokeDelegation] Revoke tx broadcast: ${txHash}`);
|
|
1478
730
|
return { txHash };
|
|
1479
731
|
}
|
|
732
|
+
function unsupportedRevoke(message) {
|
|
733
|
+
return new TalkenApiError("EXTERNAL_REVOKE_UNSUPPORTED", message, 400);
|
|
734
|
+
}
|
|
735
|
+
function unsupportedAuthorization(error) {
|
|
736
|
+
let current = error;
|
|
737
|
+
for (let depth = 0; current && typeof current === "object" && depth < 5; depth++) {
|
|
738
|
+
const value = current;
|
|
739
|
+
if (value.name === "AccountTypeNotSupportedError" || value.name === "MethodNotSupportedRpcError" || value.name === "MethodNotFoundRpcError" || value.code === -32601 || value.code === 4200)
|
|
740
|
+
return true;
|
|
741
|
+
current = value.cause;
|
|
742
|
+
}
|
|
743
|
+
return false;
|
|
744
|
+
}
|
|
745
|
+
function normalizeRevokeRejection(error) {
|
|
746
|
+
const topCode = error?.code;
|
|
747
|
+
if (topCode === 4001 || topCode === "AUTH_SESSION_CHANGED" || topCode === "AUTH_SESSION_UNBOUND")
|
|
748
|
+
return error;
|
|
749
|
+
let current = error;
|
|
750
|
+
let rejected = false;
|
|
751
|
+
for (let depth = 0; current && typeof current === "object" && depth < 5; depth++) {
|
|
752
|
+
const value = current;
|
|
753
|
+
if (value.possibleTxHash || value.txHash || value.transactionHash || value.details?.broadcast === true || value.details?.broadcast === "unknown")
|
|
754
|
+
return error;
|
|
755
|
+
if (value.code === 4001)
|
|
756
|
+
rejected = true;
|
|
757
|
+
current = value.cause;
|
|
758
|
+
}
|
|
759
|
+
return rejected ? Object.assign(new Error("User rejected the external revoke request."), {
|
|
760
|
+
code: 4001,
|
|
761
|
+
cause: error
|
|
762
|
+
}) : error;
|
|
763
|
+
}
|
|
1480
764
|
async function sendRevokeViaWalletClient(walletClient, chainId, userAddress) {
|
|
1481
|
-
if (!
|
|
765
|
+
if (!walletClient || typeof walletClient.assertSessionCurrent !== "function")
|
|
766
|
+
throw unsupportedRevoke(
|
|
767
|
+
"External revoke requires an originating account and network guard."
|
|
768
|
+
);
|
|
769
|
+
const assertCurrent = () => walletClient.assertSessionCurrent();
|
|
770
|
+
assertCurrent();
|
|
771
|
+
if (typeof walletClient.getTransactionCount !== "function" || typeof walletClient.signAuthorization !== "function" || typeof walletClient.sendTransaction !== "function" || walletClient.waitForTransactionReceipt !== void 0 && typeof walletClient.waitForTransactionReceipt !== "function")
|
|
772
|
+
throw unsupportedRevoke(
|
|
773
|
+
"External revoke requires pending nonce, authorization signing and transaction capabilities."
|
|
774
|
+
);
|
|
775
|
+
if (!isAddress(userAddress))
|
|
1482
776
|
throw new Error(`Invalid address for revoke: ${userAddress}`);
|
|
777
|
+
if (!Number.isSafeInteger(chainId) || chainId <= 0)
|
|
778
|
+
throw unsupportedRevoke(
|
|
779
|
+
"External revoke requires an explicit valid chain."
|
|
780
|
+
);
|
|
781
|
+
const guarded = async (operation) => {
|
|
782
|
+
assertCurrent();
|
|
783
|
+
try {
|
|
784
|
+
const result = await operation();
|
|
785
|
+
assertCurrent();
|
|
786
|
+
return result;
|
|
787
|
+
} catch (error) {
|
|
788
|
+
assertCurrent();
|
|
789
|
+
throw error;
|
|
790
|
+
}
|
|
791
|
+
};
|
|
792
|
+
const nonce = await guarded(
|
|
793
|
+
() => walletClient.getTransactionCount({
|
|
794
|
+
address: userAddress,
|
|
795
|
+
blockTag: "pending"
|
|
796
|
+
})
|
|
797
|
+
);
|
|
798
|
+
if (!Number.isSafeInteger(nonce) || nonce < 0 || nonce >= Number.MAX_SAFE_INTEGER)
|
|
799
|
+
throw unsupportedRevoke(
|
|
800
|
+
"External revoke could not prepare a safe pending nonce."
|
|
801
|
+
);
|
|
802
|
+
let raw;
|
|
803
|
+
try {
|
|
804
|
+
raw = await guarded(
|
|
805
|
+
() => walletClient.signAuthorization({
|
|
806
|
+
contractAddress: ZERO_ADDRESS2,
|
|
807
|
+
chainId,
|
|
808
|
+
nonce: nonce + 1,
|
|
809
|
+
executor: "self"
|
|
810
|
+
})
|
|
811
|
+
);
|
|
812
|
+
} catch (error) {
|
|
813
|
+
const refusal = normalizeRevokeRejection(error);
|
|
814
|
+
if (refusal !== error)
|
|
815
|
+
throw refusal;
|
|
816
|
+
if (["AUTH_SESSION_CHANGED", "AUTH_SESSION_UNBOUND", 4001].includes(
|
|
817
|
+
error?.code ?? ""
|
|
818
|
+
))
|
|
819
|
+
throw error;
|
|
820
|
+
if (unsupportedAuthorization(error))
|
|
821
|
+
throw unsupportedRevoke(
|
|
822
|
+
"This wallet cannot sign an EIP-7702 revoke authorization."
|
|
823
|
+
);
|
|
824
|
+
throw error;
|
|
825
|
+
}
|
|
826
|
+
const signed = raw;
|
|
827
|
+
const parity = signed?.yParity ?? (signed?.v === BigInt(0) || signed?.v === 0 || signed?.v === BigInt(27) || signed?.v === 27 ? 0 : signed?.v === BigInt(1) || signed?.v === 1 || signed?.v === BigInt(28) || signed?.v === 28 ? 1 : signed?.v);
|
|
828
|
+
if (!signed || signed.address !== ZERO_ADDRESS2 || signed.chainId !== chainId || signed.nonce !== nonce + 1 || typeof signed.r !== "string" || !/^0x[0-9a-fA-F]{1,64}$/.test(signed.r) || typeof signed.s !== "string" || !/^0x[0-9a-fA-F]{1,64}$/.test(signed.s) || parity !== 0 && parity !== 1)
|
|
829
|
+
throw unsupportedRevoke(
|
|
830
|
+
"The wallet returned an invalid EIP-7702 revoke authorization."
|
|
831
|
+
);
|
|
832
|
+
const authorization = {
|
|
833
|
+
address: ZERO_ADDRESS2,
|
|
834
|
+
chainId,
|
|
835
|
+
nonce: nonce + 1,
|
|
836
|
+
r: signed.r,
|
|
837
|
+
s: signed.s,
|
|
838
|
+
yParity: parity
|
|
839
|
+
};
|
|
840
|
+
let txHash;
|
|
841
|
+
try {
|
|
842
|
+
txHash = await guarded(
|
|
843
|
+
() => walletClient.sendTransaction({
|
|
844
|
+
authorizationList: [authorization],
|
|
845
|
+
nonce,
|
|
846
|
+
to: userAddress,
|
|
847
|
+
value: BigInt(0)
|
|
848
|
+
})
|
|
849
|
+
);
|
|
850
|
+
} catch (error) {
|
|
851
|
+
throw normalizeRevokeRejection(error);
|
|
1483
852
|
}
|
|
1484
|
-
const txHash = await walletClient.sendTransaction({
|
|
1485
|
-
authorizationList: [
|
|
1486
|
-
{ contractAddress: ZERO_ADDRESS2, chainId }
|
|
1487
|
-
],
|
|
1488
|
-
to: userAddress,
|
|
1489
|
-
value: BigInt(0)
|
|
1490
|
-
});
|
|
1491
|
-
console.log(`[RevokeDelegation] External wallet revoke tx sent: ${txHash}`);
|
|
1492
853
|
if (walletClient.waitForTransactionReceipt) {
|
|
1493
|
-
const receipt = await
|
|
1494
|
-
hash: txHash
|
|
1495
|
-
});
|
|
1496
|
-
if (receipt.status === "reverted") {
|
|
1497
|
-
throw new Error(`Revoke transaction reverted: ${txHash}`);
|
|
1498
|
-
}
|
|
1499
|
-
console.log(
|
|
1500
|
-
`[RevokeDelegation] External wallet revoke tx confirmed: ${txHash}`
|
|
854
|
+
const receipt = await guarded(
|
|
855
|
+
() => walletClient.waitForTransactionReceipt({ hash: txHash })
|
|
1501
856
|
);
|
|
857
|
+
if (receipt.status === "reverted")
|
|
858
|
+
throw new Error(`Revoke transaction reverted: ${txHash}`);
|
|
1502
859
|
}
|
|
1503
860
|
return { txHash };
|
|
1504
861
|
}
|
|
@@ -1512,38 +869,56 @@ var _locks = /* @__PURE__ */ new Map();
|
|
|
1512
869
|
function lockKey(chainKey, address) {
|
|
1513
870
|
return `${chainKey}:${address.toLowerCase()}`;
|
|
1514
871
|
}
|
|
1515
|
-
async function checkDelegation(chainKey, address) {
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
const response = await api.get(
|
|
1522
|
-
`${TALKEN_API_ENDPOINTS.WALLET_CODE}/${encodeURIComponent(chainKey)}/${encodeURIComponent(address)}`
|
|
872
|
+
async function checkDelegation(chainKey, address, delegationClient, assertCurrent) {
|
|
873
|
+
if (!delegationClient || typeof delegationClient.readCode !== "function")
|
|
874
|
+
throw new TalkenApiError(
|
|
875
|
+
"DELEGATION_CONTEXT_REQUIRED",
|
|
876
|
+
"An originating wallet delegation client is required.",
|
|
877
|
+
401
|
|
1523
878
|
);
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
879
|
+
assertCurrent?.();
|
|
880
|
+
let rawCode;
|
|
881
|
+
try {
|
|
882
|
+
rawCode = await delegationClient.readCode(chainKey, address);
|
|
883
|
+
} catch (error) {
|
|
884
|
+
assertCurrent?.();
|
|
885
|
+
throw error;
|
|
886
|
+
}
|
|
887
|
+
assertCurrent?.();
|
|
888
|
+
const code = String(rawCode).toLowerCase();
|
|
889
|
+
const hasDelegation = code.startsWith(EIP7702_CODE_PREFIX) && code.length >= EIP7702_CODE_PREFIX.length + 40;
|
|
890
|
+
return {
|
|
891
|
+
hasDelegation,
|
|
892
|
+
code,
|
|
893
|
+
delegateAddress: hasDelegation ? `0x${code.slice(EIP7702_CODE_PREFIX.length, EIP7702_CODE_PREFIX.length + 40)}` : ""
|
|
894
|
+
};
|
|
1534
895
|
}
|
|
1535
896
|
async function ensureDelegationCleared(chainKey, chainId, address, options) {
|
|
897
|
+
const delegationClient = options?.delegationClient;
|
|
898
|
+
if (!delegationClient)
|
|
899
|
+
throw new TalkenApiError(
|
|
900
|
+
"DELEGATION_CONTEXT_REQUIRED",
|
|
901
|
+
"An originating wallet delegation client is required.",
|
|
902
|
+
401
|
|
903
|
+
);
|
|
904
|
+
const assertCurrent = () => options?.assertSessionCurrent?.();
|
|
905
|
+
const readDelegation = () => checkDelegation(chainKey, address, delegationClient, assertCurrent);
|
|
906
|
+
assertCurrent();
|
|
1536
907
|
const key = lockKey(chainKey, address);
|
|
1537
908
|
const existing = _locks.get(key);
|
|
1538
909
|
if (existing) {
|
|
1539
910
|
try {
|
|
1540
911
|
await existing;
|
|
912
|
+
assertCurrent();
|
|
1541
913
|
return;
|
|
1542
914
|
} catch {
|
|
915
|
+
assertCurrent();
|
|
1543
916
|
}
|
|
1544
917
|
}
|
|
1545
918
|
const check = async () => {
|
|
1546
|
-
|
|
919
|
+
assertCurrent();
|
|
920
|
+
const initial = await readDelegation();
|
|
921
|
+
assertCurrent();
|
|
1547
922
|
if (!initial.hasDelegation)
|
|
1548
923
|
return;
|
|
1549
924
|
logger.warn(
|
|
@@ -1554,9 +929,21 @@ async function ensureDelegationCleared(chainKey, chainId, address, options) {
|
|
|
1554
929
|
options.walletClient,
|
|
1555
930
|
chainId,
|
|
1556
931
|
address
|
|
1557
|
-
) : await
|
|
932
|
+
) : delegationClient.revoke ? await delegationClient.revoke(chainKey, chainId, address) : (() => {
|
|
933
|
+
throw new TalkenApiError(
|
|
934
|
+
"EXTERNAL_REVOKE_UNSUPPORTED",
|
|
935
|
+
"This wallet has no delegation revoke capability.",
|
|
936
|
+
400
|
|
937
|
+
);
|
|
938
|
+
})();
|
|
939
|
+
assertCurrent();
|
|
1558
940
|
logger.info(`Revoke tx sent: ${txHash}. Polling for clearance...`);
|
|
1559
941
|
} catch (revokeErr) {
|
|
942
|
+
assertCurrent();
|
|
943
|
+
if (["AUTH_SESSION_CHANGED", "EXTERNAL_REVOKE_UNSUPPORTED"].includes(
|
|
944
|
+
revokeErr?.code ?? ""
|
|
945
|
+
))
|
|
946
|
+
throw revokeErr;
|
|
1560
947
|
if (revokeErr && typeof revokeErr === "object" && "code" in revokeErr && revokeErr.code === 4001) {
|
|
1561
948
|
throw revokeErr;
|
|
1562
949
|
}
|
|
@@ -1565,13 +952,16 @@ async function ensureDelegationCleared(chainKey, chainId, address, options) {
|
|
|
1565
952
|
const deadline = Date.now() + POLL_TIMEOUT_MS;
|
|
1566
953
|
while (Date.now() < deadline) {
|
|
1567
954
|
await new Promise((r) => setTimeout(r, POLL_INTERVAL_MS));
|
|
1568
|
-
|
|
955
|
+
assertCurrent();
|
|
956
|
+
const current = await readDelegation();
|
|
957
|
+
assertCurrent();
|
|
1569
958
|
if (!current.hasDelegation) {
|
|
1570
959
|
logger.info("Delegation cleared");
|
|
1571
960
|
return;
|
|
1572
961
|
}
|
|
1573
962
|
}
|
|
1574
963
|
const message = "Previous transaction delegation is still active. Please wait a moment and try again.";
|
|
964
|
+
assertCurrent();
|
|
1575
965
|
if (options?.onDelegationError) {
|
|
1576
966
|
options.onDelegationError({
|
|
1577
967
|
chainId,
|
|
@@ -1583,7 +973,8 @@ async function ensureDelegationCleared(chainKey, chainId, address, options) {
|
|
|
1583
973
|
throw new Error(message);
|
|
1584
974
|
};
|
|
1585
975
|
const promise = check().finally(() => {
|
|
1586
|
-
_locks.
|
|
976
|
+
if (_locks.get(key) === promise)
|
|
977
|
+
_locks.delete(key);
|
|
1587
978
|
});
|
|
1588
979
|
_locks.set(key, promise);
|
|
1589
980
|
return promise;
|
|
@@ -1604,7 +995,14 @@ var Eip7702Service = class {
|
|
|
1604
995
|
*/
|
|
1605
996
|
async preflight(chainKey, chainId, address, options) {
|
|
1606
997
|
try {
|
|
1607
|
-
await ensureDelegationCleared(chainKey, chainId, address,
|
|
998
|
+
await ensureDelegationCleared(chainKey, chainId, address, {
|
|
999
|
+
...options,
|
|
1000
|
+
delegationClient: options?.delegationClient ?? this.signer.getDelegationClient?.(),
|
|
1001
|
+
assertSessionCurrent: () => {
|
|
1002
|
+
this.signer.assertSessionCurrent?.();
|
|
1003
|
+
options?.assertSessionCurrent?.();
|
|
1004
|
+
}
|
|
1005
|
+
});
|
|
1608
1006
|
} catch (error) {
|
|
1609
1007
|
console.warn(
|
|
1610
1008
|
"[Eip7702Service] Pre-flight delegation check failed:",
|
|
@@ -1855,6 +1253,7 @@ var RelayPhase2Error = class extends Error {
|
|
|
1855
1253
|
};
|
|
1856
1254
|
var GaslessTransferService = class {
|
|
1857
1255
|
constructor(deps) {
|
|
1256
|
+
this.assertSessionCurrent = () => this.signer.assertSessionCurrent?.();
|
|
1858
1257
|
this.relayerApi = deps.relayerApi ?? new RelayerApi();
|
|
1859
1258
|
this.signer = deps.signer;
|
|
1860
1259
|
this.walletClient = deps.walletClient;
|
|
@@ -1865,14 +1264,20 @@ var GaslessTransferService = class {
|
|
|
1865
1264
|
});
|
|
1866
1265
|
}
|
|
1867
1266
|
async execute(params, gaslessConfig) {
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1267
|
+
this.assertSessionCurrent();
|
|
1268
|
+
try {
|
|
1269
|
+
switch (params.gaslessMode) {
|
|
1270
|
+
case "generic":
|
|
1271
|
+
return await this.executeGenericRelay(params);
|
|
1272
|
+
case "eip7702-fee":
|
|
1273
|
+
case "eip7702-points":
|
|
1274
|
+
return await this.executeEip7702Relay(params, gaslessConfig);
|
|
1275
|
+
default:
|
|
1276
|
+
throw new Error(`Unknown gasless mode: ${params.gaslessMode}`);
|
|
1277
|
+
}
|
|
1278
|
+
} catch (error) {
|
|
1279
|
+
this.assertSessionCurrent();
|
|
1280
|
+
throw error;
|
|
1876
1281
|
}
|
|
1877
1282
|
}
|
|
1878
1283
|
/**
|
|
@@ -1889,14 +1294,24 @@ var GaslessTransferService = class {
|
|
|
1889
1294
|
params.chainKey,
|
|
1890
1295
|
params.chainId,
|
|
1891
1296
|
params.fromAddress,
|
|
1892
|
-
{
|
|
1297
|
+
{
|
|
1298
|
+
walletClient: this.walletClient,
|
|
1299
|
+
assertSessionCurrent: this.assertSessionCurrent,
|
|
1300
|
+
delegationClient: this.signer.getDelegationClient?.()
|
|
1301
|
+
}
|
|
1893
1302
|
);
|
|
1894
1303
|
} catch (err) {
|
|
1304
|
+
this.assertSessionCurrent();
|
|
1305
|
+
if (["AUTH_SESSION_CHANGED", "EXTERNAL_REVOKE_UNSUPPORTED", 4001].includes(
|
|
1306
|
+
err?.code ?? ""
|
|
1307
|
+
))
|
|
1308
|
+
throw err;
|
|
1895
1309
|
console.warn(
|
|
1896
1310
|
"[GaslessTransferService] Preflight check failed (non-blocking):",
|
|
1897
1311
|
err
|
|
1898
1312
|
);
|
|
1899
1313
|
}
|
|
1314
|
+
this.assertSessionCurrent();
|
|
1900
1315
|
const deadline = Math.floor(Date.now() / 1e3) + 20 * 60;
|
|
1901
1316
|
const feeMaxAmount = (BigInt(params.feeAmountRaw) * BigInt(3) / BigInt(2)).toString();
|
|
1902
1317
|
const baseRequest = {
|
|
@@ -1918,12 +1333,14 @@ var GaslessTransferService = class {
|
|
|
1918
1333
|
auth: { method: "auto" }
|
|
1919
1334
|
};
|
|
1920
1335
|
const phase1 = await this.relayerApi.execute(baseRequest);
|
|
1336
|
+
this.assertSessionCurrent();
|
|
1921
1337
|
if (phase1.phase !== "sign") {
|
|
1922
1338
|
return this.extractResult(phase1, params);
|
|
1923
1339
|
}
|
|
1924
1340
|
const signatures = await this.permitService.signAll(
|
|
1925
1341
|
phase1.signatureRequests
|
|
1926
1342
|
);
|
|
1343
|
+
this.assertSessionCurrent();
|
|
1927
1344
|
let phase2;
|
|
1928
1345
|
try {
|
|
1929
1346
|
phase2 = await this.relayerApi.execute({
|
|
@@ -1932,8 +1349,12 @@ var GaslessTransferService = class {
|
|
|
1932
1349
|
signatures
|
|
1933
1350
|
});
|
|
1934
1351
|
} catch (err) {
|
|
1352
|
+
this.assertSessionCurrent();
|
|
1353
|
+
if (err?.code === "AUTH_SESSION_CHANGED")
|
|
1354
|
+
throw err;
|
|
1935
1355
|
throw new RelayPhase2Error(phase1.requestId, err);
|
|
1936
1356
|
}
|
|
1357
|
+
this.assertSessionCurrent();
|
|
1937
1358
|
return this.extractResult(phase2, params);
|
|
1938
1359
|
}
|
|
1939
1360
|
/**
|
|
@@ -1953,19 +1374,24 @@ var GaslessTransferService = class {
|
|
|
1953
1374
|
params.fromAddress,
|
|
1954
1375
|
{
|
|
1955
1376
|
walletClient: this.walletClient,
|
|
1956
|
-
onDelegationError: gaslessConfig.onDelegationError
|
|
1377
|
+
onDelegationError: gaslessConfig.onDelegationError,
|
|
1378
|
+
assertSessionCurrent: this.assertSessionCurrent,
|
|
1379
|
+
delegationClient: this.signer.getDelegationClient?.()
|
|
1957
1380
|
}
|
|
1958
1381
|
);
|
|
1382
|
+
this.assertSessionCurrent();
|
|
1959
1383
|
try {
|
|
1960
1384
|
const { delegateAuth } = await this.eip7702Service.signDelegate(
|
|
1961
1385
|
params.chainKey,
|
|
1962
1386
|
params.chainId,
|
|
1963
1387
|
params.fromAddress
|
|
1964
1388
|
);
|
|
1389
|
+
this.assertSessionCurrent();
|
|
1965
1390
|
const { relayerAddress, executionNonce } = await this.eip7702Service.getRelayerInfo(
|
|
1966
1391
|
params.chainKey,
|
|
1967
1392
|
params.fromAddress
|
|
1968
1393
|
);
|
|
1394
|
+
this.assertSessionCurrent();
|
|
1969
1395
|
const deadline = Math.floor(Date.now() / 1e3) + 20 * 60;
|
|
1970
1396
|
const isPointsMode = params.gaslessMode === "eip7702-points";
|
|
1971
1397
|
const transferCalldata = this.encodeErc20Transfer(
|
|
@@ -1992,6 +1418,7 @@ var GaslessTransferService = class {
|
|
|
1992
1418
|
feeAmount: params.feeAmountRaw
|
|
1993
1419
|
});
|
|
1994
1420
|
const executionAuth = await this.eip7702Service.signExecutionTypedData(executionTypedData);
|
|
1421
|
+
this.assertSessionCurrent();
|
|
1995
1422
|
const feeAmount = isPointsMode ? "0" : params.feeAmountRaw;
|
|
1996
1423
|
const feeMaxAmount = isPointsMode ? "0" : (BigInt(params.feeAmountRaw) * BigInt(3) / BigInt(2)).toString();
|
|
1997
1424
|
const result = await this.relayerApi.execute({
|
|
@@ -2017,8 +1444,12 @@ var GaslessTransferService = class {
|
|
|
2017
1444
|
executionAuth
|
|
2018
1445
|
}
|
|
2019
1446
|
});
|
|
1447
|
+
this.assertSessionCurrent();
|
|
2020
1448
|
return this.extractResult(result, params);
|
|
2021
1449
|
} catch (error) {
|
|
1450
|
+
this.assertSessionCurrent();
|
|
1451
|
+
if (error?.code === "AUTH_SESSION_CHANGED")
|
|
1452
|
+
throw error;
|
|
2022
1453
|
try {
|
|
2023
1454
|
await ensureDelegationCleared(
|
|
2024
1455
|
params.chainKey,
|
|
@@ -2026,10 +1457,15 @@ var GaslessTransferService = class {
|
|
|
2026
1457
|
params.fromAddress,
|
|
2027
1458
|
{
|
|
2028
1459
|
walletClient: this.walletClient,
|
|
2029
|
-
onDelegationError: gaslessConfig.onDelegationError
|
|
1460
|
+
onDelegationError: gaslessConfig.onDelegationError,
|
|
1461
|
+
assertSessionCurrent: this.assertSessionCurrent,
|
|
1462
|
+
delegationClient: this.signer.getDelegationClient?.()
|
|
2030
1463
|
}
|
|
2031
1464
|
);
|
|
2032
1465
|
} catch (cleanupError) {
|
|
1466
|
+
this.assertSessionCurrent();
|
|
1467
|
+
if (cleanupError?.code === "AUTH_SESSION_CHANGED")
|
|
1468
|
+
throw cleanupError;
|
|
2033
1469
|
console.error(
|
|
2034
1470
|
"[GaslessTransferService] Post-failure delegation cleanup failed:",
|
|
2035
1471
|
cleanupError
|
|
@@ -2082,10 +1518,33 @@ function sleep(ms) {
|
|
|
2082
1518
|
}
|
|
2083
1519
|
var AbcWaasSigner = class {
|
|
2084
1520
|
constructor(params) {
|
|
1521
|
+
this.api = getTalkenApiClient();
|
|
1522
|
+
this.revision = this.api?.getSessionRevision();
|
|
2085
1523
|
this.pinHash = params.pinHash;
|
|
2086
1524
|
this.network = params.network;
|
|
2087
1525
|
this.email = params.email;
|
|
2088
1526
|
}
|
|
1527
|
+
getDelegationClient() {
|
|
1528
|
+
return {
|
|
1529
|
+
readCode: async (chainKey, address) => {
|
|
1530
|
+
const api = this.getApiOrThrow();
|
|
1531
|
+
const result = await api.get(
|
|
1532
|
+
`/wallet/code/${encodeURIComponent(chainKey)}/${encodeURIComponent(address)}`
|
|
1533
|
+
);
|
|
1534
|
+
this.getApiOrThrow();
|
|
1535
|
+
return result.code ?? "0x";
|
|
1536
|
+
},
|
|
1537
|
+
revoke: (chainKey, chainId, address) => sendRevokeTx(
|
|
1538
|
+
address,
|
|
1539
|
+
chainKey,
|
|
1540
|
+
chainId,
|
|
1541
|
+
() => this.assertSessionCurrent()
|
|
1542
|
+
)
|
|
1543
|
+
};
|
|
1544
|
+
}
|
|
1545
|
+
assertSessionCurrent() {
|
|
1546
|
+
this.getApiOrThrow();
|
|
1547
|
+
}
|
|
2089
1548
|
supportsAuthorization() {
|
|
2090
1549
|
return true;
|
|
2091
1550
|
}
|
|
@@ -2094,20 +1553,24 @@ var AbcWaasSigner = class {
|
|
|
2094
1553
|
let lastError = null;
|
|
2095
1554
|
for (let attempt = 0; attempt < MAX_SIGN_ATTEMPTS; attempt++) {
|
|
2096
1555
|
try {
|
|
1556
|
+
this.getApiOrThrow();
|
|
2097
1557
|
const result = await api.evm.signTypedData({
|
|
2098
1558
|
network: this.network,
|
|
2099
1559
|
typedData: JSON.stringify(typedData),
|
|
2100
1560
|
...this.pinHash && { pin: this.pinHash },
|
|
2101
1561
|
...this.email && { email: this.email }
|
|
2102
1562
|
});
|
|
1563
|
+
this.getApiOrThrow();
|
|
2103
1564
|
const sig = typeof result === "string" ? result : result?.signature ?? result?.result;
|
|
2104
1565
|
if (sig)
|
|
2105
1566
|
return sig;
|
|
2106
1567
|
throw new Error("signTypedData returned empty signature");
|
|
2107
1568
|
} catch (error) {
|
|
1569
|
+
this.getApiOrThrow();
|
|
2108
1570
|
lastError = error instanceof Error ? error : new Error(String(error));
|
|
2109
1571
|
if (attempt < MAX_SIGN_ATTEMPTS - 1) {
|
|
2110
1572
|
await sleep(RETRY_BASE_MS * 2 ** attempt);
|
|
1573
|
+
this.getApiOrThrow();
|
|
2111
1574
|
}
|
|
2112
1575
|
}
|
|
2113
1576
|
}
|
|
@@ -2118,6 +1581,7 @@ var AbcWaasSigner = class {
|
|
|
2118
1581
|
let lastError = null;
|
|
2119
1582
|
for (let attempt = 0; attempt < MAX_SIGN_ATTEMPTS; attempt++) {
|
|
2120
1583
|
try {
|
|
1584
|
+
this.getApiOrThrow();
|
|
2121
1585
|
const result = await api.evm.signAuthorization({
|
|
2122
1586
|
network: this.network,
|
|
2123
1587
|
authorization: {
|
|
@@ -2128,6 +1592,7 @@ var AbcWaasSigner = class {
|
|
|
2128
1592
|
...this.pinHash && { pin: this.pinHash },
|
|
2129
1593
|
...this.email && { email: this.email }
|
|
2130
1594
|
});
|
|
1595
|
+
this.getApiOrThrow();
|
|
2131
1596
|
const auth = result?.authorization ?? result;
|
|
2132
1597
|
if (!auth?.r || !auth?.s) {
|
|
2133
1598
|
throw new Error("signAuthorization returned empty r/s");
|
|
@@ -2141,9 +1606,11 @@ var AbcWaasSigner = class {
|
|
|
2141
1606
|
s: auth.s
|
|
2142
1607
|
};
|
|
2143
1608
|
} catch (error) {
|
|
1609
|
+
this.getApiOrThrow();
|
|
2144
1610
|
lastError = error instanceof Error ? error : new Error(String(error));
|
|
2145
1611
|
if (attempt < MAX_SIGN_ATTEMPTS - 1) {
|
|
2146
1612
|
await sleep(RETRY_BASE_MS * 2 ** attempt);
|
|
1613
|
+
this.getApiOrThrow();
|
|
2147
1614
|
}
|
|
2148
1615
|
}
|
|
2149
1616
|
}
|
|
@@ -2152,6 +1619,7 @@ var AbcWaasSigner = class {
|
|
|
2152
1619
|
async getNonce(address) {
|
|
2153
1620
|
const api = this.getApiOrThrow();
|
|
2154
1621
|
const nonceResult = await api.evm.getNonce(this.network, address);
|
|
1622
|
+
this.getApiOrThrow();
|
|
2155
1623
|
const raw = nonceResult?.data?.result ?? nonceResult?.nonce ?? nonceResult?.result ?? nonceResult;
|
|
2156
1624
|
const nonce = Number(raw);
|
|
2157
1625
|
if (!Number.isFinite(nonce)) {
|
|
@@ -2163,6 +1631,19 @@ var AbcWaasSigner = class {
|
|
|
2163
1631
|
const api = getTalkenApiClient();
|
|
2164
1632
|
if (!api)
|
|
2165
1633
|
throw new Error("TalkenApiClient not initialized");
|
|
1634
|
+
if (api !== this.api || api.getSessionRevision() !== this.revision || !ownsTalkenApiStorage(api))
|
|
1635
|
+
throw new TalkenApiError(
|
|
1636
|
+
"AUTH_SESSION_CHANGED",
|
|
1637
|
+
"The signer wallet session changed.",
|
|
1638
|
+
401
|
|
1639
|
+
);
|
|
1640
|
+
const session = api.isAccessKeyMode() ? api.getAuthenticatedWalletSession() : null;
|
|
1641
|
+
if (api.isAccessKeyMode() && (!session || this.email && session.user.email !== this.email.trim().toLowerCase()))
|
|
1642
|
+
throw new TalkenApiError(
|
|
1643
|
+
"AUTH_SESSION_CHANGED",
|
|
1644
|
+
"The signer account does not match this login.",
|
|
1645
|
+
401
|
|
1646
|
+
);
|
|
2166
1647
|
return api;
|
|
2167
1648
|
}
|
|
2168
1649
|
};
|
|
@@ -2241,17 +1722,21 @@ var AbcEvmProvider = class extends AbstractChainProvider {
|
|
|
2241
1722
|
this.gaslessFeeService = getSharedGaslessFeeService();
|
|
2242
1723
|
this.gaslessLock = Promise.resolve();
|
|
2243
1724
|
}
|
|
1725
|
+
getWalletOperationNetwork() {
|
|
1726
|
+
return this.chainId;
|
|
1727
|
+
}
|
|
2244
1728
|
getRecoveryEmail() {
|
|
2245
1729
|
const walletEmail = this.wallet?.email?.trim();
|
|
2246
1730
|
if (walletEmail) {
|
|
2247
1731
|
return walletEmail;
|
|
2248
1732
|
}
|
|
2249
|
-
return
|
|
1733
|
+
return this.getSharedCredentials()?.getEmail() || void 0;
|
|
2250
1734
|
}
|
|
2251
1735
|
/**
|
|
2252
1736
|
* Set wallet — EVM override for chainId tracking + chainChanged event
|
|
2253
1737
|
*/
|
|
2254
1738
|
setWallet(wallet) {
|
|
1739
|
+
this.assertWalletSession(wallet);
|
|
2255
1740
|
const previousChainId = this.chainId;
|
|
2256
1741
|
this.chainId = wallet.chainId;
|
|
2257
1742
|
super.setWallet(wallet);
|
|
@@ -2276,7 +1761,7 @@ var AbcEvmProvider = class extends AbstractChainProvider {
|
|
|
2276
1761
|
* a wallet.generate() call (idempotent create/recover) to repopulate.
|
|
2277
1762
|
*/
|
|
2278
1763
|
isSigningCredentialError(error) {
|
|
2279
|
-
return error
|
|
1764
|
+
return isSigningCredentialError(error);
|
|
2280
1765
|
}
|
|
2281
1766
|
/**
|
|
2282
1767
|
* Refresh server-side signing credentials.
|
|
@@ -2285,18 +1770,21 @@ var AbcEvmProvider = class extends AbstractChainProvider {
|
|
|
2285
1770
|
* 1. PIN hash in memory → wallet.generate() to repopulate server cache
|
|
2286
1771
|
* 2. Neither available → throw UNAUTHORIZED
|
|
2287
1772
|
*
|
|
2288
|
-
* Note:
|
|
2289
|
-
*
|
|
2290
|
-
* can use them as fallback without a separate refresh call.
|
|
1773
|
+
* Note: the /sign/* and /execute/* routes do not accept cached `evmCreds`,
|
|
1774
|
+
* so this refresh is the only recovery from a cold server credential cache.
|
|
2291
1775
|
*/
|
|
2292
1776
|
async refreshSigningCredentials() {
|
|
2293
|
-
const credMgr =
|
|
2294
|
-
const pinHash = credMgr
|
|
1777
|
+
const credMgr = this.getSharedCredentials();
|
|
1778
|
+
const pinHash = credMgr?.getPinHash();
|
|
2295
1779
|
const email = this.getRecoveryEmail();
|
|
1780
|
+
const assertOperation = this.captureWalletOperation();
|
|
2296
1781
|
if (pinHash && email) {
|
|
2297
1782
|
const api = this.getTalkenApiClientOrThrow();
|
|
2298
1783
|
logger2.info("Refreshing signing credentials via wallet.generate...");
|
|
2299
|
-
await
|
|
1784
|
+
await this.awaitWalletOperation(
|
|
1785
|
+
assertOperation,
|
|
1786
|
+
async () => api.wallet.generate(pinHash, email)
|
|
1787
|
+
);
|
|
2300
1788
|
logger2.info("Signing credentials refreshed via PIN");
|
|
2301
1789
|
return;
|
|
2302
1790
|
}
|
|
@@ -2313,15 +1801,26 @@ var AbcEvmProvider = class extends AbstractChainProvider {
|
|
|
2313
1801
|
* On first failure, refreshes the server's signing credential cache and retries once.
|
|
2314
1802
|
*/
|
|
2315
1803
|
async withSigningCredentialRetry(operation) {
|
|
1804
|
+
const assertOperation = this.captureWalletOperation();
|
|
2316
1805
|
try {
|
|
2317
|
-
return await
|
|
1806
|
+
return await this.awaitWalletOperation(
|
|
1807
|
+
assertOperation,
|
|
1808
|
+
async () => operation()
|
|
1809
|
+
);
|
|
2318
1810
|
} catch (error) {
|
|
1811
|
+
assertOperation();
|
|
2319
1812
|
if (this.isSigningCredentialError(error)) {
|
|
2320
1813
|
logger2.info(
|
|
2321
1814
|
"Signing credentials missing on server \u2014 attempting refresh and retry"
|
|
2322
1815
|
);
|
|
2323
|
-
await this.
|
|
2324
|
-
|
|
1816
|
+
await this.awaitWalletOperation(
|
|
1817
|
+
assertOperation,
|
|
1818
|
+
async () => this.refreshSigningCredentials()
|
|
1819
|
+
);
|
|
1820
|
+
return await this.awaitWalletOperation(
|
|
1821
|
+
assertOperation,
|
|
1822
|
+
async () => operation()
|
|
1823
|
+
);
|
|
2325
1824
|
}
|
|
2326
1825
|
throw error;
|
|
2327
1826
|
}
|
|
@@ -2347,6 +1846,8 @@ var AbcEvmProvider = class extends AbstractChainProvider {
|
|
|
2347
1846
|
* EIP-1193 request method
|
|
2348
1847
|
*/
|
|
2349
1848
|
async request(args) {
|
|
1849
|
+
if (this.wallet)
|
|
1850
|
+
this.assertWalletSession();
|
|
2350
1851
|
const { method, params } = args;
|
|
2351
1852
|
switch (method) {
|
|
2352
1853
|
case "eth_requestAccounts":
|
|
@@ -2449,7 +1950,11 @@ var AbcEvmProvider = class extends AbstractChainProvider {
|
|
|
2449
1950
|
);
|
|
2450
1951
|
}
|
|
2451
1952
|
resolveEvmSignType(params[0]);
|
|
2452
|
-
const
|
|
1953
|
+
const assertOperation = this.captureWalletOperation();
|
|
1954
|
+
const resolved = await this.awaitWalletOperation(
|
|
1955
|
+
assertOperation,
|
|
1956
|
+
async () => this.callInterceptor("eth_sendTransaction", params)
|
|
1957
|
+
);
|
|
2453
1958
|
const tx = params[0];
|
|
2454
1959
|
logger2.debug("eth_sendTransaction incoming gas params:", {
|
|
2455
1960
|
gas: tx.gas ?? tx.gasLimit,
|
|
@@ -2466,6 +1971,7 @@ var AbcEvmProvider = class extends AbstractChainProvider {
|
|
|
2466
1971
|
const maxFeeWei = parseGwei(resolved.gasFee.maxFeePerGas);
|
|
2467
1972
|
tx.maxFeePerGas = `0x${maxFeeWei.toString(16)}`;
|
|
2468
1973
|
} catch (error) {
|
|
1974
|
+
assertOperation();
|
|
2469
1975
|
logger2.error("Failed to parse maxFeePerGas:", error);
|
|
2470
1976
|
}
|
|
2471
1977
|
}
|
|
@@ -2476,6 +1982,7 @@ var AbcEvmProvider = class extends AbstractChainProvider {
|
|
|
2476
1982
|
);
|
|
2477
1983
|
tx.maxPriorityFeePerGas = `0x${priorityFeeWei.toString(16)}`;
|
|
2478
1984
|
} catch (error) {
|
|
1985
|
+
assertOperation();
|
|
2479
1986
|
logger2.error("Failed to parse maxPriorityFeePerGas:", error);
|
|
2480
1987
|
}
|
|
2481
1988
|
}
|
|
@@ -2496,7 +2003,7 @@ var AbcEvmProvider = class extends AbstractChainProvider {
|
|
|
2496
2003
|
);
|
|
2497
2004
|
}
|
|
2498
2005
|
const api = this.getTalkenApiClientOrThrow();
|
|
2499
|
-
const pinHash = api.isAccessKeyMode() ? void 0 :
|
|
2006
|
+
const pinHash = api.isAccessKeyMode() ? void 0 : this.getSharedCredentials()?.getPinHash() || void 0;
|
|
2500
2007
|
if (!pinHash && !api.isAccessKeyMode()) {
|
|
2501
2008
|
throw new ProviderRpcError(
|
|
2502
2009
|
ProviderErrorCode.INTERNAL_ERROR,
|
|
@@ -2512,22 +2019,27 @@ var AbcEvmProvider = class extends AbstractChainProvider {
|
|
|
2512
2019
|
if (shouldTryGasless) {
|
|
2513
2020
|
const effectiveConfig = gaslessConfig ?? { enabled: true };
|
|
2514
2021
|
const attempt = this.gaslessLock.catch(() => {
|
|
2515
|
-
}).then(
|
|
2516
|
-
()
|
|
2022
|
+
}).then(() => {
|
|
2023
|
+
assertOperation();
|
|
2024
|
+
return this.tryGaslessTransfer(
|
|
2517
2025
|
tx,
|
|
2518
2026
|
chainKey,
|
|
2519
2027
|
pinHash,
|
|
2520
2028
|
email,
|
|
2521
2029
|
effectiveConfig,
|
|
2522
2030
|
preEstimatedFee
|
|
2523
|
-
)
|
|
2524
|
-
);
|
|
2031
|
+
);
|
|
2032
|
+
});
|
|
2525
2033
|
this.gaslessLock = attempt;
|
|
2526
2034
|
try {
|
|
2527
|
-
const gaslessResult = await
|
|
2035
|
+
const gaslessResult = await this.awaitWalletOperation(
|
|
2036
|
+
assertOperation,
|
|
2037
|
+
async () => attempt
|
|
2038
|
+
);
|
|
2528
2039
|
if (gaslessResult)
|
|
2529
2040
|
return gaslessResult;
|
|
2530
2041
|
} catch (gaslessError) {
|
|
2042
|
+
assertOperation();
|
|
2531
2043
|
const failedTxHash = gaslessError?.txHash || "";
|
|
2532
2044
|
this.updateTxResult({
|
|
2533
2045
|
txHash: failedTxHash,
|
|
@@ -2549,8 +2061,9 @@ var AbcEvmProvider = class extends AbstractChainProvider {
|
|
|
2549
2061
|
const amountWei = BigInt(hexValue).toString();
|
|
2550
2062
|
try {
|
|
2551
2063
|
const gasLimit = tx.gas || tx.gasLimit;
|
|
2552
|
-
const result = await this.
|
|
2553
|
-
|
|
2064
|
+
const result = await this.awaitWalletOperation(
|
|
2065
|
+
assertOperation,
|
|
2066
|
+
async () => api.evm.sendTransaction({
|
|
2554
2067
|
chainKey,
|
|
2555
2068
|
to: tx.to,
|
|
2556
2069
|
amountWei,
|
|
@@ -2575,6 +2088,7 @@ var AbcEvmProvider = class extends AbstractChainProvider {
|
|
|
2575
2088
|
});
|
|
2576
2089
|
return result.txHash;
|
|
2577
2090
|
} catch (error) {
|
|
2091
|
+
assertOperation();
|
|
2578
2092
|
this.failTxResult({
|
|
2579
2093
|
network: chainKey,
|
|
2580
2094
|
chain: "evm",
|
|
@@ -2596,18 +2110,23 @@ var AbcEvmProvider = class extends AbstractChainProvider {
|
|
|
2596
2110
|
if (!detected)
|
|
2597
2111
|
return null;
|
|
2598
2112
|
let feeEstimate = preEstimatedFee ?? null;
|
|
2113
|
+
const assertOperation = this.captureWalletOperation();
|
|
2599
2114
|
if (!feeEstimate) {
|
|
2600
2115
|
try {
|
|
2601
|
-
feeEstimate = await this.
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2116
|
+
feeEstimate = await this.awaitWalletOperation(
|
|
2117
|
+
assertOperation,
|
|
2118
|
+
async () => this.gaslessFeeService.estimateFee({
|
|
2119
|
+
chainKey,
|
|
2120
|
+
chainId: this.chainId,
|
|
2121
|
+
tokenAddress: tx.to,
|
|
2122
|
+
fromAddress: this.wallet.address,
|
|
2123
|
+
toAddress: detected.to,
|
|
2124
|
+
amount: detected.amount,
|
|
2125
|
+
gaslessConfig
|
|
2126
|
+
})
|
|
2127
|
+
);
|
|
2610
2128
|
} catch (err) {
|
|
2129
|
+
assertOperation();
|
|
2611
2130
|
console.warn("[AbcProvider] Gasless fee estimation failed:", err);
|
|
2612
2131
|
return null;
|
|
2613
2132
|
}
|
|
@@ -2623,19 +2142,22 @@ var AbcEvmProvider = class extends AbstractChainProvider {
|
|
|
2623
2142
|
relayerApi: this._sharedRelayerApi,
|
|
2624
2143
|
signer
|
|
2625
2144
|
});
|
|
2626
|
-
const gaslessResult = await
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2145
|
+
const gaslessResult = await this.awaitWalletOperation(
|
|
2146
|
+
assertOperation,
|
|
2147
|
+
async () => transferService.execute(
|
|
2148
|
+
{
|
|
2149
|
+
chainId: this.chainId,
|
|
2150
|
+
chainKey,
|
|
2151
|
+
fromAddress: this.wallet.address,
|
|
2152
|
+
toAddress: detected.to,
|
|
2153
|
+
tokenAddress: tx.to,
|
|
2154
|
+
amount: detected.amount,
|
|
2155
|
+
feeToken: feeEstimate.feeToken,
|
|
2156
|
+
gaslessMode: feeEstimate.gaslessMode,
|
|
2157
|
+
feeAmountRaw: feeEstimate.feeAmountRaw
|
|
2158
|
+
},
|
|
2159
|
+
gaslessConfig
|
|
2160
|
+
)
|
|
2639
2161
|
);
|
|
2640
2162
|
this.updateTxResult({
|
|
2641
2163
|
txHash: gaslessResult.txHash,
|
|
@@ -2671,7 +2193,11 @@ var AbcEvmProvider = class extends AbstractChainProvider {
|
|
|
2671
2193
|
);
|
|
2672
2194
|
}
|
|
2673
2195
|
const signType = resolveEvmSignType(params[0]);
|
|
2674
|
-
const
|
|
2196
|
+
const assertOperation = this.captureWalletOperation();
|
|
2197
|
+
const resolved = await this.awaitWalletOperation(
|
|
2198
|
+
assertOperation,
|
|
2199
|
+
async () => this.callInterceptor("eth_signTransaction", params)
|
|
2200
|
+
);
|
|
2675
2201
|
const tx = params[0];
|
|
2676
2202
|
if (resolved) {
|
|
2677
2203
|
if (resolved.data) {
|
|
@@ -2682,6 +2208,7 @@ var AbcEvmProvider = class extends AbstractChainProvider {
|
|
|
2682
2208
|
const maxFeeWei = parseGwei(resolved.gasFee.maxFeePerGas);
|
|
2683
2209
|
tx.maxFeePerGas = `0x${maxFeeWei.toString(16)}`;
|
|
2684
2210
|
} catch (error) {
|
|
2211
|
+
assertOperation();
|
|
2685
2212
|
logger2.error("Failed to parse maxFeePerGas:", error);
|
|
2686
2213
|
}
|
|
2687
2214
|
}
|
|
@@ -2692,27 +2219,31 @@ var AbcEvmProvider = class extends AbstractChainProvider {
|
|
|
2692
2219
|
);
|
|
2693
2220
|
tx.maxPriorityFeePerGas = `0x${priorityFeeWei.toString(16)}`;
|
|
2694
2221
|
} catch (error) {
|
|
2222
|
+
assertOperation();
|
|
2695
2223
|
logger2.error("Failed to parse maxPriorityFeePerGas:", error);
|
|
2696
2224
|
}
|
|
2697
2225
|
}
|
|
2698
2226
|
}
|
|
2699
2227
|
const api = this.getTalkenApiClientOrThrow();
|
|
2700
|
-
const pinHash =
|
|
2228
|
+
const pinHash = this.getSharedCredentials()?.getPinHash() || void 0;
|
|
2701
2229
|
const email = this.getRecoveryEmail();
|
|
2702
|
-
const result = await this.
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2230
|
+
const result = await this.awaitWalletOperation(
|
|
2231
|
+
assertOperation,
|
|
2232
|
+
async () => this.withSigningCredentialRetry(
|
|
2233
|
+
() => api.evm.signTransaction({
|
|
2234
|
+
network: getNetworkName(this.chainId),
|
|
2235
|
+
to: tx.to,
|
|
2236
|
+
value: tx.value || "0x0",
|
|
2237
|
+
data: tx.data || "0x",
|
|
2238
|
+
gasLimit: tx.gas || tx.gasLimit,
|
|
2239
|
+
maxFeePerGas: tx.maxFeePerGas,
|
|
2240
|
+
maxPriorityFeePerGas: tx.maxPriorityFeePerGas,
|
|
2241
|
+
nonce: tx.nonce ? String(Number.parseInt(tx.nonce, 16)) : void 0,
|
|
2242
|
+
...signType && { type: signType },
|
|
2243
|
+
...pinHash && { pin: pinHash },
|
|
2244
|
+
...email && { email }
|
|
2245
|
+
})
|
|
2246
|
+
)
|
|
2716
2247
|
);
|
|
2717
2248
|
return result.signature;
|
|
2718
2249
|
}
|
|
@@ -2734,7 +2265,11 @@ var AbcEvmProvider = class extends AbstractChainProvider {
|
|
|
2734
2265
|
"Invalid personal_sign params"
|
|
2735
2266
|
);
|
|
2736
2267
|
}
|
|
2737
|
-
|
|
2268
|
+
const assertOperation = this.captureWalletOperation();
|
|
2269
|
+
await this.awaitWalletOperation(
|
|
2270
|
+
assertOperation,
|
|
2271
|
+
async () => this.callInterceptor("personal_sign", params)
|
|
2272
|
+
);
|
|
2738
2273
|
const [message, address] = params;
|
|
2739
2274
|
if (address.toLowerCase() !== this.wallet.address.toLowerCase()) {
|
|
2740
2275
|
logger2.error("Address mismatch");
|
|
@@ -2745,20 +2280,23 @@ var AbcEvmProvider = class extends AbstractChainProvider {
|
|
|
2745
2280
|
}
|
|
2746
2281
|
const api = this.getTalkenApiClientOrThrow();
|
|
2747
2282
|
const network = getNetworkName(this.chainId);
|
|
2748
|
-
const pinHash =
|
|
2283
|
+
const pinHash = this.getSharedCredentials()?.getPinHash() || void 0;
|
|
2749
2284
|
const email = this.getRecoveryEmail();
|
|
2750
2285
|
const rawOpts = Array.isArray(params) && params.length > 2 ? params[2] : null;
|
|
2751
2286
|
const validPrefixes = ["eip191", "native"];
|
|
2752
2287
|
const signaturePrefix = rawOpts != null && typeof rawOpts === "object" && "signaturePrefix" in rawOpts && validPrefixes.includes(rawOpts.signaturePrefix) ? rawOpts.signaturePrefix : void 0;
|
|
2753
|
-
const result = await this.
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2288
|
+
const result = await this.awaitWalletOperation(
|
|
2289
|
+
assertOperation,
|
|
2290
|
+
async () => this.withSigningCredentialRetry(
|
|
2291
|
+
() => api.evm.signPersonal({
|
|
2292
|
+
network,
|
|
2293
|
+
message,
|
|
2294
|
+
address,
|
|
2295
|
+
pin: pinHash,
|
|
2296
|
+
...email && { email },
|
|
2297
|
+
...signaturePrefix && { signaturePrefix }
|
|
2298
|
+
})
|
|
2299
|
+
)
|
|
2762
2300
|
);
|
|
2763
2301
|
return result.signature;
|
|
2764
2302
|
}
|
|
@@ -2791,7 +2329,11 @@ var AbcEvmProvider = class extends AbstractChainProvider {
|
|
|
2791
2329
|
"Invalid signTypedData params"
|
|
2792
2330
|
);
|
|
2793
2331
|
}
|
|
2794
|
-
|
|
2332
|
+
const assertOperation = this.captureWalletOperation();
|
|
2333
|
+
await this.awaitWalletOperation(
|
|
2334
|
+
assertOperation,
|
|
2335
|
+
async () => this.callInterceptor("eth_signTypedData_v4", params)
|
|
2336
|
+
);
|
|
2795
2337
|
const [address, typedData] = params;
|
|
2796
2338
|
if (address.toLowerCase() !== this.wallet.address.toLowerCase()) {
|
|
2797
2339
|
throw new ProviderRpcError(
|
|
@@ -2801,15 +2343,18 @@ var AbcEvmProvider = class extends AbstractChainProvider {
|
|
|
2801
2343
|
}
|
|
2802
2344
|
const api = this.getTalkenApiClientOrThrow();
|
|
2803
2345
|
const network = getNetworkName(this.chainId);
|
|
2804
|
-
const pinHash =
|
|
2346
|
+
const pinHash = this.getSharedCredentials()?.getPinHash() || void 0;
|
|
2805
2347
|
const email = this.getRecoveryEmail();
|
|
2806
|
-
const result = await this.
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2348
|
+
const result = await this.awaitWalletOperation(
|
|
2349
|
+
assertOperation,
|
|
2350
|
+
async () => this.withSigningCredentialRetry(
|
|
2351
|
+
() => api.evm.signTypedData({
|
|
2352
|
+
network,
|
|
2353
|
+
typedData: typeof typedData === "string" ? typedData : JSON.stringify(typedData),
|
|
2354
|
+
pin: pinHash,
|
|
2355
|
+
...email && { email }
|
|
2356
|
+
})
|
|
2357
|
+
)
|
|
2813
2358
|
);
|
|
2814
2359
|
return result.signature;
|
|
2815
2360
|
}
|
|
@@ -2856,25 +2401,32 @@ var AbcEvmProvider = class extends AbstractChainProvider {
|
|
|
2856
2401
|
"Authorization payload is incomplete"
|
|
2857
2402
|
);
|
|
2858
2403
|
}
|
|
2859
|
-
|
|
2404
|
+
const assertOperation = this.captureWalletOperation();
|
|
2405
|
+
await this.awaitWalletOperation(
|
|
2406
|
+
assertOperation,
|
|
2407
|
+
async () => this.callInterceptor("eth_signAuthorization", params)
|
|
2408
|
+
);
|
|
2860
2409
|
const api = this.getTalkenApiClientOrThrow();
|
|
2861
2410
|
const network = getNetworkName(this.chainId);
|
|
2862
|
-
const pinHash =
|
|
2411
|
+
const pinHash = this.getSharedCredentials()?.getPinHash() || void 0;
|
|
2863
2412
|
const email = this.getRecoveryEmail();
|
|
2864
2413
|
const chainIdValue = typeof authorization.chainId === "string" ? Number(BigInt(authorization.chainId)) : Number(authorization.chainId);
|
|
2865
2414
|
const nonceValue = typeof authorization.nonce === "string" ? BigInt(authorization.nonce).toString() : String(authorization.nonce);
|
|
2866
2415
|
const authAddress = authorization.address;
|
|
2867
|
-
const result = await this.
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2416
|
+
const result = await this.awaitWalletOperation(
|
|
2417
|
+
assertOperation,
|
|
2418
|
+
async () => this.withSigningCredentialRetry(
|
|
2419
|
+
() => api.evm.signAuthorization({
|
|
2420
|
+
network,
|
|
2421
|
+
authorization: {
|
|
2422
|
+
chainId: chainIdValue,
|
|
2423
|
+
address: authAddress,
|
|
2424
|
+
nonce: nonceValue
|
|
2425
|
+
},
|
|
2426
|
+
pin: pinHash,
|
|
2427
|
+
...email && { email }
|
|
2428
|
+
})
|
|
2429
|
+
)
|
|
2878
2430
|
);
|
|
2879
2431
|
return result.authorization;
|
|
2880
2432
|
}
|
|
@@ -2894,6 +2446,7 @@ var AbcEvmProvider = class extends AbstractChainProvider {
|
|
|
2894
2446
|
return null;
|
|
2895
2447
|
}
|
|
2896
2448
|
const _previousChainId = this.chainId;
|
|
2449
|
+
this.invalidateWalletOperations();
|
|
2897
2450
|
this.chainId = newChainId;
|
|
2898
2451
|
if (this.wallet) {
|
|
2899
2452
|
this.wallet.chainId = newChainId;
|
|
@@ -2920,11 +2473,12 @@ var AbcEvmProvider = class extends AbstractChainProvider {
|
|
|
2920
2473
|
);
|
|
2921
2474
|
}
|
|
2922
2475
|
const currentChainId = this.chainId;
|
|
2476
|
+
const assertOperation = this.captureWalletOperation();
|
|
2923
2477
|
try {
|
|
2924
2478
|
const api = this.getTalkenApiClientOrThrow();
|
|
2925
|
-
const response = await
|
|
2926
|
-
|
|
2927
|
-
address
|
|
2479
|
+
const response = await this.awaitWalletOperation(
|
|
2480
|
+
assertOperation,
|
|
2481
|
+
async () => api.evm.getNonce(getNetworkName(currentChainId), address)
|
|
2928
2482
|
);
|
|
2929
2483
|
const nonce = response.result !== void 0 ? typeof response.result === "number" ? `0x${response.result.toString(16)}` : response.result : void 0;
|
|
2930
2484
|
if (!nonce) {
|
|
@@ -2932,6 +2486,7 @@ var AbcEvmProvider = class extends AbstractChainProvider {
|
|
|
2932
2486
|
}
|
|
2933
2487
|
return nonce;
|
|
2934
2488
|
} catch (error) {
|
|
2489
|
+
assertOperation();
|
|
2935
2490
|
logger2.error("Failed to get transaction count from ABC WaaS:", error);
|
|
2936
2491
|
throw new ProviderRpcError(
|
|
2937
2492
|
ProviderErrorCode.INTERNAL_ERROR,
|
|
@@ -2957,19 +2512,24 @@ var AbcEvmProvider = class extends AbstractChainProvider {
|
|
|
2957
2512
|
'Transaction must have "to" field'
|
|
2958
2513
|
);
|
|
2959
2514
|
}
|
|
2515
|
+
const assertOperation = this.captureWalletOperation();
|
|
2960
2516
|
try {
|
|
2961
|
-
const response = await this.
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2517
|
+
const response = await this.awaitWalletOperation(
|
|
2518
|
+
assertOperation,
|
|
2519
|
+
async () => this.getTalkenApiClientOrThrow().evm.estimateGas({
|
|
2520
|
+
network: getNetworkName(this.chainId),
|
|
2521
|
+
from: tx.from || this.wallet?.address || "",
|
|
2522
|
+
to: tx.to,
|
|
2523
|
+
value: tx.value,
|
|
2524
|
+
data: tx.data
|
|
2525
|
+
})
|
|
2526
|
+
);
|
|
2968
2527
|
if (!response.result) {
|
|
2969
2528
|
throw new Error("No result in gas estimate response");
|
|
2970
2529
|
}
|
|
2971
2530
|
return response.result;
|
|
2972
2531
|
} catch (error) {
|
|
2532
|
+
assertOperation();
|
|
2973
2533
|
logger2.warn("Gas estimation failed, using fallback:", error);
|
|
2974
2534
|
if (tx.data && tx.data !== "0x") {
|
|
2975
2535
|
return "0x493e0";
|
|
@@ -2989,16 +2549,21 @@ var AbcEvmProvider = class extends AbstractChainProvider {
|
|
|
2989
2549
|
"eth_call requires to and data"
|
|
2990
2550
|
);
|
|
2991
2551
|
}
|
|
2552
|
+
const assertOperation = this.captureWalletOperation();
|
|
2992
2553
|
try {
|
|
2993
2554
|
const api = this.getTalkenApiClientOrThrow();
|
|
2994
|
-
const response = await
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
2555
|
+
const response = await this.awaitWalletOperation(
|
|
2556
|
+
assertOperation,
|
|
2557
|
+
async () => api.evm.ethCall({
|
|
2558
|
+
network: getNetworkName(this.chainId),
|
|
2559
|
+
to: tx.to,
|
|
2560
|
+
data: tx.data,
|
|
2561
|
+
from: tx.from || this.wallet?.address
|
|
2562
|
+
})
|
|
2563
|
+
);
|
|
3000
2564
|
return response?.result ?? response?.data ?? "0x";
|
|
3001
2565
|
} catch (error) {
|
|
2566
|
+
assertOperation();
|
|
3002
2567
|
throw new ProviderRpcError(
|
|
3003
2568
|
ProviderErrorCode.INTERNAL_ERROR,
|
|
3004
2569
|
`eth_call failed: ${error instanceof Error ? error.message : String(error)}`
|
|
@@ -3017,14 +2582,16 @@ var AbcEvmProvider = class extends AbstractChainProvider {
|
|
|
3017
2582
|
"Missing address parameter"
|
|
3018
2583
|
);
|
|
3019
2584
|
}
|
|
2585
|
+
const assertOperation = this.captureWalletOperation();
|
|
3020
2586
|
try {
|
|
3021
2587
|
const api = this.getTalkenApiClientOrThrow();
|
|
3022
|
-
const response = await
|
|
3023
|
-
|
|
3024
|
-
address
|
|
2588
|
+
const response = await this.awaitWalletOperation(
|
|
2589
|
+
assertOperation,
|
|
2590
|
+
async () => api.evm.getBalance(getNetworkName(this.chainId), address)
|
|
3025
2591
|
);
|
|
3026
2592
|
return response?.balance ?? "0x0";
|
|
3027
2593
|
} catch (error) {
|
|
2594
|
+
assertOperation();
|
|
3028
2595
|
throw new ProviderRpcError(
|
|
3029
2596
|
ProviderErrorCode.INTERNAL_ERROR,
|
|
3030
2597
|
`eth_getBalance failed: ${error instanceof Error ? error.message : String(error)}`
|
|
@@ -3035,6 +2602,11 @@ var AbcEvmProvider = class extends AbstractChainProvider {
|
|
|
3035
2602
|
* Get current wallet
|
|
3036
2603
|
*/
|
|
3037
2604
|
getWallet() {
|
|
2605
|
+
try {
|
|
2606
|
+
this.assertWalletSession();
|
|
2607
|
+
} catch {
|
|
2608
|
+
return null;
|
|
2609
|
+
}
|
|
3038
2610
|
return this.wallet;
|
|
3039
2611
|
}
|
|
3040
2612
|
/**
|