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

feat: initial codegen #229

Merged
merged 11 commits into from
Oct 2, 2022
Merged

feat: initial codegen #229

merged 11 commits into from
Oct 2, 2022

Conversation

tjjfvi
Copy link
Contributor

@tjjfvi tjjfvi commented Sep 16, 2022

Makes progress towards #226

This cleans up the codegen code somewhat, though it's still not the prettiest. It also adds codegen for codecs, as well as initial stub codegen for pallets and their storage and calls.

This has only been minimally manually tested; automatic testing should be added, but we need to figure out the best approach for this.

@harrysolovay
Copy link
Contributor

Tested with Polkadot and the output looks correct.

This is a great foundation: types, corresponding codecs (each explicitly typed to $Codec<T> and named in accordance with their idx, specialized codecs drawn into scope, tsdocs wherever possible, and even the beginnings of extrinsic / storage bindings! Awesome work @tjjfvi.

Would love to be able to use it through something like...

deno run -A -r https://deno.land/x/capi/codegen.ts \
  --src="wss://rpc.polkadot.io" \
  --out="polkadot.ts"

@harrysolovay harrysolovay mentioned this pull request Sep 25, 2022
@tjjfvi tjjfvi marked this pull request as ready for review October 1, 2022 17:48
@tjjfvi tjjfvi requested a review from harrysolovay as a code owner October 1, 2022 17:48
Copy link
Contributor

@harrysolovay harrysolovay left a comment

Choose a reason for hiding this comment

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

Looking very nice. Review is mostly nits––pretty much merge-ready.

codegen/codegen.ts Outdated Show resolved Hide resolved
codegen/codecVisitor.ts Show resolved Hide resolved
codegen/codecVisitor.ts Show resolved Hide resolved
codegen/codegen.ts Outdated Show resolved Hide resolved
codegen/codegen.ts Outdated Show resolved Hide resolved
codegen/utils.ts Show resolved Hide resolved
codegen/utils.ts Show resolved Hide resolved
codegen/utils.ts Outdated Show resolved Hide resolved
codegen/utils.ts Outdated Show resolved Hide resolved
deno.jsonc Outdated Show resolved Hide resolved
This was referenced Oct 2, 2022
@tjjfvi tjjfvi mentioned this pull request Oct 2, 2022
@tjjfvi tjjfvi requested a review from harrysolovay October 2, 2022 15:51
Copy link
Contributor

@harrysolovay harrysolovay left a comment

Choose a reason for hiding this comment

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

Awesome work @tjjfvi

@tjjfvi tjjfvi merged commit 607326b into main Oct 2, 2022
@tjjfvi tjjfvi deleted the codegen branch October 2, 2022 19:02
harrysolovay pushed a commit that referenced this pull request Oct 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants