@paxoslabs/earn-sdk
Version:
Paxos Labs Earn SDK
29 lines (28 loc) • 856 B
JavaScript
// src/api/vault-config.ts
var configCache = null;
function toChainId(value) {
return typeof value === "number" ? value : Number(value);
}
async function fetchVaultConfigs() {
if (configCache) {
return configCache;
}
const response = await fetch("https://api.nucleusearn.io/prod/vault-config");
if (!response.ok) {
throw new Error(`API request failed with status ${response.status}`);
}
const data = await response.json();
configCache = data;
return configCache;
}
async function fetchVaultConfig(vaultKey) {
const configs = await fetchVaultConfigs();
const vault = configs.vaults[vaultKey];
if (!vault) {
throw new Error(`Vault config not found for key: ${vaultKey}`);
}
return vault;
}
export { fetchVaultConfig, toChainId };
//# sourceMappingURL=chunk-4URQP4CS.mjs.map
//# sourceMappingURL=chunk-4URQP4CS.mjs.map