@talken/talkenkit 2.7.5-beta.1 → 2.7.5-beta.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/abcWallet-HKEIJA6T.js +172 -0
- package/dist/chunk-CGSOMXYJ.js +5757 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +874 -792
- package/dist/providers/SignConfirmationProvider/SuppressSignConfirmation.d.ts +11 -0
- package/dist/providers/SignConfirmationProvider/index.d.ts +1 -0
- package/dist/providers/TransactionResultProvider/SuppressTransactionResult.d.ts +11 -0
- package/dist/providers/TransactionResultProvider/index.d.ts +1 -0
- package/dist/providers/TransactionResultProvider/types.d.ts +1 -0
- package/dist/wallets/walletConnectors/abcWallet/AbcEvmAutoConnector.js +1 -1
- package/dist/wallets/walletConnectors/abcWallet/AbstractChainProvider.d.ts +9 -0
- package/dist/wallets/walletConnectors/abcWallet/AbstractChainProvider.js +2 -2
- package/dist/wallets/walletConnectors/abcWallet/abcBitcoinConnector.js +2 -2
- package/dist/wallets/walletConnectors/abcWallet/abcBitcoinProvider.js +3 -3
- package/dist/wallets/walletConnectors/abcWallet/abcConnector.js +13 -13
- package/dist/wallets/walletConnectors/abcWallet/abcProvider.js +7 -7
- package/dist/wallets/walletConnectors/abcWallet/abcSolanaProvider.js +9 -9
- package/dist/wallets/walletConnectors/abcWallet/abcTronProvider.js +3 -3
- package/dist/wallets/walletConnectors/abcWallet/abcWallet.js +14 -14
- package/dist/wallets/walletConnectors/abcWallet/api/TalkenApiClient.js +6 -6
- package/dist/wallets/walletConnectors/abcWallet/api/index.js +6 -6
- package/dist/wallets/walletConnectors/abcWallet/api/modules/auth.js +1 -1
- package/dist/wallets/walletConnectors/abcWallet/api/modules/bitcoin.d.ts +1 -1
- package/dist/wallets/walletConnectors/abcWallet/index.js +45 -45
- package/dist/wallets/walletConnectors/abcWallet/types/api.types.d.ts +10 -10
- package/dist/wallets/walletConnectors/abcWallet/types.js +1 -1
- package/dist/wallets/walletConnectors/abcWallet/utils.js +1 -1
- package/dist/wallets/walletConnectors/abcWallet/walletGeneration.js +4 -4
- 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-25VIZXJZ.js +341 -0
- package/dist/wallets/walletConnectors/chunk-26URNKLZ.js +341 -0
- package/dist/wallets/walletConnectors/chunk-2H2JI5BJ.js +108 -0
- package/dist/wallets/walletConnectors/chunk-3QC567QK.js +94 -0
- package/dist/wallets/walletConnectors/chunk-4K2V7RCL.js +96 -0
- package/dist/wallets/walletConnectors/chunk-4QNRNDMZ.js +378 -0
- package/dist/wallets/walletConnectors/chunk-4V3HRM2R.js +95 -0
- package/dist/wallets/walletConnectors/chunk-5QYCHHVB.js +98 -0
- package/dist/wallets/walletConnectors/chunk-6P3FYHAH.js +108 -0
- package/dist/wallets/walletConnectors/chunk-76M232IF.js +101 -0
- package/dist/wallets/walletConnectors/chunk-7IBMHOYD.js +102 -0
- package/dist/wallets/walletConnectors/chunk-ACGSFRMZ.js +73 -0
- package/dist/wallets/walletConnectors/chunk-BZPKBSWY.js +66 -0
- package/dist/wallets/walletConnectors/chunk-CHEPDEJ2.js +73 -0
- package/dist/wallets/walletConnectors/chunk-CMETID7A.js +1463 -0
- package/dist/wallets/walletConnectors/chunk-DDRPEB2X.js +366 -0
- package/dist/wallets/walletConnectors/chunk-DHWJ3552.js +93 -0
- package/dist/wallets/walletConnectors/chunk-DPVILLWF.js +492 -0
- package/dist/wallets/walletConnectors/chunk-EJALZNAR.js +101 -0
- package/dist/wallets/walletConnectors/chunk-FVA6H2VF.js +95 -0
- package/dist/wallets/walletConnectors/chunk-G7QF44XS.js +378 -0
- package/dist/wallets/walletConnectors/chunk-GCHYGJNO.js +131 -0
- package/dist/wallets/walletConnectors/chunk-GNF5CHDQ.js +102 -0
- package/dist/wallets/walletConnectors/chunk-GZPGNUNF.js +94 -0
- package/dist/wallets/walletConnectors/chunk-HALTGRQW.js +87 -0
- package/dist/wallets/walletConnectors/chunk-I2LB6GVH.js +341 -0
- package/dist/wallets/walletConnectors/chunk-JL3QLDZK.js +186 -0
- package/dist/wallets/walletConnectors/chunk-KLCVXROA.js +71 -0
- package/dist/wallets/walletConnectors/chunk-KNNHGFKJ.js +98 -0
- package/dist/wallets/walletConnectors/chunk-KQDFRZT4.js +65 -0
- package/dist/wallets/walletConnectors/chunk-LKNK2KKU.js +76 -0
- package/dist/wallets/walletConnectors/chunk-LLOSDVCH.js +58 -0
- package/dist/wallets/walletConnectors/chunk-MQ57XDYK.js +340 -0
- package/dist/wallets/walletConnectors/chunk-MUAOEA3O.js +103 -0
- package/dist/wallets/walletConnectors/chunk-MVZX47XV.js +366 -0
- package/dist/wallets/walletConnectors/chunk-MWHKTQPO.js +71 -0
- package/dist/wallets/walletConnectors/chunk-MYQPTETH.js +186 -0
- package/dist/wallets/walletConnectors/chunk-NP7RQXKC.js +94 -0
- package/dist/wallets/walletConnectors/chunk-OKTFRDOV.js +340 -0
- package/dist/wallets/walletConnectors/chunk-PXL5G2PM.js +96 -0
- package/dist/wallets/walletConnectors/chunk-QB3QLNSL.js +76 -0
- package/dist/wallets/walletConnectors/chunk-QCM7BJYI.js +366 -0
- package/dist/wallets/walletConnectors/chunk-QRU6XFHH.js +110 -0
- package/dist/wallets/walletConnectors/chunk-RIN5NUVA.js +1463 -0
- package/dist/wallets/walletConnectors/chunk-RM3S3BY3.js +58 -0
- package/dist/wallets/walletConnectors/chunk-S5XGT2XC.js +131 -0
- package/dist/wallets/walletConnectors/chunk-SJ7H7FJB.js +58 -0
- 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-UZAUWE5E.js +27 -0
- package/dist/wallets/walletConnectors/chunk-V2C47DTB.js +66 -0
- package/dist/wallets/walletConnectors/chunk-XFUNA24R.js +195 -0
- package/dist/wallets/walletConnectors/chunk-XS6GJRRA.js +98 -0
- package/dist/wallets/walletConnectors/chunk-XSJUQHR7.js +95 -0
- package/dist/wallets/walletConnectors/chunk-XSX5EECZ.js +96 -0
- package/dist/wallets/walletConnectors/chunk-YJ5RF7V4.js +492 -0
- package/dist/wallets/walletConnectors/clvWallet/clvWallet.js +2 -2
- package/dist/wallets/walletConnectors/coin98Wallet/coin98Wallet.js +2 -2
- package/dist/wallets/walletConnectors/coreWallet/coreWallet.js +2 -2
- package/dist/wallets/walletConnectors/foxWallet/foxWallet.js +2 -2
- package/dist/wallets/walletConnectors/frontierWallet/frontierWallet.js +2 -2
- package/dist/wallets/walletConnectors/gateWallet/gateWallet.js +2 -2
- package/dist/wallets/walletConnectors/index.js +87 -87
- 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 +2 -2
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
getInjectedConnector,
|
|
4
|
+
hasInjectedProvider
|
|
5
|
+
} from "./chunk-PONHGUSY.js";
|
|
6
|
+
import {
|
|
7
|
+
isAndroid
|
|
8
|
+
} from "./chunk-RETKWSKD.js";
|
|
9
|
+
import {
|
|
10
|
+
getWalletConnectConnector
|
|
11
|
+
} from "./chunk-PODFK4OS.js";
|
|
12
|
+
|
|
13
|
+
// src/wallets/walletConnectors/frontierWallet/frontierWallet.ts
|
|
14
|
+
var frontierWallet = ({
|
|
15
|
+
projectId,
|
|
16
|
+
walletConnectParameters
|
|
17
|
+
}) => {
|
|
18
|
+
const isFrontierInjected = hasInjectedProvider({
|
|
19
|
+
namespace: "frontier.ethereum",
|
|
20
|
+
flag: "isFrontier"
|
|
21
|
+
});
|
|
22
|
+
const shouldUseWalletConnect = !isFrontierInjected;
|
|
23
|
+
return {
|
|
24
|
+
id: "frontier",
|
|
25
|
+
name: "Frontier Wallet",
|
|
26
|
+
rdns: "xyz.frontier.wallet",
|
|
27
|
+
installed: isFrontierInjected,
|
|
28
|
+
iconUrl: async () => (await import("./frontierWallet-HNIG7QYQ.js")).default,
|
|
29
|
+
iconBackground: "#CC703C",
|
|
30
|
+
downloadUrls: {
|
|
31
|
+
android: "https://play.google.com/store/apps/details?id=com.frontierwallet",
|
|
32
|
+
ios: "https://apps.apple.com/us/app/frontier-crypto-defi-wallet/id1482380988",
|
|
33
|
+
qrCode: "https://www.frontier.xyz/download",
|
|
34
|
+
chrome: "https://chrome.google.com/webstore/detail/frontier-wallet/kppfdiipphfccemcignhifpjkapfbihd",
|
|
35
|
+
browserExtension: "https://www.frontier.xyz/download"
|
|
36
|
+
},
|
|
37
|
+
mobile: {
|
|
38
|
+
getUri: shouldUseWalletConnect ? (uri) => {
|
|
39
|
+
return isAndroid() ? `frontier://wc?uri=${encodeURIComponent(uri)}` : uri;
|
|
40
|
+
} : void 0
|
|
41
|
+
},
|
|
42
|
+
qrCode: shouldUseWalletConnect ? {
|
|
43
|
+
getUri: (uri) => {
|
|
44
|
+
return isAndroid() ? `frontier://wc?uri=${encodeURIComponent(uri)}` : uri;
|
|
45
|
+
},
|
|
46
|
+
instructions: {
|
|
47
|
+
learnMoreUrl: "https://help.frontier.xyz/en/",
|
|
48
|
+
steps: [
|
|
49
|
+
{
|
|
50
|
+
description: "wallet_connectors.im_token.qr_code.step1.description",
|
|
51
|
+
step: "install",
|
|
52
|
+
title: "wallet_connectors.im_token.qr_code.step1.title"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
description: "wallet_connectors.im_token.qr_code.step2.description",
|
|
56
|
+
step: "create",
|
|
57
|
+
title: "wallet_connectors.im_token.qr_code.step2.title"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
description: "wallet_connectors.im_token.qr_code.step3.description",
|
|
61
|
+
step: "scan",
|
|
62
|
+
title: "wallet_connectors.im_token.qr_code.step3.title"
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
} : void 0,
|
|
67
|
+
extension: {
|
|
68
|
+
instructions: {
|
|
69
|
+
learnMoreUrl: "https://help.frontier.xyz/en/articles/6967236-setting-up-frontier-on-your-device",
|
|
70
|
+
steps: [
|
|
71
|
+
{
|
|
72
|
+
description: "wallet_connectors.frontier.extension.step1.description",
|
|
73
|
+
step: "install",
|
|
74
|
+
title: "wallet_connectors.frontier.extension.step1.title"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
description: "wallet_connectors.frontier.extension.step2.description",
|
|
78
|
+
step: "create",
|
|
79
|
+
title: "wallet_connectors.frontier.extension.step2.title"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
description: "wallet_connectors.frontier.extension.step3.description",
|
|
83
|
+
step: "refresh",
|
|
84
|
+
title: "wallet_connectors.frontier.extension.step3.title"
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
createConnector: shouldUseWalletConnect ? getWalletConnectConnector({ projectId, walletConnectParameters }) : getInjectedConnector({
|
|
90
|
+
namespace: "frontier.ethereum",
|
|
91
|
+
flag: "isFrontier"
|
|
92
|
+
})
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export {
|
|
97
|
+
frontierWallet
|
|
98
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
getInjectedConnector,
|
|
4
|
+
hasInjectedProvider
|
|
5
|
+
} from "./chunk-PONHGUSY.js";
|
|
6
|
+
import {
|
|
7
|
+
getWalletConnectConnector
|
|
8
|
+
} from "./chunk-PODFK4OS.js";
|
|
9
|
+
|
|
10
|
+
// src/wallets/walletConnectors/berasigWallet/berasigWallet.ts
|
|
11
|
+
var berasigWallet = ({
|
|
12
|
+
projectId,
|
|
13
|
+
walletConnectParameters
|
|
14
|
+
}) => {
|
|
15
|
+
const isBerasigWalletInjected = hasInjectedProvider({
|
|
16
|
+
namespace: "berasig.ethereum"
|
|
17
|
+
});
|
|
18
|
+
const shouldUseWalletConnect = !isBerasigWalletInjected;
|
|
19
|
+
return {
|
|
20
|
+
id: "berasig",
|
|
21
|
+
name: "BeraSig",
|
|
22
|
+
iconUrl: async () => (await import("./berasigWallet-NNBFDHFK.js")).default,
|
|
23
|
+
iconBackground: "#ffffff",
|
|
24
|
+
installed: isBerasigWalletInjected,
|
|
25
|
+
downloadUrls: {
|
|
26
|
+
android: "https://play.google.com/store/apps/details?id=io.berasig.ios",
|
|
27
|
+
ios: "https://apps.apple.com/us/app/berasig-wallet-on-berachain/id6502052535",
|
|
28
|
+
qrCode: "https://berasig.com",
|
|
29
|
+
mobile: "https://berasig.com",
|
|
30
|
+
browserExtension: "https://chromewebstore.google.com/detail/berasig/ckedkkegjbflcfblcjklibnedmfjppbj"
|
|
31
|
+
},
|
|
32
|
+
extension: {
|
|
33
|
+
instructions: {
|
|
34
|
+
steps: [
|
|
35
|
+
{
|
|
36
|
+
description: "wallet_connectors.berasig.extension.step1.description",
|
|
37
|
+
step: "install",
|
|
38
|
+
title: "wallet_connectors.berasig.extension.step1.title"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
description: "wallet_connectors.berasig.extension.step2.description",
|
|
42
|
+
step: "create",
|
|
43
|
+
title: "wallet_connectors.berasig.extension.step2.title"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
description: "wallet_connectors.berasig.extension.step3.description",
|
|
47
|
+
step: "refresh",
|
|
48
|
+
title: "wallet_connectors.berasig.extension.step3.title"
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
learnMoreUrl: "https://berasig.com"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
createConnector: shouldUseWalletConnect ? getWalletConnectConnector({
|
|
55
|
+
projectId,
|
|
56
|
+
walletConnectParameters
|
|
57
|
+
}) : getInjectedConnector({
|
|
58
|
+
namespace: "berasig.ethereum"
|
|
59
|
+
})
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export {
|
|
64
|
+
berasigWallet
|
|
65
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
getInjectedConnector,
|
|
4
|
+
hasInjectedProvider
|
|
5
|
+
} from "./chunk-PONHGUSY.js";
|
|
6
|
+
import {
|
|
7
|
+
isAndroid
|
|
8
|
+
} from "./chunk-RETKWSKD.js";
|
|
9
|
+
import {
|
|
10
|
+
getWalletConnectConnector
|
|
11
|
+
} from "./chunk-PODFK4OS.js";
|
|
12
|
+
|
|
13
|
+
// src/wallets/walletConnectors/binanceWallet/binanceWallet.ts
|
|
14
|
+
var binanceWallet = ({
|
|
15
|
+
projectId,
|
|
16
|
+
walletConnectParameters
|
|
17
|
+
}) => {
|
|
18
|
+
const isBinanceInjected = hasInjectedProvider({
|
|
19
|
+
flag: "isBinance"
|
|
20
|
+
});
|
|
21
|
+
const shouldUseWalletConnect = !isBinanceInjected;
|
|
22
|
+
return {
|
|
23
|
+
id: "binance",
|
|
24
|
+
name: "Binance Wallet",
|
|
25
|
+
rdns: "com.binance.wallet",
|
|
26
|
+
iconUrl: async () => (await import("./binanceWallet-BCWLBY3Q.js")).default,
|
|
27
|
+
iconBackground: "#000000",
|
|
28
|
+
installed: !shouldUseWalletConnect ? isBinanceInjected : void 0,
|
|
29
|
+
downloadUrls: {
|
|
30
|
+
android: "https://play.google.com/store/apps/details?id=com.binance.dev",
|
|
31
|
+
ios: "https://apps.apple.com/us/app/id1436799971",
|
|
32
|
+
mobile: "https://www.binance.com/en/download",
|
|
33
|
+
qrCode: "https://www.binance.com/en/web3wallet"
|
|
34
|
+
},
|
|
35
|
+
mobile: shouldUseWalletConnect ? {
|
|
36
|
+
getUri: (uri) => {
|
|
37
|
+
return isAndroid() ? uri : `bnc://app.binance.com/cedefi/wc?uri=${encodeURIComponent(
|
|
38
|
+
uri
|
|
39
|
+
)}`;
|
|
40
|
+
}
|
|
41
|
+
} : void 0,
|
|
42
|
+
qrCode: shouldUseWalletConnect ? {
|
|
43
|
+
getUri: (uri) => uri,
|
|
44
|
+
instructions: {
|
|
45
|
+
learnMoreUrl: "https://www.binance.com/en/web3wallet",
|
|
46
|
+
steps: [
|
|
47
|
+
{
|
|
48
|
+
description: "wallet_connectors.binance.qr_code.step1.description",
|
|
49
|
+
step: "install",
|
|
50
|
+
title: "wallet_connectors.binance.qr_code.step1.title"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
description: "wallet_connectors.binance.qr_code.step2.description",
|
|
54
|
+
step: "create",
|
|
55
|
+
title: "wallet_connectors.binance.qr_code.step2.title"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
description: "wallet_connectors.binance.qr_code.step3.description",
|
|
59
|
+
step: "scan",
|
|
60
|
+
title: "wallet_connectors.binance.qr_code.step3.title"
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
} : void 0,
|
|
65
|
+
createConnector: shouldUseWalletConnect ? getWalletConnectConnector({
|
|
66
|
+
projectId,
|
|
67
|
+
walletConnectParameters
|
|
68
|
+
}) : getInjectedConnector({
|
|
69
|
+
flag: "isBinance"
|
|
70
|
+
})
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export {
|
|
75
|
+
binanceWallet
|
|
76
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
abcConnector
|
|
4
|
+
} from "./chunk-25VIZXJZ.js";
|
|
5
|
+
import {
|
|
6
|
+
resolveTalkenApiUrl
|
|
7
|
+
} from "./chunk-GFWUFYT2.js";
|
|
8
|
+
import {
|
|
9
|
+
createTalkenApiClient
|
|
10
|
+
} from "./chunk-DDRPEB2X.js";
|
|
11
|
+
import {
|
|
12
|
+
ABC_WALLET_METADATA,
|
|
13
|
+
loadTgAccessKey
|
|
14
|
+
} from "./chunk-6KRX73ED.js";
|
|
15
|
+
|
|
16
|
+
// src/wallets/walletConnectors/abcWallet/abcWallet.ts
|
|
17
|
+
import { setTalkenApiClient } from "@talken/talkenkit";
|
|
18
|
+
var abcWallet = (specificOptions) => ({ projectId }) => {
|
|
19
|
+
const talkenApiUrl = resolveTalkenApiUrl(specificOptions?.talkenApiUrl);
|
|
20
|
+
const talkenApi = createTalkenApiClient({
|
|
21
|
+
baseUrl: talkenApiUrl,
|
|
22
|
+
debug: specificOptions?.environment === "development"
|
|
23
|
+
});
|
|
24
|
+
setTalkenApiClient(talkenApi);
|
|
25
|
+
const accessKey = specificOptions?.accessKey || loadTgAccessKey() || null;
|
|
26
|
+
const config = {
|
|
27
|
+
talkenApiUrl,
|
|
28
|
+
apiKey: specificOptions?.apiKey,
|
|
29
|
+
plain: specificOptions?.plain || "",
|
|
30
|
+
// Deprecated - not used (secure.ts uses random generation)
|
|
31
|
+
environment: specificOptions?.environment || "development",
|
|
32
|
+
defaultChainId: specificOptions?.defaultChainId,
|
|
33
|
+
defaultSolanaNetwork: specificOptions?.defaultSolanaNetwork,
|
|
34
|
+
defaultBitcoinNetwork: specificOptions?.defaultBitcoinNetwork,
|
|
35
|
+
projectId,
|
|
36
|
+
...accessKey && { accessKey }
|
|
37
|
+
};
|
|
38
|
+
return {
|
|
39
|
+
id: ABC_WALLET_METADATA.id,
|
|
40
|
+
name: ABC_WALLET_METADATA.name,
|
|
41
|
+
rdns: ABC_WALLET_METADATA.rdns,
|
|
42
|
+
iconUrl: async () => (await import("./abcWallet-4PXRQO5T.js")).default,
|
|
43
|
+
iconBackground: ABC_WALLET_METADATA.iconBackground,
|
|
44
|
+
// Embedded wallet - no installation required
|
|
45
|
+
installed: void 0,
|
|
46
|
+
// No download URLs for embedded wallet
|
|
47
|
+
downloadUrls: void 0,
|
|
48
|
+
// Create connector - wrapper function required by Wallet type
|
|
49
|
+
// If accessKey exists, abcConnector will use AbcAccessKeyProvider internally
|
|
50
|
+
createConnector: (_walletDetails) => abcConnector({ config }),
|
|
51
|
+
// Embedded wallet always available
|
|
52
|
+
hidden: () => false
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export {
|
|
57
|
+
abcWallet
|
|
58
|
+
};
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
AbstractChainProvider
|
|
4
|
+
} from "./chunk-S5XGT2XC.js";
|
|
5
|
+
import {
|
|
6
|
+
ProviderErrorCode,
|
|
7
|
+
TronProviderError
|
|
8
|
+
} from "./chunk-GJ4CJL7F.js";
|
|
9
|
+
import {
|
|
10
|
+
createLogger
|
|
11
|
+
} from "./chunk-762I67R6.js";
|
|
12
|
+
import {
|
|
13
|
+
getCredentialManager
|
|
14
|
+
} from "./chunk-P6KWAOFF.js";
|
|
15
|
+
|
|
16
|
+
// src/wallets/walletConnectors/abcWallet/abcTronProvider.ts
|
|
17
|
+
import { keccak256 } from "viem";
|
|
18
|
+
var logger = createLogger("TronProvider");
|
|
19
|
+
function isTalkenApiClient(client) {
|
|
20
|
+
return typeof client?.tron?.transferTrx === "function";
|
|
21
|
+
}
|
|
22
|
+
var TRON_NETWORKS = {
|
|
23
|
+
mainnet: {
|
|
24
|
+
name: "TRON Mainnet",
|
|
25
|
+
type: "tron",
|
|
26
|
+
explorer: "https://tronscan.org"
|
|
27
|
+
},
|
|
28
|
+
nile: {
|
|
29
|
+
name: "TRON Nile Testnet",
|
|
30
|
+
type: "tron_nile",
|
|
31
|
+
explorer: "https://nile.tronscan.org"
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
var AbcTronProvider = class extends AbstractChainProvider {
|
|
35
|
+
constructor(client) {
|
|
36
|
+
super(isTalkenApiClient(client) ? client : void 0);
|
|
37
|
+
this.network = TRON_NETWORKS.mainnet;
|
|
38
|
+
this.tokenMetadataCache = /* @__PURE__ */ new Map();
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Call request interceptor if set (throws on user cancel)
|
|
42
|
+
*/
|
|
43
|
+
async callInterceptor(request) {
|
|
44
|
+
if (this.requestInterceptor) {
|
|
45
|
+
await this.requestInterceptor(request);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
onWalletSet(wallet) {
|
|
49
|
+
if (wallet.network === "tron") {
|
|
50
|
+
this.network = TRON_NETWORKS.mainnet;
|
|
51
|
+
} else {
|
|
52
|
+
this.network = TRON_NETWORKS.nile;
|
|
53
|
+
}
|
|
54
|
+
this.emit("connect", {
|
|
55
|
+
address: wallet.address,
|
|
56
|
+
network: this.network.type
|
|
57
|
+
});
|
|
58
|
+
logger.info(
|
|
59
|
+
"Wallet connected:",
|
|
60
|
+
`${wallet.address.substring(0, 6)}...${wallet.address.substring(wallet.address.length - 6)}`
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
clearWallet() {
|
|
64
|
+
super.clearWallet();
|
|
65
|
+
logger.info("Wallet disconnected");
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Fetch token metadata (symbol, logo) from walletscan API with caching.
|
|
69
|
+
* Falls back to 'TRX'/'TRC20' on failure.
|
|
70
|
+
*/
|
|
71
|
+
async fetchTokenMetadata(contractAddress) {
|
|
72
|
+
const cacheKey = contractAddress || "__native__";
|
|
73
|
+
const cached = this.tokenMetadataCache.get(cacheKey);
|
|
74
|
+
if (cached)
|
|
75
|
+
return cached;
|
|
76
|
+
try {
|
|
77
|
+
const api = this.getTalkenApiClientOrThrow();
|
|
78
|
+
const chainKeys = this.network.type === "tron_nile" ? "tronNile" : "tron";
|
|
79
|
+
let tokens;
|
|
80
|
+
if (contractAddress) {
|
|
81
|
+
tokens = await api.walletscan.getToken({ chainKeys, contractAddress });
|
|
82
|
+
} else {
|
|
83
|
+
tokens = await api.walletscan.getNativeTokens({
|
|
84
|
+
chainKeys,
|
|
85
|
+
walletAddress: this.wallet.address
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
if (tokens.length > 0) {
|
|
89
|
+
const info = { symbol: tokens[0].symbol, logo: tokens[0].logo };
|
|
90
|
+
this.tokenMetadataCache.set(cacheKey, info);
|
|
91
|
+
return info;
|
|
92
|
+
}
|
|
93
|
+
} catch {
|
|
94
|
+
}
|
|
95
|
+
return { symbol: contractAddress ? "TRC20" : "TRX" };
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Check if connected
|
|
99
|
+
*/
|
|
100
|
+
/**
|
|
101
|
+
* Get TRON address
|
|
102
|
+
*/
|
|
103
|
+
async getAddress() {
|
|
104
|
+
if (!this.wallet) {
|
|
105
|
+
throw new TronProviderError(
|
|
106
|
+
ProviderErrorCode.DISCONNECTED,
|
|
107
|
+
"Wallet not connected"
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
return this.wallet.address;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Get public key
|
|
114
|
+
*/
|
|
115
|
+
async getPublicKey() {
|
|
116
|
+
if (!this.wallet) {
|
|
117
|
+
throw new TronProviderError(
|
|
118
|
+
ProviderErrorCode.DISCONNECTED,
|
|
119
|
+
"Wallet not connected"
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
return this.wallet.publicKey;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Get current network
|
|
126
|
+
*/
|
|
127
|
+
getNetwork() {
|
|
128
|
+
return this.network;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Sign TRON message using secp256k1 MPC (signHash)
|
|
132
|
+
* Convention: keccak256("\x19TRON Signed Message:\n" + length + message)
|
|
133
|
+
*/
|
|
134
|
+
async signMessage(message) {
|
|
135
|
+
if (!this.wallet) {
|
|
136
|
+
throw new TronProviderError(
|
|
137
|
+
ProviderErrorCode.DISCONNECTED,
|
|
138
|
+
"Wallet not connected"
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
try {
|
|
142
|
+
await this.callInterceptor({
|
|
143
|
+
chain: "tron",
|
|
144
|
+
method: "signMessage",
|
|
145
|
+
address: this.wallet.address,
|
|
146
|
+
network: this.network.type,
|
|
147
|
+
message
|
|
148
|
+
});
|
|
149
|
+
logger.info("Signing TRON message...");
|
|
150
|
+
const msgBytes = new TextEncoder().encode(message);
|
|
151
|
+
const prefix = new TextEncoder().encode(
|
|
152
|
+
`TRON Signed Message:
|
|
153
|
+
${msgBytes.length}`
|
|
154
|
+
);
|
|
155
|
+
const prefixed = new Uint8Array(prefix.length + msgBytes.length);
|
|
156
|
+
prefixed.set(prefix);
|
|
157
|
+
prefixed.set(msgBytes, prefix.length);
|
|
158
|
+
const hash = keccak256(prefixed);
|
|
159
|
+
const pinHash = getCredentialManager().getPinHash() || void 0;
|
|
160
|
+
const email = getCredentialManager().getEmail() || void 0;
|
|
161
|
+
const api = this.getTalkenApiClientOrThrow();
|
|
162
|
+
const result = await api.bitcoin.signHash({
|
|
163
|
+
hash: hash.startsWith("0x") ? hash.slice(2) : hash,
|
|
164
|
+
pin: pinHash || "",
|
|
165
|
+
network: this.network.type,
|
|
166
|
+
...email && { email }
|
|
167
|
+
});
|
|
168
|
+
const signature = result.signstr.startsWith("0x") ? result.signstr : `0x${result.signstr}`;
|
|
169
|
+
logger.info("Message signed successfully");
|
|
170
|
+
return signature;
|
|
171
|
+
} catch (error) {
|
|
172
|
+
logger.error("Message signing failed:", error.message);
|
|
173
|
+
throw new TronProviderError(
|
|
174
|
+
ProviderErrorCode.INTERNAL_ERROR,
|
|
175
|
+
error.message || "Failed to sign TRON message",
|
|
176
|
+
error
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Send TRON transaction (TRX native or TRC20)
|
|
182
|
+
* Complete flow: create unsigned tx -> request PIN -> sign -> broadcast
|
|
183
|
+
*
|
|
184
|
+
* @param params - Transaction parameters
|
|
185
|
+
* @returns Transaction hash
|
|
186
|
+
*/
|
|
187
|
+
async sendTransaction(params) {
|
|
188
|
+
if (!this.wallet) {
|
|
189
|
+
throw new TronProviderError(
|
|
190
|
+
ProviderErrorCode.DISCONNECTED,
|
|
191
|
+
"Wallet not connected"
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
try {
|
|
195
|
+
const tokenMetadata = await this.fetchTokenMetadata(
|
|
196
|
+
params.contractAddress
|
|
197
|
+
);
|
|
198
|
+
await this.callInterceptor({
|
|
199
|
+
chain: "tron",
|
|
200
|
+
method: "sendTransaction",
|
|
201
|
+
fromAddress: this.wallet.address,
|
|
202
|
+
toAddress: params.toAddress,
|
|
203
|
+
amount: params.amount,
|
|
204
|
+
symbol: tokenMetadata.symbol,
|
|
205
|
+
network: this.network.type,
|
|
206
|
+
tokenAddress: params.contractAddress,
|
|
207
|
+
isNativeToken: !params.contractAddress,
|
|
208
|
+
feeSymbol: "TRX",
|
|
209
|
+
tokenLogo: tokenMetadata.logo
|
|
210
|
+
});
|
|
211
|
+
logger.info("Starting TRON transaction...");
|
|
212
|
+
const api = this.getTalkenApiClientOrThrow();
|
|
213
|
+
const pinHash = api.isAccessKeyMode() ? void 0 : getCredentialManager().getPinHash();
|
|
214
|
+
if (!pinHash && !api.isAccessKeyMode()) {
|
|
215
|
+
throw new TronProviderError(
|
|
216
|
+
ProviderErrorCode.INTERNAL_ERROR,
|
|
217
|
+
"PIN hash not found. Please login again."
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
const txType = params.contractAddress ? "TRC20" : "NATIVE";
|
|
221
|
+
let amountRaw;
|
|
222
|
+
if (txType === "NATIVE") {
|
|
223
|
+
amountRaw = Math.floor(
|
|
224
|
+
Number.parseFloat(params.amount) * 1e6
|
|
225
|
+
).toString();
|
|
226
|
+
logger.debug(`Converting ${params.amount} TRX -> ${amountRaw} SUN`);
|
|
227
|
+
} else {
|
|
228
|
+
const decimals = params.decimals ?? 6;
|
|
229
|
+
amountRaw = Math.floor(
|
|
230
|
+
Number.parseFloat(params.amount) * 10 ** decimals
|
|
231
|
+
).toString();
|
|
232
|
+
logger.debug(
|
|
233
|
+
`Converting ${params.amount} -> ${amountRaw} (decimals: ${decimals})`
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
const email = getCredentialManager().getEmail() || void 0;
|
|
237
|
+
const request = txType === "NATIVE" ? {
|
|
238
|
+
kind: "native",
|
|
239
|
+
network: this.network.type,
|
|
240
|
+
toAddress: params.toAddress,
|
|
241
|
+
amountSun: amountRaw,
|
|
242
|
+
pin: pinHash || void 0,
|
|
243
|
+
waitForConfirmation: true,
|
|
244
|
+
...email && { email }
|
|
245
|
+
} : {
|
|
246
|
+
kind: "trc20",
|
|
247
|
+
network: this.network.type,
|
|
248
|
+
toAddress: params.toAddress,
|
|
249
|
+
contractAddress: params.contractAddress,
|
|
250
|
+
amount: amountRaw,
|
|
251
|
+
feeLimit: params.feeLimit,
|
|
252
|
+
pin: pinHash || void 0,
|
|
253
|
+
waitForConfirmation: true,
|
|
254
|
+
...email && { email }
|
|
255
|
+
};
|
|
256
|
+
this.showPendingTx({ network: this.network.type, chain: "tron" });
|
|
257
|
+
const result = await api.tron.transferTrx(request);
|
|
258
|
+
const txHash = result.txHash;
|
|
259
|
+
this.updateTronTransactionResult(result);
|
|
260
|
+
logger.info(
|
|
261
|
+
`${txType === "NATIVE" ? "TRX" : "TRC-20"} transaction complete via TalkenApiClient:`,
|
|
262
|
+
txHash
|
|
263
|
+
);
|
|
264
|
+
this.emit("transactionBroadcasted", {
|
|
265
|
+
txHash,
|
|
266
|
+
explorerUrl: `${this.network.explorer}/#/transaction/${txHash}`
|
|
267
|
+
});
|
|
268
|
+
return txHash;
|
|
269
|
+
} catch (error) {
|
|
270
|
+
if (error.message?.includes("cancelled") || error.message?.includes("rejected")) {
|
|
271
|
+
logger.info("User cancelled transaction");
|
|
272
|
+
throw new TronProviderError(
|
|
273
|
+
ProviderErrorCode.USER_REJECTED,
|
|
274
|
+
"User rejected transaction",
|
|
275
|
+
error
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
logger.error("Transaction failed:", error.message);
|
|
279
|
+
this.failTxResult({
|
|
280
|
+
network: this.network.type,
|
|
281
|
+
chain: "tron",
|
|
282
|
+
errorMessage: error.message
|
|
283
|
+
});
|
|
284
|
+
if (error.message?.includes("insufficient")) {
|
|
285
|
+
throw new TronProviderError(
|
|
286
|
+
ProviderErrorCode.INSUFFICIENT_FUNDS,
|
|
287
|
+
"Insufficient TRX balance",
|
|
288
|
+
error
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
this.emit("error", error);
|
|
292
|
+
throw new TronProviderError(
|
|
293
|
+
ProviderErrorCode.INTERNAL_ERROR,
|
|
294
|
+
error.message || "Failed to send TRON transaction",
|
|
295
|
+
error
|
|
296
|
+
);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Get wallet info
|
|
301
|
+
*/
|
|
302
|
+
getWalletInfo() {
|
|
303
|
+
if (!this.wallet)
|
|
304
|
+
return null;
|
|
305
|
+
return {
|
|
306
|
+
address: this.wallet.address,
|
|
307
|
+
publicKey: this.wallet.publicKey,
|
|
308
|
+
network: this.network.type
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
updateTronTransactionResult(result) {
|
|
312
|
+
let receipt = result.receipt;
|
|
313
|
+
if (!receipt && result.confirmation) {
|
|
314
|
+
const conf = result.confirmation;
|
|
315
|
+
const info = conf?.info ?? conf;
|
|
316
|
+
const tx = conf?.transaction ?? conf;
|
|
317
|
+
const blockNumber = info?.blockNumber ?? info?.result?.blockNumber ?? null;
|
|
318
|
+
const rcpt = info?.receipt ?? info?.result?.receipt;
|
|
319
|
+
const ret = tx?.ret ?? tx?.result?.ret;
|
|
320
|
+
const contractRet = Array.isArray(ret) ? ret[0]?.contractRet : void 0;
|
|
321
|
+
receipt = {
|
|
322
|
+
status: contractRet === "SUCCESS" ? 1 : contractRet ? 0 : null,
|
|
323
|
+
blockNumber,
|
|
324
|
+
gasUsed: rcpt?.energy_usage_total != null ? String(rcpt.energy_usage_total) : null
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
this.updateTxResult({
|
|
328
|
+
txHash: result.txHash,
|
|
329
|
+
network: this.network.type,
|
|
330
|
+
chain: "tron",
|
|
331
|
+
receipt,
|
|
332
|
+
explorerUrl: `${this.network.explorer}/#/transaction/${result.txHash}`
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
export {
|
|
338
|
+
TRON_NETWORKS,
|
|
339
|
+
AbcTronProvider
|
|
340
|
+
};
|