Provider

What is it?

Although it seems to be classified under Provider services, it is actually the class that should always be started first. Because all other classes always operate using provider. You can also send the provider as the last parameter in all classes. So for example, you can get 3 different EVM network provider objects and you can easily make transactions with 3 different tokens on 3 different networks.

Provider is also the class where the "web3" packets used for the respective network are initialized and hosted.

Methods

import { Provider, networks, models } from '@multiplechain/evm-chains'

const provider = new Provider(networks.ethereum)

const instance = Provider.instance // static

const instance2 = Provider.initialize(networks.ethereum) // static

const checkRpc = provider.checkRpcConnection('http://localhost:8545')

const checkWs = provider.checkWsConnection('ws://localhost:8545')

provider.update(networks.bsc) // update network

const isTestnet = provider.isTestnet() // check if network is testnet```typescript

// Example
const tx = new models.Transaction('0x123', provider)

Last updated