Skip to content

Fix SDK cancelInvoice sending extra submitterAddress argument #596

Description

@Levi-Ojukwu

Description:

The SDK's cancelInvoice method sends 2 arguments (submitterAddress, invoiceId) but the contract's cancel_invoice only accepts 1 user argument (invoice_id: u64). The freelancer/submitter is determined internally via require_submitter_by_id and should not be passed.

pub fn cancel_invoice(env: Env, invoice_id: u64)
// SDK at cancelInvoice.ts:60-64 — WRONG
const op = contract.call(
  "cancel_invoice",
  nativeToScVal(submitterAddress, { type: "address" }),  // EXTRA
  nativeToScVal(invoiceId, { type: "u64" })
);

Why it matters: Invoice cancellation is broken through the SDK. Freelancers cannot cancel pending invoices, and partially-funded invoices cannot trigger LP refunds.

Acceptance Criteria:

  • Remove the submitterAddress argument from the contract call
  • Pass only invoiceId as the argument
  • Verify submitter authentication works via require_submitter_by_id
  • Add tests for successful cancellation
  • Add tests verifying partial funding refunds work correctly

Relevant Files: sdk/src/methods/cancelInvoice.ts:60-64, contracts/invoice_liquidity/src/lib.rs:1393


Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programbugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions