@tradeport/sui-trading-sdk 0.4.58 → 0.4.60

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.
@@ -0,0 +1,222 @@
1
+ import * as _mysten_sui_dist_cjs_transactions from '@mysten/sui/dist/cjs/transactions';
2
+ import { Transaction } from '@mysten/sui/transactions';
3
+ import { GraphQLClient } from 'graphql-request';
4
+ import { KioskTransaction } from '@mysten/kiosk';
5
+ import { Protocol, Route, Coin, Commission, GetRoutesResult } from '@flowx-finance/sdk';
6
+ import { StringValue } from 'ms';
7
+
8
+ type AcceptCollectionBid = {
9
+ bidId: string;
10
+ nftId: string;
11
+ walletAddress: string;
12
+ };
13
+
14
+ type AcceptNftBids = {
15
+ bidIds: string[];
16
+ walletAddress: string;
17
+ tx?: Transaction;
18
+ kioskTx?: KioskTransaction;
19
+ beforeResolveKioskTransferRequest?: (coin: any, transferRequest: any) => void | Promise<void>;
20
+ };
21
+
22
+ type ApplyFtStrategy = {
23
+ collectionId: string;
24
+ strategyFtType?: string;
25
+ tx?: Transaction;
26
+ collectionChainState?: Record<string, unknown>;
27
+ };
28
+
29
+ type BuyListings = {
30
+ listingIds: string[];
31
+ walletAddress: string;
32
+ tx?: Transaction | string;
33
+ kioskTx?: KioskTransaction;
34
+ coinToSplit?: any;
35
+ beforeResolveKioskTransferRequest?: (transferRequest: any) => void | Promise<void>;
36
+ };
37
+
38
+ interface CancelMultiBid {
39
+ walletAddress: string;
40
+ multiBidId: string;
41
+ }
42
+
43
+ type CancelNftTransfers = {
44
+ nftIds: string[];
45
+ walletAddress: string;
46
+ };
47
+
48
+ type ClaimNfts = {
49
+ nftIds: string[];
50
+ walletAddress: string;
51
+ tx?: Transaction;
52
+ };
53
+
54
+ interface CreateMultiBid {
55
+ walletAddress: string;
56
+ name?: string;
57
+ amount?: bigint;
58
+ tx?: Transaction | string;
59
+ }
60
+
61
+ type SponsorNftListingOptions = {
62
+ shouldSponsor?: boolean;
63
+ numOfPeriods?: number;
64
+ slippage?: number;
65
+ coinInType?: string;
66
+ coinInAmount?: string;
67
+ usdcFeeAmountPerPeriod?: number;
68
+ };
69
+ type SponsorNftListing = {
70
+ nftTokenId: string;
71
+ walletAddress: string;
72
+ options: SponsorNftListingOptions;
73
+ };
74
+
75
+ type ListNfts = {
76
+ nfts: Array<{
77
+ id: string;
78
+ listPriceInMist: number;
79
+ sponsorOptions?: SponsorNftListingOptions;
80
+ }>;
81
+ walletAddress: string;
82
+ };
83
+
84
+ type MigrateNftsFromUnsharedToSharedKiosks = {
85
+ walletAddress: string;
86
+ max?: number;
87
+ };
88
+
89
+ type PlaceCollectionBid = {
90
+ collectionId: string;
91
+ bidAmountInMist: number;
92
+ numOfBids: number;
93
+ walletAddress: string;
94
+ multiBidId?: string;
95
+ multiBidChainId?: any;
96
+ expireAt?: Date;
97
+ tx?: Transaction | string;
98
+ };
99
+
100
+ type PlaceNftBids = {
101
+ bids: Array<{
102
+ nftId: string;
103
+ bidAmountInMist: number;
104
+ expireAt?: Date;
105
+ }>;
106
+ walletAddress: string;
107
+ multiBidId?: string;
108
+ multiBidChainId?: any;
109
+ tx?: Transaction | string;
110
+ };
111
+
112
+ type RemoveCollectionBids = {
113
+ bidIds: string[];
114
+ tx?: Transaction | string;
115
+ };
116
+
117
+ type RemoveNftBids = {
118
+ bidIds: string[];
119
+ tx?: Transaction | string;
120
+ };
121
+
122
+ type TransferNfts = {
123
+ nftIds: string[];
124
+ recipientAddress: string;
125
+ walletAddress: string;
126
+ };
127
+
128
+ type UnlistListings = {
129
+ listingIds: string[];
130
+ walletAddress: string;
131
+ };
132
+
133
+ interface UpdateMultiBid {
134
+ walletAddress: string;
135
+ multiBidId?: string;
136
+ name?: string;
137
+ amount?: bigint;
138
+ amountToWithdraw?: bigint;
139
+ tx?: Transaction | string;
140
+ multiBidChainId?: any;
141
+ }
142
+
143
+ type WithdrawProfitsFromKiosks = {
144
+ walletAddress: string;
145
+ };
146
+
147
+ type ApplyNftStrategy = {
148
+ collectionId: string;
149
+ strategyFtType?: string;
150
+ tx?: Transaction;
151
+ };
152
+
153
+ type SwapCoins = {
154
+ walletAddress: string;
155
+ coinInType: string;
156
+ coinInAmount: string;
157
+ coinOutType: string;
158
+ slippage?: number;
159
+ ttl?: StringValue;
160
+ excludeSources?: Protocol[];
161
+ routes?: Array<Route<Coin, Coin>>;
162
+ commission?: Commission;
163
+ tx?: Transaction;
164
+ };
165
+ type SwapRoutesArgs = {
166
+ walletAddress: string;
167
+ coinInType: string;
168
+ coinOutType: string;
169
+ amountToSwap: bigint;
170
+ excludeSources?: Protocol[];
171
+ commission?: Commission;
172
+ };
173
+
174
+ type ApiConfig = {
175
+ apiUser: string;
176
+ apiKey: string;
177
+ apiUrl?: string;
178
+ defiRouterUrl?: string;
179
+ apiVercelId?: string;
180
+ suiNodeUrl?: string;
181
+ graphQLClient?: GraphQLClient;
182
+ };
183
+ declare class SuiTradingClient {
184
+ private readonly apiUser;
185
+ private readonly apiKey;
186
+ private readonly defiRouterUrl;
187
+ private readonly suiClient;
188
+ private readonly kioskClient;
189
+ private readonly allowedApiUsersForUnsharedKiosksMigration;
190
+ constructor({ apiUser, apiKey, apiVercelId, apiUrl, defiRouterUrl, suiNodeUrl, graphQLClient, }: ApiConfig);
191
+ buyListings({ listingIds, walletAddress, tx }: BuyListings): Promise<Transaction>;
192
+ listNfts({ nfts, walletAddress }: ListNfts): Promise<Transaction>;
193
+ unlistListings({ listingIds, walletAddress }: UnlistListings): Promise<Transaction>;
194
+ placeNftBids(data: PlaceNftBids): Promise<Transaction>;
195
+ removeNftBids({ bidIds, tx }: RemoveNftBids): Promise<Transaction>;
196
+ acceptNftBids({ bidIds, walletAddress }: AcceptNftBids): Promise<Transaction>;
197
+ placeCollectionBid({ collectionId, bidAmountInMist, numOfBids, walletAddress, multiBidId, multiBidChainId, expireAt, tx, }: PlaceCollectionBid): Promise<Transaction>;
198
+ acceptCollectionBid({ bidId, nftId, walletAddress }: AcceptCollectionBid): Promise<Transaction>;
199
+ removeCollectionBids({ bidIds, tx }: RemoveCollectionBids): Promise<Transaction>;
200
+ transferNfts({ nftIds, recipientAddress, walletAddress }: TransferNfts): Promise<Transaction>;
201
+ cancelNftTransfers({ nftIds, walletAddress }: CancelNftTransfers): Promise<Transaction>;
202
+ claimNfts({ nftIds, walletAddress }: ClaimNfts): Promise<Transaction>;
203
+ withdrawProfitsFromKiosks(args: WithdrawProfitsFromKiosks): Promise<Transaction>;
204
+ migrateNftsFromUnsharedToSharedKiosks(args: MigrateNftsFromUnsharedToSharedKiosks): Promise<Transaction>;
205
+ createMultiBid(args: CreateMultiBid): Promise<{
206
+ multiBidChainId: any;
207
+ tx: Transaction;
208
+ }>;
209
+ cancelMultiBid(args: CancelMultiBid): Promise<Transaction>;
210
+ updateMultiBid(args: UpdateMultiBid): Promise<Transaction>;
211
+ sponsorNftListing(args: SponsorNftListing): Promise<Transaction>;
212
+ applyFtStrategy(args: ApplyFtStrategy): Promise<Transaction>;
213
+ applyTradeportNftStrategy(args: ApplyNftStrategy): Promise<Transaction>;
214
+ swapCoins(args: SwapCoins): Promise<{
215
+ tx: Transaction;
216
+ coinOut: _mysten_sui_dist_cjs_transactions.TransactionResult;
217
+ }>;
218
+ buildSwapRoutes(args: SwapRoutesArgs): Promise<GetRoutesResult<Coin, Coin>>;
219
+ calculateAmountToSwap(args: Pick<SwapCoins, 'coinInType' | 'coinOutType' | 'coinInAmount'>): Promise<bigint>;
220
+ }
221
+
222
+ export { SuiTradingClient };
@@ -0,0 +1,222 @@
1
+ import * as _mysten_sui_dist_cjs_transactions from '@mysten/sui/dist/cjs/transactions';
2
+ import { Transaction } from '@mysten/sui/transactions';
3
+ import { GraphQLClient } from 'graphql-request';
4
+ import { KioskTransaction } from '@mysten/kiosk';
5
+ import { Protocol, Route, Coin, Commission, GetRoutesResult } from '@flowx-finance/sdk';
6
+ import { StringValue } from 'ms';
7
+
8
+ type AcceptCollectionBid = {
9
+ bidId: string;
10
+ nftId: string;
11
+ walletAddress: string;
12
+ };
13
+
14
+ type AcceptNftBids = {
15
+ bidIds: string[];
16
+ walletAddress: string;
17
+ tx?: Transaction;
18
+ kioskTx?: KioskTransaction;
19
+ beforeResolveKioskTransferRequest?: (coin: any, transferRequest: any) => void | Promise<void>;
20
+ };
21
+
22
+ type ApplyFtStrategy = {
23
+ collectionId: string;
24
+ strategyFtType?: string;
25
+ tx?: Transaction;
26
+ collectionChainState?: Record<string, unknown>;
27
+ };
28
+
29
+ type BuyListings = {
30
+ listingIds: string[];
31
+ walletAddress: string;
32
+ tx?: Transaction | string;
33
+ kioskTx?: KioskTransaction;
34
+ coinToSplit?: any;
35
+ beforeResolveKioskTransferRequest?: (transferRequest: any) => void | Promise<void>;
36
+ };
37
+
38
+ interface CancelMultiBid {
39
+ walletAddress: string;
40
+ multiBidId: string;
41
+ }
42
+
43
+ type CancelNftTransfers = {
44
+ nftIds: string[];
45
+ walletAddress: string;
46
+ };
47
+
48
+ type ClaimNfts = {
49
+ nftIds: string[];
50
+ walletAddress: string;
51
+ tx?: Transaction;
52
+ };
53
+
54
+ interface CreateMultiBid {
55
+ walletAddress: string;
56
+ name?: string;
57
+ amount?: bigint;
58
+ tx?: Transaction | string;
59
+ }
60
+
61
+ type SponsorNftListingOptions = {
62
+ shouldSponsor?: boolean;
63
+ numOfPeriods?: number;
64
+ slippage?: number;
65
+ coinInType?: string;
66
+ coinInAmount?: string;
67
+ usdcFeeAmountPerPeriod?: number;
68
+ };
69
+ type SponsorNftListing = {
70
+ nftTokenId: string;
71
+ walletAddress: string;
72
+ options: SponsorNftListingOptions;
73
+ };
74
+
75
+ type ListNfts = {
76
+ nfts: Array<{
77
+ id: string;
78
+ listPriceInMist: number;
79
+ sponsorOptions?: SponsorNftListingOptions;
80
+ }>;
81
+ walletAddress: string;
82
+ };
83
+
84
+ type MigrateNftsFromUnsharedToSharedKiosks = {
85
+ walletAddress: string;
86
+ max?: number;
87
+ };
88
+
89
+ type PlaceCollectionBid = {
90
+ collectionId: string;
91
+ bidAmountInMist: number;
92
+ numOfBids: number;
93
+ walletAddress: string;
94
+ multiBidId?: string;
95
+ multiBidChainId?: any;
96
+ expireAt?: Date;
97
+ tx?: Transaction | string;
98
+ };
99
+
100
+ type PlaceNftBids = {
101
+ bids: Array<{
102
+ nftId: string;
103
+ bidAmountInMist: number;
104
+ expireAt?: Date;
105
+ }>;
106
+ walletAddress: string;
107
+ multiBidId?: string;
108
+ multiBidChainId?: any;
109
+ tx?: Transaction | string;
110
+ };
111
+
112
+ type RemoveCollectionBids = {
113
+ bidIds: string[];
114
+ tx?: Transaction | string;
115
+ };
116
+
117
+ type RemoveNftBids = {
118
+ bidIds: string[];
119
+ tx?: Transaction | string;
120
+ };
121
+
122
+ type TransferNfts = {
123
+ nftIds: string[];
124
+ recipientAddress: string;
125
+ walletAddress: string;
126
+ };
127
+
128
+ type UnlistListings = {
129
+ listingIds: string[];
130
+ walletAddress: string;
131
+ };
132
+
133
+ interface UpdateMultiBid {
134
+ walletAddress: string;
135
+ multiBidId?: string;
136
+ name?: string;
137
+ amount?: bigint;
138
+ amountToWithdraw?: bigint;
139
+ tx?: Transaction | string;
140
+ multiBidChainId?: any;
141
+ }
142
+
143
+ type WithdrawProfitsFromKiosks = {
144
+ walletAddress: string;
145
+ };
146
+
147
+ type ApplyNftStrategy = {
148
+ collectionId: string;
149
+ strategyFtType?: string;
150
+ tx?: Transaction;
151
+ };
152
+
153
+ type SwapCoins = {
154
+ walletAddress: string;
155
+ coinInType: string;
156
+ coinInAmount: string;
157
+ coinOutType: string;
158
+ slippage?: number;
159
+ ttl?: StringValue;
160
+ excludeSources?: Protocol[];
161
+ routes?: Array<Route<Coin, Coin>>;
162
+ commission?: Commission;
163
+ tx?: Transaction;
164
+ };
165
+ type SwapRoutesArgs = {
166
+ walletAddress: string;
167
+ coinInType: string;
168
+ coinOutType: string;
169
+ amountToSwap: bigint;
170
+ excludeSources?: Protocol[];
171
+ commission?: Commission;
172
+ };
173
+
174
+ type ApiConfig = {
175
+ apiUser: string;
176
+ apiKey: string;
177
+ apiUrl?: string;
178
+ defiRouterUrl?: string;
179
+ apiVercelId?: string;
180
+ suiNodeUrl?: string;
181
+ graphQLClient?: GraphQLClient;
182
+ };
183
+ declare class SuiTradingClient {
184
+ private readonly apiUser;
185
+ private readonly apiKey;
186
+ private readonly defiRouterUrl;
187
+ private readonly suiClient;
188
+ private readonly kioskClient;
189
+ private readonly allowedApiUsersForUnsharedKiosksMigration;
190
+ constructor({ apiUser, apiKey, apiVercelId, apiUrl, defiRouterUrl, suiNodeUrl, graphQLClient, }: ApiConfig);
191
+ buyListings({ listingIds, walletAddress, tx }: BuyListings): Promise<Transaction>;
192
+ listNfts({ nfts, walletAddress }: ListNfts): Promise<Transaction>;
193
+ unlistListings({ listingIds, walletAddress }: UnlistListings): Promise<Transaction>;
194
+ placeNftBids(data: PlaceNftBids): Promise<Transaction>;
195
+ removeNftBids({ bidIds, tx }: RemoveNftBids): Promise<Transaction>;
196
+ acceptNftBids({ bidIds, walletAddress }: AcceptNftBids): Promise<Transaction>;
197
+ placeCollectionBid({ collectionId, bidAmountInMist, numOfBids, walletAddress, multiBidId, multiBidChainId, expireAt, tx, }: PlaceCollectionBid): Promise<Transaction>;
198
+ acceptCollectionBid({ bidId, nftId, walletAddress }: AcceptCollectionBid): Promise<Transaction>;
199
+ removeCollectionBids({ bidIds, tx }: RemoveCollectionBids): Promise<Transaction>;
200
+ transferNfts({ nftIds, recipientAddress, walletAddress }: TransferNfts): Promise<Transaction>;
201
+ cancelNftTransfers({ nftIds, walletAddress }: CancelNftTransfers): Promise<Transaction>;
202
+ claimNfts({ nftIds, walletAddress }: ClaimNfts): Promise<Transaction>;
203
+ withdrawProfitsFromKiosks(args: WithdrawProfitsFromKiosks): Promise<Transaction>;
204
+ migrateNftsFromUnsharedToSharedKiosks(args: MigrateNftsFromUnsharedToSharedKiosks): Promise<Transaction>;
205
+ createMultiBid(args: CreateMultiBid): Promise<{
206
+ multiBidChainId: any;
207
+ tx: Transaction;
208
+ }>;
209
+ cancelMultiBid(args: CancelMultiBid): Promise<Transaction>;
210
+ updateMultiBid(args: UpdateMultiBid): Promise<Transaction>;
211
+ sponsorNftListing(args: SponsorNftListing): Promise<Transaction>;
212
+ applyFtStrategy(args: ApplyFtStrategy): Promise<Transaction>;
213
+ applyTradeportNftStrategy(args: ApplyNftStrategy): Promise<Transaction>;
214
+ swapCoins(args: SwapCoins): Promise<{
215
+ tx: Transaction;
216
+ coinOut: _mysten_sui_dist_cjs_transactions.TransactionResult;
217
+ }>;
218
+ buildSwapRoutes(args: SwapRoutesArgs): Promise<GetRoutesResult<Coin, Coin>>;
219
+ calculateAmountToSwap(args: Pick<SwapCoins, 'coinInType' | 'coinOutType' | 'coinInAmount'>): Promise<bigint>;
220
+ }
221
+
222
+ export { SuiTradingClient };