FetchUtility

import { utils } from "@kirobo/fct-core"

// You can either provide "rpcUrl"
const fetchUtility = new utils.FetchUtility({
    chainId,
    rpcUrl,
})

// Or "provider"
const fetchUtility = new utils.FetchUtility({
    chainId,
    provider
})

Constructor

FetchUtility should receive at least rpcUrl or provider. Otherwise when constructing FetchUtility class, it will throw an error.

Functions

fetchCurrentApprovals

Promise function - Fetch current approvals for requiredApprovals.

const approvals = await fetchUtility.fetchCurrentApprovals(requiredApprovals)

Method Arguments

Returns

{
    value: string | number | boolean; 
    // Value: ERC20 - How much is approved. ERC721 - bool, is approved for spending.
    protocol: "ERC20" | "ERC721" | "ERC1155"
    method: string
    params: object;
    token: string;
    from: string;
}

getTokensTotalSupply

Promise function - Fetch total supplies of ERC20 tokens.

const totalSupplies = await fetchUtility.getTokensTotalSupply(requiredApprovals)

Method Arguments

Returns

Record<string, string>

Last updated