superstack-wallet-sdk 0.5.1 → 0.5.3

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.ts CHANGED
@@ -190,6 +190,138 @@ type BuildTransactionRequest = {
190
190
  interface BuildTransactionResponse {
191
191
  raw_transaction: string;
192
192
  }
193
+ type BigDecimalString = string;
194
+ declare enum BorrowedAsset {
195
+ HypercorePerpsUSDC = "HypercorePerpsUSDC"
196
+ }
197
+ declare enum CollateralAsset {
198
+ HypercoreSpotBTC = "HypercoreSpotBTC"
199
+ }
200
+ declare enum CrossMarginPositionStatus {
201
+ Open = "Open",
202
+ Closed = "Closed",
203
+ PartiallyLiquidated = "PartiallyLiquidated",
204
+ AllLiquidated = "AllLiquidated"
205
+ }
206
+ declare enum CrossMarginOperationType {
207
+ Borrow = "Borrow",
208
+ Repay = "Repay",
209
+ AddMargin = "AddMargin",
210
+ RemoveMargin = "RemoveMargin",
211
+ Liquidation = "Liquidation"
212
+ }
213
+ interface CollateralAssetInfo {
214
+ amount: BigDecimalString;
215
+ contribution?: number;
216
+ liquidation_price?: number;
217
+ }
218
+ interface CrossMarginBorrowQuoteRequest {
219
+ collateral_assets: Partial<Record<CollateralAsset, BigDecimalString>>;
220
+ }
221
+ interface CrossMarginBorrowQuoteResponse {
222
+ quote_id: string;
223
+ collateral_asset_infos: Record<CollateralAsset, CollateralAssetInfo>;
224
+ total_collateral_value: number;
225
+ borrowed_asset: BorrowedAsset;
226
+ max_borrowed_amount: BigDecimalString;
227
+ max_borrowed_value: number;
228
+ created_at: number;
229
+ expires_at: number;
230
+ }
231
+ interface CrossMarginBorrowRequest {
232
+ network: Network;
233
+ address: string;
234
+ quote_id: string;
235
+ collateral_assets: Partial<Record<CollateralAsset, BigDecimalString>>;
236
+ borrowed_asset: BorrowedAsset;
237
+ borrowed_amount: BigDecimalString;
238
+ }
239
+ interface CrossMarginBorrowResponse {
240
+ position_id: string;
241
+ }
242
+ interface CrossMarginRepayQuoteRequest {
243
+ position_id: string;
244
+ }
245
+ interface CrossMarginRepayQuoteResponse {
246
+ quote_id: string;
247
+ repay_asset: BorrowedAsset;
248
+ borrowed_amount: BigDecimalString;
249
+ interest_cost: BigDecimalString;
250
+ repay_amount: BigDecimalString;
251
+ created_at: number;
252
+ expires_at: number;
253
+ }
254
+ interface CrossMarginRepayRequest {
255
+ position_id: string;
256
+ quote_id: string;
257
+ repay_asset: BorrowedAsset;
258
+ repay_amount: BigDecimalString;
259
+ }
260
+ interface CrossMarginRepayResponse {
261
+ position_id: string;
262
+ }
263
+ interface CrossMarginAdjustMarginRequest {
264
+ position_id: string;
265
+ is_add_margin: boolean;
266
+ collateral_assets: Partial<Record<CollateralAsset, BigDecimalString>>;
267
+ }
268
+ interface CrossMarginAdjustMarginResponse {
269
+ position_id: string;
270
+ }
271
+ interface BorrowedAssetGeneralInfo {
272
+ interest_rate_hourly: number;
273
+ interest_rate_annual: number;
274
+ available_amount: number;
275
+ max_borrowable_amount: number;
276
+ }
277
+ interface CollateralAssetGeneralInfo {
278
+ liquidation_threshold: number;
279
+ h_vol: number;
280
+ price: number;
281
+ }
282
+ interface CrossMarginGeneralInfoResponse {
283
+ collateral_info: Record<CollateralAsset, CollateralAssetGeneralInfo>;
284
+ borrowed_info: Record<BorrowedAsset, BorrowedAssetGeneralInfo>;
285
+ }
286
+ interface UserOpenPositionInfo {
287
+ position_id: string;
288
+ collateral_assets: Record<CollateralAsset, CollateralAssetInfo>;
289
+ borrowed_asset: BorrowedAsset;
290
+ borrowed_amount: BigDecimalString;
291
+ created_at: number;
292
+ updated_at: number;
293
+ current_ltv: number;
294
+ margin_call_ltv: number;
295
+ liquidation_ltv: number;
296
+ interest_cost: number;
297
+ }
298
+ interface UserOpenPositionsResponse {
299
+ positions: UserOpenPositionInfo[];
300
+ }
301
+ interface UserClosedPositionInfo {
302
+ position_id: string;
303
+ collateral_assets: Record<CollateralAsset, CollateralAssetInfo>;
304
+ borrowed_asset: BorrowedAsset;
305
+ borrowed_amount: BigDecimalString;
306
+ created_at: number;
307
+ closed_at: number;
308
+ interest_cost: number;
309
+ status: CrossMarginPositionStatus;
310
+ repaid_amount?: number;
311
+ }
312
+ interface UserOperationInfo {
313
+ position_id: string;
314
+ operation_id: string;
315
+ created_at: number;
316
+ finished_at: number;
317
+ operation_type: CrossMarginOperationType;
318
+ amount: BigDecimalString;
319
+ symbol: string;
320
+ }
321
+ interface UserHistoryResponse {
322
+ positions: UserClosedPositionInfo[];
323
+ operations: UserOperationInfo[];
324
+ }
193
325
 
194
326
  interface PhantomWalletAdapterConfig {
195
327
  }
@@ -400,6 +532,14 @@ declare class WalletClient {
400
532
  * @returns Build transaction response with raw transaction
401
533
  */
402
534
  buildTransaction(request: BuildTransactionRequest): Promise<BuildTransactionResponse>;
535
+ getCrossMarginGeneralInfo(): Promise<CrossMarginGeneralInfoResponse>;
536
+ getCrossMarginBorrowQuote(payload: CrossMarginBorrowQuoteRequest): Promise<CrossMarginBorrowQuoteResponse>;
537
+ borrowCrossMargin(payload: CrossMarginBorrowRequest): Promise<CrossMarginBorrowResponse>;
538
+ getCrossMarginRepayQuote(payload: CrossMarginRepayQuoteRequest): Promise<CrossMarginRepayQuoteResponse>;
539
+ repayCrossMargin(payload: CrossMarginRepayRequest): Promise<CrossMarginRepayResponse>;
540
+ adjustCrossMarginMargin(payload: CrossMarginAdjustMarginRequest): Promise<CrossMarginAdjustMarginResponse>;
541
+ getCrossMarginOpenPositions(): Promise<UserOpenPositionsResponse>;
542
+ getCrossMarginHistory(): Promise<UserHistoryResponse>;
403
543
  }
404
544
  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>>;
405
545
 
@@ -615,5 +755,5 @@ declare function useCoinbaseOnramp(): {
615
755
  getCoinbaseOnrampUrl: (amount: number, blockchain?: "solana" | "ethereum", redirectUrl?: string) => Promise<string>;
616
756
  };
617
757
 
618
- export { ACCESS_TOKEN_KEY, Network, STORAGE_STATE_KEY, SWITCHED_ACCOUNT_ADDRESS, SocialType, Storage, VaultId, WALLET_TYPE_KEY, WalletClient, WalletProvider, WalletType, injectStyles, isVersionedTransaction, theme, useActiveWallet, useCoinbaseOnramp, useConnect, useLoginModal, useWallet, useWalletStatus };
619
- export type { AccountInfo, ApiResponse, BuildTransactionRequest, BuildTransactionResponse, CoinbaseOnrampRequest, IModalManager, LoginModalProps, LoginType, MiddleAccount, MiddleAccountRequest, OrderState, SignMessageResponse, SignRequestV1, SignRequestV2, SignTransactionResponse, SignTransactionReturnType, Social, SocialInfo, SupportedTransactionVersions, TransactionOrVersionedTransaction, TransferRequest, UnsignedTx, UserSession, Wallet, WalletInfo, WalletProviderConfig };
758
+ export { ACCESS_TOKEN_KEY, BorrowedAsset, CollateralAsset, CrossMarginOperationType, CrossMarginPositionStatus, Network, STORAGE_STATE_KEY, SWITCHED_ACCOUNT_ADDRESS, SocialType, Storage, VaultId, WALLET_TYPE_KEY, WalletClient, WalletProvider, WalletType, injectStyles, isVersionedTransaction, theme, useActiveWallet, useCoinbaseOnramp, useConnect, useLoginModal, useWallet, useWalletStatus };
759
+ export type { AccountInfo, ApiResponse, BigDecimalString, BorrowedAssetGeneralInfo, BuildTransactionRequest, BuildTransactionResponse, CoinbaseOnrampRequest, CollateralAssetGeneralInfo, CollateralAssetInfo, CrossMarginAdjustMarginRequest, CrossMarginAdjustMarginResponse, CrossMarginBorrowQuoteRequest, CrossMarginBorrowQuoteResponse, CrossMarginBorrowRequest, CrossMarginBorrowResponse, CrossMarginGeneralInfoResponse, CrossMarginRepayQuoteRequest, CrossMarginRepayQuoteResponse, CrossMarginRepayRequest, CrossMarginRepayResponse, IModalManager, LoginModalProps, LoginType, MiddleAccount, MiddleAccountRequest, OrderState, SignMessageResponse, SignRequestV1, SignRequestV2, SignTransactionResponse, SignTransactionReturnType, Social, SocialInfo, SupportedTransactionVersions, TransactionOrVersionedTransaction, TransferRequest, UnsignedTx, UserClosedPositionInfo, UserHistoryResponse, UserOpenPositionInfo, UserOpenPositionsResponse, UserOperationInfo, UserSession, Wallet, WalletInfo, WalletProviderConfig };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "superstack-wallet-sdk",
3
- "version": "0.5.1",
3
+ "version": "0.5.3",
4
4
  "description": "A wallet SDK for superstack",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",