@tradeport/sui-trading-sdk 0.4.54 → 0.4.56

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/dist/index.d.mts CHANGED
@@ -1,6 +1,9 @@
1
+ import * as _mysten_sui_dist_cjs_transactions from '@mysten/sui/dist/cjs/transactions';
1
2
  import { Transaction } from '@mysten/sui/transactions';
2
3
  import { GraphQLClient } from 'graphql-request';
3
4
  import { KioskTransaction } from '@mysten/kiosk';
5
+ import { Protocol, Route, Coin, Commission, GetRoutesResult } from '@flowx-finance/sdk';
6
+ import { StringValue } from 'ms';
4
7
 
5
8
  type AcceptCollectionBid = {
6
9
  bidId: string;
@@ -16,24 +19,6 @@ type AcceptNftBids = {
16
19
  beforeResolveKioskTransferRequest?: (coin: any, transferRequest: any) => void | Promise<void>;
17
20
  };
18
21
 
19
- type BuyAndExerciseLongLocks = {
20
- walletAddress: string;
21
- locks: Array<{
22
- id: string;
23
- bidId?: string;
24
- }>;
25
- tx?: Transaction;
26
- };
27
-
28
- type BuyAndExerciseShortLocks = {
29
- walletAddress: string;
30
- locks: Array<{
31
- id: string;
32
- nftId: string;
33
- }>;
34
- tx?: Transaction;
35
- };
36
-
37
22
  type BuyListings = {
38
23
  listingIds: string[];
39
24
  walletAddress: string;
@@ -43,17 +28,6 @@ type BuyListings = {
43
28
  beforeResolveKioskTransferRequest?: (transferRequest: any) => void | Promise<void>;
44
29
  };
45
30
 
46
- type BuyLocks = {
47
- lockIds: string[];
48
- transaction?: Transaction;
49
- };
50
-
51
- type CancelLocks = {
52
- lockIds: string[];
53
- walletAddress: string;
54
- tx?: Transaction;
55
- };
56
-
57
31
  interface CancelMultiBid {
58
32
  walletAddress: string;
59
33
  multiBidId: string;
@@ -70,14 +44,6 @@ type ClaimNfts = {
70
44
  tx?: Transaction;
71
45
  };
72
46
 
73
- interface CreateLongLocks {
74
- walletAddress: string;
75
- nfts: Array<{
76
- id: string;
77
- priceInMist: number;
78
- }>;
79
- }
80
-
81
47
  interface CreateMultiBid {
82
48
  walletAddress: string;
83
49
  name?: string;
@@ -85,38 +51,12 @@ interface CreateMultiBid {
85
51
  tx?: Transaction | string;
86
52
  }
87
53
 
88
- interface CreateShortLocks {
89
- nfts: Array<{
90
- type: string;
91
- collectionId: string;
92
- priceInMist: number;
93
- }>;
94
- }
95
-
96
- type ExerciseLongLocks = {
97
- walletAddress: string;
98
- transaction?: Transaction;
99
- locks: Array<{
100
- id: string;
101
- bidId?: string;
102
- }>;
103
- };
104
-
105
- type ExerciseShortLocks = {
106
- walletAddress: string;
107
- transaction?: Transaction;
108
- locks: Array<{
109
- id: string;
110
- listingId?: string;
111
- nftId?: string;
112
- }>;
113
- };
114
-
115
54
  type SponsorNftListingOptions = {
116
55
  shouldSponsor?: boolean;
117
56
  numOfPeriods?: number;
118
57
  slippage?: number;
119
58
  coinInType?: string;
59
+ coinInAmount?: string;
120
60
  usdcFeeAmountPerPeriod?: number;
121
61
  };
122
62
  type SponsorNftListing = {
@@ -197,10 +137,32 @@ type WithdrawProfitsFromKiosks = {
197
137
  walletAddress: string;
198
138
  };
199
139
 
140
+ type SwapCoins = {
141
+ walletAddress: string;
142
+ coinInType: string;
143
+ coinInAmount: string;
144
+ coinOutType: string;
145
+ slippage?: number;
146
+ ttl?: StringValue;
147
+ excludeSources?: Protocol[];
148
+ routes?: Array<Route<Coin, Coin>>;
149
+ commission?: Commission;
150
+ tx?: Transaction;
151
+ };
152
+ type SwapRoutesArgs = {
153
+ walletAddress: string;
154
+ coinInType: string;
155
+ coinOutType: string;
156
+ amountToSwap: bigint;
157
+ excludeSources?: Protocol[];
158
+ commission?: Commission;
159
+ };
160
+
200
161
  type ApiConfig = {
201
162
  apiUser: string;
202
163
  apiKey: string;
203
164
  apiUrl?: string;
165
+ defiRouterUrl?: string;
204
166
  apiVercelId?: string;
205
167
  suiNodeUrl?: string;
206
168
  graphQLClient?: GraphQLClient;
@@ -208,10 +170,11 @@ type ApiConfig = {
208
170
  declare class SuiTradingClient {
209
171
  private readonly apiUser;
210
172
  private readonly apiKey;
173
+ private readonly defiRouterUrl;
211
174
  private readonly suiClient;
212
175
  private readonly kioskClient;
213
176
  private readonly allowedApiUsersForUnsharedKiosksMigration;
214
- constructor({ apiUser, apiKey, apiVercelId, apiUrl, suiNodeUrl, graphQLClient }: ApiConfig);
177
+ constructor({ apiUser, apiKey, apiVercelId, apiUrl, defiRouterUrl, suiNodeUrl, graphQLClient, }: ApiConfig);
215
178
  buyListings({ listingIds, walletAddress, tx }: BuyListings): Promise<Transaction>;
216
179
  listNfts({ nfts, walletAddress }: ListNfts): Promise<Transaction>;
217
180
  unlistListings({ listingIds, walletAddress }: UnlistListings): Promise<Transaction>;
@@ -224,14 +187,6 @@ declare class SuiTradingClient {
224
187
  transferNfts({ nftIds, recipientAddress, walletAddress }: TransferNfts): Promise<Transaction>;
225
188
  cancelNftTransfers({ nftIds, walletAddress }: CancelNftTransfers): Promise<Transaction>;
226
189
  claimNfts({ nftIds, walletAddress }: ClaimNfts): Promise<Transaction>;
227
- createLongLocks(args: CreateLongLocks): Promise<Transaction>;
228
- createShortLocks(args: CreateShortLocks): Promise<Transaction>;
229
- cancelLocks(args: CancelLocks): Promise<Transaction>;
230
- buyLocks(args: BuyLocks): Promise<Transaction>;
231
- exerciseLongLocks(args: ExerciseLongLocks): Promise<Transaction>;
232
- exerciseShortLocks(args: ExerciseShortLocks): Promise<Transaction>;
233
- buyAndExerciseLongLocks(args: BuyAndExerciseLongLocks): Promise<Transaction>;
234
- buyAndExerciseShortLocks(args: BuyAndExerciseShortLocks): Promise<Transaction>;
235
190
  withdrawProfitsFromKiosks(args: WithdrawProfitsFromKiosks): Promise<Transaction>;
236
191
  migrateNftsFromUnsharedToSharedKiosks(args: MigrateNftsFromUnsharedToSharedKiosks): Promise<Transaction>;
237
192
  createMultiBid(args: CreateMultiBid): Promise<{
@@ -241,6 +196,12 @@ declare class SuiTradingClient {
241
196
  cancelMultiBid(args: CancelMultiBid): Promise<Transaction>;
242
197
  updateMultiBid(args: UpdateMultiBid): Promise<Transaction>;
243
198
  sponsorNftListing(args: SponsorNftListing): Promise<Transaction>;
199
+ swapCoins(args: SwapCoins): Promise<{
200
+ tx: Transaction;
201
+ coinOut: _mysten_sui_dist_cjs_transactions.TransactionResult;
202
+ }>;
203
+ buildSwapRoutes(args: SwapRoutesArgs): Promise<GetRoutesResult<Coin, Coin>>;
204
+ calculateAmountToSwap(args: Pick<SwapCoins, 'coinInType' | 'coinOutType' | 'coinInAmount'>): Promise<bigint>;
244
205
  }
245
206
 
246
207
  export { SuiTradingClient };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,9 @@
1
+ import * as _mysten_sui_dist_cjs_transactions from '@mysten/sui/dist/cjs/transactions';
1
2
  import { Transaction } from '@mysten/sui/transactions';
2
3
  import { GraphQLClient } from 'graphql-request';
3
4
  import { KioskTransaction } from '@mysten/kiosk';
5
+ import { Protocol, Route, Coin, Commission, GetRoutesResult } from '@flowx-finance/sdk';
6
+ import { StringValue } from 'ms';
4
7
 
5
8
  type AcceptCollectionBid = {
6
9
  bidId: string;
@@ -16,24 +19,6 @@ type AcceptNftBids = {
16
19
  beforeResolveKioskTransferRequest?: (coin: any, transferRequest: any) => void | Promise<void>;
17
20
  };
18
21
 
19
- type BuyAndExerciseLongLocks = {
20
- walletAddress: string;
21
- locks: Array<{
22
- id: string;
23
- bidId?: string;
24
- }>;
25
- tx?: Transaction;
26
- };
27
-
28
- type BuyAndExerciseShortLocks = {
29
- walletAddress: string;
30
- locks: Array<{
31
- id: string;
32
- nftId: string;
33
- }>;
34
- tx?: Transaction;
35
- };
36
-
37
22
  type BuyListings = {
38
23
  listingIds: string[];
39
24
  walletAddress: string;
@@ -43,17 +28,6 @@ type BuyListings = {
43
28
  beforeResolveKioskTransferRequest?: (transferRequest: any) => void | Promise<void>;
44
29
  };
45
30
 
46
- type BuyLocks = {
47
- lockIds: string[];
48
- transaction?: Transaction;
49
- };
50
-
51
- type CancelLocks = {
52
- lockIds: string[];
53
- walletAddress: string;
54
- tx?: Transaction;
55
- };
56
-
57
31
  interface CancelMultiBid {
58
32
  walletAddress: string;
59
33
  multiBidId: string;
@@ -70,14 +44,6 @@ type ClaimNfts = {
70
44
  tx?: Transaction;
71
45
  };
72
46
 
73
- interface CreateLongLocks {
74
- walletAddress: string;
75
- nfts: Array<{
76
- id: string;
77
- priceInMist: number;
78
- }>;
79
- }
80
-
81
47
  interface CreateMultiBid {
82
48
  walletAddress: string;
83
49
  name?: string;
@@ -85,38 +51,12 @@ interface CreateMultiBid {
85
51
  tx?: Transaction | string;
86
52
  }
87
53
 
88
- interface CreateShortLocks {
89
- nfts: Array<{
90
- type: string;
91
- collectionId: string;
92
- priceInMist: number;
93
- }>;
94
- }
95
-
96
- type ExerciseLongLocks = {
97
- walletAddress: string;
98
- transaction?: Transaction;
99
- locks: Array<{
100
- id: string;
101
- bidId?: string;
102
- }>;
103
- };
104
-
105
- type ExerciseShortLocks = {
106
- walletAddress: string;
107
- transaction?: Transaction;
108
- locks: Array<{
109
- id: string;
110
- listingId?: string;
111
- nftId?: string;
112
- }>;
113
- };
114
-
115
54
  type SponsorNftListingOptions = {
116
55
  shouldSponsor?: boolean;
117
56
  numOfPeriods?: number;
118
57
  slippage?: number;
119
58
  coinInType?: string;
59
+ coinInAmount?: string;
120
60
  usdcFeeAmountPerPeriod?: number;
121
61
  };
122
62
  type SponsorNftListing = {
@@ -197,10 +137,32 @@ type WithdrawProfitsFromKiosks = {
197
137
  walletAddress: string;
198
138
  };
199
139
 
140
+ type SwapCoins = {
141
+ walletAddress: string;
142
+ coinInType: string;
143
+ coinInAmount: string;
144
+ coinOutType: string;
145
+ slippage?: number;
146
+ ttl?: StringValue;
147
+ excludeSources?: Protocol[];
148
+ routes?: Array<Route<Coin, Coin>>;
149
+ commission?: Commission;
150
+ tx?: Transaction;
151
+ };
152
+ type SwapRoutesArgs = {
153
+ walletAddress: string;
154
+ coinInType: string;
155
+ coinOutType: string;
156
+ amountToSwap: bigint;
157
+ excludeSources?: Protocol[];
158
+ commission?: Commission;
159
+ };
160
+
200
161
  type ApiConfig = {
201
162
  apiUser: string;
202
163
  apiKey: string;
203
164
  apiUrl?: string;
165
+ defiRouterUrl?: string;
204
166
  apiVercelId?: string;
205
167
  suiNodeUrl?: string;
206
168
  graphQLClient?: GraphQLClient;
@@ -208,10 +170,11 @@ type ApiConfig = {
208
170
  declare class SuiTradingClient {
209
171
  private readonly apiUser;
210
172
  private readonly apiKey;
173
+ private readonly defiRouterUrl;
211
174
  private readonly suiClient;
212
175
  private readonly kioskClient;
213
176
  private readonly allowedApiUsersForUnsharedKiosksMigration;
214
- constructor({ apiUser, apiKey, apiVercelId, apiUrl, suiNodeUrl, graphQLClient }: ApiConfig);
177
+ constructor({ apiUser, apiKey, apiVercelId, apiUrl, defiRouterUrl, suiNodeUrl, graphQLClient, }: ApiConfig);
215
178
  buyListings({ listingIds, walletAddress, tx }: BuyListings): Promise<Transaction>;
216
179
  listNfts({ nfts, walletAddress }: ListNfts): Promise<Transaction>;
217
180
  unlistListings({ listingIds, walletAddress }: UnlistListings): Promise<Transaction>;
@@ -224,14 +187,6 @@ declare class SuiTradingClient {
224
187
  transferNfts({ nftIds, recipientAddress, walletAddress }: TransferNfts): Promise<Transaction>;
225
188
  cancelNftTransfers({ nftIds, walletAddress }: CancelNftTransfers): Promise<Transaction>;
226
189
  claimNfts({ nftIds, walletAddress }: ClaimNfts): Promise<Transaction>;
227
- createLongLocks(args: CreateLongLocks): Promise<Transaction>;
228
- createShortLocks(args: CreateShortLocks): Promise<Transaction>;
229
- cancelLocks(args: CancelLocks): Promise<Transaction>;
230
- buyLocks(args: BuyLocks): Promise<Transaction>;
231
- exerciseLongLocks(args: ExerciseLongLocks): Promise<Transaction>;
232
- exerciseShortLocks(args: ExerciseShortLocks): Promise<Transaction>;
233
- buyAndExerciseLongLocks(args: BuyAndExerciseLongLocks): Promise<Transaction>;
234
- buyAndExerciseShortLocks(args: BuyAndExerciseShortLocks): Promise<Transaction>;
235
190
  withdrawProfitsFromKiosks(args: WithdrawProfitsFromKiosks): Promise<Transaction>;
236
191
  migrateNftsFromUnsharedToSharedKiosks(args: MigrateNftsFromUnsharedToSharedKiosks): Promise<Transaction>;
237
192
  createMultiBid(args: CreateMultiBid): Promise<{
@@ -241,6 +196,12 @@ declare class SuiTradingClient {
241
196
  cancelMultiBid(args: CancelMultiBid): Promise<Transaction>;
242
197
  updateMultiBid(args: UpdateMultiBid): Promise<Transaction>;
243
198
  sponsorNftListing(args: SponsorNftListing): Promise<Transaction>;
199
+ swapCoins(args: SwapCoins): Promise<{
200
+ tx: Transaction;
201
+ coinOut: _mysten_sui_dist_cjs_transactions.TransactionResult;
202
+ }>;
203
+ buildSwapRoutes(args: SwapRoutesArgs): Promise<GetRoutesResult<Coin, Coin>>;
204
+ calculateAmountToSwap(args: Pick<SwapCoins, 'coinInType' | 'coinOutType' | 'coinInAmount'>): Promise<bigint>;
244
205
  }
245
206
 
246
207
  export { SuiTradingClient };