jmwallet.wallet.bond_registry
jmwallet.wallet.bond_registry
Fidelity bond registry for persistent storage of bond metadata.
This module provides storage and retrieval of fidelity bond information, including addresses, locktimes, witness scripts, and UTXO tracking.
Classes
BondRegistry
Bases: BaseModel
Registry of all fidelity bonds for a wallet.
Source code in jmwallet/src/jmwallet/wallet/bond_registry.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | |
Attributes
bonds: list[FidelityBondInfo] = []
class-attribute
instance-attribute
version: int = 1
class-attribute
instance-attribute
Functions
add_bond(bond: FidelityBondInfo) -> None
Add a new bond to the registry.
Source code in jmwallet/src/jmwallet/wallet/bond_registry.py
97 98 99 100 101 102 103 104 105 | |
get_active_bonds() -> list[FidelityBondInfo]
Get all funded bonds that are not yet expired.
Source code in jmwallet/src/jmwallet/wallet/bond_registry.py
125 126 127 | |
get_best_bond() -> FidelityBondInfo | None
Get the best bond for advertising.
Selection criteria (in order): 1. Must be funded 2. Must not be expired 3. Highest value wins 4. If tied, longest locktime remaining wins
Source code in jmwallet/src/jmwallet/wallet/bond_registry.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | |
get_bond_by_address(address: str) -> FidelityBondInfo | None
Get a bond by its address.
Source code in jmwallet/src/jmwallet/wallet/bond_registry.py
107 108 109 110 111 112 | |
get_bond_by_index(index: int, locktime: int) -> FidelityBondInfo | None
Get a bond by its index and locktime.
Source code in jmwallet/src/jmwallet/wallet/bond_registry.py
114 115 116 117 118 119 | |
get_funded_bonds() -> list[FidelityBondInfo]
Get all funded bonds.
Source code in jmwallet/src/jmwallet/wallet/bond_registry.py
121 122 123 | |
update_utxo_info(address: str, txid: str, vout: int, value: int, confirmations: int) -> bool
Update UTXO information for a bond.
Source code in jmwallet/src/jmwallet/wallet/bond_registry.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | |
FidelityBondInfo
Bases: BaseModel
Information about a single fidelity bond.
Source code in jmwallet/src/jmwallet/wallet/bond_registry.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | |
Attributes
address: str
instance-attribute
cert_expiry: int | None = None
class-attribute
instance-attribute
cert_privkey: str | None = None
class-attribute
instance-attribute
cert_pubkey: str | None = None
class-attribute
instance-attribute
cert_signature: str | None = None
class-attribute
instance-attribute
confirmations: int | None = None
class-attribute
instance-attribute
created_at: str
instance-attribute
has_certificate: bool
property
Check if this bond has a certificate configured (for cold wallet mode).
index: int
instance-attribute
is_expired: bool
property
Check if the locktime has passed.
is_funded: bool
property
Check if this bond has been funded.
locktime: int
instance-attribute
locktime_human: str
instance-attribute
network: str
instance-attribute
path: str
instance-attribute
pubkey: str
instance-attribute
time_until_unlock: int
property
Seconds until the bond can be unlocked. Returns 0 if already expired.
txid: str | None = None
class-attribute
instance-attribute
value: int | None = None
class-attribute
instance-attribute
vout: int | None = None
class-attribute
instance-attribute
witness_script_hex: str
instance-attribute
Functions
is_certificate_expired(current_block_height: int) -> bool
Check if the certificate has expired based on current block height.
Args: current_block_height: Current blockchain height
Returns: True if certificate is expired or not configured
Source code in jmwallet/src/jmwallet/wallet/bond_registry.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | |
Functions
create_bond_info(address: str, locktime: int, index: int, path: str, pubkey_hex: str, witness_script: bytes, network: str) -> FidelityBondInfo
Create a FidelityBondInfo instance.
Args: address: The P2WSH address locktime: Unix timestamp locktime index: Derivation index path: Full derivation path pubkey_hex: Public key as hex witness_script: The witness script bytes network: Network name
Returns: FidelityBondInfo instance
Source code in jmwallet/src/jmwallet/wallet/bond_registry.py
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 | |
get_active_locktimes(data_dir: Path) -> list[int]
Get all locktimes from the bond registry that have funded, active bonds.
This is useful for the maker bot to automatically discover which locktimes to scan for when syncing fidelity bonds, without requiring the user to manually specify --fidelity-bond-locktime.
Args: data_dir: Data directory path
Returns: List of unique locktimes (Unix timestamps) for active bonds
Source code in jmwallet/src/jmwallet/wallet/bond_registry.py
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | |
get_all_locktimes(data_dir: Path) -> list[int]
Get all locktimes from the bond registry (funded or not).
This includes all bonds in the registry to allow scanning for UTXOs that may have been funded since the last sync.
Args: data_dir: Data directory path
Returns: List of unique locktimes (Unix timestamps) for all bonds
Source code in jmwallet/src/jmwallet/wallet/bond_registry.py
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | |
get_registry_path(data_dir: Path) -> Path
Get the path to the bond registry file.
Source code in jmwallet/src/jmwallet/wallet/bond_registry.py
166 167 168 | |
load_registry(data_dir: Path) -> BondRegistry
Load the bond registry from disk.
Args: data_dir: Data directory path
Returns: BondRegistry instance (empty if file doesn't exist)
Source code in jmwallet/src/jmwallet/wallet/bond_registry.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | |
save_registry(registry: BondRegistry, data_dir: Path) -> None
Save the bond registry to disk.
Args: registry: BondRegistry instance data_dir: Data directory path
Source code in jmwallet/src/jmwallet/wallet/bond_registry.py
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | |