Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
5a384b5
add getSubVaults method, add isStateUpdateRequired to vault abi
dfkadyr Jan 20, 2026
bd89745
small improves
dfkadyr Jan 20, 2026
d293448
add isClaimed to getExitQueuePositions
dfkadyr Jan 20, 2026
dff7431
add support for sub-vault management with new methods and parameters
dfkadyr Jan 30, 2026
f5adb5a
add canHarvest to getVault request
dfkadyr Jan 30, 2026
7a0692b
Create MetaVault (#341)
Cast0001 Feb 3, 2026
3c09390
Add subvault (#344)
dfkadyr Feb 17, 2026
2e92cdd
[improve-sub-vaults] change methods (#345)
Cast0001 Feb 20, 2026
661401a
[new-metavaults-addresses] set new data (#346)
Cast0001 Feb 25, 2026
39241b9
Update state (#348)
mike-diamond Mar 17, 2026
78a39c1
add replica subgraphs
Cast0001 Mar 24, 2026
94d3b4b
Abort callback (#353)
Cast0001 Mar 24, 2026
047ee99
Merge branch 'main' into sub-vaults
Cast0001 Mar 24, 2026
4abc61d
Link checker (#355)
dfkadyr Apr 7, 2026
5b52db2
refactor gas & encode in setDepositData transactions (#359)
dfkadyr Apr 8, 2026
bceb1cd
[subgraph updates] update sub vaults request (#362)
mike-diamond Apr 21, 2026
e904379
update factories addresses (#365)
dfkadyr Apr 22, 2026
e4b1cf8
Merge main sdk (#366)
dfkadyr Apr 24, 2026
42a9bd7
[expand-sub-vaults-registry] change abi (#367)
Cast0001 Apr 27, 2026
b873d54
[curator-v2] add v2 curator for vault creation (#368)
Cast0001 Apr 29, 2026
e3c6dc2
add endpoints file (#369)
dfkadyr May 4, 2026
01b26e7
Merge main (#371)
Cast0001 May 6, 2026
d9a66b5
Context7 (#374)
mike-diamond May 11, 2026
2032bee
[context7] update branch
mike-diamond May 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/build-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ jobs:
packages: read
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd

- name: Setup pnpm
uses: pnpm/action-setup@v4
uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1
with:
version: 10.25.0

- name: Setup Node
uses: actions/setup-node@v6
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f
with:
node-version: '24.12.0'

Expand Down
56 changes: 0 additions & 56 deletions .github/workflows/sync-docs.yml

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ jobs:
packages: read
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd

- name: Setup pnpm
uses: pnpm/action-setup@v4
uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1
with:
version: 10.25.0

- name: Setup Node
uses: actions/setup-node@v6
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f
with:
cache: pnpm
scope: '@stakewise'
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ schema.graphql
src/types/graphql
src/contracts/types
src/contracts/vault/types

CLAUDE.md
2 changes: 1 addition & 1 deletion .graphqlconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"extensions": {
"endpoints": {
"Subgraph GraphQL": {
"url": "https://graphs.stakewise.io/hoodi/subgraphs/name/stakewise/prod",
"url": "https://graphs-replica.stakewise.io/hoodi/subgraphs/name/stakewise/stage",
"headers": {
"user-agent": "JS GraphQL"
},
Expand Down
4 changes: 2 additions & 2 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
sh ./scripts/pre-push.sh

npm run lint
pnpm run check:docLinks
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check:docLinks fetches the live docs sitemap over the network; running this in a pre-commit hook can be slow and may fail for contributors who are offline or behind restrictive networks. Consider moving it to CI (pre-push or workflow) or adding an opt-out (e.g., env flag) so local commits don’t become flaky.

Suggested change
pnpm run check:docLinks
if [ "${SKIP_DOC_LINKS:-0}" != "1" ]; then
pnpm run check:docLinks
fi

Copilot uses AI. Check for mistakes.
pnpm run lint
23 changes: 23 additions & 0 deletions changelog/next-release.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## Added methods

- [sdk.vault.getSubVaults](https://docs.stakewise.io/sdk/api/vault/requests/getsubvaults)
- [sdk.vault.addSubVault](https://docs.stakewise.io/sdk/api/vault/transactions/addsubvault)
- [sdk.vault.rejectSubVault](https://docs.stakewise.io/sdk/api/vault/transactions/rejectsubvault)
- [sdk.vault.ejectSubVault](https://docs.stakewise.io/sdk/api/vault/transactions/ejectsubvault)
- [sdk.vault.updateState](https://docs.stakewise.io/sdk/api/vault/transactions/updatestate)

## Modified methods

### 1. [sdk.vault.getVault](https://docs.stakewise.io/sdk/api/vault/requests/getvault)

#### Add output field:
```ts
type Output = {
canHarvest: boolean
exitingAssets: string
exitingTickets: string
ejectingSubVault: string
subVaultsRegistry: string
pendingMetaSubVault: string
}
```
4 changes: 2 additions & 2 deletions codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import type { CodegenConfig } from '@graphql-codegen/cli'
import { Network } from './src/helpers/enums'
import configs from './src/helpers/configs'


let network: Network = Network.Mainnet
// TODO change
let network: Network = Network.Hoodi
Comment on lines +5 to +6
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing the default codegen network to Hoodi (with a TODO) makes builds/codegen sensitive to local defaults and can accidentally generate types against a staging endpoint. Prefer keeping the default as Mainnet (or requiring an explicit NETWORK env var) so generated outputs are deterministic across environments.

Suggested change
// TODO change
let network: Network = Network.Hoodi
let network: Network = Network.Mainnet

Copilot uses AI. Check for mistakes.

Comment on lines +5 to 7
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing the default codegen network from Mainnet to Hoodi (and leaving a TODO) can silently generate the wrong GraphQL types/operations when NETWORK is not set (e.g., local dev, CI scripts). Consider restoring Mainnet as the default and making Hoodi opt-in via env/config, or fail fast when NETWORK is missing to avoid accidental wrong builds.

Suggested change
// TODO change
let network: Network = Network.Hoodi
let network: Network = Network.Mainnet
if (process.env.NETWORK === 'hoodi') {
network = Network.Hoodi
}

Copilot uses AI. Check for mistakes.
if (process.env.NETWORK === 'mainnet') {
network = Network.Mainnet
Expand Down
41 changes: 41 additions & 0 deletions context7.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"$schema": "https://context7.com/schema/context7.json",
"projectTitle": "StakeWise V3 SDK",
"description": "Official TypeScript SDK for StakeWise V3 liquid staking on Ethereum and Gnosis. Typed access to vaults, osToken (osETH/osGNO), boost leverage, rewards via subgraph and on-chain calls.",
"url": "https://context7.com/stakewise/v3-sdk",
"public_key": "pk_wpaUy9UwJWjviJip1LFYx",
"branch": "sub-vaults",
"folders": ["documentation", "src/services"],
"excludeFolders": [
"scripts",
"dist",
"node_modules",
"changelog",
"documentation/_drafts"
],
"excludeFiles": [
"_category_.json",
"README.md",
"package.json",
"tsconfig.json",
"pnpm-lock.yaml",
"rollup.config.js",
"jest.config.ts",
"codegen.ts",
"hardhat.config.js",
"eslint.config.mjs",
"LICENSE",
"CHANGELOG.md"
],
"rules": [
"Init: `new StakeWiseSDK({ network, provider })` for read+write, or `{ network, endpoints: { web3: rpcUrl } }` for read-only.",
"After every write, `await sdk.utils.waitForSubgraph({ hash })` before refetching reads. Subgraph indexing lags transaction confirmation.",
"Writes have 3 forms: default sends a tx, `.encode(args)` returns `{data,to,value}` for multisig, `.estimateGas(args)` returns bigint. `sdk.vault.multicall<T>` lacks `.encode`/`.estimateGas`.",
"`Network.Mainnet=1` (osETH), `Network.Gnosis=100` (osGNO), `Network.Hoodi=560048`. SDK instances are immutable per network; recreate to switch.",
"V3 uses `osToken` (osETH/osGNO). `sETH2`/`rETH2` are V2, never reference in V3 code.",
"Reads return `AbortPromise<T>`; call `.abort()` to cancel. `.then`/`.catch` are silently suppressed after abort.",
"Contracts outside `sdk.contracts`: import top-level `createContract<T>(address, abi, sdk.provider)` from `@stakewise/v3-sdk`.",
"Batch independent reads with `Promise.all` / `AbortPromise.all`. Never parallelise writes; wallets serialise signing."
],
"previousVersions": []
}
4 changes: 2 additions & 2 deletions documentation/connecting-wallet.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
id: connecting
title: Connecting a Wallet
sidebar_position: 2
description: Connect wallets to the StakeWise SDK using EIP-1193 providers MetaMask, WalletConnect, Coinbase, Safe, Binance, and Wagmi integration.
description: Connect wallets to the StakeWise SDK using EIP-1193 providers - MetaMask, WalletConnect, Coinbase, Safe, Binance, and Wagmi integration.
---

# Connecting a Wallet
Expand All @@ -29,7 +29,7 @@ interface Eip1193Provider {
## Wallet Connection Types

Different wallets implement the EIP-1193 provider in different ways.
The most common type is **injected wallets** wallets that automatically inject a provider into the global `window` object under the `window.ethereum` property. This type of connection is used by wallets that are provided in the form of browsers or browser extensions, the most popular of which is **MetaMask**.
The most common type is **injected wallets** - wallets that automatically inject a provider into the global `window` object under the `window.ethereum` property. This type of connection is used by wallets that are provided in the form of browsers or browser extensions, the most popular of which is **MetaMask**.

This is the simplest connection method and works out of the box for most browser wallets.

Expand Down
75 changes: 75 additions & 0 deletions documentation/endpoints.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
---
id: endpoints
title: Available Endpoints
sidebar_position: 4
description: RPC, API and Subgraph endpoints for Mainnet, Gnosis and Hoodi networks.
---

# Available Endpoints

---

## How to retrieve the subgraph endpoint URL

The StakeWise V3 subgraph URL depends on the network the SDK is bound to. For SDK-driven workflows the subgraph URL is configured at construction time and the SDK queries it transparently - you do not need to read the URL yourself for typical reads. For direct GraphQL calls (custom queries, dashboards, monitoring), use the production URLs listed below under [Subgraph Endpoint](#subgraph-endpoint).

```typescript
import { StakeWiseSDK, Network } from '@stakewise/v3-sdk'

const sdk = new StakeWiseSDK({
network: Network.Mainnet,
endpoints: { web3: 'https://main-rpc.io' },
})

const stats = await sdk.utils.getStakewiseStats()
```

The SDK ships with the StakeWise V3 subgraph URL baked in for each `Network` (Mainnet, Hoodi, Gnosis), so all read methods (`getVault`, `getStakeBalance`, `getStakewiseStats`, etc.) hit the right subgraph automatically.

---

## RPC Endpoint

The RPC endpoint is the JSON-RPC URL of an Ethereum node for the selected network. You can use any public RPC provider - a curated list with public nodes for each chain is available at:

🔗 **[chainlist.org](https://chainlist.org/)**

✅ **Tip:** For production, prefer a dedicated provider (Infura, Alchemy, QuickNode, etc.) over a free public RPC - public RPCs are rate-limited and may go down.

---

## API Endpoint

GraphQL endpoint of the StakeWise backend.

| Network | Endpoint |
|---------|----------|
| **Mainnet** | `https://mainnet-api.stakewise.io/graphql` |
| **Gnosis** | `https://gnosis-api.stakewise.io/graphql` |
| **Hoodi** | `https://hoodi-api.stakewise.io/graphql` |

---

## Subgraph Endpoint

GraphQL endpoint of the StakeWise subgraph.

### Production

Use the **`prod`** endpoint for production environments.

| Network | Endpoint |
|---------|----------|
| **Mainnet** | `https://graphs.stakewise.io/mainnet/subgraphs/name/stakewise/prod` |
| **Gnosis** | `https://graphs.stakewise.io/gnosis/subgraphs/name/stakewise/prod` |
| **Hoodi** | `https://graphs.stakewise.io/hoodi/subgraphs/name/stakewise/prod` |

### Stage

Mirrors the production schema but tracks the staging deployment - use it only when reproducing issues against a non-production environment.

| Network | Endpoint |
|---------|----------|
| **Mainnet** | `https://graphs.stakewise.io/mainnet/subgraphs/name/stakewise/stage` |
| **Gnosis** | `https://graphs.stakewise.io/gnosis/subgraphs/name/stakewise/stage` |
| **Hoodi** | `https://graphs.stakewise.io/hoodi/subgraphs/name/stakewise/stage` |
4 changes: 4 additions & 0 deletions documentation/fundamentals/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"position": 2,
"label": "Fundamentals"
}
58 changes: 58 additions & 0 deletions documentation/fundamentals/aggregate-queries.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
id: aggregate-queries
title: Network-wide aggregates
sidebar_position: 3
description: Use sdk.utils.getStakewiseStats() to fetch total ETH staked, user count, and total earned rewards across all StakeWise V3 vaults on the configured chain.
---

# Network-wide aggregates


To answer "how much is staked across all StakeWise V3 vaults?" use `sdk.utils.getStakewiseStats()`. It returns the protocol-wide aggregate for the network the SDK is bound to.

## Total ETH staked across all V3 vaults

```typescript
import { formatEther } from 'ethers'
import { StakeWiseSDK, Network } from '@stakewise/v3-sdk'

const sdk = new StakeWiseSDK({
network: Network.Mainnet,
endpoints: { web3: 'https://main-rpc.io' },
})

const stats = await sdk.utils.getStakewiseStats()

console.log(`Total: ${formatEther(stats.totalAssets)} ETH`)
console.log(`Users: ${stats.usersCount}`)
console.log(`Earned: ${formatEther(stats.totalEarnedAssets)} ETH`)
```

`stats.totalAssets` and `stats.totalEarnedAssets` are wei strings; convert with `BigInt` for math, with `formatEther` for display. On Gnosis swap `Network.Mainnet` for `Network.Gnosis` and the value is in GNO.

## Cross-chain TVL

Instantiate one SDK per chain, run them concurrently:

```typescript
import { formatEther } from 'ethers'
import { StakeWiseSDK, Network } from '@stakewise/v3-sdk'

const mainnet = new StakeWiseSDK({
network: Network.Mainnet,
endpoints: { web3: 'https://main-rpc.io' },
})

const gnosis = new StakeWiseSDK({
network: Network.Gnosis,
endpoints: { web3: 'https://gnosis-rpc.io' },
})

const [ mainnetStats, gnosisStats ] = await Promise.all([
mainnet.utils.getStakewiseStats(),
gnosis.utils.getStakewiseStats(),
])

console.log(`Mainnet TVL: ${formatEther(mainnetStats.totalAssets)} ETH`)
console.log(`Gnosis TVL: ${formatEther(gnosisStats.totalAssets)} GNO`)
```
Loading