@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.
Files changed (56) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/jest.config.js +6 -2
  3. package/package.json +66 -65
  4. package/src/SuiTradingClient.ts +24 -14
  5. package/src/apiClients/createKioskClient.ts +5 -6
  6. package/src/apiClients/createSuiClient.ts +2 -2
  7. package/src/helpers/getTransferPolicyRuleNamesFromSuiObject.ts +9 -21
  8. package/src/helpers/isNonKioskListing.ts +2 -2
  9. package/src/helpers/kiosk/getKioskCollectionRoyaltyFeeAmount.ts +10 -10
  10. package/src/helpers/kiosk/getKioskIdFromKioskTx.ts +15 -7
  11. package/src/helpers/kiosk/getKioskPlaceBidCoin.ts +2 -2
  12. package/src/helpers/kiosk/getRulePackageId.ts +2 -2
  13. package/src/helpers/kiosk/getTransferPoliciesToResolve.ts +2 -2
  14. package/src/helpers/kiosk/kioskListingBcs.ts +19 -0
  15. package/src/helpers/kiosk/kioskTxWrapper.ts +3 -3
  16. package/src/helpers/kiosk/lockNftInsideKioskIfNotLocked.ts +9 -9
  17. package/src/helpers/kiosk/preProcessSharedBulkBuyingData.ts +33 -21
  18. package/src/helpers/kiosk/resolveRoyaltyRule.ts +2 -2
  19. package/src/helpers/kiosk/resolveTransferPolicies.ts +2 -2
  20. package/src/helpers/kiosk/takeAndBorrowNftFromKiosk.ts +2 -2
  21. package/src/helpers/kiosk/takeLockedNftFromKiosk.ts +5 -9
  22. package/src/helpers/originByte/getOBBidderKiosk.ts +4 -7
  23. package/src/helpers/rpc/getAcountBalance.ts +3 -3
  24. package/src/helpers/rpc/getObjectType.ts +8 -4
  25. package/src/methods/acceptCollectionBid/acceptCollectionBid.ts +2 -2
  26. package/src/methods/acceptCollectionBid/addAcceptCollectionBIdTxs.ts +3 -3
  27. package/src/methods/acceptNftBids/acceptNftBids.ts +2 -2
  28. package/src/methods/acceptNftBids/addAcceptNftBidTxs.ts +4 -4
  29. package/src/methods/buyListings/addBuyListingTxs.ts +16 -18
  30. package/src/methods/buyListings/buyListings.ts +2 -2
  31. package/src/methods/cancelNftTransfers/addCancelNftTransfersTx.ts +1 -1
  32. package/src/methods/claimNfts/addClaimNftsTxs.ts +8 -8
  33. package/src/methods/claimNfts/claimNfts.ts +3 -3
  34. package/src/methods/listNfts/addListTxs.ts +2 -2
  35. package/src/methods/listNfts/addRelistTxs.ts +4 -4
  36. package/src/methods/listNfts/listNfts.ts +2 -2
  37. package/src/methods/placeCollectionBids/placeCollectionBids.ts +2 -2
  38. package/src/methods/placeNftBids/addPlaceNftBidTxs.ts +5 -10
  39. package/src/methods/placeNftBids/placeNftBids.ts +2 -2
  40. package/src/methods/relistNft/relistNft.ts +2 -2
  41. package/src/methods/removeCollectionBids/removeCollectionBids.ts +2 -2
  42. package/src/methods/removeNftBids/removeNftBids.ts +2 -2
  43. package/src/methods/transferNfts/addTransferNftTx.ts +16 -7
  44. package/src/methods/transferNfts/transferNfts.ts +2 -2
  45. package/src/methods/unlistListings/addUnlistListingTxs.ts +6 -10
  46. package/src/methods/unlistListings/unlistListings.ts +2 -2
  47. package/src/methods/withdrawProfitsFromKiosks/withdrawProfitsFromKiosks.ts +2 -2
  48. package/src/tests/SuiWallet.ts +19 -15
  49. package/tsconfig.json +2 -1
  50. package/.claude/settings.local.json +0 -5
  51. package/dist/index.d.mts +0 -193
  52. package/dist/index.d.ts +0 -193
  53. package/dist/index.js +0 -7400
  54. package/dist/index.js.map +0 -1
  55. package/dist/index.mjs +0 -7375
  56. package/dist/index.mjs.map +0 -1
