@tradeport/sui-trading-sdk 0.4.66 → 0.5.0
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/CHANGELOG.md +6 -0
- package/jest.config.js +6 -2
- package/package.json +66 -65
- package/src/SuiTradingClient.ts +24 -14
- package/src/apiClients/createKioskClient.ts +5 -6
- package/src/apiClients/createSuiClient.ts +2 -2
- package/src/helpers/getTransferPolicyRuleNamesFromSuiObject.ts +9 -21
- package/src/helpers/isNonKioskListing.ts +2 -2
- package/src/helpers/kiosk/getKioskCollectionRoyaltyFeeAmount.ts +10 -10
- package/src/helpers/kiosk/getKioskIdFromKioskTx.ts +15 -7
- package/src/helpers/kiosk/getKioskPlaceBidCoin.ts +2 -2
- package/src/helpers/kiosk/getRulePackageId.ts +2 -2
- package/src/helpers/kiosk/getTransferPoliciesToResolve.ts +2 -2
- package/src/helpers/kiosk/kioskListingBcs.ts +19 -0
- package/src/helpers/kiosk/kioskTxWrapper.ts +3 -3
- package/src/helpers/kiosk/lockNftInsideKioskIfNotLocked.ts +9 -9
- package/src/helpers/kiosk/preProcessSharedBulkBuyingData.ts +33 -21
- package/src/helpers/kiosk/resolveRoyaltyRule.ts +2 -2
- package/src/helpers/kiosk/resolveTransferPolicies.ts +2 -2
- package/src/helpers/kiosk/takeAndBorrowNftFromKiosk.ts +2 -2
- package/src/helpers/kiosk/takeLockedNftFromKiosk.ts +5 -9
- package/src/helpers/originByte/getOBBidderKiosk.ts +4 -7
- package/src/helpers/rpc/getAcountBalance.ts +3 -3
- package/src/helpers/rpc/getObjectType.ts +8 -4
- package/src/methods/acceptCollectionBid/acceptCollectionBid.ts +2 -2
- package/src/methods/acceptCollectionBid/addAcceptCollectionBIdTxs.ts +3 -3
- package/src/methods/acceptNftBids/acceptNftBids.ts +2 -2
- package/src/methods/acceptNftBids/addAcceptNftBidTxs.ts +4 -4
- package/src/methods/buyListings/addBuyListingTxs.ts +16 -18
- package/src/methods/buyListings/buyListings.ts +2 -2
- package/src/methods/cancelNftTransfers/addCancelNftTransfersTx.ts +1 -1
- package/src/methods/claimNfts/addClaimNftsTxs.ts +8 -8
- package/src/methods/claimNfts/claimNfts.ts +3 -3
- package/src/methods/listNfts/addListTxs.ts +2 -2
- package/src/methods/listNfts/addRelistTxs.ts +4 -4
- package/src/methods/listNfts/listNfts.ts +2 -2
- package/src/methods/placeCollectionBids/placeCollectionBids.ts +2 -2
- package/src/methods/placeNftBids/addPlaceNftBidTxs.ts +5 -10
- package/src/methods/placeNftBids/placeNftBids.ts +2 -2
- package/src/methods/relistNft/relistNft.ts +2 -2
- package/src/methods/removeCollectionBids/removeCollectionBids.ts +2 -2
- package/src/methods/removeNftBids/removeNftBids.ts +2 -2
- package/src/methods/transferNfts/addTransferNftTx.ts +16 -7
- package/src/methods/transferNfts/transferNfts.ts +2 -2
- package/src/methods/unlistListings/addUnlistListingTxs.ts +6 -10
- package/src/methods/unlistListings/unlistListings.ts +2 -2
- package/src/methods/withdrawProfitsFromKiosks/withdrawProfitsFromKiosks.ts +2 -2
- package/src/tests/SuiWallet.ts +19 -15
- package/tsconfig.json +2 -1
- package/.claude/settings.local.json +0 -5
- package/dist/index.d.mts +0 -193
- package/dist/index.d.ts +0 -193
- package/dist/index.js +0 -7400
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -7375
- package/dist/index.mjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { KioskClient } from '@mysten/kiosk';
|
|
2
2
|
import { bcs } from '@mysten/sui/bcs';
|
|
3
|
-
import type {
|
|
3
|
+
import type { SuiGrpcClient } from '@mysten/sui/grpc';
|
|
4
4
|
import { Transaction } from '@mysten/sui/transactions';
|
|
5
5
|
import { TRADEPORT_KIOSK_LISTING_STORE } from '../../constants';
|
|
6
6
|
import { addLeadingZerosAfter0x } from '../../utils/addLeadingZerosAfter0x';
|
|
@@ -8,6 +8,7 @@ import { getNftType } from '../getNftType';
|
|
|
8
8
|
import { getSharedObjects } from '../getSharedObjects';
|
|
9
9
|
import { isOriginByteCollection } from '../originByte/isOriginByteCollection';
|
|
10
10
|
import { getTransferPoliciesToResolve } from './getTransferPoliciesToResolve';
|
|
11
|
+
import { KioskListing } from './kioskListingBcs';
|
|
11
12
|
|
|
12
13
|
export type SharedBulkBuyingDataByNftType = Record<
|
|
13
14
|
string,
|
|
@@ -26,7 +27,7 @@ export const preProcessSharedBulkBuyingData = async ({
|
|
|
26
27
|
walletAddress,
|
|
27
28
|
}: {
|
|
28
29
|
listings: any[];
|
|
29
|
-
suiClient:
|
|
30
|
+
suiClient: SuiGrpcClient;
|
|
30
31
|
kioskClient: KioskClient;
|
|
31
32
|
walletAddress: string;
|
|
32
33
|
}) => {
|
|
@@ -103,18 +104,25 @@ export const preProcessSharedBulkBuyingData = async ({
|
|
|
103
104
|
});
|
|
104
105
|
}
|
|
105
106
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
feeTx.setSender(addLeadingZerosAfter0x(walletAddress));
|
|
108
|
+
const res = await suiClient.simulateTransaction({
|
|
109
|
+
transaction: feeTx,
|
|
110
|
+
include: { commandResults: true },
|
|
111
|
+
checksEnabled: false,
|
|
109
112
|
});
|
|
110
113
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
const
|
|
114
|
-
const
|
|
114
|
+
const commandResults = res.commandResults ?? [];
|
|
115
|
+
for (let i = 0; i < commandResults.length; i++) {
|
|
116
|
+
const result = commandResults[i];
|
|
117
|
+
const returnedAmount = result?.returnValues?.[0]?.bcs;
|
|
118
|
+
if (!returnedAmount) {
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const feeAmount = BigInt(bcs.U64.parse(returnedAmount));
|
|
115
123
|
|
|
116
124
|
if (!feeAmount && feeAmount !== 0n) {
|
|
117
|
-
// We were not able to calculate the fee amount outside of the transaction via
|
|
125
|
+
// We were not able to calculate the fee amount outside of the transaction via simulation, so skip pre processing
|
|
118
126
|
continue;
|
|
119
127
|
}
|
|
120
128
|
|
|
@@ -130,19 +138,23 @@ export const preProcessSharedBulkBuyingData = async ({
|
|
|
130
138
|
for (let i = 0; i < tradeportLegacyKioskListings.length; i += batchSize) {
|
|
131
139
|
const batch = tradeportLegacyKioskListings.slice(i, i + batchSize);
|
|
132
140
|
const batchPromises = batch.map(async (listing: any) => {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
141
|
+
try {
|
|
142
|
+
const { object } = await suiClient.core.getDynamicObjectField({
|
|
143
|
+
parentId: TRADEPORT_KIOSK_LISTING_STORE,
|
|
144
|
+
name: {
|
|
145
|
+
type: '0x2::object::ID',
|
|
146
|
+
bcs: bcs.Address.serialize(listing.nft.token_id).toBytes(),
|
|
147
|
+
},
|
|
148
|
+
include: { content: true },
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
return {
|
|
152
|
+
listingId: listing.id,
|
|
153
|
+
commission: Number(KioskListing.parse(object.content).commission),
|
|
154
|
+
};
|
|
155
|
+
} catch {
|
|
139
156
|
throw new Error(`Not found kiosk listing object of token ${listing.nft.token_id}`);
|
|
140
157
|
}
|
|
141
|
-
|
|
142
|
-
return {
|
|
143
|
-
listingId: listing.id,
|
|
144
|
-
commission: Number((response.data.content as any).fields.commission),
|
|
145
|
-
};
|
|
146
158
|
});
|
|
147
159
|
|
|
148
160
|
const batchResults = await Promise.all(batchPromises);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type SuiGrpcClient } from '@mysten/sui/grpc';
|
|
2
2
|
import {
|
|
3
3
|
type Transaction,
|
|
4
4
|
type TransactionArgument,
|
|
@@ -8,7 +8,7 @@ import { getKioskCollectionRoyaltyFeeAmount } from './getKioskCollectionRoyaltyF
|
|
|
8
8
|
|
|
9
9
|
type Args = {
|
|
10
10
|
tx: Transaction;
|
|
11
|
-
suiClient:
|
|
11
|
+
suiClient: SuiGrpcClient;
|
|
12
12
|
walletAddress: string;
|
|
13
13
|
policyId: TransactionObjectInput;
|
|
14
14
|
moduleName: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type KioskClient } from '@mysten/kiosk';
|
|
2
|
-
import { type
|
|
2
|
+
import { type SuiGrpcClient } from '@mysten/sui/grpc';
|
|
3
3
|
import {
|
|
4
4
|
type Transaction,
|
|
5
5
|
type TransactionArgument,
|
|
@@ -22,7 +22,7 @@ export type Policy = {
|
|
|
22
22
|
type Props = {
|
|
23
23
|
tx: Transaction;
|
|
24
24
|
transferPolicies: any[];
|
|
25
|
-
suiClient:
|
|
25
|
+
suiClient: SuiGrpcClient;
|
|
26
26
|
walletAddress: string;
|
|
27
27
|
kioskClient: KioskClient;
|
|
28
28
|
kioskTx: any;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type KioskClient, type KioskTransaction, type TransferPolicy } from '@mysten/kiosk';
|
|
2
|
-
import { type
|
|
2
|
+
import { type SuiGrpcClient } from '@mysten/sui/grpc';
|
|
3
3
|
import { type Transaction } from '@mysten/sui/transactions';
|
|
4
4
|
import { getKioskIdFromKioskTx } from './getKioskIdFromKioskTx';
|
|
5
5
|
import { takeLockedNftFromKiosk } from './takeLockedNftFromKiosk';
|
|
@@ -20,7 +20,7 @@ export const takeAndBorrowNftFromKiosk = async ({
|
|
|
20
20
|
kioskClient: KioskClient;
|
|
21
21
|
nftTokenId: string;
|
|
22
22
|
nftType: string;
|
|
23
|
-
suiClient:
|
|
23
|
+
suiClient: SuiGrpcClient;
|
|
24
24
|
kioskOwner: string;
|
|
25
25
|
}) => {
|
|
26
26
|
const kioskId = getKioskIdFromKioskTx({ kioskTx, tx });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type KioskClient, type KioskTransaction, type TransferPolicy } from '@mysten/kiosk';
|
|
2
|
-
import { type
|
|
2
|
+
import { type SuiGrpcClient } from '@mysten/sui/grpc';
|
|
3
3
|
import { type Transaction } from '@mysten/sui/transactions';
|
|
4
4
|
import { getNativeKioskTransferPolicies } from './getNativeKioskTransferPolicies';
|
|
5
5
|
import { resolveTransferPolicies } from './resolveTransferPolicies';
|
|
@@ -7,7 +7,7 @@ import { resolveTransferPolicies } from './resolveTransferPolicies';
|
|
|
7
7
|
interface TakeLockedNftFromKioskProps {
|
|
8
8
|
tx: Transaction;
|
|
9
9
|
transferPolicies: TransferPolicy[];
|
|
10
|
-
suiClient:
|
|
10
|
+
suiClient: SuiGrpcClient;
|
|
11
11
|
kioskTx: KioskTransaction;
|
|
12
12
|
kioskClient: KioskClient;
|
|
13
13
|
nftTokenId: string;
|
|
@@ -36,8 +36,8 @@ export const takeLockedNftFromKiosk = async ({
|
|
|
36
36
|
const [purchase_cap] = tx.moveCall({
|
|
37
37
|
target: '0x2::kiosk::list_with_purchase_cap',
|
|
38
38
|
arguments: [
|
|
39
|
-
tx.object(
|
|
40
|
-
tx.object(
|
|
39
|
+
tx.object(kioskTx.kiosk),
|
|
40
|
+
tx.object(kioskTx.kioskCap),
|
|
41
41
|
tx.pure.address(nftTokenId),
|
|
42
42
|
tx.pure.u64(0),
|
|
43
43
|
],
|
|
@@ -52,11 +52,7 @@ export const takeLockedNftFromKiosk = async ({
|
|
|
52
52
|
|
|
53
53
|
const [nft, transferRequest] = tx.moveCall({
|
|
54
54
|
target: '0x2::kiosk::purchase_with_cap',
|
|
55
|
-
arguments: [
|
|
56
|
-
tx.object('value' in kioskTx.kiosk ? kioskTx.kiosk.value : kioskTx.kiosk),
|
|
57
|
-
purchase_cap,
|
|
58
|
-
zeroCoin,
|
|
59
|
-
],
|
|
55
|
+
arguments: [tx.object(kioskTx.kiosk), purchase_cap, zeroCoin],
|
|
60
56
|
typeArguments: [nftType],
|
|
61
57
|
});
|
|
62
58
|
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type SuiGrpcClient } from '@mysten/sui/grpc';
|
|
2
2
|
|
|
3
3
|
export const getOBBidderKiosk = async ({
|
|
4
4
|
suiClient,
|
|
5
5
|
bidNonce,
|
|
6
6
|
}: {
|
|
7
|
-
suiClient:
|
|
7
|
+
suiClient: SuiGrpcClient;
|
|
8
8
|
bidNonce: string;
|
|
9
9
|
}) => {
|
|
10
|
-
const bidObject =
|
|
11
|
-
|
|
12
|
-
{ showContent: true },
|
|
13
|
-
])) as any;
|
|
14
|
-
return bidObject.data?.content?.fields?.kiosk;
|
|
10
|
+
const bidObject = await suiClient.getObject({ objectId: bidNonce, include: { json: true } });
|
|
11
|
+
return (bidObject.object?.json as any)?.kiosk;
|
|
15
12
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type SuiGrpcClient } from '@mysten/sui/grpc';
|
|
2
2
|
import { addLeadingZerosAfter0x } from '../../utils/addLeadingZerosAfter0x';
|
|
3
3
|
|
|
4
4
|
type Args = {
|
|
5
|
-
suiClient:
|
|
5
|
+
suiClient: SuiGrpcClient;
|
|
6
6
|
owner: string;
|
|
7
7
|
};
|
|
8
8
|
|
|
@@ -11,7 +11,7 @@ export const getAccountBalance = async ({ suiClient, owner }: Args): Promise<num
|
|
|
11
11
|
const res = await suiClient.getBalance({
|
|
12
12
|
owner: addLeadingZerosAfter0x(owner),
|
|
13
13
|
});
|
|
14
|
-
return Number(res?.
|
|
14
|
+
return Number(res?.balance?.balance);
|
|
15
15
|
} catch (err) {
|
|
16
16
|
return 0;
|
|
17
17
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type SuiGrpcClient } from '@mysten/sui/grpc';
|
|
2
2
|
import { isValidSuiObjectId } from '@mysten/sui/utils';
|
|
3
3
|
import { addLeadingZerosAfter0x } from '../../utils/addLeadingZerosAfter0x';
|
|
4
4
|
|
|
@@ -6,15 +6,19 @@ export const getObjectType = async ({
|
|
|
6
6
|
suiClient,
|
|
7
7
|
objectId,
|
|
8
8
|
}: {
|
|
9
|
-
suiClient:
|
|
9
|
+
suiClient: SuiGrpcClient;
|
|
10
10
|
objectId: string;
|
|
11
11
|
}): Promise<string> => {
|
|
12
12
|
const normalizedObjectId = objectId.startsWith('0x')
|
|
13
13
|
? addLeadingZerosAfter0x(objectId)
|
|
14
14
|
: objectId;
|
|
15
15
|
if (isValidSuiObjectId(normalizedObjectId)) {
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
try {
|
|
17
|
+
const res = await suiClient.getObject({ objectId: normalizedObjectId, include: {} });
|
|
18
|
+
return res.object?.type ?? '';
|
|
19
|
+
} catch {
|
|
20
|
+
return '';
|
|
21
|
+
}
|
|
18
22
|
}
|
|
19
23
|
|
|
20
24
|
return '';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { KioskClient, KioskTransaction } from '@mysten/kiosk';
|
|
2
|
-
import type {
|
|
2
|
+
import type { SuiGrpcClient } from '@mysten/sui/grpc';
|
|
3
3
|
import { Transaction } from '@mysten/sui/transactions';
|
|
4
4
|
import { type RequestContext } from '../../SuiTradingClient';
|
|
5
5
|
import {
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
|
|
21
21
|
export type AcceptCollectionBidTx = {
|
|
22
22
|
tx: Transaction;
|
|
23
|
-
suiClient:
|
|
23
|
+
suiClient: SuiGrpcClient;
|
|
24
24
|
kioskClient: KioskClient;
|
|
25
25
|
kioskTx?: any;
|
|
26
26
|
sharedObjects?: any;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type TransactionObjectInput } from '@mysten/sui/
|
|
1
|
+
import { type TransactionObjectInput } from '@mysten/sui/transactions';
|
|
2
2
|
import { normalizeSuiObjectId } from '@mysten/sui/utils';
|
|
3
3
|
import {
|
|
4
4
|
BLUEMOVE_CREATOR_CONFIG_OBJECT,
|
|
@@ -205,8 +205,8 @@ export async function addBluemoveKioskAcceptCollectionBidTx({
|
|
|
205
205
|
tx.object(BLUEMOVE_KIOSK_OFFER_COLLECTION_DATA_OBJECT),
|
|
206
206
|
tx.object(BLUEMOVE_KIOSK_OFFER_COLLECTION_BIDDER_BAG),
|
|
207
207
|
tx.pure.u64(bidNonce),
|
|
208
|
-
tx.object(kioskTx.kiosk
|
|
209
|
-
tx.object(kioskTx.kioskCap
|
|
208
|
+
tx.object(kioskTx.kiosk),
|
|
209
|
+
tx.object(kioskTx.kioskCap),
|
|
210
210
|
tx.pure.address(nftTokenId),
|
|
211
211
|
],
|
|
212
212
|
typeArguments: [nftType],
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type KioskClient, type KioskTransaction } from '@mysten/kiosk';
|
|
2
|
-
import { type
|
|
2
|
+
import { type SuiGrpcClient } from '@mysten/sui/grpc';
|
|
3
3
|
import { Transaction } from '@mysten/sui/transactions';
|
|
4
4
|
import { type RequestContext } from '../../SuiTradingClient';
|
|
5
5
|
import {
|
|
@@ -22,7 +22,7 @@ export type AcceptNftBidTx = {
|
|
|
22
22
|
tx: Transaction;
|
|
23
23
|
sharedObjects?: any;
|
|
24
24
|
transferPolicies: any;
|
|
25
|
-
suiClient:
|
|
25
|
+
suiClient: SuiGrpcClient;
|
|
26
26
|
kioskClient: KioskClient;
|
|
27
27
|
kioskTx?: any;
|
|
28
28
|
sharedKioskState?: SharedKioskState;
|
|
@@ -110,8 +110,8 @@ export async function addTradeportKioskAcceptNftBidTx({
|
|
|
110
110
|
arguments: [
|
|
111
111
|
tx.object(TRADEPORT_KIOSK_BIDDING_STORE),
|
|
112
112
|
tx.pure.address(bidNonce),
|
|
113
|
-
tx.object(kioskTx.kiosk
|
|
114
|
-
tx.object(kioskTx.kioskCap
|
|
113
|
+
tx.object(kioskTx.kiosk),
|
|
114
|
+
tx.object(kioskTx.kioskCap),
|
|
115
115
|
tx.pure.address(nftTokenId),
|
|
116
116
|
],
|
|
117
117
|
typeArguments: [nftType],
|
|
@@ -141,8 +141,8 @@ export async function addTradeportKioskAcceptNftBidTx({
|
|
|
141
141
|
arguments: [
|
|
142
142
|
tx.object(TRADEPORT_KIOSK_BIDDING_STORE),
|
|
143
143
|
tx.pure.address(bidNonce),
|
|
144
|
-
tx.object(kioskTx.kiosk
|
|
145
|
-
tx.object(kioskTx.kioskCap
|
|
144
|
+
tx.object(kioskTx.kiosk),
|
|
145
|
+
tx.object(kioskTx.kioskCap),
|
|
146
146
|
tx.pure.address(nftTokenId),
|
|
147
147
|
],
|
|
148
148
|
typeArguments: [nftType],
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { bcs } from '@mysten/sui/bcs';
|
|
2
|
+
import { KioskListing } from '../../helpers/kiosk/kioskListingBcs';
|
|
2
3
|
import {
|
|
3
4
|
BLUEMOVE_CREATOR_CONFIG_OBJECT,
|
|
4
5
|
BLUEMOVE_KIOSK_MARKETPLACE_KIOSK_OBJECT,
|
|
@@ -106,16 +107,16 @@ export const addLegacyTradeportKioskBuyTx = async ({
|
|
|
106
107
|
sharedBulkBuyingDataByNftType?.[nftType]?.commissionFeeAmountsByListingId?.[listingId] ?? 0;
|
|
107
108
|
|
|
108
109
|
if (!commissionFeeAmount) {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
110
|
+
try {
|
|
111
|
+
const { object } = await suiClient.core.getDynamicObjectField({
|
|
112
|
+
parentId: TRADEPORT_KIOSK_LISTING_STORE,
|
|
113
|
+
name: { type: '0x2::object::ID', bcs: bcs.Address.serialize(nftTokenId).toBytes() },
|
|
114
|
+
include: { content: true },
|
|
115
|
+
});
|
|
116
|
+
commissionFeeAmount = Number(KioskListing.parse(object.content).commission);
|
|
117
|
+
} catch {
|
|
115
118
|
throw new Error(`Not found kiosk listing object of token ${nftTokenId}`);
|
|
116
119
|
}
|
|
117
|
-
|
|
118
|
-
commissionFeeAmount = Number((response.data?.content as any)?.fields?.commission);
|
|
119
120
|
}
|
|
120
121
|
|
|
121
122
|
if (commissionFeeAmount === 0) {
|
|
@@ -135,7 +136,7 @@ export const addLegacyTradeportKioskBuyTx = async ({
|
|
|
135
136
|
arguments: [
|
|
136
137
|
tx.object(TRADEPORT_KIOSK_LISTING_STORE),
|
|
137
138
|
tx.object(sellerKiosk),
|
|
138
|
-
tx.object(
|
|
139
|
+
tx.object(kioskTx.kiosk),
|
|
139
140
|
tx.pure.address(nftTokenId),
|
|
140
141
|
tx.object(coin),
|
|
141
142
|
],
|
|
@@ -225,8 +226,8 @@ export async function addKioskTradePortBuyTx({
|
|
|
225
226
|
tx.object(TRADEPORT_LISTINGS_STORE),
|
|
226
227
|
tx.object(TRADEPORT_ORDERBOOK_STORE),
|
|
227
228
|
tx.object(sellerKiosk),
|
|
228
|
-
tx.object(
|
|
229
|
-
tx.object(
|
|
229
|
+
tx.object(kioskTx.kiosk),
|
|
230
|
+
tx.object(kioskTx.kioskCap),
|
|
230
231
|
tx.pure.address(buyer),
|
|
231
232
|
tx.pure.id(nftTokenId),
|
|
232
233
|
tx.object(coin),
|
|
@@ -420,7 +421,7 @@ export async function addBluemoveKioskBuyTx({
|
|
|
420
421
|
tx.object(BLUEMOVE_KIOSK_MARKETPLACE_KIOSK_OBJECT),
|
|
421
422
|
tx.object(sellerKiosk),
|
|
422
423
|
tx.object(transferPolicyId),
|
|
423
|
-
tx.object(
|
|
424
|
+
tx.object(kioskTx.kiosk),
|
|
424
425
|
tx.pure.address(nftTokenId),
|
|
425
426
|
tx.pure.u64(price),
|
|
426
427
|
tx.object(coin1),
|
|
@@ -676,14 +677,11 @@ export async function addTradePortBuyTxHandler(txData: BuyTx) {
|
|
|
676
677
|
// Legacy contract logic below
|
|
677
678
|
if (txData.listingNonce?.startsWith('0x')) {
|
|
678
679
|
const response = await txData?.suiClient.getObject({
|
|
679
|
-
|
|
680
|
-
|
|
680
|
+
objectId: txData.listingNonce,
|
|
681
|
+
include: {},
|
|
681
682
|
});
|
|
682
|
-
if (response.error) {
|
|
683
|
-
throw new Error(response.error.code);
|
|
684
|
-
}
|
|
685
683
|
|
|
686
|
-
if (response.
|
|
684
|
+
if (response.object.type === NON_KIOSK_LISTING_NONCE_TYPE) {
|
|
687
685
|
const sharedObjects =
|
|
688
686
|
txData?.sharedBulkBuyingDataByNftType?.[txData?.nftType]?.sharedObjects ??
|
|
689
687
|
(await getSharedObjects(txData?.nftType));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { KioskClient, KioskTransaction } from '@mysten/kiosk';
|
|
2
|
-
import { type
|
|
2
|
+
import { type SuiGrpcClient } from '@mysten/sui/grpc';
|
|
3
3
|
import { Transaction } from '@mysten/sui/transactions';
|
|
4
4
|
import { type RequestContext } from '../../SuiTradingClient';
|
|
5
5
|
import {
|
|
@@ -30,7 +30,7 @@ type BuyTxBase = {
|
|
|
30
30
|
tx: Transaction;
|
|
31
31
|
sharedObjects?: any;
|
|
32
32
|
transferPolicies: any;
|
|
33
|
-
suiClient:
|
|
33
|
+
suiClient: SuiGrpcClient;
|
|
34
34
|
kioskClient: KioskClient;
|
|
35
35
|
kioskTx?: any;
|
|
36
36
|
sharedKioskState?: SharedKioskState;
|
|
@@ -12,7 +12,7 @@ export async function addTradeportKioskCancelNftTransferTx({
|
|
|
12
12
|
'0x49642273ca7db3d942f9fd810c93467974c40e73ea7f03e8e7a632f1222aca73::kiosk_transfers::cancel_with_purchase_cap',
|
|
13
13
|
arguments: [
|
|
14
14
|
tx.object(TRADEPORT_KIOSK_TRANSFERS_STORE),
|
|
15
|
-
tx.object(kioskTx.kiosk
|
|
15
|
+
tx.object(kioskTx.kiosk),
|
|
16
16
|
tx.pure.address(nftTokenId),
|
|
17
17
|
],
|
|
18
18
|
typeArguments: [nftType],
|
|
@@ -59,8 +59,8 @@ export const addClaimAcceptedBidNftTx = async ({
|
|
|
59
59
|
arguments: [
|
|
60
60
|
tx.object(TRADEPORT_KIOSK_BIDDING_STORE),
|
|
61
61
|
tx.object(TRADEPORT_KIOSK_BIDDING_ESCROW_KIOSK),
|
|
62
|
-
tx.object(kioskTx.kiosk
|
|
63
|
-
tx.object(kioskTx.kioskCap
|
|
62
|
+
tx.object(kioskTx.kiosk),
|
|
63
|
+
tx.object(kioskTx.kioskCap),
|
|
64
64
|
tx.pure.address(nftTokenId),
|
|
65
65
|
tx.object(transferPolicyId),
|
|
66
66
|
],
|
|
@@ -100,8 +100,8 @@ export const addClaimAcceptedBidNftWithPurchaseCapTx = async ({
|
|
|
100
100
|
arguments: [
|
|
101
101
|
tx.object(TRADEPORT_KIOSK_BIDDING_STORE),
|
|
102
102
|
tx.object(sellerKiosk),
|
|
103
|
-
tx.object(kioskTx.kiosk
|
|
104
|
-
tx.object(kioskTx.kioskCap
|
|
103
|
+
tx.object(kioskTx.kiosk),
|
|
104
|
+
tx.object(kioskTx.kioskCap),
|
|
105
105
|
tx.pure.address(nftTokenId),
|
|
106
106
|
tx.object(transferPolicyId),
|
|
107
107
|
],
|
|
@@ -140,8 +140,8 @@ export const addClaimTransferredNftTx = async ({
|
|
|
140
140
|
arguments: [
|
|
141
141
|
tx.object(TRADEPORT_KIOSK_TRANSFERS_STORE),
|
|
142
142
|
tx.object(TRADEPORT_KIOSK_TRANSFERS_ESCROW_KIOSK),
|
|
143
|
-
tx.object(kioskTx.kiosk
|
|
144
|
-
tx.object(kioskTx.kioskCap
|
|
143
|
+
tx.object(kioskTx.kiosk),
|
|
144
|
+
tx.object(kioskTx.kioskCap),
|
|
145
145
|
tx.pure.address(nftTokenId),
|
|
146
146
|
tx.object(transferPolicyId),
|
|
147
147
|
],
|
|
@@ -237,8 +237,8 @@ export const addBluemoveClaimAcceptedBidNft = async ({
|
|
|
237
237
|
tx.object(BLUEMOVE_KIOSK_OFFER_COLLECTION_BIDDER_BAG),
|
|
238
238
|
tx.object(transferPolicyId),
|
|
239
239
|
tx.object(sellerKiosk),
|
|
240
|
-
tx.object(kioskTx.kiosk
|
|
241
|
-
tx.object(kioskTx.kioskCap
|
|
240
|
+
tx.object(kioskTx.kiosk),
|
|
241
|
+
tx.object(kioskTx.kioskCap),
|
|
242
242
|
tx.pure.address(nftTokenId),
|
|
243
243
|
tx.object(coin),
|
|
244
244
|
],
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { KioskClient } from '@mysten/kiosk';
|
|
2
|
-
import { type
|
|
2
|
+
import { type SuiGrpcClient } from '@mysten/sui/grpc';
|
|
3
3
|
import { Transaction } from '@mysten/sui/transactions';
|
|
4
4
|
import { type RequestContext } from '../../SuiTradingClient';
|
|
5
5
|
import {
|
|
@@ -36,7 +36,7 @@ export type ClaimTradeHoldTx = {
|
|
|
36
36
|
|
|
37
37
|
export type ClaimTransferredNftTx = {
|
|
38
38
|
tx: Transaction;
|
|
39
|
-
suiClient?:
|
|
39
|
+
suiClient?: SuiGrpcClient;
|
|
40
40
|
kioskTx?: any;
|
|
41
41
|
kioskClient: KioskClient;
|
|
42
42
|
sharedKioskState?: SharedKioskState;
|
|
@@ -52,7 +52,7 @@ export type ClaimTransferredNftTx = {
|
|
|
52
52
|
|
|
53
53
|
export type ClaimAcceptedBidNftTx = {
|
|
54
54
|
tx: Transaction;
|
|
55
|
-
suiClient:
|
|
55
|
+
suiClient: SuiGrpcClient;
|
|
56
56
|
kioskTx?: any;
|
|
57
57
|
kioskClient: KioskClient;
|
|
58
58
|
sharedKioskState?: SharedKioskState;
|
|
@@ -110,8 +110,8 @@ export async function addKioskTradePortListTx({
|
|
|
110
110
|
arguments: [
|
|
111
111
|
tx.object(TRADEPORT_LISTINGS_STORE),
|
|
112
112
|
tx.object(TRADEPORT_ORDERBOOK_STORE),
|
|
113
|
-
tx.object(kioskTx.kiosk
|
|
114
|
-
tx.object(kioskTx.kioskCap
|
|
113
|
+
tx.object(kioskTx.kiosk),
|
|
114
|
+
tx.object(kioskTx.kioskCap),
|
|
115
115
|
tx.pure.address(seller),
|
|
116
116
|
tx.pure.id(nftTokenId),
|
|
117
117
|
tx.pure.u64(listPrice),
|
|
@@ -8,11 +8,11 @@ import {
|
|
|
8
8
|
TRADEPORT_ORDERBOOK_STORE,
|
|
9
9
|
} from '../../constants';
|
|
10
10
|
import { addTradePortListTx } from './addListTxs';
|
|
11
|
-
import { type
|
|
11
|
+
import { type SuiGrpcClient } from '@mysten/sui/grpc';
|
|
12
12
|
|
|
13
13
|
export type RelistNftTx = {
|
|
14
14
|
tx: Transaction;
|
|
15
|
-
suiClient:
|
|
15
|
+
suiClient: SuiGrpcClient;
|
|
16
16
|
kioskTx?: any;
|
|
17
17
|
kioskClient: KioskClient;
|
|
18
18
|
transferPolicies: any;
|
|
@@ -51,8 +51,8 @@ export async function addKioskTradePortRelistTx({
|
|
|
51
51
|
arguments: [
|
|
52
52
|
tx.object(TRADEPORT_LISTINGS_STORE),
|
|
53
53
|
tx.object(TRADEPORT_ORDERBOOK_STORE),
|
|
54
|
-
tx.object(kioskTx.kiosk
|
|
55
|
-
tx.object(kioskTx.kioskCap
|
|
54
|
+
tx.object(kioskTx.kiosk),
|
|
55
|
+
tx.object(kioskTx.kioskCap),
|
|
56
56
|
tx.pure.id(nftTokenId),
|
|
57
57
|
tx.pure.u64(listPrice),
|
|
58
58
|
],
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type KioskClient } from '@mysten/kiosk';
|
|
2
|
-
import { type
|
|
2
|
+
import { type SuiGrpcClient } from '@mysten/sui/grpc';
|
|
3
3
|
import { Transaction, type TransactionObjectInput } from '@mysten/sui/transactions';
|
|
4
4
|
import { type RequestContext } from '../../SuiTradingClient';
|
|
5
5
|
import {
|
|
@@ -19,7 +19,7 @@ import { addTradePortListTxHandler } from './addListTxs';
|
|
|
19
19
|
|
|
20
20
|
export type ListNftTx = {
|
|
21
21
|
tx: Transaction;
|
|
22
|
-
suiClient:
|
|
22
|
+
suiClient: SuiGrpcClient;
|
|
23
23
|
kioskClient: KioskClient;
|
|
24
24
|
kioskTx?: any;
|
|
25
25
|
sharedObjects?: any;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type KioskClient } from '@mysten/kiosk';
|
|
2
|
-
import { type
|
|
2
|
+
import { type SuiGrpcClient } from '@mysten/sui/grpc';
|
|
3
3
|
import { Transaction } from '@mysten/sui/transactions';
|
|
4
4
|
import { type RequestContext } from '../../SuiTradingClient';
|
|
5
5
|
import { ORIGIN_BYTE_NFT_TYPES_MISSING_ORDERBOOK } from '../../constants';
|
|
@@ -16,7 +16,7 @@ import { addOriginByteCollectionBidTx } from './addPlaceCollectionBidTxs';
|
|
|
16
16
|
|
|
17
17
|
export type PlaceCollectionBidTx = {
|
|
18
18
|
tx: Transaction;
|
|
19
|
-
suiClient:
|
|
19
|
+
suiClient: SuiGrpcClient;
|
|
20
20
|
kioskClient: KioskClient;
|
|
21
21
|
sharedObjects?: any;
|
|
22
22
|
transferPolicies: any;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type SuiGrpcClient } from '@mysten/sui/grpc';
|
|
2
2
|
import { fromHex, normalizeSuiObjectId } from '@mysten/sui/utils';
|
|
3
3
|
import {
|
|
4
4
|
DYNAMIC_COLLECTION_IDS,
|
|
@@ -134,22 +134,17 @@ export async function addTradePortPlaceNftBidTxHandler(txData: PlaceNftBidTx) {
|
|
|
134
134
|
|
|
135
135
|
let bidFeeBps: bigint | undefined;
|
|
136
136
|
|
|
137
|
-
export async function getBidFeeBps(suiClient:
|
|
137
|
+
export async function getBidFeeBps(suiClient: SuiGrpcClient) {
|
|
138
138
|
if (bidFeeBps !== undefined) {
|
|
139
139
|
return bidFeeBps;
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
const res = await suiClient.getObject({
|
|
143
|
-
|
|
144
|
-
|
|
143
|
+
objectId: TRADEPORT_MULTI_BID_STORE,
|
|
144
|
+
include: { json: true },
|
|
145
145
|
});
|
|
146
|
-
if (res.error) {
|
|
147
|
-
throw new Error(`Error on getting SUI object ${TRADEPORT_MULTI_BID_STORE}: ${res.error.code}`);
|
|
148
|
-
}
|
|
149
146
|
|
|
150
|
-
bidFeeBps = BigInt(
|
|
151
|
-
(res?.data?.content as unknown as { fields: { fee_bps: string } })?.fields?.fee_bps ?? 0,
|
|
152
|
-
);
|
|
147
|
+
bidFeeBps = BigInt((res?.object?.json as unknown as { fee_bps: string })?.fee_bps ?? 0);
|
|
153
148
|
|
|
154
149
|
return bidFeeBps;
|
|
155
150
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type SuiGrpcClient } from '@mysten/sui/grpc';
|
|
2
2
|
import { Transaction } from '@mysten/sui/transactions';
|
|
3
3
|
import { type RequestContext } from '../../SuiTradingClient';
|
|
4
4
|
import {
|
|
@@ -12,7 +12,7 @@ import { addTradePortPlaceNftBidTxHandler } from './addPlaceNftBidTxs';
|
|
|
12
12
|
|
|
13
13
|
export type PlaceNftBidTx = {
|
|
14
14
|
tx: Transaction;
|
|
15
|
-
suiClient:
|
|
15
|
+
suiClient: SuiGrpcClient;
|
|
16
16
|
bidder: string;
|
|
17
17
|
collectionId: string;
|
|
18
18
|
nftTokenId?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type KioskClient } from '@mysten/kiosk';
|
|
2
|
-
import { type
|
|
2
|
+
import { type SuiGrpcClient } from '@mysten/sui/grpc';
|
|
3
3
|
import { type Transaction } from '@mysten/sui/transactions';
|
|
4
4
|
import { ORIGIN_BYTE_NFT_TYPES_MISSING_ORDERBOOK } from '../../constants';
|
|
5
5
|
import { getNftType } from '../../helpers/getNftType';
|
|
@@ -24,7 +24,7 @@ import { type SharedKioskState } from '../../helpers/kiosk/sharedKioskState.type
|
|
|
24
24
|
|
|
25
25
|
interface Args {
|
|
26
26
|
tx: Transaction;
|
|
27
|
-
suiClient:
|
|
27
|
+
suiClient: SuiGrpcClient;
|
|
28
28
|
kioskClient: KioskClient;
|
|
29
29
|
sharedKioskState: SharedKioskState;
|
|
30
30
|
transferPolicies: any;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SuiGrpcClient } from '@mysten/sui/grpc';
|
|
2
2
|
import { Transaction } from '@mysten/sui/transactions';
|
|
3
3
|
import { type RequestContext } from '../../SuiTradingClient';
|
|
4
4
|
import {
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
|
|
18
18
|
export type RemoveCollectionBidTx = {
|
|
19
19
|
tx: Transaction;
|
|
20
|
-
suiClient:
|
|
20
|
+
suiClient: SuiGrpcClient;
|
|
21
21
|
sharedObjects?: any;
|
|
22
22
|
bidNonce: string;
|
|
23
23
|
bidder: string;
|