Skip to content

wallet_connect

Experimental RPC defined in ERC-7846

Requests that the wallet connects to the specified provider with an emphasis on extensibility.

Parameters

Array<ConnectParameter>

type SignInWithEthereumCapabilityRequest = {
  nonce: string;
  chainId: string; // EIP-155 hex-encoded
  version?: string;
  scheme?: string;
  domain?: string;
  uri?: string;
  statement?: string;
  issuedAt?: string;
  expirationTime?: string;
  notBefore?: string;
  requestId?: string;
  resources?: string[];
};
 
type SpendPermissionsCapabilityRequest = {
  token: `0x${string}`;
  allowance: string;
  period: number;
  salt?: `0x${string}`;
  extraData?: `0x${string}`;
};
 
type AddSubAccountCapabilityRequest = {
  // See wallet_addSubAccount
  account: AddSubAccountAccount;
};
 
type ConnectParameter = {
  version: string;
  // Optional capabilities to request (e.g. Sign In With Ethereum).
  capabilities?: {
    addSubAccount?: AddSubAccountCapabilityRequest;
    getSubAccounts?: boolean;
    spendPermissions?: SpendPermissionsCapabilityRequest;
    signInWithEthereum?: SignInWithEthereumCapabilityRequest;
  };
};

Returns

type SignInWithEthereumCapabilityResponse = {
  message: string;
  signature: `0x${string}`;
};
 
type SpendPermissionsCapabilityResponse = {
  signature: `0x${string}`;
};
 
type AddSubAccountCapabilityResponse = {
  address: `0x${string}`;
  chainId?: `0x${string}`;
  factory?: `0x${string}`;
  factoryData?: `0x${string}`;
};
 
type ConnectResponse = {
  accounts: {
    // Address of the connected account.
    address: `0x${string}`;
    // Capabilities granted that is associated with this account.
    capabilities?: {
      addSubAccount?: AddSubAccountCapabilityResponse | SerializedEthereumRpcError;
      getSubAccounts?: AddSubAccountCapabilityResponse[];
      spendPermissions?: SpendPermissionsCapabilityResponse | SerializedEthereumRpcError;
      signInWithEthereum?: SignInWithEthereumCapabilityResponse | SerializedEthereumRpcError;
    };
  }[];
};

Returns null if the request was successful.

Errors

CodeMessage
4001User rejected the request
4100Requested method not supported