@talken/talkenkit 2.3.4 → 2.3.5
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/LICENSE +9 -0
- package/dist/index.js +69 -23
- package/dist/wallets/walletConnectors/abcWallet/abcApi.js +1 -1
- package/dist/wallets/walletConnectors/abcWallet/abcConnector.js +2 -2
- package/dist/wallets/walletConnectors/abcWallet/abcSolanaWallet.js +2 -2
- package/dist/wallets/walletConnectors/abcWallet/abcWallet.js +3 -3
- package/dist/wallets/walletConnectors/abcWallet/index.js +4 -4
- package/dist/wallets/walletConnectors/chunk-2J66VMY5.js +152 -0
- package/dist/wallets/walletConnectors/chunk-2W6UBYKX.js +66 -0
- package/dist/wallets/walletConnectors/chunk-2ZPGPZCP.js +228 -0
- package/dist/wallets/walletConnectors/chunk-3DPCIDW6.js +1730 -0
- package/dist/wallets/walletConnectors/chunk-3IVTKZ7V.js +87 -0
- package/dist/wallets/walletConnectors/chunk-47TQ23J4.js +63 -0
- package/dist/wallets/walletConnectors/chunk-4HKJ53H3.js +1742 -0
- package/dist/wallets/walletConnectors/chunk-4T3UOJYR.js +76 -0
- package/dist/wallets/walletConnectors/chunk-53IBFGVW.js +102 -0
- package/dist/wallets/walletConnectors/chunk-5EARL7FN.js +39 -0
- package/dist/wallets/walletConnectors/chunk-5NM2LK2G.js +95 -0
- package/dist/wallets/walletConnectors/chunk-66SCJ77O.js +63 -0
- package/dist/wallets/walletConnectors/chunk-6JKWIEGA.js +228 -0
- package/dist/wallets/walletConnectors/chunk-7SXCH5TL.js +1752 -0
- package/dist/wallets/walletConnectors/chunk-7UZBDZZZ.js +599 -0
- package/dist/wallets/walletConnectors/chunk-AKLKCDXT.js +186 -0
- package/dist/wallets/walletConnectors/chunk-ATQWOE4J.js +110 -0
- package/dist/wallets/walletConnectors/chunk-B6DM7J4N.js +71 -0
- package/dist/wallets/walletConnectors/chunk-BJYSWRV6.js +93 -0
- package/dist/wallets/walletConnectors/chunk-BRM4ZVXZ.js +44 -0
- package/dist/wallets/walletConnectors/chunk-BUDWZAL7.js +44 -0
- package/dist/wallets/walletConnectors/chunk-C7S72VGD.js +93 -0
- package/dist/wallets/walletConnectors/chunk-CSWWNAYR.js +44 -0
- package/dist/wallets/walletConnectors/chunk-CULIWWLV.js +101 -0
- package/dist/wallets/walletConnectors/chunk-D7U5WEH2.js +96 -0
- package/dist/wallets/walletConnectors/chunk-E4N7SPPU.js +39 -0
- package/dist/wallets/walletConnectors/chunk-ENU7XLF5.js +44 -0
- package/dist/wallets/walletConnectors/chunk-ESRU5KCF.js +151 -0
- package/dist/wallets/walletConnectors/chunk-FBI7UGNO.js +95 -0
- package/dist/wallets/walletConnectors/chunk-FF7ZIXKD.js +39 -0
- package/dist/wallets/walletConnectors/chunk-FJCL2YPU.js +1737 -0
- package/dist/wallets/walletConnectors/chunk-FSU3WBH3.js +63 -0
- package/dist/wallets/walletConnectors/chunk-G2IHR6PW.js +63 -0
- package/dist/wallets/walletConnectors/chunk-GILMNC3J.js +96 -0
- package/dist/wallets/walletConnectors/chunk-HDYBRMYW.js +194 -0
- package/dist/wallets/walletConnectors/chunk-HIZCIW5L.js +228 -0
- package/dist/wallets/walletConnectors/chunk-JBVBQUCS.js +73 -0
- package/dist/wallets/walletConnectors/chunk-JCMXNOQ5.js +63 -0
- package/dist/wallets/walletConnectors/chunk-JWO4ZQLK.js +98 -0
- package/dist/wallets/walletConnectors/chunk-K6GEK4JB.js +66 -0
- package/dist/wallets/walletConnectors/chunk-K6UZPSBG.js +94 -0
- package/dist/wallets/walletConnectors/chunk-KIQDE4N6.js +39 -0
- package/dist/wallets/walletConnectors/chunk-KM55XFBI.js +65 -0
- package/dist/wallets/walletConnectors/chunk-KOT7JYJR.js +39 -0
- package/dist/wallets/walletConnectors/chunk-KZOSE2PI.js +228 -0
- package/dist/wallets/walletConnectors/chunk-LNZJLKFB.js +39 -0
- package/dist/wallets/walletConnectors/chunk-LV765WZL.js +1748 -0
- package/dist/wallets/walletConnectors/chunk-MSI2BPP5.js +1722 -0
- package/dist/wallets/walletConnectors/chunk-MX2IY5CD.js +44 -0
- package/dist/wallets/walletConnectors/chunk-NLX2EV7O.js +44 -0
- package/dist/wallets/walletConnectors/chunk-NVAZ3B3V.js +228 -0
- package/dist/wallets/walletConnectors/chunk-OEWU3ZMN.js +39 -0
- package/dist/wallets/walletConnectors/chunk-P2MTINFI.js +280 -0
- package/dist/wallets/walletConnectors/chunk-PNMSIVVT.js +44 -0
- package/dist/wallets/walletConnectors/chunk-PZNYT2HC.js +1722 -0
- package/dist/wallets/walletConnectors/chunk-QZRNNI3E.js +39 -0
- package/dist/wallets/walletConnectors/chunk-R4UYVU5X.js +1721 -0
- package/dist/wallets/walletConnectors/chunk-RLBGBBIO.js +309 -0
- package/dist/wallets/walletConnectors/chunk-S2PY4MDO.js +108 -0
- package/dist/wallets/walletConnectors/chunk-SCOX5RF4.js +91 -0
- package/dist/wallets/walletConnectors/chunk-TUUNSVKZ.js +345 -0
- package/dist/wallets/walletConnectors/chunk-U2CUEL35.js +240 -0
- package/dist/wallets/walletConnectors/chunk-V6NRLREB.js +44 -0
- package/dist/wallets/walletConnectors/chunk-V7E5KRXJ.js +103 -0
- package/dist/wallets/walletConnectors/chunk-VCBVYFLJ.js +63 -0
- package/dist/wallets/walletConnectors/chunk-VM7AEC7H.js +39 -0
- package/dist/wallets/walletConnectors/chunk-W2VDZD74.js +478 -0
- package/dist/wallets/walletConnectors/chunk-WAO3KL5U.js +285 -0
- package/dist/wallets/walletConnectors/chunk-WPHTIILX.js +228 -0
- package/dist/wallets/walletConnectors/chunk-WSCJY2QD.js +228 -0
- package/dist/wallets/walletConnectors/chunk-WSLFMQIG.js +98 -0
- package/dist/wallets/walletConnectors/chunk-X3JQB5QL.js +44 -0
- package/dist/wallets/walletConnectors/chunk-X4CDP7L7.js +228 -0
- package/dist/wallets/walletConnectors/chunk-XETOVXYM.js +228 -0
- package/dist/wallets/walletConnectors/chunk-XYPR4BAF.js +436 -0
- package/dist/wallets/walletConnectors/chunk-Z2E65XSS.js +96 -0
- package/dist/wallets/walletConnectors/chunk-Z2ZRPTPX.js +1726 -0
- package/dist/wallets/walletConnectors/index.js +31 -31
- package/package.json +11 -12
package/LICENSE
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Rainbow
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/dist/index.js
CHANGED
|
@@ -10,14 +10,14 @@ import {
|
|
|
10
10
|
secure_default
|
|
11
11
|
} from "./chunk-Y7ZSI2YC.js";
|
|
12
12
|
import {
|
|
13
|
-
|
|
14
|
-
} from "./chunk-
|
|
13
|
+
darkTheme
|
|
14
|
+
} from "./chunk-RZWDCITT.js";
|
|
15
15
|
import {
|
|
16
16
|
midnightTheme
|
|
17
17
|
} from "./chunk-7ZP3ENJ2.js";
|
|
18
18
|
import {
|
|
19
|
-
|
|
20
|
-
} from "./chunk-
|
|
19
|
+
lightTheme
|
|
20
|
+
} from "./chunk-72HZGUJA.js";
|
|
21
21
|
import "./chunk-DQLAW7KN.js";
|
|
22
22
|
import {
|
|
23
23
|
en_US_default
|
|
@@ -2114,7 +2114,7 @@ function setRainbowKitVersion({ version }) {
|
|
|
2114
2114
|
}
|
|
2115
2115
|
function useFingerprint() {
|
|
2116
2116
|
const fingerprint = useCallback3(() => {
|
|
2117
|
-
setRainbowKitVersion({ version: "2.3.
|
|
2117
|
+
setRainbowKitVersion({ version: "2.3.5" });
|
|
2118
2118
|
}, []);
|
|
2119
2119
|
useEffect10(() => {
|
|
2120
2120
|
fingerprint();
|
|
@@ -5626,6 +5626,7 @@ var AbcWaasClient = class {
|
|
|
5626
5626
|
};
|
|
5627
5627
|
const network = networkMap[params.chainId] || "ethereum";
|
|
5628
5628
|
const tx = params.transaction;
|
|
5629
|
+
const isKaiaNetwork = params.chainId === 1001 || params.chainId === 8217;
|
|
5629
5630
|
if (!tx.maxFeePerGas || !tx.maxPriorityFeePerGas || !tx.gasLimit || !tx.gas) {
|
|
5630
5631
|
try {
|
|
5631
5632
|
if (!tx.maxFeePerGas || !tx.maxPriorityFeePerGas) {
|
|
@@ -5683,22 +5684,66 @@ var AbcWaasClient = class {
|
|
|
5683
5684
|
response: estimateData
|
|
5684
5685
|
});
|
|
5685
5686
|
if (estimateResponse.ok && estimateData.result) {
|
|
5686
|
-
|
|
5687
|
-
|
|
5687
|
+
const estimatedGas = estimateData.result;
|
|
5688
|
+
const estimatedGasNumber = Number.parseInt(estimatedGas, 16);
|
|
5689
|
+
if (isKaiaNetwork) {
|
|
5690
|
+
const hasContractData = tx.data && tx.data !== "0x" && tx.data.length > 2;
|
|
5691
|
+
const minGas = hasContractData ? 1e5 : 21e3;
|
|
5692
|
+
if (estimatedGasNumber < minGas) {
|
|
5693
|
+
console.warn(
|
|
5694
|
+
"\u26A0\uFE0F [Kaia] Gas estimate too low, enforcing minimum:",
|
|
5695
|
+
{
|
|
5696
|
+
chainId: params.chainId,
|
|
5697
|
+
estimated: estimatedGas,
|
|
5698
|
+
estimatedDecimal: estimatedGasNumber,
|
|
5699
|
+
minimum: minGas,
|
|
5700
|
+
isContractCall: hasContractData
|
|
5701
|
+
}
|
|
5702
|
+
);
|
|
5703
|
+
tx.gasLimit = `0x${minGas.toString(16)}`;
|
|
5704
|
+
} else {
|
|
5705
|
+
const bufferedGas = Math.floor(estimatedGasNumber * 1.2);
|
|
5706
|
+
tx.gasLimit = `0x${bufferedGas.toString(16)}`;
|
|
5707
|
+
console.log("\u2705 [Kaia] Gas limit with 20% buffer:", {
|
|
5708
|
+
estimated: estimatedGas,
|
|
5709
|
+
buffered: tx.gasLimit
|
|
5710
|
+
});
|
|
5711
|
+
}
|
|
5712
|
+
} else {
|
|
5713
|
+
tx.gasLimit = estimatedGas;
|
|
5714
|
+
console.log("\u2705 Gas limit from estimate:", estimatedGas);
|
|
5715
|
+
}
|
|
5688
5716
|
} else {
|
|
5689
|
-
const
|
|
5690
|
-
|
|
5691
|
-
|
|
5692
|
-
|
|
5693
|
-
|
|
5694
|
-
|
|
5717
|
+
const hasContractData = tx.data && tx.data !== "0x" && tx.data.length > 2;
|
|
5718
|
+
if (hasContractData) {
|
|
5719
|
+
tx.gasLimit = isKaiaNetwork ? "0x186a0" : "0x249f0";
|
|
5720
|
+
console.warn(
|
|
5721
|
+
"\u26A0\uFE0F Gas estimate failed, using contract call fallback:",
|
|
5722
|
+
{
|
|
5723
|
+
chainId: params.chainId,
|
|
5724
|
+
network,
|
|
5725
|
+
fallbackGasLimit: tx.gasLimit,
|
|
5726
|
+
isKaia: isKaiaNetwork,
|
|
5727
|
+
error: estimateData.errorMessage || estimateData.msg
|
|
5728
|
+
}
|
|
5729
|
+
);
|
|
5730
|
+
} else {
|
|
5731
|
+
tx.gasLimit = "0x5208";
|
|
5732
|
+
console.warn(
|
|
5733
|
+
"\u26A0\uFE0F Gas estimate failed, using native transfer fallback:",
|
|
5734
|
+
{
|
|
5735
|
+
chainId: params.chainId,
|
|
5736
|
+
network,
|
|
5737
|
+
fallbackGasLimit: tx.gasLimit
|
|
5738
|
+
}
|
|
5739
|
+
);
|
|
5740
|
+
}
|
|
5695
5741
|
}
|
|
5696
5742
|
}
|
|
5697
5743
|
} catch (error3) {
|
|
5698
5744
|
console.warn("Failed to fetch gas parameters from ABC WaaS:", error3);
|
|
5699
5745
|
}
|
|
5700
5746
|
}
|
|
5701
|
-
const isContractDeployment = !params.transaction.to || params.transaction.to === "0x" || params.transaction.to === "0x0";
|
|
5702
5747
|
const bodyData = {
|
|
5703
5748
|
network,
|
|
5704
5749
|
encryptDevicePassword: encryptedDevicePassword,
|
|
@@ -5711,6 +5756,7 @@ var AbcWaasClient = class {
|
|
|
5711
5756
|
// Reference: talken-nft-drops/src/libs/abc-waas-provider/index.ts:800 - to: to ?? '0x'
|
|
5712
5757
|
to: tx.to === "0x" ? "0x" : getAddress(tx.to),
|
|
5713
5758
|
// Required by ABC WaaS API
|
|
5759
|
+
// Always use EIP1559 type (ABC WaaS handles network-specific conversion)
|
|
5714
5760
|
type: "EIP1559",
|
|
5715
5761
|
// ourpubkey and ucpubkey are required by ABC WaaS (empty strings for now)
|
|
5716
5762
|
// Based on successful tg-wallet payload analysis
|
|
@@ -5724,6 +5770,8 @@ var AbcWaasClient = class {
|
|
|
5724
5770
|
hexValue = `0${hexValue}`;
|
|
5725
5771
|
}
|
|
5726
5772
|
bodyData.value = `0x${hexValue}`;
|
|
5773
|
+
} else {
|
|
5774
|
+
bodyData.value = "0x0";
|
|
5727
5775
|
}
|
|
5728
5776
|
if (tx.gasLimit || tx.gas) {
|
|
5729
5777
|
const gasLimitValue = tx.gasLimit || tx.gas;
|
|
@@ -5747,20 +5795,18 @@ var AbcWaasClient = class {
|
|
|
5747
5795
|
bodyData.maxPriorityFeePerGas = `0x${BigInt(tx.maxPriorityFeePerGas).toString(16)}`;
|
|
5748
5796
|
}
|
|
5749
5797
|
}
|
|
5798
|
+
if (tx.gasPrice) {
|
|
5799
|
+
if (tx.gasPrice.toString().startsWith("0x")) {
|
|
5800
|
+
bodyData.gasPrice = tx.gasPrice.toString();
|
|
5801
|
+
} else {
|
|
5802
|
+
bodyData.gasPrice = `0x${BigInt(tx.gasPrice).toString(16)}`;
|
|
5803
|
+
}
|
|
5804
|
+
}
|
|
5750
5805
|
if (tx.data !== void 0 && tx.data !== null) {
|
|
5751
5806
|
bodyData.data = tx.data || "0x";
|
|
5752
5807
|
} else {
|
|
5753
5808
|
bodyData.data = "0x";
|
|
5754
5809
|
}
|
|
5755
|
-
console.log("\u{1F50D} ABC WaaS signTransaction params:", {
|
|
5756
|
-
isContractDeployment,
|
|
5757
|
-
hasTo: !!bodyData.to,
|
|
5758
|
-
to: bodyData.to,
|
|
5759
|
-
dataLength: bodyData.data?.length,
|
|
5760
|
-
network: bodyData.network,
|
|
5761
|
-
type: bodyData.type,
|
|
5762
|
-
allKeys: Object.keys(bodyData)
|
|
5763
|
-
});
|
|
5764
5810
|
const bodyString = new URLSearchParams(bodyData).toString();
|
|
5765
5811
|
const url = `${this.baseURL}${ABC_ENDPOINTS.SIGN_TRANSACTION}`;
|
|
5766
5812
|
const response = await fetch(url, {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
abcConnector
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-X4CDP7L7.js";
|
|
5
|
+
import "../chunk-3DPCIDW6.js";
|
|
6
6
|
import "../chunk-G2LI5MVX.js";
|
|
7
7
|
import "../chunk-73B7HWCT.js";
|
|
8
8
|
import "../chunk-W23N7VC4.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
abcSolanaWallet
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-KOT7JYJR.js";
|
|
5
5
|
import "../chunk-AEQOPQL6.js";
|
|
6
6
|
import "../chunk-MY5YIDOB.js";
|
|
7
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-3DPCIDW6.js";
|
|
8
8
|
import "../chunk-G2LI5MVX.js";
|
|
9
9
|
import "../chunk-W23N7VC4.js";
|
|
10
10
|
import "../chunk-VETRBBA2.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
abcWallet
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-CSWWNAYR.js";
|
|
5
|
+
import "../chunk-X4CDP7L7.js";
|
|
6
|
+
import "../chunk-3DPCIDW6.js";
|
|
7
7
|
import "../chunk-G2LI5MVX.js";
|
|
8
8
|
import "../chunk-73B7HWCT.js";
|
|
9
9
|
import "../chunk-W23N7VC4.js";
|
|
@@ -19,7 +19,7 @@ import "../chunk-KD2OAMDA.js";
|
|
|
19
19
|
import "../chunk-IOLHAU7H.js";
|
|
20
20
|
import {
|
|
21
21
|
abcSolanaWallet
|
|
22
|
-
} from "../chunk-
|
|
22
|
+
} from "../chunk-KOT7JYJR.js";
|
|
23
23
|
import {
|
|
24
24
|
AbcBitcoinConnector,
|
|
25
25
|
createAbcBitcoinConnector
|
|
@@ -43,14 +43,14 @@ import {
|
|
|
43
43
|
} from "../chunk-MY5YIDOB.js";
|
|
44
44
|
import {
|
|
45
45
|
abcWallet
|
|
46
|
-
} from "../chunk-
|
|
46
|
+
} from "../chunk-CSWWNAYR.js";
|
|
47
47
|
import {
|
|
48
48
|
abcConnector
|
|
49
|
-
} from "../chunk-
|
|
49
|
+
} from "../chunk-X4CDP7L7.js";
|
|
50
50
|
import {
|
|
51
51
|
AbcWaasClient,
|
|
52
52
|
createAbcWaasClient
|
|
53
|
-
} from "../chunk-
|
|
53
|
+
} from "../chunk-3DPCIDW6.js";
|
|
54
54
|
import {
|
|
55
55
|
secure_default
|
|
56
56
|
} from "../chunk-G2LI5MVX.js";
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
BaseApiClient
|
|
4
|
+
} from "./chunk-WAO3KL5U.js";
|
|
5
|
+
import {
|
|
6
|
+
createAbcError
|
|
7
|
+
} from "./chunk-W2VDZD74.js";
|
|
8
|
+
|
|
9
|
+
// src/wallets/walletConnectors/abcWallet/api/SolanaApi.ts
|
|
10
|
+
var SolanaApi = class extends BaseApiClient {
|
|
11
|
+
/**
|
|
12
|
+
* Generate Solana wallet (Ed25519)
|
|
13
|
+
* Uses V3 API with Ed25519 curve
|
|
14
|
+
*
|
|
15
|
+
* @param pin - Hashed PIN (SHA-256)
|
|
16
|
+
* @param isRecover - Whether to recover existing wallet (default: false)
|
|
17
|
+
* @returns Solana wallet information
|
|
18
|
+
*/
|
|
19
|
+
async generateSolanaWallet(pin, isRecover = false) {
|
|
20
|
+
const endpoint = `/v3/wallet/${isRecover ? "recover" : "generate"}`;
|
|
21
|
+
console.log(
|
|
22
|
+
`[SolanaApi] \u{1F527} ${isRecover ? "Recovering" : "Generating"} Solana wallet...`
|
|
23
|
+
);
|
|
24
|
+
const response = await this.request(endpoint, {
|
|
25
|
+
method: "POST",
|
|
26
|
+
contentType: "json",
|
|
27
|
+
body: {
|
|
28
|
+
curve: "ed25519",
|
|
29
|
+
password: pin,
|
|
30
|
+
network: "solana"
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
if (response.status !== "success" || !response.result) {
|
|
34
|
+
console.error("[SolanaApi] \u274C Operation failed:", response);
|
|
35
|
+
throw createAbcError(
|
|
36
|
+
"WALLET_NOT_FOUND" /* WALLET_NOT_FOUND */,
|
|
37
|
+
`Failed to ${isRecover ? "recover" : "generate"} Solana wallet`,
|
|
38
|
+
response
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
const result = response.result;
|
|
42
|
+
const address = this.deriveAddressFromPublicKey(result.public_key);
|
|
43
|
+
console.log("[SolanaApi] \u2705 Wallet ready:", address);
|
|
44
|
+
return {
|
|
45
|
+
uid: result.uid || "",
|
|
46
|
+
sessionId: result.share_id,
|
|
47
|
+
shareId: result.share_id,
|
|
48
|
+
publicKey: result.public_key,
|
|
49
|
+
address,
|
|
50
|
+
keyId: result.key_id || result.share_id,
|
|
51
|
+
encryptedShare: result.encrypted_share || ""
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Recover Solana wallet (alias for generateSolanaWallet with isRecover=true)
|
|
56
|
+
*
|
|
57
|
+
* @param pin - Hashed PIN (SHA-256)
|
|
58
|
+
* @returns Recovered Solana wallet information
|
|
59
|
+
*/
|
|
60
|
+
async recoverSolanaWallet(pin) {
|
|
61
|
+
return this.generateSolanaWallet(pin, true);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Derive Solana address from Ed25519 public key
|
|
65
|
+
* Converts hex public key to base58-encoded Solana address
|
|
66
|
+
*
|
|
67
|
+
* @param publicKey - Ed25519 public key (hex)
|
|
68
|
+
* @returns Solana address (base58)
|
|
69
|
+
*/
|
|
70
|
+
deriveAddressFromPublicKey(publicKey) {
|
|
71
|
+
const cleanKey = publicKey.startsWith("0x") ? publicKey.slice(2) : publicKey;
|
|
72
|
+
return cleanKey;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Sign Solana transaction with Ed25519
|
|
76
|
+
*/
|
|
77
|
+
async signSolanaTransaction(params) {
|
|
78
|
+
const response = await this.request("/v3/wallet/sign", {
|
|
79
|
+
method: "POST",
|
|
80
|
+
contentType: "json",
|
|
81
|
+
body: {
|
|
82
|
+
uid: params.uid,
|
|
83
|
+
share_id: params.shareId,
|
|
84
|
+
message: params.message,
|
|
85
|
+
password: params.pin
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
if (response.status !== "success" || !response.result?.signature) {
|
|
89
|
+
throw createAbcError(
|
|
90
|
+
"SIGNATURE_FAILED" /* SIGNATURE_FAILED */,
|
|
91
|
+
"Failed to sign Solana transaction",
|
|
92
|
+
response
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
signature: response.result.signature
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Sign Solana message with Ed25519
|
|
101
|
+
*/
|
|
102
|
+
async signSolanaMessage(params) {
|
|
103
|
+
const response = await this.request("/v3/wallet/sign", {
|
|
104
|
+
method: "POST",
|
|
105
|
+
contentType: "json",
|
|
106
|
+
body: {
|
|
107
|
+
uid: params.uid,
|
|
108
|
+
share_id: params.shareId,
|
|
109
|
+
message: params.message,
|
|
110
|
+
password: params.pin
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
if (response.status !== "success" || !response.result?.signature) {
|
|
114
|
+
throw createAbcError(
|
|
115
|
+
"SIGNATURE_FAILED" /* SIGNATURE_FAILED */,
|
|
116
|
+
"Failed to sign Solana message",
|
|
117
|
+
response
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
return {
|
|
121
|
+
signature: response.result.signature
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Send Solana transaction
|
|
126
|
+
*/
|
|
127
|
+
async sendSolanaTransaction(params) {
|
|
128
|
+
const response = await this.request("/wapi/v2/solana/tx/sendTransaction", {
|
|
129
|
+
method: "POST",
|
|
130
|
+
contentType: "json",
|
|
131
|
+
body: {
|
|
132
|
+
network: params.network,
|
|
133
|
+
serializedTX: params.serializedTX,
|
|
134
|
+
signatures: params.signatures
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
if (response.status !== "success" || !response.result?.data) {
|
|
138
|
+
throw createAbcError(
|
|
139
|
+
"NETWORK_ERROR" /* NETWORK_ERROR */,
|
|
140
|
+
"Failed to send Solana transaction",
|
|
141
|
+
response
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
return {
|
|
145
|
+
txHash: response.result.data
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
export {
|
|
151
|
+
SolanaApi
|
|
152
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
isAndroid
|
|
4
|
+
} from "./chunk-RETKWSKD.js";
|
|
5
|
+
import {
|
|
6
|
+
getInjectedConnector
|
|
7
|
+
} from "./chunk-MBBGZGXF.js";
|
|
8
|
+
import {
|
|
9
|
+
getWalletConnectConnector
|
|
10
|
+
} from "./chunk-PODFK4OS.js";
|
|
11
|
+
|
|
12
|
+
// src/wallets/walletConnectors/iopayWallet/iopayWallet.ts
|
|
13
|
+
function isIoPayMobile() {
|
|
14
|
+
return typeof navigator !== "undefined" && typeof navigator.userAgent !== "undefined" && (navigator?.userAgent.includes("IoPayAndroid") || navigator?.userAgent.includes("IoPayiOs"));
|
|
15
|
+
}
|
|
16
|
+
var iopayWallet = ({
|
|
17
|
+
projectId,
|
|
18
|
+
walletConnectParameters
|
|
19
|
+
}) => ({
|
|
20
|
+
id: "iopay",
|
|
21
|
+
name: "ioPay Wallet",
|
|
22
|
+
iconUrl: async () => (await import("./iopayWallet-IJHJ7NYT.js")).default,
|
|
23
|
+
iconBackground: "#fff",
|
|
24
|
+
downloadUrls: {
|
|
25
|
+
android: "https://play.google.com/store/apps/details?id=io.iotex.iopay.gp&pli=1",
|
|
26
|
+
ios: "https://apps.apple.com/us/app/iopay-multichain-crypto-wallet/id1478086371",
|
|
27
|
+
qrCode: "https://iopay.me/",
|
|
28
|
+
browserExtension: "https://iopay.me/"
|
|
29
|
+
},
|
|
30
|
+
mobile: {
|
|
31
|
+
getUri: (uri) => {
|
|
32
|
+
return isAndroid() ? uri : `iopay://wc?uri=${encodeURIComponent(uri)}`;
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
qrCode: {
|
|
36
|
+
getUri: (uri) => uri,
|
|
37
|
+
instructions: {
|
|
38
|
+
learnMoreUrl: "https://iopay.me/",
|
|
39
|
+
steps: [
|
|
40
|
+
{
|
|
41
|
+
description: "wallet_connectors.iopay.qr_code.step1.description",
|
|
42
|
+
step: "install",
|
|
43
|
+
title: "wallet_connectors.iopay.qr_code.step1.title"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
description: "wallet_connectors.iopay.qr_code.step2.description",
|
|
47
|
+
step: "create",
|
|
48
|
+
title: "wallet_connectors.iopay.qr_code.step2.title"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
description: "wallet_connectors.iopay.qr_code.step3.description",
|
|
52
|
+
step: "scan",
|
|
53
|
+
title: "wallet_connectors.iopay.qr_code.step3.title"
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
createConnector: isIoPayMobile() ? getInjectedConnector({}) : getWalletConnectConnector({
|
|
59
|
+
projectId,
|
|
60
|
+
walletConnectParameters
|
|
61
|
+
})
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
export {
|
|
65
|
+
iopayWallet
|
|
66
|
+
};
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
createAbcEvmProvider
|
|
4
|
+
} from "./chunk-73B7HWCT.js";
|
|
5
|
+
import {
|
|
6
|
+
createAbcWaasClient
|
|
7
|
+
} from "./chunk-4HKJ53H3.js";
|
|
8
|
+
import {
|
|
9
|
+
clearAuthState,
|
|
10
|
+
clearEncryptedTokens,
|
|
11
|
+
loadAuthState,
|
|
12
|
+
saveAuthState
|
|
13
|
+
} from "./chunk-W23N7VC4.js";
|
|
14
|
+
|
|
15
|
+
// src/wallets/walletConnectors/abcWallet/abcConnector.ts
|
|
16
|
+
import { createConnector } from "wagmi";
|
|
17
|
+
function abcConnector(options) {
|
|
18
|
+
const { config } = options;
|
|
19
|
+
return createConnector((wagmiConfig) => {
|
|
20
|
+
const client = createAbcWaasClient(config);
|
|
21
|
+
const provider = createAbcEvmProvider(client);
|
|
22
|
+
let accountsChangedHandler;
|
|
23
|
+
let chainChangedHandler;
|
|
24
|
+
let disconnectHandler;
|
|
25
|
+
return {
|
|
26
|
+
id: "abc",
|
|
27
|
+
name: "ABC Wallet",
|
|
28
|
+
type: "abc",
|
|
29
|
+
/**
|
|
30
|
+
* Connect wallet
|
|
31
|
+
*/
|
|
32
|
+
async connect() {
|
|
33
|
+
try {
|
|
34
|
+
const authState = loadAuthState();
|
|
35
|
+
console.log("\u{1F527} ABC Connector connect() called:", {
|
|
36
|
+
hasAuthState: !!authState,
|
|
37
|
+
isAuthenticated: authState?.isAuthenticated,
|
|
38
|
+
hasWallet: !!authState?.wallet,
|
|
39
|
+
walletAddress: authState?.wallet?.address
|
|
40
|
+
});
|
|
41
|
+
if (!authState || !authState.isAuthenticated || !authState.wallet) {
|
|
42
|
+
throw new Error("ABC_LOGIN_REQUIRED");
|
|
43
|
+
}
|
|
44
|
+
provider.setWallet(authState.wallet);
|
|
45
|
+
console.log("\u2705 Provider wallet set:", {
|
|
46
|
+
address: authState.wallet.address,
|
|
47
|
+
hasPIN: !!authState.pin
|
|
48
|
+
});
|
|
49
|
+
const accounts = await provider.request({
|
|
50
|
+
method: "eth_requestAccounts"
|
|
51
|
+
});
|
|
52
|
+
const currentChainId = await provider.request({
|
|
53
|
+
method: "eth_chainId"
|
|
54
|
+
});
|
|
55
|
+
if (accountsChangedHandler) {
|
|
56
|
+
provider.removeListener("accountsChanged", accountsChangedHandler);
|
|
57
|
+
}
|
|
58
|
+
accountsChangedHandler = (accounts2) => {
|
|
59
|
+
wagmiConfig.emitter.emit("change", {
|
|
60
|
+
accounts: accounts2
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
provider.on("accountsChanged", accountsChangedHandler);
|
|
64
|
+
if (chainChangedHandler) {
|
|
65
|
+
provider.removeListener("chainChanged", chainChangedHandler);
|
|
66
|
+
}
|
|
67
|
+
chainChangedHandler = (chainId) => {
|
|
68
|
+
wagmiConfig.emitter.emit("change", {
|
|
69
|
+
chainId: Number(chainId)
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
provider.on("chainChanged", chainChangedHandler);
|
|
73
|
+
if (disconnectHandler) {
|
|
74
|
+
provider.removeListener("disconnect", disconnectHandler);
|
|
75
|
+
}
|
|
76
|
+
disconnectHandler = () => {
|
|
77
|
+
wagmiConfig.emitter.emit("disconnect");
|
|
78
|
+
this.onDisconnect();
|
|
79
|
+
};
|
|
80
|
+
provider.on("disconnect", disconnectHandler);
|
|
81
|
+
return {
|
|
82
|
+
accounts,
|
|
83
|
+
chainId: Number(currentChainId)
|
|
84
|
+
};
|
|
85
|
+
} catch (error) {
|
|
86
|
+
if (error.message === "ABC_LOGIN_REQUIRED") {
|
|
87
|
+
throw error;
|
|
88
|
+
}
|
|
89
|
+
throw error;
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
/**
|
|
93
|
+
* Disconnect wallet
|
|
94
|
+
*/
|
|
95
|
+
async disconnect() {
|
|
96
|
+
if (accountsChangedHandler) {
|
|
97
|
+
provider.removeListener("accountsChanged", accountsChangedHandler);
|
|
98
|
+
accountsChangedHandler = void 0;
|
|
99
|
+
}
|
|
100
|
+
if (chainChangedHandler) {
|
|
101
|
+
provider.removeListener("chainChanged", chainChangedHandler);
|
|
102
|
+
chainChangedHandler = void 0;
|
|
103
|
+
}
|
|
104
|
+
if (disconnectHandler) {
|
|
105
|
+
provider.removeListener("disconnect", disconnectHandler);
|
|
106
|
+
disconnectHandler = void 0;
|
|
107
|
+
}
|
|
108
|
+
provider.clearWallet();
|
|
109
|
+
await client.logout();
|
|
110
|
+
let savedPinHash = null;
|
|
111
|
+
let savedEmail = null;
|
|
112
|
+
if (typeof window !== "undefined") {
|
|
113
|
+
savedPinHash = localStorage.getItem("talkenkit_abc_pin_hash");
|
|
114
|
+
savedEmail = localStorage.getItem("talkenkit_abc_saved_email");
|
|
115
|
+
}
|
|
116
|
+
clearAuthState();
|
|
117
|
+
clearEncryptedTokens();
|
|
118
|
+
if (typeof window !== "undefined") {
|
|
119
|
+
localStorage.removeItem("talkenkit_abc_enc_salt");
|
|
120
|
+
localStorage.removeItem("talkenkit_abc_enc_tokens");
|
|
121
|
+
if (savedPinHash) {
|
|
122
|
+
localStorage.setItem("talkenkit_abc_pin_hash", savedPinHash);
|
|
123
|
+
}
|
|
124
|
+
if (savedEmail) {
|
|
125
|
+
localStorage.setItem("talkenkit_abc_saved_email", savedEmail);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
console.log("\u2705 ABC Wallet disconnected (PIN preserved)");
|
|
129
|
+
},
|
|
130
|
+
/**
|
|
131
|
+
* Get accounts
|
|
132
|
+
*/
|
|
133
|
+
async getAccounts() {
|
|
134
|
+
const accounts = await provider.request({
|
|
135
|
+
method: "eth_accounts"
|
|
136
|
+
});
|
|
137
|
+
return accounts.map((account) => account);
|
|
138
|
+
},
|
|
139
|
+
/**
|
|
140
|
+
* Get chain ID
|
|
141
|
+
*/
|
|
142
|
+
async getChainId() {
|
|
143
|
+
const chainId = await provider.request({
|
|
144
|
+
method: "eth_chainId"
|
|
145
|
+
});
|
|
146
|
+
return Number(chainId);
|
|
147
|
+
},
|
|
148
|
+
/**
|
|
149
|
+
* Get provider
|
|
150
|
+
*/
|
|
151
|
+
async getProvider() {
|
|
152
|
+
return provider;
|
|
153
|
+
},
|
|
154
|
+
/**
|
|
155
|
+
* Check if authorized (has valid session)
|
|
156
|
+
*/
|
|
157
|
+
async isAuthorized() {
|
|
158
|
+
try {
|
|
159
|
+
const authState = loadAuthState();
|
|
160
|
+
if (!authState || !authState.isAuthenticated) {
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
return client.isAuthenticated();
|
|
164
|
+
} catch {
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
/**
|
|
169
|
+
* Switch chain
|
|
170
|
+
*/
|
|
171
|
+
async switchChain({ chainId }) {
|
|
172
|
+
await provider.request({
|
|
173
|
+
method: "wallet_switchEthereumChain",
|
|
174
|
+
params: [{ chainId: `0x${chainId.toString(16)}` }]
|
|
175
|
+
});
|
|
176
|
+
const newChainId = await this.getChainId();
|
|
177
|
+
const authState = loadAuthState();
|
|
178
|
+
if (authState?.wallet) {
|
|
179
|
+
authState.wallet.chainId = newChainId;
|
|
180
|
+
saveAuthState(authState);
|
|
181
|
+
}
|
|
182
|
+
return wagmiConfig.chains.find((x) => x.id === chainId) ?? {
|
|
183
|
+
id: chainId,
|
|
184
|
+
name: `Chain ${chainId}`,
|
|
185
|
+
nativeCurrency: {
|
|
186
|
+
name: "Ether",
|
|
187
|
+
decimals: 18,
|
|
188
|
+
symbol: "ETH"
|
|
189
|
+
},
|
|
190
|
+
rpcUrls: {
|
|
191
|
+
default: { http: [""] }
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
},
|
|
195
|
+
/**
|
|
196
|
+
* Handle accounts changed
|
|
197
|
+
*/
|
|
198
|
+
onAccountsChanged(accounts) {
|
|
199
|
+
if (accounts.length === 0) {
|
|
200
|
+
this.onDisconnect();
|
|
201
|
+
} else {
|
|
202
|
+
wagmiConfig.emitter.emit("change", {
|
|
203
|
+
accounts
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
/**
|
|
208
|
+
* Handle chain changed
|
|
209
|
+
*/
|
|
210
|
+
onChainChanged(chain) {
|
|
211
|
+
const chainId = Number(chain);
|
|
212
|
+
wagmiConfig.emitter.emit("change", { chainId });
|
|
213
|
+
},
|
|
214
|
+
/**
|
|
215
|
+
* Handle disconnect
|
|
216
|
+
*/
|
|
217
|
+
onDisconnect(_error) {
|
|
218
|
+
provider.clearWallet();
|
|
219
|
+
clearAuthState();
|
|
220
|
+
wagmiConfig.emitter.emit("disconnect");
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export {
|
|
227
|
+
abcConnector
|
|
228
|
+
};
|