Link.acceptOffer

Link.acceptOffer

LINK REFERENCE TOOL

Check out our Link reference tool to understand how Link methods work without having to write any code.

Here's how you can accept an offer:

import { XpansionChainOrderStatus, XpansionChainClient, Link } from '@imtbl/imx-sdk';
// Pass orderAndTradeAPI version parameter as 'v3' to target the latest version of order & trade API.
const link = new Link('https://link.sandbox.x.XpansionChain.com', null, 'v3');
// accept an offer by passing the orderId of the offer
await link.acceptOffer({
  orderId: '940',
  fees: [
    // optionally specify seller marketplace fees in array
    {
      address: '0x383b14727ac2bD3923f1583789d5385C3A26f91E',
      fee_percentage: 0.5, // equal to 0.5%
    },
  ],
});

Just like all other link SDK methods, acceptOffer returns a promise, which resolves once all operations are complete, or rejects once the link encounters a critical error.

Input parameters:

{
  orderId: string, // order id of the offer to be accepted
  fees?: {
    address: string, // recipient eth address
    fee_percentage: number, // fee percentage
  }[] // optionally specify seller marketplace fees in array
}

Errors

See error responses here.

Last updated