{"id":30883222,"url":"https://github.com/generationsoftware/viem-raf-relayer-client","last_synced_at":"2026-01-20T16:33:20.850Z","repository":{"id":312308157,"uuid":"1046673836","full_name":"GenerationSoftware/viem-raf-relayer-client","owner":"GenerationSoftware","description":"Viem library to make it easy to send requests to an RAF Relayer (ERC2771)","archived":false,"fork":false,"pushed_at":"2025-08-29T03:47:37.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-05T12:02:44.578Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GenerationSoftware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-29T03:44:08.000Z","updated_at":"2025-08-29T03:47:41.000Z","dependencies_parsed_at":"2025-08-29T19:56:31.741Z","dependency_job_id":"4c92d94c-db5f-454d-8a45-26721ddd8a39","html_url":"https://github.com/GenerationSoftware/viem-raf-relayer-client","commit_stats":null,"previous_names":["generationsoftware/viem-raf-relayer-client"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/GenerationSoftware/viem-raf-relayer-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GenerationSoftware%2Fviem-raf-relayer-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GenerationSoftware%2Fviem-raf-relayer-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GenerationSoftware%2Fviem-raf-relayer-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GenerationSoftware%2Fviem-raf-relayer-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GenerationSoftware","download_url":"https://codeload.github.com/GenerationSoftware/viem-raf-relayer-client/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GenerationSoftware%2Fviem-raf-relayer-client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28607285,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T16:10:39.856Z","status":"ssl_error","status_checked_at":"2026-01-20T16:10:39.493Z","response_time":117,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-09-08T09:43:20.823Z","updated_at":"2026-01-20T16:33:20.839Z","avatar_url":"https://github.com/GenerationSoftware.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Viem RAF Relayer Client\n\nA TypeScript library for interacting with the Ready Aim Fire Relayer server (ERC2771 sponsored transactions). This library provides a simple, object-oriented interface for signing and forwarding meta-transactions.\n\n## Installation\n\n```bash\nnpm install @generationsoftware/viem-raf-relayer-client\n```\n\n## Usage\n\n### Basic Setup\n\n```typescript\nimport { createPublicClient, createWalletClient, http } from 'viem';\nimport { arbitrum } from 'viem/chains';\nimport { RafRelayer } from '@generationsoftware/viem-raf-relayer-client';\n\n// Create a public client for reading blockchain state\nconst publicClient = createPublicClient({\n  chain: arbitrum,\n  transport: http('https://your-rpc-url.com')\n});\n\n// Create a wallet client for signing transactions\nconst walletClient = createWalletClient({\n  chain: arbitrum,\n  transport: http('https://your-rpc-url.com'),\n  account: privateKeyToAccount('0x...')\n});\n\n// Initialize the forwarder\nconst forwarder = new RafRelayer(\n  '0x...', // forwarder contract address\n  publicClient,\n  'https://your-relayer.com/forward' // relayer URL\n);\n```\n\n### Forwarding a Transaction\n\n```typescript\n// Forward a transaction through the relayer\nconst txHash = await forwarder.forward({\n  to: '0x...', // target contract address\n  data: '0x...', // encoded function call\n  value: 0n, // optional: ETH value to send\n  gas: 10000000n, // optional: gas limit\n  deadline: Math.floor(Date.now() / 1000) + 60 // optional: deadline timestamp\n}, walletClient);\n\nconsole.log('Transaction hash:', txHash);\n```\n\n### Manual Signing (Advanced)\n\nIf you need more control over the signing process:\n\n```typescript\n// Get the current nonce for an address\nconst nonce = await forwarder.getNonce(walletClient.account.address);\n\n// Create a forward request\nconst request = {\n  from: walletClient.account.address,\n  to: '0x...',\n  value: 0n,\n  gas: 10000000n,\n  nonce,\n  deadline: Math.floor(Date.now() / 1000) + 60,\n  data: '0x...'\n};\n\n// Sign the request\nconst signature = await forwarder.sign(walletClient, request);\n\n// Now you can send the signed request to your relayer manually\n```\n\n### Verifying Requests\n\n```typescript\n// Verify a signed forward request\nconst isValid = await forwarder.verify({\n  from: '0x...',\n  to: '0x...',\n  value: 0n,\n  gas: 10000000n,\n  nonce: 0n,\n  deadline: Math.floor(Date.now() / 1000) + 60,\n  data: '0x...',\n  signature: '0x...'\n});\n\n// Get detailed validation information\nconst validation = await forwarder.validate(signedRequest);\nconsole.log('Is trusted forwarder:', validation.isTrustedForwarder);\nconsole.log('Is active:', validation.active);\nconsole.log('Signer match:', validation.signerMatch);\n```\n\n## API Reference\n\n### `new RafRelayer(forwarderAddress, publicClient, relayerUrl)`\n\nCreates a new RafRelayer instance.\n\n- `forwarderAddress`: The address of the ERC2771 forwarder contract\n- `publicClient`: A viem PublicClient instance for reading blockchain state\n- `relayerUrl`: The URL of your relayer endpoint\n\n### `forwarder.forward(options, walletClient)`\n\nForwards a transaction through a relayer.\n\n**Options:**\n- `to`: Target contract address\n- `data`: Encoded function call data\n- `value?`: ETH value to send (default: 0n)\n- `gas?`: Gas limit (default: 10000000n)\n- `deadline?`: Deadline timestamp (default: 60 seconds from now)\n\n**Returns:** Transaction hash\n\n### `forwarder.sign(walletClient, request)`\n\nSigns a forward request.\n\n**Request:**\n- `from`: Sender address\n- `to`: Target contract address\n- `value`: ETH value\n- `gas`: Gas limit\n- `nonce`: Account nonce from the forwarder\n- `deadline`: Deadline timestamp\n- `data`: Encoded function call data\n\n**Returns:** Signature\n\n### `forwarder.getNonce(address)`\n\nGets the current nonce for an address from the forwarder contract.\n\n### `forwarder.verify(signedRequest)`\n\nVerifies a signed forward request.\n\n### `forwarder.validate(signedRequest)`\n\nGets detailed validation information for a signed request.\n\n## Types\n\nThe library exports the following TypeScript types:\n\n- `ForwardRequest`: Basic forward request structure\n- `SignedForwardRequest`: Forward request with signature\n- `ForwardTransactionOptions`: Options for the `forward()` method\n- `RelayerResponse`: Response from relayer\n- `EIP712Domain`: EIP-712 domain structure\n\n## License\n\nMIT","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgenerationsoftware%2Fviem-raf-relayer-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgenerationsoftware%2Fviem-raf-relayer-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgenerationsoftware%2Fviem-raf-relayer-client/lists"}