Skip to content

feat: introduce concrete signer / provider#268

Draft
enitrat wants to merge 10 commits intoprereleasefrom
feat/split-signer-provider
Draft

feat: introduce concrete signer / provider#268
enitrat wants to merge 10 commits intoprereleasefrom
feat/split-signer-provider

Conversation

@enitrat
Copy link
Copy Markdown
Contributor

@enitrat enitrat commented Apr 17, 2026

[wip]

@cla-bot cla-bot Bot added the cla-signed label Apr 17, 2026
@enitrat enitrat force-pushed the feat/split-signer-provider branch from 1582891 to 10c097c Compare April 17, 2026 17:07
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 17, 2026

Public API Changes

Expand to see full diff
diff -ru a/react-sdk-wagmi.api.md b/react-sdk-wagmi.api.md
--- a/react-sdk-wagmi.api.md	2026-04-20 16:52:57.087576391 +0000
+++ b/react-sdk-wagmi.api.md	2026-04-20 16:52:57.120075703 +0000
@@ -8,6 +8,7 @@
 import { Config } from 'wagmi';
 import { ContractAbi } from '@zama-fhe/sdk';
 import { EIP712TypedData } from '@zama-fhe/sdk';
+import { GenericProvider } from '@zama-fhe/sdk';
 import { GenericSigner } from '@zama-fhe/sdk';
 import { Hex } from '@zama-fhe/sdk';
 import { ReadContractArgs } from '@zama-fhe/sdk';
@@ -21,29 +22,39 @@
 import { WriteFunctionName } from '@zama-fhe/sdk';
 
 // @public
