@yubing744/rooch-sdk
Version:
44 lines (43 loc) • 2.45 kB
TypeScript
import fetch from 'isomorphic-fetch';
import { ChainInfo, Network } from '../constants';
import { AnnotatedFunctionResultView, Bytes, EventPageView, GlobalStateView, InscriptionStatePageView, StatePageView, StateView, TableStateView, TransactionWithInfoPageView, TransactionWithInfoView, UTXOStatePageView } from '../types';
import { IClient } from './interface';
import { ExecuteViewFunctionParams, GetEventsParams, GetTransactionsParams, QueryGlobalStatesParams, QueryInscriptionsParams, QueryTableStatesParams, QueryUTXOsParams, ResoleRoochAddressParams, ListStatesParams } from './types.ts';
export declare const ROOCH_CLIENT_BRAND: unique symbol;
export declare function isRoochClient(client: unknown): client is RoochClient;
/**
* Configuration options for the JsonRpcProvider. If the value of a field is not provided,
* value in `DEFAULT_OPTIONS` for that field will be used
*/
export type RpcProviderOptions = {
/**
* Cache timeout in seconds for the RPC API Version
*/
versionCacheTimeoutInSeconds?: number;
/** Allow defining a custom RPC client to use */
fetcher?: typeof fetch;
};
export declare class RoochClient implements IClient {
options: RpcProviderOptions;
network: Network;
private client;
private rpcApiVersion;
private cacheExpiry;
constructor(network?: Network, options?: RpcProviderOptions);
switchChain(network: Network): void;
ChainInfo(): ChainInfo;
getChainId(): number;
getRpcApiVersion(): Promise<string | undefined>;
executeViewFunction(params: ExecuteViewFunctionParams): Promise<AnnotatedFunctionResultView>;
sendRawTransaction(playload: Bytes): Promise<string>;
getTransactionsByHashes(tx_hashes: string[]): Promise<TransactionWithInfoView | null[]>;
getTransactions(params: GetTransactionsParams): Promise<TransactionWithInfoPageView>;
getEvents(params: GetEventsParams): Promise<EventPageView>;
getStates(access_path: string): Promise<StateView | null[]>;
listStates(params: ListStatesParams): Promise<StatePageView>;
queryGlobalStates(params: QueryGlobalStatesParams): Promise<GlobalStateView>;
queryTableStates(params: QueryTableStatesParams): Promise<TableStateView>;
queryInscriptions(params: QueryInscriptionsParams): Promise<InscriptionStatePageView>;
queryUTXOs(params: QueryUTXOsParams): Promise<UTXOStatePageView>;
resoleRoochAddress(params: ResoleRoochAddressParams): Promise<string>;
}