superstack-wallet-sdk 0.5.6 → 0.5.8
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 +44 -11
- package/dist/esm/types/types.d.ts +50 -147
- package/dist/index.cjs +123 -123
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +95 -159
- 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",
|
|
@@ -236,138 +270,7 @@ type BuildTransactionRequest = {
|
|
|
236
270
|
};
|
|
237
271
|
interface BuildTransactionResponse {
|
|
238
272
|
raw_transaction: string;
|
|
239
|
-
|
|
240
|
-
type BigDecimalString = string;
|
|
241
|
-
declare enum BorrowedAsset {
|
|
242
|
-
HypercorePerpsUSDC = "HypercorePerpsUSDC"
|
|
243
|
-
}
|
|
244
|
-
declare enum CollateralAsset {
|
|
245
|
-
HypercoreSpotBTC = "HypercoreSpotBTC"
|
|
246
|
-
}
|
|
247
|
-
declare enum CrossMarginPositionStatus {
|
|
248
|
-
Open = "Open",
|
|
249
|
-
Closed = "Closed",
|
|
250
|
-
PartiallyLiquidated = "PartiallyLiquidated",
|
|
251
|
-
AllLiquidated = "AllLiquidated"
|
|
252
|
-
}
|
|
253
|
-
declare enum CrossMarginOperationType {
|
|
254
|
-
Borrow = "Borrow",
|
|
255
|
-
Repay = "Repay",
|
|
256
|
-
AddMargin = "AddMargin",
|
|
257
|
-
RemoveMargin = "RemoveMargin",
|
|
258
|
-
Liquidation = "Liquidation"
|
|
259
|
-
}
|
|
260
|
-
interface CollateralAssetInfo {
|
|
261
|
-
amount: BigDecimalString;
|
|
262
|
-
contribution?: number;
|
|
263
|
-
liquidation_price?: number;
|
|
264
|
-
}
|
|
265
|
-
interface CrossMarginBorrowQuoteRequest {
|
|
266
|
-
collateral_assets: Partial<Record<CollateralAsset, BigDecimalString>>;
|
|
267
|
-
}
|
|
268
|
-
interface CrossMarginBorrowQuoteResponse {
|
|
269
|
-
quote_id: string;
|
|
270
|
-
collateral_asset_infos: Record<CollateralAsset, CollateralAssetInfo>;
|
|
271
|
-
total_collateral_value: number;
|
|
272
|
-
borrowed_asset: BorrowedAsset;
|
|
273
|
-
max_borrowed_amount: BigDecimalString;
|
|
274
|
-
max_borrowed_value: number;
|
|
275
|
-
created_at: number;
|
|
276
|
-
expires_at: number;
|
|
277
|
-
}
|
|
278
|
-
interface CrossMarginBorrowRequest {
|
|
279
|
-
network: Network;
|
|
280
|
-
address: string;
|
|
281
|
-
quote_id: string;
|
|
282
|
-
collateral_assets: Partial<Record<CollateralAsset, BigDecimalString>>;
|
|
283
|
-
borrowed_asset: BorrowedAsset;
|
|
284
|
-
borrowed_amount: BigDecimalString;
|
|
285
|
-
}
|
|
286
|
-
interface CrossMarginBorrowResponse {
|
|
287
|
-
position_id: string;
|
|
288
|
-
}
|
|
289
|
-
interface CrossMarginRepayQuoteRequest {
|
|
290
|
-
position_id: string;
|
|
291
|
-
}
|
|
292
|
-
interface CrossMarginRepayQuoteResponse {
|
|
293
|
-
quote_id: string;
|
|
294
|
-
repay_asset: BorrowedAsset;
|
|
295
|
-
borrowed_amount: BigDecimalString;
|
|
296
|
-
interest_cost: BigDecimalString;
|
|
297
|
-
repay_amount: BigDecimalString;
|
|
298
|
-
created_at: number;
|
|
299
|
-
expires_at: number;
|
|
300
|
-
}
|
|
301
|
-
interface CrossMarginRepayRequest {
|
|
302
|
-
position_id: string;
|
|
303
|
-
quote_id: string;
|
|
304
|
-
repay_asset: BorrowedAsset;
|
|
305
|
-
repay_amount: BigDecimalString;
|
|
306
|
-
}
|
|
307
|
-
interface CrossMarginRepayResponse {
|
|
308
|
-
position_id: string;
|
|
309
|
-
}
|
|
310
|
-
interface CrossMarginAdjustMarginRequest {
|
|
311
|
-
position_id: string;
|
|
312
|
-
is_add_margin: boolean;
|
|
313
|
-
collateral_assets: Partial<Record<CollateralAsset, BigDecimalString>>;
|
|
314
|
-
}
|
|
315
|
-
interface CrossMarginAdjustMarginResponse {
|
|
316
|
-
position_id: string;
|
|
317
|
-
}
|
|
318
|
-
interface BorrowedAssetGeneralInfo {
|
|
319
|
-
interest_rate_hourly: number;
|
|
320
|
-
interest_rate_annual: number;
|
|
321
|
-
available_amount: number;
|
|
322
|
-
max_borrowable_amount: number;
|
|
323
|
-
}
|
|
324
|
-
interface CollateralAssetGeneralInfo {
|
|
325
|
-
liquidation_threshold: number;
|
|
326
|
-
h_vol: number;
|
|
327
|
-
price: number;
|
|
328
|
-
}
|
|
329
|
-
interface CrossMarginGeneralInfoResponse {
|
|
330
|
-
collateral_info: Record<CollateralAsset, CollateralAssetGeneralInfo>;
|
|
331
|
-
borrowed_info: Record<BorrowedAsset, BorrowedAssetGeneralInfo>;
|
|
332
|
-
}
|
|
333
|
-
interface UserOpenPositionInfo {
|
|
334
|
-
position_id: string;
|
|
335
|
-
collateral_assets: Record<CollateralAsset, CollateralAssetInfo>;
|
|
336
|
-
borrowed_asset: BorrowedAsset;
|
|
337
|
-
borrowed_amount: BigDecimalString;
|
|
338
|
-
created_at: number;
|
|
339
|
-
updated_at: number;
|
|
340
|
-
current_ltv: number;
|
|
341
|
-
margin_call_ltv: number;
|
|
342
|
-
liquidation_ltv: number;
|
|
343
|
-
interest_cost: number;
|
|
344
|
-
}
|
|
345
|
-
interface UserOpenPositionsResponse {
|
|
346
|
-
positions: UserOpenPositionInfo[];
|
|
347
|
-
}
|
|
348
|
-
interface UserClosedPositionInfo {
|
|
349
|
-
position_id: string;
|
|
350
|
-
collateral_assets: Record<CollateralAsset, CollateralAssetInfo>;
|
|
351
|
-
borrowed_asset: BorrowedAsset;
|
|
352
|
-
borrowed_amount: BigDecimalString;
|
|
353
|
-
created_at: number;
|
|
354
|
-
closed_at: number;
|
|
355
|
-
interest_cost: number;
|
|
356
|
-
status: CrossMarginPositionStatus;
|
|
357
|
-
repaid_amount?: number;
|
|
358
|
-
}
|
|
359
|
-
interface UserOperationInfo {
|
|
360
|
-
position_id: string;
|
|
361
|
-
operation_id: string;
|
|
362
|
-
created_at: number;
|
|
363
|
-
finished_at: number;
|
|
364
|
-
operation_type: CrossMarginOperationType;
|
|
365
|
-
amount: BigDecimalString;
|
|
366
|
-
symbol: string;
|
|
367
|
-
}
|
|
368
|
-
interface UserHistoryResponse {
|
|
369
|
-
positions: UserClosedPositionInfo[];
|
|
370
|
-
operations: UserOperationInfo[];
|
|
273
|
+
metadata?: any;
|
|
371
274
|
}
|
|
372
275
|
|
|
373
276
|
interface PhantomWalletAdapterConfig {
|
|
@@ -454,8 +357,44 @@ declare class WalletClient {
|
|
|
454
357
|
get social_links(): Social[] | null;
|
|
455
358
|
reconnect(isBackup?: boolean): Promise<WalletInfo | null>;
|
|
456
359
|
connectPhantom(): Promise<WalletInfo | null>;
|
|
457
|
-
updateAccountName(name: string): Promise<
|
|
360
|
+
updateAccountName(name: string, accountIndex?: number): Promise<WalletInfo>;
|
|
361
|
+
/**
|
|
362
|
+
* Create, enable, or disable a sub-account
|
|
363
|
+
* @param request Multi-account request with type and data
|
|
364
|
+
* @returns Updated wallet info
|
|
365
|
+
*/
|
|
366
|
+
manageMultiAccount(request: MultiAccountRequest): Promise<WalletInfo>;
|
|
367
|
+
/**
|
|
368
|
+
* Create a new sub-account
|
|
369
|
+
* @param name Optional name for the sub-account
|
|
370
|
+
* @returns Updated wallet info
|
|
371
|
+
*/
|
|
372
|
+
createSubAccount(name?: string | null): Promise<WalletInfo>;
|
|
373
|
+
/**
|
|
374
|
+
* Enable a sub-account by index
|
|
375
|
+
* @param index Account index to enable
|
|
376
|
+
* @returns Updated wallet info
|
|
377
|
+
*/
|
|
378
|
+
enableSubAccount(index: number): Promise<WalletInfo>;
|
|
379
|
+
/**
|
|
380
|
+
* Disable a sub-account by index
|
|
381
|
+
* @param index Account index to disable
|
|
382
|
+
* @returns Updated wallet info
|
|
383
|
+
*/
|
|
384
|
+
disableSubAccount(index: number): Promise<WalletInfo>;
|
|
385
|
+
/**
|
|
386
|
+
* This method is used to sign a solana transaction with v3 sign api,
|
|
387
|
+
* which is enabled in default.
|
|
388
|
+
* @param transaction Solana transaction to sign
|
|
389
|
+
* @returns signed transaction
|
|
390
|
+
*/
|
|
458
391
|
signSolanaTransaction(transaction: Transaction | VersionedTransaction): Promise<Transaction | VersionedTransaction>;
|
|
392
|
+
/**
|
|
393
|
+
* This method is used to sign a ethereum eip712 transaction with v2 sign api,
|
|
394
|
+
* which is disabled in default.
|
|
395
|
+
* @param params Ethereum eip712 transaction parameters
|
|
396
|
+
* @returns signature
|
|
397
|
+
*/
|
|
459
398
|
signEthereumEip712(params: {
|
|
460
399
|
domain: {
|
|
461
400
|
name: string;
|
|
@@ -530,6 +469,11 @@ declare class WalletClient {
|
|
|
530
469
|
getSolanaBalance(): Promise<string>;
|
|
531
470
|
getEthereumBalance(): Promise<string>;
|
|
532
471
|
fetchCoinbaseToken(address: string, blockchain?: "solana" | "ethereum"): Promise<string>;
|
|
472
|
+
/**
|
|
473
|
+
* This method is used to sign a ethereum eip712 transaction with v2 sign api,
|
|
474
|
+
* which is disabled in default.
|
|
475
|
+
* @returns viem signer adapter
|
|
476
|
+
*/
|
|
533
477
|
viemSignerAdapter(): {
|
|
534
478
|
signTypedData: (params: {
|
|
535
479
|
domain: {
|
|
@@ -583,15 +527,7 @@ declare class WalletClient {
|
|
|
583
527
|
* @param request Build transaction request
|
|
584
528
|
* @returns Build transaction response with raw transaction
|
|
585
529
|
*/
|
|
586
|
-
buildTransaction(request: BuildTransactionRequest): Promise<BuildTransactionResponse>;
|
|
587
|
-
getCrossMarginGeneralInfo(): Promise<CrossMarginGeneralInfoResponse>;
|
|
588
|
-
getCrossMarginBorrowQuote(payload: CrossMarginBorrowQuoteRequest): Promise<CrossMarginBorrowQuoteResponse>;
|
|
589
|
-
borrowCrossMargin(payload: CrossMarginBorrowRequest): Promise<CrossMarginBorrowResponse>;
|
|
590
|
-
getCrossMarginRepayQuote(payload: CrossMarginRepayQuoteRequest): Promise<CrossMarginRepayQuoteResponse>;
|
|
591
|
-
repayCrossMargin(payload: CrossMarginRepayRequest): Promise<CrossMarginRepayResponse>;
|
|
592
|
-
adjustCrossMarginMargin(payload: CrossMarginAdjustMarginRequest): Promise<CrossMarginAdjustMarginResponse>;
|
|
593
|
-
getCrossMarginOpenPositions(): Promise<UserOpenPositionsResponse>;
|
|
594
|
-
getCrossMarginHistory(): Promise<UserHistoryResponse>;
|
|
530
|
+
buildTransaction(request: BuildTransactionRequest, walletAddress?: string): Promise<BuildTransactionResponse>;
|
|
595
531
|
}
|
|
596
532
|
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>>;
|
|
597
533
|
|
|
@@ -848,5 +784,5 @@ declare function useCoinbaseOnramp(): {
|
|
|
848
784
|
getCoinbaseOnrampUrl: (amount: number, blockchain?: "solana" | "ethereum", redirectUrl?: string) => Promise<string>;
|
|
849
785
|
};
|
|
850
786
|
|
|
851
|
-
export { ACCESS_TOKEN_KEY, BACKUP_WALLET_INFO, BACKUP_WALLET_TYPE_KEY,
|
|
852
|
-
export type { AccountInfo, ApiResponse,
|
|
787
|
+
export { ACCESS_TOKEN_KEY, BACKUP_WALLET_INFO, BACKUP_WALLET_TYPE_KEY, 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 };
|
|
788
|
+
export type { AccountInfo, ApiResponse, BuildTransactionRequest, BuildTransactionResponse, CoinbaseOnrampRequest, DeBridgeDlnCreateTxRequest, IModalManager, LoginModalProps, LoginType, MiddleAccount, MiddleAccountRequest, MultiAccountRequest, OrderState, SignMessageResponse, SignRequestV1, SignRequestV2, SignRequestV3, SignTransactionResponse, SignTransactionReturnType, Social, SocialInfo, SubAccountInfo, SupportedTransactionVersions, TransactionOrVersionedTransaction, TransferRequest, UnsignedTxV2, UnsignedTxV3, UserSession, Wallet, WalletInfo, WalletProviderConfig };
|