@tradeport/sui-trading-sdk 0.4.53 → 0.4.55

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,33 +51,6 @@ 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;
@@ -197,10 +136,32 @@ type WithdrawProfitsFromKiosks = {
197
136
  walletAddress: string;
198
137
  };
199
138
 
139
+ type SwapCoins = {
140
+ walletAddress: string;
141
+ coinInType: string;
142
+ coinInAmount: string;
143
+ coinOutType: string;
144
+ slippage?: number;
145
+ ttl?: StringValue;
146
+ excludeSources?: Protocol[];
147
+ routes?: Array<Route<Coin, Coin>>;
148
+ commission?: Commission;
149
+ tx?: Transaction;
150
+ };
151
+ type SwapRoutesArgs = {
152
+ walletAddress: string;
153
+ coinInType: string;
154
+ coinOutType: string;
155
+ amountToSwap: bigint;
156
+ excludeSources?: Protocol[];
157
+ commission?: Commission;
158
+ };
159
+
200
160
  type ApiConfig = {
201
161
  apiUser: string;
202
162
  apiKey: string;
203
163
  apiUrl?: string;
164
+ defiRouterUrl?: string;
204
165
  apiVercelId?: string;
205
166
  suiNodeUrl?: string;
206
167
  graphQLClient?: GraphQLClient;
@@ -208,10 +169,11 @@ type ApiConfig = {
208
169
  declare class SuiTradingClient {
209
170
  private readonly apiUser;
210
171
  private readonly apiKey;
172
+ private readonly defiRouterUrl;
211
173
  private readonly suiClient;
212
174
  private readonly kioskClient;
213
175
  private readonly allowedApiUsersForUnsharedKiosksMigration;
214
- constructor({ apiUser, apiKey, apiVercelId, apiUrl, suiNodeUrl, graphQLClient }: ApiConfig);
176
+ constructor({ apiUser, apiKey, apiVercelId, apiUrl, defiRouterUrl, suiNodeUrl, graphQLClient, }: ApiConfig);
215
177
  buyListings({ listingIds, walletAddress, tx }: BuyListings): Promise<Transaction>;
216
178
  listNfts({ nfts, walletAddress }: ListNfts): Promise<Transaction>;
217
179
  unlistListings({ listingIds, walletAddress }: UnlistListings): Promise<Transaction>;
@@ -224,14 +186,6 @@ declare class SuiTradingClient {
224
186
  transferNfts({ nftIds, recipientAddress, walletAddress }: TransferNfts): Promise<Transaction>;
225
187
  cancelNftTransfers({ nftIds, walletAddress }: CancelNftTransfers): Promise<Transaction>;
226
188
  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
189
  withdrawProfitsFromKiosks(args: WithdrawProfitsFromKiosks): Promise<Transaction>;
236
190
  migrateNftsFromUnsharedToSharedKiosks(args: MigrateNftsFromUnsharedToSharedKiosks): Promise<Transaction>;
237
191
  createMultiBid(args: CreateMultiBid): Promise<{
@@ -241,6 +195,12 @@ declare class SuiTradingClient {
241
195
  cancelMultiBid(args: CancelMultiBid): Promise<Transaction>;
242
196
  updateMultiBid(args: UpdateMultiBid): Promise<Transaction>;
243
197
  sponsorNftListing(args: SponsorNftListing): Promise<Transaction>;
198
+ swapCoins(args: SwapCoins): Promise<{
199
+ tx: Transaction;
200
+ coinOut: _mysten_sui_dist_cjs_transactions.TransactionResult;
201
+ }>;
202
+ buildSwapRoutes(args: SwapRoutesArgs): Promise<GetRoutesResult<Coin, Coin>>;
203
+ calculateAmountToSwap(args: Pick<SwapCoins, 'coinInType' | 'coinOutType' | 'coinInAmount'>): Promise<bigint>;
244
204
  }
245
205
 
246
206
  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,33 +51,6 @@ 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;
@@ -197,10 +136,32 @@ type WithdrawProfitsFromKiosks = {
197
136
  walletAddress: string;
198
137
  };
199
138
 
139
+ type SwapCoins = {
140
+ walletAddress: string;
141
+ coinInType: string;
142
+ coinInAmount: string;
143
+ coinOutType: string;
144
+ slippage?: number;
145
+ ttl?: StringValue;
146
+ excludeSources?: Protocol[];
147
+ routes?: Array<Route<Coin, Coin>>;
148
+ commission?: Commission;
149
+ tx?: Transaction;
150
+ };
151
+ type SwapRoutesArgs = {
152
+ walletAddress: string;
153
+ coinInType: string;
154
+ coinOutType: string;
155
+ amountToSwap: bigint;
156
+ excludeSources?: Protocol[];
157
+ commission?: Commission;
158
+ };
159
+
200
160
  type ApiConfig = {
201
161
  apiUser: string;
202
162
  apiKey: string;
203
163
  apiUrl?: string;
164
+ defiRouterUrl?: string;
204
165
  apiVercelId?: string;
205
166
  suiNodeUrl?: string;
206
167
  graphQLClient?: GraphQLClient;
@@ -208,10 +169,11 @@ type ApiConfig = {
208
169
  declare class SuiTradingClient {
209
170
  private readonly apiUser;
210
171
  private readonly apiKey;
172
+ private readonly defiRouterUrl;
211
173
  private readonly suiClient;
212
174
  private readonly kioskClient;
213
175
  private readonly allowedApiUsersForUnsharedKiosksMigration;
214
- constructor({ apiUser, apiKey, apiVercelId, apiUrl, suiNodeUrl, graphQLClient }: ApiConfig);
176
+ constructor({ apiUser, apiKey, apiVercelId, apiUrl, defiRouterUrl, suiNodeUrl, graphQLClient, }: ApiConfig);
215
177
  buyListings({ listingIds, walletAddress, tx }: BuyListings): Promise<Transaction>;
216
178
  listNfts({ nfts, walletAddress }: ListNfts): Promise<Transaction>;
217
179
  unlistListings({ listingIds, walletAddress }: UnlistListings): Promise<Transaction>;
@@ -224,14 +186,6 @@ declare class SuiTradingClient {
224
186
  transferNfts({ nftIds, recipientAddress, walletAddress }: TransferNfts): Promise<Transaction>;
225
187
  cancelNftTransfers({ nftIds, walletAddress }: CancelNftTransfers): Promise<Transaction>;
226
188
  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
189
  withdrawProfitsFromKiosks(args: WithdrawProfitsFromKiosks): Promise<Transaction>;
236
190
  migrateNftsFromUnsharedToSharedKiosks(args: MigrateNftsFromUnsharedToSharedKiosks): Promise<Transaction>;
237
191
  createMultiBid(args: CreateMultiBid): Promise<{
@@ -241,6 +195,12 @@ declare class SuiTradingClient {
241
195
  cancelMultiBid(args: CancelMultiBid): Promise<Transaction>;
242
196
  updateMultiBid(args: UpdateMultiBid): Promise<Transaction>;
243
197
  sponsorNftListing(args: SponsorNftListing): Promise<Transaction>;
198
+ swapCoins(args: SwapCoins): Promise<{
199
+ tx: Transaction;
200
+ coinOut: _mysten_sui_dist_cjs_transactions.TransactionResult;
201
+ }>;
202
+ buildSwapRoutes(args: SwapRoutesArgs): Promise<GetRoutesResult<Coin, Coin>>;
203
+ calculateAmountToSwap(args: Pick<SwapCoins, 'coinInType' | 'coinOutType' | 'coinInAmount'>): Promise<bigint>;
244
204
  }
245
205
 
246
206
  export { SuiTradingClient };