Package Exports
- @blockcore/provider
Readme
Blockcore Web Provider
Multi-Chain Web Provider for Blockcore
Work-in-Progress - use with caution!
Blockcore Web Provider
Web (Web3/Web5) Provider for Blockcore.
The provider is how apps talks to the blockchains. Providers take JSON-RPC requests and return the response. This is normally done by submitting the request to an HTTP or IPC socket based server.
The provider also allows connection to be made between web site / web app and the Blockcore Wallet (browser extension).
Setup
Install:
npm install @blockcore/provider
Warning: This package is native ESM and does not provide a CommonJS export. If your project uses CommonJS, you'll have to convert to ESM or use the dynamic import()
function.
Usage
import { WebProvider } from "@blockcore/provider";
let webProvider = await WebProvider.Create();
webProvider.setNetwork('BTC');
const response = await webProvider.request({
method: 'wallet_getPermissions',
});
const result: any = await webProvider.indexer.getCirculatingSupply();
Screen recording demonstrating the use of the Blockcore Web Provider:
Development
Build
Simply run npm run build
to build the library. Also run npm run lint
to verify the code syntax.
Testing
The library is using ava
for tests. Please refer to the documentation on how to write tests:
https://github.com/avajs/ava/blob/main/docs/01-writing-tests.md