SX.js

SX.js is the official Typescript SDK to interact with Snapshot X. The SDK includes a client for Mana, the meta transaction relayer.

GitHub

https://github.com/snapshot-labs/sx-monorepo/tree/master/packages/sx.js

Quick start

Installation

Install the latest version of the beta release:

npm install @snapshot-labs/sx@beta

Configuration

Clients

Everything happens thanks to the clients objects. Depending on the specific Space or Proposal setup, you may need to use a Transaction or Signature Client. This quick guide demonstrates how to easily set all of them up, both for Ethereum and StarkNet:

import { clients, evmSepolia } from '@snapshot-labs/sx';

const clientConfig = { networkConfig: evmSepolia }

const client = new clients.EthereumTx(clientConfig);
const ethSigClient = new clients.EthereumSig(clientConfig);

To learn more about StarkNet's Provider object, have a look here.

Usage

Make sure to use the right client for your use case. The examples below use Sepolia network and its config is imported from the sx.js package.

Cast a vote

Create a proposal

Update a proposal

Get voting power

Address' voting power depends on the strategy used. Below you can see an example of getting voting power for whitelist Voting strategy on Starknet.

More details coming soon.

Last updated

Was this helpful?