Security News
UK Officials Consider Banning Ransomware Payments from Public Entities
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.
@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 1,433 weekly downloads. As such, @bosonprotocol/core-sdk popularity was classified as 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 0 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
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.