Skip to content

Implement account spending limits and multi-approver transaction controls #520

Description

@Just-Bamford

Description

Problem

Applications cannot enforce high-level spending policies before transactions are submitted. There is no unified mechanism for configuring per-transaction, daily, or monthly limits or requiring additional approval when a transaction exceeds a configured threshold.

Solution

Implement a spending policy engine that evaluates transactions before submission.

Policies should support:

  • Per-transaction limits.
  • Daily limits.
  • Monthly limits.
  • Asset-specific limits.
  • Destination restrictions.
  • Approval thresholds.
  • Multiple required approvers.

The policy engine must calculate already-authorized spending and prevent concurrent transactions from bypassing configured limits.

Acceptance Criteria

  • setSpendingLimit(asset, amount, period) is implemented.
  • Per-transaction limits are enforced.
  • Daily and monthly cumulative limits are supported.
  • Limits can be configured per asset.
  • Transactions exceeding limits enter an approval state.
  • Multiple approvers can be required.
  • Approval status is tracked.
  • Concurrent transactions cannot bypass cumulative limits.
  • Policy violations return structured errors.
  • Tests cover limits, resets, concurrent requests, approvals, rejection, and multi-approver workflows.
  • Exported through src/transaction/index.ts and src/index.ts.

Note for Contributors

The policy engine should evaluate the transaction before signing/submission. Be explicit about how pending, failed, and completed transactions affect spending calculations.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions