@parabolfi/core
Version:
Core utilities for Parabol SDK
33 lines • 1.52 kB
TypeScript
import { SupportedChainId } from "../config/global";
import { Chain, PrivateKeyAccount, PublicClient, WalletClient } from "viem";
/**
* Creates a wallet provider for the specified chain and account.
*
* @param {SupportedChainId} chainId - The ID of the blockchain network.
* @param {PrivateKeyAccount} account - The private key account to be used.
* @returns {Object} An object containing the wallet client and chain information.
* @property {WalletClient} walletClient - The created wallet client.
* @property {Chain} chain - The chain configuration.
* @throws {Error} If the chain ID is not supported or if there's an error creating the wallet provider.
*
* @example
* const account = privateKeyToAccount('0x...');
* const { walletClient, chain } = createWalletProvider(324 as SupportedChainId, account);
*/
export declare function createWalletProvider(chainId: SupportedChainId, account: PrivateKeyAccount): {
walletClient: WalletClient;
chain: Chain;
};
/**
* Creates a public provider for the specified chain.
*
* @param {SupportedChainId} chainId - The ID of the blockchain network.
* @returns {PublicClient} A public client for interacting with the specified blockchain.
* @throws {Error} If the chain ID is not supported.
*
* @example
* const publicClient = createPublicProvider(1);
* const blockNumber = await publicClient.getBlockNumber();
*/
export declare function createPublicProvider(chainId: SupportedChainId): Promise<PublicClient>;
//# sourceMappingURL=createProvider.d.ts.map