Skip to main content
Use the TypeScript SDK to subscribe, request a signed attestation for any API, publish it to a Solana feed, and build calldata for EVM and Starknet. You need a Solana devnet wallet with some Devnet SOL and Devnet USDC:
Get Devnet USDC from the Circle faucet (choose USDC on Solana Devnet). Step 3 prints the subscription price before paying it. The SDK is ESM-only. Put the code below in one file, quickstart.ts, in a project whose package.json has "type": "module", and run it with npx tsx quickstart.ts.
1

Install

Requires Node.js 20.19 or later. @anchor-lang/core and bn.js are peer dependencies.
2

Initialize

3

Subscribe

Gateway rounds from the SDK are paid by a subscription. Subscribe once with the signing wallet:
subscribe transfers the plan price in Devnet USDC from your wallet and cannot be undone. It fails if the wallet already has a subscription, which is why the call is guarded.
maxPriceUsdc aborts the transaction if the on-chain price is higher than you approved. Without a subscription (or delegate access), the gateway answers 403.
4

Define a source

This example source never changes, so every node reads the same value. Replace it with your own API afterwards: pick an endpoint that returns the same value to every node, or use tolerance mode for live-moving numbers. signaturesRequired must be at least 3, the network minimum.
5

Request a signed attestation

result is an Attestation. Treat it as unverified until a verifier has checked it.
6

Publish it to Solana

The program verifies the attestation before writing. The first submit creates the Feed account for (sourceId, signaturesRequired, your wallet).
7

Build calldata for EVM or Starknet

Decode the verifier’s (success, code) with parseEvmVerifyResult or parseStarknetVerifyResult.

Next steps

Maintain a feed

Keep a Solana feed current, batch submits and request many sources.

SDK reference

Every client, type and helper.

Verify on EVM

Consume the attestation in Solidity.