For the complete documentation index, see llms.txt. This page is also available as Markdown.

fast-sdk

Fast-native account queries, signing, and transactions with @fastxyz/sdk

@fastxyz/sdk is the TypeScript SDK for Fast-native operations. The package README is the API reference for your installed version. EVM ↔ Fast movements belong to @fastxyz/allset-sdk.

Install and choose a network

npm install @fastxyz/sdk
import { FastProvider, Signer, TransactionBuilder } from '@fastxyz/sdk';
import { mainnet, testnet } from '@fastxyz/sdk/networks';

const network = testnet; // change to mainnet for real-value operations
const provider = new FastProvider(network);

FastProvider uses the proxy REST API. The built-in network constants include the URL and network ID; mainnet uses https://api.fast.xyz/proxy-rest, while testnet uses https://testnet.api.fast.xyz/proxy-rest. The JSON-RPC API is a separate low-level interface, not the transport used by this SDK.

Build, sign, and submit

const signer = new Signer(privateKey); // keep this secret out of logs and source control
const sender = await signer.getPublicKey();
const account = await provider.getAccountInfo({ address: sender });

const envelope = await new TransactionBuilder({
  networkId: network.networkId!,
  signer,
  nonce: account.nextNonce,
})
  .addTokenTransfer({ tokenId, recipient, amount: 1000n, userData: null })
  .sign();

const result = await provider.submitTransaction(envelope);

The builder does not take a provider or automatically fetch a nonce. Fetch the current nonce and select the network explicitly. Multiple operations may be batched in one Fast transaction. Other builders and multisig support are documented in the package README.

If submission times out or the response is lost, do not assume it failed. Reconcile the transaction identity, certificate, account nonce, and any pending multisig proposal before deciding whether to resubmit. A freshly rebuilt transaction can have a different timestamp or nonce and is not a safe substitute for the exact signed envelope.

The SDK also provides account/token queries, Ed25519 message signing, address conversion, and MultiSigWorkflow. It does not provide an EVM wallet or a generic bridge. See the REST reference for proxy API documentation.

Last updated

Was this helpful?