The Matic.js library follows common api architecture throughout and the APIs are divided into two types:Documentation Index
Fetch the complete documentation index at: https://docs.polygon.technology/llms.txt
Use this file to discover all available pages before exploring further.
- Read API
- Write API
Read API
Read methods do not publish anything on blockchain, so they do not consume any gas. For example:Write API
Write methods publish some data on the blockchain, so they consumes gas. Example of write methods areapprove, deposit etc.
A write method returns (at least) two data items:
TransactionHashTransactionReceipt
Transaction option
There are some configurable options that are available for all API’s. These configurations can be passed as parameters. Available configurations are -from?: string | number - The address transactions should be made from.to?: string - The address transactions should be made to.value?: number | string | BN - The value transferred for the transaction in wei.gasLimit?: number | string - The maximum gas provided for a transaction (gas limit).gasPrice?: number | string | BN - The gas price in wei to use for transactions.data?: string - The byte code of the contract.nonce?: number;chainId?: number;chain?: string;hardfork?: string;returnTransaction?: boolean - making it true will return the transaction object which can be used to send transaction manually.