import { ApplyExtrinsicResult, BlockHash, DispatchError, DispatchInfo, Extrinsic, Hash, RuntimeDispatchInfo } from '@dedot/codecs'; import { Callback, GenericSubstrateApi, IEventRecord, Unsub } from '@dedot/codecs/types'; import { HexString } from '@dedot/utils'; import { IKeyringPair, InjectedSigner } from './pjs-types.js'; export type AddressOrPair = IKeyringPair | string; export type MortalityOptions = { type: 'Immortal'; } | { type: 'Mortal'; period: number; }; export interface PayloadOptions { nonce?: number; tip?: bigint; assetId?: AssetId; metadataHash?: HexString; mortality?: MortalityOptions; [prop: string]: any; } export interface SignerOptions extends PayloadOptions { signer?: InjectedSigner; } export type DryRunResult = ApplyExtrinsicResult; export type TxPaymentInfo = RuntimeDispatchInfo; export interface ISubmittableResult { status: TxStatus; events: EventRecord[]; dispatchError?: DispatchError; dispatchInfo?: DispatchInfo; txHash: Hash; txIndex?: number; } export interface IRuntimeTxCall { pallet: string; palletCall: { name: string; params?: object; } | string | null; } interface PromiseWithUntil extends Promise { untilFinalized(): Promise; untilBestChainBlockIncluded(): Promise; } export interface TxUnsub extends PromiseWithUntil { } export interface TxHash extends PromiseWithUntil { } export interface ISubmittableExtrinsic { paymentInfo(account: AddressOrPair, options?: Partial>): Promise; send(): TxHash; send(callback: Callback): TxUnsub; sign(account: AddressOrPair, options?: Partial>): Promise; signAndSend(account: AddressOrPair, options?: Partial>): TxHash; signAndSend(account: AddressOrPair, callback: Callback): TxUnsub; signAndSend(account: AddressOrPair, options: Partial>, callback?: Callback): TxUnsub; } export interface ISubmittableExtrinsicLegacy extends ISubmittableExtrinsic { dryRun(account: AddressOrPair, optionsOrHash?: Partial | BlockHash): Promise; } export type TxStatus = { type: 'Validated'; } | { type: 'Broadcasting'; } | { type: 'BestChainBlockIncluded'; value: { blockHash: HexString; blockNumber: number; txIndex: number; }; } | { type: 'NoLongerInBestChain'; } | { type: 'Finalized'; value: { blockHash: HexString; blockNumber: number; txIndex: number; }; } | { type: 'Invalid'; value: { error: string; }; } | { type: 'Drop'; value: { error: string; }; }; export type ChainSubmittableExtrinsic = // -- Extrinsic & ISubmittableExtrinsic>; export {};