Sugar SDK for JS and TS developers.
Install the SDK alongside its peer dependencies:
npm install \
@dromos-labs/sdk.js \
@wagmi/core \
viemCreate a multi-chain configuration with getDefaultConfig. The helper wraps wagmi's createConfig, wires transports, and filters the built-in baseConfig down to the chains you care about. The result is a SugarWagmiConfig, which you pass to every SDK function.
import { getDefaultConfig, getListedTokens, optimism, base } from "@dromos-labs/sdk.js";
const config = getDefaultConfig({
chains: [
{ chain: optimism, rpcUrl: process.env.OP_RPC! },
{ chain: base, rpcUrl: process.env.BASE_RPC! },
],
});
const tokens = await getListedTokens({ config });Make sure you have the right version of node activated and install all the dependencies
nvm use && npm iUse .env.example to populate .env inside packages
Make sure the SDK builds correctly:
cd packages/sugar-sdk && npm run buildStart honey
cd packages/honey && npm start
Run tests
npm test
Regenerate
cd packages/sugar-sdk && npx @wagmi/cli generate YOUR_ETHERSCAN_KEY_HERE
