polkadot-js / api

Promise and RxJS APIs around Polkadot and Substrate based chains via RPC calls. It is dynamically generated based on what the Substrate runtime provides in terms of metadata.
Apache License 2.0
1.07k stars 349 forks source link

BUG: query.identity is undefined #5992

Open bizk opened 3 hours ago

bizk commented 3 hours ago

When using query.identity.identityof on typescript. Identity object will be undefined. I tried using older versions of the library 11.x and 12.x and also tried different rpc providers with no luck. Weird because before september this was working just fine.

I expect query.identity not being undefined.

bizk commented 3 hours ago

Btw here is some sample code to try it out:

  // Connect to the Polkadot network
  const provider = new WsProvider('wss://rpc.polkadot.io'); // You can use other endpoints if needed
  const api = await ApiPromise.create({ provider });

  // Fetch the identity information for the validator
  const { identity } = await api.query.identity.identityOf(validatorAddress);

  // Check if the identity exists
  if (identity && identity.display && identity.display.asRaw) {
    console.log(`Validator ${validatorAddress} has an identity: ${identity.display.asRaw.toString()}`);
  } else {
    console.log(`Validator ${validatorAddress} does not have an identity.`);
  }

  // Disconnect from the API
  await api.disconnect();
TarikGul commented 2 hours ago

This is because the identity pallet doesnt exist on Polkadot anymore.

All identity functionality has been moved to the People System Parachain