Skip to main content
Module

x/polkadot/mod.ts>api.ApiRx.create

Package publishing for deno.land/x/polkadot
Go to Latest
method api.ApiRx.create
import { api } from "https://deno.land/x/polkadot@0.2.16/mod.ts";
const { ApiRx } = api;

Examples

import { switchMap } from 'https://esm.sh/rxjs@7.5.7';
import Api from 'https://deno.land/x/polkadot@0.2.16/api/rx/index.ts';

Api.create()
  .pipe(
    switchMap((api) =>
      api.rpc.chain.subscribeNewHeads()
  ))
  .subscribe((header) => {
    console.log(`new block #${header.number.toNumber()}`);
  });

Parameters

optional
options: ApiOptions

options that is passed to the class constructor. Can be either [[ApiOptions]] or [[WsProvider]]

Returns

Observable<ApiRx>