Concordium / concordium-dapp-libraries

A coherent set of building blocks for making it as easy as possible for developers to build web-based dApps.
Apache License 2.0
7 stars 5 forks source link

Upgrade web sdk #51

Closed soerenbf closed 7 months ago

soerenbf commented 8 months ago

Purpose

Makes the dapp libraries compatible with version 7 of the web SDK and removes JSON RPC.

Closes #50

Checklist

soerenbf commented 7 months ago

@shjortConcordium @bisgardo could you give this a look sometime soon? Would be nice to have this out as soon as possible after the release of the new wallet API

bisgardo commented 7 months ago

@soerenbf The format of the request sent via WalletConnect is broken (Browser wallet works):

The correct format sent by current main:

{ type: "update", sender: "3he2aDi8GT9bLZTVfY3CD36JUsXBt8QaqvRW8AW4SpstdPYFzu", payload: '{"amount":"1000000","address":{"index":2059,"subindex":0},"receiveName":"cis2_wCCD.wrap","maxContractExecutionEnergy":30000,"message":"0063aaa94f7e272aa57929720d24c1250debb94c1860386fcc1e36c6fc804b95fa0000"}', … }

but now it's

{ type: "update", sender: "3he2aDi8GT9bLZTVfY3CD36JUsXBt8QaqvRW8AW4SpstdPYFzu", payload: '{"amount":"1000000","address":{"index":2059,"subindex":0,"__type":"ccd_contract_address"},"receiveName":{"value":"cis2_wCCD.wrap","__type":"ccd_receive_name"},"maxContractExecutionEnergy":{"value":30000,"__type":"ccd_energy"},"message":{"buffer":{"0":0,"1":99,"2":170,"3":169,"4":79,"5":126,"6":39,"7":42,"8":165,"9":121,"10":41,"11":114,"12":13,"13":36,"14":193,"15":37,"16":13,"17":235,"18":185,"19":76,"20":24,"21":96,"22":56,"23":111,"24":204,"25":30,"26":54,"27":198,"28":252,"29":128,"30":75,"31":149,"32":250,"33":0,"34":0},"__type":"ccd_parameter"}}', … }

In short, the new types serialize into JSON differently than the old ones. I'm thinking it can be fixed by patching accountTransactionPayloadToJson. I don't think it's a very nice solution though. It would be nice if there was a more stable way. Any ideas?

soerenbf commented 7 months ago

@soerenbf The format of the request sent via WalletConnect is broken (Browser wallet works):

The correct format sent by current main:

{ type: "update", sender: "3he2aDi8GT9bLZTVfY3CD36JUsXBt8QaqvRW8AW4SpstdPYFzu", payload: '{"amount":"1000000","address":{"index":2059,"subindex":0},"receiveName":"cis2_wCCD.wrap","maxContractExecutionEnergy":30000,"message":"0063aaa94f7e272aa57929720d24c1250debb94c1860386fcc1e36c6fc804b95fa0000"}', … }

but now it's

{ type: "update", sender: "3he2aDi8GT9bLZTVfY3CD36JUsXBt8QaqvRW8AW4SpstdPYFzu", payload: '{"amount":"1000000","address":{"index":2059,"subindex":0,"__type":"ccd_contract_address"},"receiveName":{"value":"cis2_wCCD.wrap","__type":"ccd_receive_name"},"maxContractExecutionEnergy":{"value":30000,"__type":"ccd_energy"},"message":{"buffer":{"0":0,"1":99,"2":170,"3":169,"4":79,"5":126,"6":39,"7":42,"8":165,"9":121,"10":41,"11":114,"12":13,"13":36,"14":193,"15":37,"16":13,"17":235,"18":185,"19":76,"20":24,"21":96,"22":56,"23":111,"24":204,"25":30,"26":54,"27":198,"28":252,"29":128,"30":75,"31":149,"32":250,"33":0,"34":0},"__type":"ccd_parameter"}}', … }

In short, the new types serialize into JSON differently than the old ones. I'm thinking it can be fixed by patching accountTransactionPayloadToJson. I don't think it's a very nice solution though. It would be nice if there was a more stable way. Any ideas?

well I'll be damned.. It makes sense though, good thing you caught it. I don't think there's a good way around this one. Will figure something out

soerenbf commented 7 months ago

It works now but I'm confused about the RC versions and also why you want to include the sources in the distributed package.

So the RC versions have been used to publish beta versions to be used in other dependants. Regarding including src, check my other comment. I read on the official typescript docs somewhere that it was recommended, but I cannot seem to find where 🙈