Meter Docs
Learn
  • Welcome to Meter!
  • 中文版文档
  • Overview of Meter
    • Introduction to Meter
    • Hybrid PoV Consensus Mechanism
    • MTR - The Metastable Coin
    • MTRG - Meter Governance Coin
    • On-Chain Auctions
    • The Meter Reserve
    • Meter's Ethereum Emulation Mode
  • Wallet Setup
    • Interacting with Meter Mainnet Using MetaMask
    • Interacting with Meter Mainnet Using Ledger
    • Adding Custom Tokens to MetaMask
    • Getting MTR for Gas
    • Revoking Contract Spend Limits
    • Specifying gas (GWEI) for transactions
    • Speeding Up/ Canceling Transactions
  • Meter Passport V2.0
    • Meter Passport Architecture
    • Salient Features
    • Bridge Fee
    • Programming Meter Passport
    • Tutorials for Using Meter Passport
    • MTRG Crosschain Info
    • Onboarding Passport for Your Project
    • Technical Guideline for Meter Passport
    • Security Audit for Meter Passport V2.0
  • Staking and Validation
    • Staking MTRG
      • How to Stake MTRG
        • Choosing Candidates
        • Factors affecting Staking Rewards
      • How to Stake Incremental MTRG
      • How to Undelegate MTRG
      • How to Unbound MTRG
      • Frequently Asked Questions
    • Running a Full Node on Meter Mainnet
    • Configure the Full Node to Validator Node
    • Meter Incentive Programs to promote decentralization
  • Mining
    • Meter Mining Guide
  • NFT Collections
    • Meter Community NFTs
  • Developer Documentation
    • Meter Developer Incentives
      • Meter Developer Grant Program
      • Meter TVL Incentive Program
      • Meter Gas Monetization Program
      • Meter Co-marketing Program
      • Meter DAPP Referral Program
    • Introduction to Developer Documentation
    • Developing with Remix, Ethers.js and Web3.js
    • Index Data with SubQuery
    • Meter Native TX RESTful APIs
    • Meterify API Documentation
      • meterify.eth
      • meterify.eth.Contract
      • meterify.eth.accounts
      • meterify.utils
      • meterify.module.options
      • Callbacks Promises Events
      • json interface
    • Meterify DApp Tutorials
    • Meterify Code Examples
    • Contributing to Meter and Our Documentation
      • Documentation Guidelines
        • API Documentation Guidelines
        • Tutorial Creation Guidelines
        • Code Example Guidelines
        • Article Writing Guidelines
Powered by GitBook
On this page
  • Example
  • Notes on meterify and web3
  • MODULES
  • eth
  • utils
  • module.options

Was this helpful?

  1. Developer Documentation

Meterify API Documentation

The meterify package is a wrapper to house all Meter-related modules, and depends on the web3.js library. If you are writing applications or scripts executing in Node.js or a browser environment, you should use Meterify.

Property

Type

Description

web3Instance

object

A web3 instance

host

string

The Meter host URL (and port, if applicable)

timeout

number

Request timeout value

Parameters of the meterify return object

Property

Type

Description

BatchRequest

function

Sets a RequestManager object and initiates batch requests

currentProvider

function

Get or set the current provider.

timeout

number

Request timeout value

eth

object

An Eth object (see: eth (insert link))

extension

extension

givenProvider

object

Return the given provider object.

providers

object

A list of providers.

provider

object

The current provider object.

_requestManager

object

A RequestManager object.

setProvider

function

Set the current provider.

utils

object

A utils object (see: (insert link))

Example

This code...

const meter = require("meterify").meterify;
const Web3 = require("web3");
const meterify = meter(new Web3(), "https://testnet.meter.io");

...returns an object:

{
  eth: {
    _requestManager: RequestManager,
    givenProvider: MetamaskInpageProvider,
    providers: {…},
    _provider: MeterProvider, 
    …
  },
  givenProvider: {
    mux: ObjectMultiplex,
    publicConfigStore: ObservableStore,
    rpcEngine: RpcEngine,
    send: ƒ
  },
  providers: {
    WebsocketProvider: ƒ,
    HttpProvider: ƒ,
    IpcProvider: ƒ
  },
  utils: {
    _fireError: ƒ,
    _jsonInterfaceMethodToString: ƒ,
    _flattenTypes: ƒ,
    randomHex: ƒ,
    _: ƒ, 
    …
  },
  version: "1.0.0-beta.37",
  _provider: {
    _events: Events,
    _eventsCount: 1,
    RESTHost: "https://test.meter.io",
    WSHost: "wss://wstest.meter.io",
    timeout: 0, 
    …
  },
  _requestManager: {
    provider: MeterProvider,
    providers: {…},
    subscriptions: {…}
  }
  ...
}

Notes on meterify and web3

The RESTful API of Meter differs from Ethereum's JSON-RPC, and there are some methods in web3 are not supported by meterify.

Supported Web3 Methods

web3 instance ├── eth │ ├── getBlockNumber │ ├── getBalance │ ├── getStorageAt │ ├── getCode │ ├── getBlock │ ├── getTransaction │ ├── getTransactionReceipt │ ├── sendTransaction │ ├── sendSignedTransaction │ ├── call │ ├── estimateGas │ ├── getPastLogs │ ├── subscribe │ ├── clearSubscriptions │ ├── getEnergy │ ├── getChainTag │ ├── getBlockRef │ ├── accounts │ └── Contract │ ├── Constructor(new Contract()) │ ├── clone │ ├── deploy │ ├── methods │ ├── methods.myMethod.call │ ├── methods.myMethod.send │ ├── methods.myMethod.estimateGas │ ├── methods.myMethod.encodeABI │ ├── events │ ├── once │ ├── events.myEvent │ ├── events.allEvents │ └── getPastEvents └── utils

MODULES

eth

utils

module.options

A module does provide several options for configuring the transaction confirmation workflow, or for defining default values.

PreviousMeter Native TX RESTful APIsNextmeterify.eth

Last updated 3 years ago

Was this helpful?

For meterify.eth see the reference documentation.

For meterify.utils see the reference documentation.

For the currently available option properties on a module: see the reference documentation.

eth
utils
options