@tradeport/sui-trading-sdk 0.4.63 → 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,19 +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
- coinToSplit?: any;
73
70
  nftTokenId: string;
71
+ walletAddress: string;
74
72
  options: SponsorNftListingOptions;
75
73
  };
76
74
 
@@ -81,7 +79,6 @@ type ListNfts = {
81
79
  sponsorOptions?: SponsorNftListingOptions;
82
80
  }>;
83
81
  walletAddress: string;
84
- tx?: Transaction;
85
82
  };
86
83
 
87
84
  type MigrateNftsFromUnsharedToSharedKiosks = {
@@ -97,7 +94,7 @@ type PlaceCollectionBid = {
97
94
  multiBidId?: string;
98
95
  multiBidChainId?: any;
99
96
  expireAt?: Date;
100
- tx?: Transaction;
97
+ tx?: Transaction | string;
101
98
  };
102
99
 
103
100
  type PlaceNftBids = {
@@ -109,8 +106,7 @@ type PlaceNftBids = {
109
106
  walletAddress: string;
110
107
  multiBidId?: string;
111
108
  multiBidChainId?: any;
112
- tx?: Transaction;
113
- coinToSplit?: any;
109
+ tx?: Transaction | string;
114
110
  };
115
111
 
116
112
  type RemoveCollectionBids = {
@@ -140,20 +136,46 @@ interface UpdateMultiBid {
140
136
  name?: string;
141
137
  amount?: bigint;
142
138
  amountToWithdraw?: bigint;
143
- tx?: Transaction;
139
+ tx?: Transaction | string;
144
140
  multiBidChainId?: any;
145
- coinToSplit?: any;
146
141
  }
147
142
 
148
143
  type WithdrawProfitsFromKiosks = {
149
144
  walletAddress: string;
150
145
  };
151
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
+
152
174
  type ApiConfig = {
153
175
  apiUser: string;
154
176
  apiKey: string;
155
177
  apiUrl?: string;
156
- tradeportRouterUrl?: string;
178
+ defiRouterUrl?: string;
157
179
  apiVercelId?: string;
158
180
  suiNodeUrl?: string;
159
181
  graphQLClient?: GraphQLClient;
@@ -161,13 +183,13 @@ type ApiConfig = {
161
183
  declare class SuiTradingClient {
162
184
  private readonly apiUser;
163
185
  private readonly apiKey;
164
- private readonly tradeportRouterUrl?;
186
+ private readonly defiRouterUrl;
165
187
  private readonly suiClient;
166
188
  private readonly kioskClient;
167
189
  private readonly allowedApiUsersForUnsharedKiosksMigration;
168
- constructor({ apiUser, apiKey, apiVercelId, apiUrl, tradeportRouterUrl, suiNodeUrl, graphQLClient, }: ApiConfig);
169
- buyListings(args: BuyListings): Promise<Transaction>;
170
- 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>;
171
193
  unlistListings({ listingIds, walletAddress }: UnlistListings): Promise<Transaction>;
172
194
  placeNftBids(data: PlaceNftBids): Promise<Transaction>;
173
195
  removeNftBids({ bidIds, tx }: RemoveNftBids): Promise<Transaction>;
@@ -189,6 +211,12 @@ declare class SuiTradingClient {
189
211
  sponsorNftListing(args: SponsorNftListing): Promise<Transaction>;
190
212
  applyFtStrategy(args: ApplyFtStrategy): Promise<Transaction>;
191
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>;
192
220
  }
193
221
 
194
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,19 +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
- coinToSplit?: any;
73
70
  nftTokenId: string;
71
+ walletAddress: string;
74
72
  options: SponsorNftListingOptions;
75
73
  };
76
74
 
@@ -81,7 +79,6 @@ type ListNfts = {
81
79
  sponsorOptions?: SponsorNftListingOptions;
82
80
  }>;
83
81
  walletAddress: string;
84
- tx?: Transaction;
85
82
  };
86
83
 
87
84
  type MigrateNftsFromUnsharedToSharedKiosks = {
@@ -97,7 +94,7 @@ type PlaceCollectionBid = {
97
94
  multiBidId?: string;
98
95
  multiBidChainId?: any;
99
96
  expireAt?: Date;
100
- tx?: Transaction;
97
+ tx?: Transaction | string;
101
98
  };
102
99
 
103
100
  type PlaceNftBids = {
@@ -109,8 +106,7 @@ type PlaceNftBids = {
109
106
  walletAddress: string;
110
107
  multiBidId?: string;
111
108
  multiBidChainId?: any;
112
- tx?: Transaction;
113
- coinToSplit?: any;
109
+ tx?: Transaction | string;
114
110
  };
115
111
 
116
112
  type RemoveCollectionBids = {
@@ -140,20 +136,46 @@ interface UpdateMultiBid {
140
136
  name?: string;
141
137
  amount?: bigint;
142
138
  amountToWithdraw?: bigint;
143
- tx?: Transaction;
139
+ tx?: Transaction | string;
144
140
  multiBidChainId?: any;
145
- coinToSplit?: any;
146
141
  }
147
142
 
148
143
  type WithdrawProfitsFromKiosks = {
149
144
  walletAddress: string;
150
145
  };
151
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
+
152
174
  type ApiConfig = {
153
175
  apiUser: string;
154
176
  apiKey: string;
155
177
  apiUrl?: string;
156
- tradeportRouterUrl?: string;
178
+ defiRouterUrl?: string;
157
179
  apiVercelId?: string;
158
180
  suiNodeUrl?: string;
159
181
  graphQLClient?: GraphQLClient;
@@ -161,13 +183,13 @@ type ApiConfig = {
161
183
  declare class SuiTradingClient {
162
184
  private readonly apiUser;
163
185
  private readonly apiKey;
164
- private readonly tradeportRouterUrl?;
186
+ private readonly defiRouterUrl;
165
187
  private readonly suiClient;
166
188
  private readonly kioskClient;
167
189
  private readonly allowedApiUsersForUnsharedKiosksMigration;
168
- constructor({ apiUser, apiKey, apiVercelId, apiUrl, tradeportRouterUrl, suiNodeUrl, graphQLClient, }: ApiConfig);
169
- buyListings(args: BuyListings): Promise<Transaction>;
170
- 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>;
171
193
  unlistListings({ listingIds, walletAddress }: UnlistListings): Promise<Transaction>;
172
194
  placeNftBids(data: PlaceNftBids): Promise<Transaction>;
173
195
  removeNftBids({ bidIds, tx }: RemoveNftBids): Promise<Transaction>;
@@ -189,6 +211,12 @@ declare class SuiTradingClient {
189
211
  sponsorNftListing(args: SponsorNftListing): Promise<Transaction>;
190
212
  applyFtStrategy(args: ApplyFtStrategy): Promise<Transaction>;
191
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>;
192
220
  }
193
221
 
194
222
  export { SuiTradingClient };