From d879551fb0037e28961a8f6ccfece6626cfbe7e0 Mon Sep 17 00:00:00 2001 From: bbrtj Date: Fri, 26 Jul 2024 21:00:12 +0200 Subject: [PATCH] Add documentation for Bitcoin::Crypto::Types --- Changes | 1 + lib/Bitcoin/Crypto/Types.pm | 87 ++++++++++++++++++++++++++++++++++++- 2 files changed, 86 insertions(+), 2 deletions(-) diff --git a/Changes b/Changes index 6e56ea3..7675292 100644 --- a/Changes +++ b/Changes @@ -3,6 +3,7 @@ Revision history for Perl extension Bitcoin::Crypto. 2.006 NOT RELEASED [Improvements] - test suite now uses Test2 + - Bitcoin::Crypto::Types is now documented 2.005 Wed Jul 24 2024 [Added interface] diff --git a/lib/Bitcoin/Crypto/Types.pm b/lib/Bitcoin/Crypto/Types.pm index b38189a..65bb142 100644 --- a/lib/Bitcoin/Crypto/Types.pm +++ b/lib/Bitcoin/Crypto/Types.pm @@ -161,6 +161,89 @@ __PACKAGE__->make_immutable; 1; -# This module is mostly used internally, but it can be used from outside for -# bitcoin-specific types like BIP44Purpose. +__END__ +=head1 NAME + +Bitcoin::Crypto::Types - Bitcoin-specific data types + +=head1 SYNOPSIS + + use Bitcoin::Crypto::Types qw( + BIP44Purpose + FormatStr + FormatDesc + ByteStr + ScriptType + ScriptDesc + BitcoinScript + PSBTMapType + PSBTFieldType + IntMaxBits + SatoshiAmount + ); + +=head1 DESCRIPTION + +This module is a L library for types which are either specific for +Bitcoin or are used by Bitcoin::Crypto to implement its routines. + +=head1 AVAILABLE TYPES + +=head2 BIP44Purpose + +An integer with one of the available purpose numbers for BIP44, like C<44>. + +=head2 FormatStr + +A string with one of the available format names, like C. + +=head2 FormatDesc + +An array reference with exactly two elements, where the first one is +L and the second one is a string with the data encoded in that +format. + +=head2 ByteStr + +A string where each character is 8 bit. Can be coerced from L. + +=head2 ScriptType + +A string with one of the available script type names, like C. + +=head2 ScriptDesc + +An array reference with exactly two elements, where the first one is +L or a string C
, and the second one is defined data +specific for that script type. + +=head2 BitcoinScript + +An instance of L. Can be coerced from L +or L (or any of its coercion types). + +=head2 PSBTMapType + +A string with one of the available PSBT map type names, like C. + +=head2 PSBTFieldType + +An instance of L. Can be coerced from a +string name of the PSBT field, or from an array reference of two values, where +the first one is L and the second one is a positive integer with +field code. + +=head2 IntMaxBits + +A non-negative integer which must be small enough to be representable with the +specified number of bits (parametrizable). + +=head2 SatoshiAmount + +A non-negative integer, represented as L object. Can be coerced +from an integer or from a string. + +=head1 SEE ALSO + +L