Skip to content

feat: wire public-visibility uploads through the external-signer flow - #32

Merged
Nic-dorman merged 1 commit into
mainfrom
feat/public-uploads-external-signer
Apr 30, 2026
Merged

feat: wire public-visibility uploads through the external-signer flow#32
Nic-dorman merged 1 commit into
mainfrom
feat/public-uploads-external-signer

Conversation

@Nic-dorman

@Nic-dorman Nic-dorman commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Re-enables the Public visibility option in the upload dialog (currently disabled with "Coming soon") by threading a visibility flag through the external-signer flow. Public uploads yield a single shareable on-network chunk address (the published DataMap); the public_address is surfaced on UploadResult so the UI can show / copy it.

  • Why not data_map_store after finalize_upload? That path hard-requires require_wallet()?; ant-gui has no Rust-side wallet on the WalletConnect path — all signing goes via the frontend. store_paid_chunks and friends are pub(crate). Upstream's file_prepare_upload_with_visibility bundles the DataMap chunk into the existing one-signature payment batch, which is what lets ant-gui thread a visibility flag through its existing code path.

Changes

Backend (src-tauri)

  • autonomi_ops.rs
    • Imports ant_core::data::Visibility.
    • StartUploadRequest gets an optional visibility: Option<String> (serde default → Private).
    • start_upload calls client.file_prepare_upload_with_visibility(&path, visibility).
    • confirm_upload and confirm_upload_merkle extract result.data_map_address into UploadResult.public_address (hex-encoded, 0x…, or None for private uploads).
    • wallet_upload (direct-key path) also populates UploadResult.public_address defensively from result.data_map_address. Today this is always None because direct-key mode doesn't thread visibility yet — wiring it through wallet_upload is a small follow-up if you want devnet/direct-key Public uploads too.
  • config.rsUploadHistoryEntry.public_address: Option<String> persisted to upload_history.json.

Frontend

  • stores/files.ts
    • getUploadQuote(path, visibility = 'private') accepts visibility and forwards it to start_upload. Docstring explains the prepared-batch / visibility-pinning constraint.
    • FileEntry.visibility and UploadHistoryEntry.public_address propagated through history load/save.
  • components/files/UploadConfirmDialog.vue
    • Public radio re-enabled as a real option (was disabled).
    • New visibility-change emit fires on toggle so the parent can re-quote (public batches cost one extra chunk).
  • pages/files.vue
    • onVisibilityChange(visibility) updates each selected entry's visibility in the store. The store-driven scheduler / Approve handler already pass visibility through, so the per-entry state stays synced when the user toggles in the dialog.
    • Uploads table shows a "Public" badge on rows with a public_address; clicking copies the address.

Test plan

  • cargo check --all-targets clean against ant-core-v0.2.2
  • cargo clippy --all-targets -- -D warnings clean
  • cargo fmt --check clean
  • CI green (Linux). Local Windows vitest is hitting a known npm optional-deps flake unrelated to this PR.
  • Manual: upload a file with Public selected → verify a 64-char hex address appears on the row with a Public badge → click it → verify clipboard contents.
  • Manual: upload with Private selected → row still shows the datamap filename (existing behaviour unchanged).
  • Manual: fresh download of a public upload via "Download by Address" using the copied address → verify download_public fetches the DataMap off-network and decrypts correctly.

Rebase notes

This branch was rebased onto post-bump main (which now includes the live-progress work from #65 + the ant-core 0.2.2 dep bump) and lost a couple of segments that were superseded:

  • Pre-quote machinery (pendingUploadFiles, pendingQuotes, quotedVisibility, startQuoting, the watch(autonomiConnected) re-quote trigger) was dropped in favour of main's store-driven scheduler.
  • The "drop pre-quote if visibility flipped after Approve" guard was dropped along with the pre-quote state — main re-queries through the store rather than pinning a single pre-quote per dialog session. Public/Private cost-difference UX could be added back as a follow-up.
  • effectivePaymentMode in the dialog now uses main's per-entry estimate; the AVG_CHUNK_SIZE/MERKLE_THRESHOLD heuristic from this branch was removed.
  • The two stale fix(nodes): … commits that were sitting on this branch locally were dropped during rebase — they're already on main via fix(nodes): honour storage dir setting + show real storage usage #34.

@Nic-dorman
Nic-dorman force-pushed the feat/public-uploads-external-signer branch from 5ebf3a4 to 5d5fd83 Compare April 30, 2026 09:57
@Nic-dorman
Nic-dorman marked this pull request as ready for review April 30, 2026 09:59
@Nic-dorman
Nic-dorman force-pushed the feat/public-uploads-external-signer branch from 5d5fd83 to f70a0b0 Compare April 30, 2026 10:52
Threads a visibility flag through start_upload -> file_prepare_upload_with_visibility
(ant-core PR #39), carries data_map_address out of finalize_upload and
finalize_upload_merkle, persists it in upload_history.json, and re-enables the
previously disabled "Public" button in the upload dialog.

Public uploads now yield a single shareable on-network chunk address that
appears in the uploads table with a "Public" badge; clicking copies it. The
dialog re-quotes when the user toggles visibility because the payment batch
differs (public adds one chunk for the DataMap itself).

Requires bumping the ant-core git dep to a commit containing WithAutonomi/ant-client#39.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Nic-dorman
Nic-dorman force-pushed the feat/public-uploads-external-signer branch from f70a0b0 to bd39024 Compare April 30, 2026 11:35
@Nic-dorman
Nic-dorman merged commit 00fb7b3 into main Apr 30, 2026
4 checks passed
@Nic-dorman
Nic-dorman deleted the feat/public-uploads-external-signer branch April 30, 2026 11:40
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