@tradeport/sui-trading-sdk 0.4.64 → 0.4.65

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,5 @@
1
+ {
2
+ "permissions": {
3
+ "allow": ["Bash(xxd:*)", "Bash(pnpm tsc:*)", "Bash(npx tsc:*)"]
4
+ }
5
+ }
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;
@@ -23,16 +26,10 @@ type ApplyFtStrategy = {
23
26
  collectionChainState?: Record<string, unknown>;
24
27
  };
25
28
 
26
- type ApplyNftStrategy = {
27
- collectionId: string;
28
- strategyFtType?: string;
29
- tx?: Transaction;
30
- };
31
-
32
29
  type BuyListings = {
33
30
  listingIds: string[];
34
31
  walletAddress: string;
35
- tx?: Transaction;
32
+ tx?: Transaction | string;
36
33
  kioskTx?: KioskTransaction;
37
34
  coinToSplit?: any;
38
35
  beforeResolveKioskTransferRequest?: (transferRequest: any) => void | Promise<void>;
@@ -58,18 +55,20 @@ interface CreateMultiBid {
58
55
  walletAddress: string;
59
56
  name?: string;
60
57
  amount?: bigint;
61
- tx?: Transaction;
58
+ tx?: Transaction | string;
62
59
  }
63
60
 
64
61
  type SponsorNftListingOptions = {
65
62
  shouldSponsor?: boolean;
66
63
  numOfPeriods?: number;
64
+ slippage?: number;
65
+ coinInType?: string;
66
+ coinInAmount?: string;
67
67
  usdcFeeAmountPerPeriod?: number;
68
- coinToSplit?: any;
69
68
  };
70
69
  type SponsorNftListing = {
71
- tx?: Transaction;
72
70
  nftTokenId: string;
71
+ walletAddress: string;
73
72
  options: SponsorNftListingOptions;
74
73
  };
75
74
 
@@ -80,7 +79,6 @@ type ListNfts = {
80
79
  sponsorOptions?: SponsorNftListingOptions;
81
80
  }>;
82
81
  walletAddress: string;
83
- tx?: Transaction;
84
82
  };
85
83
 