-export class WagmiSigner implements GenericSigner {
-    constructor(signerConfig: WagmiSignerConfig);
-    // (undocumented)
-    getAddress(): Promise<Address>;
+export class ZamaWagmiProvider implements GenericProvider {
+    constructor(providerConfig: ZamaWagmiProviderConfig);
     // (undocumented)
     getBlockTimestamp(): Promise<bigint>;
     // (undocumented)
     getChainId(): Promise<number>;
     // (undocumented)
     readContract<const TAbi extends ContractAbi, TFunctionName extends ReadFunctionName<TAbi>, const TArgs extends ReadContractArgs<TAbi, TFunctionName>>(config: ReadContractConfig<TAbi, TFunctionName, TArgs>): Promise<ReadContractReturnType<TAbi, TFunctionName, TArgs>>;
+    waitForTransactionReceipt(hash: Hex): Promise<TransactionReceipt>;
+}
+
+// @public
+export interface ZamaWagmiProviderConfig {
+    config: Config;
+}
+
+// @public
+export class ZamaWagmiSigner implements GenericSigner {
+    constructor(signerConfig: ZamaWagmiSignerConfig);
+    // (undocumented)
+    getAddress(): Promise<Address>;
+    // (undocumented)
+    getChainId(): Promise<number>;
     // (undocumented)
     signTypedData(typedData: EIP712TypedData): Promise<Hex>;
     // (undocumented)
     subscribe(input: SignerLifecycleCallbacks): () => void;
     // (undocumented)
-    waitForTransactionReceipt(hash: Hex): Promise<TransactionReceipt>;
-    // (undocumented)
     writeContract<const TAbi extends ContractAbi, TFunctionName extends WriteFunctionName<TAbi>, const TArgs extends WriteContractArgs<TAbi, TFunctionName>>(config: WriteContractConfig<TAbi, TFunctionName, TArgs>): Promise<Hex>;
 }
 
 // @public
-export interface WagmiSignerConfig {
-    // (undocumented)
+export interface ZamaWagmiSignerConfig {
     config: Config;
 }
 
diff -ru a/react-sdk.api.md b/react-sdk.api.md
--- a/react-sdk.api.md	2026-04-20 16:52:57.089576400 +0000
+++ b/react-sdk.api.md	2026-04-20 16:52:57.120111319 +0000
@@ -26,6 +26,7 @@
 import { EIP712TypedData } from '@zama-fhe/sdk';
 import { EncryptParams } from '@zama-fhe/sdk';
 import { FinalizeUnwrapParams } from '@zama-fhe/sdk/query';
+import { GenericProvider } from '@zama-fhe/sdk';
 import { GenericSigner } from '@zama-fhe/sdk';
 import { GenericStorage } from '@zama-fhe/sdk';
 import { PaginatedResult } from '@zama-fhe/sdk';
@@ -36,6 +37,7 @@
 import { ResumeUnshieldParams } from '@zama-fhe/sdk/query';
 import { RevokeDelegationParams } from '@zama-fhe/sdk/query';
 import { ShieldParams } from '@zama-fhe/sdk/query';
+import { Token } from '@zama-fhe/sdk';
 import { TokenMetadata } from '@zama-fhe/sdk/query';
 import { TokenWrapperPair } from '@zama-fhe/sdk';
 import { TokenWrapperPairWithMetadata } from '@zama-fhe/sdk';
@@ -250,7 +252,15 @@
 }
 
 // @public
-export function useToken(config: UseZamaConfig): _$_zama_fhe_sdk0.Token;
+export function useSignerAddress(): Address | undefined;
+
+// @public
+export function useSignerAddressSuspense(): {
+    data: Address;
+};
+
+// @public
+export function useToken(config: UseZamaConfig): Token;
 
 // @public
 export function useTokenAddress(input: {
@@ -347,6 +357,7 @@
 export interface ZamaProviderProps extends PropsWithChildren {
     keypairTTL?: number;
     onEvent?: ZamaSDKEventListener;
+    provider: GenericProvider;
     registryAddresses?: Record<number, Address>;
     registryTTL?: number;
     relayer: RelayerSDK;
diff -ru a/sdk-ethers.api.md b/sdk-ethers.api.md
--- a/sdk-ethers.api.md	2026-04-20 16:52:57.092576414 +0000
+++ b/sdk-ethers.api.md	2026-04-20 16:52:57.119628096 +0000
@@ -28,13 +28,11 @@
 
 export { EIP1193Provider }
 
-// Warning: (ae-forgotten-export) The symbol "GenericSigner" needs to be exported by the entry point index.d.ts
+// Warning: (ae-forgotten-export) The symbol "GenericProvider" needs to be exported by the entry point index.d.ts
 //
 // @public
-export class EthersSigner implements GenericSigner {
-    constructor(config: EthersSignerConfig);
-    // (undocumented)
-    getAddress(): Promise<Address>;
+export class EthersProvider implements GenericProvider {
+    constructor(config: EthersProviderConfig);
     // (undocumented)
     getBlockTimestamp(): Promise<bigint>;
     // (undocumented)
@@ -43,6 +41,26 @@
     //
     // (undocumented)
     readContract<const TAbi extends Abi | readonly unknown[], TFunctionName extends ContractFunctionName<TAbi, "pure" | "view">, const TArgs extends ContractFunctionArgs<TAbi, "pure" | "view", TFunctionName>>(config: ReadContractConfig<TAbi, TFunctionName, TArgs>): Promise<ContractFunctionReturnType<TAbi, "pure" | "view", TFunctionName, TArgs>>;
+    // Warning: (ae-forgotten-export) The symbol "TransactionReceipt" needs to be exported by the entry point index.d.ts
+    waitForTransactionReceipt(hash: Hex): Promise<TransactionReceipt>;
+}
+
+// @public
+export type EthersProviderConfig = {
+    ethereum: EIP1193Provider;
+} | {
+    provider: ethers.Provider;
+};
+
+// Warning: (ae-forgotten-export) The symbol "GenericSigner" needs to be exported by the entry point index.d.ts
+//
+// @public
+export class EthersSigner implements GenericSigner {
+    constructor(config: EthersSignerConfig);
+    // (undocumented)
+    getAddress(): Promise<Address>;
+    // (undocumented)
+    getChainId(): Promise<number>;
     // Warning: (ae-forgotten-export) The symbol "EIP712TypedData" needs to be exported by the entry point index.d.ts
     //
     // (undocumented)
@@ -51,10 +69,6 @@
     //
     // (undocumented)
     subscribe(callbacks: SignerLifecycleCallbacks): () => void;
-    // Warning: (ae-forgotten-export) The symbol "TransactionReceipt" needs to be exported by the entry point index.d.ts
-    //
-    // (undocumented)
-    waitForTransactionReceipt(hash: Hex): Promise<TransactionReceipt>;
     // Warning: (ae-forgotten-export) The symbol "WriteContractConfig" needs to be exported by the entry point index.d.ts
     //
     // (undocumented)
@@ -66,8 +80,6 @@
     ethereum: EIP1193Provider;
 } | {
     signer: Signer;
-} | {
-    provider: ethers.Provider;
 };
 
 export { ProviderConnectInfo }
diff -ru a/sdk-query.api.md b/sdk-query.api.md
--- a/sdk-query.api.md	2026-04-20 16:52:57.098576441 +0000
+++ b/sdk-query.api.md	2026-04-20 16:52:57.119716170 +0000
@@ -109,7 +109,7 @@
     tokenAddress: Address;
 }
 
-// @public (undocumented)
+// @public
 export function confidentialBalanceQueryOptions(token: ReadonlyToken, config: ConfidentialBalanceQueryConfig): QueryFactoryOptions<bigint, Error, bigint, ReturnType<typeof zamaQueryKeys.confidentialBalance.owner>>;
 
 // @public (undocumented)
@@ -134,7 +134,7 @@
 }
 
 // @public (undocumented)
-export function confidentialIsApprovedQueryOptions(signer: GenericSigner, tokenAddress: Address | undefined, config: ConfidentialIsApprovedQueryConfig): QueryFactoryOptions<boolean, Error, boolean, ReturnType<typeof zamaQueryKeys.confidentialIsApproved.scope>>;
+export function confidentialIsApprovedQueryOptions(sdk: ZamaSDK, tokenAddress: Address | undefined, config: ConfidentialIsApprovedQueryConfig): QueryFactoryOptions<boolean, Error, boolean, ReturnType<typeof zamaQueryKeys.confidentialIsApproved.scope>>;
 
 // @public (undocumented)
 export interface ConfidentialTokenAddressQueryConfig extends WrappersRegistryQueryConfig {
@@ -143,7 +143,7 @@
 }
 
 // @public (undocumented)
-export function confidentialTokenAddressQueryOptions(signer: GenericSigner, config: ConfidentialTokenAddressQueryConfig): QueryFactoryOptions<readonly [boolean, Address], Error, readonly [boolean, Address], ReturnType<typeof zamaQueryKeys.wrappersRegistry.confidentialTokenAddress>>;
+export function confidentialTokenAddressQueryOptions(sdk: ZamaSDK, config: ConfidentialTokenAddressQueryConfig): QueryFactoryOptions<readonly [boolean, Address], Error, readonly [boolean, Address], ReturnType<typeof zamaQueryKeys.wrappersRegistry.confidentialTokenAddress>>;
 
 // @public
 export interface ConfidentialTransferEvent {
@@ -413,10 +413,7 @@
 }
 
 // @public (undocumented)
-export function delegationStatusQueryOptions(sdk: {
-    signer: GenericSigner;
-    relayer: RelayerSDK;
-}, config: DelegationStatusQueryConfig): QueryFactoryOptions<DelegationStatusData, Error, DelegationStatusData, ReturnType<typeof zamaQueryKeys.delegationStatus.scope>>;
+export function delegationStatusQueryOptions(sdk: ZamaSDK, config: DelegationStatusQueryConfig): QueryFactoryOptions<DelegationStatusData, Error, DelegationStatusData, ReturnType<typeof zamaQueryKeys.delegationStatus.scope>>;
 
 // @public (undocumented)
 export interface DelegationSubmittedEvent extends BaseEvent {
@@ -505,16 +502,9 @@
 // @public
 export interface GenericSigner {
     getAddress: () => Promise<Address>;
-    getBlockTimestamp: () => Promise<bigint>;
     getChainId(): Promise<number>;
-    // Warning: (ae-forgotten-export) The symbol "ReadFunctionName" needs to be exported by the entry point index.d.ts
-    // Warning: (ae-forgotten-export) The symbol "ReadContractArgs" needs to be exported by the entry point index.d.ts
-    // Warning: (ae-forgotten-export) The symbol "ReadContractConfig" needs to be exported by the entry point index.d.ts
-    // Warning: (ae-forgotten-export) The symbol "ReadContractReturnType" needs to be exported by the entry point index.d.ts
-    readContract<const TAbi extends ContractAbi, TFunctionName extends ReadFunctionName<TAbi>, const TArgs extends ReadContractArgs<TAbi, TFunctionName>>(config: ReadContractConfig<TAbi, TFunctionName, TArgs>): Promise<ReadContractReturnType<TAbi, TFunctionName, TArgs>>;
     signTypedData(typedData: EIP712TypedData): Promise<Hex>;
     subscribe?: (callbacks: SignerLifecycleCallbacks) => () => void;
-    waitForTransactionReceipt(hash: Hex): Promise<TransactionReceipt>;
     // Warning: (ae-forgotten-export) The symbol "ContractAbi" needs to be exported by the entry point index.d.ts
     // Warning: (ae-forgotten-export) The symbol "WriteFunctionName" needs to be exported by the entry point index.d.ts
     // Warning: (ae-forgotten-export) The symbol "WriteContractArgs" needs to be exported by the entry point index.d.ts
@@ -578,7 +568,7 @@
 }
 
 // @public (undocumented)
-export function isConfidentialQueryOptions(signer: GenericSigner, tokenAddress: Address, config?: IsConfidentialQueryConfig): QueryFactoryOptions<boolean, Error, boolean, ReturnType<typeof zamaQueryKeys.isConfidential.token>>;
+export function isConfidentialQueryOptions(sdk: ZamaSDK, tokenAddress: Address, config?: IsConfidentialQueryConfig): QueryFactoryOptions<boolean, Error, boolean, ReturnType<typeof zamaQueryKeys.isConfidential.token>>;
 
 // @public (undocumented)
 export interface IsConfidentialTokenValidQueryConfig extends WrappersRegistryQueryConfig {
@@ -587,10 +577,10 @@
 }
 
 // @public (undocumented)
-export function isConfidentialTokenValidQueryOptions(signer: GenericSigner, config: IsConfidentialTokenValidQueryConfig): QueryFactoryOptions<boolean, Error, boolean, ReturnType<typeof zamaQueryKeys.wrappersRegistry.isConfidentialTokenValid>>;
+export function isConfidentialTokenValidQueryOptions(sdk: ZamaSDK, config: IsConfidentialTokenValidQueryConfig): QueryFactoryOptions<boolean, Error, boolean, ReturnType<typeof zamaQueryKeys.wrappersRegistry.isConfidentialTokenValid>>;
 
 // @public (undocumented)
-export function isWrapperQueryOptions(signer: GenericSigner, tokenAddress: Address, config?: IsConfidentialQueryConfig): QueryFactoryOptions<boolean, Error, boolean, ReturnType<typeof zamaQueryKeys.isWrapper.token>>;
+export function isWrapperQueryOptions(sdk: ZamaSDK, tokenAddress: Address, config?: IsConfidentialQueryConfig): QueryFactoryOptions<boolean, Error, boolean, ReturnType<typeof zamaQueryKeys.isWrapper.token>>;
 
 // @public (undocumented)
 export interface ListPairsQueryConfig {
@@ -893,7 +883,7 @@
 }
 
 // @public (undocumented)
-export function tokenAddressQueryOptions(signer: GenericSigner, config: TokenAddressQueryConfig): QueryFactoryOptions<readonly [boolean, Address], Error, readonly [boolean, Address], ReturnType<typeof zamaQueryKeys.wrappersRegistry.tokenAddress>>;
+export function tokenAddressQueryOptions(sdk: ZamaSDK, config: TokenAddressQueryConfig): QueryFactoryOptions<readonly [boolean, Address], Error, readonly [boolean, Address], ReturnType<typeof zamaQueryKeys.wrappersRegistry.tokenAddress>>;
 
 // @public
 export interface TokenMetadata {
@@ -912,7 +902,7 @@
 }
 
 // @public (undocumented)
-export function tokenMetadataQueryOptions(signer: GenericSigner, tokenAddress: Address, config?: TokenMetadataQueryConfig): QueryFactoryOptions<TokenMetadata, Error, TokenMetadata, ReturnType<typeof zamaQueryKeys.tokenMetadata.token>>;
+export function tokenMetadataQueryOptions(sdk: ZamaSDK, tokenAddress: Address, config?: TokenMetadataQueryConfig): QueryFactoryOptions<TokenMetadata, Error, TokenMetadata, ReturnType<typeof zamaQueryKeys.tokenMetadata.token>>;
 
 // @public (undocumented)
 export interface TokenPairQueryConfig extends WrappersRegistryQueryConfig {
@@ -921,13 +911,13 @@
 }
 
 // @public (undocumented)
-export function tokenPairQueryOptions(signer: GenericSigner, config: TokenPairQueryConfig): QueryFactoryOptions<TokenWrapperPair, Error, TokenWrapperPair, ReturnType<typeof zamaQueryKeys.wrappersRegistry.tokenPair>>;
+export function tokenPairQueryOptions(sdk: ZamaSDK, config: TokenPairQueryConfig): QueryFactoryOptions<TokenWrapperPair, Error, TokenWrapperPair, ReturnType<typeof zamaQueryKeys.wrappersRegistry.tokenPair>>;
 
 // @public (undocumented)
-export function tokenPairsLengthQueryOptions(signer: GenericSigner, config: WrappersRegistryQueryConfig): QueryFactoryOptions<bigint, Error, bigint, ReturnType<typeof zamaQueryKeys.wrappersRegistry.tokenPairsLength>>;
+export function tokenPairsLengthQueryOptions(sdk: ZamaSDK, config: WrappersRegistryQueryConfig): QueryFactoryOptions<bigint, Error, bigint, ReturnType<typeof zamaQueryKeys.wrappersRegistry.tokenPairsLength>>;
 
 // @public (undocumented)
-export function tokenPairsQueryOptions(signer: GenericSigner, config: WrappersRegistryQueryConfig): QueryFactoryOptions<readonly TokenWrapperPair[], Error, readonly TokenWrapperPair[], ReturnType<typeof zamaQueryKeys.wrappersRegistry.tokenPairs>>;
+export function tokenPairsQueryOptions(sdk: ZamaSDK, config: WrappersRegistryQueryConfig): QueryFactoryOptions<readonly TokenWrapperPair[], Error, readonly TokenWrapperPair[], ReturnType<typeof zamaQueryKeys.wrappersRegistry.tokenPairs>>;
 
 // @public (undocumented)
 export interface TokenPairsSliceQueryConfig extends WrappersRegistryQueryConfig {
@@ -938,7 +928,7 @@
 }
 
 // @public (undocumented)
-export function tokenPairsSliceQueryOptions(signer: GenericSigner, config: TokenPairsSliceQueryConfig): QueryFactoryOptions<readonly TokenWrapperPair[], Error, readonly TokenWrapperPair[], ReturnType<typeof zamaQueryKeys.wrappersRegistry.tokenPairsSlice>>;
+export function tokenPairsSliceQueryOptions(sdk: ZamaSDK, config: TokenPairsSliceQueryConfig): QueryFactoryOptions<readonly TokenWrapperPair[], Error, readonly TokenWrapperPair[], ReturnType<typeof zamaQueryKeys.wrappersRegistry.tokenPairsSlice>>;
 
 // @public (undocumented)
 export interface TotalSupplyQueryConfig {
@@ -947,7 +937,7 @@
 }
 
 // @public (undocumented)
-export function totalSupplyQueryOptions(signer: GenericSigner, tokenAddress: Address, config?: TotalSupplyQueryConfig): QueryFactoryOptions<bigint, Error, bigint, ReturnType<typeof zamaQueryKeys.totalSupply.token>>;
+export function totalSupplyQueryOptions(sdk: ZamaSDK, tokenAddress: Address, config?: TotalSupplyQueryConfig): QueryFactoryOptions<bigint, Error, bigint, ReturnType<typeof zamaQueryKeys.totalSupply.token>>;
 
 // @public (undocumented)
 export interface TransactionErrorEvent extends BaseEvent {
@@ -1006,7 +996,7 @@
 }
 
 // @public (undocumented)
-export function underlyingAllowanceQueryOptions(signer: GenericSigner, tokenAddress: Address, config: UnderlyingAllowanceQueryConfig): QueryFactoryOptions<bigint, Error, bigint, ReturnType<typeof zamaQueryKeys.underlyingAllowance.scope>>;
+export function underlyingAllowanceQueryOptions(sdk: ZamaSDK, tokenAddress: Address, config: UnderlyingAllowanceQueryConfig): QueryFactoryOptions<bigint, Error, bigint, ReturnType<typeof zamaQueryKeys.underlyingAllowance.scope>>;
 
 // @public (undocumented)
 export function unshieldAllMutationOptions(token: Token): MutationFactoryOptions<readonly ["zama.unshieldAll", Address], UnshieldAllParams | void, TransactionResult>;
@@ -1175,9 +1165,6 @@
         readonly scope: (scope: number) => readonly ["zama.signerAddress", {
             readonly scope: number;
         }];
-        readonly token: (tokenAddress: Address) => readonly ["zama.signerAddress", {
-            readonly tokenAddress: `0x${string}`;
-        }];
     };
     readonly confidentialBalance: {
         readonly all: readonly ["zama.confidentialBalance"];
@@ -1365,10 +1352,15 @@
     dispose(): void;
     // @internal
     emitEvent(input: ZamaSDKEventInput, tokenAddress?: Address): void;
+    // Warning: (ae-forgotten-export) The symbol "GenericProvider" needs to be exported by the entry point index.d.ts
+    //
+    // (undocumented)
+    readonly provider: GenericProvider;
     publicDecrypt(handles: Handle[]): Promise<PublicDecryptResult>;
     readonly registry: WrappersRegistry;
     // (undocumented)
     readonly relayer: RelayerSDK;
+    requireChainAlignment(operation: string): Promise<number>;
     revokeSession(): Promise<void>;
     // (undocumented)
     readonly sessionStorage: GenericStorage;
@@ -1384,6 +1376,7 @@
 export interface ZamaSDKConfig {
     keypairTTL?: number;
     onEvent?: ZamaSDKEventListener;
+    provider: GenericProvider;
     registryAddresses?: Record<number, Address>;
     registryTTL?: number;
     relayer: RelayerSDK;
diff -ru a/sdk-viem.api.md b/sdk-viem.api.md
--- a/sdk-viem.api.md	2026-04-20 16:52:57.101576455 +0000
+++ b/sdk-viem.api.md	2026-04-20 16:52:57.119767106 +0000
@@ -59,13 +59,11 @@
 // @public (undocumented)
 export function readUnderlyingTokenContract(client: PublicClient, wrapperAddress: Address): Promise<`0x${string}`>;
 
-// Warning: (ae-forgotten-export) The symbol "GenericSigner" needs to be exported by the entry point index.d.ts
+// Warning: (ae-forgotten-export) The symbol "GenericProvider" needs to be exported by the entry point index.d.ts
 //
 // @public
-export class ViemSigner implements GenericSigner {
-    constructor(config: ViemSignerConfig);
-    // (undocumented)
-    getAddress(): Promise<Address>;
+export class ViemProvider implements GenericProvider {
+    constructor(config: ViemProviderConfig);
     // (undocumented)
     getBlockTimestamp(): Promise<bigint>;
     // (undocumented)
@@ -74,6 +72,26 @@
     //
     // (undocumented)
     readContract<const TAbi extends Abi | readonly unknown[], TFunctionName extends ContractFunctionName<TAbi, "pure" | "view">, const TArgs extends ContractFunctionArgs<TAbi, "pure" | "view", TFunctionName>>(config: ReadContractConfig<TAbi, TFunctionName, TArgs>): Promise<ContractFunctionReturnType<TAbi, "pure" | "view", TFunctionName, TArgs>>;
+    // Warning: (ae-forgotten-export) The symbol "TransactionReceipt" needs to be exported by the entry point index.d.ts
+    //
+    // (undocumented)
+    waitForTransactionReceipt(hash: Hex): Promise<TransactionReceipt>;
+}
+
+// @public
+export interface ViemProviderConfig {
+    publicClient: PublicClient;
+}
+
+// Warning: (ae-forgotten-export) The symbol "GenericSigner" needs to be exported by the entry point index.d.ts
+//
+// @public
+export class ViemSigner implements GenericSigner {
+    constructor(config: ViemSignerConfig);
+    // (undocumented)
+    getAddress(): Promise<Address>;
+    // (undocumented)
+    getChainId(): Promise<number>;
     // Warning: (ae-forgotten-export) The symbol "EIP712TypedData" needs to be exported by the entry point index.d.ts
     //
     // (undocumented)
@@ -82,10 +100,6 @@
     //
     // (undocumented)
     subscribe(callbacks: SignerLifecycleCallbacks): () => void;
-    // Warning: (ae-forgotten-export) The symbol "TransactionReceipt" needs to be exported by the entry point index.d.ts
-    //
-    // (undocumented)
-    waitForTransactionReceipt(hash: Hex): Promise<TransactionReceipt>;
     // Warning: (ae-forgotten-export) The symbol "WriteContractConfig" needs to be exported by the entry point index.d.ts
     //
     // (undocumented)
@@ -96,9 +110,7 @@
 export interface ViemSignerConfig {
     // (undocumented)
     ethereum?: EIP1193Provider;
-    // (undocumented)
-    publicClient: PublicClient;
-    walletClient?: WalletClient;
+    walletClient: WalletClient;
 }
 
 // @public (undocumented)
diff -ru a/sdk.api.md b/sdk.api.md
--- a/sdk.api.md	2026-04-20 16:52:57.106576478 +0000
+++ b/sdk.api.md	2026-04-20 16:52:57.119803554 +0000
@@ -529,6 +529,18 @@
 }
 
 // @public
+export class ChainMismatchError extends ZamaError {
+    constructor(input: {
+        operation: string;
+        signerChainId: number;
+        providerChainId: number;
+    }, options?: ErrorOptions);
+    readonly operation: string;
+    readonly providerChainId: number;
+    readonly signerChainId: number;
+}
+
+// @public
 export class ChromeSessionStorage implements GenericStorage {
     // (undocumented)
     delete(key: string): Promise<void>;
@@ -7487,14 +7499,19 @@
 }
 
 // @public
+export interface GenericProvider {
+    getBlockTimestamp(): Promise<bigint>;
+    getChainId(): Promise<number>;
+    readContract<const TAbi extends ContractAbi, TFunctionName extends ReadFunctionName<TAbi>, const TArgs extends ReadContractArgs<TAbi, TFunctionName>>(config: ReadContractConfig<TAbi, TFunctionName, TArgs>): Promise<ReadContractReturnType<TAbi, TFunctionName, TArgs>>;
+    waitForTransactionReceipt(hash: Hex): Promise<TransactionReceipt>;
+}
+
+// @public
 export interface GenericSigner {
     getAddress: () => Promise<Address>;
-    getBlockTimestamp: () => Promise<bigint>;
     getChainId(): Promise<number>;
-    readContract<const TAbi extends ContractAbi, TFunctionName extends ReadFunctionName<TAbi>, const TArgs extends ReadContractArgs<TAbi, TFunctionName>>(config: ReadContractConfig<TAbi, TFunctionName, TArgs>): Promise<ReadContractReturnType<TAbi, TFunctionName, TArgs>>;
     signTypedData(typedData: EIP712TypedData): Promise<Hex>;
     subscribe?: (callbacks: SignerLifecycleCallbacks) => () => void;
-    waitForTransactionReceipt(hash: Hex): Promise<TransactionReceipt>;
     writeContract<const TAbi extends ContractAbi, TFunctionName extends WriteFunctionName<TAbi>, const TArgs extends WriteContractArgs<TAbi, TFunctionName>>(config: WriteContractConfig<TAbi, TFunctionName, TArgs>): Promise<Hex>;
 }
 
@@ -20600,17 +20617,17 @@
     }): Promise<PaginatedResult<TokenWrapperPairWithMetadata>>;
     // (undocumented)
     listPairs(options?: ListPairsOptions): Promise<PaginatedResult<TokenWrapperPair>>;
-    refresh(): void;
     // (undocumented)
-    readonly signer: GenericSigner;
+    readonly provider: GenericProvider;
+    refresh(): void;
     get ttlMs(): number;
 }
 
 // @public
 export interface WrappersRegistryConfig {
+    provider: GenericProvider;
     registryAddresses?: Record<number, Address>;
     registryTTL?: number;
-    signer: GenericSigner;
 }
 
 // @public
@@ -20661,7 +20678,9 @@
     readonly DelegationContractIsSelf: "DELEGATION_CONTRACT_IS_SELF"; /** The ACL contract is paused. */
     readonly AclPaused: "ACL_PAUSED"; /** Expiration date is too soon (must be at least 1 hour in the future). */
     readonly DelegationExpirationTooSoon: "DELEGATION_EXPIRATION_TOO_SOON"; /** Delegation exists on-chain but hasn't propagated to the gateway yet. */
-    readonly DelegationNotPropagated: "DELEGATION_NOT_PROPAGATED";
+    readonly DelegationNotPropagated: "DELEGATION_NOT_PROPAGATED"; /** Operation requires a wallet signer but the SDK was configured without one. */
+    readonly SignerRequired: "SIGNER_REQUIRED"; /** Signer and provider are connected to different chains. */
+    readonly ChainMismatch: "CHAIN_MISMATCH";
 };
 
 // @public
@@ -20683,10 +20702,13 @@
     dispose(): void;
     // @internal
     emitEvent(input: ZamaSDKEventInput, tokenAddress?: Address): void;
+    // (undocumented)
+    readonly provider: GenericProvider;
     publicDecrypt(handles: Handle[]): Promise<PublicDecryptResult>;
     readonly registry: WrappersRegistry;
     // (undocumented)
     readonly relayer: RelayerSDK;
+    requireChainAlignment(operation: string): Promise<number>;
     revokeSession(): Promise<void>;
     // (undocumented)
     readonly sessionStorage: GenericStorage;
@@ -20702,6 +20724,7 @@
 export interface ZamaSDKConfig {
     keypairTTL?: number;
     onEvent?: ZamaSDKEventListener;
+    provider: GenericProvider;
     registryAddresses?: Record<number, Address>;
     registryTTL?: number;
     relayer: RelayerSDK;

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 17, 2026

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 92.61% (🎯 80%) 2886 / 3116
🔵 Statements 92.68% 2964 / 3198
🔵 Functions 92.3% (🎯 80%) 912 / 988
🔵 Branches 84.92% (🎯 80%) 1110 / 1307
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/react-sdk/src/provider.tsx 91.3% 75% 80% 90% 112-113
packages/react-sdk/src/test-fixtures.tsx 100% 100% 100% 100%
packages/react-sdk/src/use-signer-address.ts 100% 100% 100% 100%
packages/react-sdk/src/authorization/use-is-allowed.ts 100% 100% 100% 100%
packages/react-sdk/src/balance/use-confidential-balance.ts 100% 100% 100% 100%
packages/react-sdk/src/balance/use-confidential-balances.ts 100% 100% 100% 100%
packages/react-sdk/src/shield/use-approve-underlying.ts 100% 100% 100% 100%
packages/react-sdk/src/shield/use-shield.ts 100% 100% 100% 100%
packages/react-sdk/src/shield/use-underlying-allowance.ts 60% 75% 50% 60% 72-81
packages/react-sdk/src/token/use-is-confidential.ts 55.55% 100% 50% 55.55% 49-51, 92-94
packages/react-sdk/src/token/use-metadata.ts 100% 100% 100% 100%
packages/react-sdk/src/token/use-token.ts 100% 100% 100% 100%
packages/react-sdk/src/token/use-total-supply.ts 100% 100% 100% 100%
packages/react-sdk/src/transfer/use-confidential-approve.ts 100% 100% 100% 100%
packages/react-sdk/src/transfer/use-confidential-is-approved.ts 100% 87.5% 100% 100%
packages/react-sdk/src/transfer/use-confidential-transfer-from.ts 100% 100% 100% 100%
packages/react-sdk/src/transfer/use-confidential-transfer.ts 100% 100% 100% 100%
packages/react-sdk/src/unshield/use-resume-unshield.ts 100% 100% 100% 100%
packages/react-sdk/src/unshield/use-unshield-all.ts 100% 100% 100% 100%
packages/react-sdk/src/unshield/use-unshield.ts 100% 100% 100% 100%
packages/react-sdk/src/unwrap/use-finalize-unwrap.ts 100% 100% 100% 100%
packages/react-sdk/src/unwrap/use-unwrap-all.ts 100% 100% 100% 100%
packages/react-sdk/src/unwrap/use-unwrap.ts 100% 100% 100% 100%
packages/react-sdk/src/wagmi/wagmi-provider.ts 27.27% 0% 40% 27.27% 42-76
packages/react-sdk/src/wagmi/wagmi-signer.ts 50% 73.68% 30% 50% 35-66
packages/react-sdk/src/wrappers-registry/use-confidential-token-address.ts 0% 100% 0% 0% 1-25
packages/react-sdk/src/wrappers-registry/use-is-confidential-token-valid.ts 0% 100% 0% 0% 1-28
packages/react-sdk/src/wrappers-registry/use-token-address.ts 0% 100% 0% 0% 1-25
packages/react-sdk/src/wrappers-registry/use-token-pair.ts 0% 100% 0% 0% 1-23
packages/react-sdk/src/wrappers-registry/use-token-pairs-length.ts 0% 100% 0% 0% 1-19
packages/react-sdk/src/wrappers-registry/use-token-pairs-registry.ts 0% 100% 0% 0% 1-21
packages/react-sdk/src/wrappers-registry/use-token-pairs-slice.ts 0% 100% 0% 0% 1-31
packages/react-sdk/src/wrappers-registry/use-wrappers-registry-address.ts 100% 100% 100% 100%
packages/sdk/src/test-fixtures.ts 88.7% 55.55% 82.92% 90% 279-313
packages/sdk/src/wrappers-registry.ts 98.95% 90.9% 100% 98.93% 399
packages/sdk/src/zama-sdk.ts 97.2% 89.58% 100% 97.16% 184, 200, 257, 307
packages/sdk/src/errors/base.ts 100% 100% 100% 100%
packages/sdk/src/errors/chain.ts 100% 100% 100% 100%
packages/sdk/src/ethers/ethers-provider.ts 92% 68.75% 100% 92% 84, 111
packages/sdk/src/ethers/ethers-signer.ts 97.14% 91.66% 100% 97.05% 95
packages/sdk/src/query/approve-underlying.ts 100% 100% 100% 100%
packages/sdk/src/query/approve.ts 100% 100% 100% 100%
packages/sdk/src/query/confidential-balance.ts 100% 100% 100% 100%
packages/sdk/src/query/confidential-is-approved.ts 100% 100% 100% 100%
packages/sdk/src/query/delegate-decryption.ts 100% 100% 100% 100%
packages/sdk/src/query/delegation-status.ts 100% 100% 100% 100%
packages/sdk/src/query/finalize-unwrap.ts 100% 100% 100% 100%
packages/sdk/src/query/is-confidential.ts 100% 100% 100% 100%
packages/sdk/src/query/query-keys.ts 95.74% 91.17% 96.96% 95.65% 152-153
packages/sdk/src/query/resume-unshield.ts 100% 100% 100% 100%
packages/sdk/src/query/revoke-delegation.ts 100% 100% 100% 100%
packages/sdk/src/query/shield.ts 100% 100% 100% 100%
packages/sdk/src/query/signer-address.ts 100% 100% 100% 100%
packages/sdk/src/query/token-metadata.ts 100% 100% 100% 100%
packages/sdk/src/query/total-supply.ts 100% 100% 100% 100%
packages/sdk/src/query/transfer-from.ts 100% 100% 100% 100%
packages/sdk/src/query/transfer.ts 100% 100% 100% 100%
packages/sdk/src/query/underlying-allowance.ts 100% 100% 100% 100%
packages/sdk/src/query/unshield-all.ts 100% 100% 100% 100%
packages/sdk/src/query/unshield.ts 100% 100% 100% 100%
packages/sdk/src/query/unwrap-all.ts 100% 100% 100% 100%
packages/sdk/src/query/unwrap.ts 100% 100% 100% 100%
packages/sdk/src/query/wrappers-registry.ts 100% 91.66% 100% 100%
packages/sdk/src/token/readonly-token.ts 96.47% 83.82% 97.22% 96.31% 222, 360-362, 372, 379, 392, 682-684
packages/sdk/src/token/token.ts 97% 92.45% 97.29% 96.89% 87-88, 381, 816, 880, 957-962, 1016-1021
packages/sdk/src/types/provider.ts 100% 100% 100% 100%
packages/sdk/src/types/signer.ts 100% 100% 100% 100%
packages/sdk/src/viem/viem-provider.ts 100% 100% 100% 100%
packages/sdk/src/viem/viem-signer.ts 85.71% 100% 75% 92.3% 95
Generated in workflow #1791 for commit a197539 by the Vitest Coverage Report Action

@enitrat enitrat force-pushed the feat/split-signer-provider branch from 6003a16 to 4418577 Compare April 20, 2026 16:06
enitrat added 10 commits April 20, 2026 17:50
…lint

Removes unused `signer` / `publicClient` destructures across test
fixtures, an unused `useZamaSDK` call in use-confidential-balance,
a side-effect-prone `import { type ... }`, and a duplicate
`../../types` import.
- Extend requireChainAlignment to delegated decrypt paths (batchBalancesOf,
  batchDecryptBalancesAs, decryptBalanceAs) so chain mismatches fail fast
  before any wallet signature prompt.
- Drop the redundant Token.signer field; Token now accesses sdk.signer like
  ReadonlyToken for a consistent access pattern.
- EthersProvider.waitForTransactionReceipt now throws TransactionRevertedError
  with the same 4337-bundler hint as the wagmi adapter, restoring taxonomy
  parity across adapters.
- Restore optional holder in UseConfidentialIsApprovedSuspenseConfig and skip
  signer-address resolution when holder is provided; test now asserts that
  signer.getAddress is not called.
- Add chain-alignment test coverage for ChainMismatchError across shield,
  userDecrypt, decryptBalanceAs, and batchBalancesOf.
- Update react-viem and react-wagmi walkthroughs to teach the provider+signer
  split and the required ZamaProvider provider prop.
- Align wagmi adapter class style to ECMAScript #private fields.
@enitrat enitrat force-pushed the feat/split-signer-provider branch from 3321995 to a197539 Compare April 20, 2026 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant