Types for ink! 3.0 (#2693)
* Updated ABI definitions & parsing * Run type generation * Definitions (should be ok-ish) * Cleanup names * Allow aliasses on structs (JSON parsing) * Cleanup json mapping passing * s/types/lookup/ * Parsing as per current output * InkSelector * MtRegistryIndex * String lookup tests * Remove serd ovverride comments (it works as-is) * inkRegistry tests * Extract primitive types * s/ty/id/ * Start of parsing into types (actually to be TypeDef) * Parsing * stringify struct fields * Small cleanups * Add type index to project lookup * Prefix with index * Fix interface generation * Latest contract metadata (#2118) * Add new (provisional) incrementer contract metadata * Update and regenerate type definitions * WIP: generate new format scale-info types * WIP: implementing variants * Implement variants * Fix up type resolution * Fix registry spec tests * Fix lints and some tests * Fix inkTypes tests * Fix some lints * Make imports same line like original * Comment out (temporarily) sanitize import to make CI pass * Sanitize * Remove indices * Remove index * api-contract rewrite * lint * cleanup * latest * latest * fix definition * fiz definitions * rv ink storage * Update packages/api-contract/src/base/Contract.ts Co-authored-by: Jaco Greeff <jacogr@gmail.com> * fixes * rv scripts * restore api-contract * reorder definitions, fix ink storage * fixes Co-authored-by: Jaco Greeff <jacogr@gmail.com> Co-authored-by: Andrew Jones <ascjones@gmail.com>
This commit is contained in:
co-authored by
Jaco Greeff
Andrew Jones
parent
e53c229ac5
commit
87985f1f1f
@@ -15,6 +15,7 @@ import { EthereumAddress, StatementKind } from '@polkadot/types/interfaces/claim
|
||||
import { CollectiveOrigin, MemberCount, ProposalIndex, Votes, VotesTo230 } from '@polkadot/types/interfaces/collective';
|
||||
import { AuthorityId, RawVRFOutput } from '@polkadot/types/interfaces/consensus';
|
||||
import { AliveContractInfo, CodeHash, ContractCallRequest, ContractExecResult, ContractExecResultSuccess, ContractExecResultSuccessTo255, ContractExecResultTo255, ContractInfo, ContractStorageKey, Gas, HostFnWeights, InstructionWeights, PrefabWasmModule, PrefabWasmModuleReserved, Schedule, ScheduleTo212, ScheduleTo258, SeedOf, TombstoneContractInfo, TrieId } from '@polkadot/types/interfaces/contracts';
|
||||
import { InkConstructorSpec, InkContractContract, InkContractSource, InkContractSpec, InkCryptoHasher, InkDiscriminant, InkDisplayName, InkEventParamSpec, InkEventSpec, InkLayoutArray, InkLayoutCell, InkLayoutEnum, InkLayoutHash, InkLayoutHashingStrategy, InkLayoutKey, InkLayoutStruct, InkLayoutStructField, InkMessageParamSpec, InkMessageSpec, InkPath, InkProject, InkSelector, InkStorageLayout, InkTypeSpec, MtField, MtLookupTypeId, MtType, MtTypeDef, MtTypeDefArray, MtTypeDefComposite, MtTypeDefPrimitive, MtTypeDefSequence, MtTypeDefSlice, MtTypeDefTuple, MtTypeDefVariant, MtVariant } from '@polkadot/types/interfaces/contractsAbi';
|
||||
import { AccountVote, AccountVoteSplit, AccountVoteStandard, Conviction, Delegations, PreimageStatus, PreimageStatusAvailable, PriorLock, PropIndex, Proposal, ProxyState, ReferendumIndex, ReferendumInfo, ReferendumInfoFinished, ReferendumInfoTo239, ReferendumStatus, Tally, Voting, VotingDelegating, VotingDirect, VotingDirectVote } from '@polkadot/types/interfaces/democracy';
|
||||
import { ApprovalFlag, DefunctVoter, Renouncing, SetIndex, Vote, VoteIndex, VoteThreshold, VoterInfo } from '@polkadot/types/interfaces/elections';
|
||||
import { CreatedBlock, ImportedAux } from '@polkadot/types/interfaces/engine';
|
||||
@@ -528,6 +529,116 @@ declare module '@polkadot/types/types/registry' {
|
||||
TrieId: TrieId;
|
||||
'Option<TrieId>': Option<TrieId>;
|
||||
'Vec<TrieId>': Vec<TrieId>;
|
||||
InkLayoutKey: InkLayoutKey;
|
||||
'Option<InkLayoutKey>': Option<InkLayoutKey>;
|
||||
'Vec<InkLayoutKey>': Vec<InkLayoutKey>;
|
||||
InkStorageLayout: InkStorageLayout;
|
||||
'Option<InkStorageLayout>': Option<InkStorageLayout>;
|
||||
'Vec<InkStorageLayout>': Vec<InkStorageLayout>;
|
||||
InkLayoutCell: InkLayoutCell;
|
||||
'Option<InkLayoutCell>': Option<InkLayoutCell>;
|
||||
'Vec<InkLayoutCell>': Vec<InkLayoutCell>;
|
||||
InkCryptoHasher: InkCryptoHasher;
|
||||
'Option<InkCryptoHasher>': Option<InkCryptoHasher>;
|
||||
'Vec<InkCryptoHasher>': Vec<InkCryptoHasher>;
|
||||
InkLayoutHash: InkLayoutHash;
|
||||
'Option<InkLayoutHash>': Option<InkLayoutHash>;
|
||||
'Vec<InkLayoutHash>': Vec<InkLayoutHash>;
|
||||
InkLayoutHashingStrategy: InkLayoutHashingStrategy;
|
||||
'Option<InkLayoutHashingStrategy>': Option<InkLayoutHashingStrategy>;
|
||||
'Vec<InkLayoutHashingStrategy>': Vec<InkLayoutHashingStrategy>;
|
||||
InkLayoutArray: InkLayoutArray;
|
||||
'Option<InkLayoutArray>': Option<InkLayoutArray>;
|
||||
'Vec<InkLayoutArray>': Vec<InkLayoutArray>;
|
||||
InkLayoutStruct: InkLayoutStruct;
|
||||
'Option<InkLayoutStruct>': Option<InkLayoutStruct>;
|
||||
'Vec<InkLayoutStruct>': Vec<InkLayoutStruct>;
|
||||
InkLayoutStructField: InkLayoutStructField;
|
||||
'Option<InkLayoutStructField>': Option<InkLayoutStructField>;
|
||||
'Vec<InkLayoutStructField>': Vec<InkLayoutStructField>;
|
||||
InkDiscriminant: InkDiscriminant;
|
||||
'Compact<InkDiscriminant>': Compact<InkDiscriminant>;
|
||||
'Option<InkDiscriminant>': Option<InkDiscriminant>;
|
||||
'Vec<InkDiscriminant>': Vec<InkDiscriminant>;
|
||||
InkLayoutEnum: InkLayoutEnum;
|
||||
'Option<InkLayoutEnum>': Option<InkLayoutEnum>;
|
||||
'Vec<InkLayoutEnum>': Vec<InkLayoutEnum>;
|
||||
MtField: MtField;
|
||||
'Option<MtField>': Option<MtField>;
|
||||
'Vec<MtField>': Vec<MtField>;
|
||||
MtLookupTypeId: MtLookupTypeId;
|
||||
'Compact<MtLookupTypeId>': Compact<MtLookupTypeId>;
|
||||
'Option<MtLookupTypeId>': Option<MtLookupTypeId>;
|
||||
'Vec<MtLookupTypeId>': Vec<MtLookupTypeId>;
|
||||
MtType: MtType;
|
||||
'Option<MtType>': Option<MtType>;
|
||||
'Vec<MtType>': Vec<MtType>;
|
||||
MtTypeDef: MtTypeDef;
|
||||
'Option<MtTypeDef>': Option<MtTypeDef>;
|
||||
'Vec<MtTypeDef>': Vec<MtTypeDef>;
|
||||
MtTypeDefArray: MtTypeDefArray;
|
||||
'Option<MtTypeDefArray>': Option<MtTypeDefArray>;
|
||||
'Vec<MtTypeDefArray>': Vec<MtTypeDefArray>;
|
||||
MtTypeDefComposite: MtTypeDefComposite;
|
||||
'Option<MtTypeDefComposite>': Option<MtTypeDefComposite>;
|
||||
'Vec<MtTypeDefComposite>': Vec<MtTypeDefComposite>;
|
||||
MtTypeDefPrimitive: MtTypeDefPrimitive;
|
||||
'Option<MtTypeDefPrimitive>': Option<MtTypeDefPrimitive>;
|
||||
'Vec<MtTypeDefPrimitive>': Vec<MtTypeDefPrimitive>;
|
||||
MtTypeDefSequence: MtTypeDefSequence;
|
||||
'Option<MtTypeDefSequence>': Option<MtTypeDefSequence>;
|
||||
'Vec<MtTypeDefSequence>': Vec<MtTypeDefSequence>;
|
||||
MtTypeDefSlice: MtTypeDefSlice;
|
||||
'Option<MtTypeDefSlice>': Option<MtTypeDefSlice>;
|
||||
'Vec<MtTypeDefSlice>': Vec<MtTypeDefSlice>;
|
||||
MtTypeDefTuple: MtTypeDefTuple;
|
||||
'Option<MtTypeDefTuple>': Option<MtTypeDefTuple>;
|
||||
'Vec<MtTypeDefTuple>': Vec<MtTypeDefTuple>;
|
||||
MtTypeDefVariant: MtTypeDefVariant;
|
||||
'Option<MtTypeDefVariant>': Option<MtTypeDefVariant>;
|
||||
'Vec<MtTypeDefVariant>': Vec<MtTypeDefVariant>;
|
||||
MtVariant: MtVariant;
|
||||
'Option<MtVariant>': Option<MtVariant>;
|
||||
'Vec<MtVariant>': Vec<MtVariant>;
|
||||
InkPath: InkPath;
|
||||
'Option<InkPath>': Option<InkPath>;
|
||||
'Vec<InkPath>': Vec<InkPath>;
|
||||
InkDisplayName: InkDisplayName;
|
||||
'Option<InkDisplayName>': Option<InkDisplayName>;
|
||||
'Vec<InkDisplayName>': Vec<InkDisplayName>;
|
||||
InkConstructorSpec: InkConstructorSpec;
|
||||
'Option<InkConstructorSpec>': Option<InkConstructorSpec>;
|
||||
'Vec<InkConstructorSpec>': Vec<InkConstructorSpec>;
|
||||
InkContractSpec: InkContractSpec;
|
||||
'Option<InkContractSpec>': Option<InkContractSpec>;
|
||||
'Vec<InkContractSpec>': Vec<InkContractSpec>;
|
||||
InkEventParamSpec: InkEventParamSpec;
|
||||
'Option<InkEventParamSpec>': Option<InkEventParamSpec>;
|
||||
'Vec<InkEventParamSpec>': Vec<InkEventParamSpec>;
|
||||
InkEventSpec: InkEventSpec;
|
||||
'Option<InkEventSpec>': Option<InkEventSpec>;
|
||||
'Vec<InkEventSpec>': Vec<InkEventSpec>;
|
||||
InkMessageParamSpec: InkMessageParamSpec;
|
||||
'Option<InkMessageParamSpec>': Option<InkMessageParamSpec>;
|
||||
'Vec<InkMessageParamSpec>': Vec<InkMessageParamSpec>;
|
||||
InkMessageSpec: InkMessageSpec;
|
||||
'Option<InkMessageSpec>': Option<InkMessageSpec>;
|
||||
'Vec<InkMessageSpec>': Vec<InkMessageSpec>;
|
||||
InkSelector: InkSelector;
|
||||
'Option<InkSelector>': Option<InkSelector>;
|
||||
'Vec<InkSelector>': Vec<InkSelector>;
|
||||
InkTypeSpec: InkTypeSpec;
|
||||
'Option<InkTypeSpec>': Option<InkTypeSpec>;
|
||||
'Vec<InkTypeSpec>': Vec<InkTypeSpec>;
|
||||
InkContractContract: InkContractContract;
|
||||
'Option<InkContractContract>': Option<InkContractContract>;
|
||||
'Vec<InkContractContract>': Vec<InkContractContract>;
|
||||
InkContractSource: InkContractSource;
|
||||
'Option<InkContractSource>': Option<InkContractSource>;
|
||||
'Vec<InkContractSource>': Vec<InkContractSource>;
|
||||
InkProject: InkProject;
|
||||
'Option<InkProject>': Option<InkProject>;
|
||||
'Vec<InkProject>': Vec<InkProject>;
|
||||
AccountVote: AccountVote;
|
||||
'Option<AccountVote>': Option<AccountVote>;
|
||||
'Vec<AccountVote>': Vec<AccountVote>;
|
||||
|
||||
@@ -64,7 +64,11 @@ function decodeFromJSON (registry: Registry, def: TypesDef, key: string, value?:
|
||||
|
||||
assert(index !== -1, `Cannot map Enum JSON, unable to find '${key}' in ${keys.join(', ')}`);
|
||||
|
||||
return createFromValue(registry, def, index, value);
|
||||
try {
|
||||
return createFromValue(registry, def, index, value);
|
||||
} catch (error) {
|
||||
throw new Error(`Enum(${key}):: ${(error as Error).message}`);
|
||||
}
|
||||
}
|
||||
|
||||
function decodeFromString (registry: Registry, def: TypesDef, value: string): Decoded {
|
||||
|
||||
@@ -44,8 +44,8 @@ export interface TypeDef {
|
||||
name?: string;
|
||||
namespace?: string;
|
||||
params?: TypeDef[];
|
||||
type: string;
|
||||
sub?: TypeDef | TypeDef[];
|
||||
type: string;
|
||||
}
|
||||
|
||||
export type TypeIndex = number;
|
||||
|
||||
@@ -90,7 +90,7 @@ export default {
|
||||
},
|
||||
ContractExecResultSuccess: {
|
||||
flags: 'u32',
|
||||
data: 'Vec<u8>',
|
||||
data: 'Bytes',
|
||||
gasConsumed: 'u64'
|
||||
},
|
||||
ContractExecResult: {
|
||||
|
||||
@@ -0,0 +1,175 @@
|
||||
// Copyright 2017-2020 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
/* eslint-disable sort-keys */
|
||||
|
||||
const layout = {
|
||||
InkCryptoHasher: {
|
||||
_enum: ['Blake2x256', 'Sha2x256', 'Keccak256']
|
||||
},
|
||||
InkDiscriminant: 'u32',
|
||||
InkLayoutArray: {
|
||||
offset: 'InkLayoutKey',
|
||||
len: 'u32',
|
||||
cellsPerElem: 'u64',
|
||||
layout: 'InkStorageLayout'
|
||||
},
|
||||
InkLayoutCell: {
|
||||
key: 'InkLayoutKey',
|
||||
ty: 'MtLookupTypeId'
|
||||
},
|
||||
InkLayoutEnum: {
|
||||
dispatchKey: 'InkLayoutKey',
|
||||
variants: 'BTreeMap<InkDiscriminant, InkLayoutStruct>'
|
||||
},
|
||||
InkLayoutHash: {
|
||||
offset: 'InkLayoutKey',
|
||||
strategy: 'InkLayoutHashingStrategy',
|
||||
layout: 'InkStorageLayout'
|
||||
},
|
||||
InkLayoutHashingStrategy: {
|
||||
hasher: 'InkCryptoHasher',
|
||||
postfix: 'Vec<u8>',
|
||||
prefix: 'Vec<u8>'
|
||||
},
|
||||
InkLayoutKey: '[u8; 32]',
|
||||
InkLayoutStruct: {
|
||||
fields: 'Vec<InkLayoutStructField>'
|
||||
},
|
||||
InkLayoutStructField: {
|
||||
layout: 'InkStorageLayout',
|
||||
name: 'Text'
|
||||
},
|
||||
InkStorageLayout: {
|
||||
_enum: {
|
||||
Cell: 'InkLayoutCell',
|
||||
Hash: 'InkLayoutHash',
|
||||
Array: 'InkLayoutArray',
|
||||
Struct: 'InkLayoutStruct',
|
||||
Enum: 'InkLayoutEnum'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const spec = {
|
||||
InkConstructorSpec: {
|
||||
name: 'Text',
|
||||
selector: 'InkSelector',
|
||||
args: 'Vec<InkMessageParamSpec>',
|
||||
docs: 'Vec<Text>'
|
||||
},
|
||||
InkContractSpec: {
|
||||
constructors: 'Vec<InkConstructorSpec>',
|
||||
messages: 'Vec<InkMessageSpec>',
|
||||
events: 'Vec<InkEventSpec>',
|
||||
docs: 'Vec<Text>'
|
||||
},
|
||||
InkDisplayName: 'MtPath',
|
||||
InkEventParamSpec: {
|
||||
name: 'Text',
|
||||
indexed: 'bool',
|
||||
type: 'InkTypeSpec',
|
||||
docs: 'Vec<Text>'
|
||||
},
|
||||
InkEventSpec: {
|
||||
name: 'Text',
|
||||
args: 'Vec<InkEventParamSpec>',
|
||||
docs: 'Vec<Text>'
|
||||
},
|
||||
InkMessageParamSpec: {
|
||||
name: 'Text',
|
||||
type: 'InkTypeSpec'
|
||||
},
|
||||
InkMessageSpec: {
|
||||
name: 'Text',
|
||||
selector: 'InkSelector',
|
||||
mutates: 'bool',
|
||||
payable: 'bool',
|
||||
args: 'Vec<InkMessageParamSpec>',
|
||||
returnType: 'Option<InkTypeSpec>',
|
||||
docs: 'Vec<Text>'
|
||||
},
|
||||
InkSelector: '[u8; 4]',
|
||||
InkTypeSpec: {
|
||||
type: 'MtLookupTypeId',
|
||||
displayName: 'InkDisplayName'
|
||||
}
|
||||
};
|
||||
|
||||
const registry = {
|
||||
MtField: {
|
||||
name: 'Option<Text>',
|
||||
type: 'MtLookupTypeId'
|
||||
},
|
||||
MtLookupTypeId: 'u32',
|
||||
MtPath: 'Vec<Text>',
|
||||
MtType: {
|
||||
def: 'MtTypeDef',
|
||||
params: 'Vec<MtLookupTypeId>',
|
||||
path: 'MtPath'
|
||||
},
|
||||
MtTypeDef: {
|
||||
_enum: {
|
||||
Array: 'MtTypeDefArray',
|
||||
Composite: 'MtTypeDefComposite',
|
||||
Primitive: 'MtTypeDefPrimitive',
|
||||
Sequence: 'MtTypeDefSequence',
|
||||
Tuple: 'MtTypeDefTuple',
|
||||
Variant: 'MtTypeDefVariant'
|
||||
}
|
||||
},
|
||||
MtTypeDefArray: {
|
||||
len: 'u16',
|
||||
type: 'MtLookupTypeId'
|
||||
},
|
||||
MtTypeDefComposite: {
|
||||
fields: 'Vec<MtField>'
|
||||
},
|
||||
MtTypeDefPrimitive: {
|
||||
// this enum definition is mapped in api-contracts/inkTypes.ts
|
||||
_enum: ['Bool', 'Char', 'Str', 'U8', 'U16', 'U32', 'U64', 'U128', 'I8', 'I16', 'I32', 'I64', 'I128']
|
||||
},
|
||||
MtTypeDefSequence: {
|
||||
type: 'MtLookupTypeId'
|
||||
},
|
||||
MtTypeDefTuple: 'Vec<MtLookupTypeId>',
|
||||
MtTypeDefVariant: {
|
||||
variants: 'Vec<MtVariant>'
|
||||
},
|
||||
MtVariant: {
|
||||
discriminant: 'Option<u64>',
|
||||
fields: 'Vec<MtField>',
|
||||
name: 'Text'
|
||||
}
|
||||
};
|
||||
|
||||
export default {
|
||||
rpc: {},
|
||||
types: {
|
||||
...layout,
|
||||
...registry,
|
||||
...spec,
|
||||
InkContractContract: {
|
||||
name: 'Text',
|
||||
version: 'Text',
|
||||
authors: 'Vec<Text>',
|
||||
description: 'Option<Text>',
|
||||
documentation: 'Option<Text>',
|
||||
repository: 'Option<Text>',
|
||||
homepage: 'Option<Text>',
|
||||
license: 'Option<Text>'
|
||||
},
|
||||
InkContractSource: {
|
||||
hash: '[u8; 32]',
|
||||
language: 'Text',
|
||||
compiler: 'Text'
|
||||
},
|
||||
InkProject: {
|
||||
metadataVersion: 'Text',
|
||||
source: 'InkContractSource',
|
||||
contract: 'InkContractContract',
|
||||
spec: 'InkContractSpec',
|
||||
storage: 'InkStorageLayout',
|
||||
types: 'Vec<MtType>'
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
|
||||
/* eslint-disable */
|
||||
|
||||
export * from './types';
|
||||
@@ -0,0 +1,253 @@
|
||||
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
|
||||
/* eslint-disable */
|
||||
|
||||
import { BTreeMap, Enum, Option, Struct, U8aFixed, Vec } from '@polkadot/types/codec';
|
||||
import { Bytes, Text, bool, u16, u32, u64, usize } from '@polkadot/types/primitive';
|
||||
|
||||
/** @name InkConstructorSpec */
|
||||
export interface InkConstructorSpec extends Struct {
|
||||
readonly name: Text;
|
||||
readonly selector: InkSelector;
|
||||
readonly args: Vec<InkMessageParamSpec>;
|
||||
readonly docs: Vec<Text>;
|
||||
}
|
||||
|
||||
/** @name InkContractContract */
|
||||
export interface InkContractContract extends Struct {
|
||||
readonly authors: Vec<Text>;
|
||||
readonly name: Text;
|
||||
readonly version: Text;
|
||||
}
|
||||
|
||||
/** @name InkContractSource */
|
||||
export interface InkContractSource extends Struct {
|
||||
readonly compiler: Text;
|
||||
readonly hash: U8aFixed;
|
||||
readonly language: Text;
|
||||
}
|
||||
|
||||
/** @name InkContractSpec */
|
||||
export interface InkContractSpec extends Struct {
|
||||
readonly constructors: Vec<InkConstructorSpec>;
|
||||
readonly messages: Vec<InkMessageSpec>;
|
||||
readonly events: Vec<InkEventSpec>;
|
||||
readonly docs: Vec<Text>;
|
||||
}
|
||||
|
||||
/** @name InkCryptoHasher */
|
||||
export interface InkCryptoHasher extends Enum {
|
||||
readonly isBlake2X256: boolean;
|
||||
readonly isSha2X256: boolean;
|
||||
readonly isKeccak256: boolean;
|
||||
}
|
||||
|
||||
/** @name InkDiscriminant */
|
||||
export interface InkDiscriminant extends usize {}
|
||||
|
||||
/** @name InkDisplayName */
|
||||
export interface InkDisplayName extends InkPath {}
|
||||
|
||||
/** @name InkEventParamSpec */
|
||||
export interface InkEventParamSpec extends Struct {
|
||||
readonly name: Text;
|
||||
readonly indexed: bool;
|
||||
readonly type: InkTypeSpec;
|
||||
readonly docs: Vec<Text>;
|
||||
}
|
||||
|
||||
/** @name InkEventSpec */
|
||||
export interface InkEventSpec extends Struct {
|
||||
readonly name: Text;
|
||||
readonly args: Vec<InkEventParamSpec>;
|
||||
readonly docs: Vec<Text>;
|
||||
}
|
||||
|
||||
/** @name InkLayoutArray */
|
||||
export interface InkLayoutArray extends Struct {
|
||||
readonly offset: InkLayoutKey;
|
||||
readonly len: u32;
|
||||
readonly cellsPerElem: u64;
|
||||
readonly layout: InkStorageLayout;
|
||||
}
|
||||
|
||||
/** @name InkLayoutCell */
|
||||
export interface InkLayoutCell extends Struct {
|
||||
readonly key: InkLayoutKey;
|
||||
readonly ty: MtLookupTypeId;
|
||||
}
|
||||
|
||||
/** @name InkLayoutEnum */
|
||||
export interface InkLayoutEnum extends Struct {
|
||||
readonly dispatchKey: InkLayoutKey;
|
||||
readonly variants: BTreeMap<InkDiscriminant, InkLayoutStruct>;
|
||||
}
|
||||
|
||||
/** @name InkLayoutHash */
|
||||
export interface InkLayoutHash extends Struct {
|
||||
readonly offset: InkLayoutKey;
|
||||
readonly strategy: InkLayoutHashingStrategy;
|
||||
readonly layout: InkStorageLayout;
|
||||
}
|
||||
|
||||
/** @name InkLayoutHashingStrategy */
|
||||
export interface InkLayoutHashingStrategy extends Struct {
|
||||
readonly hasher: InkCryptoHasher;
|
||||
readonly postfix: Bytes;
|
||||
readonly prefix: Bytes;
|
||||
}
|
||||
|
||||
/** @name InkLayoutKey */
|
||||
export interface InkLayoutKey extends U8aFixed {}
|
||||
|
||||
/** @name InkLayoutStruct */
|
||||
export interface InkLayoutStruct extends Struct {
|
||||
readonly fields: Vec<InkLayoutStructField>;
|
||||
}
|
||||
|
||||
/** @name InkLayoutStructField */
|
||||
export interface InkLayoutStructField extends Struct {
|
||||
readonly layout: InkStorageLayout;
|
||||
readonly name: Text;
|
||||
}
|
||||
|
||||
/** @name InkMessageParamSpec */
|
||||
export interface InkMessageParamSpec extends Struct {
|
||||
readonly name: Text;
|
||||
readonly type: InkTypeSpec;
|
||||
}
|
||||
|
||||
/** @name InkMessageSpec */
|
||||
export interface InkMessageSpec extends Struct {
|
||||
readonly name: Text;
|
||||
readonly selector: InkSelector;
|
||||
readonly mutates: bool;
|
||||
readonly payable: bool;
|
||||
readonly args: Vec<InkMessageParamSpec>;
|
||||
readonly returnType: Option<InkTypeSpec>;
|
||||
readonly docs: Vec<Text>;
|
||||
}
|
||||
|
||||
/** @name InkPath */
|
||||
export interface InkPath extends Vec<Text> {}
|
||||
|
||||
/** @name InkProject */
|
||||
export interface InkProject extends Struct {
|
||||
readonly contract: InkContractContract;
|
||||
readonly metadata_version: Text;
|
||||
readonly source: InkContractSource;
|
||||
readonly spec: InkContractSpec;
|
||||
readonly storage: InkStorageLayout;
|
||||
readonly types: Vec<MtType>;
|
||||
}
|
||||
|
||||
/** @name InkSelector */
|
||||
export interface InkSelector extends U8aFixed {}
|
||||
|
||||
/** @name InkStorageLayout */
|
||||
export interface InkStorageLayout extends Enum {
|
||||
readonly isCell: boolean;
|
||||
readonly asCell: InkLayoutCell;
|
||||
readonly isHash: boolean;
|
||||
readonly asHash: InkLayoutHash;
|
||||
readonly isArray: boolean;
|
||||
readonly asArray: InkLayoutArray;
|
||||
readonly isStruct: boolean;
|
||||
readonly asStruct: InkLayoutStruct;
|
||||
readonly isEnum: boolean;
|
||||
readonly asEnum: InkLayoutEnum;
|
||||
}
|
||||
|
||||
/** @name InkTypeSpec */
|
||||
export interface InkTypeSpec extends Struct {
|
||||
readonly type: MtLookupTypeId;
|
||||
readonly displayName: InkDisplayName;
|
||||
}
|
||||
|
||||
/** @name MtField */
|
||||
export interface MtField extends Struct {
|
||||
readonly name: Option<Text>;
|
||||
readonly type: MtLookupTypeId;
|
||||
}
|
||||
|
||||
/** @name MtLookupTypeId */
|
||||
export interface MtLookupTypeId extends u32 {}
|
||||
|
||||
/** @name MtType */
|
||||
export interface MtType extends Struct {
|
||||
readonly def: MtTypeDef;
|
||||
readonly params: Vec<MtLookupTypeId>;
|
||||
readonly path: Vec<Text>;
|
||||
}
|
||||
|
||||
/** @name MtTypeDef */
|
||||
export interface MtTypeDef extends Enum {
|
||||
readonly isArray: boolean;
|
||||
readonly asArray: MtTypeDefArray;
|
||||
readonly isComposite: boolean;
|
||||
readonly asComposite: MtTypeDefComposite;
|
||||
readonly isPrimitive: boolean;
|
||||
readonly asPrimitive: MtTypeDefPrimitive;
|
||||
readonly isSequence: boolean;
|
||||
readonly asSequence: MtTypeDefSequence;
|
||||
readonly isSlice: boolean;
|
||||
readonly asSlice: MtTypeDefSlice;
|
||||
readonly isTuple: boolean;
|
||||
readonly asTuple: MtTypeDefTuple;
|
||||
readonly isVariant: boolean;
|
||||
readonly asVariant: MtTypeDefVariant;
|
||||
}
|
||||
|
||||
/** @name MtTypeDefArray */
|
||||
export interface MtTypeDefArray extends Struct {
|
||||
readonly len: u16;
|
||||
readonly type: MtLookupTypeId;
|
||||
}
|
||||
|
||||
/** @name MtTypeDefComposite */
|
||||
export interface MtTypeDefComposite extends Struct {
|
||||
readonly fields: Vec<MtField>;
|
||||
}
|
||||
|
||||
/** @name MtTypeDefPrimitive */
|
||||
export interface MtTypeDefPrimitive extends Enum {
|
||||
readonly isBool: boolean;
|
||||
readonly isChar: boolean;
|
||||
readonly isStr: boolean;
|
||||
readonly isU8: boolean;
|
||||
readonly isU16: boolean;
|
||||
readonly isU32: boolean;
|
||||
readonly isU64: boolean;
|
||||
readonly isU128: boolean;
|
||||
readonly isI8: boolean;
|
||||
readonly isI16: boolean;
|
||||
readonly isI32: boolean;
|
||||
readonly isI64: boolean;
|
||||
readonly isI128: boolean;
|
||||
}
|
||||
|
||||
/** @name MtTypeDefSequence */
|
||||
export interface MtTypeDefSequence extends Struct {
|
||||
readonly type: MtLookupTypeId;
|
||||
}
|
||||
|
||||
/** @name MtTypeDefSlice */
|
||||
export interface MtTypeDefSlice extends Struct {
|
||||
readonly type: MtLookupTypeId;
|
||||
}
|
||||
|
||||
/** @name MtTypeDefTuple */
|
||||
export interface MtTypeDefTuple extends Vec<MtLookupTypeId> {}
|
||||
|
||||
/** @name MtTypeDefVariant */
|
||||
export interface MtTypeDefVariant extends Struct {
|
||||
readonly variants: Vec<MtVariant>;
|
||||
}
|
||||
|
||||
/** @name MtVariant */
|
||||
export interface MtVariant extends Struct {
|
||||
readonly discriminant: Option<u64>;
|
||||
readonly fields: Vec<MtField>;
|
||||
readonly name: Text;
|
||||
}
|
||||
|
||||
export type PHANTOM_CONTRACTSABI = 'contractsAbi';
|
||||
@@ -12,6 +12,7 @@ export { default as balances } from './balances/definitions';
|
||||
export { default as collective } from './collective/definitions';
|
||||
export { default as consensus } from './consensus/definitions';
|
||||
export { default as contracts } from './contracts/definitions';
|
||||
export { default as contractsAbi } from './contractsAbi/definitions';
|
||||
export { default as democracy } from './democracy/definitions';
|
||||
export { default as elections } from './elections/definitions';
|
||||
export { default as engine } from './engine/definitions';
|
||||
|
||||
@@ -9,6 +9,7 @@ export * from './balances/types';
|
||||
export * from './collective/types';
|
||||
export * from './consensus/types';
|
||||
export * from './contracts/types';
|
||||
export * from './contractsAbi/types';
|
||||
export * from './democracy/types';
|
||||
export * from './elections/types';
|
||||
export * from './engine/types';
|
||||
|
||||
Reference in New Issue
Block a user