nectarbase.ledgertransactions module

class nectarbase.ledgertransactions.Ledger_Transaction(*args: Any, **kwargs: Any)

Bases: Unsigned_Transaction

Create an unsigned transaction and offer method to send it to a ledger device for signing

Parameters:
  • ref_block_num (num)

  • ref_block_prefix (num)

  • expiration (str) – expiration date

  • operations (array) – array of operations

  • custom_chains (dict) – custom chain which should be added to the known chains

add_custom_chains(custom_chain: Mapping[str, Any]) None
getKnownChains() Dict[str, Any]

Return the mapping of known blockchain chains available to this transaction.

Returns:

dict: A mapping where keys are chain identifiers (e.g., “HIVE”, “STEEM” or custom names) and values are the chain metadata/configuration that was registered with this transaction.

getOperationKlass() type[Operation]
get_pubkey(path: str = "48'/13'/0'/0'/0'", request_screen_approval: bool = False, prefix: str = 'STM') PublicKey
sign(path: str = "48'/13'/0'/0'/0'", chain: str = 'HIVE') Ledger_Transaction

Sign the transaction using a Ledger device and attach the resulting signature to this transaction.

Builds APDUs for the given BIP32 path and blockchain chain identifier, sends them to a connected Ledger dongle, collects the final signature returned by the device, and stores it as the transaction’s “signatures” entry.

Parameters:

path (str): BIP32 derivation path to use on the Ledger (default “48’/13’/0’/0’/0’”). chain (str): Chain identifier used when building APDUs (e.g., “HIVE” or “STEEM”).

Returns:

Ledger_Transaction: self with self.data[“signatures”] set to an Array containing the Ledger-produced Signature.

Notes:
  • This method opens a connection to the Ledger device and closes it before returning.

  • Any exceptions raised by the Ledger communication layer are not handled here and will propagate to the caller.