UNPKG

pharos-agent-kit

Version:
28 lines 821 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getERC20Balance = getERC20Balance; exports.getBalance = getBalance; const viem_1 = require("viem"); const erc20Abi = (0, viem_1.parseAbi)(['function balanceOf(address) view returns (uint256)']); /** * Get ERC20 token balance */ async function getERC20Balance(agent, tokenAddress) { const balance = await agent.publicClient.readContract({ address: tokenAddress, abi: erc20Abi, functionName: 'balanceOf', args: [agent.wallet_address], }); return balance; } /** * Get native coin balance */ async function getBalance(agent) { const balance = await agent.publicClient.getBalance({ address: agent.wallet_address, }); return balance; } //# sourceMappingURL=getBalance.js.map