@multiplatform.one/web3 8.3.0 → 8.5.0

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.
Files changed (173) hide show
  1. package/README.md +33 -2
  2. package/dist/cjs/clients/tron.cjs +176 -0
  3. package/dist/cjs/clients/tron.native.js +318 -0
  4. package/dist/cjs/clients/tron.native.js.map +1 -0
  5. package/dist/cjs/clients/useTronClient.cjs +50 -0
  6. package/dist/cjs/clients/useTronClient.native.js +63 -0
  7. package/dist/cjs/clients/useTronClient.native.js.map +1 -0
  8. package/dist/cjs/connectkit/adapters/TronAdapter.cjs +139 -0
  9. package/dist/cjs/connectkit/adapters/TronAdapter.native.js +217 -0
  10. package/dist/cjs/connectkit/adapters/TronAdapter.native.js.map +1 -0
  11. package/dist/cjs/connectkit/connectors/createWalletMessage.cjs +3 -3
  12. package/dist/cjs/connectkit/connectors/createWalletMessage.native.js +3 -3
  13. package/dist/cjs/connectkit/connectors/createWalletMessage.native.js.map +1 -1
  14. package/dist/cjs/connectkit/connectors/ensureWalletConnectors.cjs +2 -1
  15. package/dist/cjs/connectkit/connectors/ensureWalletConnectors.native.js +18 -35
  16. package/dist/cjs/connectkit/connectors/ensureWalletConnectors.native.js.map +1 -1
  17. package/dist/cjs/connectkit/connectors/syntheticChains.cjs +10 -4
  18. package/dist/cjs/connectkit/connectors/syntheticChains.native.js +10 -4
  19. package/dist/cjs/connectkit/connectors/syntheticChains.native.js.map +1 -1
  20. package/dist/cjs/connectkit/defaultConfig.cjs +2 -1
  21. package/dist/cjs/connectkit/defaultConfig.native.js +2 -1
  22. package/dist/cjs/connectkit/defaultConfig.native.js.map +1 -1
  23. package/dist/cjs/connectkit/wallets/walletConfigs.cjs +12 -0
  24. package/dist/cjs/connectkit/wallets/walletConfigs.native.js +12 -0
  25. package/dist/cjs/connectkit/wallets/walletConfigs.native.js.map +1 -1
  26. package/dist/cjs/families/host.native.js.map +1 -1
  27. package/dist/cjs/families/tron.cjs +92 -0
  28. package/dist/cjs/families/tron.native.js +120 -0
  29. package/dist/cjs/families/tron.native.js.map +1 -0
  30. package/dist/cjs/providers/WalletProvider.cjs +3 -2
  31. package/dist/cjs/tron.cjs +46 -0
  32. package/dist/cjs/tron.native.js +49 -0
  33. package/dist/cjs/tron.native.js.map +1 -0
  34. package/dist/cjs/wagmi/host.cjs +9 -4
  35. package/dist/cjs/wagmi/host.native.js +6 -3
  36. package/dist/cjs/wagmi/host.native.js.map +1 -1
  37. package/dist/esm/clients/tron.mjs +133 -0
  38. package/dist/esm/clients/tron.mjs.map +1 -0
  39. package/dist/esm/clients/tron.native.js +272 -0
  40. package/dist/esm/clients/tron.native.js.map +1 -0
  41. package/dist/esm/clients/useTronClient.mjs +25 -0
  42. package/dist/esm/clients/useTronClient.mjs.map +1 -0
  43. package/dist/esm/clients/useTronClient.native.js +35 -0
  44. package/dist/esm/clients/useTronClient.native.js.map +1 -0
  45. package/dist/esm/connectkit/adapters/TronAdapter.mjs +111 -0
  46. package/dist/esm/connectkit/adapters/TronAdapter.mjs.map +1 -0
  47. package/dist/esm/connectkit/adapters/TronAdapter.native.js +186 -0
  48. package/dist/esm/connectkit/adapters/TronAdapter.native.js.map +1 -0
  49. package/dist/esm/connectkit/connectors/createWalletMessage.mjs +3 -3
  50. package/dist/esm/connectkit/connectors/createWalletMessage.mjs.map +1 -1
  51. package/dist/esm/connectkit/connectors/createWalletMessage.native.js +3 -3
  52. package/dist/esm/connectkit/connectors/createWalletMessage.native.js.map +1 -1
  53. package/dist/esm/connectkit/connectors/ensureWalletConnectors.mjs +2 -1
  54. package/dist/esm/connectkit/connectors/ensureWalletConnectors.mjs.map +1 -1
  55. package/dist/esm/connectkit/connectors/ensureWalletConnectors.native.js +18 -35
  56. package/dist/esm/connectkit/connectors/ensureWalletConnectors.native.js.map +1 -1
  57. package/dist/esm/connectkit/connectors/syntheticChains.mjs +8 -4
  58. package/dist/esm/connectkit/connectors/syntheticChains.mjs.map +1 -1
  59. package/dist/esm/connectkit/connectors/syntheticChains.native.js +8 -4
  60. package/dist/esm/connectkit/connectors/syntheticChains.native.js.map +1 -1
  61. package/dist/esm/connectkit/defaultConfig.mjs +2 -1
  62. package/dist/esm/connectkit/defaultConfig.mjs.map +1 -1
  63. package/dist/esm/connectkit/defaultConfig.native.js +2 -1
  64. package/dist/esm/connectkit/defaultConfig.native.js.map +1 -1
  65. package/dist/esm/connectkit/wallets/walletConfigs.mjs +12 -0
  66. package/dist/esm/connectkit/wallets/walletConfigs.mjs.map +1 -1
  67. package/dist/esm/connectkit/wallets/walletConfigs.native.js +12 -0
  68. package/dist/esm/connectkit/wallets/walletConfigs.native.js.map +1 -1
  69. package/dist/esm/families/host.mjs.map +1 -1
  70. package/dist/esm/families/host.native.js.map +1 -1
  71. package/dist/esm/families/tron.mjs +65 -0
  72. package/dist/esm/families/tron.mjs.map +1 -0
  73. package/dist/esm/families/tron.native.js +90 -0
  74. package/dist/esm/families/tron.native.js.map +1 -0
  75. package/dist/esm/providers/WalletProvider.mjs +3 -2
  76. package/dist/esm/providers/WalletProvider.mjs.map +1 -1
  77. package/dist/esm/tron.mjs +6 -0
  78. package/dist/esm/tron.mjs.map +1 -0
  79. package/dist/esm/tron.native.js +6 -0
  80. package/dist/esm/tron.native.js.map +1 -0
  81. package/dist/esm/wagmi/host.mjs +9 -4
  82. package/dist/esm/wagmi/host.mjs.map +1 -1
  83. package/dist/esm/wagmi/host.native.js +6 -3
  84. package/dist/esm/wagmi/host.native.js.map +1 -1
  85. package/dist/jsx/clients/tron.mjs +133 -0
  86. package/dist/jsx/clients/tron.mjs.map +1 -0
  87. package/dist/jsx/clients/tron.native.js +318 -0
  88. package/dist/jsx/clients/tron.native.js.map +1 -0
  89. package/dist/jsx/clients/useTronClient.mjs +25 -0
  90. package/dist/jsx/clients/useTronClient.mjs.map +1 -0
  91. package/dist/jsx/clients/useTronClient.native.js +63 -0
  92. package/dist/jsx/clients/useTronClient.native.js.map +1 -0
  93. package/dist/jsx/connectkit/adapters/TronAdapter.mjs +111 -0
  94. package/dist/jsx/connectkit/adapters/TronAdapter.mjs.map +1 -0
  95. package/dist/jsx/connectkit/adapters/TronAdapter.native.js +217 -0
  96. package/dist/jsx/connectkit/adapters/TronAdapter.native.js.map +1 -0
  97. package/dist/jsx/connectkit/connectors/createWalletMessage.mjs +3 -3
  98. package/dist/jsx/connectkit/connectors/createWalletMessage.mjs.map +1 -1
  99. package/dist/jsx/connectkit/connectors/createWalletMessage.native.js +3 -3
  100. package/dist/jsx/connectkit/connectors/createWalletMessage.native.js.map +1 -1
  101. package/dist/jsx/connectkit/connectors/ensureWalletConnectors.mjs +2 -1
  102. package/dist/jsx/connectkit/connectors/ensureWalletConnectors.mjs.map +1 -1
  103. package/dist/jsx/connectkit/connectors/ensureWalletConnectors.native.js +18 -35
  104. package/dist/jsx/connectkit/connectors/ensureWalletConnectors.native.js.map +1 -1
  105. package/dist/jsx/connectkit/connectors/syntheticChains.mjs +8 -4
  106. package/dist/jsx/connectkit/connectors/syntheticChains.mjs.map +1 -1
  107. package/dist/jsx/connectkit/connectors/syntheticChains.native.js +10 -4
  108. package/dist/jsx/connectkit/connectors/syntheticChains.native.js.map +1 -1
  109. package/dist/jsx/connectkit/defaultConfig.mjs +2 -1
  110. package/dist/jsx/connectkit/defaultConfig.mjs.map +1 -1
  111. package/dist/jsx/connectkit/defaultConfig.native.js +2 -1
  112. package/dist/jsx/connectkit/defaultConfig.native.js.map +1 -1
  113. package/dist/jsx/connectkit/wallets/walletConfigs.mjs +12 -0
  114. package/dist/jsx/connectkit/wallets/walletConfigs.mjs.map +1 -1
  115. package/dist/jsx/connectkit/wallets/walletConfigs.native.js +12 -0
  116. package/dist/jsx/connectkit/wallets/walletConfigs.native.js.map +1 -1
  117. package/dist/jsx/families/host.mjs.map +1 -1
  118. package/dist/jsx/families/host.native.js.map +1 -1
  119. package/dist/jsx/families/tron.mjs +65 -0
  120. package/dist/jsx/families/tron.mjs.map +1 -0
  121. package/dist/jsx/families/tron.native.js +120 -0
  122. package/dist/jsx/families/tron.native.js.map +1 -0
  123. package/dist/jsx/providers/WalletProvider.mjs +3 -2
  124. package/dist/jsx/providers/WalletProvider.mjs.map +1 -1
  125. package/dist/jsx/tron.mjs +6 -0
  126. package/dist/jsx/tron.mjs.map +1 -0
  127. package/dist/jsx/tron.native.js +49 -0
  128. package/dist/jsx/tron.native.js.map +1 -0
  129. package/dist/jsx/wagmi/host.mjs +9 -4
  130. package/dist/jsx/wagmi/host.mjs.map +1 -1
  131. package/dist/jsx/wagmi/host.native.js +6 -3
  132. package/dist/jsx/wagmi/host.native.js.map +1 -1
  133. package/dist/keycloak/login.iife.js +380 -380
  134. package/package.json +13 -7
  135. package/src/clients/tron.spec.ts +118 -0
  136. package/src/clients/tron.ts +186 -0
  137. package/src/clients/useTronClient.ts +26 -0
  138. package/src/connectkit/adapters/TronAdapter.spec.ts +155 -0
  139. package/src/connectkit/adapters/TronAdapter.ts +168 -0
  140. package/src/connectkit/adapters/discover.ts +1 -1
  141. package/src/connectkit/connectors/createWalletMessage.ts +3 -3
  142. package/src/connectkit/connectors/ensureWalletConnectors.ts +2 -1
  143. package/src/connectkit/connectors/syntheticChains.ts +8 -2
  144. package/src/connectkit/defaultConfig.ts +5 -2
  145. package/src/connectkit/wallets/walletConfigs.tsx +8 -0
  146. package/src/families/host.ts +9 -2
  147. package/src/families/tron.spec.ts +118 -0
  148. package/src/families/tron.ts +63 -0
  149. package/src/providers/WalletProvider.tsx +3 -2
  150. package/src/tron.ts +26 -0
  151. package/src/wagmi/host.tsx +6 -2
  152. package/types/clients/tron.d.ts +65 -0
  153. package/types/clients/tron.d.ts.map +1 -0
  154. package/types/clients/useTronClient.d.ts +8 -0
  155. package/types/clients/useTronClient.d.ts.map +1 -0
  156. package/types/connectkit/adapters/TronAdapter.d.ts +35 -0
  157. package/types/connectkit/adapters/TronAdapter.d.ts.map +1 -0
  158. package/types/connectkit/adapters/discover.d.ts +1 -1
  159. package/types/connectkit/adapters/discover.d.ts.map +1 -1
  160. package/types/connectkit/connectors/ensureWalletConnectors.d.ts.map +1 -1
  161. package/types/connectkit/connectors/syntheticChains.d.ts +4 -0
  162. package/types/connectkit/connectors/syntheticChains.d.ts.map +1 -1
  163. package/types/connectkit/defaultConfig.d.ts.map +1 -1
  164. package/types/connectkit/wallets/walletConfigs.d.ts.map +1 -1
  165. package/types/families/host.d.ts +9 -2
  166. package/types/families/host.d.ts.map +1 -1
  167. package/types/families/tron.d.ts +15 -0
  168. package/types/families/tron.d.ts.map +1 -0
  169. package/types/providers/WalletProvider.d.ts +2 -1
  170. package/types/providers/WalletProvider.d.ts.map +1 -1
  171. package/types/tron.d.ts +5 -0
  172. package/types/tron.d.ts.map +1 -0
  173. package/types/wagmi/host.d.ts.map +1 -1
