The SDK is a source-available internal preview for approved RP1 partners; @rp1/sdk is not currently published to the public npm registry. Do not put pnpm add @rp1/sdk in a public integration plan until a package release is announced.
This page documents the intended client model for approved preview consumers. Capability status is more precise than package status:
| Surface | Availability |
|---|---|
| Read-only client, bank transfers, and testnet faucet helpers | Preview package; public endpoints |
| DEX, UTA, privacy, InstaWrap, stables, lending, liquidity, and Vaults | Preview |
| Velocity through the EVM precompile | Preview |
Client model
RP1Clientprovides read-only queries.SigningRP1Clientadds wallet-backed signing and transaction submission.- The connected client exposes bank, DEX, UTA, privacy, InstaWrap, stables, lending, liquidity, and Vaults modules.
FaucetModuleis a standalone testnet helper export; it is not attached toRP1Client.
Read-only setup
import { RP1Client } from "@rp1/sdk";
const client = new RP1Client({
rpcEndpoint: "https://testnet.rpc.rp.one",
restEndpoint: "https://testnet.rest.rp.one",
});
await client.connect();
const chainId = await client.getChainId();
const pools = await client.dex.getPools();
const account = await client.uta.getMarginAccount("rp1youraddress...");Signing setup
Create a signing client only in a trusted wallet boundary. Keep the mnemonic or private key out of hosted application servers and browser bundles unless the wallet architecture explicitly owns that custody.
import { SigningRP1Client } from "@rp1/sdk";
const signingClient = await SigningRP1Client.fromMnemonic(
{
rpcEndpoint: "https://testnet.rpc.rp.one",
restEndpoint: "https://testnet.rest.rp.one",
chainId: "chain-1",
},
process.env.RP1_MNEMONIC!,
);
await signingClient.connect();Bank transfers
const result = await signingClient.bank.send({
recipientAddress: "rp1recipient...",
amount: [{ denom: "urp1", amount: "1000000" }],
memo: "settlement",
});Amounts are decimal integer strings in base units. Use a wallet or signing client that binds the configured chain ID and account sequence.
DEX and market data
const quote = await client.dex.quoteSwap({
tokenIn: { denom: "urp1", amount: "1000000" },
tokenOutDenom: "uusdc",
slippageBps: 75,
});
const book = await client.dex.getOrderBook("BTC/USD", 25);
const trades = await client.dex.getTrades("BTC/USD", 50);
const candles = await client.dex.getCandles("BTC/USD", "1m", 200);quoteSwap checks matching AMM pools and falls back to a CLOB order book when no pool quote is available. It remains a single-venue quote: inspect route.venue and live liquidity before presenting execution terms. The SDK does not imply multi-hop routing or liquidity availability.
UTA
await signingClient.uta.createMarginAccount();
await signingClient.uta.deposit({ denom: "urp1", amount: "5000000" });
const opened = await signingClient.uta.openPosition({
symbol: "BTC/USD",
side: "long",
size: "100000",
leverage: 5,
margin: "20000",
maxSlippageBps: 100,
});
const health = await client.uta.getAccountHealth("rp1youraddress...");Privacy
Privacy helpers prepare shield, unshield, and proof-bearing transfers. Proof generation, note recovery, and viewing-key custody remain wallet concerns:
await signingClient.privacy.shield({
amount: { denom: "urp1", amount: "1000000" },
viewingKey: crypto.getRandomValues(new Uint8Array(32)),
});The example generates a 32-byte key for illustration; a real wallet must generate, persist, back up, and authorize that key according to its own privacy policy. Never log the key or treat an SDK method as permission to store private material on a server.
Bridge, liquidity, stables, and workflows
The SDK includes typed helpers for InstaWrap, stables, lending, liquidity, and Vaults. Velocity is currently reached through its EVM precompile and the EVM integration path, rather than through the connected RP1 client. Each helper still requires live capability and parameter discovery. For asynchronous flows, persist the request ID and observe the final state rather than treating the submission response as completion.
See SDK safety, cross-chain integration, and agentic commerce.