@tradeport/sui-trading-sdk 0.4.62 → 0.4.63
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 +22 -50
- package/dist/index.d.ts +22 -50
- package/dist/index.js +256 -627
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +249 -615
- package/dist/index.mjs.map +1 -1
- package/package.json +59 -61
- package/src/SuiTradingClient.ts +37 -65
- package/src/index.ts +0 -1
- package/src/methods/buyListings/buyListings.ts +4 -11
- package/src/methods/createMultiBid/createMultiBid.ts +3 -4
- package/src/methods/listNfts/listNfts.ts +8 -9
- package/src/methods/placeCollectionBids/placeCollectionBids.ts +14 -13
- package/src/methods/placeNftBids/placeNftBids.ts +6 -12
- package/src/methods/sponsorNftListing/addSponsorNftListingTx.ts +4 -36
- package/src/methods/sponsorNftListing/sponsorNftListing.ts +13 -15
- package/src/methods/updateMultiBid/updateMultiBid.ts +19 -15
- package/src/utils/addLeadingZerosAfter0x.ts +7 -0
- package/.claude/settings.local.json +0 -5
- package/src/helpers/deserializeOrCreateTxBlock.ts +0 -13
- package/src/helpers/extractSwapResultCoin.ts +0 -17
- package/src/methods/swapCoins/swapCoins.ts +0 -400
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import * as _mysten_sui_dist_cjs_transactions from '@mysten/sui/dist/cjs/transactions';
|
|
2
1
|
import { Transaction } from '@mysten/sui/transactions';
|
|
3
2
|
import { GraphQLClient } from 'graphql-request';
|
|
4
3
|
import { KioskTransaction } from '@mysten/kiosk';
|
|
5
|
-
import { Protocol, Route, Coin, Commission, GetRoutesResult } from '@flowx-finance/sdk';
|
|
6
|
-
import { StringValue } from 'ms';
|
|
7
4
|
|
|
8
5
|
type AcceptCollectionBid = {
|
|
9
6
|
bidId: string;
|
|
@@ -26,10 +23,16 @@ type ApplyFtStrategy = {
|
|
|
26
23
|
collectionChainState?: Record<string, unknown>;
|
|
27
24
|
};
|
|
28
25
|
|
|
26
|
+
type ApplyNftStrategy = {
|
|
27
|
+
collectionId: string;
|
|
28
|
+
strategyFtType?: string;
|
|
29
|
+
tx?: Transaction;
|
|
30
|
+
};
|
|
31
|
+
|
|
29
32
|
type BuyListings = {
|
|
30
33
|
listingIds: string[];
|
|
31
34
|
walletAddress: string;
|
|
32
|
-
tx?: Transaction
|
|
35
|
+
tx?: Transaction;
|
|
33
36
|
kioskTx?: KioskTransaction;
|
|
34
37
|
coinToSplit?: any;
|
|
35
38
|
beforeResolveKioskTransferRequest?: (transferRequest: any) => void | Promise<void>;
|
|
@@ -55,20 +58,19 @@ interface CreateMultiBid {
|
|
|
55
58
|
walletAddress: string;
|
|
56
59
|
name?: string;
|
|
57
60
|
amount?: bigint;
|
|
58
|
-
tx?: Transaction
|
|
61
|
+
tx?: Transaction;
|
|
59
62
|
}
|
|
60
63
|
|
|
61
64
|
type SponsorNftListingOptions = {
|
|
62
65
|
shouldSponsor?: boolean;
|
|
63
66
|
numOfPeriods?: number;
|
|
64
|
-
slippage?: number;
|
|
65
|
-
coinInType?: string;
|
|
66
|
-
coinInAmount?: string;
|
|
67
67
|
usdcFeeAmountPerPeriod?: number;
|
|
68
|
+
coinToSplit?: any;
|
|
68
69
|
};
|
|
69
70
|
type SponsorNftListing = {
|
|
71
|
+
tx?: Transaction;
|
|
72
|
+
coinToSplit?: any;
|
|
70
73
|
nftTokenId: string;
|
|
71
|
-
walletAddress: string;
|
|
72
74
|
options: SponsorNftListingOptions;
|
|
73
75
|
};
|
|
74
76
|
|
|
@@ -79,6 +81,7 @@ type ListNfts = {
|
|
|
79
81
|
sponsorOptions?: SponsorNftListingOptions;
|
|
80
82
|
}>;
|
|
81
83
|
walletAddress: string;
|
|
84
|
+
tx?: Transaction;
|
|
82
85
|
};
|
|
83
86
|
|
|
84
87
|
type MigrateNftsFromUnsharedToSharedKiosks = {
|
|
@@ -94,7 +97,7 @@ type PlaceCollectionBid = {
|
|
|
94
97
|
multiBidId?: string;
|
|
95
98
|
multiBidChainId?: any;
|
|
96
99
|
expireAt?: Date;
|
|
97
|
-
tx?: Transaction
|
|
100
|
+
tx?: Transaction;
|
|
98
101
|
};
|
|
99
102
|
|
|
100
103
|
type PlaceNftBids = {
|
|
@@ -106,7 +109,8 @@ type PlaceNftBids = {
|
|
|
106
109
|
walletAddress: string;
|
|
107
110
|
multiBidId?: string;
|
|
108
111
|
multiBidChainId?: any;
|
|
109
|
-
tx?: Transaction
|
|
112
|
+
tx?: Transaction;
|
|
113
|
+
coinToSplit?: any;
|
|
110
114
|
};
|
|
111
115
|
|
|
112
116
|
type RemoveCollectionBids = {
|
|
@@ -136,46 +140,20 @@ interface UpdateMultiBid {
|
|
|
136
140
|
name?: string;
|
|
137
141
|
amount?: bigint;
|
|
138
142
|
amountToWithdraw?: bigint;
|
|
139
|
-
tx?: Transaction
|
|
143
|
+
tx?: Transaction;
|
|
140
144
|
multiBidChainId?: any;
|
|
145
|
+
coinToSplit?: any;
|
|
141
146
|
}
|
|
142
147
|
|
|
143
148
|
type WithdrawProfitsFromKiosks = {
|
|
144
149
|
walletAddress: string;
|
|
145
150
|
};
|
|
146
151
|
|
|
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
152
|
type ApiConfig = {
|
|
175
153
|
apiUser: string;
|
|
176
154
|
apiKey: string;
|
|
177
155
|
apiUrl?: string;
|
|
178
|
-
|
|
156
|
+
tradeportRouterUrl?: string;
|
|
179
157
|
apiVercelId?: string;
|
|
180
158
|
suiNodeUrl?: string;
|
|
181
159
|
graphQLClient?: GraphQLClient;
|
|
@@ -183,13 +161,13 @@ type ApiConfig = {
|
|
|
183
161
|
declare class SuiTradingClient {
|
|
184
162
|
private readonly apiUser;
|
|
185
163
|
private readonly apiKey;
|
|
186
|
-
private readonly
|
|
164
|
+
private readonly tradeportRouterUrl?;
|
|
187
165
|
private readonly suiClient;
|
|
188
166
|
private readonly kioskClient;
|
|
189
167
|
private readonly allowedApiUsersForUnsharedKiosksMigration;
|
|
190
|
-
constructor({ apiUser, apiKey, apiVercelId, apiUrl,
|
|
191
|
-
buyListings(
|
|
192
|
-
listNfts({ nfts, walletAddress }: ListNfts): Promise<Transaction>;
|
|
168
|
+
constructor({ apiUser, apiKey, apiVercelId, apiUrl, tradeportRouterUrl, suiNodeUrl, graphQLClient, }: ApiConfig);
|
|
169
|
+
buyListings(args: BuyListings): Promise<Transaction>;
|
|
170
|
+
listNfts({ nfts, walletAddress, tx }: ListNfts): Promise<Transaction>;
|
|
193
171
|
unlistListings({ listingIds, walletAddress }: UnlistListings): Promise<Transaction>;
|
|
194
172
|
placeNftBids(data: PlaceNftBids): Promise<Transaction>;
|
|
195
173
|
removeNftBids({ bidIds, tx }: RemoveNftBids): Promise<Transaction>;
|
|
@@ -211,12 +189,6 @@ declare class SuiTradingClient {
|
|
|
211
189
|
sponsorNftListing(args: SponsorNftListing): Promise<Transaction>;
|
|
212
190
|
applyFtStrategy(args: ApplyFtStrategy): Promise<Transaction>;
|
|
213
191
|
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
192
|
}
|
|
221
193
|
|
|
222
194
|
export { SuiTradingClient };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import * as _mysten_sui_dist_cjs_transactions from '@mysten/sui/dist/cjs/transactions';
|
|
2
1
|
import { Transaction } from '@mysten/sui/transactions';
|
|
3
2
|
import { GraphQLClient } from 'graphql-request';
|
|
4
3
|
import { KioskTransaction } from '@mysten/kiosk';
|
|
5
|
-
import { Protocol, Route, Coin, Commission, GetRoutesResult } from '@flowx-finance/sdk';
|
|
6
|
-
import { StringValue } from 'ms';
|
|
7
4
|
|
|
8
5
|
type AcceptCollectionBid = {
|
|
9
6
|
bidId: string;
|
|
@@ -26,10 +23,16 @@ type ApplyFtStrategy = {
|
|
|
26
23
|
collectionChainState?: Record<string, unknown>;
|
|
27
24
|
};
|
|
28
25
|
|
|
26
|
+
type ApplyNftStrategy = {
|
|
27
|
+
collectionId: string;
|
|
28
|
+
strategyFtType?: string;
|
|
29
|
+
tx?: Transaction;
|
|
30
|
+
};
|
|
31
|
+
|
|
29
32
|
type BuyListings = {
|
|
30
33
|
listingIds: string[];
|
|
31
34
|
walletAddress: string;
|
|
32
|
-
tx?: Transaction
|
|
35
|
+
tx?: Transaction;
|
|
33
36
|
kioskTx?: KioskTransaction;
|
|
34
37
|
coinToSplit?: any;
|
|
35
38
|
beforeResolveKioskTransferRequest?: (transferRequest: any) => void | Promise<void>;
|
|
@@ -55,20 +58,19 @@ interface CreateMultiBid {
|
|
|
55
58
|
walletAddress: string;
|
|
56
59
|
name?: string;
|
|
57
60
|
amount?: bigint;
|
|
58
|
-
tx?: Transaction
|
|
61
|
+
tx?: Transaction;
|
|
59
62
|
}
|
|
60
63
|
|
|
61
64
|
type SponsorNftListingOptions = {
|
|
62
65
|
shouldSponsor?: boolean;
|
|
63
66
|
numOfPeriods?: number;
|
|
64
|
-
slippage?: number;
|
|
65
|
-
coinInType?: string;
|
|
66
|
-
coinInAmount?: string;
|
|
67
67
|
usdcFeeAmountPerPeriod?: number;
|
|
68
|
+
coinToSplit?: any;
|
|
68
69
|
};
|
|
69
70
|
type SponsorNftListing = {
|
|
71
|
+
tx?: Transaction;
|
|
72
|
+
coinToSplit?: any;
|
|
70
73
|
nftTokenId: string;
|
|
71
|
-
walletAddress: string;
|
|
72
74
|
options: SponsorNftListingOptions;
|
|
73
75
|
};
|
|
74
76
|
|
|
@@ -79,6 +81,7 @@ type ListNfts = {
|
|
|
79
81
|
sponsorOptions?: SponsorNftListingOptions;
|
|
80
82
|
}>;
|
|
81
83
|
walletAddress: string;
|
|
84
|
+
tx?: Transaction;
|
|
82
85
|
};
|
|
83
86
|
|
|
84
87
|
type MigrateNftsFromUnsharedToSharedKiosks = {
|
|
@@ -94,7 +97,7 @@ type PlaceCollectionBid = {
|
|
|
94
97
|
multiBidId?: string;
|
|
95
98
|
multiBidChainId?: any;
|
|
96
99
|
expireAt?: Date;
|
|
97
|
-
tx?: Transaction
|
|
100
|
+
tx?: Transaction;
|
|
98
101
|
};
|
|
99
102
|
|
|
100
103
|
type PlaceNftBids = {
|
|
@@ -106,7 +109,8 @@ type PlaceNftBids = {
|
|
|
106
109
|
walletAddress: string;
|
|
107
110
|
multiBidId?: string;
|
|
108
111
|
multiBidChainId?: any;
|
|
109
|
-
tx?: Transaction
|
|
112
|
+
tx?: Transaction;
|
|
113
|
+
coinToSplit?: any;
|
|
110
114
|
};
|
|
111
115
|
|
|
112
116
|
type RemoveCollectionBids = {
|
|
@@ -136,46 +140,20 @@ interface UpdateMultiBid {
|
|
|
136
140
|
name?: string;
|
|
137
141
|
amount?: bigint;
|
|
138
142
|
amountToWithdraw?: bigint;
|
|
139
|
-
tx?: Transaction
|
|
143
|
+
tx?: Transaction;
|
|
140
144
|
multiBidChainId?: any;
|
|
145
|
+
coinToSplit?: any;
|
|
141
146
|
}
|
|
142
147
|
|
|
143
148
|
type WithdrawProfitsFromKiosks = {
|
|
144
149
|
walletAddress: string;
|
|
145
150
|
};
|
|
146
151
|
|
|
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
152
|
type ApiConfig = {
|
|
175
153
|
apiUser: string;
|
|
176
154
|
apiKey: string;
|
|
177
155
|
apiUrl?: string;
|
|
178
|
-
|
|
156
|
+
tradeportRouterUrl?: string;
|
|
179
157
|
apiVercelId?: string;
|
|
180
158
|
suiNodeUrl?: string;
|
|
181
159
|
graphQLClient?: GraphQLClient;
|
|
@@ -183,13 +161,13 @@ type ApiConfig = {
|
|
|
183
161
|
declare class SuiTradingClient {
|
|
184
162
|
private readonly apiUser;
|
|
185
163
|
private readonly apiKey;
|
|
186
|
-
private readonly
|
|
164
|
+
private readonly tradeportRouterUrl?;
|
|
187
165
|
private readonly suiClient;
|
|
188
166
|
private readonly kioskClient;
|
|
189
167
|
private readonly allowedApiUsersForUnsharedKiosksMigration;
|
|
190
|
-
constructor({ apiUser, apiKey, apiVercelId, apiUrl,
|
|
191
|
-
buyListings(
|
|
192
|
-
listNfts({ nfts, walletAddress }: ListNfts): Promise<Transaction>;
|
|
168
|
+
constructor({ apiUser, apiKey, apiVercelId, apiUrl, tradeportRouterUrl, suiNodeUrl, graphQLClient, }: ApiConfig);
|
|
169
|
+
buyListings(args: BuyListings): Promise<Transaction>;
|
|
170
|
+
listNfts({ nfts, walletAddress, tx }: ListNfts): Promise<Transaction>;
|
|
193
171
|
unlistListings({ listingIds, walletAddress }: UnlistListings): Promise<Transaction>;
|
|
194
172
|
placeNftBids(data: PlaceNftBids): Promise<Transaction>;
|
|
195
173
|
removeNftBids({ bidIds, tx }: RemoveNftBids): Promise<Transaction>;
|
|
@@ -211,12 +189,6 @@ declare class SuiTradingClient {
|
|
|
211
189
|
sponsorNftListing(args: SponsorNftListing): Promise<Transaction>;
|
|
212
190
|
applyFtStrategy(args: ApplyFtStrategy): Promise<Transaction>;
|
|
213
191
|
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
192
|
}
|
|
221
193
|
|
|
222
194
|
export { SuiTradingClient };
|