@@ -0,0 +1,168 @@
1
+ import type { TronNetwork } from "../../clients/tron";
2
+ import type { WalletEntry } from "./discover";
3
+ import type { SignInMessageOptions, WalletAdapter, WalletAddress } from "./types";
4
+
5
+ interface TronWebLike {
6
+ ready?: boolean;
7
+ defaultAddress?: { base58?: string | false };
8
+ fullNode?: { host?: string };
9
+ trx: { signMessageV2(message: string): Promise<string> };
10
+ }
11
+
12
+ interface TronRequester {
13
+ request(args: { method: string; params?: unknown }): Promise<unknown>;
14
+ }
15
+
16
+ interface Tip1193Provider extends TronRequester {
17
+ tronWeb?: TronWebLike | false;
18
+ on?(event: "accountsChanged", listener: (accounts: string[]) => void): void;
19
+ removeListener?(event: "accountsChanged", listener: (accounts: string[]) => void): void;
20
+ }
21
+
22
+ interface TronLinkLike extends TronRequester {
23
+ ready?: boolean;
24
+ tronWeb?: TronWebLike | false;
25
+ }
26
+
27
+ interface TronWindow {
28
+ tron?: Tip1193Provider;
29
+ tronLink?: TronLinkLike;
30
+ tronWeb?: TronWebLike | false;
31
+ addEventListener?: Window["addEventListener"];
32
+ removeEventListener?: Window["removeEventListener"];
33
+ }
34
+
35
+ const page = (): TronWindow | undefined =>
36
+ typeof window === "undefined" ? undefined : (window as unknown as TronWindow);
37
+
38
+ const tronWebOf = (w: TronWindow): TronWebLike | undefined =>
39
+ w.tron?.tronWeb || w.tronLink?.tronWeb || w.tronWeb || undefined;
40
+
41
+ const accountOf = (w: TronWindow): string | null => tronWebOf(w)?.defaultAddress?.base58 || null;
42
+
43
+ /** The network TronLink's full node is on, from its host. Mainnet for an unknown node. */
44
+ export function tronNetworkOf(host: string | undefined): TronNetwork {
45
+ if (host?.includes("nile")) return "nile";
46
+ if (host?.includes("shasta")) return "shasta";
47
+ return "mainnet";
48
+ }
49
+
50
+ /** TronLink is on this page: the TIP-1193 `window.tron`, or the older `window.tronLink`. */
51
+ export function hasTronWallet(): boolean {
52
+ const w = page();
53
+ return Boolean(w?.tron || w?.tronLink);
54
+ }
55
+
56
+ /**
57
+ * TronLink over its injected provider: `tron_requestAccounts` (or TIP-1193's
58
+ * `eth_requestAccounts`) to connect, `tronWeb.defaultAddress.base58` for the
59
+ * account, `tronWeb.trx.signMessageV2` to sign. No tronweb package.
60
+ */
61
+ export class TronAdapter implements WalletAdapter {
62
+ readonly chain = "tron";
63
+ address: WalletAddress | null = null;
64
+ isConnected = false;
65
+
66
+ get network(): TronNetwork {
67
+ const w = page();
68
+ return tronNetworkOf(w ? tronWebOf(w)?.fullNode?.host : undefined);
69
+ }
70
+
71
+ get networkId(): string {
72
+ return `tron:${this.network}`;
73
+ }
74
+
75
+ async connect(): Promise<void> {
76
+ const w = page();
77
+ if (!w?.tron && !w?.tronLink) {
78
+ throw new Error("No Tron wallet found. Install TronLink.");
79
+ }
80
+ if (w.tron) {
81
+ await w.tron.request({ method: "eth_requestAccounts" });
82
+ } else if (w.tronLink) {
83
+ const answer = (await w.tronLink.request({ method: "tron_requestAccounts" })) as
84
+ | { code?: number; message?: string }
85
+ | ""
86
+ | undefined;
87
+ if (!answer) throw new Error("TronLink is locked. Unlock it and try again.");
88
+ if (answer.code !== undefined && answer.code !== 200) {
89
+ throw new Error(answer.message || "TronLink refused the connection");
90
+ }
91
+ }
92
+ const address = accountOf(w);
93
+ if (!address) throw new Error("TronLink returned no account");
94
+ this.address = address;
95
+ this.isConnected = true;
96
+ }
97
+
98
+ /**
99
+ * Takes the account TronLink already shares with this page, without a
100
+ * prompt. False when it shares none; throws while TronLink has not
101
+ * injected itself yet.
102
+ */
103
+ async restore(): Promise<boolean> {
104
+ const w = page();
105
+ if (!w?.tron && !w?.tronLink && !w?.tronWeb) throw new Error("No Tron wallet found yet.");
106
+ const address = accountOf(w);
107
+ this.address = address;
108
+ this.isConnected = address !== null;
109
+ return address !== null;
110
+ }
111
+
112
+ /** TronLink's account switches and disconnects; the account is read back from tronWeb on each. */
113
+ subscribe(listener: () => void): () => void {
114
+ const w = page();
115
+ if (!w) return () => {};
116
+ const update = () => {
117
+ const address = accountOf(w);
118
+ this.address = address;
119
+ this.isConnected = address !== null;
120
+ listener();
121
+ };
122
+ const provider = w.tron;
123
+ if (provider?.on) {
124
+ const onAccounts = () => update();
125
+ provider.on("accountsChanged", onAccounts);
126
+ return () => provider.removeListener?.("accountsChanged", onAccounts);
127
+ }
128
+ if (typeof w.addEventListener !== "function") return () => {};
129
+ const onMessage = (event: MessageEvent) => {
130
+ const action = (event.data as { message?: { action?: string } } | null)?.message?.action;
131
+ if (
132
+ action === "accountsChanged" ||
133
+ action === "setAccount" ||
134
+ action === "disconnect" ||
135
+ action === "disconnectWeb"
136
+ ) {
137
+ update();
138
+ }
139
+ };
140
+ w.addEventListener("message", onMessage as EventListener);
141
+ return () => w.removeEventListener?.("message", onMessage as EventListener);
142
+ }
143
+
144
+ async disconnect(): Promise<void> {
145
+ this.address = null;
146
+ this.isConnected = false;
147
+ }
148
+
149
+ async buildMessage(_opts: SignInMessageOptions): Promise<string> {
150
+ throw new Error("Tron sign-in is not supported yet");
151
+ }
152
+
153
+ /** TronLink's `signMessageV2`: the 0x hex signature over the TIP-191 prefixed message. */
154
+ async signMessage(message: string): Promise<string> {
155
+ const w = page();
156
+ const tronWeb = w ? tronWebOf(w) : undefined;
157
+ if (!this.address || !tronWeb) throw new Error("connect a Tron wallet first");
158
+ return tronWeb.trx.signMessageV2(message);
159
+ }
160
+ }
161
+
162
+ /** TronLink when it is on the page, as the one Tron wallet entry. */
163
+ export function discoverTronWallets(): WalletEntry[] {
164
+ if (!hasTronWallet()) return [];
165
+ return [
166
+ { id: "wallet:tron:tronlink", name: "TronLink", ecosystem: "tron", adapter: new TronAdapter() },
167
+ ];
168
+ }
@@ -4,7 +4,7 @@ import { SolanaAdapter, isStandardSolanaWallet, standardSolanaProvider } from ".
4
4
  import { SuiAdapter, discoverSuiWallets } from "./SuiAdapter";
