thirdweb-dev / engine

The most powerful backend engine for web3 apps.
https://thirdweb.com/engine
Apache License 2.0
152 stars 59 forks source link

Proxy delegate call implementation #531

Closed vachmara closed 5 months ago

vachmara commented 5 months ago

Description:

I am facing an issue where I want to add a proxy delegate call to my implementation contract with the write endpoint.

Current Implementation:

The write endpoint code is located here. It uses contract.prepare to build the transaction taking proxy ABI to build the tx. This is resulting on a 500 error when requesting the endpoint with the following message :

no matching function (argument=\"name\", value=\"mint\", code=INVALID_ARGUMENT, version=abi/5.7.0)

image

Proposed solution

The system should be able to detect if this is a proxy contract or provide a way to choose an implementation contract reference.

I can implement this if necessary. Which solution is better?

vachmara commented 5 months ago

@farhanW3 I tried to modify the getContract function to add contract from implementation abi with proxy address but I still have the same error. So maybe my assumption was not correct at the beginning.

I will try now to reproduce the contract.prepare error (no matching function) with the sdk v4 to see if I can fix this.

EDIT:

I didn't succeed in reproducing the error with contract.prepare. Is it possible that the error is in the const queueId = await queueTx({...}); call?

vachmara commented 5 months ago

Your code fixed it, thanks!