Method -> Call, expose findMethod on api (#1222)

* Rename Method -> Call (interface, align with Rust)

* Export Call types from types, expose findCall
This commit is contained in:
Jaco Greeff
2019-07-29 09:04:37 +02:00
committed by GitHub
parent a06db4cfb9
commit fe35527a65
37 changed files with 164 additions and 161 deletions
@@ -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 { Method } from '@polkadot/types/interfaces';
import { Call } from '@polkadot/types/interfaces';
import { CallFunction } from '@polkadot/types/types';
import { FunctionMetadata } from '@polkadot/types/Metadata/v7/Calls';
import { MethodFunction } from '@polkadot/types/primitive/Generic/Method';
import { createType } from '@polkadot/types';
import { assert, stringCamelCase } from '@polkadot/util';
/**
* From the metadata of a function in the module's storage, generate the function
* that will return the an [[MethodFunction]].
* that will return the an [[CallFunction]].
*
* @param section - Name of the module section.
* @param sectionIndex - Index of the module section in the modules array.
@@ -23,17 +23,17 @@ export default function createDescriptor (
sectionIndex: number,
methodIndex: number,
callMetadata: FunctionMetadata
): MethodFunction {
): CallFunction {
const callIndex = new Uint8Array([sectionIndex, methodIndex]);
const expectedArgs = callMetadata.args;
const funcName = stringCamelCase(callMetadata.name.toString());
const extrinsicFn = (...args: any[]): Method => {
const extrinsicFn = (...args: any[]): Call => {
assert(
expectedArgs.length.valueOf() === args.length,
`Extrinsic ${section}.${funcName} expects ${expectedArgs.length.valueOf()} arguments, got ${args.length}.`
);
return createType('Method', {
return createType('Call', {
args,
callIndex
}, callMetadata);
@@ -46,5 +46,5 @@ export default function createDescriptor (
extrinsicFn.toJSON = (): any =>
callMetadata.toJSON();
return extrinsicFn as MethodFunction;
return extrinsicFn as CallFunction;
}
@@ -2,8 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { Calls, ModulesWithCalls } from '@polkadot/types/types';
import { ModuleMetadata } from '@polkadot/types/Metadata/v7/Metadata';
import { Methods, ModulesWithMethods } from '@polkadot/types/primitive/Generic/Method';
import Metadata from '@polkadot/types/Metadata';
import { stringCamelCase } from '@polkadot/util';
@@ -15,19 +16,19 @@ import createUnchecked from './createUnchecked';
*
* @param metadata - The metadata
*/
export default function fromMetadata (metadata: Metadata): ModulesWithMethods {
export default function fromMetadata (metadata: Metadata): ModulesWithCalls {
return metadata.asV7.modules
.filter((modul): boolean => modul.calls.isSome)
.reduce((result, modul: ModuleMetadata, sectionIndex): ModulesWithMethods => {
.reduce((result, modul: ModuleMetadata, sectionIndex): ModulesWithCalls => {
const section = stringCamelCase(modul.name.toString());
result[section] = modul.calls.unwrap().reduce((newModule, callMetadata, methodIndex): Methods => {
result[section] = modul.calls.unwrap().reduce((newModule, callMetadata, methodIndex): Calls => {
const method = stringCamelCase(callMetadata.name.toString());
newModule[method] = createUnchecked(section, sectionIndex, methodIndex, callMetadata);
return newModule;
}, {} as unknown as Methods);
}, {} as unknown as Calls);
return result;
}, { ...extrinsics });
@@ -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 { ModulesWithMethods } from '@polkadot/types/primitive/Generic/Method';
import { ModulesWithCalls } from '@polkadot/types/types';
const extrinsics: ModulesWithMethods = {};
const extrinsics: ModulesWithCalls = {};
export default extrinsics;
@@ -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 { ModulesWithCalls } from '@polkadot/types/types';
import { Metadata } from '@polkadot/types';
import metadataRpc from '@polkadot/types/Metadata/static';
import { ModulesWithMethods } from '@polkadot/types/primitive/Generic/Method';
import fromMetadata from './fromMetadata';
const staticMetadata: ModulesWithMethods = fromMetadata(
const staticMetadata: ModulesWithCalls = fromMetadata(
new Metadata(metadataRpc)
);
export default staticMetadata;
+13 -7
View File
@@ -4,7 +4,7 @@
import { ProviderInterface } from '@polkadot/rpc-provider/types';
import { Hash, RuntimeVersion, SignedBlock } from '@polkadot/types/interfaces';
import { AnyFunction, Codec, CodecArg, RegistryTypes } from '@polkadot/types/types';
import { AnyFunction, CallFunction, Codec, CodecArg, ModulesWithCalls, RegistryTypes } from '@polkadot/types/types';
import {
ApiInterfaceRx, ApiInterfaceEvents, ApiOptions, ApiTypes, DecorateMethodOptions,
DecoratedRpc, DecoratedRpcSection,
@@ -23,13 +23,12 @@ import { Storage } from '@polkadot/api-metadata/storage/types';
import storageFromMeta from '@polkadot/api-metadata/storage/fromMetadata';
import RpcCore from '@polkadot/rpc-core';
import { WsProvider } from '@polkadot/rpc-provider';
import { getTypeRegistry, GenericEvent, GenericMethod, Metadata, Null, u64 } from '@polkadot/types';
import { getTypeRegistry, GenericCall, GenericEvent, Metadata, Null, u64 } from '@polkadot/types';
import Linkage, { LinkageResult } from '@polkadot/types/codec/Linkage';
import { DEFAULT_VERSION as EXTRINSIC_DEFAULT_VERSION } from '@polkadot/types/primitive/Extrinsic/constants';
import { MethodFunction, ModulesWithMethods } from '@polkadot/types/primitive/Generic/Method';
import * as interfacesTypes from '@polkadot/types/interfaces/definitions';
import { StorageEntry } from '@polkadot/types/primitive/StorageKey';
import { assert, compactStripLength, isFunction, isObject, isUndefined, logger, u8aToHex } from '@polkadot/util';
import { assert, compactStripLength, isFunction, isObject, isUndefined, logger, u8aToHex, u8aToU8a } from '@polkadot/util';
import { cryptoWaitReady } from '@polkadot/util-crypto';
import createSubmittable, { SubmittableExtrinsic } from './SubmittableExtrinsic';
@@ -209,6 +208,13 @@ export default abstract class ApiBase<ApiType> {
return this._type;
}
/**
* @description Finds the definition for a specific [[Call]] based on the index supplied
*/
public findCall (callIndex: Uint8Array | string): CallFunction {
return GenericCall.findFunction(u8aToU8a(callIndex));
}
/**
* @description Set an external signer which will be used to sign extrinsic when account passed in is not KeyringPair
*/
@@ -534,7 +540,7 @@ export default abstract class ApiBase<ApiType> {
// only inject if we are not a clone (global init)
if (!this._options.source) {
GenericEvent.injectMetadata(this.runtimeMetadata);
GenericMethod.injectMethods(extrinsics);
GenericCall.injectMethods(extrinsics);
// detect the extrinsic version in-use based on the last block
const lastBlock: SignedBlock = await this._rpcCore.chain.getBlock().toPromise();
@@ -600,7 +606,7 @@ export default abstract class ApiBase<ApiType> {
});
}
private decorateExtrinsics<ApiType> (extrinsics: ModulesWithMethods, decorateMethod: ApiBase<ApiType>['decorateMethod']): SubmittableExtrinsics<ApiType> {
private decorateExtrinsics<ApiType> (extrinsics: ModulesWithCalls, decorateMethod: ApiBase<ApiType>['decorateMethod']): SubmittableExtrinsics<ApiType> {
const creator = (value: Uint8Array | string): SubmittableExtrinsic<ApiType> =>
createSubmittable(this.type, this._rx as ApiInterfaceRx, decorateMethod, value);
@@ -617,7 +623,7 @@ export default abstract class ApiBase<ApiType> {
}, creator as unknown as SubmittableExtrinsics<ApiType>);
}
private decorateExtrinsicEntry<ApiType> (method: MethodFunction, decorateMethod: ApiBase<ApiType>['decorateMethod']): SubmittableExtrinsicFunction<ApiType> {
private decorateExtrinsicEntry<ApiType> (method: CallFunction, decorateMethod: ApiBase<ApiType>['decorateMethod']): SubmittableExtrinsicFunction<ApiType> {
const decorated =
(...params: CodecArg[]): SubmittableExtrinsic<ApiType> =>
createSubmittable(this.type, this._rx as ApiInterfaceRx, decorateMethod, method(...params));
+3 -3
View File
@@ -3,7 +3,7 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import extrinsics from '@polkadot/api-metadata/extrinsics/static';
import { createType, GenericMethod } from '@polkadot/types';
import { createType, GenericCall } from '@polkadot/types';
import SignerPayload from './SignerPayload';
@@ -21,7 +21,7 @@ describe('SignerPayload', (): void => {
};
beforeEach((): void => {
GenericMethod.injectMethods(extrinsics);
GenericCall.injectMethods(extrinsics);
});
it('creates a valid JSON output', (): void => {
@@ -32,7 +32,7 @@ describe('SignerPayload', (): void => {
blockNumber: '0x231d30',
era: createType('ExtrinsicEra', { current: 2301232, period: 200 }),
genesisHash: '0xdcd1346701ca8396496e52aa2785b1748deb6db09551b72159dcb3e08991025b',
method: createType('Method', '0x0500ffd7568e5f0a7eda67a82691ff379ac4bba4f9c9b859fe779b5d46363b61ad2db9e56c'),
method: createType('Call', '0x0500ffd7568e5f0a7eda67a82691ff379ac4bba4f9c9b859fe779b5d46363b61ad2db9e56c'),
nonce: 0x1234,
tip: 0x5678,
version: 2
+3 -3
View File
@@ -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 { Address, Balance, BlockNumber, ExtrinsicEra, Hash, Index, Method } from '@polkadot/types/interfaces';
import { Address, Balance, BlockNumber, Call, ExtrinsicEra, Hash, Index } from '@polkadot/types/interfaces';
import { SignerPayload as ISignerPayload } from './types';
import { ClassOf, Compact, Struct, u8 } from '@polkadot/types';
@@ -13,7 +13,7 @@ export interface SignerPayloadType {
blockNumber: BlockNumber;
era: ExtrinsicEra;
genesisHash: Hash;
method: Method;
method: Call;
nonce: Compact<Index>;
tip: Compact<Balance>;
version: u8;
@@ -25,7 +25,7 @@ export default class SignerPayload extends Struct.with({
blockNumber: ClassOf('BlockNumber'),
era: ClassOf('ExtrinsicEra'),
genesisHash: ClassOf('Hash'),
method: ClassOf('Method'),
method: ClassOf('Call'),
nonce: ClassOf('Compact<Index>'),
tip: ClassOf('Compact<Balance>'),
version: u8
+2 -2
View File
@@ -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 { AccountId, Address, ExtrinsicEra, ExtrinsicStatus, EventRecord, Hash, Header, Index, Method, SignedBlock } from '@polkadot/types/interfaces';
import { AccountId, Address, Call, ExtrinsicEra, ExtrinsicStatus, EventRecord, Hash, Header, Index, SignedBlock } from '@polkadot/types/interfaces';
import { AnyNumber, AnyU8a, Callback, Codec, IExtrinsic, IExtrinsicEra, IKeyringPair, SignatureOptions } from '@polkadot/types/types';
import { ApiInterfaceRx, ApiTypes } from './types';
@@ -110,7 +110,7 @@ export default function createSubmittableExtrinsic<ApiType> (
type: ApiTypes,
api: ApiInterfaceRx,
decorateMethod: ApiBase<ApiType>['decorateMethod'],
extrinsic: Method | Uint8Array | string,
extrinsic: Call | Uint8Array | string,
trackingCb?: Callback<ISubmittableResult>
): SubmittableExtrinsic<ApiType> {
const _extrinsic = createType('Extrinsic', extrinsic, { version: api.extrinsicType }) as unknown as SubmittableExtrinsic<ApiType>;
+1 -1
View File
@@ -60,7 +60,7 @@ export default async function test (): Promise<void> {
const transfer = api.tx.balances.transfer(keyring.bob.address, 12345);
console.log('transfer as Method', transfer as IMethod);
console.log('transfer as Call', transfer as IMethod);
console.log('transfer as Extrinsic', transfer as IExtrinsic);
// simple "return the hash" variant
+2 -3
View File
@@ -3,7 +3,7 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import { Hash, RuntimeVersion } from '@polkadot/types/interfaces';
import { AnyFunction, Callback, Codec, CodecArg, IExtrinsic, RegistryTypes, SignatureOptions } from '@polkadot/types/types';
import { AnyFunction, Callback, CallFunction, Codec, CodecArg, IExtrinsic, RegistryTypes, SignatureOptions } from '@polkadot/types/types';
import BN from 'bn.js';
import { Observable } from 'rxjs';
@@ -11,7 +11,6 @@ import { DeriveCustom } from '@polkadot/api-derive';
import { Constants } from '@polkadot/api-metadata/consts/types';
import { ProviderInterface, ProviderInterfaceEmitted } from '@polkadot/rpc-provider/types';
import { u64 } from '@polkadot/types';
import { MethodFunction } from '@polkadot/types/primitive/Generic/Method';
import { StorageEntry } from '@polkadot/types/primitive/StorageKey';
import ApiBase from './Base';
@@ -164,7 +163,7 @@ export interface QueryableStorage<ApiType> {
[index: string]: QueryableModuleStorage<ApiType>;
}
export interface SubmittableExtrinsicFunction<ApiType> extends MethodFunction {
export interface SubmittableExtrinsicFunction<ApiType> extends CallFunction {
(...params: CodecArg[]): SubmittableExtrinsic<ApiType>;
}
+1 -1
View File
@@ -41,7 +41,7 @@ const submitAndWatchExtrinsic: RpcMethodOpt = {
const section = 'author';
/**
* @summary Methods to work with authors & contributors.
* @summary Calls to work with authors & contributors.
*/
export default {
isDeprecated: false,
+1 -1
View File
@@ -89,7 +89,7 @@ const subscribeRuntimeVersion: RpcMethodOpt = {
const section = 'chain';
/**
* @summary Methods to retrieve chain data.
* @summary Calls to retrieve chain data.
*/
export default {
isDeprecated: false,
+2 -2
View File
@@ -54,12 +54,12 @@ const networkState: RpcMethodOpt = {
const section = 'system';
/**
* @summary Methods to retrieve system info.
* @summary Calls to retrieve system info.
*/
export default {
isDeprecated: false,
isHidden: false,
description: 'Methods to retrieve system info',
description: 'Calls to retrieve system info',
section,
methods: {
chain: createMethod(section, 'chain', chain),
+2 -2
View File
@@ -39,6 +39,7 @@ These primitive types are available:
| [[Address]] | A wrapper around an AccountId and/or AccountIndex that is encoded with a prefix |
| [[Bool]] | Representation for a boolean value in the system |
| [[Bytes]] | A Bytes wrapper for `Vec<u8>` |
| [[Call]] | Extrinsic function descriptor, as defined in [the extrinsic format for a node](https://github.com/paritytech/wiki/blob/master/Extrinsic.md#the-extrinsic-format-for-node) |
| [[Data]] | A raw data structure. It is an encoding of a U8a without any length encoding |
| [[Event]] | Wrapper for the actual data that forms part of an [[Event]] |
| [[EventRecord]] | A record for an [[Event]] (as specified by [[Metadata]]) with the specific [[Phase]] of application |
@@ -55,7 +56,6 @@ These primitive types are available:
| [[I64]] | A 64-bit signed integer |
| [[I128]] | A 128-bit signed integer |
| [[I256]] | A 256-bit signed integer |
| [[Method]] | Extrinsic function descriptor, as defined in [the extrinsic format for a node](https://github.com/paritytech/wiki/blob/master/Extrinsic.md#the-extrinsic-format-for-node) |
| [[Moment]] | A wrapper around seconds/timestamps. Internally the representation only has second precicion (aligning with Rust) |
| [[Null]] | Implements a type that does not contain anything (apart from `null`) |
| [[Origin]] | Where Origin occurs, it should be ignored as an internal-only value |
@@ -122,7 +122,7 @@ These custom types implement specific types that are found as part of the Substr
| [[Permill]] | Parts per million (See also [[Perbill]]) |
| [[PrefabWasmModule]] | Struct to encode the vesting schedule of an individual account |
| [[PropIndex]] | An increasing number that represents a specific council proposal index in the system |
| [[Proposal]] | A proposal in the system. It just extends [[Method]] (Proposal = Call in Rust) |
| [[Proposal]] | A proposal in the system. It just extends [[Call]] (Proposal = Call in Rust) |
| [[ProposalIndex]] | An increasing number that represents a specific council proposal index in the system |
| [[ReferendumIndex]] | An increasing number that represents a specific referendum in the system |
| [[ReferendumInfo]] | Info regarding an ongoing referendum |
+2 -2
View File
@@ -8,7 +8,7 @@ import extrinsicsFromMeta from '@polkadot/api-metadata/extrinsics/fromMetadata';
import { createTypeUnsafe } from '../../codec/createType';
import Metadata from '../Metadata';
import Method from '../../primitive/Generic/Method';
import Call from '../../primitive/Generic/Call';
import { MetadataInterface } from '../types';
import { Codec } from '../../types';
@@ -54,7 +54,7 @@ export function defaultValues (rpcData: string): void {
describe('storage with default values', (): void => {
const metadata = new Metadata(rpcData);
Method.injectMethods(extrinsicsFromMeta(metadata));
Call.injectMethods(extrinsicsFromMeta(metadata));
metadata.asV7.modules
.filter(({ storage }): boolean => storage.isSome)
+3 -3
View File
@@ -11,7 +11,7 @@ import { CodecTo } from '../types';
import extrinsics from '@polkadot/api-metadata/extrinsics/static';
import { ClassOf } from '../codec/createType';
import Method from '../primitive/Generic/Method';
import Call from '../primitive/Generic/Call';
import Text from '../primitive/Text';
import U32 from '../primitive/U32';
import Tuple from './Tuple';
@@ -56,7 +56,7 @@ describe('Tuple', (): void => {
});
it.skip('creates properly via actual hex string', (): void => {
Method.injectMethods(extrinsics);
Call.injectMethods(extrinsics);
const test = new (Tuple.with([
ClassOf('BlockNumber'), ClassOf('Proposal'), ClassOf('VoteThreshold')
@@ -64,7 +64,7 @@ describe('Tuple', (): void => {
))('0x62190000000000000003507b0a092230783432223a202230783433220a7d0a01');
expect((test[0] as BlockNumber).toNumber()).toEqual(6498);
expect((test[1] as Method).callIndex).toEqual(new Uint8Array([0, 3]));
expect((test[1] as Call).callIndex).toEqual(new Uint8Array([0, 3]));
expect((test[2] as VoteThreshold).toNumber()).toEqual(1);
});
+2 -2
View File
@@ -8,7 +8,7 @@ import { Codec, CodecTo } from '../types';
import extrinsics from '@polkadot/api-metadata/extrinsics/static';
import AccountId from '../primitive/Generic/AccountId';
import Method from '../primitive/Generic/Method';
import Call from '../primitive/Generic/Call';
import Text from '../primitive/Text';
import { createTypeUnsafe } from './createType';
import Vec from './Vec';
@@ -20,7 +20,7 @@ describe('Vec', (): void => {
beforeEach((): void => {
vector = new Vec(Text, ['1', '23', '345', '4567', new Text('56789')]);
Method.injectMethods(extrinsics);
Call.injectMethods(extrinsics);
});
it('wraps a sequence of values', (): void => {
+2 -2
View File
@@ -7,7 +7,7 @@ import './injector';
import extrinsics from '@polkadot/api-metadata/extrinsics/static';
import { createTypeUnsafe } from './codec/createType';
import GenericMethod from './primitive/Generic/Method';
import GenericCall from './primitive/Generic/Call';
import { Codec } from './types';
import * as exported from './index.types';
import * as definitions from './interfaces/definitions';
@@ -36,7 +36,7 @@ function testTypes (type: string, typeNames: string[]): void {
});
describe(`${type}:: default creation (empty bytes)`, (): void => {
GenericMethod.injectMethods(extrinsics);
GenericCall.injectMethods(extrinsics);
typeNames.forEach((name): void => {
it(`creates an empty ${name} (from empty bytes)`, (): void => {
+4 -4
View File
@@ -2,7 +2,7 @@
import { Compact, Option, Vec } from './codec';
import { Bytes, Data, Fixed64, H160, H256, H512, Null, StorageHasher, StorageKey, Text, Type, bool, i128, i16, i256, i32, i64, i8, u128, u16, u256, u32, u64, u8, usize } from './primitive';
import { AccountId, AccountIdOf, AccountIndex, Address, Balance, BalanceOf, Block, BlockNumber, Consensus, ConsensusEngineId, Digest, DigestItem, Ed25519Signature, Extrinsic, ExtrinsicEra, ExtrinsicPayload, Hash, Header, ImmortalEra, Index, Justification, KeyTypeId, KeyValue, LockIdentifier, Method, Moment, MortalEra, Origin, Perbill, Permill, Phantom, PreRuntime, Seal, SealV0, Signature, SignedBlock, Sr25519Signature, StorageData, ValidatorId, Weight, WeightMultiplier } from './interfaces/runtime';
import { AccountId, AccountIdOf, AccountIndex, Address, Balance, BalanceOf, Block, BlockNumber, Call, Consensus, ConsensusEngineId, Digest, DigestItem, Ed25519Signature, Extrinsic, ExtrinsicEra, ExtrinsicPayload, Hash, Header, ImmortalEra, Index, Justification, KeyTypeId, KeyValue, LockIdentifier, Moment, MortalEra, Origin, Perbill, Permill, Phantom, PreRuntime, Seal, SealV0, Signature, SignedBlock, Sr25519Signature, StorageData, ValidatorId, Weight, WeightMultiplier } from './interfaces/runtime';
import { AuthorityId } from './interfaces/consensus';
import { Keys, SessionIndex } from './interfaces/session';
import { AuthorityWeight, NextAuthority, PendingPause, PendingResume, StoredPendingChange, StoredState } from './interfaces/grandpa';
@@ -182,9 +182,9 @@ export interface InterfaceRegistry {
Sr25519Signature: Sr25519Signature;
'Option<Sr25519Signature>': Option<Sr25519Signature>;
'Vec<Sr25519Signature>': Vec<Sr25519Signature>;
Method: Method;
'Option<Method>': Option<Method>;
'Vec<Method>': Vec<Method>;
Call: Call;
'Option<Call>': Option<Call>;
'Vec<Call>': Vec<Call>;
Origin: Origin;
'Option<Origin>': Option<Origin>;
'Vec<Origin>': Vec<Origin>;
@@ -21,7 +21,7 @@ export default {
]
},
PropIndex: 'u32',
Proposal: 'Method',
Proposal: 'Call',
ReferendumIndex: 'u32',
ReferendumInfo: {
end: 'BlockNumber',
@@ -2,7 +2,7 @@
import { Enum, Struct } from '../../codec';
import { u32 } from '../../primitive';
import { BlockNumber, Method } from '../runtime';
import { BlockNumber, Call } from '../runtime';
import { VoteThreshold } from '../elections';
/** Enum */
@@ -24,8 +24,8 @@ export interface Conviction extends Enum {
/** u32 */
export type PropIndex = u32;
/** Method */
export type Proposal = Method;
/** Call */
export type Proposal = Call;
/** u32 */
export type ReferendumIndex = u32;
@@ -7,7 +7,7 @@ import '../../injector';
import extrinsics from '@polkadot/api-metadata/extrinsics/static';
import createType from '../../codec/createType';
import Method from '../../primitive/Generic/Method';
import Call from '../../primitive/Generic/Call';
import events from '../../json/SignedBlock.002.json';
import immortalTxs from '../../json/SignedBlock.004.immortal.json';
import mortalTxs from '../../json/SignedBlock.004.mortal.json';
@@ -15,7 +15,7 @@ import knownMehods from '../../json/SignedBlock.005.json';
describe('SignedBlock', (): void => {
beforeEach((): void => {
Method.injectMethods(extrinsics);
Call.injectMethods(extrinsics);
});
it('decodes a full block', (): void => {
@@ -33,7 +33,7 @@ export default {
Sr25519Signature: 'Signature',
// extrinsic definition
Method: 'GenericMethod',
Call: 'GenericCall',
Origin: 'GenericOrigin',
ImmortalEra: 'GenericImmortalEra',
MortalEra: 'GenericMortalEra',
@@ -2,7 +2,7 @@
import { Codec } from '../../types';
import { Compact, Struct, Vec } from '../../codec';
import { Bytes, Fixed64, GenericAccountId, GenericAccountIndex, GenericAddress, GenericBlock, GenericConsensusEngineId, GenericDigest, GenericDigestItem, GenericExtrinsic, GenericExtrinsicEra, GenericExtrinsicPayload, GenericImmortalEra, GenericMethod, GenericMortalEra, GenericOrigin, H256, H512, Null, StorageKey, u128, u32, u64, u8 } from '../../primitive';
import { Bytes, Fixed64, GenericAccountId, GenericAccountIndex, GenericAddress, GenericBlock, GenericCall, GenericConsensusEngineId, GenericDigest, GenericDigestItem, GenericExtrinsic, GenericExtrinsicEra, GenericExtrinsicPayload, GenericImmortalEra, GenericMortalEra, GenericOrigin, H256, H512, Null, StorageKey, u128, u32, u64, u8 } from '../../primitive';
/** GenericAccountId */
export type AccountId = GenericAccountId;
@@ -28,6 +28,9 @@ export type Block = GenericBlock;
/** u64 */
export type BlockNumber = u64;
/** GenericCall */
export type Call = GenericCall;
/** [ConsensusEngineId, Bytes] & Codec */
export type Consensus = [ConsensusEngineId, Bytes] & Codec;
@@ -87,9 +90,6 @@ export type KeyValue = [StorageKey, StorageData] & Codec;
/** Vec<u8> */
export type LockIdentifier = Vec<u8>;
/** GenericMethod */
export type Method = GenericMethod;
/** u64 */
export type Moment = u64;
@@ -6,12 +6,12 @@ import extrinsics from '@polkadot/api-metadata/extrinsics/static';
import { hexToU8a } from '@polkadot/util';
import Method from '../Generic/Method';
import Call from '../Generic/Call';
import Extrinsic from './Extrinsic';
describe('Extrinsic', (): void => {
beforeAll((): void => {
Method.injectMethods(extrinsics);
Call.injectMethods(extrinsics);
});
describe('V1', (): void => {
@@ -11,7 +11,7 @@ import Base from '../../codec/Base';
import Compact from '../../codec/Compact';
import { FunctionMetadata } from '../../Metadata/v7/Calls';
import Address from '../Generic/Address';
import Method from '../Generic/Method';
import Call from '../Generic/Call';
import ExtrinsicV1, { ExtrinsicValueV1 } from './v1/Extrinsic';
import ExtrinsicV2, { ExtrinsicValueV2 } from './v2/Extrinsic';
import ExtrinsicEra from './ExtrinsicEra';
@@ -36,7 +36,7 @@ interface ExtrinsicOptions {
* - left as is, to create an inherent
*/
export default class Extrinsic extends Base<ExtrinsicV1 | ExtrinsicV2> implements IExtrinsic {
public constructor (value: Extrinsic | ExtrinsicValue | AnyU8a | Method | undefined, { version }: ExtrinsicOptions = {}) {
public constructor (value: Extrinsic | ExtrinsicValue | AnyU8a | Call | undefined, { version }: ExtrinsicOptions = {}) {
super(Extrinsic.decodeExtrinsic(value, version));
}
@@ -55,7 +55,7 @@ export default class Extrinsic extends Base<ExtrinsicV1 | ExtrinsicV2> implement
}
}
public static decodeExtrinsic (value: Extrinsic | ExtrinsicValue | AnyU8a | Method | undefined, version: number = DEFAULT_VERSION): ExtrinsicV1 | ExtrinsicV2 {
public static decodeExtrinsic (value: Extrinsic | ExtrinsicValue | AnyU8a | Call | undefined, version: number = DEFAULT_VERSION): ExtrinsicV1 | ExtrinsicV2 {
if (Array.isArray(value) || isHex(value)) {
// Instead of the block below, it should simply be:
// return Extrinsic.decodeExtrinsic(hexToU8a(value as string));
@@ -83,7 +83,7 @@ export default class Extrinsic extends Base<ExtrinsicV1 | ExtrinsicV2> implement
assert(total <= value.length, `Extrinsic: required length less than remainder, expected at least ${total}, found ${value.length}`);
return Extrinsic.decodeU8a(value.subarray(offset, total));
} else if (value instanceof Method) {
} else if (value instanceof Call) {
return Extrinsic.newFromValue({ method: value }, version);
}
@@ -95,28 +95,28 @@ export default class Extrinsic extends Base<ExtrinsicV1 | ExtrinsicV2> implement
}
/**
* @description The arguments passed to for the call, exposes args so it is compatible with [[Method]]
* @description The arguments passed to for the call, exposes args so it is compatible with [[Call]]
*/
public get args (): Codec[] {
return this.method.args;
}
/**
* @description Thge argument defintions, compatible with [[Method]]
* @description Thge argument defintions, compatible with [[Call]]
*/
public get argsDef (): ArgsDef {
return this.method.argsDef;
}
/**
* @description The actual `[sectionIndex, methodIndex]` as used in the Method
* @description The actual `[sectionIndex, methodIndex]` as used in the Call
*/
public get callIndex (): Uint8Array {
return this.method.callIndex;
}
/**
* @description The actual data for the Method
* @description The actual data for the Call
*/
public get data (): Uint8Array {
return this.method.data;
@@ -137,7 +137,7 @@ export default class Extrinsic extends Base<ExtrinsicV1 | ExtrinsicV2> implement
}
/**
* @description `true` is method has `Origin` argument (compatibility with [[Method]])
* @description `true` is method has `Origin` argument (compatibility with [Call])
*/
public get hasOrigin (): boolean {
return this.method.hasOrigin;
@@ -165,9 +165,9 @@ export default class Extrinsic extends Base<ExtrinsicV1 | ExtrinsicV2> implement
}
/**
* @description The [[Method]] this extrinsic wraps
* @description The [[Call]] this extrinsic wraps
*/
public get method (): Method {
public get method (): Call {
return this.raw.method;
}
@@ -7,12 +7,12 @@ import { ExtrinsicPayloadValue, IExtrinsicImpl, IKeyringPair, SignatureOptions }
import { isU8a } from '@polkadot/util';
import Struct from '../../../codec/Struct';
import Method from '../../Generic/Method';
import Call from '../../Generic/Call';
import Address from '../../Generic/Address';
import ExtrinsicSignature from './ExtrinsicSignature';
export interface ExtrinsicValueV1 {
method?: Method;
method?: Call;
signature?: ExtrinsicSignature;
}
@@ -31,7 +31,7 @@ export default class ExtrinsicV1 extends Struct implements IExtrinsicImpl {
public constructor (value?: Uint8Array | ExtrinsicValueV1, { isSigned }: ExtrinsicV1Options = {}) {
super({
signature: ExtrinsicSignature,
method: Method
method: Call
}, ExtrinsicV1.decodeExtrinsic(value, isSigned));
}
@@ -43,7 +43,7 @@ export default class ExtrinsicV1 extends Struct implements IExtrinsicImpl {
} else if (isU8a(value)) {
// here we decode manually since we need to pull through the version information
const signature = new ExtrinsicSignature(value, { isSigned });
const method = new Method(value.subarray(signature.encodedLength));
const method = new Call(value.subarray(signature.encodedLength));
return {
method,
@@ -62,10 +62,10 @@ export default class ExtrinsicV1 extends Struct implements IExtrinsicImpl {
}
/**
* @description The [[Method]] this extrinsic wraps
* @description The [[Call]] this extrinsic wraps
*/
public get method (): Method {
return this.get('method') as Method;
public get method (): Call {
return this.get('method') as Call;
}
/**
@@ -8,7 +8,7 @@ import { ExtrinsicPayloadValue, IExtrinsicSignature, IKeyringPair, SignatureOpti
import createType, { ClassOf } from '../../../codec/createType';
import Compact from '../../../codec/Compact';
import Struct from '../../../codec/Struct';
import Method from '../../Generic/Method';
import Call from '../../Generic/Call';
import ExtrinsicEra from '../ExtrinsicEra';
import { EMPTY_U8A, IMMORTAL_ERA } from '../constants';
import ExtrinsicPayload from './ExtrinsicPayload';
@@ -123,7 +123,7 @@ export default class ExtrinsicSignatureV1 extends Struct implements IExtrinsicSi
/**
* @description Generate a payload and pplies the signature from a keypair
*/
public sign (method: Method, account: IKeyringPair, { blockHash, era, nonce }: SignatureOptions): IExtrinsicSignature {
public sign (method: Call, account: IKeyringPair, { blockHash, era, nonce }: SignatureOptions): IExtrinsicSignature {
const signer = createType('Address', account.publicKey);
const payload = new ExtrinsicPayload({
nonce,
@@ -5,14 +5,14 @@
import extrinsics from '@polkadot/api-metadata/extrinsics/static';
import testingPairs from '@polkadot/keyring/testingPairs';
import Method from '../../Generic/Method';
import Call from '../../Generic/Call';
import Extrinsic from './Extrinsic';
const keyring = testingPairs({ type: 'ed25519' }, false);
describe('ExtrinsicV2', (): void => {
beforeEach((): void => {
Method.injectMethods(extrinsics);
Call.injectMethods(extrinsics);
});
it('constructs a sane Uint8Array (default)', (): void => {
@@ -7,14 +7,14 @@ import { ExtrinsicPayloadValue, IExtrinsicImpl, IKeyringPair, SignatureOptions }
import { isU8a } from '@polkadot/util';
import Struct from '../../../codec/Struct';
import Method from '../../Generic/Method';
import Call from '../../Generic/Call';
import Address from '../../Generic/Address';
import ExtrinsicSignature from './ExtrinsicSignature';
const TRANSACTION_VERSION = 2;
export interface ExtrinsicValueV2 {
method?: Method;
method?: Call;
signature?: ExtrinsicSignature;
}
@@ -28,24 +28,24 @@ interface ExtrinsicV2Options {
* The second generation of compact extrinsics
*/
export default class ExtrinsicV2 extends Struct implements IExtrinsicImpl {
public constructor (value?: Uint8Array | ExtrinsicValueV2 | Method, { isSigned }: ExtrinsicV2Options = {}) {
public constructor (value?: Uint8Array | ExtrinsicValueV2 | Call, { isSigned }: ExtrinsicV2Options = {}) {
super({
signature: ExtrinsicSignature,
method: Method
method: Call
}, ExtrinsicV2.decodeExtrinsic(value, isSigned));
}
public static decodeExtrinsic (value?: Method | Uint8Array | ExtrinsicValueV2, isSigned: boolean = false): ExtrinsicValueV2 {
public static decodeExtrinsic (value?: Call | Uint8Array | ExtrinsicValueV2, isSigned: boolean = false): ExtrinsicValueV2 {
if (!value) {
return {};
} else if (value instanceof ExtrinsicV2) {
return value;
} else if (value instanceof Method) {
} else if (value instanceof Call) {
return { method: value };
} else if (isU8a(value)) {
// here we decode manually since we need to pull through the version information
const signature = new ExtrinsicSignature(value, { isSigned });
const method = new Method(value.subarray(signature.encodedLength));
const method = new Call(value.subarray(signature.encodedLength));
return {
method,
@@ -64,10 +64,10 @@ export default class ExtrinsicV2 extends Struct implements IExtrinsicImpl {
}
/**
* @description The [[Method]] this extrinsic wraps
* @description The [[Call]] this extrinsic wraps
*/
public get method (): Method {
return this.get('method') as Method;
public get method (): Call {
return this.get('method') as Call;
}
/**
@@ -8,7 +8,7 @@ import { ExtrinsicPayloadValue, IExtrinsicSignature, IKeyringPair, SignatureOpti
import createType, { ClassOf } from '../../../codec/createType';
import Compact from '../../../codec/Compact';
import Struct from '../../../codec/Struct';
import Method from '../../Generic/Method';
import Call from '../../Generic/Call';
import ExtrinsicEra from '../ExtrinsicEra';
import ExtrinsicPayload from './ExtrinsicPayload';
import { EMPTY_U8A, IMMORTAL_ERA } from '../constants';
@@ -127,7 +127,7 @@ export default class ExtrinsicSignatureV2 extends Struct implements IExtrinsicSi
/**
* @description Generate a payload and pplies the signature from a keypair
*/
public sign (method: Method, account: IKeyringPair, { blockHash, era, nonce, tip }: SignatureOptions): IExtrinsicSignature {
public sign (method: Call, account: IKeyringPair, { blockHash, era, nonce, tip }: SignatureOptions): IExtrinsicSignature {
const signer = createType('Address', account.publicKey);
const payload = new ExtrinsicPayload({
blockHash,
@@ -7,12 +7,12 @@ import '../../injector';
import extrinsics from '@polkadot/api-metadata/extrinsics/static';
import block00300 from '../../json/SignedBlock.003.00.json';
import Method from './Method';
import Call from './Call';
import Block from './Block';
describe('Block', (): void => {
beforeEach((): void => {
Method.injectMethods(extrinsics);
Call.injectMethods(extrinsics);
});
it('has a valid toRawType', (): void => {
@@ -4,16 +4,16 @@
import extrinsics from '@polkadot/api-metadata/extrinsics/static';
import Method from './Method';
import Call from './Call';
describe('Method', (): void => {
describe('Call', (): void => {
beforeEach((): void => {
Method.injectMethods(extrinsics);
Call.injectMethods(extrinsics);
});
it('handles decoding correctly (bare)', (): void => {
expect(
new Method({
new Call({
args: [],
callIndex: [5, 1] // balances.setBalance
}).toU8a()
@@ -22,7 +22,7 @@ describe('Method', (): void => {
it('handles creation from a hex value properly', (): void => {
expect(
new Method('0x0501').toU8a()
new Call('0x0501').toU8a()
).toEqual(new Uint8Array([5, 1, 0, 0, 0])); // balances.setBalance
});
@@ -34,19 +34,19 @@ describe('Method', (): void => {
it('is false with no arguments', (): void => {
expect(
new Method(test, { args: [] } as any).hasOrigin
new Call(test, { args: [] } as any).hasOrigin
).toEqual(false);
});
it('is false with first argument as non-Origin', (): void => {
expect(
new Method(test, { args: [{ name: 'a', type: 'u32' }] } as any).hasOrigin
new Call(test, { args: [{ name: 'a', type: 'u32' }] } as any).hasOrigin
).toEqual(false);
});
it('is false with first argument as non-Origin', (): void => {
expect(
new Method(test, { args: [{ name: 'a', type: 'Origin' }] } as any).hasOrigin
new Call(test, { args: [{ name: 'a', type: 'Origin' }] } as any).hasOrigin
).toEqual(true);
});
});
@@ -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, ArgsDef, Codec, IMethod } from '../../types';
import { AnyU8a, ArgsDef, CallFunction, Codec, IMethod, ModulesWithCalls } from '../../types';
import { assert, isHex, isObject, isU8a, hexToU8a } from '@polkadot/util';
@@ -13,7 +13,7 @@ import { FunctionMetadata as FunctionMetadataV7, FunctionArgumentMetadata } from
interface DecodeMethodInput {
args: any;
callIndex: MethodIndex | Uint8Array;
callIndex: CallIndex | Uint8Array;
}
interface DecodedMethod extends DecodeMethodInput {
@@ -21,55 +21,38 @@ interface DecodedMethod extends DecodeMethodInput {
meta: FunctionMetadataV7;
}
export interface MethodFunction {
(...args: any[]): Method;
callIndex: Uint8Array;
meta: FunctionMetadataV7;
method: string;
section: string;
toJSON: () => any;
}
export interface Methods {
[key: string]: MethodFunction;
}
export interface ModulesWithMethods {
[key: string]: Methods; // Will hold modules returned by state_getMetadata
}
const FN_UNKNOWN: Partial<MethodFunction> = {
const FN_UNKNOWN: Partial<CallFunction> = {
method: 'unknown',
section: 'unknown'
};
const injected: Record<string, MethodFunction> = {};
const injected: Record<string, CallFunction> = {};
/**
* @name MethodIndex
* @name CallIndex
* @description
* A wrapper around the `[sectionIndex, methodIndex]` value that uniquely identifies a method
*/
export class MethodIndex extends U8aFixed {
export class CallIndex extends U8aFixed {
public constructor (value?: AnyU8a) {
super(value, 16);
}
}
/**
* @name Method
* @name Call
* @description
* Extrinsic function descriptor, as defined in
* {@link https://github.com/paritytech/wiki/blob/master/Extrinsic.md#the-extrinsic-format-for-node}.
*/
export default class Method extends Struct implements IMethod {
export default class Call extends Struct implements IMethod {
protected _meta: FunctionMetadataV7;
public constructor (value: any, meta?: FunctionMetadataV7) {
const decoded = Method.decodeMethod(value, meta);
const decoded = Call.decodeCall(value, meta);
super({
callIndex: MethodIndex,
callIndex: CallIndex,
args: Struct.with(decoded.argsDef)
}, decoded);
@@ -86,19 +69,19 @@ export default class Method extends Struct implements IMethod {
* @param _meta - Metadata to use, so that `injectMethods` lookup is not
* necessary.
*/
private static decodeMethod (value: DecodedMethod | Uint8Array | string = new Uint8Array(), _meta?: FunctionMetadataV7): DecodedMethod {
private static decodeCall (value: DecodedMethod | Uint8Array | string = new Uint8Array(), _meta?: FunctionMetadataV7): DecodedMethod {
if (isHex(value)) {
return Method.decodeMethod(hexToU8a(value), _meta);
return Call.decodeCall(hexToU8a(value), _meta);
} else if (isU8a(value)) {
// The first 2 bytes are the callIndex
const callIndex = value.subarray(0, 2);
// Find metadata with callIndex
const meta = _meta || Method.findFunction(callIndex).meta;
const meta = _meta || Call.findFunction(callIndex).meta;
return {
args: value.subarray(2),
argsDef: Method.getArgsDef(meta),
argsDef: Call.getArgsDef(meta),
callIndex,
meta
};
@@ -107,22 +90,22 @@ export default class Method extends Struct implements IMethod {
const { args, callIndex } = value;
// Get the correct lookupIndex
const lookupIndex = callIndex instanceof MethodIndex
const lookupIndex = callIndex instanceof CallIndex
? callIndex.toU8a()
: callIndex;
// Find metadata with callIndex
const meta = _meta || Method.findFunction(lookupIndex).meta;
const meta = _meta || Call.findFunction(lookupIndex).meta;
return {
args,
argsDef: Method.getArgsDef(meta),
argsDef: Call.getArgsDef(meta),
meta,
callIndex
};
}
throw new Error(`Method: Cannot decode value '${value}' of type ${typeof value}`);
throw new Error(`Call: Cannot decode value '${value}' of type ${typeof value}`);
}
// If the extrinsic function has an argument of type `Origin`, we ignore it
@@ -142,8 +125,8 @@ export default class Method extends Struct implements IMethod {
//
// As a convenience helper though, we return the full constructor function,
// which includes the meta, name, section & actual interface for calling
public static findFunction (callIndex: Uint8Array): MethodFunction {
assert(Object.keys(injected).length > 0, 'Calling Method.findFunction before extrinsics have been injected.');
public static findFunction (callIndex: Uint8Array): CallFunction {
assert(Object.keys(injected).length > 0, 'Calling Call.findFunction before extrinsics have been injected.');
return injected[callIndex.toString()] || FN_UNKNOWN;
}
@@ -155,7 +138,7 @@ export default class Method extends Struct implements IMethod {
* @param meta - The function metadata used to get the definition.
*/
private static getArgsDef (meta: FunctionMetadataV7): ArgsDef {
return Method.filterOrigin(meta).reduce((result, { name, type }): ArgsDef => {
return Call.filterOrigin(meta).reduce((result, { name, type }): ArgsDef => {
const Type = getTypeClass(
getTypeDef(type.toString())
);
@@ -167,7 +150,7 @@ export default class Method extends Struct implements IMethod {
// This is called/injected by the API on init, allowing a snapshot of
// the available system extrinsics to be used in lookups
public static injectMethods (moduleMethods: ModulesWithMethods): void {
public static injectMethods (moduleMethods: ModulesWithCalls): void {
Object.values(moduleMethods).forEach((methods): void =>
Object.values(methods).forEach((method): void => {
injected[method.callIndex.toString()] = method;
@@ -187,14 +170,14 @@ export default class Method extends Struct implements IMethod {
* @description Thge argument defintions
*/
public get argsDef (): ArgsDef {
return Method.getArgsDef(this.meta);
return Call.getArgsDef(this.meta);
}
/**
* @description The encoded `[sectionIndex, methodIndex]` identifier
*/
public get callIndex (): Uint8Array {
return (this.get('callIndex') as MethodIndex).toU8a();
return (this.get('callIndex') as CallIndex).toU8a();
}
/**
@@ -224,14 +207,14 @@ export default class Method extends Struct implements IMethod {
* @description Returns the name of the method
*/
public get methodName (): string {
return Method.findFunction(this.callIndex).method;
return Call.findFunction(this.callIndex).method;
}
/**
* @description Returns the module containing the method
*/
public get sectionName (): string {
return Method.findFunction(this.callIndex).section;
return Call.findFunction(this.callIndex).section;
}
/**
@@ -6,9 +6,9 @@ export { default as GenericAccountId } from './AccountId';
export { default as GenericAccountIndex } from './AccountIndex';
export { default as GenericAddress } from './Address';
export { default as GenericBlock } from './Block';
export { default as GenericCall } from './Call';
export { default as GenericConsensusEngineId } from './ConsensusEngineId';
export { default as GenericEvent } from './Event';
export { default as GenericDigest, DigestItem as GenericDigestItem } from './Digest';
export { default as GenericMethod } from './Method';
export { default as GenericOrigin } from './Origin';
export { default as GenericVote } from './Vote';
+2 -2
View File
@@ -8,7 +8,7 @@ import fs from 'fs';
import { stringCamelCase, stringLowerFirst } from '@polkadot/util';
import interfaces from '../../../type-jsonrpc/src';
import Method from '../primitive/Generic/Method';
import Call from '../primitive/Generic/Call';
import Metadata from '../Metadata';
import rpcdata from '../Metadata/static';
import MetadataV7, { ModuleMetadataV7 } from '../Metadata/v7';
@@ -150,7 +150,7 @@ function addExtrinsics (metadata: MetadataV7): string {
return orderedMethods.reduce((md, func): string => {
const methodName = stringCamelCase(func.name.toString());
const args = Method.filterOrigin(func).map(({ name, type }): string => `${name}: ` + '`' + type + '`').join(', ');
const args = Call.filterOrigin(func).map(({ name, type }): string => `${name}: ` + '`' + type + '`').join(', ');
const doc = func.documentation.reduce((md, doc): string => `${md} ${doc}`, '');
const renderSignature = `${md}\n▸ **${methodName}**(${args})`;
const renderSummary = `${doc ? `\n- **summary**: ${doc}\n` : '\n'}`;
+17 -4
View File
@@ -9,11 +9,24 @@ import BN from 'bn.js';
import Compact from './codec/Compact';
import U8a from './codec/U8a';
import { FunctionMetadata } from './Metadata/v7/Calls';
import Method from './primitive/Generic/Method';
import Call from './primitive/Generic/Call';
import Address from './primitive/Generic/Address';
export * from './codec/types';
export interface CallFunction {
(...args: any[]): Call;
callIndex: Uint8Array;
meta: FunctionMetadata;
method: string;
section: string;
toJSON: () => any;
}
export type Calls = Record<string, CallFunction>;
export type ModulesWithCalls = Record<string, Calls>;
// eslint-disable-next-line @typescript-eslint/interface-name-prefix
export interface IKeyringPair {
address: string;
@@ -169,7 +182,7 @@ export interface ExtrinsicPayloadValue {
// eslint-disable-next-line @typescript-eslint/interface-name-prefix
export interface IExtrinsicSignature extends ExtrinsicSignatureBase, Codec {
addSignature (signer: Address | Uint8Array | string, signature: Uint8Array | string, payload: Uint8Array | string): IExtrinsicSignature;
sign (method: Method, account: IKeyringPair, options: SignatureOptions): IExtrinsicSignature;
sign (method: Call, account: IKeyringPair, options: SignatureOptions): IExtrinsicSignature;
}
// eslint-disable-next-line @typescript-eslint/interface-name-prefix
@@ -180,7 +193,7 @@ export interface IExtrinsicEra extends Codec {
// eslint-disable-next-line @typescript-eslint/interface-name-prefix
export interface IExtrinsicImpl extends Codec {
readonly method: Method;
readonly method: Call;
readonly signature: IExtrinsicSignature;
readonly version: number;
@@ -191,7 +204,7 @@ export interface IExtrinsicImpl extends Codec {
// eslint-disable-next-line @typescript-eslint/interface-name-prefix
export interface IExtrinsic extends ExtrinsicSignatureBase, IMethod {
readonly length: number;
readonly method: Method;
readonly method: Call;
readonly type: number;
readonly version: number;