Installation and Setup

Installation

Install the @ethsign/sp-sdk package to use the Sign Protocol SDK in your frontend or Node backend projects.

NPM

npm i @ethsign/sp-sdk -S

Yarn

yarn add @ethsign/sp-sdk

Creating a Client Instance

new SignProtocolClient(spMode, options);

Parameters

NameTypeDescription

spMode

SpMode

Whether the client is initialized in on-chain or Arweave (off-chain) mode.

options

OnChainClientOptions | OffChainClientOptions

Client options based on spMode.

NOTE: The account variable in options is marked as optional. If it is not provided, the SDK will use the provider from window.ethereum by default to derive an account. If a provider from window.ethereum cannot be located when an account is not provided, calls to the SDK will fail.

Example

const { privateKeyToAccount } = require("viem/accounts");
const client = new SignProtocolClient(SpMode.OnChain, {
  chain: EvmChains.baseSepolia,
  account: privateKeyToAccount(privateKey)
});

Creating an Index Service Client

new IndexService(env);

Parameters

NameTypeDescription

env

"testnet" | "mainnet"

Whether the indexing service should be querying testnets or mainnets.

Example

const indexService = new IndexService("testnet");

Last updated