@elsoul/erpc-sdk 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ELSOUL LABO B.V.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,95 @@
1
+ # `@elsoul/erpc-sdk`
2
+
3
+ Official type-safe TypeScript client for [ERPC](https://erpc.global). Use one
4
+ client and one API key for Solana, Ethereum, price data, indexed data, leader
5
+ and validator data, analytics, subscriptions, and account information.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install @elsoul/erpc-sdk
11
+ # or: pnpm add @elsoul/erpc-sdk
12
+ ```
13
+
14
+ The package has no runtime dependencies and includes ESM, CommonJS, and
15
+ TypeScript declarations. Node.js 20 or later is supported.
16
+
17
+ ## Quick start
18
+
19
+ ```ts
20
+ import { createErpcClient } from '@elsoul/erpc-sdk'
21
+
22
+ const apiKey = process.env.ERPC_API_KEY
23
+ if (!apiKey) throw new Error('ERPC_API_KEY is required')
24
+
25
+ const erpc = createErpcClient({ apiKey })
26
+
27
+ const slot = await erpc.solana.rpc.getSlot().send()
28
+ const chainId = await erpc.ethereum.rpc.eth_chainId().send()
29
+
30
+ console.log({ slot, chainId })
31
+ erpc.close()
32
+ ```
33
+
34
+ JSON-RPC method calls return pending requests. Call `.send()` to perform the
35
+ network request.
36
+
37
+ ## Namespaces
38
+
39
+ | Namespace | Purpose |
40
+ | --- | --- |
41
+ | `erpc.solana.rpc` | Solana JSON-RPC |
42
+ | `erpc.solana.das` | Indexed assets and tokens |
43
+ | `erpc.solana.history` | Address transactions and transfers |
44
+ | `erpc.solana.leaders` | Leader slots and validator information |
45
+ | `erpc.solana.analytics` | Epoch, slot, program, and TPS analytics |
46
+ | `erpc.solana.subscriptions` | Enhanced WebSocket subscriptions |
47
+ | `erpc.ethereum.rpc` | Ethereum JSON-RPC |
48
+ | `erpc.ethereum.subscriptions` | Ethereum WebSocket subscriptions |
49
+ | `erpc.price` | Price metadata, updates, and streams |
50
+ | `erpc.account` | ERPC token balance |
51
+
52
+ ## Examples
53
+
54
+ ```ts
55
+ const asset = await erpc.solana.das.getAsset({ id: assetId }).send()
56
+
57
+ const block = await erpc.ethereum.rpc
58
+ .eth_getBlockByNumber('latest', false)
59
+ .send()
60
+
61
+ const prices = await erpc.price.getLatestPriceUpdates({
62
+ ids: [feedId],
63
+ parsed: true,
64
+ })
65
+
66
+ const heads = await erpc.ethereum.subscriptions.subscribe(
67
+ 'newHeads',
68
+ (header) => console.log(header),
69
+ )
70
+
71
+ await heads.unsubscribe()
72
+ erpc.close()
73
+ ```
74
+
75
+ ## Raw methods
76
+
77
+ The typed catalogs track methods available from ERPC. The raw API provides
78
+ forward compatibility with newly introduced server methods:
79
+
80
+ ```ts
81
+ const result = await erpc.solana.rpc
82
+ .raw<MyResult>('futureMethod', [{ enabled: true }])
83
+ .send()
84
+ ```
85
+
86
+ ## Documentation
87
+
88
+ - [Complete guide](https://github.com/elsoul/erpc-sdk#readme)
89
+ - [Method availability](https://github.com/elsoul/erpc-sdk/blob/main/docs/METHODS.md)
90
+ - [Roadmap](https://github.com/elsoul/erpc-sdk/blob/main/ROADMAP.md)
91
+ - [Security policy](https://github.com/elsoul/erpc-sdk/blob/main/SECURITY.md)
92
+
93
+ ## License
94
+
95
+ [MIT](https://github.com/elsoul/erpc-sdk/blob/main/LICENSE)