5
5
  import { BitcoinAdapter } from "./BitcoinAdapter";
6
6
 
7
- export type WalletEcosystem = "solana" | "sui" | "bitcoin";
7
+ export type WalletEcosystem = "solana" | "sui" | "bitcoin" | "tron";
8
8
 
9
9
  export interface WalletEntry {
10
10
  /** Stable id, e.g. "wallet:solana:phantom" — matches a walletConfigs key. */
@@ -3,9 +3,9 @@ import { ecosystemBySyntheticChainId } from "./syntheticChains";
3
3
 
4
4
  /** Derive the signer family from the (possibly synthetic) chainId of the active connector. */
5
5
  export function familyFromChainId(chainId?: number): SignerFamily {
6
- if (chainId != null && ecosystemBySyntheticChainId[chainId]) {
7
- return ecosystemBySyntheticChainId[chainId];
8
- }
6
+ const ecosystem = chainId == null ? undefined : ecosystemBySyntheticChainId[chainId];
7
+ if (ecosystem === "tron") throw new Error("Tron sign-in is not supported yet");
8
+ if (ecosystem) return ecosystem;
9
9
  return "evm";
10
10
  }
11
11
 
@@ -2,6 +2,7 @@ import type { Config, Connector, CreateConnectorFn } from "wagmi";
2
2
 
3
3
  import { getConnectorEcosystem } from "@multiplatform.one/connectkit";
4
4
  import { discoverWallets } from "../adapters/discover";
5
+ import { discoverTronWallets } from "../adapters/TronAdapter";
5
6
  import { ecosystemBySyntheticChainId } from "./syntheticChains";
6
7
  import { walletAdapterConnector } from "./walletAdapterConnector";
7
8
 
@@ -38,7 +39,7 @@ export function ensureWalletConnectors(config: Config): number {
38
39
  ]);
