@tradeport/sui-trading-sdk 0.5.3 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babel.config.js +3 -0
- package/.claude/settings.json +5 -0
- package/.claude/settings.local.json +5 -0
- package/.env.demo +5 -0
- package/.eslintrc.json +46 -0
- package/.prettierignore +4 -0
- package/.prettierrc.json +7 -0
- package/.vscode/launch.json +23 -0
- package/CHANGELOG.md +746 -0
- package/jest.config.js +12 -0
- package/package.json +66 -71
- package/src/SuiTradingClient.ts +442 -0
- package/src/apiClients/createKioskClient.ts +10 -0
- package/src/apiClients/createSuiClient.ts +5 -0
- package/src/apiClients/graphqlClient.ts +17 -0
- package/src/bigNumberConfig.ts +10 -0
- package/src/constants.ts +1052 -0
- package/src/graphql/createChainGQLQuery.ts +27 -0
- package/src/graphql/gqlChainRequest.ts +21 -0
- package/src/graphql/queries/fetchAccountKiosks.ts +12 -0
- package/src/graphql/queries/fetchActiveLockStateByNftId.ts +15 -0
- package/src/graphql/queries/fetchBidsById.ts +36 -0
- package/src/graphql/queries/fetchCollectionBidById.ts +21 -0
- package/src/graphql/queries/fetchCollectionBidsAtSamePrice.ts +29 -0
- package/src/graphql/queries/fetchCollectionChainState.ts +17 -0
- package/src/graphql/queries/fetchCollectionFloorListingForMarket.ts +28 -0
- package/src/graphql/queries/fetchCollectionFloorListings.ts +15 -0
- package/src/graphql/queries/fetchCollectionsById.ts +39 -0
- package/src/graphql/queries/fetchCommissionByListingId.ts +13 -0
- package/src/graphql/queries/fetchCryptoToUsdRate.ts +13 -0
- package/src/graphql/queries/fetchKiosksByOwner.ts +14 -0
- package/src/graphql/queries/fetchListingsById.ts +29 -0
- package/src/graphql/queries/fetchListingsByNftId.ts +23 -0
- package/src/graphql/queries/fetchLockById.ts +23 -0
- package/src/graphql/queries/fetchMultibidById.ts +34 -0
- package/src/graphql/queries/fetchNftCollectionChainState.ts +12 -0
- package/src/graphql/queries/fetchNftsById.ts +75 -0
- package/src/graphql/queries/fetchNftsByKioskId.ts +45 -0
- package/src/graphql/queries/fetchOwnerCapByKiosk.ts +10 -0
- package/src/graphql/queries/fetchPersonalCapByKiosk.ts +10 -0
- package/src/graphql/queries/fetchSharedObjectsByType.ts +12 -0
- package/src/graphql/queries/fetchTransferPoliciesByType.ts +12 -0
- package/src/graphql/queries/fetchWalletKiosks.ts +14 -0
- package/src/graphql/queries/getCommissionByListingId.ts +15 -0
- package/src/helpers/addOneDollarFee.ts +17 -0
- package/src/helpers/addThirdPartyTxFee.ts +17 -0
- package/src/helpers/calculatePremium.ts +9 -0
- package/src/helpers/calculateRoyaltyFee.ts +28 -0
- package/src/helpers/destroyZeroCoin.ts +14 -0
- package/src/helpers/getActiveLockStateByNftId.ts +15 -0
- package/src/helpers/getCollectionChainState.ts +31 -0
- package/src/helpers/getCollectionFloorPrice.ts +12 -0
- package/src/helpers/getLockById.ts +29 -0
- package/src/helpers/getMarketFeePrice.ts +82 -0
- package/src/helpers/getNftType.ts +38 -0
- package/src/helpers/getRoyaltyRuleModule.ts +7 -0
- package/src/helpers/getSharedObjects.ts +119 -0
- package/src/helpers/getSuiToUsdRate.ts +14 -0
- package/src/helpers/getTradeportBiddingContractBidAmount.ts +31 -0
- package/src/helpers/getTransferPolicyRuleNamesFromSuiObject.ts +24 -0
- package/src/helpers/hasPersonalKioskRule.ts +7 -0
- package/src/helpers/hasRoyaltyRule.ts +7 -0
- package/src/helpers/hasTransferPolicyRules.ts +6 -0
- package/src/helpers/isExpiredListing.ts +9 -0
- package/src/helpers/isNonKioskListing.ts +14 -0
- package/src/helpers/isSIngleBid.ts +13 -0
- package/src/helpers/kiosk/assertNftInSharedKiosk.ts +31 -0
- package/src/helpers/kiosk/getKioskCollectionRoyaltyFeeAmount.ts +71 -0
- package/src/helpers/kiosk/getKioskIdFromKioskTx.ts +29 -0
- package/src/helpers/kiosk/getKioskPlaceBidCoin.ts +59 -0
- package/src/helpers/kiosk/getNativeKioskTransferPolicies.ts +29 -0
- package/src/helpers/kiosk/getNativeKioskTransferPoliciesByNftType.ts +21 -0
- package/src/helpers/kiosk/getRulePackageId.ts +59 -0
- package/src/helpers/kiosk/getTransferPoliciesToResolve.ts +154 -0
- package/src/helpers/kiosk/isBluemoveKioskBid.ts +1 -0
- package/src/helpers/kiosk/isTradePortKioskBid.ts +4 -0
- package/src/helpers/kiosk/kioskListingBcs.ts +19 -0
- package/src/helpers/kiosk/kioskTxWrapper.ts +152 -0
- package/src/helpers/kiosk/lockNftInsideKioskIfNotLocked.ts +100 -0
- package/src/helpers/kiosk/preProcessSharedBulkBuyingData.ts +171 -0
- package/src/helpers/kiosk/resolveCustomTransferPolicyRules.ts +75 -0
- package/src/helpers/kiosk/resolveFloorPriceRule.ts +21 -0
- package/src/helpers/kiosk/resolveKioskLockRule.ts +47 -0
- package/src/helpers/kiosk/resolvePersonalKioskRule.ts +23 -0
- package/src/helpers/kiosk/resolveRoyaltyRule.ts +57 -0
- package/src/helpers/kiosk/resolveTableAllowlistRule.ts +34 -0
- package/src/helpers/kiosk/resolveTransferPolicies.ts +158 -0
- package/src/helpers/kiosk/sharedKioskState.type.ts +11 -0
- package/src/helpers/kiosk/takeAndBorrowNftFromKiosk.ts +50 -0
- package/src/helpers/kiosk/takeLockedNftFromKiosk.ts +73 -0
- package/src/helpers/kiosk/upgradeKioskRulesPackageId.ts +17 -0
- package/src/helpers/originByte/confirmOBTranfer.ts +33 -0
- package/src/helpers/originByte/createOBKiosk.ts +14 -0
- package/src/helpers/originByte/depositNftIntoOBKiosk.ts +16 -0
- package/src/helpers/originByte/getOBBidderKiosk.ts +12 -0
- package/src/helpers/originByte/getOBKiosk.ts +24 -0
- package/src/helpers/originByte/getOrCreateOBKiosk.ts +42 -0
- package/src/helpers/originByte/isOBKiosk.ts +13 -0
- package/src/helpers/originByte/isOriginByteBid.ts +30 -0
- package/src/helpers/originByte/isOriginByteCollection.ts +11 -0
- package/src/helpers/originByte/shareOriginByteKiosk.ts +14 -0
- package/src/helpers/rpc/getAcountBalance.ts +18 -0
- package/src/helpers/rpc/getObjectType.ts +25 -0
- package/src/helpers/splitCoins.ts +12 -0
- package/src/helpers/track.ts +20 -0
- package/src/helpers/validateMinFloorPrice.ts +22 -0
- package/src/index.ts +2 -0
- package/src/methods/acceptCollectionBid/acceptCollectionBid.ts +189 -0
- package/src/methods/acceptCollectionBid/addAcceptCollectionBIdTxs.ts +398 -0
- package/src/methods/acceptNftBids/acceptNftBids.ts +174 -0
- package/src/methods/acceptNftBids/addAcceptNftBidTxs.ts +438 -0
- package/src/methods/applyFtStrategy/applyFtStrategy.ts +55 -0
- package/src/methods/applyNftStrategy/applyNftStrategy.ts +90 -0
- package/src/methods/buyListings/addBuyListingTxs.ts +806 -0
- package/src/methods/buyListings/buyListings.ts +230 -0
- package/src/methods/cancelMultiBid/cancelMultiBid.ts +51 -0
- package/src/methods/cancelNftTransfers/addCancelNftTransfersTx.ts +20 -0
- package/src/methods/cancelNftTransfers/cancelNftTransfers.ts +118 -0
- package/src/methods/claimNfts/addClaimNftsTxs.ts +247 -0
- package/src/methods/claimNfts/claimNfts.ts +270 -0
- package/src/methods/createMultiBid/createMultiBid.ts +36 -0
- package/src/methods/listNfts/addListTxs.ts +210 -0
- package/src/methods/listNfts/addRelistTxs.ts +87 -0
- package/src/methods/listNfts/listNfts.ts +152 -0
- package/src/methods/migrateNftsFromUnsharedToSharedKiosks/migrateNftsFromUnsharedToSharedKiosks.ts +226 -0
- package/src/methods/placeCollectionBids/addPlaceCollectionBidTxs.ts +149 -0
- package/src/methods/placeCollectionBids/placeCollectionBids.ts +153 -0
- package/src/methods/placeNftBids/addPlaceNftBidTxs.ts +154 -0
- package/src/methods/placeNftBids/placeNftBids.ts +111 -0
- package/src/methods/relistNft/relistNft.ts +153 -0
- package/src/methods/removeCollectionBids/addRemoveCollectionBidsTxs.ts +132 -0
- package/src/methods/removeCollectionBids/removeCollectionBids.ts +117 -0
- package/src/methods/removeNftBids/addRemoveNftBidTxs.ts +122 -0
- package/src/methods/removeNftBids/removeNftBids.ts +116 -0
- package/src/methods/sponsorNftListing/addSponsorNftListingTx.ts +40 -0
- package/src/methods/sponsorNftListing/sponsorNftListing.ts +60 -0
- package/src/methods/transferNfts/addTransferNftTx.ts +220 -0
- package/src/methods/transferNfts/transferNfts.ts +216 -0
- package/src/methods/unlistListings/addUnlistListingTxs.ts +399 -0
- package/src/methods/unlistListings/unlistListings.ts +158 -0
- package/src/methods/updateMultiBid/updateMultiBid.ts +66 -0
- package/src/methods/withdrawProfitsFromKiosks/withdrawProfitsFromKiosks.ts +100 -0
- package/src/tests/SuiWallet.ts +83 -0
- package/src/utils/addHexPrefix.ts +7 -0
- package/src/utils/addLeadingZerosAfter0x.ts +9 -0
- package/src/utils/normalizeNftType.ts +7 -0
- package/src/utils/printTxBlockTxs.ts +11 -0
- package/src/utils/pureValues.ts +13 -0
- package/src/utils/toUint8Array.ts +12 -0
- package/tsconfig.json +16 -0
- package/dist/index.d.ts +0 -194
- package/dist/index.js +0 -7419
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { type SuiGrpcClient } from '@mysten/sui/grpc';
|
|
2
|
+
import { fromHex, normalizeSuiObjectId } from '@mysten/sui/utils';
|
|
3
|
+
import {
|
|
4
|
+
DYNAMIC_COLLECTION_IDS,
|
|
5
|
+
ORIGIN_BYTE_NFT_TYPES_MISSING_ORDERBOOK,
|
|
6
|
+
TRADEPORT_MULTI_BID_PACKAGE,
|
|
7
|
+
TRADEPORT_MULTI_BID_STORE,
|
|
8
|
+
} from '../../constants';
|
|
9
|
+
import { gqlChainRequest } from '../../graphql/gqlChainRequest';
|
|
10
|
+
import {
|
|
11
|
+
fetchMultibidChainIdAndExpiredSingleBidsById,
|
|
12
|
+
fetchMultibidChainIdById,
|
|
13
|
+
} from '../../graphql/queries/fetchMultibidById';
|
|
14
|
+
import { getNativeKioskTransferPolicies } from '../../helpers/kiosk/getNativeKioskTransferPolicies';
|
|
15
|
+
import { isOriginByteCollection } from '../../helpers/originByte/isOriginByteCollection';
|
|
16
|
+
import { normalizedNftType } from '../../utils/normalizeNftType';
|
|
17
|
+
import { type PlaceNftBidTx } from './placeNftBids';
|
|
18
|
+
import { addCancelSingleBidForMultibidChainId } from '../removeNftBids/addRemoveNftBidTxs';
|
|
19
|
+
import { type Transaction } from '@mysten/sui/transactions';
|
|
20
|
+
|
|
21
|
+
export async function addTradePortPlaceNftBidTxHandler(txData: PlaceNftBidTx) {
|
|
22
|
+
if (
|
|
23
|
+
isOriginByteCollection(txData?.transferPolicies) &&
|
|
24
|
+
!ORIGIN_BYTE_NFT_TYPES_MISSING_ORDERBOOK?.includes(normalizedNftType(txData?.nftType))
|
|
25
|
+
) {
|
|
26
|
+
throw new Error('OriginByte bidding not supported currently');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const {
|
|
30
|
+
tx,
|
|
31
|
+
nftType,
|
|
32
|
+
multiBidId,
|
|
33
|
+
multiBidChainId: existingMultiBidChainId,
|
|
34
|
+
nftTokenId,
|
|
35
|
+
collectionId,
|
|
36
|
+
bcsHex,
|
|
37
|
+
expireAt,
|
|
38
|
+
coinToSplit,
|
|
39
|
+
} = txData;
|
|
40
|
+
let bcs: Uint8Array | undefined;
|
|
41
|
+
if (nftTokenId && isDynamicCollection(collectionId)) {
|
|
42
|
+
if (!bcsHex) {
|
|
43
|
+
throw new Error(`No BCS found for token ${nftTokenId}`);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
bcs = fromHex(bcsHex);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
let multiBidChainId;
|
|
50
|
+
let expiredBids;
|
|
51
|
+
if (existingMultiBidChainId) {
|
|
52
|
+
multiBidChainId = existingMultiBidChainId;
|
|
53
|
+
} else {
|
|
54
|
+
const {
|
|
55
|
+
chain_id: chainId,
|
|
56
|
+
cancelled_at,
|
|
57
|
+
bids,
|
|
58
|
+
} = multiBidId
|
|
59
|
+
? ((
|
|
60
|
+
await gqlChainRequest({
|
|
61
|
+
chain: 'sui',
|
|
62
|
+
query: fetchMultibidChainIdAndExpiredSingleBidsById,
|
|
63
|
+
variables: { multiBidId, expiredBidLimit: 300 },
|
|
64
|
+
})
|
|
65
|
+
)?.multi_bids?.[0] ?? {})
|
|
66
|
+
: {};
|
|
67
|
+
|
|
68
|
+
if (chainId && cancelled_at) {
|
|
69
|
+
throw new Error(`MultiBid ${chainId} already cancelled`);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
multiBidChainId = chainId;
|
|
73
|
+
expiredBids = bids;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const transferPolicies = getNativeKioskTransferPolicies(txData?.transferPolicies);
|
|
77
|
+
const transferPolicy = transferPolicies?.find(
|
|
78
|
+
(policy: { rules: any[] }) => policy?.rules?.length > 0,
|
|
79
|
+
);
|
|
80
|
+
const price = BigInt(txData?.bidAmount ?? 0n);
|
|
81
|
+
const fee = (BigInt(txData?.bidAmount ?? 0) * (await getBidFeeBps(txData?.suiClient))) / 10_000n;
|
|
82
|
+
let royalty = 0n;
|
|
83
|
+
const royaltyRule = (transferPolicy?.rules ?? []).find((r: { type: string }) =>
|
|
84
|
+
r.type.endsWith('royalty_rule'),
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
if (royaltyRule) {
|
|
88
|
+
const { amount_bp, min_amount } = royaltyRule;
|
|
89
|
+
royalty = BigInt((price * BigInt(amount_bp)) / 10_000n);
|
|
90
|
+
if (royalty < BigInt(min_amount ?? 0n)) {
|
|
91
|
+
royalty = BigInt(min_amount ?? 0n);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const txWithState = tx as Transaction & { hasCancelBidTransactions: Map<string, boolean> };
|
|
96
|
+
txWithState.hasCancelBidTransactions ??= new Map<string, boolean>();
|
|
97
|
+
|
|
98
|
+
if (multiBidChainId && !txWithState.hasCancelBidTransactions.get(multiBidChainId)) {
|
|
99
|
+
// Clean up expired bids in existing multibid
|
|
100
|
+
for (const { nonce } of expiredBids ?? []) {
|
|
101
|
+
addCancelSingleBidForMultibidChainId(tx, nonce, multiBidChainId);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
txWithState.hasCancelBidTransactions.set(multiBidChainId, true);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const [coin] = tx.splitCoins(coinToSplit ? coinToSplit : tx.gas, [
|
|
108
|
+
multiBidChainId ? 0n : price + fee + royalty,
|
|
109
|
+
]);
|
|
110
|
+
tx.moveCall({
|
|
111
|
+
target: `${TRADEPORT_MULTI_BID_PACKAGE}::tradeport_biddings::create_bid_with${transferPolicy ? '' : 'out'}_transfer_policy`,
|
|
112
|
+
typeArguments: [nftType],
|
|
113
|
+
arguments: [
|
|
114
|
+
tx.object(TRADEPORT_MULTI_BID_STORE),
|
|
115
|
+
tx.pure.u64(nftTokenId ? 1 : 0),
|
|
116
|
+
multiBidChainId
|
|
117
|
+
? typeof multiBidChainId === 'string'
|
|
118
|
+
? tx.pure.option('id', normalizeSuiObjectId(multiBidChainId))
|
|
119
|
+
: tx.moveCall({
|
|
120
|
+
target: '0x1::option::some',
|
|
121
|
+
typeArguments: ['0x2::object::ID'],
|
|
122
|
+
arguments: [multiBidChainId],
|
|
123
|
+
})
|
|
124
|
+
: undefined,
|
|
125
|
+
tx.pure.option('id', nftTokenId ? normalizeSuiObjectId(nftTokenId) : undefined),
|
|
126
|
+
tx.pure.option('vector<u8>', bcs ? [...bcs] : undefined),
|
|
127
|
+
tx.pure.option('u64', expireAt?.getTime()),
|
|
128
|
+
tx.pure.u64(price),
|
|
129
|
+
...(transferPolicy ? [tx.object(transferPolicy.id)] : []),
|
|
130
|
+
tx.object(coin),
|
|
131
|
+
],
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
let bidFeeBps: bigint | undefined;
|
|
136
|
+
|
|
137
|
+
export async function getBidFeeBps(suiClient: SuiGrpcClient) {
|
|
138
|
+
if (bidFeeBps !== undefined) {
|
|
139
|
+
return bidFeeBps;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const res = await suiClient.getObject({
|
|
143
|
+
objectId: TRADEPORT_MULTI_BID_STORE,
|
|
144
|
+
include: { json: true },
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
bidFeeBps = BigInt((res?.object?.json as unknown as { fee_bps: string })?.fee_bps ?? 0);
|
|
148
|
+
|
|
149
|
+
return bidFeeBps;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export function isDynamicCollection(collectionId: string): boolean {
|
|
153
|
+
return DYNAMIC_COLLECTION_IDS.includes(collectionId);
|
|
154
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { type SuiGrpcClient } from '@mysten/sui/grpc';
|
|
2
|
+
import { Transaction } from '@mysten/sui/transactions';
|
|
3
|
+
import { type RequestContext } from '../../SuiTradingClient';
|
|
4
|
+
import {
|
|
5
|
+
DELOREAN_TOKEN_IDS_TO_DISABLE,
|
|
6
|
+
DELOREAN_TOKEN_IDS_TO_DISABLE_MESSAGE,
|
|
7
|
+
} from '../../constants';
|
|
8
|
+
import { gqlChainRequest } from '../../graphql/gqlChainRequest';
|
|
9
|
+
import { fetchNftsById } from '../../graphql/queries/fetchNftsById';
|
|
10
|
+
import { getNftType } from '../../helpers/getNftType';
|
|
11
|
+
import { addTradePortPlaceNftBidTxHandler } from './addPlaceNftBidTxs';
|
|
12
|
+
|
|
13
|
+
export type PlaceNftBidTx = {
|
|
14
|
+
tx: Transaction;
|
|
15
|
+
suiClient: SuiGrpcClient;
|
|
16
|
+
bidder: string;
|
|
17
|
+
collectionId: string;
|
|
18
|
+
nftTokenId?: string;
|
|
19
|
+
nftType: string;
|
|
20
|
+
bidAmount: bigint;
|
|
21
|
+
multiBidId?: string;
|
|
22
|
+
multiBidChainId?: any;
|
|
23
|
+
expireAt?: Date;
|
|
24
|
+
sharedObjects?: any;
|
|
25
|
+
transferPolicies: any;
|
|
26
|
+
bcsHex?: string;
|
|
27
|
+
coinToSplit?: any;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export type PlaceNftBids = {
|
|
31
|
+
bids: Array<{
|
|
32
|
+
nftId: string;
|
|
33
|
+
bidAmountInMist: number;
|
|
34
|
+
expireAt?: Date;
|
|
35
|
+
}>;
|
|
36
|
+
walletAddress: string;
|
|
37
|
+
multiBidId?: string;
|
|
38
|
+
multiBidChainId?: any;
|
|
39
|
+
tx?: Transaction;
|
|
40
|
+
coinToSplit?: any;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const placeNftBids = async (
|
|
44
|
+
{ bids, walletAddress, multiBidId, multiBidChainId, tx: existingTx, coinToSplit }: PlaceNftBids,
|
|
45
|
+
context: RequestContext,
|
|
46
|
+
): Promise<Transaction> => {
|
|
47
|
+
const tx = existingTx ?? new Transaction();
|
|
48
|
+
|
|
49
|
+
const res = await gqlChainRequest({
|
|
50
|
+
chain: 'sui',
|
|
51
|
+
query: fetchNftsById,
|
|
52
|
+
variables: { nftIds: bids.map((bid) => bid.nftId) },
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
if (res?.nfts?.length === 0) {
|
|
56
|
+
throw new Error('No nfts found');
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const nftsForTracking = [];
|
|
60
|
+
for (const bid of bids) {
|
|
61
|
+
const nft = res.nfts?.find((nft: any) => nft.id === bid.nftId);
|
|
62
|
+
|
|
63
|
+
if (DELOREAN_TOKEN_IDS_TO_DISABLE?.includes(nft?.token_id)) {
|
|
64
|
+
throw new Error(DELOREAN_TOKEN_IDS_TO_DISABLE_MESSAGE);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const nftType = getNftType({
|
|
68
|
+
collectionId: nft?.collection_id,
|
|
69
|
+
collectionChainState: nft?.collection?.chain_state,
|
|
70
|
+
nft,
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
const transferPolicies = nft?.collection?.chain_state?.transfer_policies;
|
|
74
|
+
|
|
75
|
+
const txData: PlaceNftBidTx = {
|
|
76
|
+
tx,
|
|
77
|
+
suiClient: context.suiClient,
|
|
78
|
+
transferPolicies,
|
|
79
|
+
bidder: walletAddress,
|
|
80
|
+
collectionId: nft?.collection_id,
|
|
81
|
+
nftTokenId: nft?.token_id,
|
|
82
|
+
nftType,
|
|
83
|
+
bidAmount: BigInt(bid?.bidAmountInMist ?? 0n),
|
|
84
|
+
bcsHex: nft.chain_state?.bcs?.bcsHex,
|
|
85
|
+
multiBidId,
|
|
86
|
+
multiBidChainId,
|
|
87
|
+
expireAt: bid?.expireAt,
|
|
88
|
+
coinToSplit,
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
await addTradePortPlaceNftBidTxHandler(txData);
|
|
92
|
+
|
|
93
|
+
nftsForTracking.push({
|
|
94
|
+
nftType,
|
|
95
|
+
collectionId: nft?.collection_id,
|
|
96
|
+
bidAmount: bid?.bidAmountInMist,
|
|
97
|
+
bidder: walletAddress,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// if (process.env.ENABLE_SEGMENT_TRACKING === 'true' && nftsForTracking.length > 0) {
|
|
102
|
+
// trackMethodCall({
|
|
103
|
+
// apiUser: context.apiUser,
|
|
104
|
+
// apiKey: context.apiKey,
|
|
105
|
+
// event: 'PLACE_NFT_BIDS',
|
|
106
|
+
// items: nftsForTracking,
|
|
107
|
+
// });
|
|
108
|
+
// }
|
|
109
|
+
|
|
110
|
+
return tx;
|
|
111
|
+
};
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { type KioskClient } from '@mysten/kiosk';
|
|
2
|
+
import { type SuiGrpcClient } from '@mysten/sui/grpc';
|
|
3
|
+
import { type Transaction } from '@mysten/sui/transactions';
|
|
4
|
+
import { ORIGIN_BYTE_NFT_TYPES_MISSING_ORDERBOOK } from '../../constants';
|
|
5
|
+
import { getNftType } from '../../helpers/getNftType';
|
|
6
|
+
import { kioskTxWrapper } from '../../helpers/kiosk/kioskTxWrapper';
|
|
7
|
+
import { isOriginByteCollection } from '../../helpers/originByte/isOriginByteCollection';
|
|
8
|
+
import { normalizedNftType } from '../../utils/normalizeNftType';
|
|
9
|
+
import { addTradePortListTxHandler } from '../listNfts/addListTxs';
|
|
10
|
+
import {
|
|
11
|
+
addBlueMoveRelistTx,
|
|
12
|
+
addTocenRelistTx,
|
|
13
|
+
addTradePortRelistTx,
|
|
14
|
+
addKioskTradePortRelistTx,
|
|
15
|
+
} from '../listNfts/addRelistTxs';
|
|
16
|
+
import {
|
|
17
|
+
addBluemoveUnlistTxHandler,
|
|
18
|
+
addClutchyUnlistTxHandler,
|
|
19
|
+
addHyperspaceUnlistTxHandler,
|
|
20
|
+
addTradePortUnlistTxHandler,
|
|
21
|
+
} from '../unlistListings/addUnlistListingTxs';
|
|
22
|
+
import { type UnlistListingTx } from '../unlistListings/unlistListings';
|
|
23
|
+
import { type SharedKioskState } from '../../helpers/kiosk/sharedKioskState.type';
|
|
24
|
+
|
|
25
|
+
interface Args {
|
|
26
|
+
tx: Transaction;
|
|
27
|
+
suiClient: SuiGrpcClient;
|
|
28
|
+
kioskClient: KioskClient;
|
|
29
|
+
sharedKioskState: SharedKioskState;
|
|
30
|
+
transferPolicies: any;
|
|
31
|
+
nft: any;
|
|
32
|
+
listPrice: number;
|
|
33
|
+
walletAddress: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export async function relistNft({
|
|
37
|
+
tx,
|
|
38
|
+
suiClient,
|
|
39
|
+
kioskClient,
|
|
40
|
+
sharedKioskState,
|
|
41
|
+
nft,
|
|
42
|
+
listPrice,
|
|
43
|
+
transferPolicies,
|
|
44
|
+
walletAddress,
|
|
45
|
+
}: Args) {
|
|
46
|
+
const firstListedOrExpiredListing = (
|
|
47
|
+
nft?.listings as Array<{ listed: boolean; price?: number; nonce?: string; market_name: string }>
|
|
48
|
+
).find((l) => l.listed || l.nonce);
|
|
49
|
+
if (!firstListedOrExpiredListing) {
|
|
50
|
+
throw new Error('No listing found for NFT');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const txData: UnlistListingTx = {
|
|
54
|
+
tx,
|
|
55
|
+
suiClient,
|
|
56
|
+
kioskClient,
|
|
57
|
+
sharedKioskState,
|
|
58
|
+
transferPolicies,
|
|
59
|
+
nftTokenId: nft?.token_id,
|
|
60
|
+
nftType: getNftType({
|
|
61
|
+
collectionId: nft?.collection?.id,
|
|
62
|
+
collectionChainState: nft?.collection?.chain_state,
|
|
63
|
+
nft,
|
|
64
|
+
}),
|
|
65
|
+
listingNonce: firstListedOrExpiredListing.nonce,
|
|
66
|
+
price: firstListedOrExpiredListing.price,
|
|
67
|
+
sellerKiosk: nft?.chain_state?.kiosk_id,
|
|
68
|
+
collectionId: nft?.collection_id,
|
|
69
|
+
seller: walletAddress,
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
switch (firstListedOrExpiredListing.market_name) {
|
|
73
|
+
case 'tradeport':
|
|
74
|
+
if (
|
|
75
|
+
txData?.listingNonce &&
|
|
76
|
+
isOriginByteCollection(txData?.transferPolicies) &&
|
|
77
|
+
!ORIGIN_BYTE_NFT_TYPES_MISSING_ORDERBOOK?.includes(normalizedNftType(txData?.nftType))
|
|
78
|
+
) {
|
|
79
|
+
await addTradePortUnlistTxHandler(txData);
|
|
80
|
+
await addTradePortListTxHandler({
|
|
81
|
+
...txData,
|
|
82
|
+
listPrice,
|
|
83
|
+
});
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (txData?.listingNonce?.startsWith('0::')) {
|
|
88
|
+
addTradePortRelistTx({ ...txData, listPrice });
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (txData?.listingNonce?.startsWith('1::')) {
|
|
93
|
+
return kioskTxWrapper({
|
|
94
|
+
tx: txData?.tx,
|
|
95
|
+
kioskClient: txData?.kioskClient,
|
|
96
|
+
kioskOwner: txData?.seller,
|
|
97
|
+
kiosk: txData?.sellerKiosk,
|
|
98
|
+
shouldAssertNftInSharedKiosk: true,
|
|
99
|
+
sharedKioskState: txData?.sharedKioskState,
|
|
100
|
+
shouldUseSharedKioskTx: false,
|
|
101
|
+
async runCommands(kioskTx) {
|
|
102
|
+
await addKioskTradePortRelistTx({
|
|
103
|
+
...txData,
|
|
104
|
+
kioskTx,
|
|
105
|
+
listPrice,
|
|
106
|
+
});
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
await addTradePortUnlistTxHandler({ ...txData, isPartOfRelist: true });
|
|
112
|
+
await addTradePortListTxHandler({ ...txData, listPrice });
|
|
113
|
+
break;
|
|
114
|
+
case 'hyperspace':
|
|
115
|
+
await addHyperspaceUnlistTxHandler(txData);
|
|
116
|
+
await addTradePortListTxHandler({ ...txData, listPrice });
|
|
117
|
+
break;
|
|
118
|
+
case 'bluemove':
|
|
119
|
+
if (
|
|
120
|
+
!isOriginByteCollection(txData?.transferPolicies) ||
|
|
121
|
+
(ORIGIN_BYTE_NFT_TYPES_MISSING_ORDERBOOK?.includes(normalizedNftType(txData?.nftType)) &&
|
|
122
|
+
!txData?.sellerKiosk)
|
|
123
|
+
) {
|
|
124
|
+
addBlueMoveRelistTx({ ...txData, listPrice });
|
|
125
|
+
} else {
|
|
126
|
+
await addBluemoveUnlistTxHandler(txData);
|
|
127
|
+
await addTradePortListTxHandler({ ...txData, listPrice });
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
break;
|
|
131
|
+
case 'clutchy':
|
|
132
|
+
await addClutchyUnlistTxHandler(txData);
|
|
133
|
+
await addTradePortListTxHandler({ ...txData, listPrice });
|
|
134
|
+
break;
|
|
135
|
+
case 'souffl3':
|
|
136
|
+
// Souffl3 contract does not support relists
|
|
137
|
+
|
|
138
|
+
break;
|
|
139
|
+
case 'somis':
|
|
140
|
+
// Somis contract does not support relists
|
|
141
|
+
|
|
142
|
+
break;
|
|
143
|
+
case 'keepsake':
|
|
144
|
+
// Keepsake contract does not support relists
|
|
145
|
+
|
|
146
|
+
break;
|
|
147
|
+
case 'tocen':
|
|
148
|
+
addTocenRelistTx({ ...txData, listPrice });
|
|
149
|
+
break;
|
|
150
|
+
default:
|
|
151
|
+
throw new Error('Marketplace not supported');
|
|
152
|
+
}
|
|
153
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { normalizeSuiObjectId } from '@mysten/sui/utils';
|
|
2
|
+
import {
|
|
3
|
+
BLUEMOVE_KIOSK_OFFER_COLLECTION_DATA_OBJECT,
|
|
4
|
+
BLUEMOVE_OFFER_COLLECTION_DATA_OBJECT,
|
|
5
|
+
TRADEPORT_BIDDING_STORE,
|
|
6
|
+
} from '../../constants';
|
|
7
|
+
import { getSharedObjects } from '../../helpers/getSharedObjects';
|
|
8
|
+
import { isSingleBid } from '../../helpers/isSIngleBid';
|
|
9
|
+
import { isBluemoveKioskBid } from '../../helpers/kiosk/isBluemoveKioskBid';
|
|
10
|
+
import { isTradePortKioskBid } from '../../helpers/kiosk/isTradePortKioskBid';
|
|
11
|
+
import { isOriginByteBid } from '../../helpers/originByte/isOriginByteBid';
|
|
12
|
+
import { getObjectType } from '../../helpers/rpc/getObjectType';
|
|
13
|
+
import { addLeadingZerosAfter0x } from '../../utils/addLeadingZerosAfter0x';
|
|
14
|
+
import {
|
|
15
|
+
addSingleBidRemoveNftBidTx,
|
|
16
|
+
addTradeportKioskRemoveNftBidTx,
|
|
17
|
+
} from '../removeNftBids/addRemoveNftBidTxs';
|
|
18
|
+
import { type RemoveCollectionBidTx } from './removeCollectionBids';
|
|
19
|
+
|
|
20
|
+
export function addTradeportRemoveCollectionBidTx({
|
|
21
|
+
tx,
|
|
22
|
+
nftType,
|
|
23
|
+
bidNonce,
|
|
24
|
+
}: RemoveCollectionBidTx) {
|
|
25
|
+
tx.moveCall({
|
|
26
|
+
target:
|
|
27
|
+
'0xb42dbb7413b79394e1a0175af6ae22b69a5c7cc5df259cd78072b6818217c027::biddings::cancel_bid',
|
|
28
|
+
arguments: [tx.object(TRADEPORT_BIDDING_STORE), tx.pure.address(bidNonce)],
|
|
29
|
+
typeArguments: [nftType],
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function addTradePortKioskRemoveCollectionBidTx(txData: RemoveCollectionBidTx) {
|
|
34
|
+
addTradeportKioskRemoveNftBidTx(txData);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function addOriginByteRemoveCollectionBidTx({
|
|
38
|
+
tx,
|
|
39
|
+
nftType,
|
|
40
|
+
bidAmount,
|
|
41
|
+
bidder,
|
|
42
|
+
sharedObjects,
|
|
43
|
+
}: RemoveCollectionBidTx) {
|
|
44
|
+
const { orderbook } = sharedObjects;
|
|
45
|
+
|
|
46
|
+
const [coin] = tx.moveCall({
|
|
47
|
+
target: '0x2::coin::zero',
|
|
48
|
+
arguments: [],
|
|
49
|
+
typeArguments: ['0x2::sui::SUI'],
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
tx.moveCall({
|
|
53
|
+
target:
|
|
54
|
+
'0x8534e4cdfd28709c94330a9783c3d5fe6f5daba0bffb69102ce303c5b38aed5a::orderbook::cancel_bid',
|
|
55
|
+
arguments: [tx.object(orderbook), tx.pure.u64(bidAmount), tx.object(coin)],
|
|
56
|
+
typeArguments: [nftType, '0x2::sui::SUI'],
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
tx.transferObjects([tx.object(coin)], tx.pure.address(addLeadingZerosAfter0x(bidder)));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function addBluemoveRemoveCollectionBidTx({ tx, nftType, bidNonce }: RemoveCollectionBidTx) {
|
|
63
|
+
tx.moveCall({
|
|
64
|
+
target:
|
|
65
|
+
'0xd5dd28cc24009752905689b2ba2bf90bfc8de4549b9123f93519bb8ba9bf9981::offer_collection::cancel_offer_collection',
|
|
66
|
+
arguments: [tx.object(BLUEMOVE_OFFER_COLLECTION_DATA_OBJECT), tx.pure.u64(bidNonce)],
|
|
67
|
+
typeArguments: [nftType],
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function addBluemoveKioskRemoveCollectionBidTx({
|
|
72
|
+
tx,
|
|
73
|
+
nftType,
|
|
74
|
+
bidNonce,
|
|
75
|
+
}: RemoveCollectionBidTx) {
|
|
76
|
+
tx.moveCall({
|
|
77
|
+
target:
|
|
78
|
+
'0xcc97b74ed95c8e8a3ed88050a898727dee37896da579fc400d482b64db6149ff::kiosk_offer_collection_v2::cancel_offer_collection_v2',
|
|
79
|
+
arguments: [tx.object(BLUEMOVE_KIOSK_OFFER_COLLECTION_DATA_OBJECT), tx.pure.u64(bidNonce)],
|
|
80
|
+
typeArguments: [nftType],
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export async function addTradePortRemoveCollectionBidTxHandler(txData: RemoveCollectionBidTx) {
|
|
85
|
+
const bidType = await getObjectType({
|
|
86
|
+
suiClient: txData?.suiClient,
|
|
87
|
+
objectId: normalizeSuiObjectId(txData?.bidNonce),
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
if (isSingleBid(bidType)) {
|
|
91
|
+
await addSingleBidRemoveNftBidTx(txData);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (isOriginByteBid(bidType)) {
|
|
96
|
+
const sharedObjects = await getSharedObjects(txData?.nftType);
|
|
97
|
+
addOriginByteRemoveCollectionBidTx({ ...txData, sharedObjects });
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (isTradePortKioskBid(bidType)) {
|
|
102
|
+
addTradePortKioskRemoveCollectionBidTx(txData);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
addTradeportRemoveCollectionBidTx(txData);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export async function addBluemoveRemoveCollectionBidTxHandler(txData: RemoveCollectionBidTx) {
|
|
110
|
+
const bidType = await getObjectType({
|
|
111
|
+
suiClient: txData?.suiClient,
|
|
112
|
+
objectId: normalizeSuiObjectId(txData?.bidNonce),
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
if (isOriginByteBid(bidType)) {
|
|
116
|
+
const sharedObjects = await getSharedObjects(txData?.nftType);
|
|
117
|
+
addOriginByteRemoveCollectionBidTx({ ...txData, sharedObjects });
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (isBluemoveKioskBid(txData?.bidNonce)) {
|
|
122
|
+
addBluemoveKioskRemoveCollectionBidTx(txData);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
addBluemoveRemoveCollectionBidTx(txData);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export async function addClutchyRemoveCollectionBidTxHandler(txData: RemoveCollectionBidTx) {
|
|
130
|
+
const sharedObjects = await getSharedObjects(txData?.nftType);
|
|
131
|
+
addOriginByteRemoveCollectionBidTx({ ...txData, sharedObjects });
|
|
132
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import type { SuiGrpcClient } from '@mysten/sui/grpc';
|
|
2
|
+
import { Transaction } from '@mysten/sui/transactions';
|
|
3
|
+
import { type RequestContext } from '../../SuiTradingClient';
|
|
4
|
+
import {
|
|
5
|
+
DELOREAN_TOKEN_IDS_TO_DISABLE,
|
|
6
|
+
DELOREAN_TOKEN_IDS_TO_DISABLE_MESSAGE,
|
|
7
|
+
} from '../../constants';
|
|
8
|
+
import { gqlChainRequest } from '../../graphql/gqlChainRequest';
|
|
9
|
+
import { fetchCollectionBidsById } from '../../graphql/queries/fetchCollectionBidById';
|
|
10
|
+
import { fetchCollectionsByIdWithOneNft } from '../../graphql/queries/fetchCollectionsById';
|
|
11
|
+
import { getNftType } from '../../helpers/getNftType';
|
|
12
|
+
import {
|
|
13
|
+
addBluemoveRemoveCollectionBidTxHandler,
|
|
14
|
+
addClutchyRemoveCollectionBidTxHandler,
|
|
15
|
+
addTradePortRemoveCollectionBidTxHandler,
|
|
16
|
+
} from './addRemoveCollectionBidsTxs';
|
|
17
|
+
|
|
18
|
+
export type RemoveCollectionBidTx = {
|
|
19
|
+
tx: Transaction;
|
|
20
|
+
suiClient: SuiGrpcClient;
|
|
21
|
+
sharedObjects?: any;
|
|
22
|
+
bidNonce: string;
|
|
23
|
+
bidder: string;
|
|
24
|
+
nftType: string;
|
|
25
|
+
nftTokenId: string;
|
|
26
|
+
bidAmount: number;
|
|
27
|
+
sellerKiosk: string;
|
|
28
|
+
bidMarketName: string;
|
|
29
|
+
multiBidId?: string;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type RemoveCollectionBids = {
|
|
33
|
+
bidIds: string[];
|
|
34
|
+
tx?: Transaction | string;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const removeCollectionBids = async (
|
|
38
|
+
{ bidIds, tx: existingTx }: RemoveCollectionBids,
|
|
39
|
+
context: RequestContext,
|
|
40
|
+
): Promise<Transaction> => {
|
|
41
|
+
const res = await gqlChainRequest({
|
|
42
|
+
chain: 'sui',
|
|
43
|
+
query: fetchCollectionBidsById,
|
|
44
|
+
variables: { bidIds },
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
if (res?.bids?.length === 0) {
|
|
48
|
+
throw new Error('No bids found');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const bidsForTracking = [];
|
|
52
|
+
const tx = existingTx ? Transaction.from(existingTx) : new Transaction();
|
|
53
|
+
|
|
54
|
+
for (const bid of res.bids) {
|
|
55
|
+
if (DELOREAN_TOKEN_IDS_TO_DISABLE?.includes(bid?.nft?.token_id)) {
|
|
56
|
+
throw new Error(DELOREAN_TOKEN_IDS_TO_DISABLE_MESSAGE);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const collectionWithOneNftRes = await gqlChainRequest({
|
|
60
|
+
chain: 'sui',
|
|
61
|
+
query: fetchCollectionsByIdWithOneNft,
|
|
62
|
+
variables: { collectionIds: [bid?.collection_id] },
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
const nftType = getNftType({
|
|
66
|
+
collectionId: collectionWithOneNftRes?.collections?.[0]?.id,
|
|
67
|
+
collectionChainState: collectionWithOneNftRes?.collections?.[0]?.chain_state,
|
|
68
|
+
nft: collectionWithOneNftRes?.collections?.[0]?.nfts?.[0],
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
const txData: RemoveCollectionBidTx = {
|
|
72
|
+
tx,
|
|
73
|
+
suiClient: context.suiClient,
|
|
74
|
+
bidNonce: bid?.nonce,
|
|
75
|
+
bidder: bid?.bidder,
|
|
76
|
+
nftType,
|
|
77
|
+
nftTokenId: bid?.nft?.token_id,
|
|
78
|
+
bidAmount: bid?.price,
|
|
79
|
+
sellerKiosk: bid?.nft?.chain_state?.kiosk_id,
|
|
80
|
+
bidMarketName: bid?.market_contract?.name,
|
|
81
|
+
multiBidId: bid?.multi_bid_id,
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
switch (txData.bidMarketName) {
|
|
85
|
+
case 'tradeport':
|
|
86
|
+
await addTradePortRemoveCollectionBidTxHandler(txData);
|
|
87
|
+
break;
|
|
88
|
+
case 'bluemove':
|
|
89
|
+
await addBluemoveRemoveCollectionBidTxHandler(txData);
|
|
90
|
+
break;
|
|
91
|
+
case 'clutchy':
|
|
92
|
+
await addClutchyRemoveCollectionBidTxHandler(txData);
|
|
93
|
+
break;
|
|
94
|
+
default:
|
|
95
|
+
throw new Error('Marketplace not supported');
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
bidsForTracking.push({
|
|
99
|
+
nftType,
|
|
100
|
+
collectionId: bid?.collection_id,
|
|
101
|
+
bidAmount: bid?.price,
|
|
102
|
+
bidMarketName: bid?.market_contract?.name,
|
|
103
|
+
bidder: bid?.bidder,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// if (process.env.ENABLE_SEGMENT_TRACKING === 'true' && bidsForTracking.length > 0) {
|
|
108
|
+
// trackMethodCall({
|
|
109
|
+
// apiUser: context.apiUser,
|
|
110
|
+
// apiKey: context.apiKey,
|
|
111
|
+
// event: 'REMOVE_COLLECTION_BID',
|
|
112
|
+
// items: bidsForTracking,
|
|
113
|
+
// });
|
|
114
|
+
// }
|
|
115
|
+
|
|
116
|
+
return Transaction.from(tx);
|
|
117
|
+
};
|