@molecularlabs/nucleus-frontend
Version:
Nucleus BoringVault Frontend SDK
45 lines (42 loc) • 1.43 kB
text/typescript
import { Chain } from 'viem/chains';
import { Vault, VaultKey } from '../vaults/config.mjs';
import 'viem';
type ChainId = number | `${number}`;
interface VaultConfigResponse {
chains: {
[key: string]: Chain;
};
vaults: {
[key: string]: Vault;
};
}
/**
* Validates if a chain ID is supported by checking the vault configuration
*/
declare function isChainSupported(chainId: ChainId): Promise<boolean>;
/**
* Gets the numeric chain ID from any valid chain ID input
*/
declare function toChainId(value: ChainId): number;
/**
* Fetches vault configurations from the API
* @returns Promise<VaultConfigResponse>
*/
declare function fetchVaultConfigs(): Promise<VaultConfigResponse>;
/**
* Fetches configuration for a specific vault
* @param vaultKey The vault key to fetch configuration for (can be a known VaultKey or a new vault key from the API)
* @returns Promise<Vault>
*/
declare function fetchVaultConfig(vaultKey: VaultKey | string): Promise<Vault>;
/**
* Gets a specific chain configuration
* @param chainId The chain ID to fetch configuration for
* @returns Promise<Chain>
*/
declare function getChainConfig(chainId: ChainId): Promise<Chain>;
/**
* Clears the configuration cache
*/
declare function clearConfigCache(): void;
export { type ChainId, type VaultConfigResponse, clearConfigCache, fetchVaultConfig, fetchVaultConfigs, getChainConfig, isChainSupported, toChainId };