Remove struct map naming overrides (#918)
This commit is contained in:
committed by
Amaury Martiny
parent
86a8011c65
commit
bafda6dc93
@@ -1,39 +0,0 @@
|
||||
{
|
||||
"jsonrpc": "2.0",
|
||||
"result": {
|
||||
"apis": [
|
||||
[
|
||||
[
|
||||
105,
|
||||
110,
|
||||
104,
|
||||
101,
|
||||
114,
|
||||
101,
|
||||
110,
|
||||
116
|
||||
],
|
||||
1
|
||||
],
|
||||
[
|
||||
[
|
||||
118,
|
||||
97,
|
||||
108,
|
||||
105,
|
||||
100,
|
||||
97,
|
||||
116,
|
||||
120
|
||||
],
|
||||
1
|
||||
]
|
||||
],
|
||||
"authoring_version": 1,
|
||||
"impl_name": "substrate-node",
|
||||
"impl_version": 0,
|
||||
"spec_name": "node",
|
||||
"spec_version": 1
|
||||
},
|
||||
"id": 1
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"jsonrpc": "2.0",
|
||||
"result": {
|
||||
"apis": [
|
||||
[
|
||||
"0xdf6acb689907609b",
|
||||
2
|
||||
],
|
||||
[
|
||||
"0x37e397fc7c91f5e4",
|
||||
1
|
||||
],
|
||||
[
|
||||
"0x40fe3ad401f8959a",
|
||||
3
|
||||
],
|
||||
[
|
||||
"0xd2bc9897eed08f15",
|
||||
1
|
||||
],
|
||||
[
|
||||
"0xf78b278be53f454c",
|
||||
1
|
||||
],
|
||||
[
|
||||
"0xed99c5acb25eedf5",
|
||||
2
|
||||
],
|
||||
[
|
||||
"0xdd718d5cc53262d4",
|
||||
1
|
||||
],
|
||||
[
|
||||
"0x7801759919ee83e5",
|
||||
1
|
||||
]
|
||||
],
|
||||
"authoringVersion": 10,
|
||||
"implName": "substrate-node",
|
||||
"implVersion": 60,
|
||||
"specName": "node",
|
||||
"specVersion": 60
|
||||
},
|
||||
"id": 21
|
||||
}
|
||||
@@ -6,11 +6,6 @@ import Struct from '../codec/Struct';
|
||||
import Bool from '../primitive/Bool';
|
||||
import USize from '../primitive/USize';
|
||||
|
||||
const JSON_MAP = new Map([
|
||||
['isSyncing', 'is_syncing'],
|
||||
['shouldHavePeers', 'should_have_peers']
|
||||
]);
|
||||
|
||||
/**
|
||||
* @name Health
|
||||
* @description
|
||||
@@ -22,7 +17,7 @@ export default class Health extends Struct {
|
||||
peers: USize,
|
||||
isSyncing: Bool,
|
||||
shouldHavePeers: Bool
|
||||
}, value, JSON_MAP);
|
||||
}, value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -8,13 +8,6 @@ import U32 from '../primitive/U32';
|
||||
import Hash from '../primitive/Hash';
|
||||
import BlockNumber from '../type/BlockNumber';
|
||||
|
||||
const JSON_MAP = new Map([
|
||||
['bestHash', 'best_hash'],
|
||||
['bestNumber', 'best_number'],
|
||||
['protocolVersion', 'protocol_version'],
|
||||
['peerId', 'peer_id']
|
||||
]);
|
||||
|
||||
/**
|
||||
* @name PeerInfo
|
||||
* @description
|
||||
@@ -28,7 +21,7 @@ export default class PeerInfo extends Struct {
|
||||
protocolVersion: U32,
|
||||
bestHash: Hash,
|
||||
bestNumber: BlockNumber
|
||||
}, value, JSON_MAP);
|
||||
}, value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,30 +2,30 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import rpc from '../json/RuntimeVersion.001.json';
|
||||
import rpc from '../json/RuntimeVersion.002.json';
|
||||
import RuntimeVersion from './RuntimeVersion';
|
||||
|
||||
describe('RuntimeVersion', () => {
|
||||
const version = new RuntimeVersion(rpc.result);
|
||||
|
||||
it('has the correct authoring', () => {
|
||||
expect(version.authoringVersion.toNumber()).toEqual(1);
|
||||
expect(version.authoringVersion.toNumber()).toEqual(10);
|
||||
});
|
||||
|
||||
it('has the apis', () => {
|
||||
const api = version.apis[0];
|
||||
|
||||
expect(api.id.toHex()).toEqual('0x696e686572656e74');
|
||||
expect(api.version.toNumber()).toEqual(1);
|
||||
expect(api.id.toHex()).toEqual('0xdf6acb689907609b');
|
||||
expect(api.version.toNumber()).toEqual(2);
|
||||
});
|
||||
|
||||
it('has the correct implementation', () => {
|
||||
expect(version.implName.toString()).toEqual('substrate-node');
|
||||
expect(version.implVersion.toNumber()).toEqual(0);
|
||||
expect(version.implVersion.toNumber()).toEqual(60);
|
||||
});
|
||||
|
||||
it('has the correct spec', () => {
|
||||
expect(version.specName.toString()).toEqual('node');
|
||||
expect(version.specVersion.toNumber()).toEqual(1);
|
||||
expect(version.specVersion.toNumber()).toEqual(60);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -78,13 +78,7 @@ export default class RuntimeVersion extends Struct implements RuntimeVersionInte
|
||||
specVersion: U32,
|
||||
implVersion: U32,
|
||||
apis: Vector.with(RuntimeVersionApi)
|
||||
}, value, new Map([
|
||||
['authoringVersion', 'authoring_version'],
|
||||
['implName', 'impl_name'],
|
||||
['implVersion', 'impl_version'],
|
||||
['specName', 'spec_name'],
|
||||
['specVersion', 'spec_version']
|
||||
]));
|
||||
}, value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -36,9 +36,7 @@ export class RhdJustification extends Struct {
|
||||
roundNumber: U32,
|
||||
hash: Hash,
|
||||
signatures: Vector.with(BftAuthoritySignature)
|
||||
}, value, new Map([
|
||||
['roundNumber', 'round_number']
|
||||
]));
|
||||
}, value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -55,10 +55,7 @@ export default class StoredPendingChange extends Struct {
|
||||
scheduledAt: BlockNumber,
|
||||
delay: BlockNumber,
|
||||
nextAuthorities: Vector.with(NextAuthority)
|
||||
}, value, new Map([
|
||||
['scheduledAt', 'scheduled_at'],
|
||||
['nextAuthorities', 'next_authorities']
|
||||
]));
|
||||
}, value);
|
||||
}
|
||||
|
||||
get delay (): BlockNumber {
|
||||
|
||||
Reference in New Issue
Block a user