86
84
  type MigrateNftsFromUnsharedToSharedKiosks = {
@@ -96,7 +94,7 @@ type PlaceCollectionBid = {
96
94
  multiBidId?: string;
97
95
  multiBidChainId?: any;
98
96
  expireAt?: Date;
99
- tx?: Transaction;
97
+ tx?: Transaction | string;
100
98
  };
101
99
 
102
100
  type PlaceNftBids = {
@@ -108,8 +106,7 @@ type PlaceNftBids = {
108
106
  walletAddress: string;
109
107
  multiBidId?: string;
110
108
  multiBidChainId?: any;
111
- tx?: Transaction;
112
- coinToSplit?: any;
109
+ tx?: Transaction | string;
113
110
  };
114
111
 
115
112
  type RemoveCollectionBids = {
@@ -139,20 +136,46 @@ interface UpdateMultiBid {
139
136
  name?: string;
140
137
  amount?: bigint;
141
138
  amountToWithdraw?: bigint;
142
- tx?: Transaction;
139
+ tx?: Transaction | string;
143
140
  multiBidChainId?: any;
144
- coinToSplit?: any;
145
141
  }
146
142
 
147
143
  type WithdrawProfitsFromKiosks = {
148
144
  walletAddress: string;
149
145
  };
150
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
+
151
174
  type ApiConfig = {
152
175
  apiUser: string;
153
176
  apiKey: string;
154
177
  apiUrl?: string;
155
- tradeportRouterUrl?: string;
178
+ defiRouterUrl?: string;
156
179
  apiVercelId?: string;
157
180
  suiNodeUrl?: string;
158
181
  graphQLClient?: GraphQLClient;
@@ -160,13 +183,13 @@ type ApiConfig = {
160
183
  declare class SuiTradingClient {
161
184
  private readonly apiUser;
162
185
  private readonly apiKey;
163
- private readonly tradeportRouterUrl?;
186
+ private readonly defiRouterUrl;
164
187
  private readonly suiClient;
165
188
  private readonly kioskClient;
166
189
  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>;
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>;
170
193
  unlistListings({ listingIds, walletAddress }: UnlistListings): Promise<Transaction>;
171
194
  placeNftBids(data: PlaceNftBids): Promise<Transaction>;
172
195
  removeNftBids({ bidIds, tx }: RemoveNftBids): Promise<Transaction>;
@@ -188,6 +211,12 @@ declare class SuiTradingClient {
188
211
  sponsorNftListing(args: SponsorNftListing): Promise<Transaction>;
189
212
  applyFtStrategy(args: ApplyFtStrategy): Promise<Transaction>;
190
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>;
191
220
  }
192
221
 
193
222
  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;
@@ -23,16 +26,10 @@ type ApplyFtStrategy = {
23
26
  collectionChainState?: Record<string, unknown>;
24
27
  };
25
28
 
26
- type ApplyNftStrategy = {
27
- collectionId: string;
28
- strategyFtType?: string;
29
- tx?: Transaction;
30
- };
31
-
32
29
  type BuyListings = {
33
30
  listingIds: string[];
34
31
  walletAddress: string;
35
- tx?: Transaction;
32
+ tx?: Transaction | string;
36
33
  kioskTx?: KioskTransaction;
37
34
  coinToSplit?: any;
38
35
  beforeResolveKioskTransferRequest?: (transferRequest: any) => void | Promise<void>;
@@ -58,18 +55,20 @@ interface CreateMultiBid {
58
55
  walletAddress: string;
59
56
  name?: string;
60
57
  amount?: bigint;
61
- tx?: Transaction;
58
+ tx?: Transaction | string;
62
59
  }
63
60
 
64
61
  type SponsorNftListingOptions = {
65
62
  shouldSponsor?: boolean;
66
63
  numOfPeriods?: number;
64
+ slippage?: number;
65
+ coinInType?: string;
66
+ coinInAmount?: string;
67
67
  usdcFeeAmountPerPeriod?: number;
68
- coinToSplit?: any;
69
68
  };
70
69
  type SponsorNftListing = {
71
- tx?: Transaction;
72
70
  nftTokenId: string;
71
+ walletAddress: string;
73
72
  options: SponsorNftListingOptions;
74
73
  };
75
74
 
@@ -80,7 +79,6 @@ type ListNfts = {
80
79
  sponsorOptions?: SponsorNftListingOptions;
81
80
  }>;
82
81
  walletAddress: string;
83
- tx?: Transaction;
84
82
  };
85
83
 
86
84
  type MigrateNftsFromUnsharedToSharedKiosks = {
@@ -96,7 +94,7 @@ type PlaceCollectionBid = {
96
94
  multiBidId?: string;
97
95
  multiBidChainId?: any;
98
96
  expireAt?: Date;
99
- tx?: Transaction;
97
+ tx?: Transaction | string;
100
98
  };
101
99
 
102
100
  type PlaceNftBids = {
@@ -108,8 +106,7 @@ type PlaceNftBids = {
108
106
  walletAddress: string;
109
107
  multiBidId?: string;
110
108
  multiBidChainId?: any;
111
- tx?: Transaction;
112
- coinToSplit?: any;
109
+ tx?: Transaction | string;
113
110
  };
114
111
 
115
112
  type RemoveCollectionBids = {
@@ -139,20 +136,46 @@ interface UpdateMultiBid {
139
136
  name?: string;
140
137
  amount?: bigint;
141
138
  amountToWithdraw?: bigint;
142
- tx?: Transaction;
139
+ tx?: Transaction | string;
143
140
  multiBidChainId?: any;
144
- coinToSplit?: any;
145
141
  }
146
142
 
147
143
  type WithdrawProfitsFromKiosks = {
148
144
  walletAddress: string;
149
145
  };
150
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
+
151
174
  type ApiConfig = {
152
175
  apiUser: string;
153
176
  apiKey: string;
154
177
  apiUrl?: string;
155
- tradeportRouterUrl?: string;
178
+ defiRouterUrl?: string;
156
179
  apiVercelId?: string;
157
180
  suiNodeUrl?: string;
158
181
  graphQLClient?: GraphQLClient;
@@ -160,13 +183,13 @@ type ApiConfig = {
160
183
  declare class SuiTradingClient {
161
184
  private readonly apiUser;
162
185
  private readonly apiKey;
163
- private readonly tradeportRouterUrl?;
186
+ private readonly defiRouterUrl;
164
187
  private readonly suiClient;
165
188
  private readonly kioskClient;
166
189
  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>;
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>;
170
193
  unlistListings({ listingIds, walletAddress }: UnlistListings): Promise<Transaction>;
171
194
  placeNftBids(data: PlaceNftBids): Promise<Transaction>;
172
195
  removeNftBids({ bidIds, tx }: RemoveNftBids): Promise<Transaction>;
@@ -188,6 +211,12 @@ declare class SuiTradingClient {
188
211
  sponsorNftListing(args: SponsorNftListing): Promise<Transaction>;
189
212
  applyFtStrategy(args: ApplyFtStrategy): Promise<Transaction>;
190
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>;
191
220
  }
192
221
 
193
222
  export { SuiTradingClient };