ProjectOpenSea / opensea-js

TypeScript SDK for the OpenSea marketplace
https://docs.opensea.io/reference
MIT License
2.28k stars 962 forks source link

opensea-js 7.1.1 Can't use MetaMask for fulfillingOrders #1426

Closed SMLaursen closed 8 months ago

SMLaursen commented 8 months ago

Component

Utils

Have you ensured that all of these are up to date?

What version of opensea-js are you on?

7.1.1

What function is the bug in?

fulfillOrder

Operating System

macOS (Apple Silicon)

Describe the bug

ethers : v6.11.1, node : v20.11.1 & @metamask/detect-provider: v2.0.0 (to pass the MM provider to below function)

In version 7.0.9 I could fulfill orders with MetaMask using the following snippet :

const fulfillOrder = useCallback(
    async ({ order, accountAddress }: { order: Listing; accountAddress: string }) => {
      if (!provider) {
        throw new Error("provider is not ready")
      }

      const { BrowserProvider } = await import("ethers")

      const mmProvider = new BrowserProvider(provider)
      const mmSigner = await mmProvider.getSigner()

      const { OpenSeaSDK, Chain } = await import("opensea-js")
      const chain = NETWORK_ID === 11155111 ? Chain.Sepolia : Chain.Mainnet

      const openseaSDK = new OpenSeaSDK(mmSigner, {
        chain,
        apiKey: OPENSEA_API_KEY,
      })
      await openseaSDK.fulfillOrder({ order, accountAddress })
    },
    [provider]
  )

In version 7.1.1 I get the following error

Error: execution reverted (unknown custom error) (action="estimateGas", data="0x815e1d64", reason=null, transaction={REDACTED}, invocation=null, revert=null, code=CALL_EXCEPTION, version=6.11.1)
    at makeError (errors.js:137:21)
    at getBuiltinCallException (abi-coder.js:119:70)
    at AbiCoder.getBuiltinCallException (abi-coder.js:220:16)
    at BrowserProvider.getRpcError (provider-jsonrpc.js:681:75)
    at BrowserProvider.getRpcError (provider-browser.js:71:22)
    at eval (provider-jsonrpc.js:315:45)
ryanio commented 8 months ago

thanks for opening, looking into this

ryanio commented 8 months ago

@SMLaursen is this happening for just one order or all of them? could you share an example order you are getting this?

0x815e1d64 == InvalidSigner() which means the order signature is invalid (not from the offerer)

ryanio commented 8 months ago

have identified the issue, will be opening a fix soon

SMLaursen commented 8 months ago

Ah okay, this was one of those failing : sepolia/0x5a96cf3ace257dfcc1fd3c037e548585124dc0c5/582

But i managed to but another one : sepolia/0xdd6d39977949c20917742b03ff7ad55158eb3365/1

So some seems to work ☺️

ryanio commented 8 months ago

Released the fix in v7.1.2, could you please try updating that should fix the issue.

SMLaursen commented 8 months ago

Released the fix in v7.1.2, could you please try updating that should fix the issue.

Great, can purchase both SeaPort 1.5 and 1.6 orders now ;)