Getting started
Install
This package currently has a peer dependency on etherjs V6.
yarn add @hypercerts-org/marketplace-sdk ethers
npm install @hypercerts-org/marketplace-sdk ethers --save
pnpm add @hypercerts-org/marketplace-sdk ethers
Initialization
The SDK exposes a main class that's used to perform all onchain operations:
import {
HypercertExchangeClient,
ChainId,
} from "@hypercerts-org/marketplace-sdk";
const hypercertExchangeClient = new HypercertExchangeClient(
ChainId.OPTIMISM,
provider,
signer
);
The signer is optional if you need access to read only data (⚠️ Calls to functions that need a signer will throw a Signer is undefined
exception):
import {
HypercertExchangeClient,
ChainId,
} from "@hypercerts-org/marketplace-sdk";
const hypercertExchangeClient = new HypercertExchangeClient(
ChainId.OPTIMISM,
provider
);
If you work on a Hardhat setup, you can override the addresses as follows:
import { HypercertExchangeClient, ChainId } from "@hypercerts-org/marketplace-sdk";
const addresses: Addresses = {...};
const hypercertExchangeClient = new HypercertExchangeClient(ChainId.HARDHAT, provider, signer, addresses);