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

x/polkadot/api/bundle.ts>WsProvider#subscribe

Package publishing for deno.land/x/polkadot
Latest
method WsProvider.prototype.subscribe
import { WsProvider } from "https://deno.land/x/polkadot@0.2.45/api/bundle.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>