Bump dev (#2576)
* Bump dev * type linting * linting * linting * missed
This commit is contained in:
@@ -102,8 +102,6 @@ function decodeStruct <T> (registry: Registry, Types: ConstructorDef, value: unk
|
||||
export default class Struct<
|
||||
// The actual Class structure, i.e. key -> Class
|
||||
S extends TypesDef = TypesDef,
|
||||
// internal type, instance of classes mapped by key
|
||||
T extends { [K in keyof S]: Codec } = { [K in keyof S]: Codec },
|
||||
// input values, mapped by key can be anything (construction)
|
||||
V extends { [K in keyof S]: any } = { [K in keyof S]: any },
|
||||
// type names, mapped by key, name of Class in S
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
// 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.
|
||||
/* eslint-disable @typescript-eslint/no-use-before-define */
|
||||
|
||||
type Mapper = (value: string, options?: SanitizeOptions) => string;
|
||||
|
||||
interface SanitizeOptions {
|
||||
allowNamespaces?: boolean;
|
||||
}
|
||||
|
||||
type Mapper = (value: string, options?: SanitizeOptions) => string;
|
||||
|
||||
const ALLOWED_BOXES = ['BTreeMap', 'BTreeSet', 'Compact', 'DoNotConstruct', 'HashMap', 'Int', 'Linkage', 'Result', 'Option', 'UInt', 'Vec'];
|
||||
const BOX_PRECEDING = ['<', '(', '[', '"', ',', ' ']; // start of vec, tuple, fixed array, part of struct def or in tuple
|
||||
|
||||
|
||||
@@ -108,6 +108,11 @@ export interface MetaTypeDefEnumVariantTupleStruct {
|
||||
'tuple_struct_variant.types': TypeIndex[];
|
||||
}
|
||||
|
||||
export interface MetaTypeDefStructField {
|
||||
name: StringIndex;
|
||||
type: TypeIndex;
|
||||
}
|
||||
|
||||
export interface MetaTypeDefEnumVariantStruct {
|
||||
'struct_variant.name': StringIndex;
|
||||
'struct_variant.fields': MetaTypeDefStructField[];
|
||||
@@ -119,11 +124,6 @@ export interface MetaTypeDefEnum {
|
||||
'enum.variants': MetaTypeDefEnumVariant[];
|
||||
}
|
||||
|
||||
export interface MetaTypeDefStructField {
|
||||
name: StringIndex;
|
||||
type: TypeIndex;
|
||||
}
|
||||
|
||||
export type MetaTypeDefUnionField = MetaTypeDefStructField;
|
||||
|
||||
export interface MetaTypeDefStruct {
|
||||
|
||||
@@ -12,6 +12,7 @@ import Base from '../codec/Base';
|
||||
import AccountIndex from '../generic/AccountIndex';
|
||||
import EthereumAccountId from './AccountId';
|
||||
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
type AnyAddress = BN | LookupSource | EthereumAccountId | AccountIndex | number[] | Uint8Array | number | string;
|
||||
|
||||
export const ACCOUNT_ID_PREFIX = new Uint8Array([0xff]);
|
||||
|
||||
@@ -13,6 +13,7 @@ import U8aFixed from '../codec/U8aFixed';
|
||||
|
||||
interface DecodeMethodInput {
|
||||
args: unknown;
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
callIndex: CallIndex | Uint8Array;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import Base from '../codec/Base';
|
||||
import AccountId from './AccountId';
|
||||
import AccountIndex from './AccountIndex';
|
||||
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
type AnyAddress = BN | LookupSource | AccountId | AccountIndex | number[] | Uint8Array | number | string;
|
||||
|
||||
export const ACCOUNT_ID_PREFIX = new Uint8Array([0xff]);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
// 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.
|
||||
|
||||
@@ -8,23 +8,8 @@ import { Registry } from './registry';
|
||||
|
||||
import BN from 'bn.js';
|
||||
|
||||
export type ArgsDef = Record<string, Constructor>;
|
||||
|
||||
// We cannot inline this into CodecArg, TS thrws up when building docs
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
interface CodecArgArray extends Array<CodecArg> {}
|
||||
|
||||
export type CodecArg = Codec | BN | boolean | string | Uint8Array | boolean | number | string | undefined | CodecArgArray | { [index: string]: CodecArg };
|
||||
|
||||
export type CodecTo = 'toHex' | 'toJSON' | 'toString' | 'toU8a';
|
||||
|
||||
export interface Constructor<T = Codec> {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
new(registry: Registry, ...value: any[]): T;
|
||||
}
|
||||
|
||||
export type ConstructorDef<T = Codec> = Record<string, Constructor<T>>;
|
||||
|
||||
/**
|
||||
* @name Codec
|
||||
* @description
|
||||
@@ -89,3 +74,19 @@ export interface Codec {
|
||||
*/
|
||||
toU8a (isBare?: BareOpts): Uint8Array;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
export type CodecArg = Codec | BN | boolean | string | Uint8Array | boolean | number | string | undefined | CodecArgArray | { [index: string]: CodecArg };
|
||||
|
||||
// We cannot inline this into CodecArg, TS throws up when building docs
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
interface CodecArgArray extends Array<CodecArg> {}
|
||||
|
||||
export interface Constructor<T = Codec> {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
new(registry: Registry, ...value: any[]): T;
|
||||
}
|
||||
|
||||
export type ConstructorDef<T = Codec> = Record<string, Constructor<T>>;
|
||||
|
||||
export type ArgsDef = Record<string, Constructor>;
|
||||
|
||||
@@ -24,96 +24,6 @@ export interface ISubmittableResult {
|
||||
toHuman (isExtended?: boolean): AnyJson;
|
||||
}
|
||||
|
||||
export interface SignerResult {
|
||||
/**
|
||||
* @description The id for this request
|
||||
*/
|
||||
id: number;
|
||||
|
||||
/**
|
||||
* @description The resulting signature in hex
|
||||
*/
|
||||
signature: string;
|
||||
}
|
||||
|
||||
export interface Signer {
|
||||
/**
|
||||
* @description signs an extrinsic payload from a serialized form
|
||||
*/
|
||||
signPayload?: (payload: SignerPayloadJSON) => Promise<SignerResult>;
|
||||
|
||||
/**
|
||||
* @description signs a raw payload, only the bytes data as supplied
|
||||
*/
|
||||
signRaw?: (raw: SignerPayloadRaw) => Promise<SignerResult>;
|
||||
|
||||
/**
|
||||
* @description Receives an update for the extrinsic signed by a `signer.sign`
|
||||
*/
|
||||
update?: (id: number, status: H256 | ISubmittableResult) => void;
|
||||
}
|
||||
|
||||
export interface SignatureOptions {
|
||||
blockHash: AnyU8a;
|
||||
era?: IExtrinsicEra;
|
||||
genesisHash: AnyU8a;
|
||||
nonce: AnyNumber;
|
||||
runtimeVersion: IRuntimeVersion;
|
||||
signedExtensions?: string[];
|
||||
signer?: Signer;
|
||||
tip?: AnyNumber;
|
||||
}
|
||||
|
||||
interface ExtrinsicSignatureBase {
|
||||
readonly isSigned: boolean;
|
||||
readonly era: IExtrinsicEra;
|
||||
readonly nonce: ICompact<Index>;
|
||||
readonly signature: EcdsaSignature | Ed25519Signature | Sr25519Signature;
|
||||
readonly signer: Address;
|
||||
readonly tip: ICompact<Balance>;
|
||||
}
|
||||
|
||||
export interface ExtrinsicPayloadValue {
|
||||
blockHash: AnyU8a;
|
||||
era: AnyU8a | IExtrinsicEra;
|
||||
genesisHash: AnyU8a;
|
||||
method: AnyU8a | IMethod;
|
||||
nonce: AnyNumber;
|
||||
specVersion: AnyNumber;
|
||||
tip: AnyNumber;
|
||||
transactionVersion: AnyNumber;
|
||||
}
|
||||
|
||||
export interface IExtrinsicSignature extends ExtrinsicSignatureBase, Codec {
|
||||
addSignature (signer: Address | Uint8Array | string, signature: Uint8Array | string, payload: Uint8Array | string): IExtrinsicSignature;
|
||||
sign (method: Call, account: IKeyringPair, options: SignatureOptions): IExtrinsicSignature;
|
||||
signFake (method: Call, address: Address | Uint8Array | string, options: SignatureOptions): IExtrinsicSignature;
|
||||
}
|
||||
|
||||
export interface IExtrinsicEra extends Codec {
|
||||
asImmortalEra: Codec;
|
||||
asMortalEra: Codec;
|
||||
}
|
||||
|
||||
interface IExtrinsicSignable<T> {
|
||||
addSignature (signer: Address | Uint8Array | string, signature: Uint8Array | string, payload: ExtrinsicPayloadValue | Uint8Array | string): T;
|
||||
sign (account: IKeyringPair, options: SignatureOptions): T;
|
||||
signFake (address: Address | Uint8Array | string, options: SignatureOptions): T;
|
||||
}
|
||||
|
||||
export interface IExtrinsicImpl extends IExtrinsicSignable<IExtrinsicImpl>, Codec {
|
||||
readonly method: Call;
|
||||
readonly signature: IExtrinsicSignature;
|
||||
readonly version: number;
|
||||
}
|
||||
|
||||
export interface IExtrinsic extends IExtrinsicSignable<IExtrinsic>, ExtrinsicSignatureBase, IMethod {
|
||||
readonly length: number;
|
||||
readonly method: Call;
|
||||
readonly type: number;
|
||||
readonly version: number;
|
||||
}
|
||||
|
||||
export interface SignerPayloadJSON {
|
||||
/**
|
||||
* @description The ss-58 encoded address
|
||||
@@ -204,3 +114,93 @@ export interface ISignerPayload {
|
||||
toPayload (): SignerPayloadJSON;
|
||||
toRaw (): SignerPayloadRaw;
|
||||
}
|
||||
|
||||
export interface SignerResult {
|
||||
/**
|
||||
* @description The id for this request
|
||||
*/
|
||||
id: number;
|
||||
|
||||
/**
|
||||
* @description The resulting signature in hex
|
||||
*/
|
||||
signature: string;
|
||||
}
|
||||
|
||||
export interface Signer {
|
||||
/**
|
||||
* @description signs an extrinsic payload from a serialized form
|
||||
*/
|
||||
signPayload?: (payload: SignerPayloadJSON) => Promise<SignerResult>;
|
||||
|
||||
/**
|
||||
* @description signs a raw payload, only the bytes data as supplied
|
||||
*/
|
||||
signRaw?: (raw: SignerPayloadRaw) => Promise<SignerResult>;
|
||||
|
||||
/**
|
||||
* @description Receives an update for the extrinsic signed by a `signer.sign`
|
||||
*/
|
||||
update?: (id: number, status: H256 | ISubmittableResult) => void;
|
||||
}
|
||||
|
||||
export interface IExtrinsicEra extends Codec {
|
||||
asImmortalEra: Codec;
|
||||
asMortalEra: Codec;
|
||||
}
|
||||
|
||||
export interface SignatureOptions {
|
||||
blockHash: AnyU8a;
|
||||
era?: IExtrinsicEra;
|
||||
genesisHash: AnyU8a;
|
||||
nonce: AnyNumber;
|
||||
runtimeVersion: IRuntimeVersion;
|
||||
signedExtensions?: string[];
|
||||
signer?: Signer;
|
||||
tip?: AnyNumber;
|
||||
}
|
||||
|
||||
interface ExtrinsicSignatureBase {
|
||||
readonly isSigned: boolean;
|
||||
readonly era: IExtrinsicEra;
|
||||
readonly nonce: ICompact<Index>;
|
||||
readonly signature: EcdsaSignature | Ed25519Signature | Sr25519Signature;
|
||||
readonly signer: Address;
|
||||
readonly tip: ICompact<Balance>;
|
||||
}
|
||||
|
||||
export interface ExtrinsicPayloadValue {
|
||||
blockHash: AnyU8a;
|
||||
era: AnyU8a | IExtrinsicEra;
|
||||
genesisHash: AnyU8a;
|
||||
method: AnyU8a | IMethod;
|
||||
nonce: AnyNumber;
|
||||
specVersion: AnyNumber;
|
||||
tip: AnyNumber;
|
||||
transactionVersion: AnyNumber;
|
||||
}
|
||||
|
||||
export interface IExtrinsicSignature extends ExtrinsicSignatureBase, Codec {
|
||||
addSignature (signer: Address | Uint8Array | string, signature: Uint8Array | string, payload: Uint8Array | string): IExtrinsicSignature;
|
||||
sign (method: Call, account: IKeyringPair, options: SignatureOptions): IExtrinsicSignature;
|
||||
signFake (method: Call, address: Address | Uint8Array | string, options: SignatureOptions): IExtrinsicSignature;
|
||||
}
|
||||
|
||||
interface IExtrinsicSignable<T> {
|
||||
addSignature (signer: Address | Uint8Array | string, signature: Uint8Array | string, payload: ExtrinsicPayloadValue | Uint8Array | string): T;
|
||||
sign (account: IKeyringPair, options: SignatureOptions): T;
|
||||
signFake (address: Address | Uint8Array | string, options: SignatureOptions): T;
|
||||
}
|
||||
|
||||
export interface IExtrinsicImpl extends IExtrinsicSignable<IExtrinsicImpl>, Codec {
|
||||
readonly method: Call;
|
||||
readonly signature: IExtrinsicSignature;
|
||||
readonly version: number;
|
||||
}
|
||||
|
||||
export interface IExtrinsic extends IExtrinsicSignable<IExtrinsic>, ExtrinsicSignatureBase, IMethod {
|
||||
readonly length: number;
|
||||
readonly method: Call;
|
||||
readonly type: number;
|
||||
readonly version: number;
|
||||
}
|
||||
|
||||
@@ -10,11 +10,12 @@ import BN from 'bn.js';
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export type AnyFunction = (...args: any[]) => any;
|
||||
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
export type AnyJson = string | number | boolean | null | undefined | AnyJsonArray | { [index: string]: AnyJson };
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
interface AnyJsonArray extends Array<AnyJson> {}
|
||||
|
||||
export type AnyJson = string | number | boolean | null | undefined | AnyJsonArray | { [index: string]: AnyJson };
|
||||
|
||||
export type AnyNumber = BN | BigInt | Uint8Array | number | string;
|
||||
|
||||
export type AnyString = string | string;
|
||||
|
||||
@@ -13,11 +13,6 @@ import { AnyJson } from './helpers';
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface InterfaceTypes { }
|
||||
|
||||
export interface OverrideVersionedType {
|
||||
minmax: [number?, number?]; // min (v >= min) and max (v <= max)
|
||||
types: RegistryTypes;
|
||||
}
|
||||
|
||||
export interface ChainUpgradeVersion {
|
||||
blockNumber: BN;
|
||||
specVersion: BN;
|
||||
@@ -28,19 +23,6 @@ export interface ChainUpgrades {
|
||||
versions: ChainUpgradeVersion[];
|
||||
}
|
||||
|
||||
export type OverrideModuleType = Record<string, string>;
|
||||
|
||||
export interface OverrideBundleDefinition {
|
||||
alias?: Record<string, OverrideModuleType>;
|
||||
rpc?: Record<string, Record<string, DefinitionRpc | DefinitionRpcSub>>;
|
||||
types?: OverrideVersionedType[];
|
||||
}
|
||||
|
||||
export interface OverrideBundleType {
|
||||
chain?: Record<string, OverrideBundleDefinition>;
|
||||
spec?: Record<string, OverrideBundleDefinition>;
|
||||
}
|
||||
|
||||
export type RegistryTypes = Record<string, Constructor | string | Record<string, string> | { _enum: string[] | Record<string, string | null> } | { _set: Record<string, number> }>;
|
||||
|
||||
export interface RegistryMetadataText extends String, Codec {
|
||||
@@ -109,6 +91,24 @@ export interface RegistryMetadata {
|
||||
asLatest: RegistryMetadataLatest;
|
||||
}
|
||||
|
||||
export interface OverrideVersionedType {
|
||||
minmax: [number?, number?]; // min (v >= min) and max (v <= max)
|
||||
types: RegistryTypes;
|
||||
}
|
||||
|
||||
export type OverrideModuleType = Record<string, string>;
|
||||
|
||||
export interface OverrideBundleDefinition {
|
||||
alias?: Record<string, OverrideModuleType>;
|
||||
rpc?: Record<string, Record<string, DefinitionRpc | DefinitionRpcSub>>;
|
||||
types?: OverrideVersionedType[];
|
||||
}
|
||||
|
||||
export interface OverrideBundleType {
|
||||
chain?: Record<string, OverrideBundleDefinition>;
|
||||
spec?: Record<string, OverrideBundleDefinition>;
|
||||
}
|
||||
|
||||
export interface RegisteredTypes {
|
||||
/**
|
||||
* @description Additional types used by runtime modules. This is necessary if the runtime modules
|
||||
|
||||
Reference in New Issue
Block a user