@talken/talkenkit 2.3.5 → 2.3.7
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/components/ChainIndicator/ChainIndicator.css.d.ts +4 -0
- package/dist/components/ChainIndicator/ChainIndicator.d.ts +53 -0
- package/dist/components/ChainIndicator/index.d.ts +2 -0
- package/dist/components/ChainSelector/ChainSelector.css.d.ts +5 -0
- package/dist/components/ChainSelector/ChainSelector.d.ts +38 -0
- package/dist/components/ChainSelector/index.d.ts +2 -0
- package/dist/components/ConnectButton/ConnectButtonRenderer.d.ts +9 -0
- package/dist/components/ConnectOptions/DesktopOptions.d.ts +5 -1
- package/dist/components/ConnectOptions/MultiChainConnectOptions.d.ts +31 -0
- package/dist/components/ConnectOptions/index.d.ts +3 -0
- package/dist/components/ModalSelection/ModalSelection.d.ts +2 -1
- package/dist/components/ProfileDetails/ProfileDetails.d.ts +1 -2
- package/dist/components/RainbowKitProvider/RainbowKitProvider.d.ts +8 -1
- package/dist/components/SolanaWalletList/SolanaWalletList.css.d.ts +7 -0
- package/dist/components/SolanaWalletList/SolanaWalletList.d.ts +32 -0
- package/dist/components/SolanaWalletList/index.d.ts +2 -0
- package/dist/contexts/MultiChainContext.d.ts +68 -0
- package/dist/contexts/index.d.ts +7 -0
- package/dist/index.css +105 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +1445 -899
- package/dist/solana/SolanaWalletProvider.d.ts +38 -0
- package/dist/solana/config.d.ts +57 -0
- package/dist/solana/index.d.ts +11 -0
- package/dist/solana/utils/detection.d.ts +27 -0
- package/dist/solana/wallets/backpackWallet.d.ts +19 -0
- package/dist/solana/wallets/index.d.ts +8 -0
- package/dist/solana/wallets/phantomSolanaWallet.d.ts +17 -0
- package/dist/solana/wallets/solflareWallet.d.ts +17 -0
- package/dist/types/solana.d.ts +97 -0
- package/dist/wallets/recentSolanaWalletIds.d.ts +16 -0
- 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-3SVPZCA6.js +71 -0
- package/dist/wallets/walletConnectors/chunk-5QEUEPNY.js +94 -0
- package/dist/wallets/walletConnectors/chunk-B6JLYR3I.js +66 -0
- package/dist/wallets/walletConnectors/{chunk-6JKWIEGA.js → chunk-BHMMHU7Y.js} +1 -1
- package/dist/wallets/walletConnectors/chunk-HKWBR5B7.js +102 -0
- package/dist/wallets/walletConnectors/chunk-K4APJ4PE.js +96 -0
- package/dist/wallets/walletConnectors/chunk-LJ2B47VF.js +108 -0
- package/dist/wallets/walletConnectors/chunk-LXINMUQC.js +186 -0
- package/dist/wallets/walletConnectors/chunk-MORUEOYX.js +76 -0
- package/dist/wallets/walletConnectors/chunk-MQTXA63X.js +27 -0
- package/dist/wallets/walletConnectors/{chunk-G2IHR6PW.js → chunk-NLKL4KD2.js} +11 -11
- package/dist/wallets/walletConnectors/{chunk-KOT7JYJR.js → chunk-OEB7MRS5.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-RWIZ25FJ.js → chunk-P2E4LSYH.js} +17 -23
- package/dist/wallets/walletConnectors/chunk-PMZJGS7X.js +73 -0
- package/dist/wallets/walletConnectors/{chunk-BRM4ZVXZ.js → chunk-RSZS2RMC.js} +1 -1
- package/dist/wallets/walletConnectors/chunk-WZZVA3LW.js +101 -0
- package/dist/wallets/walletConnectors/chunk-XEIKWKH7.js +63 -0
- package/dist/wallets/walletConnectors/chunk-XOQNQKZE.js +98 -0
- package/dist/wallets/walletConnectors/chunk-ZAGAF6PO.js +63 -0
- package/dist/wallets/walletConnectors/chunk-ZJ6OFFD5.js +95 -0
- package/dist/wallets/walletConnectors/index.js +24 -24
- package/package.json +17 -11
- package/LICENSE +0 -9
- package/dist/wallets/walletConnectors/chunk-2J66VMY5.js +0 -152
- package/dist/wallets/walletConnectors/chunk-2ZPGPZCP.js +0 -228
- package/dist/wallets/walletConnectors/chunk-3DPCIDW6.js +0 -1730
- package/dist/wallets/walletConnectors/chunk-4HKJ53H3.js +0 -1742
- package/dist/wallets/walletConnectors/chunk-5EARL7FN.js +0 -39
- package/dist/wallets/walletConnectors/chunk-7SXCH5TL.js +0 -1752
- package/dist/wallets/walletConnectors/chunk-7UZBDZZZ.js +0 -599
- package/dist/wallets/walletConnectors/chunk-BUDWZAL7.js +0 -44
- package/dist/wallets/walletConnectors/chunk-CSWWNAYR.js +0 -44
- package/dist/wallets/walletConnectors/chunk-E4N7SPPU.js +0 -39
- package/dist/wallets/walletConnectors/chunk-ENU7XLF5.js +0 -44
- package/dist/wallets/walletConnectors/chunk-ESRU5KCF.js +0 -151
- package/dist/wallets/walletConnectors/chunk-FF7ZIXKD.js +0 -39
- package/dist/wallets/walletConnectors/chunk-FJCL2YPU.js +0 -1737
- package/dist/wallets/walletConnectors/chunk-FSU3WBH3.js +0 -63
- package/dist/wallets/walletConnectors/chunk-HD6YCICR.js +0 -228
- package/dist/wallets/walletConnectors/chunk-HDYBRMYW.js +0 -194
- package/dist/wallets/walletConnectors/chunk-HIZCIW5L.js +0 -228
- package/dist/wallets/walletConnectors/chunk-JRNBDHFL.js +0 -44
- package/dist/wallets/walletConnectors/chunk-KIQDE4N6.js +0 -39
- package/dist/wallets/walletConnectors/chunk-KZOSE2PI.js +0 -228
- package/dist/wallets/walletConnectors/chunk-LNZJLKFB.js +0 -39
- package/dist/wallets/walletConnectors/chunk-LV765WZL.js +0 -1748
- package/dist/wallets/walletConnectors/chunk-MSI2BPP5.js +0 -1722
- package/dist/wallets/walletConnectors/chunk-MX2IY5CD.js +0 -44
- package/dist/wallets/walletConnectors/chunk-NLX2EV7O.js +0 -44
- package/dist/wallets/walletConnectors/chunk-NVAZ3B3V.js +0 -228
- package/dist/wallets/walletConnectors/chunk-OEWU3ZMN.js +0 -39
- package/dist/wallets/walletConnectors/chunk-P2MTINFI.js +0 -280
- package/dist/wallets/walletConnectors/chunk-PNMSIVVT.js +0 -44
- package/dist/wallets/walletConnectors/chunk-PZNYT2HC.js +0 -1722
- package/dist/wallets/walletConnectors/chunk-QPAE4SDS.js +0 -39
- package/dist/wallets/walletConnectors/chunk-QZRNNI3E.js +0 -39
- package/dist/wallets/walletConnectors/chunk-R4UYVU5X.js +0 -1721
- package/dist/wallets/walletConnectors/chunk-RLBGBBIO.js +0 -309
- package/dist/wallets/walletConnectors/chunk-TUUNSVKZ.js +0 -345
- package/dist/wallets/walletConnectors/chunk-U2CUEL35.js +0 -240
- package/dist/wallets/walletConnectors/chunk-V6NRLREB.js +0 -44
- package/dist/wallets/walletConnectors/chunk-VM7AEC7H.js +0 -39
- package/dist/wallets/walletConnectors/chunk-W2VDZD74.js +0 -478
- package/dist/wallets/walletConnectors/chunk-WAO3KL5U.js +0 -285
- package/dist/wallets/walletConnectors/chunk-WPHTIILX.js +0 -228
- package/dist/wallets/walletConnectors/chunk-WSCJY2QD.js +0 -228
- package/dist/wallets/walletConnectors/chunk-X3JQB5QL.js +0 -44
- package/dist/wallets/walletConnectors/chunk-X4CDP7L7.js +0 -228
- package/dist/wallets/walletConnectors/chunk-XETOVXYM.js +0 -228
- package/dist/wallets/walletConnectors/chunk-XYPR4BAF.js +0 -436
- package/dist/wallets/walletConnectors/chunk-Z2ZRPTPX.js +0 -1726
- package/dist/wallets/walletConnectors/{chunk-VCBVYFLJ.js → chunk-6TLWAEJV.js} +7 -7
- package/dist/wallets/walletConnectors/{chunk-47TQ23J4.js → chunk-74ALNZG4.js} +8 -8
- package/dist/wallets/walletConnectors/{chunk-66SCJ77O.js → chunk-CM5OGUJV.js} +6 -6
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
abcWallet
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-RSZS2RMC.js";
|
|
5
|
+
import "./chunk-BHMMHU7Y.js";
|
|
6
|
+
import "./chunk-P2E4LSYH.js";
|
|
7
7
|
import "./chunk-G2LI5MVX.js";
|
|
8
8
|
import "./chunk-73B7HWCT.js";
|
|
9
9
|
import "./chunk-W23N7VC4.js";
|
|
10
10
|
import "./chunk-VETRBBA2.js";
|
|
11
11
|
import "./chunk-5UEBEMEE.js";
|
|
12
12
|
import {
|
|
13
|
-
|
|
14
|
-
} from "./chunk-
|
|
13
|
+
trustWallet
|
|
14
|
+
} from "./chunk-EM6BREIH.js";
|
|
15
15
|
import {
|
|
16
16
|
uniswapWallet
|
|
17
17
|
} from "./chunk-DLDZUVTB.js";
|
|
@@ -27,12 +27,12 @@ import {
|
|
|
27
27
|
import {
|
|
28
28
|
xdefiWallet
|
|
29
29
|
} from "./chunk-26RJNF7V.js";
|
|
30
|
-
import {
|
|
31
|
-
zealWallet
|
|
32
|
-
} from "./chunk-DVLTKWTZ.js";
|
|
33
30
|
import {
|
|
34
31
|
zerionWallet
|
|
35
32
|
} from "./chunk-CCZUA25H.js";
|
|
33
|
+
import {
|
|
34
|
+
zealWallet
|
|
35
|
+
} from "./chunk-DVLTKWTZ.js";
|
|
36
36
|
import {
|
|
37
37
|
safeheronWallet
|
|
38
38
|
} from "./chunk-PHF4VWKP.js";
|
|
@@ -55,8 +55,8 @@ import {
|
|
|
55
55
|
tokenPocketWallet
|
|
56
56
|
} from "./chunk-RCZCJUTR.js";
|
|
57
57
|
import {
|
|
58
|
-
|
|
59
|
-
} from "./chunk-
|
|
58
|
+
tokenaryWallet
|
|
59
|
+
} from "./chunk-U24COF36.js";
|
|
60
60
|
import {
|
|
61
61
|
oneKeyWallet
|
|
62
62
|
} from "./chunk-6UGYPEQE.js";
|
|
@@ -75,33 +75,33 @@ import {
|
|
|
75
75
|
import {
|
|
76
76
|
ramperWallet
|
|
77
77
|
} from "./chunk-OX3PQBV2.js";
|
|
78
|
+
import {
|
|
79
|
+
roninWallet
|
|
80
|
+
} from "./chunk-DSTY7YNG.js";
|
|
78
81
|
import {
|
|
79
82
|
safeWallet
|
|
80
83
|
} from "./chunk-Z2QCE6O6.js";
|
|
81
84
|
import {
|
|
82
|
-
|
|
83
|
-
} from "./chunk-
|
|
85
|
+
magicEdenWallet
|
|
86
|
+
} from "./chunk-WB7EEKPS.js";
|
|
84
87
|
import {
|
|
85
88
|
metaMaskWallet
|
|
86
89
|
} from "./chunk-VUMT22HL.js";
|
|
87
90
|
import {
|
|
88
91
|
mewWallet
|
|
89
92
|
} from "./chunk-ZRY6ILYP.js";
|
|
90
|
-
import {
|
|
91
|
-
magicEdenWallet
|
|
92
|
-
} from "./chunk-WB7EEKPS.js";
|
|
93
93
|
import {
|
|
94
94
|
nestWallet
|
|
95
95
|
} from "./chunk-NN4KGG3I.js";
|
|
96
96
|
import {
|
|
97
97
|
oktoWallet
|
|
98
98
|
} from "./chunk-7SSXG35M.js";
|
|
99
|
-
import {
|
|
100
|
-
omniWallet
|
|
101
|
-
} from "./chunk-RGPO7AY3.js";
|
|
102
99
|
import {
|
|
103
100
|
okxWallet
|
|
104
101
|
} from "./chunk-GF7RKBNV.js";
|
|
102
|
+
import {
|
|
103
|
+
omniWallet
|
|
104
|
+
} from "./chunk-RGPO7AY3.js";
|
|
105
105
|
import {
|
|
106
106
|
oneInchWallet
|
|
107
107
|
} from "./chunk-OJT577AY.js";
|
|
@@ -156,12 +156,12 @@ import {
|
|
|
156
156
|
import {
|
|
157
157
|
bitverseWallet
|
|
158
158
|
} from "./chunk-6HCSSBZY.js";
|
|
159
|
-
import {
|
|
160
|
-
braveWallet
|
|
161
|
-
} from "./chunk-EYN3CVFM.js";
|
|
162
159
|
import {
|
|
163
160
|
bloomWallet
|
|
164
161
|
} from "./chunk-3KPCADAF.js";
|
|
162
|
+
import {
|
|
163
|
+
braveWallet
|
|
164
|
+
} from "./chunk-EYN3CVFM.js";
|
|
165
165
|
import {
|
|
166
166
|
bybitWallet
|
|
167
167
|
} from "./chunk-DW37ROR6.js";
|
|
@@ -177,15 +177,15 @@ import {
|
|
|
177
177
|
import {
|
|
178
178
|
compassWallet
|
|
179
179
|
} from "./chunk-3OO564GS.js";
|
|
180
|
+
import {
|
|
181
|
+
berasigWallet
|
|
182
|
+
} from "./chunk-UZWMFUJU.js";
|
|
180
183
|
import {
|
|
181
184
|
argentWallet
|
|
182
185
|
} from "./chunk-XT2WYPN5.js";
|
|
183
186
|
import {
|
|
184
187
|
bestWallet
|
|
185
188
|
} from "./chunk-OPAPBEA5.js";
|
|
186
|
-
import {
|
|
187
|
-
berasigWallet
|
|
188
|
-
} from "./chunk-UZWMFUJU.js";
|
|
189
189
|
import {
|
|
190
190
|
bifrostWallet
|
|
191
191
|
} from "./chunk-WXXI4WBF.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@talken/talkenkit",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.7",
|
|
4
4
|
"description": "The best way to connect a wallet",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -22,6 +22,16 @@
|
|
|
22
22
|
"engines": {
|
|
23
23
|
"node": ">=12.4"
|
|
24
24
|
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "node build.js",
|
|
27
|
+
"build:watch": "node build.js --watch",
|
|
28
|
+
"dev": "pnpm build:watch & pnpm typegen:watch",
|
|
29
|
+
"prepare": "MINIFY_CSS=true pnpm build",
|
|
30
|
+
"prebuild": "pnpm typegen",
|
|
31
|
+
"typecheck": "pnpm tsc --noEmit",
|
|
32
|
+
"typegen": "tsc --emitDeclarationOnly || true",
|
|
33
|
+
"typegen:watch": "tsc --emitDeclarationOnly --watch"
|
|
34
|
+
},
|
|
25
35
|
"keywords": [
|
|
26
36
|
"ens",
|
|
27
37
|
"ethereum",
|
|
@@ -59,6 +69,11 @@
|
|
|
59
69
|
"vitest": "2.0.5"
|
|
60
70
|
},
|
|
61
71
|
"dependencies": {
|
|
72
|
+
"@solana/wallet-adapter-base": "^0.9.23",
|
|
73
|
+
"@solana/wallet-adapter-react": "^0.15.35",
|
|
74
|
+
"@solana/wallet-adapter-wallets": "^0.19.32",
|
|
75
|
+
"@solana/wallet-standard": "^1.1.4",
|
|
76
|
+
"@solana/wallet-standard-features": "^1.3.0",
|
|
62
77
|
"@solana/web3.js": "^1.95.8",
|
|
63
78
|
"@vanilla-extract/css": "1.17.3",
|
|
64
79
|
"@vanilla-extract/dynamic": "2.1.4",
|
|
@@ -77,14 +92,5 @@
|
|
|
77
92
|
"type": "git",
|
|
78
93
|
"url": "git+https://github.com/talken-io/talken-kit.git",
|
|
79
94
|
"directory": "packages/talkenkit"
|
|
80
|
-
},
|
|
81
|
-
"scripts": {
|
|
82
|
-
"build": "node build.js",
|
|
83
|
-
"build:watch": "node build.js --watch",
|
|
84
|
-
"dev": "pnpm build:watch & pnpm typegen:watch",
|
|
85
|
-
"prebuild": "pnpm typegen",
|
|
86
|
-
"typecheck": "pnpm tsc --noEmit",
|
|
87
|
-
"typegen": "tsc --emitDeclarationOnly || true",
|
|
88
|
-
"typegen:watch": "tsc --emitDeclarationOnly --watch"
|
|
89
95
|
}
|
|
90
|
-
}
|
|
96
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
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.
|
|
@@ -1,152 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,228 +0,0 @@
|
|
|
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
|
-
};
|