import './augment'; import BN from 'bn.js'; import { DeriveCustom, ExactDerive } from "../../api-derive"; import { Constants } from "../../metadata/Decorated/types"; import { RpcInterface, UserRpc } from "../../rpc-core/types"; import { Metadata } from "../../types"; import { Hash, RuntimeVersion } from "../../types/interfaces"; import { RegistryTypes, SignatureOptions, SignerPayloadJSON, SignerPayloadRaw, Registry } from "../../types/types"; import ApiBase from '../base'; import { SubmittableResultImpl } from '../submittable/types'; import { DeriveAllSections } from '../util/decorate'; import { DecoratedRpc } from './rpc'; import { QueryableStorage, QueryableStorageMulti } from './storage'; import { SubmittableExtrinsics } from './submittable'; import { ProviderInterface, ProviderInterfaceEmitted } from "../../rpc-provider/types"; export * from '../submittable/types'; export * from './base'; export * from './rpc'; export * from './storage'; export * from './submittable'; export * from './transaction-tags'; export interface ApiOptions { /** * @description Add custom derives to be injected */ derives?: DeriveCustom; /** * @description prebundles is a map of 'genesis hash and runtime spec version' as key to metadata's hex string * if genesis hash and runtime spec version matches, then use metadata, else fetch it from chain */ metadata?: Record; /** * @description Transport Provider from rpc-provider. If not specified, it will default to * connecting to a WsProvider connecting localhost with the default port, i.e. `ws://127.0.0.1:9944` */ provider?: ProviderInterface; /** * @description A type registry to use along with this instance */ registry?: Registry; /** * @description User-defined RPC methods */ rpc?: UserRpc; /** * @description An external signer which will be used to sign extrinsic when account passed in is not KeyringPair */ signer?: Signer; /** * @description The source object to use for runtime information (only used when cloning) */ source?: ApiBase; /** * @description Additional types used by runtime modules. This is nessusary if the runtime modules * uses types not available in the base Substrate runtime. */ types?: RegistryTypes; /** * @description Additional types that are injected based on the chain we are connecting to. There are keyed by the chain, i.e. `{ 'Kusama CC1': { ... } }` */ typesChain?: Record; /** * @description Additional types that are injected based on the type of node we are connecting to, as set via specName in the runtime version. There are keyed by the node, i.e. `{ 'edgeware': { ... } }` */ typesSpec?: Record; } export interface ApiInterfaceRx { consts: Constants; derive: DeriveAllSections<'rxjs', ExactDerive>; extrinsicType: number; genesisHash: Hash; hasSubscriptions: boolean; registry: Registry; runtimeMetadata: Metadata; runtimeVersion: RuntimeVersion; query: QueryableStorage<'rxjs'>; queryMulti: QueryableStorageMulti<'rxjs'>; rpc: DecoratedRpc<'rxjs', RpcInterface>; tx: SubmittableExtrinsics<'rxjs'>; signer?: Signer; } export declare type ApiInterfaceEvents = ProviderInterfaceEmitted | 'ready'; export interface SignerOptions extends SignatureOptions { blockNumber: BN; genesisHash: Hash; } export interface SignerResult { /** * @description The id for this request */ id: number; /** * @description The resulting signature in hex */ signature: string; } export interface Signer { /** * @description signs an extrinsic payload from a serialized form */ signPayload?: (payload: SignerPayloadJSON) => Promise; /** * @description signs a raw payload, only the bytes data as supplied */ signRaw?: (raw: SignerPayloadRaw) => Promise; /** * @description Receives an update for the extrinsic signed by a `signer.sign` */ update?: (id: number, status: Hash | SubmittableResultImpl) => void; } export { ApiBase };