Missing staking methods (slashing, propsal missed, setBalance) (#143)

This commit is contained in:
Jaco Greeff
2018-09-04 09:57:24 +02:00
committed by GitHub
parent 87273e56d9
commit 0b61aded8f
10 changed files with 86 additions and 42 deletions
+2 -2
View File
@@ -32,7 +32,7 @@
"@babel/runtime": "^7.0.0-rc.1",
"@polkadot/jsonrpc": "^0.28.24",
"@polkadot/primitives": "^0.28.24",
"@polkadot/util": "^0.28.21",
"@polkadot/util-keyring": "^0.28.21"
"@polkadot/util": "^0.29.18",
"@polkadot/util-keyring": "^0.29.18"
}
}
+3 -3
View File
@@ -35,9 +35,9 @@
"dependencies": {
"@babel/runtime": "^7.0.0-rc.1",
"@polkadot/storage": "^0.28.24",
"@polkadot/util": "^0.28.21",
"@polkadot/util-crypto": "^0.28.21",
"@polkadot/util-keyring": "^0.28.21",
"@polkadot/util": "^0.29.18",
"@polkadot/util-crypto": "^0.29.18",
"@polkadot/util-keyring": "^0.29.18",
"@types/nock": "^9.1.3",
"eventemitter3": "^3.1.0",
"isomorphic-fetch": "^2.2.1",
+1 -1
View File
@@ -34,6 +34,6 @@
"@polkadot/api-provider": "^0.28.24",
"@polkadot/jsonrpc": "^0.28.24",
"@polkadot/params": "^0.28.24",
"@polkadot/util": "^0.28.21"
"@polkadot/util": "^0.29.18"
}
}
+1 -1
View File
@@ -13,6 +13,6 @@
"@babel/runtime": "^7.0.0-rc.1",
"@polkadot/params": "^0.28.24",
"@polkadot/primitives": "^0.28.24",
"@polkadot/util": "^0.28.21"
"@polkadot/util": "^0.29.18"
}
}
+46 -2
View File
@@ -47,6 +47,24 @@ const unstake: CreateItemOptions = {
type: []
};
const registerSlashPreference: CreateItemOptions = {
description: 'Preference for slashing',
params: [
param('intentionIndex', 'u32'),
// FIXME This is actually a 'SlashPreference' struct (for now only a single value)
param('unstakeThreshold', 'u32')
],
type: []
};
const noteMissedProposal: CreateItemOptions = {
description: 'Indicate that a proposal has been missed',
params: [
param('offlineValIndices', ['u32'])
],
type: []
};
const setSessionsPerEra: CreateItemOptions = {
description: 'Set sessions per era',
params: [
@@ -77,6 +95,24 @@ const forceNewEra: CreateItemOptions = {
type: []
};
const setOfflineSlashGrace: CreateItemOptions = {
description: 'Sets the offline grace period before slashing',
params: [
param('value', 'u32')
],
type: []
};
const setBalance: CreateItemOptions = {
description: 'Sets the balance for an account',
params: [
param('who', 'AccountId'),
param('free', 'Balance'),
param('reserved', 'Balance')
],
type: []
};
export default (name: Extrinsic$Sections, index: number): Section<Extrinsics, any, any> =>
createSection(name, index)((createMethod: CreateItems<Extrinsics>) => ({
description: 'Staking',
@@ -90,7 +126,11 @@ export default (name: Extrinsic$Sections, index: number): Section<Extrinsics, an
nominate:
createMethod('nominate', 3)(nominate),
unnominate:
createMethod('unnominate', 4)(unnominate)
createMethod('unnominate', 4)(unnominate),
registerSlashPreference:
createMethod('registerSlashPreference', 5)(registerSlashPreference),
noteMissedProposal:
createMethod('noteMissedProposal', 6)(noteMissedProposal)
},
private: {
setSessionsPerEra:
@@ -100,6 +140,10 @@ export default (name: Extrinsic$Sections, index: number): Section<Extrinsics, an
setValidatorCount:
createMethod('setValidatorCount', 2)(setValidatorCount),
forceNewEra:
createMethod('forceNewEra', 3)(forceNewEra)
createMethod('forceNewEra', 3)(forceNewEra),
setOfflineSlashGrace:
createMethod('setOfflineSlashGrace', 4)(setOfflineSlashGrace),
setBalance:
createMethod('setBalance', 5)(setBalance)
}
}));
+2 -2
View File
@@ -32,7 +32,7 @@
"@polkadot/extrinsics": "^0.28.24",
"@polkadot/params": "^0.28.24",
"@polkadot/primitives": "^0.28.24",
"@polkadot/util": "^0.28.21",
"@polkadot/util-keyring": "^0.28.21"
"@polkadot/util": "^0.29.18",
"@polkadot/util-keyring": "^0.29.18"
}
}
+2 -2
View File
@@ -29,8 +29,8 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/type-primitives#readme",
"dependencies": {
"@babel/runtime": "^7.0.0-rc.1",
"@polkadot/trie-hash": "^0.28.21",
"@polkadot/util": "^0.28.21"
"@polkadot/trie-hash": "^0.29.18",
"@polkadot/util": "^0.29.18"
},
"devDependencies": {
"bn.js": "^4.11.8"
+3 -3
View File
@@ -32,8 +32,8 @@
"@babel/runtime": "^7.0.0-rc.1",
"@polkadot/params": "^0.28.24",
"@polkadot/primitives": "^0.28.24",
"@polkadot/util": "^0.28.21",
"@polkadot/util-crypto": "^0.28.21",
"@polkadot/util-keyring": "^0.28.21"
"@polkadot/util": "^0.29.18",
"@polkadot/util-crypto": "^0.29.18",
"@polkadot/util-keyring": "^0.29.18"
}
}