Enum toJSON returns toString for a basic enum (#1697)

* Update kusama static from 1032 to 1033

* Test 1032 and 1033

* Got exact metadata from kusama

* First pass: enum TOJSON and fix some tests

* Build interfaces

* Fix import

* Use camelCase for enum toJSON

* Build interface

* Fix lint

* Fix tests

* Generate static json
This commit is contained in:
Amaury Martiny
2020-01-13 22:18:51 +01:00
committed by Jaco Greeff
parent dd57b1a007
commit fbbbcd2612
25 changed files with 2808 additions and 2879 deletions
@@ -438,7 +438,7 @@
"functions": [
{
"name": "AccountNonce",
"modifier": 1,
"modifier": "default",
"type": {
"Map": {
"key": "AccountId",
@@ -450,7 +450,7 @@
},
{
"name": "ExtrinsicCount",
"modifier": 0,
"modifier": "optional",
"type": {
"Plain": "u32"
},
@@ -459,7 +459,7 @@
},
{
"name": "BlockHash",
"modifier": 1,
"modifier": "default",
"type": {
"Map": {
"key": "BlockNumber",
@@ -471,7 +471,7 @@
},
{
"name": "ExtrinsicData",
"modifier": 1,
"modifier": "default",
"type": {
"Map": {
"key": "u32",
@@ -483,7 +483,7 @@
},
{
"name": "RandomSeed",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "Hash"
},
@@ -492,7 +492,7 @@
},
{
"name": "Number",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "BlockNumber"
},
@@ -503,7 +503,7 @@
},
{
"name": "ParentHash",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "Hash"
},
@@ -512,7 +512,7 @@
},
{
"name": "ExtrinsicsRoot",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "Hash"
},
@@ -521,7 +521,7 @@
},
{
"name": "Digest",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "Digest"
},
@@ -530,7 +530,7 @@
},
{
"name": "Events",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "Vec<EventRecord>"
},
@@ -586,7 +586,7 @@
"functions": [
{
"name": "Now",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "Moment"
},
@@ -597,7 +597,7 @@
},
{
"name": "BlockPeriod",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "Moment"
},
@@ -608,7 +608,7 @@
},
{
"name": "DidUpdate",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "bool"
},
@@ -713,7 +713,7 @@
"functions": [
{
"name": "OriginalAuthorities",
"modifier": 0,
"modifier": "optional",
"type": {
"Plain": "Vec<SessionKey>"
},
@@ -737,7 +737,7 @@
"functions": [
{
"name": "NextEnumSet",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "AccountIndex"
},
@@ -748,7 +748,7 @@
},
{
"name": "EnumSet",
"modifier": 1,
"modifier": "default",
"type": {
"Map": {
"key": "AccountIndex",
@@ -816,7 +816,7 @@
"functions": [
{
"name": "TotalIssuance",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "Balance"
},
@@ -827,7 +827,7 @@
},
{
"name": "ExistentialDeposit",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "Balance"
},
@@ -838,7 +838,7 @@
},
{
"name": "TransferFee",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "Balance"
},
@@ -849,7 +849,7 @@
},
{
"name": "CreationFee",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "Balance"
},
@@ -860,7 +860,7 @@
},
{
"name": "FreeBalance",
"modifier": 1,
"modifier": "default",
"type": {
"Map": {
"key": "AccountId",
@@ -884,7 +884,7 @@
},
{
"name": "ReservedBalance",
"modifier": 1,
"modifier": "default",
"type": {
"Map": {
"key": "AccountId",
@@ -909,7 +909,7 @@
},
{
"name": "TransactionBaseFee",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "Balance"
},
@@ -920,7 +920,7 @@
},
{
"name": "TransactionByteFee",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "Balance"
},
@@ -987,7 +987,7 @@
"functions": [
{
"name": "Validators",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "Vec<AccountId>"
},
@@ -998,7 +998,7 @@
},
{
"name": "SessionLength",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "BlockNumber"
},
@@ -1009,7 +1009,7 @@
},
{
"name": "CurrentIndex",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "BlockNumber"
},
@@ -1020,7 +1020,7 @@
},
{
"name": "CurrentStart",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "Moment"
},
@@ -1031,7 +1031,7 @@
},
{
"name": "ForcingNewSession",
"modifier": 0,
"modifier": "optional",
"type": {
"Plain": "bool"
},
@@ -1043,7 +1043,7 @@
},
{
"name": "LastLengthChange",
"modifier": 0,
"modifier": "optional",
"type": {
"Plain": "BlockNumber"
},
@@ -1054,7 +1054,7 @@
},
{
"name": "NextKeyFor",
"modifier": 0,
"modifier": "optional",
"type": {
"Map": {
"key": "AccountId",
@@ -1068,7 +1068,7 @@
},
{
"name": "NextSessionLength",
"modifier": 0,
"modifier": "optional",
"type": {
"Plain": "BlockNumber"
},
@@ -1243,7 +1243,7 @@
"functions": [
{
"name": "ValidatorCount",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "u32"
},
@@ -1254,7 +1254,7 @@
},
{
"name": "MinimumValidatorCount",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "u32"
},
@@ -1265,7 +1265,7 @@
},
{
"name": "SessionsPerEra",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "BlockNumber"
},
@@ -1276,7 +1276,7 @@
},
{
"name": "SessionReward",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "Perbill"
},
@@ -1287,7 +1287,7 @@
},
{
"name": "OfflineSlash",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "Perbill"
},
@@ -1298,7 +1298,7 @@
},
{
"name": "OfflineSlashGrace",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "u32"
},
@@ -1309,7 +1309,7 @@
},
{
"name": "BondingDuration",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "BlockNumber"
},
@@ -1320,7 +1320,7 @@
},
{
"name": "Invulerables",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "Vec<AccountId>"
},
@@ -1332,7 +1332,7 @@
},
{
"name": "CurrentEra",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "BlockNumber"
},
@@ -1343,7 +1343,7 @@
},
{
"name": "ValidatorPreferences",
"modifier": 1,
"modifier": "default",
"type": {
"Map": {
"key": "AccountId",
@@ -1357,7 +1357,7 @@
},
{
"name": "Intentions",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "Vec<AccountId>"
},
@@ -1368,7 +1368,7 @@
},
{
"name": "Nominating",
"modifier": 0,
"modifier": "optional",
"type": {
"Map": {
"key": "AccountId",
@@ -1382,7 +1382,7 @@
},
{
"name": "NominatorsFor",
"modifier": 1,
"modifier": "default",
"type": {
"Map": {
"key": "AccountId",
@@ -1396,7 +1396,7 @@
},
{
"name": "CurrentNominatorsFor",
"modifier": 1,
"modifier": "default",
"type": {
"Map": {
"key": "AccountId",
@@ -1410,7 +1410,7 @@
},
{
"name": "CurrentSessionReward",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "Balance"
},
@@ -1421,7 +1421,7 @@
},
{
"name": "CurrentOfflineSlash",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "Balance"
},
@@ -1432,7 +1432,7 @@
},
{
"name": "NextSessionsPerEra",
"modifier": 0,
"modifier": "optional",
"type": {
"Plain": "BlockNumber"
},
@@ -1443,7 +1443,7 @@
},
{
"name": "LastEraLengthChange",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "BlockNumber"
},
@@ -1454,7 +1454,7 @@
},
{
"name": "StakeRange",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "(Balance,Balance)"
},
@@ -1465,7 +1465,7 @@
},
{
"name": "Bondage",
"modifier": 1,
"modifier": "default",
"type": {
"Map": {
"key": "AccountId",
@@ -1479,7 +1479,7 @@
},
{
"name": "SlashCount",
"modifier": 1,
"modifier": "default",
"type": {
"Map": {
"key": "AccountId",
@@ -1493,7 +1493,7 @@
},
{
"name": "ForcingNewEra",
"modifier": 0,
"modifier": "optional",
"type": {
"Plain": "Null"
},
@@ -1619,7 +1619,7 @@
"functions": [
{
"name": "PublicPropCount",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "PropIndex"
},
@@ -1630,7 +1630,7 @@
},
{
"name": "PublicProps",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "Vec<(PropIndex,Proposal,AccountId)>"
},
@@ -1641,7 +1641,7 @@
},
{
"name": "DepositOf",
"modifier": 0,
"modifier": "optional",
"type": {
"Map": {
"key": "PropIndex",
@@ -1655,7 +1655,7 @@
},
{
"name": "LaunchPeriod",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "BlockNumber"
},
@@ -1666,7 +1666,7 @@
},
{
"name": "MinimumDeposit",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "Balance"
},
@@ -1677,7 +1677,7 @@
},
{
"name": "PublicDelay",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "BlockNumber"
},
@@ -1688,7 +1688,7 @@
},
{
"name": "MaxLockPeriods",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "LockPeriods"
},
@@ -1699,7 +1699,7 @@
},
{
"name": "VotingPeriod",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "BlockNumber"
},
@@ -1710,7 +1710,7 @@
},
{
"name": "ReferendumCount",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "ReferendumIndex"
},
@@ -1721,7 +1721,7 @@
},
{
"name": "NextTally",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "ReferendumIndex"
},
@@ -1732,7 +1732,7 @@
},
{
"name": "ReferendumInfoOf",
"modifier": 0,
"modifier": "optional",
"type": {
"Map": {
"key": "ReferendumIndex",
@@ -1746,7 +1746,7 @@
},
{
"name": "DispatchQueue",
"modifier": 1,
"modifier": "default",
"type": {
"Map": {
"key": "BlockNumber",
@@ -1760,7 +1760,7 @@
},
{
"name": "Bondage",
"modifier": 1,
"modifier": "default",
"type": {
"Map": {
"key": "AccountId",
@@ -1774,7 +1774,7 @@
},
{
"name": "VotersFor",
"modifier": 1,
"modifier": "default",
"type": {
"Map": {
"key": "ReferendumIndex",
@@ -1788,7 +1788,7 @@
},
{
"name": "VoteOf",
"modifier": 1,
"modifier": "default",
"type": {
"Map": {
"key": "(ReferendumIndex,AccountId)",
@@ -1976,7 +1976,7 @@
"functions": [
{
"name": "CandidacyBond",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "Balance"
},
@@ -1987,7 +1987,7 @@
},
{
"name": "VotingBond",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "Balance"
},
@@ -1998,7 +1998,7 @@
},
{
"name": "PresentSlashPerVoter",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "Balance"
},
@@ -2009,7 +2009,7 @@
},
{
"name": "CarryCount",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "u32"
},
@@ -2020,7 +2020,7 @@
},
{
"name": "PresentationDuration",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "BlockNumber"
},
@@ -2031,7 +2031,7 @@
},
{
"name": "InactiveGracePeriod",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "VoteIndex"
},
@@ -2043,7 +2043,7 @@
},
{
"name": "VotingPeriod",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "BlockNumber"
},
@@ -2054,7 +2054,7 @@
},
{
"name": "TermDuration",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "BlockNumber"
},
@@ -2065,7 +2065,7 @@
},
{
"name": "DesiredSeats",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "u32"
},
@@ -2076,7 +2076,7 @@
},
{
"name": "ActiveCouncil",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "Vec<(AccountId,BlockNumber)>"
},
@@ -2090,7 +2090,7 @@
},
{
"name": "VoteCount",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "VoteIndex"
},
@@ -2101,7 +2101,7 @@
},
{
"name": "ApprovalsOf",
"modifier": 1,
"modifier": "default",
"type": {
"Map": {
"key": "AccountId",
@@ -2116,7 +2116,7 @@
},
{
"name": "RegisterInfoOf",
"modifier": 0,
"modifier": "optional",
"type": {
"Map": {
"key": "AccountId",
@@ -2131,7 +2131,7 @@
},
{
"name": "LastActiveOf",
"modifier": 0,
"modifier": "optional",
"type": {
"Map": {
"key": "AccountId",
@@ -2145,7 +2145,7 @@
},
{
"name": "Voters",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "Vec<AccountId>"
},
@@ -2156,7 +2156,7 @@
},
{
"name": "Candidates",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "Vec<AccountId>"
},
@@ -2167,7 +2167,7 @@
},
{
"name": "CandidateCount",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "u32"
},
@@ -2176,7 +2176,7 @@
},
{
"name": "NextFinalise",
"modifier": 0,
"modifier": "optional",
"type": {
"Plain": "(BlockNumber,u32,Vec<AccountId>)"
},
@@ -2187,7 +2187,7 @@
},
{
"name": "SnapshotedStakes",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "Vec<Balance>"
},
@@ -2198,7 +2198,7 @@
},
{
"name": "Leaderboard",
"modifier": 0,
"modifier": "optional",
"type": {
"Plain": "Vec<(Balance,AccountId)>"
},
@@ -2284,7 +2284,7 @@
"functions": [
{
"name": "CooloffPeriod",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "BlockNumber"
},
@@ -2293,7 +2293,7 @@
},
{
"name": "VotingPeriod",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "BlockNumber"
},
@@ -2302,7 +2302,7 @@
},
{
"name": "EnactDelayPeriod",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "BlockNumber"
},
@@ -2313,7 +2313,7 @@
},
{
"name": "Proposals",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "Vec<(BlockNumber,Hash)>"
},
@@ -2322,7 +2322,7 @@
},
{
"name": "ProposalOf",
"modifier": 0,
"modifier": "optional",
"type": {
"Map": {
"key": "Hash",
@@ -2334,7 +2334,7 @@
},
{
"name": "ProposalVoters",
"modifier": 1,
"modifier": "default",
"type": {
"Map": {
"key": "Hash",
@@ -2346,7 +2346,7 @@
},
{
"name": "CouncilVoteOf",
"modifier": 0,
"modifier": "optional",
"type": {
"Map": {
"key": "(Hash,AccountId)",
@@ -2358,7 +2358,7 @@
},
{
"name": "VetoedProposal",
"modifier": 0,
"modifier": "optional",
"type": {
"Map": {
"key": "Hash",
@@ -2420,7 +2420,7 @@
"functions": [
{
"name": "Proposals",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "Vec<Hash>"
},
@@ -2431,7 +2431,7 @@
},
{
"name": "ProposalOf",
"modifier": 0,
"modifier": "optional",
"type": {
"Map": {
"key": "Hash",
@@ -2445,7 +2445,7 @@
},
{
"name": "Voting",
"modifier": 0,
"modifier": "optional",
"type": {
"Map": {
"key": "Hash",
@@ -2459,7 +2459,7 @@
},
{
"name": "ProposalCount",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "u32"
},
@@ -2499,7 +2499,7 @@
"functions": [
{
"name": "PendingChange",
"modifier": 0,
"modifier": "optional",
"type": {
"Plain": "StoredPendingChange"
},
@@ -2608,7 +2608,7 @@
"functions": [
{
"name": "ProposalBond",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "Permill"
},
@@ -2620,7 +2620,7 @@
},
{
"name": "ProposalBondMinimum",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "Balance"
},
@@ -2631,7 +2631,7 @@
},
{
"name": "SpendPeriod",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "BlockNumber"
},
@@ -2642,7 +2642,7 @@
},
{
"name": "Burn",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "Permill"
},
@@ -2653,7 +2653,7 @@
},
{
"name": "Pot",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "Balance"
},
@@ -2664,7 +2664,7 @@
},
{
"name": "ProposalCount",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "ProposalIndex"
},
@@ -2675,7 +2675,7 @@
},
{
"name": "Proposals",
"modifier": 0,
"modifier": "optional",
"type": {
"Map": {
"key": "ProposalIndex",
@@ -2689,7 +2689,7 @@
},
{
"name": "Approvals",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "Vec<ProposalIndex>"
},
@@ -2809,7 +2809,7 @@
"functions": [
{
"name": "Key",
"modifier": 1,
"modifier": "default",
"type": {
"Plain": "AccountId"
},
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -2,10 +2,10 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { MetadataV9, MetadataV10, ModuleMetadataV9, ModuleMetadataV10, StorageEntryMetadataV9, StorageEntryTypeV9, StorageHasherV9 } from '@polkadot/types/interfaces/metadata';
import { MetadataV9, MetadataV10, ModuleMetadataV9, ModuleMetadataV10, StorageEntryMetadataV9, StorageEntryTypeV9, StorageHasherV9, StorageHasherV10 } from '@polkadot/types/interfaces/metadata';
import { Registry } from '@polkadot/types/types';
import { createType, StorageHasherV10 } from '@polkadot/types';
import { createType } from '@polkadot/types';
// migrate a storage hasher type
// see https://github.com/paritytech/substrate/pull/4462
+3 -3
View File
@@ -178,7 +178,7 @@ describe('Enum', (): void => {
const testEncode = (to: 'toJSON' | 'toNumber' | 'toString' | 'toU8a', expected: any): void =>
it(`can encode ${to}`, (): void => {
const e = new Enum(registry, ['foo', 'bar'], 1);
const e = new Enum(registry, ['Foo', 'Bar'], 1);
expect(e[to]()).toEqual(expected);
});
@@ -191,9 +191,9 @@ describe('Enum', (): void => {
testDecode('Uint8Array', Uint8Array.from([0]), 'foo');
testDecode('Uint8Array', Uint8Array.from([1]), 'bar');
testEncode('toJSON', 1);
testEncode('toJSON', 'bar');
testEncode('toNumber', 1);
testEncode('toString', 'bar');
testEncode('toString', 'Bar');
testEncode('toU8a', Uint8Array.from([1]));
it('provides a clean toString()', (): void => {
+1 -1
View File
@@ -244,7 +244,7 @@ export default class Enum extends Base<Codec> {
*/
public toJSON (): AnyJson {
return this._isBasic
? this._index
? stringCamelCase(this.toString())
: { [this.type]: this.raw.toJSON() };
}
@@ -47,7 +47,7 @@ describe('createType', (): void => {
it('allows creation of a Enum (simple)', (): void => {
expect(
createTypeUnsafe(registry, '{"_enum": ["A", "B", "C"]}', [1]).toJSON()
).toEqual(1);
).toEqual('b');
});
it('allows creation of a Enum (parametrised)', (): void => {
+8 -8
View File
@@ -2,7 +2,7 @@
/* eslint-disable @typescript-eslint/no-empty-interface */
import { Compact, Option, Raw, Vec } from '@polkadot/types/codec';
import { Bytes, Data, Fixed64, H160, H256, H512, IdentityFields, Null, StorageData, StorageHasherV10, StorageHasherV4, StorageKey, Text, Type, U256, bool, i128, i16, i256, i32, i64, i8, u128, u16, u256, u32, u64, u8, usize } from '@polkadot/types/primitive';
import { Bytes, Data, Fixed64, H160, H256, H512, IdentityFields, Null, StorageData, StorageKey, Text, Type, U256, bool, i128, i16, i256, i32, i64, i8, u128, u16, u256, u32, u64, u8, usize } from '@polkadot/types/primitive';
import { AccountId, AccountIdOf, AccountIndex, Address, AssetId, Balance, BalanceOf, Block, BlockNumber, Call, Consensus, ConsensusEngineId, Digest, DigestItem, DispatchClass, DispatchInfo, DispatchInfoTo190, EcdsaSignature, Ed25519Signature, Extrinsic, ExtrinsicEra, ExtrinsicPayload, ExtrinsicPayloadUnknown, ExtrinsicPayloadV1, ExtrinsicPayloadV2, ExtrinsicPayloadV3, ExtrinsicPayloadV4, ExtrinsicUnknown, ExtrinsicV1, ExtrinsicV2, ExtrinsicV3, ExtrinsicV4, Hash, Header, ImmortalEra, Index, Justification, KeyTypeId, KeyValue, LockIdentifier, Moment, MortalEra, MultiSignature, Origin, Perbill, Percent, Permill, Perquintill, Phantom, PhantomData, PreRuntime, Seal, SealV0, Signature, SignedBlock, SignerPayload, Sr25519Signature, ValidatorId, Weight, WeightMultiplier } from '@polkadot/types/interfaces/runtime';
import { InclusionHeight, Uncle, UncleEntryItem } from '@polkadot/types/interfaces/authorship';
import { RawAuraPreDigest } from '@polkadot/types/interfaces/aura';
@@ -28,7 +28,7 @@ import { Multisig, Timepoint } from '@polkadot/types/interfaces/utility';
import { BlockAttestations, IncludedBlocks, MoreAttestations } from '@polkadot/types/interfaces/attestations';
import { EthereumAddress } from '@polkadot/types/interfaces/claims';
import { AttestedCandidate, AuctionIndex, BalanceUpload, Bidder, CandidateReceipt, CollatorId, CollatorSignature, EgressQueueRoot, HeadData, IncomingParachain, IncomingParachainDeploy, IncomingParachainFixed, LeasePeriod, LeasePeriodOf, NewBidder, ParaId, ParaIdOf, ParaInfo, ParaScheduling, ParachainDispatchOrigin, Retriable, SlotRange, SubId, UpwardMessage, ValidatorIndex, ValidityAttestation, ValidityVote, WinningData, WinningDataEntry } from '@polkadot/types/interfaces/parachains';
import { CallMetadataV0, DoubleMapTypeV10, DoubleMapTypeV11, DoubleMapTypeV3, DoubleMapTypeV4, DoubleMapTypeV5, DoubleMapTypeV6, DoubleMapTypeV7, DoubleMapTypeV8, DoubleMapTypeV9, ErrorMetadataV10, ErrorMetadataV11, ErrorMetadataV8, ErrorMetadataV9, EventMetadataLatest, EventMetadataV0, EventMetadataV1, EventMetadataV10, EventMetadataV11, EventMetadataV2, EventMetadataV3, EventMetadataV4, EventMetadataV5, EventMetadataV6, EventMetadataV7, EventMetadataV8, EventMetadataV9, FunctionArgumentMetadataLatest, FunctionArgumentMetadataV0, FunctionArgumentMetadataV1, FunctionArgumentMetadataV10, FunctionArgumentMetadataV11, FunctionArgumentMetadataV2, FunctionArgumentMetadataV3, FunctionArgumentMetadataV4, FunctionArgumentMetadataV5, FunctionArgumentMetadataV6, FunctionArgumentMetadataV7, FunctionArgumentMetadataV8, FunctionArgumentMetadataV9, FunctionMetadataLatest, FunctionMetadataV0, FunctionMetadataV1, FunctionMetadataV10, FunctionMetadataV11, FunctionMetadataV2, FunctionMetadataV3, FunctionMetadataV4, FunctionMetadataV5, FunctionMetadataV6, FunctionMetadataV7, FunctionMetadataV8, FunctionMetadataV9, MapKindV11, MapTypeV0, MapTypeV10, MapTypeV11, MapTypeV2, MapTypeV3, MapTypeV4, MapTypeV5, MapTypeV6, MapTypeV7, MapTypeV8, MapTypeV9, MetadataAll, MetadataLatest, MetadataV0, MetadataV1, MetadataV10, MetadataV11, MetadataV2, MetadataV3, MetadataV4, MetadataV5, MetadataV6, MetadataV7, MetadataV8, MetadataV9, ModuleConstantMetadataLatest, ModuleConstantMetadataV10, ModuleConstantMetadataV11, ModuleConstantMetadataV6, ModuleConstantMetadataV7, ModuleConstantMetadataV8, ModuleConstantMetadataV9, ModuleMetadataLatest, ModuleMetadataV0, ModuleMetadataV1, ModuleMetadataV10, ModuleMetadataV11, ModuleMetadataV2, ModuleMetadataV3, ModuleMetadataV4, ModuleMetadataV5, ModuleMetadataV6, ModuleMetadataV7, ModuleMetadataV8, ModuleMetadataV9, OuterDispatchCallV0, OuterDispatchMetadataV0, OuterEventEventMetadataEventsV0, OuterEventEventMetadataV0, OuterEventMetadataV0, PlainTypeLatest, PlainTypeV0, PlainTypeV10, PlainTypeV11, PlainTypeV2, PlainTypeV3, PlainTypeV4, PlainTypeV5, PlainTypeV6, PlainTypeV7, PlainTypeV8, PlainTypeV9, RuntimeModuleMetadataV0, StorageEntryMetadataLatest, StorageEntryMetadataV10, StorageEntryMetadataV11, StorageEntryMetadataV6, StorageEntryMetadataV7, StorageEntryMetadataV8, StorageEntryMetadataV9, StorageEntryModifierLatest, StorageEntryModifierV10, StorageEntryModifierV11, StorageEntryModifierV6, StorageEntryModifierV7, StorageEntryModifierV8, StorageEntryModifierV9, StorageEntryTypeLatest, StorageEntryTypeV10, StorageEntryTypeV11, StorageEntryTypeV6, StorageEntryTypeV7, StorageEntryTypeV8, StorageEntryTypeV9, StorageFunctionMetadataV0, StorageFunctionMetadataV1, StorageFunctionMetadataV2, StorageFunctionMetadataV3, StorageFunctionMetadataV4, StorageFunctionMetadataV5, StorageFunctionModifierV0, StorageFunctionModifierV1, StorageFunctionModifierV2, StorageFunctionModifierV3, StorageFunctionModifierV4, StorageFunctionModifierV5, StorageFunctionTypeV0, StorageFunctionTypeV1, StorageFunctionTypeV2, StorageFunctionTypeV3, StorageFunctionTypeV4, StorageFunctionTypeV5, StorageHasher, StorageHasherV11, StorageHasherV5, StorageHasherV6, StorageHasherV7, StorageHasherV8, StorageHasherV9, StorageMetadataV0, StorageMetadataV10, StorageMetadataV11, StorageMetadataV7, StorageMetadataV8, StorageMetadataV9 } from '@polkadot/types/interfaces/metadata';
import { CallMetadataV0, DoubleMapTypeV10, DoubleMapTypeV11, DoubleMapTypeV3, DoubleMapTypeV4, DoubleMapTypeV5, DoubleMapTypeV6, DoubleMapTypeV7, DoubleMapTypeV8, DoubleMapTypeV9, ErrorMetadataV10, ErrorMetadataV11, ErrorMetadataV8, ErrorMetadataV9, EventMetadataLatest, EventMetadataV0, EventMetadataV1, EventMetadataV10, EventMetadataV11, EventMetadataV2, EventMetadataV3, EventMetadataV4, EventMetadataV5, EventMetadataV6, EventMetadataV7, EventMetadataV8, EventMetadataV9, FunctionArgumentMetadataLatest, FunctionArgumentMetadataV0, FunctionArgumentMetadataV1, FunctionArgumentMetadataV10, FunctionArgumentMetadataV11, FunctionArgumentMetadataV2, FunctionArgumentMetadataV3, FunctionArgumentMetadataV4, FunctionArgumentMetadataV5, FunctionArgumentMetadataV6, FunctionArgumentMetadataV7, FunctionArgumentMetadataV8, FunctionArgumentMetadataV9, FunctionMetadataLatest, FunctionMetadataV0, FunctionMetadataV1, FunctionMetadataV10, FunctionMetadataV11, FunctionMetadataV2, FunctionMetadataV3, FunctionMetadataV4, FunctionMetadataV5, FunctionMetadataV6, FunctionMetadataV7, FunctionMetadataV8, FunctionMetadataV9, MapKindV11, MapTypeV0, MapTypeV10, MapTypeV11, MapTypeV2, MapTypeV3, MapTypeV4, MapTypeV5, MapTypeV6, MapTypeV7, MapTypeV8, MapTypeV9, MetadataAll, MetadataLatest, MetadataV0, MetadataV1, MetadataV10, MetadataV11, MetadataV2, MetadataV3, MetadataV4, MetadataV5, MetadataV6, MetadataV7, MetadataV8, MetadataV9, ModuleConstantMetadataLatest, ModuleConstantMetadataV10, ModuleConstantMetadataV11, ModuleConstantMetadataV6, ModuleConstantMetadataV7, ModuleConstantMetadataV8, ModuleConstantMetadataV9, ModuleMetadataLatest, ModuleMetadataV0, ModuleMetadataV1, ModuleMetadataV10, ModuleMetadataV11, ModuleMetadataV2, ModuleMetadataV3, ModuleMetadataV4, ModuleMetadataV5, ModuleMetadataV6, ModuleMetadataV7, ModuleMetadataV8, ModuleMetadataV9, OuterDispatchCallV0, OuterDispatchMetadataV0, OuterEventEventMetadataEventsV0, OuterEventEventMetadataV0, OuterEventMetadataV0, PlainTypeLatest, PlainTypeV0, PlainTypeV10, PlainTypeV11, PlainTypeV2, PlainTypeV3, PlainTypeV4, PlainTypeV5, PlainTypeV6, PlainTypeV7, PlainTypeV8, PlainTypeV9, RuntimeModuleMetadataV0, StorageEntryMetadataLatest, StorageEntryMetadataV10, StorageEntryMetadataV11, StorageEntryMetadataV6, StorageEntryMetadataV7, StorageEntryMetadataV8, StorageEntryMetadataV9, StorageEntryModifierLatest, StorageEntryModifierV10, StorageEntryModifierV11, StorageEntryModifierV6, StorageEntryModifierV7, StorageEntryModifierV8, StorageEntryModifierV9, StorageEntryTypeLatest, StorageEntryTypeV10, StorageEntryTypeV11, StorageEntryTypeV6, StorageEntryTypeV7, StorageEntryTypeV8, StorageEntryTypeV9, StorageFunctionMetadataV0, StorageFunctionMetadataV1, StorageFunctionMetadataV2, StorageFunctionMetadataV3, StorageFunctionMetadataV4, StorageFunctionMetadataV5, StorageFunctionModifierV0, StorageFunctionModifierV1, StorageFunctionModifierV2, StorageFunctionModifierV3, StorageFunctionModifierV4, StorageFunctionModifierV5, StorageFunctionTypeV0, StorageFunctionTypeV1, StorageFunctionTypeV2, StorageFunctionTypeV3, StorageFunctionTypeV4, StorageFunctionTypeV5, StorageHasher, StorageHasherV10, StorageHasherV11, StorageHasherV4, StorageHasherV5, StorageHasherV6, StorageHasherV7, StorageHasherV8, StorageHasherV9, StorageMetadataV0, StorageMetadataV10, StorageMetadataV11, StorageMetadataV7, StorageMetadataV8, StorageMetadataV9 } from '@polkadot/types/interfaces/metadata';
import { ApiId, BlockHash, ChainProperties, ExtrinsicOrHash, ExtrinsicStatus, Health, KeyValueOption, NetworkState, PeerInfo, RpcMethods, RuntimeDispatchInfo, RuntimeVersion, RuntimeVersionApi, StorageChangeSet } from '@polkadot/types/interfaces/rpc';
export interface InterfaceRegistry {
@@ -80,12 +80,6 @@ export interface InterfaceRegistry {
StorageData: StorageData;
'Option<StorageData>': Option<StorageData>;
'Vec<StorageData>': Vec<StorageData>;
StorageHasherV10: StorageHasherV10;
'Option<StorageHasherV10>': Option<StorageHasherV10>;
'Vec<StorageHasherV10>': Vec<StorageHasherV10>;
StorageHasherV4: StorageHasherV4;
'Option<StorageHasherV4>': Option<StorageHasherV4>;
'Vec<StorageHasherV4>': Vec<StorageHasherV4>;
StorageKey: StorageKey;
'Option<StorageKey>': Option<StorageKey>;
'Vec<StorageKey>': Vec<StorageKey>;
@@ -1052,6 +1046,9 @@ export interface InterfaceRegistry {
StorageFunctionTypeV4: StorageFunctionTypeV4;
'Option<StorageFunctionTypeV4>': Option<StorageFunctionTypeV4>;
'Vec<StorageFunctionTypeV4>': Vec<StorageFunctionTypeV4>;
StorageHasherV4: StorageHasherV4;
'Option<StorageHasherV4>': Option<StorageHasherV4>;
'Vec<StorageHasherV4>': Vec<StorageHasherV4>;
DoubleMapTypeV5: DoubleMapTypeV5;
'Option<DoubleMapTypeV5>': Option<DoubleMapTypeV5>;
'Vec<DoubleMapTypeV5>': Vec<DoubleMapTypeV5>;
@@ -1301,6 +1298,9 @@ export interface InterfaceRegistry {
StorageMetadataV10: StorageMetadataV10;
'Option<StorageMetadataV10>': Option<StorageMetadataV10>;
'Vec<StorageMetadataV10>': Vec<StorageMetadataV10>;
StorageHasherV10: StorageHasherV10;
'Option<StorageHasherV10>': Option<StorageHasherV10>;
'Vec<StorageHasherV10>': Vec<StorageHasherV10>;
DoubleMapTypeV11: DoubleMapTypeV11;
'Option<DoubleMapTypeV11>': Option<DoubleMapTypeV11>;
'Vec<DoubleMapTypeV11>': Vec<DoubleMapTypeV11>;
@@ -217,6 +217,15 @@ export default {
DoubleMap: 'DoubleMapTypeV4'
}
},
StorageHasherV4: {
_enum: {
Blake2_128: null, // eslint-disable-line @typescript-eslint/camelcase
Blake2_256: null, // eslint-disable-line @typescript-eslint/camelcase
Twox128: null,
Twox256: null,
Twox64Concat: null
}
},
// v5
DoubleMapTypeV5: {
@@ -410,6 +419,16 @@ export default {
prefix: 'Text',
items: 'Vec<StorageEntryMetadataV10>'
},
StorageHasherV10: {
_enum: {
Blake2_128: null, // eslint-disable-line @typescript-eslint/camelcase
Blake2_256: null, // eslint-disable-line @typescript-eslint/camelcase
Blake2_128Concat: null, // eslint-disable-line @typescript-eslint/camelcase
Twox128: null,
Twox256: null,
Twox64Concat: null
}
},
// v11
DoubleMapTypeV11: 'DoubleMapTypeV10',
@@ -3,7 +3,7 @@
import { ITuple } from '@polkadot/types/types';
import { Enum, Option, Struct, Vec } from '@polkadot/types/codec';
import { Bytes, StorageHasherV10, StorageHasherV4, Text, Type, bool, u16 } from '@polkadot/types/primitive';
import { Bytes, Text, Type, bool, u16 } from '@polkadot/types/primitive';
/** Struct */
export interface CallMetadataV0 extends Struct {
@@ -1011,9 +1011,39 @@ export interface StorageFunctionTypeV5 extends Enum {
/** StorageHasherV11 */
export interface StorageHasher extends StorageHasherV11 {}
/** Enum */
export interface StorageHasherV10 extends Enum {
/** 0:: Blake2_128 */
readonly isBlake2128: boolean;
/** 1:: Blake2_256 */
readonly isBlake2256: boolean;
/** 2:: Blake2_128Concat */
readonly isBlake2128Concat: boolean;
/** 3:: Twox128 */
readonly isTwox128: boolean;
/** 4:: Twox256 */
readonly isTwox256: boolean;
/** 5:: Twox64Concat */
readonly isTwox64Concat: boolean;
}
/** StorageHasherV10 */
export interface StorageHasherV11 extends StorageHasherV10 {}
/** Enum */
export interface StorageHasherV4 extends Enum {
/** 0:: Blake2_128 */
readonly isBlake2128: boolean;
/** 1:: Blake2_256 */
readonly isBlake2256: boolean;
/** 2:: Twox128 */
readonly isTwox128: boolean;
/** 3:: Twox256 */
readonly isTwox256: boolean;
/** 4:: Twox64Concat */
readonly isTwox64Concat: boolean;
}
/** StorageHasherV4 */
export interface StorageHasherV5 extends StorageHasherV4 {}
@@ -1,119 +0,0 @@
// Copyright 2017-2020 @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 { Registry } from '../types';
import Enum from '../codec/Enum';
export class StorageHasherV4 extends Enum {
constructor (registry: Registry, value?: any) {
super(registry, [
'Blake2_128',
'Blake2_256',
'Twox128',
'Twox256',
'Twox64Concat'
], value);
}
/**
* @description Is the enum Blake2_128?
*/
public get isBlake2128 (): boolean {
return this.toNumber() === 0;
}
/**
* @description Is the enum Blake2_256?
*/
public get isBlake2256 (): boolean {
return this.toNumber() === 1;
}
/**
* @description Is the enum Twox128?
*/
public get isTwox128 (): boolean {
return this.toNumber() === 2;
}
/**
* @description Is the enum Twox256?
*/
public get isTwox256 (): boolean {
return this.toNumber() === 3;
}
/**
* @description Is the enum isTwox64Concat?
*/
public get isTwox64Concat (): boolean {
return this.toNumber() === 4;
}
public toJSON (): string {
// This looks prettier in the generated JSON
return this.toString();
}
}
export class StorageHasherV10 extends Enum {
constructor (registry: Registry, value?: any) {
super(registry, [
'Blake2_128',
'Blake2_256',
'Blake2_128Concat',
'Twox128',
'Twox256',
'Twox64Concat'
], value);
}
/**
* @description Is the enum Blake2_128?
*/
public get isBlake2128 (): boolean {
return this.toNumber() === 0;
}
/**
* @description Is the enum Blake2_256?
*/
public get isBlake2256 (): boolean {
return this.toNumber() === 1;
}
/**
* @description Is the enum Blake2_128Concat?
*/
public get isBlake2128Concat (): boolean {
return this.toNumber() === 2;
}
/**
* @description Is the enum Twox128?
*/
public get isTwox128 (): boolean {
return this.toNumber() === 3;
}
/**
* @description Is the enum Twox256?
*/
public get isTwox256 (): boolean {
return this.toNumber() === 4;
}
/**
* @description Is the enum isTwox64Concat?
*/
public get isTwox64Concat (): boolean {
return this.toNumber() === 5;
}
public toJSON (): string {
// This looks prettier in the generated JSON
return this.toString();
}
}
-1
View File
@@ -24,7 +24,6 @@ export { default as i128 } from './I128';
export { default as i256 } from './I256';
export { default as Null } from './Null';
export { default as StorageData } from './StorageData';
export { StorageHasherV10, StorageHasherV4 } from './StorageHasher';
export { default as StorageKey } from './StorageKey';
export { default as Text } from './Text';
export { default as Type } from './Type';