Fix struct keys, log additional decoding error info (#872)
* Re-create test cases for failures * Fix cloberring of keys * Add logging to pinpoint decoding failures
This commit is contained in:
@@ -8,48 +8,97 @@ import WsProvider from '../../../rpc-provider/src/ws';
|
||||
describe.skip('alex queries', () => {
|
||||
let api;
|
||||
|
||||
beforeAll(async () => {
|
||||
api = await Api.create({
|
||||
provider: new WsProvider('wss://poc3-rpc.polkadot.io/')
|
||||
});
|
||||
|
||||
return api;
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
jest.setTimeout(3000000);
|
||||
});
|
||||
|
||||
it('retrieves the list of validators', (done) => {
|
||||
api.query.staking.validators((res) => {
|
||||
console.log('api.query.staking.validators():', res.toJSON());
|
||||
describe.skip('Remote RPC queries', () => {
|
||||
beforeAll(async () => {
|
||||
api = await Api.create({
|
||||
provider: new WsProvider('wss://poc3-rpc.polkadot.io/')
|
||||
});
|
||||
|
||||
done();
|
||||
return api;
|
||||
});
|
||||
|
||||
it('retrieves the list of validators', (done) => {
|
||||
api.query.staking.validators((res) => {
|
||||
console.log('api.query.staking.validators():', res.toJSON());
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('retrieves a single value', (done) => {
|
||||
api.query.staking.validators('5EF7wdkP9XZq38fu2ioAvxoEhHUJUc1E2KbuSQSMGofRKhCL', (res) => {
|
||||
console.log('api.query.staking.validators(id):', res.toJSON());
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('derives a list of the controllers', (done) => {
|
||||
api.derive.staking.controllers((res) => {
|
||||
console.log('api.derive.staking.controllers:', JSON.stringify(res));
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it.skip('retrieves the list of nominators', (done) => {
|
||||
let count = 0;
|
||||
api.query.staking.nominators((res) => {
|
||||
console.log(`[${++count}]:: nominators(${res[0].length}):`, res.toJSON());
|
||||
|
||||
// done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('retrieves a single value', (done) => {
|
||||
api.query.staking.validators('5EF7wdkP9XZq38fu2ioAvxoEhHUJUc1E2KbuSQSMGofRKhCL', (res) => {
|
||||
console.log('api.query.staking.validators(id):', res.toJSON());
|
||||
describe.skip('Local archive queries (for debug)', () => {
|
||||
beforeAll(async () => {
|
||||
api = await Api.create();
|
||||
|
||||
return api;
|
||||
});
|
||||
|
||||
// https://github.com/polkadot-js/api/issues/845
|
||||
it('retrieves block with no issues', async () => {
|
||||
const metadata = await api.rpc.state.getMetadata('0x6f6f9bba0eed8e3ae9446c37eee763f93118b52a315a7b46090453ba6288da1f');
|
||||
|
||||
console.error(JSON.stringify(metadata, null, 2));
|
||||
|
||||
const block = await api.rpc.chain.getBlock('0x6f6f9bba0eed8e3ae9446c37eee763f93118b52a315a7b46090453ba6288da1f')
|
||||
|
||||
console.error(block);
|
||||
|
||||
expect(block).toBeDefined();
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
// https://github.com/polkadot-js/api/issues/846
|
||||
it('handles toJSON with no issues', async (done) => {
|
||||
const signedBlock = await api.rpc.chain.getBlock('0x85c62b581f38cb81c3e443d34392672beb1fb877017fd7237cc87704113259dc');
|
||||
const failed = signedBlock.block.extrinsics.filter((extrinsic) => {
|
||||
try {
|
||||
const json = extrinsic.method.toJSON();
|
||||
|
||||
console.error(json);
|
||||
|
||||
return false;
|
||||
} catch (error) {
|
||||
console.log(extrinsic.method);
|
||||
console.log(extrinsic.method.keys());
|
||||
console.error(error);
|
||||
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
expect(failed).toHaveLength(0);
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('derives a list of the controllers', (done) => {
|
||||
api.derive.staking.controllers((res) => {
|
||||
console.log('api.derive.staking.controllers:', JSON.stringify(res));
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it.skip('retrieves the list of nominators', (done) => {
|
||||
let count = 0;
|
||||
api.query.staking.nominators((res) => {
|
||||
console.log(`[${++count}]:: nominators(${res[0].length}):`, res.toJSON());
|
||||
|
||||
// done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user