@tradeport/sui-trading-sdk 0.1.26 → 0.1.28
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 +13 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +119 -83
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +119 -83
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/constants.ts +2 -2
- package/src/graphql/queries/fetchLockById.ts +1 -0
- package/src/helpers/getLockById.ts +2 -0
- package/src/helpers/kiosk/resolveRoyaltyRule.ts +3 -1
- package/src/helpers/kiosk/resolveTransferPolicies.ts +14 -4
- package/src/methods/buyAndExerciseShortLocks/buyAndExerciseShortLocks.ts +1 -2
- package/src/methods/buyListings/addBuyListingTxs.ts +6 -3
- package/src/methods/buyListings/buyListings.ts +4 -0
- package/src/methods/buyLocks/buyLocks.ts +24 -1
- package/src/methods/exerciseShortLocks/exerciseShortLocks.ts +38 -28
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @tradeport/sui-trading-sdk
|
|
2
2
|
|
|
3
|
+
## 0.1.28
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fixed exercising short locks for a profit
|
|
8
|
+
|
|
9
|
+
## 0.1.27
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Fixe buyAndExerciseShortLocks
|
|
14
|
+
- abea54b: Fixed buyAndExerciseShortLocks
|
|
15
|
+
|
|
3
16
|
## 0.1.26
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -27,8 +27,7 @@ type BuyAndExerciseShortLocks = {
|
|
|
27
27
|
walletAddress: string;
|
|
28
28
|
locks: Array<{
|
|
29
29
|
id: string;
|
|
30
|
-
|
|
31
|
-
nftId?: string;
|
|
30
|
+
nftId: string;
|
|
32
31
|
}>;
|
|
33
32
|
tx?: Transaction;
|
|
34
33
|
};
|
|
@@ -38,6 +37,7 @@ type BuyListings = {
|
|
|
38
37
|
walletAddress: string;
|
|
39
38
|
tx?: Transaction;
|
|
40
39
|
kioskTx?: KioskTransaction;
|
|
40
|
+
coinToSplit?: any;
|
|
41
41
|
beforeResolveKioskTransferRequest?: (transferRequest: any) => void | Promise<void>;
|
|
42
42
|
};
|
|
43
43
|
|
package/dist/index.d.ts
CHANGED
|
@@ -27,8 +27,7 @@ type BuyAndExerciseShortLocks = {
|
|
|
27
27
|
walletAddress: string;
|
|
28
28
|
locks: Array<{
|
|
29
29
|
id: string;
|
|
30
|
-
|
|
31
|
-
nftId?: string;
|
|
30
|
+
nftId: string;
|
|
32
31
|
}>;
|
|
33
32
|
tx?: Transaction;
|
|
34
33
|
};
|
|
@@ -38,6 +37,7 @@ type BuyListings = {
|
|
|
38
37
|
walletAddress: string;
|
|
39
38
|
tx?: Transaction;
|
|
40
39
|
kioskTx?: KioskTransaction;
|
|
40
|
+
coinToSplit?: any;
|
|
41
41
|
beforeResolveKioskTransferRequest?: (transferRequest: any) => void | Promise<void>;
|
|
42
42
|
};
|
|
43
43
|
|
package/dist/index.js
CHANGED
|
@@ -200,8 +200,8 @@ var TRADEPORT_KIOSK_TRANSFERS_ESCROW_KIOSK = "0xa677dab85a93bd8d6845b6cc7914f3bb
|
|
|
200
200
|
var TRADEPORT_KIOSK_BIDDING_STORE = "0x1e5e7f38e3a61d1d189506d0fc6b7e47e935a292d9e1b23c0f3f1c0f94227772";
|
|
201
201
|
var TRADEPORT_KIOSK_BIDDING_ESCROW_KIOSK = "0x151fbe627d3f8de855f424c879ea2176d89282185a4b9226a7157172dd2919cc";
|
|
202
202
|
var TRADEPORT_KIOSK_BID_NONCE_TYPE = "0xec175e537be9e48f75fa6929291de6454d2502f1091feb22c0d26a22821bbf28::kiosk_biddings::Bid";
|
|
203
|
-
var TRADEPORT_PRICE_LOCK_PACKAGE = "
|
|
204
|
-
var TRADEPORT_PRICE_LOCK_STORE = "
|
|
203
|
+
var TRADEPORT_PRICE_LOCK_PACKAGE = "0xcf523cab6fdf00222ed1d9f20d926af79723b4c948afd7d9816336c30dbe7f2e";
|
|
204
|
+
var TRADEPORT_PRICE_LOCK_STORE = "0x4b705de46a79b29276baf45009bc7d6f70cc0f1407f0c9e03cac5729c0c47946";
|
|
205
205
|
var COLLECTION_IDS_WITH_ZERO_COMMISSION = [
|
|
206
206
|
""
|
|
207
207
|
];
|
|
@@ -688,7 +688,8 @@ function resolveRoyaltyRule({
|
|
|
688
688
|
transferRequest,
|
|
689
689
|
nftType,
|
|
690
690
|
price,
|
|
691
|
-
priceObjectArgument
|
|
691
|
+
priceObjectArgument,
|
|
692
|
+
coinToSplit
|
|
692
693
|
}) {
|
|
693
694
|
const [amount] = tx.moveCall({
|
|
694
695
|
target: `${packageId}::${moduleName}::fee_amount`,
|
|
@@ -698,7 +699,7 @@ function resolveRoyaltyRule({
|
|
|
698
699
|
priceObjectArgument ? tx.object(priceObjectArgument) : tx.pure.u64(price || "0")
|
|
699
700
|
]
|
|
700
701
|
});
|
|
701
|
-
const feeCoin = tx.splitCoins(tx.gas, [amount]);
|
|
702
|
+
const feeCoin = tx.splitCoins(coinToSplit ? coinToSplit : tx.gas, [amount]);
|
|
702
703
|
tx.moveCall({
|
|
703
704
|
target: `${packageId}::${moduleName}::pay`,
|
|
704
705
|
typeArguments: [nftType],
|
|
@@ -718,7 +719,9 @@ var resolveTransferPolicies = async ({
|
|
|
718
719
|
price,
|
|
719
720
|
priceObjectArgument,
|
|
720
721
|
shouldSkipKioskLocking,
|
|
721
|
-
shouldSkipResolvingRoyaltyRule
|
|
722
|
+
shouldSkipResolvingRoyaltyRule,
|
|
723
|
+
coinToSplit,
|
|
724
|
+
beforeResolveKioskTransferRequest
|
|
722
725
|
}) => {
|
|
723
726
|
const transferPolicies = await kioskClient_default.getTransferPolicies({
|
|
724
727
|
type: normalizedNftType(nftType)
|
|
@@ -769,7 +772,8 @@ var resolveTransferPolicies = async ({
|
|
|
769
772
|
transferRequest: policy.transferRequest,
|
|
770
773
|
nftType: policy.isCustom && policy.type ? policy.type : nftType,
|
|
771
774
|
price,
|
|
772
|
-
priceObjectArgument
|
|
775
|
+
priceObjectArgument,
|
|
776
|
+
coinToSplit
|
|
773
777
|
});
|
|
774
778
|
break;
|
|
775
779
|
case "kiosk_lock_rule":
|
|
@@ -808,15 +812,19 @@ var resolveTransferPolicies = async ({
|
|
|
808
812
|
throw new Error(`No resolver for the following rule: ${rule}.`);
|
|
809
813
|
}
|
|
810
814
|
}
|
|
815
|
+
}
|
|
816
|
+
if (canTransferOutsideKiosk && kioskItem) {
|
|
817
|
+
kioskTx.place({ itemType: nftType, item: kioskItem });
|
|
818
|
+
}
|
|
819
|
+
console.log({ transferRequest });
|
|
820
|
+
await beforeResolveKioskTransferRequest?.(transferRequest);
|
|
821
|
+
for (const policy of policies) {
|
|
811
822
|
tx.moveCall({
|
|
812
823
|
target: "0x2::transfer_policy::confirm_request",
|
|
813
824
|
arguments: [tx.object(policy.data.id), policy.transferRequest],
|
|
814
825
|
typeArguments: [policy.isCustom && policy.type ? policy.type : nftType]
|
|
815
826
|
});
|
|
816
827
|
}
|
|
817
|
-
if (canTransferOutsideKiosk && kioskItem) {
|
|
818
|
-
kioskTx.place({ itemType: nftType, item: kioskItem });
|
|
819
|
-
}
|
|
820
828
|
};
|
|
821
829
|
|
|
822
830
|
// src/helpers/originByte/getOBBidderKiosk.ts
|
|
@@ -1694,6 +1702,17 @@ function calculatePremium(price) {
|
|
|
1694
1702
|
return BigInt(price) * PREMIUM_NOMINATOR / 10000n;
|
|
1695
1703
|
}
|
|
1696
1704
|
|
|
1705
|
+
// src/helpers/calculateRoyaltyFee.ts
|
|
1706
|
+
function calculateRoyaltyFee(transferPolicyRules, price) {
|
|
1707
|
+
const royaltyRules = transferPolicyRules.filter(
|
|
1708
|
+
(rule) => rule.type === "royalty_rule"
|
|
1709
|
+
);
|
|
1710
|
+
return royaltyRules.reduce(
|
|
1711
|
+
(sum, rule) => sum + BigInt(rule.min_amount) + BigInt(rule.amount_bp) * price / 10000n,
|
|
1712
|
+
0n
|
|
1713
|
+
);
|
|
1714
|
+
}
|
|
1715
|
+
|
|
1697
1716
|
// src/graphql/queries/fetchLockById.ts
|
|
1698
1717
|
var import_graphql_request13 = require("graphql-request");
|
|
1699
1718
|
var fetchLockById = import_graphql_request13.gql`
|
|
@@ -1709,6 +1728,7 @@ var fetchLockById = import_graphql_request13.gql`
|
|
|
1709
1728
|
maker
|
|
1710
1729
|
chain_state
|
|
1711
1730
|
collection_id
|
|
1731
|
+
expire_in
|
|
1712
1732
|
nft {
|
|
1713
1733
|
id
|
|
1714
1734
|
token_id
|
|
@@ -1727,37 +1747,6 @@ var getLockById = async (lockId) => {
|
|
|
1727
1747
|
return res?.locks?.[0] ?? void 0;
|
|
1728
1748
|
};
|
|
1729
1749
|
|
|
1730
|
-
// src/methods/buyLocks/buyLocks.ts
|
|
1731
|
-
async function buyLocks({ lockIds, transaction }) {
|
|
1732
|
-
const tx = transaction ?? new import_transactions3.Transaction();
|
|
1733
|
-
for (const lockId of lockIds) {
|
|
1734
|
-
const lock = await getLockById(lockId);
|
|
1735
|
-
if (!lock) {
|
|
1736
|
-
throw new Error(`Lock ${lockId} is not found`);
|
|
1737
|
-
}
|
|
1738
|
-
if (lock.state !== "active") {
|
|
1739
|
-
throw new Error(`Lock ${lockId} must be in active state`);
|
|
1740
|
-
}
|
|
1741
|
-
const premiumAmount = calculatePremium(lock.maker_price);
|
|
1742
|
-
const [premium] = tx.splitCoins(tx.gas, [premiumAmount]);
|
|
1743
|
-
tx.moveCall({
|
|
1744
|
-
target: `${TRADEPORT_PRICE_LOCK_PACKAGE}::tradeport_price_lock::buy_lock`,
|
|
1745
|
-
typeArguments: [lock.nft_type],
|
|
1746
|
-
arguments: [
|
|
1747
|
-
tx.object(TRADEPORT_PRICE_LOCK_STORE),
|
|
1748
|
-
tx.object(import_utils.SUI_CLOCK_OBJECT_ID),
|
|
1749
|
-
tx.pure.id(lock.lock_id),
|
|
1750
|
-
premium
|
|
1751
|
-
]
|
|
1752
|
-
});
|
|
1753
|
-
}
|
|
1754
|
-
return tx;
|
|
1755
|
-
}
|
|
1756
|
-
|
|
1757
|
-
// src/methods/exerciseLongLocks/exerciseLongLocks.ts
|
|
1758
|
-
var import_utils2 = require("@mysten/sui.js/utils");
|
|
1759
|
-
var import_transactions4 = require("@mysten/sui/transactions");
|
|
1760
|
-
|
|
1761
1750
|
// src/helpers/getMarketFeePrice.ts
|
|
1762
1751
|
var getMASCMarketFeePrice = (price) => {
|
|
1763
1752
|
if (price * (MASC_ROYALTY_DECIMAL_PERCENT + TRADEPORT_DEFAULT_FEE_DECIMAL_PERCENT) < 1) {
|
|
@@ -1808,7 +1797,51 @@ var getMarketFeePrice = ({ price, collectionId }) => {
|
|
|
1808
1797
|
return parseInt(marketFeePrice?.toFixed(0), 10);
|
|
1809
1798
|
};
|
|
1810
1799
|
|
|
1800
|
+
// src/methods/buyLocks/buyLocks.ts
|
|
1801
|
+
async function buyLocks({ lockIds, transaction }) {
|
|
1802
|
+
const tx = transaction ?? new import_transactions3.Transaction();
|
|
1803
|
+
for (const lockId of lockIds) {
|
|
1804
|
+
const lock = await getLockById(lockId);
|
|
1805
|
+
if (!lock) {
|
|
1806
|
+
throw new Error(`Lock ${lockId} is not found`);
|
|
1807
|
+
}
|
|
1808
|
+
if (lock.state !== "active") {
|
|
1809
|
+
throw new Error(`Lock ${lockId} must be in active state`);
|
|
1810
|
+
}
|
|
1811
|
+
const transferPolicy = (await getKioskTransferPolicies(lock.nft_type))?.at(0);
|
|
1812
|
+
if (!transferPolicy) {
|
|
1813
|
+
throw new Error(`Missing transfer policy for ${lock.nft_type}`);
|
|
1814
|
+
}
|
|
1815
|
+
const marketplaceFee = BigInt(
|
|
1816
|
+
getMarketFeePrice({
|
|
1817
|
+
price: Number(lock.maker_price),
|
|
1818
|
+
collectionId: lock.collection_id
|
|
1819
|
+
})
|
|
1820
|
+
);
|
|
1821
|
+
const royalty = calculateRoyaltyFee(transferPolicy.rules, BigInt(lock.maker_price));
|
|
1822
|
+
const premiumAmount = calculatePremium(lock.maker_price);
|
|
1823
|
+
const [premium] = tx.splitCoins(tx.gas, [premiumAmount]);
|
|
1824
|
+
tx.moveCall({
|
|
1825
|
+
target: `${TRADEPORT_PRICE_LOCK_PACKAGE}::tradeport_price_lock::buy_lock`,
|
|
1826
|
+
typeArguments: [lock.nft_type],
|
|
1827
|
+
arguments: [
|
|
1828
|
+
tx.object(TRADEPORT_PRICE_LOCK_STORE),
|
|
1829
|
+
tx.object(import_utils.SUI_CLOCK_OBJECT_ID),
|
|
1830
|
+
tx.pure.id(lock.lock_id),
|
|
1831
|
+
tx.pure.u64(lock.maker_price),
|
|
1832
|
+
tx.pure.u64(marketplaceFee),
|
|
1833
|
+
tx.pure.u64(royalty),
|
|
1834
|
+
tx.pure.u64(lock.expire_in),
|
|
1835
|
+
premium
|
|
1836
|
+
]
|
|
1837
|
+
});
|
|
1838
|
+
}
|
|
1839
|
+
return tx;
|
|
1840
|
+
}
|
|
1841
|
+
|
|
1811
1842
|
// src/methods/exerciseLongLocks/exerciseLongLocks.ts
|
|
1843
|
+
var import_utils2 = require("@mysten/sui.js/utils");
|
|
1844
|
+
var import_transactions4 = require("@mysten/sui/transactions");
|
|
1812
1845
|
async function exerciseLongLocks({ walletAddress, transaction, locks }, context) {
|
|
1813
1846
|
const tx = transaction ?? new import_transactions4.Transaction();
|
|
1814
1847
|
for (const { id: lockId, bidId } of locks) {
|
|
@@ -1985,17 +2018,6 @@ var fetchListingsById = import_graphql_request14.gql`
|
|
|
1985
2018
|
}
|
|
1986
2019
|
`;
|
|
1987
2020
|
|
|
1988
|
-
// src/helpers/calculateRoyaltyFee.ts
|
|
1989
|
-
function calculateRoyaltyFee(transferPolicyRules, price) {
|
|
1990
|
-
const royaltyRules = transferPolicyRules.filter(
|
|
1991
|
-
(rule) => rule.type === "royalty_rule"
|
|
1992
|
-
);
|
|
1993
|
-
return royaltyRules.reduce(
|
|
1994
|
-
(sum, rule) => sum + BigInt(rule.min_amount) + BigInt(rule.amount_bp) * price / 10000n,
|
|
1995
|
-
0n
|
|
1996
|
-
);
|
|
1997
|
-
}
|
|
1998
|
-
|
|
1999
2021
|
// src/methods/buyListings/buyListings.ts
|
|
2000
2022
|
var import_transactions6 = require("@mysten/sui/transactions");
|
|
2001
2023
|
|
|
@@ -2088,11 +2110,14 @@ var addTradeportKioskBuyTx = async ({
|
|
|
2088
2110
|
nftTokenId,
|
|
2089
2111
|
price,
|
|
2090
2112
|
sellerKiosk,
|
|
2113
|
+
coinToSplit,
|
|
2091
2114
|
collectionId,
|
|
2092
2115
|
beforeResolveKioskTransferRequest
|
|
2093
2116
|
}) => {
|
|
2094
2117
|
const marketFeePrice = getMarketFeePrice({ price, collectionId });
|
|
2095
|
-
const
|
|
2118
|
+
const coin = tx.splitCoins(coinToSplit ? coinToSplit : tx.gas, [
|
|
2119
|
+
tx.pure.u64(price + marketFeePrice)
|
|
2120
|
+
]);
|
|
2096
2121
|
if (!coin)
|
|
2097
2122
|
throw new Error("Coin could not be split");
|
|
2098
2123
|
const [kioskItem, transferRequest, kioskPrice] = tx.moveCall({
|
|
@@ -2106,14 +2131,15 @@ var addTradeportKioskBuyTx = async ({
|
|
|
2106
2131
|
],
|
|
2107
2132
|
typeArguments: [nftType]
|
|
2108
2133
|
});
|
|
2109
|
-
await beforeResolveKioskTransferRequest?.(transferRequest);
|
|
2110
2134
|
await resolveTransferPolicies({
|
|
2111
2135
|
tx,
|
|
2112
2136
|
kioskTx,
|
|
2113
2137
|
nftType,
|
|
2114
2138
|
priceObjectArgument: kioskPrice,
|
|
2115
2139
|
kioskItem,
|
|
2116
|
-
transferRequest
|
|
2140
|
+
transferRequest,
|
|
2141
|
+
coinToSplit,
|
|
2142
|
+
beforeResolveKioskTransferRequest
|
|
2117
2143
|
});
|
|
2118
2144
|
destroyZeroCoin({ tx, coin });
|
|
2119
2145
|
};
|
|
@@ -2471,6 +2497,7 @@ var buyListings = async ({
|
|
|
2471
2497
|
walletAddress,
|
|
2472
2498
|
tx: existingTx,
|
|
2473
2499
|
kioskTx,
|
|
2500
|
+
coinToSplit,
|
|
2474
2501
|
beforeResolveKioskTransferRequest
|
|
2475
2502
|
}, context) => {
|
|
2476
2503
|
const res = await gqlChainRequest({
|
|
@@ -2506,6 +2533,7 @@ var buyListings = async ({
|
|
|
2506
2533
|
sellerKiosk: listing.nft?.chain_state?.kiosk_id,
|
|
2507
2534
|
collectionId: listing?.nft?.collection_id,
|
|
2508
2535
|
nftContractId: listing?.nft?.contract_id,
|
|
2536
|
+
coinToSplit,
|
|
2509
2537
|
beforeResolveKioskTransferRequest
|
|
2510
2538
|
};
|
|
2511
2539
|
switch (listing?.market_name) {
|
|
@@ -2620,22 +2648,35 @@ async function exerciseShortLocks({ walletAddress, transaction, locks }, context
|
|
|
2620
2648
|
kioskOwner: walletAddress,
|
|
2621
2649
|
kiosk: nftIdArg ? nft?.chain_state?.kiosk_id : null,
|
|
2622
2650
|
async runCommands(kioskTx) {
|
|
2623
|
-
|
|
2651
|
+
const [coin, confirmLockRequest] = tx.moveCall({
|
|
2652
|
+
target: `${TRADEPORT_PRICE_LOCK_PACKAGE}::tradeport_price_lock::start_confirm_short_lock`,
|
|
2653
|
+
typeArguments: [lock.nft_type],
|
|
2654
|
+
arguments: [
|
|
2655
|
+
tx.object(TRADEPORT_PRICE_LOCK_STORE),
|
|
2656
|
+
tx.object(import_utils3.SUI_CLOCK_OBJECT_ID),
|
|
2657
|
+
tx.pure.id(lock.lock_id)
|
|
2658
|
+
]
|
|
2659
|
+
});
|
|
2624
2660
|
if (listing) {
|
|
2625
2661
|
const beforeResolveKioskTransferRequest = async (transferRequest) => {
|
|
2626
|
-
|
|
2627
|
-
target: `${TRADEPORT_PRICE_LOCK_PACKAGE}::tradeport_price_lock::
|
|
2662
|
+
tx.moveCall({
|
|
2663
|
+
target: `${TRADEPORT_PRICE_LOCK_PACKAGE}::tradeport_price_lock::end_confirm_short_lock_with_listing`,
|
|
2628
2664
|
typeArguments: [lock.nft_type],
|
|
2629
2665
|
arguments: [
|
|
2630
2666
|
tx.object(TRADEPORT_PRICE_LOCK_STORE),
|
|
2631
|
-
tx.object(
|
|
2632
|
-
|
|
2633
|
-
tx.
|
|
2634
|
-
tx.
|
|
2635
|
-
transferRequest
|
|
2667
|
+
tx.object(TRADEPORT_KIOSK_TRANSFERS_STORE),
|
|
2668
|
+
confirmLockRequest,
|
|
2669
|
+
tx.object(kioskTx.kiosk.value ?? kioskTx.kiosk),
|
|
2670
|
+
tx.object(kioskTx.kioskCap.value ?? kioskTx.kioskCap),
|
|
2671
|
+
transferRequest,
|
|
2672
|
+
tx.object(transferPolicy?.id),
|
|
2673
|
+
tx.object(coin)
|
|
2636
2674
|
]
|
|
2637
2675
|
});
|
|
2638
|
-
|
|
2676
|
+
tx.transferObjects(
|
|
2677
|
+
[tx.object(coin)],
|
|
2678
|
+
tx.pure.address(addLeadingZerosAfter0x(walletAddress))
|
|
2679
|
+
);
|
|
2639
2680
|
};
|
|
2640
2681
|
await buyListings(
|
|
2641
2682
|
{
|
|
@@ -2643,43 +2684,38 @@ async function exerciseShortLocks({ walletAddress, transaction, locks }, context
|
|
|
2643
2684
|
walletAddress,
|
|
2644
2685
|
tx,
|
|
2645
2686
|
kioskTx,
|
|
2687
|
+
coinToSplit: coin,
|
|
2646
2688
|
beforeResolveKioskTransferRequest
|
|
2647
2689
|
},
|
|
2648
2690
|
context
|
|
2649
2691
|
);
|
|
2650
2692
|
} else {
|
|
2651
|
-
const [
|
|
2652
|
-
target: `${TRADEPORT_PRICE_LOCK_PACKAGE}::tradeport_price_lock::
|
|
2693
|
+
const [transferRequest] = tx.moveCall({
|
|
2694
|
+
target: `${TRADEPORT_PRICE_LOCK_PACKAGE}::tradeport_price_lock::end_confirm_short_lock`,
|
|
2653
2695
|
typeArguments: [lock.nft_type],
|
|
2654
2696
|
arguments: [
|
|
2655
2697
|
tx.object(TRADEPORT_PRICE_LOCK_STORE),
|
|
2656
|
-
tx.object(
|
|
2657
|
-
|
|
2658
|
-
tx.
|
|
2659
|
-
tx.object(kioskTx.
|
|
2698
|
+
tx.object(TRADEPORT_KIOSK_TRANSFERS_STORE),
|
|
2699
|
+
confirmLockRequest,
|
|
2700
|
+
tx.object(kioskTx.kiosk.value ?? kioskTx.kiosk),
|
|
2701
|
+
tx.object(kioskTx.kioskCap.value ?? kioskTx.kioskCap),
|
|
2702
|
+
tx.pure.address(nft?.token_id)
|
|
2660
2703
|
]
|
|
2661
2704
|
});
|
|
2662
|
-
confirmLockRequest = request;
|
|
2663
2705
|
await resolveTransferPolicies({
|
|
2664
2706
|
tx,
|
|
2665
2707
|
kioskTx,
|
|
2666
2708
|
nftType: lock.nft_type,
|
|
2667
2709
|
price: lock.maker_price.toString(),
|
|
2668
|
-
transferRequest
|
|
2669
|
-
shouldSkipKioskLocking: true
|
|
2710
|
+
transferRequest,
|
|
2711
|
+
shouldSkipKioskLocking: true,
|
|
2712
|
+
coinToSplit: coin
|
|
2670
2713
|
});
|
|
2714
|
+
tx.transferObjects(
|
|
2715
|
+
[tx.object(coin)],
|
|
2716
|
+
tx.pure.address(addLeadingZerosAfter0x(walletAddress))
|
|
2717
|
+
);
|
|
2671
2718
|
}
|
|
2672
|
-
tx.moveCall({
|
|
2673
|
-
target: `${TRADEPORT_PRICE_LOCK_PACKAGE}::tradeport_price_lock::end_confirm_short_lock`,
|
|
2674
|
-
typeArguments: [lock.nft_type],
|
|
2675
|
-
arguments: [
|
|
2676
|
-
tx.object(TRADEPORT_PRICE_LOCK_STORE),
|
|
2677
|
-
tx.object(TRADEPORT_KIOSK_TRANSFERS_STORE),
|
|
2678
|
-
confirmLockRequest,
|
|
2679
|
-
tx.object(kioskTx.kiosk.value ?? kioskTx.kiosk),
|
|
2680
|
-
tx.object(kioskTx.kioskCap.value ?? kioskTx.kioskCap)
|
|
2681
|
-
]
|
|
2682
|
-
});
|
|
2683
2719
|
}
|
|
2684
2720
|
});
|
|
2685
2721
|
}
|