Move H160, H256 & H512 to interfaces (#1890)
* Move H160, H256 & H512 to interfaces * Test for Hash -> H256 * Replace IHash & Codec.hash with H256 * [u8; n] extends U8aFixed * Update formatting.ts
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
- Add `.toHuman` on SubmittableResult, aligning with Codec
|
||||
- Remove `GenericDigestItem`, the `DigestItem` is now a type interface via `@polkadot/types/interfaces`
|
||||
- Move `H160`, `H256` & `H512` to interfaces in `@polkadot/types/interfaces`
|
||||
- Align construction of unknown types via `registry.get` e.g. in Events, warn on detection, throw on use
|
||||
- Expose static with on `UInt`, `Int` & `U8aFixed` classes with optional type name override
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
|
||||
import { AnyNumber, ITuple } from '@polkadot/types/types';
|
||||
import { Option, Raw, Vec } from '@polkadot/types/codec';
|
||||
import { Option, U8aFixed, Vec } from '@polkadot/types/codec';
|
||||
import { Bytes, Data, bool, u32, u64 } from '@polkadot/types/primitive';
|
||||
import { AccountId, AccountIndex, Balance, BalanceOf, BlockNumber, Hash, Index, KeyTypeId, Moment, Perbill, ValidatorId, Weight } from '@polkadot/types/interfaces/runtime';
|
||||
import { UncleEntryItem } from '@polkadot/types/interfaces/authorship';
|
||||
@@ -97,7 +97,7 @@ declare module '@polkadot/api/types/storage' {
|
||||
/**
|
||||
* The set of open multisig operations.
|
||||
**/
|
||||
multisigs: AugmentedQueryDoubleMap<ApiType, (key1: AccountId | string | Uint8Array, key2: Raw | string | Uint8Array) => Observable<Option<Multisig>>, AccountId | string | Uint8Array> & QueryableStorageEntry<ApiType>;
|
||||
multisigs: AugmentedQueryDoubleMap<ApiType, (key1: AccountId | string | Uint8Array, key2: U8aFixed | string | Uint8Array) => Observable<Option<Multisig>>, AccountId | string | Uint8Array> & QueryableStorageEntry<ApiType>;
|
||||
};
|
||||
babe: {
|
||||
[index: string]: QueryableStorageEntry<ApiType>;
|
||||
@@ -128,11 +128,11 @@ declare module '@polkadot/api/types/storage' {
|
||||
* used where a number is needed that cannot have been chosen by an
|
||||
* adversary, for purposes such as public-coin zero-knowledge proofs.
|
||||
**/
|
||||
randomness: AugmentedQuery<ApiType, () => Observable<Raw>> & QueryableStorageEntry<ApiType>;
|
||||
randomness: AugmentedQuery<ApiType, () => Observable<U8aFixed>> & QueryableStorageEntry<ApiType>;
|
||||
/**
|
||||
* Next epoch randomness.
|
||||
**/
|
||||
nextRandomness: AugmentedQuery<ApiType, () => Observable<Raw>> & QueryableStorageEntry<ApiType>;
|
||||
nextRandomness: AugmentedQuery<ApiType, () => Observable<U8aFixed>> & QueryableStorageEntry<ApiType>;
|
||||
/**
|
||||
* Randomness under construction.
|
||||
* We make a tradeoff between storage accesses and list length.
|
||||
@@ -143,7 +143,7 @@ declare module '@polkadot/api/types/storage' {
|
||||
* epoch.
|
||||
**/
|
||||
segmentIndex: AugmentedQuery<ApiType, () => Observable<u32>> & QueryableStorageEntry<ApiType>;
|
||||
underConstruction: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Vec<Raw>>> & QueryableStorageEntry<ApiType>;
|
||||
underConstruction: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Vec<U8aFixed>>> & QueryableStorageEntry<ApiType>;
|
||||
/**
|
||||
* Temporary value (cleared at block finalization) which is `Some`
|
||||
* if per-block initialization has already been called for current block.
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
|
||||
import { AnyNumber, Codec, IExtrinsic } from '@polkadot/types/types';
|
||||
import { Option, Vec } from '@polkadot/types/codec';
|
||||
import { Bytes, H256, StorageData, StorageKey, Text, bool, u32, u64 } from '@polkadot/types/primitive';
|
||||
import { Bytes, StorageData, StorageKey, Text, bool, u32, u64 } from '@polkadot/types/primitive';
|
||||
import { Metadata } from '@polkadot/types';
|
||||
import { AccountId, BlockNumber, Extrinsic, Hash, Header, Index, SignedBlock } from '@polkadot/types/interfaces/runtime';
|
||||
import { AccountId, BlockNumber, Extrinsic, H256, Hash, Header, Index, SignedBlock } from '@polkadot/types/interfaces/runtime';
|
||||
import { ContractCallRequest, ContractExecResult } from '@polkadot/types/interfaces/contracts';
|
||||
import { BlockHash, ChainProperties, ExtrinsicOrHash, ExtrinsicStatus, Health, NetworkState, PeerInfo, RpcMethods, RuntimeDispatchInfo, RuntimeVersion, StorageChangeSet } from '@polkadot/types/interfaces/rpc';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
|
||||
import { AnyNumber, ITuple } from '@polkadot/types/types';
|
||||
import { Compact, Option, Raw, Vec } from '@polkadot/types/codec';
|
||||
import { Compact, Option, U8aFixed, Vec } from '@polkadot/types/codec';
|
||||
import { Bytes, Data, IdentityFields, bool, u16, u32, u64 } from '@polkadot/types/primitive';
|
||||
import { AccountId, AccountIndex, Address, Balance, BalanceOf, BlockNumber, Call, ChangesTrieConfiguration, Hash, Header, KeyValue, LookupSource, Moment, Signature } from '@polkadot/types/interfaces/runtime';
|
||||
import { MemberCount, ProposalIndex } from '@polkadot/types/interfaces/collective';
|
||||
@@ -151,7 +151,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* `MultisigDepositBase + threshold * MultisigDepositFactor`.
|
||||
* # </weight>
|
||||
**/
|
||||
approveAsMulti: AugmentedSubmittable<(threshold: u16 | AnyNumber | Uint8Array, otherSignatories: Vec<AccountId> | (AccountId | string | Uint8Array)[], maybeTimepoint: Option<Timepoint> | null | object | string | Uint8Array, callHash: Raw | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
approveAsMulti: AugmentedSubmittable<(threshold: u16 | AnyNumber | Uint8Array, otherSignatories: Vec<AccountId> | (AccountId | string | Uint8Array)[], maybeTimepoint: Option<Timepoint> | null | object | string | Uint8Array, callHash: U8aFixed | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
/**
|
||||
* Cancel a pre-existing, on-going multisig transaction. Any deposit reserved previously
|
||||
* for this operation will be unreserved on success.
|
||||
@@ -173,7 +173,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* - Storage: removes one item.
|
||||
* # </weight>
|
||||
**/
|
||||
cancelAsMulti: AugmentedSubmittable<(threshold: u16 | AnyNumber | Uint8Array, otherSignatories: Vec<AccountId> | (AccountId | string | Uint8Array)[], timepoint: Timepoint | { height?: any; index?: any } | string | Uint8Array, callHash: Raw | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
cancelAsMulti: AugmentedSubmittable<(threshold: u16 | AnyNumber | Uint8Array, otherSignatories: Vec<AccountId> | (AccountId | string | Uint8Array)[], timepoint: Timepoint | { height?: any; index?: any } | string | Uint8Array, callHash: U8aFixed | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
};
|
||||
timestamp: {
|
||||
[index: string]: SubmittableExtrinsicFunction<ApiType>;
|
||||
|
||||
@@ -2,13 +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 { EventRecord, SignedBlock } from '@polkadot/types/interfaces';
|
||||
|
||||
import { Raw } from '@polkadot/types';
|
||||
import { EventRecord, H256, SignedBlock } from '@polkadot/types/interfaces';
|
||||
|
||||
import l from './logging';
|
||||
|
||||
export default function filterEvents (extHash: Raw, { block: { extrinsics, header } }: SignedBlock, allEvents: EventRecord[]): EventRecord[] | undefined {
|
||||
export default function filterEvents (extHash: H256, { block: { extrinsics, header } }: SignedBlock, allEvents: EventRecord[]): EventRecord[] | undefined {
|
||||
// extrinsics to hashes
|
||||
const myHash = extHash.toHex();
|
||||
const allHashes = extrinsics.map((ext): string => ext.hash.toHex());
|
||||
|
||||
@@ -128,12 +128,10 @@ function tsVec (definitions: object, def: TypeDef, imports: TypeImports): string
|
||||
? (def.ext as TypeDefExtVecFixed).type
|
||||
: (def.sub as TypeDef).type;
|
||||
|
||||
// FIXME This should be a VecFixed
|
||||
// FIXME Technically Vec has length prefix, so for others this is not 100%
|
||||
if (def.info === TypeDefInfo.VecFixed && type === 'u8') {
|
||||
setImports(definitions, imports, ['Codec']);
|
||||
setImports(definitions, imports, ['U8aFixed']);
|
||||
|
||||
return exportType(def.name, 'Uint8Array, Codec');
|
||||
return exportType(def.name, 'U8aFixed');
|
||||
}
|
||||
|
||||
return exportInterface(def.name, formatType(definitions, def, imports));
|
||||
|
||||
@@ -163,11 +163,11 @@ export function formatType (definitions: object, type: string | TypeDef, imports
|
||||
}
|
||||
case TypeDefInfo.VecFixed: {
|
||||
if ((typeDef.ext as TypeDefExtVecFixed).type === 'u8') {
|
||||
setImports(definitions, imports, ['Raw']);
|
||||
setImports(definitions, imports, ['U8aFixed']);
|
||||
|
||||
// `[u8, 32]` gets transformed into Raw
|
||||
return 'Raw';
|
||||
return 'U8aFixed';
|
||||
}
|
||||
|
||||
setImports(definitions, imports, ['Vec']);
|
||||
return formatVec(formatType(definitions, (typeDef.ext as TypeDefExtVecFixed).type, imports));
|
||||
}
|
||||
|
||||
@@ -2,7 +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 { AnyJson, AnyJsonArray, Codec, IHash, Registry } from '../types';
|
||||
import { H256 } from '../interfaces/runtime';
|
||||
import { AnyJson, AnyJsonArray, Codec, Registry } from '../types';
|
||||
|
||||
import { u8aConcat, u8aToHex } from '@polkadot/util';
|
||||
import { blake2AsU8a } from '@polkadot/util-crypto';
|
||||
@@ -39,7 +40,7 @@ export default abstract class AbstractArray<T extends Codec> extends Array<T> im
|
||||
/**
|
||||
* @description returns a hash of the contents
|
||||
*/
|
||||
public get hash (): IHash {
|
||||
public get hash (): H256 {
|
||||
return new Raw(this.registry, blake2AsU8a(this.toU8a(), 256));
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +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 { AnyNumber, Codec, IHash, Registry } from '../types';
|
||||
import { H256 } from '../interfaces/runtime';
|
||||
import { AnyNumber, Codec, Registry } from '../types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import { bnToBn, formatNumber, hexToBn, isHex, isString, isU8a, u8aToBn } from '@polkadot/util';
|
||||
@@ -79,7 +80,7 @@ export default abstract class AbstractInt extends BN implements Codec {
|
||||
/**
|
||||
* @description returns a hash of the contents
|
||||
*/
|
||||
public get hash (): IHash {
|
||||
public get hash (): H256 {
|
||||
return new Raw(this.registry, blake2AsU8a(this.toU8a(), 256));
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +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 { AnyJson, Constructor, Codec, IHash, InterfaceTypes, Registry } from '../types';
|
||||
import { H256 } from '../interfaces/runtime';
|
||||
import { AnyJson, Constructor, Codec, InterfaceTypes, Registry } from '../types';
|
||||
|
||||
import { isHex, hexToU8a, isU8a, u8aConcat, u8aToHex, u8aToU8a } from '@polkadot/util';
|
||||
import { blake2AsU8a } from '@polkadot/util-crypto';
|
||||
@@ -121,7 +122,7 @@ export default class BTreeMap<K extends Codec = Codec, V extends Codec = Codec>
|
||||
/**
|
||||
* @description Returns a hash of the value
|
||||
*/
|
||||
public get hash (): IHash {
|
||||
public get hash (): H256 {
|
||||
return new Raw(this.registry, blake2AsU8a(this.toU8a(), 256));
|
||||
}
|
||||
|
||||
|
||||
@@ -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 { AnyJsonArray, Constructor, Codec, IHash, InterfaceTypes, Registry } from '../types';
|
||||
import { H256 } from '../interfaces/runtime';
|
||||
import { AnyJsonArray, Constructor, Codec, InterfaceTypes, Registry } from '../types';
|
||||
|
||||
import { isHex, hexToU8a, isU8a, u8aConcat, u8aToHex, u8aToU8a } from '@polkadot/util';
|
||||
import { blake2AsU8a } from '@polkadot/util-crypto';
|
||||
|
||||
import Compact from './Compact';
|
||||
import U8a from './U8aFixed';
|
||||
import Raw from './Raw';
|
||||
import { compareSet, decodeU8a, typeToConstructor } from './utils';
|
||||
|
||||
export default class BTreeSet<V extends Codec = Codec> extends Set<V> implements Codec {
|
||||
@@ -115,8 +116,8 @@ export default class BTreeSet<V extends Codec = Codec> extends Set<V> implements
|
||||
/**
|
||||
* @description Returns a hash of the value
|
||||
*/
|
||||
public get hash (): IHash {
|
||||
return new U8a(this.registry, blake2AsU8a(this.toU8a(), 256));
|
||||
public get hash (): H256 {
|
||||
return new Raw(this.registry, blake2AsU8a(this.toU8a(), 256));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +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 { AnyJson, BareOpts, Codec, IHash, Registry } from '../types';
|
||||
import { H256 } from '../interfaces/runtime';
|
||||
import { AnyJson, BareOpts, Codec, Registry } from '../types';
|
||||
|
||||
import { blake2AsU8a } from '@polkadot/util-crypto';
|
||||
|
||||
@@ -32,7 +33,7 @@ export default abstract class Base<T extends Codec> implements Codec {
|
||||
/**
|
||||
* @description returns a hash of the contents
|
||||
*/
|
||||
public get hash (): IHash {
|
||||
public get hash (): H256 {
|
||||
return new Raw(this.registry, blake2AsU8a(this.toU8a(), 256));
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +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 { AnyNumber, Codec, IHash, Registry } from '../types';
|
||||
import { H256 } from '../interfaces/runtime';
|
||||
import { AnyNumber, Codec, Registry } from '../types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import { bnToBn, bnToHex, bnToU8a, isString, isU8a, u8aToBn } from '@polkadot/util';
|
||||
@@ -60,8 +61,8 @@ export default class CodecDate extends Date implements Codec {
|
||||
/**
|
||||
* @description returns a hash of the contents
|
||||
*/
|
||||
public get hash (): IHash {
|
||||
return createType(this.registry, 'Hash', blake2AsU8a(this.toU8a(), 256));
|
||||
public get hash (): H256 {
|
||||
return createType(this.registry, 'H256', blake2AsU8a(this.toU8a(), 256));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +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 { AnyU8a, IHash, IU8a, Registry } from '../types';
|
||||
import { H256 } from '../interfaces/runtime';
|
||||
import { AnyU8a, IU8a, Registry } from '../types';
|
||||
|
||||
import { isU8a, isUndefined, u8aToHex, u8aToU8a } from '@polkadot/util';
|
||||
import { blake2AsU8a } from '@polkadot/util-crypto';
|
||||
@@ -44,7 +45,7 @@ export default class Raw extends Uint8Array implements IU8a {
|
||||
/**
|
||||
* @description returns a hash of the contents
|
||||
*/
|
||||
public get hash (): IHash {
|
||||
public get hash (): H256 {
|
||||
return new Raw(this.registry, blake2AsU8a(this.toU8a(), 256));
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +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 { Codec, Constructor, IHash, Registry } from '../types';
|
||||
import { H256 } from '../interfaces/runtime';
|
||||
import { Codec, Constructor, Registry } from '../types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import { assert, bnToBn, isU8a, isNumber, isString, isUndefined, stringCamelCase, stringUpperFirst, u8aToHex, isBn, u8aToU8a } from '@polkadot/util';
|
||||
@@ -115,7 +116,7 @@ export default class CodecSet extends Set<string> implements Codec {
|
||||
/**
|
||||
* @description returns a hash of the contents
|
||||
*/
|
||||
public get hash (): IHash {
|
||||
public get hash (): H256 {
|
||||
return new Raw(this.registry, blake2AsU8a(this.toU8a(), 256));
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +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 { AnyJsonObject, BareOpts, Codec, Constructor, ConstructorDef, IHash, InterfaceTypes, Registry } from '../types';
|
||||
import { H256 } from '../interfaces/runtime';
|
||||
import { AnyJsonObject, BareOpts, Codec, Constructor, ConstructorDef, InterfaceTypes, Registry } from '../types';
|
||||
|
||||
import { hexToU8a, isBoolean, isHex, isObject, isU8a, isUndefined, u8aConcat, u8aToHex } from '@polkadot/util';
|
||||
import { blake2AsU8a } from '@polkadot/util-crypto';
|
||||
@@ -188,7 +189,7 @@ export default class Struct<
|
||||
/**
|
||||
* @description returns a hash of the contents
|
||||
*/
|
||||
public get hash (): IHash {
|
||||
public get hash (): H256 {
|
||||
return new Raw(this.registry, blake2AsU8a(this.toU8a(), 256));
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +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 { AnyJsonObject, Codec, IHash, Registry } from '../types';
|
||||
import { H256 } from '../interfaces/runtime';
|
||||
import { AnyJsonObject, Codec, Registry } from '../types';
|
||||
|
||||
import { isUndefined } from '@polkadot/util';
|
||||
import { blake2AsU8a } from '@polkadot/util-crypto';
|
||||
@@ -58,7 +59,7 @@ export default class StructAny extends Map<string, any> implements Codec {
|
||||
/**
|
||||
* @description returns a hash of the contents
|
||||
*/
|
||||
public get hash (): IHash {
|
||||
public get hash (): H256 {
|
||||
return new Raw(this.registry, blake2AsU8a(this.toU8a(), 256));
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ export { default as Set } from './Set';
|
||||
export { default as Struct } from './Struct';
|
||||
// export { default as StructAny } from './StructAny';
|
||||
export { default as Tuple } from './Tuple';
|
||||
export { default as U8aFixed } from './U8aFixed';
|
||||
export { default as Vec } from './Vec';
|
||||
|
||||
// Convenience base classes, used as "anything of this type" bases
|
||||
|
||||
@@ -149,7 +149,7 @@ const infoMapping: Record<TypeDefInfo, (registry: Registry, value: TypeDef) => C
|
||||
|
||||
return (
|
||||
ext.type === 'u8'
|
||||
? U8aFixed.with((ext.length * 8) as U8aFixedBitLength)
|
||||
? U8aFixed.with((ext.length * 8) as U8aFixedBitLength, ext.rawName)
|
||||
: VecFixed.with(ext.type as InterfaceTypes, ext.length)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,15 @@ import { createClass, createType, createTypeUnsafe, ClassOf, TypeRegistry } from
|
||||
describe('createType', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
it('allows creation of a H256 (with proper toRawType)', (): void => {
|
||||
expect(
|
||||
createTypeUnsafe(registry, 'H256').toRawType()
|
||||
).toEqual('H256');
|
||||
expect(
|
||||
createTypeUnsafe(registry, 'Hash').toRawType()
|
||||
).toEqual('H256');
|
||||
});
|
||||
|
||||
it('allows creation of a Struct', (): void => {
|
||||
expect(
|
||||
createTypeUnsafe(registry, '{"balance":"Balance","index":"u32"}', [{
|
||||
|
||||
@@ -67,13 +67,13 @@ function _decodeStruct (value: TypeDef, type: string, _: string): TypeDef {
|
||||
// decode a fixed vector, e.g. [u8;32]
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
function _decodeFixedVec (value: TypeDef, type: string, _: string): TypeDef {
|
||||
const [vecType, _vecLen] = type.substr(1, type.length - 2).split(';');
|
||||
const [vecType, _vecLen, rawName] = type.substr(1, type.length - 2).split(';');
|
||||
const vecLen = parseInt(_vecLen.trim(), 10);
|
||||
|
||||
// as a first round, only u8 via u8aFixed, we can add more support
|
||||
assert(vecLen <= 256, `${type}: Only support for [Type; <length>], where length <= 256`);
|
||||
|
||||
value.ext = { length: vecLen, type: vecType } as TypeDefExtVecFixed;
|
||||
value.ext = { length: vecLen, rawName, type: vecType } as TypeDefExtVecFixed;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ export enum TypeDefInfo {
|
||||
|
||||
export interface TypeDefExtVecFixed {
|
||||
length: number;
|
||||
rawName?: string;
|
||||
type: string;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
|
||||
import { Compact, Option, Raw, Vec } from '@polkadot/types/codec';
|
||||
import { BitVec, Bytes, Data, Fixed64, H160, H256, H512, IdentityFields, Null, StorageData, StorageKey, Text, Type, U256, Unconstructable, bool, i128, i16, i256, i32, i64, i8, u128, u16, u256, u32, u64, u8, usize } from '@polkadot/types/primitive';
|
||||
import { AccountId, AccountIdOf, AccountIndex, Address, AssetId, Balance, BalanceOf, Block, BlockNumber, Call, ChangesTrieConfiguration, Consensus, ConsensusEngineId, Digest, DigestItem, DispatchClass, DispatchInfo, DispatchInfoTo190, EcdsaSignature, Ed25519Signature, Extrinsic, ExtrinsicEra, ExtrinsicPayload, ExtrinsicPayloadUnknown, ExtrinsicPayloadV1, ExtrinsicPayloadV2, ExtrinsicPayloadV3, ExtrinsicPayloadV4, ExtrinsicSignatureV1, ExtrinsicSignatureV2, ExtrinsicSignatureV3, ExtrinsicSignatureV4, ExtrinsicUnknown, ExtrinsicV1, ExtrinsicV2, ExtrinsicV3, ExtrinsicV4, Hash, Header, ImmortalEra, Index, Justification, KeyTypeId, KeyValue, LockIdentifier, LookupSource, LookupTarget, Moment, MortalEra, MultiSignature, Origin, Perbill, Percent, Permill, Perquintill, Phantom, PhantomData, PreRuntime, Seal, SealV0, Signature, SignedBlock, SignerPayload, Sr25519Signature, ValidatorId, Weight, WeightMultiplier } from '@polkadot/types/interfaces/runtime';
|
||||
import { BitVec, Bytes, Data, Fixed64, IdentityFields, Null, StorageData, StorageKey, Text, Type, U256, Unconstructable, bool, i128, i16, i256, i32, i64, i8, u128, u16, u256, u32, u64, u8, usize } from '@polkadot/types/primitive';
|
||||
import { AccountId, AccountIdOf, AccountIndex, Address, AssetId, Balance, BalanceOf, Block, BlockNumber, Call, ChangesTrieConfiguration, Consensus, ConsensusEngineId, Digest, DigestItem, DispatchClass, DispatchInfo, DispatchInfoTo190, EcdsaSignature, Ed25519Signature, Extrinsic, ExtrinsicEra, ExtrinsicPayload, ExtrinsicPayloadUnknown, ExtrinsicPayloadV1, ExtrinsicPayloadV2, ExtrinsicPayloadV3, ExtrinsicPayloadV4, ExtrinsicSignatureV1, ExtrinsicSignatureV2, ExtrinsicSignatureV3, ExtrinsicSignatureV4, ExtrinsicUnknown, ExtrinsicV1, ExtrinsicV2, ExtrinsicV3, ExtrinsicV4, H160, H256, H512, Hash, Header, ImmortalEra, Index, Justification, KeyTypeId, KeyValue, LockIdentifier, LookupSource, LookupTarget, Moment, MortalEra, MultiSignature, Origin, Perbill, Percent, Permill, Perquintill, Phantom, PhantomData, PreRuntime, Seal, SealV0, Signature, SignedBlock, SignerPayload, Sr25519Signature, ValidatorId, Weight, WeightMultiplier } from '@polkadot/types/interfaces/runtime';
|
||||
import { InclusionHeight, Uncle, UncleEntryItem } from '@polkadot/types/interfaces/authorship';
|
||||
import { RawAuraPreDigest } from '@polkadot/types/interfaces/aura';
|
||||
import { BabeAuthorityWeight, BabeBlockWeight, BabeWeight, MaybeVrf, RawBabePreDigest, RawBabePreDigestCompat, RawBabePreDigestPrimary, RawBabePreDigestPrimaryTo159, RawBabePreDigestSecondary, RawBabePreDigestSecondaryTo159, RawBabePreDigestTo159, SlotNumber, VrfData, VrfProof } from '@polkadot/types/interfaces/babe';
|
||||
@@ -48,15 +48,6 @@ export interface InterfaceRegistry {
|
||||
Data: Data;
|
||||
'Option<Data>': Option<Data>;
|
||||
'Vec<Data>': Vec<Data>;
|
||||
H160: H160;
|
||||
'Option<H160>': Option<H160>;
|
||||
'Vec<H160>': Vec<H160>;
|
||||
H256: H256;
|
||||
'Option<H256>': Option<H256>;
|
||||
'Vec<H256>': Vec<H256>;
|
||||
H512: H512;
|
||||
'Option<H512>': Option<H512>;
|
||||
'Vec<H512>': Vec<H512>;
|
||||
IdentityFields: IdentityFields;
|
||||
'Option<IdentityFields>': Option<IdentityFields>;
|
||||
'Vec<IdentityFields>': Vec<IdentityFields>;
|
||||
@@ -241,6 +232,15 @@ export interface InterfaceRegistry {
|
||||
DispatchInfoTo190: DispatchInfoTo190;
|
||||
'Option<DispatchInfoTo190>': Option<DispatchInfoTo190>;
|
||||
'Vec<DispatchInfoTo190>': Vec<DispatchInfoTo190>;
|
||||
H160: H160;
|
||||
'Option<H160>': Option<H160>;
|
||||
'Vec<H160>': Vec<H160>;
|
||||
H256: H256;
|
||||
'Option<H256>': Option<H256>;
|
||||
'Vec<H256>': Vec<H256>;
|
||||
H512: H512;
|
||||
'Option<H512>': Option<H512>;
|
||||
'Vec<H512>': Vec<H512>;
|
||||
Hash: Hash;
|
||||
'Option<Hash>': Option<Hash>;
|
||||
'Vec<Hash>': Vec<Hash>;
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
|
||||
import { Struct, Vec } from '@polkadot/types/codec';
|
||||
import { H256 } from '@polkadot/types/primitive';
|
||||
import { AccountId, BlockNumber, Hash } from '@polkadot/types/interfaces/runtime';
|
||||
import { AccountId, BlockNumber, H256, Hash } from '@polkadot/types/interfaces/runtime';
|
||||
import { SessionIndex } from '@polkadot/types/interfaces/session';
|
||||
import { CandidateReceipt, ParaId } from '@polkadot/types/interfaces/parachains';
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
|
||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
|
||||
import { Codec } from '@polkadot/types/types';
|
||||
import { Enum, Option, Struct } from '@polkadot/types/codec';
|
||||
import { Enum, Option, Struct, U8aFixed } from '@polkadot/types/codec';
|
||||
import { u32, u64 } from '@polkadot/types/primitive';
|
||||
|
||||
/** @name BabeAuthorityWeight */
|
||||
@@ -78,7 +77,7 @@ export interface RawBabePreDigestTo159 extends Enum {
|
||||
export interface SlotNumber extends u64 {}
|
||||
|
||||
/** @name VrfData */
|
||||
export interface VrfData extends Uint8Array, Codec {}
|
||||
export interface VrfData extends U8aFixed {}
|
||||
|
||||
/** @name VrfProof */
|
||||
export interface VrfProof extends Uint8Array, Codec {}
|
||||
export interface VrfProof extends U8aFixed {}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
|
||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
|
||||
import { H160 } from '@polkadot/types/primitive';
|
||||
import { H160 } from '@polkadot/types/interfaces/runtime';
|
||||
|
||||
/** @name EthereumAddress */
|
||||
export interface EthereumAddress extends H160 {}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
|
||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
|
||||
import { Codec } from '@polkadot/types/types';
|
||||
import { Compact, Enum, Option, Raw, Struct } from '@polkadot/types/codec';
|
||||
import { Compact, Enum, Option, Raw, Struct, U8aFixed } from '@polkadot/types/codec';
|
||||
import { Bytes, Null, bool, u32, u64, u8 } from '@polkadot/types/primitive';
|
||||
import { AccountId, Balance, BlockNumber, Hash } from '@polkadot/types/interfaces/runtime';
|
||||
|
||||
@@ -50,7 +49,7 @@ export interface ContractInfo extends Enum {
|
||||
}
|
||||
|
||||
/** @name ContractStorageKey */
|
||||
export interface ContractStorageKey extends Uint8Array, Codec {}
|
||||
export interface ContractStorageKey extends U8aFixed {}
|
||||
|
||||
/** @name Gas */
|
||||
export interface Gas extends u64 {}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
|
||||
import { Struct, Vec } from '@polkadot/types/codec';
|
||||
import { Bytes, H160, H256, U256 } from '@polkadot/types/primitive';
|
||||
import { Bytes, U256 } from '@polkadot/types/primitive';
|
||||
import { H160, H256 } from '@polkadot/types/interfaces/runtime';
|
||||
|
||||
/** @name Account */
|
||||
export interface Account extends Struct {
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
import { ITuple } from '@polkadot/types/types';
|
||||
import { Enum, Option, Struct, Vec } from '@polkadot/types/codec';
|
||||
import { Data, H160, IdentityFields, u32 } from '@polkadot/types/primitive';
|
||||
import { AccountId, Balance } from '@polkadot/types/interfaces/runtime';
|
||||
import { Data, IdentityFields, u32 } from '@polkadot/types/primitive';
|
||||
import { AccountId, Balance, H160 } from '@polkadot/types/interfaces/runtime';
|
||||
|
||||
/** @name IdentityInfo */
|
||||
export interface IdentityInfo extends Struct {
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
|
||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
|
||||
import { Codec } from '@polkadot/types/types';
|
||||
import { Struct, Vec } from '@polkadot/types/codec';
|
||||
import { Struct, U8aFixed, Vec } from '@polkadot/types/codec';
|
||||
import { Bytes } from '@polkadot/types/primitive';
|
||||
import { AccountId, Hash } from '@polkadot/types/interfaces/runtime';
|
||||
import { IdentificationTuple } from '@polkadot/types/interfaces/session';
|
||||
|
||||
/** @name Kind */
|
||||
export interface Kind extends Uint8Array, Codec {}
|
||||
export interface Kind extends U8aFixed {}
|
||||
|
||||
/** @name OffenceDetails */
|
||||
export interface OffenceDetails extends Struct {
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
import { ITuple } from '@polkadot/types/types';
|
||||
import { Enum, Struct, Vec } from '@polkadot/types/codec';
|
||||
import { BitVec, Bytes, H256, u32 } from '@polkadot/types/primitive';
|
||||
import { AccountId, Balance, BalanceOf, BlockNumber, Hash, Signature } from '@polkadot/types/interfaces/runtime';
|
||||
import { BitVec, Bytes, u32 } from '@polkadot/types/primitive';
|
||||
import { AccountId, Balance, BalanceOf, BlockNumber, H256, Hash, Signature } from '@polkadot/types/interfaces/runtime';
|
||||
|
||||
/** @name AttestedCandidate */
|
||||
export interface AttestedCandidate extends Struct {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
|
||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
|
||||
import { Codec, ITuple } from '@polkadot/types/types';
|
||||
import { Enum, Option, Struct, Vec } from '@polkadot/types/codec';
|
||||
import { ITuple } from '@polkadot/types/types';
|
||||
import { Enum, Option, Struct, U8aFixed, Vec } from '@polkadot/types/codec';
|
||||
import { Bytes, StorageData, StorageKey, Text, bool, u32, u64, u8 } from '@polkadot/types/primitive';
|
||||
import { Balance, BlockNumber, DispatchClass, Hash, Weight } from '@polkadot/types/interfaces/runtime';
|
||||
|
||||
/** @name ApiId */
|
||||
export interface ApiId extends Uint8Array, Codec {}
|
||||
export interface ApiId extends U8aFixed {}
|
||||
|
||||
/** @name BlockHash */
|
||||
export interface BlockHash extends Hash {}
|
||||
|
||||
@@ -65,6 +65,9 @@ export default {
|
||||
weight: 'Weight',
|
||||
class: 'DispatchClass'
|
||||
},
|
||||
H160: '[u8; 20; H160]',
|
||||
H256: '[u8; 32; H256]',
|
||||
H512: '[u8; 64; H512]',
|
||||
Hash: 'H256',
|
||||
Header: {
|
||||
parentHash: 'Hash',
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
|
||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
|
||||
import { Codec, ITuple } from '@polkadot/types/types';
|
||||
import { Compact, Enum, Struct, Vec } from '@polkadot/types/codec';
|
||||
import { Bytes, Fixed64, GenericAccountId, GenericAccountIndex, GenericAddress, GenericBlock, GenericCall, GenericConsensusEngineId, GenericDigest, GenericExtrinsic, GenericExtrinsicEra, GenericExtrinsicPayload, GenericExtrinsicPayloadUnknown, GenericExtrinsicPayloadV1, GenericExtrinsicPayloadV2, GenericExtrinsicPayloadV3, GenericExtrinsicPayloadV4, GenericExtrinsicSignatureV1, GenericExtrinsicSignatureV2, GenericExtrinsicSignatureV3, GenericExtrinsicSignatureV4, GenericExtrinsicUnknown, GenericExtrinsicV1, GenericExtrinsicV2, GenericExtrinsicV3, GenericExtrinsicV4, GenericImmortalEra, GenericMortalEra, GenericOrigin, GenericSignerPayload, H256, H512, Null, StorageData, StorageKey, bool, u128, u32, u64, u8 } from '@polkadot/types/primitive';
|
||||
import { ITuple } from '@polkadot/types/types';
|
||||
import { Compact, Enum, Struct, U8aFixed, Vec } from '@polkadot/types/codec';
|
||||
import { Bytes, Fixed64, GenericAccountId, GenericAccountIndex, GenericAddress, GenericBlock, GenericCall, GenericConsensusEngineId, GenericDigest, GenericExtrinsic, GenericExtrinsicEra, GenericExtrinsicPayload, GenericExtrinsicPayloadUnknown, GenericExtrinsicPayloadV1, GenericExtrinsicPayloadV2, GenericExtrinsicPayloadV3, GenericExtrinsicPayloadV4, GenericExtrinsicSignatureV1, GenericExtrinsicSignatureV2, GenericExtrinsicSignatureV3, GenericExtrinsicSignatureV4, GenericExtrinsicUnknown, GenericExtrinsicV1, GenericExtrinsicV2, GenericExtrinsicV3, GenericExtrinsicV4, GenericImmortalEra, GenericMortalEra, GenericOrigin, GenericSignerPayload, Null, StorageData, StorageKey, bool, u128, u32, u64, u8 } from '@polkadot/types/primitive';
|
||||
import { AuthorityId } from '@polkadot/types/interfaces/consensus';
|
||||
|
||||
/** @name AccountId */
|
||||
@@ -89,7 +89,7 @@ export interface DispatchInfoTo190 extends Struct {
|
||||
}
|
||||
|
||||
/** @name EcdsaSignature */
|
||||
export interface EcdsaSignature extends Uint8Array, Codec {}
|
||||
export interface EcdsaSignature extends U8aFixed {}
|
||||
|
||||
/** @name Ed25519Signature */
|
||||
export interface Ed25519Signature extends Signature {}
|
||||
@@ -145,6 +145,15 @@ export interface ExtrinsicV3 extends GenericExtrinsicV3 {}
|
||||
/** @name ExtrinsicV4 */
|
||||
export interface ExtrinsicV4 extends GenericExtrinsicV4 {}
|
||||
|
||||
/** @name H160 */
|
||||
export interface H160 extends U8aFixed {}
|
||||
|
||||
/** @name H256 */
|
||||
export interface H256 extends U8aFixed {}
|
||||
|
||||
/** @name H512 */
|
||||
export interface H512 extends U8aFixed {}
|
||||
|
||||
/** @name Hash */
|
||||
export interface Hash extends H256 {}
|
||||
|
||||
@@ -173,7 +182,7 @@ export interface KeyTypeId extends u32 {}
|
||||
export interface KeyValue extends ITuple<[StorageKey, StorageData]> {}
|
||||
|
||||
/** @name LockIdentifier */
|
||||
export interface LockIdentifier extends Uint8Array, Codec {}
|
||||
export interface LockIdentifier extends U8aFixed {}
|
||||
|
||||
/** @name LookupSource */
|
||||
export interface LookupSource extends Address {}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
|
||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
|
||||
import { Codec, ITuple } from '@polkadot/types/types';
|
||||
import { Enum, Option, Result, Struct, Vec } from '@polkadot/types/codec';
|
||||
import { ITuple } from '@polkadot/types/types';
|
||||
import { Enum, Option, Result, Struct, U8aFixed, Vec } from '@polkadot/types/codec';
|
||||
import { Bytes, GenericEvent, Text, u32, u8 } from '@polkadot/types/primitive';
|
||||
import { Digest, Hash } from '@polkadot/types/interfaces/runtime';
|
||||
|
||||
@@ -53,7 +53,7 @@ export interface DispatchResultTo198 extends Result<ITuple<[]>, Text> {
|
||||
export interface Event extends GenericEvent {}
|
||||
|
||||
/** @name EventId */
|
||||
export interface EventId extends Uint8Array, Codec {}
|
||||
export interface EventId extends U8aFixed {}
|
||||
|
||||
/** @name EventIndex */
|
||||
export interface EventIndex extends u32 {}
|
||||
|
||||
@@ -2,7 +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 { Codec, IHash, Registry } from '../types';
|
||||
import { H256 } from '../interfaces/runtime';
|
||||
import { Codec, Registry } from '../types';
|
||||
|
||||
import { isU8a, u8aToHex } from '@polkadot/util';
|
||||
import { blake2AsU8a } from '@polkadot/util-crypto';
|
||||
@@ -46,8 +47,8 @@ export default class Bool extends Boolean implements Codec {
|
||||
/**
|
||||
* @description returns a hash of the contents
|
||||
*/
|
||||
public get hash (): IHash {
|
||||
return createType(this.registry, 'Hash', blake2AsU8a(this.toU8a(), 256));
|
||||
public get hash (): H256 {
|
||||
return createType(this.registry, 'H256', blake2AsU8a(this.toU8a(), 256));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,6 +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 { H256 } from '../interfaces/runtime';
|
||||
import { Registry } from '../types';
|
||||
|
||||
import { isString, isU8a, u8aToU8a } from '@polkadot/util';
|
||||
@@ -9,7 +10,6 @@ import { isString, isU8a, u8aToU8a } from '@polkadot/util';
|
||||
import Enum from '../codec/Enum';
|
||||
import { createType } from '../create/createType';
|
||||
import Bytes from './Bytes';
|
||||
import H256 from './H256';
|
||||
|
||||
/** @internal */
|
||||
function decodeDataU8a (registry: Registry, value: Uint8Array): [any, number | undefined] {
|
||||
|
||||
@@ -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 { Digest, DigestItem, Hash, Header } from '../../interfaces/runtime';
|
||||
import { Digest, DigestItem, H256, Header } from '../../interfaces/runtime';
|
||||
import { AnyNumber, AnyU8a, Registry } from '../../types';
|
||||
|
||||
import { blake2AsU8a } from '@polkadot/util-crypto';
|
||||
@@ -41,8 +41,8 @@ export default class Block extends Struct {
|
||||
/**
|
||||
* @description Encodes a content [[Hash]] for the block
|
||||
*/
|
||||
public get contentHash (): Hash {
|
||||
return createType(this.registry, 'Hash', blake2AsU8a(this.toU8a(), 256));
|
||||
public get contentHash (): H256 {
|
||||
return createType(this.registry, 'H256', blake2AsU8a(this.toU8a(), 256));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -55,7 +55,7 @@ export default class Block extends Struct {
|
||||
/**
|
||||
* @description Block/header [[Hash]]
|
||||
*/
|
||||
public get hash (): Hash {
|
||||
public get hash (): H256 {
|
||||
return this.header.hash;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
// Copyright 2017-2020 @polkadot/types authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import U8aFixed from '../codec/U8aFixed';
|
||||
|
||||
/**
|
||||
* @name H160
|
||||
* @description
|
||||
* Hash containing 160 bits (20 bytes), typically used in blocks, extrinsics and
|
||||
* as a sane default for fixed-length hash representations.
|
||||
*/
|
||||
export default class H160 extends U8aFixed.with(160, 'H160') {}
|
||||
@@ -1,15 +0,0 @@
|
||||
// Copyright 2017-2020 @polkadot/types authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { IHash } from '../types';
|
||||
|
||||
import U8aFixed from '../codec/U8aFixed';
|
||||
|
||||
/**
|
||||
* @name H256
|
||||
* @description
|
||||
* 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.with(256, 'H256') implements IHash {}
|
||||
@@ -1,12 +0,0 @@
|
||||
// Copyright 2017-2020 @polkadot/types authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import U8aFixed from '../codec/U8aFixed';
|
||||
|
||||
/**
|
||||
* @name H512
|
||||
* @description
|
||||
* Hash containing 512 bits (64 bytes), typically used for signatures
|
||||
*/
|
||||
export default class H512 extends U8aFixed.with(512, 'H512') {}
|
||||
@@ -2,7 +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 { Codec, IHash, Registry } from '../types';
|
||||
import { H256 } from '../interfaces/runtime';
|
||||
import { Codec, Registry } from '../types';
|
||||
|
||||
import { isNull } from '@polkadot/util';
|
||||
|
||||
@@ -28,7 +29,7 @@ export default class Null implements Codec {
|
||||
/**
|
||||
* @description returns a hash of the contents
|
||||
*/
|
||||
public get hash (): IHash {
|
||||
public get hash (): H256 {
|
||||
throw new Error('.hash is not implemented on Null');
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +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 { AnyU8a, Codec, IHash, Registry } from '../types';
|
||||
import { H256 } from '../interfaces/runtime';
|
||||
import { AnyU8a, Codec, Registry } from '../types';
|
||||
|
||||
import { assert, hexToU8a, isHex, isString, stringToU8a, u8aToString, u8aToHex } from '@polkadot/util';
|
||||
import { blake2AsU8a } from '@polkadot/util-crypto';
|
||||
@@ -67,8 +68,8 @@ export default class Text extends String implements Codec {
|
||||
/**
|
||||
* @description returns a hash of the contents
|
||||
*/
|
||||
public get hash (): IHash {
|
||||
return createType(this.registry, 'Hash', blake2AsU8a(this.toU8a(), 256));
|
||||
public get hash (): H256 {
|
||||
return createType(this.registry, 'H256', blake2AsU8a(this.toU8a(), 256));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -12,9 +12,6 @@ export { default as bool } from './Bool';
|
||||
export { default as BitVec } from './BitVec';
|
||||
export { default as Bytes } from './Bytes';
|
||||
export { default as Data } from './Data';
|
||||
export { default as H160 } from './H160';
|
||||
export { default as H256 } from './H256';
|
||||
export { default as H512 } from './H512';
|
||||
export { default as IdentityFields } from './IdentityFields';
|
||||
export { default as i8 } from './I8';
|
||||
export { default as i16 } from './I16';
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
/* eslint-disable @typescript-eslint/interface-name-prefix */
|
||||
|
||||
import { H256 } from '../interfaces/runtime';
|
||||
import { AnyJson, BareOpts } from './helpers';
|
||||
import { IHash } from './interfaces';
|
||||
import { Registry } from './registry';
|
||||
|
||||
import BN from 'bn.js';
|
||||
@@ -45,7 +45,7 @@ export interface Codec {
|
||||
/**
|
||||
* @description Returns a hash of the value
|
||||
*/
|
||||
readonly hash: IHash;
|
||||
readonly hash: H256;
|
||||
|
||||
/**
|
||||
* @description Checks if the value is an empty value
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { ExtrinsicStatus } from '../interfaces/rpc';
|
||||
import { Address, Balance, Call, EcdsaSignature, Ed25519Signature, Index, Sr25519Signature } from '../interfaces/runtime';
|
||||
import { Address, Balance, Call, EcdsaSignature, Ed25519Signature, H256, Index, Sr25519Signature } from '../interfaces/runtime';
|
||||
import { EventRecord } from '../interfaces/system';
|
||||
import { Codec } from './codec';
|
||||
import { AnyJson, AnyNumber, AnyU8a } from './helpers';
|
||||
import { ICompact, IHash, IKeyringPair, IMethod, IRuntimeVersion } from './interfaces';
|
||||
import { ICompact, IKeyringPair, IMethod, IRuntimeVersion } from './interfaces';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/interface-name-prefix
|
||||
export interface ISubmittableResult {
|
||||
@@ -49,7 +49,7 @@ export interface Signer {
|
||||
/**
|
||||
* @description Receives an update for the extrinsic signed by a `signer.sign`
|
||||
*/
|
||||
update?: (id: number, status: IHash | ISubmittableResult) => void;
|
||||
update?: (id: number, status: H256 | ISubmittableResult) => void;
|
||||
}
|
||||
|
||||
export interface SignatureOptions {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
/* eslint-disable @typescript-eslint/interface-name-prefix */
|
||||
|
||||
import { SignOptions } from '@polkadot/keyring/types';
|
||||
import { Hash } from '../interfaces/runtime';
|
||||
import { FunctionMetadataLatest } from '../interfaces/metadata';
|
||||
|
||||
import BN from 'bn.js';
|
||||
@@ -16,9 +17,6 @@ export interface ICompact<T> extends Codec {
|
||||
unwrap (): T;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface IHash extends IU8a { }
|
||||
|
||||
export interface IKeyringPair {
|
||||
address: string;
|
||||
publicKey: Uint8Array;
|
||||
@@ -31,7 +29,7 @@ export interface IMethod extends Codec {
|
||||
readonly argsDef: ArgsDef;
|
||||
readonly callIndex: Uint8Array;
|
||||
readonly data: Uint8Array;
|
||||
readonly hash: IHash;
|
||||
readonly hash: Hash;
|
||||
readonly hasOrigin: boolean;
|
||||
readonly meta: FunctionMetadataLatest;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user