UNPKG

@molecularlabs/nucleus-frontend

Version:
81 lines 2.62 kB
"use strict"; 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 accountant_exports = {}; __export(accountant_exports, { getRateInQuoteAndSharesAndWantAssetDecimals: () => getRateInQuoteAndSharesAndWantAssetDecimals, getRateInQuoteWithAssetDecimals: () => getRateInQuoteWithAssetDecimals }); module.exports = __toCommonJS(accountant_exports); var import_viem = require("viem"); var import_accountant_abi = require("../contracts/accountant-abi"); var import_boring_vault_abi = require("../contracts/boring-vault-abi"); var import_client = require("../lib/client"); const getRateInQuoteWithAssetDecimals = async ({ assetAddress, accountantAddress, chainId }) => { const client = await (0, import_client.getClient)(chainId); const results = await client.multicall({ contracts: [ { abi: import_viem.erc20Abi, address: assetAddress, functionName: "decimals" }, { abi: import_accountant_abi.AccountantAbi, address: accountantAddress, functionName: "getRateInQuote", args: [assetAddress] } ] }); return results; }; const getRateInQuoteAndSharesAndWantAssetDecimals = async ({ sharesAssetAddress, wantAssetAddress, accountantAddress, chainId }) => { const client = await (0, import_client.getClient)(chainId); const results = await client.multicall({ contracts: [ { abi: import_viem.erc20Abi, address: wantAssetAddress, functionName: "decimals" }, { abi: import_boring_vault_abi.BoringVaultAbi, address: sharesAssetAddress, functionName: "decimals" }, { abi: import_accountant_abi.AccountantAbi, address: accountantAddress, functionName: "getRateInQuote", args: [wantAssetAddress] } ] }); return results; }; //# sourceMappingURL=accountant.js.map