Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/polkadot/api/rx/Api.ts>ApiRx.create

Package publishing for deno.land/x/polkadot
Go to Latest
method ApiRx.create
import { ApiRx } from "https://deno.land/x/polkadot@0.2.29/api/rx/Api.ts";

Examples

import { switchMap } from 'https://esm.sh/rxjs@7.8.0';
import Api from 'https://deno.land/x/polkadot@0.2.29/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]]