Module

x/polkadot/rpc-provider/index.ts>WsProvider#subscribe

Package publishing for deno.land/x/polkadot
Go to Latest
method WsProvider.prototype.subscribe
import { WsProvider } from "https://dotland.deno.dev/x/polkadot@0.2.38/rpc-provider/index.ts";

Examples

const provider = new WsProvider('ws://127.0.0.1:9944');
const rpc = new Rpc(provider);

rpc.state.subscribeStorage([[storage.system.account, <Address>]], (_, values) => {
  console.log(values)
}).then((subscriptionId) => {
  console.log('balance changes subscription id: ', subscriptionId)
})

Parameters

type: string
method: string
params: unknown[]
callback: ProviderInterfaceCallback

Returns

Promise<number | string>