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

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

Package publishing for deno.land/x/polkadot
Go to Latest
method WsProvider.prototype.subscribe
import { WsProvider } from "https://deno.land/x/polkadot@0.2.35/rpc-provider/mod.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>