@@ -1,4 +1,4 @@
1
- import type { SuiClient } from '@mysten/sui/client';
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 RemoveNftBidTx = {
19
19
  tx: Transaction;
20
- suiClient: SuiClient;
20
+ suiClient: SuiGrpcClient;
21
21
  sharedObjects?: any;
22
22
  bidNonce: string;
23
23
  nftType: string;
@@ -1,5 +1,5 @@
1
1
  import { type KioskClient } from '@mysten/kiosk';
2
- import { type SuiClient } from '@mysten/sui/client';
2
+ import { type SuiGrpcClient } from '@mysten/sui/grpc';
3
3
  import { type Transaction } from '@mysten/sui/transactions';
4
4
  import {
5
5
  MYSTEN_TRANSFER_POLICY_RULES_PACKAGE_ID,
@@ -88,8 +88,8 @@ export async function addTradeportKioskTransferTx({
88
88
  '0x49642273ca7db3d942f9fd810c93467974c40e73ea7f03e8e7a632f1222aca73::kiosk_transfers::transfer_with_purchase_capability',
89
89
  arguments: [
90
90
  tx.object(TRADEPORT_KIOSK_TRANSFERS_STORE),
91
- tx.object(kioskTx.kiosk.value ?? kioskTx.kiosk),
92
- tx.object(kioskTx.kioskCap.value ?? kioskTx.kioskCap),
91
+ tx.object(kioskTx.kiosk),
92
+ tx.object(kioskTx.kioskCap),
93
93
  tx.pure.address(nftTokenId),
94
94
  tx.pure.address(addLeadingZerosAfter0x(recipientAddress)),
95
95
  ],
@@ -106,7 +106,7 @@ export async function addTradeportKioskDirectTransferTx(
106
106
  sharedKioskState?: SharedKioskState;
107
107
  },
108
108
  nfts: any[],
109
- suiClient: SuiClient,
109
+ suiClient: SuiGrpcClient,
110
110
  ) {
111
111
  const { tx, recipientAddress, kioskClient, sharedKioskState, senderAddress } = txData;
112
112
  if (nfts.length === 0) {
@@ -128,7 +128,16 @@ export async function addTradeportKioskDirectTransferTx(
128
128
  );
129
129
 
130
130
  const totalRoyaltyAmount = royaltyAmounts.reduce((sum: bigint, amount) => sum + amount, 0n);
131
- const [royaltyCoin] = tx.splitCoins(tx.gas, [tx.pure.u64(totalRoyaltyAmount)]);
131
+ // When no royalty is due, avoid touching the gas coin: sponsored transactions
132
+ // (e.g. Enoki) reject any PTB that uses GasCoin as an argument.
133
+ const [royaltyCoin] =
134
+ totalRoyaltyAmount === 0n
135
+ ? tx.moveCall({
136
+ target: '0x2::coin::zero',
137
+ arguments: [],
138
+ typeArguments: ['0x2::sui::SUI'],
139
+ })
140
+ : tx.splitCoins(tx.gas, [tx.pure.u64(totalRoyaltyAmount)]);
132
141
  for (const nft of nfts) {
133
142
  const nftType = getNftType({
134
143
  collectionId: nft?.collection?.id,
@@ -165,7 +174,7 @@ export async function addTradeportKioskDirectTransferTx(
165
174
  }
166
175
 
167
176
  export async function canBeTransferedDirectly(
168
- suiClient: SuiClient,
177
+ suiClient: SuiGrpcClient,
169
178
  collectionChainState?: CollectionChainState,
170
179
  ) {
171
180
  return (
@@ -174,7 +183,7 @@ export async function canBeTransferedDirectly(
174
183
  }
175
184
 
176
185
  export async function getTransferPolicyForDirectTransfer(
177
- suiClient: SuiClient,
186
+ suiClient: SuiGrpcClient,
178
187
  collectionChainState?: CollectionChainState,
179
188
  validateRules = false,
180
189
  ): Promise<TransferPolicy | undefined> {
@@ -1,5 +1,5 @@
1
1
  import type { KioskClient } from '@mysten/kiosk';
2
- import type { SuiClient } from '@mysten/sui/client';
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 {
@@ -35,7 +35,7 @@ export type TransferNftTx = {
35
35
  transferPolicies: any;
36
36
  kioskTx?: any;
37
37
  transferPolicy?: any;
38
- suiClient: SuiClient;
38
+ suiClient: SuiGrpcClient;
39
39
  };
40
40
 
41
41
  export type TransferNfts = {
@@ -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.value ?? kioskTx.kiosk),
47
- tx.object(kioskTx.kioskCap.value ?? 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.value ?? kioskTx.kiosk),
78
- tx.object(kioskTx.kioskCap.value ?? 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.value ?? 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 { SuiClient } from '@mysten/sui/client';
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: 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
- transactionBlock: tx as any,
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
- transactionBlock: tx as any,
78
+ transaction: tx,
79
79
  kioskClient: context.kioskClient,
80
80
  cap: {
81
81
  isPersonal: false,
@@ -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() })).totalBalance,
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
- const result = await this.suiClient.devInspectTransactionBlock({
35
- transactionBlock: tx,
36
- sender: sender ?? this.keypair.toSuiAddress(),
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?.effects?.status?.status === 'failure') {
40
+ if (result.$kind === 'FailedTransaction') {
40
41
  throw new Error(
41
- `Error on transaction simulation (from effect): ${result.effects.status.error}`,
42
- ); // result.effects.status.error
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 { digest } = await this.suiClient.signAndExecuteTransaction({
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
- options: { showEffects: true },
59
+ include: { effects: true },
62
60
  });
63
- if (response.effects?.status?.status !== 'success') {
64
- throw new Error(`Error on transaction execution: ${response.effects?.status?.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
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  "target": "es2020",
4
- "module": "commonjs",
4
+ "module": "esnext",
5
+ "moduleResolution": "Bundler",
5
6
  "lib": ["es2020"],
6
7
  "allowJs": false,
7
8
  "skipLibCheck": true,
@@ -1,5 +0,0 @@
1
- {
2
- "permissions": {
3
- "allow": ["Bash(xxd:*)", "Bash(pnpm tsc:*)", "Bash(npx tsc:*)"]
4
- }
5
- }
package/dist/index.d.mts DELETED
@@ -1,193 +0,0 @@
1
- import { Transaction } from '@mysten/sui/transactions';
2
- import { GraphQLClient } from 'graphql-request';
3
- import { KioskTransaction } from '@mysten/kiosk';
4
-
5
- type AcceptCollectionBid = {
6
- bidId: string;
7
- nftId: string;
8
- walletAddress: string;
9
- };
10
-
11
- type AcceptNftBids = {
12
- bidIds: string[];
13
- walletAddress: string;
14
- tx?: Transaction;
15
- kioskTx?: KioskTransaction;
16
- beforeResolveKioskTransferRequest?: (coin: any, transferRequest: any) => void | Promise<void>;
17
- };
18
-
19
- type ApplyFtStrategy = {
20
- collectionId: string;
21
- strategyFtType?: string;
22
- tx?: Transaction;
23
- collectionChainState?: Record<string, unknown>;
24
- };
25
-
26
- type ApplyNftStrategy = {
27
- collectionId: string;
28
- strategyFtType?: string;
29
- tx?: Transaction;
30
- };
31
-
32
- type BuyListings = {
33
- listingIds: string[];
34
- walletAddress: string;
35
- tx?: Transaction;
36
- kioskTx?: KioskTransaction;
37
- coinToSplit?: any;
38
- beforeResolveKioskTransferRequest?: (transferRequest: any) => void | Promise<void>;
39
- };
40
-
41
- interface CancelMultiBid {
42
- walletAddress: string;
43
- multiBidId: string;
44
- }
45
-
46
- type CancelNftTransfers = {
47
- nftIds: string[];
48
- walletAddress: string;
49
- };
50
-
51
- type ClaimNfts = {
52
- nftIds: string[];
53
- walletAddress: string;
54
- tx?: Transaction;
55
- };
56
-
57
- interface CreateMultiBid {
58
- walletAddress: string;
59
- name?: string;
60
- amount?: bigint;
61
- tx?: Transaction;
62
- }
63
-
64
- type SponsorNftListingOptions = {
65
- shouldSponsor?: boolean;
66
- numOfPeriods?: number;
67
- usdcFeeAmountPerPeriod?: number;
68
- coinToSplit?: any;
69
- };
70
- type SponsorNftListing = {
71
- tx?: Transaction;
72
- nftTokenId: string;
73
- options: SponsorNftListingOptions;
74
- };
75
-
76
- type ListNfts = {
77
- nfts: Array<{
78
- id: string;
79
- listPriceInMist: number;
80
- sponsorOptions?: SponsorNftListingOptions;
81
- }>;
82
- walletAddress: string;
83
- tx?: Transaction;
84
- };
85
-
86
- type MigrateNftsFromUnsharedToSharedKiosks = {
87
- walletAddress: string;
88
- max?: number;
89
- };
90
-
91
- type PlaceCollectionBid = {
92
- collectionId: string;
93
- bidAmountInMist: number;
94
- numOfBids: number;
95
- walletAddress: string;
96
- multiBidId?: string;
97
- multiBidChainId?: any;
98
- expireAt?: Date;
99
- tx?: Transaction;
100
- };
101
-
102
- type PlaceNftBids = {
103
- bids: Array<{
104
- nftId: string;
105
- bidAmountInMist: number;
106
- expireAt?: Date;
107
- }>;
108
- walletAddress: string;
109
- multiBidId?: string;
110
- multiBidChainId?: any;
111
- tx?: Transaction;
112
- coinToSplit?: any;
113
- };
114
-
115
- type RemoveCollectionBids = {
116
- bidIds: string[];
117
- tx?: Transaction | string;
118
- };
119
-
120
- type RemoveNftBids = {
121
- bidIds: string[];
122
- tx?: Transaction | string;
123
- };
124
-
125
- type TransferNfts = {
126
- nftIds: string[];
127
- recipientAddress: string;
128
- walletAddress: string;
129
- };
130
-
131
- type UnlistListings = {
132
- listingIds: string[];
133
- walletAddress: string;
134
- };
135
-
136
- interface UpdateMultiBid {
137
- walletAddress: string;
138
- multiBidId?: string;
139
- name?: string;
140
- amount?: bigint;
141
- amountToWithdraw?: bigint;
142
- tx?: Transaction;
143
- multiBidChainId?: any;
144
- coinToSplit?: any;
145
- }
146
-
147
- type WithdrawProfitsFromKiosks = {
148
- walletAddress: string;
149
- };
150
-
151
- type ApiConfig = {
152
- apiUser: string;
153
- apiKey: string;
154
- apiUrl?: string;
155
- tradeportRouterUrl?: string;
156
- apiVercelId?: string;
157
- suiNodeUrl?: string;
158
- graphQLClient?: GraphQLClient;
159
- };
160
- declare class SuiTradingClient {
161
- private readonly apiUser;
162
- private readonly apiKey;
163
- private readonly tradeportRouterUrl?;
164
- private readonly suiClient;
165
- private readonly kioskClient;
166
- private readonly allowedApiUsersForUnsharedKiosksMigration;
167
- constructor({ apiUser, apiKey, apiVercelId, apiUrl, tradeportRouterUrl, suiNodeUrl, graphQLClient, }: ApiConfig);
168
- buyListings(args: BuyListings): Promise<Transaction>;
169
- listNfts({ nfts, walletAddress, tx }: ListNfts): Promise<Transaction>;
170
- unlistListings({ listingIds, walletAddress }: UnlistListings): Promise<Transaction>;
171
- placeNftBids(data: PlaceNftBids): Promise<Transaction>;
172
- removeNftBids({ bidIds, tx }: RemoveNftBids): Promise<Transaction>;
173
- acceptNftBids({ bidIds, walletAddress }: AcceptNftBids): Promise<Transaction>;
174
- placeCollectionBid({ collectionId, bidAmountInMist, numOfBids, walletAddress, multiBidId, multiBidChainId, expireAt, tx, }: PlaceCollectionBid): Promise<Transaction>;
175
- acceptCollectionBid({ bidId, nftId, walletAddress }: AcceptCollectionBid): Promise<Transaction>;
176
- removeCollectionBids({ bidIds, tx }: RemoveCollectionBids): Promise<Transaction>;
177
- transferNfts({ nftIds, recipientAddress, walletAddress }: TransferNfts): Promise<Transaction>;
178
- cancelNftTransfers({ nftIds, walletAddress }: CancelNftTransfers): Promise<Transaction>;
179
- claimNfts({ nftIds, walletAddress }: ClaimNfts): Promise<Transaction>;
180
- withdrawProfitsFromKiosks(args: WithdrawProfitsFromKiosks): Promise<Transaction>;
181
- migrateNftsFromUnsharedToSharedKiosks(args: MigrateNftsFromUnsharedToSharedKiosks): Promise<Transaction>;
182
- createMultiBid(args: CreateMultiBid): Promise<{
183
- multiBidChainId: any;
184
- tx: Transaction;
185
- }>;
186
- cancelMultiBid(args: CancelMultiBid): Promise<Transaction>;
187
- updateMultiBid(args: UpdateMultiBid): Promise<Transaction>;
188
- sponsorNftListing(args: SponsorNftListing): Promise<Transaction>;
189
- applyFtStrategy(args: ApplyFtStrategy): Promise<Transaction>;
190
- applyTradeportNftStrategy(args: ApplyNftStrategy): Promise<Transaction>;
191
- }
192
-
193
- export { SuiTradingClient };
package/dist/index.d.ts DELETED
@@ -1,193 +0,0 @@
1
- import { Transaction } from '@mysten/sui/transactions';
2
- import { GraphQLClient } from 'graphql-request';
3
- import { KioskTransaction } from '@mysten/kiosk';
4
-
5
- type AcceptCollectionBid = {
6
- bidId: string;
7
- nftId: string;
8
- walletAddress: string;
9
- };
10
-
11
- type AcceptNftBids = {
12
- bidIds: string[];
13
- walletAddress: string;
14
- tx?: Transaction;
15
- kioskTx?: KioskTransaction;
16
- beforeResolveKioskTransferRequest?: (coin: any, transferRequest: any) => void | Promise<void>;
17
- };
18
-
19
- type ApplyFtStrategy = {
20
- collectionId: string;
21
- strategyFtType?: string;
22
- tx?: Transaction;
23
- collectionChainState?: Record<string, unknown>;
24
- };
25
-
26
- type ApplyNftStrategy = {
27
- collectionId: string;
28
- strategyFtType?: string;
29
- tx?: Transaction;
30
- };
31
-
32
- type BuyListings = {
33
- listingIds: string[];
34
- walletAddress: string;
35
- tx?: Transaction;
36
- kioskTx?: KioskTransaction;
37
- coinToSplit?: any;
38
- beforeResolveKioskTransferRequest?: (transferRequest: any) => void | Promise<void>;
39
- };
40
-
41
- interface CancelMultiBid {
42
- walletAddress: string;
43
- multiBidId: string;
44
- }
45
-
46
- type CancelNftTransfers = {
47
- nftIds: string[];
48
- walletAddress: string;
49
- };
50
-
51
- type ClaimNfts = {
52
- nftIds: string[];
53
- walletAddress: string;
54
- tx?: Transaction;
55
- };
56
-
57
- interface CreateMultiBid {
58
- walletAddress: string;
59
- name?: string;
60
- amount?: bigint;
61
- tx?: Transaction;
62
- }
63
-
64
- type SponsorNftListingOptions = {
65
- shouldSponsor?: boolean;
66
- numOfPeriods?: number;
67
- usdcFeeAmountPerPeriod?: number;
68
- coinToSplit?: any;
69
- };
70
- type SponsorNftListing = {
71
- tx?: Transaction;
72
- nftTokenId: string;
73
- options: SponsorNftListingOptions;
74
- };
75
-
76
- type ListNfts = {
77
- nfts: Array<{
78
- id: string;
79
- listPriceInMist: number;
80
- sponsorOptions?: SponsorNftListingOptions;
81
- }>;
82
- walletAddress: string;
83
- tx?: Transaction;
84
- };
85
-
86
- type MigrateNftsFromUnsharedToSharedKiosks = {
87
- walletAddress: string;
88
- max?: number;
89
- };
90
-
91
- type PlaceCollectionBid = {
92
- collectionId: string;
93
- bidAmountInMist: number;
94
- numOfBids: number;
95
- walletAddress: string;
96
- multiBidId?: string;
97
- multiBidChainId?: any;
98
- expireAt?: Date;
99
- tx?: Transaction;
100
- };
101
-
102
- type PlaceNftBids = {
103
- bids: Array<{
104
- nftId: string;
105
- bidAmountInMist: number;
106
- expireAt?: Date;
107
- }>;
108
- walletAddress: string;
109
- multiBidId?: string;
110
- multiBidChainId?: any;
111
- tx?: Transaction;
112
- coinToSplit?: any;
113
- };
114
-
115
- type RemoveCollectionBids = {
116
- bidIds: string[];
117
- tx?: Transaction | string;
118
- };
119
-
120
- type RemoveNftBids = {
121
- bidIds: string[];
122
- tx?: Transaction | string;
123
- };
124
-
125
- type TransferNfts = {
126
- nftIds: string[];
127
- recipientAddress: string;
128
- walletAddress: string;
129
- };
130
-
131
- type UnlistListings = {
132
- listingIds: string[];
133
- walletAddress: string;
134
- };
135
-
136
- interface UpdateMultiBid {
137
- walletAddress: string;
138
- multiBidId?: string;
139
- name?: string;
140
- amount?: bigint;
141
- amountToWithdraw?: bigint;
142
- tx?: Transaction;
143
- multiBidChainId?: any;
144
- coinToSplit?: any;
145
- }
146
-
147
- type WithdrawProfitsFromKiosks = {
148
- walletAddress: string;
149
- };
150
-
151
- type ApiConfig = {
152
- apiUser: string;
153
- apiKey: string;
154
- apiUrl?: string;
155
- tradeportRouterUrl?: string;
156
- apiVercelId?: string;
157
- suiNodeUrl?: string;
158
- graphQLClient?: GraphQLClient;
159
- };
160
- declare class SuiTradingClient {
161
- private readonly apiUser;
162
- private readonly apiKey;
163
- private readonly tradeportRouterUrl?;
164
- private readonly suiClient;
165
- private readonly kioskClient;
166
- private readonly allowedApiUsersForUnsharedKiosksMigration;
167
- constructor({ apiUser, apiKey, apiVercelId, apiUrl, tradeportRouterUrl, suiNodeUrl, graphQLClient, }: ApiConfig);
168
- buyListings(args: BuyListings): Promise<Transaction>;
169
- listNfts({ nfts, walletAddress, tx }: ListNfts): Promise<Transaction>;
170
- unlistListings({ listingIds, walletAddress }: UnlistListings): Promise<Transaction>;
171
- placeNftBids(data: PlaceNftBids): Promise<Transaction>;
172
- removeNftBids({ bidIds, tx }: RemoveNftBids): Promise<Transaction>;
173
- acceptNftBids({ bidIds, walletAddress }: AcceptNftBids): Promise<Transaction>;
174
- placeCollectionBid({ collectionId, bidAmountInMist, numOfBids, walletAddress, multiBidId, multiBidChainId, expireAt, tx, }: PlaceCollectionBid): Promise<Transaction>;
175
- acceptCollectionBid({ bidId, nftId, walletAddress }: AcceptCollectionBid): Promise<Transaction>;
176
- removeCollectionBids({ bidIds, tx }: RemoveCollectionBids): Promise<Transaction>;
177
- transferNfts({ nftIds, recipientAddress, walletAddress }: TransferNfts): Promise<Transaction>;
178
- cancelNftTransfers({ nftIds, walletAddress }: CancelNftTransfers): Promise<Transaction>;
179
- claimNfts({ nftIds, walletAddress }: ClaimNfts): Promise<Transaction>;
180
- withdrawProfitsFromKiosks(args: WithdrawProfitsFromKiosks): Promise<Transaction>;
181
- migrateNftsFromUnsharedToSharedKiosks(args: MigrateNftsFromUnsharedToSharedKiosks): Promise<Transaction>;
182
- createMultiBid(args: CreateMultiBid): Promise<{
183
- multiBidChainId: any;
184
- tx: Transaction;
185
- }>;
186
- cancelMultiBid(args: CancelMultiBid): Promise<Transaction>;
187
- updateMultiBid(args: UpdateMultiBid): Promise<Transaction>;
188
- sponsorNftListing(args: SponsorNftListing): Promise<Transaction>;
189
- applyFtStrategy(args: ApplyFtStrategy): Promise<Transaction>;
190
- applyTradeportNftStrategy(args: ApplyNftStrategy): Promise<Transaction>;
191
- }
192
-
193
- export { SuiTradingClient };