Bump dev (incl. lint fixes) (#2126)

* Bump dev (incl. lint fixes)

* Fix call encoding (stepped into that one)

* Event struct order

* Update with missing tuple type (getTypeDef type)
This commit is contained in:
Jaco Greeff
2020-04-01 22:44:34 +02:00
committed by GitHub
parent 7d3464ae2c
commit 0dc46445bc
130 changed files with 718 additions and 483 deletions
+3
View File
@@ -89,6 +89,7 @@ describe('Enum', (): void => {
expect(
new Enum(
registry,
// eslint-disable-next-line sort-keys
{ foo: 'Text', bar: 'u32' },
'0x0134120000'
).value.toString()
@@ -339,7 +340,9 @@ describe('Enum', (): void => {
it('has a sane output for typed enums', (): void => {
expect(
// eslint-disable-next-line sort-keys
new Enum(registry, { foo: Text, bar: U32 }).toRawType()
// eslint-disable-next-line sort-keys
).toEqual(JSON.stringify({ _enum: { foo: 'Text', bar: 'u32' } }));
});
});
+1
View File
@@ -21,6 +21,7 @@ export default class Linkage<T extends Codec> extends Struct {
constructor (registry: Registry, Type: Constructor | keyof InterfaceTypes, value?: any) {
super(registry, {
previous: Option.with(Type),
// eslint-disable-next-line sort-keys
next: Option.with(Type)
}, value);
}
+1 -1
View File
@@ -10,7 +10,7 @@ import Result from './Result';
describe('Result', (): void => {
const registry = new TypeRegistry();
const Type = Result.with({ Ok: u32, Error: Text });
const Type = Result.with({ Error: Text, Ok: u32 });
it('has a sane toRawType representation', (): void => {
expect(new Type(registry).toRawType()).toEqual('Result<u32,Text>');
+1
View File
@@ -16,6 +16,7 @@ import Enum from './Enum';
export default class Result<O extends Codec, E extends Codec> extends Enum {
constructor (registry: Registry, Ok: Constructor<O> | keyof InterfaceTypes, Error: Constructor<E> | keyof InterfaceTypes, value?: any) {
// NOTE This is order-dependent, Ok (with index 0) needs to be first
// eslint-disable-next-line sort-keys
super(registry, { Ok, Error }, value);
}
+3
View File
@@ -2,9 +2,12 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
/* eslint-disable sort-keys */
import { TypeRegistry } from '../create';
import Set from './Set';
// TODO actually import these from definitions, don't re-define here
const SET_FIELDS = {
header: 0b00000001,
body: 0b00000010,
+4 -1
View File
@@ -228,6 +228,9 @@ export default class CodecSet extends Set<string> implements Codec {
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public toU8a (isBare?: boolean): Uint8Array {
return bnToU8a(this.valueEncoded, { isLe: false, bitLength: this.#byteLength * 8 });
return bnToU8a(this.valueEncoded, {
bitLength: this.#byteLength * 8,
isLe: false
});
}
}
+2
View File
@@ -2,6 +2,8 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
/* eslint-disable sort-keys */
import { TypeRegistry } from '../create';
import AccountId from '../generic/AccountId';
import Text from '../primitive/Text';
+1
View File
@@ -127,6 +127,7 @@ describe('Tuple', (): void => {
it('generates sane value with object types', (): void => {
expect(
// eslint-disable-next-line sort-keys
new Tuple(registry, { number: U128, blockNumber: registry.createClass('BlockNumber') }).toRawType()
).toEqual('(u128,u32)');
});
@@ -21,7 +21,7 @@ export function paramsNotation (outer: string, inner?: string | any[], transform
}
function encodeWithParams (typeDef: Pick<TypeDef, any>, outer = typeDef.displayName || typeDef.type): string {
const { info, sub, params } = typeDef;
const { info, params, sub } = typeDef;
switch (info) {
case TypeDefInfo.BTreeMap:
+3 -3
View File
@@ -106,7 +106,7 @@ const infoMapping: Record<TypeDefInfo, (registry: Registry, value: TypeDef) => C
// We have circular deps between Linkage & Struct
[TypeDefInfo.Linkage]: (registry: Registry, value: TypeDef): Constructor => {
const type = `Option<${getSubType(value)}>`;
const Clazz = Struct.with({ previous: type, next: type } as any);
const Clazz = Struct.with({ next: type, previous: type } as any);
ClassOf.prototype.toRawType = function (): string {
return `Linkage<${this.next.toRawType(true)}>`;
@@ -127,14 +127,14 @@ const infoMapping: Record<TypeDefInfo, (registry: Registry, value: TypeDef) => C
const [Ok, Error] = getTypeClassArray(value);
// eslint-disable-next-line @typescript-eslint/no-use-before-define
return Result.with({ Ok, Error });
return Result.with({ Error, Ok });
},
[TypeDefInfo.Set]: (registry: Registry, value: TypeDef): Constructor => {
const result: Record<string, number> = {};
return CodecSet.with(
getSubDefArray(value).reduce((result, { name, index }): Record<string, number> => {
getSubDefArray(value).reduce((result, { index, name }): Record<string, number> => {
result[name as string] = index as number;
return result;
+7 -3
View File
@@ -125,17 +125,19 @@ describe('createType', (): void => {
registry.register({
TestComplex: {
balance: 'Balance',
// eslint-disable-next-line sort-keys
accountId: 'AccountId',
log: '(u64, u32)',
// eslint-disable-next-line sort-keys
fromSrml: 'Gas'
}
});
const value = createTypeUnsafe(registry, 'TestComplex', [{
balance: 123,
accountId: '0x1234567812345678123456781234567812345678123456781234567812345678',
log: [456, 789],
fromSrml: 0
balance: 123,
fromSrml: 0,
log: [456, 789]
}]);
expect(value instanceof createClass(registry, 'TestComplex')).toBe(true);
@@ -160,8 +162,10 @@ describe('createType', (): void => {
Balance: 'u128',
TestComplex: {
balance: 'Balance',
// eslint-disable-next-line sort-keys
accountId: 'AccountId',
log: '(u64, u32)',
// eslint-disable-next-line sort-keys
fromSrml: 'Gas'
}
});
+42 -42
View File
@@ -34,7 +34,6 @@ describe('getTypeDef', (): void => {
getTypeDef('BTreeMap<u32, Text>')
).toEqual({
info: TypeDefInfo.BTreeMap,
type: 'BTreeMap<u32,Text>',
sub: [
{
info: TypeDefInfo.Plain,
@@ -44,7 +43,8 @@ describe('getTypeDef', (): void => {
info: TypeDefInfo.Plain,
type: 'Text'
}
]
],
type: 'BTreeMap<u32,Text>'
});
});
@@ -53,11 +53,11 @@ describe('getTypeDef', (): void => {
getTypeDef('BTreeSet<Text>')
).toEqual({
info: TypeDefInfo.BTreeSet,
type: 'BTreeSet<Text>',
sub: {
info: TypeDefInfo.Plain,
type: 'Text'
}
},
type: 'BTreeSet<Text>'
});
});
@@ -66,7 +66,6 @@ describe('getTypeDef', (): void => {
getTypeDef('Result<u32, Text>')
).toEqual({
info: TypeDefInfo.Result,
type: 'Result<u32,Text>',
sub: [
{
info: TypeDefInfo.Plain,
@@ -76,7 +75,8 @@ describe('getTypeDef', (): void => {
info: TypeDefInfo.Plain,
type: 'Text'
}
]
],
type: 'Result<u32,Text>'
});
});
@@ -85,11 +85,9 @@ describe('getTypeDef', (): void => {
getTypeDef('Result<Result<Null,u32>,Text>')
).toEqual({
info: TypeDefInfo.Result,
type: 'Result<Result<Null,u32>,Text>',
sub: [
{
info: TypeDefInfo.Result,
type: 'Result<Null,u32>',
sub: [
{
info: TypeDefInfo.Plain,
@@ -99,13 +97,15 @@ describe('getTypeDef', (): void => {
info: TypeDefInfo.Plain,
type: 'u32'
}
]
],
type: 'Result<Null,u32>'
},
{
info: TypeDefInfo.Plain,
type: 'Text'
}
]
],
type: 'Result<Result<Null,u32>,Text>'
});
});
@@ -114,7 +114,6 @@ describe('getTypeDef', (): void => {
getTypeDef('(u32, Compact<u32>, Vec<u64>, Option<u128>, (Text,Vec<(Bool,u128)>))')
).toEqual({
info: TypeDefInfo.Tuple,
type: '(u32,Compact<u32>,Vec<u64>,Option<u128>,(Text,Vec<(Bool,u128)>))',
sub: [
{
info: TypeDefInfo.Plain,
@@ -122,31 +121,30 @@ describe('getTypeDef', (): void => {
},
{
info: TypeDefInfo.Compact,
type: 'Compact<u32>',
sub: {
info: TypeDefInfo.Plain,
type: 'u32'
}
},
type: 'Compact<u32>'
},
{
info: TypeDefInfo.Vec,
type: 'Vec<u64>',
sub: {
info: TypeDefInfo.Plain,
type: 'u64'
}
},
type: 'Vec<u64>'
},
{
info: TypeDefInfo.Option,
type: 'Option<u128>',
sub: {
info: TypeDefInfo.Plain,
type: 'u128'
}
},
type: 'Option<u128>'
},
{
info: TypeDefInfo.Tuple,
type: '(Text,Vec<(Bool,u128)>)',
sub: [
{
info: TypeDefInfo.Plain,
@@ -154,10 +152,8 @@ describe('getTypeDef', (): void => {
},
{
info: TypeDefInfo.Vec,
type: 'Vec<(Bool,u128)>',
sub: {
info: TypeDefInfo.Tuple,
type: '(Bool,u128)',
sub: [
{
info: TypeDefInfo.Plain,
@@ -167,12 +163,16 @@ describe('getTypeDef', (): void => {
info: TypeDefInfo.Plain,
type: 'u128'
}
]
}
],
type: '(Bool,u128)'
},
type: 'Vec<(Bool,u128)>'
}
]
],
type: '(Text,Vec<(Bool,u128)>)'
}
]
],
type: '(u32,Compact<u32>,Vec<u64>,Option<u128>,(Text,Vec<(Bool,u128)>))'
});
});
@@ -181,10 +181,8 @@ describe('getTypeDef', (): void => {
getTypeDef('Vec<(Box<PropIndex>, Proposal,Lookup::Target)>')
).toEqual({
info: TypeDefInfo.Vec,
type: 'Vec<(PropIndex,Proposal,LookupTarget)>',
sub: {
info: TypeDefInfo.Tuple,
type: '(PropIndex,Proposal,LookupTarget)',
sub: [
{
info: TypeDefInfo.Plain,
@@ -198,8 +196,10 @@ describe('getTypeDef', (): void => {
info: TypeDefInfo.Plain,
type: 'LookupTarget'
}
]
}
],
type: '(PropIndex,Proposal,LookupTarget)'
},
type: 'Vec<(PropIndex,Proposal,LookupTarget)>'
});
});
@@ -208,10 +208,8 @@ describe('getTypeDef', (): void => {
getTypeDef('Vec<(PropIndex, Proposal, AccountId)>')
).toEqual({
info: TypeDefInfo.Vec,
type: 'Vec<(PropIndex,Proposal,AccountId)>',
sub: {
info: TypeDefInfo.Tuple,
type: '(PropIndex,Proposal,AccountId)',
sub: [
{
info: TypeDefInfo.Plain,
@@ -225,8 +223,10 @@ describe('getTypeDef', (): void => {
info: TypeDefInfo.Plain,
type: 'AccountId'
}
]
}
],
type: '(PropIndex,Proposal,AccountId)'
},
type: 'Vec<(PropIndex,Proposal,AccountId)>'
});
});
@@ -235,7 +235,6 @@ describe('getTypeDef', (): void => {
getTypeDef('{"balance":"Balance","account_id":"AccountId","log":"(u64, Signature)"}')
).toEqual({
info: TypeDefInfo.Struct,
type: '{"balance":"Balance","account_id":"AccountId","log":"(u64,Signature)"}',
sub: [
{
info: TypeDefInfo.Plain,
@@ -250,7 +249,6 @@ describe('getTypeDef', (): void => {
{
info: TypeDefInfo.Tuple,
name: 'log',
type: '(u64,Signature)',
sub: [
{
info: TypeDefInfo.Plain,
@@ -260,9 +258,11 @@ describe('getTypeDef', (): void => {
info: TypeDefInfo.Plain,
type: 'Signature'
}
]
],
type: '(u64,Signature)'
}
]
],
type: '{"balance":"Balance","account_id":"AccountId","log":"(u64,Signature)"}'
});
});
@@ -271,23 +271,23 @@ describe('getTypeDef', (): void => {
expect(
getTypeDef('[[u8;32];3]')
).toEqual({
info: TypeDefInfo.VecFixed,
type: '[[u8;32];3]',
ext: {
length: 3,
type: '[u8;32]'
},
info: TypeDefInfo.VecFixed,
sub: {
info: TypeDefInfo.VecFixed,
type: '[u8;32]',
ext: {
length: 32
},
info: TypeDefInfo.VecFixed,
sub: {
info: TypeDefInfo.Plain,
type: 'u8'
}
}
},
type: '[u8;32]'
},
type: '[[u8;32];3]'
});
});
});
+2 -2
View File
@@ -158,10 +158,10 @@ interface TypeDefOptions {
displayName?: string;
}
export function getTypeDef (_type: string, { name, displayName }: TypeDefOptions = {}): TypeDef {
export function getTypeDef (_type: string, { displayName, name }: TypeDefOptions = {}): TypeDef {
// create the type via Type, allowing types to be sanitized
const type = sanitize(_type);
const value: TypeDef = { info: TypeDefInfo.Plain, displayName, name, type };
const value: TypeDef = { displayName, info: TypeDefInfo.Plain, name, type };
const nested = nestedExtraction.find((nested): boolean =>
hasWrapper(type, nested)
);
+4 -4
View File
@@ -110,15 +110,15 @@ describe('TypeRegistry', (): void => {
it('can create structs via definition', (): void => {
registry.register({
SomeStruct: {
foo: 'u32',
bar: 'Text'
bar: 'Text',
foo: 'u32'
}
});
const SomeStruct = registry.getOrThrow('SomeStruct');
const struct: any = new SomeStruct(registry, {
foo: 42,
bar: 'testing'
bar: 'testing',
foo: 42
});
expect(struct instanceof Struct).toBe(true);
+1 -1
View File
@@ -23,7 +23,7 @@ function decorateErrors (_: Registry, metadata: RegistryMetadata, metadataErrors
metadata.asLatest.modules.forEach((section, sectionIndex): void => {
const sectionName = stringCamelCase(section.name.toString());
section.errors.forEach(({ name, documentation }, index): void => {
section.errors.forEach(({ documentation, name }, index): void => {
const eventIndex = new Uint8Array([sectionIndex, index]);
metadataErrors[u8aToHex(eventIndex)] = {
+5 -5
View File
@@ -256,15 +256,15 @@ export default class Extrinsic extends ExtrinsicBase implements IExtrinsic {
*/
public toHuman (isExpanded?: boolean): AnyJson {
return {
method: this.method.toHuman(isExpanded),
isSigned: this.isSigned,
method: this.method.toHuman(isExpanded),
...(this.isSigned
? {
signer: this.signer.toHuman(isExpanded),
nonce: this.nonce.toHuman(isExpanded),
era: this.era.toHuman(isExpanded),
tip: this.tip.toHuman(isExpanded),
signature: this.signature.toHex()
nonce: this.nonce.toHuman(isExpanded),
signature: this.signature.toHex(),
signer: this.signer.toHuman(isExpanded),
tip: this.tip.toHuman(isExpanded)
}
: {}
)
@@ -27,6 +27,7 @@ export default class ExtrinsicV1 extends Struct implements IExtrinsicImpl {
constructor (registry: Registry, value?: Uint8Array | ExtrinsicValueV1, { isSigned }: Partial<ExtrinsicOptions> = {}) {
super(registry, {
signature: 'ExtrinsicSignatureV1',
// eslint-disable-next-line sort-keys
method: 'Call'
}, ExtrinsicV1.decodeExtrinsic(registry, value, isSigned));
}
@@ -26,8 +26,11 @@ export default class ExtrinsicPayloadV1 extends Struct {
constructor (registry: Registry, value?: ExtrinsicPayloadValue | Uint8Array | string) {
super(registry, {
nonce: 'Compact<Index>',
// eslint-disable-next-line sort-keys
method: 'Bytes',
// eslint-disable-next-line sort-keys
era: 'ExtrinsicEra',
// eslint-disable-next-line sort-keys
blockHash: 'Hash'
}, value);
}
@@ -26,8 +26,11 @@ export default class ExtrinsicSignatureV1 extends Struct implements IExtrinsicSi
constructor (registry: Registry, value?: ExtrinsicSignatureV1 | Uint8Array, { isSigned }: ExtrinsicSignatureOptions = {}) {
super(registry, {
signer: 'Address',
// eslint-disable-next-line sort-keys
signature: 'Signature',
// eslint-disable-next-line sort-keys
nonce: 'Compact<Index>',
// eslint-disable-next-line sort-keys
era: 'ExtrinsicEra'
}, ExtrinsicSignatureV1.decodeExtrinsicSignature(value, isSigned));
}
@@ -27,6 +27,7 @@ export default class ExtrinsicV2 extends Struct implements IExtrinsicImpl {
constructor (registry: Registry, value?: Uint8Array | ExtrinsicValueV2 | Call, { isSigned }: Partial<ExtrinsicOptions> = {}) {
super(registry, {
signature: 'ExtrinsicSignatureV2',
// eslint-disable-next-line sort-keys
method: 'Call'
}, ExtrinsicV2.decodeExtrinsic(registry, value, isSigned));
}
@@ -21,9 +21,11 @@ export default class ExtrinsicPayloadV2 extends Struct {
constructor (registry: Registry, value?: ExtrinsicPayloadValue | Uint8Array | string) {
super(registry, {
method: 'Bytes',
// eslint-disable-next-line sort-keys
era: 'ExtrinsicEra',
nonce: 'Compact<Index>',
tip: 'Compact<Balance>',
// eslint-disable-next-line sort-keys
blockHash: 'Hash'
}, value);
}
@@ -21,7 +21,9 @@ export default class ExtrinsicSignatureV2 extends Struct implements IExtrinsicSi
constructor (registry: Registry, value: ExtrinsicSignatureV2 | Uint8Array | undefined, { isSigned }: ExtrinsicSignatureOptions = {}) {
super(registry, {
signer: 'Address',
// eslint-disable-next-line sort-keys
signature: 'Signature',
// eslint-disable-next-line sort-keys
era: 'ExtrinsicEra',
nonce: 'Compact<Index>',
tip: 'Compact<Balance>'
@@ -27,6 +27,7 @@ export default class ExtrinsicV3 extends Struct implements IExtrinsicImpl {
constructor (registry: Registry, value?: Uint8Array | ExtrinsicValueV3 | Call, { isSigned }: Partial<ExtrinsicOptions> = {}) {
super(registry, {
signature: 'ExtrinsicSignatureV3',
// eslint-disable-next-line sort-keys
method: 'Call'
}, ExtrinsicV3.decodeExtrinsic(registry, value, isSigned));
}
@@ -22,13 +22,15 @@ export default class ExtrinsicPayloadV3 extends Struct {
constructor (registry: Registry, value?: ExtrinsicPayloadValue | Uint8Array | string) {
super(registry, {
method: 'Bytes',
// extensions
// eslint-disable-next-line sort-keys
era: 'ExtrinsicEra',
nonce: 'Compact<Index>',
tip: 'Compact<Balance>',
// extensions (additional)
// eslint-disable-next-line sort-keys
specVersion: 'u32',
// eslint-disable-next-line sort-keys
genesisHash: 'Hash',
// eslint-disable-next-line sort-keys
blockHash: 'Hash'
}, value);
}
@@ -27,6 +27,7 @@ export default class ExtrinsicV4 extends Struct implements IExtrinsicImpl {
constructor (registry: Registry, value?: Uint8Array | ExtrinsicValueV4 | Call, { isSigned }: Partial<ExtrinsicOptions> = {}) {
super(registry, {
signature: 'ExtrinsicSignatureV4',
// eslint-disable-next-line sort-keys
method: 'Call'
}, ExtrinsicV4.decodeExtrinsic(registry, value, isSigned));
}
@@ -23,6 +23,7 @@ export default class ExtrinsicSignatureV4 extends Struct implements IExtrinsicSi
constructor (registry: Registry, value: ExtrinsicSignatureV4 | Uint8Array | undefined, { isSigned }: ExtrinsicSignatureOptions = {}) {
super(registry, {
signer: 'Address',
// eslint-disable-next-line sort-keys
signature: 'MultiSignature',
...registry.getSignedExtensionTypes()
}, ExtrinsicSignatureV4.decodeExtrinsicSignature(value, isSigned));
+2
View File
@@ -2,6 +2,8 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
/* eslint-disable sort-keys */
import Metadata from '@polkadot/metadata/Metadata';
import metadataStatic from '@polkadot/metadata/Metadata/static';
+1
View File
@@ -33,6 +33,7 @@ export default class Block extends Struct {
constructor (registry: Registry, value?: BlockValue | Uint8Array) {
super(registry, {
header: 'Header',
// eslint-disable-next-line sort-keys
extrinsics: 'Vec<Extrinsic>'
}, value);
}
+6 -5
View File
@@ -55,8 +55,8 @@ function decodeCallViaObject (registry: Registry, value: DecodedMethod, _meta?:
return {
args,
argsDef: getArgsDef(registry, meta),
meta,
callIndex
callIndex,
meta
};
}
@@ -124,6 +124,7 @@ export default class Call extends Struct implements IMethod {
super(registry, {
callIndex: CallIndex,
// eslint-disable-next-line sort-keys
args: Struct.with(decoded.argsDef)
}, decoded);
@@ -212,10 +213,10 @@ export default class Call extends Struct implements IMethod {
}
return {
callIndex: u8aToHex(this.callIndex),
section: call?.section,
method: call?.method,
args: this.args.map((arg) => arg.toHuman(isExpanded)),
callIndex: u8aToHex(this.callIndex),
method: call?.method,
section: call?.section,
...(isExpanded && call
? { documentation: call.meta.documentation.map((d) => d.toString()) }
: {}
+3 -2
View File
@@ -77,6 +77,7 @@ export default class Event extends Struct {
super(registry, {
index: 'EventId',
// eslint-disable-next-line sort-keys
data: DataType
}, value);
}
@@ -94,8 +95,8 @@ export default class Event extends Struct {
return {
DataType: registry.findMetaEvent(index),
value: {
index,
data: value.subarray(2)
data: value.subarray(2),
index
}
};
}
+2 -2
View File
@@ -101,8 +101,8 @@ export default class Vote extends U8aFixed {
*/
public toHuman (isExpanded?: boolean): AnyJson {
return {
vote: this.isAye ? 'Aye' : 'Nay',
conviction: this.conviction.toHuman(isExpanded)
conviction: this.conviction.toHuman(isExpanded),
vote: this.isAye ? 'Aye' : 'Nay'
};
}
@@ -2,6 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// order important in structs... :)
/* eslint-disable sort-keys */
import { Definitions } from '../../types';
export default {
@@ -2,6 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// order important in structs... :)
/* eslint-disable sort-keys */
import { Definitions } from '../../types';
export default {
@@ -2,6 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// order important in structs... :)
/* eslint-disable sort-keys */
import { Definitions } from '../../types';
export default {
@@ -2,6 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// order important in structs... :)
/* eslint-disable sort-keys */
import { Definitions } from '../../types';
export default {
@@ -2,6 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// order important in structs... :)
/* eslint-disable sort-keys */
import { Definitions } from '../../types';
export default {
@@ -2,6 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// order important in structs... :)
/* eslint-disable sort-keys */
import { Definitions } from '../../types';
export default {
@@ -2,6 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// order important in structs... :)
/* eslint-disable sort-keys */
import { Definitions } from '../../types';
export default {
@@ -2,6 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// order important in structs... :)
/* eslint-disable sort-keys */
import { Definitions } from '../../types';
export default {
@@ -2,6 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// order important in structs... :)
/* eslint-disable sort-keys */
import { Definitions } from '../../types';
export default {
@@ -2,6 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// order important in structs... :)
/* eslint-disable sort-keys */
import { Definitions } from '../../types';
export default {
@@ -2,6 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// order important in structs... :)
/* eslint-disable sort-keys */
import { Definitions } from '../../types';
export default {
@@ -2,6 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// order important in structs... :)
/* eslint-disable sort-keys */
import { Definitions } from '../../types';
export default {
@@ -2,6 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// order important in structs... :)
/* eslint-disable sort-keys */
import { Definitions } from '../../types';
export default {
@@ -2,6 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// order important in structs... :)
/* eslint-disable sort-keys */
import { Definitions } from '../../types';
const AllConvictions = [
@@ -2,6 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// order important in structs... :)
/* eslint-disable sort-keys */
import { Definitions } from '../../types';
export default {
@@ -2,6 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// order important in structs... :)
/* eslint-disable sort-keys */
import { Definitions } from '../../types';
export default {
@@ -2,6 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// order important in structs... :)
/* eslint-disable sort-keys */
import { Definitions } from '../../types';
export default {
@@ -2,6 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// order important in structs... :)
/* eslint-disable sort-keys */
import { Definitions } from '../../types';
export default {
@@ -2,6 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// order important in structs... :)
/* eslint-disable sort-keys */
import { Definitions } from '../../types';
export default {
@@ -2,6 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// order important in structs... :)
/* eslint-disable sort-keys */
import { Definitions } from '../../types';
export default {
@@ -2,6 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// order important in structs... :)
/* eslint-disable sort-keys */
import { Definitions } from '../../types';
export default {
@@ -2,6 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// order important in structs... :)
/* eslint-disable sort-keys */
import { Definitions } from '../../types';
export default {
@@ -2,6 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// order important in structs... :)
/* eslint-disable sort-keys */
import { Definitions } from '../../types';
const AllHashers = {
@@ -2,6 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// order important in structs... :)
/* eslint-disable sort-keys */
import { Definitions } from '../../types';
export default {
@@ -2,6 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// order important in structs... :)
/* eslint-disable sort-keys */
import { Definitions } from '../../types';
export default {
@@ -2,6 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// order important in structs... :)
/* eslint-disable sort-keys */
import { Definitions } from '../../types';
export default {
@@ -2,6 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// order important in structs... :)
/* eslint-disable sort-keys */
import { Definitions } from '../../types';
export default {
@@ -2,6 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// order important in structs... :)
/* eslint-disable sort-keys */
import { Definitions } from '../../types';
export default {
@@ -2,6 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// order important in structs... :)
/* eslint-disable sort-keys */
import { Definitions } from '../../types';
export default {
@@ -2,6 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// order important in structs... :)
/* eslint-disable sort-keys */
import { Definitions } from '../../types';
export default {
@@ -2,6 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// order important in structs... :)
/* eslint-disable sort-keys */
import { Definitions } from '../../types';
// The runtime definition of SessionKeys are passed as a Trait to session
@@ -2,6 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// order important in structs... :)
/* eslint-disable sort-keys */
import { Definitions } from '../../types';
export default {
@@ -2,6 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// order important in structs... :)
/* eslint-disable sort-keys */
import { Definitions } from '../../types';
const deprecated = {
@@ -2,6 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// order important in structs... :)
/* eslint-disable sort-keys */
import { Definitions } from '../../types';
export default {
@@ -2,6 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// order important in structs... :)
/* eslint-disable sort-keys */
import { Definitions } from '../../types';
export default {
@@ -2,13 +2,14 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// order important in structs... :)
/* eslint-disable sort-keys */
import { Definitions } from '../../types';
export default {
rpc: {},
types: {
OpenTipFinder: '(AccountId, Balance)',
OpenTipTip: '(AccountId, Balance)',
OpenTip: {
reason: 'Hash',
who: 'AccountId',
@@ -16,6 +17,8 @@ export default {
closes: 'Option<BlockNumber>',
tips: 'Vec<OpenTipTip>'
},
OpenTipFinder: '(AccountId, Balance)',
OpenTipTip: '(AccountId, Balance)',
TreasuryProposal: {
proposer: 'AccountId',
value: 'Balance',
@@ -2,20 +2,23 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// order important in structs... :)
/* eslint-disable sort-keys */
import { Definitions } from '../../types';
export default {
rpc: {},
types: {
Timepoint: {
height: 'BlockNumber',
index: 'u32'
},
Multisig: {
when: 'Timepoint',
deposit: 'Balance',
depositor: 'AccountId',
approvals: 'Vec<AccountId>'
},
Timepoint: {
height: 'BlockNumber',
index: 'u32'
}
}
} as Definitions;
@@ -2,6 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// order important in structs... :)
/* eslint-disable sort-keys */
import { Definitions } from '../../types';
export default {
+2
View File
@@ -57,8 +57,10 @@ export default class Data extends Enum {
super(registry, {
None: 'Null', // 0
Raw: 'Bytes', // 1
// eslint-disable-next-line sort-keys
BlakeTwo256: 'H256', // 2
Sha256: 'H256', // 3
// eslint-disable-next-line sort-keys
Keccak256: 'H256', // 4
ShaThree256: 'H256' // 5
}, ...decodeData(registry, value));
+3 -5
View File
@@ -35,14 +35,12 @@ interface StorageKeyExtra {
const HASHER_MAP: Record<keyof typeof AllHashers, [number, boolean]> = {
// opaque
Blake2_128: [16, false], // eslint-disable-line @typescript-eslint/camelcase
Blake2_128Concat: [16, true], // eslint-disable-line @typescript-eslint/camelcase
Blake2_256: [32, false], // eslint-disable-line @typescript-eslint/camelcase
Identity: [0, true],
Twox128: [16, false],
Twox256: [32, false],
// can decode
Blake2_128Concat: [16, true], // eslint-disable-line @typescript-eslint/camelcase
Twox64Concat: [8, true],
Identity: [0, true]
Twox64Concat: [8, true]
};
function getStorageType (type: StorageEntryTypeLatest, isOptionalLinked?: boolean): [boolean, string] {