Update metadata to latest (#708)

This commit is contained in:
Jaco Greeff
2019-02-17 07:53:28 +01:00
committed by GitHub
parent 774bb127bc
commit 9a56f1b5ec
7 changed files with 304 additions and 22 deletions
+12
View File
@@ -0,0 +1,12 @@
# metadata update
1. New branch :)
2. `curl -H "Content-Type: application/json" -d '{"id":1, "jsonrpc":"2.0", "method": "state_getMetadata", "params":[]}' http://localhost:9933`
3. Copy the result (hex-only) into `tstaic.ts`, as of now linked to `v1/static.ts`
4. Rust Metadata tests, `yarn run test packages/types/src/Metadata`
5. Add new class types as required (find missing in Rust code, add)
6. Add all classes to `index.classes.ts`
7. Repeat 4-6 until passing
8. Update parsed JSON to actual output version, `v1/latest.*.json`
9. All tests
10. Make PR
@@ -28,6 +28,15 @@
"fallback": "0x00",
"docs": []
},
{
"name": "AllExtrinsicsLen",
"modifier": "Optional",
"type": {
"PlainType": "u32"
},
"fallback": "0x00",
"docs": []
},
{
"name": "BlockHash",
"modifier": "Default",
@@ -324,7 +333,10 @@
"AccountIndex"
],
"docs": [
" A new account was created."
" A new account index was assigned.",
"",
" This event is not triggered when an existing index is reassigned",
" to another `AccountId`."
]
}
]
@@ -377,6 +389,20 @@
" The fee required to create an account. At least as big as ReclaimRebate."
]
},
{
"name": "Vesting",
"modifier": "Optional",
"type": {
"MapType": {
"key": "AccountId",
"value": "VestingSchedule"
}
},
"fallback": "0x00",
"docs": [
" Information regarding the vesting of a given account."
]
},
{
"name": "FreeBalance",
"modifier": "Default",
@@ -845,7 +871,7 @@
"name": "CurrentSessionReward",
"modifier": "Default",
"type": {
"PlainType": "Balance"
"PlainType": "BalanceOf"
},
"fallback": "0x00000000000000000000000000000000",
"docs": [
@@ -856,7 +882,7 @@
"name": "CurrentOfflineSlash",
"modifier": "Default",
"type": {
"PlainType": "Balance"
"PlainType": "BalanceOf"
},
"fallback": "0x00000000000000000000000000000000",
"docs": [
@@ -889,7 +915,7 @@
"name": "StakeRange",
"modifier": "Default",
"type": {
"PlainType": "(Balance,Balance)"
"PlainType": "(BalanceOf,BalanceOf)"
},
"fallback": "0x0000000000000000000000000000000000000000000000000000000000000000",
"docs": [
@@ -934,6 +960,17 @@
"docs": [
" We are forcing a new era."
]
},
{
"name": "RecentlyOffline",
"modifier": "Default",
"type": {
"PlainType": "Vec<(AccountId,BlockNumber,u32)>"
},
"fallback": "0x00",
"docs": [
" Most recent `RECENT_OFFLINE_COUNT` instances. (who it was, when it was reported, how many instances they were offline for)."
]
}
],
"calls": [
@@ -1140,7 +1177,7 @@
"type": {
"MapType": {
"key": "PropIndex",
"value": "(Balance,Vec<AccountId>)"
"value": "(BalanceOf,Vec<AccountId>)"
}
},
"fallback": "0x00",
@@ -1163,7 +1200,7 @@
"name": "MinimumDeposit",
"modifier": "Default",
"type": {
"PlainType": "Balance"
"PlainType": "BalanceOf"
},
"fallback": "0x00000000000000000000000000000000",
"docs": [
@@ -1308,7 +1345,7 @@
},
{
"name": "value",
"type": "Compact<Balance>"
"type": "Compact<BalanceOf>"
}
],
"docs": [
@@ -1394,6 +1431,14 @@
}
],
"events": [
{
"name": "Proposed",
"args": [
"PropIndex",
"Balance"
],
"docs": []
},
{
"name": "Tabled",
"args": [
@@ -1450,7 +1495,7 @@
"name": "CandidacyBond",
"modifier": "Default",
"type": {
"PlainType": "Balance"
"PlainType": "BalanceOf"
},
"fallback": "0x09000000000000000000000000000000",
"docs": [
@@ -1461,7 +1506,7 @@
"name": "VotingBond",
"modifier": "Default",
"type": {
"PlainType": "Balance"
"PlainType": "BalanceOf"
},
"fallback": "0x00000000000000000000000000000000",
"docs": [
@@ -1472,7 +1517,7 @@
"name": "PresentSlashPerVoter",
"modifier": "Default",
"type": {
"PlainType": "Balance"
"PlainType": "BalanceOf"
},
"fallback": "0x01000000000000000000000000000000",
"docs": [
@@ -1661,7 +1706,7 @@
"name": "SnapshotedStakes",
"modifier": "Default",
"type": {
"PlainType": "Vec<Balance>"
"PlainType": "Vec<BalanceOf>"
},
"fallback": "0x00",
"docs": [
@@ -1672,7 +1717,7 @@
"name": "Leaderboard",
"modifier": "Optional",
"type": {
"PlainType": "Vec<(Balance,AccountId)>"
"PlainType": "Vec<(BalanceOf,AccountId)>"
},
"fallback": "0x00",
"docs": [
@@ -1761,7 +1806,7 @@
},
{
"name": "total",
"type": "Compact<Balance>"
"type": "Compact<BalanceOf>"
},
{
"name": "index",
@@ -2252,7 +2297,7 @@
"name": "ProposalBondMinimum",
"modifier": "Default",
"type": {
"PlainType": "Balance"
"PlainType": "BalanceOf"
},
"fallback": "0x00000000000000000000000000000000",
"docs": [
@@ -2285,7 +2330,7 @@
"name": "Pot",
"modifier": "Default",
"type": {
"PlainType": "Balance"
"PlainType": "BalanceOf"
},
"fallback": "0x00000000000000000000000000000000",
"docs": [
@@ -2335,7 +2380,7 @@
"args": [
{
"name": "value",
"type": "Compact<Balance>"
"type": "Compact<BalanceOf>"
},
{
"name": "beneficiary",
@@ -2353,7 +2398,7 @@
"args": [
{
"name": "new_pot",
"type": "Compact<Balance>"
"type": "Compact<BalanceOf>"
}
],
"docs": [
@@ -2369,7 +2414,7 @@
},
{
"name": "proposal_bond_minimum",
"type": "Compact<Balance>"
"type": "Compact<BalanceOf>"
},
{
"name": "spend_period",
@@ -2462,8 +2507,139 @@
},
{
"name": "contract",
"prefix": "",
"storage": null,
"prefix": "Contract",
"storage": [
{
"name": "ContractFee",
"modifier": "Default",
"type": {
"PlainType": "Balance"
},
"fallback": "0x15000000000000000000000000000000",
"docs": [
" The fee required to create a contract. At least as big as staking's ReclaimRebate."
]
},
{
"name": "CallBaseFee",
"modifier": "Default",
"type": {
"PlainType": "Gas"
},
"fallback": "0x8700000000000000",
"docs": [
" The fee charged for a call into a contract."
]
},
{
"name": "CreateBaseFee",
"modifier": "Default",
"type": {
"PlainType": "Gas"
},
"fallback": "0xaf00000000000000",
"docs": [
" The fee charged for a create of a contract."
]
},
{
"name": "GasPrice",
"modifier": "Default",
"type": {
"PlainType": "Balance"
},
"fallback": "0x01000000000000000000000000000000",
"docs": [
" The price of one unit of gas."
]
},
{
"name": "MaxDepth",
"modifier": "Default",
"type": {
"PlainType": "u32"
},
"fallback": "0x64000000",
"docs": [
" The maximum nesting level of a call/create stack."
]
},
{
"name": "BlockGasLimit",
"modifier": "Default",
"type": {
"PlainType": "Gas"
},
"fallback": "0x40420f0000000000",
"docs": [
" The maximum amount of gas that could be expended per block."
]
},
{
"name": "GasSpent",
"modifier": "Default",
"type": {
"PlainType": "Gas"
},
"fallback": "0x0000000000000000",
"docs": [
" Gas spent so far in this block."
]
},
{
"name": "CurrentSchedule",
"modifier": "Default",
"type": {
"PlainType": "Schedule"
},
"fallback": "0x000000000100000000000000010000000000000001000000000000000100000000000000010000000000000001000000000000000000010010000000",
"docs": [
" Current cost schedule for contracts."
]
},
{
"name": "CodeHashOf",
"modifier": "Optional",
"type": {
"MapType": {
"key": "AccountId",
"value": "CodeHash"
}
},
"fallback": "0x00",
"docs": [
" The code associated with a given account."
]
},
{
"name": "PristineCode",
"modifier": "Optional",
"type": {
"MapType": {
"key": "CodeHash",
"value": "Bytes"
}
},
"fallback": "0x00",
"docs": [
" A mapping from an original code hash to the original code, untouched by instrumentation."
]
},
{
"name": "CodeStorage",
"modifier": "Optional",
"type": {
"MapType": {
"key": "CodeHash",
"value": "PrefabWasmModule"
}
},
"fallback": "0x00",
"docs": [
" A mapping between an original code hash and instrumented wasm code, ready for the execution."
]
}
],
"calls": [
{
"name": "update_schedule",
File diff suppressed because one or more lines are too long
+57
View File
@@ -0,0 +1,57 @@
// Copyright 2017-2019 @polkadot/types authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import Compact from './codec/Compact';
import Option from './codec/Option';
import Struct from './codec/Struct';
import Bytes from './Bytes';
import Null from './Null';
import U32 from './U32';
class PrefabWasmModuleReserved extends Option<Null> {
}
/**
* @name PrefabWasmModule
* @description Struct to encode the vesting schedule of an individual account
*/
export default class PrefabWasmModule extends Struct {
constructor (value?: any) {
super({
scheduleVersion: Compact.with(U32),
initial: Compact.with(U32),
maximum: Compact.with(U32),
_reserved: PrefabWasmModuleReserved,
code: Bytes
}, value);
}
/**
* @description The code as [[Bytes]]
*/
get code (): Bytes {
return this.get('code') as Bytes;
}
/**
* @description The initial as [[Compact]]
*/
get initial (): Compact {
return this.get('initial') as Compact;
}
/**
* @description The maximum as [[Compact]]
*/
get maximum (): Compact {
return this.get('maximum') as Compact;
}
/**
* @description The scheduleVersion value as [[Compact]]
*/
get scheduleVersion (): Compact {
return this.get('scheduleVersion') as Compact;
}
}
+3 -1
View File
@@ -202,7 +202,9 @@ export default class Type extends Text {
// replace <Lookup as StaticLookup>
.replace(/<LookupasStaticLookup>/g, 'Lookup')
// replace `<...>::Type`
.replace(/::Type/g, '');
.replace(/::Type/g, '')
// replace `wasm::*` eg. `wasm::PrefabWasmModule`
.replace(/wasm::/g, '');
};
}
+33
View File
@@ -0,0 +1,33 @@
// Copyright 2017-2019 @polkadot/types authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import Struct from './codec/Struct';
import Balance from './Balance';
/**
* @name VestingSchedule
* @description Struct to encode the vesting schedule of an individual account
*/
export default class VestingSchedule extends Struct {
constructor (value?: any) {
super({
offset: Balance,
perBlock: Balance
}, value);
}
/**
* @description The offset as [[Balance]]
*/
get offset (): Balance {
return this.get('offset') as Balance;
}
/**
* @description The perBlock value as [[Balance]]
*/
get perBlock (): Balance {
return this.get('perBlock') as Balance;
}
}
+2
View File
@@ -64,6 +64,7 @@ export { default as PeerInfo } from './PeerInfo';
export { default as PendingExtrinsics } from './PendingExtrinsics';
export { default as Permill } from './Permill';
export { default as Perbill } from './Perbill';
export { default as PrefabWasmModule } from './PrefabWasmModule';
export { default as PropIndex } from './PropIndex';
export { default as Proposal } from './Proposal';
export { default as ProposalIndex } from './ProposalIndex';
@@ -90,6 +91,7 @@ export { default as u128 } from './U128';
export { default as u256 } from './U256';
export { default as usize } from './USize';
export { default as ValidatorPrefs } from './ValidatorPrefs';
export { default as VestingSchedule } from './VestingSchedule';
export { default as Vote } from './Vote';
export { default as VoteThreshold } from './VoteThreshold';
export { default as VoteIndex } from './VoteIndex';