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

generate types json second try #2178

Merged
merged 8 commits into from
Oct 11, 2024
Merged

Conversation

shannonwells
Copy link
Collaborator

@shannonwells shannonwells commented Oct 9, 2024

Goal

The goal of this PR is to generate a types.json file to help with being on Subscan et al. This is identical to the previous PR by the same name. It's an attempt to fix the problems with the release action via a new branch from main after the genesis issue was fixed.

You can see the list of artifacts with the test release here to check that it has the types.json file.

Download the js-api-augment built package here to check that it also has the types.json file (although the build of the release would have failed if it didn't)

Closes #2062

with @wilwade and @enddynayn

Checklist

  • Updated js/api-augment for Custom RPC OR Runtime API?
  • Added types.json generation to release.yml
  • Added types.json artifact to the release artifacts.
  • Added types.json generation to package.json (two scripts, but postbuild doesn't seem to be used anywhere).
  • Added types.json generation to generate_js_definitions.js script so it is triggered by make js

Verify

  1. Check out this branch and run make js, which replicates the two needed steps run in CI.
  2. if you cd js/api-augment/dist, this should exist: json/types.json
  3. The content of types.json should look like the following, so that it would be included in the tarball if you run npm pack:
{
    "RpcEvent": {
        "phase": "Option<u32>",
        "pallet": "u8",
        "event": "u8",
        "data": "Vec<u8>"
    },
    "HandleSuffix": "u16",
    "HandleResponse": {
        "base_handle": "String",
        "canonical_base": "String",
        "suffix": "u16"
    },
    "PresumptiveSuffixesResponse": {
        "suffixes": "Vec<HandleSuffix>",
        "base_handle": "String"
    },
    "BlockPaginationRequest": {
        "from_block": "BlockNumber",
        "from_index": "u32",
        "to_block": "BlockNumber",
        "page_size": "u32"
    },
    "MessageResponse": {
        "payload": "Option<Vec<u8>>",
        "cid": "Option<Vec<u8>>",
        "provider_msa_id": "MessageSourceId",
        "msa_id": "Option<MessageSourceId>",
        "index": "u16",
        "block_number": "BlockNumber",
        "payload_length": "Option<u32>"
    },
    "BlockPaginationResponseMessage": {
        "content": "Vec<MessageResponse>",
        "has_next": "bool",
        "next_block": "Option<BlockNumber>",
        "next_index": "Option<u32>"
    },
    "MessageSourceId": "u64",
    "DelegatorId": "MessageSourceId",
    "ProviderId": "MessageSourceId",
    "KeyInfoResponse": {
        "msa_keys": "Vec<AccountId>",
        "msa_id": "MessageSourceId"
    },
    "SchemaGrantResponse": {
        "schema_id": "SchemaId",
        "revoked_at": "BlockNumber"
    },
    "DelegationResponse": {
        "provider_id": "ProviderId",
        "permissions": "Vec<SchemaGrantResponse>"
    },
    "SchemaId": "u16",
    "SchemaModel": "Vec<u8>",
    "SchemaVersion": "u8",
    "SchemaResponse": {
        "schema_id": "SchemaId",
        "model": "SchemaModel",
        "model_type": "ModelType",
        "payload_location": "PayloadLocation",
        "settings": "Vec<SchemaSetting>"
    },
    "ModelType": {
        "_enum": [
            "AvroBinary",
            "Parquet"
        ]
    },
    "PayloadLocation": {
        "_enum": [
            "OnChain",
            "IPFS",
            "Itemized",
            "Paginated"
        ]
    },
    "SchemaSetting": {
        "_enum": [
            "AppendOnly",
            "SignatureRequired"
        ]
    },
    "SchemaVersionResponse": {
        "schema_name": "String",
        "schema_version": "SchemaVersion",
        "schema_id": "SchemaId"
    },
    "PageId": "u16",
    "PageHash": "u32",
    "PageNonce": "u16",
    "ItemizedStorageResponse": {
        "index": "u16",
        "payload": "Vec<u8>"
    },
    "PaginatedStorageResponse": {
        "page_id": "PageId",
        "msa_id": "MessageSourceId",
        "schema_id": "SchemaId",
        "content_hash": "PageHash",
        "nonce": "PageNonce",
        "payload": "Vec<u8>"
    },
    "ItemizedStoragePageResponse": {
        "msa_id": "MessageSourceId",
        "schema_id": "SchemaId",
        "content_hash": "PageHash",
        "nonce": "PageNonce",
        "items": "Vec<ItemizedStorageResponse>"
    }
}

@shannonwells shannonwells changed the title Feat/generate types json second try generate types json second try Oct 9, 2024
wilwade and others added 2 commits October 10, 2024 10:09
- Fix issue with releases due to the update of chain specs
- Update the metadata comparison setup
Co-authored-by: Wil Wade <[email protected]>
@shannonwells shannonwells marked this pull request as ready for review October 11, 2024 20:44
@shannonwells shannonwells requested review from wilwade, a team, mattheworris, enddynayn, aramikm, claireolmstead and JoeCap08055 and removed request for a team October 11, 2024 20:44
@shannonwells shannonwells enabled auto-merge (squash) October 11, 2024 21:20
Copy link
Collaborator

@mattheworris mattheworris left a comment

Choose a reason for hiding this comment

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

  • Read through changes
  • Encountered local build error, so could not execute make js

@shannonwells shannonwells merged commit 37b9cdb into main Oct 11, 2024
25 checks passed
@shannonwells shannonwells deleted the feat/generate-types-json-2 branch October 11, 2024 21:53
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.

Publish types.json with releases
5 participants