Skip to content
This repository has been archived by the owner on Sep 18, 2023. It is now read-only.

Releases: Concordium/concordium-contracts-common

concordium-contracts-common 8.0.0

21 Aug 06:36
Compare
Choose a tag to compare

Summary

This release adds support for new types and operations available in protocol 6, as well as other minor improvements.

Changes

  • Add signature and key types to concordium-contracts-common.
  • Add Display trait to VersionedModuleSchema to display the VersionedModuleSchema as a JSON template.
  • Add Display trait to SchemaType to display the SchemaType as a JSON template.
  • Add associated function from_base64_str to VersionedModuleSchema to easily parse from base64
  • Add NonZeroThresholdU8, and derived AccountThreshold and SignatureThreshold types.
  • Bump version of concordium-contracts-common-derive to 4.

concordium-contracts-common-derive 4.0.0

21 Aug 06:32
Compare
Choose a tag to compare

Summary

This major release adds new convenience features to derive macros that reduce the amount of boilerplate needed in many common scenarios, and removes the StateClone derive macro.

Changes

  • Fix a bug in derivation macros for Serial, Deserial, DeserialWithState
    and SchemaType which incorrectly handled the case where the type had where
    predicates in its definition.
  • Support adding #[concordium(repr(u))] for enum types, where u is either u8 or u16. Setting this changes the integer serialization used for the variant tags in derive macros such as Serial, Deserial, DeserialWithState and SchemaType.
  • Support adding #[concordium(tag = n)] for enum variants, where n is some unsigned integer literal. Setting this attribute on a variant overrides the tag used in derive macros such as Serial, Deserial, DeserialWithState and SchemaType. Note that setting #[concordium(repr(u*))] is required when using this attribute.
  • Support adding #[concordium(forward = n)], for enum variants, where n is either an unsigned integer literal, cis2_events, cis3_events, cis4_events or an array of the same options.
    Setting this attribute on a variant overrides the (de)serialization to flatten with the (de)serialization of the inner field when using derive macros such as Serial, Deserial, DeserialWithState and SchemaType.
    Note that setting #[concordium(repr(u*))] is required when using this attribute.
  • derive(StateClone) removed completely, as StateClone trait is removed from concordium-std

concordium-contracts-common 7.0.0

16 Jun 06:23
b87380d
Compare
Choose a tag to compare

Summary

This release brings a number of convenience improvements and error reporting.

In particular when converting JSON and binary formats using schemas, the error reporting is much improved.

Changes

  • Implement serde::Serialize and serde::Deserialize for Duration using
    FromStr and Display implementations, when feature derive-serde is
    enabled.
  • Implement Serialize any HashBytes<Purpose> over any Purpose.
  • Add TryFrom implementation to convert Timestamp to chrono::DateTime.
  • Add a Serial implementation for any &A if A: Serial.
  • Set minimum Rust version to 1.65.
  • Add smart-contract feature to enable the macros which are only suitable for smart contract development using concordium-std. The feature is not enabled by default.
  • Add macros Reject, DeserialWithState, SchemaType, StateClone and Deletable, init, receive, concordium_test, concordium_cfg_test, concordium_cfg_not_test and concordium_quickcheck from concordium_std_derive with their related features wasm-test, build-schema and concordium-quickcheck.

Breaking changes

  • Add a new error type ToJsonError, which is returned when deserializing a schema type fails.
  • Add the member JsonError::TraceError to JsonError, which has trace information for the error produced when serializing a schema type fails.

concordium-contracts-common-derive 3.0.0

16 Jun 06:21
b87380d
Compare
Choose a tag to compare

Summary

This release brings a number of additions to the schema deriving macros to reduce the need for manual instances.

Changes

  • Set minimum Rust version to 1.65.
  • Add derive macros for Reject, DeserialWithState, SchemaType, StateClone and Deletable from concordium_std_derive.
  • Add attribute macros init, receive, concordium_test, concordium_cfg_test, concordium_cfg_not_test and concordium_quickcheck from concordium_std_derive with their related features wasm-test, build-schema and concordium-quickcheck.
  • Deriving Serial, Deserial, DeserialWithState and SchemaType now produces an implementation which adds a bound to each of the type parameters to implement the relevant trait.
    Note that Serial and DeserialWithState skips this bound for state_parameter when/if this is provided. This is not the behavior of Deserial and SchemaType since they are incompatible with DeserialWithState and therefore state_parameter is never present in these cases.
  • Deriving SchemaType will now produce an implementation even without the build-schema feature being enabled.
  • Support adding attribute #[concordium(transparent)] to newtype structs causing a derived SchemaType to use the implementation of the single field and thereby hiding the newtype struct in the schema.
  • Fix error message for deriving Deserial and DeserialWithState, for types with an invalid field attribute.

