SDK installation
The SealedIP SDK is a TypeScript module that wraps the SealedAuction contract surface and the CDR encryption/decryption flow. Use it instead of raw ABI calls unless you need fine-grained control.
Install
npm install @sealedip/sdk viem
Yarn / pnpm / bun work identically. viem is a peer dependency.
Subpath exports
The SDK ships multiple subpath exports:
| Subpath | What it exports |
|---|---|
@sealedip/sdk | Top-level re-exports: sealReserve + its types |
@sealedip/sdk/constants | Deployed addresses, chain config, gas constants |
@sealedip/sdk/abi/sealed-auction | sealedAuctionAbi — viem const ABI |
@sealedip/sdk/encrypt | encryptBid, EncryptBidInput, EncryptedBid |
@sealedip/sdk/payload | encodePayload, decodePayload, signBidDigest, BidPayloadFields |
High-level helpers live in their own modules:
import {sealReserve} from '@sealedip/sdk' // or from '@sealedip/sdk/seller'
import {placeBid} from '@sealedip/sdk/bidder'
import {settleAuction} from '@sealedip/sdk/orchestrator'
import {getAuction, getBid, getAllBids} from '@sealedip/sdk/auction'
WASM constraint: Node / server only for encrypt + decrypt
encryptBid and decryptBid call into @piplabs/cdr-sdk and
@piplabs/cdr-crypto, which load a WASM binary via initWasm(). The WASM
glue does not load in browser or edge-runtime bundles.
As a result:
encryptBidmust run in Node (a Next.js API route, a server action, or a standalone script).decryptBid(and by extensionsettleAuction) must also run in Node.placeBidcallsencryptBidinternally, so it is also Node-only.
The SealedIP reference web app handles this by routing bid placement through
web/app/api/encrypt-bid/route.ts (a Node API route).
Configure a chain client
import {createPublicClient, http} from 'viem'
import {storyAeneid} from 'viem/chains'
export const publicClient = createPublicClient({
chain: storyAeneid,
transport: http('https://aeneid.storyrpc.io'),
})
storyAeneid is in viem/chains (chain id 1315). If your viem version does
not include it, define the chain manually:
import {defineChain} from 'viem'
export const storyAeneid = defineChain({
id: 1315,
name: 'Story Aeneid',
nativeCurrency: {name: 'IP', symbol: 'IP', decimals: 18},
rpcUrls: {default: {http: ['https://aeneid.storyrpc.io']}},
blockExplorers: {
default: {name: 'Storyscan', url: 'https://aeneid.storyscan.io'},
},
})
Gas pricing
Aeneid reports a near-zero EIP-1559 base fee. The SDK's write helpers pin
gasPrice to 100_000_000_000n (100 gwei) via the GAS_PRICE_WEI constant
from @sealedip/sdk/constants. If you are calling contracts directly, apply
the same value or your transactions will stall.
TypeScript
The SDK ships types out of the box. Minimum TypeScript: 5.0.
React + wagmi
For browser read access, use the SDK's ABIs with wagmi hooks:
import {useReadContract} from 'wagmi'
import {sealedAuctionAbi} from '@sealedip/sdk/abi/sealed-auction'
import {SEALED_AUCTION_ADDRESS} from '@sealedip/sdk/constants'
function useAuction(id: bigint) {
return useReadContract({
address: SEALED_AUCTION_ADDRESS,
abi: sealedAuctionAbi,
functionName: 'auctions',
args: [id],
})
}
For write operations (place bid, seal reserve), proxy through a Next.js API route to avoid the WASM constraint described above.
Next
- Types —
Auction,Bid,BidReveal,ReserveReveal, and more - Encrypting a bid — TDH2 encryption via
encryptBid - Submitting a bid — full
placeBidflow - Settling —
settleAuctionorchestrator flow