Getting Started
Installation
To interact with the V3 SDK we recommend installing though npm/yarn:
yarn add @storyhunt/wrapper-sdknpm install @storyhunt/wrapper-sdkInitialization
Before using any of the routing or swap functions, you must initialize the SDK using initClient.
Parameters
options: An object containing the initialization parameters.privateKey(optional,string): A private key used to initialize aviemwallet client for write operations.ethersSigner(optional,Signer): Anethers.jssigner used for write operations ifprivateKeyis not provided.graph_url(required,string): The GraphQL URL for querying the subgraph.
Example
import { initClient, defaultChain } from '@storyhunt/wrapper-sdk';
// Option A: Using Private Key (loaded from environment, for example)
await initClient({
privateKey: process.env.TEST_PRIVATE_KEY,
});
// Option B: Using ethers Signer
const provider = new ethers.JsonRpcProvider(defaultChain);
const signer = new ethers.Wallet(process.env.TEST_PRIVATE_KEY, provider);
await initClient({ ethersSigner: signer });
console.log('SDK initialized!');
Once initClient is called, the SDKβs internal clients are ready for use by other functions.