opensea-js icon indicating copy to clipboard operation
opensea-js copied to clipboard

Error: Unsupported Protocol

Open sghofrany opened this issue 3 years ago • 15 comments

I am getting Error: Unsupported Protocol when attempting to fulfillOrder.

SDK version: 4.0.12

this.openseaSDK = new OpenSeaSDK(this.walletProvider, {
    networkName: Network.Main,
    apiKey: 'API-KEY'
});

const order = await this.openseaSDK.api.getOrder({
                side: "ask",
                assetContractAddress: this.contractAddress,
                tokenId: tokenId
            })

this.openseaSDK.fulfillOrder({
    order,
    accountAddress
});

Here is an example of the order object I am getting:

{
  "createdDate": "2023-03-04T19:00:25.651939",
  "closingDate": "2023-03-04T20:59:27",
  "listingTime": 1677956367,
  "expirationTime": 1677963567,
  "orderHash": "0x75a6473ffc8a8944ac0f831a644a1835527563506d6a28c8bf0a921a67e82fb9",
  "maker": {
    "address": "0xe8697df4bdac272c94abb99104691670cbb66142",
    "config": "",
    "profileImgUrl": "https://storage.googleapis.com/opensea-static/opensea-profile/20.png",
    "user": {}
  },
  "taker": null,
  "protocolData": {
    "parameters": {
      "offerer": "0xe8697df4bdac272c94abb99104691670cbb66142",
      "offer": [
        {
          "itemType": 2,
          "token": "0xED5AF388653567Af2F388E6224dC7C4b3241C544",
          "identifierOrCriteria": "5238",
          "startAmount": "1",
          "endAmount": "1"
        }
      ],
      "consideration": [
        {
          "itemType": 0,
          "token": "0x0000000000000000000000000000000000000000",
          "identifierOrCriteria": "0",
          "startAmount": "14735950000000000000",
          "endAmount": "14735950000000000000",
          "recipient": "0xe8697dF4BdAC272C94Abb99104691670CBb66142"
        },
        {
          "itemType": 0,
          "token": "0x0000000000000000000000000000000000000000",
          "identifierOrCriteria": "0",
          "startAmount": "74050000000000000",
          "endAmount": "74050000000000000",
          "recipient": "0xB4D24DAcbdFfA1BBf9A624044484b3FEeB7fdF74"
        }
      ],
      "startTime": "1677956367",
      "endTime": "1677963567",
      "orderType": 0,
      "zone": "0x004C00500000aD104D7DBd00e3ae0A5C00560C00",
      "zoneHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
      "salt": "0x360c6ebe0000000000000000000000000000000000000000a33a881460dd1edd",
      "conduitKey": "0x0000007b02230091a7ed01230072f7006a004d60a8d4e71d599b8104250f0000",
      "totalOriginalConsiderationItems": 2,
      "counter": 0
    },
    "signature": "0x7aa38bf4edd301fe08cde55374a8a166deab1630cb5ead5a3707aa452da8155f4cbe340dea5e1f3c22e29ba825214adf57583cdf3c36f38650c7a692191c17f5"
  },
  "protocolAddress": "0x00000000000001ad428e4906ae43d8f9852d0dd6",
  "currentPrice": "14810000000000000000",
  "makerFees": [
    {
      "account": {
        "address": "0xb4d24dacbdffa1bbf9a624044484b3feeb7fdf74",
        "config": "",
        "profileImgUrl": "https://storage.googleapis.com/opensea-static/opensea-profile/14.png",
        "user": null
      },
      "basisPoints": "50"
    }
  ],
  "takerFees": [],
  "side": "ask",
  "orderType": "basic",
  "cancelled": false,
  "finalized": false,
  "markedInvalid": false,
  "clientSignature": "0x7aa38bf4edd301fe08cde55374a8a166deab1630cb5ead5a3707aa452da8155f4cbe340dea5e1f3c22e29ba825214adf57583cdf3c36f38650c7a692191c17f5",
  "makerAssetBundle": {
    "maker": null,
    "assets": [
      {
        "tokenId": "5238",
        "tokenAddress": "0xed5af388653567af2f388e6224dc7c4b3241c544",
        "name": "Azuki #5238",
        "description": null,
        "owner": null,
        "assetContract": {
          "name": "Azuki",
          "description": "Take the red bean to join the garden. View the collection at [azuki.com/gallery](https://azuki.com/gallery).\r\n\r\nAzuki starts with a collection of 10,000 avatars that give you membership access to The Garden: a corner of the internet where artists, builders, and web3 enthusiasts meet to create a decentralized future. Azuki holders receive access to exclusive drops, experiences, and more. Visit [azuki.com](https://azuki.com) for more details.\r\n\r\nWe rise together. We build together. We grow together.",
          "type": "non-fungible",
          "schemaName": "ERC721",
          "address": "0xed5af388653567af2f388e6224dc7c4b3241c544",
          "tokenSymbol": "AZUKI",
          "buyerFeeBasisPoints": 0,
          "sellerFeeBasisPoints": 500,
          "openseaBuyerFeeBasisPoints": 0,
          "openseaSellerFeeBasisPoints": 0,
          "devBuyerFeeBasisPoints": 0,
          "devSellerFeeBasisPoints": 500,
          "imageUrl": "https://i.seadn.io/gae/H8jOCJuQokNqGBpkBN5wk1oZwO7LM8bNnrHCaekV2nKjnCqw6UB5oaH8XyNeBDj6bA_n1mjejzhFQUP3O1NfjFLHr3FOaeHcTOOT?w=500&auto=format",
          "externalLink": "http://www.azuki.com"
        },
        "collection": {
          "createdDate": null,
          "name": "Azuki",
          "description": "Take the red bean to join the garden. View the collection at [azuki.com/gallery](https://azuki.com/gallery).\r\n\r\nAzuki starts with a collection of 10,000 avatars that give you membership access to The Garden: a corner of the internet where artists, builders, and web3 enthusiasts meet to create a decentralized future. Azuki holders receive access to exclusive drops, experiences, and more. Visit [azuki.com](https://azuki.com) for more details.\r\n\r\nWe rise together. We build together. We grow together.",
          "slug": "azuki",
          "hidden": false,
          "featured": false,
          "featuredImageUrl": null,
          "displayData": {
            "card_display_style": "contain"
          },
          "paymentTokens": [],
          "openseaBuyerFeeBasisPoints": 0,
          "openseaSellerFeeBasisPoints": 0,
          "devBuyerFeeBasisPoints": 0,
          "devSellerFeeBasisPoints": 500,
          "payoutAddress": "0xb4d24dacbdffa1bbf9a624044484b3feeb7fdf74",
          "imageUrl": "https://i.seadn.io/gae/H8jOCJuQokNqGBpkBN5wk1oZwO7LM8bNnrHCaekV2nKjnCqw6UB5oaH8XyNeBDj6bA_n1mjejzhFQUP3O1NfjFLHr3FOaeHcTOOT?w=500&auto=format",
          "largeImageUrl": null,
          "externalLink": "http://www.azuki.com",
          "wikiLink": null,
          "fees": {
            "openseaFees": {},
            "sellerFees": {}
          }
        },
        "orders": null,
        "sellOrders": null,
        "buyOrders": null,
        "imageUrl": "https://i.seadn.io/gcs/files/4aab114dbc77ebfc3857a355034c8122.png?w=500&auto=format",
        "imagePreviewUrl": "https://i.seadn.io/gcs/files/4aab114dbc77ebfc3857a355034c8122.png?w=500&auto=format",
        "imageUrlOriginal": "ipfs://QmYDvPAXtiJg7s8JdRBSLWdgSphQdac8j1YuQNNxcGE1hg/5238.png",
        "imageUrlThumbnail": "https://i.seadn.io/gcs/files/4aab114dbc77ebfc3857a355034c8122.png?w=500&auto=format",
        "externalLink": null,
        "openseaLink": "https://opensea.io/assets/ethereum/0xed5af388653567af2f388e6224dc7c4b3241c544/5238",
        "numSales": 41,
        "lastSale": null,
        "backgroundColor": null,
        "transferFee": null,
        "transferFeePaymentToken": null
      }
    ],
    "name": null,
    "slug": null,
    "description": null,
    "externalLink": null,
    "permalink": null,
    "sellOrders": null
  },
  "takerAssetBundle": {
    "maker": null,
    "assets": [
      {
        "tokenId": "0",
        "tokenAddress": "0x0000000000000000000000000000000000000000",
        "name": "Ether",
        "description": "",
        "owner": null,
        "assetContract": {
          "name": "Ether",
          "description": "This is the collection of owners of Ether",
          "type": "fungible",
          "schemaName": "ERC20",
          "address": "0x0000000000000000000000000000000000000000",
          "tokenSymbol": "ETH",
          "buyerFeeBasisPoints": 0,
          "sellerFeeBasisPoints": 50,
          "openseaBuyerFeeBasisPoints": 0,
          "openseaSellerFeeBasisPoints": 50,
          "devBuyerFeeBasisPoints": 0,
          "devSellerFeeBasisPoints": 0,
          "imageUrl": null,
          "externalLink": null
        },
        "collection": {
          "createdDate": null,
          "name": "Ether",
          "description": "This is the collection of owners of Ether",
          "slug": "ether",
          "hidden": true,
          "featured": false,
          "featuredImageUrl": null,
          "displayData": {},
          "paymentTokens": [],
          "openseaBuyerFeeBasisPoints": 0,
          "openseaSellerFeeBasisPoints": 50,
          "devBuyerFeeBasisPoints": 0,
          "devSellerFeeBasisPoints": 0,
          "payoutAddress": null,
          "imageUrl": null,
          "largeImageUrl": null,
          "externalLink": null,
          "wikiLink": null,
          "fees": {
            "openseaFees": {},
            "sellerFees": {}
          }
        },
        "orders": null,
        "sellOrders": null,
        "buyOrders": null,
        "imageUrl": "https://openseauserdata.com/files/6f8e2979d428180222796ff4a33ab929.svg",
        "imagePreviewUrl": "https://openseauserdata.com/files/6f8e2979d428180222796ff4a33ab929.svg",
        "imageUrlOriginal": "https://openseauserdata.com/files/6f8e2979d428180222796ff4a33ab929.svg",
        "imageUrlThumbnail": "https://openseauserdata.com/files/6f8e2979d428180222796ff4a33ab929.svg",
        "externalLink": null,
        "openseaLink": "https://opensea.io/assets/ethereum/0x0000000000000000000000000000000000000000/0",
        "numSales": 2,
        "lastSale": null,
        "backgroundColor": null,
        "transferFee": null,
        "transferFeePaymentToken": null
      }
    ],
    "name": null,
    "slug": null,
    "description": null,
    "externalLink": null,
    "permalink": null,
    "sellOrders": null
  }
}

