Skip to content

Add ADRs for insurance pool, NFT invoices, multisig admin; add SDK getLpInvoices - #589

Merged
Levi-Ojukwu merged 4 commits into
Invoice-Liquidity-Network:mainfrom
Samuel1505:main
Jul 26, 2026
Merged

Add ADRs for insurance pool, NFT invoices, multisig admin; add SDK getLpInvoices#589
Levi-Ojukwu merged 4 commits into
Invoice-Liquidity-Network:mainfrom
Samuel1505:main

Conversation

@Samuel1505

Copy link
Copy Markdown
Contributor

Summary

Closes #555,
closes #556,
closes #557,
closes #558.

Docs — Architecture Decision Records

  • Write ADR for insurance pool design #555docs/adr/ADR-006-insurance-pool-design.md: documents why the
    insurance pool is a separate contract from invoice_liquidity, the
    accounting-not-custody / flat-coverage-cap scope of the current stub, the
    timelocked coverage/admin-change flow, and the claim_default → pool
    claim integration hook. Flags that the hook is documented in
    docs/insurance-pool-design.md but not yet wired into claim_default.
  • Write ADR for NFT invoice representation #556docs/adr/adr-007-nft-invoice-representation.md: documents the
    InvoiceNftMetadata data model and the mint/transfer/burn lifecycle design
    in contracts/invoice_liquidity/src/nft.rs. Flags that none of
    mint_invoice_nft, transfer_invoice_nft, or burn_invoice_nft are
    currently called from submit_invoice, fund_invoice, or mark_paid
    only the read-only queries are wired into the contract's public API today.
  • Write ADR for multisig admin #557docs/adr/adr-008-multisig-admin.md: documents the M-of-N
    threshold scheme, the 24-hour (MULTISIG_WINDOW_LEDGERS) proposal
    expiration window, and the closed AdminAction enum in
    contracts/invoice_liquidity/src/multisig.rs. Flags — traced via git log
    and MULTISIG_IMPLEMENTATION.md — that the full contract integration
    (initialize_multisig_admin, propose_pause/propose_unpause,
    sign_proposal, execute_proposal) shipped in commit d267e36 but was
    lost from lib.rs in a later merge-conflict resolution (9e94e45); the
    module and its test suite (tests_multisig_admin.rs) exist but are not
    declared in lib.rs and are not reachable from the contract today.
  • All three ADRs are added to the index in docs/adr/README.md.

Each ADR documents the design as built, including where the
implementation currently falls short of the original design, so contributors
don't assume more is wired up than actually is.

SDK — getLpInvoices (#558)

  • Adds getLpInvoices(server, contractId, lp, page?, pageSize?, networkPassphrase?)
    in sdk/src/methods/lpInvoices.ts, wrapping the contract's
    list_invoices_by_lp(lp, page, page_size) view
    (contracts/invoice_liquidity/src/lib.rs:627).
  • page defaults to 0, pageSize defaults to 10 (the contract itself
    clamps page_size to 50). Returns a decoded Invoice[] for the requested
    page (empty past the last page), reusing the existing decodeInvoice
    helper.
  • Unlike the existing listInvoicesByLP in queries.ts (which requires the
    caller to construct and pass a sourceAccount), this method follows the
    newer getReputation/getTopPayers convention: a self-contained read-only
    simulation with a G-address validity check, no caller-supplied account
    needed.
  • Wired into ILNClient#getLpInvoices and the iln singleton, and exported
    from sdk/src/index.ts.

Test plan

  • sdk/src/methods/lpInvoices.test.ts — decoded page of invoices,
    default/custom page/pageSize passed through as u32, empty page, empty
    retval, invalid-address rejection, RPC/simulation errors.
  • sdk/src/client.test.tsiln.getLpInvoices throws before
    iln.configure(...) is called.
  • npx vitest run (sdk) — same 13 pre-existing failures across 5 files
    present on main before this change (unrelated: nft.test.ts mock
    account setup, governance.test.ts filter assertion, a
    get_token_decimals address-type test); all new tests pass, total passing
    count increased by 10 with no new failures.
  • npx tsc --noEmit (sdk) — same 18 pre-existing error lines on main
    (unrelated: batch.ts, client.ts:389, events/types.ts,
    xdrDecoder.ts:33); no new errors introduced (verified via git stash
    diff against main).
  • npx eslint on all touched/added files — clean.
  • No positive-path Rust tests were added/changed for the ADR issues,
    since they are documentation-only; the "not wired up" findings recorded in
    the multisig and NFT ADRs were confirmed by grepping lib.rs for the
    relevant module/function names and cross-checking with git log.

Document the insurance_pool contract's separation from invoice_liquidity,
its accounting-not-custody stub scope, timelocked admin actions, and the
still-unwired claim_default integration hook, per issue Invoice-Liquidity-Network#555.
Document the InvoiceNftMetadata data model, its mint/transfer/burn
lifecycle design, and that the lifecycle is not yet wired into
submit_invoice/fund_invoice/mark_paid, per issue Invoice-Liquidity-Network#556.
Document the M-of-N threshold scheme, proposal expiration window, and
admin action types in multisig.rs, and note that the lib.rs/storage.rs/
errors.rs integration was lost in a prior merge conflict resolution and
is not currently reachable from the contract's public API, per issue Invoice-Liquidity-Network#557.
Expose the contract's list_invoices_by_lp(lp, page, page_size) view as
getLpInvoices, a read-only simulation that needs no caller-supplied
source account, matching the getReputation/getTopPayers convention.
Wired into the free-function API, ILNClient, and the iln singleton.
@drips-wave

drips-wave Bot commented Jul 26, 2026

Copy link
Copy Markdown

@Samuel1505 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Levi-Ojukwu
Levi-Ojukwu merged commit a597f6f into Invoice-Liquidity-Network:main Jul 26, 2026
4 checks passed
@grantfox-oss grantfox-oss Bot mentioned this pull request Jul 26, 2026
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants