feat: introduce concrete signer / provider#268
Draft
enitrat wants to merge 10 commits intoprereleasefrom
Draft
Conversation
1582891 to
10c097c
Compare
Public API ChangesExpand to see full diffdiff -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;
|
6003a16 to
4418577
Compare
…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.
3321995 to
a197539
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[wip]