@tradeport/sui-trading-sdk 0.4.66 → 0.5.1
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.ts +2 -1
- package/dist/index.js +330 -329
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -5
- package/dist/index.mjs.map +1 -1
- 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
|
@@ -43,8 +43,8 @@ export async function addLegacyTradePortKioskUnlistTx({
|
|
|
43
43
|
'0x475e98e9c436ec118909f3b9e241d86bcbbc2cf9fba05e99a934823fefb375b7::kiosk_listings::unlist',
|
|
44
44
|
arguments: [
|
|
45
45
|
tx.object(TRADEPORT_KIOSK_LISTING_STORE),
|
|
46
|
-
tx.object(kioskTx.kiosk
|
|
47
|
-
tx.object(kioskTx.kioskCap
|
|
46
|
+
tx.object(kioskTx.kiosk),
|
|
47
|
+
tx.object(kioskTx.kioskCap),
|
|
48
48
|
tx.pure.address(nftTokenId),
|
|
49
49
|
],
|
|
50
50
|
typeArguments: [nftType],
|
|
@@ -74,8 +74,8 @@ export async function addKioskTradePortUnlistTx({
|
|
|
74
74
|
arguments: [
|
|
75
75
|
tx.object(TRADEPORT_LISTINGS_STORE),
|
|
76
76
|
tx.object(TRADEPORT_ORDERBOOK_STORE),
|
|
77
|
-
tx.object(kioskTx.kiosk
|
|
78
|
-
tx.object(kioskTx.kioskCap
|
|
77
|
+
tx.object(kioskTx.kiosk),
|
|
78
|
+
tx.object(kioskTx.kioskCap),
|
|
79
79
|
tx.pure.id(nftTokenId),
|
|
80
80
|
],
|
|
81
81
|
typeArguments: [nftType],
|
|
@@ -134,7 +134,7 @@ export async function addBluemoveKioskUnlistTx({
|
|
|
134
134
|
'0xcc97b74ed95c8e8a3ed88050a898727dee37896da579fc400d482b64db6149ff::kiosk_trade::kiosk_delist',
|
|
135
135
|
arguments: [
|
|
136
136
|
tx.object(BLUEMOVE_KIOSK_MARKETPLACE_KIOSK_OBJECT),
|
|
137
|
-
tx.object(kioskTx.kiosk
|
|
137
|
+
tx.object(kioskTx.kiosk),
|
|
138
138
|
tx.pure.address(nftTokenId),
|
|
139
139
|
],
|
|
140
140
|
typeArguments: [nftType],
|
|
@@ -163,11 +163,7 @@ export async function addHyperspaceKioskUnlistTx({
|
|
|
163
163
|
tx.moveCall({
|
|
164
164
|
target:
|
|
165
165
|
'0x6ea97b03c441edd54ae89224bf9560e583ee66c37e6c246f5db35258e580ba94::hyperspace::delist',
|
|
166
|
-
arguments: [
|
|
167
|
-
tx.object(kioskTx.kiosk.value ?? kioskTx.kiosk),
|
|
168
|
-
tx.object(kioskTx.kioskCap.value ?? kioskTx.kioskCap),
|
|
169
|
-
tx.pure.address(nftTokenId),
|
|
170
|
-
],
|
|
166
|
+
arguments: [tx.object(kioskTx.kiosk), tx.object(kioskTx.kioskCap), tx.pure.address(nftTokenId)],
|
|
171
167
|
typeArguments: [nftType, HYPERSPACE_MP_TRANSFER_POLICY_TYPE],
|
|
172
168
|
});
|
|
173
169
|
}
|
|
@@ -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 {
|
|
@@ -24,7 +24,7 @@ import { normalizeSuiAddress } from '@mysten/sui/utils';
|
|
|
24
24
|
|
|
25
25
|
export type UnlistListingTx = {
|
|
26
26
|
tx: Transaction;
|
|
27
|
-
suiClient:
|
|
27
|
+
suiClient: SuiGrpcClient;
|
|
28
28
|
kioskClient: KioskClient;
|
|
29
29
|
sharedKioskState?: SharedKioskState;
|
|
30
30
|
kioskTx?: any;
|
|
@@ -55,7 +55,7 @@ export async function withdrawProfitsFromKiosks(
|
|
|
55
55
|
).personalCap?.id;
|
|
56
56
|
|
|
57
57
|
kioskTx = new KioskTransaction({
|
|
58
|
-
|
|
58
|
+
transaction: tx,
|
|
59
59
|
kioskClient: context.kioskClient,
|
|
60
60
|
cap: {
|
|
61
61
|
isPersonal: true,
|
|
@@ -75,7 +75,7 @@ export async function withdrawProfitsFromKiosks(
|
|
|
75
75
|
).ownerCap?.id;
|
|
76
76
|
|
|
77
77
|
kioskTx = new KioskTransaction({
|
|
78
|
-
|
|
78
|
+
transaction: tx,
|
|
79
79
|
kioskClient: context.kioskClient,
|
|
80
80
|
cap: {
|
|
81
81
|
isPersonal: false,
|
package/src/tests/SuiWallet.ts
CHANGED
|
@@ -18,7 +18,7 @@ export class SuiWallet {
|
|
|
18
18
|
|
|
19
19
|
async refreshBalance(): Promise<void> {
|
|
20
20
|
this.balanceAmount = BigInt(
|
|
21
|
-
(await this.suiClient.getBalance({ owner: this.keypair.toSuiAddress() })).
|
|
21
|
+
(await this.suiClient.getBalance({ owner: this.keypair.toSuiAddress() })).balance.balance,
|
|
22
22
|
);
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -31,19 +31,16 @@ export class SuiWallet {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
async simulateCall(tx: Transaction, sender?: string): Promise<any> {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
tx.setSenderIfNotSet(sender ?? this.keypair.toSuiAddress());
|
|
35
|
+
const result = await this.suiClient.simulateTransaction({
|
|
36
|
+
transaction: tx,
|
|
37
|
+
include: { effects: true },
|
|
37
38
|
});
|
|
38
39
|
|
|
39
|
-
if (result
|
|
40
|
+
if (result.$kind === 'FailedTransaction') {
|
|
40
41
|
throw new Error(
|
|
41
|
-
`Error on transaction simulation
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (result?.error) {
|
|
46
|
-
throw new Error(`Error on transaction simulation: ${result.error}`); // result.error
|
|
42
|
+
`Error on transaction simulation: ${JSON.stringify(result.FailedTransaction.status.error)}`,
|
|
43
|
+
);
|
|
47
44
|
}
|
|
48
45
|
|
|
49
46
|
return result;
|
|
@@ -51,17 +48,24 @@ export class SuiWallet {
|
|
|
51
48
|
|
|
52
49
|
async executeTransaction(tx: Transaction): Promise<string> {
|
|
53
50
|
tx.setSenderIfNotSet(this.keypair.toSuiAddress());
|
|
54
|
-
const
|
|
51
|
+
const executed = await this.suiClient.signAndExecuteTransaction({
|
|
55
52
|
transaction: tx,
|
|
56
53
|
signer: this.keypair,
|
|
57
54
|
});
|
|
55
|
+
const digest = executed.Transaction?.digest ?? executed.FailedTransaction?.digest ?? '';
|
|
58
56
|
console.log(digest);
|
|
59
57
|
const response = await this.suiClient.waitForTransaction({
|
|
60
58
|
digest,
|
|
61
|
-
|
|
59
|
+
include: { effects: true },
|
|
62
60
|
});
|
|
63
|
-
if (response
|
|
64
|
-
throw new Error(
|
|
61
|
+
if (response.$kind !== 'Transaction') {
|
|
62
|
+
throw new Error(
|
|
63
|
+
`Error on transaction execution: ${
|
|
64
|
+
response.FailedTransaction?.status?.error
|
|
65
|
+
? JSON.stringify(response.FailedTransaction.status.error)
|
|
66
|
+
: ''
|
|
67
|
+
}`,
|
|
68
|
+
);
|
|
65
69
|
}
|
|
66
70
|
|
|
67
71
|
return digest;
|
package/tsconfig.json
CHANGED