unich-web3-sdk
Version:
Web3 SDK for DEX applications with multi-chain support
49 lines (47 loc) • 1.13 kB
text/typescript
/**
* Enum for different blockchain types
*/
declare enum ChainType {
EVM = "evm",// Ethereum Virtual Machine based chains
SVM = "svm"
}
/**
* Enum for network types
*/
declare enum NetworkType {
MAINNET = "mainnet",
TESTNET = "testnet",
DEVNET = "devnet"
}
/**
* Interface for chain configuration
*/
interface ChainConfig {
id: string | number;
name: string;
type: ChainType;
networkType: NetworkType;
rpcUrls: string[];
nativeCurrency: {
name: string;
symbol: string;
decimals: number;
};
blockExplorerUrls?: string[];
iconUrl?: string;
testnet?: boolean;
}
/**
* Type for chain ID
*/
type ChainId = string | number;
/**
* Interface for chain adapter
* This is used to implement chain-specific functionality
*/
interface ChainAdapter {
getProvider: (chain: ChainConfig) => any;
getBalance: (chain: ChainConfig, address: string) => Promise<bigint>;
getBlockNumber: (chain: ChainConfig) => Promise<bigint>;
}
export { type ChainId as C, NetworkType as N, type ChainConfig as a, ChainType as b, type ChainAdapter as c };