GithubHelp home page GithubHelp logo

x2y2-sdk's People

Contributors

shermiexyz avatar tp-x2y2 avatar tster avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

x2y2-sdk's Issues

Suggestion: Add error codes for missing approvals

At least a few times a week there are individuals in the X2Y2 developer Discord struggling to make offers or list NFTs with the SDK (or directly through the API).

In many cases, this is because they have forgotten to approve WETH spending (in the case of making offers) or approve transfer of the relevant NFT collection (in case of listing NFTs) to X2Y2's contracts, despite numerous notes about this in the SDK docs.

Would it be possible to add error codes for these cases?

can't find testnet

testnet is not supported by the sdk. Can we have more information about it.

SDK returning Error: bad response

Describe the bug
When following the instructions to make an offer as described at https://github.com/X2Y2-io/x2y2-sdk#making-offers--collection-offers, an Error: bad response is thrown.

Code sample

const offerResponse = await offer({
        network,
        signer: WALLET, // Signer of the buyer
        isCollection: false, // bool, set true for collection offer
        tokenAddress: '0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D', // string, contract address of NFT collection
        tokenId: '2491', // string, token ID of the NFT, use empty string for collection offer
        currency: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', // string, contract address of WETH, '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
        price: '10', // string, eg. '1000000000000000000' for 1 WETH
        expirationTime: 1657273865, // number, the unix timestamp when the listing will expire, in seconds
      })
    } catch (error) {
        console.log(error)
    }

Expected behavior
The API should return a 200 status code. If something is wrong with the order, one of the custom error codes should be thrown.

Error: API Client not yet initialized

When trying to use the SDK to make offers, I have the following error:

"Error: API Client not yet initialized".

Could you please let me know the reason?

Cannot find module '@x2y2-io/sdk/dist/network'

  1. npm install @x2y2-io/[email protected] --save
  2. ts-node test.ts
    Got the error:
    /usr/local/lib/node_modules/ts-node/dist-raw/node-internal-modules-esm-resolve.js:366
    throw new ERR_MODULE_NOT_FOUND(
    ^
    CustomError: Cannot find module '/Users/main/workspace/node/x2y2-api/node_modules/@x2y2-io/sdk/dist/network' imported from /Users/daizong/workspace/node/x2y2-api/src/test.ts
    at finalizeResolution (/usr/local/lib/node_modules/ts-node/dist-raw/node-internal-modules-esm-resolve.js:366:11)
    at moduleResolve (/usr/local/lib/node_modules/ts-node/dist-raw/node-internal-modules-esm-resolve.js:801:10)
    at Object.defaultResolve (/usr/local/lib/node_modules/ts-node/dist-raw/node-internal-modules-esm-resolve.js:912:11)
    at /usr/local/lib/node_modules/ts-node/src/esm.ts:218:35
    at entrypointFallback (/usr/local/lib/node_modules/ts-node/src/esm.ts:168:34)
    at /usr/local/lib/node_modules/ts-node/src/esm.ts:217:14
    at addShortCircuitFlag (/usr/local/lib/node_modules/ts-node/src/esm.ts:409:21)
    at resolve (/usr/local/lib/node_modules/ts-node/src/esm.ts:197:12)
    at resolve (/usr/local/lib/node_modules/ts-node/src/child/child-loader.ts:15:39)
    at ESMLoader.resolve (node:internal/modules/esm/loader:580:30)

code: test.ts
`import {init} from '@x2y2-io/sdk'
import { Network } from '@x2y2-io/sdk/dist/network'

export var test = async function() {
init("xxxxx", Network.Mainnet)
}
await test()`

node version: v16.15.1
ts-node version: v10.8.1

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.