@bosonprotocol/core-sdk
Advanced tools
Comparing version 1.42.2 to 1.43.0-alpha.0
@@ -38,2 +38,7 @@ import { AssetWithTokenId, FulfillmentDataResponse, GetNFTResponse, OrderAPIOptions, OrderV2, OrdersQueryOptions, ProtocolData } from "opensea-js"; | ||
createListing(listing: OpenSeaListing): Promise<OrderV2>; | ||
cancelOrder(args: { | ||
order: OrderV2; | ||
accountAddress: string; | ||
domain?: string; | ||
}): Promise<void>; | ||
}; | ||
@@ -106,2 +111,6 @@ export declare class WrapperFactory { | ||
}): Promise<import("@bosonprotocol/common").TransactionResponse>; | ||
cancelOrder(asset: { | ||
contract: string; | ||
tokenId: string; | ||
}, side: Side): Promise<void>; | ||
protected convertListing(listing: Listing): OpenSeaListing; | ||
@@ -108,0 +117,0 @@ protected convertOsOrder(osOrder: OrderV2 | undefined): Order | undefined; |
@@ -14,2 +14,3 @@ "use strict"; | ||
const units_1 = require("@ethersproject/units"); | ||
const opensea_js_1 = require("opensea-js"); | ||
const bignumber_1 = require("@ethersproject/bignumber"); | ||
@@ -332,2 +333,17 @@ const common_1 = require("@bosonprotocol/common"); | ||
} | ||
cancelOrder(asset, side) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const signer = yield this._web3Lib.getSignerAddress(); | ||
const osOrder = yield this._handler.api.getOrder({ | ||
assetContractAddress: asset.contract, | ||
tokenId: asset.tokenId, | ||
side: side === common_2.Side.Ask ? types_1.OrderSide.LISTING : types_1.OrderSide.OFFER, | ||
maker: signer | ||
}); | ||
yield this._handler.cancelOrder({ | ||
order: osOrder, | ||
accountAddress: osOrder.maker.address | ||
}); | ||
}); | ||
} | ||
convertListing(listing) { | ||
@@ -368,3 +384,4 @@ return { | ||
maker: osOrder.maker ? { address: osOrder.maker.address } : undefined, | ||
taker: osOrder.taker ? { address: osOrder.taker.address } : undefined | ||
taker: osOrder.taker ? { address: osOrder.taker.address } : undefined, | ||
isAuction: osOrder.orderType === opensea_js_1.OrderType.ENGLISH | ||
}; | ||
@@ -371,0 +388,0 @@ } |
@@ -50,2 +50,3 @@ import { PriceDiscoveryStruct, Side, TransactionResponse } from "@bosonprotocol/common"; | ||
}; | ||
isAuction: boolean; | ||
}; | ||
@@ -97,3 +98,7 @@ export type SignedOrder = Order & { | ||
abstract getOrCreateVouchersWrapper(contractAddress: string): Promise<Wrapper>; | ||
abstract cancelOrder(asset: { | ||
contract: string; | ||
tokenId: string; | ||
}, side: Side): Promise<void>; | ||
} | ||
//# sourceMappingURL=types.d.ts.map |
@@ -38,2 +38,7 @@ import { AssetWithTokenId, FulfillmentDataResponse, GetNFTResponse, OrderAPIOptions, OrderV2, OrdersQueryOptions, ProtocolData } from "opensea-js"; | ||
createListing(listing: OpenSeaListing): Promise<OrderV2>; | ||
cancelOrder(args: { | ||
order: OrderV2; | ||
accountAddress: string; | ||
domain?: string; | ||
}): Promise<void>; | ||
}; | ||
@@ -106,2 +111,6 @@ export declare class WrapperFactory { | ||
}): Promise<import("@bosonprotocol/common").TransactionResponse>; | ||
cancelOrder(asset: { | ||
contract: string; | ||
tokenId: string; | ||
}, side: Side): Promise<void>; | ||
protected convertListing(listing: Listing): OpenSeaListing; | ||
@@ -108,0 +117,0 @@ protected convertOsOrder(osOrder: OrderV2 | undefined): Order | undefined; |
import { formatUnits } from "@ethersproject/units"; | ||
import { OrderType } from "opensea-js"; | ||
import { BigNumber } from "@ethersproject/bignumber"; | ||
@@ -305,2 +306,15 @@ import { abis } from "@bosonprotocol/common"; | ||
} | ||
async cancelOrder(asset, side) { | ||
const signer = await this._web3Lib.getSignerAddress(); | ||
const osOrder = await this._handler.api.getOrder({ | ||
assetContractAddress: asset.contract, | ||
tokenId: asset.tokenId, | ||
side: side === Side.Ask ? OrderSide.LISTING : OrderSide.OFFER, | ||
maker: signer | ||
}); | ||
await this._handler.cancelOrder({ | ||
order: osOrder, | ||
accountAddress: osOrder.maker.address | ||
}); | ||
} | ||
convertListing(listing) { | ||
@@ -341,3 +355,4 @@ return { | ||
maker: osOrder.maker ? { address: osOrder.maker.address } : undefined, | ||
taker: osOrder.taker ? { address: osOrder.taker.address } : undefined | ||
taker: osOrder.taker ? { address: osOrder.taker.address } : undefined, | ||
isAuction: osOrder.orderType === OrderType.ENGLISH | ||
}; | ||
@@ -344,0 +359,0 @@ } |
@@ -50,2 +50,3 @@ import { PriceDiscoveryStruct, Side, TransactionResponse } from "@bosonprotocol/common"; | ||
}; | ||
isAuction: boolean; | ||
}; | ||
@@ -97,3 +98,7 @@ export type SignedOrder = Order & { | ||
abstract getOrCreateVouchersWrapper(contractAddress: string): Promise<Wrapper>; | ||
abstract cancelOrder(asset: { | ||
contract: string; | ||
tokenId: string; | ||
}, side: Side): Promise<void>; | ||
} | ||
//# sourceMappingURL=types.d.ts.map |
{ | ||
"name": "@bosonprotocol/core-sdk", | ||
"version": "1.42.2", | ||
"version": "1.43.0-alpha.0", | ||
"description": "Facilitates interaction with the contracts and subgraphs of the Boson Protocol", | ||
@@ -64,3 +64,3 @@ "main": "./dist/cjs/index.js", | ||
}, | ||
"gitHead": "517147852fd3dc240c91259199396f3e339dfece" | ||
"gitHead": "df0d422ef5da5338e236b5e9827a90e577a31ae9" | ||
} |
@@ -7,2 +7,3 @@ import { formatUnits } from "@ethersproject/units"; | ||
OrderAPIOptions, | ||
OrderType, | ||
OrderV2, | ||
@@ -96,2 +97,7 @@ OrdersQueryOptions, | ||
createListing(listing: OpenSeaListing): Promise<OrderV2>; | ||
cancelOrder(args: { | ||
order: OrderV2; | ||
accountAddress: string; | ||
domain?: string; | ||
}): Promise<void>; | ||
}; | ||
@@ -471,2 +477,22 @@ | ||
public async cancelOrder( | ||
asset: { | ||
contract: string; | ||
tokenId: string; | ||
}, | ||
side: Side | ||
) { | ||
const signer = await this._web3Lib.getSignerAddress(); | ||
const osOrder = await this._handler.api.getOrder({ | ||
assetContractAddress: asset.contract, | ||
tokenId: asset.tokenId, | ||
side: side === Side.Ask ? OrderSide.LISTING : OrderSide.OFFER, | ||
maker: signer | ||
}); | ||
await this._handler.cancelOrder({ | ||
order: osOrder, | ||
accountAddress: osOrder.maker.address | ||
}); | ||
} | ||
protected convertListing(listing: Listing): OpenSeaListing { | ||
@@ -508,3 +534,4 @@ return { | ||
maker: osOrder.maker ? { address: osOrder.maker.address } : undefined, | ||
taker: osOrder.taker ? { address: osOrder.taker.address } : undefined | ||
taker: osOrder.taker ? { address: osOrder.taker.address } : undefined, | ||
isAuction: osOrder.orderType === OrderType.ENGLISH | ||
}; | ||
@@ -511,0 +538,0 @@ } |
@@ -58,2 +58,3 @@ import { | ||
}; | ||
isAuction: boolean; | ||
}; | ||
@@ -127,2 +128,9 @@ | ||
): Promise<Wrapper>; | ||
public abstract cancelOrder( | ||
asset: { | ||
contract: string; | ||
tokenId: string; | ||
}, | ||
side: Side | ||
): Promise<void>; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
17584445
267956
2