sghofrany avatar Mar 04 '23 19:03 sghofrany

i am also facing the same issue

the order returns the protocol address as "protocolAddress": "0x00000000000001ad428e4906ae43d8f9852d0dd6",

seaport js we are having the protocol address as CROSS_CHAIN_SEAPORT_V1_4_ADDRESS = "0x00000000000001ad428e4906aE43D8F9852d0dD6";

0x00000000000001ad428e4906ae43d8f9852d0dd6 != 0x00000000000001ad428e4906aE43D8F9852d0dD6

because of this it throws unsupported protocol issue

this address is same but i see case difference

pravin120993 avatar Mar 04 '23 21:03 pravin120993

I don't see why case difference would cause an issue, since hexadecimal isn't case sensitive.

sghofrany avatar Mar 04 '23 21:03 sghofrany

its a string

in opensea js fullfillorder function there is a condition

if (!(order.protocolAddress in
                            [constants_1.CROSS_CHAIN_SEAPORT_ADDRESS, constants_1.CROSS_CHAIN_SEAPORT_V1_4_ADDRESS])) {
                            throw new Error("Unsupported protocol");
                        }

in the above code

order.protocolAddress is "0x00000000000001ad428e4906ae43d8f9852d0dd6" CROSS_CHAIN_SEAPORT_V1_4_ADDRESS is "0x00000000000001ad428e4906aE43D8F9852d0dD6";

pravin120993 avatar Mar 04 '23 21:03 pravin120993

Ahh, good to know. Let me test it out.

sghofrany avatar Mar 04 '23 21:03 sghofrany

@pravin120993 can you tell me what class you found that in?

sghofrany avatar Mar 04 '23 21:03 sghofrany

https://github.com/ProjectOpenSea/opensea-js/blob/master/src/sdk.ts#L1048 https://github.com/ProjectOpenSea/seaport-js/blob/main/src/constants.ts#L124

you can check it in node_modules of your project node_modules/opensea-js/lib/sdk.js

pravin120993 avatar Mar 04 '23 21:03 pravin120993

My version doesn't have the CROSS_CHAIN_SEAPORT_V1_4_ADDRESS constant. Do I need to upgrade my version? I'm still on version 4.0.12.

sghofrany avatar Mar 04 '23 21:03 sghofrany

iam on latest version 4.0.16 i think you should update.

pravin120993 avatar Mar 04 '23 21:03 pravin120993

I always have problems installing the newest version of this sdk, it almost never works without some weird hacks

sghofrany avatar Mar 04 '23 21:03 sghofrany

along with the above mentioned issue, found one more in the condition check for the protocol address.

this is because of this pr https://github.com/ProjectOpenSea/opensea-js/pull/844

raised one PR for the issue https://github.com/ProjectOpenSea/opensea-js/pull/853

pravin120993 avatar Mar 05 '23 19:03 pravin120993

if (!(order.protocolAddress in [constants_1.CROSS_CHAIN_SEAPORT_ADDRESS, constants_1.CROSS_CHAIN_SEAPORT_V1_4_ADDRESS]))

Isn't in designed for objects... i think this needs to change to include

stickx avatar Mar 06 '23 07:03 stickx

`return __generator(this, function (_b) { switch (_b.label) { case 0: if (!(order.protocolAddress in [constants_1.CROSS_CHAIN_SEAPORT_ADDRESS, constants_1.CROSS_CHAIN_SEAPORT_V1_4_ADDRESS])) { throw new Error("Unsupported protocol"); }

     constants_1.CROSS_CHAIN_SEAPORT_V1_4_ADDRESS = 0x00000000000001ad428e4906aE43D8F9852d0dD6
     
                    order.protocolAddress = 0x00000000000001ad428e4906ae43d8f9852d0dd6
                    `

but I set array for

image

this error same

EternalShallow avatar Mar 06 '23 15:03 EternalShallow

if (!(order.protocolAddress in [constants_1.CROSS_CHAIN_SEAPORT_ADDRESS, constants_1.CROSS_CHAIN_SEAPORT_V1_4_ADDRESS]))

Isn't in designed for objects... i think this needs to change to include

Good point, I just tried this simple example:

console.log("one" in ["one", "two"])

and the output is false

sghofrany avatar Mar 06 '23 15:03 sghofrany

This has been fixed in version 4.0.17 https://www.npmjs.com/package/opensea-js/v/4.0.17

JoshuaSchmidt-OpenSea avatar Mar 06 '23 16:03 JoshuaSchmidt-OpenSea

@JoshuaSchmidt-OpenSea Just tried out version 4.0.20, and am still getting the Unsupported Protocol error.

I see the changes in the main branch, but it seems the compiled code in the npm dist is still the old code? image

This can also be seen on npmjs.com (search for "Unsupported protocol"): https://www.npmjs.com/package/opensea-js/v/4.0.20?activeTab=explore

Was there possibly an issue in the npm bundle process?

nickfujita avatar Mar 09 '23 10:03 nickfujita