Optionaloptions: ApiOptions
Options to create an instance. Can be either [[ApiOptions]] or [[WsProvider]]
Protected__Protected_Protected_Protected_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:
decorateMethod should just be identity, because the input
function is already an ObservabledecorateMethod 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_Protected_Protected_Protected Optional_Protected_Protected Optional_Protected_Protected_Protected Readonly_Protected_Protected Optional_Protected Optional_Protected_Protected Optional_Protected_Protected Optional_Protected Optional_Protected_Protected_true if the API operates with subscriptions
Contains all the chain state modules and their subsequent methods in the API. These are attached dynamically from the runtime metadata.
All calls inside the namespace, is denoted by section.method and may take an optional query parameter. As an example, api.query.timestamp.now() (current block timestamp) does not take parameters, while api.query.system.account(<accountId>) (retrieving the associated nonce & balances for an account), takes the AccountId as a parameter.
Allows for the querying of multiple storage entries and the combination thereof into a single result. This is a very optimal way to make multiple queries since it only makes a single connection to the node and retrieves the data over one subscription.
const unsub = await api.queryMulti(
[
// you can include the storage without any parameters
api.query.balances.totalIssuance,
// or you can pass parameters to the storage query
[api.query.system.account, '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY']
],
([existential, [, { free }]]) => {
console.log(`You have ${free.sub(existential)} more than the existential deposit`);
unsub();
}
);
Contains all the raw rpc sections and their subsequent methods in the API as defined by the jsonrpc interface definitions. Unlike the dynamic api.query and api.tx sections, these methods are fixed (although extensible with node upgrades) and not determined by the runtime.
RPC endpoints available here allow for the query of chain, node and system information, in addition to providing interfaces for the raw queries of state (using known keys) and the submission of transactions.
true if the API decorate multi-key queries
Protected_Optionaladditional: DefinitionsCallProtected_OptionalblockHash: Uint8ArrayProtected_Protected_Protected_Protected_Protected_Protected_Protected_Protected_Protected_Protected_OptionalblockHash: Uint8ArrayProtected_Protected_Protected_Protected_Protected_Protected_Protected_Protected_Protected_ProtectedemitOptionalfromEmpty: booleanOptionalregistry: RegistryThe type of event the callback was attached to. Available events are connected, disconnected, ready and error
The callback to unregister.
The type of event to listen to. Available events are connected, disconnected, ready and error
The callback to be called when the event fires. Depending on the event type, it could fire with additional arguments.
The type of event to listen to. Available events are connected, disconnected, ready and error
The callback to be called when the event fires. Depending on the event type, it could fire with additional arguments.
StaticcreateOptionaloptions: ApiOptions
options that is passed to the class constructor. Can be either [[ApiOptions]] or [[WsProvider]]
@pezkuwi/api/rx
Overview
Name
ApiRx
Description
ApiRx is a powerful RxJS Observable wrapper around the RPC and interfaces on the Pezkuwi network. As a full Observable API, all interface calls return RxJS Observables, including the static
.create(...). In the same fashion and subscription-based methods return long-running Observables that update with the latest values.The API is well suited to real-time applications where the latest state is needed, unlocking the subscription-based features of Pezkuwi (and Bizinikiwi) clients. Some familiarity with RxJS is a requirement to use the API, however just understanding
.subscribeand.pipeon Observables will unlock full-scale use thereof.See
[[ApiPromise]]
Usage
Making rpc calls -
Subscribing to chain state -
Submitting a transaction -