UNPKG

@moonsong-labs/moonwall-util

Version:

Testing framework for the Moon family of projects

33 lines (30 loc) 1.62 kB
import { ApiTypes, SubmittableExtrinsic } 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 { ethers } from 'ethers'; interface BlockCreation { parentHash?: string; finalize?: boolean; } 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; declare const alithSigner: (context: ethers.Provider) => ethers.Wallet; export { BlockCreation, BlockCreationResponse, ExtrinsicCreation, alithSigner, extractError, extractInfo, filterAndApply, getDispatchError, isExtrinsicSuccessful };