superstack-wallet-sdk 0.5.7 → 0.5.9
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/esm/src/client.js +1 -1
- package/dist/esm/src/client.js.map +1 -1
- package/dist/esm/src/index.js +1 -1
- package/dist/esm/src/index.js.map +1 -1
- package/dist/esm/src/types.js +1 -1
- package/dist/esm/src/types.js.map +1 -1
- package/dist/esm/types/client.d.ts +151 -12
- package/dist/esm/types/types.d.ts +283 -142
- package/dist/index.cjs +123 -123
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +434 -154
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import react__default, { ReactNode } from 'react';
|
|
|
7
7
|
type SupportedTransactionVersions = ReadonlySet<TransactionVersion> | null | undefined;
|
|
8
8
|
type TransactionOrVersionedTransaction<S extends SupportedTransactionVersions> = S extends null | undefined ? Transaction : Transaction | VersionedTransaction;
|
|
9
9
|
declare function isVersionedTransaction(transaction: Transaction | VersionedTransaction): transaction is VersionedTransaction;
|
|
10
|
-
type LoginType = "
|
|
10
|
+
type LoginType = "Email" | "Phone" | "TwitterOAuth" | "GoogleOAuth" | "Telegram" | "TelegramOAuth" | "Apple" | "Phantom" | "Okx" | "MetaMask" | "Rabby" | "Coinbase" | "WalletConnect";
|
|
11
11
|
declare enum Network {
|
|
12
12
|
Solana = "Solana",
|
|
13
13
|
Ethereum = "Ethereum"
|
|
@@ -17,12 +17,10 @@ declare enum WalletType {
|
|
|
17
17
|
Embedded = "Embedded"
|
|
18
18
|
}
|
|
19
19
|
declare enum SocialType {
|
|
20
|
-
Email = "Email",
|
|
21
20
|
Google = "Google",
|
|
22
21
|
Twitter = "Twitter",
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
Okx = "Okx"
|
|
22
|
+
Telegram = "Telegram",
|
|
23
|
+
Apple = "Apple"
|
|
26
24
|
}
|
|
27
25
|
type Social = {
|
|
28
26
|
[key in SocialType]: string;
|
|
@@ -43,36 +41,72 @@ interface Wallet {
|
|
|
43
41
|
address: string;
|
|
44
42
|
network: Network;
|
|
45
43
|
wallet_type: WalletType;
|
|
46
|
-
wallet_set: "Main" |
|
|
44
|
+
wallet_set: "Main" | `Forward-${number}` | `Secondary-${number}` | `SecondaryForward-${number}-${number}`;
|
|
45
|
+
account_index: number;
|
|
46
|
+
is_enabled: boolean;
|
|
47
47
|
}
|
|
48
48
|
interface WalletInfo {
|
|
49
|
-
account_info: AccountInfo;
|
|
50
49
|
id: string;
|
|
51
|
-
is_exported: boolean;
|
|
52
50
|
wallets: Wallet[];
|
|
53
51
|
social_links: Social[];
|
|
54
52
|
social_infos: SocialInfo[];
|
|
53
|
+
account_info: AccountInfo;
|
|
54
|
+
created_at: number;
|
|
55
|
+
is_exported: boolean;
|
|
55
56
|
access_token?: string;
|
|
56
57
|
}
|
|
58
|
+
interface SubAccountInfo {
|
|
59
|
+
account_index: number;
|
|
60
|
+
secondary_index: number;
|
|
61
|
+
name?: string;
|
|
62
|
+
created_at: number;
|
|
63
|
+
is_exported: boolean;
|
|
64
|
+
is_enabled: boolean;
|
|
65
|
+
}
|
|
57
66
|
interface AccountInfo {
|
|
58
67
|
name: string | null;
|
|
68
|
+
sub_accounts: SubAccountInfo[];
|
|
59
69
|
}
|
|
70
|
+
type MultiAccountRequest = {
|
|
71
|
+
type: "Create";
|
|
72
|
+
data: {
|
|
73
|
+
name?: string | null;
|
|
74
|
+
};
|
|
75
|
+
} | {
|
|
76
|
+
type: "Enable";
|
|
77
|
+
data: {
|
|
78
|
+
index: number;
|
|
79
|
+
};
|
|
80
|
+
} | {
|
|
81
|
+
type: "Disable";
|
|
82
|
+
data: {
|
|
83
|
+
index: number;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
60
86
|
interface SignRequestV1 {
|
|
87
|
+
user_id: string;
|
|
88
|
+
network: string;
|
|
61
89
|
address: string;
|
|
62
|
-
userId: string;
|
|
63
90
|
message: string;
|
|
64
|
-
network: string;
|
|
65
|
-
requestId: string;
|
|
66
91
|
}
|
|
67
|
-
interface
|
|
92
|
+
interface UnsignedTxV2 {
|
|
68
93
|
Solana?: string;
|
|
69
94
|
EthereumEip712?: Record<string, unknown>;
|
|
70
95
|
}
|
|
71
96
|
interface SignRequestV2 {
|
|
97
|
+
user_id: string;
|
|
98
|
+
network: string;
|
|
72
99
|
address: string;
|
|
100
|
+
tx: UnsignedTxV2;
|
|
101
|
+
}
|
|
102
|
+
interface UnsignedTxV3 {
|
|
103
|
+
Solana?: string;
|
|
104
|
+
}
|
|
105
|
+
interface SignRequestV3 {
|
|
73
106
|
user_id: string;
|
|
74
107
|
network: string;
|
|
75
|
-
|
|
108
|
+
address: string;
|
|
109
|
+
tx: UnsignedTxV3;
|
|
76
110
|
}
|
|
77
111
|
interface UserSession {
|
|
78
112
|
id: string;
|
|
@@ -138,13 +172,13 @@ interface OrderState {
|
|
|
138
172
|
}
|
|
139
173
|
interface TransferRequest {
|
|
140
174
|
user_id: string;
|
|
175
|
+
network: Network;
|
|
176
|
+
chain_id: number;
|
|
141
177
|
from: string;
|
|
142
178
|
to: string;
|
|
143
179
|
amount: string;
|
|
144
180
|
decimals: number;
|
|
145
181
|
token?: string;
|
|
146
|
-
network: Network;
|
|
147
|
-
chain_id: number;
|
|
148
182
|
}
|
|
149
183
|
declare enum VaultId {
|
|
150
184
|
HyperbeatUltraHype = "HyperbeatUltraHype",
|
|
@@ -189,6 +223,8 @@ interface DeBridgeDlnCreateTxRequest {
|
|
|
189
223
|
srcChainPriorityLevel?: string | null;
|
|
190
224
|
}
|
|
191
225
|
type BuildTransactionRequest = {
|
|
226
|
+
wallet_address?: string | null;
|
|
227
|
+
} & ({
|
|
192
228
|
type: "HyperbeatVaultApprove";
|
|
193
229
|
data: {
|
|
194
230
|
vault_id: VaultId;
|
|
@@ -233,142 +269,247 @@ type BuildTransactionRequest = {
|
|
|
233
269
|
data: {
|
|
234
270
|
request: DeBridgeDlnCreateTxRequest;
|
|
235
271
|
};
|
|
236
|
-
};
|
|
272
|
+
});
|
|
237
273
|
interface BuildTransactionResponse {
|
|
238
274
|
raw_transaction: string;
|
|
239
275
|
metadata?: any;
|
|
240
276
|
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
}
|
|
245
|
-
declare enum
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
+
declare enum LighterOrderSide {
|
|
278
|
+
Buy = "buy",
|
|
279
|
+
Sell = "sell"
|
|
280
|
+
}
|
|
281
|
+
declare enum LighterOrderType {
|
|
282
|
+
Limit = "limit",
|
|
283
|
+
Market = "market",
|
|
284
|
+
StopLoss = "stop_loss",
|
|
285
|
+
StopLossLimit = "stop_loss_limit",
|
|
286
|
+
TakeProfit = "take_profit",
|
|
287
|
+
TakeProfitLimit = "take_profit_limit",
|
|
288
|
+
Twap = "twap",
|
|
289
|
+
TwapSub = "twap_sub"
|
|
290
|
+
}
|
|
291
|
+
declare enum LighterTimeInForce {
|
|
292
|
+
ImmediateOrCancel = "immediate_or_cancel",
|
|
293
|
+
GoodTillTime = "good_till_time",
|
|
294
|
+
PostOnly = "post_only"
|
|
295
|
+
}
|
|
296
|
+
declare enum LighterMarginMode {
|
|
297
|
+
Cross = "cross",
|
|
298
|
+
Isolated = "isolated"
|
|
299
|
+
}
|
|
300
|
+
declare enum LighterGroupingType {
|
|
301
|
+
Default = "default",
|
|
302
|
+
OneTriggersTheOther = "one_triggers_the_other",
|
|
303
|
+
OneCancelsTheOther = "one_cancels_the_other",
|
|
304
|
+
OneTriggersAOneCancelsTheOther = "one_triggers_a_one_cancels_the_other"
|
|
305
|
+
}
|
|
306
|
+
interface LighterTxContext {
|
|
307
|
+
account_index: number;
|
|
308
|
+
from_account_index: number;
|
|
309
|
+
api_key_index: number;
|
|
310
|
+
expired_at: number;
|
|
311
|
+
nonce: number;
|
|
312
|
+
}
|
|
313
|
+
interface LighterOrderParams {
|
|
314
|
+
account_index: number;
|
|
315
|
+
from_account_index: number;
|
|
316
|
+
api_key_index: number;
|
|
317
|
+
expired_at: number;
|
|
318
|
+
nonce: number;
|
|
319
|
+
market_index: number;
|
|
320
|
+
client_order_index?: number | null;
|
|
321
|
+
base_amount: number;
|
|
322
|
+
price?: number | null;
|
|
323
|
+
side: LighterOrderSide;
|
|
324
|
+
order_type: LighterOrderType;
|
|
325
|
+
time_in_force?: LighterTimeInForce | null;
|
|
326
|
+
reduce_only?: boolean;
|
|
327
|
+
trigger_price?: number | null;
|
|
328
|
+
order_expiry_ms?: number | null;
|
|
329
|
+
}
|
|
330
|
+
interface LighterLeverageParams {
|
|
331
|
+
account_index: number;
|
|
332
|
+
from_account_index: number;
|
|
333
|
+
api_key_index: number;
|
|
334
|
+
expired_at: number;
|
|
335
|
+
nonce: number;
|
|
336
|
+
market_index: number;
|
|
337
|
+
leverage: number;
|
|
338
|
+
margin_mode: LighterMarginMode;
|
|
339
|
+
}
|
|
340
|
+
interface LighterWithdrawParams {
|
|
341
|
+
account_index: number;
|
|
342
|
+
from_account_index: number;
|
|
343
|
+
api_key_index: number;
|
|
344
|
+
expired_at: number;
|
|
345
|
+
nonce: number;
|
|
346
|
+
usdc_amount: number;
|
|
347
|
+
}
|
|
348
|
+
interface LighterCreateSubAccountParams {
|
|
349
|
+
account_index: number;
|
|
350
|
+
from_account_index: number;
|
|
351
|
+
api_key_index: number;
|
|
352
|
+
expired_at: number;
|
|
353
|
+
nonce: number;
|
|
354
|
+
}
|
|
355
|
+
interface LighterGroupedOrderEntry {
|
|
356
|
+
market_index: number;
|
|
357
|
+
client_order_index?: number | null;
|
|
358
|
+
base_amount: number;
|
|
359
|
+
price?: number | null;
|
|
360
|
+
side: LighterOrderSide;
|
|
361
|
+
order_type: LighterOrderType;
|
|
362
|
+
time_in_force?: LighterTimeInForce | null;
|
|
363
|
+
reduce_only?: boolean;
|
|
364
|
+
trigger_price?: number | null;
|
|
365
|
+
order_expiry_ms?: number | null;
|
|
366
|
+
}
|
|
367
|
+
interface LighterGroupedOrdersParams {
|
|
368
|
+
account_index: number;
|
|
369
|
+
from_account_index: number;
|
|
370
|
+
api_key_index: number;
|
|
371
|
+
expired_at: number;
|
|
372
|
+
nonce: number;
|
|
373
|
+
grouping_type: LighterGroupingType;
|
|
374
|
+
orders: LighterGroupedOrderEntry[];
|
|
375
|
+
}
|
|
376
|
+
interface LighterGeneralTransferParams {
|
|
377
|
+
account_index: number;
|
|
378
|
+
from_account_index: number;
|
|
379
|
+
api_key_index: number;
|
|
380
|
+
expired_at: number;
|
|
381
|
+
nonce: number;
|
|
382
|
+
to_account_index: number;
|
|
383
|
+
usdc_amount: number;
|
|
384
|
+
fee?: number;
|
|
385
|
+
memo_hex?: string | null;
|
|
386
|
+
}
|
|
387
|
+
interface LighterCancelOrderParams {
|
|
388
|
+
account_index: number;
|
|
389
|
+
from_account_index: number;
|
|
390
|
+
api_key_index: number;
|
|
391
|
+
expired_at: number;
|
|
392
|
+
nonce: number;
|
|
393
|
+
market_index: number;
|
|
394
|
+
index: number;
|
|
395
|
+
}
|
|
396
|
+
interface LighterCancelAllOrdersParams {
|
|
397
|
+
account_index: number;
|
|
398
|
+
from_account_index: number;
|
|
399
|
+
api_key_index: number;
|
|
400
|
+
expired_at: number;
|
|
401
|
+
nonce: number;
|
|
402
|
+
time_in_force: LighterTimeInForce;
|
|
403
|
+
time: number;
|
|
404
|
+
}
|
|
405
|
+
type LighterBuildTransactionRequest = {
|
|
406
|
+
wallet_address?: string | null;
|
|
407
|
+
} & ({
|
|
408
|
+
type: "Order";
|
|
409
|
+
data: LighterOrderParams;
|
|
410
|
+
} | {
|
|
411
|
+
type: "UpdateLeverage";
|
|
412
|
+
data: LighterLeverageParams;
|
|
413
|
+
} | {
|
|
414
|
+
type: "Withdraw";
|
|
415
|
+
data: LighterWithdrawParams;
|
|
416
|
+
} | {
|
|
417
|
+
type: "CreateSubAccount";
|
|
418
|
+
data: LighterCreateSubAccountParams;
|
|
419
|
+
} | {
|
|
420
|
+
type: "Transfer";
|
|
421
|
+
data: LighterGeneralTransferParams;
|
|
422
|
+
} | {
|
|
423
|
+
type: "GroupedOrders";
|
|
424
|
+
data: LighterGroupedOrdersParams;
|
|
425
|
+
} | {
|
|
426
|
+
type: "CancelOrder";
|
|
427
|
+
data: LighterCancelOrderParams;
|
|
428
|
+
} | {
|
|
429
|
+
type: "CancelAllOrders";
|
|
430
|
+
data: LighterCancelAllOrdersParams;
|
|
431
|
+
});
|
|
432
|
+
interface LighterBuildTransactionResponse {
|
|
433
|
+
tx_type: number;
|
|
434
|
+
tx_info: string;
|
|
435
|
+
tx_hash?: string | null;
|
|
436
|
+
hash: string;
|
|
437
|
+
}
|
|
438
|
+
interface LighterAuthRequest {
|
|
439
|
+
wallet_address?: string | null;
|
|
440
|
+
expires_in_ms?: number | null;
|
|
441
|
+
account_index: number;
|
|
442
|
+
}
|
|
443
|
+
interface LighterAuthResponse {
|
|
444
|
+
auth: string;
|
|
277
445
|
expires_at: number;
|
|
278
446
|
}
|
|
279
|
-
interface
|
|
447
|
+
interface LighterChangeKeyRequest {
|
|
448
|
+
wallet_address?: string | null;
|
|
449
|
+
account_index: number;
|
|
450
|
+
}
|
|
451
|
+
interface LighterChangeKeyResponse {
|
|
452
|
+
account_index: number;
|
|
453
|
+
public_key: string;
|
|
454
|
+
}
|
|
455
|
+
interface ExchangeSignature {
|
|
456
|
+
r: string;
|
|
457
|
+
s: string;
|
|
458
|
+
v: number;
|
|
459
|
+
}
|
|
460
|
+
interface ExchangePayload {
|
|
461
|
+
action: any;
|
|
462
|
+
nonce: number;
|
|
463
|
+
signature: ExchangeSignature;
|
|
464
|
+
vaultAddress?: string | null;
|
|
465
|
+
expiresAfter?: number | null;
|
|
466
|
+
}
|
|
467
|
+
interface ExchangeResponse {
|
|
468
|
+
payload: ExchangePayload;
|
|
469
|
+
}
|
|
470
|
+
interface ExchangeRequest {
|
|
471
|
+
action: any;
|
|
472
|
+
vaultAddress?: string | null;
|
|
473
|
+
expiresAfter?: number | null;
|
|
474
|
+
isMainnet?: boolean | null;
|
|
475
|
+
walletAddress?: string | null;
|
|
476
|
+
}
|
|
477
|
+
interface ExportInitRequest {
|
|
478
|
+
user_nonce: string;
|
|
479
|
+
account_index?: number;
|
|
480
|
+
}
|
|
481
|
+
interface ExportInitResponse {
|
|
482
|
+
server_nonce: string;
|
|
483
|
+
}
|
|
484
|
+
interface ExportFinishRequest {
|
|
485
|
+
user_nonce?: string;
|
|
486
|
+
server_nonce?: string;
|
|
487
|
+
account_index?: number;
|
|
488
|
+
is_export: boolean;
|
|
489
|
+
}
|
|
490
|
+
interface ExportWallet {
|
|
280
491
|
network: Network;
|
|
492
|
+
wallet_set: string;
|
|
281
493
|
address: string;
|
|
282
|
-
|
|
283
|
-
collateral_assets: Partial<Record<CollateralAsset, BigDecimalString>>;
|
|
284
|
-
borrowed_asset: BorrowedAsset;
|
|
285
|
-
borrowed_amount: BigDecimalString;
|
|
286
|
-
}
|
|
287
|
-
interface CrossMarginBorrowResponse {
|
|
288
|
-
position_id: string;
|
|
289
|
-
}
|
|
290
|
-
interface CrossMarginRepayQuoteRequest {
|
|
291
|
-
position_id: string;
|
|
292
|
-
}
|
|
293
|
-
interface CrossMarginRepayQuoteResponse {
|
|
294
|
-
quote_id: string;
|
|
295
|
-
repay_asset: BorrowedAsset;
|
|
296
|
-
borrowed_amount: BigDecimalString;
|
|
297
|
-
interest_cost: BigDecimalString;
|
|
298
|
-
repay_amount: BigDecimalString;
|
|
299
|
-
created_at: number;
|
|
300
|
-
expires_at: number;
|
|
494
|
+
private_key: string;
|
|
301
495
|
}
|
|
302
|
-
interface
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
repay_asset: BorrowedAsset;
|
|
306
|
-
repay_amount: BigDecimalString;
|
|
307
|
-
}
|
|
308
|
-
interface CrossMarginRepayResponse {
|
|
309
|
-
position_id: string;
|
|
310
|
-
}
|
|
311
|
-
interface CrossMarginAdjustMarginRequest {
|
|
312
|
-
position_id: string;
|
|
313
|
-
is_add_margin: boolean;
|
|
314
|
-
collateral_assets: Partial<Record<CollateralAsset, BigDecimalString>>;
|
|
315
|
-
}
|
|
316
|
-
interface CrossMarginAdjustMarginResponse {
|
|
317
|
-
position_id: string;
|
|
318
|
-
}
|
|
319
|
-
interface BorrowedAssetGeneralInfo {
|
|
320
|
-
interest_rate_hourly: number;
|
|
321
|
-
interest_rate_annual: number;
|
|
322
|
-
available_amount: number;
|
|
323
|
-
max_borrowable_amount: number;
|
|
324
|
-
}
|
|
325
|
-
interface CollateralAssetGeneralInfo {
|
|
326
|
-
liquidation_threshold: number;
|
|
327
|
-
h_vol: number;
|
|
328
|
-
price: number;
|
|
329
|
-
}
|
|
330
|
-
interface CrossMarginGeneralInfoResponse {
|
|
331
|
-
collateral_info: Record<CollateralAsset, CollateralAssetGeneralInfo>;
|
|
332
|
-
borrowed_info: Record<BorrowedAsset, BorrowedAssetGeneralInfo>;
|
|
333
|
-
}
|
|
334
|
-
interface UserOpenPositionInfo {
|
|
335
|
-
position_id: string;
|
|
336
|
-
collateral_assets: Record<CollateralAsset, CollateralAssetInfo>;
|
|
337
|
-
borrowed_asset: BorrowedAsset;
|
|
338
|
-
borrowed_amount: BigDecimalString;
|
|
339
|
-
created_at: number;
|
|
340
|
-
updated_at: number;
|
|
341
|
-
current_ltv: number;
|
|
342
|
-
margin_call_ltv: number;
|
|
343
|
-
liquidation_ltv: number;
|
|
344
|
-
interest_cost: number;
|
|
345
|
-
}
|
|
346
|
-
interface UserOpenPositionsResponse {
|
|
347
|
-
positions: UserOpenPositionInfo[];
|
|
348
|
-
}
|
|
349
|
-
interface UserClosedPositionInfo {
|
|
350
|
-
position_id: string;
|
|
351
|
-
collateral_assets: Record<CollateralAsset, CollateralAssetInfo>;
|
|
352
|
-
borrowed_asset: BorrowedAsset;
|
|
353
|
-
borrowed_amount: BigDecimalString;
|
|
354
|
-
created_at: number;
|
|
355
|
-
closed_at: number;
|
|
356
|
-
interest_cost: number;
|
|
357
|
-
status: CrossMarginPositionStatus;
|
|
358
|
-
repaid_amount?: number;
|
|
359
|
-
}
|
|
360
|
-
interface UserOperationInfo {
|
|
361
|
-
position_id: string;
|
|
362
|
-
operation_id: string;
|
|
363
|
-
created_at: number;
|
|
364
|
-
finished_at: number;
|
|
365
|
-
operation_type: CrossMarginOperationType;
|
|
366
|
-
amount: BigDecimalString;
|
|
367
|
-
symbol: string;
|
|
496
|
+
interface ExportWalletResponse {
|
|
497
|
+
user_id: string;
|
|
498
|
+
wallets: ExportWallet[];
|
|
368
499
|
}
|
|
369
|
-
interface
|
|
370
|
-
|
|
371
|
-
|
|
500
|
+
interface CloseInitRequest {
|
|
501
|
+
user_nonce: string;
|
|
502
|
+
}
|
|
503
|
+
interface CloseInitResponse {
|
|
504
|
+
server_nonce: string;
|
|
505
|
+
}
|
|
506
|
+
interface CloseFinishRequest {
|
|
507
|
+
user_nonce: string;
|
|
508
|
+
server_nonce: string;
|
|
509
|
+
}
|
|
510
|
+
interface CloseFinishResponse {
|
|
511
|
+
user_id: string;
|
|
512
|
+
is_closed: boolean;
|
|
372
513
|
}
|
|
373
514
|
|
|
374
515
|
interface PhantomWalletAdapterConfig {
|
|
@@ -455,8 +596,44 @@ declare class WalletClient {
|
|
|
455
596
|
get social_links(): Social[] | null;
|
|
456
597
|
reconnect(isBackup?: boolean): Promise<WalletInfo | null>;
|
|
457
598
|
connectPhantom(): Promise<WalletInfo | null>;
|
|
458
|
-
updateAccountName(name: string): Promise<
|
|
599
|
+
updateAccountName(name: string, accountIndex?: number): Promise<WalletInfo>;
|
|
600
|
+
/**
|
|
601
|
+
* Create, enable, or disable a sub-account
|
|
602
|
+
* @param request Multi-account request with type and data
|
|
603
|
+
* @returns Updated wallet info
|
|
604
|
+
*/
|
|
605
|
+
manageMultiAccount(request: MultiAccountRequest): Promise<WalletInfo>;
|
|
606
|
+
/**
|
|
607
|
+
* Create a new sub-account
|
|
608
|
+
* @param name Optional name for the sub-account
|
|
609
|
+
* @returns Updated wallet info
|
|
610
|
+
*/
|
|
611
|
+
createSubAccount(name?: string | null): Promise<WalletInfo>;
|
|
612
|
+
/**
|
|
613
|
+
* Enable a sub-account by index
|
|
614
|
+
* @param index Account index to enable
|
|
615
|
+
* @returns Updated wallet info
|
|
616
|
+
*/
|
|
617
|
+
enableSubAccount(index: number): Promise<WalletInfo>;
|
|
618
|
+
/**
|
|
619
|
+
* Disable a sub-account by index
|
|
620
|
+
* @param index Account index to disable
|
|
621
|
+
* @returns Updated wallet info
|
|
622
|
+
*/
|
|
623
|
+
disableSubAccount(index: number): Promise<WalletInfo>;
|
|
624
|
+
/**
|
|
625
|
+
* This method is used to sign a solana transaction with v3 sign api,
|
|
626
|
+
* which is enabled in default.
|
|
627
|
+
* @param transaction Solana transaction to sign
|
|
628
|
+
* @returns signed transaction
|
|
629
|
+
*/
|
|
459
630
|
signSolanaTransaction(transaction: Transaction | VersionedTransaction): Promise<Transaction | VersionedTransaction>;
|
|
631
|
+
/**
|
|
632
|
+
* This method is used to sign a ethereum eip712 transaction with v2 sign api,
|
|
633
|
+
* which is disabled in default.
|
|
634
|
+
* @param params Ethereum eip712 transaction parameters
|
|
635
|
+
* @returns signature
|
|
636
|
+
*/
|
|
460
637
|
signEthereumEip712(params: {
|
|
461
638
|
domain: {
|
|
462
639
|
name: string;
|
|
@@ -531,6 +708,11 @@ declare class WalletClient {
|
|
|
531
708
|
getSolanaBalance(): Promise<string>;
|
|
532
709
|
getEthereumBalance(): Promise<string>;
|
|
533
710
|
fetchCoinbaseToken(address: string, blockchain?: "solana" | "ethereum"): Promise<string>;
|
|
711
|
+
/**
|
|
712
|
+
* This method is used to sign a ethereum eip712 transaction with v2 sign api,
|
|
713
|
+
* which is disabled in default.
|
|
714
|
+
* @returns viem signer adapter
|
|
715
|
+
*/
|
|
534
716
|
viemSignerAdapter(): {
|
|
535
717
|
signTypedData: (params: {
|
|
536
718
|
domain: {
|
|
@@ -581,18 +763,116 @@ declare class WalletClient {
|
|
|
581
763
|
}): Promise<BuildTransactionResponse>;
|
|
582
764
|
/**
|
|
583
765
|
* Build a transaction using the server-side build transaction API
|
|
584
|
-
* @param request Build transaction request
|
|
766
|
+
* @param request Build transaction request (with optional wallet_address field)
|
|
767
|
+
* @param walletAddress Optional wallet address (will be added to request if provided)
|
|
585
768
|
* @returns Build transaction response with raw transaction
|
|
586
769
|
*/
|
|
587
|
-
buildTransaction(request: BuildTransactionRequest): Promise<BuildTransactionResponse>;
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
770
|
+
buildTransaction(request: BuildTransactionRequest, walletAddress?: string): Promise<BuildTransactionResponse>;
|
|
771
|
+
/**
|
|
772
|
+
* Initialize the export process by generating a server nonce
|
|
773
|
+
* @param accountIndex Optional account index to export (defaults to 0)
|
|
774
|
+
* @returns Server nonce for verification
|
|
775
|
+
*/
|
|
776
|
+
exportInit(accountIndex?: number): Promise<ExportInitResponse>;
|
|
777
|
+
/**
|
|
778
|
+
* Finalize the export process and retrieve wallet private keys
|
|
779
|
+
* @param params Export parameters including nonces and account index
|
|
780
|
+
* @returns Exported wallet information with private keys
|
|
781
|
+
*/
|
|
782
|
+
exportFinal(params: {
|
|
783
|
+
userNonce: string;
|
|
784
|
+
serverNonce: string;
|
|
785
|
+
accountIndex?: number;
|
|
786
|
+
isExport?: boolean;
|
|
787
|
+
}): Promise<ExportWalletResponse>;
|
|
788
|
+
/**
|
|
789
|
+
* Retrieve previously exported wallet information
|
|
790
|
+
* @param accountIndex Optional account index (defaults to 0)
|
|
791
|
+
* @returns Previously exported wallet information
|
|
792
|
+
*/
|
|
793
|
+
getExportedWallets(accountIndex?: number): Promise<ExportWalletResponse>;
|
|
794
|
+
/**
|
|
795
|
+
* Initialize the account closure process
|
|
796
|
+
* @returns Server nonce for verification
|
|
797
|
+
*/
|
|
798
|
+
closeInit(): Promise<CloseInitResponse>;
|
|
799
|
+
/**
|
|
800
|
+
* Finalize the account closure process and permanently delete the account
|
|
801
|
+
* @param params Close parameters including nonces
|
|
802
|
+
* @returns Confirmation that the account was closed
|
|
803
|
+
*/
|
|
804
|
+
closeFinal(params: {
|
|
805
|
+
userNonce: string;
|
|
806
|
+
serverNonce: string;
|
|
807
|
+
}): Promise<CloseFinishResponse>;
|
|
808
|
+
/**
|
|
809
|
+
* Raw v1 sign API - Sign a message with user's wallet
|
|
810
|
+
* @param params Sign parameters including network, address, and message
|
|
811
|
+
* @returns Signature string
|
|
812
|
+
*/
|
|
813
|
+
signV1(params: {
|
|
814
|
+
network: Network;
|
|
815
|
+
address: string;
|
|
816
|
+
message: string;
|
|
817
|
+
}): Promise<string>;
|
|
818
|
+
/**
|
|
819
|
+
* Raw v2 sign API - Sign a transaction (Solana or Ethereum EIP712) with user's wallet
|
|
820
|
+
* @param params Sign parameters including network, address, and transaction
|
|
821
|
+
* @returns Signature string
|
|
822
|
+
*/
|
|
823
|
+
signV2(params: {
|
|
824
|
+
network: Network;
|
|
825
|
+
address: string;
|
|
826
|
+
tx: {
|
|
827
|
+
Solana?: string;
|
|
828
|
+
EthereumEip712?: Record<string, unknown>;
|
|
829
|
+
};
|
|
830
|
+
}): Promise<string>;
|
|
831
|
+
/**
|
|
832
|
+
* Raw v3 sign API - Sign a Solana transaction with user's wallet
|
|
833
|
+
* Note: v3 sign API only supports Solana transactions
|
|
834
|
+
* @param params Sign parameters including network, address, and Solana transaction
|
|
835
|
+
* @returns Signature string
|
|
836
|
+
*/
|
|
837
|
+
signV3(params: {
|
|
838
|
+
network: Network;
|
|
839
|
+
address: string;
|
|
840
|
+
tx: {
|
|
841
|
+
Solana: string;
|
|
842
|
+
};
|
|
843
|
+
}): Promise<string>;
|
|
844
|
+
/**
|
|
845
|
+
* Build a Lighter transaction using the server-side build transaction API
|
|
846
|
+
* @param request Lighter build transaction request (with optional wallet_address field)
|
|
847
|
+
* @param walletAddress Optional wallet address (will be added to request if provided)
|
|
848
|
+
* @returns Lighter build transaction response with transaction details
|
|
849
|
+
*/
|
|
850
|
+
lighterBuildTransaction(request: LighterBuildTransactionRequest, walletAddress?: string): Promise<LighterBuildTransactionResponse>;
|
|
851
|
+
/**
|
|
852
|
+
* Generate a Lighter authentication token
|
|
853
|
+
* @param params Auth parameters including account_index and optional wallet_address and expires_in_ms
|
|
854
|
+
* @returns Lighter auth response with token and expiration
|
|
855
|
+
*/
|
|
856
|
+
lighterAuth(params: {
|
|
857
|
+
lighter_account_index: number;
|
|
858
|
+
wallet_address?: string | null;
|
|
859
|
+
expires_in_ms?: number | null;
|
|
860
|
+
}): Promise<LighterAuthResponse>;
|
|
861
|
+
/**
|
|
862
|
+
* Rotate/change the Lighter L2 key for an account
|
|
863
|
+
* @param params Change key parameters including account_index and optional wallet_address
|
|
864
|
+
* @returns Lighter change key response with new public key
|
|
865
|
+
*/
|
|
866
|
+
lighterChangeKey(params: {
|
|
867
|
+
lighter_account_index: number;
|
|
868
|
+
wallet_address?: string | null;
|
|
869
|
+
}): Promise<LighterChangeKeyResponse>;
|
|
870
|
+
/**
|
|
871
|
+
* Sign and build a Hyperliquid exchange transaction
|
|
872
|
+
* @param request Exchange request with action and optional parameters
|
|
873
|
+
* @returns Exchange response with signed payload
|
|
874
|
+
*/
|
|
875
|
+
exchange(request: ExchangeRequest): Promise<ExchangeResponse>;
|
|
596
876
|
}
|
|
597
877
|
type SignTransactionReturnType<serializer extends viem.SerializeTransactionFn<viem.TransactionSerializable> = viem.SerializeTransactionFn<viem.TransactionSerializable>, transaction extends Parameters<serializer>[0] = Parameters<serializer>[0]> = viem.TransactionSerialized<viem.GetTransactionType<transaction>>;
|
|
598
878
|
|
|
@@ -849,5 +1129,5 @@ declare function useCoinbaseOnramp(): {
|
|
|
849
1129
|
getCoinbaseOnrampUrl: (amount: number, blockchain?: "solana" | "ethereum", redirectUrl?: string) => Promise<string>;
|
|
850
1130
|
};
|
|
851
1131
|
|
|
852
|
-
export { ACCESS_TOKEN_KEY, BACKUP_WALLET_INFO, BACKUP_WALLET_TYPE_KEY,
|
|
853
|
-
export type { AccountInfo, ApiResponse,
|
|
1132
|
+
export { ACCESS_TOKEN_KEY, BACKUP_WALLET_INFO, BACKUP_WALLET_TYPE_KEY, LighterGroupingType, LighterMarginMode, LighterOrderSide, LighterOrderType, LighterTimeInForce, Network, STORAGE_STATE_KEY, SWITCHED_ACCOUNT_ADDRESS, SocialType, Storage, VaultId, WALLET_TYPE_KEY, WalletClient, WalletProvider, WalletProviderBackup, WalletType, injectStyles, isVersionedTransaction, theme, useActiveWallet, useCoinbaseOnramp, useConnect, useLoginModal, useWallet, useWalletBackup, useWalletBackupStatus, useWalletStatus };
|
|
1133
|
+
export type { AccountInfo, ApiResponse, BuildTransactionRequest, BuildTransactionResponse, CloseFinishRequest, CloseFinishResponse, CloseInitRequest, CloseInitResponse, CoinbaseOnrampRequest, DeBridgeDlnCreateTxRequest, ExchangePayload, ExchangeRequest, ExchangeResponse, ExchangeSignature, ExportFinishRequest, ExportInitRequest, ExportInitResponse, ExportWallet, ExportWalletResponse, IModalManager, LighterAuthRequest, LighterAuthResponse, LighterBuildTransactionRequest, LighterBuildTransactionResponse, LighterCancelAllOrdersParams, LighterCancelOrderParams, LighterChangeKeyRequest, LighterChangeKeyResponse, LighterCreateSubAccountParams, LighterGeneralTransferParams, LighterGroupedOrderEntry, LighterGroupedOrdersParams, LighterLeverageParams, LighterOrderParams, LighterTxContext, LighterWithdrawParams, LoginModalProps, LoginType, MiddleAccount, MiddleAccountRequest, MultiAccountRequest, OrderState, SignMessageResponse, SignRequestV1, SignRequestV2, SignRequestV3, SignTransactionResponse, SignTransactionReturnType, Social, SocialInfo, SubAccountInfo, SupportedTransactionVersions, TransactionOrVersionedTransaction, TransferRequest, UnsignedTxV2, UnsignedTxV3, UserSession, Wallet, WalletInfo, WalletProviderConfig };
|