UNPKG

@0xfutbol/id

Version:

React component library with shared providers for 0xFutbol ID

58 lines (57 loc) 1.86 kB
'use strict';var index=require('./index-DwkZmKdT.js');require('react'),require('react/jsx-runtime'),require('@0xfutbol/id-sign'),require('react-use'),require('@0xfutbol/constants'),require('thirdweb'),require('@matchain/matchid-sdk-react'),require('@tanstack/react-query'),require('@matchain/matchid-sdk-react/index.css'),require('react-dom');const FN_SELECTOR = "0x70a08231"; const FN_INPUTS = [ { type: "address", name: "_address", }, ]; const FN_OUTPUTS = [ { type: "uint256", }, ]; /** * Calls the "balanceOf" function on the contract. * @param options - The options for the balanceOf function. * @returns The parsed result of the function call. * @extension ERC20 * @example * ```ts * import { balanceOf } from "thirdweb/extensions/erc20"; * * const result = await balanceOf({ * contract, * address: ..., * }); * * ``` */ async function balanceOf(options) { return index.P({ contract: options.contract, method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS], params: [options.address], }); }/** * Retrieves the balance of an ERC20 token for a specific address. * @param options - The transaction options including the address. * @returns An object containing the balance value, display value, and symbol. * @extension ERC20 * @example * ```ts * import { getBalance } from "thirdweb/extensions/erc20"; * * const balance = await getBalance({ contract, address: "0x..." }); * ``` */ async function getBalance(options) { const [balanceWei, currencyMetadata] = await Promise.all([ balanceOf(options), index.Q(options), ]); return { ...currencyMetadata, value: balanceWei, displayValue: index.R(balanceWei, currencyMetadata.decimals), }; }exports.getBalance=getBalance;//# sourceMappingURL=getBalance-DcKEg9b3.js.map