@tradeport/sui-trading-sdk 0.5.1 → 0.5.3

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 (154) hide show
  1. package/dist/index.js +19 -1
  2. package/dist/index.js.map +1 -1
  3. package/package.json +71 -66
  4. package/.babel.config.js +0 -3
  5. package/.claude/settings.json +0 -5
  6. package/.env.demo +0 -5
  7. package/.eslintrc.json +0 -46
  8. package/.prettierignore +0 -4
  9. package/.prettierrc.json +0 -7
  10. package/.vscode/launch.json +0 -23
  11. package/CHANGELOG.md +0 -746
  12. package/dist/index.d.mts +0 -193
  13. package/dist/index.mjs +0 -7386
  14. package/dist/index.mjs.map +0 -1
  15. package/jest.config.js +0 -12
  16. package/src/SuiTradingClient.ts +0 -442
  17. package/src/apiClients/createKioskClient.ts +0 -10
  18. package/src/apiClients/createSuiClient.ts +0 -5
  19. package/src/apiClients/graphqlClient.ts +0 -17
  20. package/src/bigNumberConfig.ts +0 -10
  21. package/src/constants.ts +0 -1052
  22. package/src/graphql/createChainGQLQuery.ts +0 -27
  23. package/src/graphql/gqlChainRequest.ts +0 -21
  24. package/src/graphql/queries/fetchAccountKiosks.ts +0 -12
  25. package/src/graphql/queries/fetchActiveLockStateByNftId.ts +0 -15
  26. package/src/graphql/queries/fetchBidsById.ts +0 -36
  27. package/src/graphql/queries/fetchCollectionBidById.ts +0 -21
  28. package/src/graphql/queries/fetchCollectionBidsAtSamePrice.ts +0 -29
  29. package/src/graphql/queries/fetchCollectionChainState.ts +0 -17
  30. package/src/graphql/queries/fetchCollectionFloorListingForMarket.ts +0 -28
  31. package/src/graphql/queries/fetchCollectionFloorListings.ts +0 -15
  32. package/src/graphql/queries/fetchCollectionsById.ts +0 -39
  33. package/src/graphql/queries/fetchCommissionByListingId.ts +0 -13
  34. package/src/graphql/queries/fetchCryptoToUsdRate.ts +0 -13
  35. package/src/graphql/queries/fetchKiosksByOwner.ts +0 -14
  36. package/src/graphql/queries/fetchListingsById.ts +0 -29
  37. package/src/graphql/queries/fetchListingsByNftId.ts +0 -23
  38. package/src/graphql/queries/fetchLockById.ts +0 -23
  39. package/src/graphql/queries/fetchMultibidById.ts +0 -34
  40. package/src/graphql/queries/fetchNftCollectionChainState.ts +0 -12
  41. package/src/graphql/queries/fetchNftsById.ts +0 -75
  42. package/src/graphql/queries/fetchNftsByKioskId.ts +0 -45
  43. package/src/graphql/queries/fetchOwnerCapByKiosk.ts +0 -10
  44. package/src/graphql/queries/fetchPersonalCapByKiosk.ts +0 -10
  45. package/src/graphql/queries/fetchSharedObjectsByType.ts +0 -12
  46. package/src/graphql/queries/fetchTransferPoliciesByType.ts +0 -12
  47. package/src/graphql/queries/fetchWalletKiosks.ts +0 -14
  48. package/src/graphql/queries/getCommissionByListingId.ts +0 -15
  49. package/src/helpers/addOneDollarFee.ts +0 -17
  50. package/src/helpers/addThirdPartyTxFee.ts +0 -17
  51. package/src/helpers/calculatePremium.ts +0 -9
  52. package/src/helpers/calculateRoyaltyFee.ts +0 -28
  53. package/src/helpers/destroyZeroCoin.ts +0 -14
  54. package/src/helpers/getActiveLockStateByNftId.ts +0 -15
  55. package/src/helpers/getCollectionChainState.ts +0 -31
  56. package/src/helpers/getCollectionFloorPrice.ts +0 -12
  57. package/src/helpers/getLockById.ts +0 -29
  58. package/src/helpers/getMarketFeePrice.ts +0 -82
  59. package/src/helpers/getNftType.ts +0 -38
  60. package/src/helpers/getRoyaltyRuleModule.ts +0 -7
  61. package/src/helpers/getSharedObjects.ts +0 -119
  62. package/src/helpers/getSuiToUsdRate.ts +0 -14
  63. package/src/helpers/getTradeportBiddingContractBidAmount.ts +0 -31
  64. package/src/helpers/getTransferPolicyRuleNamesFromSuiObject.ts +0 -24
  65. package/src/helpers/hasPersonalKioskRule.ts +0 -7
  66. package/src/helpers/hasRoyaltyRule.ts +0 -7
  67. package/src/helpers/hasTransferPolicyRules.ts +0 -6
  68. package/src/helpers/isExpiredListing.ts +0 -9
  69. package/src/helpers/isNonKioskListing.ts +0 -14
  70. package/src/helpers/isSIngleBid.ts +0 -13
  71. package/src/helpers/kiosk/assertNftInSharedKiosk.ts +0 -31
  72. package/src/helpers/kiosk/getKioskCollectionRoyaltyFeeAmount.ts +0 -71
  73. package/src/helpers/kiosk/getKioskIdFromKioskTx.ts +0 -29
  74. package/src/helpers/kiosk/getKioskPlaceBidCoin.ts +0 -59
  75. package/src/helpers/kiosk/getNativeKioskTransferPolicies.ts +0 -29
  76. package/src/helpers/kiosk/getNativeKioskTransferPoliciesByNftType.ts +0 -21
  77. package/src/helpers/kiosk/getRulePackageId.ts +0 -59
  78. package/src/helpers/kiosk/getTransferPoliciesToResolve.ts +0 -154
  79. package/src/helpers/kiosk/isBluemoveKioskBid.ts +0 -1
  80. package/src/helpers/kiosk/isTradePortKioskBid.ts +0 -4
  81. package/src/helpers/kiosk/kioskListingBcs.ts +0 -19
  82. package/src/helpers/kiosk/kioskTxWrapper.ts +0 -152
  83. package/src/helpers/kiosk/lockNftInsideKioskIfNotLocked.ts +0 -100
  84. package/src/helpers/kiosk/preProcessSharedBulkBuyingData.ts +0 -171
  85. package/src/helpers/kiosk/resolveCustomTransferPolicyRules.ts +0 -75
  86. package/src/helpers/kiosk/resolveFloorPriceRule.ts +0 -21
  87. package/src/helpers/kiosk/resolveKioskLockRule.ts +0 -47
  88. package/src/helpers/kiosk/resolvePersonalKioskRule.ts +0 -23
  89. package/src/helpers/kiosk/resolveRoyaltyRule.ts +0 -57
  90. package/src/helpers/kiosk/resolveTableAllowlistRule.ts +0 -34
  91. package/src/helpers/kiosk/resolveTransferPolicies.ts +0 -158
  92. package/src/helpers/kiosk/sharedKioskState.type.ts +0 -11
  93. package/src/helpers/kiosk/takeAndBorrowNftFromKiosk.ts +0 -50
  94. package/src/helpers/kiosk/takeLockedNftFromKiosk.ts +0 -73
  95. package/src/helpers/kiosk/upgradeKioskRulesPackageId.ts +0 -17
  96. package/src/helpers/originByte/confirmOBTranfer.ts +0 -33
  97. package/src/helpers/originByte/createOBKiosk.ts +0 -14
  98. package/src/helpers/originByte/depositNftIntoOBKiosk.ts +0 -16
  99. package/src/helpers/originByte/getOBBidderKiosk.ts +0 -12
  100. package/src/helpers/originByte/getOBKiosk.ts +0 -24
  101. package/src/helpers/originByte/getOrCreateOBKiosk.ts +0 -42
  102. package/src/helpers/originByte/isOBKiosk.ts +0 -13
  103. package/src/helpers/originByte/isOriginByteBid.ts +0 -6
  104. package/src/helpers/originByte/isOriginByteCollection.ts +0 -11
  105. package/src/helpers/originByte/shareOriginByteKiosk.ts +0 -14
  106. package/src/helpers/rpc/getAcountBalance.ts +0 -18
  107. package/src/helpers/rpc/getObjectType.ts +0 -25
  108. package/src/helpers/splitCoins.ts +0 -12
  109. package/src/helpers/track.ts +0 -20
  110. package/src/helpers/validateMinFloorPrice.ts +0 -22
  111. package/src/index.ts +0 -2
  112. package/src/methods/acceptCollectionBid/acceptCollectionBid.ts +0 -189
  113. package/src/methods/acceptCollectionBid/addAcceptCollectionBIdTxs.ts +0 -398
  114. package/src/methods/acceptNftBids/acceptNftBids.ts +0 -174
  115. package/src/methods/acceptNftBids/addAcceptNftBidTxs.ts +0 -438
  116. package/src/methods/applyFtStrategy/applyFtStrategy.ts +0 -55
  117. package/src/methods/applyNftStrategy/applyNftStrategy.ts +0 -90
  118. package/src/methods/buyListings/addBuyListingTxs.ts +0 -803
  119. package/src/methods/buyListings/buyListings.ts +0 -230
  120. package/src/methods/cancelMultiBid/cancelMultiBid.ts +0 -51
  121. package/src/methods/cancelNftTransfers/addCancelNftTransfersTx.ts +0 -20
  122. package/src/methods/cancelNftTransfers/cancelNftTransfers.ts +0 -118
  123. package/src/methods/claimNfts/addClaimNftsTxs.ts +0 -247
  124. package/src/methods/claimNfts/claimNfts.ts +0 -270
  125. package/src/methods/createMultiBid/createMultiBid.ts +0 -36
  126. package/src/methods/listNfts/addListTxs.ts +0 -210
  127. package/src/methods/listNfts/addRelistTxs.ts +0 -87
  128. package/src/methods/listNfts/listNfts.ts +0 -152
  129. package/src/methods/migrateNftsFromUnsharedToSharedKiosks/migrateNftsFromUnsharedToSharedKiosks.ts +0 -226
  130. package/src/methods/placeCollectionBids/addPlaceCollectionBidTxs.ts +0 -149
  131. package/src/methods/placeCollectionBids/placeCollectionBids.ts +0 -153
  132. package/src/methods/placeNftBids/addPlaceNftBidTxs.ts +0 -154
  133. package/src/methods/placeNftBids/placeNftBids.ts +0 -111
  134. package/src/methods/relistNft/relistNft.ts +0 -153
  135. package/src/methods/removeCollectionBids/addRemoveCollectionBidsTxs.ts +0 -132
  136. package/src/methods/removeCollectionBids/removeCollectionBids.ts +0 -117
  137. package/src/methods/removeNftBids/addRemoveNftBidTxs.ts +0 -122
  138. package/src/methods/removeNftBids/removeNftBids.ts +0 -116
  139. package/src/methods/sponsorNftListing/addSponsorNftListingTx.ts +0 -40
  140. package/src/methods/sponsorNftListing/sponsorNftListing.ts +0 -60
  141. package/src/methods/transferNfts/addTransferNftTx.ts +0 -220
  142. package/src/methods/transferNfts/transferNfts.ts +0 -216
  143. package/src/methods/unlistListings/addUnlistListingTxs.ts +0 -399
  144. package/src/methods/unlistListings/unlistListings.ts +0 -158
  145. package/src/methods/updateMultiBid/updateMultiBid.ts +0 -66
  146. package/src/methods/withdrawProfitsFromKiosks/withdrawProfitsFromKiosks.ts +0 -100
  147. package/src/tests/SuiWallet.ts +0 -83
  148. package/src/utils/addHexPrefix.ts +0 -7
  149. package/src/utils/addLeadingZerosAfter0x.ts +0 -9
  150. package/src/utils/normalizeNftType.ts +0 -7
  151. package/src/utils/printTxBlockTxs.ts +0 -11
  152. package/src/utils/pureValues.ts +0 -13
  153. package/src/utils/toUint8Array.ts +0 -12
  154. package/tsconfig.json +0 -16
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 };