Add session.noteOffline extrinsic (#140)
* Add session.noteOffline extrinsic * Remove extra debug logging
This commit is contained in:
@@ -60,7 +60,7 @@ describe.skip('e2e', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('retrieves a block by hash', () => {
|
||||
it('retrieves a block by hash (krumme lanke #1)', () => {
|
||||
return api.chain
|
||||
.getBlock('0x627847bffdf5f3e01ac440d057dec6a37a12a6f329db7ef8367665574b76b5df')
|
||||
.then((block) => {
|
||||
@@ -73,7 +73,20 @@ describe.skip('e2e', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it.skip('retrieves the pending extrinsics', () => {
|
||||
it('retrieves a block by hash (krumme lanke #2)', () => {
|
||||
return api.chain
|
||||
.getBlock('0x53416d53a4b1dfcae9165a89d193608e4aa770414f02267f5b2c4015a2e66091')
|
||||
.then((block) => {
|
||||
expect(block).toBeDefined();
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
|
||||
throw error;
|
||||
});
|
||||
});
|
||||
|
||||
it('retrieves the pending extrinsics', () => {
|
||||
return api.author
|
||||
.pendingExtrinsics()
|
||||
.then((extrinsics) => {
|
||||
|
||||
@@ -8,6 +8,20 @@ import { Extrinsics, Extrinsic$Sections } from './types';
|
||||
import param from '@polkadot/params/param';
|
||||
import createSection from '@polkadot/params/section';
|
||||
|
||||
const forceNewSession: CreateItemOptions = {
|
||||
description: 'Force new session',
|
||||
params: [],
|
||||
type: []
|
||||
};
|
||||
|
||||
const noteOffline: CreateItemOptions = {
|
||||
description: 'Indicate offline validators',
|
||||
params: [
|
||||
param('indexes', ['u32'])
|
||||
],
|
||||
type: []
|
||||
};
|
||||
|
||||
const setKey: CreateItemOptions = {
|
||||
description: 'Set session key',
|
||||
params: [
|
||||
@@ -24,18 +38,14 @@ const setLength: CreateItemOptions = {
|
||||
type: []
|
||||
};
|
||||
|
||||
const forceNewSession: CreateItemOptions = {
|
||||
description: 'Force new session',
|
||||
params: [],
|
||||
type: []
|
||||
};
|
||||
|
||||
export default (name: Extrinsic$Sections, index: number): Section<Extrinsics, any, any> =>
|
||||
createSection(name, index)((createMethod: CreateItems<Extrinsics>) => ({
|
||||
description: 'Session',
|
||||
public: {
|
||||
setKey:
|
||||
createMethod('setKey', 0)(setKey)
|
||||
createMethod('setKey', 0)(setKey),
|
||||
noteOffline:
|
||||
createMethod('noteOffline', 1)(noteOffline)
|
||||
},
|
||||
private: {
|
||||
setLength:
|
||||
|
||||
@@ -24,19 +24,19 @@ export default function call (decode: Decoder, input: Uint8Array | null | undefi
|
||||
} as Param$Decoded;
|
||||
}
|
||||
|
||||
const section: Section<Extrinsics, any, any> | undefined = Object.values(extrinsics).find(({ index }) =>
|
||||
const _section: Section<Extrinsics, any, any> | undefined = Object.values(extrinsics).find(({ index }) =>
|
||||
index[0] === input[0]
|
||||
);
|
||||
|
||||
assert(!isUndefined(section), `Unable to find extrinsic section ${input[0]}`);
|
||||
assert(!isUndefined(_section), `Unable to find extrinsic section ${input[0]}`);
|
||||
|
||||
// @ts-ignore checked above
|
||||
const section = _section as Section<Extrinsics, any, any>;
|
||||
const methods = section[isPublic ? 'public' : 'private'];
|
||||
const extrinsic = Object.values(methods).find(({ index }) =>
|
||||
index[1] === input[1]
|
||||
);
|
||||
|
||||
assert(!isUndefined(extrinsic), `Unable to find method ${input[1]}`);
|
||||
assert(!isUndefined(extrinsic), `Unable to find method ${input[1]} for section '${section.name}'`);
|
||||
|
||||
// @ts-ignore checked above
|
||||
const params = extrinsic.params;
|
||||
|
||||
Reference in New Issue
Block a user