UNPKG

@moonsong-labs/moonwall-cli

Version:

Testing framework for the Moon family of projects

46 lines (43 loc) 2.33 kB
import { ApiPromise } from '@polkadot/api'; import { ApiTypes, SubmittableExtrinsic, AugmentedEvent } from '@polkadot/api/types'; import { GenericExtrinsic } from '@polkadot/types/extrinsic'; import { EventRecord, DispatchError, DispatchInfo } from '@polkadot/types/interfaces'; import { AnyTuple, RegistryError } from '@polkadot/types/types'; import { Web3 } from 'web3'; import { Debugger } from 'debug'; declare function createBlock<ApiType extends ApiTypes, Call extends SubmittableExtrinsic<ApiType> | Promise<SubmittableExtrinsic<ApiType>> | string | Promise<string>, Calls extends Call | Call[]>(w3Api: Web3, pjsApi: ApiPromise, transactions?: Calls, options?: BlockCreation): Promise<BlockCreationResponse<ApiType, Calls extends Call[] ? Awaited<Call>[] : Awaited<Call>>>; interface ChopsticksBlockCreation { providerName?: string; count?: number; to?: number; expectEvents?: AugmentedEvent<ApiTypes>[]; allowFailures?: boolean; logger?: Debugger; } interface BlockCreation { parentHash?: string; finalize?: boolean; allowFailures?: boolean; expectEvents?: AugmentedEvent<ApiTypes>[]; logger?: Debugger; } interface BlockCreationResponse<ApiType extends ApiTypes, Call extends SubmittableExtrinsic<ApiType> | string | (SubmittableExtrinsic<ApiType> | string)[]> { block: { duration: number; hash: string; }; result: Call extends (string | SubmittableExtrinsic<ApiType>)[] ? ExtrinsicCreation[] : ExtrinsicCreation; } interface ExtrinsicCreation { extrinsic: GenericExtrinsic<AnyTuple>; events: EventRecord[]; error: RegistryError; successful: boolean; hash: string; } declare function filterAndApply<T>(events: EventRecord[], section: string, methods: string[], onFound: (record: EventRecord) => T): T[]; declare function getDispatchError({ event: { data: [dispatchError], }, }: EventRecord): DispatchError; declare function extractError(events?: EventRecord[]): DispatchError | undefined; declare function isExtrinsicSuccessful(events?: EventRecord[]): boolean; declare function extractInfo(events?: EventRecord[]): DispatchInfo | undefined; export { BlockCreation, BlockCreationResponse, ChopsticksBlockCreation, ExtrinsicCreation, createBlock, extractError, extractInfo, filterAndApply, getDispatchError, isExtrinsicSuccessful };