BoringVault Config
Getting the vault
Getting the vault is easy. Just pass the vault key into the getVaultByKey function, and you should have all the information you need to interact with the PXL BoringVault.
import { getVaultByKey, VaultKeys } from "@molecularlabs/nucleus-frontend";
function App() {
const vault = await getVaultByKey(VaultKeys.COOLVAULT)
// or
const vault2 = await getVaultByKey("cool-vault");
console.log(vault);
console.log(vault2);
return (
<div>
<h1>{`${vault} Boring Vault`}</h1>
// ...other code
</div>
)
}
import { getVaultByKey, VaultKeys } from "@molecularlabs/nucleus-frontend";
import { useQuery } from "@tanstack/react-query";
const COOLVAULT_VAULT_KEY = VaultKeys.COOLVAULT;
function App() {
const {
data: vault,
error: vaultError,
status: vaultStatus,
} = useQuery({
queryKey: [COOLVAULT_VAULT_KEY],
queryFn: () => getVaultByKey(COOLVAULT_VAULT_KEY),
});
if (vaultError) {
return <div>Error: {vaultError.message}</div>;
}
if (vaultStatus === "pending") {
return <div>Loading...</div>;
}
console.log("vault in app", vault);
// UI
}
The config file is designed to provide all the information you may need when interacting with a PXL BoringVault. Below you'll find the shape of the Vault object to help you understand what data is included.
const VaultKeys = {
BOBAETH: 'bobaeth',
SSETH: 'sseth',
FETH: 'feth',
COOLVAULT: 'cool-vault'
// etc...
} as const;
export type VaultKey = (typeof VaultKeys)[keyof typeof VaultKeys];
export type VaultConfig = {
contracts: {
accountant: Address;
boringVault: Address;
teller: Address;
};
token: {
name: string;
symbol: string;
address: Address;
decimals: number;
};
deposit: {
sourceChains: {
[chainId: string]: {
depositTokens: string[];
destinationChains: {
[chainId: string]: {
displayName: string;
bridge: BridgeConfig;
};
};
};
};
};
withdraw: {
sourceChains: {
[chainId: string]: {
displayName: string;
destinationChains: {
[chainId: string]: {
bridge: BridgeConfig;
displayName: string;
wantTokens: string[];
};
};
};
};
};
};
export interface BridgeConfig {
type: 'hyperlane' | 'layerzero' | 'none';
chainIdentifier: number;
Last updated