0
// Import
import { ApiPromise, WsProvider } from "@polkadot/api";

// Construct
/*
https://rpc.kulupu.network
https://rpc.kulupu.network/ws
https://rpc.kulupu.corepaper.org
https://rpc.kulupu.corepaper.org/ws
*/

(async () => {
  //const wsProvider = new WsProvider('wss://rpc.polkadot.io');
  const wsProvider = new WsProvider("wss://rpc.kulupu.network/ws");
  const api = await ApiPromise.create({ provider: wsProvider });

  // Do something
  const chain = await api.rpc.system.chain();

  console.log(`You are connected to ${chain} !`);
  console.log(await api.query.difficulty.pastDifficultiesAndTimestamps.toJSON());

  console.log(api.genesisHash.toHex());
})();

4

1 に答える 1