@abstraxn/signer-react 3.1.2 → 3.1.3
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/CHANGELOG.md +11 -0
- package/dist/src/components/AbstraxnProvider/AbstraxnProvider.js +52 -23
- package/dist/src/hooks.d.ts +20 -13
- package/dist/src/hooks.js +3 -3
- package/dist/src/wagmiConfig.d.ts +7 -1
- package/dist/src/wagmiConfig.js +31 -15
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [3.1.3] - 2026-03-31
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- **Embedded-only wagmi context** – When `externalWallets.enabled` is `false`, the provider still mounts `QueryClientProvider` and `WagmiProvider` using a **connector-free** wagmi config (`createWagmiConfig(..., embedOnly: true)`), so hooks like `useConfig`, `useAccount`, and unified chain switching keep working for email/social embedded flows without registering injected/MetaMask/WalletConnect connectors. If React Query is missing, the error message now describes wagmi hook requirements instead of blaming disabled external wallets.
|
|
13
|
+
- **`createWagmiConfig` embed mode** – New optional `embedOnly` flag builds a minimal wagmi `Config` (empty `connectors`, shared HTTP transports and storage) for embedded-only usage; chain list must still be non-empty.
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- **`useExternalWalletInfo().switchChain`** – Returns the unified `switchChain` implementation (embedded + external) instead of only the external-wallet switcher, so chain changes behave consistently when external wallets are off.
|
|
18
|
+
|
|
8
19
|
## [3.1.2] - 2026-03-27
|
|
9
20
|
|
|
10
21
|
### Changed
|
|
@@ -168,38 +168,67 @@ export function AbstraxnProvider({ config, children }) {
|
|
|
168
168
|
externalSsr,
|
|
169
169
|
config.wagmiConfig,
|
|
170
170
|
]);
|
|
171
|
-
//
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
171
|
+
// Connector-free wagmi config so `useConfig` / `useAccount` / etc. never throw when
|
|
172
|
+
// `externalWallets.enabled` is false (embedded email/social only). React Query is required
|
|
173
|
+
// for WagmiProvider the same as for the full external-wallet tree.
|
|
174
|
+
const { embedWagmiConfig, embedConfigError } = useMemo(() => {
|
|
175
|
+
if (externalWalletsEnabled) {
|
|
176
|
+
return { embedWagmiConfig: null, embedConfigError: null };
|
|
177
|
+
}
|
|
178
|
+
try {
|
|
179
|
+
const cfg = createWagmiConfig(wagmiChains, undefined, undefined, wagmiThemeRef.current, externalSsr, true);
|
|
180
|
+
return { embedWagmiConfig: cfg, embedConfigError: null };
|
|
181
|
+
}
|
|
182
|
+
catch (error) {
|
|
183
|
+
console.error("Failed to create embed-only wagmi config:", error);
|
|
184
|
+
return {
|
|
185
|
+
embedWagmiConfig: null,
|
|
186
|
+
embedConfigError: error instanceof Error
|
|
187
|
+
? error
|
|
188
|
+
: new Error("Failed to create embed-only wagmi config"),
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
}, [externalWalletsEnabled, chainsKey, externalSsr]);
|
|
192
|
+
// Embedded-only mode: still mount WagmiProvider (no connectors) when React Query is available.
|
|
193
|
+
if (!externalWalletsEnabled) {
|
|
175
194
|
const queryCheck = canUseReactQuery();
|
|
176
195
|
if (!queryCheck.canUse) {
|
|
177
|
-
console.error("❌
|
|
196
|
+
console.error("❌ Wagmi hooks require @tanstack/react-query. Install it or wrap your app with QueryClientProvider.\n" +
|
|
178
197
|
`Reason: ${queryCheck.reason || "Unknown"}\n` +
|
|
179
|
-
"
|
|
180
|
-
"Falling back to Abstraxn wallet only.");
|
|
198
|
+
"Rendering without WagmiProvider; calls to useConfig may throw.");
|
|
181
199
|
return (_jsx(AbstraxnProviderWithoutWagmi, { config: config, children: children }));
|
|
182
200
|
}
|
|
183
|
-
if (
|
|
184
|
-
|
|
185
|
-
|
|
201
|
+
if (embedConfigError || !embedWagmiConfig) {
|
|
202
|
+
if (embedConfigError) {
|
|
203
|
+
console.error("Failed to create embed-only wagmi config:", embedConfigError);
|
|
204
|
+
}
|
|
186
205
|
return (_jsx(AbstraxnProviderWithoutWagmi, { config: config, children: children }));
|
|
187
206
|
}
|
|
188
|
-
if (!wagmiConfig) {
|
|
189
|
-
// Show loading state while config is being created
|
|
190
|
-
// Don't render AbstraxnProviderInner until wagmiConfig is ready
|
|
191
|
-
return (_jsx(QueryClientWrapper, { queryClient: queryClient, children: _jsx("div", { style: { display: "none" }, children: "Loading wallet connectors..." }) }));
|
|
192
|
-
}
|
|
193
|
-
// ✅ For SSR mode, wait for hydration before rendering WagmiProvider
|
|
194
|
-
// This ensures injected wallets (Phantom, etc.) are detected properly
|
|
195
207
|
if (externalSsr && !isHydrated) {
|
|
196
|
-
return (_jsx(QueryClientWrapper, { queryClient: queryClient, children: _jsx("div", { style: { display: "none" }, children: "Hydrating
|
|
208
|
+
return (_jsx(QueryClientWrapper, { queryClient: queryClient, children: _jsx("div", { style: { display: "none" }, children: "Hydrating..." }) }));
|
|
197
209
|
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
210
|
+
return (_jsx(QueryClientWrapper, { queryClient: queryClient, children: _jsx(WagmiProvider, { config: embedWagmiConfig, children: _jsx(AbstraxnProviderWithoutWagmi, { config: config, children: children }) }) }));
|
|
211
|
+
}
|
|
212
|
+
// External wallets enabled: full connectors + Solana adapter tree
|
|
213
|
+
// Check if React Query is available BEFORE doing anything else
|
|
214
|
+
const queryCheck = canUseReactQuery();
|
|
215
|
+
if (!queryCheck.canUse) {
|
|
216
|
+
console.error("❌ External wallets are disabled because React Query is not available.\n" +
|
|
217
|
+
`Reason: ${queryCheck.reason || "Unknown"}\n` +
|
|
218
|
+
"Please install @tanstack/react-query@^5.90.16 and ensure there is only one React instance.\n" +
|
|
219
|
+
"Falling back to Abstraxn wallet only.");
|
|
220
|
+
return (_jsx(AbstraxnProviderWithoutWagmi, { config: config, children: children }));
|
|
221
|
+
}
|
|
222
|
+
if (configError) {
|
|
223
|
+
console.error("Failed to create wagmi config:", configError);
|
|
224
|
+
return (_jsx(AbstraxnProviderWithoutWagmi, { config: config, children: children }));
|
|
225
|
+
}
|
|
226
|
+
if (!wagmiConfig) {
|
|
227
|
+
return (_jsx(QueryClientWrapper, { queryClient: queryClient, children: _jsx("div", { style: { display: "none" }, children: "Loading wallet connectors..." }) }));
|
|
228
|
+
}
|
|
229
|
+
if (externalSsr && !isHydrated) {
|
|
230
|
+
return (_jsx(QueryClientWrapper, { queryClient: queryClient, children: _jsx("div", { style: { display: "none" }, children: "Hydrating wallet connectors..." }) }));
|
|
201
231
|
}
|
|
202
|
-
|
|
203
|
-
return (_jsx(AbstraxnProviderWithoutWagmi, { config: config, children: children }));
|
|
232
|
+
return (_jsx(QueryClientWrapper, { queryClient: queryClient, children: _jsx(ConnectionProvider, { endpoint: config.chains?.solanaEndpoint || "https://api.mainnet-beta.solana.com", children: _jsx(WalletProvider, { wallets: solanaWallets, autoConnect: true, children: _jsx(WagmiProvider, { config: wagmiConfig, initialState: config.initialState, children: _jsx(AbstraxnProviderWithWagmi, { config: config, children: children }) }) }) }) }));
|
|
204
233
|
}
|
|
205
234
|
//# sourceMappingURL=AbstraxnProvider.js.map
|
package/dist/src/hooks.d.ts
CHANGED
|
@@ -270,6 +270,7 @@ export declare function usePublicClient(chain: Chain, rpcUrl: string): {
|
|
|
270
270
|
request?: (parameters: import("viem").CcipRequestParameters) => Promise<import("viem/_types/utils/ccip").CcipRequestReturnType>;
|
|
271
271
|
} | undefined;
|
|
272
272
|
chain: Chain | undefined;
|
|
273
|
+
dataSuffix?: import("viem").DataSuffix | undefined;
|
|
273
274
|
experimental_blockTag?: import("viem").BlockTag | undefined;
|
|
274
275
|
key: string;
|
|
275
276
|
name: string;
|
|
@@ -321,7 +322,6 @@ export declare function usePublicClient(chain: Chain, rpcUrl: string): {
|
|
|
321
322
|
withdrawalsRoot?: `0x${string}` | undefined;
|
|
322
323
|
transactions: includeTransactions extends true ? ({
|
|
323
324
|
type: "legacy";
|
|
324
|
-
value: bigint;
|
|
325
325
|
yParity?: undefined | undefined;
|
|
326
326
|
from: Address;
|
|
327
327
|
gas: bigint;
|
|
@@ -333,6 +333,7 @@ export declare function usePublicClient(chain: Chain, rpcUrl: string): {
|
|
|
333
333
|
to: Address | null;
|
|
334
334
|
typeHex: import("viem").Hex | null;
|
|
335
335
|
v: bigint;
|
|
336
|
+
value: bigint;
|
|
336
337
|
accessList?: undefined | undefined;
|
|
337
338
|
authorizationList?: undefined | undefined;
|
|
338
339
|
blobVersionedHashes?: undefined | undefined;
|
|
@@ -346,7 +347,6 @@ export declare function usePublicClient(chain: Chain, rpcUrl: string): {
|
|
|
346
347
|
transactionIndex: (blockTag extends "pending" ? true : false) extends infer T_2 ? T_2 extends (blockTag extends "pending" ? true : false) ? T_2 extends true ? null : number : never : never;
|
|
347
348
|
} | {
|
|
348
349
|
type: "eip2930";
|
|
349
|
-
value: bigint;
|
|
350
350
|
yParity: number;
|
|
351
351
|
from: Address;
|
|
352
352
|
gas: bigint;
|
|
@@ -358,6 +358,7 @@ export declare function usePublicClient(chain: Chain, rpcUrl: string): {
|
|
|
358
358
|
to: Address | null;
|
|
359
359
|
typeHex: import("viem").Hex | null;
|
|
360
360
|
v: bigint;
|
|
361
|
+
value: bigint;
|
|
361
362
|
accessList: import("viem").AccessList;
|
|
362
363
|
authorizationList?: undefined | undefined;
|
|
363
364
|
blobVersionedHashes?: undefined | undefined;
|
|
@@ -371,7 +372,6 @@ export declare function usePublicClient(chain: Chain, rpcUrl: string): {
|
|
|
371
372
|
transactionIndex: (blockTag extends "pending" ? true : false) extends infer T_5 ? T_5 extends (blockTag extends "pending" ? true : false) ? T_5 extends true ? null : number : never : never;
|
|
372
373
|
} | {
|
|
373
374
|
type: "eip1559";
|
|
374
|
-
value: bigint;
|
|
375
375
|
yParity: number;
|
|
376
376
|
from: Address;
|
|
377
377
|
gas: bigint;
|
|
@@ -383,6 +383,7 @@ export declare function usePublicClient(chain: Chain, rpcUrl: string): {
|
|
|
383
383
|
to: Address | null;
|
|
384
384
|
typeHex: import("viem").Hex | null;
|
|
385
385
|
v: bigint;
|
|
386
|
+
value: bigint;
|
|
386
387
|
accessList: import("viem").AccessList;
|
|
387
388
|
authorizationList?: undefined | undefined;
|
|
388
389
|
blobVersionedHashes?: undefined | undefined;
|
|
@@ -396,7 +397,6 @@ export declare function usePublicClient(chain: Chain, rpcUrl: string): {
|
|
|
396
397
|
transactionIndex: (blockTag extends "pending" ? true : false) extends infer T_8 ? T_8 extends (blockTag extends "pending" ? true : false) ? T_8 extends true ? null : number : never : never;
|
|
397
398
|
} | {
|
|
398
399
|
type: "eip4844";
|
|
399
|
-
value: bigint;
|
|
400
400
|
yParity: number;
|
|
401
401
|
from: Address;
|
|
402
402
|
gas: bigint;
|
|
@@ -408,6 +408,7 @@ export declare function usePublicClient(chain: Chain, rpcUrl: string): {
|
|
|
408
408
|
to: Address | null;
|
|
409
409
|
typeHex: import("viem").Hex | null;
|
|
410
410
|
v: bigint;
|
|
411
|
+
value: bigint;
|
|
411
412
|
accessList: import("viem").AccessList;
|
|
412
413
|
authorizationList?: undefined | undefined;
|
|
413
414
|
blobVersionedHashes: readonly import("viem").Hex[];
|
|
@@ -421,7 +422,6 @@ export declare function usePublicClient(chain: Chain, rpcUrl: string): {
|
|
|
421
422
|
transactionIndex: (blockTag extends "pending" ? true : false) extends infer T_11 ? T_11 extends (blockTag extends "pending" ? true : false) ? T_11 extends true ? null : number : never : never;
|
|
422
423
|
} | {
|
|
423
424
|
type: "eip7702";
|
|
424
|
-
value: bigint;
|
|
425
425
|
yParity: number;
|
|
426
426
|
from: Address;
|
|
427
427
|
gas: bigint;
|
|
@@ -433,6 +433,7 @@ export declare function usePublicClient(chain: Chain, rpcUrl: string): {
|
|
|
433
433
|
to: Address | null;
|
|
434
434
|
typeHex: import("viem").Hex | null;
|
|
435
435
|
v: bigint;
|
|
436
|
+
value: bigint;
|
|
436
437
|
accessList: import("viem").AccessList;
|
|
437
438
|
authorizationList: import("viem").SignedAuthorizationList;
|
|
438
439
|
blobVersionedHashes?: undefined | undefined;
|
|
@@ -452,6 +453,7 @@ export declare function usePublicClient(chain: Chain, rpcUrl: string): {
|
|
|
452
453
|
getChainId: () => Promise<import("viem").GetChainIdReturnType>;
|
|
453
454
|
getCode: (args: import("viem").GetBytecodeParameters) => Promise<import("viem").GetBytecodeReturnType>;
|
|
454
455
|
getContractEvents: <const abi extends Abi | readonly unknown[], eventName extends import("viem").ContractEventName<abi> | undefined = undefined, strict extends boolean | undefined = undefined, fromBlock extends import("viem").BlockNumber | import("viem").BlockTag | undefined = undefined, toBlock extends import("viem").BlockNumber | import("viem").BlockTag | undefined = undefined>(args: import("viem").GetContractEventsParameters<abi, eventName, strict, fromBlock, toBlock>) => Promise<import("viem").GetContractEventsReturnType<abi, eventName, strict, fromBlock, toBlock>>;
|
|
456
|
+
getDelegation: (args: import("viem").GetDelegationParameters) => Promise<import("viem").GetDelegationReturnType>;
|
|
455
457
|
getEip712Domain: (args: import("viem").GetEip712DomainParameters) => Promise<import("viem").GetEip712DomainReturnType>;
|
|
456
458
|
getEnsAddress: (args: import("viem").GetEnsAddressParameters) => Promise<import("viem").GetEnsAddressReturnType>;
|
|
457
459
|
getEnsAvatar: (args: import("viem").GetEnsAvatarParameters) => Promise<import("viem").GetEnsAvatarReturnType>;
|
|
@@ -471,7 +473,6 @@ export declare function usePublicClient(chain: Chain, rpcUrl: string): {
|
|
|
471
473
|
getStorageAt: (args: import("viem").GetStorageAtParameters) => Promise<import("viem").GetStorageAtReturnType>;
|
|
472
474
|
getTransaction: <blockTag extends import("viem").BlockTag = "latest">(args: import("viem").GetTransactionParameters<blockTag>) => Promise<{
|
|
473
475
|
type: "legacy";
|
|
474
|
-
value: bigint;
|
|
475
476
|
yParity?: undefined | undefined;
|
|
476
477
|
from: Address;
|
|
477
478
|
gas: bigint;
|
|
@@ -483,6 +484,7 @@ export declare function usePublicClient(chain: Chain, rpcUrl: string): {
|
|
|
483
484
|
to: Address | null;
|
|
484
485
|
typeHex: import("viem").Hex | null;
|
|
485
486
|
v: bigint;
|
|
487
|
+
value: bigint;
|
|
486
488
|
accessList?: undefined | undefined;
|
|
487
489
|
authorizationList?: undefined | undefined;
|
|
488
490
|
blobVersionedHashes?: undefined | undefined;
|
|
@@ -496,7 +498,6 @@ export declare function usePublicClient(chain: Chain, rpcUrl: string): {
|
|
|
496
498
|
transactionIndex: (blockTag extends "pending" ? true : false) extends infer T_2 ? T_2 extends (blockTag extends "pending" ? true : false) ? T_2 extends true ? null : number : never : never;
|
|
497
499
|
} | {
|
|
498
500
|
type: "eip2930";
|
|
499
|
-
value: bigint;
|
|
500
501
|
yParity: number;
|
|
501
502
|
from: Address;
|
|
502
503
|
gas: bigint;
|
|
@@ -508,6 +509,7 @@ export declare function usePublicClient(chain: Chain, rpcUrl: string): {
|
|
|
508
509
|
to: Address | null;
|
|
509
510
|
typeHex: import("viem").Hex | null;
|
|
510
511
|
v: bigint;
|
|
512
|
+
value: bigint;
|
|
511
513
|
accessList: import("viem").AccessList;
|
|
512
514
|
authorizationList?: undefined | undefined;
|
|
513
515
|
blobVersionedHashes?: undefined | undefined;
|
|
@@ -521,7 +523,6 @@ export declare function usePublicClient(chain: Chain, rpcUrl: string): {
|
|
|
521
523
|
transactionIndex: (blockTag extends "pending" ? true : false) extends infer T_5 ? T_5 extends (blockTag extends "pending" ? true : false) ? T_5 extends true ? null : number : never : never;
|
|
522
524
|
} | {
|
|
523
525
|
type: "eip1559";
|
|
524
|
-
value: bigint;
|
|
525
526
|
yParity: number;
|
|
526
527
|
from: Address;
|
|
527
528
|
gas: bigint;
|
|
@@ -533,6 +534,7 @@ export declare function usePublicClient(chain: Chain, rpcUrl: string): {
|
|
|
533
534
|
to: Address | null;
|
|
534
535
|
typeHex: import("viem").Hex | null;
|
|
535
536
|
v: bigint;
|
|
537
|
+
value: bigint;
|
|
536
538
|
accessList: import("viem").AccessList;
|
|
537
539
|
authorizationList?: undefined | undefined;
|
|
538
540
|
blobVersionedHashes?: undefined | undefined;
|
|
@@ -546,7 +548,6 @@ export declare function usePublicClient(chain: Chain, rpcUrl: string): {
|
|
|
546
548
|
transactionIndex: (blockTag extends "pending" ? true : false) extends infer T_8 ? T_8 extends (blockTag extends "pending" ? true : false) ? T_8 extends true ? null : number : never : never;
|
|
547
549
|
} | {
|
|
548
550
|
type: "eip4844";
|
|
549
|
-
value: bigint;
|
|
550
551
|
yParity: number;
|
|
551
552
|
from: Address;
|
|
552
553
|
gas: bigint;
|
|
@@ -558,6 +559,7 @@ export declare function usePublicClient(chain: Chain, rpcUrl: string): {
|
|
|
558
559
|
to: Address | null;
|
|
559
560
|
typeHex: import("viem").Hex | null;
|
|
560
561
|
v: bigint;
|
|
562
|
+
value: bigint;
|
|
561
563
|
accessList: import("viem").AccessList;
|
|
562
564
|
authorizationList?: undefined | undefined;
|
|
563
565
|
blobVersionedHashes: readonly import("viem").Hex[];
|
|
@@ -571,7 +573,6 @@ export declare function usePublicClient(chain: Chain, rpcUrl: string): {
|
|
|
571
573
|
transactionIndex: (blockTag extends "pending" ? true : false) extends infer T_11 ? T_11 extends (blockTag extends "pending" ? true : false) ? T_11 extends true ? null : number : never : never;
|
|
572
574
|
} | {
|
|
573
575
|
type: "eip7702";
|
|
574
|
-
value: bigint;
|
|
575
576
|
yParity: number;
|
|
576
577
|
from: Address;
|
|
577
578
|
gas: bigint;
|
|
@@ -583,6 +584,7 @@ export declare function usePublicClient(chain: Chain, rpcUrl: string): {
|
|
|
583
584
|
to: Address | null;
|
|
584
585
|
typeHex: import("viem").Hex | null;
|
|
585
586
|
v: bigint;
|
|
587
|
+
value: bigint;
|
|
586
588
|
accessList: import("viem").AccessList;
|
|
587
589
|
authorizationList: import("viem").SignedAuthorizationList;
|
|
588
590
|
blobVersionedHashes?: undefined | undefined;
|
|
@@ -3877,6 +3879,7 @@ export declare function usePublicClient(chain: Chain, rpcUrl: string): {
|
|
|
3877
3879
|
cacheTime?: undefined;
|
|
3878
3880
|
ccipRead?: undefined;
|
|
3879
3881
|
chain?: undefined;
|
|
3882
|
+
dataSuffix?: undefined;
|
|
3880
3883
|
experimental_blockTag?: undefined;
|
|
3881
3884
|
key?: undefined;
|
|
3882
3885
|
name?: undefined;
|
|
@@ -3885,7 +3888,7 @@ export declare function usePublicClient(chain: Chain, rpcUrl: string): {
|
|
|
3885
3888
|
transport?: undefined;
|
|
3886
3889
|
type?: undefined;
|
|
3887
3890
|
uid?: undefined;
|
|
3888
|
-
} & import("viem").ExactPartial<Pick<import("viem").PublicActions<import("viem").Transport, Chain | undefined, undefined>, "call" | "createContractEventFilter" | "createEventFilter" | "estimateContractGas" | "estimateGas" | "getBlock" | "getBlockNumber" | "getChainId" | "getContractEvents" | "getEnsText" | "getFilterChanges" | "getGasPrice" | "getLogs" | "getTransaction" | "getTransactionCount" | "getTransactionReceipt" | "
|
|
3891
|
+
} & import("viem").ExactPartial<Pick<import("viem").PublicActions<import("viem").Transport, Chain | undefined, undefined>, "prepareTransactionRequest" | "call" | "createContractEventFilter" | "createEventFilter" | "estimateContractGas" | "estimateGas" | "getBlock" | "getBlockNumber" | "getChainId" | "getContractEvents" | "getEnsText" | "getFilterChanges" | "getGasPrice" | "getLogs" | "getTransaction" | "getTransactionCount" | "getTransactionReceipt" | "readContract" | "sendRawTransaction" | "simulateContract" | "uninstallFilter" | "watchBlockNumber" | "watchContractEvent"> & Pick<import("viem").WalletActions<Chain | undefined, undefined>, "sendTransaction" | "writeContract">>>(fn: (client: import("viem").Client<import("viem").Transport, Chain | undefined, undefined, import("viem").PublicRpcSchema, import("viem").PublicActions<import("viem").Transport, Chain | undefined>>) => client) => import("viem").Client<import("viem").Transport, Chain | undefined, undefined, import("viem").PublicRpcSchema, { [K in keyof client]: client[K]; } & import("viem").PublicActions<import("viem").Transport, Chain | undefined>>;
|
|
3889
3892
|
};
|
|
3890
3893
|
};
|
|
3891
3894
|
/**
|
|
@@ -3926,6 +3929,7 @@ export declare function useWalletClient(chain: any, rpcUrl?: string): {
|
|
|
3926
3929
|
request?: (parameters: import("viem").CcipRequestParameters) => Promise<import("viem/_types/utils/ccip").CcipRequestReturnType>;
|
|
3927
3930
|
} | undefined;
|
|
3928
3931
|
chain: Chain | undefined;
|
|
3932
|
+
dataSuffix?: import("viem").DataSuffix | undefined;
|
|
3929
3933
|
experimental_blockTag?: import("viem").BlockTag | undefined;
|
|
3930
3934
|
key: string;
|
|
3931
3935
|
name: string;
|
|
@@ -8337,6 +8341,7 @@ export declare function useWalletClient(chain: any, rpcUrl?: string): {
|
|
|
8337
8341
|
cacheTime?: undefined;
|
|
8338
8342
|
ccipRead?: undefined;
|
|
8339
8343
|
chain?: undefined;
|
|
8344
|
+
dataSuffix?: undefined;
|
|
8340
8345
|
experimental_blockTag?: undefined;
|
|
8341
8346
|
key?: undefined;
|
|
8342
8347
|
name?: undefined;
|
|
@@ -8345,7 +8350,7 @@ export declare function useWalletClient(chain: any, rpcUrl?: string): {
|
|
|
8345
8350
|
transport?: undefined;
|
|
8346
8351
|
type?: undefined;
|
|
8347
8352
|
uid?: undefined;
|
|
8348
|
-
} & import("viem").ExactPartial<Pick<import("viem").PublicActions<import("viem").Transport, Chain | undefined, import("viem").Account | undefined>, "call" | "createContractEventFilter" | "createEventFilter" | "estimateContractGas" | "estimateGas" | "getBlock" | "getBlockNumber" | "getChainId" | "getContractEvents" | "getEnsText" | "getFilterChanges" | "getGasPrice" | "getLogs" | "getTransaction" | "getTransactionCount" | "getTransactionReceipt" | "
|
|
8353
|
+
} & import("viem").ExactPartial<Pick<import("viem").PublicActions<import("viem").Transport, Chain | undefined, import("viem").Account | undefined>, "prepareTransactionRequest" | "call" | "createContractEventFilter" | "createEventFilter" | "estimateContractGas" | "estimateGas" | "getBlock" | "getBlockNumber" | "getChainId" | "getContractEvents" | "getEnsText" | "getFilterChanges" | "getGasPrice" | "getLogs" | "getTransaction" | "getTransactionCount" | "getTransactionReceipt" | "readContract" | "sendRawTransaction" | "simulateContract" | "uninstallFilter" | "watchBlockNumber" | "watchContractEvent"> & Pick<import("viem").WalletActions<Chain | undefined, import("viem").Account | undefined>, "sendTransaction" | "writeContract">>>(fn: (client: import("viem").Client<import("viem").Transport, Chain | undefined, import("viem").Account | undefined, import("viem").WalletRpcSchema, import("viem").WalletActions<Chain | undefined, import("viem").Account | undefined>>) => client) => import("viem").Client<import("viem").Transport, Chain | undefined, import("viem").Account | undefined, import("viem").WalletRpcSchema, { [K in keyof client]: client[K]; } & import("viem").WalletActions<Chain | undefined, import("viem").Account | undefined>>;
|
|
8349
8354
|
};
|
|
8350
8355
|
};
|
|
8351
8356
|
/**
|
|
@@ -8863,6 +8868,7 @@ export declare function useExternalWalletClient(): {
|
|
|
8863
8868
|
request?: (parameters: import("viem").CcipRequestParameters) => Promise<import("viem/_types/utils/ccip").CcipRequestReturnType>;
|
|
8864
8869
|
} | undefined;
|
|
8865
8870
|
chain: Chain;
|
|
8871
|
+
dataSuffix?: import("viem").DataSuffix | undefined;
|
|
8866
8872
|
experimental_blockTag?: import("viem").BlockTag | undefined;
|
|
8867
8873
|
key: string;
|
|
8868
8874
|
name: string;
|
|
@@ -13274,6 +13280,7 @@ export declare function useExternalWalletClient(): {
|
|
|
13274
13280
|
cacheTime?: undefined;
|
|
13275
13281
|
ccipRead?: undefined;
|
|
13276
13282
|
chain?: undefined;
|
|
13283
|
+
dataSuffix?: undefined;
|
|
13277
13284
|
experimental_blockTag?: undefined;
|
|
13278
13285
|
key?: undefined;
|
|
13279
13286
|
name?: undefined;
|
|
@@ -13282,7 +13289,7 @@ export declare function useExternalWalletClient(): {
|
|
|
13282
13289
|
transport?: undefined;
|
|
13283
13290
|
type?: undefined;
|
|
13284
13291
|
uid?: undefined;
|
|
13285
|
-
} & import("viem").ExactPartial<Pick<import("viem").PublicActions<import("wagmi").Transport<string, Record<string, any>, import("viem").EIP1193RequestFn>, Chain, import("viem").Account>, "call" | "createContractEventFilter" | "createEventFilter" | "estimateContractGas" | "estimateGas" | "getBlock" | "getBlockNumber" | "getChainId" | "getContractEvents" | "getEnsText" | "getFilterChanges" | "getGasPrice" | "getLogs" | "getTransaction" | "getTransactionCount" | "getTransactionReceipt" | "
|
|
13292
|
+
} & import("viem").ExactPartial<Pick<import("viem").PublicActions<import("wagmi").Transport<string, Record<string, any>, import("viem").EIP1193RequestFn>, Chain, import("viem").Account>, "prepareTransactionRequest" | "call" | "createContractEventFilter" | "createEventFilter" | "estimateContractGas" | "estimateGas" | "getBlock" | "getBlockNumber" | "getChainId" | "getContractEvents" | "getEnsText" | "getFilterChanges" | "getGasPrice" | "getLogs" | "getTransaction" | "getTransactionCount" | "getTransactionReceipt" | "readContract" | "sendRawTransaction" | "simulateContract" | "uninstallFilter" | "watchBlockNumber" | "watchContractEvent"> & Pick<import("viem").WalletActions<Chain, import("viem").Account>, "sendTransaction" | "writeContract">>>(fn: (client: import("viem").Client<import("wagmi").Transport<string, Record<string, any>, import("viem").EIP1193RequestFn>, Chain, import("viem").Account, import("viem").WalletRpcSchema, import("viem").WalletActions<Chain, import("viem").Account>>) => client) => import("viem").Client<import("wagmi").Transport<string, Record<string, any>, import("viem").EIP1193RequestFn>, Chain, import("viem").Account, import("viem").WalletRpcSchema, { [K in keyof client]: client[K]; } & import("viem").WalletActions<Chain, import("viem").Account>>;
|
|
13286
13293
|
} | null;
|
|
13287
13294
|
isConnected: boolean;
|
|
13288
13295
|
isPending: boolean;
|
package/dist/src/hooks.js
CHANGED
|
@@ -504,7 +504,7 @@ export function useExternalWalletChain() {
|
|
|
504
504
|
* ```
|
|
505
505
|
*/
|
|
506
506
|
export function useExternalWalletInfo() {
|
|
507
|
-
const { externalWalletChainId, externalWalletNetwork,
|
|
507
|
+
const { externalWalletChainId, externalWalletNetwork, isExternalWalletConnected, externalWalletAddress, externalWalletBalance, } = useExternalWallet();
|
|
508
508
|
const { sendTransaction, signMessage, signTransaction, switchChain, } = useAbstraxnWallet();
|
|
509
509
|
const [formattedBalance, setFormattedBalance] = useState('0');
|
|
510
510
|
useEffect(() => {
|
|
@@ -571,8 +571,8 @@ export function useExternalWalletInfo() {
|
|
|
571
571
|
// Balance information
|
|
572
572
|
balance: externalWalletBalance, // BigInt in wei
|
|
573
573
|
formattedBalance, // String formatted as ETH (e.g., "0.123456")
|
|
574
|
-
//
|
|
575
|
-
switchChain
|
|
574
|
+
// Unified chain switch (embedded + external); not only switchExternalWalletChain.
|
|
575
|
+
switchChain,
|
|
576
576
|
// Connection status
|
|
577
577
|
isConnected: isExternalWalletConnected,
|
|
578
578
|
address: externalWalletAddress,
|
|
@@ -9,7 +9,13 @@ import { type Chain as CoreChain } from "@abstraxn/signer-core";
|
|
|
9
9
|
* Note: Uses 'injected' connector which automatically detects MetaMask and other wallets
|
|
10
10
|
* without requiring @metamask/sdk
|
|
11
11
|
*/
|
|
12
|
-
export declare function createWagmiConfig(chains?: CoreChain[] | Chain[], walletConnectProjectId?: string, enabledConnectors?: ("injected" | "metaMask" | "walletConnect")[], theme?: "light" | "dark", ssr?: boolean
|
|
12
|
+
export declare function createWagmiConfig(chains?: CoreChain[] | Chain[], walletConnectProjectId?: string, enabledConnectors?: ("injected" | "metaMask" | "walletConnect")[], theme?: "light" | "dark", ssr?: boolean,
|
|
13
|
+
/**
|
|
14
|
+
* When true, builds a wagmi config with **no** wallet connectors. Used when
|
|
15
|
+
* `externalWallets.enabled` is false so hooks like `useConfig` / `useAccount`
|
|
16
|
+
* still work for embedded flows without exposing MetaMask / WalletConnect.
|
|
17
|
+
*/
|
|
18
|
+
embedOnly?: boolean): Config;
|
|
13
19
|
/**
|
|
14
20
|
* External wallet connector types
|
|
15
21
|
*/
|
package/dist/src/wagmiConfig.js
CHANGED
|
@@ -35,7 +35,13 @@ function convertToViemChain(chain) {
|
|
|
35
35
|
* Note: Uses 'injected' connector which automatically detects MetaMask and other wallets
|
|
36
36
|
* without requiring @metamask/sdk
|
|
37
37
|
*/
|
|
38
|
-
export function createWagmiConfig(chains, walletConnectProjectId, enabledConnectors, theme, ssr
|
|
38
|
+
export function createWagmiConfig(chains, walletConnectProjectId, enabledConnectors, theme, ssr,
|
|
39
|
+
/**
|
|
40
|
+
* When true, builds a wagmi config with **no** wallet connectors. Used when
|
|
41
|
+
* `externalWallets.enabled` is false so hooks like `useConfig` / `useAccount`
|
|
42
|
+
* still work for embedded flows without exposing MetaMask / WalletConnect.
|
|
43
|
+
*/
|
|
44
|
+
embedOnly) {
|
|
39
45
|
// Normalize chains to ensure they are all valid viem Chain objects
|
|
40
46
|
// This handles mixed arrays of viem Chains and CoreChains (e.g. custom chains)
|
|
41
47
|
const viemChains = chains && chains.length > 0
|
|
@@ -48,6 +54,28 @@ export function createWagmiConfig(chains, walletConnectProjectId, enabledConnect
|
|
|
48
54
|
return convertToViemChain(chain);
|
|
49
55
|
})
|
|
50
56
|
: SUPPORTED_CHAINS.map(convertToViemChain);
|
|
57
|
+
// Ensure we have at least one chain (shared by embed + full config)
|
|
58
|
+
if (viemChains.length === 0) {
|
|
59
|
+
throw new Error("At least one chain is required");
|
|
60
|
+
}
|
|
61
|
+
const transports = viemChains.reduce((acc, chain) => {
|
|
62
|
+
acc[chain.id] = http();
|
|
63
|
+
return acc;
|
|
64
|
+
}, {});
|
|
65
|
+
const storage = ssr
|
|
66
|
+
? createStorage({ storage: cookieStorage })
|
|
67
|
+
: typeof window !== "undefined"
|
|
68
|
+
? createStorage({ storage: window.localStorage })
|
|
69
|
+
: undefined;
|
|
70
|
+
if (embedOnly) {
|
|
71
|
+
return createConfig({
|
|
72
|
+
chains: viemChains,
|
|
73
|
+
connectors: [],
|
|
74
|
+
transports,
|
|
75
|
+
storage,
|
|
76
|
+
ssr: !!ssr,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
51
79
|
const connectors = [];
|
|
52
80
|
// Add connectors based on enabled list
|
|
53
81
|
// Note: 'injected' connector will automatically detect MetaMask and other injected wallets
|
|
@@ -95,23 +123,11 @@ export function createWagmiConfig(chains, walletConnectProjectId, enabledConnect
|
|
|
95
123
|
}));
|
|
96
124
|
}
|
|
97
125
|
}
|
|
98
|
-
// Ensure we have at least one chain
|
|
99
|
-
if (viemChains.length === 0) {
|
|
100
|
-
throw new Error("At least one chain is required");
|
|
101
|
-
}
|
|
102
126
|
return createConfig({
|
|
103
127
|
chains: viemChains,
|
|
104
128
|
connectors,
|
|
105
|
-
transports
|
|
106
|
-
|
|
107
|
-
return acc;
|
|
108
|
-
}, {}),
|
|
109
|
-
// Configure storage based on SSR setting
|
|
110
|
-
storage: ssr
|
|
111
|
-
? createStorage({ storage: cookieStorage })
|
|
112
|
-
: typeof window !== "undefined"
|
|
113
|
-
? createStorage({ storage: window.localStorage })
|
|
114
|
-
: undefined,
|
|
129
|
+
transports,
|
|
130
|
+
storage,
|
|
115
131
|
ssr: !!ssr,
|
|
116
132
|
});
|
|
117
133
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abstraxn/signer-react",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.3",
|
|
4
4
|
"description": "React SDK for Abstraxn Wallet - React components, hooks, and providers for seamless Web3 wallet integration",
|
|
5
5
|
"main": "./dist/src/index.js",
|
|
6
6
|
"module": "./dist/src/index.js",
|