diff --git a/components/trade/overviewModal/TokenItemDetails.vue b/components/trade/overviewModal/TokenItemDetails.vue
new file mode 100644
index 0000000000..8d16052b10
--- /dev/null
+++ b/components/trade/overviewModal/TokenItemDetails.vue
@@ -0,0 +1,28 @@
+
+
+
+
+ {{ formattedPrice }}
+
+
+
+
+
+
diff --git a/components/trade/overviewModal/TradeOverviewModal.vue b/components/trade/overviewModal/TradeOverviewModal.vue
index 229ea9282e..488c43f28f 100644
--- a/components/trade/overviewModal/TradeOverviewModal.vue
+++ b/components/trade/overviewModal/TradeOverviewModal.vue
@@ -30,7 +30,7 @@
:trade="trade"
/>
diff --git a/components/trade/overviewModal/TypeOffer.vue b/components/trade/overviewModal/TypeOffer.vue
index 3b50bd86a4..e54fd04efa 100644
--- a/components/trade/overviewModal/TypeOffer.vue
+++ b/components/trade/overviewModal/TypeOffer.vue
@@ -2,15 +2,14 @@
-
-
-
- {{ desiredFormatted }}
-
-
-
+
+
@@ -22,19 +21,12 @@
diff --git a/components/trade/overviewModal/TypeSwap.vue b/components/trade/overviewModal/TypeSwap.vue
index b7f02a72c5..b8cfc92ca9 100644
--- a/components/trade/overviewModal/TypeSwap.vue
+++ b/components/trade/overviewModal/TypeSwap.vue
@@ -8,37 +8,25 @@
'flex-col-reverse': isMyTrade,
}"
>
-
+
-
-
-
- {{ desiredFormatted }}
-
-
-
+ :nft="desired"
+ />
-
-
-
- {{ oferredFormatted }}
-
-
-
+
+
@@ -52,9 +40,9 @@
diff --git a/components/trade/overviewModal/utils.ts b/components/trade/overviewModal/utils.ts
index 14ccf0e5b1..2b43eecf52 100644
--- a/components/trade/overviewModal/utils.ts
+++ b/components/trade/overviewModal/utils.ts
@@ -2,9 +2,9 @@ export type OverviewMode = 'owner' | 'incoming'
export const useIsTradeOverview = (trade: ComputedRef) => {
const { accountId } = useAuth()
- const { isOwnerOfNft } = useIsTrade(trade, accountId)
+ const { isTargetOfTrade } = useIsTrade(trade, accountId)
- const mode = computed(() => isOwnerOfNft.value ? 'incoming' : 'owner')
+ const mode = computed(() => isTargetOfTrade.value ? 'incoming' : 'owner')
const isMyTrade = computed(() => mode.value === 'owner')
const isIncomingTrade = computed(() => mode.value === 'incoming')
diff --git a/composables/transaction/utils.ts b/composables/transaction/utils.ts
index ecc1b3ffb6..9128b5d18b 100644
--- a/composables/transaction/utils.ts
+++ b/composables/transaction/utils.ts
@@ -60,7 +60,7 @@ export function isActionValid(action: Actions): boolean {
[ShoppingActions.ACCEPT_SWAP]: (action: ActionAcceptSwap) =>
Boolean(action.receiveItem) && Boolean(action.receiveCollection) && Boolean(action.sendItem) && Boolean(action.sendCollection),
[ShoppingActions.ACCEPT_OFFER]: (action: ActionAcceptOffer) =>
- Boolean(action.sendItem && action.sendCollection && action.price && action.receiveItem),
+ Boolean(action.sendCollection && action.price && action.receiveItem),
[Interaction.MINT]: (action: ActionMintCollection) =>
Boolean(action.collection),
[Collections.DELETE]: (action: ActionDeleteCollection) =>
diff --git a/composables/useIsTrade.ts b/composables/useIsTrade.ts
index e2621319a5..9cfa169f97 100644
--- a/composables/useIsTrade.ts
+++ b/composables/useIsTrade.ts
@@ -1,9 +1,9 @@
export default function (trade: ComputedRef, target: MaybeRef) {
const isCreatorOfTrade = computed(() => trade.value?.caller === unref(target))
- const isOwnerOfNft = computed(() => (trade.value?.isEntireCollectionDesired ? trade.value?.considered : trade.value?.desired)?.currentOwner === unref(target))
+ const isTargetOfTrade = computed(() => trade.value?.targets.includes(unref(target)))
return {
isCreatorOfTrade,
- isOwnerOfNft,
+ isTargetOfTrade,
}
}
diff --git a/composables/useTrades.ts b/composables/useTrades.ts
index 2284150d89..fc4c496f2b 100644
--- a/composables/useTrades.ts
+++ b/composables/useTrades.ts
@@ -40,9 +40,9 @@ type BaseTrade = {
considered: TradeConsidered
}
-export enum TradeDesiredType {
- TOKEN,
- COLLECTION,
+export enum TradeDesiredTokenType {
+ SPECIFIC,
+ ANY_IN_COLLECTION,
}
export enum TradeType {
@@ -59,10 +59,11 @@ type Offer = BaseTrade
type Trade = Swap | Offer
export type TradeNftItem = T & {
- expirationDate?: Date
+ expirationDate: Date
type: TradeType
- desiredType: TradeDesiredType
- isEntireCollectionDesired: boolean
+ desiredType: TradeDesiredTokenType
+ isAnyTokenInCollectionDesired: boolean
+ targets: string[]
}
export const TRADES_QUERY_MAP: Record = {
@@ -85,51 +86,103 @@ export default function ({ where = {}, limit = 100, disabled = computed(() => fa
disabled?: ComputedRef
type?: TradeType
}) {
- const variables = computed(() => ({
- where: unref(where),
- limit: limit,
- }))
-
const { queryDocument, dataKey } = TRADES_QUERY_MAP[type]
+ const items = ref([])
+ const targetsOfTrades = ref