Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use more wrappers in API #270

Merged
merged 28 commits into from
Oct 2, 2023
Merged

Use more wrappers in API #270

merged 28 commits into from
Oct 2, 2023

Conversation

limemloh
Copy link
Collaborator

@limemloh limemloh commented Sep 22, 2023

Purpose

Introduce type wrappers and update API to use them instead of primitives.

Changes

Several types have been replaced with a module containing the type itself together with functions for constructing and
converting the type:

  • AccountAddress
  • ContractAddresss
  • CredentialRegistrationId
  • Duration
  • Timestamp
  • Energy

The API now uses dedicated types instead of language primitives for:

  • Uses AccountAddress instead of a string with base58 encoding.
  • Uses BlockHash instead of a string with hex encoding.
  • Uses TranactionHash instead of a string with hex encoding.
  • Uses Energy instead of a bigint.
  • Uses ReceiveName instead of a string.
  • Uses InitName instead of a string.
  • Uses ContractName instead of a string.
  • Uses EntrypointName instead of a string.
  • Uses Parameter instead of a string with hex encoding.
  • Uses SequenceNumber (formerly called nonce) instead of a bigint.
  • Uses Timestamp instead of a bigint.
  • Uses Duration instead of a bigint.

Checklist

  • My code follows the style of this project.
  • The code compiles without warnings.
  • I have performed a self-review of the changes.
  • I have documented my code, in particular the intent of the
    hard-to-understand areas.
  • (If necessary) I have updated the CHANGELOG.

@limemloh limemloh force-pushed the ccd-js-gen-use-schema branch 3 times, most recently from 936594b to 43746e4 Compare September 25, 2023 13:16
@limemloh limemloh force-pushed the ccd-js-gen-use-schema branch from 43746e4 to b528f5a Compare September 26, 2023 07:32
@limemloh limemloh changed the base branch from ccd-js-gen-use-schema to release/10 September 26, 2023 19:22
@limemloh limemloh marked this pull request as ready for review September 27, 2023 18:42
@limemloh limemloh force-pushed the api-strict-types branch 2 times, most recently from d31b794 to c5a0fab Compare September 28, 2023 07:08
Copy link
Collaborator

@soerenbf soerenbf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's what I found:

Also, as discussed, we should implement some JSON (de)serialization interface for all the types. Maybe we should add an issue for this, so we don't forget?

examples/ccd-js-gen/wCCD/client-tokenMetadata.ts Outdated Show resolved Hide resolved
packages/common/src/GenericContract.ts Outdated Show resolved Hide resolved
packages/common/src/schemaTypes.ts Outdated Show resolved Hide resolved
packages/nodejs/test/testHelpers.ts Outdated Show resolved Hide resolved
@limemloh limemloh merged commit 545893b into release/10 Oct 2, 2023
10 checks passed
@limemloh limemloh deleted the api-strict-types branch August 7, 2024 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants