Giter VIP home page Giter VIP logo

ethereum-sdk's Issues

Facing Error while creating instance of Ethereum-sdk

image

This is what my code looks like.

  const { library: provider, account: from } = useWeb3React();
  useEffect(() => {
    console.log(`account: ${from}`);
  }, [from]);
  const wallet = useMemo(() => {
    if (provider !== undefined && from !== undefined) {
      const address = toUnionAddress(`ETHEREUM:${from}`);
      return new EthereumWallet(
        new Web3Ethereum({ web3: provider, from }),
        address
      );
    } else {
      return undefined;
    }
  }, [provider, from]);
  const sdk = useMemo(() => {
    if (wallet !== undefined) {
      return createRaribleSdk(wallet, "dev"); // error occurs on this line. I did tried to pass params there. But the error remains same.
    } else {
      return undefined;
    }
  }, [env, wallet]);

The package versions that I am using are.

"@rarible/protocol-ethereum-sdk": "^0.12.8",
"@rarible/sdk-wallet": "^0.7.11",

ERC1155 Sell and Bid orders error 400

When placing a bid or sell order on an ERC1155 token from the SDK, I get this error every time.
I'm testing on Rinkeby network.

The error:
Failed to load resource: the server responded with a status of 400 ()

Here is the full request that I do:

curl 'https: //ethereum-api-staging.rarible.org/v0.1/order/orders' \ -H 'authority: ethereum-api-staging.rarible.org' \ -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.61 Safari/537.36' \ -H 'content-type: application/json' \ -H 'accept: */*' \ -H 'sec-gpc: 1' \ -H 'origin: https://rarible-demo.bubbleapps.io' \ -H 'sec-fetch-site: cross-site' \ -H 'sec-fetch-mode: cors' \ -H 'sec-fetch-dest: empty' \ -H 'referer: https://rarible-demo.bubbleapps.io/' \ -H 'accept-language: en-GB,en-US;q=0.9,en;q=0.8' \ --data-raw '{"maker":"0xbea9938565b830a263162c86de7642177fa08004","make":{"assetType":{"@type":"ERC1155","contract":"0x1af7a7555263f275433c6bb0b8fdcd231f89b1d7","tokenId":"86239056537866358507050266989756184312317378498709552951663058336055197433857","uri":"QmVeSu3CNqY6PVTkDFzABvQwtBLrK6uwgFZtWo2vMTfmNH","creators":[{"account":"0xbea9938565b830a263162c86de7642177fa08004","value":10000}],"royalties":[{"account":"0xbea9938565b830a263162c86de7642177fa08004","value":1000}],"signatures":["0xd3cf1d4d8129d559a65da90e078a555906e43989226a3043e660686165043280173751fb645946c1510180b5e512c8a4681262a701297753e8f1ecd054d790db1b"],"supply":"6","assetClass":"ERC721_LAZY"},"value":"1"},"take":{"assetType":{"assetClass":"ETH"},"value":"1000000000000000000"},"type":"RARIBLE_V2","data":{"dataType":"RARIBLE_V2_DATA_V1","payouts":[],"originFees":[]},"salt":"18599704616995546978572909908843229650706680586262049193108086493917652791984","signature":"0xfa5ebd00702c401b4bf7e1c603cecef4e93dcddbb2539bfc76e4e896ad195dd40d98c3bd9a896316ea538699e58b7f9f931aaea5ae5e953193182aabb4dc06f81b"}' \ --compressed

sdk order.sell not working for ERC1155

I'm trying to create a sell order from my front-end client on an RFC1155 token I own and I'm getting the following error:

{
  "code": "INCORRECT_LAZY_ASSET",
  "message": "Invalid signatures for creators [0x28d431d565b97815473a4773634acbfc1f12421b] for lazy asset on make side",
  "status": 400
}

Here's the code:

const orderBuilder = await raribleSdk.order.sell({
  makeAssetType: {
    assetClass: 'ERC1155',
    contract: toAddress(
      config.get('myown1155contractaddress')
    ),
    tokenId: toBigNumber(
      extractTokenIdFromItemId(nft.previewNft.itemId)
    ),
  },
  maker: toAddress(ownership.owner.ethAddress),
  amount: quantity,
  price: getValues('price'),
  payouts: [],
  originFees: [
    {
      account: toAddress(config.get('myownaddress')),
      value: 250,
    },
  ],
  takeAssetType: { assetClass: 'ETH' },
});

and here's the request I see in the browser:

{
  "maker": "0x28d431d565b97815473a4773634acbfc1f12421b",
  "make": {
    "assetType": {
      "@type": "ERC1155",
      "contract": "0x927b2ed99edd05a1fbef4de4e1775ada0901d4c2",
      "tokenId": "18467429459816144863947812166421793754398676185957064781363011930739185811472",
      "uri": "/ipfs/QmSsKPRpMwUHNT7fJDJQ3nRsBAJBNskeatbYhNtTKr9uL8",
      "creators": [
        {
          "account": "0x28d431d565b97815473a4773634acbfc1f12421b",
          "value": 10000
        }
      ],
      "royalties": [
        {
          "account": "0x28d431d565b97815473a4773634acbfc1f12421b",
          "value": 500
        },
        {
          "account": "0xee5f8c3e15b2d9280f060f01fc08c2f2f3b4476b",
          "value": 1000
        }
      ],
      "signatures": [
      "0x107899f9ff79bad2c9659c6154d661c5badf20daea4e6f5bcb820d5fe946674e47cb524e0f53842d1df04304ff65da14343a8cb2b5e2cc2b3f87c2f47d3face01c"
      ],
      "supply": "10",
      "assetClass": "ERC721_LAZY"
    },
    "value": "2"
  },
  "take": { "assetType": { "assetClass": "ETH" }, "value": "2" },
  "type": "RARIBLE_V2",
  "data": {
    "dataType": "RARIBLE_V2_DATA_V1",
    "payouts": [],
    "originFees": [
      { "account": "0x28d431d565b97815473a4773634acbfc1f12421b", "value": 250 }
    ]
  },
  "salt": "34945805662674558592829447995129376213206409534291223948514422231105297539999",
  "signature": "0x24bda6f87871cc6fbac173e60aa46b95847a42c1ac7097c5b59bb346289dd1a367272f444f15009d4d875570e154d51aabd1235ea44b3d635af46b20e87d6ee11b"
}

I'm 100% sure I own the NFT, so I'm not sure how the signature could be wrong. I set all this up by following the README on this repo and on the protocol-example repo. Am I sending wrong params when calling order.sell?

I do see "assetClass": "ERC721_LAZY" in the request body, which does seem completely wrong since I'm dealing with an 1155.

Can not Purchase order

When I try to purchase order by using this code, I get "transaction underpriced" error.
sdk.order.buy({ order, payouts: [], originFees: [], amount: 1, infinite: true })

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.