UNPKG

@broxus/js-core

Version:

MobX-based JavaScript Core library

37 lines (36 loc) 1.9 kB
import { type Address, type FullContractState, type ProviderApiResponse, type ProviderRpcClient, type Subscriber } from 'everscale-inpage-provider'; import { AbstractStore } from '../AbstractStore'; import { type Forceable, type ObjectLiteral } from '../types'; export interface SmartContractModelData { computedStorageData?: ProviderApiResponse<'computeStorageFee'>; contractState?: FullContractState; } export interface SmartContractModelState { isSyncing?: boolean; syncedAt?: number; } interface SyncContractStateOptions extends Forceable { ttl?: number; } export declare abstract class SmartContractModel<T extends SmartContractModelData | ObjectLiteral = SmartContractModelData, U extends SmartContractModelState | ObjectLiteral = SmartContractModelState> extends AbstractStore<SmartContractModelData & T, SmartContractModelState & U> { protected readonly _connection: ProviderRpcClient; private readonly _address; protected contractSubscriber?: Subscriber; /** * @param {ProviderRpcClient} _connection Standalone RPC client that doesn't require connection to the TVM wallet provider * @param {Address | string} address Contract address * @protected */ protected constructor(_connection: ProviderRpcClient, address: Address | string); get address(): Address; get computedStorageData(): SmartContractModelData['computedStorageData'] | undefined; get contractState(): SmartContractModelData['contractState']; get isSyncing(): SmartContractModelState['isSyncing']; get syncedAt(): SmartContractModelState['syncedAt']; get isDeployed(): FullContractState['isDeployed'] | undefined; syncContractState(options?: SyncContractStateOptions): Promise<FullContractState | undefined>; protected syncComputedStorageData(): Promise<void>; watch?(): Promise<Subscriber>; unwatch?(): Promise<void>; } export {};