feat: ink! v5 (#5791)

* adds definitions and types according to ink v5 changes

* adds toV5 boilerplate code draft

* adds v5 flipper test contract code

* fix license dates

* adds test v5 toLatest test

* implements new scheme to determine event

* apply linter changes

* adds test result outputs

* change `EventRecord['topics'][0]` type to plain `Hash`

* adds testcases for decoding payload data of a ink!v4 and ink!v5 event

* changes `Abi.decodeEvent(data:Bytes)` method interface to `Abi.decodeEvent(record:EventRecord)` which includes the event and the topic for decoding.

* draft implementation with version metadata

* cleaner implementation of versioned Metadata by actually leveraging the `version` field included since v2 contract metadata

* trying to make linter happy

* makes `ContractMetadataSupported` in internal to `Abi` type and not exposing it externally.

* properly types unused parameter for tsc 🤷

* adds `@polkadot/types-support` dev dependency

* Update yarn.lock

* references `types-support` in `api-contract

* resolving change requests

* resolves linter warnings

* changes ContractMetadataV5 field to `u64` from `Text`

* adds contracts and contract metadata compiled with the most recent ink version

* implements decoding of anonymous events if possible

* removes done todo comments
This commit is contained in:
peetzweg/
2024-03-02 09:18:14 -05:00
committed by GitHub
parent f9b2d26381
commit ca4802326c
39 changed files with 6245 additions and 93 deletions
@@ -0,0 +1,10 @@
// Copyright 2017-2024 @polkadot/types-support authors & contributors
// SPDX-License-Identifier: Apache-2.0
import metadata from './v14/substrate-contracts-node-hex.js';
import rpc from './v14/substrate-contracts-node-rpc.js';
import version from './v14/substrate-contracts-node-ver.js';
export { rpc, version };
export default metadata;
File diff suppressed because one or more lines are too long
@@ -0,0 +1,108 @@
// Copyright 2017-2024 @polkadot/types-support authors & contributors
// SPDX-License-Identifier: Apache-2.0
/* eslint-disable */
// cargo run --release -- purge-chain -y --dev && cargo run --release -- --dev
export default {
"methods": [
"account_nextIndex",
"author_hasKey",
"author_hasSessionKeys",
"author_insertKey",
"author_pendingExtrinsics",
"author_removeExtrinsic",
"author_rotateKeys",
"author_submitAndWatchExtrinsic",
"author_submitExtrinsic",
"author_unwatchExtrinsic",
"chainHead_unstable_body",
"chainHead_unstable_call",
"chainHead_unstable_continue",
"chainHead_unstable_follow",
"chainHead_unstable_genesisHash",
"chainHead_unstable_header",
"chainHead_unstable_stopOperation",
"chainHead_unstable_storage",
"chainHead_unstable_unfollow",
"chainHead_unstable_unpin",
"chain_getBlock",
"chain_getBlockHash",
"chain_getFinalisedHead",
"chain_getFinalizedHead",
"chain_getHead",
"chain_getHeader",
"chain_getRuntimeVersion",
"chain_subscribeAllHeads",
"chain_subscribeFinalisedHeads",
"chain_subscribeFinalizedHeads",
"chain_subscribeNewHead",
"chain_subscribeNewHeads",
"chain_subscribeRuntimeVersion",
"chain_unsubscribeAllHeads",
"chain_unsubscribeFinalisedHeads",
"chain_unsubscribeFinalizedHeads",
"chain_unsubscribeNewHead",
"chain_unsubscribeNewHeads",
"chain_unsubscribeRuntimeVersion",
"childstate_getKeys",
"childstate_getKeysPaged",
"childstate_getKeysPagedAt",
"childstate_getStorage",
"childstate_getStorageEntries",
"childstate_getStorageHash",
"childstate_getStorageSize",
"offchain_localStorageGet",
"offchain_localStorageSet",
"payment_queryFeeDetails",
"payment_queryInfo",
"state_call",
"state_callAt",
"state_getChildReadProof",
"state_getKeys",
"state_getKeysPaged",
"state_getKeysPagedAt",
"state_getMetadata",
"state_getPairs",
"state_getReadProof",
"state_getRuntimeVersion",
"state_getStorage",
"state_getStorageAt",
"state_getStorageHash",
"state_getStorageHashAt",
"state_getStorageSize",
"state_getStorageSizeAt",
"state_queryStorage",
"state_queryStorageAt",
"state_subscribeRuntimeVersion",
"state_subscribeStorage",
"state_traceBlock",
"state_unsubscribeRuntimeVersion",
"state_unsubscribeStorage",
"subscribe_newHead",
"system_accountNextIndex",
"system_addLogFilter",
"system_addReservedPeer",
"system_chain",
"system_chainType",
"system_dryRun",
"system_dryRunAt",
"system_health",
"system_localListenAddresses",
"system_localPeerId",
"system_name",
"system_nodeRoles",
"system_peers",
"system_properties",
"system_removeReservedPeer",
"system_reservedPeers",
"system_resetLogFilter",
"system_syncState",
"system_unstable_networkState",
"system_version",
"transaction_unstable_submitAndWatch",
"transaction_unstable_unwatch",
"unsubscribe_newHead"
]
};
@@ -0,0 +1,58 @@
// Copyright 2017-2024 @polkadot/types-support authors & contributors
// SPDX-License-Identifier: Apache-2.0
/* eslint-disable */
// cargo run --release -- purge-chain -y --dev && cargo run --release -- --dev
export default {
"specName": "substrate-contracts-node",
"implName": "substrate-contracts-node",
"authoringVersion": 1,
"specVersion": 100,
"implVersion": 1,
"apis": [
[
"0xdf6acb689907609b",
4
],
[
"0x37e397fc7c91f5e4",
2
],
[
"0x40fe3ad401f8959a",
6
],
[
"0xd2bc9897eed08f15",
3
],
[
"0xf78b278be53f454c",
2
],
[
"0xab3c0572291feb8b",
1
],
[
"0xbc9d89904f5b923f",
1
],
[
"0x37c8bb1350a9a2a8",
4
],
[
"0xf3ff14d5ab527059",
3
],
[
"0x68b66ba122c93fa7",
2
]
],
"transactionVersion": 1,
"stateVersion": 1
};