Skip to main content
Module

x/polkadot/api/base/Decorate.ts>Decorate

Package publishing for deno.land/x/polkadot
Go to Latest
class Decorate
extends Events
Abstract
import { Decorate } from "https://deno.land/x/polkadot@0.2.25/api/base/Decorate.ts";

Constructors

new
Decorate(
options: ApiOptions,
type: ApiTypes,
decorateMethod: DecorateMethod<ApiType>,
)

Type Parameters

ApiType extends ApiTypes

Properties

protected
__phantom: BN
protected
_call: QueryableCalls<ApiType>
protected
_consts: QueryableConsts<ApiType>
protected
_decorateMethod: DecorateMethod<ApiType>

This is the one and only method concrete children classes need to implement. It's a higher-order function, which takes one argument method: Method extends (...args: any[]) => Observable<any> (and one optional options), and should return the user facing method. For example:

  • For ApiRx, decorateMethod should just be identity, because the input function is already an Observable
  • For ApiPromise, decorateMethod should return a function that takes all the parameters from method, adds an optional callback argument, and returns a Promise.

We could easily imagine other user-facing interfaces, which are simply implemented by transforming the Observable to Stream/Iterator/Kefir/Bacon via decorateMethod.

protected
optional
_derive: ReturnType<Decorate<ApiType>["_decorateDerive"]>
protected
_errors: DecoratedErrors<ApiType>
protected
_events: DecoratedEvents<ApiType>
protected
optional
_extrinsics: SubmittableExtrinsics<ApiType>
protected
_extrinsicType
protected
optional
_genesisHash: Hash
protected
_isConnected: BehaviorSubject<boolean>
protected
_isReady: boolean
protected
readonly
_options: ApiOptions
protected
_query: QueryableStorage<ApiType>
protected
optional
_queryMulti: QueryableStorageMulti<ApiType>
protected
optional
_rpc: DecoratedRpc<ApiType, RpcInterface>
protected
_rpcCore: RpcCore & RpcInterface
protected
optional
_runtimeChain: Text
protected
_runtimeMap: Record<HexString, string>
protected
optional
_runtimeMetadata: Metadata
protected
optional
_runtimeVersion: RuntimeVersion
protected
_rx: ApiInterfaceRx
protected
_rxDecorateMethod: <Method extends AnyFunction>(method: Method) => Method

Put the this.onCall function of ApiRx here, because it is needed by api._rx.

protected
_type: ApiTypes
readonly
hasSubscriptions: boolean
readonly
registry: Registry
readonly
supportMulti: boolean

Methods

private
_decorateExtrinsicEntry<ApiType extends ApiTypes>(method: CallFunction, creator: (value: Call | Uint8Array | string) => SubmittableExtrinsic<ApiType>): SubmittableExtrinsicFunction<ApiType>
private
_decorateFunctionMeta(input: MetaDecoration, output: MetaDecoration): MetaDecoration
private
_decorateStorageCall<ApiType extends ApiTypes>(creator: StorageEntry, decorateMethod: DecorateMethod<ApiType>): ReturnType<DecorateMethod<ApiType>>
private
_decorateStorageEntry<ApiType extends ApiTypes>(creator: StorageEntry, decorateMethod: DecorateMethod<ApiType>): QueryableStorageEntry<ApiType>
private
_decorateStorageEntryAt<ApiType extends ApiTypes>(
registry: Registry,
creator: StorageEntry,
decorateMethod: DecorateMethod<ApiType>,
blockHash: Uint8Array,
): QueryableStorageEntryAt<ApiType>
private
_queueStorage(call: [StorageEntry, unknown[]], queue: [Observable<Codec[]>, [StorageEntry, unknown[]][]][]): Observable<Codec>
private
_retrieveMapEntries(
entry: StorageEntry,
at:
| Hash
| Uint8Array
| string
| null
,
args: unknown[],
): Observable<[StorageKey, Codec][]>
private
_retrieveMapEntriesPaged(
entry: StorageEntry,
at:
| Hash
| Uint8Array
| string
| undefined
,
): Observable<[StorageKey, Codec][]>
private
_retrieveMapKeys(
unnamed 0: StorageEntry,
at:
| Hash
| Uint8Array
| string
| null
,
args: unknown[],
): Observable<StorageKey[]>
private
_retrieveMapKeysPaged(
unnamed 0: StorageEntry,
at:
| Hash
| Uint8Array
| string
| undefined
,
): Observable<StorageKey[]>
private
_retrieveMulti(keys: [StorageEntry, unknown[]][], blockHash?: Uint8Array): Observable<Codec[]>
private
_rpcSubmitter<ApiType extends ApiTypes>(decorateMethod: DecorateMethod<ApiType>): DecoratedRpc<ApiType, RpcInterface>
protected
_addRuntimeDef(result: DefinitionsCall, additional?: DefinitionsCall): void
protected
_createDecorated(
fromEmpty: boolean,
decoratedApi: ApiDecoration<ApiType> | null,
blockHash?: Uint8Array,
): FullDecoration<ApiType>
protected
_decorateCall<ApiType extends ApiTypes>(
registry: Registry,
stateCall: (method: string, bytes: Uint8Array) => Observable<Codec>,
decorateMethod: DecorateMethod<ApiType>,
): AugmentedCall<ApiType>
protected
_decorateCalls<ApiType extends ApiTypes>(
unnamed 0: VersionedRegistry<any>,
decorateMethod: DecorateMethod<ApiType>,
blockHash?: Uint8Array | string | null,
): QueryableCalls<ApiType>
protected
_decorateDeriveRx(decorateMethod: DecorateMethod<ApiType>): AllDerives<"rxjs">
protected
_decorateExtrinsics<ApiType extends ApiTypes>(unnamed 0: DecoratedMeta, decorateMethod: DecorateMethod<ApiType>): SubmittableExtrinsics<ApiType>
protected
_decorateMulti<ApiType extends ApiTypes>(decorateMethod: DecorateMethod<ApiType>): QueryableStorageMulti<ApiType>
protected
_decorateMultiAt<ApiType extends ApiTypes>(
decorateMethod: DecorateMethod<ApiType>,
blockHash: Uint8Array | string,
): QueryableStorageMulti<ApiType>
protected
_decorateRpc<ApiType extends ApiTypes>(
decorateMethod: DecorateMethod<ApiType>,
input?: Partial<DecoratedRpc<ApiType, RpcInterface>>,
): DecoratedRpc<ApiType, RpcInterface>
protected
_decorateStorage<ApiType extends ApiTypes>(
unnamed 0: DecoratedMeta,
decorateMethod: DecorateMethod<ApiType>,
blockHash?: Uint8Array,
): QueryableStorage<ApiType>
protected
_emptyDecorated(registry: Registry, blockHash?: Uint8Array): ApiDecoration<ApiType>
protected
_filterRpc(methods: string[], additional: Record<string, Record<string, DefinitionRpc | DefinitionRpcSub>>): void
protected
_filterRpcMethods(exposed: string[]): void
protected
_getRuntimeDefs(
registry: Registry,
specName: Text,
chain?: Text | string,
): [string, DefinitionsCallEntry[]][]
protected
_injectMetadata(registry: VersionedRegistry<ApiType>, fromEmpty?): void
abstract
at(blockHash: Uint8Array | string, knownVersion?: RuntimeVersion): Promise<ApiDecoration<ApiType>>
createType<T extends Codec = Codec, K extends string = string>(type: K, ...params: unknown[]): DetectCodec<T, K>
deprecated
injectMetadata(
metadata: Metadata,
fromEmpty?: boolean,
registry?: Registry,
): void