BSV.Tokens.ActionData (bsv_sdk v1.4.0)

Copy Markdown View Source

Additional data attached to a STAS 3.0 action.

Swap Variant

The swap variant carries the full 61-byte swap leg structure:

  • requested_script_hash (32 bytes) — SHA256 of counterparty's locking script tail
  • requested_pkh (20 bytes) — requested recipient public key hash
  • rate_numerator (uint32 LE) — exchange rate numerator
  • rate_denominator (uint32 LE) — exchange rate denominator

Special case: both numerator=0 and denominator=0 indicates swap cancellation.

Summary

Types

swap_fields()

@type swap_fields() :: %{
  requested_script_hash: <<_::256>>,
  requested_pkh: <<_::160>>,
  rate_numerator: non_neg_integer(),
  rate_denominator: non_neg_integer()
}

t()

@type t() :: {:swap, swap_fields()} | {:custom, binary()}