The TypeScript client this explorer uses. It wraps JSON-RPC, verifies object proofs locally, and decodes frames into an ImageBitmap you can paint on a canvas.
| export | signature | notes |
|---|---|---|
| createClient | (opts) => Client | http or websocket transport |
| client.block | (height) => Block | null outside the archive window |
| client.object | (slug, id) => GifObject | includes traits and rarity |
| client.frames | (slug, id) => Uint8Array[] | decoded, palette applied |
| client.proof | (slug, id) => Proof | verify against a block header |
| client.watch | (filter, cb) => Unsub | live events over websocket |
| signer.mint | (slug, qty) => TxHash | requires a local key |
Proof verification runs in the client, so a lying RPC node cannot convince the SDK that an object has a different owner. It can only refuse to answer.
import { createClient } from '@gifchain/sdk'
const chain = createClient({ url: 'https://rpc.gifchain.net' })
const obj = await chain.object('gifcats', 128)
const proof = await chain.proof('gifcats', 128)
const head = await chain.block()
console.log(proof.verify(head.objectRoot)) // true
chain.watch({ type: 'SALE', collection: 'gifcats' }, (e) => {
console.log(e.price, '->', e.to)
})