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

Replace @727-ventures/typechain-* with @prosopo/typechain-* #64

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

wottpal
Copy link
Member

@wottpal wottpal commented May 1, 2024

  • Type generation in contracts/build-all.sh
  • Frontend integration: Queries
  • Frontend integration: Transactions

Issues

Unfortunately, I have discovered a set of errors with typechain-polkadot that still make it unusable at it's current stage:

  1. There are some unescaped control characters as part of the generated/stringified JSON (see contracts/typed-contracts/contract-info/greeter.ts. This can be solved by removing them manually (see below) but that's a manual step that needs to be done after every new build/generation and therefore should be fixed within the typechain CLI:
/* eslint-disable no-control-regex */
export const ContractAbi = `{"source": ……… }`.replace(/[\u0000-\u0019]+/g, '')

CleanShot 2024-05-02 at 08 46 10@2x

  1. Transactions are somehow still not working: typedContract.tx.setMessage("…") throws an error (but still sometimes runs through and updates state).

prosopo/typechain-polkadot@675cd56

Type generation in build-all.sh works, but throws error (JSON parsing) in frontedn
Copy link

changeset-bot bot commented May 1, 2024

⚠️ No Changeset found

Latest commit: cc58172

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented May 1, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
inkathon-xyz ✅ Ready (Inspect) Visit Preview May 2, 2024 10:45am

@ical10
Copy link
Contributor

ical10 commented May 15, 2024

gm @wottpal

Created a new branch for a forked prosopo repo here.

What I did so far:

  • Fixed the problem with unescaped control characters in this commit, and also provided an example to test typesafe greeter contract generation in /examples/greeter.
  • For transactions, I've debugged and found a potential issue. Basically inkathon and prosopo aren't using the same version of @polkadot-api. This mismatch creates a type error in examples/greeter/out/tx-sign-and-send/greeter.ts. See also screenshot below. Bumping up the version in prosopo package should solve this issue, but I'll check if it works fine or not.

Screenshot 2024-05-15 at 18 07 21

@wottpal
Copy link
Member Author

wottpal commented May 15, 2024

CC/FYI @forgetso we'll probably do another small PR soonish :)

@forgetso
Copy link

forgetso commented May 16, 2024

@wottpal Thanks for letting me know. The version changes with PJS are pretty tricky. We run into this issue constantly and we'll need to bump our own stuff to v11 as well.

@ical10
Copy link
Contributor

ical10 commented May 17, 2024

We run into this issue constantly and we'll need to bump our own stuff to v11 as well.

Hi @forgetso , any plan to update PJS on typechain-polkadot to v11 ? It might help with resolving the issue above.

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.

3 participants