@molecularlabs/nucleus-frontend
Version:
Nucleus BoringVault Frontend SDK
54 lines • 1.79 kB
JavaScript
;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var boring_vault_exports = {};
__export(boring_vault_exports, {
getTotalSupply: () => getTotalSupply,
getVaultAllowance: () => getVaultAllowance
});
module.exports = __toCommonJS(boring_vault_exports);
var import_viem = require("viem");
var import_client = require("../lib/client");
async function getVaultAllowance({
tokenAddress,
spenderAddress,
userAddress,
chainId
}) {
const client = await (0, import_client.getClient)(chainId);
const allowance = await client.readContract({
abi: import_viem.erc20Abi,
address: tokenAddress,
functionName: "allowance",
args: [userAddress, spenderAddress]
});
return allowance;
}
async function getTotalSupply({
tokenAddress,
chainId
}) {
const client = await (0, import_client.getClient)(chainId);
const totalSupply = await client.readContract({
abi: import_viem.erc20Abi,
address: tokenAddress,
functionName: "totalSupply"
});
return totalSupply;
}
//# sourceMappingURL=boring-vault.js.map