chaingate
Version:
Multi-chain cryptocurrency SDK for TypeScript — unified API for Bitcoin, Ethereum, Litecoin, Dogecoin, Bitcoin Cash, Polygon, Arbitrum, and any EVM-compatible chain. Create wallets, query balances, send transactions, and manage tokens and NFTs across UTXO
58 lines (57 loc) • 2.2 kB
TypeScript
import type { MarketsResponse } from '../../Client';
import type { TTLCache } from '../../utils/TTLCache';
import type { Network, NetworkInfoInternal } from './types';
import { NetworkDescriptor } from './NetworkDescriptor';
import { UtxoNetworkDescriptor } from './UtxoNetworkDescriptor';
import { BchNetworkDescriptor } from './BchNetworkDescriptor';
import { EvmNetworkDescriptor } from './EvmNetworkDescriptor';
import { EvmRpcNetworkDescriptor } from './EvmRpcNetworkDescriptor';
import type { EvmRpcConfig } from './EvmRpcNetworkDescriptor';
/** @internal */
export declare const NETWORKS_INFO: Record<Network, NetworkInfoInternal>;
/**
* A collection of all supported networks.
*
* Iterable like an array (via `for...of`, `.forEach`, spread, etc.)
* **and** provides named properties for direct access:
*
* ```ts
* const cg = new ChainGate();
*
* // Direct access
* cg.explore(cg.networks.bitcoin);
*
* // Iteration
* for (const net of cg.networks) { ... }
* ```
*/
export interface NetworkCollection extends ReadonlyArray<NetworkDescriptor> {
readonly bitcoin: UtxoNetworkDescriptor;
readonly litecoin: UtxoNetworkDescriptor;
readonly dogecoin: UtxoNetworkDescriptor;
readonly bitcoincash: BchNetworkDescriptor;
readonly bitcointestnet: UtxoNetworkDescriptor;
readonly ethereum: EvmNetworkDescriptor;
readonly avalanche: EvmNetworkDescriptor;
/**
* Creates a descriptor for a custom EVM network accessible via a direct
* JSON-RPC endpoint.
*
* The returned {@link EvmRpcNetworkDescriptor} can be passed to
* `cg.connect()` to obtain an {@link EvmRpcConnector}.
*
* @example
* ```ts
* const bsc = cg.networks.evmRpc({
* rpcUrl: 'https://bsc-dataseed.binance.org',
* chainId: 56,
* name: 'BNB Smart Chain',
* symbol: 'BNB',
* });
* const conn = cg.connect(bsc, wallet);
* ```
*/
evmRpc(config: EvmRpcConfig): EvmRpcNetworkDescriptor;
}
/** @internal Builds the {@link NetworkCollection} for a {@link ChainGate} instance. */
export declare function createNetworkCollection(marketsCache: TTLCache<MarketsResponse>, apiKey?: string): NetworkCollection;