Skip to content

Repository files navigation

Wield SDK

TypeScript SDK for the Wield vault protocol on Robinhood Chain Mainnet (chain ID 4663).

Four packages, one dependency philosophy: viem and nothing you don't need.

Package For Runtime
core Chain config, ABIs, intent hashing and signing, shared types Node / Bun / browser
user-sdk Read vault state, preview deposits, build deposit/withdraw calls, decode events Node / Bun / browser
developer-sdk React hooks and drop-in components (WieldProvider, useVault, DepositButton, -) React / Next.js
bot-sdk Shared command layer for Discord and Telegram bots Node / Bun

Network

Field Value
Chain Robinhood Chain Mainnet
Chain ID 4663
RPC https://rpc.mainnet.chain.robinhood.com
Explorer https://robinhoodchain.blockscout.com
USDG (Paxos) 0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168
Flagship vault 0x7769526f55cd6B0B8a9E0Bf9e124618A0fe084de
BlendManager 0x4bc86AC09EeC8dd21557944b21891e08F1295b42
Big Tech basket 0xfcb4B482C89839e8c19696E3e78223B8985ED923
Frontier basket 0xb345dafdED457A2544B6ECcF462A41Ea77168eF3
Core 4 basket 0x66bc68ed37f0dC1b53bb1838beb204b3B42D55B9

All of the above are exported from core/src/constants.ts - import them instead of hardcoding.

Install

Requires Bun >= 1.1 (or Node 20+ with your own package manager).

git clone https://github.com/useWield/wield-sdk
cd wield-sdk/core && bun install

Each package installs and tests independently.

Quickstart

Read vault state

import { createPublicClient, http } from 'viem'
import { ROBINHOOD_CHAIN_ID, DEFAULT_RPC_URL, VAULT_ADDRESS } from '@wield/core'
import { getVaultSnapshot } from '@wield/user-sdk'

const client = createPublicClient({ transport: http(DEFAULT_RPC_URL) })
const snapshot = await getVaultSnapshot(client, VAULT_ADDRESS)

console.log(snapshot.totalAssets, snapshot.sharePrice, snapshot.paused)

React

import { WieldProvider, useVault, DepositButton } from '@wield/developer-sdk'

export default function App() {
  return (
    <WieldProvider>
      <Dashboard />
    </WieldProvider>
  )
}

function Dashboard() {
  const { data, isLoading } = useVault()
  if (isLoading) return <p>Loading-</p>
  return (
    <>
      <p>TVL: {data.totalAssets} USDG</p>
      <DepositButton amount="100" />
    </>
  )
}

A full Next.js example lives in developer-sdk/examples/nextjs-app.

Bots

cd bot-sdk && bun install
bun run examples/telegram-bot   # or examples/discord-bot

Intent signing

core exposes hashIntent and signIntent. An intent is bound to the chain ID and vault address, so a signature from one deployment cannot be replayed on another.

import { hashIntent, signIntent } from '@wield/core'

const hash = hashIntent(intent, ROBINHOOD_CHAIN_ID, VAULT_ADDRESS)
const signature = await signIntent(account, hash)

Cross-check tests in core/tests/hashIntent.cross.test.ts assert the TypeScript hash matches the Solidity implementation byte-for-byte.

Tests

cd core && bun test
cd ../user-sdk && bun test
cd ../developer-sdk && bun test
cd ../bot-sdk && bun test

Integration tests that hit a live RPC are opt-in and skip themselves when the RPC env var is unset.

Contributing

See CONTRIBUTING.md. Security issues: SECURITY.md - do not open a public issue.

License

MIT - see LICENSE.

About

TypeScript SDK for Wield - core, user, developer (React) and bot packages

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages