Skip to content

Latest commit

 

History

History
47 lines (32 loc) · 1.17 KB

README.md

File metadata and controls

47 lines (32 loc) · 1.17 KB

@bosonprotocol/ethers-sdk

JS lib that exports EthersAdapter (implementation of Web3LibAdapter) and contract abstractions targeting ethers.

Install

npm i @bosonprotocol/ethers-sdk ethers

# OR

yarn add @bosonprotocol/ethers-sdk ethers

Usage

EthersAdapter

This adapter is intended to be passed as an constructor argument to @bosonprotocol/core-sdk.

import { CoreSDK } from "@bosonprotocol/core-sdk";
import { EthersAdapter } from "@bosonprotocol/ethers-sdk";
import { ethers } from "ethers";

// injected web3 provider
const web3Provider = new ethers.providers.Web3Provider(window.ethereum);

const ethersAdapter = new EthersAdapter(web3Provider);
const coreSDK = new CoreSDK({
  web3Lib: ethersAdapter
  // ...other args
});

Contract abstractions

We provide fully typed, auto-generated contract abstractions using TypeChain, which targets ethers.

import { contracts } from "@bosonprotocol/ethers-sdk";

const bosonOfferHandler = contracts.IBosonOfferHandler__factory.connect(
  contractAddress,
  ethersSignerOrProvider
);