Private constructor. Instead, use PolygonOnEthereumSDK.getInstance
.
apiUrl — URL of the advanced API.
Contract addresses by current network mode.
currentAccount — connected account.
Network mode.
readProvider — provider which allows to read data without connecting the wallet.
writeProvider — provider which has signer for signing transactions.
instance — SDK instance.
Returns true
if instance is initialized with production mode.
Add token to wallet.
token symbol (ankrMATIC or aMATICb)
Approve ankrMATIC for aMATICb, i.e. allow aMATICb smart contract to access and transfer ankrMATIC tokens.
Approve MATIC for PolygonPool, i.e. allow PolygonPool smart contract to access and transfer MATIC tokens.
Internal function to convert wei value to human-readable format.
value in wei
executeBatchCalls
is supposed to decrease calls to blockchain.
It only sends one request and returns data from each call.
web3 instance
web3 calls
array of return values from web3 calls
Fetch transaction data.
transaction hash
Fetch transaction receipt.
transaction hash.
Return aMATICb token balance.
Return ankrMATIC token allowance.
Return ankrMATIC token balance.
Return ankrMATIC/MATIC ratio.
Internal function to get aMATICb token contract.
Internal function to get ankrMATIC token contract.
Internal function to get blocks by block number. It uses cache to avoid unnecessary requests.
web3 instance.
block numbers to get.
blocks data.
Get transaction history for all period that starts from contract creation.
full transaction history.
Get latest block number.
Return MATIC token balance.
Internal function to get MATIC token contract.
Get minimum stake amount.
An internal function for getting past events from the API or blockchain according to the current environment.
Internal function to get past events from indexed logs API.
Internal function to get past events, using the defined range.
Get total pending unstake amount.
Get pending data for aMATICb and ankrMATIC.
Internal function to get polygonPool contract.
Internal function to return pool raw events.
from block
to block
Get stake gas fee.
amount to stake
token symbol (aMATICb or ankrMATIC)
Internal function to return stake method by token symbol.
token symbol
Internal function to return transaction history group from events.
Get transaction history for block range.
from block number
to block number
if true, only unstake events will be returned
Internal function to map event type to transaction type.
Internal function to return unstake method by token symbol.
token symbol
Return web3 unstake transaction object.
amount to unstake
token symbol (aMATICb or ankrMATIC)
web3 unstake transaction object
Get unstake transaction fee.
amount to unstake
token symbol (aMATICb or ankrMATIC)
Internal function to get write provider. If provider is not connected, it will be connected.
Internal function to check the current network.
current selected provider
Switch ankrMATIC to aMATICb.
object with amount to switch and scale
Stake token.
amount of token
choose which token to receive (aMATICb or ankrMATIC)
Switch aMATICb to ankrMATIC.
object with amount to switch and scale
Unstake token.
amount to unstake
choose which token to unstake (aMATICb or ankrMATIC)
Initialization method for the SDK.
Auto-connects writeProvider if chains are the same. Initializes readProvider to support multiple chains.
Generated using TypeDoc
PolygonOnEthereumSDK allows you to interact with Polygon Liquid Staking smart contracts on the Ethereum blockchain: MATIC, aMATICb, ankrMATIC, and polygonPool.
For more information on Polygon Liquid Staking from Ankr, refer to the development details.