@talken/talkenkit 2.5.0 → 2.5.2
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/{AbcCredentialManager-DDHLW2IH.js → AbcCredentialManager-5W3B7GI4.js} +1 -1
- package/dist/{abcWallet-5GTT47V6.js → abcWallet-HRNBHY5Q.js} +2 -2
- package/dist/{chunk-ALBABQ53.js → chunk-PN6K4CMZ.js} +4 -1
- package/dist/{chunk-REVMSQIO.js → chunk-VCQZZ6SN.js} +478 -58
- package/dist/components/TransactionResultModal/TransactionResultModal.css.d.ts +17 -0
- package/dist/components/TransactionResultModal/TransactionResultModal.d.ts +9 -0
- package/dist/index.css +138 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1341 -977
- package/dist/providers/TransactionResultProvider/TransactionResultContext.d.ts +6 -0
- package/dist/providers/TransactionResultProvider/TransactionResultProvider.d.ts +7 -0
- package/dist/providers/TransactionResultProvider/TransactionResultSingleton.d.ts +16 -0
- package/dist/providers/TransactionResultProvider/index.d.ts +4 -0
- package/dist/providers/TransactionResultProvider/types.d.ts +14 -0
- package/dist/wallets/walletConnectors/abcWallet/AbcCredentialManager.js +2 -2
- package/dist/wallets/walletConnectors/abcWallet/AbcEvmAutoConnector.js +2 -2
- package/dist/wallets/walletConnectors/abcWallet/abcAccessKeyProvider.d.ts +29 -3
- package/dist/wallets/walletConnectors/abcWallet/abcAccessKeyProvider.js +4 -4
- package/dist/wallets/walletConnectors/abcWallet/abcBitcoinConnector.js +3 -3
- package/dist/wallets/walletConnectors/abcWallet/abcBitcoinProvider.js +3 -3
- package/dist/wallets/walletConnectors/abcWallet/abcConnector.js +8 -8
- package/dist/wallets/walletConnectors/abcWallet/abcProvider.d.ts +8 -0
- package/dist/wallets/walletConnectors/abcWallet/abcProvider.js +5 -5
- package/dist/wallets/walletConnectors/abcWallet/abcSolanaProvider.d.ts +1 -0
- package/dist/wallets/walletConnectors/abcWallet/abcSolanaProvider.js +8 -8
- package/dist/wallets/walletConnectors/abcWallet/abcSolanaWalletAdapter.js +3 -3
- package/dist/wallets/walletConnectors/abcWallet/abcTronProvider.d.ts +1 -0
- package/dist/wallets/walletConnectors/abcWallet/abcTronProvider.js +3 -3
- package/dist/wallets/walletConnectors/abcWallet/abcWallet.js +9 -9
- package/dist/wallets/walletConnectors/abcWallet/api/ConfigApi.js +2 -2
- package/dist/wallets/walletConnectors/abcWallet/api/TalkenApiClient.d.ts +25 -0
- package/dist/wallets/walletConnectors/abcWallet/api/TalkenApiClient.js +3 -3
- package/dist/wallets/walletConnectors/abcWallet/api/TokenApi.js +2 -2
- package/dist/wallets/walletConnectors/abcWallet/api/WalletscanApi.js +3 -3
- package/dist/wallets/walletConnectors/abcWallet/api/index.js +9 -9
- package/dist/wallets/walletConnectors/abcWallet/constants.d.ts +3 -0
- package/dist/wallets/walletConnectors/abcWallet/constants.js +1 -1
- package/dist/wallets/walletConnectors/abcWallet/index.d.ts +1 -1
- package/dist/wallets/walletConnectors/abcWallet/index.js +21 -21
- package/dist/wallets/walletConnectors/abcWallet/sessionUtils.js +2 -2
- package/dist/wallets/walletConnectors/abcWallet/types.d.ts +9 -0
- package/dist/wallets/walletConnectors/abcWallet/utils.js +2 -2
- package/dist/wallets/walletConnectors/abcWallet/walletGeneration.js +3 -3
- package/dist/wallets/walletConnectors/{chunk-VDWJ3NQ5.js → chunk-25ZDAJ3L.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-HWXOTEC3.js → chunk-2A5XTST5.js} +64 -14
- package/dist/wallets/walletConnectors/chunk-4JZPP3S7.js +380 -0
- package/dist/wallets/walletConnectors/{chunk-QSP2A4LA.js → chunk-4PDTJS5L.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-IN3HEGZM.js → chunk-645DT4TS.js} +46 -5
- package/dist/wallets/walletConnectors/{chunk-BHEVY4QY.js → chunk-ASYCOXE6.js} +50 -4
- package/dist/wallets/walletConnectors/chunk-BRXYKYKT.js +360 -0
- package/dist/wallets/walletConnectors/{chunk-MO2AXXLI.js → chunk-FKI5AZVH.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-JADQLTFW.js → chunk-H2AZTZMM.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-NULM3THX.js → chunk-HWRZGGGN.js} +1 -1
- package/dist/wallets/walletConnectors/chunk-IPH3SIC3.js +57 -0
- package/dist/wallets/walletConnectors/chunk-JBOKTW2Q.js +360 -0
- package/dist/wallets/walletConnectors/{chunk-TQHS6APN.js → chunk-L6FCF3FH.js} +89 -7
- package/dist/wallets/walletConnectors/{chunk-ACLPF2UW.js → chunk-LIGH2LEU.js} +1 -1
- package/dist/wallets/walletConnectors/chunk-MIX4TRKO.js +194 -0
- package/dist/wallets/walletConnectors/chunk-NP5PWUVU.js +873 -0
- package/dist/wallets/walletConnectors/{chunk-K66HU6GX.js → chunk-OASBABPG.js} +15 -1
- package/dist/wallets/walletConnectors/{chunk-A66MTFML.js → chunk-PF65YS3T.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-6WF4SXLB.js → chunk-QKK3OPQA.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-3LF7FVL6.js → chunk-RGYZNNB6.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-DPTDOCWL.js → chunk-RX2VOIUB.js} +4 -1
- package/dist/wallets/walletConnectors/chunk-TVZHPWFR.js +843 -0
- package/dist/wallets/walletConnectors/{chunk-YV6IZWGE.js → chunk-URS2KVYK.js} +45 -2
- package/dist/wallets/walletConnectors/chunk-WKP53WWR.js +57 -0
- package/dist/wallets/walletConnectors/{chunk-BXH3GDX5.js → chunk-YKFI6ZGM.js} +1 -1
- package/dist/wallets/walletConnectors/index.js +48 -48
- package/package.json +1 -1
- package/dist/wallets/walletConnectors/chunk-S2SQYPGR.js +0 -220
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
getCredentialManager
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-QKK3OPQA.js";
|
|
5
5
|
|
|
6
6
|
// src/wallets/walletConnectors/abcWallet/abcTronProvider.ts
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
getShowPendingTransaction,
|
|
9
|
+
getTalkenApiClient,
|
|
10
|
+
getUpdateTransactionResult
|
|
11
|
+
} from "@talken/talkenkit";
|
|
8
12
|
import { keccak256 } from "viem";
|
|
9
13
|
function isTalkenApiClient(client) {
|
|
10
14
|
return typeof client?.tron?.transferTrx === "function";
|
|
@@ -325,6 +329,7 @@ ${msgBytes.length}`
|
|
|
325
329
|
toAddress: params.toAddress,
|
|
326
330
|
amountSun: amountRaw,
|
|
327
331
|
pin: pinHash,
|
|
332
|
+
waitForConfirmation: true,
|
|
328
333
|
...email && { email }
|
|
329
334
|
} : {
|
|
330
335
|
kind: "trc20",
|
|
@@ -334,10 +339,21 @@ ${msgBytes.length}`
|
|
|
334
339
|
amount: amountRaw,
|
|
335
340
|
feeLimit: params.feeLimit,
|
|
336
341
|
pin: pinHash,
|
|
342
|
+
waitForConfirmation: true,
|
|
337
343
|
...email && { email }
|
|
338
344
|
};
|
|
345
|
+
const showPending = getShowPendingTransaction();
|
|
346
|
+
if (showPending) {
|
|
347
|
+
showPending({
|
|
348
|
+
txHash: "",
|
|
349
|
+
network: this.network.type,
|
|
350
|
+
chain: "tron",
|
|
351
|
+
explorerUrl: void 0
|
|
352
|
+
});
|
|
353
|
+
}
|
|
339
354
|
const result = await api.tron.transferTrx(request);
|
|
340
355
|
const txHash = result.txHash;
|
|
356
|
+
this.updateTransactionResult(result);
|
|
341
357
|
console.log(
|
|
342
358
|
`[TronProvider] \u2705 ${txType === "NATIVE" ? "TRX" : "TRC-20"} transaction complete via TalkenApiClient:`,
|
|
343
359
|
txHash
|
|
@@ -384,6 +400,33 @@ ${msgBytes.length}`
|
|
|
384
400
|
network: this.network.type
|
|
385
401
|
};
|
|
386
402
|
}
|
|
403
|
+
updateTransactionResult(result) {
|
|
404
|
+
const updateResult = getUpdateTransactionResult();
|
|
405
|
+
if (!updateResult)
|
|
406
|
+
return;
|
|
407
|
+
let receipt = result.receipt;
|
|
408
|
+
if (!receipt && result.confirmation) {
|
|
409
|
+
const conf = result.confirmation;
|
|
410
|
+
const info = conf?.info ?? conf;
|
|
411
|
+
const tx = conf?.transaction ?? conf;
|
|
412
|
+
const blockNumber = info?.blockNumber ?? info?.result?.blockNumber ?? null;
|
|
413
|
+
const rcpt = info?.receipt ?? info?.result?.receipt;
|
|
414
|
+
const ret = tx?.ret ?? tx?.result?.ret;
|
|
415
|
+
const contractRet = Array.isArray(ret) ? ret[0]?.contractRet : void 0;
|
|
416
|
+
receipt = {
|
|
417
|
+
status: contractRet === "SUCCESS" ? 1 : contractRet ? 0 : null,
|
|
418
|
+
blockNumber,
|
|
419
|
+
gasUsed: rcpt?.energy_usage_total != null ? String(rcpt.energy_usage_total) : null
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
updateResult({
|
|
423
|
+
txHash: result.txHash,
|
|
424
|
+
network: this.network.type,
|
|
425
|
+
chain: "tron",
|
|
426
|
+
receipt,
|
|
427
|
+
explorerUrl: `${this.network.explorer}/#/transaction/${result.txHash}`
|
|
428
|
+
});
|
|
429
|
+
}
|
|
387
430
|
};
|
|
388
431
|
|
|
389
432
|
export {
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
abcConnector
|
|
4
|
+
} from "./chunk-2A5XTST5.js";
|
|
5
|
+
import {
|
|
6
|
+
resolveTalkenApiUrl
|
|
7
|
+
} from "./chunk-GFWUFYT2.js";
|
|
8
|
+
import {
|
|
9
|
+
createTalkenApiClient
|
|
10
|
+
} from "./chunk-NP5PWUVU.js";
|
|
11
|
+
import {
|
|
12
|
+
ABC_WALLET_METADATA
|
|
13
|
+
} from "./chunk-RX2VOIUB.js";
|
|
14
|
+
|
|
15
|
+
// src/wallets/walletConnectors/abcWallet/abcWallet.ts
|
|
16
|
+
import { setTalkenApiClient } from "@talken/talkenkit";
|
|
17
|
+
var abcWallet = (specificOptions) => ({ projectId }) => {
|
|
18
|
+
const talkenApiUrl = resolveTalkenApiUrl(specificOptions?.talkenApiUrl);
|
|
19
|
+
const talkenApi = createTalkenApiClient({
|
|
20
|
+
baseUrl: talkenApiUrl,
|
|
21
|
+
debug: specificOptions?.environment === "development"
|
|
22
|
+
});
|
|
23
|
+
setTalkenApiClient(talkenApi);
|
|
24
|
+
const accessKey = specificOptions?.accessKey || (typeof localStorage !== "undefined" ? localStorage.getItem("talken_ak") : null) || null;
|
|
25
|
+
const config = {
|
|
26
|
+
talkenApiUrl,
|
|
27
|
+
apiKey: specificOptions?.apiKey,
|
|
28
|
+
plain: specificOptions?.plain || "",
|
|
29
|
+
// Deprecated - not used (secure.ts uses random generation)
|
|
30
|
+
environment: specificOptions?.environment || "development",
|
|
31
|
+
defaultChainId: specificOptions?.defaultChainId,
|
|
32
|
+
defaultSolanaNetwork: specificOptions?.defaultSolanaNetwork,
|
|
33
|
+
defaultBitcoinNetwork: specificOptions?.defaultBitcoinNetwork,
|
|
34
|
+
projectId,
|
|
35
|
+
...accessKey && { accessKey }
|
|
36
|
+
};
|
|
37
|
+
return {
|
|
38
|
+
id: ABC_WALLET_METADATA.id,
|
|
39
|
+
name: ABC_WALLET_METADATA.name,
|
|
40
|
+
rdns: ABC_WALLET_METADATA.rdns,
|
|
41
|
+
iconUrl: async () => (await import("./abcWallet-AYWSIGAG.js")).default,
|
|
42
|
+
iconBackground: ABC_WALLET_METADATA.iconBackground,
|
|
43
|
+
// Embedded wallet - no installation required
|
|
44
|
+
installed: void 0,
|
|
45
|
+
// No download URLs for embedded wallet
|
|
46
|
+
downloadUrls: void 0,
|
|
47
|
+
// Create connector - wrapper function required by Wallet type
|
|
48
|
+
// If accessKey exists, abcConnector will use AbcAccessKeyProvider internally
|
|
49
|
+
createConnector: (_walletDetails) => abcConnector({ config }),
|
|
50
|
+
// Embedded wallet always available
|
|
51
|
+
hidden: () => false
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export {
|
|
56
|
+
abcWallet
|
|
57
|
+
};
|
|
@@ -1,46 +1,52 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
bestWallet
|
|
4
|
-
} from "./chunk-OPAPBEA5.js";
|
|
5
2
|
import {
|
|
6
3
|
abcWallet
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-WKP53WWR.js";
|
|
5
|
+
import "./chunk-2A5XTST5.js";
|
|
9
6
|
import "./chunk-R6ZE7JAZ.js";
|
|
10
7
|
import "./chunk-GFWUFYT2.js";
|
|
11
|
-
import
|
|
8
|
+
import {
|
|
9
|
+
zealWallet
|
|
10
|
+
} from "./chunk-SCOX5RF4.js";
|
|
11
|
+
import "./chunk-4JZPP3S7.js";
|
|
12
12
|
import "./chunk-O4AU63LK.js";
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-L6FCF3FH.js";
|
|
14
|
+
import "./chunk-OASBABPG.js";
|
|
15
|
+
import "./chunk-PF65YS3T.js";
|
|
16
|
+
import "./chunk-NP5PWUVU.js";
|
|
17
17
|
import "./chunk-4P3SPC44.js";
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-QKK3OPQA.js";
|
|
19
|
+
import "./chunk-RX2VOIUB.js";
|
|
20
|
+
import {
|
|
21
|
+
tokenaryWallet
|
|
22
|
+
} from "./chunk-U24COF36.js";
|
|
23
|
+
import {
|
|
24
|
+
trustWallet
|
|
25
|
+
} from "./chunk-S2PY4MDO.js";
|
|
20
26
|
import {
|
|
21
27
|
uniswapWallet
|
|
22
28
|
} from "./chunk-DLDZUVTB.js";
|
|
23
|
-
import {
|
|
24
|
-
valoraWallet
|
|
25
|
-
} from "./chunk-CVUEWUDI.js";
|
|
26
29
|
import {
|
|
27
30
|
walletConnectWallet
|
|
28
31
|
} from "./chunk-KU5R3WAJ.js";
|
|
32
|
+
import {
|
|
33
|
+
valoraWallet
|
|
34
|
+
} from "./chunk-CVUEWUDI.js";
|
|
29
35
|
import {
|
|
30
36
|
wigwamWallet
|
|
31
37
|
} from "./chunk-EFYKBPOB.js";
|
|
32
38
|
import {
|
|
33
39
|
xdefiWallet
|
|
34
40
|
} from "./chunk-26RJNF7V.js";
|
|
35
|
-
import {
|
|
36
|
-
zealWallet
|
|
37
|
-
} from "./chunk-SCOX5RF4.js";
|
|
38
41
|
import {
|
|
39
42
|
zerionWallet
|
|
40
43
|
} from "./chunk-53IBFGVW.js";
|
|
41
44
|
import {
|
|
42
45
|
safeWallet
|
|
43
46
|
} from "./chunk-Z2QCE6O6.js";
|
|
47
|
+
import {
|
|
48
|
+
safeheronWallet
|
|
49
|
+
} from "./chunk-PHF4VWKP.js";
|
|
44
50
|
import {
|
|
45
51
|
safepalWallet
|
|
46
52
|
} from "./chunk-ATQWOE4J.js";
|
|
@@ -60,11 +66,8 @@ import {
|
|
|
60
66
|
tokenPocketWallet
|
|
61
67
|
} from "./chunk-5NM2LK2G.js";
|
|
62
68
|
import {
|
|
63
|
-
|
|
64
|
-
} from "./chunk-
|
|
65
|
-
import {
|
|
66
|
-
trustWallet
|
|
67
|
-
} from "./chunk-S2PY4MDO.js";
|
|
69
|
+
oneInchWallet
|
|
70
|
+
} from "./chunk-OJT577AY.js";
|
|
68
71
|
import {
|
|
69
72
|
oneKeyWallet
|
|
70
73
|
} from "./chunk-6UGYPEQE.js";
|
|
@@ -87,17 +90,17 @@ import {
|
|
|
87
90
|
roninWallet
|
|
88
91
|
} from "./chunk-D7U5WEH2.js";
|
|
89
92
|
import {
|
|
90
|
-
|
|
91
|
-
} from "./chunk-
|
|
92
|
-
import {
|
|
93
|
-
magicEdenWallet
|
|
94
|
-
} from "./chunk-WB7EEKPS.js";
|
|
93
|
+
ledgerWallet
|
|
94
|
+
} from "./chunk-BF3VSNPL.js";
|
|
95
95
|
import {
|
|
96
96
|
metaMaskWallet
|
|
97
97
|
} from "./chunk-AKLKCDXT.js";
|
|
98
98
|
import {
|
|
99
99
|
mewWallet
|
|
100
100
|
} from "./chunk-ZRY6ILYP.js";
|
|
101
|
+
import {
|
|
102
|
+
magicEdenWallet
|
|
103
|
+
} from "./chunk-WB7EEKPS.js";
|
|
101
104
|
import {
|
|
102
105
|
nestWallet
|
|
103
106
|
} from "./chunk-NN4KGG3I.js";
|
|
@@ -111,14 +114,14 @@ import {
|
|
|
111
114
|
omniWallet
|
|
112
115
|
} from "./chunk-RGPO7AY3.js";
|
|
113
116
|
import {
|
|
114
|
-
|
|
115
|
-
} from "./chunk-
|
|
116
|
-
import {
|
|
117
|
-
injectedWallet
|
|
118
|
-
} from "./chunk-GDGRUMZB.js";
|
|
117
|
+
imTokenWallet
|
|
118
|
+
} from "./chunk-EHE2536P.js";
|
|
119
119
|
import {
|
|
120
120
|
iopayWallet
|
|
121
121
|
} from "./chunk-2W6UBYKX.js";
|
|
122
|
+
import {
|
|
123
|
+
injectedWallet
|
|
124
|
+
} from "./chunk-GDGRUMZB.js";
|
|
122
125
|
import {
|
|
123
126
|
kaiaWallet
|
|
124
127
|
} from "./chunk-C7S72VGD.js";
|
|
@@ -132,20 +135,20 @@ import {
|
|
|
132
135
|
kresusWallet
|
|
133
136
|
} from "./chunk-CM3VR7OM.js";
|
|
134
137
|
import {
|
|
135
|
-
|
|
136
|
-
} from "./chunk-
|
|
138
|
+
coreWallet
|
|
139
|
+
} from "./chunk-FBI7UGNO.js";
|
|
137
140
|
import {
|
|
138
141
|
dawnWallet
|
|
139
142
|
} from "./chunk-YMP3W2MO.js";
|
|
140
143
|
import {
|
|
141
144
|
desigWallet
|
|
142
145
|
} from "./chunk-DVXPOWEC.js";
|
|
143
|
-
import {
|
|
144
|
-
enkryptWallet
|
|
145
|
-
} from "./chunk-5QHPQU7J.js";
|
|
146
146
|
import {
|
|
147
147
|
foxWallet
|
|
148
148
|
} from "./chunk-K6GEK4JB.js";
|
|
149
|
+
import {
|
|
150
|
+
enkryptWallet
|
|
151
|
+
} from "./chunk-5QHPQU7J.js";
|
|
149
152
|
import {
|
|
150
153
|
frameWallet
|
|
151
154
|
} from "./chunk-CP45RGL4.js";
|
|
@@ -155,9 +158,6 @@ import {
|
|
|
155
158
|
import {
|
|
156
159
|
frontierWallet
|
|
157
160
|
} from "./chunk-JWO4ZQLK.js";
|
|
158
|
-
import {
|
|
159
|
-
imTokenWallet
|
|
160
|
-
} from "./chunk-EHE2536P.js";
|
|
161
161
|
import {
|
|
162
162
|
bloomWallet
|
|
163
163
|
} from "./chunk-3KPCADAF.js";
|
|
@@ -173,27 +173,27 @@ import {
|
|
|
173
173
|
import {
|
|
174
174
|
coin98Wallet
|
|
175
175
|
} from "./chunk-GILMNC3J.js";
|
|
176
|
+
import {
|
|
177
|
+
binanceWallet
|
|
178
|
+
} from "./chunk-4T3UOJYR.js";
|
|
176
179
|
import {
|
|
177
180
|
coinbaseWallet
|
|
178
181
|
} from "./chunk-PNEDRY6O.js";
|
|
179
182
|
import {
|
|
180
183
|
compassWallet
|
|
181
184
|
} from "./chunk-3OO564GS.js";
|
|
182
|
-
import {
|
|
183
|
-
coreWallet
|
|
184
|
-
} from "./chunk-FBI7UGNO.js";
|
|
185
185
|
import {
|
|
186
186
|
argentWallet
|
|
187
187
|
} from "./chunk-XT2WYPN5.js";
|
|
188
188
|
import {
|
|
189
|
-
|
|
190
|
-
} from "./chunk-
|
|
189
|
+
bestWallet
|
|
190
|
+
} from "./chunk-OPAPBEA5.js";
|
|
191
191
|
import {
|
|
192
192
|
bifrostWallet
|
|
193
193
|
} from "./chunk-B6DM7J4N.js";
|
|
194
194
|
import {
|
|
195
|
-
|
|
196
|
-
} from "./chunk-
|
|
195
|
+
berasigWallet
|
|
196
|
+
} from "./chunk-KM55XFBI.js";
|
|
197
197
|
import {
|
|
198
198
|
bitgetWallet
|
|
199
199
|
} from "./chunk-CULIWWLV.js";
|
package/package.json
CHANGED
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
getChainKey
|
|
4
|
-
} from "./chunk-K66HU6GX.js";
|
|
5
|
-
import {
|
|
6
|
-
hexToNumber,
|
|
7
|
-
numberToHex
|
|
8
|
-
} from "./chunk-A66MTFML.js";
|
|
9
|
-
|
|
10
|
-
// src/wallets/walletConnectors/abcWallet/abcAccessKeyProvider.ts
|
|
11
|
-
var EventEmitter = class {
|
|
12
|
-
constructor() {
|
|
13
|
-
this.events = /* @__PURE__ */ new Map();
|
|
14
|
-
}
|
|
15
|
-
on(event, listener) {
|
|
16
|
-
if (!this.events.has(event))
|
|
17
|
-
this.events.set(event, []);
|
|
18
|
-
this.events.get(event).push(listener);
|
|
19
|
-
return this;
|
|
20
|
-
}
|
|
21
|
-
off(event, listener) {
|
|
22
|
-
const listeners = this.events.get(event);
|
|
23
|
-
if (listeners) {
|
|
24
|
-
const idx = listeners.indexOf(listener);
|
|
25
|
-
if (idx !== -1)
|
|
26
|
-
listeners.splice(idx, 1);
|
|
27
|
-
}
|
|
28
|
-
return this;
|
|
29
|
-
}
|
|
30
|
-
removeListener(event, listener) {
|
|
31
|
-
return this.off(event, listener);
|
|
32
|
-
}
|
|
33
|
-
emit(event, ...args) {
|
|
34
|
-
const listeners = this.events.get(event);
|
|
35
|
-
if (listeners) {
|
|
36
|
-
for (const listener of listeners)
|
|
37
|
-
listener(...args);
|
|
38
|
-
return true;
|
|
39
|
-
}
|
|
40
|
-
return false;
|
|
41
|
-
}
|
|
42
|
-
removeAllListeners(event) {
|
|
43
|
-
if (event)
|
|
44
|
-
this.events.delete(event);
|
|
45
|
-
else
|
|
46
|
-
this.events.clear();
|
|
47
|
-
return this;
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
var ErrorCode = {
|
|
51
|
-
USER_REJECTED: 4001,
|
|
52
|
-
UNAUTHORIZED: 4100,
|
|
53
|
-
UNSUPPORTED_METHOD: 4200,
|
|
54
|
-
DISCONNECTED: 4900,
|
|
55
|
-
INTERNAL_ERROR: -32603
|
|
56
|
-
};
|
|
57
|
-
var ProviderRpcError = class extends Error {
|
|
58
|
-
constructor(code, message, data) {
|
|
59
|
-
super(message);
|
|
60
|
-
this.code = code;
|
|
61
|
-
this.data = data;
|
|
62
|
-
this.name = "ProviderRpcError";
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
var AbcAccessKeyProvider = class extends EventEmitter {
|
|
66
|
-
constructor(accessKey, apiBaseUrl) {
|
|
67
|
-
super();
|
|
68
|
-
this.wallet = null;
|
|
69
|
-
this.chainId = 1;
|
|
70
|
-
this.connected = false;
|
|
71
|
-
this.accessKey = accessKey;
|
|
72
|
-
this.apiBaseUrl = apiBaseUrl || (typeof window !== "undefined" ? window.__TALKEN_API_URL__ || "" : "");
|
|
73
|
-
}
|
|
74
|
-
// ── Wallet management ─────────────────────────────────────
|
|
75
|
-
setWallet(wallet) {
|
|
76
|
-
this.wallet = wallet;
|
|
77
|
-
this.chainId = wallet.chainId || 1;
|
|
78
|
-
this.connected = true;
|
|
79
|
-
}
|
|
80
|
-
clearWallet() {
|
|
81
|
-
this.wallet = null;
|
|
82
|
-
this.connected = false;
|
|
83
|
-
}
|
|
84
|
-
isConnected() {
|
|
85
|
-
return this.connected && !!this.wallet;
|
|
86
|
-
}
|
|
87
|
-
getWallet() {
|
|
88
|
-
return this.wallet;
|
|
89
|
-
}
|
|
90
|
-
getChainId() {
|
|
91
|
-
return this.chainId;
|
|
92
|
-
}
|
|
93
|
-
setAccessKey(key) {
|
|
94
|
-
this.accessKey = key;
|
|
95
|
-
}
|
|
96
|
-
// ── EIP-1193 request ──────────────────────────────────────
|
|
97
|
-
async request(args) {
|
|
98
|
-
const { method, params } = args;
|
|
99
|
-
switch (method) {
|
|
100
|
-
case "eth_requestAccounts":
|
|
101
|
-
case "eth_accounts":
|
|
102
|
-
return this.wallet ? [this.wallet.address] : [];
|
|
103
|
-
case "eth_chainId":
|
|
104
|
-
return numberToHex(this.chainId);
|
|
105
|
-
case "wallet_switchEthereumChain": {
|
|
106
|
-
const p = params?.[0];
|
|
107
|
-
if (p?.chainId) {
|
|
108
|
-
this.chainId = hexToNumber(p.chainId);
|
|
109
|
-
this.emit("chainChanged", numberToHex(this.chainId));
|
|
110
|
-
}
|
|
111
|
-
return null;
|
|
112
|
-
}
|
|
113
|
-
case "eth_sendTransaction":
|
|
114
|
-
return this.sendTransaction(params);
|
|
115
|
-
case "personal_sign":
|
|
116
|
-
return this.personalSign(params);
|
|
117
|
-
case "eth_signTypedData":
|
|
118
|
-
case "eth_signTypedData_v4":
|
|
119
|
-
return this.signTypedData(params);
|
|
120
|
-
case "eth_estimateGas":
|
|
121
|
-
return this.rpcCall("eth_estimateGas", params);
|
|
122
|
-
case "eth_getTransactionCount":
|
|
123
|
-
return this.rpcCall("eth_getTransactionCount", params);
|
|
124
|
-
case "wallet_getCapabilities":
|
|
125
|
-
return {};
|
|
126
|
-
default:
|
|
127
|
-
return this.rpcCall(method, params);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
// ── Signing via access-key (server-side, no PIN) ──────────
|
|
131
|
-
async sendTransaction(params) {
|
|
132
|
-
if (!this.wallet) {
|
|
133
|
-
throw new ProviderRpcError(
|
|
134
|
-
ErrorCode.UNAUTHORIZED,
|
|
135
|
-
"Wallet not connected"
|
|
136
|
-
);
|
|
137
|
-
}
|
|
138
|
-
const tx = params?.[0];
|
|
139
|
-
if (!tx) {
|
|
140
|
-
throw new ProviderRpcError(
|
|
141
|
-
ErrorCode.INTERNAL_ERROR,
|
|
142
|
-
"Missing transaction params"
|
|
143
|
-
);
|
|
144
|
-
}
|
|
145
|
-
const chainKey = getChainKey(this.chainId);
|
|
146
|
-
const result = await this.apiPost("/tx/relay-execute", {
|
|
147
|
-
chainKey,
|
|
148
|
-
user: this.wallet.address,
|
|
149
|
-
tokenIn: "0x0000000000000000000000000000000000000000",
|
|
150
|
-
amountIn: tx.value || "0",
|
|
151
|
-
target: tx.to,
|
|
152
|
-
targetCalldata: tx.data || "0x",
|
|
153
|
-
deadline: Math.floor(Date.now() / 1e3) + 600,
|
|
154
|
-
auth: { method: "auto" }
|
|
155
|
-
});
|
|
156
|
-
return result?.txHash || result?.hash;
|
|
157
|
-
}
|
|
158
|
-
async personalSign(params) {
|
|
159
|
-
if (!this.wallet) {
|
|
160
|
-
throw new ProviderRpcError(
|
|
161
|
-
ErrorCode.UNAUTHORIZED,
|
|
162
|
-
"Wallet not connected"
|
|
163
|
-
);
|
|
164
|
-
}
|
|
165
|
-
const p = params;
|
|
166
|
-
const message = p?.[0];
|
|
167
|
-
const result = await this.apiPost("/agent/sessions/sign", {
|
|
168
|
-
operation: "signMessage",
|
|
169
|
-
chainId: this.chainId,
|
|
170
|
-
payload: { message }
|
|
171
|
-
});
|
|
172
|
-
return result?.signature;
|
|
173
|
-
}
|
|
174
|
-
async signTypedData(params) {
|
|
175
|
-
if (!this.wallet) {
|
|
176
|
-
throw new ProviderRpcError(
|
|
177
|
-
ErrorCode.UNAUTHORIZED,
|
|
178
|
-
"Wallet not connected"
|
|
179
|
-
);
|
|
180
|
-
}
|
|
181
|
-
const p = params;
|
|
182
|
-
const typedData = typeof p?.[1] === "string" ? JSON.parse(p[1]) : p?.[1];
|
|
183
|
-
const result = await this.apiPost("/agent/sessions/sign", {
|
|
184
|
-
operation: "signTypedData",
|
|
185
|
-
chainId: this.chainId,
|
|
186
|
-
payload: typedData
|
|
187
|
-
});
|
|
188
|
-
return result?.signature;
|
|
189
|
-
}
|
|
190
|
-
// ── HTTP helpers ──────────────────────────────────────────
|
|
191
|
-
async apiPost(path, body) {
|
|
192
|
-
const url = `${this.apiBaseUrl}${path}`;
|
|
193
|
-
const res = await fetch(url, {
|
|
194
|
-
method: "POST",
|
|
195
|
-
headers: {
|
|
196
|
-
"Content-Type": "application/json",
|
|
197
|
-
"X-Access-Key": this.accessKey
|
|
198
|
-
},
|
|
199
|
-
body: JSON.stringify(body)
|
|
200
|
-
});
|
|
201
|
-
if (!res.ok) {
|
|
202
|
-
const err = await res.json().catch(() => ({ message: res.statusText }));
|
|
203
|
-
throw new ProviderRpcError(
|
|
204
|
-
ErrorCode.INTERNAL_ERROR,
|
|
205
|
-
err?.error?.message || err?.message || `API error: ${res.status}`
|
|
206
|
-
);
|
|
207
|
-
}
|
|
208
|
-
const json = await res.json();
|
|
209
|
-
return json?.data || json;
|
|
210
|
-
}
|
|
211
|
-
async rpcCall(method, params) {
|
|
212
|
-
const chainKey = getChainKey(this.chainId);
|
|
213
|
-
const result = await this.apiPost("/rpc", { chainKey, method, params });
|
|
214
|
-
return result?.result ?? result;
|
|
215
|
-
}
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
export {
|
|
219
|
-
AbcAccessKeyProvider
|
|
220
|
-
};
|