Initialization

TypeScript SDK

Each action described in the following sections requires an initialised coreSDK instance. It can be done using the following snippet. When there are multiple actors involved in some flow, each of them needs its own instance./

import { Contract, providers, utils, Wallet } from "ethers";
import { CoreSDK, getEnvConfigById } from "@bosonprotocol/core-sdk";
import { EthersAdapter } from "@bosonprotocol/ethers-sdk";

const envName = "testing"; // amoy testnet
const configId = "testing-80002-0";

const defaultConfig = getEnvConfigById(envName, configId);
const ethereumProvider = new providers.JsonRpcProvider(
  "https://yourEthereumRPCProvider"
);

const signerWallet = Wallet.createRandom(ethereumProvider);
const coreSDK = CoreSDK.fromDefaultConfig({
    envName,
    configId,
    web3Lib: new EthersAdapter(provider, signerWallet),
  });

To use the coreSDK with the testnet or production protocols, the following parameters can be used.

envName
configId

Amoy

testing

testing-80002-0

Sepolia

testing

testing-11155111-0

Base Sepolia

testing

testing-84532-0

Optimism Sepolia

testing

testing-11155420-0

Arbitrum Sepolia

testing

testing-421614-0

Polygon

production

production-137-0

Ethereum

production

production-137-0

Base

production

production-8453-0

Optimism

production

production-10-0

Arbitrum

production

production-42161-0

Last updated