@bitgo/utxo-ord
Version:
Utilities for building ordinals with BitGo utxo-lib
58 lines • 2.86 kB
TypeScript
import { type TapLeafScript, type CoinName } from '@bitgo/wasm-utxo';
export type { TapLeafScript };
/**
* Prepared data for an inscription reveal transaction.
* Compatible with sdk-core's PreparedInscriptionRevealData.
*/
export type PreparedInscriptionRevealData = {
/** The commit address (derived from outputScript for the given network) */
address: string;
/** Estimated virtual size of the reveal transaction */
revealTransactionVSize: number;
/** Tap leaf script for spending the commit output */
tapLeafScript: TapLeafScript;
};
/**
* BIP32-like interface compatible with both utxo-lib and wasm-utxo BIP32 types.
* The publicKey can be Buffer (utxo-lib) or Uint8Array (wasm-utxo).
*/
export interface BIP32Like {
publicKey: Uint8Array;
}
/** Input type for inscription functions - either a BIP32-like key or raw public key bytes */
export type KeyInput = BIP32Like | Uint8Array;
/**
* Create the P2TR output script for an inscription.
*
* @param key - BIP32 key or public key bytes (32-byte x-only or 33-byte compressed)
* @param contentType - MIME type of the inscription (e.g., "text/plain", "image/png")
* @param inscriptionData - The inscription data bytes
* @returns The P2TR output script for the inscription commit address
*/
export declare function createOutputScriptForInscription(key: KeyInput, contentType: string, inscriptionData: Uint8Array): Uint8Array;
/**
* Create inscription reveal data including the commit address and tap leaf script.
*
* @param key - BIP32 key or public key bytes (32-byte x-only or 33-byte compressed)
* @param contentType - MIME type of the inscription (e.g., "text/plain", "image/png")
* @param inscriptionData - The inscription data bytes
* @param coinName - Coin name (e.g., "btc", "tbtc")
* @returns PreparedInscriptionRevealData with address, vsize estimate, and tap leaf script
*/
export declare function createInscriptionRevealData(key: KeyInput, contentType: string, inscriptionData: Uint8Array, coinName: CoinName): PreparedInscriptionRevealData;
/**
* Sign a reveal transaction.
*
* Creates and signs the reveal transaction that spends from the commit output
* and sends the inscription to the recipient.
*
* @param privateKey - 32-byte private key
* @param tapLeafScript - The tap leaf script from createInscriptionRevealData
* @param commitAddress - The commit address
* @param recipientAddress - Where to send the inscription
* @param unsignedCommitTx - The unsigned commit transaction bytes
* @param coinName - Coin name (e.g., "btc", "tbtc")
* @returns The signed PSBT as bytes
*/
export declare function signRevealTransaction(privateKey: Uint8Array, tapLeafScript: TapLeafScript, commitAddress: string, recipientAddress: string, unsignedCommitTx: Uint8Array, coinName: CoinName): Uint8Array;
//# sourceMappingURL=inscriptions.d.ts.map