Package Exports
- @streambird/web3-core
- @streambird/web3-core/dist/cjs/index.js
- @streambird/web3-core/dist/esm/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@streambird/web3-core) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Streambird RPC provider
Installation
Yarn
$ yarn add @streambird/rpc-providernpm
$ npm install @streambird/rpc-providerInitializing Provider
ES Modules/TypeScript
import { StreambirdRPCProvider } from '@streambird/rpc-provider'
import Web3 from 'web3'
const rpcProvider = new StreambirdRPCProvider({
// Streambird server url
endpoint: process.env.SECURED_STREAMBIRD_URL,
// Node url e.g: https://rinkeby.infura.io/v3/<API_KEY>
network: process.env.NODE_URL,
privateKey: process.env.PRIVATE_KEY,
})
const web3 = new Web3(rpcProvider)CommonJS
const { StreambirdRPCProvider } = require('@streambird/rpc-provider')
const Web3 = require('web3')
const rpcProvider = new StreambirdRPCProvider({
// Streambird server url
endpoint: process.env.SECURED_STREAMBIRD_URL,
// Node url e.g: https://rinkeby.infura.io/v3/<API_KEY>
network: process.env.NODE_URL,
privateKey: process.env.PRIVATE_KEY,
})
const web3 = new Web3(rpcProvider)Get User Info
const address = (await web3.eth.getAccounts())[0]
const balance = web3.utils.fromWei(await web3.eth.getBalance(address))