@bosonprotocol/common
JS lib with common types, interfaces and utilities shared by the core components of the Boson Protocol.
Install
npm install @bosonprotocol/common
yarn add @bosonprotocol/common
Usage
ABIs
Useful ABIs can be imported.
import { abis } from "@bosonprotocol/common";
const { ProtocolDiamondABI } = abis;
Default configs
We provide default configurations for multiple chains that can be used for easier interaction on different environments.
import { getDefaultConfig } from "@bosonprotocol/common";
const defaultConfigOnRopsten = getDefaultConfig({
chainId: 3
});
Interfaces and types
Interfaces and types can also be imported. This might be useful for implementing custom a Web3LibAdapter
or MetadataStorage
.
import { Web3LibAdapter, MetadataStorage } from "@bosonprotocol/common";
class CustomWeb3LibAdapter implements Web3LibAdapter {
}
class CustomMetadataStorage implements MetadataStorage {
}
Web3LibAdapter
The core-sdk has the following features:
- web3 lib agnostic
- lightweight
- consists of composable building blocks
- leverages existing tools, such as TypeChain
To achieve these, we use an adapter pattern with Web3LibAdapter
being the interface.
An example implementation is the EthersAdapter
targeting the ethers library.