@msafe/sui-app-store 0.0.337 → 0.0.338
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 +641 -22
- package/dist/index.d.ts +641 -22
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PoolName } from '@alphafi/alphafi-sdk';
|
|
2
|
+
import { SuiAddress, TransactionType, CreateStreamIntentionData, SetAutoClaimIntentionData, ClaimStreamIntentionData, ClaimByProxyStreamIntentionData, CancelStreamIntentionData } from '@msafe/sui3-utils';
|
|
3
|
+
import { NumStr } from '@firefly-exchange/library-sui';
|
|
4
|
+
import { Pool, NFT, Trade } from 'turbos-clmm-sdk';
|
|
2
5
|
import { Transaction } from '@mysten/sui/transactions';
|
|
3
6
|
import { SuiSignTransactionBlockInput, WalletAccount, IdentifierString } from '@mysten/wallet-standard';
|
|
4
7
|
import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
|
|
@@ -6,12 +9,219 @@ import { SuiGrpcClient } from '@mysten/sui/grpc';
|
|
|
6
9
|
import { SuiClient } from '@mysten/sui.js/client';
|
|
7
10
|
import { TransactionBlock } from '@mysten/sui.js/transactions';
|
|
8
11
|
|
|
12
|
+
type AlphaFiIntentionData = DepositDoubleAssetIntentionData | DepositSingleAssetIntentionData | WithdrawAlphaIntentionData | WithdrawIntentionData$2 | EmptyIntentionData;
|
|
13
|
+
interface EmptyIntentionData {
|
|
14
|
+
}
|
|
15
|
+
interface DepositDoubleAssetIntentionData {
|
|
16
|
+
poolName: PoolName;
|
|
17
|
+
amount: string;
|
|
18
|
+
isAmountA: boolean;
|
|
19
|
+
}
|
|
20
|
+
interface DepositSingleAssetIntentionData {
|
|
21
|
+
poolName: PoolName;
|
|
22
|
+
amount: string;
|
|
23
|
+
}
|
|
24
|
+
interface WithdrawIntentionData$2 {
|
|
25
|
+
xTokensAmount: string;
|
|
26
|
+
poolName: PoolName;
|
|
27
|
+
}
|
|
28
|
+
interface WithdrawAlphaIntentionData {
|
|
29
|
+
xTokensAmount: string;
|
|
30
|
+
withdrawFromLocked: boolean;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface Token {
|
|
34
|
+
address: string;
|
|
35
|
+
name: string;
|
|
36
|
+
symbol: string;
|
|
37
|
+
decimals: number;
|
|
38
|
+
logoURI: string;
|
|
39
|
+
totalSupply: string;
|
|
40
|
+
circulatingSupply: string;
|
|
41
|
+
isVerified: boolean;
|
|
42
|
+
hasBluefinPools: boolean;
|
|
43
|
+
rfqSupported: boolean;
|
|
44
|
+
}
|
|
45
|
+
type FeeTokens = [string, string];
|
|
46
|
+
type RewardTokens = Array<string>;
|
|
47
|
+
type CollectTokens = {
|
|
48
|
+
collectFeeTokens: FeeTokens;
|
|
49
|
+
collectRewardTokens: RewardTokens;
|
|
50
|
+
};
|
|
51
|
+
type OpenPositionIntentionData = {
|
|
52
|
+
pool: SuiAddress;
|
|
53
|
+
lowerTick: number;
|
|
54
|
+
upperTick: number;
|
|
55
|
+
tokenAmount: string;
|
|
56
|
+
maxAmountTokenA: string;
|
|
57
|
+
maxAmountTokenB: string;
|
|
58
|
+
isTokenAFixed: boolean;
|
|
59
|
+
};
|
|
60
|
+
type ClosePositionIntentionData = {
|
|
61
|
+
pool: SuiAddress;
|
|
62
|
+
position: SuiAddress;
|
|
63
|
+
transferTokensTo?: SuiAddress;
|
|
64
|
+
} & CollectTokens;
|
|
65
|
+
type ProvideLiquidityIntentionData = {
|
|
66
|
+
pool: SuiAddress;
|
|
67
|
+
position: SuiAddress;
|
|
68
|
+
lowerTick: number;
|
|
69
|
+
upperTick: number;
|
|
70
|
+
tokenAmount: string;
|
|
71
|
+
maxAmountTokenA: string;
|
|
72
|
+
maxAmountTokenB: string;
|
|
73
|
+
isTokenAFixed: boolean;
|
|
74
|
+
};
|
|
75
|
+
type RemoveLiquidityIntentionData$1 = {
|
|
76
|
+
pool: SuiAddress;
|
|
77
|
+
position: SuiAddress;
|
|
78
|
+
liquidity: string;
|
|
79
|
+
maxAmountTokenA: string;
|
|
80
|
+
maxAmountTokenB: string;
|
|
81
|
+
transferTokensTo?: SuiAddress;
|
|
82
|
+
} & CollectTokens;
|
|
83
|
+
type CollectRewardsAndFeeIntentionData = {
|
|
84
|
+
pool: SuiAddress;
|
|
85
|
+
position: SuiAddress;
|
|
86
|
+
} & CollectTokens;
|
|
87
|
+
type CollectRewardsIntentionData = {
|
|
88
|
+
pool: SuiAddress;
|
|
89
|
+
position: SuiAddress;
|
|
90
|
+
collectRewardTokens: RewardTokens;
|
|
91
|
+
};
|
|
92
|
+
type CollectFeeIntentionData$1 = {
|
|
93
|
+
pool: SuiAddress;
|
|
94
|
+
position: SuiAddress;
|
|
95
|
+
collectFeeTokens: FeeTokens;
|
|
96
|
+
};
|
|
97
|
+
type Aggregator7KSwapIntentionData = {
|
|
98
|
+
tokenIn: Token | undefined;
|
|
99
|
+
tokenOut: Token | undefined;
|
|
100
|
+
amountIn: string;
|
|
101
|
+
maxSlippage: string;
|
|
102
|
+
};
|
|
103
|
+
type BluefinIntentionData = OpenPositionIntentionData | ClosePositionIntentionData | ProvideLiquidityIntentionData | RemoveLiquidityIntentionData$1 | CollectRewardsIntentionData | CollectFeeIntentionData$1 | CollectRewardsAndFeeIntentionData | Aggregator7KSwapIntentionData;
|
|
104
|
+
|
|
9
105
|
type SuiNetworks = 'sui:devnet' | 'sui:testnet' | 'sui:localnet' | 'sui:mainnet';
|
|
10
106
|
|
|
11
|
-
interface
|
|
107
|
+
interface CloseIntentionData {
|
|
108
|
+
collateralType: string;
|
|
109
|
+
recipient: string;
|
|
110
|
+
strapId?: string;
|
|
111
|
+
}
|
|
112
|
+
interface BorrowIntentionData$2 {
|
|
113
|
+
collateralType: string;
|
|
114
|
+
collateralAmount: string;
|
|
115
|
+
borrowAmount: string;
|
|
116
|
+
insertionPlace?: string;
|
|
117
|
+
strapId?: string;
|
|
118
|
+
}
|
|
119
|
+
interface WithdrawIntentionData$1 {
|
|
120
|
+
collateralType: string;
|
|
121
|
+
withdrawAmount: string;
|
|
122
|
+
insertionPlace?: string;
|
|
123
|
+
strapId?: string;
|
|
124
|
+
}
|
|
125
|
+
interface RepayIntentionData$2 {
|
|
126
|
+
collateralType: string;
|
|
127
|
+
repayAmount: string;
|
|
128
|
+
withdrawAmount: string;
|
|
129
|
+
isSurplus: boolean;
|
|
130
|
+
insertionPlace?: string;
|
|
131
|
+
strapId?: string;
|
|
132
|
+
}
|
|
133
|
+
interface PsmIntentionData {
|
|
134
|
+
coinType: string;
|
|
135
|
+
amount: string;
|
|
136
|
+
buckToCoin: boolean;
|
|
137
|
+
}
|
|
138
|
+
interface SBUCKDepositIntentionData {
|
|
139
|
+
coinType: string;
|
|
140
|
+
amount: string;
|
|
141
|
+
isStake: boolean;
|
|
142
|
+
}
|
|
143
|
+
interface SBUCKUnstakeIntentionData {
|
|
144
|
+
stakeProofs: string[];
|
|
145
|
+
amount: string;
|
|
146
|
+
isStake: boolean;
|
|
147
|
+
toBuck: boolean;
|
|
148
|
+
}
|
|
149
|
+
interface SBUCKWithdrawIntentionData {
|
|
150
|
+
amount: string;
|
|
151
|
+
}
|
|
152
|
+
interface SBUCKClaimIntentionData {
|
|
153
|
+
stakeProofs: string[];
|
|
154
|
+
}
|
|
155
|
+
interface TankDepositIntentionData {
|
|
156
|
+
coinType: string;
|
|
157
|
+
amount: string;
|
|
158
|
+
}
|
|
159
|
+
interface TankWithdrawIntentionData {
|
|
160
|
+
coinType: string;
|
|
161
|
+
amount: string;
|
|
162
|
+
}
|
|
163
|
+
interface TankClaimIntentionData {
|
|
164
|
+
coinType: string;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
interface LockClaimIntentionData {
|
|
168
|
+
coinType: string;
|
|
169
|
+
proofCount: number;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
type BucketIntentionData = PsmIntentionData | BorrowIntentionData$2 | WithdrawIntentionData$1 | RepayIntentionData$2 | CloseIntentionData | TankDepositIntentionData | TankWithdrawIntentionData | TankClaimIntentionData | SBUCKDepositIntentionData | SBUCKWithdrawIntentionData | SBUCKUnstakeIntentionData | SBUCKClaimIntentionData | LockClaimIntentionData;
|
|
173
|
+
|
|
174
|
+
interface CetusIntentionData {
|
|
175
|
+
txbParams: any;
|
|
176
|
+
action: string;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
type DepositAssetIntentionData = {
|
|
180
|
+
vaultID: SuiAddress;
|
|
181
|
+
amount: NumStr;
|
|
182
|
+
};
|
|
183
|
+
type MintSharesIntentionData = {
|
|
184
|
+
vaultID: SuiAddress;
|
|
185
|
+
numShares: NumStr;
|
|
186
|
+
};
|
|
187
|
+
type RedeemSharesIntentionData = {
|
|
188
|
+
vaultID: SuiAddress;
|
|
189
|
+
numShares: NumStr;
|
|
190
|
+
};
|
|
191
|
+
type CancelPendingWithdrawalRequestIntentionData = {
|
|
192
|
+
vaultID: SuiAddress;
|
|
193
|
+
sequenceNumber: NumStr;
|
|
194
|
+
};
|
|
195
|
+
type EmberIntentionData = DepositAssetIntentionData | MintSharesIntentionData | RedeemSharesIntentionData | CancelPendingWithdrawalRequestIntentionData;
|
|
196
|
+
|
|
197
|
+
type MMTDEXIntentionData = {
|
|
198
|
+
action: TransactionSubType;
|
|
199
|
+
params: any;
|
|
200
|
+
};
|
|
201
|
+
declare enum TransactionSubType {
|
|
202
|
+
AddLiquidity = "AddLiquidity",
|
|
203
|
+
AddLiquiditySingleSide = "AddLiquiditySingleSide",
|
|
204
|
+
ClaimAllRewards = "ClaimAllRewards",
|
|
205
|
+
ClaimRewards = "ClaimRewards",
|
|
206
|
+
ClaimRewardsAs = "ClaimRewardsAs",
|
|
207
|
+
RemoveLiquidity = "RemoveLiquidity",
|
|
208
|
+
Swap = "Swap",
|
|
209
|
+
ManageLiquidity = "ManageLiquidity",
|
|
210
|
+
ManageLiquiditySingleSide = "ManageLiquiditySingleSide",
|
|
211
|
+
StakeXSui = "StakeXSui",
|
|
212
|
+
UnstakeXSui = "UnstakeXSui",
|
|
213
|
+
Bond = "Bond",
|
|
214
|
+
Extend = "Extend",
|
|
215
|
+
Merge = "Merge",
|
|
216
|
+
Unbond = "Unbond"
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
interface IAppHelperInternalLegacy<T> {
|
|
220
|
+
application: string;
|
|
221
|
+
supportSDK: '@mysten/sui.js';
|
|
12
222
|
deserialize(input: SuiSignTransactionBlockInput & {
|
|
13
223
|
network: SuiNetworks;
|
|
14
|
-
|
|
224
|
+
suiClient: SuiClient;
|
|
15
225
|
account: WalletAccount;
|
|
16
226
|
appContext?: any;
|
|
17
227
|
}): Promise<{
|
|
@@ -24,19 +234,21 @@ interface IAppHelper<T> {
|
|
|
24
234
|
txType: TransactionType;
|
|
25
235
|
txSubType: string;
|
|
26
236
|
intentionData: T;
|
|
27
|
-
|
|
237
|
+
suiClient: SuiClient;
|
|
28
238
|
account: WalletAccount;
|
|
29
|
-
}): Promise<
|
|
239
|
+
}): Promise<TransactionBlock>;
|
|
30
240
|
}
|
|
31
241
|
|
|
32
|
-
|
|
242
|
+
type MPayIntentionData = CreateStreamIntentionData | SetAutoClaimIntentionData | ClaimStreamIntentionData | ClaimByProxyStreamIntentionData | CancelStreamIntentionData;
|
|
243
|
+
|
|
244
|
+
interface IAppHelperInternalGrpc<T> {
|
|
33
245
|
application: string;
|
|
34
|
-
supportSDK: '@mysten/sui';
|
|
246
|
+
supportSDK: '@mysten/sui-v2';
|
|
35
247
|
deserialize(input: {
|
|
36
248
|
transaction: Transaction;
|
|
37
249
|
chain: IdentifierString;
|
|
38
250
|
network: SuiNetworks;
|
|
39
|
-
|
|
251
|
+
suiGrpcClient: SuiGrpcClient;
|
|
40
252
|
account: WalletAccount;
|
|
41
253
|
appContext?: any;
|
|
42
254
|
}): Promise<{
|
|
@@ -49,19 +261,33 @@ interface IAppHelperInternal<T> {
|
|
|
49
261
|
txType: TransactionType;
|
|
50
262
|
txSubType: string;
|
|
51
263
|
intentionData: T;
|
|
52
|
-
|
|
264
|
+
suiGrpcClient: SuiGrpcClient;
|
|
53
265
|
account: WalletAccount;
|
|
54
266
|
}): Promise<Transaction>;
|
|
55
267
|
}
|
|
56
268
|
|
|
57
|
-
interface
|
|
269
|
+
interface CoinTransferIntentionData {
|
|
270
|
+
recipient: string;
|
|
271
|
+
coinType: string;
|
|
272
|
+
amount: string;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
interface ObjectTransferIntentionData {
|
|
276
|
+
receiver: string;
|
|
277
|
+
objectType: string;
|
|
278
|
+
objectId: string;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
type CoreIntentionData = CoinTransferIntentionData | ObjectTransferIntentionData;
|
|
282
|
+
|
|
283
|
+
interface IAppHelperInternal<T> {
|
|
58
284
|
application: string;
|
|
59
|
-
supportSDK: '@mysten/sui
|
|
285
|
+
supportSDK: '@mysten/sui';
|
|
60
286
|
deserialize(input: {
|
|
61
287
|
transaction: Transaction;
|
|
62
288
|
chain: IdentifierString;
|
|
63
289
|
network: SuiNetworks;
|
|
64
|
-
|
|
290
|
+
suiClient: SuiJsonRpcClient;
|
|
65
291
|
account: WalletAccount;
|
|
66
292
|
appContext?: any;
|
|
67
293
|
}): Promise<{
|
|
@@ -74,17 +300,407 @@ interface IAppHelperInternalGrpc<T> {
|
|
|
74
300
|
txType: TransactionType;
|
|
75
301
|
txSubType: string;
|
|
76
302
|
intentionData: T;
|
|
77
|
-
|
|
303
|
+
suiClient: SuiJsonRpcClient;
|
|
78
304
|
account: WalletAccount;
|
|
79
305
|
}): Promise<Transaction>;
|
|
80
306
|
}
|
|
81
307
|
|
|
82
|
-
interface
|
|
83
|
-
|
|
84
|
-
|
|
308
|
+
interface ClaimRewardIntentionData {
|
|
309
|
+
type: string;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
interface ClaimSupplyIntentionData {
|
|
313
|
+
type: string;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
interface EntryBorrowIntentionData {
|
|
317
|
+
amount: number;
|
|
318
|
+
assetId: number;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
interface EntryDepositIntentionData {
|
|
322
|
+
amount: number;
|
|
323
|
+
assetId: number;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
interface EntryRepayIntentionData {
|
|
327
|
+
amount: number;
|
|
328
|
+
assetId: number;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
interface EntryWithdrawIntentionData {
|
|
332
|
+
amount: number;
|
|
333
|
+
assetId: number;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
interface EntryMultiDepositIntentionData {
|
|
337
|
+
list: {
|
|
338
|
+
amount: number;
|
|
339
|
+
assetId: number;
|
|
340
|
+
}[];
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
interface PlainTransactionIntentionData {
|
|
344
|
+
content: string;
|
|
345
|
+
scene: string;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
type NAVIIntentionData = EntryDepositIntentionData | EntryBorrowIntentionData | EntryRepayIntentionData | EntryWithdrawIntentionData | EntryMultiDepositIntentionData | ClaimRewardIntentionData | ClaimSupplyIntentionData | PlainTransactionIntentionData;
|
|
349
|
+
|
|
350
|
+
type PlainTransactionData = {
|
|
351
|
+
content: string;
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
interface BorrowIntentionData$1 {
|
|
355
|
+
coinName: string;
|
|
356
|
+
amount: number | string;
|
|
357
|
+
obligationId: string;
|
|
358
|
+
obligationKey: string;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
interface BorrowWithBoostIntentionData {
|
|
362
|
+
coinName: string;
|
|
363
|
+
amount: number | string;
|
|
364
|
+
obligationId: string;
|
|
365
|
+
obligationKey: string;
|
|
366
|
+
veScaKey: string;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
interface BorrowWithReferralIntentionData {
|
|
370
|
+
coinName: string;
|
|
371
|
+
amount: number | string;
|
|
372
|
+
obligationId: string;
|
|
373
|
+
obligationKey: string;
|
|
374
|
+
veScaKey: string | undefined;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
interface DepositCollateralIntentionData {
|
|
378
|
+
collateralCoinName: string;
|
|
379
|
+
amount: number | string;
|
|
380
|
+
obligationId: string;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
interface MigrateAndClaimIntentionData {
|
|
384
|
+
obligationKey: string;
|
|
385
|
+
obligationId: string;
|
|
386
|
+
rewardCoinName: string;
|
|
387
|
+
veScaKey?: string;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
interface MigrateScoinIntentionData {
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
interface OpenObligationIntentionData {
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
interface RepayIntentionData$1 {
|
|
397
|
+
coinName: string;
|
|
398
|
+
amount: number | string;
|
|
399
|
+
obligationId: string;
|
|
400
|
+
obligationKey: string;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
interface RepayWithBoostIntentionData {
|
|
404
|
+
coinName: string;
|
|
405
|
+
amount: number | string;
|
|
406
|
+
obligationId: string;
|
|
407
|
+
veScaKey: string;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
interface SupplyLendingIntentionData {
|
|
411
|
+
amount: number | string;
|
|
412
|
+
coinName: string;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
interface UnstakeSpoolIntentionData {
|
|
416
|
+
amount: number | string;
|
|
417
|
+
marketCoinName: string;
|
|
418
|
+
stakeAccountId: string | null;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
interface WithdrawAndUnstakeLendingIntentionData {
|
|
422
|
+
amount: number | undefined;
|
|
423
|
+
coinName: string;
|
|
424
|
+
stakeAccountId: {
|
|
425
|
+
id: string;
|
|
426
|
+
coin: number;
|
|
427
|
+
}[];
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
interface WithdrawCollateralIntentionData {
|
|
431
|
+
collateralCoinName: string;
|
|
432
|
+
amount: number | string;
|
|
433
|
+
obligationId: string;
|
|
434
|
+
obligationKey: string;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
interface WithdrawLendingIntentionData {
|
|
438
|
+
amount: string | number;
|
|
439
|
+
coinName: string;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
interface BindReferralIntentionData {
|
|
443
|
+
veScaKey: string;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
interface ClaimRevenueReferralIntentionData {
|
|
447
|
+
veScaKey: string;
|
|
448
|
+
coins: string[];
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
interface CreateReferralLinkIntentionData {
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
interface ExtendPeriodAndStakeMoreIntentionData {
|
|
455
|
+
amount: number;
|
|
456
|
+
veScaKey: string;
|
|
457
|
+
unlockTime: number;
|
|
458
|
+
obligationId: string | undefined;
|
|
459
|
+
obligationKey: string | undefined;
|
|
460
|
+
isOldBorrowIncentive: boolean;
|
|
461
|
+
isObligationLocked: boolean;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
interface ExtendStakePeriodIntentionData {
|
|
465
|
+
isObligationLocked: boolean;
|
|
466
|
+
isOldBorrowIncentive: boolean;
|
|
467
|
+
obligationId: string | undefined;
|
|
468
|
+
obligationKey: string | undefined;
|
|
469
|
+
unlockTime: number | undefined;
|
|
470
|
+
veScaKey: string | undefined;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
interface MergeVeScaIntentionData {
|
|
474
|
+
targetVeScaKey: string;
|
|
475
|
+
sourceVeScaKey: string;
|
|
476
|
+
obligationDatas: {
|
|
477
|
+
obligationKey: string;
|
|
478
|
+
obligationId: string;
|
|
479
|
+
}[];
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
interface RedeemScaIntentionData {
|
|
483
|
+
veScaKey: string;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
interface RenewExpStakePeriodIntentionData {
|
|
487
|
+
amount: number;
|
|
488
|
+
unlockTime: number;
|
|
489
|
+
veScaKey: string;
|
|
490
|
+
isHaveRedeem: boolean;
|
|
491
|
+
obligation?: string;
|
|
492
|
+
obligationKey?: string;
|
|
493
|
+
isObligationLocked: boolean;
|
|
494
|
+
isOldBorrowIncentive: boolean;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
interface SplitVeScaIntentionData {
|
|
498
|
+
targetVeScaKey: string;
|
|
499
|
+
splitAmount: number;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
interface StakeScaIntentionData {
|
|
503
|
+
amount: number;
|
|
504
|
+
isObligationLocked: boolean;
|
|
505
|
+
isOldBorrowIncentive: boolean;
|
|
506
|
+
obligationId: string | undefined;
|
|
507
|
+
obligationKey: string | undefined;
|
|
508
|
+
unlockTime: number | undefined;
|
|
509
|
+
veScaKey: string | undefined;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
interface SupplyAndStakeLendingIntentionData {
|
|
513
|
+
amount: number | string;
|
|
514
|
+
coinName: string;
|
|
515
|
+
stakeAccountId?: string | null;
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
|
+
* Represents possible actions in the system
|
|
520
|
+
*/
|
|
521
|
+
type Action = 'stake' | 'unstake' | 'deactivate';
|
|
522
|
+
/**
|
|
523
|
+
* Type mapping from Action to its required arguments
|
|
524
|
+
*/
|
|
525
|
+
type Args<T extends Action> = T extends 'stake' ? StakeArgs : T extends 'unstake' ? UnstakeArgs : T extends 'deactivate' ? DeactivateArgs : never;
|
|
526
|
+
/**
|
|
527
|
+
* Arguments required for the 'stake' action
|
|
528
|
+
*/
|
|
529
|
+
interface StakeArgs {
|
|
530
|
+
veScaKey: string;
|
|
531
|
+
obligationId: string;
|
|
532
|
+
obligationKey: string;
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* Arguments required for the 'unstake' action
|
|
536
|
+
*/
|
|
537
|
+
interface UnstakeArgs {
|
|
538
|
+
obligationId: string;
|
|
539
|
+
obligationKey: string;
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
542
|
+
* Arguments required for the 'deactivate' action
|
|
543
|
+
*/
|
|
544
|
+
interface DeactivateArgs {
|
|
545
|
+
veScaKey: string;
|
|
546
|
+
obligationId: string;
|
|
547
|
+
}
|
|
548
|
+
type BindingDatas = {
|
|
549
|
+
action: 'deactivate';
|
|
550
|
+
args: Args<'deactivate'>;
|
|
551
|
+
} | {
|
|
552
|
+
action: 'stake';
|
|
553
|
+
args: Args<'stake'>;
|
|
554
|
+
} | {
|
|
555
|
+
action: 'unstake';
|
|
556
|
+
args: Args<'unstake'>;
|
|
557
|
+
};
|
|
558
|
+
interface VeScaObligationBindingsIntentData {
|
|
559
|
+
bindingDatas: BindingDatas[];
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
interface TransferVeScaKeysIntentionData {
|
|
563
|
+
veScaKeys: {
|
|
564
|
+
objectId: string;
|
|
565
|
+
version: string;
|
|
566
|
+
digest: string;
|
|
567
|
+
}[];
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
interface WithdrawStakedScaIntentionData {
|
|
571
|
+
vescaKey?: string;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
type ScallopIntentionData = SupplyLendingIntentionData | WithdrawLendingIntentionData | BorrowIntentionData$1 | RepayIntentionData$1 | DepositCollateralIntentionData | WithdrawCollateralIntentionData | OpenObligationIntentionData | UnstakeSpoolIntentionData | BorrowWithBoostIntentionData | StakeScaIntentionData | ExtendStakePeriodIntentionData | ExtendPeriodAndStakeMoreIntentionData | RenewExpStakePeriodIntentionData | WithdrawStakedScaIntentionData | SupplyAndStakeLendingIntentionData | WithdrawAndUnstakeLendingIntentionData | RedeemScaIntentionData | MigrateAndClaimIntentionData | BorrowWithReferralIntentionData | CreateReferralLinkIntentionData | ClaimRevenueReferralIntentionData | BindReferralIntentionData | MigrateScoinIntentionData | RepayWithBoostIntentionData | MergeVeScaIntentionData | SplitVeScaIntentionData | VeScaObligationBindingsIntentData | TransferVeScaKeysIntentionData;
|
|
575
|
+
|
|
576
|
+
interface StakeIntentionData$1 {
|
|
577
|
+
amount: string;
|
|
578
|
+
outCoinType: string;
|
|
579
|
+
}
|
|
580
|
+
interface StakeAndDepositIntentionData {
|
|
581
|
+
amount: string;
|
|
582
|
+
outCoinType: string;
|
|
583
|
+
}
|
|
584
|
+
interface ConvertIntentionData {
|
|
585
|
+
amount: string;
|
|
586
|
+
inCoinType: string;
|
|
587
|
+
outCoinType: string;
|
|
588
|
+
}
|
|
589
|
+
interface ConvertAndDepositIntentionData {
|
|
590
|
+
amount: string;
|
|
591
|
+
inCoinType: string;
|
|
592
|
+
outCoinType: string;
|
|
593
|
+
}
|
|
594
|
+
interface UnstakeIntentionData {
|
|
595
|
+
amount: string;
|
|
596
|
+
inCoinType: string;
|
|
597
|
+
}
|
|
598
|
+
type SpringSuiIntentionData = StakeIntentionData$1 | StakeAndDepositIntentionData | ConvertIntentionData | ConvertAndDepositIntentionData | UnstakeIntentionData;
|
|
599
|
+
|
|
600
|
+
interface MintIntentionData {
|
|
601
|
+
amount: string;
|
|
602
|
+
}
|
|
603
|
+
interface RedeemIntentionData {
|
|
604
|
+
amount: string;
|
|
605
|
+
}
|
|
606
|
+
type StSuiIntentionData = MintIntentionData | RedeemIntentionData;
|
|
607
|
+
|
|
608
|
+
type SuilendIntentionData = DepositIntentionData | WithdrawIntentionData | BorrowIntentionData | RepayIntentionData | ClaimIntentionData | ClaimAndDepositIntentionData;
|
|
609
|
+
interface WithdrawIntentionData {
|
|
610
|
+
coinType: string;
|
|
611
|
+
value: string;
|
|
612
|
+
}
|
|
613
|
+
interface BorrowIntentionData {
|
|
614
|
+
coinType: string;
|
|
615
|
+
value: string;
|
|
616
|
+
}
|
|
617
|
+
interface ClaimIntentionData {
|
|
618
|
+
value: Record<string, string>;
|
|
619
|
+
}
|
|
620
|
+
interface ClaimAndDepositIntentionData {
|
|
621
|
+
value: Record<string, string>;
|
|
622
|
+
}
|
|
623
|
+
interface DepositIntentionData {
|
|
624
|
+
coinType: string;
|
|
625
|
+
value: string;
|
|
626
|
+
}
|
|
627
|
+
interface RepayIntentionData {
|
|
628
|
+
coinType: string;
|
|
629
|
+
value: string;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
type TURBOSIntentionData = CreatePoolIntentionData | AddLiquidityIntentionData | IncreaseLiquidityIntentionData | DecreaseLiquidityIntentionData | DecreaseLiquidityWithReturnIntentionData | CollectFeeIntentionData | CollectRewardIntentionData | RemoveLiquidityIntentionData | RemoveLiquidityWithReturnIntentionData | BurnIntentionData | SwapIntentionData | PrixJoinIntentionData | PrixClaimIntentionData | SwapExactQuoteForBaseIntentionData | SwapExactBaseForQuoteIntentionData;
|
|
633
|
+
type CreatePoolIntentionData = Pool.CreatePoolOptions;
|
|
634
|
+
type AddLiquidityIntentionData = Pool.AddLiquidityOptions;
|
|
635
|
+
type BurnIntentionData = NFT.BurnOptions;
|
|
636
|
+
type CollectFeeIntentionData = Pool.CollectFeeOptions;
|
|
637
|
+
type CollectRewardIntentionData = Pool.CollectRewardOptions;
|
|
638
|
+
type DecreaseLiquidityIntentionData = Pool.DecreaseLiquidityOptions;
|
|
639
|
+
type DecreaseLiquidityWithReturnIntentionData = Pool.DecreaseLiquidityOptions;
|
|
640
|
+
type IncreaseLiquidityIntentionData = Pool.IncreaseLiquidityOptions;
|
|
641
|
+
interface PrixClaimIntentionData {
|
|
642
|
+
}
|
|
643
|
+
interface PrixJoinIntentionData {
|
|
644
|
+
}
|
|
645
|
+
type RemoveLiquidityIntentionData = Pool.RemoveLiquidityOptions;
|
|
646
|
+
type RemoveLiquidityWithReturnIntentionData = Pool.RemoveLiquidityOptions;
|
|
647
|
+
type SwapIntentionData = Trade.SwapOptions;
|
|
648
|
+
interface SwapExactBaseForQuoteIntentionData {
|
|
649
|
+
token1: string;
|
|
650
|
+
token2: string;
|
|
651
|
+
poolId: string;
|
|
652
|
+
amountIn: number;
|
|
653
|
+
}
|
|
654
|
+
interface SwapExactQuoteForBaseIntentionData {
|
|
655
|
+
token1: string;
|
|
656
|
+
token2: string;
|
|
657
|
+
poolId: string;
|
|
658
|
+
amountIn: number;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
interface ClaimTicketIntentionData {
|
|
662
|
+
ticketId: string;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
interface StakeIntentionData {
|
|
666
|
+
amount: number;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
interface UnStakeIntentionData {
|
|
670
|
+
amount: number;
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
type VoloIntentionData = StakeIntentionData | UnStakeIntentionData | ClaimTicketIntentionData;
|
|
674
|
+
|
|
675
|
+
/**
|
|
676
|
+
* Maps each registered application name to its intention data type.
|
|
677
|
+
* Add new apps here when registering helpers in `src/index.ts`.
|
|
678
|
+
*/
|
|
679
|
+
interface AppRegistry {
|
|
680
|
+
alphafi: AlphaFiIntentionData;
|
|
681
|
+
bluefin: BluefinIntentionData;
|
|
682
|
+
bucket: BucketIntentionData;
|
|
683
|
+
cetus: CetusIntentionData;
|
|
684
|
+
ember: EmberIntentionData;
|
|
685
|
+
'mmt-dex': MMTDEXIntentionData;
|
|
686
|
+
mpay: MPayIntentionData;
|
|
687
|
+
'msafe-core': CoreIntentionData;
|
|
688
|
+
'msafe-plain-tx': PlainTransactionData;
|
|
689
|
+
navi: NAVIIntentionData;
|
|
690
|
+
scallop: ScallopIntentionData;
|
|
691
|
+
SpringSui: SpringSuiIntentionData;
|
|
692
|
+
stsui: StSuiIntentionData;
|
|
693
|
+
Suilend: SuilendIntentionData;
|
|
694
|
+
turbos: TURBOSIntentionData;
|
|
695
|
+
volo: VoloIntentionData;
|
|
696
|
+
}
|
|
697
|
+
type AppName = keyof AppRegistry;
|
|
698
|
+
type AppIntentionData<K extends AppName> = AppRegistry[K];
|
|
699
|
+
|
|
700
|
+
interface IAppHelper<T> {
|
|
85
701
|
deserialize(input: SuiSignTransactionBlockInput & {
|
|
86
702
|
network: SuiNetworks;
|
|
87
|
-
|
|
703
|
+
clientUrl: string;
|
|
88
704
|
account: WalletAccount;
|
|
89
705
|
appContext?: any;
|
|
90
706
|
}): Promise<{
|
|
@@ -97,22 +713,25 @@ interface IAppHelperInternalLegacy<T> {
|
|
|
97
713
|
txType: TransactionType;
|
|
98
714
|
txSubType: string;
|
|
99
715
|
intentionData: T;
|
|
100
|
-
|
|
716
|
+
clientUrl: string;
|
|
101
717
|
account: WalletAccount;
|
|
102
|
-
}): Promise<
|
|
718
|
+
}): Promise<Transaction>;
|
|
103
719
|
}
|
|
104
720
|
|
|
105
721
|
type InternalAppHelper<T> = IAppHelperInternalLegacy<T> | IAppHelperInternal<T> | IAppHelperInternalGrpc<T>;
|
|
722
|
+
type RegisteredAppHelper = IAppHelper<AppRegistry[AppName]>;
|
|
106
723
|
declare class MSafeApps {
|
|
107
|
-
apps: Map<
|
|
724
|
+
apps: Map<AppName, RegisteredAppHelper>;
|
|
108
725
|
private constructor();
|
|
109
726
|
static fromHelpers(apps: InternalAppHelper<any>[]): MSafeApps;
|
|
110
727
|
addLegacyHelper(app: IAppHelperInternalLegacy<any>): void;
|
|
111
728
|
addHelper(app: IAppHelperInternal<any>): void;
|
|
112
729
|
addGrpcHelper(app: IAppHelperInternalGrpc<any>): void;
|
|
113
|
-
getAppHelper(appName:
|
|
730
|
+
getAppHelper<K extends AppName>(appName: K): IAppHelper<AppRegistry[K]>;
|
|
731
|
+
getAppHelper(appName: string): IAppHelper<unknown>;
|
|
732
|
+
private setApp;
|
|
114
733
|
}
|
|
115
734
|
|
|
116
735
|
declare const appHelpers: MSafeApps;
|
|
117
736
|
|
|
118
|
-
export { appHelpers };
|
|
737
|
+
export { type AppIntentionData, type AppName, type AppRegistry, appHelpers };
|