Security News
CISA Brings KEV Data to GitHub
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
@bosonprotocol/core-sdk
Advanced tools
@bosonprotocol/core-sdk
JS lib that facilitates interaction with the Boson Protocol contracts, subgraph and metadata storage.
The core-sdk
is intended to be used in combination with implementations of the Web3LibAdapter
and MetadataStorage
interfaces.
If you, for example, want to use the core-sdk
in combination with ethers
and IPFS
as the metadata storage, then run
npm i @bosonprotocol/core-sdk @bosonprotocol/ethers-sdk @bosonprotocol/ipfs-storage ethers
# OR
yarn add @bosonprotocol/core-sdk @bosonprotocol/ethers-sdk @bosonprotocol/ipfs-storage ethers
We currently support the following
Web3LibAdapter
implementations:
EthersAdapter
exported from @bosonprotocol/ethers-sdk
EthConnectAdapter
exported from @bosonprotocol/eth-connect-sdk
MetadataStorage
implementations:
IpfsMetadata
exported from @bosonprotocol/ipfs-storage
The following assumes the usage of the
core-sdk
withethers
andIPFS
as the metadata storage.
The core-sdk
can be initialized by explicitly passing in the required arguments
import { CoreSDK } from "@bosonprotocol/core-sdk";
import { EthersAdapter } from "@bosonprotocol/ethers-sdk";
import { IpfsMetadata } from "@bosonprotocol/ipfs-storage";
import { ethers } from "ethers";
// injected web3 provider
const web3Provider = new ethers.providers.Web3Provider(window.ethereum);
// initialize explicitly
const coreSDK = new CoreSDK({
web3Lib: new EthersAdapter(web3Provider),
subgraphUrl: "https://api.thegraph.com/subgraphs/name/bosonprotocol/cc",
protocolDiamond: "0x5E3f5127e320aD0C38a21970E327eefEf12561E5",
// optional
metadataStorage: new IpfsMetadata({
url: "https://ipfs.infura.io:5001"
}),
// optional
theGraphStorage: new IpfsMetadata({
url: "https://api.thegraph.com/ipfs/api/v0"
})
});
It is also possible to use the default configuration provided through the @bosonprotocol/common
package.
import { CoreSDK } from "@bosonprotocol/core-sdk";
import { EthersAdapter } from "@bosonprotocol/ethers-sdk";
import { IpfsMetadata } from "@bosonprotocol/ipfs-storage";
import { ethers } from "ethers";
// injected web3 provider
const web3Provider = new ethers.providers.Web3Provider(window.ethereum);
// initialize via default config of chainId = 3
const coreSDK = CoreSDK.fromDefaultConfig({
web3Lib: new EthersAdapter(web3Provider),
chainId: 3
// ...other args
});
For handling metadata through the core-sdk
, make sure to pass an instance as a constructor argument
import { CoreSDK } from "@bosonprotocol/core-sdk";
import { IpfsMetadata } from "@bosonprotocol/ipfs-storage";
const ipfsMetadata = new IpfsMetadata({ url: "https://ipfs.infura.io:5001" });
const coreSDK = CoreSDK.fromDefaultConfig({
// ...other args
metadataStorage: ipfsMetadata
});
// store metadata
const cid = await coreSDK.storeMetadata(offerMetadata);
// get metadata
await coreSDK.getMetadata(cid);
TODO
TODO
FAQs
Facilitates interaction with the contracts and subgraphs of the Boson Protocol
The npm package @bosonprotocol/core-sdk receives a total of 467 weekly downloads. As such, @bosonprotocol/core-sdk popularity was classified as not popular.
We found that @bosonprotocol/core-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.