From 7000a65917a3125087fdfa87fdab027f34aac2db Mon Sep 17 00:00:00 2001 From: Anorth <31010490+Anorth1997@users.noreply.github.com> Date: Sat, 13 Jan 2024 20:09:54 +0800 Subject: [PATCH] Fix/self order book (#30) * fix post to self order book * update version --- package.json | 2 +- src/modules/utils/post-order/index.ts | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 0de358b..9a88815 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@nftgo/gotrading", - "version": "1.0.11", + "version": "1.0.12", "main": "dist/index.js", "module": "dist/index.esm.js", "types": "dist/index.d.ts", diff --git a/src/modules/utils/post-order/index.ts b/src/modules/utils/post-order/index.ts index 0f83dfc..5fee6f6 100644 --- a/src/modules/utils/post-order/index.ts +++ b/src/modules/utils/post-order/index.ts @@ -2,20 +2,22 @@ import { splitSignature } from 'ethers/lib/utils'; import { AggregatorApiException, BaseException } from '@/exceptions'; -import { IPostOrderHandler } from './utils'; import * as Models from './utils'; +import { IPostOrderHandler } from './utils'; import { - HTTPClient, - Config, AggregatorApiResponse, AggregatorApiStatusResponse, - PostOrderReq, + Config, + HTTPClient, + Orderbook, OrderKind, + PostOrderReq, } from '@/types'; -import { SeaportV1D5Handler, LooksRareV2Handler, X2Y2Handler } from './handler'; +import { LooksRareV2Handler, SeaportV1D5Handler, X2Y2Handler } from './handler'; import { HTTPClientStable } from '@/http'; import { SafeAny } from 'src/types/safe-any'; + export class PostOrderHandler { private handlers = new Map(); private client: HTTPClient = new HTTPClientStable(); @@ -37,7 +39,7 @@ export class PostOrderHandler { async handle(params: PostOrderReq, signature: string, endpoint: string): Promise { // given the orderKind, invoke NFTGo developer API or directly post order to marketplace - if (params.order.kind === OrderKind.Blur) { + if (params.order.kind === OrderKind.Blur || params.orderbook === Orderbook.SELF) { const res = await this.post(endpoint, { ...params, signature,