KardiaChain JS SDK
  • Overview
  • Getting Started
  • Guides
    • Connecting to KardiaChain
      • Front-end
      • Back-end
    • Working with wallet
    • Sending your first transaction
    • Smart Contract: decentralize application
    • KRC20 tokens
    • KAI Chain module
    • Utilities
  • Reference
    • KardiaClient
    • Account
    • Transaction
    • KAI Chain
    • Smart contract
    • KRC20
    • Objects reference
Powered by GitBook
On this page

Was this helpful?

  1. Guides

KAI Chain module

Get events using filter

import KardiaClient from 'kardia-js-sdk';
import keccak256 from 'keccak256';

const RPC_ENDPOINT = 'YOUR_RPC_ENDPOINT';

const kardiaClient = new KardiaClient({ endpoint: RPC_ENDPOINT });
const kaiChain = kardiaClient.kaiChain;

const topic = keccak256('Transfer(address,address,uint256)');

const filterId = await kaiChain.newFilter({
      fromBlock: 200000,
      topics: [topic]
})

// To get all logs
const allLogs = await kaiChain.getFilterLogs(filterId);

// To get logs since last poll
const logs = await kaiChain.getFilterChanges(filterId);
PreviousKRC20 tokensNextUtilities

Last updated 4 years ago

Was this helpful?