UNPKG

@koyofinance/swap-sdk

Version:
180 lines (174 loc) 5.33 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); 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 __publicField = (obj, key, value) => { __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); return value; }; // src/index.ts var src_exports = {}; __export(src_exports, { Coin: () => Coin, FIAT_ASSET_TYPES: () => FIAT_ASSET_TYPES, REFERENCE_ASSETS: () => REFERENCE_ASSETS, augmentedCoins: () => augmentedCoins, augmentedPools: () => augmentedPools, coins: () => coins, findPoolForCoinsIds: () => findPoolForCoinsIds, findPoolForSwapAddress: () => findPoolForSwapAddress, getPoolById: () => getPoolById, poolIds: () => poolIds, pools: () => pools }); module.exports = __toCommonJS(src_exports); // src/constants/referenceAssets.ts var REFERENCE_ASSETS; (function(REFERENCE_ASSETS2) { REFERENCE_ASSETS2["USD"] = "usd"; REFERENCE_ASSETS2["ETH"] = "eth"; })(REFERENCE_ASSETS || (REFERENCE_ASSETS = {})); var FIAT_ASSET_TYPES = [ REFERENCE_ASSETS.USD ]; // src/constants/coins/coins.ts var import_core_sdk = require("@koyofinance/core-sdk"); var coins = [ { id: "boba:dai", coingeckoId: "dai", chainId: import_core_sdk.ChainId.BOBA, type: REFERENCE_ASSETS.USD, name: "Dai Stablecoin", symbol: "dai", decimals: 18, address: "0xf74195Bb8a5cf652411867c5C2C5b8C2a402be35" }, { id: "boba:frax", coingeckoId: "Frax", chainId: import_core_sdk.ChainId.BOBA, type: REFERENCE_ASSETS.USD, name: "Frax", symbol: "Frax", decimals: 18, address: "0x7562F525106F5d54E891e005867Bf489B5988CD9" }, { id: "boba:usdc", coingeckoId: "usd-coin", chainId: import_core_sdk.ChainId.BOBA, type: REFERENCE_ASSETS.USD, name: "USD Coin", symbol: "usdc", decimals: 6, address: "0x66a2A913e447d6b4BF33EFbec43aAeF87890FBbc" }, { id: "boba:usdt", coingeckoId: "tether", chainId: import_core_sdk.ChainId.BOBA, type: REFERENCE_ASSETS.USD, name: "Tether", symbol: "usdt", decimals: 6, address: "0x5DE1677344D3Cb0D7D465c10b72A8f60699C062d" } ]; // src/constants/coins/index.ts var Coin = class { constructor(coin) { __publicField(this, "decimals", 18); this.id = coin.id; this.name = coin.name; this.symbol = coin.symbol; this.decimals = coin.decimals; this.coingeckoId = coin.coingeckoId; this.chainId = coin.chainId; this.type = coin.type; this.address = coin.address; this.rawCoin = coin; } isFiat() { return FIAT_ASSET_TYPES.includes(this.type); } toJSON() { return this.rawCoin; } }; __name(Coin, "Coin"); var augmentedCoins = Object.fromEntries(coins.map((coin) => [ coin.id, new Coin(coin) ])); // src/constants/pools/pools.ts var import_core_sdk2 = require("@koyofinance/core-sdk"); var pools = [ { id: "4pool", name: "4pool", chainId: import_core_sdk2.ChainId.BOBA, lpTokenInfo: { name: "Koyo.finance FRAX/DAI/USDC/USDT", symbol: "4Koyo" }, assets: "FRAX+DAI+USDC+USDT", coins: [ augmentedCoins["boba:frax"], augmentedCoins["boba:dai"], augmentedCoins["boba:usdc"], augmentedCoins["boba:usdt"] ], addresses: { swap: "0x9f0a572be1fcfe96e94c0a730c5f4bc2993fe3f6", lpToken: "0xdab3fc342a242add09504bea790f9b026aa1e709" } } ]; // src/constants/pools/index.ts var augmentedPools = pools; var poolIds = augmentedPools.map(({ id }) => id); function getPoolById(id) { return augmentedPools.find((pool) => id === pool.id); } __name(getPoolById, "getPoolById"); function findPoolForCoinsIds(coinIdA, coinIdB) { return augmentedPools.find(({ coins: coins2 }) => coins2.some(({ id }) => id === coinIdA) && coins2.some(({ id }) => id === coinIdB)); } __name(findPoolForCoinsIds, "findPoolForCoinsIds"); function findPoolForSwapAddress(swapAddress) { const lcSwapAddress = swapAddress.toLowerCase(); return augmentedPools.find(({ addresses }) => addresses.swap.toLowerCase() === lcSwapAddress); } __name(findPoolForSwapAddress, "findPoolForSwapAddress"); // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { Coin, FIAT_ASSET_TYPES, REFERENCE_ASSETS, augmentedCoins, augmentedPools, coins, findPoolForCoinsIds, findPoolForSwapAddress, getPoolById, poolIds, pools }); //# sourceMappingURL=index.js.map