39
40
  const existing = new Set(config.connectors.map((c) => c.id));
40
41
  let added = 0;
41
- for (const entry of discoverWallets()) {
42
+ for (const entry of [...discoverWallets(), ...discoverTronWallets()]) {
42
43
  if (existing.has(entry.id) || !listed.has(entry.ecosystem)) continue;
43
44
  const fn = walletAdapterConnector({
44
45
  id: entry.id,
@@ -8,7 +8,7 @@
8
8
  import type { Chain } from "viem";
9
9
  import type { Ecosystem } from "@multiplatform.one/connectkit";
10
10
 
11
- // 0x534f4c="SOL", 0x535549="SUI", 0x425443="BTC" — reserved, collision-free vs
11
+ // 0x534f4c="SOL", 0x535549="SUI", 0x425443="BTC", 0x545258="TRX" — reserved, collision-free vs
12
12
  // real EVM chainIds.
13
13
  /** @deprecated The wagmi shim for Solana, Sui and Bitcoin wallets, which goes in a later major when the connect modal reads the connection store (MPO-385). Use the `sol()`, `sui()` and `btc()` families and `useConnection()`. */
14
14
  export const SOLANA_CHAIN_ID = 0x534f4c; // 5_459_788
@@ -16,17 +16,21 @@ export const SOLANA_CHAIN_ID = 0x534f4c; // 5_459_788
16
16
  export const SUI_CHAIN_ID = 0x535549; // 5_461_321
17
17
  /** @deprecated The wagmi shim for Solana, Sui and Bitcoin wallets, which goes in a later major when the connect modal reads the connection store (MPO-385). Use the `sol()`, `sui()` and `btc()` families and `useConnection()`. */
18
18
  export const BITCOIN_CHAIN_ID = 0x425443; // 4_347_459
19
+ /** @deprecated The wagmi shim for Solana, Sui, Bitcoin and Tron wallets, which goes in a later major when the connect modal reads the connection store (MPO-385). Use the `tron()` family from `./tron` and `useConnection()`. */
20
+ export const TRON_CHAIN_ID = 0x545258; // 5_526_104
19
21
 
20
22
  export const syntheticChainIdByEcosystem: Record<Exclude<Ecosystem, "evm">, number> = {
21
23
  solana: SOLANA_CHAIN_ID,
22
24
  sui: SUI_CHAIN_ID,
23
25
  bitcoin: BITCOIN_CHAIN_ID,
26
+ tron: TRON_CHAIN_ID,
24
27
  };
25
28
 
26
29
  export const ecosystemBySyntheticChainId: Record<number, Ecosystem> = {
27
30
  [SOLANA_CHAIN_ID]: "solana",
28
31
  [SUI_CHAIN_ID]: "sui",
29
32
  [BITCOIN_CHAIN_ID]: "bitcoin",
33
+ [TRON_CHAIN_ID]: "tron",
30
34
  };
31
35
 
32
36
  /** @deprecated The wagmi shim for Solana, Sui and Bitcoin wallets, which goes in a later major when the connect modal reads the connection store (MPO-385). Use the `sol()`, `sui()` and `btc()` families and `useConnection()`. */
@@ -56,6 +60,8 @@ export const solanaChain = makeChain(SOLANA_CHAIN_ID, "Solana", "SOL", 9);
56
60
  export const suiChain = makeChain(SUI_CHAIN_ID, "Sui", "SUI", 9);
57
61
  /** @deprecated The wagmi shim for Solana, Sui and Bitcoin wallets, which goes in a later major when the connect modal reads the connection store (MPO-385). Use the `sol()`, `sui()` and `btc()` families and `useConnection()`. */
58
62
  export const bitcoinChain = makeChain(BITCOIN_CHAIN_ID, "Bitcoin", "BTC", 8);
63
+ /** @deprecated The wagmi shim for Solana, Sui, Bitcoin and Tron wallets, which goes in a later major when the connect modal reads the connection store (MPO-385). Use the `tron()` family from `./tron` and `useConnection()`. */
64
+ export const tronChain = makeChain(TRON_CHAIN_ID, "Tron", "TRX", 6);
59
65
 
60
66
  /** @deprecated The wagmi shim for Solana, Sui and Bitcoin wallets, which goes in a later major when the connect modal reads the connection store (MPO-385). Use the `sol()`, `sui()` and `btc()` families and `useConnection()`. */
61
- export const syntheticChains: Chain[] = [solanaChain, suiChain, bitcoinChain];
67
+ export const syntheticChains: Chain[] = [solanaChain, suiChain, bitcoinChain, tronChain];
@@ -7,6 +7,7 @@ import { setAppMeta } from "@multiplatform.one/connectkit";
7
7
  import defaultConnectors from "./defaultConnectors";
8
8
  import type { RestoredSessionTimeout } from "./connectors/restoredSession";
9
9
  import { discoverWallets, type WalletEcosystem } from "./adapters/discover";
10
+ import { discoverTronWallets } from "./adapters/TronAdapter";
10
11
  import { getWalletConnectors } from "./connectors/getWalletConnectors";
11
12
  import { ecosystemBySyntheticChainId, syntheticChains } from "./connectors/syntheticChains";
12
13
 
@@ -32,7 +33,7 @@ type DefaultConfigProps = {
32
33
  metaMaskRestoredSessionTimeout?: RestoredSessionTimeout;
33
34
  // wallet: append shim-connectors for any detected non-EVM wallet (Solana/Sui/
34
35
  // Bitcoin) alongside the EVM connectors. No-op when none are installed. A list
35
- // limits it to those ecosystems.
36
+ // limits it to those ecosystems; Tron is listed only when a list names it.
36
37
  enableWallet?: boolean | readonly WalletEcosystem[];
37
38
  } & Partial<CreateConfigParameters>;
38
39
 
@@ -90,7 +91,9 @@ const defaultConfig = ({
90
91
  ? [
91
92
  ...(baseConnectors ?? []),
92
93
  ...getWalletConnectors(
93
- discoverWallets().filter((entry) => ecosystems.includes(entry.ecosystem)),
94
+ [...discoverWallets(), ...discoverTronWallets()].filter((entry) =>
95
+ ecosystems.includes(entry.ecosystem),
96
+ ),
94
97
  ),
95
98
  ]
96
99
  : baseConnectors;
@@ -89,6 +89,14 @@ export const walletConfigs: {
89
89
  icon: <BrandIcon bg="#000000" fg="#FFFFFF" glyph="OK" />,
90
90
  iconShape: "squircle",
91
91
  },
92
+ "wallet:tron:tronlink": {
93
+ icon: <BrandIcon bg="#EB0029" fg="#FFFFFF" glyph="T" />,
94
+ iconShape: "squircle",
95
+ downloadUrls: {
96
+ website: "https://www.tronlink.org",
97
+ chrome: "https://chromewebstore.google.com/detail/tronlink/ibnejdfjmmkpcnlpebklmnkoeoihofec",
98
+ },
99
+ },
92
100
  aaveAccountProvider: {
93
101
  name: "Aave Account",
94
102
  shortName: "Aave",
@@ -1,9 +1,11 @@
1
1
  import type { Config } from "wagmi";
2
2
  import type { SolanaChain } from "../clients/solanaMessage";
3
+ import type { ChainClient } from "../clients/types";
4
+ import type { WalletAdapter } from "../connectkit/adapters/types";
3
5
  import type { WalletFamily } from "../core/family";
4
6
 
5
- /** The ecosystem a wagmi connector carries: `evm`, or a Solana, Sui or Bitcoin shim's. */
6
- export type HostedEcosystem = "evm" | "solana" | "sui" | "bitcoin";
7
+ /** The ecosystem a wagmi connector carries: `evm`, or a Solana, Sui, Bitcoin or Tron shim's. */
8
+ export type HostedEcosystem = "evm" | "solana" | "sui" | "bitcoin" | "tron";
7
9
 
8
10
  /**
9
11
  * How a Web3Provider hosts a built-in family on its wagmi config while the
@@ -19,6 +21,11 @@ export interface WagmiHosting {
19
21
  readonly solanaChain?: SolanaChain;
20
22
  /** The wagmi config the app gave `eth()`, which the provider then uses. */
21
23
  readonly config?: Config;
24
+ /**
25
+ * The family's client over its shim's adapter, for a family whose client
26
+ * the shared connector lookup does not build, such as Tron's web-only one.
27
+ */
28
+ readonly client?: (adapter: WalletAdapter) => ChainClient | null;
22
29
  }
23
30
 
24
31
  const hosting = new WeakMap<WalletFamily, WagmiHosting>();
@@ -0,0 +1,118 @@
1
+ // @vitest-environment happy-dom
2
+ import { afterEach, describe, expect, it, vi } from "vitest";
3
+ import { createConfig, http } from "wagmi";
4
+ import { mainnet } from "wagmi/chains";
5
+ import type { TronClient } from "../clients/tron";
6
+ import { TronAdapter } from "../connectkit/adapters/TronAdapter";
7
+ import { tronChain } from "../connectkit/connectors/syntheticChains";
8
+ import { walletAdapterConnector } from "../connectkit/connectors/walletAdapterConnector";
9
+ import { createFamilyRegistry } from "../core/family";
10
+ import { hostFamiliesOnWagmi } from "../wagmi/host";
11
+ import { wagmiHosting } from "./host";
12
+ import { walletFamilies } from "./index";
13
+ import { tron, tronDriver } from "./tron";
14
+
15
+ const address = "TKHuVq1oKVruCGLvqVexFs6dawKv6fQgFs";
16
+ const usdt = "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t";
17
+ const globals: string[] = [];
18
+ const install = (name: string, value: unknown) => {
19
+ globals.push(name);
20
+ (window as unknown as Record<string, unknown>)[name] = value;
21
+ };
22
+
23
+ afterEach(() => {
24
+ for (const name of globals.splice(0)) Reflect.deleteProperty(window, name);
25
+ vi.unstubAllGlobals();
26
+ });
27
+
28
+ function injectTronLink(host = "https://nile.trongrid.io") {
29
+ const web = {
30
+ defaultAddress: { base58: false as string | false },
31
+ fullNode: { host },
32
+ trx: { signMessageV2: vi.fn(async () => "0xsig") },
33
+ };
34
+ install("tronLink", {
35
+ tronWeb: web,
36
+ request: vi.fn(async () => {
37
+ web.defaultAddress.base58 = address;
38
+ return { code: 200 };
39
+ }),
40
+ });
41
+ install("tronWeb", web);
42
+ return web;
43
+ }
44
+
45
+ function trongrid(word = "2a") {
46
+ const fetch = vi.fn(async (_url: string | URL | Request, _init?: RequestInit) =>
47
+ Response.json({ result: { result: true }, constant_result: [word] }),
48
+ );
49
+ vi.stubGlobal("fetch", fetch);
50
+ return fetch;
51
+ }
52
+
53
+ describe("the tron family", () => {
54
+ it("is its own family, beside the built-in ones and not among them", () => {
55
+ const family = tron();
56
+ expect(family).toMatchObject({ id: "tron", label: "Tron", aliases: ["trx"] });
57
+ expect(createFamilyRegistry([family]).require("trx")).toBe(family);
58
+ expect(wagmiHosting(family)).toMatchObject({ ecosystem: "tron", chainId: "tron" });
59
+ expect(walletFamilies().map((entry) => entry.id)).not.toContain("tron");
60
+ });
61
+
62
+ it("connects TronLink on the light driver and reads TRC-20 on TronLink's network", async () => {
63
+ injectTronLink();
64
+ const fetch = trongrid();
65
+ const driver = tronDriver();
66
+ expect(driver.connectors()).toEqual([{ id: "wallet:tron:tronlink", name: "TronLink" }]);
67
+ await expect(driver.connect("wallet:tron:tronlink")).resolves.toEqual({
68
+ address,
69
+ chainId: "tron",
70
+ });
71
+ const client = (await driver.client?.(driver.getState())) as TronClient;
72
+ expect(client).toMatchObject({ family: "tron", address, network: "nile" });
73
+ await expect(client.trc20Balance(usdt)).resolves.toBe(42n);
74
+ expect(fetch.mock.calls[0][0]).toBe("https://nile.trongrid.io/wallet/triggerconstantcontract");
75
+ });
76
+
77
+ it("hears TronLink when it injects itself after the page loaded", () => {
78
+ const driver = tronDriver();
79
+ expect(driver.connectors()).toEqual([]);
80
+ const changed = vi.fn();
81
+ const unwatch = driver.watchConnectors?.(changed);
82
+ injectTronLink();
83
+ window.dispatchEvent(new Event("tronLink#initialized"));
84
+ expect(changed).toHaveBeenCalledTimes(1);
85
+ expect(driver.connectors()).toHaveLength(1);
86
+ unwatch?.();
87
+ window.dispatchEvent(new Event("tronLink#initialized"));
88
+ expect(changed).toHaveBeenCalledTimes(1);
89
+ });
90
+
91
+ it("hosted on wagmi, connects through the modal's shim and hands back its Tron client", async () => {
92
+ injectTronLink("https://api.trongrid.io");
93
+ trongrid("0");
94
+ const adapter = new TronAdapter();
95
+ const config = createConfig({
96
+ chains: [mainnet, tronChain],
97
+ connectors: [
98
+ walletAdapterConnector({
99
+ id: "wallet:tron:tronlink",
100
+ name: "TronLink",
101
+ ecosystem: "tron",
102
+ adapter,
103
+ }),
104
+ ],
105
+ transports: { [mainnet.id]: http(), [tronChain.id]: http() },
106
+ });
107
+ const [hosted] = hostFamiliesOnWagmi([tron()], config);
108
+ const driver = hosted.driver?.();
109
+ expect(driver?.connectors().map((connector) => connector.id)).toEqual(["wallet:tron:tronlink"]);
110
+ await expect(driver?.connect("wallet:tron:tronlink")).resolves.toEqual({
111
+ address,
112
+ chainId: "tron",
113
+ });
114
+ const client = (await driver?.client?.(driver.getState())) as TronClient;
115
+ expect(client).toMatchObject({ family: "tron", address, network: "mainnet" });
116
+ await expect(client.trc20Balance(usdt)).resolves.toBe(0n);
117
+ });
118
+ });
@@ -0,0 +1,63 @@
1
+ import { tronClient, type TronClientOptions } from "../clients/tron";
2
+ import { discoverTronWallets, TronAdapter } from "../connectkit/adapters/TronAdapter";
3
+ import type { WalletMessageSpec } from "../core/message";
4
+ import { defineWalletFamily, type WalletFamily } from "../core/family";
5
+ import { lightDriver } from "../core/lightDriver";
6
+ import type { ConnectionDriver } from "../core/types";
7
+ import { withHosting } from "./host";
8
+
9
+ export const tronMessage: WalletMessageSpec = {
10
+ header: "wants you to sign in with your Tron account:",
11
+ statement: "Sign in With Tron.",
12
+ chainId: "tron",
13
+ };
14
+
15
+ export type TronFamilyOptions = Omit<TronClientOptions, "network">;
16
+
17
+ const networkOf = (adapter: unknown) =>
18
+ adapter instanceof TronAdapter ? { network: adapter.network } : {};
19
+
20
+ /** TronLink on the light driver. Hears TronLink when it injects itself after the page loaded. */
21
+ export function tronDriver(options: TronFamilyOptions = {}): ConnectionDriver {
22
+ return lightDriver({
23
+ wallets: () => discoverTronWallets().map(({ id, name, adapter }) => ({ id, name, adapter })),
24
+ watchWallets(listener) {
25
+ if (typeof window === "undefined" || typeof window.addEventListener !== "function") {
26
+ return () => {};
27
+ }
28
+ const announced = (event: Event) => {
29
+ const action = (event as MessageEvent<{ message?: { action?: string } } | null>).data
30
+ ?.message?.action;
31
+ if (event.type === "tronLink#initialized" || action === "tabReply") listener();
32
+ };
33
+ window.addEventListener("tronLink#initialized", announced);
34
+ window.addEventListener("message", announced);
35
+ return () => {
36
+ window.removeEventListener("tronLink#initialized", announced);
37
+ window.removeEventListener("message", announced);
38
+ };
39
+ },
40
+ chainId: "tron",
41
+ client: (wallet) => tronClient(wallet.adapter, { ...options, ...networkOf(wallet.adapter) }),
42
+ });
43
+ }
44
+
45
+ /**
46
+ * The Tron family: TronLink, through the connect modal under Web3Provider.
47
+ * Its client reads TRC-20 balances through TronGrid on the network TronLink
48
+ * is on. Web only, from `@multiplatform.one/web3/tron`.
49
+ */
50
+ export function tron(options: TronFamilyOptions = {}): WalletFamily {
51
+ const family = defineWalletFamily({
52
+ id: "tron",
53
+ label: "Tron",
54
+ aliases: ["trx"],
55
+ message: tronMessage,
56
+ driver: () => tronDriver(options),
57
+ });
58
+ return withHosting(family, {
59
+ ecosystem: "tron",
60
+ chainId: "tron",
61
+ client: (adapter) => tronClient(adapter, { ...options, ...networkOf(adapter) }),
62
+ });
63
+ }
@@ -1,5 +1,6 @@
1
1
  import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
2
- import { ConnectKitProvider, SIWEProvider, type SIWEConfig, getDefaultConfig } from "../connectkit";
2
+ import { ConnectKitProvider, type SIWEConfig, getDefaultConfig } from "../connectkit";
3
+ import { SIWEProvider } from "../connectkit/siwe/SIWEProvider";
3
4
  import type { ComponentProps, PropsWithChildren } from "react";
4
5
  import { useMemo } from "react";
5
6
  import { WagmiProvider, createConfig } from "wagmi";
@@ -51,7 +52,7 @@ const defaultQueryClient = new QueryClient();
51
52
  type WagmiConfigResult = ReturnType<typeof createConfig>;
52
53
  const wagmiConfigCache = new Map<string, WagmiConfigResult>();
53
54
 
54
- const walletEcosystems = ["solana", "sui", "bitcoin"] as const;
55
+ const walletEcosystems = ["solana", "sui", "bitcoin", "tron"] as const;
55
56
 
56
57
  function hosts(families: readonly WalletFamily[], ecosystem: HostedEcosystem) {
57
58
  return families.some((family) => wagmiHosting(family)?.ecosystem === ecosystem);
package/src/tron.ts ADDED
@@ -0,0 +1,26 @@
1
+ // `@multiplatform.one/web3/tron`: the Tron family and its client, for web
2
+ // only. A subpath with no react-native entry, so no Tron code reaches the
3
+ // native bundle until Tron has a bridge namespace.
4
+ export {
5
+ isTronAddress,
6
+ readTrc20Balance,
7
+ toTronBase58,
8
+ toTronHex,
9
+ tronAddressBytes,
10
+ tronClient,
11
+ tronGridUrls,
12
+ TronGridError,
13
+ type Trc20BalanceParameters,
14
+ type TronClient,
15
+ type TronClientOptions,
16
+ type TronGridOptions,
17
+ type TronNetwork,
18
+ } from "./clients/tron";
19
+ export { useTronClient } from "./clients/useTronClient";
20
+ export {
21
+ discoverTronWallets,
22
+ hasTronWallet,
23
+ TronAdapter,
24
+ tronNetworkOf,
25
+ } from "./connectkit/adapters/TronAdapter";
26
+ export { tron, tronDriver, tronMessage, type TronFamilyOptions } from "./families/tron";
@@ -30,7 +30,7 @@ export function hostFamiliesOnWagmi(
30
30
  return families.map((family) => {
31
31
  const hosting = wagmiHosting(family);
32
32
  if (!hosting) return family;
33
- const { ecosystem, chainId, solanaChain } = hosting;
33
+ const { ecosystem, chainId, solanaChain, client } = hosting;
34
34
  if (ecosystem === "evm")
35
35
  return defineWalletFamily({ ...family, driver: () => wagmiDriver(config) });
36
36
  return defineWalletFamily({
@@ -39,7 +39,11 @@ export function hostFamiliesOnWagmi(
39
39
  wagmiDriver(config, {
40
40
  filter: (connector) => connectorAdapter(connector, ecosystem) !== null,
41
41
  ...(chainId === undefined ? {} : { chainId }),
42
- client: (connector) => clientForConnector(connector, solanaChain ? { solanaChain } : {}),
42
+ client: (connector) => {
43
+ if (!client) return clientForConnector(connector, solanaChain ? { solanaChain } : {});
44
+ const adapter = connectorAdapter(connector, ecosystem);
45
+ return adapter?.address ? client(adapter) : null;
46
+ },
43
47
  }),
44
48
  });
45
49
  });
@@ -0,0 +1,65 @@
1
+ import type { WalletAdapter } from "../connectkit/adapters/types";
2
+ import type { ChainClient } from "./types";
3
+ /** The Tron networks TronGrid serves. */
4
+ export type TronNetwork = "mainnet" | "nile" | "shasta";
5
+ /** TronGrid's HTTP API per network. */
6
+ export declare const tronGridUrls: Readonly<Record<TronNetwork, string>>;
7
+ /**
8
+ * A Tron address as its 21 bytes, version byte 0x41 first. Takes base58
9
+ * (`T…`), 41-prefixed hex, or a bare 20-byte EVM-style hex. Throws on a bad
10
+ * checksum or length.
11
+ */
12
+ export declare function tronAddressBytes(address: string): Uint8Array;
13
+ /** The base58 form TronLink shows (`T…`), from any form tronAddressBytes takes. */
14
+ export declare function toTronBase58(address: string): string;
15
+ /** The 41-prefixed hex form TronGrid takes when `visible` is false. */
16
+ export declare function toTronHex(address: string): string;
17
+ /** Whether `address` is a well-formed Tron address in any form tronAddressBytes takes. */
18
+ export declare function isTronAddress(address: string): boolean;
19
+ /** Where a TronGrid read goes: a network, or an API URL of the app's own. */
20
+ export interface TronGridOptions {
21
+ /** Defaults to `mainnet`. Ignored when `apiUrl` is given. */
22
+ network?: TronNetwork;
23
+ /** A TronGrid-compatible full node, in place of the network's TronGrid URL. */
24
+ apiUrl?: string;
25
+ /** Sent as `TRON-PRO-API-KEY`. TronGrid serves keyless reads at a lower rate. */
26
+ apiKey?: string;
27
+ fetch?: typeof fetch;
28
+ signal?: AbortSignal;
29
+ }
30
+ export interface Trc20BalanceParameters extends TronGridOptions {
31
+ /** The TRC-20 contract. */
32
+ token: string;
33
+ /** The account whose balance is read. */
34
+ owner: string;
35
+ }
36
+ /** A TronGrid call that answered without a result. */
37
+ export declare class TronGridError extends Error {
38
+ readonly status?: number;
39
+ constructor(message: string, status?: number);
40
+ }
41
+ /**
42
+ * A TRC-20 `balanceOf(owner)` in the token's smallest unit, read through
43
+ * TronGrid's `triggerconstantcontract`. No wallet and no tronweb: one POST.
44
+ */
45
+ export declare function readTrc20Balance(parameters: Trc20BalanceParameters): Promise<bigint>;
46
+ type MessageAdapter = Pick<WalletAdapter, "address" | "signMessage">;
47
+ export interface TronClientOptions extends Omit<TronGridOptions, "signal"> {
48
+ }
49
+ /**
50
+ * The connected Tron wallet: message signing through TronLink and TRC-20
51
+ * reads through TronGrid on the wallet's network.
52
+ */
53
+ export interface TronClient extends ChainClient<"tron"> {
54
+ readonly address: string;
55
+ readonly chainId: "tron";
56
+ /** The network TronLink's node is on, which `trc20Balance` reads. */
57
+ readonly network: TronNetwork;
58
+ /** TronLink's `signMessageV2`, 0x hex. */
59
+ signMessage(message: string): Promise<string>;
60
+ /** A TRC-20 balance in the token's smallest unit, for the connected account unless `owner` is given. */
61
+ trc20Balance(token: string, owner?: string, signal?: AbortSignal): Promise<bigint>;
62
+ }
63
+ export declare function tronClient(adapter: MessageAdapter, options?: TronClientOptions): TronClient;
64
+ export {};
65
+ //# sourceMappingURL=tron.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tron.d.ts","sourceRoot":"","sources":["../../src/clients/tron.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAoB,MAAM,SAAS,CAAC;AAE7D,yCAAyC;AACzC,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAC;AAExD,uCAAuC;AACvC,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAI7D,CAAC;AAMH;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,CAuB5D;AAED,mFAAmF;AACnF,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAGpD;AAED,uEAAuE;AACvE,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,0FAA0F;AAC1F,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAOtD;AAED,6EAA6E;AAC7E,MAAM,WAAW,eAAe;IAC9B,6DAA6D;IAC7D,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,+EAA+E;IAC/E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iFAAiF;IACjF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,WAAW,sBAAuB,SAAQ,eAAe;IAC7D,2BAA2B;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,sDAAsD;AACtD,qBAAa,aAAc,SAAQ,KAAK;IACtC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;gBACb,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;CAK7C;AAYD;;;GAGG;AACH,wBAAsB,gBAAgB,CAAC,UAAU,EAAE,sBAAsB,GAAG,OAAO,CAAC,MAAM,CAAC,CAmC1F;AAED,KAAK,cAAc,GAAG,IAAI,CAAC,aAAa,EAAE,SAAS,GAAG,aAAa,CAAC,CAAC;AAErE,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,eAAe,EAAE,QAAQ,CAAC;CAAG;AAE7E;;;GAGG;AACH,MAAM,WAAW,UAAW,SAAQ,WAAW,CAAC,MAAM,CAAC;IACrD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,qEAAqE;IACrE,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,0CAA0C;IAC1C,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9C,wGAAwG;IACxG,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACpF;AAID,wBAAgB,UAAU,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,GAAE,iBAAsB,GAAG,UAAU,CAc/F"}
@@ -0,0 +1,8 @@
1
+ import { type TronClient } from "./tron";
2
+ /**
3
+ * The connected TronLink wallet: the connection store's client when one is
4
+ * mounted, else wagmi's shim connector's. Undefined while no Tron wallet
5
+ * holds the connection.
6
+ */
7
+ export declare function useTronClient(): TronClient | undefined;
8
+ //# sourceMappingURL=useTronClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTronClient.d.ts","sourceRoot":"","sources":["../../src/clients/useTronClient.ts"],"names":[],"mappings":"AAKA,OAAO,EAAc,KAAK,UAAU,EAAE,MAAM,QAAQ,CAAC;AAErD;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,UAAU,GAAG,SAAS,CAatD"}