Skip to main content

Offer

This page instructs you how to create, cancel and accept offer from a logged-in users Passport wallet.

Pre-requisites

  • The user must be logged into your application via Passport

1. Making an offer

The system currently only supports creating a offer on a listed asset i.e an asset that is already listed for sale and has an active sell order associated with it.

To making an offer, the following properties must be specified:

  • buy: The amount of tokens that will be bought for this order
  • sell: The amount of tokens that will be sold for this order
  • expiration_timestamp: (Optional) ExpirationTimestamp in Unix time. Note: will be rounded down to the nearest hour
  • fees: (Optional) Inclusion of either maker or taker fees

For example:

const offerRequest: UnsignedOrderRequest = {
buy: {
type: "ERC721",
data: {
token_id: "2",
token_address: "0x5f0d12c93ec0a95ea01dcafbf11110bbd6d71c51"
},
amount: "1"
},
sell: {
type: "ETH",
data: {
decimals: 18
},
amount: "11000000000000"
},
expiration_timestamp: 0,
};

Performing the creating offer:

using the order function on the IMXProvider instance that is returned from the connectImx function:

const offerResponst = await provider.createOrder(offerRequest);

2. Cancelling the offer

Once a user has made an offer, they can later cancel that offer.

To cancel an offer, the following properties must be specified:

  • order_id: ID of the offer to be cancelled

For example:

const cancelOfferRequest: GetSignableCancelOrderRequest = {
order_id: '12345',
};

Performing the cancelling the offer:

using the cancelOrder function on the IMXProvider instance that is returned from the connectImx function:

const cancelOfferResponse = await provider.cancelOrder(cancelOfferRequest);

3. Accept the offer

Seller can accept an offer and sell my NFT asset for fungible tokens / ETH.

To accepting an offer, the following properties must be specified:

  • expiration_timestamp: (Optional) ExpirationTimestamp in Unix
  • fees: Inclusion of either maker or taker fees
  • order_id: The ID of the offer
  • user: Ethereum address of the submitting user

For example:

const acceptOfferRequest: GetSignableTradeRequest = {
order_id: '12345',
expiration_timestamp: 0
user: "0x1234"
};

Performing the accepting the offer:

using the createTrade function on the IMXProvider instance that is returned from the connectImx function:

const acceptOfferResponse = await provider.createTrade(acceptOfferRequest);

IMX Whitepaper IMX Tokenomics Block Explorer Careers Contact Us