Skip to content

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

Draft
Nic-dorman wants to merge 1 commit intomainfrom
feat/public-uploads-external-signer
Draft

feat: wire public-visibility uploads through the external-signer flow#32
Nic-dorman wants to merge 1 commit intomainfrom
feat/public-uploads-external-signer

Conversation

@Nic-dorman
Copy link
Copy Markdown
Contributor

⚠️ Blocked on WithAutonomi/ant-client#39

This branch does not compile against today's ant-core pin. It calls Client::file_prepare_upload_with_visibility and reads FileUploadResult.data_map_address, both of which land with ant-client #39 (approved by @mickvandijke, waiting to merge). The plan once #39 lands:

  1. Bump the ant-core rev in src-tauri/Cargo.toml to the post-merge commit
  2. `cargo check` — verify the symbols resolve
  3. Flip this PR out of draft

Opened as draft now so the ant-gui work is discoverable alongside the upstream PR.

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); clicking it in the uploads table copies it to the clipboard for sharing.

  • Why not `data_map_store` after `finalize_upload`? That path hard-requires `require_wallet()?`; ant-gui has no Rust-side wallet — all signing goes via WalletConnect on the frontend. `store_paid_chunks` and friends are `pub(crate)`, so hand-rolling the storage flow isn't an option either. Upstream EVM Network Naming from Connect Wallet/MetaMask #39 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`, threads `StartUploadRequest.visibility` (serde default → Private) into `file_prepare_upload_with_visibility`, extracts `FileUploadResult.data_map_address` into `UploadResult.public_address` on both `confirm_upload` and `confirm_upload_merkle`.
  • `config.rs` — `UploadHistoryEntry.public_address: Option` persisted to `upload_history.json`.

Frontend

  • `stores/files.ts` — `FileEntry.public_address`, `UploadHistoryEntry.public_address`, `getUploadQuote(path, visibility)`, passes visibility into `start_upload`, captures `result.public_address` from both confirm paths, persists on history load/save.
  • `components/files/UploadConfirmDialog.vue` — Public button re-enabled as a real radio option; emits `visibility-change` so the parent can re-quote (public batches cost one extra chunk).
  • `pages/files.vue` — `quotedVisibility` tracks what the pre-quote represents; `onVisibilityChange` re-quotes when the user flips the selector; `confirmUpload` drops the pre-quote if its visibility no longer matches. Uploads table shows a blue "PUBLIC" badge — clicking copies the on-network address with a share-aware toast.

Test plan

  • `vitest run` — 19/19 pass
  • Nuxt typecheck clean on app code (only pre-existing Tauri build-artifact noise)
  • Post-EVM Network Naming from Connect Wallet/MetaMask #39 merge: bump `ant-core` rev, `cargo check` resolves `Visibility` / `file_prepare_upload_with_visibility` / `FileUploadResult.data_map_address`
  • 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 → verify row still shows the datamap filename (existing behaviour unchanged)
  • Manual: fresh download of a public upload via "Download by Address" using the copied public_address → verify `download_public` fetches the DataMap off-network and decrypts correctly

🤖 Generated with Claude Code

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>
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