Documentation
¶
Overview ¶
Package binarycodec provides encoding and decoding functionality for XRPL binary format.
Index ¶
- Variables
- func Decode(hexEncoded string) (map[string]any, error)
- func DecodeQuality(quality string) (string, error)
- func Encode(json map[string]any) (string, error)
- func EncodeForMultisigning(json map[string]any, xrpAccountID string) (string, error)
- func EncodeForSigning(json map[string]any) (string, error)
- func EncodeForSigningBatch(json map[string]any) (string, error)
- func EncodeForSigningClaim(json map[string]any) (string, error)
- func EncodeQuality(quality string) (string, error)
- type LedgerData
Constants ¶
This section is empty.
Variables ¶
var ( // ErrSigningClaimFieldNotFound is returned when the 'Channel' & 'Amount' fields are both required, but were not found. ErrSigningClaimFieldNotFound = errors.New("'Channel' & 'Amount' fields are both required, but were not found") // ErrBatchFlagsFieldNotFound is returned when the 'flags' field is missing. ErrBatchFlagsFieldNotFound = errors.New("no field `flags`") // ErrBatchTxIDsFieldNotFound is returned when the 'txIDs' field is missing. ErrBatchTxIDsFieldNotFound = errors.New("no field `txIDs`") // ErrBatchTxIDsNotArray is returned when the 'txIDs' field is not an array. ErrBatchTxIDsNotArray = errors.New("txIDs field must be an array") // ErrBatchTxIDNotString is returned when a txID is not a string. ErrBatchTxIDNotString = errors.New("each txID must be a string") // ErrBatchFlagsNotUInt32 is returned when the 'flags' field is not a uint32. ErrBatchFlagsNotUInt32 = errors.New("flags field must be a uint32") // ErrBatchTxIDsLengthTooLong is returned when the 'txIDs' field is too long. ErrBatchTxIDsLengthTooLong = errors.New("txIDs length exceeds maximum uint32 value") )
var ErrInvalidQuality = errors.New("invalid quality")
ErrInvalidQuality is returned when the quality is invalid.
Functions ¶
func Decode ¶
Decode decodes a hex string in the canonical binary format into a JSON transaction object.
func DecodeQuality ¶
DecodeQuality decodes a quality amount from a hex string to a string.
func Encode ¶
Encode converts a JSON transaction object to a hex string in the canonical binary format. The binary format is defined in XRPL's core codebase.
func EncodeForMultisigning ¶
EncodeForMultisigning encodes a transaction into binary format in preparation for providing one signature towards a multi-signed transaction. Only encodes fields that are intended to be signed. NOTE: The caller is responsible for setting SigningPubKey to "" for regular multisigning. For counterparty signing (e.g. LoanSet), SigningPubKey must remain set to the first signer's public key, so this function must not overwrite it.
func EncodeForSigning ¶
EncodeForSigning encodes a transaction into binary format in preparation for signing.
func EncodeForSigningBatch ¶ added in v0.1.11
EncodeForSigningBatch encodes a batch transaction into binary format in preparation for signing.
func EncodeForSigningClaim ¶
EncodeForSigningClaim encodes a payment channel claim into binary format in preparation for signing.
func EncodeQuality ¶
EncodeQuality encodes a quality amount to a hex string.
Types ¶
type LedgerData ¶
type LedgerData struct {
LedgerIndex uint32
TotalCoins string
ParentHash string
TransactionHash string
AccountHash string
ParentCloseTime uint32
CloseTime uint32
CloseTimeResolution uint8
CloseFlags uint8
}
LedgerData represents the data of a ledger.
func DecodeLedgerData ¶
func DecodeLedgerData(data string) (LedgerData, error)
DecodeLedgerData decodes a hex string in the canonical binary format into a LedgerData object. The hex string should represent a ledger data object.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package definitions contains XRPL binary codec field and type definitions.
|
Package definitions contains XRPL binary codec field and type definitions. |
|
Package serdes provides utilities to parse and serialize XRPL binary data fields.
|
Package serdes provides utilities to parse and serialize XRPL binary data fields. |
|
interfaces
Package interfaces defines interfaces for binary serialization and deserialization of XRPL fields.
|
Package interfaces defines interfaces for binary serialization and deserialization of XRPL fields. |
|
testutil
Package testutil is a generated GoMock package.
|
Package testutil is a generated GoMock package. |
|
Package types contains data structures for binary codec operations.
|
Package types contains data structures for binary codec operations. |
|
interfaces
Package interfaces defines the BinaryParser interface for binary codec parsing operations.
|
Package interfaces defines the BinaryParser interface for binary codec parsing operations. |
|
testutil
Package testutil is a generated GoMock package.
|
Package testutil is a generated GoMock package. |