Skip to content

Commit

Permalink
Update listen-events.ts: use cord.js instead of polks.js
Browse files Browse the repository at this point in the history
  • Loading branch information
adi-a11y authored Jun 20, 2024
1 parent 8b0a40f commit 7c2b974
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions demo/src/listen-events.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { ApiPromise, WsProvider } from '@polkadot/api'
import * as Cord from "@cord.network/sdk";

async function main() {
const networkAddress = process.env.NETWORK_ADDRESS
? process.env.NETWORK_ADDRESS
: 'ws://127.0.0.1:9944'
const provider = new WsProvider(networkAddress)
const api = await ApiPromise.create({ provider })
// const networkAddress = 'ws://127.0.0.1:9944'
Cord.ConfigService.set({ submitTxResolveOn: Cord.Chain.IS_IN_BLOCK })
await Cord.connect(networkAddress)

const api = Cord.ConfigService.get('api')

// Subscribe to system events
api.query.system.events((events) => {
Expand Down

0 comments on commit 7c2b974

Please sign in to comment.