BSV.Tokens.Factory.StasBtg (bsv_sdk v1.1.0)

Copy Markdown View Source

STAS-BTG transaction factories.

Pure functions that build complete, signed transactions for STAS-BTG token operations: transfer, split, merge, and checkpoint.

Summary

Functions

Build a BTG checkpoint transaction.

Build a BTG merge transaction.

Build a BTG split transaction.

Build a BTG transfer transaction.

Types

btg_checkpoint_config()

@type btg_checkpoint_config() :: %{
  token_utxo: BSV.Tokens.Payment.t(),
  issuer_private_key: BSV.PrivateKey.t(),
  destination: BSV.Tokens.Destination.t(),
  redemption_pkh: <<_::160>>,
  splittable: boolean(),
  funding: BSV.Tokens.Payment.t(),
  fee_rate: non_neg_integer()
}

btg_merge_config()

@type btg_merge_config() :: %{
  token_utxos: [btg_payment()],
  destination: BSV.Tokens.Destination.t(),
  redemption_pkh: <<_::160>>,
  splittable: boolean(),
  funding: BSV.Tokens.Payment.t(),
  fee_rate: non_neg_integer()
}

btg_payment()

@type btg_payment() :: %{
  txid: binary(),
  vout: non_neg_integer(),
  satoshis: non_neg_integer(),
  locking_script: BSV.Script.t(),
  private_key: BSV.PrivateKey.t(),
  prev_raw_tx: binary()
}

btg_split_config()

@type btg_split_config() :: %{
  token_utxo: btg_payment(),
  destinations: [BSV.Tokens.Destination.t()],
  redemption_pkh: <<_::160>>,
  funding: BSV.Tokens.Payment.t(),
  fee_rate: non_neg_integer()
}

btg_transfer_config()

@type btg_transfer_config() :: %{
  token_utxo: btg_payment(),
  destination: BSV.Tokens.Destination.t(),
  redemption_pkh: <<_::160>>,
  splittable: boolean(),
  funding: BSV.Tokens.Payment.t(),
  fee_rate: non_neg_integer()
}

Functions

build_btg_checkpoint_tx(config)

@spec build_btg_checkpoint_tx(btg_checkpoint_config()) ::
  {:ok, BSV.Transaction.t()} | {:error, term()}

Build a BTG checkpoint transaction.

build_btg_merge_tx(config)

@spec build_btg_merge_tx(btg_merge_config()) ::
  {:ok, BSV.Transaction.t()} | {:error, term()}

Build a BTG merge transaction.

build_btg_split_tx(config)

@spec build_btg_split_tx(btg_split_config()) ::
  {:ok, BSV.Transaction.t()} | {:error, term()}

Build a BTG split transaction.

build_btg_transfer_tx(config)

@spec build_btg_transfer_tx(btg_transfer_config()) ::
  {:ok, BSV.Transaction.t()} | {:error, term()}

Build a BTG transfer transaction.