# JAW Provider - RPC Reference > EIP-1193 compliant provider with full RPC method support for smart account operations. **This file is self-contained.** You have everything needed to help with this topic. Do NOT fetch other llms-*.txt files unless the user explicitly asks about a different topic. ## Key Info - **Package:** `@jaw.id/core` - **Install:** `npm install @jaw.id/core` - **Dashboard:** https://dashboard.jaw.id - **Docs:** https://docs.jaw.id ## Quick Example ```typescript import { JAW } from '@jaw.id/core'; const provider = await JAW.create({ apiKey: 'YOUR_API_KEY', appName: 'My App', chains: [{ id: 8453, rpcUrl: 'https://mainnet.base.org' }], }); // EIP-1193 compliant - use with any library const accounts = await provider.request({ method: 'eth_requestAccounts' }); ``` --- ## eth_accounts Source: https://docs.jaw.id/api-reference/eth_accounts ## eth\_accounts Get currently connected accounts without triggering authentication. Returns an empty array if no accounts are connected. **Authentication Required:** No ### Request ```typescript await jaw.provider.request({ method: 'eth_accounts', }); ``` #### Parameters None ### Response Returns an array of connected account addresses. Returns an empty array if not authenticated. **Type:** `0x${string}[]` #### Example (Connected) ```typescript ["0x1234567890123456789012345678901234567890"] ``` #### Example (Not Connected) ```typescript [] ``` ### Behavior * Returns empty array if not authenticated * Returns cached accounts if already connected * Does not trigger authentication popup ### Example ```typescript import { JAW } from '@jaw.id/core'; const jaw = JAW.create({ apiKey: 'your-api-key', }); const accounts = await jaw.provider.request({ method: 'eth_accounts', }); ``` ### Related Methods * [eth\_requestAccounts](/api-reference/eth_requestAccounts) - Request authentication ## eth_chainId Source: https://docs.jaw.id/api-reference/eth_chainId ## eth\_chainId Get the current chain ID in hexadecimal format. **Authentication Required:** No (returns default chain if not authenticated) ### Request ```typescript await jaw.provider.request({ method: 'eth_chainId', }); ``` #### Parameters None ### Response Returns the chain ID as a hexadecimal string. **Type:** `0x${string}` #### Example ```json "0x1" ``` ### Behavior * Returns default chain ID if not authenticated * Returns current active chain ID if authenticated * Updates when chain is switched via `wallet_switchEthereumChain` ### Example Usage ```typescript import { JAW } from '@jaw.id/core'; const jaw = JAW.create({ apiKey: 'your-api-key', }); const chainId = await jaw.provider.request({ method: 'eth_chainId', }); ``` ### Related Methods * [wallet\_switchEthereumChain](/api-reference/wallet_switchEthereumChain) - Switch chains ## eth_requestAccounts Source: https://docs.jaw.id/api-reference/eth_requestAccounts ## eth\_requestAccounts Request user authentication and account access. **Authentication Required:** No (triggers authentication) ### Request ```typescript await jaw.provider.request({ method: 'eth_requestAccounts', }); ``` #### Parameters None ### Response Returns an array of account addresses. **Type:** `0x${string}[]` #### Example ```typescript ["0x1234567890123456789012345678901234567890"] ``` ### Behavior * Opens authentication popup (in CrossPlatform mode) * User creates a new account or signs in with an existing one * Returns array with single account address * Emits `accountsChanged` event with the connected accounts * Subsequent calls return cached accounts without opening popup ### Errors \| Code | Description | \|------|-------------| \| 4001 | User rejected the request | \| 4100 | Unauthorized (authentication failed) | ### Example ```typescript import { JAW } from '@jaw.id/core'; const jaw = JAW.create({ apiKey: 'your-api-key', }); const accounts = await jaw.provider.request({ method: 'eth_requestAccounts', }); ``` ### Related Methods * [eth\_accounts](/api-reference/eth_accounts) - Get accounts without triggering authentication * [wallet\_connect](/api-reference/wallet_connect) - Connect with advanced capabilities (SIWE, subnames) ## eth_sendTransaction Source: https://docs.jaw.id/api-reference/eth_sendTransaction ## eth\_sendTransaction Broadcast a transaction to the network. **Authentication Required:** Yes ### Request ```typescript await jaw.provider.request({ method: 'eth_sendTransaction', params: [{ to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb', value: '0x9184e72a000', data: '0x', }], }); ``` #### Parameters \| Name | Type | Required | Description | \|------|------|----------|-------------| \| `to` | `0x${string}` | Yes | Recipient address | \| `value` | `0x${string}` | No | Amount in wei (hexadecimal) | \| `data` | `0x${string}` | No | Transaction data (hexadecimal) | \| `chainId` | `0x${string}` | No | Target chain ID (defaults to connected chain) | #### Example ```typescript [{ "to": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb", "value": "0x9184e72a000", "data": "0x" }] ``` ### Response Returns the transaction hash after the transaction is submitted. **Type:** `0x${string}` #### Example ```typescript "0xabc123def456..." ``` ### Behavior * Opens popup for user approval * Uses ERC-4337 UserOperation under the hood * Transaction is sponsored by paymaster if configured * Returns transaction hash after submission ### Errors \| Code | Description | \|------|-------------| \| 4001 | User rejected the request | \| 4100 | Unauthorized (not authenticated) | \| -32602 | Invalid params | ### Example Usage #### Send Native Token (ETH) ```typescript const txHash = await jaw.provider.request({ method: 'eth_sendTransaction', params: [{ to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb', value: '0xde0b6b3a7640000', // 1 ETH in wei (hex) }], }); console.log('Transaction hash:', txHash); ``` #### Call Contract Function ```typescript import { encodeFunctionData } from 'viem'; // Encode ERC-20 transfer function const data = encodeFunctionData({ abi: [{ name: 'transfer', type: 'function', inputs: [ { name: 'to', type: 'address' }, { name: 'amount', type: 'uint256' }, ], }], functionName: 'transfer', args: ['0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb', 1000000n], }); const txHash = await jaw.provider.request({ method: 'eth_sendTransaction', params: [{ to: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', data, }], }); ``` ### Related Methods * [wallet\_sendCalls](/api-reference/wallet_sendCalls) - Send multiple transactions atomically ## eth_signTypedData_v4 Source: https://docs.jaw.id/api-reference/eth_signTypedData_v4 ## eth\_signTypedData\_v4 Sign structured typed data via EIP-712. **Authentication Required:** Yes ### Request ```typescript await jaw.provider.request({ method: 'eth_signTypedData_v4', params: [ '0x1234...', JSON.stringify(typedData), ], }); ``` #### Parameters \| Name | Type | Required | Description | \|------|------|----------|-------------| \| `address` | `0x${string}` | Yes | Address to sign with | \| `typedData` | `string` | Yes | JSON stringified EIP-712 typed data | #### TypedData Structure The typed data must follow EIP-712 format: ```typescript { types: { EIP712Domain: [...], [primaryType]: [...], }, primaryType: string, domain: { name: string, version: string, chainId: number, verifyingContract?: string, }, message: object, } ``` #### Example ```json [ "0x1234567890123456789012345678901234567890", "..." ] ``` ### Response Returns the signature as a hexadecimal string. **Type:** `0x${string}` #### Example ```typescript "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890ab" ``` ### Behavior * Opens popup showing structured data in human-readable format * Validates EIP-712 format before signing * Shows domain, message types, and values to user ### Errors \| Code | Description | \|------|-------------| \| 4001 | User rejected the request | \| 4100 | Unauthorized (not authenticated) | \| -32602 | Invalid params (malformed EIP-712 data) | ### Example ```typescript const typedData = { types: { EIP712Domain: [ { name: 'name', type: 'string' }, { name: 'version', type: 'string' }, { name: 'chainId', type: 'uint256' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], }, primaryType: 'Mail', domain: { name: 'My DApp', version: '1', chainId: 1, }, message: { from: { name: 'Alice', wallet: '0x1234...', }, to: { name: 'Bob', wallet: '0x5678...', }, contents: 'Hello Bob!', }, }; const signature = await jaw.provider.request({ method: 'eth_signTypedData_v4', params: [account, JSON.stringify(typedData)], }); ``` ### Related Methods * [personal\_sign](/api-reference/personal_sign) - Sign plain messages * [wallet\_sign](/api-reference/wallet_sign) - Generic signing method ## Provider - RPC Reference Source: https://docs.jaw.id/api-reference/index ## Provider - RPC Reference Complete reference for all RPC methods supported by the JAW SDK provider. ### Installation :::code-group ```bash [npm] npm install @jaw.id/core ``` ```bash [pnpm] pnpm add @jaw.id/core ``` ```bash [yarn] yarn add @jaw.id/core ``` ```bash [bun] bun add @jaw.id/core ``` ::: ### Setup ```typescript import { JAW } from '@jaw.id/core'; const jaw = JAW.create({ apiKey: 'YOUR_API_KEY', appName: 'My App', }); ``` ### Making Requests All requests are made through the provider's `request` method: ```typescript const result = await jaw.provider.request({ method: 'method_name', params: [...], }); ``` ### Provider Events The provider emits events following the EIP-1193 specification: ```typescript // Account changes jaw.provider.on('accountsChanged', (accounts: string[]) => { console.log('Accounts changed:', accounts); }); // Chain changes jaw.provider.on('chainChanged', (chainId: string) => { console.log('Chain changed:', chainId); }); // Connection jaw.provider.on('connect', (info: { chainId: string }) => { console.log('Connected to chain:', info.chainId); }); // Disconnection jaw.provider.on('disconnect', (error: ProviderRpcError) => { console.log('Disconnected:', error); }); ``` ### Account Methods Methods for managing user accounts and authentication. \| Method | Description | Auth Required | \|--------|-------------|---------------| \| [eth\_requestAccounts](/api-reference/eth_requestAccounts) | Request user authentication and account access | No | \| [eth\_accounts](/api-reference/eth_accounts) | Get currently connected accounts | No | ### Chain Methods Methods for querying and switching blockchain networks. \| Method | Description | Auth Required | \|--------|-------------|---------------| \| [eth\_chainId](/api-reference/eth_chainId) | Get current chain ID (hex) | No | \| [wallet\_switchEthereumChain](/api-reference/wallet_switchEthereumChain) | Switch to a different chain | Yes | ### Transaction Methods Methods for sending transactions and batch operations. \| Method | Description | Auth Required | \|--------|-------------|---------------| \| [eth\_sendTransaction](/api-reference/eth_sendTransaction) | Broadcast a transaction to the network | Yes | \| [wallet\_sendCalls](/api-reference/wallet_sendCalls) | Broadcast bundle of calls to the network | No\* | \| [wallet\_getCallsStatus](/api-reference/wallet_getCallsStatus) | Get batch transaction status | No | ### Signing Methods Methods for signing messages and typed data. \| Method | Description | Auth Required | \|--------|-------------|---------------| \| [personal\_sign](/api-reference/personal_sign) | Sign a message with EIP-191 | Yes | \| [eth\_signTypedData\_v4](/api-reference/eth_signTypedData_v4) | Sign structured typed data (EIP-712) | Yes | \| [wallet\_sign](/api-reference/wallet_sign) | Unified signing method supporting multiple message formats | No\* | \*Can use ephemeral signer if not authenticated ### Wallet Methods Methods for wallet connection and lifecycle management. \| Method | Description | Auth Required | \|--------|-------------|---------------| \| [wallet\_connect](/api-reference/wallet_connect) | Connect with advanced capabilities (SIWE, subnames) | No | \| [wallet\_disconnect](/api-reference/wallet_disconnect) | Disconnect current session | No | ### Capability Methods Methods for querying wallet capabilities. \| Method | Description | Auth Required | \|--------|-------------|---------------| \| [wallet\_getCapabilities](/api-reference/wallet_getCapabilities) | Get wallet capabilities per chain (EIP-5792) | No | ### Permission Methods Methods for managing granular permissions for delegated transactions. \| Method | Description | Auth Required | \|--------|-------------|---------------| \| [wallet\_grantPermissions](/api-reference/wallet_grantPermissions) | Grant call and spend permissions to a spender | No\* | \| [wallet\_revokePermissions](/api-reference/wallet_revokePermissions) | Revoke previously granted permissions | No\* | \| [wallet\_getPermissions](/api-reference/wallet_getPermissions) | Get all permissions for an account | No\*\* | \*Can use ephemeral signer if not authenticated \*\*Requires address parameter if not authenticated ### Asset Methods Methods for querying token balances. \| Method | Description | Auth Required | \|--------|-------------|---------------| \| [wallet\_getAssets](/api-reference/wallet_getAssets) | Get token balances across chains (EIP-7811) | No\*\* | \*\*Requires address parameter ### Error Codes JAW SDK follows EIP-1193 error codes: \| Code | Message | Description | \|------|---------|-------------| \| 4001 | User Rejected Request | User declined in popup | \| 4100 | Unauthorized | Not authenticated | \| 4200 | Unsupported Method | Method not supported | \| 4900 | Disconnected | Provider disconnected | \| 4901 | Chain Disconnected | Chain not available | \| -32700 | Parse Error | Invalid JSON | \| -32600 | Invalid Request | Invalid request object | \| -32601 | Method Not Found | Method doesn't exist | \| -32602 | Invalid Params | Invalid parameters | \| -32603 | Internal Error | Internal JSON-RPC error | ## personal_sign Source: https://docs.jaw.id/api-reference/personal_sign ## personal\_sign Signs an EIP-191 personal message. **Authentication Required:** Yes ### Request ```typescript await jaw.provider.request({ method: 'personal_sign', params: ['0x48656c6c6f20576f726c64', '0x1234...'], }); ``` #### Parameters \| Name | Type | Required | Description | \|------|------|----------|-------------| \| `message` | `0x${string}` | Yes | Message to sign (hex encoded) | \| `address` | `0x${string}` | Yes | Address to sign with | #### Example ```typescript ["0x48656c6c6f20576f726c64", "0x1234567890123456789012345678901234567890"] ``` ### Response Returns the signature as a hexadecimal string. **Type:** `0x${string}` #### Example ```typescript "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1c" ``` ### Behavior * Opens popup for user approval * Displays human-readable message to user * Returns EIP-191 signature with "\x19Ethereum Signed Message:\n" prefix ### Errors \| Code | Description | \|------|-------------| \| 4001 | User rejected the request | \| 4100 | Unauthorized (not authenticated) | \| -32602 | Invalid params (message not hex encoded) | ### Example ```typescript import { toHex } from 'viem'; const message = 'Hello World'; const messageHex = toHex(message); const account = '0x1234...'; const signature = await jaw.provider.request({ method: 'personal_sign', params: [messageHex, account], }); console.log('Signature:', signature); ``` ### Related Methods * [eth\_signTypedData\_v4](/api-reference/eth_signTypedData_v4) - Sign structured data (EIP-712) * [wallet\_sign](/api-reference/wallet_sign) - Generic signing method ## wallet_connect Source: https://docs.jaw.id/api-reference/wallet_connect ## wallet\_connect Requests to connect account(s) with optional capabilities. **Authentication Required:** No (triggers authentication) ### Request ```typescript await jaw.provider.request({ method: 'wallet_connect', params: [{ capabilities: { signInWithEthereum: { nonce: 'abc123xyz789', chainId: '0x1', domain: 'my-dapp.com', uri: 'https://my-dapp.com', statement: 'Sign in to My DApp with your JAW account' }, subnameTextRecords: [ { key: 'avatar', value: 'https://my-dapp.com/avatars/1.png' }, { key: 'description', value: 'Premium member' } ] } }], }); ``` #### Parameters \| Name | Type | Required | Description | \|------|------|----------|-------------| \| `capabilities` | `object` | No | Requested capabilities | #### Capabilities ##### signInWithEthereum \| Name | Type | Required | Description | \|------|------|----------|-------------| \| `nonce` | `string` | Yes | Random nonce for SIWE | \| `chainId` | `string` | Yes | Chain ID (hex format) | \| `domain` | `string` | No | Domain requesting signature | \| `uri` | `string` | No | URI of the application | \| `statement` | `string` | No | Human-readable statement | \| `version` | `string` | No | SIWE version (default: "1") | \| `issuedAt` | `string` | No | ISO 8601 timestamp | \| `expirationTime` | `string` | No | ISO 8601 expiration | ##### subnameTextRecords Array of key-value pairs to attach as ENS text records to the user's subname on account creation. **Note:** This capability is only used if an ENS domain is configured in the SDK preferences (via the `ens` option). If no ENS domain is configured, these records are disregarded. \| Name | Type | Description | \|------|------|-------------| \| `key` | `string` | Text record key (e.g., "avatar", "url") | \| `value` | `string` | Text record value | ### Response Returns connection result with accounts and capabilities. **Type:** `object` #### Example ```json { "accounts": [{ "address": "0x1234567890123456789012345678901234567890", "capabilities": { "signInWithEthereum": { "message": "my-dapp.com wants you to sign in with your Ethereum account:\n0x1234...", "signature": "0xabcdef..." } } }] } ``` ### Behavior * Opens authentication popup * User creates account or signs in with existing account * If `signInWithEthereum` capability is requested: * Generates and signs a SIWE message with the provided parameters * Returns the signed message in the response capabilities * If `subnameTextRecords` capability is provided and `ens` is configured in SDK preferences: * Attaches the provided text records to the subname * Returns accounts with capability responses ### Errors \| Code | Description | \|------|-------------| \| 4001 | User rejected the request | \| 4100 | Unauthorized (authentication failed) | \| -32602 | Invalid params | ### Example ```typescript const result = await jaw.provider.request({ method: 'wallet_connect', params: [{}], }); ``` ### Related Methods * [eth\_requestAccounts](/api-reference/eth_requestAccounts) - Simple authentication without capabilities ## wallet_disconnect Source: https://docs.jaw.id/api-reference/wallet_disconnect ## wallet\_disconnect Disconnect the current session and clean up all authentication state. **Authentication Required:** No ### Request ```typescript await jaw.provider.request({ method: 'wallet_disconnect', }); ``` #### Parameters None ### Response Returns `null` on success. **Type:** `null` ### Behavior * Clears the active session and authentication state * Emits `disconnect` event * Same effect as calling `jaw.disconnect()` ### Example Usage #### Disconnect Button ```typescript await jaw.provider.request({ method: 'wallet_disconnect', }); ``` #### Listen to Disconnect Event ```typescript // Listen for disconnect events jaw.provider.on('disconnect', (error) => { console.log('Wallet disconnected:', error.message); }); await jaw.provider.request({ method: 'wallet_disconnect', }); ``` ### Related Methods * [eth\_requestAccounts](/api-reference/eth_requestAccounts) - Reconnect wallet * [wallet\_connect](/api-reference/wallet_connect) - Connect with capabilities ## wallet_getAssets Source: https://docs.jaw.id/api-reference/wallet_getAssets ## wallet\_getAssets Get token balances across multiple chains for an account. Implements EIP-7811. **Authentication Required:** No (requires account parameter) ### Request ```typescript await jaw.provider.request({ method: 'wallet_getAssets', params: [{ account: '0x1234...', assetFilter: { '0x1': [{ address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', type: 'erc20' }], }, }], }); ``` #### Parameters \| Name | Type | Required | Description | \|------|------|----------|-------------| \| `account` | `string` | Yes | Account address to query | \| `chainFilter` | `string[]` | No | Limit to specific chains (hex chain IDs) | \| `assetTypeFilter` | `AssetType[]` | No | Filter by asset type: `'native'` or `'erc20'` | \| `assetFilter` | `AssetFilter` | No | Filter by specific assets per chain | #### Types ```typescript type AssetType = 'native' | 'erc20'; type AssetFilter = Record<`0x${string}`, AssetFilterEntry[]>; type AssetFilterEntry = { address: `0x${string}`; type: AssetType; }; ``` #### Example ```json [{ "account": "0x1234567890123456789012345678901234567890", "chainFilter": ["0x1", "0x89"] }] ``` With asset type filter (ERC-20 tokens only): ```json [{ "account": "0x1234567890123456789012345678901234567890", "assetTypeFilter": ["erc20"] }] ``` With specific asset filter: ```json [{ "account": "0x1234567890123456789012345678901234567890", "assetFilter": { "0x1": [{ "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", "type": "erc20" }], "0x2105": [{ "address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "type": "erc20" }] } }] ``` ### Response Returns an object mapping chain IDs to asset arrays. **Type:** `WalletGetAssetsResponse` ```typescript type WalletGetAssetsResponse = { [chainId: string]: Asset[]; }; type Asset = { /** Token contract address, null for native tokens */ address: string | null; /** Balance in hex format */ balance: string; /** Asset metadata */ metadata: { decimals: number; name: string; symbol: string; } | null; /** Asset type */ type: 'native' | 'erc20'; }; ``` #### Example ```json { "0x1": [ { "address": null, "balance": "0x1bc16d674ec80000", "metadata": { "decimals": 18, "name": "Ether", "symbol": "ETH" }, "type": "native" }, { "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", "balance": "0x5f5e100", "metadata": { "decimals": 6, "name": "USD Coin", "symbol": "USDC" }, "type": "erc20" } ], "0x89": [ { "address": null, "balance": "0x2b5e3af16b1880000", "metadata": { "decimals": 18, "name": "POL", "symbol": "POL" }, "type": "native" } ] } ``` #### Asset Object Fields \| Field | Type | Description | \|-------|------|-------------| \| `address` | `string \| null` | Token contract address, `null` for native tokens | \| `balance` | `string` | Balance in smallest unit (wei/raw), hex format | \| `metadata` | `object \| null` | Token metadata (decimals, name, symbol) | \| `type` | `'native' \| 'erc20'` | Asset type | ### Behavior * Includes native tokens (ETH, MATIC, etc.) * Includes ERC-20 tokens with non-zero balances * Auto-filters by `showTestnets` SDK preference * Can be called without authentication * Returns only tokens with non-zero balances ### Example #### Get All Assets ```typescript const assets = await jaw.provider.request({ method: 'wallet_getAssets', params: [{ account: '0x1234...', }], }); ``` #### Filter by Asset Type ```typescript // Only get ERC-20 tokens const tokens = await jaw.provider.request({ method: 'wallet_getAssets', params: [{ account: '0x1234...', assetTypeFilter: ['erc20'], }], }); ``` #### Filter by Specific Assets ```typescript // Get only USDC on mainnet and Base const usdc = await jaw.provider.request({ method: 'wallet_getAssets', params: [{ account: '0x1234...', assetFilter: { '0x1': [{ address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', type: 'erc20' }], '0x2105': [{ address: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913', type: 'erc20' }], }, }], }); ``` ### Related Methods * [eth\_getBalance](/api-reference) (Proxied) - Get native balance for single chain * [wallet\_getCapabilities](/api-reference/wallet_getCapabilities) - Check supported chains ## wallet_getCallsHistory Source: https://docs.jaw.id/api-reference/wallet_getCallsHistory ## wallet\_getCallsHistory Get the history of call bundles for an address. **Authentication Required:** No ### Request ```typescript await jaw.provider.request({ method: 'wallet_getCallsHistory', params: [{ address: '0x...', limit: 20, sort: 'desc', }], }); ``` #### Parameters \| Name | Type | Required | Description | \|------|------|----------|-------------| \| `address` | `Address` | Yes | The wallet address to fetch call history for | \| `chainId` | `number` | No | Chain ID to filter by | \| `index` | `number` | No | Index cursor for pagination | \| `limit` | `number` | No | Maximum bundles to return (default: 20) | \| `sort` | `'asc' \| 'desc'` | No | Sort direction by index (default: 'desc') | #### Example ```json [{ "address": "0x1234567890123456789012345678901234567890", "chainId": 1, "limit": 10, "sort": "desc" }] ``` ### Response Returns an array of call history items. #### Example ```json [ { "id": "0xabc123...", "index": 42, "address": "0x1234567890123456789012345678901234567890", "status": 200, "timestamp": 1706054400, "chainId": 1, "transactionHash": "0xdef456..." }, { "id": "0x789xyz...", "index": 41, "address": "0x1234567890123456789012345678901234567890", "status": 100, "timestamp": 1706050800, "chainId": 1, "transactionHash": null } ] ``` #### Response Fields \| Field | Type | Description | \|-------|------|-------------| \| `id` | `string` | The userOpHash (batch identifier) | \| `index` | `number` | Auto-incrementing index per address (for cursor pagination) | \| `address` | `string` | The wallet address | \| `status` | `number` | Status code (see below) | \| `timestamp` | `number` | Unix timestamp in seconds | \| `chainId` | `number` | Chain ID | \| `transactionHash` | `string \| null` | Transaction hash (null when pending) | #### Status Codes \| Code | Status | Description | \|------|--------|-------------| \| 100 | Pending | Not yet on-chain | \| 200 | Completed | Successfully executed on-chain | \| 500 | Onchain Revert | Reverted on-chain | ### Behavior * Can be called without authentication * Returns call history for any address * Results are paginated using `index` cursor * Default sort is newest first (`desc`) * Useful for displaying transaction history UI ### Examples #### Basic Usage ```typescript const history = await jaw.provider.request({ method: 'wallet_getCallsHistory', params: [{ address: '0x1234567890123456789012345678901234567890', }], }); console.log(`Found ${history.length} transactions`); ``` #### Paginated Fetch ```typescript async function fetchAllHistory(address: string) { const allHistory = []; let lastIndex: number | undefined; while (true) { const batch = await jaw.provider.request({ method: 'wallet_getCallsHistory', params: [{ address, index: lastIndex, limit: 20, sort: 'desc', }], }); if (batch.length === 0) break; allHistory.push(...batch); lastIndex = batch[batch.length - 1].index; } return allHistory; } ``` ### Related Methods * [wallet\_sendCalls](/api-reference/wallet_sendCalls) - Send atomic batch of calls * [wallet\_getCallsStatus](/api-reference/wallet_getCallsStatus) - Get status of a specific batch * [useGetCallsHistory](/wagmi/useGetCallsHistory) - React hook for calls history ## wallet_getCallsStatus Source: https://docs.jaw.id/api-reference/wallet_getCallsStatus ## wallet\_getCallsStatus Get the status of a batch of calls. **Authentication Required:** No ### Request ```typescript await jaw.provider.request({ method: 'wallet_getCallsStatus', params: ['0x123abc...'], }); ``` #### Parameters \| Name | Type | Required | Description | \|------|------|----------|-------------| \| `batchId` | `string` | Yes | Batch ID returned from wallet\_sendCalls | #### Example ```json ["0x123abc456def..."] ``` ### Response Returns detailed status information about the batch execution. #### Example ```json { "id": "0x123abc...", "chainId": "0x1", "status": 200, "atomic": true, "receipts": [{ "logs": [{ "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", "data": "0x...", "topics": ["0x..."] }], "status": "0x1", "blockHash": "0x...", "blockNumber": "0x...", "gasUsed": "0x...", "transactionHash": "0x..." }] } ``` #### Response Fields \| Field | Type | Description | \|-------|------|-------------| \| `id` | `string` | Batch identifier | \| `chainId` | `string` | Chain ID (hex) | \| `status` | `number` | Status code (see below) | \| `atomic` | `boolean` | Whether calls are atomic | \| `receipts` | `array` | Transaction receipts (when completed) | #### Status Codes \| Code | Status | Description | \|------|--------|-------------| \| 100 | Pending | Not yet on-chain | \| 200 | Completed | Successfully executed on-chain | \| 400 | Offchain Failure | Failed before submission (wallet won't retry) | \| 500 | Onchain Revert | Reverted on-chain (has receipt with status 0x0) | \| 600 | Partial Revert | Some calls reverted (not applicable for atomic ops) | ### Behavior * Can be called without authentication * Returns current status of the batch operation * Receipts included only when status is 200 or 500 * Background monitoring updates status automatically ### Example #### Poll for Completion ```typescript const result = await jaw.provider.request({ method: 'wallet_sendCalls', params: [{ version: '1.0', chainId: '0x1', from: account, calls: [...], }], }); // Poll until completed async function waitForCompletion(batchId: string) { while (true) { const status = await jaw.provider.request({ method: 'wallet_getCallsStatus', params: [batchId], }); if (status.status === 200) { console.log('Batch completed successfully!'); return status; } else if (status.status >= 400) { console.error('Batch failed:', status); throw new Error('Batch execution failed'); } // Still pending, wait and retry await new Promise(resolve => setTimeout(resolve, 2000)); } } await waitForCompletion(result.id); ``` ### Related Methods * [wallet\_sendCalls](/api-reference/wallet_sendCalls) - Send atomic batch of calls ## wallet_getCapabilities Source: https://docs.jaw.id/api-reference/wallet_getCapabilities ## wallet\_getCapabilities Get wallet capabilities for supported chains. Implements EIP-5792 for capability discovery. **Authentication Required:** No ### Request ```typescript await jaw.provider.request({ method: 'wallet_getCapabilities', params: ['0x1234...', ['0x1', '0x2105']], }); ``` #### Parameters \| Name | Type | Required | Description | \|------|------|----------|-------------| \| `address` | `string` | No | Account address | \| `chainIds` | `string[]` | No | Filter by specific chain IDs (hex) | #### Example ```json ["0x1234567890123456789012345678901234567890", ["0x1", "0x2105"]] ``` Or without filtering: ```json [] ``` ### Response Returns capabilities per chain as an object keyed by chain ID (hex). **Type:** `Record` #### Example ```json { "0x1": { "atomicBatch": { "supported": true }, "atomic": { "status": "supported" }, "paymasterService": { "supported": true }, "permissions": { "supported": true }, "feeToken": { "supported": true, "tokens": [ { "uid": "ethereum", "symbol": "ETH", "address": "0x0000000000000000000000000000000000000000", "interop": false, "decimals": 18, "feeToken": true } ] } }, "0x2105": { "atomicBatch": { "supported": true }, "atomic": { "status": "supported" }, "paymasterService": { "supported": true }, "permissions": { "supported": true }, "feeToken": { "supported": true, "tokens": [ { "uid": "ethereum", "symbol": "ETH", "address": "0x0000000000000000000000000000000000000000", "interop": true, "decimals": 18, "feeToken": true } ] } } } ``` ### Capabilities Explained #### atomicBatch **Value:** `{ supported: true }` Indicates support for `wallet_sendCalls` - the ability to send multiple transactions atomically (all succeed or all fail). #### atomic **Value:** `{ status: "supported" }` Indicates atomic transaction execution where all operations in a batch are guaranteed to succeed or fail together. #### paymasterService **Value:** `{ supported: true }` Indicates support for ERC-7677 paymaster service - gasless transactions sponsored by paymasters. #### permissions **Value:** `{ supported: true }` Indicates support for the permission system (`wallet_grantPermissions`, `wallet_revokePermissions`). #### feeToken **Value:** `{ supported: true, tokens: [...] }` Indicates the supported fee tokens for gas payments on each chain. \| Field | Type | Description | \|-------|------|-------------| \| `supported` | `boolean` | Whether fee token selection is supported | \| `tokens` | `array` | List of available fee tokens | \| `tokens[].uid` | `string` | Unique identifier for the token | \| `tokens[].symbol` | `string` | Token symbol (e.g., "ETH", "USDC") | \| `tokens[].address` | `string` | Token contract address (zero address for native token) | \| `tokens[].interop` | `boolean` | Whether the token supports cross-chain interoperability | \| `tokens[].decimals` | `number` | Token decimal places | \| `tokens[].feeToken` | `boolean` | Whether this token can be used for gas fees | ### Behavior * Can be called without authentication * Returns capabilities for all supported chains by default * Filters by chain IDs if `chainIds` parameter provided * When `showTestnets` is disabled (default), only mainnet chains are returned ### Example ```typescript const capabilities = await jaw.provider.request({ method: 'wallet_getCapabilities', }); ``` ### Related Methods * [wallet\_sendCalls](/api-reference/wallet_sendCalls) - Use atomic batch capability * [wallet\_grantPermissions](/api-reference/wallet_grantPermissions) - Use permission capability ## wallet_getPermissions Source: https://docs.jaw.id/api-reference/wallet_getPermissions ## wallet\_getPermissions Get all permissions for an account. **Authentication Required:** No (if address provided) ### Request ```typescript await jaw.provider.request({ method: 'wallet_getPermissions', params: [{ address: '0x1234...' }], }); ``` #### Parameters \| Name | Type | Required | Description | \|------|------|----------|-------------| \| `address` | `string` | No\* | Account address to query | \*Required if not authenticated. Auto-injected if authenticated and not provided. #### Example ```json [{ "address": "0x1234567890123456789012345678901234567890" }] ``` Or when authenticated (auto-injects address): ```json [] ``` ### Response Returns an array of permission objects. **Type:** `array` #### Example ```json [ { "permissionId": "0xabc123...", "account": "0x1234567890123456789012345678901234567890", "spender": "0x5678901234567890123456789012345678901234", "start": 1704067200, "end": 1735689600, "salt": "0x1a2b3c...", "calls": [{ "target": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", "selector": "0xa9059cbb", "checker": "0x0000000000000000000000000000000000000000" }], "spends": [{ "token": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", "allowance": "0x16345785d8a0000", "unit": "day", "multiplier": 1 }], "chainId": "0x1" } ] ``` #### Permission Object Fields \| Field | Type | Description | \|-------|------|-------------| \| `permissionId` | `string` | Unique permission identifier (hash) | \| `account` | `string` | Account that granted the permission | \| `spender` | `string` | Address that received permissions | \| `start` | `number` | Unix timestamp when permission becomes valid | \| `end` | `number` | Unix timestamp when permission expires | \| `salt` | `string` | Salt for permission uniqueness (hex) | \| `calls` | `array` | Granted call permissions | \| `spends` | `array` | Granted spend limits | \| `chainId` | `string` | Chain ID (hex) | ### Behavior * Can be called without authentication if address provided * Auto-injects connected address if authenticated * Returns empty array if no permissions found ### Errors \| Code | Description | \|------|-------------| \| -32602 | Invalid params (address required when not authenticated) | ### Example ```typescript const permissions = await jaw.provider.request({ method: 'wallet_getPermissions', }); ``` ### Related Methods * [wallet\_grantPermissions](/api-reference/wallet_grantPermissions) - Grant new permissions * [wallet\_revokePermissions](/api-reference/wallet_revokePermissions) - Revoke permissions ## wallet_grantPermissions Source: https://docs.jaw.id/api-reference/wallet_grantPermissions ## wallet\_grantPermissions Grant granular permissions to a spender address for delegated transaction execution with spending limits and call restrictions. **Authentication Required:** No ### Request ```typescript import { parseEther } from 'viem'; await jaw.provider.request({ method: 'wallet_grantPermissions', params: [{ expiry: 1735689600, // Unix timestamp spender: '0x5678...', // Who gets permissions permissions: { calls: [{ target: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', functionSignature: 'transfer(address,uint256)', }], spends: [{ token: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE', allowance: parseEther('0.1').toString(), // 0.1 ETH unit: 'day', }], }, // chainId: '0x1', // Optional - defaults to connected chain }], }); ``` #### Parameters \| Name | Type | Required | Description | \|------|------|----------|-------------| \| `expiry` | `number` | Yes | Expiration timestamp (seconds) | \| `spender` | `0x${string}` | Yes | Address receiving permissions | \| `permissions` | `object` | Yes | Permission details | \| `chainId` | `0x${string}` | No | Target chain ID (defaults to connected chain) | \| `capabilities` | `object` | No | Additional capabilities (see below) | #### Capabilities \| Name | Type | Description | \|------|------|-------------| \| `capabilities.paymasterService` | `object` | Paymaster service for gas sponsorship | \| `capabilities.paymasterService.url` | `string` | Paymaster service URL (ERC-7677 compliant) | \| `capabilities.paymasterService.context` | `object` | Optional context (e.g., `{ sponsorshipPolicyId: '...' }`) | :::info The `paymasterService` capability allows you to specify a paymaster per-call, overriding any paymaster configured at the SDK level. ::: #### Permission Details ##### calls Array of call permissions. Each permission: \| Name | Type | Required | Description | \|------|------|----------|-------------| \| `target` | `0x${string}` | Yes | Contract address | \| `functionSignature` | `string` | No\* | Function signature (e.g., "transfer(address,uint256)") | \| `selector` | `0x${string}` | No\* | 4-byte function selector (0x...) | \*Either `functionSignature` or `selector` is required. ##### spends (Optional\*) Array of spend limits. Each limit: \| Name | Type | Required | Description | \|------|------|----------|-------------| \| `token` | `0x${string}` | Yes | Token address (`0xEeee...` for native token) | \| `allowance` | `string` | Yes | Spending allowance in wei (decimal or hex string) | \| `unit` | `string` | Yes | Time unit for allowance reset | \| `multiplier` | `number` | No | Multiplier for the time unit (default: 1) | **Valid Units:** * `minute` - Resets every minute * `hour` - Resets every hour * `day` - Resets every day * `week` - Resets every week * `month` - Resets every month * `year` - Resets every year * `forever` - Never resets (one-time allowance) \*Spend Limits are required if moving funds. ### Response Returns permission grant result with generated permission ID. ```json { "account": "0x1234567890123456789012345678901234567890", "spender": "0x5678901234567890123456789012345678901234", "start": 1704067200, "end": 1735689600, "salt": "0x1a2b3c...", "calls": [{ "target": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", "selector": "0xa9059cbb" }], "spends": [{ "token": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", "allowance": "0x16345785d8a0000", "unit": "day", "multiplier": 1 }], "permissionId": "0xabc123...", "chainId": "0x1" } ``` ### Behavior * Opens popup for user approval * Approves permission * Returns permission ID for future revocation ### Errors \| Code | Description | \|------|-------------| \| 4001 | User rejected the request | \| 4100 | Unauthorized (not authenticated) | \| -32602 | Invalid params | ### Example ```typescript import { parseUnits } from 'viem'; // Allow DeFi protocol to swap USDC with daily limit const permission = await jaw.provider.request({ method: 'wallet_grantPermissions', params: [{ expiry: Math.floor(Date.now() / 1000) + (365 * 24 * 60 * 60), // 1 year spender: dexRouterAddress, permissions: { calls: [{ target: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', functionSignature: 'approve(address,uint256)', }, { target: dexRouterAddress, functionSignature: 'swap(address,address,uint256,uint256)', }], spends: [{ token: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', allowance: parseUnits('1000', 6).toString(), // 1000 USDC per day unit: 'day', }], }, // chainId: '0x1', // Optional - defaults to connected chain }], }); ``` ### Related Methods * [wallet\_revokePermissions](/api-reference/wallet_revokePermissions) - Revoke permissions * [wallet\_getPermissions](/api-reference/wallet_getPermissions) - Query permissions ## wallet_revokePermissions Source: https://docs.jaw.id/api-reference/wallet_revokePermissions ## wallet\_revokePermissions Revoke previously granted permissions. **Authentication Required:** No ### Request ```typescript await jaw.provider.request({ method: 'wallet_revokePermissions', params: [{ id: '0xabc123...', // Permission ID }], }); ``` #### Parameters \| Name | Type | Required | Description | \|------|------|----------|-------------| \| `id` | `string` | Yes | Permission ID to revoke | \| `capabilities` | `object` | No | Additional capabilities (see below) | #### Capabilities \| Name | Type | Description | \|------|------|-------------| \| `capabilities.paymasterService` | `object` | Paymaster service for gas sponsorship | \| `capabilities.paymasterService.url` | `string` | Paymaster service URL (ERC-7677 compliant) | \| `capabilities.paymasterService.context` | `object` | Optional context (e.g., `{ sponsorshipPolicyId: '...' }`) | :::info The `paymasterService` capability allows you to specify a paymaster per-call, overriding any paymaster configured at the SDK level. ::: #### Example ```json [{ "id": "0xabc123456def789..." }] ``` ### Response Returns revocation result. #### Example ```json { "success": true } ``` ### Behavior * Opens popup for user approval * Revokes permission ### Errors \| Code | Description | \|------|-------------| \| 4001 | User rejected the request | \| 4100 | Unauthorized (not authenticated) | \| -32602 | Invalid params (permission ID not found) | ### Example ```typescript const permissionId = '0xabc123...'; const result = await jaw.provider.request({ method: 'wallet_revokePermissions', params: [{ id: permissionId, }], }); ``` ### Related Methods * [wallet\_grantPermissions](/api-reference/wallet_grantPermissions) - Grant permissions * [wallet\_getPermissions](/api-reference/wallet_getPermissions) - List all permissions ## wallet_sendCalls Source: https://docs.jaw.id/api-reference/wallet_sendCalls ## wallet\_sendCalls Broadcast bundle of calls to the network. **Authentication Required:** No ### Request ```typescript await jaw.provider.request({ method: 'wallet_sendCalls', params: [{ calls: [ { to: '0xContractA...', value: '0x0', data: '0x...', }, { to: '0xContractB...', value: '0x0', data: '0x...', }, ], }], }); ``` #### Parameters \| Name | Type | Required | Description | \|------|------|----------|-------------| \| `calls` | `array` | Yes | Array of call objects | \| `calls[].to` | `0x${string}` | Yes | Recipient address | \| `calls[].value` | `0x${string}` | No | Value in wei (hex), default "0x0" | \| `calls[].data` | `0x${string}` | No | Call data (hex), default "0x" | \| `chainId` | `0x${string}` | No | Target chain ID (defaults to connected chain) | \| `capabilities` | `object` | No | Additional capabilities (see below) | #### Capabilities \| Name | Type | Description | \|------|------|-------------| \| `capabilities.permissions` | `object` | Permission capability for delegated execution | \| `capabilities.permissions.id` | `0x${string}` | ID of the permission to use for execution | \| `capabilities.paymasterService` | `object` | Paymaster service for per-call gas sponsorship | \| `capabilities.paymasterService.url` | `string` | Paymaster service URL (ERC-7677 compliant) | \| `capabilities.paymasterService.context` | `object` | Optional context (e.g., `{ sponsorshipPolicyId: '...' }`) | :::info The `paymasterService` capability allows you to specify a paymaster per-call, overriding any paymaster configured at the SDK level. ::: ### Response Returns a batch call identifier. #### Example ```json { "id": "0x123abc..." } ``` ### Behavior * All calls succeed atomically or all fail together * Uses currently connected chain if `chainId` not specified * Returns batch ID immediately for status tracking * Background task monitors completion * Gas is sponsored by paymaster if configured * Users offered native ERC-20 paymaster option for gas fees (no configuration needed) ### Errors \| Code | Description | \|------|-------------| \| 4001 | User rejected the request | \| 4100 | Unauthorized (not authenticated) | \| -32602 | Invalid params | ### Example #### Transfer Multiple ERC-20 Tokens ```typescript import { encodeFunctionData } from 'viem'; const transferAbi = [{ name: 'transfer', type: 'function', inputs: [ { name: 'to', type: 'address' }, { name: 'amount', type: 'uint256' }, ], }]; const account = '0x1234...'; const recipient = '0x5678...'; // Encode both transfers const usdcTransfer = encodeFunctionData({ abi: transferAbi, functionName: 'transfer', args: [recipient, 1000000n], }); const uniTransfer = encodeFunctionData({ abi: transferAbi, functionName: 'transfer', args: [recipient, 1000000000000000000n], }); // Send both transfers atomically const result = await jaw.provider.request({ method: 'wallet_sendCalls', params: [{ calls: [ { to: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', data: usdcTransfer, }, { to: '0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984', data: uniTransfer, }, ], }], }); console.log('Batch ID:', result.id); ``` #### Check Status ```typescript // Get status of the batch const status = await jaw.provider.request({ method: 'wallet_getCallsStatus', params: [result.id], }); console.log('Status:', status.status); ``` #### Execute with Permission (Delegated Execution) When a permission has been granted via `wallet_grantPermissions`, you can execute calls using that permission. This allows the spender to execute transactions on behalf of the account within the permission's constraints. ```typescript import { encodeFunctionData } from 'viem'; // First, get the permission ID from a previous wallet_grantPermissions call const permissionId = '0x1234...'; // The permission ID returned from grantPermissions const transferData = encodeFunctionData({ abi: erc20Abi, functionName: 'transfer', args: ['0x5678...', 1000000n], }); // Execute the transfer using the permission const result = await jaw.provider.request({ method: 'wallet_sendCalls', params: [{ calls: [ { to: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC data: transferData, }, ], capabilities: { permissions: { id: permissionId, }, }, }], }); console.log('Batch ID:', result.id); ``` When using the `permissions` capability: * The calls are executed through the JustaPermissionManager contract * The permission's call and spend limits are enforced * The spender must have been granted appropriate permissions for the calls being made ### Related Methods * [wallet\_getCallsStatus](/api-reference/wallet_getCallsStatus) - Get batch status * [wallet\_grantPermissions](/api-reference/wallet_grantPermissions) - Grant permissions for delegated execution ## wallet_sign Source: https://docs.jaw.id/api-reference/wallet_sign ## wallet\_sign Unified signing method supporting multiple message formats (ERC-7871). Delegates to `personal_sign` or `eth_signTypedData_v4` based on the request type. **Authentication Required:** No ### Request ```typescript await jaw.provider.request({ method: 'wallet_sign', params: [{ // chainId: '0x1', // Optional - defaults to connected chain request: { type: '0x45', // or '0x01' data: { message: 'Hello World' } // or TypedData object for 0x01 }, }], }); ``` #### Parameters \| Name | Type | Required | Description | \|------|------|----------|-------------| \| `chainId` | `0x${string}` | No | Target chain ID (defaults to connected chain) | \| `request.type` | `string` | Yes | Signature type: `"0x45"` (personal\_sign) or `"0x01"` (signTypedData\_v4) | \| `request.data` | `object` | Yes | For 0x45: `{ message: string }`. For 0x01: TypedData object (EIP-712) | #### Supported Types \| Type | EIP Standard | Description | Data Format | \|------|--------------|-------------|-------------| \| `0x45` | EIP-191 | Personal message signing | `{ message: string }` - UTF-8 message string | \| `0x01` | EIP-712 | Structured typed data signing | TypedData object with `types`, `domain`, `primaryType`, `message` | ### Response Returns the signature as a hexadecimal string. **Type:** `0x${string}` #### Example ```typescript "0x1234567890abcdef..." ``` ### Behavior * **Type 0x45**: Delegates to `personal_sign` - adds EIP-191 prefix and signs the UTF-8 message * **Type 0x01**: Delegates to `eth_signTypedData_v4` - signs structured EIP-712 data * Uses currently connected chain if `chainId` not specified * Opens popup for user approval * Returns signature in same format as the underlying method ### Errors \| Code | Description | \|------|-------------| \| 4001 | User rejected the request | \| 4100 | Unauthorized (not authenticated) | \| -32602 | Invalid params (unsupported type or malformed data) | ### Example #### Personal Message (Type 0x45) ```typescript const message = 'Hello World'; const signature = await jaw.provider.request({ method: 'wallet_sign', params: [{ request: { type: '0x45', data: { message: message, // UTF-8 message string }, }, }], }); ``` #### Typed Data (Type 0x01) ```typescript const typedData = { types: { EIP712Domain: [ { name: 'name', type: 'string' }, { name: 'version', type: 'string' }, { name: 'chainId', type: 'uint256' }, ], Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], }, primaryType: 'Person', domain: { name: 'My DApp', version: '1', chainId: 1, }, message: { name: 'Alice', wallet: '0x...', }, }; const signature = await jaw.provider.request({ method: 'wallet_sign', params: [{ request: { type: '0x01', data: typedData, // TypedData object directly }, }], }); ``` #### SIWE (Sign-In With Ethereum) ```typescript const siweMessage = `example.com wants you to sign in with your Ethereum account: 0x1234... Sign in to Example DApp URI: https://example.com Version: 1 Chain ID: 1 Nonce: ${crypto.randomUUID()} Issued At: ${new Date().toISOString()}`; const signature = await jaw.provider.request({ method: 'wallet_sign', params: [{ request: { type: '0x45', data: { message: siweMessage, // UTF-8 message string }, }, }], }); ``` ### Related Methods * [personal\_sign](/api-reference/personal_sign) - Direct EIP-191 message signing (type 0x45) * [eth\_signTypedData\_v4](/api-reference/eth_signTypedData_v4) - Direct EIP-712 typed data signing (type 0x01) ## wallet_switchEthereumChain Source: https://docs.jaw.id/api-reference/wallet_switchEthereumChain ## wallet\_switchEthereumChain Switch to a different chain. **Authentication Required:** Yes ### Request ```typescript await jaw.provider.request({ method: 'wallet_switchEthereumChain', params: [{ chainId: '0x2105' }], // Base }); ``` #### Parameters \| Name | Type | Required | Description | \|------|------|----------|-------------| \| `chainId` | `0x${string}` | Yes | Target chain ID in hexadecimal format | #### Example ```json [{ "chainId": "0x2105" }] ``` ### Response Returns `null` on success. **Type:** `null` ### Behavior * Switches to the specified chain if supported * Emits `chainChanged` event with the new chain ID * All subsequent transactions use the new chain * Only supported chains can be switched to ### Errors \| Code | Description | \|------|-------------| \| 4001 | User rejected the request | \| 4100 | Unauthorized (not authenticated) | \| 4902 | Chain not supported | ### Example #### Basic Chain Switch ```typescript try { await jaw.provider.request({ method: 'wallet_switchEthereumChain', params: [{ chainId: '0x2105' }], // Base }); console.log('Switched to Base'); } catch (error) { if (error.code === 4902) { console.error('Base is not supported'); } } ``` #### Switch with Event Listener ```typescript // Listen for chain changes jaw.provider.on('chainChanged', (chainId) => { console.log('Chain changed to:', parseInt(chainId, 16)); }); // Switch chain await jaw.provider.request({ method: 'wallet_switchEthereumChain', params: [{ chainId: '0x2105' }], // Base }); ``` ### Related Methods * [eth\_chainId](/api-reference/eth_chainId) - Get current chain ID