Skip to content

fix: XRP Issue 40-byte encoding, nil opts guards, public ComputeSigna…#193

Draft
panterose wants to merge 1 commit intoXRPLF:mainfrom
tokinvoice:tokinvoice/minimal-patches
Draft

fix: XRP Issue 40-byte encoding, nil opts guards, public ComputeSigna…#193
panterose wants to merge 1 commit intoXRPLF:mainfrom
tokinvoice:tokinvoice/minimal-patches

Conversation

@panterose
Copy link

@panterose panterose commented Feb 9, 2026

Context

We are building an invoice factoring platform on XRPL using XLS-65 (Single Asset Vault) and XLS-66 (Lending Protocol) together. The workflow involves:

  1. Creating Vaults (XLS-65) to hold LP liquidity
  2. Creating LoanBrokers that draw from these Vaults
  3. Creating Loans (XLS-66) that require dual-signing between lender and borrower

Issues Encountered

VaultCreate failing with `invalidTransaction`:

  • Root cause: The `Issue` type was encoding XRP as only 20 bytes (currency), but the decoder expected 40 bytes (currency + issuer zeros)
  • This caused a `parser out of bounds` error during transaction serialization

LoanSet dual-signing not possible:

  • The `computeSignature` method in `wallet.go` was private
  • XLS-66 LoanSet requires both lender and borrower to sign the same transaction, needing external access to signature computation

Nil pointer dereference:

  • Calling `SubmitTx` or `SubmitTxAndWait` with nil options caused a panic

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Refactoring

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code where needed
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective
  • New and existing unit tests pass locally with my changes

Changes

File Fix
`issue.go` XRP Issues now return 40 bytes (currency + 20 zero bytes for issuer)
`client.go` Added nil guards for `opts` parameter
`wallet.go` Added public `ComputeSignature` wrapper for dual-signing

Testing

  • All binary-codec tests pass
  • tokinvoice/shared/xrpl builds and tests pass
  • VaultCreate and LoanSet transactions now serialize correctly

@panterose panterose marked this pull request as draft February 9, 2026 12:47
…ture

- issue.go: XRP Issues now return 40 bytes (currency + issuer zeros) for consistency
- issue_test.go: Updated tests to expect 40-byte XRP encoding
- client.go: Added nil guards for opts in SubmitTx and SubmitTxAndWait
- wallet.go: Added public ComputeSignature for dual-signing (XLS-66)
@panterose panterose force-pushed the tokinvoice/minimal-patches branch from 96766f0 to e44e340 Compare February 19, 2026 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant