UNPKG

@faktoryfun/styx-sdk

Version:

Bitcoin deposit SDK for Stacks applications, enabling trustless Bitcoin-to-sBTC deposits

173 lines (172 loc) 4.32 kB
export interface FeeEstimates { low: number; medium: number; high: number; } export interface DepositCreateParams { btcAmount: number; stxReceiver: string; btcSender: string; isBlaze?: boolean; poolId?: string; swapType?: "sbtc" | "usda" | "pepe" | "aibtc"; minTokenOut?: number; dexId?: number; aiAccountReceiver?: string; } export interface DepositUpdateParams { id: string; data: { btcTxId?: string; status?: DepositStatus; }; } export type FeePriority = "low" | "medium" | "high"; export interface TransactionPrepareParams { amount: string; userAddress: string; btcAddress: string; feePriority: FeePriority; walletProvider: "leather" | "xverse" | null; feeRates?: FeeEstimates; poolId?: string; minTokenOut?: number; swapType?: "sbtc" | "usda" | "pepe" | "aibtc"; dexId?: number; aiAccountReceiver?: string; } export interface UTXO { txid: string; vout: number; value: number; status: { confirmed: boolean; block_height?: number; block_hash?: string; block_time?: number; }; address?: string; scriptPubKey?: string; } export interface PreparedTransactionData { utxos: UTXO[]; opReturnData: string; depositAddress: string; fee: number; changeAmount: number; amountInSatoshis: number; feeRate: number; inscriptionCount: number; inputCount: number; outputCount: number; } export interface TransactionDetails { inputCount: number; outputCount: number; totalValueIn: number; primaryOutput: number; changeOutput: number; fee: number; feeRate: number; } export interface ExecuteTransactionResponse { txPsbtHex: string; txPsbtBase64: string; utxos: UTXO[]; addressType: "segwit" | "p2sh" | "legacy"; needsFrontendInputHandling: boolean; transactionDetails: TransactionDetails; } export type DepositStatus = "initiated" | "broadcast" | "processing" | "confirmed" | "refund-requested" | "canceled"; export interface Deposit { id: string; btcAmount: number; sbtcAmount: number | null; stxReceiver: string; btcSender: string; btcTxId: string | null; btcTxBlockHeight: number | null; stxTxId: string | null; stxTxBlockHeight: number | null; status: DepositStatus; createdAt: number | null; updatedAt: number | null; isBlaze?: boolean; poolId?: string; swapType?: "sbtc" | "usda" | "pepe" | "aibtc"; minTokenOut?: number; dexId?: number; } export interface AggregateData { totalDeposits: number; totalVolume: number; uniqueUsers: number; } export interface DepositHistoryResponse { aggregateData: AggregateData; recentDeposits: Deposit[]; } export interface DepositStatusUpdateParams { id: string; data: { btcTxId?: string; status: DepositStatus; }; } export declare enum TransactionPriority { Low = "low", Medium = "medium", High = "high" } export interface PoolStatus { realAvailable: number; estimatedAvailable: number; lastUpdated: number; } export interface BTCPrice { price: number; } export interface ClarityValue { type: string; value: string | ClarityValue | ClarityValue[]; } export interface DecodedClarityValueResponse<T = unknown> { success: boolean; data: { original: ClarityValue | string; decoded: T; }; } export type NetworkType = "mainnet" | "testnet" | "regtest"; export interface PoolConfig { id: string; type: "legacy" | "aibtc"; contractAddress: string; btcAddress: string; name: string; description: string; supportedSwapTypes: string[]; minDepositSats: number; maxDepositSats: number; isActive: boolean; } export interface AllowlistedPair { ftContract: string; dexContract: string; isActive: boolean; } export interface CheckFtPairResponse { success: boolean; action?: "added" | "updated" | "exists"; pair?: AllowlistedPair; totalPairs?: number; error?: string; ftContract?: string; } export interface AIBTCDepositCreateParams extends DepositCreateParams { poolId: "aibtc"; swapType: "sbtc" | "aibtc"; minTokenOut: number; dexContract: string; } export {};