Updated ABI definitions & parsing (#1662)

* 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

* Adjust ContractAbi interface (empty rpc)

* linting

* Pull in Andrew's changes

* Cleanups

* Some more cleanups

* Update with v3 contracts

* Adjust with actual types

* Regenerate

* Update ABI parsing (#2695)

* Adjust ABI code

* Cleanup

* Merge non-code

* Type naming

* Simplify Base

* Rename 1

* rename 2

* Rename 3

* Simplify

* Add index to AbiMessage

* Pass actual message or index for call

* Rename param

* Simplify

* Expose call & exec

* s/call/read/

* Cleanup asserts

* AccountId as per spec

* displayName is path

* Update definitions

* Flatten ABIType into TypeDef

* Rewrite

* Fix tests

* Updates

Co-authored-by: Andrew Jones <ascjones@gmail.com>
This commit is contained in:
Jaco Greeff
2020-10-09 18:33:31 +02:00
committed by GitHub
co-authored by Andrew Jones
parent 89e0548092
commit 453dd9e49a
61 changed files with 6978 additions and 11163 deletions
+81 -12
View File
@@ -3,23 +3,92 @@
import { TypeRegistry } from '@polkadot/types';
import incrementerAbi from '../test/contracts/incrementer.json';
import { Abi } from '.';
import Abi from './Abi';
import * as testContracts from '../test/contracts';
const abis: Record<string, any> = { ...testContracts };
function compare (name: string, registry: TypeRegistry, messageIds: string[]): void {
try {
const inkAbi = new Abi(registry, abis[name]);
expect(inkAbi.messages.map(({ identifier }) => identifier)).toEqual(messageIds);
} catch (error) {
console.error(error);
throw error;
}
}
describe('Abi', (): void => {
const registry = new TypeRegistry();
describe('construction', (): void => {
const registry = new TypeRegistry();
describe('incrementer', (): void => {
let abi: Abi;
beforeEach((): void => {
abi = new Abi(registry, incrementerAbi);
it('initializes from a contract ABI (flipper)', (): void => {
compare('flipper', registry, ['flip', 'get']);
});
it('has the attached methods', (): void => {
expect(Object.values(abi.abi.contract.messages).map(({ name }): string => name)).toEqual(
['inc', 'get', 'compare']
);
it('initializes from a contract ABI (incrementer)', (): void => {
compare('incrementer', registry, ['inc', 'get']);
});
it('initializes from a contract ABI (erc20)', (): void => {
compare('erc20', registry, [
'total_supply',
'balance_of',
'allowance',
'transfer',
'approve',
'transfer_from'
]);
});
it('initializes from a contract ABI (delegator)', (): void => {
compare('delegator', registry, [
'get',
'change',
'switch'
]);
});
it('initializes from a contract ABI (dns)', (): void => {
compare('dns', registry, [
'register',
'set_address',
'transfer',
'get_address'
]);
});
it('initializes from a contract ABI (erc721)', (): void => {
compare('erc721', registry, [
'balance_of',
'owner_of',
'get_approved',
'is_approved_for_all',
'set_approval_for_all',
'approve',
'transfer',
'transfer_from',
'mint',
'burn'
]);
});
it('initializes from a contract ABI (multisig_plain)', (): void => {
compare('multisigPlain', registry, [
'add_owner',
'remove_owner',
'replace_owner',
'change_requirement',
'submit_transaction',
'cancel_transaction',
'confirm_transaction',
'revoke_confirmation',
'invoke_transaction',
'eval_transaction'
]);
});
});
});
+76 -29
View File
@@ -1,47 +1,94 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Registry } from '@polkadot/types/types';
import { AbiConstructors, AbiMessages, ContractABI, ContractABIPre, ContractABIFn, InterfaceAbi } from './types';
import { AnyJson, CodecArg, Constructor, Registry } from '@polkadot/types/types';
import { InkConstructorSpec, InkMessageSpec } from '@polkadot/types/interfaces';
import { AbiConstructor, AbiMessage, AbiMessageParam } from './types';
import { stringCamelCase } from '@polkadot/util';
import { Compact, createClass, encodeTypeDef } from '@polkadot/types';
import { assert, isObject, isUndefined, stringCamelCase } from '@polkadot/util';
import ContractRegistry from './ContractRegistry';
export default class ContractAbi extends ContractRegistry implements InterfaceAbi {
public readonly abi: ContractABI;
function createArgClass (registry: Registry, args: AbiMessageParam[], baseDef: Record<string, string>): Constructor {
return createClass(
registry,
JSON.stringify(
args.reduce((base: Record<string, any>, { name, type }): Record<string, any> => {
base[name] = type.displayName || encodeTypeDef(type);
public readonly constructors: AbiConstructors;
return base;
}, baseDef)
)
);
}
public readonly messages: AbiMessages;
function extendBase (fn: AbiMessage, add: Partial<AbiMessage> = {}): AbiMessage {
return Object.entries(add).reduce((fn: AbiMessage, [key, value]): AbiMessage => {
// do some magic
fn[key as 'args'] = value as AbiMessageParam[];
constructor (registry: Registry, abi: ContractABIPre) {
super(registry, abi);
[this.abi, this.constructors, this.messages] = this._decodeAbi(abi);
return fn;
}, fn);
}
export default class Abi extends ContractRegistry {
public readonly constructors: AbiConstructor[];
public readonly messages: AbiMessage[];
constructor (registry: Registry, json: AnyJson) {
super(registry, json);
this.constructors = this.project.spec.constructors.map((spec: InkConstructorSpec, index) =>
this._createBase(spec, {
index,
isConstructor: true
})
);
this.messages = this.project.spec.messages.map((spec: InkMessageSpec, index): AbiMessage => {
const typeSpec = spec.returnType.unwrapOr(null);
return this._createBase(spec, {
index,
isMutating: spec.mutates.isTrue,
isPayable: spec.payable.isTrue,
returnType: typeSpec
? this.typeDefAt(typeSpec.id, { displayName: typeSpec.displayName.map((s) => s.toString()).join('::') || undefined })
: null
});
});
}
private _decodeAbi (abiPre: ContractABIPre): [ContractABI, ContractABIFn[], AbiMessages] {
this.validateAbi(abiPre);
private _createBase (spec: InkMessageSpec | InkConstructorSpec, add: Partial<AbiMessage> = {}): AbiMessage {
const identifier = spec.name.toString();
const args = spec.args.map(({ name, type }): AbiMessageParam => {
assert(isObject(type), `Invalid type at index ${type.toString()}`);
const abi = this.convertAbi(abiPre);
const constructors = abi.contract.constructors.map(
(constructor, index): ContractABIFn => {
return this.createMessage(`constructor ${index}`, constructor);
}
);
return {
name: stringCamelCase(name.toString()),
type: this.typeDefAt(type.id)
};
});
const messages: AbiMessages = abi.contract.messages.reduce(
(result: AbiMessages, message): AbiMessages => {
const name = stringCamelCase(message.name);
const Clazz = createArgClass(this.registry, args, isUndefined(spec.selector) ? {} : { __selector: 'u32' });
const baseStruct: { [index: string]: any } = { __selector: this.registry.createType('u32', spec.selector) };
return {
...result,
[name]: this.createMessage(`messages.${name}`, message)
};
},
{}
);
const fn = ((...params: CodecArg[]): Uint8Array => {
assert(params.length === args.length, `Expected ${args.length} arguments to contract message '${identifier}', found ${params.length}`);
return [abi, constructors, messages];
return Compact.addLengthPrefix(new Clazz(this.registry, args.reduce((mapped, { name }, index): Record<string, CodecArg> => {
mapped[name] = params[index];
return mapped;
}, { ...baseStruct })).toU8a());
}) as AbiMessage;
return extendBase(fn, {
...add,
args,
docs: spec.docs.map((doc) => doc.toString()),
identifier
});
}
}
@@ -0,0 +1,68 @@
// Copyright 2017-2020 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0
/* eslint-disable @typescript-eslint/no-var-requires */
import fs from 'fs';
import path from 'path';
import { TypeRegistry } from '@polkadot/types';
import ContractRegistry from './ContractRegistry';
import * as testContracts from '../test/contracts';
const abis: Record<string, any> = { ...testContracts };
function compare (name: string, registry: TypeRegistry): void {
const inkRegistry = new ContractRegistry(registry, abis[name]);
try {
const cmpPath = path.join(__dirname, `../test/compare/${name}.test.json`);
if (!fs.existsSync(cmpPath)) {
fs.writeFileSync(cmpPath, JSON.stringify(inkRegistry.typeDefs, null, 2), { flag: 'w' });
}
expect(inkRegistry.typeDefs).toEqual(require(cmpPath));
} catch (error) {
console.error(JSON.stringify(inkRegistry.typeDefs));
throw error;
}
}
describe('ContractRegistry', (): void => {
describe('construction', (): void => {
const registry = new TypeRegistry();
it('initializes from a contract ABI (flipper)', (): void => {
compare('flipper', registry);
});
it('initializes from a contract ABI (incrementer)', (): void => {
compare('incrementer', registry);
});
it('initializes from a contract ABI (erc20)', (): void => {
compare('erc20', registry);
});
it('initializes from a contract ABI (dns)', (): void => {
compare('dns', registry);
});
it('initializes from a contract ABI (erc721)', (): void => {
compare('erc721', registry);
});
it('initializes from a contract ABI (multisig_plain)', (): void => {
compare('multisigPlain', registry);
});
it('stores base project as JSON', (): void => {
const inkRegistry = new ContractRegistry(registry, abis.dns);
expect(inkRegistry.json).toEqual(abis.dns);
});
});
});
+178 -187
View File
@@ -1,227 +1,218 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { CodecArg, Constructor, Registry, TypeDef } from '@polkadot/types/types';
import { ContractABIArgBasePre, ContractABIContract, ContractABIContractPre, ContractABIEvent, ContractABIEventPre, ContractABIFn, ContractABIFnArg, ContractABIMessage, ContractABIMessageBase, ContractABIMessagePre, ContractABI, ContractABIMessageCommon, ContractABIPre, ContractABIRange, ContractABIRangePre, ContractABIStorage, ContractABIStorageLayout, ContractABIStorageLayoutPre, ContractABIStoragePre, ContractABIStorageStruct, ContractABIStorageStructPre, ContractABITypePre } from './types';
import { InkProject, MtField, MtLookupTypeId, MtType, MtTypeDefArray, MtTypeDefVariant, MtTypeDefSequence, MtTypeDefTuple, MtVariant } from '@polkadot/types/interfaces';
import { AnyJson, Registry, TypeDef, TypeDefInfo } from '@polkadot/types/types';
import { Compact, u32, createClass, encodeTypeDef } from '@polkadot/types';
import { assert, hexToU8a, isNumber, isString, isNull, isObject, isUndefined, stringCamelCase, isHex, hexToNumber } from '@polkadot/util';
import { assert, isObject, isUndefined } from '@polkadot/util';
import { withTypeString } from '@polkadot/types';
import MetaRegistry from './MetaRegistry';
// convert the offset into project-specific, index-1
export function getRegistryOffset (id: MtLookupTypeId): number {
return id.toNumber() - 1;
}
// parse a selector, this can be a number (older) or of [<hex>, <hex>, ...]. However,
// just catch everything (since this is now non-standard for u32 anyway)
function parseSelector (registry: Registry, fnname: string, input: ContractABIMessageCommon['selector']): u32 {
if (isNumber(input)) {
return registry.createType('u32', input);
} else if (isHex(input)) {
return registry.createType('u32', hexToU8a(input));
} else if (typeof input === 'string') {
try {
const array = JSON.parse(input) as unknown[];
export default class ContractRegistry {
public typeDefs: TypeDef[] = [];
assert(array.length === 4, `${fnname}: Invalid selector length`);
public registry: Registry;
return registry.createType('u32', Uint8Array.from(
// the as number[] is here to pacify TS, it doesn't quite know how to handle the cb
(array as number[]).map((value: string | number): number =>
isHex(value)
? hexToNumber(value.toString())
: value
)
));
} catch (e) {
console.error(e);
public project: InkProject;
public json: AnyJson;
constructor (registry: Registry, json: AnyJson) {
assert(isObject(json) && !Array.isArray(json) && json.metadataVersion && isObject(json.spec) && !Array.isArray(json.spec) && Array.isArray(json.spec.constructors) && Array.isArray(json.spec.messages), 'Invalid JSON ABI structure supplied, expected a recent metadata version');
this.registry = registry;
this.json = json;
this.project = registry.createType('InkProject', json);
// Generate TypeDefs for each provided registry type
this.project.types.forEach((_, index) => this.setTypeDef(this.registry.createType('MtLookupTypeId', index + 1)));
}
public getAbiType (id: MtLookupTypeId): MtType {
const offset = getRegistryOffset(id);
const type = this.project.types[offset];
assert(!isUndefined(type), `getAbiType:: Unable to find ${id.toNumber()} in type values`);
return this.registry.createType('MtType', type);
}
public typeDefAt (id: MtLookupTypeId, extra: Pick<TypeDef, never> = {}): TypeDef {
if (!this.typeDefs[getRegistryOffset(id)]) {
this.setTypeDef(id);
}
return {
...this.typeDefs[getRegistryOffset(id)],
...extra
};
}
throw new Error(`${fnname}: Unable to parse selector`);
}
public setTypeDef (id: MtLookupTypeId): void {
this.typeDefs[getRegistryOffset(id)] = this.extractType(this.getAbiType(id), id) as TypeDef;
}
function createArgClass (registry: Registry, args: ContractABIFnArg[], baseDef: Record<string, string>): Constructor {
return createClass(
registry,
JSON.stringify(
args.reduce((base: Record<string, any>, { name, type }): Record<string, any> => {
base[name] = type.displayName || encodeTypeDef(type);
private extractType (inkType: MtType, id: MtLookupTypeId): Pick<TypeDef, never> {
const path = [...inkType.path];
let typeDef;
return base;
}, baseDef)
)
);
}
if (inkType.path.join('::').startsWith('ink_env::types::') || inkType.def.isPrimitive) {
typeDef = this.extractPrimitive(inkType);
} else if (inkType.def.isComposite) {
typeDef = this.extractFields(inkType.def.asComposite.fields);
} else if (inkType.def.isVariant) {
typeDef = this.extractVariant(inkType.def.asVariant, id);
} else if (inkType.def.isArray) {
typeDef = this.extractArray(inkType.def.asArray);
} else if (inkType.def.isSequence) {
typeDef = this.extractSequence(inkType.def.asSequence, id);
} else if (inkType.def.isTuple) {
typeDef = this.extractTuple(inkType.def.asTuple);
} else {
throw new Error(`Invalid ink! type at index ${id.toString()}`);
}
export default class ContractRegistry extends MetaRegistry {
// Contract ABI helpers
public validateArgs (name: string, args: ContractABIArgBasePre[]): void {
assert(Array.isArray(args), `Expected 'args' to exist on ${name}`);
const displayName = path.pop()?.toString();
args.forEach((arg): void => {
const unknownKeys = Object.keys(arg).filter((key): boolean => !['name', 'type'].includes(key));
assert(unknownKeys.length === 0, `Unknown keys ${unknownKeys.join(', ')} found in ABI args for ${name}`);
assert(isNumber(arg.name) && isString(this._stringAt(arg.name)), `${name} args should have valid name `);
assert(isNumber(arg.type.ty) && isObject(this.typeDefAt(arg.type.ty)), `${name} args should have valid type`);
return withTypeString({
...(displayName
? { displayName }
: {}
),
...(path.length > 1
? { namespace: path.map((segment) => segment.toString()).join('::') }
: {}
),
...(inkType.params.length > 0
? { params: inkType.params.map((id) => this.typeDefAt(id)) }
: {}
),
...typeDef
});
}
public validateConstructors ({ contract: { constructors } }: ContractABIPre): void {
constructors.forEach((constructor: ContractABIMessagePre, index): void => {
const unknownKeys = Object.keys(constructor).filter((key): boolean => !['args', 'docs', 'name', 'selector'].includes(key));
assert(unknownKeys.length === 0, `Unknown keys ${unknownKeys.join(', ')} found in ABI constructor`);
this.validateArgs(`constructor ${index}`, constructor.args);
});
}
public validateMessages ({ contract: { messages } }: ContractABIPre): void {
messages.forEach((message): void => {
const unknownKeys = Object.keys(message).filter((key): boolean => !['args', 'docs', 'mutates', 'name', 'selector', 'return_type'].includes(key));
const fnname = `messages.${message.name}`;
assert(unknownKeys.length === 0, `Unknown keys ${unknownKeys.join(', ')} found in ABI args for messages.${message.name}`);
const { name, return_type: returnType, selector } = message;
assert(isNumber(name) && isString(this._stringAt(name)), `Expected name for ${fnname}`);
assert(isNull(returnType) || (isNumber(returnType.ty) && isObject(this.typeDefAt(returnType.ty))), `Expected return_type for ${fnname}`);
parseSelector(this.registry, fnname, selector);
this.validateArgs(fnname, message.args);
});
}
public validateAbi (abi: ContractABIPre): void {
const unknownKeys = Object.keys(abi.contract).filter((key): boolean => !['constructors', 'docs', 'events', 'messages', 'name'].includes(key));
assert(unknownKeys.length === 0, `Unknown fields ${unknownKeys.join(', ')} found in ABI`);
const { contract: { constructors, messages, name } } = abi;
assert(constructors && messages && isString(this._stringAt(name)), 'ABI should have constructors, messages & name sections');
this.validateConstructors(abi);
this.validateMessages(abi);
}
public createMessage (name: string, message: Partial<ContractABIMessage> & ContractABIMessageBase): ContractABIFn {
const args = message.args.map(({ name, type }): ContractABIFnArg => {
assert(isObject(type), `Invalid type at index ${type.toString()}`);
private extractVariant ({ variants }: MtTypeDefVariant, id: MtLookupTypeId): Pick<TypeDef, never> {
const { params, path } = this.getAbiType(id);
const specialVariant = path[0].toString();
if (specialVariant === 'Option') {
return {
name: stringCamelCase(name),
type
info: TypeDefInfo.Option,
sub: this.typeDefAt(params[0])
};
} else if (specialVariant === 'Result') {
return {
info: TypeDefInfo.Result,
sub: params.map((param, index) => ({
name: ['Ok', 'Error'][index],
...this.typeDefAt(param)
}))
};
}
return {
info: TypeDefInfo.Enum,
sub: this.extractVariantSub(variants)
};
}
private extractVariantSub (variants: MtVariant[]): Pick<TypeDef, any>[] {
const isAllUnitVariants = variants.every(({ fields }) => fields.length === 0);
if (isAllUnitVariants) {
return variants.map(({ discriminant, name }) => ({
...(
discriminant.isSome
? { ext: { discriminant: discriminant.unwrap().toNumber() } }
: {}
),
info: TypeDefInfo.Plain,
name: name.toString(),
type: 'Null'
}));
}
return variants.map(({ fields, name }) => ({
...this.extractFields(fields),
name: name.toString()
}));
}
private extractFields (fields: MtField[]): Pick<TypeDef, any> {
const [isStruct, isTuple] = fields.reduce(([isAllNamed, isAllUnnamed], { name }) => ([
isAllNamed && name.isSome,
isAllUnnamed && name.isNone
]),
[true, true]);
let info;
// check for tuple first (no fields may be available)
if (isTuple) {
info = TypeDefInfo.Tuple;
} else if (isStruct) {
info = TypeDefInfo.Struct;
} else {
throw new Error('Invalid fields type detected, expected either Tuple or Struct');
}
const sub = fields.map(({ name, type }) => {
return {
...this.typeDefAt(type),
...(name.isSome ? { name: name.unwrap().toString() } : {})
};
});
const Clazz = createArgClass(this.registry, args, isUndefined(message.selector) ? {} : { __selector: 'u32' });
const baseStruct: { [index: string]: any } = { __selector: isUndefined(message.selector) ? undefined : parseSelector(this.registry, name, message.selector) };
const encoder = (...params: CodecArg[]): Uint8Array => {
assert(params.length === args.length, `Expected ${args.length} arguments to contract ${name}, found ${params.length}`);
const u8a = new Clazz(
this.registry,
args.reduce((mapped, { name }, index): Record<string, CodecArg> => {
mapped[name] = params[index];
return mapped;
}, { ...baseStruct })
).toU8a();
return Compact.addLengthPrefix(u8a);
};
const fn = (encoder as ContractABIFn);
fn.args = args;
fn.isConstant = !(message.mutates || false);
fn.type = message.returnType || null;
return fn;
return isTuple && sub.length === 1
? sub[0]
: { info, sub };
}
public convertAbi ({ contract, storage }: ContractABIPre): ContractABI {
private extractArray ({ len: length, type }: MtTypeDefArray): Pick<TypeDef, never> {
assert(!length || length.toNumber() <= 256, 'ContractRegistry: Only support for [Type; <length>], where length > 256');
return {
contract: this.convertContract(contract),
storage: this.convertStorage(storage)
info: TypeDefInfo.VecFixed,
length: length.toNumber(),
sub: this.typeDefAt(type)
};
}
public convertArgs (args: ContractABIArgBasePre[]): any[] {
return args.map(({ name, type, ...arg }) => ({ ...arg, name: this._stringAt(name), type: this.convertType(type) }));
}
private extractSequence ({ type }: MtTypeDefSequence, id: MtLookupTypeId): Pick<TypeDef, never> {
assert(!!type, `ContractRegistry: Invalid sequence type found at id ${id.toString()}`);
public convertType ({ display_name: displayNameIndices, ty }: ContractABITypePre): TypeDef {
const displayName = this.stringsAt(displayNameIndices).join('::');
return this.typeDefAt(ty, { displayName });
}
public convertContract ({ constructors, events, messages, name, ...contract }: ContractABIContractPre): ContractABIContract {
return {
constructors: this.convertConstructors(constructors),
messages: messages.map((message) => this.convertMessage(message)),
name: this._stringAt(name),
...(events
? { events: events.map((event) => this.convertEvent(event)) }
: {}),
...contract
info: TypeDefInfo.Vec,
sub: this.typeDefAt(type)
};
}
public convertConstructors (constructors: ContractABIMessagePre[]): ContractABIMessage[] {
return constructors.map(
(constructor: ContractABIMessagePre): ContractABIMessage => {
return this.convertMessage(constructor);
}
);
private extractTuple (ids: MtTypeDefTuple): Pick<TypeDef, never> {
return ids.length === 1
? this.typeDefAt(ids[0])
: {
info: TypeDefInfo.Tuple,
sub: ids.map((id) => this.typeDefAt(id))
};
}
public convertMessage ({ args, name, return_type: returnType, ...message }: ContractABIMessagePre): ContractABIMessage {
return {
...message,
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
args: this.convertArgs(args),
name: this._stringAt(name),
returnType: returnType ? this.convertType(returnType) : null
};
}
public convertEvent ({ args }: ContractABIEventPre): ContractABIEvent {
return {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
args: this.convertArgs(args)
};
}
public convertStorage (storage: ContractABIStoragePre): ContractABIStorage {
return this.convertStorageStruct(storage);
}
public convertStorageLayout (storageLayout: ContractABIStorageLayoutPre): ContractABIStorageLayout {
if ((storageLayout as ContractABIStorageStructPre)['struct.type']) {
return this.convertStorageStruct(storageLayout as ContractABIStorageStructPre);
} else {
return this.convertStorageRange(storageLayout as ContractABIRangePre);
private extractPrimitive (inkType: MtType): Pick<TypeDef, never> {
if (inkType.def.isPrimitive) {
return {
info: TypeDefInfo.Plain,
type: inkType.def.asPrimitive.type.toLowerCase()
};
} else if (inkType.path.length > 1) {
return {
info: TypeDefInfo.Plain,
type: inkType.path[inkType.path.length - 1].toString()
};
}
}
public convertStorageStruct ({ 'struct.fields': structFields, 'struct.type': structType }: ContractABIStorageStructPre): ContractABIStorageStruct {
return {
'struct.fields': structFields.map(({ layout, name }) => ({
layout: this.convertStorageLayout(layout),
name: this._stringAt(name)
})),
'struct.type': this.typeDefAt(structType)
};
}
public convertStorageRange ({ 'range.elem_type': type, ...range }: ContractABIRangePre): ContractABIRange {
return {
...range,
'range.elem_type': this.typeDefAt(type)
};
throw new Error('Invalid primitive type');
}
}
-354
View File
@@ -1,354 +0,0 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { MetaRegistryItem, MetaRegistryJson, MetaTypeDefClikeEnum, MetaType, MetaTypeDefEnum, MetaTypeDefEnumVariant, MetaTypeDefEnumVariantStruct, MetaTypeDefEnumVariantTupleStruct, MetaTypeDefEnumVariantUnit, MetaTypeDefStruct, MetaTypeDefStructField, MetaTypeDefTupleStruct, MetaTypeDefUnion, MetaTypeIdCustom, MetaTypeIdVec, MetaTypeIdVecFixed, MetaTypeInfo, Registry, StringIndex, TypeDef, TypeDefInfo, TypeIndex } from '@polkadot/types/types';
import { assert } from '@polkadot/util';
import { encodeTypeDef, withTypeString } from '@polkadot/types';
const builtinMap: [(id: unknown | unknown[] | { 'array.type': unknown } | { 'slice.type': unknown }) => boolean, MetaTypeInfo][] = [
[(id: any) => typeof id === 'string', MetaTypeInfo.BuiltinPlain],
[(id: any) => Array.isArray(id), MetaTypeInfo.BuiltinTuple],
[(id: any) => !!((id as { 'array.type': unknown })['array.type']), MetaTypeInfo.BuiltinVecFixed],
[(id: any) => !!((id as { 'slice.type': unknown })['slice.type']), MetaTypeInfo.BuiltinVec]
];
const typeMap: [string, MetaTypeInfo][] = [
['enum.variants', MetaTypeInfo.Enum],
['clike_enum.variants', MetaTypeInfo.ClikeEnum],
['struct.fields', MetaTypeInfo.Struct],
['tuple_struct.types', MetaTypeInfo.TupleStruct]
];
function detectedType ({ def, id }: MetaType): MetaTypeInfo {
assert(!(def as MetaTypeDefUnion)['union.fields'], 'Invalid union type definition found');
const lookup = def === 'builtin'
? builtinMap.find(([test]) => test(id))
: typeMap.find(([test]) => !!(def as unknown as Record<string, unknown>)[test]);
return lookup
? lookup[1]
: MetaTypeInfo.Null;
}
class MetadataRegistryLookup {
public readonly registry: Registry;
protected _strings: string[] = [];
protected _types: MetaType[] = [];
public typeDefs: TypeDef[] = [];
constructor (registry: Registry, { registry: { strings, types } }: MetaRegistryJson) {
this.registry = registry;
this._strings = strings;
this._types = types;
}
protected _hasItemAt (index: number, variant: MetaRegistryItem): boolean {
switch (variant) {
case MetaRegistryItem.String:
return this._strings && !!this._strings[index - 1];
case MetaRegistryItem.Type:
return this._types && !!this._types[index - 1];
case MetaRegistryItem.TypeDef:
return this.typeDefs && !!this.typeDefs[index - 1];
}
}
protected _itemAt (index: number, variant: MetaRegistryItem): string | MetaType | TypeDef {
assert(this._hasItemAt(index, variant), `MetaRegistry: Invalid ${variant} index ${index} found in metadata`);
switch (variant) {
case MetaRegistryItem.String:
return this._strings[index - 1];
case MetaRegistryItem.Type:
return this._types[index - 1];
case MetaRegistryItem.TypeDef:
return this.typeDefs[index - 1];
}
}
protected _itemsAt (indices: number[], variant: MetaRegistryItem): (string | MetaType | TypeDef)[] {
return indices.map((index: number) => this._itemAt(index, variant));
}
protected _stringAt (index: StringIndex): string {
return this._itemAt(index, MetaRegistryItem.String) as string;
}
public stringsAt (indices: StringIndex[]): string[] {
return this._itemsAt(indices, MetaRegistryItem.String) as string[];
}
public typeAt (index: TypeIndex): MetaType {
return this._itemAt(index, MetaRegistryItem.Type) as MetaType;
}
public typesAt (indices: TypeIndex[]): MetaType[] {
return this._itemsAt(indices, MetaRegistryItem.Type) as MetaType[];
}
public hasTypeDefAt (index: TypeIndex): boolean {
return this._hasItemAt(index, MetaRegistryItem.TypeDef);
}
public typeDefAt (index: TypeIndex, extra: Pick<TypeDef, never> = {}): TypeDef {
return {
...this._itemAt(index, MetaRegistryItem.TypeDef) as TypeDef,
...extra
};
}
}
export default class MetaRegistry extends MetadataRegistryLookup {
constructor (registry: Registry, json: MetaRegistryJson) {
super(registry, json);
// Generate TypeDefs for each provided registry type
this._types.forEach((_, index: number): void => this.setTypeDefAtIndex(index + 1));
}
public setTypeDefAtIndex (typeIndex: TypeIndex): void {
this.typeDefs[typeIndex - 1] = this.typeDefFromMetaType(this.typeAt(typeIndex), typeIndex);
}
private _typeDefIdFields ({ id }: MetaType): Pick<TypeDef, never> {
const { 'custom.name': nameIndex, 'custom.namespace': namespaceIndices, 'custom.params': paramsIndices } = id as MetaTypeIdCustom;
if (!nameIndex) {
return {};
}
return {
name: this._stringAt(nameIndex),
...(namespaceIndices && namespaceIndices.length
? { namespace: this.stringsAt(namespaceIndices).join('::') }
: {}
),
...(paramsIndices && paramsIndices.length
? { params: this.typesAt(paramsIndices).map((type): TypeDef => this.typeDefFromMetaType(type)) }
: {}
)
};
}
private _typeDefDefFields (metaType: MetaType, typeIndex: TypeIndex = -1): Pick<TypeDef, never> {
let typeDef;
switch (detectedType(metaType)) {
case MetaTypeInfo.BuiltinPlain:
typeDef = this._typeDefForBuiltinPlain(metaType.id as string);
break;
case MetaTypeInfo.BuiltinTuple:
typeDef = this._typeDefForBuiltinTuple(metaType.id as TypeIndex[]);
break;
case MetaTypeInfo.BuiltinVec:
typeDef = this._typeDefForBuiltinVec(metaType.id as MetaTypeIdVec, typeIndex);
break;
case MetaTypeInfo.BuiltinVecFixed:
typeDef = this._typeDefForBuiltinVecFixed(metaType.id as MetaTypeIdVecFixed, typeIndex);
break;
case MetaTypeInfo.Enum:
typeDef = this._typeDefForEnum(metaType.def as MetaTypeDefEnum, metaType.id as MetaTypeIdCustom, typeIndex);
break;
case MetaTypeInfo.ClikeEnum:
typeDef = this._typeDefForClikeEnum(metaType.def as MetaTypeDefClikeEnum);
break;
case MetaTypeInfo.Struct:
typeDef = this.typeDefForStruct(metaType.def as MetaTypeDefStruct);
break;
case MetaTypeInfo.TupleStruct:
typeDef = this._typeDefForTupleStruct(metaType.def as MetaTypeDefTupleStruct);
break;
case MetaTypeInfo.Null:
default:
throw new Error(`Invalid type detected at index ${typeIndex}`);
}
return typeDef;
}
public typeDefFromMetaType (metaType: MetaType, typeIndex?: TypeIndex): TypeDef {
return withTypeString({
info: TypeDefInfo.Null,
type: '',
...this._typeDefDefFields(metaType, typeIndex),
...this._typeDefIdFields(metaType)
}) as TypeDef;
}
public typeDefFromMetaTypeAt (typeIndex: TypeIndex): TypeDef {
if (!this.hasTypeDefAt(typeIndex)) {
this.setTypeDefAtIndex(typeIndex);
}
return this.typeDefAt(typeIndex);
}
private _typeDefForEnumVariant (variant: MetaTypeDefEnumVariant): Pick<TypeDef, any> {
const { 'unit_variant.name': unitNameIndex } = variant as MetaTypeDefEnumVariantUnit;
if (unitNameIndex) {
return {
info: TypeDefInfo.Plain,
name: this._stringAt(unitNameIndex),
type: 'Null'
};
}
const { 'tuple_struct_variant.name': tupleStructVariantNameIndex } = variant as MetaTypeDefEnumVariantTupleStruct;
if (tupleStructVariantNameIndex) {
return this._typeDefForTupleStruct(variant as MetaTypeDefEnumVariantTupleStruct);
}
const { 'struct_variant.name': structVariantNameIndex } = variant as MetaTypeDefEnumVariantStruct;
if (structVariantNameIndex) {
return this.typeDefForStruct(variant as MetaTypeDefEnumVariantStruct);
}
return {
info: TypeDefInfo.Null,
type: 'Null'
};
}
private _typeDefForBuiltinPlain (id: string): Pick<TypeDef, never> {
return {
info: TypeDefInfo.Plain,
type: id
};
}
private _typeDefForBuiltinTuple (id: TypeIndex[]): Pick<TypeDef, never> {
const sub = id.map((tupleTypeIndex: number): TypeDef => this.typeDefFromMetaTypeAt(tupleTypeIndex));
return {
info: TypeDefInfo.Tuple,
sub
};
}
private _typeDefForBuiltinVec (id: MetaTypeIdVec, typeIndex: TypeIndex = -1): Pick<TypeDef, never> {
const { 'slice.type': vecTypeIndex } = id;
assert(!typeIndex || vecTypeIndex !== typeIndex, `MetaRegistry: self-referencing registry type at index ${typeIndex}`);
const type = encodeTypeDef(this.typeDefFromMetaTypeAt(vecTypeIndex));
assert(type && type.length > 0, `MetaRegistry: Invalid builtin Vec type found at index ${typeIndex}`);
return {
info: TypeDefInfo.Vec,
sub: this.typeDefFromMetaTypeAt(vecTypeIndex),
type: `Vec<${type}>`
};
}
private _typeDefForBuiltinVecFixed (id: MetaTypeIdVecFixed, typeIndex: TypeIndex = -1): Pick<TypeDef, never> {
const { 'array.len': vecLength, 'array.type': vecTypeIndex } = id;
assert(!vecLength || vecLength <= 256, 'MetaRegistry: Only support for [Type; <length>], where length <= 256');
assert(!typeIndex || vecTypeIndex !== typeIndex, `MetaRegistry: self-referencing registry type at index ${typeIndex}`);
const type = encodeTypeDef(this.typeDefFromMetaTypeAt(vecTypeIndex));
assert(type && type.length > 0, `MetaRegistry: Invalid vector type found at index ${typeIndex}`);
return {
info: TypeDefInfo.VecFixed,
length: vecLength, // ex: { type: type }
sub: this.typeDefFromMetaTypeAt(vecTypeIndex),
type: `[${type};${vecLength}]`
};
}
private _typeDefForEnum (def: MetaTypeDefEnum, id: MetaTypeIdCustom, typeIndex?: TypeIndex): Pick<TypeDef, any> {
const name = id && this._stringAt(id['custom.name']);
switch (name) {
case 'Option':
return this.typeDefForOption(id, typeIndex);
case 'Result':
return this.typeDefForResult(id, typeIndex);
default: {
const sub = def['enum.variants'].map((variant) => this._typeDefForEnumVariant(variant));
return {
info: TypeDefInfo.Enum,
sub
};
}
}
}
private _typeDefForClikeEnum (def: MetaTypeDefClikeEnum): Pick<TypeDef, never> {
return {
info: TypeDefInfo.Enum,
sub: def['clike_enum.variants'].map(({ discriminant, name: nameIndex }): TypeDef => ({
ext: { discriminant },
info: TypeDefInfo.Plain,
name: this._stringAt(nameIndex),
type: 'Null'
}))
};
}
public typeDefForOption (id: MetaTypeIdCustom, typeIndex: TypeIndex = -1): Pick<TypeDef, any> {
assert(id['custom.params'] && id['custom.params'][0], `Invalid Option type defined at index ${typeIndex}`);
return {
info: TypeDefInfo.Option,
sub: this.typeDefFromMetaTypeAt(id['custom.params']![0])
};
}
public typeDefForResult (id: MetaTypeIdCustom, typeIndex: TypeIndex = -1): Pick<TypeDef, any> {
assert(id['custom.params'] && id['custom.params'][0] && id['custom.params'][1], `Invalid Result type defined at index ${typeIndex}`);
return {
info: TypeDefInfo.Result,
sub: id['custom.params']!.map((typeIndex): TypeDef => this.typeDefFromMetaTypeAt(typeIndex))
};
}
public typeDefForStruct (def: MetaTypeDefStruct | MetaTypeDefEnumVariantStruct): Pick<TypeDef, any> {
const structFields = (def as MetaTypeDefStruct)['struct.fields'] || (def as MetaTypeDefEnumVariantStruct)['struct_variant.fields'];
const structNameIndex = (def as MetaTypeDefEnumVariantStruct)['struct_variant.name'];
return withTypeString({
info: TypeDefInfo.Struct,
...(structNameIndex
? { name: this._stringAt(structNameIndex) }
: {}
),
sub: structFields.map((field: MetaTypeDefStructField): TypeDef => ({
...this.typeDefFromMetaTypeAt(field.type),
name: this._stringAt(field.name)
}))
});
}
private _typeDefForTupleStruct (def: MetaTypeDefTupleStruct | MetaTypeDefEnumVariantTupleStruct): Pick<TypeDef, any> {
const tupleStructTypes = (def as MetaTypeDefTupleStruct)['tuple_struct.types'] || (def as MetaTypeDefEnumVariantTupleStruct)['tuple_struct_variant.types'];
const tupleStructNameIndex = (def as MetaTypeDefEnumVariantTupleStruct)['tuple_struct_variant.name'];
return withTypeString({
info: TypeDefInfo.Tuple,
...(tupleStructNameIndex
? { name: this._stringAt(tupleStructNameIndex) }
: {}
),
sub: tupleStructTypes.map((fieldIndex: number, index: number): TypeDef => ({
...this.typeDefFromMetaTypeAt(fieldIndex),
index
}))
});
}
}
+34
View File
@@ -0,0 +1,34 @@
// Copyright 2017-2020 @polkadot/api authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { ApiTypes, DecorateMethod, SubmittableModuleExtrinsics } from '@polkadot/api/types';
import { AnyJson, Registry } from '@polkadot/types/types';
import { ApiObject } from '../types';
import { assert } from '@polkadot/util';
import Abi from '../Abi';
export default abstract class Base<ApiType extends ApiTypes> {
public readonly abi: Abi;
public readonly api: ApiObject<ApiType>;
public readonly registry: Registry;
protected readonly _decorateMethod: DecorateMethod<ApiType>;
constructor (api: ApiObject<ApiType>, abi: AnyJson | Abi, decorateMethod: DecorateMethod<ApiType>) {
this.abi = abi instanceof Abi
? abi
: new Abi(api.registry, abi);
this.api = api;
this.registry = api.registry;
this._decorateMethod = decorateMethod;
assert(this.api.rx.tx.contracts && this.api.rx.tx.contracts.putCode, 'You need to connect to a node with the contracts module, the metadata does not enable api.tx.contracts on this instance');
}
protected get _apiContracts (): SubmittableModuleExtrinsics<'rxjs'> {
return this.api.rx.tx.contracts;
}
}
+18 -26
View File
@@ -2,9 +2,9 @@
// SPDX-License-Identifier: Apache-2.0
import { ApiTypes, DecorateMethod } from '@polkadot/api/types';
import { AccountId, Address, Hash } from '@polkadot/types/interfaces';
import { IKeyringPair, ISubmittableResult } from '@polkadot/types/types';
import { ApiObject, ContractABIPre } from '../types';
import { AccountId, EventRecord, Hash } from '@polkadot/types/interfaces';
import { AnyJson, IKeyringPair, ISubmittableResult } from '@polkadot/types/types';
import { ApiObject } from '../types';
import BN from 'bn.js';
import { Observable } from 'rxjs';
@@ -13,14 +13,15 @@ import { SubmittableResult } from '@polkadot/api';
import { assert } from '@polkadot/util';
import Abi from '../Abi';
import Base from './Base';
import Contract from './Contract';
import { BaseWithTx } from './util';
import { applyOnEvent } from './util';
// eslint-disable-next-line no-use-before-define
type BlueprintCreateResultSubscription<ApiType extends ApiTypes> = Observable<BlueprintCreateResult<ApiType>>;
export interface BlueprintCreate<ApiType extends ApiTypes> {
signAndSend (account: IKeyringPair | string | AccountId | Address): BlueprintCreateResultSubscription<ApiType>;
signAndSend (account: IKeyringPair | string | AccountId): BlueprintCreateResultSubscription<ApiType>;
}
class BlueprintCreateResult<ApiType extends ApiTypes> extends SubmittableResult {
@@ -34,10 +35,10 @@ class BlueprintCreateResult<ApiType extends ApiTypes> extends SubmittableResult
}
// NOTE Experimental, POC, bound to change
export default class Blueprint<ApiType extends ApiTypes> extends BaseWithTx<ApiType> {
export default class Blueprint<ApiType extends ApiTypes> extends Base<ApiType> {
public readonly codeHash: Hash;
constructor (api: ApiObject<ApiType>, abi: ContractABIPre | Abi, decorateMethod: DecorateMethod<ApiType>, codeHash: string | Hash) {
constructor (api: ApiObject<ApiType>, abi: AnyJson | Abi, decorateMethod: DecorateMethod<ApiType>, codeHash: string | Hash) {
super(api, abi, decorateMethod);
this.codeHash = this.registry.createType('Hash', codeHash);
@@ -48,28 +49,19 @@ export default class Blueprint<ApiType extends ApiTypes> extends BaseWithTx<ApiT
return {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
signAndSend: this.decorateMethod(
(account: IKeyringPair | string | AccountId | Address): BlueprintCreateResultSubscription<ApiType> => {
return this._apiContracts
signAndSend: this._decorateMethod(
(account: IKeyringPair | string | AccountId): BlueprintCreateResultSubscription<ApiType> =>
this._apiContracts
.create(endowment, maxGas, this.codeHash, this.abi.constructors[constructorIndex](...params))
.signAndSend(account)
.pipe(map(this._createResult));
}
.pipe(
map((result) =>
new BlueprintCreateResult(result, applyOnEvent(result, 'Instantiated', (record: EventRecord) =>
new Contract<ApiType>(this.api, this.abi, this._decorateMethod, record.event.data[1] as AccountId)
))
)
)
)
};
}
private _createResult = (result: SubmittableResult): BlueprintCreateResult<ApiType> => {
let contract: Contract<ApiType> | undefined;
if (result.isInBlock) {
const record = result.findRecord('contract', 'Instantiated');
if (record) {
contract = new Contract<ApiType>(this.api, this.abi, this.decorateMethod, record.event.data[1] as Address);
}
}
return new BlueprintCreateResult(result, contract);
}
}
+16 -23
View File
@@ -2,9 +2,9 @@
// SPDX-License-Identifier: Apache-2.0
import { ApiTypes, DecorateMethod } from '@polkadot/api/types';
import { AccountId, Address, Hash } from '@polkadot/types/interfaces';
import { IKeyringPair, ISubmittableResult } from '@polkadot/types/types';
import { ApiObject, ContractABIPre } from '../types';
import { AccountId, Address, EventRecord, Hash } from '@polkadot/types/interfaces';
import { AnyJson, IKeyringPair, ISubmittableResult } from '@polkadot/types/types';
import { ApiObject } from '../types';
import BN from 'bn.js';
import { Observable } from 'rxjs';
@@ -13,8 +13,9 @@ import { SubmittableResult } from '@polkadot/api';
import { compactAddLength, u8aToU8a } from '@polkadot/util';
import Abi from '../Abi';
import Base from './Base';
import Blueprint from './Blueprint';
import { BaseWithTx } from './util';
import { applyOnEvent } from './util';
// eslint-disable-next-line no-use-before-define
type CodePutCodeResultSubscription<ApiType extends ApiTypes> = Observable<CodePutCodeResult<ApiType>>;
@@ -34,10 +35,10 @@ class CodePutCodeResult<ApiType extends ApiTypes> extends SubmittableResult {
}
// NOTE Experimental, POC, bound to change
export default class Code<ApiType extends ApiTypes> extends BaseWithTx<ApiType> {
export default class Code<ApiType extends ApiTypes> extends Base<ApiType> {
public readonly code: Uint8Array;
constructor (api: ApiObject<ApiType>, abi: ContractABIPre | Abi, decorateMethod: DecorateMethod<ApiType>, wasm: string | Uint8Array) {
constructor (api: ApiObject<ApiType>, abi: AnyJson | Abi, decorateMethod: DecorateMethod<ApiType>, wasm: Uint8Array | string) {
super(api, abi, decorateMethod);
this.code = u8aToU8a(wasm);
@@ -46,27 +47,19 @@ export default class Code<ApiType extends ApiTypes> extends BaseWithTx<ApiType>
public createBlueprint = (maxGas: number | BN): CodePutCode<ApiType> => {
return {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
signAndSend: this.decorateMethod(
(account: IKeyringPair | string | AccountId | Address): CodePutCodeResultSubscription<ApiType> =>
signAndSend: this._decorateMethod(
(account: IKeyringPair | string | AccountId): CodePutCodeResultSubscription<ApiType> =>
this._apiContracts
.putCode(maxGas, compactAddLength(this.code))
.signAndSend(account)
.pipe(map(this._createResult))
.pipe(
map((result) =>
new CodePutCodeResult(result, applyOnEvent(result, 'CodeStored', (record: EventRecord) =>
new Blueprint<ApiType>(this.api, this.abi, this._decorateMethod, record.event.data[0] as Hash)
))
)
)
)
};
}
private _createResult = (result: ISubmittableResult): CodePutCodeResult<ApiType> => {
let blueprint: Blueprint<ApiType> | undefined;
if (result.isInBlock) {
const record = result.findRecord('contract', 'CodeStored');
if (record) {
blueprint = new Blueprint<ApiType>(this.api, this.abi, this.decorateMethod, record.event.data[0] as Hash);
}
}
return new CodePutCodeResult(result, blueprint);
}
}
+75 -48
View File
@@ -2,17 +2,20 @@
// SPDX-License-Identifier: Apache-2.0
import { ApiTypes, DecorateMethod, ObsInnerType } from '@polkadot/api/types';
import { AccountId, Address, ContractExecResult } from '@polkadot/types/interfaces';
import { Codec, CodecArg, IKeyringPair } from '@polkadot/types/types';
import { ApiObject, ContractABIMessage, ContractABIPre, ContractCallOutcome } from '../types';
import { AccountId, ContractExecResult } from '@polkadot/types/interfaces';
import { AnyJson, Codec, CodecArg, IKeyringPair } from '@polkadot/types/types';
import { ApiObject, AbiMessage, ContractCallOutcome } from '../types';
import BN from 'bn.js';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { SubmittableResult } from '@polkadot/api';
import { assert, isFunction, isNumber } from '@polkadot/util';
import Abi from '../Abi';
import { formatData } from '../util';
import { BaseWithTxAndRpcCall } from './util';
import Base from './Base';
import { SignerOptions } from '@polkadot/api/submittable/types';
type ContractCallTypes = 'tx' | 'rpc';
@@ -22,71 +25,95 @@ type ContractCallResultSubscription<ApiType extends ApiTypes, CallType extends C
// eslint-disable-next-line no-use-before-define
: Promise<ObsInnerType<ContractCallResult<CallType>>>;
export interface ContractCall<ApiType extends ApiTypes, CallType extends ContractCallTypes> {
send (account: IKeyringPair | string | AccountId | Address): ContractCallResultSubscription<ApiType, CallType>;
export interface ContractExec<ApiType extends ApiTypes> {
signAndSend (account: IKeyringPair | string | AccountId, options?: Partial<SignerOptions>): ContractCallResultSubscription<ApiType, 'tx'>;
}
export interface ContractRead<ApiType extends ApiTypes> {
send (account: IKeyringPair | string | AccountId): ContractCallResultSubscription<ApiType, 'rpc'>;
}
export type ContractCallResult<CallType extends ContractCallTypes> = CallType extends 'rpc'
? Observable<ContractCallOutcome>
: Observable<SubmittableResult>;
export default class Contract<ApiType extends ApiTypes> extends BaseWithTxAndRpcCall<ApiType> {
public readonly address: Address;
export default class Contract<ApiType extends ApiTypes> extends Base<ApiType> {
public readonly address: AccountId;
constructor (api: ApiObject<ApiType>, abi: ContractABIPre | Abi, decorateMethod: DecorateMethod<ApiType>, address: string | AccountId | Address) {
constructor (api: ApiObject<ApiType>, abi: AnyJson | Abi, decorateMethod: DecorateMethod<ApiType>, address: string | AccountId) {
super(api, abi, decorateMethod);
this.address = this.registry.createType('Address', address);
this.address = this.registry.createType('AccountId', address);
}
public call (as: 'rpc', message: string, value: BN | number, gasLimit: BN | number, ...params: CodecArg[]): ContractCall<ApiType, 'rpc'>;
public call (as: 'tx', message: string, value: BN | number, gasLimit: BN | number, ...params: CodecArg[]): ContractCall<ApiType, 'tx'>;
public call<CallType extends ContractCallTypes> (as: CallType, message: string, value: BN | number, gasLimit: BN | number, ...params: CodecArg[]): ContractCall<ApiType, CallType> {
const { def, fn } = this.getMessage(message);
public get hasRpcContractsCall (): boolean {
return isFunction(this.api.rx.rpc.contracts?.call);
}
private _createInput (message: AbiMessage | number, params: CodecArg[]): [Uint8Array, AbiMessage] {
const fn = isNumber(message)
? this.abi.messages[message]
: message;
assert(fn, 'Attempted to call an invalid contract message');
return [fn(...params), fn];
}
public exec = (message: AbiMessage | number, value: BN | string | number, gasLimit: BN | string | number, ...params: CodecArg[]): ContractExec<ApiType> => {
const [inputData] = this._createInput(message, params);
return {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
send: this.decorateMethod(
as === 'rpc' && this.hasRpcContractsCall
? (account: IKeyringPair | string | AccountId | Address): ContractCallResult<'rpc'> =>
this._rpcContractsCall(
this.registry.createType('ContractCallRequest', {
dest: this.address.toString(),
gasLimit,
inputData: fn(...params),
origin: account,
value
})
).pipe(map((result: ContractExecResult): ContractCallOutcome =>
this._createOutcome(result, this.registry.createType('AccountId', account), def, params)
))
: (account: IKeyringPair | string | AccountId | Address): ContractCallResult<'tx'> =>
this._apiContracts
.call(this.address, value, gasLimit, fn(...params))
.signAndSend(account)
signAndSend: this._decorateMethod((account: IKeyringPair | string | AccountId, options?: Partial<SignerOptions>): ContractCallResult<'tx'> =>
this._apiContracts
.call(this.address, value, gasLimit, inputData)
.signAndSend(account, options)
)
};
}
private _createOutcome (result: ContractExecResult, origin: AccountId, message: ContractABIMessage, params: CodecArg[]): ContractCallOutcome {
let output: Codec | null = null;
public read = (message: AbiMessage | number, value: BN | string | number, gasLimit: BN | string | number, ...params: CodecArg[]): ContractRead<ApiType> => {
assert(this.hasRpcContractsCall, 'Your node does not support contract RPC read calls');
if (result.isSuccess) {
const { data } = result.asSuccess;
output = message.returnType
? formatData(this.registry, data, message.returnType)
: this.registry.createType('Raw', data);
}
const [inputData, messageFn] = this._createInput(message, params);
return {
isSuccess: result.isSuccess,
message,
origin,
output,
params,
result,
time: Date.now()
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
send: this._decorateMethod((account: IKeyringPair | string | AccountId): ContractCallResult<'rpc'> =>
this.api.rx.rpc.contracts.call(
this.registry.createType('ContractCallRequest', {
dest: this.address,
gasLimit,
inputData,
origin: account,
value
})
).pipe(
map((result: ContractExecResult): ContractCallOutcome => {
let output: Codec | null = null;
if (result.isSuccess) {
const { data } = result.asSuccess;
output = messageFn.returnType
? formatData(this.registry, data, messageFn.returnType)
: this.registry.createType('Raw', data);
}
return {
isSuccess: result.isSuccess,
message: messageFn,
origin: this.registry.createType('AccountId', account),
output,
params,
result,
time: Date.now(),
type: messageFn.returnType || null
};
})
)
)
};
}
}
+9 -70
View File
@@ -1,78 +1,17 @@
// Copyright 2017-2020 @polkadot/api authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { ApiTypes, DecorateMethod, DecoratedRpc, SubmittableModuleExtrinsics } from '@polkadot/api/types';
import { RpcInterface } from '@polkadot/rpc-core/types';
import { Registry } from '@polkadot/types/types';
import { ApiObject, ContractABIMessage, ContractABIPre, ContractBase, ContractMessage } from '../types';
import { SubmittableResult } from '@polkadot/api';
import { EventRecord } from '@polkadot/types/interfaces';
import { assert, isFunction, stringCamelCase } from '@polkadot/util';
import Abi from '../Abi';
export function applyOnEvent <T> (result: SubmittableResult, type: 'CodeStored' | 'Instantiated', fn: (record: EventRecord) => T): T | undefined {
if (result.isInBlock || result.isFinalized) {
const record = result.findRecord('contract', 'CodeStored');
export abstract class Base<ApiType extends ApiTypes> implements ContractBase<ApiType> {
public readonly abi: Abi;
public readonly api: ApiObject<ApiType>;
public readonly decorateMethod: DecorateMethod<ApiType>;
public readonly registry: Registry;
constructor (api: ApiObject<ApiType>, abi: ContractABIPre | Abi, decorateMethod: DecorateMethod<ApiType>) {
this.abi = abi instanceof Abi
? abi
: new Abi(api.registry, abi);
this.registry = api.registry;
this.api = api;
this.decorateMethod = decorateMethod;
if (record) {
return fn(record);
}
}
public get messages (): ContractMessage[] {
return this.abi.abi.contract.messages.map(
(def: ContractABIMessage, index): ContractMessage => ({
def,
fn: this.abi.messages[def.name] || this.abi.messages[stringCamelCase(name)],
index
})
);
}
public getMessage (nameOrIndex?: string | number): ContractMessage {
const index = nameOrIndex
? typeof nameOrIndex === 'number'
? nameOrIndex
: this.abi.abi.contract.messages.findIndex((message): boolean => nameOrIndex === message.name || nameOrIndex === stringCamelCase(message.name))
: 0;
const def = this.abi.abi.contract.messages[index];
assert(!!def, `Attempted to access a contract message that does not exist: ${typeof nameOrIndex === 'number' ? `index ${nameOrIndex}` : (nameOrIndex || 'unknown')}`);
const fn = this.abi.messages[def.name] || this.abi.messages[stringCamelCase(def.name)];
return { def, fn, index };
}
}
export abstract class BaseWithTx<ApiType extends ApiTypes> extends Base<ApiType> {
protected get _apiContracts (): SubmittableModuleExtrinsics<'rxjs'> {
return this.api.rx.tx.contracts;
}
constructor (api: ApiObject<ApiType>, abi: ContractABIPre | Abi, decorateMethod: DecorateMethod<ApiType>) {
super(api, abi, decorateMethod);
assert(this.api.rx.tx.contracts && this.api.rx.tx.contracts.putCode, 'You need to connect to a node with the contracts module, the metadata does not enable api.tx.contracts on this instance');
}
}
export abstract class BaseWithTxAndRpcCall<ApiType extends ApiTypes> extends BaseWithTx<ApiType> {
public get hasRpcContractsCall (): boolean {
return isFunction(this.api.rx.rpc.contracts?.call);
}
protected get _rpcContractsCall (): DecoratedRpc<'rxjs', RpcInterface>['contracts']['call'] {
assert(this.hasRpcContractsCall, 'You need to connect to a node with the contracts.call RPC method.');
return this.api.rx.rpc.contracts.call;
}
return undefined;
}
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
import { Hash } from '@polkadot/types/interfaces';
import { ContractABIPre } from '../types';
import { AnyJson } from '@polkadot/types/types';
import { ApiPromise } from '@polkadot/api';
import { decorateMethod } from '@polkadot/api/promise';
@@ -11,7 +11,7 @@ import Abi from '../Abi';
import Blueprint from '../base/Blueprint';
export default class PromiseBlueprint extends Blueprint<'promise'> {
constructor (api: ApiPromise, abi: ContractABIPre | Abi, codeHash: string | Hash) {
constructor (api: ApiPromise, abi: AnyJson | Abi, codeHash: string | Hash) {
super(api, abi, decorateMethod, codeHash);
}
}
@@ -1,16 +1,15 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { ContractABIPre } from '../types';
import { ApiPromise } from '@polkadot/api';
import { decorateMethod } from '@polkadot/api/promise';
import { AnyJson } from '@polkadot/types/types';
import Abi from '../Abi';
import Code from '../base/Code';
export default class PromiseCode extends Code<'promise'> {
constructor (api: ApiPromise, abi: ContractABIPre | Abi, wasm: string | Uint8Array) {
constructor (api: ApiPromise, abi: AnyJson | Abi, wasm: string | Uint8Array) {
super(api, abi, decorateMethod, wasm);
}
}
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
import { AccountId } from '@polkadot/types/interfaces';
import { ContractABIPre } from '../types';
import { AnyJson } from '@polkadot/types/types';
import { ApiPromise } from '@polkadot/api';
import { decorateMethod } from '@polkadot/api/promise';
@@ -11,7 +11,7 @@ import Abi from '../Abi';
import Contract from '../base/Contract';
export default class PromiseContract extends Contract<'promise'> {
constructor (api: ApiPromise, abi: ContractABIPre | Abi, address: string | AccountId) {
constructor (api: ApiPromise, abi: AnyJson | Abi, address: string | AccountId) {
super(api, abi, decorateMethod, address);
}
}
+2 -2
View File
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
import { Hash } from '@polkadot/types/interfaces';
import { ContractABIPre } from '../types';
import { AnyJson } from '@polkadot/types/types';
import { ApiRx } from '@polkadot/api';
import { decorateMethod } from '@polkadot/api/rx';
@@ -11,7 +11,7 @@ import Abi from '../Abi';
import Blueprint from '../base/Blueprint';
export default class RxBlueprint extends Blueprint<'rxjs'> {
constructor (api: ApiRx, abi: ContractABIPre | Abi, codeHash: string | Hash) {
constructor (api: ApiRx, abi: AnyJson | Abi, codeHash: string | Hash) {
super(api, abi, decorateMethod, codeHash);
}
}
+2 -2
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { ContractABIPre } from '../types';
import { AnyJson } from '@polkadot/types/types';
import { ApiRx } from '@polkadot/api';
import { decorateMethod } from '@polkadot/api/rx';
@@ -10,7 +10,7 @@ import Abi from '../Abi';
import Code from '../base/Code';
export default class RxCode extends Code<'rxjs'> {
constructor (api: ApiRx, abi: ContractABIPre | Abi, wasm: string | Uint8Array) {
constructor (api: ApiRx, abi: AnyJson | Abi, wasm: string | Uint8Array) {
super(api, abi, decorateMethod, wasm);
}
}
+2 -2
View File
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
import { AccountId } from '@polkadot/types/interfaces';
import { ContractABIPre } from '../types';
import { AnyJson } from '@polkadot/types/types';
import { ApiRx } from '@polkadot/api';
import { decorateMethod } from '@polkadot/api/rx';
@@ -11,7 +11,7 @@ import Abi from '../Abi';
import Contract from '../base/Contract';
export default class RxContract extends Contract<'rxjs'> {
constructor (api: ApiRx, abi: ContractABIPre | Abi, address: string | AccountId) {
constructor (api: ApiRx, abi: AnyJson | Abi, address: string | AccountId) {
super(api, abi, decorateMethod, address);
}
}
+24 -173
View File
@@ -1,195 +1,45 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { ApiTypes, DecorateMethod } from '@polkadot/api/types';
import { ApiTypes } from '@polkadot/api/types';
import { AccountId, Address, ContractExecResult } from '@polkadot/types/interfaces';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { Codec, CodecArg } from '@polkadot/types/types';
import { MetaRegistryJson, StringIndex, TypeIndex, TypeDef } from '@polkadot/types/create/types';
import { Codec, CodecArg, TypeDef } from '@polkadot/types/types';
import { ApiPromise, ApiRx } from '@polkadot/api';
// I give up, too hard to untangle atm... and is basically deprecated
/* eslint-disable no-use-before-define */
import Abi from './Abi';
export type ApiObject<ApiType extends ApiTypes> = ApiType extends 'rxjs'
? ApiRx
: ApiPromise;
export interface ContractBase<ApiType extends ApiTypes> {
readonly abi: InterfaceAbi;
readonly abi: Abi;
readonly api: ApiObject<ApiType>;
readonly decorateMethod: DecorateMethod<ApiType>;
getMessage: (name: string) => ContractMessage;
messages: ContractMessage[];
getMessage: (name: string) => AbiMessage;
messages: AbiMessage[];
}
export interface ContractABITypePre {
ty: TypeIndex;
// eslint-disable-next-line camelcase
display_name: StringIndex[];
}
export interface ContractABIArgBasePre {
name: StringIndex;
type: ContractABITypePre;
}
export interface ContractABIArgBase {
export interface AbiMessageParam {
name: string;
type: TypeDef;
}
export type ContractABIMessageArgPre = ContractABIArgBasePre;
export interface AbiMessage {
args: AbiMessageParam[];
docs: string[];
identifier: string;
index: number;
isConstructor?: boolean;
isMutating?: boolean;
isPayable?: boolean;
returnType?: TypeDef | null;
selector: string;
export type ContractABIMessageArg = ContractABIArgBase;
export interface ContractABIMessageBase {
args: ContractABIMessageArg[];
}
export interface ContractABIMessageBasePre {
args: ContractABIMessageArgPre[];
}
export interface ContractABIMessageCommon {
docs?: ContractABIDocs;
mutates?: boolean;
selector: string | number;
}
export interface ContractABIMessagePre extends ContractABIMessageCommon, ContractABIMessageBasePre {
name: StringIndex;
// eslint-disable-next-line camelcase
return_type: ContractABITypePre | null;
}
export interface ContractABIMessage extends ContractABIMessageCommon {
args: ContractABIMessageArg[];
name: string;
returnType: TypeDef | null;
}
export interface ContractABIContractCommon {
docs?: ContractABIDocs;
}
export interface ContractABIContractPre extends ContractABIContractCommon {
constructors: ContractABIMessagePre[];
messages: ContractABIMessagePre[];
name: StringIndex;
events?: ContractABIEventPre[];
docs?: ContractABIDocs;
}
export interface ContractABIContract extends ContractABIContractCommon {
constructors: ContractABIMessage[];
messages: ContractABIMessage[];
name: string;
events?: ContractABIEvent[];
docs?: ContractABIDocs;
}
export interface ContractABIPre extends MetaRegistryJson {
storage: ContractABIStoragePre;
contract: ContractABIContractPre;
}
export interface ContractABI {
storage: ContractABIStorage;
contract: ContractABIContract;
}
export interface ContractABIFnArg {
name: string;
type: TypeDef;
}
export interface ContractABIMeta {
args: ContractABIFnArg[];
isConstant: boolean;
type: TypeDef | null;
}
export interface ContractABIFn extends ContractABIMeta {
(...args: CodecArg[]): Uint8Array;
}
export interface ContractABIEventArgBase {
indexed: boolean;
}
export interface ContractABIEventArgPre extends ContractABIArgBasePre, ContractABIEventArgBase {}
export interface ContractABIEventArg extends ContractABIArgBase, ContractABIEventArgBase {}
export type ContractABIDocs = string[];
export interface ContractABIEventPre {
args: ContractABIEventArgPre[];
}
export interface ContractABIEvent {
args: ContractABIEventArg[];
}
export interface ContractABIRangeBase {
// can be number[] (old) or hex (new)
'range.offset': number[] | string;
'range.len': number;
}
export interface ContractABIRangePre extends ContractABIRangeBase {
'range.elem_type': TypeIndex;
}
export interface ContractABIRange extends ContractABIRangeBase {
'range.elem_type': TypeDef;
}
export type ContractABIStorageLayoutPre = ContractABIStorageStructPre | ContractABIRangePre;
export type ContractABIStorageLayout = ContractABIStorageStruct | ContractABIRange;
export interface ContractABIStorageStructFieldPre {
name: StringIndex;
layout: ContractABIStorageLayoutPre;
}
export interface ContractABIStorageStructField {
name: string;
layout: ContractABIStorageLayout;
}
export interface ContractABIStorageStructPre {
'struct.type': TypeIndex;
'struct.fields': ContractABIStorageStructFieldPre[];
}
export interface ContractABIStorageStruct {
'struct.type': TypeDef;
'struct.fields': ContractABIStorageStructField[];
}
export type ContractABIStoragePre = ContractABIStorageStructPre;
export type ContractABIStorage = ContractABIStorageStruct;
export interface ContractMessage {
index: number;
fn: ContractABIFn;
def: ContractABIMessage;
}
export type AbiConstructors = ContractABIFn[];
export type AbiMessages = Record<string, ContractABIFn>;
export interface InterfaceAbi {
readonly abi: ContractABI;
readonly constructors: AbiConstructors;
readonly messages: AbiMessages;
}
export type AbiConstructor = AbiMessage;
export interface InterfaceContractCalls {
// eslint-disable-next-line @typescript-eslint/ban-types
@@ -202,11 +52,12 @@ export interface InterfaceContract {
}
export interface ContractCallOutcome {
time: number;
result: ContractExecResult;
isSuccess: boolean;
message: AbiMessage;
origin: AccountId;
output: Codec | null;
params: any[];
isSuccess: boolean;
message: ContractABIMessage;
result: ContractExecResult;
time: number;
type: TypeDef | null;
}
+3 -11
View File
@@ -1,18 +1,10 @@
// Copyright 2017-2020 @polkadot/rpc-core authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Codec, Registry, TypeDef, TypeDefInfo } from '@polkadot/types/types';
import { Codec, Registry, TypeDef } from '@polkadot/types/types';
import { Option, Raw, createClass, createTypeUnsafe } from '@polkadot/types';
export function formatData (registry: Registry, data: Raw, { info, type }: TypeDef): Codec {
if (info === TypeDefInfo.Option) {
return new Option(
registry,
createClass(registry, type),
createTypeUnsafe(registry, type, [data], true)
);
}
import { Raw, createTypeUnsafe } from '@polkadot/types';
export function formatData (registry: Registry, data: Raw, { type }: TypeDef): Codec {
return createTypeUnsafe(registry, type, [data], true);
}
File diff suppressed because it is too large Load Diff
-467
View File
@@ -1,467 +0,0 @@
{
"registry": {
"strings": [
"StorageAndEnv",
"app",
"__ink_private",
"__ink_storage",
"__storage",
"Storage",
"value",
"Value",
"ink_core",
"storage",
"cell",
"SyncCell",
"sync_cell",
"Key",
"key",
"name",
"vec",
"Vec",
"elems",
"__env",
"EnvAccess",
"env2",
"env_access",
"immutable",
"TestEnv",
"test",
"accessor",
"DefaultSrmlTypes",
"types",
"access",
"EnvAccessMut",
"mutable",
"env",
"PhantomData",
"buffer",
"has_interacted",
"has_returned_value",
"new",
"init_value",
"bool",
"default",
"flip",
"get"
],
"types": [
{
"id": {
"custom.name": 1,
"custom.namespace": [
2,
2,
3,
4
],
"custom.params": []
},
"def": {
"struct.fields": [
{
"name": 5,
"type": 2
},
{
"name": 20,
"type": 14
}
]
}
},
{
"id": {
"custom.name": 6,
"custom.namespace": [
2,
2,
3,
4
],
"custom.params": []
},
"def": {
"struct.fields": [
{
"name": 7,
"type": 3
},
{
"name": 16,
"type": 9
}
]
}
},
{
"id": {
"custom.name": 8,
"custom.namespace": [
9,
10,
7
],
"custom.params": [
4
]
},
"def": {
"struct.fields": [
{
"name": 11,
"type": 5
}
]
}
},
{
"id": "bool",
"def": "builtin"
},
{
"id": {
"custom.name": 12,
"custom.namespace": [
9,
10,
11,
13
],
"custom.params": [
4
]
},
"def": {
"struct.fields": [
{
"name": 11,
"type": 6
}
]
}
},
{
"id": {
"custom.name": 14,
"custom.namespace": [
9,
10,
15
],
"custom.params": []
},
"def": {
"tuple_struct.types": [
7
]
}
},
{
"id": {
"array.len": 32,
"array.type": 8
},
"def": "builtin"
},
{
"id": "u8",
"def": "builtin"
},
{
"id": {
"custom.name": 8,
"custom.namespace": [
9,
10,
7
],
"custom.params": [
10
]
},
"def": {
"struct.fields": [
{
"name": 11,
"type": 13
}
]
}
},
{
"id": "str",
"def": {
"struct.fields": [
{
"name": 17,
"type": 11
}
]
}
},
{
"id": {
"custom.name": 18,
"custom.namespace": [],
"custom.params": [
8
]
},
"def": {
"struct.fields": [
{
"name": 19,
"type": 12
}
]
}
},
{
"id": {
"slice.type": 8
},
"def": "builtin"
},
{
"id": {
"custom.name": 12,
"custom.namespace": [
9,
10,
11,
13
],
"custom.params": [
10
]
},
"def": {
"struct.fields": [
{
"name": 11,
"type": 6
}
]
}
},
{
"id": {
"custom.name": 21,
"custom.namespace": [
9,
22,
23,
24
],
"custom.params": [
15
]
},
"def": {
"struct.fields": [
{
"name": 30,
"type": 17
}
]
}
},
{
"id": {
"custom.name": 25,
"custom.namespace": [
9,
22,
26,
27
],
"custom.params": [
16
]
},
"def": {
"struct.fields": []
}
},
{
"id": {
"custom.name": 28,
"custom.namespace": [
9,
22,
29
],
"custom.params": []
},
"def": {
"clike_enum.variants": []
}
},
{
"id": {
"custom.name": 31,
"custom.namespace": [
9,
22,
23,
32
],
"custom.params": [
15
]
},
"def": {
"struct.fields": [
{
"name": 33,
"type": 18
},
{
"name": 35,
"type": 11
},
{
"name": 36,
"type": 4
},
{
"name": 37,
"type": 4
}
]
}
},
{
"id": {
"custom.name": 34,
"custom.namespace": [],
"custom.params": [
15
]
},
"def": {
"tuple_struct.types": []
}
}
]
},
"storage": {
"struct.type": 1,
"struct.fields": [
{
"name": 10,
"layout": {
"struct.type": 2,
"struct.fields": [
{
"name": 7,
"layout": {
"struct.type": 3,
"struct.fields": [
{
"name": 11,
"layout": {
"range.offset": "0x0000000000000000000000000000000000000000000000000000000000000000",
"range.len": 1,
"range.elem_type": 4
}
}
]
}
},
{
"name": 16,
"layout": {
"struct.type": 9,
"struct.fields": [
{
"name": 11,
"layout": {
"range.offset": "0x0000000000000000000000000000000000000000000000000000000000000001",
"range.len": 1,
"range.elem_type": 10
}
}
]
}
}
]
}
}
]
},
"contract": {
"name": 2,
"constructors": [
{
"name": 38,
"selector": "[\"0x5E\",\"0xBD\",\"0x88\",\"0xD6\"]",
"args": [
{
"name": 16,
"type": {
"ty": 11,
"display_name": [
18
]
}
},
{
"name": 39,
"type": {
"ty": 4,
"display_name": [
40
]
}
}
],
"docs": [
"Constructor that initializes the `bool` value to the given `init_value`."
]
},
{
"name": 41,
"selector": "[\"0x02\",\"0x22\",\"0xFF\",\"0x18\"]",
"args": [],
"docs": [
"Constructor that initializes the `bool` value to `false`.",
"",
"Constructors can delegate to other constructors."
]
}
],
"messages": [
{
"name": 42,
"selector": "[\"0x8C\",\"0x97\",\"0xDB\",\"0x39\"]",
"mutates": true,
"args": [],
"return_type": null,
"docs": [
"A message that can be called on instantiated contracts.",
"This one flips the value of the stored `bool` from `true`",
"to `false` and vice versa."
]
},
{
"name": 43,
"selector": "[\"0x25\",\"0x44\",\"0x4A\",\"0xFE\"]",
"mutates": false,
"args": [],
"return_type": {
"ty": 4,
"display_name": [
40
]
},
"docs": [
"Simply returns the current value of our `bool`."
]
}
],
"events": [],
"docs": []
}
}
-142
View File
@@ -1,142 +0,0 @@
{
"name": "Types",
"deploy": {
"args": []
},
"messages": [
{
"name": "primitive",
"selector": 11111,
"mutates": true,
"args": [
{
"name": "bool",
"type": "bool"
},
{
"name": "u32",
"type": "u32"
}
],
"return_type": "bool"
},
{
"name": "vector",
"selector": 2222,
"mutates": false,
"args": [
{
"name": "Vec_u8",
"type": {
"Vec<T>": {
"T": "u8"
}
}
},
{
"name": "Vec_u32",
"type": {
"Vec<T>": {
"T": "u32"
}
}
}
],
"return_type": {
"Vec<T>": {
"T": "bool"
}
}
},
{
"name": "vector_fixed",
"selector": 3333,
"mutates": false,
"args": [
{
"name": "vec_u8_length_32",
"type": {
"[T;n]": {
"T": "u8",
"n": 32
}
}
}
],
"return_type": {
"[T;n]": {
"T": "u32",
"n": 8
}
}
},
{
"name": "option",
"selector": 4444,
"mutates": false,
"args": [
{
"name": "Option_u32",
"type": {
"Option<T>": {
"T": "u32"
}
}
}
],
"return_type": {
"Option<T>": {
"T": "bool"
}
}
},
{
"name": "tuple",
"selector": 5555,
"mutates": false,
"args": [
{
"name": "Tuple_u32_u64",
"type": ["u32", "u64"]
}
],
"return_type": ["bool"]
},
{
"name": "result",
"selector": 666,
"mutates": false,
"args": [],
"return_type": {
"Result<T,E>": {
"T": "u32",
"E": "u32"
}
}
},
{
"name": "nested",
"selector": 987654321,
"mutates": false,
"args": [
{
"name": "option_vec",
"type": {
"Option<T>": {
"T": {
"Vec<T>": {
"T": "u32"
}
}
}
}
}
],
"return_type": {
"Vec<T>": {
"T": ["u32", "u64"]
}
}
}
]
}
@@ -0,0 +1,259 @@
[
{
"displayName": "Header",
"namespace": "ink_storage::collections::stash",
"info": 9,
"sub": [
{
"info": 6,
"type": "u32",
"name": "last_vacant"
},
{
"info": 6,
"type": "u32",
"name": "len"
},
{
"info": 6,
"type": "u32",
"name": "len_entries"
}
],
"type": "{\"last_vacant\":\"u32\",\"len\":\"u32\",\"len_entries\":\"u32\"}"
},
{
"info": 6,
"type": "u32"
},
{
"displayName": "Entry",
"namespace": "ink_storage::collections::stash",
"params": [
{
"displayName": "Hash",
"namespace": "ink_env::types",
"info": 6,
"type": "Hash"
}
],
"info": 3,
"sub": [
{
"displayName": "VacantEntry",
"namespace": "ink_storage::collections::stash",
"info": 9,
"sub": [
{
"info": 6,
"type": "u32",
"name": "next"
},
{
"info": 6,
"type": "u32",
"name": "prev"
}
],
"type": "{\"next\":\"u32\",\"prev\":\"u32\"}",
"name": "Vacant"
},
{
"displayName": "Hash",
"namespace": "ink_env::types",
"info": 6,
"type": "Hash",
"name": "Occupied"
}
],
"type": "{\"_enum\":{\"Vacant\":\"VacantEntry\",\"Occupied\":\"Hash\"}}"
},
{
"displayName": "Hash",
"namespace": "ink_env::types",
"info": 6,
"type": "Hash"
},
{
"info": 12,
"length": 32,
"sub": {
"info": 6,
"type": "u8"
},
"type": "[u8;32]"
},
{
"info": 6,
"type": "u8"
},
{
"displayName": "VacantEntry",
"namespace": "ink_storage::collections::stash",
"info": 9,
"sub": [
{
"info": 6,
"type": "u32",
"name": "next"
},
{
"info": 6,
"type": "u32",
"name": "prev"
}
],
"type": "{\"next\":\"u32\",\"prev\":\"u32\"}"
},
{
"displayName": "ValueEntry",
"namespace": "ink_storage::collections::hashmap",
"params": [
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"type": "AccountId"
}
],
"info": 9,
"sub": [
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"type": "AccountId",
"name": "value"
},
{
"info": 6,
"type": "u32",
"name": "key_index"
}
],
"type": "{\"value\":\"AccountId\",\"key_index\":\"u32\"}"
},
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"type": "AccountId"
},
{
"displayName": "Result",
"params": [
{
"info": 10,
"sub": [],
"type": "()"
},
{
"displayName": "Error",
"namespace": "dns::dns",
"info": 3,
"sub": [
{
"ext": {
"discriminant": 0
},
"info": 6,
"name": "NameAlreadyExists",
"type": "Null"
},
{
"ext": {
"discriminant": 1
},
"info": 6,
"name": "CallerIsNotOwner",
"type": "Null"
}
],
"type": "[\"NameAlreadyExists\", \"CallerIsNotOwner\"]"
}
],
"info": 7,
"sub": [
{
"name": "Ok",
"info": 10,
"sub": [],
"type": "()"
},
{
"name": "Error",
"displayName": "Error",
"namespace": "dns::dns",
"info": 3,
"sub": [
{
"ext": {
"discriminant": 0
},
"info": 6,
"name": "NameAlreadyExists",
"type": "Null"
},
{
"ext": {
"discriminant": 1
},
"info": 6,
"name": "CallerIsNotOwner",
"type": "Null"
}
],
"type": "[\"NameAlreadyExists\", \"CallerIsNotOwner\"]"
}
],
"type": "Result<(), Error>"
},
{
"info": 10,
"sub": [],
"type": "()"
},
{
"displayName": "Error",
"namespace": "dns::dns",
"info": 3,
"sub": [
{
"ext": {
"discriminant": 0
},
"info": 6,
"name": "NameAlreadyExists",
"type": "Null"
},
{
"ext": {
"discriminant": 1
},
"info": 6,
"name": "CallerIsNotOwner",
"type": "Null"
}
],
"type": "[\"NameAlreadyExists\", \"CallerIsNotOwner\"]"
},
{
"displayName": "Option",
"params": [
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"type": "AccountId"
}
],
"info": 5,
"sub": {
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"type": "AccountId"
},
"type": "Option<AccountId>"
}
]
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,571 @@
[
{
"displayName": "Header",
"namespace": "ink_storage::collections::stash",
"info": 9,
"sub": [
{
"info": 6,
"type": "u32",
"name": "last_vacant"
},
{
"info": 6,
"type": "u32",
"name": "len"
},
{
"info": 6,
"type": "u32",
"name": "len_entries"
}
],
"type": "{\"last_vacant\":\"u32\",\"len\":\"u32\",\"len_entries\":\"u32\"}"
},
{
"info": 6,
"type": "u32"
},
{
"displayName": "Entry",
"namespace": "ink_storage::collections::stash",
"params": [
{
"info": 6,
"type": "u32"
}
],
"info": 3,
"sub": [
{
"displayName": "VacantEntry",
"namespace": "ink_storage::collections::stash",
"info": 9,
"sub": [
{
"info": 6,
"type": "u32",
"name": "next"
},
{
"info": 6,
"type": "u32",
"name": "prev"
}
],
"type": "{\"next\":\"u32\",\"prev\":\"u32\"}",
"name": "Vacant"
},
{
"info": 6,
"type": "u32",
"name": "Occupied"
}
],
"type": "{\"_enum\":{\"Vacant\":\"VacantEntry\",\"Occupied\":\"u32\"}}"
},
{
"displayName": "VacantEntry",
"namespace": "ink_storage::collections::stash",
"info": 9,
"sub": [
{
"info": 6,
"type": "u32",
"name": "next"
},
{
"info": 6,
"type": "u32",
"name": "prev"
}
],
"type": "{\"next\":\"u32\",\"prev\":\"u32\"}"
},
{
"displayName": "ValueEntry",
"namespace": "ink_storage::collections::hashmap",
"params": [
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"type": "AccountId"
}
],
"info": 9,
"sub": [
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"type": "AccountId",
"name": "value"
},
{
"info": 6,
"type": "u32",
"name": "key_index"
}
],
"type": "{\"value\":\"AccountId\",\"key_index\":\"u32\"}"
},
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"type": "AccountId"
},
{
"info": 12,
"length": 32,
"sub": {
"info": 6,
"type": "u8"
},
"type": "[u8;32]"
},
{
"info": 6,
"type": "u8"
},
{
"displayName": "Entry",
"namespace": "ink_storage::collections::stash",
"params": [
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"type": "AccountId"
}
],
"info": 3,
"sub": [
{
"displayName": "VacantEntry",
"namespace": "ink_storage::collections::stash",
"info": 9,
"sub": [
{
"info": 6,
"type": "u32",
"name": "next"
},
{
"info": 6,
"type": "u32",
"name": "prev"
}
],
"type": "{\"next\":\"u32\",\"prev\":\"u32\"}",
"name": "Vacant"
},
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"type": "AccountId",
"name": "Occupied"
}
],
"type": "{\"_enum\":{\"Vacant\":\"VacantEntry\",\"Occupied\":\"AccountId\"}}"
},
{
"displayName": "ValueEntry",
"namespace": "ink_storage::collections::hashmap",
"params": [
{
"info": 6,
"type": "u32"
}
],
"info": 9,
"sub": [
{
"info": 6,
"type": "u32",
"name": "value"
},
{
"info": 6,
"type": "u32",
"name": "key_index"
}
],
"type": "{\"value\":\"u32\",\"key_index\":\"u32\"}"
},
{
"displayName": "Entry",
"namespace": "ink_storage::collections::stash",
"params": [
{
"info": 10,
"sub": [
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"type": "AccountId"
},
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"type": "AccountId"
}
],
"type": "(AccountId, AccountId)"
}
],
"info": 3,
"sub": [
{
"displayName": "VacantEntry",
"namespace": "ink_storage::collections::stash",
"info": 9,
"sub": [
{
"info": 6,
"type": "u32",
"name": "next"
},
{
"info": 6,
"type": "u32",
"name": "prev"
}
],
"type": "{\"next\":\"u32\",\"prev\":\"u32\"}",
"name": "Vacant"
},
{
"info": 10,
"sub": [
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"type": "AccountId"
},
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"type": "AccountId"
}
],
"type": "(AccountId, AccountId)",
"name": "Occupied"
}
],
"type": "{\"_enum\":{\"Vacant\":\"VacantEntry\",\"Occupied\":\"(AccountId, AccountId)\"}}"
},
{
"info": 10,
"sub": [
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"type": "AccountId"
},
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"type": "AccountId"
}
],
"type": "(AccountId, AccountId)"
},
{
"displayName": "ValueEntry",
"namespace": "ink_storage::collections::hashmap",
"params": [
{
"info": 6,
"type": "bool"
}
],
"info": 9,
"sub": [
{
"info": 6,
"type": "bool",
"name": "value"
},
{
"info": 6,
"type": "u32",
"name": "key_index"
}
],
"type": "{\"value\":\"bool\",\"key_index\":\"u32\"}"
},
{
"info": 6,
"type": "bool"
},
{
"displayName": "Option",
"params": [
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"type": "AccountId"
}
],
"info": 5,
"sub": {
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"type": "AccountId"
},
"type": "Option<AccountId>"
},
{
"displayName": "Result",
"params": [
{
"info": 10,
"sub": [],
"type": "()"
},
{
"displayName": "Error",
"namespace": "erc721::erc721",
"info": 3,
"sub": [
{
"ext": {
"discriminant": 0
},
"info": 6,
"name": "NotOwner",
"type": "Null"
},
{
"ext": {
"discriminant": 1
},
"info": 6,
"name": "NotApproved",
"type": "Null"
},
{
"ext": {
"discriminant": 2
},
"info": 6,
"name": "TokenExists",
"type": "Null"
},
{
"ext": {
"discriminant": 3
},
"info": 6,
"name": "TokenNotFound",
"type": "Null"
},
{
"ext": {
"discriminant": 4
},
"info": 6,
"name": "CannotInsert",
"type": "Null"
},
{
"ext": {
"discriminant": 5
},
"info": 6,
"name": "CannotRemove",
"type": "Null"
},
{
"ext": {
"discriminant": 6
},
"info": 6,
"name": "CannotFetchValue",
"type": "Null"
},
{
"ext": {
"discriminant": 7
},
"info": 6,
"name": "NotAllowed",
"type": "Null"
}
],
"type": "[\"NotOwner\", \"NotApproved\", \"TokenExists\", \"TokenNotFound\", \"CannotInsert\", \"CannotRemove\", \"CannotFetchValue\", \"NotAllowed\"]"
}
],
"info": 7,
"sub": [
{
"name": "Ok",
"info": 10,
"sub": [],
"type": "()"
},
{
"name": "Error",
"displayName": "Error",
"namespace": "erc721::erc721",
"info": 3,
"sub": [
{
"ext": {
"discriminant": 0
},
"info": 6,
"name": "NotOwner",
"type": "Null"
},
{
"ext": {
"discriminant": 1
},
"info": 6,
"name": "NotApproved",
"type": "Null"
},
{
"ext": {
"discriminant": 2
},
"info": 6,
"name": "TokenExists",
"type": "Null"
},
{
"ext": {
"discriminant": 3
},
"info": 6,
"name": "TokenNotFound",
"type": "Null"
},
{
"ext": {
"discriminant": 4
},
"info": 6,
"name": "CannotInsert",
"type": "Null"
},
{
"ext": {
"discriminant": 5
},
"info": 6,
"name": "CannotRemove",
"type": "Null"
},
{
"ext": {
"discriminant": 6
},
"info": 6,
"name": "CannotFetchValue",
"type": "Null"
},
{
"ext": {
"discriminant": 7
},
"info": 6,
"name": "NotAllowed",
"type": "Null"
}
],
"type": "[\"NotOwner\", \"NotApproved\", \"TokenExists\", \"TokenNotFound\", \"CannotInsert\", \"CannotRemove\", \"CannotFetchValue\", \"NotAllowed\"]"
}
],
"type": "Result<(), Error>"
},
{
"info": 10,
"sub": [],
"type": "()"
},
{
"displayName": "Error",
"namespace": "erc721::erc721",
"info": 3,
"sub": [
{
"ext": {
"discriminant": 0
},
"info": 6,
"name": "NotOwner",
"type": "Null"
},
{
"ext": {
"discriminant": 1
},
"info": 6,
"name": "NotApproved",
"type": "Null"
},
{
"ext": {
"discriminant": 2
},
"info": 6,
"name": "TokenExists",
"type": "Null"
},
{
"ext": {
"discriminant": 3
},
"info": 6,
"name": "TokenNotFound",
"type": "Null"
},
{
"ext": {
"discriminant": 4
},
"info": 6,
"name": "CannotInsert",
"type": "Null"
},
{
"ext": {
"discriminant": 5
},
"info": 6,
"name": "CannotRemove",
"type": "Null"
},
{
"ext": {
"discriminant": 6
},
"info": 6,
"name": "CannotFetchValue",
"type": "Null"
},
{
"ext": {
"discriminant": 7
},
"info": 6,
"name": "NotAllowed",
"type": "Null"
}
],
"type": "[\"NotOwner\", \"NotApproved\", \"TokenExists\", \"TokenNotFound\", \"CannotInsert\", \"CannotRemove\", \"CannotFetchValue\", \"NotAllowed\"]"
}
]
@@ -1,169 +1,6 @@
[
{
"info": 8,
"type": "{\"value\": {\"cell\": {\"cell\": ([u8;32])}}}",
"name": "Flipper",
"namespace": "flipper::normal",
"sub": [
{
"info": 8,
"type": "{\"cell\": {\"cell\": ([u8;32])}}",
"name": "value",
"namespace": "ink_core::storage::value",
"params": [
{
"info": 6,
"type": "bool"
}
],
"sub": [
{
"info": 8,
"type": "{\"cell\": ([u8;32])}",
"name": "cell",
"namespace": "ink_core::storage::cell::sync_cell",
"params": [
{
"info": 6,
"type": "bool"
}
],
"sub": [
{
"info": 9,
"type": "([u8;32])",
"name": "cell",
"namespace": "ink_core::storage::key",
"sub": [
{
"info": 11,
"type": "[u8;32]",
"length": 32,
"sub": {
"info": 6,
"type": "u8"
},
"index": 0
}
]
}
]
}
]
}
]
},
{
"info": 8,
"type": "{\"cell\": {\"cell\": ([u8;32])}}",
"name": "Value",
"namespace": "ink_core::storage::value",
"params": [
{
"info": 6,
"type": "bool"
}
],
"sub": [
{
"info": 8,
"type": "{\"cell\": ([u8;32])}",
"name": "cell",
"namespace": "ink_core::storage::cell::sync_cell",
"params": [
{
"info": 6,
"type": "bool"
}
],
"sub": [
{
"info": 9,
"type": "([u8;32])",
"name": "cell",
"namespace": "ink_core::storage::key",
"sub": [
{
"info": 11,
"type": "[u8;32]",
"length": 32,
"sub": {
"info": 6,
"type": "u8"
},
"index": 0
}
]
}
]
}
]
},
{
"info": 6,
"type": "bool"
},
{
"info": 8,
"type": "{\"cell\": ([u8;32])}",
"name": "SyncCell",
"namespace": "ink_core::storage::cell::sync_cell",
"params": [
{
"info": 6,
"type": "bool"
}
],
"sub": [
{
"info": 9,
"type": "([u8;32])",
"name": "cell",
"namespace": "ink_core::storage::key",
"sub": [
{
"info": 11,
"type": "[u8;32]",
"length": 32,
"sub": {
"info": 6,
"type": "u8"
},
"index": 0
}
]
}
]
},
{
"info": 9,
"type": "([u8;32])",
"name": "Key",
"namespace": "ink_core::storage::key",
"sub": [
{
"info": 11,
"type": "[u8;32]",
"length": 32,
"sub": {
"info": 6,
"type": "u8"
},
"index": 0
}
]
},
{
"info": 11,
"type": "[u8;32]",
"length": 32,
"sub": {
"info": 6,
"type": "u8"
}
},
{
"info": 6,
"type": "u8"
}
]
]
@@ -1,173 +1,6 @@
[
{
"info": 10,
"type": "{ \"value\": \"{ \"cell\": \"{ \"cell\": \"([u8;32])\"} }<u32>\"} }<u32>\"} }",
"sub": [
{
"info": 10,
"type": "{ \"cell\": \"{ \"cell\": \"([u8;32])\"} }<u32>\"} }",
"sub": [
{
"info": 10,
"type": "{ \"cell\": \"([u8;32])\"} }",
"sub": [
{
"info": 11,
"type": "([u8;32])",
"sub": [
{
"info": 13,
"type": "[u8;32]",
"length": 32,
"sub": {
"info": 7,
"type": "u8"
},
"index": 0
}
],
"name": "cell",
"namespace": "ink_core::storage::key"
}
],
"name": "cell",
"namespace": "ink_core::storage::cell::sync_cell",
"params": [
{
"info": 7,
"type": "u32"
}
]
}
],
"name": "value",
"namespace": "ink_core::storage::value",
"params": [
{
"info": 7,
"type": "u32"
}
]
}
],
"name": "Incrementer",
"namespace": "incrementer::normal"
},
{
"info": 10,
"type": "{ \"cell\": \"{ \"cell\": \"([u8;32])\"} }<u32>\"} }",
"sub": [
{
"info": 10,
"type": "{ \"cell\": \"([u8;32])\"} }",
"sub": [
{
"info": 11,
"type": "([u8;32])",
"sub": [
{
"info": 13,
"type": "[u8;32]",
"length": 32,
"sub": {
"info": 7,
"type": "u8"
},
"index": 0
}
],
"name": "cell",
"namespace": "ink_core::storage::key"
}
],
"name": "cell",
"namespace": "ink_core::storage::cell::sync_cell",
"params": [
{
"info": 7,
"type": "u32"
}
]
}
],
"name": "Value",
"namespace": "ink_core::storage::value",
"params": [
{
"info": 7,
"type": "u32"
}
]
},
{
"info": 7,
"type": "u32"
},
{
"info": 10,
"type": "{ \"cell\": \"([u8;32])\"} }",
"sub": [
{
"info": 11,
"type": "([u8;32])",
"sub": [
{
"info": 13,
"type": "[u8;32]",
"length": 32,
"sub": {
"info": 7,
"type": "u8"
},
"index": 0
}
],
"name": "cell",
"namespace": "ink_core::storage::key"
}
],
"name": "SyncCell",
"namespace": "ink_core::storage::cell::sync_cell",
"params": [
{
"info": 7,
"type": "u32"
}
]
},
{
"info": 11,
"type": "([u8;32])",
"sub": [
{
"info": 13,
"type": "[u8;32]",
"length": 32,
"sub": {
"info": 7,
"type": "u8"
},
"index": 0
}
],
"name": "Key",
"namespace": "ink_core::storage::key"
},
{
"info": 13,
"type": "[u8;32]",
"length": 32,
"sub": {
"info": 7,
"type": "u8"
}
},
{
"info": 7,
"type": "u8"
},
{
"info": 7,
"type": "bool"
"info": 6,
"type": "i32"
}
]
]
@@ -0,0 +1,680 @@
[
{
"displayName": "Header",
"namespace": "ink_storage::collections::stash",
"info": 9,
"sub": [
{
"info": 6,
"type": "u32",
"name": "last_vacant"
},
{
"info": 6,
"type": "u32",
"name": "len"
},
{
"info": 6,
"type": "u32",
"name": "len_entries"
}
],
"type": "{\"last_vacant\":\"u32\",\"len\":\"u32\",\"len_entries\":\"u32\"}"
},
{
"info": 6,
"type": "u32"
},
{
"displayName": "Entry",
"namespace": "ink_storage::collections::stash",
"params": [
{
"info": 10,
"sub": [
{
"info": 6,
"type": "u32"
},
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"type": "AccountId"
}
],
"type": "(u32, AccountId)"
}
],
"info": 3,
"sub": [
{
"displayName": "VacantEntry",
"namespace": "ink_storage::collections::stash",
"info": 9,
"sub": [
{
"info": 6,
"type": "u32",
"name": "next"
},
{
"info": 6,
"type": "u32",
"name": "prev"
}
],
"type": "{\"next\":\"u32\",\"prev\":\"u32\"}",
"name": "Vacant"
},
{
"info": 10,
"sub": [
{
"info": 6,
"type": "u32"
},
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"type": "AccountId"
}
],
"type": "(u32, AccountId)",
"name": "Occupied"
}
],
"type": "{\"_enum\":{\"Vacant\":\"VacantEntry\",\"Occupied\":\"(u32, AccountId)\"}}"
},
{
"info": 10,
"sub": [
{
"info": 6,
"type": "u32"
},
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"type": "AccountId"
}
],
"type": "(u32, AccountId)"
},
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"type": "AccountId"
},
{
"info": 12,
"length": 32,
"sub": {
"info": 6,
"type": "u8"
},
"type": "[u8;32]"
},
{
"info": 6,
"type": "u8"
},
{
"displayName": "VacantEntry",
"namespace": "ink_storage::collections::stash",
"info": 9,
"sub": [
{
"info": 6,
"type": "u32",
"name": "next"
},
{
"info": 6,
"type": "u32",
"name": "prev"
}
],
"type": "{\"next\":\"u32\",\"prev\":\"u32\"}"
},
{
"displayName": "ValueEntry",
"namespace": "ink_storage::collections::hashmap",
"params": [
{
"info": 10,
"sub": [],
"type": "()"
}
],
"info": 9,
"sub": [
{
"info": 10,
"sub": [],
"type": "()",
"name": "value"
},
{
"info": 6,
"type": "u32",
"name": "key_index"
}
],
"type": "{\"value\":\"()\",\"key_index\":\"u32\"}"
},
{
"info": 10,
"sub": [],
"type": "()"
},
{
"displayName": "Entry",
"namespace": "ink_storage::collections::stash",
"params": [
{
"info": 6,
"type": "u32"
}
],
"info": 3,
"sub": [
{
"displayName": "VacantEntry",
"namespace": "ink_storage::collections::stash",
"info": 9,
"sub": [
{
"info": 6,
"type": "u32",
"name": "next"
},
{
"info": 6,
"type": "u32",
"name": "prev"
}
],
"type": "{\"next\":\"u32\",\"prev\":\"u32\"}",
"name": "Vacant"
},
{
"info": 6,
"type": "u32",
"name": "Occupied"
}
],
"type": "{\"_enum\":{\"Vacant\":\"VacantEntry\",\"Occupied\":\"u32\"}}"
},
{
"displayName": "ValueEntry",
"namespace": "ink_storage::collections::hashmap",
"params": [
{
"info": 6,
"type": "u32"
}
],
"info": 9,
"sub": [
{
"info": 6,
"type": "u32",
"name": "value"
},
{
"info": 6,
"type": "u32",
"name": "key_index"
}
],
"type": "{\"value\":\"u32\",\"key_index\":\"u32\"}"
},
{
"displayName": "Entry",
"namespace": "ink_storage::collections::stash",
"params": [
{
"displayName": "Transaction",
"namespace": "multisig_plain::multisig_plain",
"info": 9,
"sub": [
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"type": "AccountId",
"name": "callee"
},
{
"info": 12,
"length": 4,
"sub": {
"info": 6,
"type": "u8"
},
"type": "[u8;4]",
"name": "selector"
},
{
"info": 11,
"sub": {
"info": 6,
"type": "u8"
},
"type": "Vec<u8>",
"name": "input"
},
{
"info": 6,
"type": "u128",
"name": "transferred_value"
},
{
"info": 6,
"type": "u64",
"name": "gas_limit"
}
],
"type": "{\"callee\":\"AccountId\",\"selector\":\"[u8;4]\",\"input\":\"Vec<u8>\",\"transferred_value\":\"u128\",\"gas_limit\":\"u64\"}"
}
],
"info": 3,
"sub": [
{
"displayName": "VacantEntry",
"namespace": "ink_storage::collections::stash",
"info": 9,
"sub": [
{
"info": 6,
"type": "u32",
"name": "next"
},
{
"info": 6,
"type": "u32",
"name": "prev"
}
],
"type": "{\"next\":\"u32\",\"prev\":\"u32\"}",
"name": "Vacant"
},
{
"displayName": "Transaction",
"namespace": "multisig_plain::multisig_plain",
"info": 9,
"sub": [
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"type": "AccountId",
"name": "callee"
},
{
"info": 12,
"length": 4,
"sub": {
"info": 6,
"type": "u8"
},
"type": "[u8;4]",
"name": "selector"
},
{
"info": 11,
"sub": {
"info": 6,
"type": "u8"
},
"type": "Vec<u8>",
"name": "input"
},
{
"info": 6,
"type": "u128",
"name": "transferred_value"
},
{
"info": 6,
"type": "u64",
"name": "gas_limit"
}
],
"type": "{\"callee\":\"AccountId\",\"selector\":\"[u8;4]\",\"input\":\"Vec<u8>\",\"transferred_value\":\"u128\",\"gas_limit\":\"u64\"}",
"name": "Occupied"
}
],
"type": "{\"_enum\":{\"Vacant\":\"VacantEntry\",\"Occupied\":\"Transaction\"}}"
},
{
"displayName": "Transaction",
"namespace": "multisig_plain::multisig_plain",
"info": 9,
"sub": [
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"type": "AccountId",
"name": "callee"
},
{
"info": 12,
"length": 4,
"sub": {
"info": 6,
"type": "u8"
},
"type": "[u8;4]",
"name": "selector"
},
{
"info": 11,
"sub": {
"info": 6,
"type": "u8"
},
"type": "Vec<u8>",
"name": "input"
},
{
"info": 6,
"type": "u128",
"name": "transferred_value"
},
{
"info": 6,
"type": "u64",
"name": "gas_limit"
}
],
"type": "{\"callee\":\"AccountId\",\"selector\":\"[u8;4]\",\"input\":\"Vec<u8>\",\"transferred_value\":\"u128\",\"gas_limit\":\"u64\"}"
},
{
"info": 12,
"length": 4,
"sub": {
"info": 6,
"type": "u8"
},
"type": "[u8;4]"
},
{
"info": 11,
"sub": {
"info": 6,
"type": "u8"
},
"type": "Vec<u8>"
},
{
"info": 6,
"type": "u128"
},
{
"info": 6,
"type": "u64"
},
{
"displayName": "Entry",
"namespace": "ink_storage::collections::stash",
"params": [
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"type": "AccountId"
}
],
"info": 3,
"sub": [
{
"displayName": "VacantEntry",
"namespace": "ink_storage::collections::stash",
"info": 9,
"sub": [
{
"info": 6,
"type": "u32",
"name": "next"
},
{
"info": 6,
"type": "u32",
"name": "prev"
}
],
"type": "{\"next\":\"u32\",\"prev\":\"u32\"}",
"name": "Vacant"
},
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"type": "AccountId",
"name": "Occupied"
}
],
"type": "{\"_enum\":{\"Vacant\":\"VacantEntry\",\"Occupied\":\"AccountId\"}}"
},
{
"info": 11,
"sub": {
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"type": "AccountId"
},
"type": "Vec<AccountId>"
},
{
"info": 10,
"sub": [
{
"info": 6,
"type": "u32"
},
{
"displayName": "ConfirmationStatus",
"namespace": "multisig_plain::multisig_plain",
"info": 3,
"sub": [
{
"info": 10,
"sub": [],
"name": "Confirmed"
},
{
"info": 6,
"type": "u32",
"name": "ConfirmationsNeeded"
}
],
"type": "{\"_enum\":{\"Confirmed\":\"()\",\"ConfirmationsNeeded\":\"u32\"}}"
}
],
"type": "(u32, ConfirmationStatus)"
},
{
"displayName": "ConfirmationStatus",
"namespace": "multisig_plain::multisig_plain",
"info": 3,
"sub": [
{
"info": 10,
"sub": [],
"name": "Confirmed"
},
{
"info": 6,
"type": "u32",
"name": "ConfirmationsNeeded"
}
],
"type": "{\"_enum\":{\"Confirmed\":\"()\",\"ConfirmationsNeeded\":\"u32\"}}"
},
{
"displayName": "Result",
"params": [
{
"info": 10,
"sub": [],
"type": "()"
},
{
"info": 10,
"sub": [],
"type": "()"
}
],
"info": 7,
"sub": [
{
"name": "Ok",
"info": 10,
"sub": [],
"type": "()"
},
{
"name": "Error",
"info": 10,
"sub": [],
"type": "()"
}
],
"type": "Result<(), ()>"
},
{
"displayName": "Result",
"params": [
{
"info": 11,
"sub": {
"info": 6,
"type": "u8"
},
"type": "Vec<u8>"
},
{
"info": 10,
"sub": [],
"type": "()"
}
],
"info": 7,
"sub": [
{
"name": "Ok",
"info": 11,
"sub": {
"info": 6,
"type": "u8"
},
"type": "Vec<u8>"
},
{
"name": "Error",
"info": 10,
"sub": [],
"type": "()"
}
],
"type": "Result<Vec<u8>, ()>"
},
{
"displayName": "Result",
"params": [
{
"displayName": "Option",
"params": [
{
"info": 11,
"sub": {
"info": 6,
"type": "u8"
},
"type": "Vec<u8>"
}
],
"info": 5,
"sub": {
"info": 11,
"sub": {
"info": 6,
"type": "u8"
},
"type": "Vec<u8>"
},
"type": "Option<Vec<u8>>"
},
{
"info": 10,
"sub": [],
"type": "()"
}
],
"info": 7,
"sub": [
{
"name": "Ok",
"displayName": "Option",
"params": [
{
"info": 11,
"sub": {
"info": 6,
"type": "u8"
},
"type": "Vec<u8>"
}
],
"info": 5,
"sub": {
"info": 11,
"sub": {
"info": 6,
"type": "u8"
},
"type": "Vec<u8>"
},
"type": "Option<Vec<u8>>"
},
{
"name": "Error",
"info": 10,
"sub": [],
"type": "()"
}
],
"type": "Result<Option<Vec<u8>>, ()>"
},
{
"displayName": "Option",
"params": [
{
"info": 11,
"sub": {
"info": 6,
"type": "u8"
},
"type": "Vec<u8>"
}
],
"info": 5,
"sub": {
"info": 11,
"sub": {
"info": 6,
"type": "u8"
},
"type": "Vec<u8>"
},
"type": "Option<Vec<u8>>"
}
]
File diff suppressed because it is too large Load Diff
@@ -1,972 +0,0 @@
[
{
"info": 9,
"type": "{\"__storage\":\"{\\\"value\\\":\\\"{\\\\\\\"cell\\\\\\\":\\\\\\\"{\\\\\\\\\\\\\\\"cell\\\\\\\\\\\\\\\":\\\\\\\\\\\\\\\"([u8;32])\\\\\\\\\\\\\\\"}\\\\\\\"}\\\",\\\"name\\\":\\\"{\\\\\\\"cell\\\\\\\":\\\\\\\"{\\\\\\\\\\\\\\\"cell\\\\\\\\\\\\\\\":\\\\\\\\\\\\\\\"([u8;32])\\\\\\\\\\\\\\\"}\\\\\\\"}\\\"}\",\"__env\":\"{\\\"access\\\":\\\"{\\\\\\\"env\\\\\\\":\\\\\\\"()\\\\\\\",\\\\\\\"buffer\\\\\\\":\\\\\\\"{\\\\\\\\\\\\\\\"elems\\\\\\\\\\\\\\\":\\\\\\\\\\\\\\\"Vec<u8>\\\\\\\\\\\\\\\"}\\\\\\\",\\\\\\\"has_interacted\\\\\\\":\\\\\\\"bool\\\\\\\",\\\\\\\"has_returned_value\\\\\\\":\\\\\\\"bool\\\\\\\"}\\\"}\"}",
"sub": [
{
"info": 9,
"type": "{\"value\":\"{\\\"cell\\\":\\\"{\\\\\\\"cell\\\\\\\":\\\\\\\"([u8;32])\\\\\\\"}\\\"}\",\"name\":\"{\\\"cell\\\":\\\"{\\\\\\\"cell\\\\\\\":\\\\\\\"([u8;32])\\\\\\\"}\\\"}\"}",
"sub": [
{
"info": 9,
"type": "{\"cell\":\"{\\\"cell\\\":\\\"([u8;32])\\\"}\"}",
"sub": [
{
"info": 9,
"type": "{\"cell\":\"([u8;32])\"}",
"sub": [
{
"info": 10,
"type": "([u8;32])",
"sub": [
{
"info": 12,
"type": "[u8;32]",
"length": 32,
"sub": {
"info": 6,
"type": "u8"
},
"index": 0
}
],
"name": "cell",
"namespace": "ink_core::storage::key"
}
],
"name": "cell",
"namespace": "ink_core::storage::cell::sync_cell",
"params": [
{
"info": 6,
"type": "bool"
}
]
}
],
"name": "value",
"namespace": "ink_core::storage::value",
"params": [
{
"info": 6,
"type": "bool"
}
]
},
{
"info": 9,
"type": "{\"cell\":\"{\\\"cell\\\":\\\"([u8;32])\\\"}\"}",
"sub": [
{
"info": 9,
"type": "{\"cell\":\"([u8;32])\"}",
"sub": [
{
"info": 10,
"type": "([u8;32])",
"sub": [
{
"info": 12,
"type": "[u8;32]",
"length": 32,
"sub": {
"info": 6,
"type": "u8"
},
"index": 0
}
],
"name": "cell",
"namespace": "ink_core::storage::key"
}
],
"name": "cell",
"namespace": "ink_core::storage::cell::sync_cell",
"params": [
{
"info": 9,
"type": "{\"vec\":\"{\\\"elems\\\":\\\"Vec<u8>\\\"}\"}",
"sub": [
{
"info": 9,
"type": "{\"elems\":\"Vec<u8>\"}",
"sub": [
{
"info": 11,
"type": "Vec<u8>",
"sub": {
"info": 6,
"type": "u8"
},
"name": "elems"
}
],
"name": "vec",
"params": [
{
"info": 6,
"type": "u8"
}
]
}
]
}
]
}
],
"name": "name",
"namespace": "ink_core::storage::value",
"params": [
{
"info": 9,
"type": "{\"vec\":\"{\\\"elems\\\":\\\"Vec<u8>\\\"}\"}",
"sub": [
{
"info": 9,
"type": "{\"elems\":\"Vec<u8>\"}",
"sub": [
{
"info": 11,
"type": "Vec<u8>",
"sub": {
"info": 6,
"type": "u8"
},
"name": "elems"
}
],
"name": "vec",
"params": [
{
"info": 6,
"type": "u8"
}
]
}
]
}
]
}
],
"name": "__storage",
"namespace": "app::app::__ink_private::__ink_storage"
},
{
"info": 9,
"type": "{\"access\":\"{\\\"env\\\":\\\"()\\\",\\\"buffer\\\":\\\"{\\\\\\\"elems\\\\\\\":\\\\\\\"Vec<u8>\\\\\\\"}\\\",\\\"has_interacted\\\":\\\"bool\\\",\\\"has_returned_value\\\":\\\"bool\\\"}\"}",
"sub": [
{
"info": 9,
"type": "{\"env\":\"()\",\"buffer\":\"{\\\"elems\\\":\\\"Vec<u8>\\\"}\",\"has_interacted\":\"bool\",\"has_returned_value\":\"bool\"}",
"sub": [
{
"info": 10,
"type": "()",
"sub": [],
"name": "env",
"params": [
{
"info": 9,
"type": "{}",
"sub": [],
"name": "TestEnv",
"namespace": "ink_core::env2::test::accessor",
"params": [
{
"info": 3,
"type": "[]",
"sub": [],
"name": "DefaultSrmlTypes",
"namespace": "ink_core::env2::types"
}
]
}
]
},
{
"info": 9,
"type": "{\"elems\":\"Vec<u8>\"}",
"sub": [
{
"info": 11,
"type": "Vec<u8>",
"sub": {
"info": 6,
"type": "u8"
},
"name": "elems"
}
],
"name": "buffer",
"params": [
{
"info": 6,
"type": "u8"
}
]
},
{
"info": 6,
"type": "bool",
"name": "has_interacted"
},
{
"info": 6,
"type": "bool",
"name": "has_returned_value"
}
],
"name": "access",
"namespace": "ink_core::env2::env_access::mutable",
"params": [
{
"info": 9,
"type": "{}",
"sub": [],
"name": "TestEnv",
"namespace": "ink_core::env2::test::accessor",
"params": [
{
"info": 3,
"type": "[]",
"sub": [],
"name": "DefaultSrmlTypes",
"namespace": "ink_core::env2::types"
}
]
}
]
}
],
"name": "__env",
"namespace": "ink_core::env2::env_access::immutable",
"params": [
{
"info": 9,
"type": "{}",
"sub": [],
"name": "TestEnv",
"namespace": "ink_core::env2::test::accessor",
"params": [
{
"info": 3,
"type": "[]",
"sub": [],
"name": "DefaultSrmlTypes",
"namespace": "ink_core::env2::types"
}
]
}
]
}
],
"name": "StorageAndEnv",
"namespace": "app::app::__ink_private::__ink_storage"
},
{
"info": 9,
"type": "{\"value\":\"{\\\"cell\\\":\\\"{\\\\\\\"cell\\\\\\\":\\\\\\\"([u8;32])\\\\\\\"}\\\"}\",\"name\":\"{\\\"cell\\\":\\\"{\\\\\\\"cell\\\\\\\":\\\\\\\"([u8;32])\\\\\\\"}\\\"}\"}",
"sub": [
{
"info": 9,
"type": "{\"cell\":\"{\\\"cell\\\":\\\"([u8;32])\\\"}\"}",
"sub": [
{
"info": 9,
"type": "{\"cell\":\"([u8;32])\"}",
"sub": [
{
"info": 10,
"type": "([u8;32])",
"sub": [
{
"info": 12,
"type": "[u8;32]",
"length": 32,
"sub": {
"info": 6,
"type": "u8"
},
"index": 0
}
],
"name": "cell",
"namespace": "ink_core::storage::key"
}
],
"name": "cell",
"namespace": "ink_core::storage::cell::sync_cell",
"params": [
{
"info": 6,
"type": "bool"
}
]
}
],
"name": "value",
"namespace": "ink_core::storage::value",
"params": [
{
"info": 6,
"type": "bool"
}
]
},
{
"info": 9,
"type": "{\"cell\":\"{\\\"cell\\\":\\\"([u8;32])\\\"}\"}",
"sub": [
{
"info": 9,
"type": "{\"cell\":\"([u8;32])\"}",
"sub": [
{
"info": 10,
"type": "([u8;32])",
"sub": [
{
"info": 12,
"type": "[u8;32]",
"length": 32,
"sub": {
"info": 6,
"type": "u8"
},
"index": 0
}
],
"name": "cell",
"namespace": "ink_core::storage::key"
}
],
"name": "cell",
"namespace": "ink_core::storage::cell::sync_cell",
"params": [
{
"info": 9,
"type": "{\"vec\":\"{\\\"elems\\\":\\\"Vec<u8>\\\"}\"}",
"sub": [
{
"info": 9,
"type": "{\"elems\":\"Vec<u8>\"}",
"sub": [
{
"info": 11,
"type": "Vec<u8>",
"sub": {
"info": 6,
"type": "u8"
},
"name": "elems"
}
],
"name": "vec",
"params": [
{
"info": 6,
"type": "u8"
}
]
}
]
}
]
}
],
"name": "name",
"namespace": "ink_core::storage::value",
"params": [
{
"info": 9,
"type": "{\"vec\":\"{\\\"elems\\\":\\\"Vec<u8>\\\"}\"}",
"sub": [
{
"info": 9,
"type": "{\"elems\":\"Vec<u8>\"}",
"sub": [
{
"info": 11,
"type": "Vec<u8>",
"sub": {
"info": 6,
"type": "u8"
},
"name": "elems"
}
],
"name": "vec",
"params": [
{
"info": 6,
"type": "u8"
}
]
}
]
}
]
}
],
"name": "Storage",
"namespace": "app::app::__ink_private::__ink_storage"
},
{
"info": 9,
"type": "{\"cell\":\"{\\\"cell\\\":\\\"([u8;32])\\\"}\"}",
"sub": [
{
"info": 9,
"type": "{\"cell\":\"([u8;32])\"}",
"sub": [
{
"info": 10,
"type": "([u8;32])",
"sub": [
{
"info": 12,
"type": "[u8;32]",
"length": 32,
"sub": {
"info": 6,
"type": "u8"
},
"index": 0
}
],
"name": "cell",
"namespace": "ink_core::storage::key"
}
],
"name": "cell",
"namespace": "ink_core::storage::cell::sync_cell",
"params": [
{
"info": 6,
"type": "bool"
}
]
}
],
"name": "Value",
"namespace": "ink_core::storage::value",
"params": [
{
"info": 6,
"type": "bool"
}
]
},
{
"info": 6,
"type": "bool"
},
{
"info": 9,
"type": "{\"cell\":\"([u8;32])\"}",
"sub": [
{
"info": 10,
"type": "([u8;32])",
"sub": [
{
"info": 12,
"type": "[u8;32]",
"length": 32,
"sub": {
"info": 6,
"type": "u8"
},
"index": 0
}
],
"name": "cell",
"namespace": "ink_core::storage::key"
}
],
"name": "SyncCell",
"namespace": "ink_core::storage::cell::sync_cell",
"params": [
{
"info": 6,
"type": "bool"
}
]
},
{
"info": 10,
"type": "([u8;32])",
"sub": [
{
"info": 12,
"type": "[u8;32]",
"length": 32,
"sub": {
"info": 6,
"type": "u8"
},
"index": 0
}
],
"name": "Key",
"namespace": "ink_core::storage::key"
},
{
"info": 12,
"type": "[u8;32]",
"length": 32,
"sub": {
"info": 6,
"type": "u8"
}
},
{
"info": 6,
"type": "u8"
},
{
"info": 9,
"type": "{\"cell\":\"{\\\"cell\\\":\\\"([u8;32])\\\"}\"}",
"sub": [
{
"info": 9,
"type": "{\"cell\":\"([u8;32])\"}",
"sub": [
{
"info": 10,
"type": "([u8;32])",
"sub": [
{
"info": 12,
"type": "[u8;32]",
"length": 32,
"sub": {
"info": 6,
"type": "u8"
},
"index": 0
}
],
"name": "cell",
"namespace": "ink_core::storage::key"
}
],
"name": "cell",
"namespace": "ink_core::storage::cell::sync_cell",
"params": [
{
"info": 9,
"type": "{\"vec\":\"{\\\"elems\\\":\\\"Vec<u8>\\\"}\"}",
"sub": [
{
"info": 9,
"type": "{\"elems\":\"Vec<u8>\"}",
"sub": [
{
"info": 11,
"type": "Vec<u8>",
"sub": {
"info": 6,
"type": "u8"
},
"name": "elems"
}
],
"name": "vec",
"params": [
{
"info": 6,
"type": "u8"
}
]
}
]
}
]
}
],
"name": "Value",
"namespace": "ink_core::storage::value",
"params": [
{
"info": 9,
"type": "{\"vec\":\"{\\\"elems\\\":\\\"Vec<u8>\\\"}\"}",
"sub": [
{
"info": 9,
"type": "{\"elems\":\"Vec<u8>\"}",
"sub": [
{
"info": 11,
"type": "Vec<u8>",
"sub": {
"info": 6,
"type": "u8"
},
"name": "elems"
}
],
"name": "vec",
"params": [
{
"info": 6,
"type": "u8"
}
]
}
]
}
]
},
{
"info": 9,
"type": "{\"vec\":\"{\\\"elems\\\":\\\"Vec<u8>\\\"}\"}",
"sub": [
{
"info": 9,
"type": "{\"elems\":\"Vec<u8>\"}",
"sub": [
{
"info": 11,
"type": "Vec<u8>",
"sub": {
"info": 6,
"type": "u8"
},
"name": "elems"
}
],
"name": "vec",
"params": [
{
"info": 6,
"type": "u8"
}
]
}
]
},
{
"info": 9,
"type": "{\"elems\":\"Vec<u8>\"}",
"sub": [
{
"info": 11,
"type": "Vec<u8>",
"sub": {
"info": 6,
"type": "u8"
},
"name": "elems"
}
],
"name": "Vec",
"params": [
{
"info": 6,
"type": "u8"
}
]
},
{
"info": 11,
"type": "Vec<u8>",
"sub": {
"info": 6,
"type": "u8"
}
},
{
"info": 9,
"type": "{\"cell\":\"([u8;32])\"}",
"sub": [
{
"info": 10,
"type": "([u8;32])",
"sub": [
{
"info": 12,
"type": "[u8;32]",
"length": 32,
"sub": {
"info": 6,
"type": "u8"
},
"index": 0
}
],
"name": "cell",
"namespace": "ink_core::storage::key"
}
],
"name": "SyncCell",
"namespace": "ink_core::storage::cell::sync_cell",
"params": [
{
"info": 9,
"type": "{\"vec\":\"{\\\"elems\\\":\\\"Vec<u8>\\\"}\"}",
"sub": [
{
"info": 9,
"type": "{\"elems\":\"Vec<u8>\"}",
"sub": [
{
"info": 11,
"type": "Vec<u8>",
"sub": {
"info": 6,
"type": "u8"
},
"name": "elems"
}
],
"name": "vec",
"params": [
{
"info": 6,
"type": "u8"
}
]
}
]
}
]
},
{
"info": 9,
"type": "{\"access\":\"{\\\"env\\\":\\\"()\\\",\\\"buffer\\\":\\\"{\\\\\\\"elems\\\\\\\":\\\\\\\"Vec<u8>\\\\\\\"}\\\",\\\"has_interacted\\\":\\\"bool\\\",\\\"has_returned_value\\\":\\\"bool\\\"}\"}",
"sub": [
{
"info": 9,
"type": "{\"env\":\"()\",\"buffer\":\"{\\\"elems\\\":\\\"Vec<u8>\\\"}\",\"has_interacted\":\"bool\",\"has_returned_value\":\"bool\"}",
"sub": [
{
"info": 10,
"type": "()",
"sub": [],
"name": "env",
"params": [
{
"info": 9,
"type": "{}",
"sub": [],
"name": "TestEnv",
"namespace": "ink_core::env2::test::accessor",
"params": [
{
"info": 3,
"type": "[]",
"sub": [],
"name": "DefaultSrmlTypes",
"namespace": "ink_core::env2::types"
}
]
}
]
},
{
"info": 9,
"type": "{\"elems\":\"Vec<u8>\"}",
"sub": [
{
"info": 11,
"type": "Vec<u8>",
"sub": {
"info": 6,
"type": "u8"
},
"name": "elems"
}
],
"name": "buffer",
"params": [
{
"info": 6,
"type": "u8"
}
]
},
{
"info": 6,
"type": "bool",
"name": "has_interacted"
},
{
"info": 6,
"type": "bool",
"name": "has_returned_value"
}
],
"name": "access",
"namespace": "ink_core::env2::env_access::mutable",
"params": [
{
"info": 9,
"type": "{}",
"sub": [],
"name": "TestEnv",
"namespace": "ink_core::env2::test::accessor",
"params": [
{
"info": 3,
"type": "[]",
"sub": [],
"name": "DefaultSrmlTypes",
"namespace": "ink_core::env2::types"
}
]
}
]
}
],
"name": "EnvAccess",
"namespace": "ink_core::env2::env_access::immutable",
"params": [
{
"info": 9,
"type": "{}",
"sub": [],
"name": "TestEnv",
"namespace": "ink_core::env2::test::accessor",
"params": [
{
"info": 3,
"type": "[]",
"sub": [],
"name": "DefaultSrmlTypes",
"namespace": "ink_core::env2::types"
}
]
}
]
},
{
"info": 9,
"type": "{}",
"sub": [],
"name": "TestEnv",
"namespace": "ink_core::env2::test::accessor",
"params": [
{
"info": 3,
"type": "[]",
"sub": [],
"name": "DefaultSrmlTypes",
"namespace": "ink_core::env2::types"
}
]
},
{
"info": 3,
"type": "[]",
"sub": [],
"name": "DefaultSrmlTypes",
"namespace": "ink_core::env2::types"
},
{
"info": 9,
"type": "{\"env\":\"()\",\"buffer\":\"{\\\"elems\\\":\\\"Vec<u8>\\\"}\",\"has_interacted\":\"bool\",\"has_returned_value\":\"bool\"}",
"sub": [
{
"info": 10,
"type": "()",
"sub": [],
"name": "env",
"params": [
{
"info": 9,
"type": "{}",
"sub": [],
"name": "TestEnv",
"namespace": "ink_core::env2::test::accessor",
"params": [
{
"info": 3,
"type": "[]",
"sub": [],
"name": "DefaultSrmlTypes",
"namespace": "ink_core::env2::types"
}
]
}
]
},
{
"info": 9,
"type": "{\"elems\":\"Vec<u8>\"}",
"sub": [
{
"info": 11,
"type": "Vec<u8>",
"sub": {
"info": 6,
"type": "u8"
},
"name": "elems"
}
],
"name": "buffer",
"params": [
{
"info": 6,
"type": "u8"
}
]
},
{
"info": 6,
"type": "bool",
"name": "has_interacted"
},
{
"info": 6,
"type": "bool",
"name": "has_returned_value"
}
],
"name": "EnvAccessMut",
"namespace": "ink_core::env2::env_access::mutable",
"params": [
{
"info": 9,
"type": "{}",
"sub": [],
"name": "TestEnv",
"namespace": "ink_core::env2::test::accessor",
"params": [
{
"info": 3,
"type": "[]",
"sub": [],
"name": "DefaultSrmlTypes",
"namespace": "ink_core::env2::types"
}
]
}
]
},
{
"info": 10,
"type": "()",
"sub": [],
"name": "PhantomData",
"params": [
{
"info": 9,
"type": "{}",
"sub": [],
"name": "TestEnv",
"namespace": "ink_core::env2::test::accessor",
"params": [
{
"info": 3,
"type": "[]",
"sub": [],
"name": "DefaultSrmlTypes",
"namespace": "ink_core::env2::types"
}
]
}
]
}
]
File diff suppressed because it is too large Load Diff
@@ -1 +0,0 @@
{"name":"Flipper","deploy":{"args":[]},"messages":[{"name":"flip","selector":970692492,"mutates":true,"args":[],"return_type":null},{"name":"get","selector":4266279973,"mutates":false,"args":[],"return_type":"bool"}]}
@@ -1,201 +0,0 @@
{
"registry": {
"strings": [
"Flipper",
"flipper",
"normal",
"value",
"Value",
"ink_core",
"storage",
"cell",
"SyncCell",
"sync_cell",
"Key",
"key",
"flip",
"get"
],
"types": [
{
"id": {
"custom.name": 1,
"custom.namespace": [
2,
3
],
"custom.params": []
},
"def": {
"struct.fields": [
{
"name": 4,
"type": 2
}
]
}
},
{
"id": {
"custom.name": 5,
"custom.namespace": [
6,
7,
4
],
"custom.params": [
3
]
},
"def": {
"struct.fields": [
{
"name": 8,
"type": 4
}
]
}
},
{
"id": "bool",
"def": "builtin"
},
{
"id": {
"custom.name": 9,
"custom.namespace": [
6,
7,
8,
10
],
"custom.params": [
3
]
},
"def": {
"struct.fields": [
{
"name": 8,
"type": 5
}
]
}
},
{
"id": {
"custom.name": 11,
"custom.namespace": [
6,
7,
12
],
"custom.params": []
},
"def": {
"tuple_struct.types": [
6
]
}
},
{
"id": {
"array.len": 32,
"array.type": 7
},
"def": "builtin"
},
{
"id": "u8",
"def": "builtin"
}
]
},
"storage": {
"struct.type": 1,
"struct.fields": [
{
"name": 4,
"layout": {
"struct.type": 2,
"struct.fields": [
{
"name": 8,
"layout": {
"range.offset": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
"range.len": 1,
"range.elem_type": 3
}
}
]
}
}
]
},
"contract": {
"name": 1,
"deploy": {
"args": [],
"docs": [
"Initializes our state to `false` upon deploying our smart contract."
]
},
"messages": [
{
"name": 13,
"selector": 970692492,
"mutates": true,
"args": [],
"return_type": null,
"docs": [
"Flips the current state of our smart contract."
]
},
{
"name": 14,
"selector": 4266279973,
"mutates": false,
"args": [],
"return_type": 3,
"docs": [
"Returns the current state."
]
}
],
"events": [],
"docs": []
}
}
@@ -1 +0,0 @@
{"name":"SharedVec","deploy":{"args":[]},"messages":[{"name":"push","selector":865577567,"mutates":true,"args":[{"name":"value","type":"i32"}],"return_type":{"Result<T,E>":{"T":[],"E":"u32"}}},{"name":"register","selector":572030971,"mutates":true,"args":[{"name":"mutator","type":"AccountId"},{"name":"begin","type":{"Option<T>":{"T":"u32"}}},{"name":"end","type":{"Option<T>":{"T":"u32"}}}],"return_type":{"Result<T,E>":{"T":[],"E":"u32"}}},{"name":"set","selector":2028185770,"mutates":true,"args":[{"name":"at","type":"u32"},{"name":"to","type":"i32"}],"return_type":{"Result<T,E>":{"T":"i32","E":"u32"}}},{"name":"get","selector":4266279973,"mutates":false,"args":[{"name":"at","type":"u32"}],"return_type":{"Option<T>":{"T":"i32"}}},{"name":"len","selector":1403873684,"mutates":false,"args":[],"return_type":"u32"}]}
@@ -1,935 +0,0 @@
{
"registry": {
"strings": [
"SharedVec",
"shared_vec",
"normal",
"mutators",
"HashMap",
"ink_core",
"storage",
"collections",
"hash_map",
"impls",
"AccountId",
"env",
"srml",
"types",
"Access",
"begin",
"Option",
"None",
"Some",
"end",
"len",
"Value",
"value",
"cell",
"SyncCell",
"sync_cell",
"Key",
"key",
"entries",
"SyncChunk",
"chunk",
"sync_chunk",
"Entry",
"Occupied",
"OccupiedEntry",
"val",
"Removed",
"cells_key",
"vec",
"Vec",
"cells",
"on_deploy",
"push",
"i32",
"Result",
"Ok",
"Err",
"register",
"mutator",
"set",
"at",
"u32",
"to",
"get",
"Mutate",
"Push",
"Register"
],
"types": [
{
"id": {
"custom.name": 1,
"custom.namespace": [
2,
3
],
"custom.params": []
},
"def": {
"struct.fields": [
{
"name": 4,
"type": 2
},
{
"name": 39,
"type": 15
}
]
}
},
{
"id": {
"custom.name": 5,
"custom.namespace": [
6,
7,
8,
9,
10
],
"custom.params": [
3,
6
]
},
"def": {
"struct.fields": [
{
"name": 21,
"type": 9
},
{
"name": 29,
"type": 12
}
]
}
},
{
"id": {
"custom.name": 11,
"custom.namespace": [
6,
12,
13,
14
],
"custom.params": []
},
"def": {
"tuple_struct.types": [
4
]
}
},
{
"id": {
"array.len": 32,
"array.type": 5
},
"def": "builtin"
},
{
"id": "u8",
"def": "builtin"
},
{
"id": {
"custom.name": 15,
"custom.namespace": [
2
],
"custom.params": []
},
"def": {
"struct.fields": [
{
"name": 16,
"type": 7
},
{
"name": 20,
"type": 7
}
]
}
},
{
"id": {
"custom.name": 17,
"custom.namespace": [],
"custom.params": [
8
]
},
"def": {
"enum.variants": [
{
"unit_variant.name": 18
},
{
"tuple_struct_variant.name": 19,
"tuple_struct_variant.types": [
8
]
}
]
}
},
{
"id": "u32",
"def": "builtin"
},
{
"id": {
"custom.name": 22,
"custom.namespace": [
6,
7,
23
],
"custom.params": [
8
]
},
"def": {
"struct.fields": [
{
"name": 24,
"type": 10
}
]
}
},
{
"id": {
"custom.name": 25,
"custom.namespace": [
6,
7,
24,
26
],
"custom.params": [
8
]
},
"def": {
"struct.fields": [
{
"name": 24,
"type": 11
}
]
}
},
{
"id": {
"custom.name": 27,
"custom.namespace": [
6,
7,
28
],
"custom.params": []
},
"def": {
"tuple_struct.types": [
4
]
}
},
{
"id": {
"custom.name": 30,
"custom.namespace": [
6,
7,
31,
32,
31
],
"custom.params": [
13
]
},
"def": {
"struct.fields": [
{
"name": 38,
"type": 11
}
]
}
},
{
"id": {
"custom.name": 33,
"custom.namespace": [
6,
7,
8,
9,
10
],
"custom.params": [
3,
6
]
},
"def": {
"enum.variants": [
{
"tuple_struct_variant.name": 34,
"tuple_struct_variant.types": [
14
]
},
{
"unit_variant.name": 37
}
]
}
},
{
"id": {
"custom.name": 35,
"custom.namespace": [
6,
7,
8,
9,
10
],
"custom.params": [
3,
6
]
},
"def": {
"struct.fields": [
{
"name": 28,
"type": 3
},
{
"name": 36,
"type": 6
}
]
}
},
{
"id": {
"custom.name": 40,
"custom.namespace": [
6,
7,
8,
39,
10
],
"custom.params": [
16
]
},
"def": {
"struct.fields": [
{
"name": 21,
"type": 9
},
{
"name": 41,
"type": 17
}
]
}
},
{
"id": "i32",
"def": "builtin"
},
{
"id": {
"custom.name": 30,
"custom.namespace": [
6,
7,
31,
32,
31
],
"custom.params": [
16
]
},
"def": {
"struct.fields": [
{
"name": 38,
"type": 11
}
]
}
},
{
"id": {
"custom.name": 45,
"custom.namespace": [],
"custom.params": [
19,
8
]
},
"def": {
"enum.variants": [
{
"tuple_struct_variant.name": 46,
"tuple_struct_variant.types": [
19
]
},
{
"tuple_struct_variant.name": 47,
"tuple_struct_variant.types": [
8
]
}
]
}
},
{
"id": [],
"def": "builtin"
},
{
"id": {
"custom.name": 45,
"custom.namespace": [],
"custom.params": [
16,
8
]
},
"def": {
"enum.variants": [
{
"tuple_struct_variant.name": 46,
"tuple_struct_variant.types": [
16
]
},
{
"tuple_struct_variant.name": 47,
"tuple_struct_variant.types": [
8
]
}
]
}
},
{
"id": {
"custom.name": 17,
"custom.namespace": [],
"custom.params": [
16
]
},
"def": {
"enum.variants": [
{
"unit_variant.name": 18
},
{
"tuple_struct_variant.name": 19,
"tuple_struct_variant.types": [
16
]
}
]
}
}
]
},
"storage": {
"struct.type": 1,
"struct.fields": [
{
"name": 4,
"layout": {
"struct.type": 2,
"struct.fields": [
{
"name": 21,
"layout": {
"struct.type": 9,
"struct.fields": [
{
"name": 24,
"layout": {
"range.offset": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
"range.len": 1,
"range.elem_type": 8
}
}
]
}
},
{
"name": 29,
"layout": {
"range.offset": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1
],
"range.len": 4294967295,
"range.elem_type": 13
}
}
]
}
},
{
"name": 39,
"layout": {
"struct.type": 15,
"struct.fields": [
{
"name": 21,
"layout": {
"struct.type": 9,
"struct.fields": [
{
"name": 24,
"layout": {
"range.offset": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0
],
"range.len": 1,
"range.elem_type": 8
}
}
]
}
},
{
"name": 41,
"layout": {
"range.offset": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
1
],
"range.len": 4294967295,
"range.elem_type": 16
}
}
]
}
}
]
},
"contract": {
"name": 1,
"constructors": [
{
"name": 42,
"selector": 0,
"args": [],
"docs": [
"Initializes the value to the initial value."
]
}
],
"messages": [
{
"name": 43,
"selector": 865577567,
"mutates": true,
"args": [
{
"name": 23,
"type": {
"ty": 16,
"display_name": [
44
]
}
}
],
"return_type": {
"ty": 18,
"display_name": [
45
]
},
"docs": [
"Pushes a new value to the shared vector.",
"",
"# Errors",
"",
"- If the caller does not have unlimited access rights."
]
},
{
"name": 48,
"selector": 572030971,
"mutates": true,
"args": [
{
"name": 49,
"type": {
"ty": 3,
"display_name": [
11
]
}
},
{
"name": 16,
"type": {
"ty": 7,
"display_name": [
17
]
}
},
{
"name": 20,
"type": {
"ty": 7,
"display_name": [
17
]
}
}
],
"return_type": {
"ty": 18,
"display_name": [
45
]
},
"docs": [
"Registers a new user with the given access rights.",
"",
"Can also be used to change access rights of an already existing user.",
"",
"# Errors",
"",
"- If the caller does not have unlimited access rights."
]
},
{
"name": 50,
"selector": 2028185770,
"mutates": true,
"args": [
{
"name": 51,
"type": {
"ty": 8,
"display_name": [
52
]
}
},
{
"name": 53,
"type": {
"ty": 16,
"display_name": [
44
]
}
}
],
"return_type": {
"ty": 20,
"display_name": [
45
]
},
"docs": [
"Sets the value at the given position to the given value.",
"",
"Returns the previous value.",
"",
"# Errors",
"",
"- If the given position is out of bounds.",
"- If the caller does not have the required access rights."
]
},
{
"name": 54,
"selector": 4266279973,
"mutates": false,
"args": [
{
"name": 51,
"type": {
"ty": 8,
"display_name": [
52
]
}
}
],
"return_type": {
"ty": 21,
"display_name": [
17
]
},
"docs": [
"Returns the value of the shared vector at the given position",
"or `None` if the access is out of bounds."
]
},
{
"name": 21,
"selector": 1403873684,
"mutates": false,
"args": [],
"return_type": {
"ty": 8,
"display_name": [
52
]
},
"docs": [
"Returns the length of the shared vector."
]
}
],
"events": [
{
"name": 55,
"args": [
{
"name": 51,
"indexed": false,
"type": {
"ty": 8,
"display_name": [
52
]
}
},
{
"name": 23,
"indexed": false,
"type": {
"ty": 16,
"display_name": [
44
]
}
}
],
"docs": [
"Fires whenever a mutator changes the vector."
]
},
{
"name": 56,
"args": [
{
"name": 49,
"indexed": false,
"type": {
"ty": 3,
"display_name": [
11
]
}
},
{
"name": 23,
"indexed": false,
"type": {
"ty": 16,
"display_name": [
44
]
}
}
],
"docs": [
"Fires whenever a mutator pushes the vector successfully."
]
},
{
"name": 57,
"args": [
{
"name": 49,
"indexed": false,
"type": {
"ty": 3,
"display_name": [
11
]
}
},
{
"name": 16,
"indexed": false,
"type": {
"ty": 7,
"display_name": [
17
]
}
},
{
"name": 20,
"indexed": false,
"type": {
"ty": 7,
"display_name": [
17
]
}
}
],
"docs": [
"Fires whenever a new mutator is registered",
"or when a mutators access rights are changed."
]
}
],
"docs": []
}
}
@@ -1,697 +0,0 @@
{
"registry": {
"strings": [
"RustStructures",
"structures",
"normal",
"my_tuple_struct",
"Value",
"ink_core",
"storage",
"value",
"TupleStruct",
"cell",
"SyncCell",
"sync_cell",
"Key",
"key",
"my_struct",
"Struct",
"first",
"seconds",
"my_clike_enum",
"ClikeEnum",
"FirstVariant",
"SecondVariant",
"ThirdVariant",
"my_enum",
"RustEnum",
"NoData",
"TupleVariant",
"StructVariant",
"second",
"my_union",
"Union"
],
"types": [
{
"id": {
"custom.name": 1,
"custom.namespace": [
2,
3
],
"custom.params": []
},
"def": {
"struct.fields": [
{
"name": 4,
"type": 2
},
{
"name": 15,
"type": 9
},
{
"name": 19,
"type": 12
},
{
"name": 24,
"type": 15
},
{
"name": 30,
"type": 18
}
]
}
},
{
"id": {
"custom.name": 5,
"custom.namespace": [
6,
7,
8
],
"custom.params": [
3
]
},
"def": {
"struct.fields": [
{
"name": 10,
"type": 6
}
]
}
},
{
"id": {
"custom.name": 9,
"custom.namespace": [
2
],
"custom.params": []
},
"def": {
"tuple_struct.types": [
4,
5
]
}
},
{
"id": "u8",
"def": "builtin"
},
{
"id": "u16",
"def": "builtin"
},
{
"id": {
"custom.name": 11,
"custom.namespace": [
6,
7,
10,
12
],
"custom.params": [
3
]
},
"def": {
"struct.fields": [
{
"name": 10,
"type": 7
}
]
}
},
{
"id": {
"custom.name": 13,
"custom.namespace": [
6,
7,
14
],
"custom.params": []
},
"def": {
"tuple_struct.types": [
8
]
}
},
{
"id": {
"array.len": 32,
"array.type": 4
},
"def": "builtin"
},
{
"id": {
"custom.name": 5,
"custom.namespace": [
6,
7,
8
],
"custom.params": [
10
]
},
"def": {
"struct.fields": [
{
"name": 10,
"type": 11
}
]
}
},
{
"id": {
"custom.name": 16,
"custom.namespace": [
2
],
"custom.params": []
},
"def": {
"struct.fields": [
{
"name": 17,
"type": 4
},
{
"name": 18,
"type": 5
}
]
}
},
{
"id": {
"custom.name": 11,
"custom.namespace": [
6,
7,
10,
12
],
"custom.params": [
10
]
},
"def": {
"struct.fields": [
{
"name": 10,
"type": 7
}
]
}
},
{
"id": {
"custom.name": 5,
"custom.namespace": [
6,
7,
8
],
"custom.params": [
13
]
},
"def": {
"struct.fields": [
{
"name": 10,
"type": 14
}
]
}
},
{
"id": {
"custom.name": 20,
"custom.namespace": [
2
],
"custom.params": []
},
"def": {
"clike_enum.variants": [
{
"name": 21,
"discriminant": 0
},
{
"name": 22,
"discriminant": 1
},
{
"name": 23,
"discriminant": 42
}
]
}
},
{
"id": {
"custom.name": 11,
"custom.namespace": [
6,
7,
10,
12
],
"custom.params": [
13
]
},
"def": {
"struct.fields": [
{
"name": 10,
"type": 7
}
]
}
},
{
"id": {
"custom.name": 5,
"custom.namespace": [
6,
7,
8
],
"custom.params": [
16
]
},
"def": {
"struct.fields": [
{
"name": 10,
"type": 17
}
]
}
},
{
"id": {
"custom.name": 25,
"custom.namespace": [
2
],
"custom.params": []
},
"def": {
"enum.variants": [
{
"unit_variant.name": 26
},
{
"tuple_struct_variant.name": 27,
"tuple_struct_variant.types": [
4,
5
]
},
{
"struct_variant.name": 28,
"struct_variant.fields": [
{
"name": 17,
"type": 4
},
{
"name": 29,
"type": 5
}
]
}
]
}
},
{
"id": {
"custom.name": 11,
"custom.namespace": [
6,
7,
10,
12
],
"custom.params": [
16
]
},
"def": {
"struct.fields": [
{
"name": 10,
"type": 7
}
]
}
},
{
"id": {
"custom.name": 5,
"custom.namespace": [
6,
7,
8
],
"custom.params": [
19
]
},
"def": {
"struct.fields": [
{
"name": 10,
"type": 20
}
]
}
},
{
"id": {
"custom.name": 31,
"custom.namespace": [
2
],
"custom.params": []
},
"def": {
"union.fields": [
{
"name": 17,
"type": 4
},
{
"name": 29,
"type": 5
}
]
}
},
{
"id": {
"custom.name": 11,
"custom.namespace": [
6,
7,
10,
12
],
"custom.params": [
19
]
},
"def": {
"struct.fields": [
{
"name": 10,
"type": 7
}
]
}
}
]
},
"storage": {
"struct.type": 1,
"struct.fields": [
{
"name": 4,
"layout": {
"struct.type": 2,
"struct.fields": [
{
"name": 10,
"layout": {
"range.offset": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
"range.len": 1,
"range.elem_type": 3
}
}
]
}
},
{
"name": 15,
"layout": {
"struct.type": 9,
"struct.fields": [
{
"name": 10,
"layout": {
"range.offset": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1
],
"range.len": 1,
"range.elem_type": 10
}
}
]
}
},
{
"name": 19,
"layout": {
"struct.type": 12,
"struct.fields": [
{
"name": 10,
"layout": {
"range.offset": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
2
],
"range.len": 1,
"range.elem_type": 13
}
}
]
}
},
{
"name": 24,
"layout": {
"struct.type": 15,
"struct.fields": [
{
"name": 10,
"layout": {
"range.offset": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
3
],
"range.len": 1,
"range.elem_type": 16
}
}
]
}
},
{
"name": 30,
"layout": {
"struct.type": 18,
"struct.fields": [
{
"name": 10,
"layout": {
"range.offset": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4
],
"range.len": 1,
"range.elem_type": 19
}
}
]
}
}
]
},
"contract": {
"name": 1,
"deploy": {
"args": [],
"docs": []
},
"messages": [],
"events": [],
"docs": []
}
}
@@ -0,0 +1,252 @@
{
"metadataVersion": "0.1.0",
"source": {
"hash": "0x87175ad8e56de12e8bac275483adb1990a61c8b8caca9ddc18f1d5ad3b5dc976",
"language": "ink! 3.0.0",
"compiler": "rustc 1.48.0-nightly"
},
"contract": {
"name": "delegator",
"version": "3.0.0",
"authors": [
"Parity Technologies <admin@parity.io>"
]
},
"spec": {
"constructors": [
{
"args": [
{
"name": "init_value",
"type": {
"displayName": [
"i32"
],
"id": 4
}
},
{
"name": "accumulator_code_hash",
"type": {
"displayName": [
"Hash"
],
"id": 5
}
},
{
"name": "adder_code_hash",
"type": {
"displayName": [
"Hash"
],
"id": 5
}
},
{
"name": "subber_code_hash",
"type": {
"displayName": [
"Hash"
],
"id": 5
}
}
],
"docs": [
" Instantiate a delegator with the given sub-contract codes."
],
"name": [
"new"
],
"selector": "0xd183512b"
}
],
"docs": [],
"events": [],
"messages": [
{
"args": [],
"docs": [
" Returns the accumulator's value."
],
"mutates": false,
"name": [
"get"
],
"payable": false,
"returnType": {
"displayName": [
"i32"
],
"id": 4
},
"selector": "0x1e5ca456"
},
{
"args": [
{
"name": "by",
"type": {
"displayName": [
"i32"
],
"id": 4
}
}
],
"docs": [
" Delegates the call to either `Adder` or `Subber`."
],
"mutates": true,
"name": [
"change"
],
"payable": false,
"returnType": null,
"selector": "0x0af938f2"
},
{
"args": [],
"docs": [
" Switches the delegator."
],
"mutates": true,
"name": [
"switch"
],
"payable": false,
"returnType": null,
"selector": "0x5d37c38d"
}
]
},
"storage": {
"struct": {
"fields": [
{
"layout": {
"enum": {
"dispatch_key": "0x0000000000000000000000000000000000000000000000000000000000000000",
"variants": {
"0": {
"fields": []
},
"1": {
"fields": []
}
}
}
},
"name": "which"
},
{
"layout": {
"struct": {
"fields": [
{
"layout": {
"cell": {
"key": "0x0100000000000000000000000000000000000000000000000000000000000000",
"ty": 1
}
},
"name": "account_id"
}
]
}
},
"name": "accumulator"
},
{
"layout": {
"struct": {
"fields": [
{
"layout": {
"cell": {
"key": "0x0200000000000000000000000000000000000000000000000000000000000000",
"ty": 1
}
},
"name": "account_id"
}
]
}
},
"name": "adder"
},
{
"layout": {
"struct": {
"fields": [
{
"layout": {
"cell": {
"key": "0x0300000000000000000000000000000000000000000000000000000000000000",
"ty": 1
}
},
"name": "account_id"
}
]
}
},
"name": "subber"
}
]
}
},
"types": [
{
"def": {
"composite": {
"fields": [
{
"type": 2
}
]
}
},
"path": [
"ink_env",
"types",
"AccountId"
]
},
{
"def": {
"array": {
"len": 32,
"type": 3
}
}
},
{
"def": {
"primitive": "u8"
}
},
{
"def": {
"primitive": "i32"
}
},
{
"def": {
"composite": {
"fields": [
{
"type": 2
}
]
}
},
"path": [
"ink_env",
"types",
"Hash"
]
}
]
}
Binary file not shown.
@@ -0,0 +1,713 @@
{
"metadataVersion": "0.1.0",
"source": {
"hash": "0x1f1aa9abdcef699d384445b485ed35d890c9a1185510d03d6e1142248187b247",
"language": "ink! 3.0.0",
"compiler": "rustc 1.48.0-nightly"
},
"contract": {
"name": "dns",
"version": "3.0.0",
"authors": [
"Parity Technologies <admin@parity.io>"
]
},
"spec": {
"constructors": [
{
"args": [],
"docs": [
" Creates a new domain name service contract."
],
"name": [
"new"
],
"selector": "0xd183512b"
}
],
"docs": [],
"events": [
{
"args": [
{
"docs": [],
"indexed": true,
"name": "name",
"type": {
"displayName": [
"Hash"
],
"id": 4
}
},
{
"docs": [],
"indexed": true,
"name": "from",
"type": {
"displayName": [
"AccountId"
],
"id": 9
}
}
],
"docs": [
" Emitted whenever a new name is being registered."
],
"name": "Register"
},
{
"args": [
{
"docs": [],
"indexed": true,
"name": "name",
"type": {
"displayName": [
"Hash"
],
"id": 4
}
},
{
"docs": [],
"indexed": false,
"name": "from",
"type": {
"displayName": [
"AccountId"
],
"id": 9
}
},
{
"docs": [],
"indexed": true,
"name": "old_address",
"type": {
"displayName": [
"Option"
],
"id": 13
}
},
{
"docs": [],
"indexed": true,
"name": "new_address",
"type": {
"displayName": [
"AccountId"
],
"id": 9
}
}
],
"docs": [
" Emitted whenever an address changes."
],
"name": "SetAddress"
},
{
"args": [
{
"docs": [],
"indexed": true,
"name": "name",
"type": {
"displayName": [
"Hash"
],
"id": 4
}
},
{
"docs": [],
"indexed": false,
"name": "from",
"type": {
"displayName": [
"AccountId"
],
"id": 9
}
},
{
"docs": [],
"indexed": true,
"name": "old_owner",
"type": {
"displayName": [
"Option"
],
"id": 13
}
},
{
"docs": [],
"indexed": true,
"name": "new_owner",
"type": {
"displayName": [
"AccountId"
],
"id": 9
}
}
],
"docs": [
" Emitted whenver a name is being transferred."
],
"name": "Transfer"
}
],
"messages": [
{
"args": [
{
"name": "name",
"type": {
"displayName": [
"Hash"
],
"id": 4
}
}
],
"docs": [
" Register specific name with caller as owner."
],
"mutates": true,
"name": [
"register"
],
"payable": false,
"returnType": {
"displayName": [
"Result"
],
"id": 10
},
"selector": "0x7fb0aded"
},
{
"args": [
{
"name": "name",
"type": {
"displayName": [
"Hash"
],
"id": 4
}
},
{
"name": "new_address",
"type": {
"displayName": [
"AccountId"
],
"id": 9
}
}
],
"docs": [
" Set address for specific name."
],
"mutates": true,
"name": [
"set_address"
],
"payable": false,
"returnType": {
"displayName": [
"Result"
],
"id": 10
},
"selector": "0x220ac6e3"
},
{
"args": [
{
"name": "name",
"type": {
"displayName": [
"Hash"
],
"id": 4
}
},
{
"name": "to",
"type": {
"displayName": [
"AccountId"
],
"id": 9
}
}
],
"docs": [
" Transfer owner to another address."
],
"mutates": true,
"name": [
"transfer"
],
"payable": false,
"returnType": {
"displayName": [
"Result"
],
"id": 10
},
"selector": "0xfae3a09d"
},
{
"args": [
{
"name": "name",
"type": {
"displayName": [
"Hash"
],
"id": 4
}
}
],
"docs": [
" Get address for specific name."
],
"mutates": false,
"name": [
"get_address"
],
"payable": false,
"returnType": {
"displayName": [
"AccountId"
],
"id": 9
},
"selector": "0xb9ee7664"
}
]
},
"storage": {
"struct": {
"fields": [
{
"layout": {
"struct": {
"fields": [
{
"layout": {
"struct": {
"fields": [
{
"layout": {
"cell": {
"key": "0x0000000000000000000000000000000000000000000000000000000000000000",
"ty": 1
}
},
"name": "header"
},
{
"layout": {
"struct": {
"fields": [
{
"layout": {
"cell": {
"key": "0x0100000000000000000000000000000000000000000000000000000000000000",
"ty": 2
}
},
"name": "len"
},
{
"layout": {
"array": {
"cells_per_elem": 1,
"layout": {
"cell": {
"key": "0x0100000001000000000000000000000000000000000000000000000000000000",
"ty": 3
}
},
"len": 4294967295,
"offset": "0x0200000000000000000000000000000000000000000000000000000000000000"
}
},
"name": "elems"
}
]
}
},
"name": "entries"
}
]
}
},
"name": "keys"
},
{
"layout": {
"hash": {
"layout": {
"cell": {
"key": "0x0200000001000000000000000000000000000000000000000000000000000000",
"ty": 8
}
},
"offset": "0x0100000001000000000000000000000000000000000000000000000000000000",
"strategy": {
"hasher": "Blake2x256",
"postfix": "",
"prefix": "0x696e6b20686173686d6170"
}
}
},
"name": "values"
}
]
}
},
"name": "name_to_address"
},
{
"layout": {
"struct": {
"fields": [
{
"layout": {
"struct": {
"fields": [
{
"layout": {
"cell": {
"key": "0x0200000001000000000000000000000000000000000000000000000000000000",
"ty": 1
}
},
"name": "header"
},
{
"layout": {
"struct": {
"fields": [
{
"layout": {
"cell": {
"key": "0x0300000001000000000000000000000000000000000000000000000000000000",
"ty": 2
}
},
"name": "len"
},
{
"layout": {
"array": {
"cells_per_elem": 1,
"layout": {
"cell": {
"key": "0x0300000002000000000000000000000000000000000000000000000000000000",
"ty": 3
}
},
"len": 4294967295,
"offset": "0x0400000001000000000000000000000000000000000000000000000000000000"
}
},
"name": "elems"
}
]
}
},
"name": "entries"
}
]
}
},
"name": "keys"
},
{
"layout": {
"hash": {
"layout": {
"cell": {
"key": "0x0400000002000000000000000000000000000000000000000000000000000000",
"ty": 8
}
},
"offset": "0x0300000002000000000000000000000000000000000000000000000000000000",
"strategy": {
"hasher": "Blake2x256",
"postfix": "",
"prefix": "0x696e6b20686173686d6170"
}
}
},
"name": "values"
}
]
}
},
"name": "name_to_owner"
},
{
"layout": {
"cell": {
"key": "0x0400000002000000000000000000000000000000000000000000000000000000",
"ty": 9
}
},
"name": "default_address"
}
]
}
},
"types": [
{
"def": {
"composite": {
"fields": [
{
"name": "last_vacant",
"type": 2
},
{
"name": "len",
"type": 2
},
{
"name": "len_entries",
"type": 2
}
]
}
},
"path": [
"ink_storage",
"collections",
"stash",
"Header"
]
},
{
"def": {
"primitive": "u32"
}
},
{
"def": {
"variant": {
"variants": [
{
"fields": [
{
"type": 7
}
],
"name": "Vacant"
},
{
"fields": [
{
"type": 4
}
],
"name": "Occupied"
}
]
}
},
"params": [
4
],
"path": [
"ink_storage",
"collections",
"stash",
"Entry"
]
},
{
"def": {
"composite": {
"fields": [
{
"type": 5
}
]
}
},
"path": [
"ink_env",
"types",
"Hash"
]
},
{
"def": {
"array": {
"len": 32,
"type": 6
}
}
},
{
"def": {
"primitive": "u8"
}
},
{
"def": {
"composite": {
"fields": [
{
"name": "next",
"type": 2
},
{
"name": "prev",
"type": 2
}
]
}
},
"path": [
"ink_storage",
"collections",
"stash",
"VacantEntry"
]
},
{
"def": {
"composite": {
"fields": [
{
"name": "value",
"type": 9
},
{
"name": "key_index",
"type": 2
}
]
}
},
"params": [
9
],
"path": [
"ink_storage",
"collections",
"hashmap",
"ValueEntry"
]
},
{
"def": {
"composite": {
"fields": [
{
"type": 5
}
]
}
},
"path": [
"ink_env",
"types",
"AccountId"
]
},
{
"def": {
"variant": {
"variants": [
{
"fields": [
{
"type": 11
}
],
"name": "Ok"
},
{
"fields": [
{
"type": 12
}
],
"name": "Err"
}
]
}
},
"params": [
11,
12
],
"path": [
"Result"
]
},
{
"def": {
"tuple": []
}
},
{
"def": {
"variant": {
"variants": [
{
"discriminant": 0,
"name": "NameAlreadyExists"
},
{
"discriminant": 1,
"name": "CallerIsNotOwner"
}
]
}
},
"path": [
"dns",
"dns",
"Error"
]
},
{
"def": {
"variant": {
"variants": [
{
"name": "None"
},
{
"fields": [
{
"type": 9
}
],
"name": "Some"
}
]
}
},
"params": [
9
],
"path": [
"Option"
]
}
]
}
Binary file not shown.
@@ -0,0 +1,704 @@
{
"metadataVersion": "0.1.0",
"source": {
"hash": "0xae28fa9f075f218d559a36f720b0704b2c09326590fe19d7d76a7eaa40d079b3",
"language": "ink! 3.0.0",
"compiler": "rustc 1.48.0-nightly"
},
"contract": {
"name": "erc20",
"version": "3.0.0",
"authors": [
"Parity Technologies <admin@parity.io>"
]
},
"spec": {
"constructors": [
{
"args": [
{
"name": "initial_supply",
"type": {
"displayName": [
"Balance"
],
"id": 1
}
}
],
"docs": [],
"name": [
"new"
],
"selector": "0xd183512b"
}
],
"docs": [],
"events": [
{
"args": [
{
"docs": [],
"indexed": true,
"name": "from",
"type": {
"displayName": [
"Option"
],
"id": 13
}
},
{
"docs": [],
"indexed": true,
"name": "to",
"type": {
"displayName": [
"Option"
],
"id": 13
}
},
{
"docs": [],
"indexed": true,
"name": "value",
"type": {
"displayName": [
"Balance"
],
"id": 1
}
}
],
"docs": [],
"name": "Transfer"
},
{
"args": [
{
"docs": [],
"indexed": true,
"name": "owner",
"type": {
"displayName": [
"AccountId"
],
"id": 5
}
},
{
"docs": [],
"indexed": true,
"name": "spender",
"type": {
"displayName": [
"AccountId"
],
"id": 5
}
},
{
"docs": [],
"indexed": true,
"name": "value",
"type": {
"displayName": [
"Balance"
],
"id": 1
}
}
],
"docs": [],
"name": "Approval"
}
],
"messages": [
{
"args": [],
"docs": [],
"mutates": false,
"name": [
"total_supply"
],
"payable": false,
"returnType": {
"displayName": [
"Balance"
],
"id": 1
},
"selector": "0xdcb736b5"
},
{
"args": [
{
"name": "owner",
"type": {
"displayName": [
"AccountId"
],
"id": 5
}
}
],
"docs": [],
"mutates": false,
"name": [
"balance_of"
],
"payable": false,
"returnType": {
"displayName": [
"Balance"
],
"id": 1
},
"selector": "0x56e929b2"
},
{
"args": [
{
"name": "owner",
"type": {
"displayName": [
"AccountId"
],
"id": 5
}
},
{
"name": "spender",
"type": {
"displayName": [
"AccountId"
],
"id": 5
}
}
],
"docs": [],
"mutates": false,
"name": [
"allowance"
],
"payable": false,
"returnType": {
"displayName": [
"Balance"
],
"id": 1
},
"selector": "0xf3cfff66"
},
{
"args": [
{
"name": "to",
"type": {
"displayName": [
"AccountId"
],
"id": 5
}
},
{
"name": "value",
"type": {
"displayName": [
"Balance"
],
"id": 1
}
}
],
"docs": [],
"mutates": true,
"name": [
"transfer"
],
"payable": false,
"returnType": {
"displayName": [
"bool"
],
"id": 12
},
"selector": "0xfae3a09d"
},
{
"args": [
{
"name": "spender",
"type": {
"displayName": [
"AccountId"
],
"id": 5
}
},
{
"name": "value",
"type": {
"displayName": [
"Balance"
],
"id": 1
}
}
],
"docs": [],
"mutates": true,
"name": [
"approve"
],
"payable": false,
"returnType": {
"displayName": [
"bool"
],
"id": 12
},
"selector": "0x03d0e114"
},
{
"args": [
{
"name": "from",
"type": {
"displayName": [
"AccountId"
],
"id": 5
}
},
{
"name": "to",
"type": {
"displayName": [
"AccountId"
],
"id": 5
}
},
{
"name": "value",
"type": {
"displayName": [
"Balance"
],
"id": 1
}
}
],
"docs": [],
"mutates": true,
"name": [
"transfer_from"
],
"payable": false,
"returnType": {
"displayName": [
"bool"
],
"id": 12
},
"selector": "0xfcfb2ccd"
}
]
},
"storage": {
"struct": {
"fields": [
{
"layout": {
"cell": {
"key": "0x0000000000000000000000000000000000000000000000000000000000000000",
"ty": 1
}
},
"name": "total_supply"
},
{
"layout": {
"struct": {
"fields": [
{
"layout": {
"struct": {
"fields": [
{
"layout": {
"cell": {
"key": "0x0100000000000000000000000000000000000000000000000000000000000000",
"ty": 2
}
},
"name": "header"
},
{
"layout": {
"struct": {
"fields": [
{
"layout": {
"cell": {
"key": "0x0200000000000000000000000000000000000000000000000000000000000000",
"ty": 3
}
},
"name": "len"
},
{
"layout": {
"array": {
"cells_per_elem": 1,
"layout": {
"cell": {
"key": "0x0200000001000000000000000000000000000000000000000000000000000000",
"ty": 4
}
},
"len": 4294967295,
"offset": "0x0300000000000000000000000000000000000000000000000000000000000000"
}
},
"name": "elems"
}
]
}
},
"name": "entries"
}
]
}
},
"name": "keys"
},
{
"layout": {
"hash": {
"layout": {
"cell": {
"key": "0x0300000001000000000000000000000000000000000000000000000000000000",
"ty": 9
}
},
"offset": "0x0200000001000000000000000000000000000000000000000000000000000000",
"strategy": {
"hasher": "Blake2x256",
"postfix": "",
"prefix": "0x696e6b20686173686d6170"
}
}
},
"name": "values"
}
]
}
},
"name": "balances"
},
{
"layout": {
"struct": {
"fields": [
{
"layout": {
"struct": {
"fields": [
{
"layout": {
"cell": {
"key": "0x0300000001000000000000000000000000000000000000000000000000000000",
"ty": 2
}
},
"name": "header"
},
{
"layout": {
"struct": {
"fields": [
{
"layout": {
"cell": {
"key": "0x0400000001000000000000000000000000000000000000000000000000000000",
"ty": 3
}
},
"name": "len"
},
{
"layout": {
"array": {
"cells_per_elem": 1,
"layout": {
"cell": {
"key": "0x0400000002000000000000000000000000000000000000000000000000000000",
"ty": 10
}
},
"len": 4294967295,
"offset": "0x0500000001000000000000000000000000000000000000000000000000000000"
}
},
"name": "elems"
}
]
}
},
"name": "entries"
}
]
}
},
"name": "keys"
},
{
"layout": {
"hash": {
"layout": {
"cell": {
"key": "0x0500000002000000000000000000000000000000000000000000000000000000",
"ty": 9
}
},
"offset": "0x0400000002000000000000000000000000000000000000000000000000000000",
"strategy": {
"hasher": "Blake2x256",
"postfix": "",
"prefix": "0x696e6b20686173686d6170"
}
}
},
"name": "values"
}
]
}
},
"name": "allowances"
}
]
}
},
"types": [
{
"def": {
"primitive": "u128"
}
},
{
"def": {
"composite": {
"fields": [
{
"name": "last_vacant",
"type": 3
},
{
"name": "len",
"type": 3
},
{
"name": "len_entries",
"type": 3
}
]
}
},
"path": [
"ink_storage",
"collections",
"stash",
"Header"
]
},
{
"def": {
"primitive": "u32"
}
},
{
"def": {
"variant": {
"variants": [
{
"fields": [
{
"type": 8
}
],
"name": "Vacant"
},
{
"fields": [
{
"type": 5
}
],
"name": "Occupied"
}
]
}
},
"params": [
5
],
"path": [
"ink_storage",
"collections",
"stash",
"Entry"
]
},
{
"def": {
"composite": {
"fields": [
{
"type": 6
}
]
}
},
"path": [
"ink_env",
"types",
"AccountId"
]
},
{
"def": {
"array": {
"len": 32,
"type": 7
}
}
},
{
"def": {
"primitive": "u8"
}
},
{
"def": {
"composite": {
"fields": [
{
"name": "next",
"type": 3
},
{
"name": "prev",
"type": 3
}
]
}
},
"path": [
"ink_storage",
"collections",
"stash",
"VacantEntry"
]
},
{
"def": {
"composite": {
"fields": [
{
"name": "value",
"type": 1
},
{
"name": "key_index",
"type": 3
}
]
}
},
"params": [
1
],
"path": [
"ink_storage",
"collections",
"hashmap",
"ValueEntry"
]
},
{
"def": {
"variant": {
"variants": [
{
"fields": [
{
"type": 8
}
],
"name": "Vacant"
},
{
"fields": [
{
"type": 11
}
],
"name": "Occupied"
}
]
}
},
"params": [
11
],
"path": [
"ink_storage",
"collections",
"stash",
"Entry"
]
},
{
"def": {
"tuple": [
5,
5
]
}
},
{
"def": {
"primitive": "bool"
}
},
{
"def": {
"variant": {
"variants": [
{
"name": "None"
},
{
"fields": [
{
"type": 5
}
],
"name": "Some"
}
]
}
},
"params": [
5
],
"path": [
"Option"
]
}
]
}
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
@@ -0,0 +1,106 @@
{
"metadataVersion": "0.1.0",
"source": {
"hash": "0x98f9fc872ae9db158c8f695018a1b3c5a2fb863f9bed7c83ec039f05ea67fc57",
"language": "ink! 3.0.0",
"compiler": "rustc 1.48.0-nightly"
},
"contract": {
"name": "flipper",
"version": "3.0.0",
"authors": [
"Parity Technologies <admin@parity.io>"
]
},
"spec": {
"constructors": [
{
"args": [
{
"name": "init_value",
"type": {
"displayName": [
"bool"
],
"id": 1
}
}
],
"docs": [
" Creates a new flipper smart contract initialized with the given value."
],
"name": [
"new"
],
"selector": "0xd183512b"
},
{
"args": [],
"docs": [
" Creates a new flipper smart contract initialized to `false`."
],
"name": [
"default"
],
"selector": "0x6a3712e2"
}
],
"docs": [],
"events": [],
"messages": [
{
"args": [],
"docs": [
" Flips the current value of the Flipper's bool."
],
"mutates": true,
"name": [
"flip"
],
"payable": false,
"returnType": null,
"selector": "0xc096a5f3"
},
{
"args": [],
"docs": [
" Returns the current value of the Flipper's bool."
],
"mutates": false,
"name": [
"get"
],
"payable": false,
"returnType": {
"displayName": [
"bool"
],
"id": 1
},
"selector": "0x1e5ca456"
}
]
},
"storage": {
"struct": {
"fields": [
{
"layout": {
"cell": {
"key": "0x0000000000000000000000000000000000000000000000000000000000000000",
"ty": 1
}
},
"name": "value"
}
]
}
},
"types": [
{
"def": {
"primitive": "bool"
}
}
]
}
Binary file not shown.
@@ -1,233 +1,108 @@
{
"registry": {
"strings": [
"Incrementer",
"incrementer",
"normal",
"value",
"Value",
"ink_core",
"storage",
"cell",
"SyncCell",
"sync_cell",
"Key",
"key",
"on_deploy",
"init_value",
"u32",
"inc",
"by",
"get",
"compare",
"with",
"bool"
"metadataVersion": "0.1.0",
"source": {
"hash": "0xafe9cfb918e19fc701470017985ab0324017c66dbcfb13cb3ceca39e68cddd86",
"language": "ink! 3.0.0",
"compiler": "rustc 1.48.0-nightly"
},
"contract": {
"name": "incrementer",
"version": "3.0.0",
"authors": [
"Parity Technologies <admin@parity.io>"
]
},
"spec": {
"constructors": [
{
"args": [
{
"name": "init_value",
"type": {
"displayName": [
"i32"
],
"id": 1
}
}
],
"docs": [],
"name": [
"new"
],
"selector": "0xd183512b"
},
{
"args": [],
"docs": [],
"name": [
"default"
],
"selector": "0x6a3712e2"
}
],
"types": [
"docs": [],
"events": [],
"messages": [
{
"id": {
"custom.name": 1,
"custom.namespace": [
2,
3
],
"custom.params": []
},
"def": {
"struct.fields": [
{
"name": 4,
"type": 2
"args": [
{
"name": "by",
"type": {
"displayName": [
"i32"
],
"id": 1
}
]
}
}
],
"docs": [],
"mutates": true,
"name": [
"inc"
],
"payable": false,
"returnType": null,
"selector": "0x2fb8d143"
},
{
"id": {
"custom.name": 5,
"custom.namespace": [
6,
7,
4
"args": [],
"docs": [],
"mutates": false,
"name": [
"get"
],
"payable": false,
"returnType": {
"displayName": [
"i32"
],
"custom.params": [
3
]
"id": 1
},
"def": {
"struct.fields": [
{
"name": 8,
"type": 4
}
]
}
},
{
"id": "u32",
"def": "builtin"
},
{
"id": {
"custom.name": 9,
"custom.namespace": [
6,
7,
8,
10
],
"custom.params": [
3
]
},
"def": {
"struct.fields": [
{
"name": 8,
"type": 5
}
]
}
},
{
"id": {
"custom.name": 11,
"custom.namespace": [
6,
7,
12
],
"custom.params": []
},
"def": {
"tuple_struct.types": [
6
]
}
},
{
"id": {
"array.len": 32,
"array.type": 7
},
"def": "builtin"
},
{
"id": "u8",
"def": "builtin"
},
{
"id": "bool",
"def": "builtin"
"selector": "0x1e5ca456"
}
]
},
"storage": {
"struct.type": 1,
"struct.fields": [
{
"name": 4,
"layout": {
"struct.type": 2,
"struct.fields": [
{
"name": 8,
"layout": {
"range.offset": "0x0000000000000000000000000000000000000000000000000000000000000000",
"range.len": 1,
"range.elem_type": 3
}
"struct": {
"fields": [
{
"layout": {
"cell": {
"key": "0x0000000000000000000000000000000000000000000000000000000000000000",
"ty": 1
}
]
},
"name": "value"
}
}
]
]
}
},
"contract": {
"name": 1,
"constructors": [
{
"name": 13,
"selector": "[\"0x00\",\"0x00\",\"0x00\",\"0x00\"]",
"args": [
{
"name": 14,
"type": {
"ty": 3,
"display_name": [
15
]
}
}
],
"docs": [
"Initializes the value to the initial value."
]
"types": [
{
"def": {
"primitive": "i32"
}
],
"messages": [
{
"name": 16,
"selector": "[\"0x0F\",\"0x59\",\"0xD0\",\"0xE7\"]",
"mutates": true,
"args": [
{
"name": 17,
"type": {
"ty": 3,
"display_name": [
15
]
}
}
],
"return_type": null,
"docs": [
"Flips the current state of our smart contract."
]
},
{
"name": 18,
"selector": "[\"0xFE\",\"0x4A\",\"0x44\",\"0x25\"]",
"mutates": false,
"args": [],
"return_type": {
"ty": 3,
"display_name": [
15
]
},
"docs": [
"Returns the current state."
]
},
{
"name": 19,
"selector": "[\"0x15\",\"0xB0\",\"0xC5\",\"0x0C\"]",
"mutates": false,
"args": [
{
"name": 20,
"type": {
"ty": 3,
"display_name": [
15
]
}
}
],
"return_type": {
"ty": 8,
"display_name": [
21
]
},
"docs": [
"Returns `true` if the internal value is greater than or equal to the provided value."
]
}
],
"events": [],
"docs": []
}
}
]
}
@@ -0,0 +1,10 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
export { default as delegator } from './delegator.json';
export { default as dns } from './dns.json';
export { default as erc20 } from './erc20.json';
export { default as erc721 } from './erc721.json';
export { default as flipper } from './flipper.json';
export { default as incrementer } from './incrementer.json';
export { default as multisigPlain } from './multisig_plain.json';
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,103 @@
{
"metadataVersion": "0.1.0",
"source": {
"hash": "0x4c7e27282d0877aef2390dd50254a0fea52de5b61bc1104b41c791044f47133c",
"language": "ink! 3.0.0",
"compiler": "rustc 1.48.0-nightly"
},
"contract": {
"name": "flipper",
"version": "3.0.0",
"authors": [
"Parity Technologies <admin@parity.io>"
]
},
"spec": {
"constructors": [
{
"args": [],
"docs": [
" Creates a new flipper smart contract initialized to `false`."
],
"name": [
"default"
],
"selector": "0x6a3712e2"
},
{
"args": [
{
"name": "init_value",
"type": {
"displayName": [
"bool"
],
"id": 1
}
}
],
"docs": [],
"name": [
"Flip",
"new"
],
"selector": "0x818482e7"
}
],
"docs": [],
"events": [],
"messages": [
{
"args": [],
"docs": [],
"mutates": true,
"name": [
"Flip",
"flip"
],
"payable": false,
"returnType": null,
"selector": "0xad931d5f"
},
{
"args": [],
"docs": [],
"mutates": false,
"name": [
"Flip",
"get"
],
"payable": false,
"returnType": {
"displayName": [
"bool"
],
"id": 1
},
"selector": "0x6b3549bc"
}
]
},
"storage": {
"struct": {
"fields": [
{
"layout": {
"cell": {
"key": "0x0000000000000000000000000000000000000000000000000000000000000000",
"ty": 1
}
},
"name": "value"
}
]
}
},
"types": [
{
"def": {
"primitive": "bool"
}
}
]
}