Cater for key definitions rework (#1269)
* Keys structure update * Bump metadata, pull new keys * Update for latest * Update tests for new values * Polkador session keys override * Cleanup tests (browserlist adjustments) * Update metadata * Bump deps
This commit is contained in:
+1
-1
@@ -32,7 +32,7 @@
|
||||
"@babel/core": "^7.5.5",
|
||||
"@babel/register": "^7.5.5",
|
||||
"@babel/runtime": "^7.5.5",
|
||||
"@polkadot/dev": "^0.30.0-beta.24",
|
||||
"@polkadot/dev": "^0.30.0-beta.26",
|
||||
"@polkadot/ts": "^0.1.63",
|
||||
"gh-pages": "2.0.1"
|
||||
}
|
||||
|
||||
@@ -16,6 +16,6 @@ const consts = fromMetadata(metadata);
|
||||
describe('fromMetadata', (): void => {
|
||||
it('should return constants with the correct type and value', (): void => {
|
||||
expect(consts.democracy.cooloffPeriod).toBeInstanceOf(ClassOf('BlockNumber'));
|
||||
expect(consts.democracy.cooloffPeriod.eq(432000)).toBeTruthy();
|
||||
expect(consts.democracy.cooloffPeriod.toHex()).toEqual('0x0000000000062700');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -574,6 +574,14 @@ export default abstract class ApiBase<ApiType> {
|
||||
this._query = this.decorateStorage(storage, this.decorateMethod);
|
||||
this._consts = constants;
|
||||
|
||||
// NOTE The SessionKeys definition for Polkadot and Substrate (OpaqueKeys
|
||||
// implementation) are different. Detect Polkadot and inject the `Keys`
|
||||
// definition as applicable. (3 keys in substrate vs 4 in Polkadot). If
|
||||
// we have reflected metadata, this override becomes unneeded
|
||||
if (this._query.parachains) {
|
||||
getTypeRegistry().register({ Keys: 'SessionKeysPolkadot' });
|
||||
}
|
||||
|
||||
this._rx.extrinsicType = this._extrinsicType;
|
||||
this._rx.genesisHash = this._genesisHash;
|
||||
this._rx.runtimeVersion = this._runtimeVersion;
|
||||
|
||||
@@ -99,8 +99,9 @@ describeE2E({
|
||||
|
||||
describe('session Keys', (): void => {
|
||||
it('sets a session key, retrieves the value', async (done): Promise<void> => {
|
||||
const ed25519 = encodeAddress(randomAsU8a());
|
||||
const sr25519 = encodeAddress(randomAsU8a());
|
||||
const babe = encodeAddress(randomAsU8a());
|
||||
const grandpa = encodeAddress(randomAsU8a());
|
||||
const imOnline = encodeAddress(randomAsU8a());
|
||||
|
||||
async function queryKeys (): Promise<void> {
|
||||
console.error('*** query.session.nextKeys');
|
||||
@@ -112,9 +113,9 @@ describeE2E({
|
||||
)).toArray()
|
||||
);
|
||||
|
||||
console.error(result, [ed25519, sr25519]);
|
||||
console.error(result, [grandpa, babe, imOnline]);
|
||||
|
||||
expect(result).toEqual(JSON.stringify([ed25519, sr25519]));
|
||||
expect(result).toEqual(JSON.stringify([grandpa, babe, imOnline]));
|
||||
done();
|
||||
}
|
||||
|
||||
@@ -122,7 +123,7 @@ describeE2E({
|
||||
console.error('*** tx.session.setKeys');
|
||||
|
||||
await api.tx.session
|
||||
.setKeys({ ed25519, sr25519 }, new Uint8Array([]))
|
||||
.setKeys({ babe, grandpa, imOnline }, new Uint8Array([]))
|
||||
.signAndSend(keyring.eve, (result): void => {
|
||||
if (result.isCompleted) {
|
||||
queryKeys();
|
||||
|
||||
@@ -379,16 +379,38 @@
|
||||
" Next epoch randomness."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "SegmentIndex",
|
||||
"modifier": "Default",
|
||||
"type": {
|
||||
"PlainType": "u32"
|
||||
},
|
||||
"fallback": "0x00000000",
|
||||
"documentation": [
|
||||
" Randomness under construction.",
|
||||
"",
|
||||
" We make a tradeoff between storage accesses and list length.",
|
||||
" We store the under-construction randomness in segments of up to",
|
||||
" `UNDER_CONSTRUCTION_SEGMENT_LENGTH`.",
|
||||
"",
|
||||
" Once a segment reaches this length, we begin the next one.",
|
||||
" We reset all segments and return to `0` at the beginning of every",
|
||||
" epoch."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "UnderConstruction",
|
||||
"modifier": "Default",
|
||||
"type": {
|
||||
"PlainType": "[u8;32]"
|
||||
"MapType": {
|
||||
"hasher": "Blake2_256",
|
||||
"key": "u32",
|
||||
"value": "Vec<[u8;32]>",
|
||||
"isLinked": false
|
||||
}
|
||||
},
|
||||
"fallback": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"documentation": [
|
||||
" Randomness under construction."
|
||||
]
|
||||
"fallback": "0x00",
|
||||
"documentation": []
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -1911,35 +1933,6 @@
|
||||
" # </weight>"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "emergency_propose",
|
||||
"args": [
|
||||
{
|
||||
"name": "proposal",
|
||||
"type": "Proposal"
|
||||
},
|
||||
{
|
||||
"name": "threshold",
|
||||
"type": "VoteThreshold"
|
||||
},
|
||||
{
|
||||
"name": "voting_period",
|
||||
"type": "BlockNumber"
|
||||
},
|
||||
{
|
||||
"name": "delay",
|
||||
"type": "BlockNumber"
|
||||
}
|
||||
],
|
||||
"documentation": [
|
||||
" Schedule an emergency referendum.",
|
||||
"",
|
||||
" This will create a new referendum for the `proposal`, approved as long as counted votes",
|
||||
" exceed `threshold` and, if approved, enacted after the given `delay`.",
|
||||
"",
|
||||
" It may be called from either the Root or the Emergency origin."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "emergency_cancel",
|
||||
"args": [
|
||||
@@ -1976,11 +1969,30 @@
|
||||
],
|
||||
"documentation": [
|
||||
" Schedule a majority-carries referendum to be tabled next once it is legal to schedule",
|
||||
" an external referendum."
|
||||
" an external referendum.",
|
||||
"",
|
||||
" Unlike `external_propose`, blacklisting has no effect on this and it may replace a",
|
||||
" pre-scheduled `external_propose` call."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "external_push",
|
||||
"name": "external_propose_default",
|
||||
"args": [
|
||||
{
|
||||
"name": "proposal",
|
||||
"type": "Proposal"
|
||||
}
|
||||
],
|
||||
"documentation": [
|
||||
" Schedule a negative-turnout-bias referendum to be tabled next once it is legal to",
|
||||
" schedule an external referendum.",
|
||||
"",
|
||||
" Unlike `external_propose`, blacklisting has no effect on this and it may replace a",
|
||||
" pre-scheduled `external_propose` call."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "fast_track",
|
||||
"args": [
|
||||
{
|
||||
"name": "proposal_hash",
|
||||
@@ -2258,7 +2270,7 @@
|
||||
{
|
||||
"name": "CooloffPeriod",
|
||||
"type": "BlockNumber",
|
||||
"value": "0x8097060000000000",
|
||||
"value": "0x0027060000000000",
|
||||
"documentation": [
|
||||
" Period in blocks where an external proposal may not be re-submitted after being vetoed."
|
||||
]
|
||||
@@ -3277,6 +3289,128 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "TechnicalMembership",
|
||||
"storage": {
|
||||
"prefix": "Instance1Membership",
|
||||
"items": [
|
||||
{
|
||||
"name": "Members",
|
||||
"modifier": "Default",
|
||||
"type": {
|
||||
"PlainType": "Vec<AccountId>"
|
||||
},
|
||||
"fallback": "0x00",
|
||||
"documentation": [
|
||||
" The current membership, stored as an ordered Vec."
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"calls": [
|
||||
{
|
||||
"name": "add_member",
|
||||
"args": [
|
||||
{
|
||||
"name": "who",
|
||||
"type": "AccountId"
|
||||
}
|
||||
],
|
||||
"documentation": [
|
||||
" Add a member `who` to the set.",
|
||||
"",
|
||||
" May only be called from `AddOrigin` or root."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "remove_member",
|
||||
"args": [
|
||||
{
|
||||
"name": "who",
|
||||
"type": "AccountId"
|
||||
}
|
||||
],
|
||||
"documentation": [
|
||||
" Remove a member `who` from the set.",
|
||||
"",
|
||||
" May only be called from `RemoveOrigin` or root."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "swap_member",
|
||||
"args": [
|
||||
{
|
||||
"name": "remove",
|
||||
"type": "AccountId"
|
||||
},
|
||||
{
|
||||
"name": "add",
|
||||
"type": "AccountId"
|
||||
}
|
||||
],
|
||||
"documentation": [
|
||||
" Swap out one member `remove` for another `add`.",
|
||||
"",
|
||||
" May only be called from `SwapOrigin` or root."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "reset_members",
|
||||
"args": [
|
||||
{
|
||||
"name": "members",
|
||||
"type": "Vec<AccountId>"
|
||||
}
|
||||
],
|
||||
"documentation": [
|
||||
" Change the membership to a new set, disregarding the existing membership. Be nice and",
|
||||
" pass `members` pre-sorted.",
|
||||
"",
|
||||
" May only be called from `ResetOrigin` or root."
|
||||
]
|
||||
}
|
||||
],
|
||||
"events": [
|
||||
{
|
||||
"name": "MemberAdded",
|
||||
"args": [],
|
||||
"documentation": [
|
||||
" The given member was added; see the transaction for who."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "MemberRemoved",
|
||||
"args": [],
|
||||
"documentation": [
|
||||
" The given member was removed; see the transaction for who."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "MembersSwapped",
|
||||
"args": [],
|
||||
"documentation": [
|
||||
" Two members were swapped; see the transaction for who."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "MembersReset",
|
||||
"args": [],
|
||||
"documentation": [
|
||||
" The membership was reset; see the transaction for who the new set is."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Dummy",
|
||||
"args": [
|
||||
"PhantomData"
|
||||
],
|
||||
"documentation": [
|
||||
" Phantom member, never used."
|
||||
]
|
||||
}
|
||||
],
|
||||
"constants": []
|
||||
},
|
||||
{
|
||||
"name": "FinalityTracker",
|
||||
"storage": null,
|
||||
@@ -3824,35 +3958,6 @@
|
||||
" If contract is not evicted as a result of this call, no actions are taken and",
|
||||
" the sender is not eligible for the reward."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "restore_to",
|
||||
"args": [
|
||||
{
|
||||
"name": "dest",
|
||||
"type": "AccountId"
|
||||
},
|
||||
{
|
||||
"name": "code_hash",
|
||||
"type": "CodeHash"
|
||||
},
|
||||
{
|
||||
"name": "rent_allowance",
|
||||
"type": "BalanceOf"
|
||||
},
|
||||
{
|
||||
"name": "delta",
|
||||
"type": "Vec<ContractStorageKey>"
|
||||
}
|
||||
],
|
||||
"documentation": [
|
||||
" Allows a contract to restore a tombstone by giving its storage.",
|
||||
"",
|
||||
" The contract that wants to restore (i.e. origin of the call, or `msg.sender` in Solidity terms) will compute a",
|
||||
" tombstone with its storage and the given code_hash. If the computed tombstone",
|
||||
" match the destination one, the destination contract is restored with the rent_allowance` specified,",
|
||||
" while the origin sends all its funds to the destination and is removed."
|
||||
]
|
||||
}
|
||||
],
|
||||
"events": [
|
||||
@@ -4158,16 +4263,20 @@
|
||||
"PlainType": "BlockNumber"
|
||||
},
|
||||
"fallback": "0x0000000000000000",
|
||||
"documentation": []
|
||||
"documentation": [
|
||||
" The block number when we should gossip."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "LastNewEraStart",
|
||||
"modifier": "Optional",
|
||||
"name": "Keys",
|
||||
"modifier": "Default",
|
||||
"type": {
|
||||
"PlainType": "SessionIndex"
|
||||
"PlainType": "Vec<AuthorityId>"
|
||||
},
|
||||
"fallback": "0x00",
|
||||
"documentation": []
|
||||
"documentation": [
|
||||
" The current set of keys that may issue a heartbeat."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "ReceivedHeartbeats",
|
||||
@@ -4176,13 +4285,16 @@
|
||||
"DoubleMapType": {
|
||||
"hasher": "Blake2_256",
|
||||
"key1": "SessionIndex",
|
||||
"key2": "AuthorityId",
|
||||
"key2": "AuthIndex",
|
||||
"value": "Bytes",
|
||||
"key2Hasher": "Blake2_256"
|
||||
}
|
||||
},
|
||||
"fallback": "0x00",
|
||||
"documentation": []
|
||||
"documentation": [
|
||||
" For each session index we keep a mapping of `AuthorityId`",
|
||||
" to `offchain::OpaqueNetworkState`."
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -4196,7 +4308,7 @@
|
||||
},
|
||||
{
|
||||
"name": "_signature",
|
||||
"type": "Bytes"
|
||||
"type": "AuthoritySignature"
|
||||
}
|
||||
],
|
||||
"documentation": []
|
||||
@@ -4206,24 +4318,14 @@
|
||||
{
|
||||
"name": "HeartbeatReceived",
|
||||
"args": [
|
||||
"BlockNumber",
|
||||
"AuthorityId"
|
||||
],
|
||||
"documentation": [
|
||||
" A new heartbeat was received at this `BlockNumber` from `AuthorityId`"
|
||||
" A new heartbeat was received from `AuthorityId`"
|
||||
]
|
||||
}
|
||||
],
|
||||
"constants": [
|
||||
{
|
||||
"name": "SessionsPerEra",
|
||||
"type": "SessionIndex",
|
||||
"value": "0x06000000",
|
||||
"documentation": [
|
||||
" Number of sessions per era."
|
||||
]
|
||||
}
|
||||
]
|
||||
"constants": []
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -3,6 +3,7 @@
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { TypeRegistry } from './typeRegistry';
|
||||
import Struct from '../codec/Struct';
|
||||
import Text from '../primitive/Text';
|
||||
import U32 from '../primitive/U32';
|
||||
|
||||
@@ -58,9 +59,9 @@ describe('TypeRegistry', (): void => {
|
||||
bar: 'testing'
|
||||
});
|
||||
|
||||
expect(SomeStruct.name).toBe('Struct');
|
||||
expect(struct.get('foo').toNumber()).toEqual(42);
|
||||
expect(struct.get('bar').toString()).toEqual('testing');
|
||||
expect(struct instanceof Struct).toBe(true);
|
||||
expect(struct.foo.toNumber()).toEqual(42);
|
||||
expect(struct.bar.toString()).toEqual('testing');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
import { Compact, Option, Vec } from './codec';
|
||||
import { Bytes, Data, Fixed64, H160, H256, H512, Null, StorageData, StorageHasher, StorageKey, Text, Type, bool, i128, i16, i256, i32, i64, i8, u128, u16, u256, u32, u64, u8, usize } from './primitive';
|
||||
import { AccountId, AccountIdOf, AccountIndex, Address, AssetId, Balance, BalanceOf, Block, BlockNumber, Call, Consensus, ConsensusEngineId, Digest, DigestItem, Ed25519Signature, Extrinsic, ExtrinsicEra, ExtrinsicPayload, Hash, Header, ImmortalEra, Index, Justification, KeyTypeId, KeyValue, LockIdentifier, Moment, MortalEra, Origin, Perbill, Permill, Phantom, PreRuntime, Seal, SealV0, Signature, SignedBlock, Sr25519Signature, ValidatorId, Weight, WeightMultiplier } from './interfaces/runtime';
|
||||
import { AccountId, AccountIdOf, AccountIndex, Address, AssetId, Balance, BalanceOf, Block, BlockNumber, Call, Consensus, ConsensusEngineId, Digest, DigestItem, Ed25519Signature, Extrinsic, ExtrinsicEra, ExtrinsicPayload, Hash, Header, ImmortalEra, Index, Justification, KeyTypeId, KeyValue, LockIdentifier, Moment, MortalEra, Origin, Perbill, Permill, Phantom, PhantomData, PreRuntime, Seal, SealV0, Signature, SignedBlock, Sr25519Signature, ValidatorId, Weight, WeightMultiplier } from './interfaces/runtime';
|
||||
import { AuthorityId } from './interfaces/consensus';
|
||||
import { Keys, SessionIndex } from './interfaces/session';
|
||||
import { Keys, SessionIndex, SessionKeysPolkadot, SessionKeysSubstrate } from './interfaces/session';
|
||||
import { AuthorityWeight, NextAuthority, PendingPause, PendingResume, StoredPendingChange, StoredState } from './interfaces/grandpa';
|
||||
import { ApprovalFlag, SetIndex, Vote, VoteIndex, VoteThreshold, VoterInfo } from './interfaces/elections';
|
||||
import { InclusionHeight, Uncle, UncleEntryItem } from './interfaces/authorship';
|
||||
@@ -15,7 +15,7 @@ import { AliveContractInfo, CodeHash, ContractInfo, ContractStorageKey, Gas, Pre
|
||||
import { Conviction, PropIndex, Proposal, ReferendumIndex, ReferendumInfo } from './interfaces/democracy';
|
||||
import { AccountInfo, Amount, AssetOf, InherentOfflineReport, LockPeriods, NewAccountOutcome, OpaqueKey, SessionKey } from './interfaces/deprecated';
|
||||
import { AssetOptions, Owner, PermissionLatest, PermissionVersions, PermissionsV1 } from './interfaces/genericAsset';
|
||||
import { Heartbeat, OpaqueMultiaddr, OpaqueNetworkState, OpaquePeerId } from './interfaces/imOnline';
|
||||
import { AuthIndex, AuthoritySignature, Heartbeat, OpaqueMultiaddr, OpaqueNetworkState, OpaquePeerId } from './interfaces/imOnline';
|
||||
import { EraIndex, EraRewards, Exposure, IndividualExposure, MomentOf, RewardDestination, StakingLedger, UnlockChunk, ValidatorPrefs } from './interfaces/staking';
|
||||
import { DigestOf, Event, EventId, EventIndex, EventRecord, EventRecord0to76, Key, Phase } from './interfaces/system';
|
||||
import { TreasuryProposal } from './interfaces/treasury';
|
||||
@@ -166,6 +166,9 @@ export interface InterfaceRegistry {
|
||||
Phantom: Phantom;
|
||||
'Option<Phantom>': Option<Phantom>;
|
||||
'Vec<Phantom>': Vec<Phantom>;
|
||||
PhantomData: PhantomData;
|
||||
'Option<PhantomData>': Option<PhantomData>;
|
||||
'Vec<PhantomData>': Vec<PhantomData>;
|
||||
ValidatorId: ValidatorId;
|
||||
'Option<ValidatorId>': Option<ValidatorId>;
|
||||
'Vec<ValidatorId>': Vec<ValidatorId>;
|
||||
@@ -250,6 +253,12 @@ export interface InterfaceRegistry {
|
||||
'Compact<SessionIndex>': Compact<SessionIndex>;
|
||||
'Option<SessionIndex>': Option<SessionIndex>;
|
||||
'Vec<SessionIndex>': Vec<SessionIndex>;
|
||||
SessionKeysSubstrate: SessionKeysSubstrate;
|
||||
'Option<SessionKeysSubstrate>': Option<SessionKeysSubstrate>;
|
||||
'Vec<SessionKeysSubstrate>': Vec<SessionKeysSubstrate>;
|
||||
SessionKeysPolkadot: SessionKeysPolkadot;
|
||||
'Option<SessionKeysPolkadot>': Option<SessionKeysPolkadot>;
|
||||
'Vec<SessionKeysPolkadot>': Vec<SessionKeysPolkadot>;
|
||||
Keys: Keys;
|
||||
'Option<Keys>': Option<Keys>;
|
||||
'Vec<Keys>': Vec<Keys>;
|
||||
@@ -424,6 +433,13 @@ export interface InterfaceRegistry {
|
||||
AssetOptions: AssetOptions;
|
||||
'Option<AssetOptions>': Option<AssetOptions>;
|
||||
'Vec<AssetOptions>': Vec<AssetOptions>;
|
||||
AuthIndex: AuthIndex;
|
||||
'Compact<AuthIndex>': Compact<AuthIndex>;
|
||||
'Option<AuthIndex>': Option<AuthIndex>;
|
||||
'Vec<AuthIndex>': Vec<AuthIndex>;
|
||||
AuthoritySignature: AuthoritySignature;
|
||||
'Option<AuthoritySignature>': Option<AuthoritySignature>;
|
||||
'Vec<AuthoritySignature>': Vec<AuthoritySignature>;
|
||||
OpaqueMultiaddr: OpaqueMultiaddr;
|
||||
'Option<OpaqueMultiaddr>': Option<OpaqueMultiaddr>;
|
||||
'Vec<OpaqueMultiaddr>': Vec<OpaqueMultiaddr>;
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
export default {
|
||||
types: {
|
||||
AuthIndex: 'u32',
|
||||
AuthoritySignature: 'Signature',
|
||||
OpaqueMultiaddr: 'Bytes',
|
||||
OpaquePeerId: 'Bytes',
|
||||
OpaqueNetworkState: {
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
// Auto-generated via `yarn build:interfaces`, do not edit
|
||||
|
||||
import { Struct, Vec } from '../../codec';
|
||||
import { Bytes } from '../../primitive';
|
||||
import { BlockNumber } from '../runtime';
|
||||
import { Bytes, u32 } from '../../primitive';
|
||||
import { BlockNumber, Signature } from '../runtime';
|
||||
import { AuthorityId } from '../consensus';
|
||||
import { SessionIndex } from '../session';
|
||||
|
||||
/** u32 */
|
||||
export type AuthIndex = u32;
|
||||
|
||||
/** Signature */
|
||||
export type AuthoritySignature = Signature;
|
||||
|
||||
/** Struct */
|
||||
export interface Heartbeat extends Struct {
|
||||
/** BlockNumber */
|
||||
|
||||
@@ -20,6 +20,7 @@ export default {
|
||||
Perbill: 'u32',
|
||||
Permill: 'u32',
|
||||
Phantom: 'Null',
|
||||
PhantomData: 'Null',
|
||||
ValidatorId: 'AccountId',
|
||||
Weight: 'u32',
|
||||
WeightMultiplier: 'Fixed64',
|
||||
|
||||
@@ -111,6 +111,9 @@ export type Permill = u32;
|
||||
/** Null */
|
||||
export type Phantom = Null;
|
||||
|
||||
/** Null */
|
||||
export type PhantomData = Null;
|
||||
|
||||
/** [ConsensusEngineId, Bytes] & Codec */
|
||||
export type PreRuntime = [ConsensusEngineId, Bytes] & Codec;
|
||||
|
||||
|
||||
@@ -5,10 +5,21 @@
|
||||
export default {
|
||||
types: {
|
||||
SessionIndex: 'u32',
|
||||
// node/runtime/src/lib.rs, impl_opaque_keys
|
||||
Keys: {
|
||||
ed25519: 'AccountId', // Grandpa, aka GrandpaId
|
||||
sr25519: 'AccountId' // Babe, aka BabeId
|
||||
}
|
||||
|
||||
// The runtime definition of SessionKeys are passes as a Trait to session
|
||||
// Defined in `node/runtime/src/lib.rs` as follow
|
||||
// impl_opaque_keys! {
|
||||
// pub struct SessionKeys {
|
||||
SessionKeysSubstrate: {
|
||||
grandpa: 'AccountId', // aka GrandpaId
|
||||
babe: 'AccountId', // aka BabeId
|
||||
imOnline: 'AccountId' // aka ImOnlineId
|
||||
},
|
||||
SessionKeysPolkadot: {
|
||||
grandpa: 'AccountId', // aka GrandpaId
|
||||
babe: 'AccountId', // aka BabeId
|
||||
imOnline: 'AccountId' // aka ImOnlineId
|
||||
},
|
||||
Keys: 'SessionKeysSubstrate'
|
||||
}
|
||||
};
|
||||
|
||||
@@ -4,13 +4,28 @@ import { Struct } from '../../codec';
|
||||
import { u32 } from '../../primitive';
|
||||
import { AccountId } from '../runtime';
|
||||
|
||||
/** Struct */
|
||||
export interface Keys extends Struct {
|
||||
/** AccountId */
|
||||
readonly ed25519: AccountId;
|
||||
/** AccountId */
|
||||
readonly sr25519: AccountId;
|
||||
}
|
||||
/** SessionKeysSubstrate */
|
||||
export type Keys = SessionKeysSubstrate;
|
||||
|
||||
/** u32 */
|
||||
export type SessionIndex = u32;
|
||||
|
||||
/** Struct */
|
||||
export interface SessionKeysPolkadot extends Struct {
|
||||
/** AccountId */
|
||||
readonly grandpa: AccountId;
|
||||
/** AccountId */
|
||||
readonly babe: AccountId;
|
||||
/** AccountId */
|
||||
readonly imOnline: AccountId;
|
||||
}
|
||||
|
||||
/** Struct */
|
||||
export interface SessionKeysSubstrate extends Struct {
|
||||
/** AccountId */
|
||||
readonly grandpa: AccountId;
|
||||
/** AccountId */
|
||||
readonly babe: AccountId;
|
||||
/** AccountId */
|
||||
readonly imOnline: AccountId;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ export default class Type extends Text {
|
||||
Type._alias('Lookup::Target', 'AccountId'),
|
||||
// alias for grandpa, as used in polkadot
|
||||
Type._alias('grandpa::AuthorityId', 'AuthorityId'),
|
||||
// specific for SessionIndex (cvould make this session::, but be conservative)
|
||||
// specific for SessionIndex (could make this session::, but be conservative)
|
||||
Type._alias('session::SessionIndex', 'SessionIndex'),
|
||||
// HACK duplication between contracts & primitives, however contracts prefixed with exec
|
||||
Type._alias('exec::StorageKey', 'ContractStorageKey'),
|
||||
@@ -223,7 +223,9 @@ export default class Type extends Text {
|
||||
// replace `<...>::Type`
|
||||
.replace(/::Type/g, '')
|
||||
// replace `wasm::*` eg. `wasm::PrefabWasmModule`
|
||||
.replace(/wasm::/g, '');
|
||||
.replace(/wasm::/g, '')
|
||||
// `sr_std::marker::`
|
||||
.replace(/sr_std::marker::/g, '');
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -18,13 +18,9 @@ export default class Unconstructable extends Null {
|
||||
throw new Error('Unconstructable should not be constructed, it is only a placeholder for compatibility');
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public static with (typeDef: any): Constructor {
|
||||
return class extends Null {
|
||||
public constructor () {
|
||||
super();
|
||||
|
||||
throw new Error(`Unable to construct ${JSON.stringify(typeDef)}`);
|
||||
}
|
||||
return class extends Unconstructable {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1795,10 +1795,10 @@
|
||||
universal-user-agent "^3.0.0"
|
||||
url-template "^2.0.8"
|
||||
|
||||
"@polkadot/dev@^0.30.0-beta.24":
|
||||
version "0.30.0-beta.24"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/dev/-/dev-0.30.0-beta.24.tgz#b007707551dafabfcd6f77faf14a73106a9afc96"
|
||||
integrity sha512-jbty6uUL+UHLHS8hwSSUp+G6BYyPAYU2SJdBy1KFexuaeMcEQ0n7J8EmgJ6TPegYAs8rmk3jX2xxwct/mUKuTQ==
|
||||
"@polkadot/dev@^0.30.0-beta.26":
|
||||
version "0.30.0-beta.26"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/dev/-/dev-0.30.0-beta.26.tgz#2291b61711f9ae5ab147fca4a6739a55322ce5ef"
|
||||
integrity sha512-nYAjzZ4SbZOc4tvh9sKDWyWogZC3ORmApFoiV2H5JdUB1zt6EvcqmEOMb1RhrAJggYQqijF+FhmOG78A+9yaqQ==
|
||||
dependencies:
|
||||
"@babel/cli" "^7.5.5"
|
||||
"@babel/core" "^7.5.5"
|
||||
@@ -1811,7 +1811,7 @@
|
||||
"@babel/preset-typescript" "^7.3.3"
|
||||
"@babel/register" "^7.5.5"
|
||||
"@babel/runtime" "^7.5.5"
|
||||
"@types/jest" "^24.0.16"
|
||||
"@types/jest" "^24.0.17"
|
||||
"@types/node" "^12.6.9"
|
||||
"@typescript-eslint/eslint-plugin" "^1.13.0"
|
||||
"@typescript-eslint/parser" "^1.13.0"
|
||||
@@ -1837,7 +1837,7 @@
|
||||
tslint "^5.18.0"
|
||||
tslint-config-standard "^8.0.1"
|
||||
typedoc "^0.15.0"
|
||||
typedoc-plugin-markdown "^2.1.0"
|
||||
typedoc-plugin-markdown "^2.1.1"
|
||||
typedoc-plugin-no-inherit "^1.1.9"
|
||||
typescript "^3.5.3"
|
||||
vuepress "^1.0.3"
|
||||
@@ -2022,10 +2022,10 @@
|
||||
resolved "https://registry.yarnpkg.com/@types/jest-diff/-/jest-diff-20.0.1.tgz#35cc15b9c4f30a18ef21852e255fdb02f6d59b89"
|
||||
integrity sha512-yALhelO3i0hqZwhjtcr6dYyaLoCHbAMshwtj6cGxTvHZAKXHsYGdff6E8EPw3xLKY0ELUTQ69Q1rQiJENnccMA==
|
||||
|
||||
"@types/jest@^24.0.16":
|
||||
version "24.0.16"
|
||||
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-24.0.16.tgz#8d3e406ec0f0dc1688d6711af3062ff9bd428066"
|
||||
integrity sha512-JrAiyV+PPGKZzw6uxbI761cHZ0G7QMOHXPhtSpcl08rZH6CswXaaejckn3goFKmF7M3nzEoJ0lwYCbqLMmjziQ==
|
||||
"@types/jest@^24.0.17":
|
||||
version "24.0.17"
|
||||
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-24.0.17.tgz#b66ea026efb746eb5db1356ee28518aaff7af416"
|
||||
integrity sha512-1cy3xkOAfSYn78dsBWy4M3h/QF/HeWPchNFDjysVtp3GHeTdSmtluNnELfCmfNRRHo0OWEcpf+NsEJQvwQfdqQ==
|
||||
dependencies:
|
||||
"@types/jest-diff" "*"
|
||||
|
||||
@@ -12340,10 +12340,10 @@ typedoc-default-themes@^0.6.0:
|
||||
lunr "^2.3.6"
|
||||
underscore "^1.9.1"
|
||||
|
||||
typedoc-plugin-markdown@^2.1.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/typedoc-plugin-markdown/-/typedoc-plugin-markdown-2.1.0.tgz#17b7b97415b97214985d1a61ef7b9a4dce3e8305"
|
||||
integrity sha512-f7CgreapeUIpm85BnC4ec9PZp10INOpLpItSCV4YFlZS4VaBA/a1D2nYv9+7TVJugc084XlSFUY+OX9fwGAUpA==
|
||||
typedoc-plugin-markdown@^2.1.1:
|
||||
version "2.1.1"
|
||||
resolved "https://registry.yarnpkg.com/typedoc-plugin-markdown/-/typedoc-plugin-markdown-2.1.1.tgz#b9bbb48c23b1994be3b9b09f2626887bac613aa0"
|
||||
integrity sha512-AQxnYLwdOzwCTo+VAVIxIXuVdMsK3Jamyd4m29630Llga+i59dqsYyduFFlzlJM8Xu8EiVCeURwr+vwMl87Gqg==
|
||||
|
||||
typedoc-plugin-no-inherit@^1.1.9:
|
||||
version "1.1.9"
|
||||
|
||||
Reference in New Issue
Block a user