Builder for STAS locking scripts.
Supports both the legacy STAS v2 template (P2PKH-only, splittable flag) and the new STAS v3 template (P2MPKH, 2nd variable field, flags, service fields).
The v3 template shares its core logic with STAS 3.0 — the difference is in the trailing metadata (flags and service fields appended after redemption PKH).
Summary
Functions
@spec build_stas_locking_script(<<_::160>>, <<_::160>>, boolean()) :: {:ok, BSV.Script.t()} | {:error, term()}
Build a STAS v2 locking script (legacy).
Uses the v2 template with P2PKH-only ownership and a simple splittable flag. No support for 2nd variable field, flags, or service fields.
Parameters
owner_pkh- 20-byte public key hash of the ownerredemption_pkh- 20-byte public key hash for redemptionsplittable- whether the token can be split
@spec build_stas_v3_locking_script(<<_::160>>, <<_::160>>, keyword()) :: {:ok, BSV.Script.t()} | {:error, term()}
Build a STAS v3 locking script.
Uses the new template with P2MPKH support, 2nd variable field, flags, and service fields. This is the same core template used by STAS 3.0.
Parameters
owner_pkh- 20-byte owner public key hash or multisig script hashredemption_pkh- 20-byte redemption address/MPKHopts- Keyword list of options::action_data-ActionData.t()ornil(default:nil):frozen- whether the UTXO is frozen (default:false):flags-ScriptFlags.t()(default: no flags):service_fields- list of binary service fields (default:[]):optional_data- list of additional data binaries (default:[])