Cancelling Offers

An offer can be canceled by the creator of the offer by calling the cancelOffer contract method and passing the offer ID.

import { api } from '@cityofzion/neon-js';

async function cancelOffer(offerId) {
    let configWithTx;
    try {
      // send the signed transactions to the api for relay
      configWithTx = await buildContractTransaction('cancelOffer',
          offerId.replace('0x', ''),
    } catch (e) {
        throw new Error(`Failed to build cancel order transaction. ${e.message}`);

    await api.sendTx(configWithTx);
    // wait for transaction success
    await monitorTxForConfirmation(configWithTx.tx);

    return configWithTx;