@obolnetwork/obol-sdk 2.11.8 → 2.11.10
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/README.md +78 -2
- package/dist/browser/src/index.js +416 -292
- package/dist/browser/src/index.js.map +1 -1
- package/dist/cjs/src/index.js +419 -292
- package/dist/cjs/src/index.js.map +1 -1
- package/dist/esm/src/index.js +416 -292
- package/dist/esm/src/index.js.map +1 -1
- package/dist/types/src/bytecodes.d.ts +0 -3
- package/dist/types/src/constants.d.ts +1 -2
- package/dist/types/src/eoa/eoa.d.ts +54 -43
- package/dist/types/src/errors.d.ts +23 -0
- package/dist/types/src/exits/exit.d.ts +16 -19
- package/dist/types/src/incentives/incentives.d.ts +59 -30
- package/dist/types/src/index.d.ts +262 -76
- package/dist/types/src/services.d.ts +22 -8
- package/dist/types/src/splits/splits.d.ts +100 -65
- package/dist/types/src/types.d.ts +63 -25
- package/dist/types/test/fixtures.d.ts +31 -122
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -4,6 +4,34 @@
|
|
|
4
4
|
|
|
5
5
|
This repo contains the Obol Software Development Kit, for creating Distributed Validators with the help of the [Obol API](https://docs.obol.org/api).
|
|
6
6
|
|
|
7
|
+
## Quick Start
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
import { Client } from "@obolnetwork/obol-sdk";
|
|
11
|
+
import { Wallet } from "ethers";
|
|
12
|
+
|
|
13
|
+
// 1. Create a client (Hoodi testnet)
|
|
14
|
+
const signer = new Wallet(process.env.PRIVATE_KEY!);
|
|
15
|
+
const client = new Client({ chainId: 560048 }, signer);
|
|
16
|
+
|
|
17
|
+
// 2. Accept terms and conditions (required once per address)
|
|
18
|
+
await client.acceptObolLatestTermsAndConditions();
|
|
19
|
+
|
|
20
|
+
// 3. Create a cluster definition
|
|
21
|
+
const configHash = await client.createClusterDefinition({
|
|
22
|
+
name: "my-cluster",
|
|
23
|
+
operators: [{ address: "0xOperator1..." }, { address: "0xOperator2..." }],
|
|
24
|
+
validators: [{
|
|
25
|
+
fee_recipient_address: "0xFeeRecipient...",
|
|
26
|
+
withdrawal_address: "0xWithdrawal...",
|
|
27
|
+
}],
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// 4. Retrieve the definition / lock (read-only, no signer needed)
|
|
31
|
+
const definition = await client.getClusterDefinition(configHash);
|
|
32
|
+
const lock = await client.getClusterLock(configHash);
|
|
33
|
+
```
|
|
34
|
+
|
|
7
35
|
## Getting Started
|
|
8
36
|
|
|
9
37
|
Checkout our [docs](https://docs.obol.org/docs/advanced/quickstart-sdk), [examples](https://github.com/ObolNetwork/obol-sdk-examples/), and SDK [reference](https://obolnetwork.github.io/obol-sdk). Further guides and walkthroughs coming soon.
|
|
@@ -19,7 +47,7 @@ If you're integrating this SDK with a **backend** (e.g., in Node.js), and you st
|
|
|
19
47
|
|
|
20
48
|
## ⚡️ Integration with Safe Wallet
|
|
21
49
|
|
|
22
|
-
When integrating the Obol SDK with a **Safe Wallet**, you can either pass an RPC URL OR provide the `RPC_MAINNET` or `
|
|
50
|
+
When integrating the Obol SDK with a **Safe Wallet**, you can either pass an RPC URL OR provide the `RPC_MAINNET` or `RPC_GNOSIS` or `RPC_SEPOLIA` or `RPC_HOODI` environment variable, pointing to the correct network's RPC URL. This is required to interact with Safe kit.
|
|
23
51
|
|
|
24
52
|
|
|
25
53
|
## Contributing
|
|
@@ -53,6 +81,55 @@ All contributions are reviewed before they are merged into the main branch. Plea
|
|
|
53
81
|
|
|
54
82
|
Thank you for contributing to Obol-SDK!
|
|
55
83
|
|
|
84
|
+
## For AI Agents and Code Generators
|
|
85
|
+
|
|
86
|
+
If you are an LLM, code-generation agent, or tool using this SDK programmatically, follow these guidelines to avoid common mistakes:
|
|
87
|
+
|
|
88
|
+
- **Primary entrypoint:** `Client` from `@obolnetwork/obol-sdk`.
|
|
89
|
+
- **Constructor:** `new Client({ chainId }, signer?, provider?)` – `chainId` defaults to `560048` (Hoodi).
|
|
90
|
+
- **All operations are namespaced** under the client instance. Do **not** construct HTTP requests manually.
|
|
91
|
+
|
|
92
|
+
### Client API Surface
|
|
93
|
+
|
|
94
|
+
| Namespace | Method | Description |
|
|
95
|
+
|-----------|--------|-------------|
|
|
96
|
+
| *(root)* | `acceptObolLatestTermsAndConditions()` | Accept T&C (required once before writes) |
|
|
97
|
+
| *(root)* | `createClusterDefinition(payload)` | Create a new cluster → returns `config_hash` |
|
|
98
|
+
| *(root)* | `acceptClusterDefinition(operatorPayload, configHash)` | Join a cluster as an operator |
|
|
99
|
+
| *(root)* | `getClusterDefinition(configHash)` | Fetch cluster definition (read-only) |
|
|
100
|
+
| *(root)* | `getClusterLock(configHash)` | Fetch cluster lock by config hash (read-only) |
|
|
101
|
+
| *(root)* | `getClusterLockByHash(lockHash)` | Fetch cluster lock by lock hash (read-only) |
|
|
102
|
+
| *(root)* | `createObolRewardsSplit(payload)` | Deploy OWR + splitter (rewards-only split) |
|
|
103
|
+
| *(root)* | `createObolTotalSplit(payload)` | Deploy splitter (total split) |
|
|
104
|
+
| *(root)* | `getOWRTranches(owrAddress)` | Read OWR tranche info (read-only on-chain) |
|
|
105
|
+
| `client.splits` | `createValidatorManagerAndRewardsSplit(payload)` | Deploy OVM + SplitV2 (rewards-only) |
|
|
106
|
+
| `client.splits` | `createValidatorManagerAndTotalSplit(payload)` | Deploy OVM + SplitV2 (total) |
|
|
107
|
+
| `client.splits` | `requestWithdrawal(payload)` | Request withdrawal from OVM |
|
|
108
|
+
| `client.splits` | `deposit(payload)` | Deposit to OVM contract |
|
|
109
|
+
| `client.incentives` | `getIncentivesByAddress(address)` | Fetch claimable incentives (read-only) |
|
|
110
|
+
| `client.incentives` | `isClaimed(contractAddress, index)` | Check if incentives claimed (read-only) |
|
|
111
|
+
| `client.incentives` | `claimIncentives(address)` | Claim incentives on-chain |
|
|
112
|
+
| `client.eoa` | `requestWithdrawal(payload)` | Request EOA withdrawal |
|
|
113
|
+
| `client.eoa` | `deposit(payload)` | Batch deposit validators |
|
|
114
|
+
| `client.exit` | `verifyPartialExitSignature(...)` | Verify BLS partial exit signature |
|
|
115
|
+
| `client.exit` | `verifyExitPayloadSignature(...)` | Verify ECDSA exit payload signature |
|
|
116
|
+
| `client.exit` | `validateExitBlobs(...)` | Validate exit blobs against cluster config |
|
|
117
|
+
| `client.exit` | `recombineExitBlobs(...)` | Aggregate partial exit signatures |
|
|
118
|
+
|
|
119
|
+
### Standalone Utilities
|
|
120
|
+
|
|
121
|
+
| Export | Description |
|
|
122
|
+
|--------|-------------|
|
|
123
|
+
| `validateClusterLock(lock, safeRpcUrl?)` | Verify a cluster lock's cryptographic validity |
|
|
124
|
+
|
|
125
|
+
### Key Rules
|
|
126
|
+
|
|
127
|
+
1. All request/response types are exported from the package root.
|
|
128
|
+
2. Error types exported: `ConflictError`, `SignerRequiredError`, `UnsupportedChainError`.
|
|
129
|
+
3. Methods that **write** (create, deploy, claim) require a `signer`. Methods that **read** (get, fetch) do not.
|
|
130
|
+
4. Supported chain IDs: `1` (Mainnet), `560048` (Hoodi).
|
|
131
|
+
5. Splitter/OVM deployment is only supported on chains 1 and 560048.
|
|
132
|
+
|
|
56
133
|
## Next.js / SSR Configuration
|
|
57
134
|
|
|
58
135
|
If using this SDK in **Next.js** or other SSR frameworks, add this minimal config to your `next.config.js`:
|
|
@@ -71,7 +148,6 @@ webpack: (config, { isServer, webpack }) => {
|
|
|
71
148
|
config.externals = config.externals || [];
|
|
72
149
|
config.externals.push({
|
|
73
150
|
'@chainsafe/bls': 'commonjs @chainsafe/bls',
|
|
74
|
-
'@chainsafe/blst': 'commonjs @chainsafe/blst',
|
|
75
151
|
'bcrypto': 'commonjs bcrypto',
|
|
76
152
|
});
|
|
77
153
|
}
|