satsterminal-sdk
Version:
A TypeScript SDK for interacting with the SatsTerminal ecosystem.
112 lines (111 loc) • 4.72 kB
TypeScript
import { SatsTerminalConfig, RuneOrder, OrderSummary, UTXO, MarketplacePSBTs, ConfirmPSBTsParams, MarketplaceConfirmationResult, ConfirmPSBTParams, MarketplacePSBT } from './types';
export declare class SatsTerminal {
private readonly config;
constructor(config: SatsTerminalConfig);
/**
* Fetches a quote based on the provided BTC amount and rune name.
* @param btcAmount The amount of BTC.
* @param runeName The name of the rune.
*/
fetchQuote(btcAmount: number, runeName: string): Promise<OrderSummary>;
/**
* Generates a PSBT for Odinswap orders.
* @param orders The list of orders.
* @param address The recipient address.
* @param publicKey The public key of the recipient.
* @param paymentAddress The payment address.
* @param paymentPublicKey The public key of the payment address.
* @param runeName The name of the rune.
*/
private getOdinswapPSBT;
/**
* Generates a PSBT for Magic Eden orders.
* @param orders The list of orders.
* @param address The recipient address.
* @param publicKey The public key of the recipient.
* @param paymentAddress The payment address.
* @param paymentPublicKey The public key of the payment address.
* @param runeName The name of the rune.
*/
private getMagicEdenPSBT;
/**
* Generates a PSBT for OKX orders.
* @param orders The list of orders.
* @param ordinalsAddress The ordinals address.
* @param publicKey The public key of the recipient.
* @param paymentAddress The payment address.
* @param utxos The list of UTXOs.
*/
private getOkxPSBT;
/**
* Generates a PSBT for Unisat orders.
* @param orders The list of orders.
* @param address The recipient address.
* @param publicKey The public key of the recipient.
* @param paymentAddress The payment address.
* @param paymentPublicKey The public key of the payment address.
* @param runeName The name of the rune.
*/
private getUnisatPSBT;
/**
* Confirms a PSBT for OKX orders.
* @param orders The list of orders.
* @param address The recipient address.
* @param publicKey The public key of the recipient.
* @param paymentAddress The payment address.
* @param paymentPublicKey The public key of the payment address.
* @param signedPsbtBase64 The signed PSBT in base64 format.
*/
private confirmOkxPSBT;
/**
* Confirms a PSBT for Magic Eden orders.
* @param orders The list of orders.
* @param address The recipient address.
* @param publicKey The public key of the recipient.
* @param paymentAddress The payment address.
* @param paymentPublicKey The public key of the payment address.
* @param signedPsbtBase64 The signed PSBT in base64 format.
*/
private confirmMagicEdenPSBT;
/**
* Confirms a PSBT for Unisat orders.
* @param swapId The swap ID.
* @param signedPsbtHex The signed PSBT in hex format.
*/
private confirmUnisatPSBT;
/**
* Confirms a PSBT for Odinswap orders.
* @param bidId The swap ID.
* @param signedPsbtBase64 The signed PSBT in base64 format.
*/
private confirmOdinswapPSBT;
/**
* Fetches PSBT from the relevant marketplace based on the orders.
* @param orders The list of orders from a single marketplace
* @param address The recipient address
* @param publicKey The public key of the recipient
* @param paymentAddress The payment address
* @param paymentPublicKey The public key of the payment address
* @param runeName The name of the rune
* @param utxos The list of UTXOs (required for OKX)
*/
fetchPSBTs(orders: RuneOrder[], address: string, publicKey: string, paymentAddress: string, paymentPublicKey: string, runeName: string, utxos: UTXO[] | []): Promise<MarketplacePSBTs>;
/**
* Confirms PSBTs for all relevant marketplaces.
* @param params The parameters for confirming PSBTs
*/
confirmPSBT(params: ConfirmPSBTsParams): Promise<MarketplaceConfirmationResult[]>;
private fetchOkxPSBT;
private getMidFeeRate;
private getHeaders;
/**
* Fetches PSBT for any marketplace.
* @param params The parameters for fetching PSBT
*/
fetchPSBT(orders: RuneOrder[], address: string, publicKey: string, paymentAddress: string, paymentPublicKey: string, utxos: UTXO[], feeRate: number, runeName: string): Promise<MarketplacePSBT>;
/**
* Confirms PSBT for any marketplace.
* @param params The parameters for confirming PSBT
*/
confirmPSBTs(params: ConfirmPSBTParams): Promise<MarketplaceConfirmationResult[]>;
}