warp-contracts / warp

An implementation of the Arweave SmartWeave smart contracts protocol.
MIT License
159 stars 44 forks source link

Error: Types of property 'api' are incompatible. #346

Closed luckyr13 closed 1 year ago

luckyr13 commented 1 year ago

Hey guys, how is it going? Today I was updating my libraries for some of my projects and I'm getting an error that says:

Types of property 'api' are incompatible.
    Type 'import("C:/xampp/htdocs/arwiki/node_modules/arweave/node/lib/api").default' is not assignable to type 'import("C:/xampp/htdocs/arwiki/node_modules/warp-contracts/node_modules/arweave/node/lib/api").default'.
      Types have separate declarations of a private property 'mergeDefaults'.

this._warp = WarpFactory.forMainnet(undefined, undefined, _arweave.arweave);

The problem seems to be when I try to create a Warp instance passing my own Arweave object.

So I was checking the package.json for the Warp SDK and I found that you are using an old version (1.11.8) for the Arweave library: https://github.com/warp-contracts/warp/blob/main/package.json#L70

Current version for Arweave library is 1.12.4

So in other words, warp-contracts 1.2.51 library is not compatible with arweave-js library 1.12.4

Should I wait for a new update for the warp-contracts library that is compatible with the new Arweave library version? Or do you have any fix for this?

Thanks in advance :)

ppedziwiatr commented 1 year ago

Hey @luckyr13 ! I've fixed it in 1.2.52-beta.2 - and btw. fixed few other issues (see https://github.com/warp-contracts/warp/pull/347) the were causing overly big bundle size - mind testing this version?

ppedziwiatr commented 1 year ago

oh, and btw., you could probably also fix this by simpy using (in your package.json) resolutions (for yarn) and overrides (for npm):

"resolutions": {
    "arweave": "1.12.4",
  },
  "overrides": {
    "arweave": "1.12.4"
  },
luckyr13 commented 1 year ago

Hey @ppedziwiatr I really appreciate your help! 1.2.52-beta.2 works extremely well and is so small that blows my mind, you did an amazing job.

About adding overrides mmm ... it's a cool fix but I'm thinking to wait for the 1.2.52-beta.2 to be released as the new stable version 1.2.52 ... the reason is that the beta version solves the incompatibility issue with the new arweave-js version.

I'm afraid of adding the override unnecessarily because you already solved the issue (but is not released as the official stable version). I already have some fixes on my package.json that I don't remember why are still there or if they are still needed. Maybe I just need to be patient, right? haha

I can imagine that the new version 1.2.52 will solve my issue right? I can totally wait for the new version, there's no hurry to be honest.

Thanks for your time and great job!

ppedziwiatr commented 1 year ago

Thanks for feedback! I'll make some final touches and release the official version today or tomorrow.

Re. bundle size - it's still waaaay toooo big, but removing some unused wasm-related stuff and moving VRF to a separate plugin should further help here.

Obviously the 1.2.52 solves the issue - the suggestion with the resolutions/overrides was just in case a similar issue would occur in the future - as we might not be able to instantly release an update.

ppedziwiatr commented 1 year ago

Released in 1.2.52