MultipleChain Docs V0.4
  • OVERVIEW
    • 👋Welcome
    • 😇Doc Logic
  • STRUCTURE
    • 🪙Assets
      • Common
      • Coin
      • NFT
      • Token
      • Contract
    • 📝Models
      • Common
      • Transaction
      • CoinTransaction
      • NftTransaction
      • TokenTransaction
      • ContractTransaction
    • 📬Services
      • Provider
      • TransactionSigner
      • TransactionListener
    • 💻Browser
  • NETWORKS
    • 🔗Etherem (EVM)
    • 🔗Solana
    • 🔗Bitcoin
    • 🔗Tron
  • LANGUAGES
    • 💻JavaScript (TS)
      • Node
      • Browser
    • 💻PHP
Powered by GitBook
On this page
  • What is it?
  • Methods
  1. STRUCTURE
  2. Services

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)
PreviousServicesNextTransactionSigner

Last updated 10 months ago

📬