concordium-contracts-common 6.0.0

08 May 06:32
a99827d
Compare
Choose a tag to compare

Summary

This release brings additional functionality and removes the sdk feature.
The use of the library through concordium-std is unaffected, but uses through concordium-rust-sdk have
to be adapted. See changes below for details.

Changes

  • Remove the Copy requirement for deserialization of BTreeMap and BTreeSet.
    This allows using non-copyable (and non-clonable) types as map keys or set
    values.
  • Add the method serial_for_smart_contracts to OwnedPolicy, which serializes the policy for easy consumption by smart contracts.
  • Set minimum Rust version to 1.60.
  • Set Rust edition to 2021.
  • Remove the sdk feature.
    • Migrate by adding use concordium_rust_sdk::types::smart_contracts::concordium_contracts_common as concordium_std;
      in the files where you derive Serial or Deserial with the help from this crate.

concordium-contracts-common-derive 2.0.0

08 May 06:30
a99827d
Compare
Choose a tag to compare

Summary

This release removes the sdk feature. The use of the derive crate inside concordium-std is unaffected,
but uses through concordium-rust-sdk have to be adjusted. See changes for details.

Changes

  • Set minimum Rust version to 1.60.
  • Set Rust edition to 2021.
  • Remove the sdk feature.
    • Migrate by adding use concordium_rust_sdk::types::smart_contracts::concordium_contracts_common as concordium_std;
      in the files where you derive Serial or Deserial with the help from this crate.

concordium-contracts-common 5.3.1

12 Apr 11:39
c666512
Compare
Choose a tag to compare

This is a minor release that adds minor helper functionality both for on and off-chain use and fixes a bug in schema JSON parsing.

Changelog

  • Fix schema JSON deserialization of negative signed numbers.
  • Add PartialEq implementations for comparing ReceiveName, ContractName, and EntrypointName and their owned variants to str.

concordium-contracts-common 5.3.0

16 Mar 13:40
Compare
Choose a tag to compare

This is a minor release that adds minor helper functionality both for on and off-chain use.

There are a few breaking changes, but they are minor so only the minor version is bumped. The changelog below describes the migration path if you are affected by these changes.

Changelog

  • Add Display implementation for OwnedParameter and Parameter, which uses
    hex encoding.
  • Replace From<Vec<u8>> instance for OwnedParameter/Parameter with a TryFrom,
    which ensures a valid length, and the unchecked method new_unchecked.
    • Migrate from From/Into: Use new_unchecked instead (if known to be
      valid length).
  • Make inner field in OwnedParameter/Parameter private, but add a From
    implementation for getting the raw bytes.
    • Migrate from parameter.0: use parameter.into() instead (for both of the affected
      types).
  • For ModuleReference, replace AsRef<[u8;32]> with AsRef<[u8]> and make
    inner bytes public.
    • The change was necessary for internal reasons.
    • Migrate from module_reference.as_ref(): use &module_reference.bytes instead.
  • Replace OwnedParameter::new with OwnedParameter::from_serial, which also
    ensures a valid length.
    • Migrate from new(x): Use from_serial(x).unwrap() (if known to be valid length).
  • Add an empty method for both OwnedParameter and Parameter.
  • Implement Default for Parameter.
  • Move AccountBalance from concordium-std.
  • Add to_owned method to EntrypointName and ContractName types.
  • Implement Serial/Deserial instances for tuples with 4, 5, and 6 elements.
  • Add checked_sub to Amount type.

concordium-contracts-common 5.2.0

08 Feb 07:41
Compare
Choose a tag to compare

This is a minor release with bugfixes for off-chain functionality and quality of life improvements.

concordium-contracts-common 5.2.0 (2023-02-08)

  • Add methods serial_value and serial_value_into on the Type.
    They are more ergonomic to use than write_bytes_from_json_schema_type which
    is marked as deprecated and will be removed in future versions.
  • Fix schema's to_json for contract addresses to that it outputs a value in
    the correct {"index": ..., "subindex": ...} format.
  • Add Display implementations for ContractName, ReceiveName, and their
    owned variants.

Release concordium-contracts-common 5.1.0

14 Dec 08:27
Compare
Choose a tag to compare

concordium-contracts-common 5.1.0 (2022-12-14)

  • Implement quickcheck::Arbitrary for Timestamp, AccountAddress, ContractAddress, Address, ChainMetadata, AttributeTag, AttributeValue and OwnedPolicy.