{"id":21018551,"url":"https://github.com/damartripamungkas/client-blockchain-rpc","last_synced_at":"2026-02-25T23:32:22.349Z","repository":{"id":310997806,"uuid":"737298510","full_name":"damartripamungkas/client-blockchain-rpc","owner":"damartripamungkas","description":"⛓️ Lightweight, and type-safe multi-protocol blockchain RPC client for EVM, Solana, and more.","archived":false,"fork":false,"pushed_at":"2025-12-19T10:55:27.000Z","size":284,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-22T02:02:56.619Z","etag":null,"topics":["arbitrum","blockchain","blockchain-rpc","client-blockchain-rpc","ethereum","jsonrpc","solana"],"latest_commit_sha":null,"homepage":"https://npmjs.com/package/client-blockchain-rpc","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/damartripamungkas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-12-30T14:26:48.000Z","updated_at":"2025-12-21T04:55:15.000Z","dependencies_parsed_at":"2025-08-21T14:51:42.645Z","dependency_job_id":null,"html_url":"https://github.com/damartripamungkas/client-blockchain-rpc","commit_stats":null,"previous_names":["damartripamungkas/client-blockchain-rpc"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/damartripamungkas/client-blockchain-rpc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damartripamungkas%2Fclient-blockchain-rpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damartripamungkas%2Fclient-blockchain-rpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damartripamungkas%2Fclient-blockchain-rpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damartripamungkas%2Fclient-blockchain-rpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/damartripamungkas","download_url":"https://codeload.github.com/damartripamungkas/client-blockchain-rpc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damartripamungkas%2Fclient-blockchain-rpc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29844867,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-25T22:37:40.667Z","status":"ssl_error","status_checked_at":"2026-02-25T22:37:25.960Z","response_time":61,"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":["arbitrum","blockchain","blockchain-rpc","client-blockchain-rpc","ethereum","jsonrpc","solana"],"created_at":"2024-11-19T10:26:31.850Z","updated_at":"2026-02-25T23:32:22.344Z","avatar_url":"https://github.com/damartripamungkas.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eClient Blockchain RPC\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ci\u003eA professional, lightweight, and type-safe multi-protocol blockchain RPC client\u003c/i\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.npmjs.com/package/client-blockchain-rpc\"\u003e\n    \u003cimg alt=\"npm version\" src=\"https://img.shields.io/npm/v/client-blockchain-rpc?style=flat-square\u0026color=007bff\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/client-blockchain-rpc\"\u003e\n    \u003cimg alt=\"npm downloads\" src=\"https://img.shields.io/npm/dm/client-blockchain-rpc?style=flat-square\u0026color=28a745\"\u003e\n  \u003c/a\u003e\n  \u003cimg alt=\"TypeScript\" src=\"https://img.shields.io/badge/TypeScript-Ready-blue?style=flat-square\u0026logo=typescript\"\u003e\n  \u003cimg alt=\"License\" src=\"https://img.shields.io/github/license/damartripamungkas/client-blockchain-rpc?style=flat-square\u0026color=ffc107\"\u003e\n\u003c/p\u003e\n\n---\n\n## 📖 Introduction\n\n**Client Blockchain RPC** is a high-performance, modular RPC client designed for developers who need a reliable way to interact with various blockchain protocols. Whether you are building a DeFi dashboard, a trading bot, or a cross-chain aggregator, this library provides a unified interface for **HTTP**, **WebSocket**, and **IPC** connections.\n\n---\n\n## 📦 Installation\n\n```bash\n# Using npm\nnpm install client-blockchain-rpc\n\n# Using yarn\nyarn add client-blockchain-rpc\n\n# Using bun\nbun add client-blockchain-rpc\n```\n\n---\n\n## 🚀 Quick Start\n\n### 1. High-Level RPC Wrappers\n\nThe easiest way to interact with a blockchain. Wrappers provide an intuitive, async/await interface for all standard methods.\n\n#### Ethereum (EVM)\n\n```typescript\nimport { Provider, EthereumRpc } from \"client-blockchain-rpc\";\n\nconst eth = new EthereumRpc(new Provider(\"https://eth.llamarpc.com\"));\n\nconst blockNumber = await eth.blockNumber();\nconst balance = await eth.getBalance(\"0xd8dA...6045\");\nconsole.log(`Block: ${blockNumber}, Balance: ${balance} wei`);\n```\n\n#### Solana\n\n```typescript\nimport { Provider, SolanaRpc } from \"client-blockchain-rpc\";\n\nconst solana = new SolanaRpc(\n  new Provider(\"https://api.mainnet-beta.solana.com\")\n);\n\nconst balance = await solana.getBalance(\"vines1...7iY\");\nconst version = await solana.getVersion();\nconsole.log(`Balance: ${balance} lamports, Version: ${version[\"solana-core\"]}`);\n```\n\n### 2. Using Providers \u0026 Payloads\n\nFor advanced usage, you can use the `Provider` directly with `Payload` builders. This is useful for custom formatting or manual request control.\n\n```typescript\nimport { Provider, EthereumPayload as EIP } from \"client-blockchain-rpc\";\n\nconst provider = new Provider(\"wss://ethereum-rpc.publicnode.com\");\n\n// Use the payload builder directly\nconst chainId = await provider.send(EIP.chainId());\n```\n\n### 3. Reformatting Payloads\n\nSometimes you need a different return format than the default. You can use `PayloadHelper.reformat` to override the formatting logic of any payload.\n\n```typescript\nimport {\n  Provider,\n  EthereumPayload as EIP,\n  PayloadHelper,\n} from \"client-blockchain-rpc\";\n\nconst provider = new Provider(\"https://eth.llamarpc.com\");\n\n// Default returns bigint\nconst blockNumber = await provider.send(EIP.blockNumber());\n\n// Use reformat to get it as a string instead\nconst blockNumberStr = await provider.send(\n  PayloadHelper.reformat(EIP.blockNumber(), (val) =\u003e val.toString())\n);\n\nconsole.log(typeof blockNumberStr); // \"string\"\n```\n\n### 4. Advanced Batch Requests\n\nExecute multiple calls in a single network round-trip. The results are automatically parsed and typed.\n\n```typescript\nimport { EthereumPayload as EIP } from \"client-blockchain-rpc\";\n\n// Execute multiple requests at once\nconst [block, chainId] = await provider.sendBatch(\n  EIP.blockNumber(),\n  EIP.chainId()\n);\n\nblock; \u003c-- 1000000n\nchainId; \u003c-- 1n\n```\n\n### 5. WebSocket Subscriptions\n\nHandle real-time events with automatic reconnection logic.\n\n```typescript\nimport { EthereumPayload as EIP } from \"client-blockchain-rpc\";\n\nprovider.subscribe(\n  EIP.subscribe(\"newHeads\"),\n  true, // autoReconnect\n  (data, subsId) =\u003e {\n    console.log(`New block in subscription ${subsId}:`, data.number);\n  }\n);\n```\n\n### 6. Custom Error Handling\n\nDescriptively catch and handle RPC-level errors.\n\n```typescript\ntry {\n  await eth.getBalance(\"invalid-address\");\n} catch (error) {\n  // Descriptive error message from the node\n  console.error(\"RPC Error:\", error);\n}\n```\n\n---\n\n## 🧩 Architecture\n\nThe library follows a layered architecture to ensure maximum flexibility and maintainability.\n\n```mermaid\ngraph TD\n    A[Application Layer] --\u003e B[RPC Wrapper Layer]\n    B --\u003e C[Payload Builder Layer]\n    C --\u003e D[Provider Layer]\n    D --\u003e E((Blockchain Node))\n\n    style A fill:#f9f,stroke:#333,stroke-width:2px\n    style E fill:#00d,stroke:#fff,stroke-width:2px,color:#fff\n```\n\n1. **Provider Layer**: Manages raw connections (HTTP/WS/IPC) and stateful features like auto-reconnect.\n2. **Payload Builder Layer**: Pure, static functions that generate valid JSON-RPC request objects.\n3. **RPC Wrapper Layer**: High-level instance methods that combine providers and payloads for a clean API.\n\n---\n\n## ⚙️ Configuration\n\nThe `Provider` constructor handles protocol detection and accepts optional settings.\n\n```typescript\nconst provider = new Provider(\"wss://ethereum-rpc.publicnode.com\", {\n  reconnect: {\n    autoReconnect: true,\n    delay: 5000,\n    maxAttempts: 10,\n  },\n  options: {\n    // Protocol-specific options (web3-providers-ws, etc.)\n  },\n});\n```\n\n---\n\n## 🧪 Testing\n\nWe ensure reliability through comprehensive unit and integration tests.\n\n```bash\n# Run the test suite\nbun test\n```\n\n---\n\n## 📜 License\n\nDistributed under the **MIT License**.\n\n---\n\n\u003cp align=\"center\"\u003e\n  Made with ❤️ by \u003ca href=\"https://github.com/damartripamungkas\"\u003edamartripamungkas\u003c/a\u003e\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdamartripamungkas%2Fclient-blockchain-rpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdamartripamungkas%2Fclient-blockchain-rpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdamartripamungkas%2Fclient-blockchain-rpc/lists"}