Skip to content

Bug: approveAllowance places the required signTx parameter after the defaulted expirationLedger, making the default unreachable #385

Description

@Jaydbrown

File: lib/tokens.ts:176-184 (approveAllowance)

export async function approveAllowance(
  source: string,
  tokenAddress: string,
  spender: string,
  amount: bigint,
  expirationLedger: number = DEFAULT_EXPIRATION_LEDGER,   // optional, has a default
  signTx: (xdr: string, signal?) => Promise<string>,      // REQUIRED, comes after
  options?: { signal?: AbortSignal },
): Promise<ApproveResult>

A required parameter (signTx) sits after a parameter with a default value
(expirationLedger). TypeScript still requires the caller to pass
expirationLedger positionally to reach signTx, so the default is unreachable
in practice — every call site must write
approveAllowance(src, tok, sp, amt, DEFAULT_EXPIRATION_LEDGER, signTx).

Suggested fix

Move signTx before expirationLedger, or take a single options object.

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave programbugSomething isn't workingpriority: mediumMissing feature or UX issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions