Module BSV::Wallet::Validators ¶
Constants¶
RESERVED_BASKET_NAME ¶
Basket name that is globally reserved and cannot be used.
RESERVED_BASKET_PREFIXES ¶
Reserved basket name prefixes. Basket names beginning with any of these strings are disallowed.
RESERVED_BASKET_SUFFIX ¶
Suffix that is disallowed on basket names.
RESERVED_PROTOCOL_PREFIXES ¶
Reserved protocol name prefixes (BRC-44 and BRC-98). Names beginning with any of these strings are disallowed.
RESERVED_PROTOCOL_SUFFIX ¶
Suffix that is disallowed on protocol names.
Public Class Methods¶
validate_basket!(basket) ¶
Basket name rules — two-zone model (BRC-99 flat zone, BRC-122 structured zone):
Flat zone (no colon): * 5-300 chars, lowercase letters, numbers, and spaces only * no consecutive spaces * must not end with ' basket' * must not start with 'admin' or 'p ' (reserved prefixes) * must not be 'default'
Structured zone (contains a colon): * normalised (stripped and downcased) before validation * 1-300 bytes after normalisation * valid characters: lowercase letters, digits, spaces, colons, dots, hyphens, underscores * no consecutive spaces or consecutive colons * prefix before the first colon must match [a-z][a-z0-9] * content after the first colon must be non-empty after strip * reserved prefixes apply: must not start with 'admin' or 'p ' - @raise* [InvalidParameterError]
validate_counterparty!(counterparty) ¶
Counterparty: 'self', 'anyone', or 66-char hex (compressed pubkey)
validate_description!(description, name = 'description') ¶
Description: 5-50 characters - @raise [InvalidParameterError]
validate_hex_string!(value, name = 'hex_string') ¶
Hex string: even-length hex characters only - @raise [InvalidParameterError]
validate_integer!(value, name, min: = nil, max: = nil) ¶
Integer within bounds - @raise [InvalidParameterError]
validate_key_id!(key_id) ¶
Key ID: 1-800 bytes - @raise [InvalidParameterError]
validate_label!(label) ¶
Label: 1-300 characters - @raise [InvalidParameterError]
validate_outpoint!(outpoint) ¶
Outpoint: "<64-hex-txid>.
validate_protocol_id!(protocol_id) ¶
BRC-100 protocol ID rules: * Array of [security_level, protocol_name] * security_level: Integer 0, 1, or 2 * protocol_name: 5-400 chars (up to 430 for 'specific linkage revelation' protocol) * lowercase letters, numbers, and spaces only * no consecutive spaces * must not end with ' protocol' * must not start with 'admin' (BRC-44) * must not start with 'p ' (BRC-98 reserved)
The name is normalised (stripped and downcased) before validation so that ' MyProtocol ' and 'myprotocol' are treated identically and do not silently fork to different key-derivation paths (F8.7). - @raise [InvalidParameterError]
validate_pub_key_hex!(value, name = 'public_key') ¶
Compressed public key hex: exactly 66 hex characters - @raise [InvalidParameterError]
validate_satoshis!(value, name = 'satoshis') ¶
Satoshis: 1 to 2_100_000_000_000_000 - @raise [InvalidParameterError]
validate_tag!(tag) ¶
Tag: 1-300 characters - @raise [InvalidParameterError]