@tradeport/sui-trading-sdk 0.1.78 → 0.1.80
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 +12 -0
- package/dist/index.js +124 -58
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +124 -58
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/graphql/queries/fetchBidsById.ts +3 -0
- package/src/graphql/queries/fetchCollectionsById.ts +1 -0
- package/src/graphql/queries/fetchListingsById.ts +3 -0
- package/src/graphql/queries/fetchNftsById.ts +9 -0
- package/src/graphql/queries/fetchNftsByKioskId.ts +3 -0
- package/src/helpers/getNftType.ts +31 -0
- package/src/helpers/kiosk/assertNftInSharedKiosk.ts +2 -3
- package/src/methods/acceptCollectionBid/acceptCollectionBid.ts +9 -6
- package/src/methods/acceptNftBids/acceptNftBids.ts +9 -6
- package/src/methods/buyListings/buyListings.ts +9 -6
- package/src/methods/cancelNftTransfers/cancelNftTransfers.ts +9 -4
- package/src/methods/claimNfts/claimNfts.ts +11 -8
- package/src/methods/createLongLocks/createLongLocks.ts +6 -2
- package/src/methods/listNfts/listNfts.ts +9 -6
- package/src/methods/migrateNftsFromUnsharedToSharedKiosks/migrateNftsFromUnsharedToSharedKiosks.ts +11 -3
- package/src/methods/placeCollectionBids/placeCollectionBids.ts +5 -5
- package/src/methods/placeNftBids/placeNftBids.ts +9 -6
- package/src/methods/relistNft/relistNft.ts +5 -2
- package/src/methods/removeCollectionBid/removeCollectionBid.ts +5 -6
- package/src/methods/removeNftBids/removeNftBids.ts +9 -6
- package/src/methods/transferNfts/transferNfts.ts +9 -4
- package/src/methods/unlistListings/unlistListings.ts +9 -6
- package/src/helpers/getNftTypeFromNft.ts +0 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @tradeport/sui-trading-sdk
|
|
2
2
|
|
|
3
|
+
## 0.1.80
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 32d6883: Refactored to get nftType from collection.chain_state
|
|
8
|
+
|
|
9
|
+
## 0.1.79
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- e633f1f: Updated assertion for nfts in unshared kiosks to make sure that nft kiosk is found
|
|
14
|
+
|
|
3
15
|
## 0.1.78
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -150,6 +150,9 @@ var fetchNftById = import_graphql_request5.gql`
|
|
|
150
150
|
nonce
|
|
151
151
|
market_name
|
|
152
152
|
}
|
|
153
|
+
collection {
|
|
154
|
+
chain_state
|
|
155
|
+
}
|
|
153
156
|
}
|
|
154
157
|
}
|
|
155
158
|
`;
|
|
@@ -166,6 +169,9 @@ var fetchNftsById = import_graphql_request5.gql`
|
|
|
166
169
|
contract {
|
|
167
170
|
properties
|
|
168
171
|
}
|
|
172
|
+
collection {
|
|
173
|
+
chain_state
|
|
174
|
+
}
|
|
169
175
|
}
|
|
170
176
|
}
|
|
171
177
|
`;
|
|
@@ -187,17 +193,25 @@ var fetchNftsWithListingsById = import_graphql_request5.gql`
|
|
|
187
193
|
price
|
|
188
194
|
nonce
|
|
189
195
|
}
|
|
196
|
+
collection {
|
|
197
|
+
chain_state
|
|
198
|
+
}
|
|
190
199
|
}
|
|
191
200
|
}
|
|
192
201
|
`;
|
|
193
202
|
|
|
194
|
-
// src/helpers/
|
|
195
|
-
var
|
|
203
|
+
// src/helpers/getNftType.ts
|
|
204
|
+
var getNftType = ({
|
|
205
|
+
collectionChainState,
|
|
206
|
+
nft
|
|
207
|
+
}) => {
|
|
208
|
+
if (collectionChainState?.nft_type)
|
|
209
|
+
return collectionChainState.nft_type;
|
|
196
210
|
let nftType = nft?.properties?.nft_type;
|
|
197
211
|
if (!nftType || nftType?.split("::")?.length <= 1) {
|
|
198
212
|
nftType = nft?.contract?.properties?.nft_type;
|
|
199
213
|
}
|
|
200
|
-
return nftType;
|
|
214
|
+
return nftType ?? "";
|
|
201
215
|
};
|
|
202
216
|
|
|
203
217
|
// src/constants.ts
|
|
@@ -417,8 +431,8 @@ var assertNftInSharedKiosk = async ({
|
|
|
417
431
|
});
|
|
418
432
|
kiosksToCheck = res?.kiosks;
|
|
419
433
|
}
|
|
420
|
-
const
|
|
421
|
-
if (!
|
|
434
|
+
const nftKiosk = kiosksToCheck?.find((k) => k.id === kioskId);
|
|
435
|
+
if (nftKiosk && !nftKiosk?.is_shared) {
|
|
422
436
|
throw new Error("NFT is inside a kiosk that is not shared");
|
|
423
437
|
}
|
|
424
438
|
};
|
|
@@ -1717,9 +1731,11 @@ var acceptCollectionBid = async ({
|
|
|
1717
1731
|
}
|
|
1718
1732
|
const bidsForTracking = [];
|
|
1719
1733
|
const tx = existingTx ?? new import_transactions.Transaction();
|
|
1720
|
-
const
|
|
1721
|
-
|
|
1722
|
-
|
|
1734
|
+
const nftType = getNftType({
|
|
1735
|
+
collectionChainState: nft?.collection?.chain_state,
|
|
1736
|
+
nft
|
|
1737
|
+
});
|
|
1738
|
+
const sharedObjects = await getSharedObjects(nftType);
|
|
1723
1739
|
const txData = {
|
|
1724
1740
|
tx,
|
|
1725
1741
|
kioskTx,
|
|
@@ -1727,7 +1743,7 @@ var acceptCollectionBid = async ({
|
|
|
1727
1743
|
kioskClient: context.kioskClient,
|
|
1728
1744
|
sharedObjects,
|
|
1729
1745
|
bidNonce: bid?.nonce,
|
|
1730
|
-
nftType
|
|
1746
|
+
nftType,
|
|
1731
1747
|
nftTokenId: nft?.token_id,
|
|
1732
1748
|
itemOwner: nft?.owner,
|
|
1733
1749
|
listingPrice: nft?.listings?.[0]?.price,
|
|
@@ -1768,7 +1784,7 @@ var acceptCollectionBid = async ({
|
|
|
1768
1784
|
throw new Error("Marketplace not supported");
|
|
1769
1785
|
}
|
|
1770
1786
|
bidsForTracking.push({
|
|
1771
|
-
nftType
|
|
1787
|
+
nftType,
|
|
1772
1788
|
collectionId: nft?.collection_id,
|
|
1773
1789
|
bidAmount: bid?.price,
|
|
1774
1790
|
bidMarketName: bid?.market_contract?.name,
|
|
@@ -1809,6 +1825,9 @@ var fetchBidsById = import_graphql_request12.gql`
|
|
|
1809
1825
|
market_contract {
|
|
1810
1826
|
name
|
|
1811
1827
|
}
|
|
1828
|
+
collection {
|
|
1829
|
+
chain_state
|
|
1830
|
+
}
|
|
1812
1831
|
}
|
|
1813
1832
|
}
|
|
1814
1833
|
`;
|
|
@@ -1833,9 +1852,11 @@ var acceptNftBids = async ({ bidIds, tx: existingTx, kioskTx, beforeResolveKiosk
|
|
|
1833
1852
|
if (bid?.type !== "solo") {
|
|
1834
1853
|
throw new Error("Bid is not an individual item bid. Use acceptCollectionBid() instead.");
|
|
1835
1854
|
}
|
|
1836
|
-
const
|
|
1837
|
-
|
|
1838
|
-
|
|
1855
|
+
const nftType = getNftType({
|
|
1856
|
+
collectionChainState: bid?.collection?.chain_state,
|
|
1857
|
+
nft: bid?.nft
|
|
1858
|
+
});
|
|
1859
|
+
const sharedObjects = await getSharedObjects(nftType);
|
|
1839
1860
|
const txData = {
|
|
1840
1861
|
tx,
|
|
1841
1862
|
kioskTx,
|
|
@@ -1843,7 +1864,7 @@ var acceptNftBids = async ({ bidIds, tx: existingTx, kioskTx, beforeResolveKiosk
|
|
|
1843
1864
|
kioskClient: context.kioskClient,
|
|
1844
1865
|
sharedObjects,
|
|
1845
1866
|
bidNonce: bid?.nonce,
|
|
1846
|
-
nftType
|
|
1867
|
+
nftType,
|
|
1847
1868
|
listingPrice: bid?.nft?.listings?.[0]?.price,
|
|
1848
1869
|
nftTokenId: bid?.nft?.token_id,
|
|
1849
1870
|
itemOwner: bid?.nft?.owner,
|
|
@@ -1872,7 +1893,7 @@ var acceptNftBids = async ({ bidIds, tx: existingTx, kioskTx, beforeResolveKiosk
|
|
|
1872
1893
|
throw new Error("Marketplace not supported");
|
|
1873
1894
|
}
|
|
1874
1895
|
bidsForTracking.push({
|
|
1875
|
-
nftType
|
|
1896
|
+
nftType,
|
|
1876
1897
|
collectionId: bid?.nft?.collection_id,
|
|
1877
1898
|
bidAmount: bid?.price,
|
|
1878
1899
|
bidMarketName: bid?.market_contract?.name,
|
|
@@ -2220,6 +2241,9 @@ var fetchListingsById = import_graphql_request14.gql`
|
|
|
2220
2241
|
properties
|
|
2221
2242
|
}
|
|
2222
2243
|
}
|
|
2244
|
+
collection {
|
|
2245
|
+
chain_state
|
|
2246
|
+
}
|
|
2223
2247
|
}
|
|
2224
2248
|
}
|
|
2225
2249
|
`;
|
|
@@ -2752,9 +2776,11 @@ var buyListings = async ({
|
|
|
2752
2776
|
if (!listing?.listed) {
|
|
2753
2777
|
throw new Error(`Listing ${listing?.id} is not listed`);
|
|
2754
2778
|
}
|
|
2755
|
-
const
|
|
2756
|
-
|
|
2757
|
-
|
|
2779
|
+
const nftType = getNftType({
|
|
2780
|
+
collectionChainState: listing?.collection?.chain_state,
|
|
2781
|
+
nft: listing?.nft
|
|
2782
|
+
});
|
|
2783
|
+
const sharedObjects = await getSharedObjects(nftType);
|
|
2758
2784
|
const buyTxData = {
|
|
2759
2785
|
tx,
|
|
2760
2786
|
kioskTx,
|
|
@@ -2764,7 +2790,7 @@ var buyListings = async ({
|
|
|
2764
2790
|
buyer: walletAddress,
|
|
2765
2791
|
seller: listing?.seller,
|
|
2766
2792
|
nftTokenId: listing.nft?.token_id,
|
|
2767
|
-
nftType
|
|
2793
|
+
nftType,
|
|
2768
2794
|
listingId: listing?.id,
|
|
2769
2795
|
listingNonce: listing?.nonce,
|
|
2770
2796
|
price: listing?.price,
|
|
@@ -2810,7 +2836,7 @@ var buyListings = async ({
|
|
|
2810
2836
|
}
|
|
2811
2837
|
listingsForTracking.push({
|
|
2812
2838
|
walletAddress,
|
|
2813
|
-
nftType
|
|
2839
|
+
nftType,
|
|
2814
2840
|
collectionId: listing?.nft?.collection_id,
|
|
2815
2841
|
price: listing?.price,
|
|
2816
2842
|
seller: listing?.seller,
|
|
@@ -3066,10 +3092,14 @@ var cancelNftTransfers = async ({ nftIds, walletAddress }, context) => {
|
|
|
3066
3092
|
if (nft?.chain_state?.claimable_reason !== "offer-transfer") {
|
|
3067
3093
|
throw new Error("Cannot cancel transfer of NFT that is not currently transferring");
|
|
3068
3094
|
}
|
|
3069
|
-
const
|
|
3095
|
+
const nftType = getNftType({
|
|
3096
|
+
collectionChainState: nft?.collection?.chain_state,
|
|
3097
|
+
nft
|
|
3098
|
+
});
|
|
3099
|
+
const sharedObjects = await getSharedObjects(nftType);
|
|
3070
3100
|
const txData = {
|
|
3071
3101
|
tx,
|
|
3072
|
-
nftType
|
|
3102
|
+
nftType,
|
|
3073
3103
|
nftTokenId: nft?.token_id,
|
|
3074
3104
|
senderKiosk: nft?.chain_state?.kiosk_id,
|
|
3075
3105
|
senderAddress: walletAddress,
|
|
@@ -3270,15 +3300,17 @@ var claimNfts = async ({ nftIds, walletAddress, tx: existingTx }, context, useOl
|
|
|
3270
3300
|
if (!nft?.chain_state?.claimable) {
|
|
3271
3301
|
throw new Error(`Nft ID: ${nft?.id} is not claimable`);
|
|
3272
3302
|
}
|
|
3273
|
-
const
|
|
3274
|
-
|
|
3275
|
-
|
|
3303
|
+
const nftType = getNftType({
|
|
3304
|
+
collectionChainState: nft?.collection?.chain_state,
|
|
3305
|
+
nft
|
|
3306
|
+
});
|
|
3307
|
+
const sharedObjects = await getSharedObjects(nftType);
|
|
3276
3308
|
if (nft?.chain_state?.claimable_trade_id) {
|
|
3277
3309
|
const txData = {
|
|
3278
3310
|
tx,
|
|
3279
3311
|
kioskClient: context.kioskClient,
|
|
3280
3312
|
sharedObjects,
|
|
3281
|
-
nftType
|
|
3313
|
+
nftType,
|
|
3282
3314
|
claimableTradeId: nft?.chain_state?.claimable_trade_id,
|
|
3283
3315
|
claimableSellerKiosk: nft?.chain_state?.claimable_seller_kiosk,
|
|
3284
3316
|
claimableBuyerKiosk: nft?.chain_state?.claimable_buyer_kiosk
|
|
@@ -3294,7 +3326,7 @@ var claimNfts = async ({ nftIds, walletAddress, tx: existingTx }, context, useOl
|
|
|
3294
3326
|
kioskClient: context.kioskClient,
|
|
3295
3327
|
sharedObjects,
|
|
3296
3328
|
claimer: walletAddress,
|
|
3297
|
-
nftType
|
|
3329
|
+
nftType,
|
|
3298
3330
|
nftTokenId: nft?.token_id,
|
|
3299
3331
|
sellerKiosk: nft?.chain_state?.kiosk_id,
|
|
3300
3332
|
seller: nft?.owner
|
|
@@ -3354,7 +3386,7 @@ var claimNfts = async ({ nftIds, walletAddress, tx: existingTx }, context, useOl
|
|
|
3354
3386
|
kioskClient: context.kioskClient,
|
|
3355
3387
|
sharedObjects,
|
|
3356
3388
|
claimer: walletAddress,
|
|
3357
|
-
nftType
|
|
3389
|
+
nftType,
|
|
3358
3390
|
nftTokenId: nft?.token_id,
|
|
3359
3391
|
sellerKiosk: nft?.chain_state?.kiosk_id,
|
|
3360
3392
|
seller: nft?.owner
|
|
@@ -3410,7 +3442,7 @@ var claimNfts = async ({ nftIds, walletAddress, tx: existingTx }, context, useOl
|
|
|
3410
3442
|
}
|
|
3411
3443
|
}
|
|
3412
3444
|
nftsForTracking.push({
|
|
3413
|
-
nftType
|
|
3445
|
+
nftType,
|
|
3414
3446
|
claimer: walletAddress,
|
|
3415
3447
|
claimReason: nft?.chain_state?.claimable_reason
|
|
3416
3448
|
});
|
|
@@ -3465,7 +3497,10 @@ async function createLongLocks({ walletAddress, nfts }, context) {
|
|
|
3465
3497
|
query: fetchNftById,
|
|
3466
3498
|
variables: { nftId: argNft.id }
|
|
3467
3499
|
}))?.nfts?.[0];
|
|
3468
|
-
const nftType =
|
|
3500
|
+
const nftType = getNftType({
|
|
3501
|
+
collectionChainState: nft?.collection?.chain_state,
|
|
3502
|
+
nft
|
|
3503
|
+
});
|
|
3469
3504
|
const transferPolicy = (await getKioskTransferPolicies(nftType))?.at(0);
|
|
3470
3505
|
if (!transferPolicy) {
|
|
3471
3506
|
throw new Error(`Missing transfer policy for ${nftType}`);
|
|
@@ -3764,7 +3799,10 @@ async function relistNft({
|
|
|
3764
3799
|
kioskClient,
|
|
3765
3800
|
sharedObjects,
|
|
3766
3801
|
nftTokenId: nft?.token_id,
|
|
3767
|
-
nftType:
|
|
3802
|
+
nftType: getNftType({
|
|
3803
|
+
collectionChainState: nft?.collection?.chain_state,
|
|
3804
|
+
nft
|
|
3805
|
+
}),
|
|
3768
3806
|
listingNonce: nft?.listings?.[0]?.nonce,
|
|
3769
3807
|
price: nft?.listings?.[0]?.price,
|
|
3770
3808
|
sellerKiosk: nft?.chain_state?.kiosk_id,
|
|
@@ -3850,9 +3888,11 @@ var listNfts = async ({ nfts, walletAddress }, context) => {
|
|
|
3850
3888
|
const nftsForTracking = [];
|
|
3851
3889
|
const tx = new import_transactions14.Transaction();
|
|
3852
3890
|
for (const nft of res.nfts) {
|
|
3853
|
-
const
|
|
3854
|
-
|
|
3855
|
-
|
|
3891
|
+
const nftType = getNftType({
|
|
3892
|
+
collectionChainState: nft?.collection?.chain_state,
|
|
3893
|
+
nft
|
|
3894
|
+
});
|
|
3895
|
+
const sharedObjects = await getSharedObjects(nftType);
|
|
3856
3896
|
if (nft?.listed) {
|
|
3857
3897
|
await relistNft({
|
|
3858
3898
|
tx,
|
|
@@ -3871,7 +3911,7 @@ var listNfts = async ({ nfts, walletAddress }, context) => {
|
|
|
3871
3911
|
seller: walletAddress,
|
|
3872
3912
|
collectionId: nft?.collection_id,
|
|
3873
3913
|
nftTokenId: nft?.token_id,
|
|
3874
|
-
nftType
|
|
3914
|
+
nftType,
|
|
3875
3915
|
listPrice: nfts?.find((n) => n.id === nft?.id)?.listPriceInMist,
|
|
3876
3916
|
sellerKiosk: nft?.chain_state?.kiosk_id
|
|
3877
3917
|
};
|
|
@@ -3879,7 +3919,7 @@ var listNfts = async ({ nfts, walletAddress }, context) => {
|
|
|
3879
3919
|
}
|
|
3880
3920
|
nftsForTracking.push({
|
|
3881
3921
|
walletAddress,
|
|
3882
|
-
nftType
|
|
3922
|
+
nftType,
|
|
3883
3923
|
collectionId: nft?.collection_id,
|
|
3884
3924
|
listPrice: nfts?.find((n) => n.id === nft?.id)?.listPriceInMist,
|
|
3885
3925
|
isRelist: nft?.listed,
|
|
@@ -3908,6 +3948,9 @@ var fetchNftsByKioskId = import_graphql_request18.gql`
|
|
|
3908
3948
|
contract {
|
|
3909
3949
|
properties
|
|
3910
3950
|
}
|
|
3951
|
+
collection {
|
|
3952
|
+
chain_state
|
|
3953
|
+
}
|
|
3911
3954
|
}
|
|
3912
3955
|
}
|
|
3913
3956
|
`;
|
|
@@ -3995,7 +4038,10 @@ async function migrateNftsFromUnsharedToSharedKiosks({ walletAddress }, context)
|
|
|
3995
4038
|
if (nft?.collection_id === "67ded9ed-4dcc-4d15-9e6f-04dded46f419") {
|
|
3996
4039
|
continue;
|
|
3997
4040
|
}
|
|
3998
|
-
const nftType =
|
|
4041
|
+
const nftType = getNftType({
|
|
4042
|
+
collectionChainState: nft?.collection?.chain_state,
|
|
4043
|
+
nft
|
|
4044
|
+
});
|
|
3999
4045
|
const nftTokenId = nft?.token_id;
|
|
4000
4046
|
if (sharedOBKiosk) {
|
|
4001
4047
|
tx.moveCall({
|
|
@@ -4032,7 +4078,10 @@ async function migrateNftsFromUnsharedToSharedKiosks({ walletAddress }, context)
|
|
|
4032
4078
|
if (nft?.claimable_reason === "offer-transfer") {
|
|
4033
4079
|
continue;
|
|
4034
4080
|
}
|
|
4035
|
-
const nftType =
|
|
4081
|
+
const nftType = getNftType({
|
|
4082
|
+
collectionChainState: nft?.collection?.chain_state,
|
|
4083
|
+
nft
|
|
4084
|
+
});
|
|
4036
4085
|
const nftTokenId = nft?.token_id;
|
|
4037
4086
|
await kioskTxWrapper({
|
|
4038
4087
|
tx,
|
|
@@ -4098,6 +4147,7 @@ var fetchCollectionsByIdWithOneNft = import_graphql_request19.gql`
|
|
|
4098
4147
|
query fetchCollectionsByIdWithOneNft($collectionIds: [uuid!]) {
|
|
4099
4148
|
collections(where: { id: { _in: $collectionIds } }) {
|
|
4100
4149
|
id
|
|
4150
|
+
chain_state
|
|
4101
4151
|
contract {
|
|
4102
4152
|
properties
|
|
4103
4153
|
}
|
|
@@ -4298,7 +4348,10 @@ var placeCollectionBids = async ({ collections, walletAddress }, context) => {
|
|
|
4298
4348
|
const collectionsForTracking = [];
|
|
4299
4349
|
const tx = new import_transactions16.Transaction();
|
|
4300
4350
|
for (const collection of res.collections) {
|
|
4301
|
-
const nftType =
|
|
4351
|
+
const nftType = getNftType({
|
|
4352
|
+
collectionChainState: collection?.chain_state,
|
|
4353
|
+
nft: collection?.nfts?.[0]
|
|
4354
|
+
});
|
|
4302
4355
|
const sharedObjects = await getSharedObjects(nftType);
|
|
4303
4356
|
const txData = {
|
|
4304
4357
|
tx,
|
|
@@ -4437,9 +4490,11 @@ var placeNftBids = async ({ nfts, walletAddress }, context) => {
|
|
|
4437
4490
|
const nftsForTracking = [];
|
|
4438
4491
|
const tx = new import_transactions17.Transaction();
|
|
4439
4492
|
for (const nft of res.nfts) {
|
|
4440
|
-
const
|
|
4441
|
-
|
|
4442
|
-
|
|
4493
|
+
const nftType = getNftType({
|
|
4494
|
+
collectionChainState: nft?.collection?.chain_state,
|
|
4495
|
+
nft
|
|
4496
|
+
});
|
|
4497
|
+
const sharedObjects = await getSharedObjects(nftType);
|
|
4443
4498
|
const txData = {
|
|
4444
4499
|
tx,
|
|
4445
4500
|
kioskClient: context.kioskClient,
|
|
@@ -4447,13 +4502,13 @@ var placeNftBids = async ({ nfts, walletAddress }, context) => {
|
|
|
4447
4502
|
bidder: walletAddress,
|
|
4448
4503
|
collectionId: nft?.collection_id,
|
|
4449
4504
|
nftTokenId: nft?.token_id,
|
|
4450
|
-
nftType
|
|
4505
|
+
nftType,
|
|
4451
4506
|
bidAmount: nfts?.find((n) => n.id === nft?.id)?.bidAmountInMist,
|
|
4452
4507
|
sellerKiosk: nft?.chain_state?.kiosk_id
|
|
4453
4508
|
};
|
|
4454
4509
|
await addTradePortPlaceNftBidTxHandler(txData);
|
|
4455
4510
|
nftsForTracking.push({
|
|
4456
|
-
nftType
|
|
4511
|
+
nftType,
|
|
4457
4512
|
collectionId: nft?.collection_id,
|
|
4458
4513
|
bidAmount: nfts?.find((n) => n.id === nft?.id)?.bidAmountInMist,
|
|
4459
4514
|
bidder: walletAddress
|
|
@@ -4624,7 +4679,10 @@ var removeCollectionBid = async ({ bidId }, context) => {
|
|
|
4624
4679
|
query: fetchCollectionsByIdWithOneNft,
|
|
4625
4680
|
variables: { collectionIds: [bid?.collection_id] }
|
|
4626
4681
|
});
|
|
4627
|
-
const nftType =
|
|
4682
|
+
const nftType = getNftType({
|
|
4683
|
+
collectionChainState: collectionWithOneNftRes?.collections?.[0]?.chain_state,
|
|
4684
|
+
nft: collectionWithOneNftRes?.collections?.[0]?.nfts?.[0]
|
|
4685
|
+
});
|
|
4628
4686
|
const sharedObjects = await getSharedObjects(nftType);
|
|
4629
4687
|
const txData = {
|
|
4630
4688
|
tx,
|
|
@@ -4676,15 +4734,17 @@ var removeNftBids = async ({ bidIds }, context) => {
|
|
|
4676
4734
|
const bidsForTracking = [];
|
|
4677
4735
|
const tx = new import_transactions19.Transaction();
|
|
4678
4736
|
for (const bid of res.bids) {
|
|
4679
|
-
const
|
|
4680
|
-
|
|
4681
|
-
|
|
4737
|
+
const nftType = getNftType({
|
|
4738
|
+
collectionChainState: bid?.collection?.chain_state,
|
|
4739
|
+
nft: bid?.nft
|
|
4740
|
+
});
|
|
4741
|
+
const sharedObjects = await getSharedObjects(nftType);
|
|
4682
4742
|
const txData = {
|
|
4683
4743
|
tx,
|
|
4684
4744
|
suiClient: context.suiClient,
|
|
4685
4745
|
sharedObjects,
|
|
4686
4746
|
bidNonce: bid?.nonce,
|
|
4687
|
-
nftType
|
|
4747
|
+
nftType,
|
|
4688
4748
|
nftTokenId: bid?.nft?.token_id,
|
|
4689
4749
|
bidAmount: bid?.price,
|
|
4690
4750
|
sellerKiosk: bid?.nft?.chain_state?.kiosk_id,
|
|
@@ -4707,7 +4767,7 @@ var removeNftBids = async ({ bidIds }, context) => {
|
|
|
4707
4767
|
throw new Error("Marketplace not supported");
|
|
4708
4768
|
}
|
|
4709
4769
|
bidsForTracking.push({
|
|
4710
|
-
nftType
|
|
4770
|
+
nftType,
|
|
4711
4771
|
collectionId: bid?.nft?.collection_id,
|
|
4712
4772
|
bidAmount: bid?.price,
|
|
4713
4773
|
bidMarketName: bid?.market_contract?.name,
|
|
@@ -4796,11 +4856,15 @@ var transferNfts = async ({ nftIds, recipientAddress, walletAddress }, context)
|
|
|
4796
4856
|
if (nft?.listed) {
|
|
4797
4857
|
throw new Error("Cannot transfer a listed NFT");
|
|
4798
4858
|
}
|
|
4799
|
-
const
|
|
4859
|
+
const nftType = getNftType({
|
|
4860
|
+
collectionChainState: nft?.collection?.chain_state,
|
|
4861
|
+
nft
|
|
4862
|
+
});
|
|
4863
|
+
const sharedObjects = await getSharedObjects(nftType);
|
|
4800
4864
|
const txData = {
|
|
4801
4865
|
tx,
|
|
4802
4866
|
kioskClient: context.kioskClient,
|
|
4803
|
-
nftType
|
|
4867
|
+
nftType,
|
|
4804
4868
|
nftTokenId: nft?.token_id,
|
|
4805
4869
|
senderKiosk: nft?.chain_state?.kiosk_id,
|
|
4806
4870
|
senderAddress: walletAddress,
|
|
@@ -4830,7 +4894,7 @@ var transferNfts = async ({ nftIds, recipientAddress, walletAddress }, context)
|
|
|
4830
4894
|
}
|
|
4831
4895
|
});
|
|
4832
4896
|
nftsForTracking.push({
|
|
4833
|
-
nftType
|
|
4897
|
+
nftType,
|
|
4834
4898
|
senderAddress: walletAddress,
|
|
4835
4899
|
recipientAddress
|
|
4836
4900
|
});
|
|
@@ -4858,16 +4922,18 @@ var unlistListings = async ({ listingIds, walletAddress }, context) => {
|
|
|
4858
4922
|
if (!listing?.listed) {
|
|
4859
4923
|
throw new Error(`Listing ${listing?.id} is not listed`);
|
|
4860
4924
|
}
|
|
4861
|
-
const
|
|
4862
|
-
|
|
4863
|
-
|
|
4925
|
+
const nftType = getNftType({
|
|
4926
|
+
collectionChainState: listing?.collection?.chain_state,
|
|
4927
|
+
nft: listing?.nft
|
|
4928
|
+
});
|
|
4929
|
+
const sharedObjects = await getSharedObjects(nftType);
|
|
4864
4930
|
const txData = {
|
|
4865
4931
|
tx,
|
|
4866
4932
|
suiClient: context.suiClient,
|
|
4867
4933
|
kioskClient: context.kioskClient,
|
|
4868
4934
|
sharedObjects,
|
|
4869
4935
|
nftTokenId: listing.nft?.token_id,
|
|
4870
|
-
nftType
|
|
4936
|
+
nftType,
|
|
4871
4937
|
listingNonce: listing?.nonce,
|
|
4872
4938
|
price: listing?.price,
|
|
4873
4939
|
sellerKiosk: listing.nft?.chain_state?.kiosk_id,
|
|
@@ -4904,7 +4970,7 @@ var unlistListings = async ({ listingIds, walletAddress }, context) => {
|
|
|
4904
4970
|
}
|
|
4905
4971
|
listingsForTracking.push({
|
|
4906
4972
|
walletAddress,
|
|
4907
|
-
nftType
|
|
4973
|
+
nftType,
|
|
4908
4974
|
collectionId: listing?.nft?.collection_id,
|
|
4909
4975
|
price: listing?.price,
|
|
4910
4976
|
seller: listing?.seller,
|