cashscript_py.interfaces module
Shared interfaces and simple data models used across the public API.
- class ContractUnlocker(generate_locking_bytecode: Callable[[], bytes], generate_unlocking_bytecode: Callable[[Transaction, list[Output], int], bytes], contract: cashscript_py.Contract, params: list[FunctionArgument], abi_function: dict[str, Any])[source]
Bases:
UnlockerUnlocker associated with a Contract ABI function and its parameters.
- class HashType(*values)[source]
Bases:
FlagSupported SIGHASH flags.
- SIGHASH_ALL = 1
- SIGHASH_ANYONECANPAY = 128
- SIGHASH_FORKID = 64
- SIGHASH_NONE = 2
- SIGHASH_SINGLE = 3
- SIGHASH_UTXOS = 32
- class NftCapability(*values)[source]
Bases:
StrEnumNFT CashTokens capabilities.
- MINTING = 'minting'
- MUTABLE = 'mutable'
- NONE = 'none'
- class Output(to: bytes | str, amount: int, token: TokenDetails | None = None)[source]
Bases:
objectTransaction output description.
- to
Recipient locking bytecode (bytes) or CashAddress (str).
- amount
BCH amount in satoshis.
- token
Optional CashToken details.
- class SignatureAlgorithm(*values)[source]
Bases:
FlagSupported signature algorithms.
- ECDSA = 0
- SCHNORR = 1
- class TokenDetails(amount: int | None, category: str, nft: Nft | None)[source]
Bases:
objectCashToken details: fungible amount and optional NFT.
- class Nft(capability: NftCapability, commitment: str | None)[source]
Bases:
objectNested NFT metadata.
- class Transaction(inputs: list[UnlockableUtxo], locktime: int, outputs: list[Output], version: int)[source]
Bases:
objectSimple transaction template used for signing and serialization.
- class TransactionDetails(inputs: list[UnlockableUtxo], locktime: int, outputs: list[Output], version: int)[source]
Bases:
TransactionTransaction including txid and hex representation.
- hex: str
- txid: str
- class UnlockableUtxo(txid: str, vout: int, satoshis: int, token: TokenDetails | None, unlocker: Unlocker, sequence: int | None)[source]
Bases:
UtxoUtxo extended with an unlocker and optional input options.
- classmethod from_utxo(utxo: Utxo, unlocker: Unlocker, sequence: int | None) UnlockableUtxo[source]
Construct an UnlockableUtxo from a plain Utxo and an Unlocker.
- sequence: int | None
- class Unlocker(generate_locking_bytecode: Callable[[], bytes], generate_unlocking_bytecode: Callable[[Transaction, list[Output], int], bytes])[source]
Bases:
objectUnlocker providing locking/unlocking bytecode generators.
- class Utxo(txid: str, vout: int, satoshis: int, token: TokenDetails | None = None)[source]
Bases:
objectSpendable output reference with optional CashToken details.