@bosonprotocol/ethers-sdk
v1.15.0
Published
Implementation of the Web3LibAdapter interface and contract abstractions targeting ethers for the Boson Protocol.
Downloads
4,155
Keywords
Readme
@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
);