getInscription

Static helper: extracts Bitcoin Computer module inscription data from a raw transaction witness.

Type

static getInscription(
  rawTx: string,
  index: number,
): { contentType: string; body: string }

Parameters

rawTx

Serialized transaction hex.

index

Input index whose witness holds the taproot script-path reveal.

Return Value

contentType and body (module source) for a valid BC protocol envelope. Empty strings if the input has no witness. Throws if the witness is not a valid BC module inscription.

Description

Used for taproot module deploys (moduleStorageType: 'taproot'). Multisig modules use data-output { ept } instead; see deploy and Transaction.onChainMetaData.

Protocol id is BC. Content type is typically text/javascript.

Example

const { contentType, body } = Computer.getInscription(rawTxHex, 0)

See also