Convert all type/* (and some primitives) to srml/* (#1189)
* Convert (almost-all) non-primitives (and some primitives) to srml/* * Move Vote to primitives, remove type folder * Move Balance :-o * Fixup tests, override Balance.toRaw()
This commit is contained in:
@@ -2,16 +2,22 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Balance, BlockNumber } from '../srml/runtime/types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
|
||||
import Balance from '../primitive/Balance';
|
||||
import createType, { ClassOf } from '../codec/createType';
|
||||
import Moment from '../primitive/Moment';
|
||||
import U32 from '../primitive/U32';
|
||||
import BlockNumber from '../type/BlockNumber';
|
||||
import { injectDefinitions } from '../srml';
|
||||
import Compact from './Compact';
|
||||
import UInt from './UInt';
|
||||
|
||||
describe('Compact', (): void => {
|
||||
beforeEach((): void => {
|
||||
injectDefinitions();
|
||||
});
|
||||
|
||||
describe('encodeU8a', (): void => {
|
||||
it('encodes short u8', (): void => {
|
||||
expect(
|
||||
@@ -63,7 +69,7 @@ describe('Compact', (): void => {
|
||||
|
||||
it('encondes a large balance', (): void => {
|
||||
expect(
|
||||
Compact.encodeU8a(new Balance('0x5af3107a4000'))
|
||||
Compact.encodeU8a(createType<Balance>('Balance', '0x5af3107a4000'))
|
||||
).toEqual(
|
||||
new Uint8Array([
|
||||
3 + ((6 - 4) << 2),
|
||||
@@ -108,13 +114,13 @@ describe('Compact', (): void => {
|
||||
describe('constructor', (): void => {
|
||||
it('has the correct bitLength for constructor values (BlockNumber)', (): void => {
|
||||
expect(
|
||||
new Compact(BlockNumber, 0xfffffff9).bitLength()
|
||||
new Compact(ClassOf<BlockNumber>('BlockNumber'), 0xfffffff9).bitLength()
|
||||
).toEqual(64);
|
||||
});
|
||||
|
||||
it('has the correct encodedLength for constructor values (BlockNumber)', (): void => {
|
||||
expect(
|
||||
new Compact(BlockNumber, 0xfffffff9).encodedLength
|
||||
new Compact(ClassOf<BlockNumber>('BlockNumber'), 0xfffffff9).encodedLength
|
||||
).toEqual(5);
|
||||
});
|
||||
|
||||
|
||||
@@ -6,8 +6,13 @@ import Enum from './Enum';
|
||||
import Null from '../primitive/Null';
|
||||
import Text from '../primitive/Text';
|
||||
import U32 from '../primitive/U32';
|
||||
import { injectDefinitions } from '../srml';
|
||||
|
||||
describe('Enum', (): void => {
|
||||
beforeEach((): void => {
|
||||
injectDefinitions();
|
||||
});
|
||||
|
||||
describe('typed enum (previously EnumType)', (): void => {
|
||||
it('provides a clean toString() (value)', (): void => {
|
||||
expect(
|
||||
|
||||
@@ -2,18 +2,20 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { ClassOf } from '../codec/createType';
|
||||
import AccountId from '../primitive/AccountId';
|
||||
import Balance from '../primitive/Balance';
|
||||
import Text from '../primitive/Text';
|
||||
import U32 from '../primitive/U32';
|
||||
import BlockNumber from '../type/BlockNumber';
|
||||
import { injectDefinitions } from '../srml';
|
||||
import { CodecTo } from '../types';
|
||||
import Compact from './Compact';
|
||||
import Option from './Option';
|
||||
import Struct from './Struct';
|
||||
import Vector from './Vector';
|
||||
|
||||
describe('Struct', (): void => {
|
||||
beforeEach((): void => {
|
||||
injectDefinitions();
|
||||
});
|
||||
|
||||
describe('decoding', (): void => {
|
||||
const testDecode = (type: string, input: any): void =>
|
||||
it(`can decode from ${type}`, (): void => {
|
||||
@@ -182,7 +184,7 @@ describe('Struct', (): void => {
|
||||
// replicate https://github.com/polkadot-js/api/issues/640
|
||||
expect(
|
||||
new Struct({
|
||||
blockNumber: Option.with(BlockNumber)
|
||||
blockNumber: ClassOf('Option<BlockNumber>')
|
||||
}, { blockNumber: '0x1234567890abcdef' }).toString()
|
||||
).toEqual('{"blockNumber":"0x1234567890abcdef"}');
|
||||
});
|
||||
@@ -191,16 +193,16 @@ describe('Struct', (): void => {
|
||||
expect(
|
||||
new Struct({
|
||||
accountId: AccountId,
|
||||
balance: Balance,
|
||||
blockNumber: BlockNumber,
|
||||
compactNumber: Compact.with(BlockNumber),
|
||||
optionNumber: Option.with(BlockNumber),
|
||||
balanceCompact: ClassOf('Compact<Balance>'),
|
||||
blockNumber: ClassOf('BlockNumber'),
|
||||
compactNumber: ClassOf('Compact<BlockNumber>'),
|
||||
optionNumber: ClassOf('Option<BlockNumber>'),
|
||||
counter: U32,
|
||||
vector: Vector.with(AccountId)
|
||||
}).toRawType()
|
||||
).toEqual(JSON.stringify({
|
||||
accountId: 'AccountId',
|
||||
balance: 'Balance',
|
||||
balanceCompact: 'Compact<Balance>', // Override in Uint
|
||||
blockNumber: 'u64',
|
||||
compactNumber: 'Compact<u64>',
|
||||
optionNumber: 'Option<u64>',
|
||||
@@ -212,14 +214,14 @@ describe('Struct', (): void => {
|
||||
it('generates sane toRawType (via with)', (): void => {
|
||||
const Type = Struct.with({
|
||||
accountId: AccountId,
|
||||
balance: Balance
|
||||
balance: ClassOf('Balance')
|
||||
});
|
||||
|
||||
expect(
|
||||
new Type().toRawType()
|
||||
).toEqual(JSON.stringify({
|
||||
accountId: 'AccountId',
|
||||
balance: 'Balance'
|
||||
balance: 'Balance' // Override in Uint
|
||||
}));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Proposal } from '../srml/democracy/types';
|
||||
import { VoteThreshold } from '../srml/elections/types';
|
||||
import { BlockNumber } from '../srml/runtime/types';
|
||||
import { CodecTo } from '../types';
|
||||
|
||||
import extrinsics from '@polkadot/api-metadata/extrinsics/static';
|
||||
@@ -13,7 +13,6 @@ import Method from '../primitive/Method';
|
||||
import Text from '../primitive/Text';
|
||||
import U32 from '../primitive/U32';
|
||||
import { injectDefinitions } from '../srml';
|
||||
import BlockNumber from '../type/BlockNumber';
|
||||
import Tuple from './Tuple';
|
||||
|
||||
describe('Tuple', (): void => {
|
||||
@@ -60,7 +59,7 @@ describe('Tuple', (): void => {
|
||||
Method.injectMethods(extrinsics);
|
||||
|
||||
const test = new (Tuple.with([
|
||||
BlockNumber, ClassOf<Proposal>('Proposal'), ClassOf<VoteThreshold>('VoteThreshold')
|
||||
ClassOf('BlockNumber'), ClassOf('Proposal'), ClassOf('VoteThreshold')
|
||||
]
|
||||
))('0x62190000000000000003507b0a092230783432223a202230783433220a7d0a01');
|
||||
|
||||
@@ -75,7 +74,8 @@ describe('Tuple', (): void => {
|
||||
|
||||
it('exposes the Types (object creation)', (): void => {
|
||||
const test = new Tuple({
|
||||
BlockNumber, VoteThreshold: ClassOf<VoteThreshold>('VoteThreshold')
|
||||
BlockNumber: ClassOf('BlockNumber'),
|
||||
VoteThreshold: ClassOf('VoteThreshold')
|
||||
}, []);
|
||||
|
||||
expect(test.Types).toEqual(['BlockNumber', 'VoteThreshold']);
|
||||
@@ -102,13 +102,13 @@ describe('Tuple', (): void => {
|
||||
describe('toRawType', (): void => {
|
||||
it('generates sane value with array types', (): void => {
|
||||
expect(
|
||||
new Tuple([U32, BlockNumber]).toRawType()
|
||||
new Tuple([U32, ClassOf('BlockNumber')]).toRawType()
|
||||
).toEqual('(u32,u64)');
|
||||
});
|
||||
|
||||
it('generates sane value with object types', (): void => {
|
||||
expect(
|
||||
new Tuple({ number: U32, blockNumber: BlockNumber }).toRawType()
|
||||
new Tuple({ number: U32, blockNumber: ClassOf('BlockNumber') }).toRawType()
|
||||
).toEqual('(u32,u64)');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -6,6 +6,7 @@ import { AnyNumber } from '../types';
|
||||
|
||||
import { bnToHex, bnToU8a } from '@polkadot/util';
|
||||
|
||||
import { ClassOf } from './createType';
|
||||
import AbstractInt, { DEFAULT_UINT_BITS, UIntBitLength } from './AbstractInt';
|
||||
|
||||
/**
|
||||
@@ -46,7 +47,12 @@ export default class UInt extends AbstractInt {
|
||||
* @description Returns the base runtime type name for this instance
|
||||
*/
|
||||
public toRawType (): string {
|
||||
return `u${this._bitLength}`;
|
||||
// NOTE In the case of balances, which have a special meaning on the UI
|
||||
// and can be interpreted differently, return a specifc value for it so
|
||||
// underlying it always matches (no matter which length it actually is)
|
||||
return this instanceof ClassOf('Balance')
|
||||
? 'Balance'
|
||||
: `u${this._bitLength}`;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
import { Codec, Constructor } from '../types';
|
||||
|
||||
import createType, { TypeDef, TypeDefInfo, createClass, getTypeClass, getTypeDef, typeSplit, ClassOf } from './createType';
|
||||
import Balance from '../primitive/Balance';
|
||||
import Text from '../primitive/Text';
|
||||
import { injectDefinitions } from '../srml';
|
||||
import CodecSet from './Set';
|
||||
@@ -308,7 +307,7 @@ describe('createType', (): void => {
|
||||
it('instanceof should work (primitive type)', (): void => {
|
||||
const value = createType('Balance', 1234);
|
||||
|
||||
expect(value instanceof Balance).toBe(true);
|
||||
expect(value instanceof ClassOf('Balance')).toBe(true);
|
||||
});
|
||||
|
||||
it('instanceof should work (srml type)', (): void => {
|
||||
|
||||
@@ -11,4 +11,3 @@
|
||||
export { default as Metadata } from './Metadata';
|
||||
export * from './primitive';
|
||||
export * from './rpc';
|
||||
export * from './type';
|
||||
|
||||
@@ -68,11 +68,3 @@ export default class AccountId extends U8aFixed {
|
||||
return 'AccountId';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @name AccountIdOf
|
||||
* @description
|
||||
* The Substrate AccountIdOf representation as a [[AccountId]].
|
||||
*/
|
||||
export class AccountIdOf extends AccountId {
|
||||
}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/types authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import Struct from '../codec/Struct';
|
||||
import Bytes from './Bytes';
|
||||
import U64 from './U64';
|
||||
|
||||
/**
|
||||
* @name AccountInfo
|
||||
* @description
|
||||
* An Account information structure for contracts
|
||||
*/
|
||||
export default class AccountInfo extends Struct {
|
||||
public constructor (value: any) {
|
||||
super({
|
||||
trieId: Bytes,
|
||||
currentMemStored: U64
|
||||
}, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The size of stored value in octet
|
||||
*/
|
||||
public get currentMemStored (): U64 {
|
||||
return this.get('currentMemStored') as U64;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Unique ID for the subtree encoded as a byte
|
||||
*/
|
||||
public get trieId (): Bytes {
|
||||
return this.get('trieId') as Bytes;
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/types authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import U128 from './U128';
|
||||
|
||||
/**
|
||||
* @name Balance
|
||||
* @description
|
||||
* The Substrate Balance representation as a [[U128]].
|
||||
*/
|
||||
export default class Balance extends U128 {
|
||||
/**
|
||||
* @description Returns the base runtime type name for this instance
|
||||
*/
|
||||
public toRawType (): string {
|
||||
// NOTE Balance we treat as a special case, don't return the base u128 - there
|
||||
// is typically special processing downstream, i.e. different inputs, it gets
|
||||
// treated as a primitive in this case
|
||||
return 'Balance';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @name BalanceOf
|
||||
* @description
|
||||
* The Substrate BalanceOf representation as a [[Balance]].
|
||||
*/
|
||||
export class BalanceOf extends Balance {
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/types authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import Compact from '../codec/Compact';
|
||||
import Balance from './Balance';
|
||||
|
||||
/**
|
||||
* @name BalanceCompact
|
||||
* @description
|
||||
* The Compact<Balance> or number of transactions sent by a specific account. Generally used
|
||||
* with extrinsics to determine the order of execution.
|
||||
*/
|
||||
export default class BalanceCompact extends Compact.with(Balance) {
|
||||
}
|
||||
@@ -2,12 +2,14 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Hash } from '../srml/runtime/types';
|
||||
|
||||
import { assert } from '@polkadot/util';
|
||||
|
||||
import createType, { ClassOf } from '../codec/createType';
|
||||
import Enum from '../codec/Enum';
|
||||
import Struct from '../codec/Struct';
|
||||
import Vector from '../codec/Vector';
|
||||
import Hash from './Hash';
|
||||
import Event from './Event';
|
||||
import Null from './Null';
|
||||
import U32 from './U32';
|
||||
@@ -106,7 +108,7 @@ export class EventRecord0to76 extends Struct {
|
||||
* @description The [[Hash]] topics for this event (empty, compat)
|
||||
*/
|
||||
public get topics (): Vector<Hash> {
|
||||
return new (Vector.with(Hash))();
|
||||
return createType('Vec<Hash>', []);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,7 +123,7 @@ export default class EventRecord extends Struct {
|
||||
super({
|
||||
phase: Phase,
|
||||
event: Event,
|
||||
topics: Vector.with(Hash)
|
||||
topics: ClassOf('Vec<Hash>')
|
||||
}, value);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,19 +2,18 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Balance, Hash, Index } from '../../srml/runtime/types';
|
||||
import { AnyU8a, ArgsDef, Codec, ExtrinsicPayloadValue, IExtrinsic, IHash, IKeyringPair, SignatureOptions } from '../../types';
|
||||
|
||||
import { assert, isHex, isU8a, u8aConcat, u8aToHex, u8aToU8a } from '@polkadot/util';
|
||||
import { blake2AsU8a } from '@polkadot/util-crypto';
|
||||
|
||||
import createType from '../../codec/createType';
|
||||
import Base from '../../codec/Base';
|
||||
import Compact from '../../codec/Compact';
|
||||
import { FunctionMetadata } from '../../Metadata/v6/Calls';
|
||||
import NonceCompact from '../../type/NonceCompact';
|
||||
import { FunctionMetadata } from '../../Metadata/v7/Calls';
|
||||
import Address from '../Address';
|
||||
import BalanceCompact from '../BalanceCompact';
|
||||
import Method from '../Method';
|
||||
import Hash from '../Hash';
|
||||
import ExtrinsicV1, { ExtrinsicValueV1 } from './v1/Extrinsic';
|
||||
import ExtrinsicV2, { ExtrinsicValueV2 } from './v2/Extrinsic';
|
||||
import ExtrinsicEra from './ExtrinsicEra';
|
||||
@@ -143,9 +142,7 @@ export default class Extrinsic extends Base<ExtrinsicV1 | ExtrinsicV2> implement
|
||||
* @description Convernience function, encodes the extrinsic and returns the actual hash
|
||||
*/
|
||||
public get hash (): Hash {
|
||||
return new Hash(
|
||||
blake2AsU8a(this.toU8a(), 256)
|
||||
);
|
||||
return createType('Hash', blake2AsU8a(this.toU8a(), 256));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -186,7 +183,7 @@ export default class Extrinsic extends Base<ExtrinsicV1 | ExtrinsicV2> implement
|
||||
/**
|
||||
* @description The nonce for this extrinsic
|
||||
*/
|
||||
public get nonce (): NonceCompact {
|
||||
public get nonce (): Compact<Index> {
|
||||
return this.raw.signature.nonce;
|
||||
}
|
||||
|
||||
@@ -207,7 +204,7 @@ export default class Extrinsic extends Base<ExtrinsicV1 | ExtrinsicV2> implement
|
||||
/**
|
||||
* @description Forwards compat
|
||||
*/
|
||||
public get tip (): BalanceCompact {
|
||||
public get tip (): Compact<Balance> {
|
||||
return this.raw.signature.tip;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,14 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { injectDefinitions } from '../../srml';
|
||||
import ExtrinsicEra from './ExtrinsicEra';
|
||||
|
||||
describe('ExtrinsicEra', (): void => {
|
||||
beforeEach((): void => {
|
||||
injectDefinitions();
|
||||
});
|
||||
|
||||
it('decodes an Extrinsic Era with immortal', (): void => {
|
||||
const extrinsicEra = new ExtrinsicEra(new Uint8Array([0]));
|
||||
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Balance, Hash, Index } from '../../srml/runtime/types';
|
||||
import { IKeyringPair } from '../../types';
|
||||
|
||||
import { u8aToHex } from '@polkadot/util';
|
||||
|
||||
import createType from '../../codec/createType';
|
||||
import Base from '../../codec/Base';
|
||||
import Compact from '../../codec/Compact';
|
||||
import U8a from '../../codec/U8a';
|
||||
import NonceCompact from '../../type/NonceCompact';
|
||||
import BalanceCompact from '../BalanceCompact';
|
||||
import Hash from '../Hash';
|
||||
import SignaturePayloadV1, { SignaturePayloadValueV1 } from './v1/SignaturePayload';
|
||||
import SignaturePayloadV2, { SignaturePayloadValueV2 } from './v2/SignaturePayload';
|
||||
import ExtrinsicEra from './ExtrinsicEra';
|
||||
@@ -67,17 +67,17 @@ export default class SignaturePayload extends Base<SignaturePayloadV1 | Signatur
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The [[NonceCompact]]
|
||||
* @description The [[Index]]
|
||||
*/
|
||||
public get nonce (): NonceCompact {
|
||||
public get nonce (): Compact<Index> {
|
||||
return this.raw.nonce;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The [[BalanceCompact]]
|
||||
* @description The [[Balance]]
|
||||
*/
|
||||
public get tip (): BalanceCompact {
|
||||
return (this.raw as SignaturePayloadV2).tip || new BalanceCompact(0);
|
||||
public get tip (): Compact<Balance> {
|
||||
return (this.raw as SignaturePayloadV2).tip || createType('Compact<Balance>', 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
// Copyright 2017-2019 @polkadot/types authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
export { default as Extrinsic } from './Extrinsic';
|
||||
export { default as ExtrinsicEra, MortalEra, ImmortalEra } from './ExtrinsicEra';
|
||||
export { default as SignaturePayload } from './SignaturePayload';
|
||||
@@ -2,14 +2,14 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Balance, Index, Signature } from '../../../srml/runtime/types';
|
||||
import { ExtrinsicPayloadValue, IExtrinsicSignature, IKeyringPair, SignatureOptions } from '../../../types';
|
||||
|
||||
import createType, { ClassOf } from '../../../codec/createType';
|
||||
import Compact from '../../../codec/Compact';
|
||||
import Struct from '../../../codec/Struct';
|
||||
import Address from '../../Address';
|
||||
import BalanceCompact from '../../BalanceCompact';
|
||||
import Method from '../../Method';
|
||||
import Signature from '../../Signature';
|
||||
import NonceCompact from '../../../type/NonceCompact';
|
||||
import ExtrinsicEra from '../ExtrinsicEra';
|
||||
import { EMPTY_U8A, IMMORTAL_ERA } from '../constants';
|
||||
import SignaturePayload from './SignaturePayload';
|
||||
@@ -32,8 +32,8 @@ export default class ExtrinsicSignatureV1 extends Struct implements IExtrinsicSi
|
||||
public constructor (value?: ExtrinsicSignatureV1 | Uint8Array, { isSigned }: ExtrinsicSignatureV1Options = {}) {
|
||||
super({
|
||||
signer: Address,
|
||||
signature: Signature,
|
||||
nonce: NonceCompact,
|
||||
signature: ClassOf('Signature'),
|
||||
nonce: ClassOf('Compact<Index>'),
|
||||
era: ExtrinsicEra
|
||||
}, ExtrinsicSignatureV1.decodeExtrinsicSignature(value, isSigned));
|
||||
}
|
||||
@@ -65,10 +65,10 @@ export default class ExtrinsicSignatureV1 extends Struct implements IExtrinsicSi
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The [[Nonce]] for the signature
|
||||
* @description The [[Index]] for the signature
|
||||
*/
|
||||
public get nonce (): NonceCompact {
|
||||
return this.get('nonce') as NonceCompact;
|
||||
public get nonce (): Compact<Index> {
|
||||
return this.get('nonce') as Compact<Index>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,8 +88,8 @@ export default class ExtrinsicSignatureV1 extends Struct implements IExtrinsicSi
|
||||
/**
|
||||
* @description Forwards compat
|
||||
*/
|
||||
public get tip (): BalanceCompact {
|
||||
return new BalanceCompact(0);
|
||||
public get tip (): Compact<Balance> {
|
||||
return createType('Compact<Balance>', 0);
|
||||
}
|
||||
|
||||
private injectSignature (signer: Address, signature: Signature, { era, nonce }: SignaturePayload): IExtrinsicSignature {
|
||||
@@ -107,7 +107,7 @@ export default class ExtrinsicSignatureV1 extends Struct implements IExtrinsicSi
|
||||
public addSignature (signer: Address | Uint8Array | string, signature: Uint8Array | string, payload: ExtrinsicPayloadValue | Uint8Array | string): IExtrinsicSignature {
|
||||
return this.injectSignature(
|
||||
new Address(signer),
|
||||
new Signature(signature),
|
||||
createType('Signature', signature),
|
||||
new SignaturePayload(payload)
|
||||
);
|
||||
}
|
||||
@@ -123,7 +123,7 @@ export default class ExtrinsicSignatureV1 extends Struct implements IExtrinsicSi
|
||||
era: era || IMMORTAL_ERA,
|
||||
blockHash
|
||||
});
|
||||
const signature = new Signature(payload.sign(account));
|
||||
const signature = createType<Signature>('Signature', payload.sign(account));
|
||||
|
||||
return this.injectSignature(signer, signature, payload);
|
||||
}
|
||||
|
||||
@@ -2,12 +2,13 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Hash, Index } from '../../../srml/runtime/types';
|
||||
import { AnyNumber, AnyU8a, ExtrinsicPayloadValue, IExtrinsicEra, IKeyringPair, IMethod } from '../../../types';
|
||||
|
||||
import { ClassOf } from '../../../codec/createType';
|
||||
import Compact from '../../../codec/Compact';
|
||||
import Struct from '../../../codec/Struct';
|
||||
import U8a from '../../../codec/U8a';
|
||||
import Hash from '../../Hash';
|
||||
import NonceCompact from '../../../type/NonceCompact';
|
||||
import ExtrinsicEra from '../ExtrinsicEra';
|
||||
import { sign } from '../util';
|
||||
|
||||
@@ -32,10 +33,10 @@ export interface SignaturePayloadValueV1 {
|
||||
export default class SignaturePayloadV1 extends Struct {
|
||||
public constructor (value?: ExtrinsicPayloadValue | SignaturePayloadValueV1 | Uint8Array | string) {
|
||||
super({
|
||||
nonce: NonceCompact,
|
||||
nonce: ClassOf('Compact<Index>'),
|
||||
method: U8a,
|
||||
era: ExtrinsicEra,
|
||||
blockHash: Hash
|
||||
blockHash: ClassOf('Hash')
|
||||
}, value);
|
||||
}
|
||||
|
||||
@@ -61,10 +62,10 @@ export default class SignaturePayloadV1 extends Struct {
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The [[NonceCompact]]
|
||||
* @description The [[Index]]
|
||||
*/
|
||||
public get nonce (): NonceCompact {
|
||||
return this.get('nonce') as NonceCompact;
|
||||
public get nonce (): Compact<Index> {
|
||||
return this.get('nonce') as Compact<Index>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,9 +2,14 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { injectDefinitions } from '../../../srml';
|
||||
import ExtrinsicExtra from './ExtrinsicExtra';
|
||||
|
||||
describe('ExtrinsicExtraV2', (): void => {
|
||||
beforeEach((): void => {
|
||||
injectDefinitions();
|
||||
});
|
||||
|
||||
it('encodes to a sane Uint8Array (default construction)', (): void => {
|
||||
expect(
|
||||
new ExtrinsicExtra().toU8a()
|
||||
|
||||
@@ -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.
|
||||
|
||||
import { Balance, Index } from '../../../srml/runtime/types';
|
||||
import { AnyNumber } from '../../../types';
|
||||
|
||||
import { ClassOf } from '../../../codec/createType';
|
||||
import Compact from '../../../codec/Compact';
|
||||
import Struct from '../../../codec/Struct';
|
||||
import Address from '../../Address';
|
||||
import BalanceCompact from '../../BalanceCompact';
|
||||
import ExtrinsicEra from '../ExtrinsicEra';
|
||||
import NonceCompact from '../../../type/NonceCompact';
|
||||
|
||||
interface ExtrinsicExtraValueV2 {
|
||||
era?: Uint8Array;
|
||||
@@ -16,12 +17,6 @@ interface ExtrinsicExtraValueV2 {
|
||||
tip?: AnyNumber;
|
||||
}
|
||||
|
||||
export const extraDefinition = {
|
||||
era: ExtrinsicEra,
|
||||
nonce: NonceCompact,
|
||||
tip: BalanceCompact
|
||||
};
|
||||
|
||||
/**
|
||||
* @name ExtrinsicExtraV2
|
||||
* @description
|
||||
@@ -29,7 +24,11 @@ export const extraDefinition = {
|
||||
*/
|
||||
export default class ExtrinsicExtraV2 extends Struct {
|
||||
public constructor (value?: ExtrinsicExtraValueV2 | Uint8Array) {
|
||||
super(extraDefinition, value);
|
||||
super({
|
||||
era: ExtrinsicEra,
|
||||
nonce: ClassOf('Compact<Index>'),
|
||||
tip: ClassOf('Compact<Balance>')
|
||||
}, value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -40,10 +39,10 @@ export default class ExtrinsicExtraV2 extends Struct {
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The [[NonceCompact]] for the signature
|
||||
* @description The [[Index]] for the signature
|
||||
*/
|
||||
public get nonce (): NonceCompact {
|
||||
return this.get('nonce') as NonceCompact;
|
||||
public get nonce (): Compact<Index> {
|
||||
return this.get('nonce') as Compact<Index>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,9 +53,9 @@ export default class ExtrinsicExtraV2 extends Struct {
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The [[BalanceCompact]] tip
|
||||
* @description The [[Balance]] tip
|
||||
*/
|
||||
public get tip (): BalanceCompact {
|
||||
return this.get('tip') as BalanceCompact;
|
||||
public get tip (): Compact<Balance> {
|
||||
return this.get('tip') as Compact<Balance>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,14 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { injectDefinitions } from '../../../srml';
|
||||
import ExtrinsicSignature from './ExtrinsicSignature';
|
||||
|
||||
describe('ExtrinsicSignatureV2', (): void => {
|
||||
beforeEach((): void => {
|
||||
injectDefinitions();
|
||||
});
|
||||
|
||||
it('encodes to a sane Uint8Array', (): void => {
|
||||
const u8a = new Uint8Array([
|
||||
// signer as an AccountIndex
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Balance, Index, Signature } from '../../../srml/runtime/types';
|
||||
import { ExtrinsicPayloadValue, IExtrinsicSignature, IKeyringPair, SignatureOptions } from '../../../types';
|
||||
|
||||
import createType, { ClassOf } from '../../../codec/createType';
|
||||
import Compact from '../../../codec/Compact';
|
||||
import Struct from '../../../codec/Struct';
|
||||
import Address from '../../Address';
|
||||
import BalanceCompact from '../../BalanceCompact';
|
||||
import Method from '../../Method';
|
||||
import Signature from '../../Signature';
|
||||
import ExtrinsicEra from '../ExtrinsicEra';
|
||||
import NonceCompact from '../../../type/NonceCompact';
|
||||
import SignaturePayload from './SignaturePayload';
|
||||
import { EMPTY_U8A, IMMORTAL_ERA } from '../constants';
|
||||
import ExtrinsicExtra from './ExtrinsicExtra';
|
||||
@@ -28,7 +28,7 @@ export default class ExtrinsicSignatureV2 extends Struct implements IExtrinsicSi
|
||||
public constructor (value: ExtrinsicSignatureV2 | Uint8Array | undefined, { isSigned }: ExtrinsicSignatureV2Options = {}) {
|
||||
super({
|
||||
signer: Address,
|
||||
signature: Signature,
|
||||
signature: ClassOf('Signature'),
|
||||
extra: ExtrinsicExtra
|
||||
}, ExtrinsicSignatureV2.decodeExtrinsicSignature(value, isSigned));
|
||||
}
|
||||
@@ -67,9 +67,9 @@ export default class ExtrinsicSignatureV2 extends Struct implements IExtrinsicSi
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The [[NonceCompact]] for the signature
|
||||
* @description The [[Index]] for the signature
|
||||
*/
|
||||
public get nonce (): NonceCompact {
|
||||
public get nonce (): Compact<Index> {
|
||||
return this.extra.nonce;
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ export default class ExtrinsicSignatureV2 extends Struct implements IExtrinsicSi
|
||||
/**
|
||||
* @description The [[Balance]] tip
|
||||
*/
|
||||
public get tip (): BalanceCompact {
|
||||
public get tip (): Compact<Balance> {
|
||||
return this.extra.tip;
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ export default class ExtrinsicSignatureV2 extends Struct implements IExtrinsicSi
|
||||
public addSignature (signer: Address | Uint8Array | string, signature: Uint8Array | string, payload: ExtrinsicPayloadValue | Uint8Array | string): IExtrinsicSignature {
|
||||
return this.injectSignature(
|
||||
new Address(signer),
|
||||
new Signature(signature),
|
||||
createType('Signature', signature),
|
||||
new SignaturePayload(payload)
|
||||
);
|
||||
}
|
||||
@@ -128,7 +128,7 @@ export default class ExtrinsicSignatureV2 extends Struct implements IExtrinsicSi
|
||||
nonce,
|
||||
tip: tip || 0
|
||||
});
|
||||
const signature = new Signature(payload.sign(account));
|
||||
const signature = createType<Signature>('Signature', payload.sign(account));
|
||||
|
||||
return this.injectSignature(signer, signature, payload);
|
||||
}
|
||||
|
||||
@@ -2,15 +2,14 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Balance, Hash, Index } from '../../../srml/runtime/types';
|
||||
import { AnyNumber, AnyU8a, ExtrinsicPayloadValue, IExtrinsicEra, IKeyringPair, IMethod } from '../../../types';
|
||||
|
||||
import { ClassOf } from '../../../codec/createType';
|
||||
import Compact from '../../../codec/Compact';
|
||||
import Struct from '../../../codec/Struct';
|
||||
import U8a from '../../../codec/U8a';
|
||||
import BalanceCompact from '../../BalanceCompact';
|
||||
import Hash from '../../Hash';
|
||||
import NonceCompact from '../../../type/NonceCompact';
|
||||
import ExtrinsicEra from '../ExtrinsicEra';
|
||||
import { extraDefinition } from './ExtrinsicExtra';
|
||||
import { sign } from '../util';
|
||||
|
||||
export interface SignaturePayloadValueV2 {
|
||||
@@ -21,11 +20,6 @@ export interface SignaturePayloadValueV2 {
|
||||
tip: AnyNumber;
|
||||
}
|
||||
|
||||
const basePayload = {
|
||||
...extraDefinition,
|
||||
blockHash: Hash
|
||||
};
|
||||
|
||||
/**
|
||||
* @name SignaturePayloadV2
|
||||
* @description
|
||||
@@ -36,7 +30,10 @@ export default class SignaturePayloadV2 extends Struct {
|
||||
public constructor (value?: ExtrinsicPayloadValue | SignaturePayloadValueV2 | Uint8Array | string) {
|
||||
super({
|
||||
method: U8a,
|
||||
...basePayload
|
||||
era: ExtrinsicEra,
|
||||
nonce: ClassOf('Compact<Index>'),
|
||||
tip: ClassOf('Compact<Balance>'),
|
||||
blockHash: ClassOf('Hash')
|
||||
}, value);
|
||||
}
|
||||
|
||||
@@ -62,17 +59,17 @@ export default class SignaturePayloadV2 extends Struct {
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The [[NonceCompact]]
|
||||
* @description The [[Index]]
|
||||
*/
|
||||
public get nonce (): NonceCompact {
|
||||
return this.get('nonce') as NonceCompact;
|
||||
public get nonce (): Compact<Index> {
|
||||
return this.get('nonce') as Compact<Index>;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The tip [[BalanceCompact]]
|
||||
* @description The tip [[Balance]]
|
||||
*/
|
||||
public get tip (): BalanceCompact {
|
||||
return this.get('tip') as BalanceCompact;
|
||||
public get tip (): Compact<Balance> {
|
||||
return this.get('tip') as Compact<Balance>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { AnyU8a } from '../types';
|
||||
import { AnyU8a, IHash } from '../types';
|
||||
|
||||
import U8aFixed from '../codec/U8aFixed';
|
||||
|
||||
@@ -12,7 +12,7 @@ import U8aFixed from '../codec/U8aFixed';
|
||||
* Hash containing 256 bits (32 bytes), typically used in blocks, extrinsics and
|
||||
* as a sane default for fixed-length hash representations.
|
||||
*/
|
||||
export default class H256 extends U8aFixed {
|
||||
export default class H256 extends U8aFixed implements IHash {
|
||||
public constructor (value?: AnyU8a) {
|
||||
super(value, 256);
|
||||
}
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/types authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { IHash } from '../types';
|
||||
|
||||
import H256 from './H256';
|
||||
|
||||
/**
|
||||
* @name Hash
|
||||
* @description
|
||||
* The default hash that is used accross the system. It is basically just a thin
|
||||
* wrapper around [[H256]], representing a 32-byte blake2b (Substrate) value
|
||||
*/
|
||||
export default class Hash extends H256 implements IHash {
|
||||
}
|
||||
@@ -6,8 +6,8 @@ import { AnyU8a } from '../types';
|
||||
|
||||
import Option from '../codec/Option';
|
||||
import Tuple from '../codec/Tuple';
|
||||
import StorageData from '../primitive/StorageData';
|
||||
import StorageKey from '../primitive/StorageKey';
|
||||
import StorageData from './StorageData';
|
||||
import StorageKey from './StorageKey';
|
||||
|
||||
type KeyValueValue = [AnyU8a, AnyU8a];
|
||||
|
||||
@@ -2,16 +2,16 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Hash } from '../srml/runtime/types';
|
||||
import { AnyU8a, ArgsDef, Codec, IMethod } from '../types';
|
||||
|
||||
import { assert, isHex, isObject, isU8a, hexToU8a } from '@polkadot/util';
|
||||
import { blake2AsU8a } from '@polkadot/util-crypto';
|
||||
|
||||
import { getTypeDef, getTypeClass } from '../codec/createType';
|
||||
import createType, { getTypeDef, getTypeClass } from '../codec/createType';
|
||||
import Struct from '../codec/Struct';
|
||||
import U8aFixed from '../codec/U8aFixed';
|
||||
import { FunctionMetadata as FunctionMetadataV7, FunctionArgumentMetadata } from '../Metadata/v7/Calls';
|
||||
import Hash from './Hash';
|
||||
|
||||
interface DecodeMethodInput {
|
||||
args: any;
|
||||
@@ -210,9 +210,7 @@ export default class Method extends Struct implements IMethod {
|
||||
* @description Convenience function, encodes the Method and returns the actual hash
|
||||
*/
|
||||
public get hash (): Hash {
|
||||
return new Hash(
|
||||
blake2AsU8a(this.toU8a(), 256)
|
||||
);
|
||||
return createType('Hash', blake2AsU8a(this.toU8a(), 256));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/types authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import H512 from './H512';
|
||||
|
||||
/**
|
||||
* @name Signature
|
||||
* @description
|
||||
* The default signature that is used accross the system. It is currectly defined
|
||||
* as a 512-bit value, represented by a [[H512]].
|
||||
*/
|
||||
export default class Signature extends H512 {
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Ed25519Signature
|
||||
* @description
|
||||
* The default Ed25519 that is used accross the system. It is currectly defined
|
||||
* as a 512-bit value, represented by a [[H512]].
|
||||
*/
|
||||
export class Ed25519Signature extends Signature {}
|
||||
|
||||
/**
|
||||
* @name Sr25519Signature
|
||||
* @description
|
||||
* The default Sr25519 signature that is used accross the system. It is currectly defined
|
||||
* as a 512-bit value, represented by a [[H512]].
|
||||
*/
|
||||
export class Sr25519Signature extends Signature {}
|
||||
@@ -54,8 +54,6 @@ export default class Type extends Text {
|
||||
// alias () -> Null
|
||||
Type._alias('\\(\\)', 'Null'),
|
||||
// alias Vec<u8> -> Bytes
|
||||
Type._alias('Compact<Index>', 'IndexCompact'),
|
||||
// alias Vec<u8> -> Bytes
|
||||
Type._alias('Vec<u8>', 'Bytes'),
|
||||
// alias &[u8] -> Bytes
|
||||
Type._alias('&\\[u8\\]', 'Bytes'),
|
||||
|
||||
@@ -17,11 +17,4 @@ export default class USize extends U32 {
|
||||
|
||||
throw new Error('The `usize` type should not be used. Since it is platform-specific, it creates incompatibilities between native (generally u64) and WASM (always u32) code. Use one of the `u32` or `u64` types explicitly.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Returns the base runtime type name for this instance
|
||||
*/
|
||||
public toRawType (): string {
|
||||
return 'usize';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ export default class Unconstructable extends Null {
|
||||
public constructor () {
|
||||
super();
|
||||
|
||||
throw new Error(`Unabdle to construct ${JSON.stringify(typeDef)}`);
|
||||
throw new Error(`Unable to construct ${JSON.stringify(typeDef)}`);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import { isBoolean, isNumber, isObject, isU8a, isUndefined } from '@polkadot/uti
|
||||
|
||||
import createType from '../codec/createType';
|
||||
import U8a from '../codec/U8a';
|
||||
import Bool from '../primitive/Bool';
|
||||
import Bool from './Bool';
|
||||
|
||||
/**
|
||||
* @name Vote
|
||||
@@ -1,13 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/types authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import Fixed64 from '../primitive/I64Fixed';
|
||||
|
||||
/**
|
||||
* @name WeightMultiplier
|
||||
* @description
|
||||
* Representation of a weight multiplier. This represents how a fee value can be computed from a weighted transaction, extending [[Fixed64]]
|
||||
*/
|
||||
export default class WeightMultiplier extends Fixed64 {
|
||||
}
|
||||
@@ -10,25 +10,18 @@
|
||||
*/
|
||||
// NOTE We are exporting Bool as bool to match with Rust (however also using Bool internally),
|
||||
// so with the renamed versions, epose both cases, allowing createType to work
|
||||
export { default as AccountId, AccountIdOf } from './AccountId';
|
||||
export { default as AccountId } from './AccountId';
|
||||
export { default as AccountIndex } from './AccountIndex';
|
||||
export { default as AccountInfo } from './AccountInfo';
|
||||
export { default as Address } from './Address';
|
||||
// Balance is technically not a primitive, however since it is used in a number of interfaces
|
||||
// and actually is problematic/impossible to be overridden, it is included here as well
|
||||
export { default as Balance, BalanceOf } from './Balance';
|
||||
export { default as Event, EventIndex } from './Event';
|
||||
export { default as EventRecord, EventRecord0to76 } from './EventRecord';
|
||||
export { default as Bool, default as bool } from './Bool';
|
||||
export { default as Bytes } from './Bytes';
|
||||
export { default as Data } from './Data';
|
||||
export { default as Extrinsic } from './Extrinsic/Extrinsic';
|
||||
export { default as ExtrinsicEra, MortalEra, ImmortalEra } from './Extrinsic/ExtrinsicEra';
|
||||
export { default as SignaturePayload } from './Extrinsic/SignaturePayload';
|
||||
export * from './Extrinsic';
|
||||
export { default as H160 } from './H160';
|
||||
export { default as H256 } from './H256';
|
||||
export { default as H512 } from './H512';
|
||||
export { default as Hash } from './Hash';
|
||||
export { default as I8, default as i8 } from './I8';
|
||||
export { default as I16, default as i16 } from './I16';
|
||||
export { default as I32, default as i32 } from './I32';
|
||||
@@ -36,11 +29,11 @@ export { default as I64, default as i64 } from './I64';
|
||||
export { default as Fixed64 } from './I64Fixed';
|
||||
export { default as I128, default as i128 } from './I128';
|
||||
export { default as I256, default as i256 } from './I256';
|
||||
export { default as KeyValue } from './KeyValue';
|
||||
export { default as Method } from './Method';
|
||||
export { default as Moment, MomentOf } from './Moment';
|
||||
export { default as Null, Phantom } from './Null';
|
||||
export { default as Origin } from './Origin';
|
||||
export { default as Signature, Ed25519Signature, Sr25519Signature } from './Signature';
|
||||
export { default as StorageData } from './StorageData';
|
||||
export { default as StorageHasher } from './StorageHasher';
|
||||
export { default as StorageKey } from './StorageKey';
|
||||
@@ -53,5 +46,4 @@ export { default as U64, default as u64 } from './U64';
|
||||
export { default as U128, default as u128 } from './U128';
|
||||
export { default as U256, default as u256 } from './U256';
|
||||
export { default as USize, default as usize } from './USize';
|
||||
export { default as Weight } from './Weight';
|
||||
export { default as WeightMultiplier } from './WeightMultiplier';
|
||||
export { default as Vote } from './Vote';
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Hash } from '../srml/runtime/types';
|
||||
import { AnyU8a } from '../types';
|
||||
|
||||
import { blake2AsU8a } from '@polkadot/util-crypto';
|
||||
|
||||
import { ClassOf } from '../codec/createType';
|
||||
import createType, { ClassOf } from '../codec/createType';
|
||||
import Extrinsic from '../primitive/Extrinsic/Extrinsic';
|
||||
import Struct from '../codec/Struct';
|
||||
import Vector from '../codec/Vector';
|
||||
import Hash from '../primitive/Hash';
|
||||
import Header, { HeaderValue } from './Header';
|
||||
|
||||
export interface BlockValue {
|
||||
@@ -35,9 +35,7 @@ export default class Block extends Struct {
|
||||
* @description Encodes a content [[Hash]] for the block
|
||||
*/
|
||||
public get contentHash (): Hash {
|
||||
return new Hash(
|
||||
blake2AsU8a(this.toU8a(), 256)
|
||||
);
|
||||
return createType('Hash', blake2AsU8a(this.toU8a(), 256));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,11 +2,16 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { injectDefinitions } from '../srml';
|
||||
import json3 from '../json/Header.003.json';
|
||||
import block1 from '../json/SignedBlock.003.00.json';
|
||||
import Digest, { ConsensusEngineId, CID_AURA, CID_BABE, CID_GRPA } from './Digest';
|
||||
|
||||
describe('Digest', (): void => {
|
||||
beforeEach((): void => {
|
||||
injectDefinitions();
|
||||
});
|
||||
|
||||
it('decodes logs with consensus', (): void => {
|
||||
const digest = new Digest(json3.result.digest);
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
import { Hash, Signature } from '../srml/runtime/types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import { assert, bnToBn } from '@polkadot/util';
|
||||
|
||||
@@ -10,13 +12,12 @@ import Struct from '../codec/Struct';
|
||||
import Tuple from '../codec/Tuple';
|
||||
import Vector from '../codec/Vector';
|
||||
import Bytes from '../primitive/Bytes';
|
||||
import Hash from '../primitive/Hash';
|
||||
import Signature from '../primitive/Signature';
|
||||
import U32 from '../primitive/U32';
|
||||
import U64 from '../primitive/U64';
|
||||
|
||||
// Should import AuthorityId (however, move these to generated types)
|
||||
import AuthorityId from '../primitive/AccountId';
|
||||
import { ClassOf } from '../codec';
|
||||
|
||||
const CID_AURA = 0x61727561; // 'aura'
|
||||
const CID_BABE = 0x65626162; // 'babe'
|
||||
@@ -32,14 +33,6 @@ export { CID_AURA, CID_BABE, CID_GRPA };
|
||||
export class AuthoritiesChange extends Vector.with(AuthorityId) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @name ChangesTrieRoot
|
||||
* @description
|
||||
* Log for changes to the Trie root
|
||||
*/
|
||||
export class ChangesTrieRoot extends Hash {
|
||||
}
|
||||
|
||||
/**
|
||||
* @name ConsensusEngineId
|
||||
* @description
|
||||
@@ -145,7 +138,7 @@ export class SealV0 extends Tuple {
|
||||
public constructor (value: any) {
|
||||
super({
|
||||
U64,
|
||||
Signature
|
||||
Signature: ClassOf<Signature>('Signature')
|
||||
}, value);
|
||||
}
|
||||
|
||||
@@ -181,7 +174,7 @@ export class Seal extends Tuple {
|
||||
* @description The wrapped [[Bytes]]
|
||||
*/
|
||||
public get data (): Bytes {
|
||||
return this[1] as Signature;
|
||||
return this[1] as Bytes;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -235,20 +228,6 @@ export class PreRuntime extends Tuple {
|
||||
}
|
||||
}
|
||||
|
||||
// Note the ordering, it aligns with numbers to the Rust implementation
|
||||
// (current and previous versions are included hjere, e.g. SealV0)
|
||||
const DigestItemEnumMap = {
|
||||
Other, // 0
|
||||
AuthoritiesChange, // 1
|
||||
ChangesTrieRoot, // 2
|
||||
SealV0, // 3
|
||||
Consensus, // 4
|
||||
Seal, // 5
|
||||
PreRuntime // 6
|
||||
};
|
||||
|
||||
type DigestItemTypes = keyof typeof DigestItemEnumMap;
|
||||
|
||||
/**
|
||||
* @name DigestItem
|
||||
* @description
|
||||
@@ -256,7 +235,15 @@ type DigestItemTypes = keyof typeof DigestItemEnumMap;
|
||||
*/
|
||||
export class DigestItem extends Enum {
|
||||
public constructor (value: any) {
|
||||
super(DigestItemEnumMap, value);
|
||||
super({
|
||||
Other, // 0
|
||||
AuthoritiesChange, // 1
|
||||
ChangesTrieRoot: ClassOf<Hash>('Hash'), // 2
|
||||
SealV0, // 3
|
||||
Consensus, // 4
|
||||
Seal, // 5
|
||||
PreRuntime // 6
|
||||
}, value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -271,10 +258,10 @@ export class DigestItem extends Enum {
|
||||
/**
|
||||
* @description Returns the item as a [[ChangesTrieRoot]]
|
||||
*/
|
||||
public get asChangesTrieRoot (): ChangesTrieRoot {
|
||||
public get asChangesTrieRoot (): Hash {
|
||||
assert(this.isChangesTrieRoot, `Cannot convert '${this.type}' via asChangesTrieRoot`);
|
||||
|
||||
return this.value as ChangesTrieRoot;
|
||||
return this.value as Hash;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -379,10 +366,10 @@ export class DigestItem extends Enum {
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Returns the type of engine, we just override here to get the typings correct
|
||||
* @description Returns the type of engine
|
||||
*/
|
||||
public get type (): DigestItemTypes {
|
||||
return super.type as DigestItemTypes;
|
||||
public get type (): string {
|
||||
return super.type;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -408,14 +395,14 @@ export default class Digest extends Struct {
|
||||
/**
|
||||
* @description The [[DigestItem]] logs, filtered, filter items included. This is useful for derive functionality where only a certain type of log is to be returned.
|
||||
*/
|
||||
public logsWith (...include: DigestItemTypes[]): Vector<DigestItem> {
|
||||
public logsWith (...include: string[]): Vector<DigestItem> {
|
||||
return this.logs.filter(({ type }): boolean => include.includes(type)) as Vector<DigestItem>;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The [[DigestItem]] logs, filtered, filter items exluded. This is useful for stripping headers for eg. WASM runtime execution.
|
||||
*/
|
||||
public logsWithout (...exclude: DigestItemTypes[]): Vector<DigestItem> {
|
||||
public logsWithout (...exclude: string[]): Vector<DigestItem> {
|
||||
return this.logs.filter(({ type }): boolean => !exclude.includes(type)) as Vector<DigestItem>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,11 +2,18 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { injectDefinitions } from '../srml';
|
||||
import rpc from '../json/ExtrinsicStatus.001.json';
|
||||
import ExtrinsicStatus from './ExtrinsicStatus';
|
||||
|
||||
describe('ExtrinsicStatus', (): void => {
|
||||
const status = new ExtrinsicStatus(rpc.params.result);
|
||||
let status: ExtrinsicStatus;
|
||||
|
||||
beforeEach((): void => {
|
||||
injectDefinitions();
|
||||
|
||||
status = new ExtrinsicStatus(rpc.params.result);
|
||||
});
|
||||
|
||||
it('has the correct type', (): void => {
|
||||
expect(
|
||||
|
||||
@@ -2,70 +2,16 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Hash } from '../srml/types';
|
||||
|
||||
import { assert } from '@polkadot/util';
|
||||
|
||||
import { ClassOf } from '../codec/createType';
|
||||
import Enum from '../codec/Enum';
|
||||
import Vector from '../codec/Vector';
|
||||
import Hash from '../primitive/Hash';
|
||||
import Null from '../primitive/Null';
|
||||
import Text from '../primitive/Text';
|
||||
|
||||
/**
|
||||
* @name Broadcast
|
||||
* @description
|
||||
* An [[ExtrinsicStatus]] indicating that the [[Extrinsic]] has been boradcast to peers
|
||||
*/
|
||||
export class Broadcast extends Vector.with(Text) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Dropped
|
||||
* @description
|
||||
* An [[ExtrinsicStatus]] indicating that the [[Extrinsic]] has been dropped
|
||||
*/
|
||||
export class Dropped extends Null {
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Finalized
|
||||
* @description
|
||||
* An [[ExtrinsicStatus] indicating that the [[Extrinsic]]] has been finalized and included
|
||||
*/
|
||||
export class Finalized extends Hash {
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Future
|
||||
* @description
|
||||
* An [[ExtrinsicStatus]] indicating that the [[Extrinsic]] has been added to the future queue
|
||||
*/
|
||||
export class Future extends Null {
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Ready
|
||||
* @description
|
||||
* An [[ExtrinsicStatus]] indicating that the [[Extrinsic]] has been added to the ready queue
|
||||
*/
|
||||
export class Ready extends Null {
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Invalid
|
||||
* @description
|
||||
* An [[ExtrinsicStatus]] indicating that the [[Extrinsic]] is invalid
|
||||
*/
|
||||
export class Invalid extends Null {
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Usurped
|
||||
* @description
|
||||
* An [[ExtrinsicStatus]] indicating that the [[Extrinsic]] has been usurped
|
||||
*/
|
||||
export class Usurped extends Hash {
|
||||
}
|
||||
|
||||
/**
|
||||
* @name ExtrinsicStatus
|
||||
* @description
|
||||
@@ -74,77 +20,77 @@ export class Usurped extends Hash {
|
||||
export default class ExtrinsicStatus extends Enum {
|
||||
public constructor (value: any, index?: number) {
|
||||
super({
|
||||
Future,
|
||||
Ready,
|
||||
Finalized,
|
||||
Usurped,
|
||||
Broadcast,
|
||||
Dropped,
|
||||
Invalid
|
||||
Future: Null,
|
||||
Ready: Null,
|
||||
Finalized: ClassOf('Hash'),
|
||||
Usurped: ClassOf('Hash'),
|
||||
Broadcast: Vector.with(Text),
|
||||
Dropped: Null,
|
||||
Invalid: Null
|
||||
}, value, index);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Returns the item as a [[Broadcast]]
|
||||
*/
|
||||
public get asBroadcast (): Broadcast {
|
||||
public get asBroadcast (): Vector<Text> {
|
||||
assert(this.isBroadcast, `Cannot convert '${this.type}' via asBroadcast`);
|
||||
|
||||
return this.value as Broadcast;
|
||||
return this.value as Vector<Text>;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Returns the item as a [[Dropped]]
|
||||
*/
|
||||
public get asDropped (): Dropped {
|
||||
public get asDropped (): Null {
|
||||
assert(this.isDropped, `Cannot convert '${this.type}' via asDropped`);
|
||||
|
||||
return this.value as Dropped;
|
||||
return this.value as Null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Returns the item as a [[Finalized]]
|
||||
*/
|
||||
public get asFinalized (): Finalized {
|
||||
public get asFinalized (): Hash {
|
||||
assert(this.isFinalized, `Cannot convert '${this.type}' via asFinalized`);
|
||||
|
||||
return this.value as Finalized;
|
||||
return this.value as Hash;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Returns the item as a [[Future]]
|
||||
*/
|
||||
public get asFuture (): Future {
|
||||
public get asFuture (): Null {
|
||||
assert(this.isFuture, `Cannot convert '${this.type}' via asFuture`);
|
||||
|
||||
return this.value as Future;
|
||||
return this.value as Null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Returns the item as a [[Invalid]]
|
||||
*/
|
||||
public get asInvalid (): Invalid {
|
||||
public get asInvalid (): Null {
|
||||
assert(this.isInvalid, `Cannot convert '${this.type}' via asInvalid`);
|
||||
|
||||
return this.value as Invalid;
|
||||
return this.value as Null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Returns the item as a [[Ready]]
|
||||
*/
|
||||
public get asReady (): Ready {
|
||||
public get asReady (): Null {
|
||||
assert(this.isReady, `Cannot convert '${this.type}' via asReady`);
|
||||
|
||||
return this.value as Ready;
|
||||
return this.value as Null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Returns the item as a [[Usurped]]
|
||||
*/
|
||||
public get asUsurped (): Usurped {
|
||||
public get asUsurped (): Hash {
|
||||
assert(this.isUsurped, `Cannot convert '${this.type}' via asUsurped`);
|
||||
|
||||
return this.value as Usurped;
|
||||
return this.value as Hash;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,14 +4,19 @@
|
||||
|
||||
import BN from 'bn.js';
|
||||
|
||||
import Header from './Header';
|
||||
import { injectDefinitions } from '../srml';
|
||||
import json1 from '../json/Header.001.json';
|
||||
import json2 from '../json/Header.002.json';
|
||||
import json3 from '../json/Header.003.json';
|
||||
import block00300 from '../json/SignedBlock.003.00.json';
|
||||
import block00301 from '../json/SignedBlock.003.01.json';
|
||||
import Header from './Header';
|
||||
|
||||
describe('Header', (): void => {
|
||||
beforeEach((): void => {
|
||||
injectDefinitions();
|
||||
});
|
||||
|
||||
it('decodes an actual JSON response', (): void => {
|
||||
const header = new Header(json1.result);
|
||||
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { BlockNumber, Hash } from '../srml/runtime/types';
|
||||
import { AnyNumber, AnyU8a } from '../types';
|
||||
|
||||
import { blake2AsU8a } from '@polkadot/util-crypto';
|
||||
|
||||
import createType, { ClassOf } from '../codec/createType';
|
||||
import Compact from '../codec/Compact';
|
||||
import Struct from '../codec/Struct';
|
||||
import Hash from '../primitive/Hash';
|
||||
import BlockNumber from '../type/BlockNumber';
|
||||
import Digest, { DigestItem } from './Digest';
|
||||
|
||||
export interface HeaderValue {
|
||||
@@ -28,10 +28,10 @@ export interface HeaderValue {
|
||||
export default class Header extends Struct {
|
||||
public constructor (value?: HeaderValue | Uint8Array | null) {
|
||||
super({
|
||||
parentHash: Hash,
|
||||
number: Compact.with(BlockNumber),
|
||||
stateRoot: Hash,
|
||||
extrinsicsRoot: Hash,
|
||||
parentHash: ClassOf('Hash'),
|
||||
number: ClassOf('Compact<BlockNumber>'),
|
||||
stateRoot: ClassOf('Hash'),
|
||||
extrinsicsRoot: ClassOf('Hash'),
|
||||
digest: Digest
|
||||
}, value || {});
|
||||
}
|
||||
@@ -61,9 +61,7 @@ export default class Header extends Struct {
|
||||
* @description Convenience method, encodes the header and calculates the [[Hash]]
|
||||
*/
|
||||
public get hash (): Hash {
|
||||
return new Hash(
|
||||
blake2AsU8a(this.toU8a(), 256)
|
||||
);
|
||||
return createType('Hash', blake2AsU8a(this.toU8a(), 256));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,11 +2,12 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { BlockNumber, Hash } from '../srml/runtime/types';
|
||||
|
||||
import { ClassOf } from '../codec/createType';
|
||||
import Struct from '../codec/Struct';
|
||||
import Text from '../primitive/Text';
|
||||
import U32 from '../primitive/U32';
|
||||
import Hash from '../primitive/Hash';
|
||||
import BlockNumber from '../type/BlockNumber';
|
||||
|
||||
/**
|
||||
* @name PeerInfo
|
||||
@@ -19,8 +20,8 @@ export default class PeerInfo extends Struct {
|
||||
peerId: Text,
|
||||
roles: Text,
|
||||
protocolVersion: U32,
|
||||
bestHash: Hash,
|
||||
bestNumber: BlockNumber
|
||||
bestHash: ClassOf('Hash'),
|
||||
bestNumber: ClassOf('BlockNumber')
|
||||
}, value);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,12 +2,11 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Justification } from '../srml/runtime/types';
|
||||
import { Hash, Justification } from '../srml/runtime/types';
|
||||
import { AnyU8a } from '../types';
|
||||
|
||||
import { ClassOf } from '../codec/createType';
|
||||
import Struct from '../codec/Struct';
|
||||
import Hash from '../primitive/Hash';
|
||||
import Block, { BlockValue } from './Block';
|
||||
|
||||
interface SignedBlockValue {
|
||||
@@ -24,7 +23,7 @@ export default class SignedBlock extends Struct {
|
||||
public constructor (value?: SignedBlockValue | Uint8Array) {
|
||||
super({
|
||||
block: Block,
|
||||
justification: ClassOf<Justification>('Justification')
|
||||
justification: ClassOf('Justification')
|
||||
}, value);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,12 +2,13 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Hash } from '../srml/runtime/types';
|
||||
import { AnyU8a } from '../types';
|
||||
|
||||
import { ClassOf } from '../codec/createType';
|
||||
import Struct from '../codec/Struct';
|
||||
import Vector from '../codec/Vector';
|
||||
import Hash from '../primitive/Hash';
|
||||
import { KeyValueOption, KeyValueOptionValue } from '../type/KeyValue';
|
||||
import { KeyValueOption, KeyValueOptionValue } from '../primitive/KeyValue';
|
||||
|
||||
interface StorageChangeSetValue {
|
||||
block?: AnyU8a;
|
||||
@@ -24,7 +25,7 @@ interface StorageChangeSetValue {
|
||||
export default class StorageChangeSet extends Struct {
|
||||
public constructor (value?: StorageChangeSetValue | Uint8Array) {
|
||||
super({
|
||||
block: Hash,
|
||||
block: ClassOf('Hash'),
|
||||
changes: Vector.with(KeyValueOption)
|
||||
}, value);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import { isString, stringCamelCase, stringUpperFirst } from '@polkadot/util';
|
||||
import { getTypeDef, TypeDef, TypeDefInfo, TypeDefExtVecFixed } from '../codec/createType';
|
||||
import * as codecClasses from '../codec';
|
||||
import * as primitiveClasses from '../primitive';
|
||||
import * as typeClasses from '../type';
|
||||
import * as definitions from '../srml/definitions';
|
||||
|
||||
// these map all the codec and primitive types for import, see the TypeImports below. If
|
||||
@@ -24,7 +23,6 @@ interface TypeImports {
|
||||
localTypes: LocalExist;
|
||||
ownTypes: string[];
|
||||
primitiveTypes: TypeExist;
|
||||
substrateTypes: TypeExist;
|
||||
}
|
||||
|
||||
const HEADER = '/* eslint-disable @typescript-eslint/no-empty-interface */\n// Auto-generated via `yarn build:srmlTs`, do not edit\n\n';
|
||||
@@ -32,7 +30,7 @@ const FOOTER = '\n';
|
||||
|
||||
// Maps the types as found to the source location. This is used to generate the
|
||||
// imports in the output file, dep-duped and sorted
|
||||
function setImports ({ codecTypes, localTypes, ownTypes, primitiveTypes, substrateTypes }: TypeImports, types: string[]): void {
|
||||
function setImports ({ codecTypes, localTypes, ownTypes, primitiveTypes }: TypeImports, types: string[]): void {
|
||||
types.forEach((type): void => {
|
||||
if (ownTypes.includes(type)) {
|
||||
// do nothing
|
||||
@@ -40,8 +38,6 @@ function setImports ({ codecTypes, localTypes, ownTypes, primitiveTypes, substra
|
||||
codecTypes[type] = true;
|
||||
} else if ((primitiveClasses as any)[type]) {
|
||||
primitiveTypes[type] = true;
|
||||
} else if ((typeClasses as any)[type]) {
|
||||
substrateTypes[type] = true;
|
||||
} else {
|
||||
// find this module inside the exports from the rest
|
||||
const [moduleName] = Object.entries(definitions).find(([, { types }]): boolean =>
|
||||
@@ -262,11 +258,10 @@ function generateTsDef (srmlName: string, { types }: { types: Record<string, any
|
||||
}, {});
|
||||
const ownTypes = Object.keys(types);
|
||||
const primitiveTypes: TypeExist = {};
|
||||
const substrateTypes: TypeExist = {};
|
||||
const interfaces = Object.entries(types).map(([name, type]): [string, string] => {
|
||||
const def = getTypeDef(isString(type) ? type.toString() : JSON.stringify(type), name);
|
||||
|
||||
return [name, generators[def.info](def, { codecTypes, localTypes, ownTypes, primitiveTypes, substrateTypes })];
|
||||
return [name, generators[def.info](def, { codecTypes, localTypes, ownTypes, primitiveTypes })];
|
||||
});
|
||||
|
||||
const sortedDefs = interfaces.sort((a, b): number => a[0].localeCompare(b[0])).map(([, definition]): string => definition).join('\n\n');
|
||||
@@ -283,10 +278,6 @@ function generateTsDef (srmlName: string, { types }: { types: Record<string, any
|
||||
file: '../primitive',
|
||||
types: Object.keys(primitiveTypes)
|
||||
},
|
||||
{
|
||||
file: '../type',
|
||||
types: Object.keys(substrateTypes)
|
||||
},
|
||||
...Object.keys(localTypes).map((moduleName): { file: string; types: string[] } => ({
|
||||
file: `${moduleName}/types`,
|
||||
types: Object.keys(localTypes[moduleName])
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
import { Codec } from '../../types';
|
||||
import { Enum, Option } from '../../codec';
|
||||
import { AccountId, Hash } from '../../primitive';
|
||||
import { BlockNumber } from '../../type';
|
||||
import { AccountId } from '../../primitive';
|
||||
import { BlockNumber, Hash } from '../runtime/types';
|
||||
|
||||
export interface InclusionHeight extends BlockNumber {}
|
||||
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
|
||||
import { Struct } from '../../codec';
|
||||
import { Balance } from '../../primitive';
|
||||
import { BlockNumber } from '../../type';
|
||||
import { LockIdentifier } from '../runtime/types';
|
||||
import { WithdrawReasons } from '../staking/types';
|
||||
import { Set, Struct } from '../../codec';
|
||||
import { Balance, BlockNumber, LockIdentifier } from '../runtime/types';
|
||||
|
||||
export interface BalanceLock extends Struct {
|
||||
readonly id: LockIdentifier;
|
||||
@@ -18,3 +15,10 @@ export interface VestingSchedule extends Struct {
|
||||
readonly offset: Balance;
|
||||
readonly perBlock: Balance;
|
||||
}
|
||||
|
||||
export interface WithdrawReasons extends Set {
|
||||
readonly isTransactionPayment: boolean;
|
||||
readonly isTransfer: boolean;
|
||||
readonly isReserve: boolean;
|
||||
readonly isFee: boolean;
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
|
||||
import { Compact, Enum, Option, Struct, Vector } from '../../codec';
|
||||
import { Balance, Bool, Bytes, Hash, Null, u32, u64, u8 } from '../../primitive';
|
||||
import { BlockNumber } from '../../type';
|
||||
import { Bool, Bytes, Null, u32, u64, u8 } from '../../primitive';
|
||||
import { Balance, BlockNumber, Hash } from '../runtime/types';
|
||||
|
||||
export interface AliveContractInfo extends Struct {
|
||||
readonly trieId: TrieId;
|
||||
|
||||
@@ -6,10 +6,7 @@
|
||||
// layers can re-use types from higher layers as this is being injected. The
|
||||
// injection order is critical.
|
||||
|
||||
// first do the deprecated types, these should be self-standing
|
||||
export { default as deprecated } from './deprecated/definitions';
|
||||
|
||||
// runtime before balances, session
|
||||
// runtime before everything else, these are base definitions
|
||||
export { default as runtime } from './runtime/definitions';
|
||||
|
||||
// consensus before grandpa, imOnline
|
||||
@@ -31,7 +28,9 @@ export { default as balances } from './balances/definitions';
|
||||
export { default as collective } from './collective/definitions';
|
||||
export { default as contracts } from './contracts/definitions';
|
||||
export { default as democracy } from './democracy/definitions';
|
||||
export { default as deprecated } from './deprecated/definitions';
|
||||
export { default as imOnline } from './imOnline/definitions';
|
||||
export { default as parachains } from './parachains/definitions';
|
||||
export { default as staking } from './staking/definitions';
|
||||
export { default as system } from './system/definitions';
|
||||
export { default as treasury } from './treasury/definitions';
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import { Enum, Struct } from '../../codec';
|
||||
import { Method, u32 } from '../../primitive';
|
||||
import { BlockNumber } from '../../type';
|
||||
import { BlockNumber } from '../runtime/types';
|
||||
import { VoteThreshold } from '../elections/types';
|
||||
|
||||
export interface Conviction extends Enum {
|
||||
|
||||
@@ -15,6 +15,11 @@ export default {
|
||||
AssetOf: 'u32',
|
||||
|
||||
// Metadata v3
|
||||
// :: contracts
|
||||
AccountInfo: {
|
||||
trieId: 'Bytes',
|
||||
currentMemStored: 'u64'
|
||||
},
|
||||
// :: democracy
|
||||
LockPeriods: 'i8',
|
||||
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
|
||||
import { Enum } from '../../codec';
|
||||
import { AccountId, Balance, Bytes, Null, i8, u32 } from '../../primitive';
|
||||
import { Enum, Struct } from '../../codec';
|
||||
import { AccountId, Bytes, Null, i8, u32, u64 } from '../../primitive';
|
||||
import { Balance } from '../runtime/types';
|
||||
|
||||
export interface AccountInfo extends Struct {
|
||||
readonly trieId: Bytes;
|
||||
readonly currentMemStored: u64;
|
||||
}
|
||||
|
||||
export interface Amount extends Balance {}
|
||||
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
|
||||
import { Enum, Struct } from '../../codec';
|
||||
import { Balance, u32 } from '../../primitive';
|
||||
import { u32 } from '../../primitive';
|
||||
import { Balance } from '../runtime/types';
|
||||
|
||||
export interface ApprovalFlag extends u32 {}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import { Codec } from '../../types';
|
||||
import { Enum, Struct, Vector } from '../../codec';
|
||||
import { u64 } from '../../primitive';
|
||||
import { BlockNumber } from '../../type';
|
||||
import { BlockNumber } from '../runtime/types';
|
||||
import { AuthorityId } from '../consensus/types';
|
||||
|
||||
export interface AuthorityWeight extends u64 {}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import { Struct, Vector } from '../../codec';
|
||||
import { Bytes } from '../../primitive';
|
||||
import { BlockNumber } from '../../type';
|
||||
import { BlockNumber } from '../runtime/types';
|
||||
import { AuthorityId } from '../consensus/types';
|
||||
import { SessionIndex } from '../session/types';
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
import { Codec } from '../../types';
|
||||
import { Enum, Struct, Vector } from '../../codec';
|
||||
import { AccountId, BalanceOf, Bytes, Hash, Signature, u32, u64 } from '../../primitive';
|
||||
import { BlockNumber } from '../../type';
|
||||
import { AccountId, Bytes, u32, u64 } from '../../primitive';
|
||||
import { BalanceOf, BlockNumber, Hash, Signature } from '../runtime/types';
|
||||
|
||||
export interface AttestedCandidate extends Struct {
|
||||
readonly candidate: CandidateReceipt;
|
||||
|
||||
@@ -4,12 +4,25 @@
|
||||
|
||||
export default {
|
||||
types: {
|
||||
AccountIdOf: 'AccountId',
|
||||
Balance: 'u128',
|
||||
BalanceOf: 'Balance',
|
||||
BlockNumber: 'u64',
|
||||
Hash: 'H256',
|
||||
Justification: 'Bytes',
|
||||
KeyTypeId: 'u32',
|
||||
LockIdentifier: '[u8; 8]',
|
||||
Index: 'u64',
|
||||
Perbill: 'u32',
|
||||
Permill: 'u32',
|
||||
SessionKeys: {
|
||||
ed25519: 'AccountId'
|
||||
},
|
||||
ValidatorId: 'AccountId'
|
||||
Signature: 'H512',
|
||||
Ed25519Signature: 'Signature',
|
||||
Sr25519Signature: 'Signature',
|
||||
ValidatorId: 'AccountId',
|
||||
Weight: 'u32',
|
||||
WeightMultiplier: 'Fixed64'
|
||||
}
|
||||
};
|
||||
|
||||
@@ -2,7 +2,21 @@
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
|
||||
import { Struct, Vector } from '../../codec';
|
||||
import { AccountId, Bytes, u32, u8 } from '../../primitive';
|
||||
import { AccountId, Bytes, Fixed64, H256, H512, u128, u32, u64, u8 } from '../../primitive';
|
||||
|
||||
export interface AccountIdOf extends AccountId {}
|
||||
|
||||
export interface Balance extends u128 {}
|
||||
|
||||
export interface BalanceOf extends Balance {}
|
||||
|
||||
export interface BlockNumber extends u64 {}
|
||||
|
||||
export interface Ed25519Signature extends Signature {}
|
||||
|
||||
export interface Hash extends H256 {}
|
||||
|
||||
export interface Index extends u64 {}
|
||||
|
||||
export interface Justification extends Bytes {}
|
||||
|
||||
@@ -10,8 +24,20 @@ export interface KeyTypeId extends u32 {}
|
||||
|
||||
export interface LockIdentifier extends Vector<u8> {}
|
||||
|
||||
export interface Perbill extends u32 {}
|
||||
|
||||
export interface Permill extends u32 {}
|
||||
|
||||
export interface SessionKeys extends Struct {
|
||||
readonly ed25519: AccountId;
|
||||
}
|
||||
|
||||
export interface Signature extends H512 {}
|
||||
|
||||
export interface Sr25519Signature extends Signature {}
|
||||
|
||||
export interface ValidatorId extends AccountId {}
|
||||
|
||||
export interface Weight extends u32 {}
|
||||
|
||||
export interface WeightMultiplier extends Fixed64 {}
|
||||
|
||||
@@ -25,6 +25,16 @@ export default {
|
||||
'Controller'
|
||||
]
|
||||
},
|
||||
UnlockChunk: {
|
||||
value: 'Compact<Balance>',
|
||||
era: 'Compact<BlockNumber>'
|
||||
},
|
||||
StakingLedger: {
|
||||
stash: 'AccountId',
|
||||
total: 'Compact<Balance>',
|
||||
active: 'Compact<Balance>',
|
||||
unlocking: 'Vec<UnlockChunk>'
|
||||
},
|
||||
ValidatorPrefs: {
|
||||
unstakeThreshold: 'Compact<u32>',
|
||||
validatorPayment: 'Compact<Balance>'
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
|
||||
import { Compact, Enum, Set, Struct, Vector } from '../../codec';
|
||||
import { AccountId, Balance, u32 } from '../../primitive';
|
||||
import { Compact, Enum, Struct, Vector } from '../../codec';
|
||||
import { AccountId, u32 } from '../../primitive';
|
||||
import { Balance, BlockNumber } from '../runtime/types';
|
||||
|
||||
export interface EraIndex extends u32 {}
|
||||
|
||||
@@ -37,14 +38,19 @@ export interface RewardDestination extends Enum {
|
||||
readonly isController: boolean;
|
||||
}
|
||||
|
||||
export interface StakingLedger extends Struct {
|
||||
readonly stash: AccountId;
|
||||
readonly total: Compact<Balance>;
|
||||
readonly active: Compact<Balance>;
|
||||
readonly unlocking: Vector<UnlockChunk>;
|
||||
}
|
||||
|
||||
export interface UnlockChunk extends Struct {
|
||||
readonly value: Compact<Balance>;
|
||||
readonly era: Compact<BlockNumber>;
|
||||
}
|
||||
|
||||
export interface ValidatorPrefs extends Struct {
|
||||
readonly unstakeThreshold: Compact<u32>;
|
||||
readonly validatorPayment: Compact<Balance>;
|
||||
}
|
||||
|
||||
export interface WithdrawReasons extends Set {
|
||||
readonly isTransactionPayment: boolean;
|
||||
readonly isTransfer: boolean;
|
||||
readonly isReserve: boolean;
|
||||
readonly isFee: boolean;
|
||||
}
|
||||
|
||||
+5
-9
@@ -2,12 +2,8 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import U32 from './U32';
|
||||
|
||||
/**
|
||||
* @name Weight
|
||||
* @description
|
||||
* Numeric range of a transaction weight.
|
||||
*/
|
||||
export default class Weight extends U32 {
|
||||
}
|
||||
export default {
|
||||
types: {
|
||||
Key: 'Bytes'
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
|
||||
import { Bytes } from '../../primitive';
|
||||
|
||||
export interface Key extends Bytes {}
|
||||
@@ -2,7 +2,8 @@
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
|
||||
import { Struct } from '../../codec';
|
||||
import { AccountId, Balance } from '../../primitive';
|
||||
import { AccountId } from '../../primitive';
|
||||
import { Balance } from '../runtime/types';
|
||||
|
||||
export interface TreasuryProposal extends Struct {
|
||||
readonly proposer: AccountId;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
|
||||
export * from './deprecated/types';
|
||||
export * from './runtime/types';
|
||||
export * from './consensus/types';
|
||||
export * from './session/types';
|
||||
@@ -13,7 +12,9 @@ export * from './balances/types';
|
||||
export * from './collective/types';
|
||||
export * from './contracts/types';
|
||||
export * from './democracy/types';
|
||||
export * from './deprecated/types';
|
||||
export * from './imOnline/types';
|
||||
export * from './parachains/types';
|
||||
export * from './staking/types';
|
||||
export * from './system/types';
|
||||
export * from './treasury/types';
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/types authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import U64 from '../primitive/U64';
|
||||
|
||||
/**
|
||||
* @name BlockNumber
|
||||
* @description
|
||||
* A representation of a Substrate BlockNumber, implemented as a [[U64]]
|
||||
*/
|
||||
export default class BlockNumber extends U64 {
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/types authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import Bytes from '../primitive/Bytes';
|
||||
|
||||
/**
|
||||
* @name Key
|
||||
* @description
|
||||
* The Substrate Key representation as a [[Bytes]] (`vec<u8>`).
|
||||
*/
|
||||
|
||||
export default class Key extends Bytes {
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/types authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import U64 from '../primitive/U64';
|
||||
|
||||
/**
|
||||
* @name Nonce
|
||||
* @description
|
||||
* The Nonce or number of transactions sent by a specific account. Generally used
|
||||
* with extrinsics to determine the order of execution. implemented as a Substrate
|
||||
* [[U64]]
|
||||
*/
|
||||
export default class Nonce extends U64 {
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/types authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import Compact from '../codec/Compact';
|
||||
import Nonce from './Nonce';
|
||||
|
||||
/**
|
||||
* @name Nonce
|
||||
* @description
|
||||
* The Compact<Nonce> or number of transactions sent by a specific account. Generally used
|
||||
* with extrinsics to determine the order of execution.
|
||||
*/
|
||||
export default class NonceCompact extends Compact.with(Nonce) {
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/types authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import Bytes from '../primitive/Bytes';
|
||||
|
||||
/**
|
||||
* @name OpaqueKey
|
||||
* @description
|
||||
* The Substrate OpaqueKey representation as a [[Bytes]] (`vec<u8>`).
|
||||
*/
|
||||
|
||||
export default class OpaqueKey extends Bytes {
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/types authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import U32 from '../primitive/U32';
|
||||
|
||||
/**
|
||||
* @name Perbill
|
||||
* @description
|
||||
* Parts per billion (see also [[Permill]])
|
||||
*/
|
||||
// TODO We need to think about the toNumber() and toString() here, so we
|
||||
// want to multiply by 1_000_000_000 for those purposes?
|
||||
export default class Perbill extends U32 {
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/types authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import U32 from '../primitive/U32';
|
||||
|
||||
/**
|
||||
* @name Permill
|
||||
* @description
|
||||
* Parts per million (See also [[Perbill]])
|
||||
*/
|
||||
// TODO We need to think about the toNumber() and toString() here, so we
|
||||
// want to multiply by 1_000_000 for those purposes?
|
||||
export default class Permill extends U32 {
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/types authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import Compact from '../codec/Compact';
|
||||
import Struct from '../codec/Struct';
|
||||
import Vector from '../codec/Vector';
|
||||
import AccountId from '../primitive/AccountId';
|
||||
import Balance from '../primitive/Balance';
|
||||
import BlockNumber from './BlockNumber';
|
||||
import UnlockChunk from './UnlockChunk';
|
||||
|
||||
/**
|
||||
* @name StakingLedger
|
||||
* @description
|
||||
* The ledger of a (bonded) stash
|
||||
*/
|
||||
export default class StakingLedger extends Struct {
|
||||
public constructor (value?: any) {
|
||||
super({
|
||||
stash: AccountId,
|
||||
total: Compact.with(Balance),
|
||||
active: Compact.with(Balance),
|
||||
unlocking: Vector.with(UnlockChunk)
|
||||
}, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The total amount of the stash's balance that will be at stake in any forthcoming rounds
|
||||
*/
|
||||
public get active (): Balance {
|
||||
return (this.get('active') as Compact<BlockNumber>).unwrap();
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The stash account whose balance is actually locked and at stake
|
||||
*/
|
||||
public get stash (): AccountId {
|
||||
return this.get('stash') as AccountId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The total amount of the stash's balance that we are currently accounting for. It's just `active` plus all the `unlocking` balances
|
||||
*/
|
||||
public get total (): Balance {
|
||||
return (this.get('total') as Compact<Balance>).unwrap();
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Any balance that is becoming free, which may eventually be transferred out of the stash (assuming it doesn't get slashed first)
|
||||
*/
|
||||
public get unlocking (): Vector<UnlockChunk> {
|
||||
return this.get('unlocking') as Vector<UnlockChunk>;
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/types authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import Compact from '../codec/Compact';
|
||||
import Struct from '../codec/Struct';
|
||||
import Balance from '../primitive/Balance';
|
||||
import BlockNumber from './BlockNumber';
|
||||
|
||||
/**
|
||||
* @name UnlockChunk
|
||||
* @description
|
||||
* Just a Balance/BlockNumber tuple to encode when a chunk of funds will be unlocked
|
||||
*/
|
||||
export default class UnlockChunk extends Struct {
|
||||
public constructor (value?: any) {
|
||||
super({
|
||||
value: Compact.with(Balance),
|
||||
era: Compact.with(BlockNumber)
|
||||
}, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Era number at which point it'll be unlocked
|
||||
*/
|
||||
public get era (): BlockNumber {
|
||||
return (this.get('era') as Compact<Balance>).unwrap();
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Amount of funds to be unlocked
|
||||
*/
|
||||
public get value (): Balance {
|
||||
return (this.get('value') as Compact<Balance>).unwrap();
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/types authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import Struct from '../codec/Struct';
|
||||
import Balance from '../primitive/Balance';
|
||||
|
||||
/**
|
||||
* @name VestingSchedule
|
||||
* @description Struct to encode the vesting schedule of an individual account
|
||||
*/
|
||||
export default class VestingSchedule extends Struct {
|
||||
public constructor (value?: any) {
|
||||
super({
|
||||
offset: Balance,
|
||||
perBlock: Balance
|
||||
}, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The offset as [[Balance]]
|
||||
*/
|
||||
public get offset (): Balance {
|
||||
return this.get('offset') as Balance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The perBlock value as [[Balance]]
|
||||
*/
|
||||
public get perBlock (): Balance {
|
||||
return this.get('perBlock') as Balance;
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/types authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
// NOTE When adding any types here, we need to update the coumentation links as
|
||||
// well - <root>/docs/SUMMARY.md as well as ../README.md
|
||||
|
||||
/**
|
||||
* @summary Type definitions that are used in the system
|
||||
*/
|
||||
export { default as BlockNumber } from './BlockNumber';
|
||||
export { default as Key } from './Key';
|
||||
export { default as KeyValue } from './KeyValue';
|
||||
// NOTE Nonce is renamed to Index
|
||||
export { default as Index, default as Nonce } from './Nonce';
|
||||
export { default as IndexCompact } from './NonceCompact';
|
||||
export { default as Permill } from './Permill';
|
||||
export { default as Perbill } from './Perbill';
|
||||
export { default as StakingLedger } from './StakingLedger';
|
||||
export { default as UnlockChunk } from './UnlockChunk';
|
||||
export { default as Vote } from './Vote';
|
||||
@@ -2,14 +2,15 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Balance, Index } from './srml/runtime/types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
|
||||
import Compact from './codec/Compact';
|
||||
import U8a from './codec/U8a';
|
||||
import { FunctionMetadata } from './Metadata/v6/Calls';
|
||||
import BalanceCompact from './primitive/BalanceCompact';
|
||||
import Method from './primitive/Method';
|
||||
import Address from './primitive/Address';
|
||||
import NonceCompact from './type/NonceCompact';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/interface-name-prefix
|
||||
export interface IKeyringPair {
|
||||
@@ -147,10 +148,10 @@ export interface IMethod extends Codec {
|
||||
interface ExtrinsicSignatureBase {
|
||||
readonly isSigned: boolean;
|
||||
readonly era: IExtrinsicEra;
|
||||
readonly nonce: NonceCompact;
|
||||
readonly nonce: Compact<Index>;
|
||||
readonly signature: IHash;
|
||||
readonly signer: Address;
|
||||
readonly tip: BalanceCompact;
|
||||
readonly tip: Compact<Balance>;
|
||||
}
|
||||
|
||||
export interface ExtrinsicPayloadValue {
|
||||
|
||||
Reference in New Issue
Block a user