UNPKG

@devasher/kuru-sdk

Version:

Ethers v6 SDK to interact with Kuru (forked from @kuru-labs/kuru-sdk)

31 lines 1.43 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.TokenDetailsReader = void 0; const ethers_1 = require("ethers"); const KuruUtils_json_1 = __importDefault(require("../../abi/KuruUtils.json")); class TokenDetailsReader { /** * @dev Gets details for multiple tokens for a specific holder * @param provider - The ethers.js provider to interact with the blockchain * @param kuruUtilsAddress - The address of the KuruUtils contract * @param tokens - Array of token addresses to query * @param holder - Address of the token holder * @returns Promise resolving to an array of TokenInfo objects */ static async getTokensInfo(providerOrSigner, kuruUtilsAddress, tokens, holder) { const kuruUtils = new ethers_1.ethers.Contract(kuruUtilsAddress, KuruUtils_json_1.default.abi, providerOrSigner); const result = await kuruUtils.getTokensInfo(tokens, holder); return result.map((info) => ({ name: info.name, symbol: info.symbol, balance: info.balance.toString(), decimals: info.decimals, totalSupply: info.totalSupply.toString(), })); } } exports.TokenDetailsReader = TokenDetailsReader; //# sourceMappingURL=tokenDetails.js.map