inkathon icon indicating copy to clipboard operation
inkathon copied to clipboard

Replace `@727-ventures/typechain-*` with `@prosopo/typechain-*`

Open wottpal opened this issue 1 year ago • 6 comments

  • [x] Type generation in contracts/build-all.sh
  • [x] 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).

https://github.com/prosopo/typechain-polkadot/commit/675cd56647022b9c86c71efcea8cfd4fa9c533a0

wottpal avatar May 01 '24 22:05 wottpal

⚠️ No Changeset found

Latest commit: cc581726820335483cc4644abb28b7b0205be378

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

changeset-bot[bot] avatar May 01 '24 22:05 changeset-bot[bot]

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

vercel[bot] avatar May 01 '24 22:05 vercel[bot]

gm @wottpal

Created a new branch for a forked prosopo repo here.

What I did so far:

  • [x] Fixed the problem with unescaped control characters in this commit, and also provided an example to test typesafe greeter contract generation in /examples/greeter.
  • [x] 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

ical10 avatar May 15 '24 10:05 ical10

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

wottpal avatar May 15 '24 10:05 wottpal

@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.

forgetso avatar May 16 '24 08:05 forgetso

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.

ical10 avatar May 17 '24 11:05 ical10