thirdweb-dev / js

Best in class web3 SDKs for Browser, Node and Mobile apps
https://thirdweb.com
Apache License 2.0
430 stars 328 forks source link

Signature minting not working with custom contract and SDK v5 #3225

Closed tarikhagustia closed 4 months ago

tarikhagustia commented 4 months ago

Hi there,

I'm using signature minting on my custom contract using SignatureMint1155 extension and SDK v4 currently, however i got an error while using signature mint using SDK v5. "Invalid Request".

But when i created a new contract using pre-build contract and sdk v5 its working fine. After digging the source code i found that the EIP712 implementation between the pre-built and the extension is different.

the pre-built version is using TokenERC1155 as a domain name https://github.com/thirdweb-dev/contracts/blob/0353be5d8fa8f93247daa320bbfe09a38a112d72/contracts/prebuilts/token/TokenERC1155.sol#L149

and the extension using SignatureMintERC1155 as a domain name https://github.com/thirdweb-dev/contracts/blob/0353be5d8fa8f93247daa320bbfe09a38a112d72/contracts/extension/SignatureMintERC1155.sol#L20C27-L20C47

and looks like the V5 sdk using TokenERC1155 as a default domain. was wondering if we can add an option to change the domain name.

joaquim-verges commented 4 months ago

Thanks for reporting this, we haven't added support for sigmint extensions yet but for 1155 its just the domain name changing as you pointed out so I just put up a quick PR: https://github.com/thirdweb-dev/js/pull/3226

will merge shortly and you can test it with npm i thirdweb@nightly once it merges