@tradeport/sui-trading-sdk 0.1.35 → 0.1.36
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/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +59 -37
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +59 -37
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/methods/acceptCollectionBid/acceptCollectionBid.ts +3 -3
- package/src/methods/acceptNftBids/acceptNftBids.ts +3 -2
- package/src/methods/acceptNftBids/addAcceptNftBidTxs.ts +57 -27
- package/src/methods/createShortLocks/createShortLocks.ts +2 -0
- package/src/methods/exerciseLongLocks/exerciseLongLocks.ts +18 -12
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -11,7 +11,7 @@ type AcceptNftBids = {
|
|
|
11
11
|
bidIds: string[];
|
|
12
12
|
tx?: Transaction;
|
|
13
13
|
kioskTx?: KioskTransaction;
|
|
14
|
-
beforeResolveKioskTransferRequest?: (transferRequest: any) => void | Promise<void>;
|
|
14
|
+
beforeResolveKioskTransferRequest?: (coin: any, transferRequest: any) => void | Promise<void>;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
type BuyAndExerciseLongLocks = {
|
package/dist/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ type AcceptNftBids = {
|
|
|
11
11
|
bidIds: string[];
|
|
12
12
|
tx?: Transaction;
|
|
13
13
|
kioskTx?: KioskTransaction;
|
|
14
|
-
beforeResolveKioskTransferRequest?: (transferRequest: any) => void | Promise<void>;
|
|
14
|
+
beforeResolveKioskTransferRequest?: (coin: any, transferRequest: any) => void | Promise<void>;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
type BuyAndExerciseLongLocks = {
|
package/dist/index.js
CHANGED
|
@@ -893,6 +893,7 @@ function addTradeportAcceptNftBidTx({
|
|
|
893
893
|
}
|
|
894
894
|
async function addTradeportKioskAcceptNftBidTx({
|
|
895
895
|
tx,
|
|
896
|
+
seller,
|
|
896
897
|
sharedObjects,
|
|
897
898
|
kioskTx,
|
|
898
899
|
bidNonce,
|
|
@@ -900,35 +901,60 @@ async function addTradeportKioskAcceptNftBidTx({
|
|
|
900
901
|
nftType,
|
|
901
902
|
royaltyRulePackageId,
|
|
902
903
|
royaltyRuleModule,
|
|
904
|
+
bidAmount,
|
|
903
905
|
beforeResolveKioskTransferRequest
|
|
904
906
|
}) {
|
|
905
907
|
const { transferPolicy } = sharedObjects;
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
908
|
+
if (beforeResolveKioskTransferRequest) {
|
|
909
|
+
const [feeCoin, transferRequest] = tx.moveCall({
|
|
910
|
+
target: "0x6468e232af988cd8be608b1901863f0d7dbaa16764c1834daa39b023cb3b2fc8::kiosk_biddings::accept_bid_with_price_lock",
|
|
911
|
+
arguments: [
|
|
912
|
+
tx.object(TRADEPORT_KIOSK_BIDDING_STORE),
|
|
913
|
+
tx.pure.address(bidNonce),
|
|
914
|
+
tx.object(kioskTx.kiosk.value ?? kioskTx.kiosk),
|
|
915
|
+
tx.object(kioskTx.kioskCap.value ?? kioskTx.kioskCap),
|
|
916
|
+
tx.pure.address(nftTokenId)
|
|
917
|
+
],
|
|
918
|
+
typeArguments: [nftType]
|
|
919
|
+
});
|
|
920
|
+
await beforeResolveKioskTransferRequest?.(feeCoin, transferRequest);
|
|
921
|
+
await resolveTransferPolicies({
|
|
922
|
+
tx,
|
|
923
|
+
kioskTx,
|
|
924
|
+
nftType,
|
|
925
|
+
price: bidAmount?.toString(),
|
|
926
|
+
transferRequest,
|
|
927
|
+
coinToSplit: feeCoin,
|
|
928
|
+
shouldSkipKioskLocking: true
|
|
929
|
+
});
|
|
930
|
+
tx.transferObjects([tx.object(feeCoin)], tx.pure.address(addLeadingZerosAfter0x(seller)));
|
|
931
|
+
} else {
|
|
932
|
+
const [feeCoin, transferRequest] = tx.moveCall({
|
|
933
|
+
target: "0xf527efa4c02d079f15389fb596b04688cd5767948d953942e494ff455f11aa7b::kiosk_biddings::accept_bid_with_purchase_cap",
|
|
934
|
+
arguments: [
|
|
935
|
+
tx.object(TRADEPORT_KIOSK_BIDDING_STORE),
|
|
936
|
+
tx.pure.address(bidNonce),
|
|
937
|
+
tx.object(kioskTx.kiosk.value ?? kioskTx.kiosk),
|
|
938
|
+
tx.object(kioskTx.kioskCap.value ?? kioskTx.kioskCap),
|
|
939
|
+
tx.pure.address(nftTokenId)
|
|
940
|
+
],
|
|
941
|
+
typeArguments: [nftType]
|
|
942
|
+
});
|
|
943
|
+
tx.moveCall({
|
|
944
|
+
target: `${royaltyRulePackageId}::${royaltyRuleModule}::pay`,
|
|
945
|
+
typeArguments: [nftType],
|
|
946
|
+
arguments: [tx.object(transferPolicy), transferRequest, feeCoin]
|
|
947
|
+
});
|
|
948
|
+
await resolveTransferPolicies({
|
|
949
|
+
tx,
|
|
950
|
+
kioskTx,
|
|
951
|
+
nftType,
|
|
952
|
+
price: "0",
|
|
953
|
+
transferRequest,
|
|
954
|
+
shouldSkipKioskLocking: true,
|
|
955
|
+
shouldSkipResolvingRoyaltyRule: true
|
|
956
|
+
});
|
|
957
|
+
}
|
|
932
958
|
}
|
|
933
959
|
async function addOriginByteAcceptNftBidTx({
|
|
934
960
|
tx,
|
|
@@ -1922,9 +1948,6 @@ async function exerciseLongLocks({ walletAddress, transaction, locks }, context)
|
|
|
1922
1948
|
collectionId: lock.collection_id
|
|
1923
1949
|
})
|
|
1924
1950
|
);
|
|
1925
|
-
const [makerRewardWithFee] = tx.splitCoins(tx.gas, [
|
|
1926
|
-
BigInt(lock.maker_price) + marketplaceFee
|
|
1927
|
-
]);
|
|
1928
1951
|
const [transferRequest, confirmLockRequest] = tx.moveCall({
|
|
1929
1952
|
target: `${TRADEPORT_PRICE_LOCK_PACKAGE}::tradeport_price_lock::start_confirm_long_lock`,
|
|
1930
1953
|
typeArguments: [lock.nft_type],
|
|
@@ -1947,7 +1970,10 @@ async function exerciseLongLocks({ walletAddress, transaction, locks }, context)
|
|
|
1947
1970
|
shouldSkipKioskLocking: true
|
|
1948
1971
|
});
|
|
1949
1972
|
if (bid) {
|
|
1950
|
-
const beforeResolveKioskTransferRequest = (transferRequest2) => {
|
|
1973
|
+
const beforeResolveKioskTransferRequest = (coin, transferRequest2) => {
|
|
1974
|
+
const [makerRewardWithFee] = tx.splitCoins(coin, [
|
|
1975
|
+
BigInt(lock.maker_price) + marketplaceFee
|
|
1976
|
+
]);
|
|
1951
1977
|
tx.moveCall({
|
|
1952
1978
|
target: `${TRADEPORT_PRICE_LOCK_PACKAGE}::tradeport_price_lock::end_confirm_long_lock_with_bid`,
|
|
1953
1979
|
typeArguments: [lock.nft_type],
|
|
@@ -1960,13 +1986,6 @@ async function exerciseLongLocks({ walletAddress, transaction, locks }, context)
|
|
|
1960
1986
|
});
|
|
1961
1987
|
};
|
|
1962
1988
|
switch (bid.type) {
|
|
1963
|
-
case "solo": {
|
|
1964
|
-
await acceptNftBids(
|
|
1965
|
-
{ bidIds: [bidId], tx, kioskTx, beforeResolveKioskTransferRequest },
|
|
1966
|
-
context
|
|
1967
|
-
);
|
|
1968
|
-
break;
|
|
1969
|
-
}
|
|
1970
1989
|
case "collection": {
|
|
1971
1990
|
await acceptCollectionBid(
|
|
1972
1991
|
{
|
|
@@ -1986,6 +2005,9 @@ async function exerciseLongLocks({ walletAddress, transaction, locks }, context)
|
|
|
1986
2005
|
}
|
|
1987
2006
|
}
|
|
1988
2007
|
} else {
|
|
2008
|
+
const [makerRewardWithFee] = tx.splitCoins(tx.gas, [
|
|
2009
|
+
BigInt(lock.maker_price) + marketplaceFee
|
|
2010
|
+
]);
|
|
1989
2011
|
const [transferRequest2] = tx.moveCall({
|
|
1990
2012
|
target: `${TRADEPORT_PRICE_LOCK_PACKAGE}::tradeport_price_lock::end_confirm_long_lock`,
|
|
1991
2013
|
typeArguments: [lock.nft_type],
|