TypeScript SDK

GitHub Repository: spark-orderbook-ts-sdk

Installation To install the spark-orderbook-ts-sdk, follow these steps:

npm i @compolabs/spark-orderbook-ts-sdk

Usage To use the spark-orderbook-ts-sdk, you'll need to set up a Spark instance with the appropriate configuration:

import Spark, { TESTNET_NETWORK, BETA_CONTRACT_ADDRESSES, TESTNET_INDEXER_URL } from "spark-orderbook-ts-sdk";

// Create a wallet instance
const provider = await Provider.create(TESTNET_NETWORK.url);
const wallet = Wallet.fromPrivateKey(/* PRIVATE KEY */, provider);

const spark = new Spark({
  networkUrl: TESTNET_NETWORK.url,
  contractAddresses: BETA_CONTRACT_ADDRESSES,
  indexerApiUrl: TESTNET_INDEXER_URL,
  wallet,
});

// Now you can use `spark` to interact with the library methods