UNPKG

viem-erc20

Version:
25 lines 827 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.allowance = void 0; const viem_1 = require("viem"); const actions_1 = require("viem/actions"); const allowance = async function (client, parameters) { const { address, owner, spender } = parameters ?? {}; if (!(0, viem_1.isAddress)(address)) { throw new Error("Invalid address"); } if (!(0, viem_1.isAddress)(owner)) { throw new Error("Invalid owner address"); } if (!(0, viem_1.isAddress)(spender)) { throw new Error("Invalid spender address"); } return (0, actions_1.readContract)(client, { abi: viem_1.erc20Abi, address, args: [owner, spender], functionName: "allowance", }); }; exports.allowance = allowance; //# sourceMappingURL=allowance.js.map