import * as RpcSchemas from "./request.js"; import { z } from "../zod.js"; export const PrepareCalls = createExample( "wallet_prepareCalls", [ { calls: [ { to: "0x1234567890123456789012345678901234567890", data: "0x", }, ], from: "0xa363219d7C0b8673df17529D469Db9eFF0f35D2A", chainId: "0x01", capabilities: { paymasterService: { policyId: "11111111-2222-4333-8444-555555555555", }, }, }, ], { type: "user-operation-v070", data: { sender: "0xa363219d7C0b8673df17529D469Db9eFF0f35D2A", nonce: "0x10000000000000000", callData: "0x34fcd5be0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000001234567890123456789012345678901234567890000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000", paymaster: "0x3f222Df6aB18C1E10d0Ec136503c3B0dfd929048", paymasterData: "0x0000000000000000682d7e7c9fa6f71c28c31141a11ac9eb2bdbe898ddbd42a4f7085f8bb3380ba75dd9231a386e24fe5a84777217c907391e983b5b0f78a4a9d0fd1c8631dd22c10e106b461c", paymasterPostOpGasLimit: "0x0", paymasterVerificationGasLimit: "0x74d3", maxPriorityFeePerGas: "0x60e4b0", maxFeePerGas: "0x1bf52290", callGasLimit: "0x2bb8", verificationGasLimit: "0xc845", preVerificationGas: "0x14b74", }, chainId: "0x66eee", signatureRequest: { type: "personal_sign", data: { raw: "0xc69e468aa6fafb5c7298c02841e76f976b433018266af39a5807bc29ea9ad392", }, rawPayload: "0x2a8073568c8fad3edf15f70c3471a7fff18e1d57c650a501ab47f57a5c1f0e39", }, feePayment: { sponsored: false, tokenAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", maxAmount: "0x1f34", }, details: { type: "user-operation", data: { hash: "0xc69e468aa6fafb5c7298c02841e76f976b433018266af39a5807bc29ea9ad392", calls: [ { to: "0x1234567890123456789012345678901234567890", data: "0x", }, ], }, }, }, ); export const SendPreparedCalls = createExample( "wallet_sendPreparedCalls", [ { type: "user-operation-v070", data: { sender: "0xa363219d7C0b8673df17529D469Db9eFF0f35D2A", nonce: "0x10000000000000000", callData: "0x34fcd5be0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000001234567890123456789012345678901234567890000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000", paymaster: "0x3f222Df6aB18C1E10d0Ec136503c3B0dfd929048", paymasterData: "0x0000000000000000682d7e7c9fa6f71c28c31141a11ac9eb2bdbe898ddbd42a4f7085f8bb3380ba75dd9231a386e24fe5a84777217c907391e983b5b0f78a4a9d0fd1c8631dd22c10e106b461c", paymasterPostOpGasLimit: "0x0", paymasterVerificationGasLimit: "0x74d3", maxPriorityFeePerGas: "0x60e4b0", maxFeePerGas: "0x1bf52290", callGasLimit: "0x2bb8", verificationGasLimit: "0xc845", preVerificationGas: "0x14b74", }, chainId: "0x66eee", signature: { type: "secp256k1", data: "0xb1a055089b1ba8387ed435f2bd0afe7ff69f22b928cdfdea1b5323c64d6af387164de3fa6febf031b544de46a84d6fb7f084b9798ddfaba820950c257139a7321b", }, }, ], { id: "0x0000000000000000000000000000000000000000000000000000000000066eeec69e468aa6fafb5c7298c02841e76f976b433018266af39a5807bc29ea9ad392", preparedCallIds: [ "0x0000000000000000000000000000000000000000000000000000000000066eeec69e468aa6fafb5c7298c02841e76f976b433018266af39a5807bc29ea9ad392", ], details: { type: "user-operation" as const, data: { hash: "0xc69e468aa6fafb5c7298c02841e76f976b433018266af39a5807bc29ea9ad392", calls: [ { to: "0x1234567890123456789012345678901234567890", data: "0x", value: "0x0", }, ], }, }, }, ); export const RequestAccount = createExample( "wallet_requestAccount", [ { signerAddress: "0xa363219d7C0b8673df17529D469Db9eFF0f35D2A", }, ], { accountAddress: "0xa363219d7C0b8673df17529D469Db9eFF0f35D2A", id: "3061cc5f-1f96-48a9-ab45-41faad2dd23b", }, ); export const ListAccounts = createExample( "wallet_listAccounts", [ { signerAddress: "0x6275B53E98D07c729108A177207634eA22F5A748", }, ], { accounts: [ { accountAddress: "0xafdABa1E09e82F780721963eba39bA9e6d9FE4d2", id: "3d8b3315-4aa1-4c67-8c82-20221e8dbf16", }, ], meta: { totalCount: 1, after: null, }, }, ); export const GetCapabilities = createExample( "wallet_getCapabilities", ["0xd46e8dd67c5d32be8058bb8eb970870f07244567", ["0x2105", "0x14A34"]], { "0x0": { atomic: { status: "supported", }, paymasterService: { supported: true, }, eip7702Auth: { supported: true, }, }, }, ); export const CreateSession = createExample( "wallet_createSession", [ { account: "0xafdABa1E09e82F780721963eba39bA9e6d9FE4d2", chainId: "0x01", key: { publicKey: "0x647bbf38CD0E116d1672405aE17a775572a84e03", type: "secp256k1", }, permissions: [ { type: "root", }, ], expirySec: 1747969653, }, ], { sessionId: "0xcd8b2d07a6fa76f1e8a5eaa8f3a7883c", chainId: "0x1", signatureRequest: { type: "eth_signTypedData_v4", data: { domain: { chainId: 1, verifyingContract: "0xafdABa1E09e82F780721963eba39bA9e6d9FE4d2", }, types: { DeferredAction: [ { name: "nonce", type: "uint256", }, { name: "deadline", type: "uint48", }, { name: "call", type: "bytes", }, ], }, primaryType: "DeferredAction", message: { nonce: "0x1030000000000000000", deadline: 1747969653, call: "0x1bbf564c00000000000099DE0BF6fA90dEB851E2A2df7d83000000010500000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000647bbf38cd0e116d1672405ae17a775572a84e0300000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000007900000000000082B8e2012be914dFA4f62A0573eA0000000101000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000682fe675000000000000000000000000000000000000000000000000000000000000000000000000000000", }, }, rawPayload: "0x2a8073568c8fad3edf15f70c3471a7fff18e1d57c650a501ab47f57a5c1f0e39", }, }, ); export const GetCallsStatus = createExample( "wallet_getCallsStatus", [ "0x0000000000000000000000000000000000000000000000000000000000066eee1057eff9529142aa3b74adcaacfce5b99a09d80c9f2e38e35ea1f27535e61477", ], { id: "0x0000000000000000000000000000000000000000000000000000000000066eee1057eff9529142aa3b74adcaacfce5b99a09d80c9f2e38e35ea1f27535e61477", chainId: "0x66eee", atomic: true, status: 200, details: { type: "user-operation", data: { hash: "0x1057eff9529142aa3b74adcaacfce5b99a09d80c9f2e38e35ea1f27535e61477", calls: [ { to: "0x1234567890123456789012345678901234567890", data: "0x", }, ], }, }, receipts: [ { status: "0x1", blockHash: "0x7c6f2f548c0ad4434dfb64f49a810bc795dadcd4cbec948bf8d4ae81a10fed5e", blockNumber: "0x8ba5f79", gasUsed: "0x33c65", transactionHash: "0x8ec28074a461102e4dbe43cb4aa9fed3e8c1274f1f1b0d5f6a0919ce7e20f517", logs: [ { address: "0x00000000000017c61b5bee81050ec8efc9c6fecd", data: "0x0000000000000000000000000000000000000000000000000000000000000000", topics: [ "0xd32049610f0cd3babd266cf338d726cc8c34c8ff97356c0f33c13fa59962ac92", "0x000000000000000000000000f13223cca0ae9786dd91dffe1f4e834c71ccdc2d", "0x0000000000000000000000003f3503e682bf27330f9e5065043d47207e609e7d", ], }, { address: "0x0000000071727de22e5e9d8baf0edac6f37da032", data: "0x00000000000000000000000000000000000017c61b5bee81050ec8efc9c6fecd0000000000000000000000002cc0c7981d846b9f2a16276556f6e8cb52bfb633", topics: [ "0xd51a9c61267aa6196961883ecf5ff2da6619c37dac0fa92122513fb32c032d2d", "0x1057eff9529142aa3b74adcaacfce5b99a09d80c9f2e38e35ea1f27535e61477", "0x000000000000000000000000f13223cca0ae9786dd91dffe1f4e834c71ccdc2d", ], }, { address: "0x0000000071727de22e5e9d8baf0edac6f37da032", data: "0x", topics: [ "0xbb47ee3e183a558b1a2ff0874b079f3fc5478b7454eacf2bfc5af2ff5878f972", ], }, { address: "0x0000000071727de22e5e9d8baf0edac6f37da032", data: "0x00000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000014ba6c2cd4f0000000000000000000000000000000000000000000000000000000000003451d", topics: [ "0x49628fd1471006c1482da88028e9ce4dbb080b815c9b0344d39e5a8e6ec1419f", "0x1057eff9529142aa3b74adcaacfce5b99a09d80c9f2e38e35ea1f27535e61477", "0x000000000000000000000000f13223cca0ae9786dd91dffe1f4e834c71ccdc2d", "0x0000000000000000000000002cc0c7981d846b9f2a16276556f6e8cb52bfb633", ], }, ], }, ], }, ); export const GetCrossChainStatusV0 = createExample( "wallet_getCrossChainStatus_v0", [ "0x010100066d00682d7e7c9fa6f71c28c31141a11ac9eb2bdbe898ddbd42a4f7085f8bb3380ba75dd9231a386e24fe5a84777217c907391e983b5b0f78a4a9d0fd1c8631dd22c00000000000000000000000000000000000000000000000000000000000a4b1000000000000000000000000000000000000000000000000000000000000000102a8073568c8fad3edf15f70c3471a7fff18e1d57c650a501ab47f57a5c1f0e39", ], { type: "cross-chain", id: "0x010100066d00682d7e7c9fa6f71c28c31141a11ac9eb2bdbe898ddbd42a4f7085f8bb3380ba75dd9231a386e24fe5a84777217c907391e983b5b0f78a4a9d0fd1c8631dd22c00000000000000000000000000000000000000000000000000000000000a4b1000000000000000000000000000000000000000000000000000000000000000102a8073568c8fad3edf15f70c3471a7fff18e1d57c650a501ab47f57a5c1f0e39", status: 120, originTransaction: { chainId: "0xa4b1", status: 200, receipt: { status: "0x1", blockHash: "0x7c6f2f548c0ad4434dfb64f49a810bc795dadcd4cbec948bf8d4ae81a10fed5e", blockNumber: "0x8ba5f79", gasUsed: "0x33c65", transactionHash: "0x8ec28074a461102e4dbe43cb4aa9fed3e8c1274f1f1b0d5f6a0919ce7e20f517", logs: [], }, }, destinationTransaction: { chainId: "0x1", status: 100, }, }, ); export const PrepareSign = createExample( "wallet_prepareSign", [ { from: "0xa363219d7C0b8673df17529D469Db9eFF0f35D2A", chainId: "0x01", signatureRequest: { type: "personal_sign", data: { raw: "0x48656c6c6f20576f726c6421", // "Hello World!" }, }, }, ], { chainId: "0x66eee", signatureRequest: { type: "eth_signTypedData_v4", data: { domain: { chainId: 421614, verifyingContract: "0xafdABa1E09e82F780721963eba39bA9e6d9FE4d2", }, types: { ReplaySafeHash: [ { name: "hash", type: "bytes32", }, ], }, primaryType: "ReplaySafeHash", message: { hash: "0xec3608877ecbf8084c29896b7eab2a368b2b3c8d003288584d145613dfa4706c", }, }, }, }, ); export const FormatSign = createExample( "wallet_formatSign", [ { from: "0xa363219d7C0b8673df17529D469Db9eFF0f35D2A", chainId: "0x01", signature: { type: "ecdsa", data: "0xb1a055089b1ba8387ed435f2bd0afe7ff69f22b928cdfdea1b5323c64d6af387164de3fa6febf031b544de46a84d6fb7f084b9798ddfaba820950c257139a7321b", }, }, ], { signature: "0xb1a055089b1ba8387ed435f2bd0afe7ff69f22b928cdfdea1b5323c64d6af387164de3fa6febf031b544de46a84d6fb7f084b9798ddfaba820950c257139a7321b", }, ); export const RequestQuoteV0 = createExample( "wallet_requestQuote_v0", [ { from: "0xa363219d7C0b8673df17529D469Db9eFF0f35D2A", fromToken: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEee", toToken: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831", minimumToAmount: "0x5F5E100", chainId: "0xa4b1", capabilities: { paymasterService: { policyId: "11111111-2222-4333-8444-555555555555", }, }, postCalls: [ { to: "0x1234567890123456789012345678901234567890", data: "0x", }, ], }, ], { rawCalls: false, quote: { fromAmount: "0x123", minimumToAmount: "0x456", expiry: "0xffffffff", }, type: "user-operation-v070", data: { sender: "0xa363219d7C0b8673df17529D469Db9eFF0f35D2A", nonce: "0x10000000000000000", callData: "0x34fcd5be0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000001234567890123456789012345678901234567890000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000", paymaster: "0x3f222Df6aB18C1E10d0Ec136503c3B0dfd929048", paymasterData: "0x0000000000000000682d7e7c9fa6f71c28c31141a11ac9eb2bdbe898ddbd42a4f7085f8bb3380ba75dd9231a386e24fe5a84777217c907391e983b5b0f78a4a9d0fd1c8631dd22c10e106b461c", paymasterPostOpGasLimit: "0x0", paymasterVerificationGasLimit: "0x74d3", maxPriorityFeePerGas: "0x60e4b0", maxFeePerGas: "0x1bf52290", callGasLimit: "0x2bb8", verificationGasLimit: "0xc845", preVerificationGas: "0x14b74", }, chainId: "0x66eee", signatureRequest: { type: "personal_sign", data: { raw: "0xc69e468aa6fafb5c7298c02841e76f976b433018266af39a5807bc29ea9ad392", }, rawPayload: "0x2a8073568c8fad3edf15f70c3471a7fff18e1d57c650a501ab47f57a5c1f0e39", }, feePayment: { sponsored: false, tokenAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", maxAmount: "0x1f34", }, details: { type: "user-operation", data: { hash: "0xc69e468aa6fafb5c7298c02841e76f976b433018266af39a5807bc29ea9ad392", calls: [ { to: "0x1234567890123456789012345678901234567890", data: "0x", }, ], }, }, }, ); /** * Creates a type-safe RPC example with schema-based type checking * @param method - The RPC method name (must match a key in RpcSchemas) * @param request - The request parameters (typed against the schema) * @param response - The response value (typed against the schema) * @returns A properly structured example object */ export function createExample( method: TMethod, request: z.input<(typeof RpcSchemas)[TMethod]>["Request"]["params"], response: z.input<(typeof RpcSchemas)[TMethod]>["ReturnType"], ): { name: string; params: readonly [ { name: "Request"; value: z.input<(typeof RpcSchemas)[TMethod]>["Request"]["params"]; }, ]; result: { name: "Response"; value: z.input<(typeof RpcSchemas)[TMethod]>["ReturnType"]; }; } { return { name: `${String(method)} example`, params: [ { name: "Request" as const, value: request, }, ], result: { name: "Response" as const, value: response, }, } as const; }