Skip to content

feat: merkle batch payment support for large uploads - #3

Merged
Nic-dorman merged 3 commits into
mainfrom
feat/merkle-payment-support
Apr 6, 2026
Merged

feat: merkle batch payment support for large uploads#3
Nic-dorman merged 3 commits into
mainfrom
feat/merkle-payment-support

Conversation

@Nic-dorman

Copy link
Copy Markdown
Contributor

Summary

  • Implements GUI support for merkle batch payments from ant-client PR #12
  • Files with 64+ chunks auto-select merkle payment (single tx) instead of wave-batch, reducing gas costs
  • Updates to unified PaymentVault contract (evmlib 0.8.0) — new address 0x9A3EcAc693b699Fc0B2B6A50B5549e50c2320A26

Changes

Rust backend (autonomi_ops.rs, lib.rs):

  • Match on ExternalPaymentInfo::WaveBatch vs ::Merkle in start_upload
  • Serialize merkle params (depth, pool commitments, timestamp) to frontend
  • New confirm_upload_merkle command accepting winner pool hash

Frontend payment (payment.ts):

  • payForMerkleTree() — calls payForMerkleTree on unified vault, extracts winnerPoolHash from MerklePaymentMade event
  • ERC20 allowance handling shared with wave-batch path

Upload flow (stores/files.ts):

  • UploadQuote carries payment mode + merkle fields
  • startRealUpload branches: merkle → payForMerkleTree + confirm_upload_merkle, wave-batch → payForQuotes + confirm_upload

UI (UploadConfirmDialog.vue):

  • Payment mode indicator (auto-selected, not user-chosen) with explanation text on inactive option
  • Network discovery state: spinner → timeout message when not connected

Contract (IPaymentVault.json, wallet-config.ts):

  • Unified ABI with both payForQuotes and payForMerkleTree
  • Updated vault address for evmlib 0.8.0

Test plan

  • Small file upload (<16MB) uses wave-batch path
  • Large file upload (>16MB / 64+ chunks) uses merkle path
  • Dialog shows correct payment mode indicator with explanation
  • Network discovery spinner + timeout when not connected
  • ERC20 allowance approval works for both paths
  • MerklePaymentMade event correctly decoded from receipt

🤖 Generated with Claude Code

Nic-dorman and others added 3 commits April 6, 2026 17:38
Implements the GUI side of merkle batch payments (ant-client PR #12).
Files with 64+ chunks now auto-select merkle payment (single tx) instead
of wave-batch (per-batch txs), reducing gas costs for large uploads.

Backend: match on ExternalPaymentInfo enum, serialize merkle params,
add confirm_upload_merkle command. Frontend: payForMerkleTree() via
unified PaymentVault contract, branch upload flow on payment mode.
Updates contract ABI and address to evmlib 0.8.0 unified vault.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add get_dir_size Tauri command for recursive directory size calculation
- Add nodeDetail API method (GET /api/v1/nodes/{id}) from ant-client PR #22
- Enrich nodes with data_dir and storage_bytes on 30s interval
- Fix storage display to show "0 B" for empty dirs instead of "-"
- Replace payment mode card selector with compact text label

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Nic-dorman
Nic-dorman force-pushed the feat/merkle-payment-support branch from f7b632c to b6f8a66 Compare April 6, 2026 16:39
@Nic-dorman
Nic-dorman merged commit a1415e4 into main Apr 6, 2026
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