x2y2-io / x2y2-sdk Goto Github PK
View Code? Open in Web Editor NEWX2Y2 Node.js SDK.
License: MIT License
X2Y2 Node.js SDK.
License: MIT License
@tp-x2y2 @tster @shermiexyz
I think it’s time to show the results of work after almost a year of silence.
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?
testnet is not supported by the sdk. Can we have more information about it.
Getting Error: bad response when accepting an offer in the mainnet.
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.
Two Discord users reported running into error codes 1002 and 2014. Information about these errors is missing from the SDK docs.
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?
Is this sdk for node or for front-end developers? Why is the getSellOrders request cross-domain?
:)
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.