js icon indicating copy to clipboard operation
js copied to clipboard

Marketplace contract with custom provider: buyoutListing Error: invalid hash

Open arnaudjnn opened this issue 2 years ago • 0 comments

I'm using magic.link wallet as a custom provider with the Marketplace contract.

Here is my code:

const magic = new Magic(process.env.NEXT_PUBLIC_MAGIC_API_KEY);
await magic.auth.loginWithMagicLink({ email: "[email protected]" });
const provider = new ethers.providers.Web3Provider(magic.rpcProvider);
const signer = provider.getSigner();
const web3Sdk = ThirdwebSDK.fromSigner(signer, "goerli");
const contract = await web3Sdk.getContract(
  process.env.NEXT_PUBLIC_REKOLT_MARKETPLACE_CONTRACT_ADDRESS,
  'marketplace',
);
const buy = await contract.buyoutListing(1, 1);

I have the following error:

Error: Contract transaction failed

Message: invalid hash

| Transaction info |

from:      0x031d9DA080fD0DE2Be1C08Aa1e88C1146588E434
to:        0xC166FA92A0515234DeA1BF52D06776168600dfDE
chain:     goerli (5)

Need help with this error? Join our community: https://discord.gg/thirdweb

| Raw error |

invalid hash (argument="value", value=null, code=INVALID_ARGUMENT, version=providers/5.7.1)
    at convertToTWError (paper-xyz-b54e7924.esm.js?f374:1588:1)
    at ContractWrapper.sendTransactionByFunction (paper-xyz-b54e7924.esm.js?f374:5449:1)
    at async ContractWrapper.sendTransaction (paper-xyz-b54e7924.esm.js?f374:5424:1)
    at async MarketplaceDirect.buyoutListing (paper-xyz-b54e7924.esm.js?f374:13133:1)
    at async Marketplace.buyoutListing (marketplace-ceb4a6d2.esm.js?4f67:388:1)

Is it possible to use this contract with a custom provider? What I'm missing?

arnaudjnn avatar Nov 08 '22 08:11 arnaudjnn