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 354 forks source link

`api.query.proxy.proxies` on some blocks doesn't work #5959

Open wliyongfeng opened 2 months ago

wliyongfeng commented 2 months ago

On block 11178419, proxy.proxies doesn't work. Please use following code to reproduce:

async function queryProxies(api, delegator, height) {
  const blockHash = await api.rpc.chain.getBlockHash(height);
  const blockApi = await api.at(blockHash);
  const proxies = await blockApi.query.proxy.proxies(delegator);

  console.log(proxies.toJSON());
}

(async () => {
  const api = await getApi(); // please construct an api by yourself
  const delegator = "1KvKReVmUiTc2LW2a4qyHsaJJ9eE9LRsywZkMk5hyBeyHgw";

  await queryProxies(api, delegator, 11178419);

  process.exit(0)
})();
TarikGul commented 2 weeks ago

rel: https://github.com/polkadot-js/api/issues/5974

Might just need the corrects types set in types-known.