Files
api/packages/api-contract/test/contracts/erc721.json
T
503286f7aa Update ink type spec for 3.0-rc1 (#2702)
* Updated ABI definitions & parsing

* Run type generation

* Definitions (should be ok-ish)

* Cleanup names

* Allow aliasses on structs (JSON parsing)

* Cleanup json mapping passing

* s/types/lookup/

* Parsing as per current output

* InkSelector

* MtRegistryIndex

* String lookup tests

* Remove serd ovverride comments (it works as-is)

* inkRegistry tests

* Extract primitive types

* s/ty/id/

* Start of parsing into types (actually to be TypeDef)

* Parsing

* stringify struct fields

* Small cleanups

* Add type index to project lookup

* Prefix with index

* Fix interface generation

* Latest contract metadata (#2118)

* Add new (provisional) incrementer contract metadata

* Update and regenerate type definitions

* WIP: generate new format scale-info types

* WIP: implementing variants

* Implement variants

* Fix up type resolution

* Fix registry spec tests

* Fix lints and some tests

* Fix inkTypes tests

* Fix some lints

* Make imports same line like original

* Comment out (temporarily) sanitize import to make CI pass

* Sanitize

* Remove indices

* Remove index

* api-contract rewrite

* lint

* cleanup

* latest

* latest

* fix definition

* fiz definitions

* rv ink storage

* Update packages/api-contract/src/base/Contract.ts

Co-authored-by: Jaco Greeff <jacogr@gmail.com>

* fixes

* rv scripts

* restore api-contract

* reorder definitions, fix ink storage

* fixes

* def order

* fixes

* encodeTypeDef asRaw

* update ink typ spec

* latest built contracts

* compare files

* Apply suggestions from code review

Co-authored-by: Jaco Greeff <jacogr@gmail.com>
Co-authored-by: Andrew Jones <ascjones@gmail.com>
2020-10-11 09:37:39 +02:00

1197 lines
29 KiB
JSON

{
"metadataVersion": "0.1.0",
"source": {
"hash": "0xf7dac8dd8a2d9c7419c766facfa29d91823625305be8a1e7a9e6d750b894782b",
"language": "ink! 3.0.0-rc1",
"compiler": "rustc 1.48.0-nightly"
},
"contract": {
"name": "erc721",
"version": "3.0.0-rc1",
"authors": [
"Parity Technologies <admin@parity.io>"
]
},
"spec": {
"constructors": [
{
"args": [],
"docs": [
" Creates a new ERC721 token contract."
],
"name": [
"new"
],
"selector": "0xd183512b"
}
],
"docs": [],
"events": [
{
"args": [
{
"docs": [],
"indexed": true,
"name": "from",
"type": {
"displayName": [
"Option"
],
"type": 15
}
},
{
"docs": [],
"indexed": true,
"name": "to",
"type": {
"displayName": [
"Option"
],
"type": 15
}
},
{
"docs": [],
"indexed": true,
"name": "id",
"type": {
"displayName": [
"TokenId"
],
"type": 2
}
}
],
"docs": [
" Event emitted when a token transfer occurs."
],
"name": "Transfer"
},
{
"args": [
{
"docs": [],
"indexed": true,
"name": "from",
"type": {
"displayName": [
"AccountId"
],
"type": 6
}
},
{
"docs": [],
"indexed": true,
"name": "to",
"type": {
"displayName": [
"AccountId"
],
"type": 6
}
},
{
"docs": [],
"indexed": true,
"name": "id",
"type": {
"displayName": [
"TokenId"
],
"type": 2
}
}
],
"docs": [
" Event emited when a token approve occurs."
],
"name": "Approval"
},
{
"args": [
{
"docs": [],
"indexed": true,
"name": "owner",
"type": {
"displayName": [
"AccountId"
],
"type": 6
}
},
{
"docs": [],
"indexed": true,
"name": "operator",
"type": {
"displayName": [
"AccountId"
],
"type": 6
}
},
{
"docs": [],
"indexed": false,
"name": "approved",
"type": {
"displayName": [
"bool"
],
"type": 14
}
}
],
"docs": [
" Event emitted when an operator is enabled or disabled for an owner.",
" The operator can manage all NFTs of the owner."
],
"name": "ApprovalForAll"
}
],
"messages": [
{
"args": [
{
"name": "owner",
"type": {
"displayName": [
"AccountId"
],
"type": 6
}
}
],
"docs": [
" Returns the balance of the owner.",
"",
" This represents the amount of unique tokens the owner has."
],
"mutates": false,
"name": [
"balance_of"
],
"payable": false,
"returnType": {
"displayName": [
"u32"
],
"type": 2
},
"selector": "0x56e929b2"
},
{
"args": [
{
"name": "id",
"type": {
"displayName": [
"TokenId"
],
"type": 2
}
}
],
"docs": [
" Returns the owner of the token."
],
"mutates": false,
"name": [
"owner_of"
],
"payable": false,
"returnType": {
"displayName": [
"Option"
],
"type": 15
},
"selector": "0xf7860ada"
},
{
"args": [
{
"name": "id",
"type": {
"displayName": [
"TokenId"
],
"type": 2
}
}
],
"docs": [
" Returns the approved account ID for this token if any."
],
"mutates": false,
"name": [
"get_approved"
],
"payable": false,
"returnType": {
"displayName": [
"Option"
],
"type": 15
},
"selector": "0xb09dc487"
},
{
"args": [
{
"name": "owner",
"type": {
"displayName": [
"AccountId"
],
"type": 6
}
},
{
"name": "operator",
"type": {
"displayName": [
"AccountId"
],
"type": 6
}
}
],
"docs": [
" Returns `true` if the operator is approved by the owner."
],
"mutates": false,
"name": [
"is_approved_for_all"
],
"payable": false,
"returnType": {
"displayName": [
"bool"
],
"type": 14
},
"selector": "0xc666bf03"
},
{
"args": [
{
"name": "to",
"type": {
"displayName": [
"AccountId"
],
"type": 6
}
},
{
"name": "approved",
"type": {
"displayName": [
"bool"
],
"type": 14
}
}
],
"docs": [
" Approves or disapproves the operator for all tokens of the caller."
],
"mutates": true,
"name": [
"set_approval_for_all"
],
"payable": false,
"returnType": {
"displayName": [
"Result"
],
"type": 16
},
"selector": "0x51176f12"
},
{
"args": [
{
"name": "to",
"type": {
"displayName": [
"AccountId"
],
"type": 6
}
},
{
"name": "id",
"type": {
"displayName": [
"TokenId"
],
"type": 2
}
}
],
"docs": [
" Approves the account to transfer the specified token on behalf of the caller."
],
"mutates": true,
"name": [
"approve"
],
"payable": false,
"returnType": {
"displayName": [
"Result"
],
"type": 16
},
"selector": "0x03d0e114"
},
{
"args": [
{
"name": "destination",
"type": {
"displayName": [
"AccountId"
],
"type": 6
}
},
{
"name": "id",
"type": {
"displayName": [
"TokenId"
],
"type": 2
}
}
],
"docs": [
" Transfers the token from the caller to the given destination."
],
"mutates": true,
"name": [
"transfer"
],
"payable": false,
"returnType": {
"displayName": [
"Result"
],
"type": 16
},
"selector": "0xfae3a09d"
},
{
"args": [
{
"name": "from",
"type": {
"displayName": [
"AccountId"
],
"type": 6
}
},
{
"name": "to",
"type": {
"displayName": [
"AccountId"
],
"type": 6
}
},
{
"name": "id",
"type": {
"displayName": [
"TokenId"
],
"type": 2
}
}
],
"docs": [
" Transfer approved or owned token."
],
"mutates": true,
"name": [
"transfer_from"
],
"payable": false,
"returnType": {
"displayName": [
"Result"
],
"type": 16
},
"selector": "0xfcfb2ccd"
},
{
"args": [
{
"name": "id",
"type": {
"displayName": [
"TokenId"
],
"type": 2
}
}
],
"docs": [
" Creates a new token."
],
"mutates": true,
"name": [
"mint"
],
"payable": false,
"returnType": {
"displayName": [
"Result"
],
"type": 16
},
"selector": "0xf8885eeb"
},
{
"args": [
{
"name": "id",
"type": {
"displayName": [
"TokenId"
],
"type": 2
}
}
],
"docs": [
" Deletes an existing token. Only the owner can burn the token."
],
"mutates": true,
"name": [
"burn"
],
"payable": false,
"returnType": {
"displayName": [
"Result"
],
"type": 16
},
"selector": "0x120bc564"
}
]
},
"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": {
"cellsPerElem": 1,
"layout": {
"cell": {
"key": "0x0100000001000000000000000000000000000000000000000000000000000000",
"ty": 3
}
},
"len": 4294967295,
"offset": "0x0200000000000000000000000000000000000000000000000000000000000000"
}
},
"name": "elems"
}
]
}
},
"name": "entries"
}
]
}
},
"name": "keys"
},
{
"layout": {
"hash": {
"layout": {
"cell": {
"key": "0x0200000001000000000000000000000000000000000000000000000000000000",
"ty": 5
}
},
"offset": "0x0100000001000000000000000000000000000000000000000000000000000000",
"strategy": {
"hasher": "Blake2x256",
"postfix": "",
"prefix": "0x696e6b20686173686d6170"
}
}
},
"name": "values"
}
]
}
},
"name": "token_owner"
},
{
"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": {
"cellsPerElem": 1,
"layout": {
"cell": {
"key": "0x0300000002000000000000000000000000000000000000000000000000000000",
"ty": 3
}
},
"len": 4294967295,
"offset": "0x0400000001000000000000000000000000000000000000000000000000000000"
}
},
"name": "elems"
}
]
}
},
"name": "entries"
}
]
}
},
"name": "keys"
},
{
"layout": {
"hash": {
"layout": {
"cell": {
"key": "0x0400000002000000000000000000000000000000000000000000000000000000",
"ty": 5
}
},
"offset": "0x0300000002000000000000000000000000000000000000000000000000000000",
"strategy": {
"hasher": "Blake2x256",
"postfix": "",
"prefix": "0x696e6b20686173686d6170"
}
}
},
"name": "values"
}
]
}
},
"name": "token_approvals"
},
{
"layout": {
"struct": {
"fields": [
{
"layout": {
"struct": {
"fields": [
{
"layout": {
"cell": {
"key": "0x0400000002000000000000000000000000000000000000000000000000000000",
"ty": 1
}
},
"name": "header"
},
{
"layout": {
"struct": {
"fields": [
{
"layout": {
"cell": {
"key": "0x0500000002000000000000000000000000000000000000000000000000000000",
"ty": 2
}
},
"name": "len"
},
{
"layout": {
"array": {
"cellsPerElem": 1,
"layout": {
"cell": {
"key": "0x0500000003000000000000000000000000000000000000000000000000000000",
"ty": 9
}
},
"len": 4294967295,
"offset": "0x0600000002000000000000000000000000000000000000000000000000000000"
}
},
"name": "elems"
}
]
}
},
"name": "entries"
}
]
}
},
"name": "keys"
},
{
"layout": {
"hash": {
"layout": {
"cell": {
"key": "0x0600000003000000000000000000000000000000000000000000000000000000",
"ty": 10
}
},
"offset": "0x0500000003000000000000000000000000000000000000000000000000000000",
"strategy": {
"hasher": "Blake2x256",
"postfix": "",
"prefix": "0x696e6b20686173686d6170"
}
}
},
"name": "values"
}
]
}
},
"name": "owned_tokens_count"
},
{
"layout": {
"struct": {
"fields": [
{
"layout": {
"struct": {
"fields": [
{
"layout": {
"cell": {
"key": "0x0600000003000000000000000000000000000000000000000000000000000000",
"ty": 1
}
},
"name": "header"
},
{
"layout": {
"struct": {
"fields": [
{
"layout": {
"cell": {
"key": "0x0700000003000000000000000000000000000000000000000000000000000000",
"ty": 2
}
},
"name": "len"
},
{
"layout": {
"array": {
"cellsPerElem": 1,
"layout": {
"cell": {
"key": "0x0700000004000000000000000000000000000000000000000000000000000000",
"ty": 11
}
},
"len": 4294967295,
"offset": "0x0800000003000000000000000000000000000000000000000000000000000000"
}
},
"name": "elems"
}
]
}
},
"name": "entries"
}
]
}
},
"name": "keys"
},
{
"layout": {
"hash": {
"layout": {
"cell": {
"key": "0x0800000004000000000000000000000000000000000000000000000000000000",
"ty": 13
}
},
"offset": "0x0700000004000000000000000000000000000000000000000000000000000000",
"strategy": {
"hasher": "Blake2x256",
"postfix": "",
"prefix": "0x696e6b20686173686d6170"
}
}
},
"name": "values"
}
]
}
},
"name": "operator_approvals"
}
]
}
},
"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": 4
}
],
"name": "Vacant"
},
{
"fields": [
{
"type": 2
}
],
"name": "Occupied"
}
]
}
},
"params": [
2
],
"path": [
"ink_storage",
"collections",
"stash",
"Entry"
]
},
{
"def": {
"composite": {
"fields": [
{
"name": "next",
"type": 2
},
{
"name": "prev",
"type": 2
}
]
}
},
"path": [
"ink_storage",
"collections",
"stash",
"VacantEntry"
]
},
{
"def": {
"composite": {
"fields": [
{
"name": "value",
"type": 6
},
{
"name": "key_index",
"type": 2
}
]
}
},
"params": [
6
],
"path": [
"ink_storage",
"collections",
"hashmap",
"ValueEntry"
]
},
{
"def": {
"composite": {
"fields": [
{
"type": 7
}
]
}
},
"path": [
"ink_env",
"types",
"AccountId"
]
},
{
"def": {
"array": {
"len": 32,
"type": 8
}
}
},
{
"def": {
"primitive": "u8"
}
},
{
"def": {
"variant": {
"variants": [
{
"fields": [
{
"type": 4
}
],
"name": "Vacant"
},
{
"fields": [
{
"type": 6
}
],
"name": "Occupied"
}
]
}
},
"params": [
6
],
"path": [
"ink_storage",
"collections",
"stash",
"Entry"
]
},
{
"def": {
"composite": {
"fields": [
{
"name": "value",
"type": 2
},
{
"name": "key_index",
"type": 2
}
]
}
},
"params": [
2
],
"path": [
"ink_storage",
"collections",
"hashmap",
"ValueEntry"
]
},
{
"def": {
"variant": {
"variants": [
{
"fields": [
{
"type": 4
}
],
"name": "Vacant"
},
{
"fields": [
{
"type": 12
}
],
"name": "Occupied"
}
]
}
},
"params": [
12
],
"path": [
"ink_storage",
"collections",
"stash",
"Entry"
]
},
{
"def": {
"tuple": [
6,
6
]
}
},
{
"def": {
"composite": {
"fields": [
{
"name": "value",
"type": 14
},
{
"name": "key_index",
"type": 2
}
]
}
},
"params": [
14
],
"path": [
"ink_storage",
"collections",
"hashmap",
"ValueEntry"
]
},
{
"def": {
"primitive": "bool"
}
},
{
"def": {
"variant": {
"variants": [
{
"name": "None"
},
{
"fields": [
{
"type": 6
}
],
"name": "Some"
}
]
}
},
"params": [
6
],
"path": [
"Option"
]
},
{
"def": {
"variant": {
"variants": [
{
"fields": [
{
"type": 17
}
],
"name": "Ok"
},
{
"fields": [
{
"type": 18
}
],
"name": "Err"
}
]
}
},
"params": [
17,
18
],
"path": [
"Result"
]
},
{
"def": {
"tuple": []
}
},
{
"def": {
"variant": {
"variants": [
{
"discriminant": 0,
"name": "NotOwner"
},
{
"discriminant": 1,
"name": "NotApproved"
},
{
"discriminant": 2,
"name": "TokenExists"
},
{
"discriminant": 3,
"name": "TokenNotFound"
},
{
"discriminant": 4,
"name": "CannotInsert"
},
{
"discriminant": 5,
"name": "CannotRemove"
},
{
"discriminant": 6,
"name": "CannotFetchValue"
},
{
"discriminant": 7,
"name": "NotAllowed"
}
]
}
},
"path": [
"erc721",
"erc721",
"Error"
]
}
]
}