MarketSDK

The core class for interacting with the SDK.

Properties
Methods
Static Methods

Properties

sdk.web3

The Web3 instance used for all RPC calls.

Type: Web3

sdk.options

An object containing all deployed contracts info.

Type: MarketOptions

Note: the sdk.options property is only available after a successful sdk.init() call.

Methods

sdk.init

Initializes the MarketSDK instance. sdk.init() must be called before accessing any SDK features.

Parameters: none

Returns: Promise<void>

import Web3 from "web3";
import { MarketSDK, MarketOptions } from "market-sdk";

const options: MarketOptions = {
  poolDirectory: "SET_DIRECTORY_ADDRESS",
  marketLens: "SET_MARKET_LENS_ADDRESS"
};
const web3 = new Web3("SET_RPC_OR_PROVIDER");
const sdk = new MarketSDK(web3);

await sdk.init(options);
// use sdk here

Static Methods

MarketSDK.init

Creates and returns an initialized MarketSDK instance.

Parameters:

import Web3 from "web3";
import { MarketSDK, MarketOptions } from "market-sdk";

const options: MarketOptions = {
  poolDirectory: "SET_DIRECTORY_ADDRESS",
  marketLens: "SET_MARKET_LENS_ADDRESS"
};
const web3 = new Web3("SET_RPC_OR_PROVIDER");
const sdk = await MarketSDK.init(web3, options);

// use sdk here, no need to call sdk.init again

Last updated