The cancellation of an NFT order works in the same way as the cancelation of "fungible tokens" order
Transaction parameters:
orderHash
: limit order unique id
Example
/* eslint-disable @typescript-eslint/no-unused-vars */
import * as dotenv from 'dotenv';
import axios from 'axios';
import { ethers } from 'ethers';
import {
constructPartialSDK,
constructEthersContractCaller,
constructAxiosFetcher,
constructCancelLimitOrder,
constructGetLimitOrders,
} from '..';
dotenv.config();
const maker = new ethers.Wallet(process.env.PK).connect(
ethers.getDefaultProvider(137)
);
const fetcher = constructAxiosFetcher(axios);
// provider must have write access to account
// this would usually be wallet provider (Metamask)
const provider = maker;
const contractCaller = constructEthersContractCaller(
{
ethersProviderOrSigner: provider,
EthersContract: ethers.Contract,
},
maker.address
);
const paraSwapLimitOrderSDK = constructPartialSDK(
{
chainId: 137,
fetcher,
contractCaller,
},
constructGetLimitOrders,
constructCancelLimitOrder
);
async function run() {
const deleteTx: ethers.ContractTransaction =
await paraSwapLimitOrderSDK.cancelLimitOrder(
'0x045cf1a02e39cc59d2027d3cb9ea6d832d6e0f2904cc1f1afab39061eb589d05'
);
console.log('deleteTx', deleteTx);
}
run();
s