@defdone/annon 0.0.0-stage → 0.1.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +56 -0
- package/CLI.md +378 -0
- package/LICENSE +201 -0
- package/NOTICE +7 -0
- package/README.md +581 -2
- package/dist/api/annon-types.d.ts +108 -0
- package/dist/api/annon-types.js +2 -0
- package/dist/api/annon.d.ts +117 -0
- package/dist/api/annon.js +1152 -0
- package/dist/api/hosted-record.d.ts +13 -0
- package/dist/api/hosted-record.js +149 -0
- package/dist/api/sharing-types.d.ts +109 -0
- package/dist/api/sharing-types.js +1 -0
- package/dist/api/sharing.d.ts +36 -0
- package/dist/api/sharing.js +879 -0
- package/dist/browser/download.d.ts +19 -0
- package/dist/browser/download.js +52 -0
- package/dist/browser/index.d.ts +23 -0
- package/dist/browser/index.js +22 -0
- package/dist/browser/login-bundle.js +116 -0
- package/dist/browser/login.d.ts +1 -0
- package/dist/browser/login.js +177 -0
- package/dist/browser/purchase-bundle.js +84 -0
- package/dist/browser/purchases.d.ts +98 -0
- package/dist/browser/purchases.js +735 -0
- package/dist/browser/record.d.ts +55 -0
- package/dist/browser/record.js +16 -0
- package/dist/browser/selling.d.ts +146 -0
- package/dist/browser/selling.js +418 -0
- package/dist/browser/wallets.d.ts +53 -0
- package/dist/browser/wallets.js +286 -0
- package/dist/bytes.d.ts +4 -0
- package/dist/bytes.js +16 -0
- package/dist/download/download.d.ts +59 -0
- package/dist/download/download.js +384 -0
- package/dist/download/host.d.ts +56 -0
- package/dist/download/host.js +161 -0
- package/dist/download/http.d.ts +23 -0
- package/dist/download/http.js +87 -0
- package/dist/download/proof.d.ts +20 -0
- package/dist/download/proof.js +79 -0
- package/dist/download/upload.d.ts +130 -0
- package/dist/download/upload.js +408 -0
- package/dist/envelope/evm.d.ts +4 -0
- package/dist/envelope/evm.js +32 -0
- package/dist/envelope/pay2.d.ts +176 -0
- package/dist/envelope/pay2.js +541 -0
- package/dist/envelope/replay.d.ts +45 -0
- package/dist/envelope/replay.js +186 -0
- package/dist/envelope/stream.d.ts +78 -0
- package/dist/envelope/stream.js +372 -0
- package/dist/errors.d.ts +21 -0
- package/dist/errors.js +300 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +23 -0
- package/dist/keys/near-ckd.d.ts +47 -0
- package/dist/keys/near-ckd.js +96 -0
- package/dist/limits.d.ts +4 -0
- package/dist/limits.js +4 -0
- package/dist/near/nep413.d.ts +22 -0
- package/dist/near/nep413.js +39 -0
- package/dist/near/rpc.d.ts +170 -0
- package/dist/near/rpc.js +423 -0
- package/dist/near/texts.d.ts +39 -0
- package/dist/near/texts.js +60 -0
- package/dist/net/ip.d.ts +7 -0
- package/dist/net/ip.js +62 -0
- package/dist/net/retry.d.ts +3 -0
- package/dist/net/retry.js +31 -0
- package/dist/node/adapter-checks.d.ts +6 -0
- package/dist/node/adapter-checks.js +13 -0
- package/dist/node/adapter.d.ts +8 -0
- package/dist/node/adapter.js +99 -0
- package/dist/node/agent.d.ts +49 -0
- package/dist/node/agent.js +266 -0
- package/dist/node/amounts.d.ts +2 -0
- package/dist/node/amounts.js +20 -0
- package/dist/node/browser-login.d.ts +18 -0
- package/dist/node/browser-login.js +212 -0
- package/dist/node/budget.d.ts +24 -0
- package/dist/node/budget.js +59 -0
- package/dist/node/buy-commands.d.ts +24 -0
- package/dist/node/buy-commands.js +301 -0
- package/dist/node/cli.d.ts +60 -0
- package/dist/node/cli.js +201 -0
- package/dist/node/command-context.d.ts +82 -0
- package/dist/node/command-context.js +77 -0
- package/dist/node/config.d.ts +37 -0
- package/dist/node/config.js +189 -0
- package/dist/node/core-adapter.d.ts +43 -0
- package/dist/node/core-adapter.js +122 -0
- package/dist/node/errors.d.ts +8 -0
- package/dist/node/errors.js +12 -0
- package/dist/node/index.d.ts +7 -0
- package/dist/node/index.js +5 -0
- package/dist/node/io.d.ts +13 -0
- package/dist/node/io.js +112 -0
- package/dist/node/keychain.d.ts +10 -0
- package/dist/node/keychain.js +67 -0
- package/dist/node/main.d.ts +2 -0
- package/dist/node/main.js +21 -0
- package/dist/node/offers.d.ts +16 -0
- package/dist/node/offers.js +91 -0
- package/dist/node/origin.d.ts +11 -0
- package/dist/node/origin.js +80 -0
- package/dist/node/paths.d.ts +3 -0
- package/dist/node/paths.js +71 -0
- package/dist/node/payment-terms.d.ts +26 -0
- package/dist/node/payment-terms.js +127 -0
- package/dist/node/purchase-commands.d.ts +16 -0
- package/dist/node/purchase-commands.js +237 -0
- package/dist/node/purchase-guard.d.ts +19 -0
- package/dist/node/purchase-guard.js +53 -0
- package/dist/node/relay-transport.d.ts +6 -0
- package/dist/node/relay-transport.js +173 -0
- package/dist/node/resources.d.ts +2 -0
- package/dist/node/resources.js +26 -0
- package/dist/node/retry-gate.d.ts +15 -0
- package/dist/node/retry-gate.js +53 -0
- package/dist/node/seller-commands.d.ts +12 -0
- package/dist/node/seller-commands.js +207 -0
- package/dist/node/sharing.d.ts +3 -0
- package/dist/node/sharing.js +28 -0
- package/dist/node/shops.d.ts +17 -0
- package/dist/node/shops.js +74 -0
- package/dist/node/signer-mock.d.ts +11 -0
- package/dist/node/signer-mock.js +79 -0
- package/dist/node/signer-wallet.d.ts +8 -0
- package/dist/node/signer-wallet.js +147 -0
- package/dist/node/signing.d.ts +29 -0
- package/dist/node/signing.js +200 -0
- package/dist/node/storage-commands.d.ts +11 -0
- package/dist/node/storage-commands.js +50 -0
- package/dist/node/sync-dir.d.ts +1 -0
- package/dist/node/sync-dir.js +11 -0
- package/dist/node/wallets.d.ts +13 -0
- package/dist/node/wallets.js +146 -0
- package/dist/oneclick/oneclick.d.ts +132 -0
- package/dist/oneclick/oneclick.js +342 -0
- package/dist/pay/backup.d.ts +70 -0
- package/dist/pay/backup.js +402 -0
- package/dist/pay/base.d.ts +135 -0
- package/dist/pay/base.js +393 -0
- package/dist/pay/eip3009.d.ts +59 -0
- package/dist/pay/eip3009.js +72 -0
- package/dist/pay/pay.d.ts +86 -0
- package/dist/pay/pay.js +297 -0
- package/dist/pay/purchase.d.ts +103 -0
- package/dist/pay/purchase.js +20 -0
- package/dist/pay/recover.d.ts +31 -0
- package/dist/pay/recover.js +34 -0
- package/dist/pay/seller.d.ts +130 -0
- package/dist/pay/seller.js +444 -0
- package/dist/pay/settle.d.ts +96 -0
- package/dist/pay/settle.js +308 -0
- package/dist/pay/split.d.ts +115 -0
- package/dist/pay/split.js +256 -0
- package/dist/pay/store-node.d.ts +8 -0
- package/dist/pay/store-node.js +224 -0
- package/dist/pay/store.d.ts +54 -0
- package/dist/pay/store.js +135 -0
- package/dist/pay/x402.d.ts +95 -0
- package/dist/pay/x402.js +136 -0
- package/dist/relay/admission.d.ts +8 -0
- package/dist/relay/admission.js +58 -0
- package/dist/relay/capabilities.d.ts +36 -0
- package/dist/relay/capabilities.js +232 -0
- package/dist/relay/fees.d.ts +17 -0
- package/dist/relay/fees.js +105 -0
- package/dist/relay/index.d.ts +10 -0
- package/dist/relay/index.js +8 -0
- package/dist/relay/keeper-balance.d.ts +17 -0
- package/dist/relay/keeper-balance.js +46 -0
- package/dist/relay/keeper-runner.d.ts +114 -0
- package/dist/relay/keeper-runner.js +703 -0
- package/dist/relay/keeper.d.ts +38 -0
- package/dist/relay/keeper.js +73 -0
- package/dist/relay/ledger.d.ts +155 -0
- package/dist/relay/ledger.js +392 -0
- package/dist/relay/relay-checks.d.ts +3 -0
- package/dist/relay/relay-checks.js +244 -0
- package/dist/relay/relay-reconciliation.d.ts +15 -0
- package/dist/relay/relay-reconciliation.js +293 -0
- package/dist/relay/relay-request.d.ts +6 -0
- package/dist/relay/relay-request.js +139 -0
- package/dist/relay/relay-transactions.d.ts +23 -0
- package/dist/relay/relay-transactions.js +182 -0
- package/dist/relay/relay-types.d.ts +128 -0
- package/dist/relay/relay-types.js +17 -0
- package/dist/relay/relay.d.ts +102 -0
- package/dist/relay/relay.js +426 -0
- package/dist/relay/reservation.d.ts +29 -0
- package/dist/relay/reservation.js +132 -0
- package/dist/relay/sponsorship.d.ts +42 -0
- package/dist/relay/sponsorship.js +184 -0
- package/dist/routes.d.ts +2 -0
- package/dist/routes.js +1 -0
- package/dist/settle-near/codec.d.ts +17 -0
- package/dist/settle-near/codec.js +86 -0
- package/dist/settle-near/identity.d.ts +27 -0
- package/dist/settle-near/identity.js +80 -0
- package/dist/settle-near/purchase.d.ts +40 -0
- package/dist/settle-near/purchase.js +153 -0
- package/dist/settle-near/terms.d.ts +37 -0
- package/dist/settle-near/terms.js +89 -0
- package/dist/shops/discovery.d.ts +95 -0
- package/dist/shops/discovery.js +384 -0
- package/dist/wallet/account-only.d.ts +11 -0
- package/dist/wallet/account-only.js +6 -0
- package/dist/wallet/uncertain.d.ts +8 -0
- package/dist/wallet/uncertain.js +13 -0
- package/dist/wallet/wallet.d.ts +100 -0
- package/dist/wallet/wallet.js +204 -0
- package/package.json +135 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# @defdone/annon
|
|
2
|
+
|
|
3
|
+
## 0.1.0-alpha.0
|
|
4
|
+
|
|
5
|
+
First public alpha, published on the npm `alpha` tag.
|
|
6
|
+
|
|
7
|
+
- PAY2 encryption with streaming `sell` and `open` in constant memory.
|
|
8
|
+
- Purchases verified by the Annon contract on NEAR: USDC on NEAR, Base through x402, and other chains
|
|
9
|
+
through NEAR Intents (1Click), with explicit route selection.
|
|
10
|
+
- Key release through NEAR MPC to a one-time buyer key, grant-proved downloads, and recovery on a new
|
|
11
|
+
device with the buyer's wallet.
|
|
12
|
+
- Per-file storage budgets, sponsored listings through a relayer, and protocol fees shown before
|
|
13
|
+
registration.
|
|
14
|
+
- Browser entry `@defdone/annon/browser`: a purchase controller that survives reloads and works
|
|
15
|
+
across tabs, encrypted IndexedDB receipts with export and import, downloads with in-browser
|
|
16
|
+
decryption up to 50 MiB, and adapters for injected EVM, Solana and NEAR wallets.
|
|
17
|
+
- `annon` CLI with browser wallet login (`annon login`) and agent mode (`annon init --agent`) with a
|
|
18
|
+
price cap and a daily budget.
|
|
19
|
+
|
|
20
|
+
### Minor Changes
|
|
21
|
+
|
|
22
|
+
- Add bounded shop discovery and client-side catalog search and paging to the SDK, CLI and read-only MCP tools. Keep aliases and deployment profiles in human configuration. Refuse unavailable direct Base routes before wallet setup and restore authenticated, validated seller-key backup import.
|
|
23
|
+
- Add hosted sharing through approved shops, durable seller checkpoints and pending backups, browser seller controls, upload signing helpers, and CLI and MCP share commands. Keep NEAR and Solana listings on NEAR and 1Click routes. Preserve retry hints for hosted sharing budget refusals and isolate unavailable third-party shops during discovery.
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- Prepare immutable encrypted bodies for hosted upload reservations.
|
|
28
|
+
- Add a canonical hosted split salt, reject direct Base settlement when final terms omit Base, preserve pending upload retry hints, tighten split response validation, and protect sponsored seller admissions with a liquid balance floor while keeping buyer recovery available.
|
|
29
|
+
- Expose relayer services and browser sponsorship checks through the supported package entries. Send seller-signed storage requests, share retry handling, and preserve download and registration recovery evidence. Use the Node entrypoint in the MCP server and validate packed package boundaries.
|
|
30
|
+
|
|
31
|
+
Report wrong_identity when a funding wallet is not the file's seller. Keep shared CORS defaults empty and scan recent recovery grants first.
|
|
32
|
+
- Check NEAR wallet return hashes against the pending call's exact deposit and the time the attempt started. Old, mismatched or unreadable hashes are refused with transaction_uncertain and leave the pending operation in place, so no second deposit is sent. Saved transaction hashes are also checked for the exact deposit. Passing txHash when no NEAR wallet call is pending now fails with invalid_arguments.
|
|
33
|
+
- Use one public payment route vocabulary and validated portable receipts. Standardize public errors and preserve relayer recovery accounting.
|
|
34
|
+
|
|
35
|
+
Remove the unused sell preview callback and text preview helper.
|
|
36
|
+
|
|
37
|
+
Preserve command-specific error guidance and alert on held relayer reconciliation. Remove unused preview verification and seller-key import helpers.
|
|
38
|
+
- Publish an explicit list of entry points instead of every module under `dist/`: `.`, `./browser`, `./browser/purchase-bundle.js`, `./node`, `./relay`, `./pay/store-node`, `./node/signer-mock` and the server building blocks `./pay/seller`, `./pay/settle`, `./pay/store`, `./pay/split`, `./download/host`, `./download/http`, `./envelope/pay2` and `./near/rpc`. `./node/adapter`, `./node/cli` and `./node/errors` remain for now and are deprecated in favour of `./node`. The main entry lists its exports by name, adds the error classes, and no longer exports the low-level `openTo`, the relayer fee math or the purchase, refund and text encoders. The build starts from an empty `dist/` and ships no source maps.
|
|
39
|
+
- Restore relay dependency and declaration initialization order while retaining the split function bodies.
|
|
40
|
+
- Split relay request validation, transaction handling and reconciliation into focused modules while preserving behavior and existing import paths.
|
|
41
|
+
- Remove unused internal keeper wrappers and exports, and keep the refund tree oracle in test support.
|
|
42
|
+
- Check Base sponsorship and split eligibility before signing. Preserve pending Base purchases after expiry and allow an explicit NEAR unlock wallet when resuming with a fresh SDK instance.
|
|
43
|
+
|
|
44
|
+
Enforce configured source spending caps, prevent accidental repeat purchases, and retain download and settlement waits across restarts. Automatic download retries and pending-payment polling now stop after at most 60 seconds of total waiting and return the remaining retry hint. Use the same saved purchase when retrying.
|
|
45
|
+
|
|
46
|
+
Require a configured origin for agent 1Click purchases. Recover the purchase guard queue after a failed renewal and preserve completed buy results when reservation cleanup fails.
|
|
47
|
+
- Check Base authorization validity, balances and nonce state before recording new payments. Add exact-origin CORS validation and hooks for durable completed-download accounting.
|
|
48
|
+
|
|
49
|
+
The SDK HTTP helper now applies an exact-origin CORS allow-list policy with no origins allowed by default. Integrators configure `allowedOrigins` and, optionally, verified exact `previewOrigins` on `handle()` for their browser clients.
|
|
50
|
+
- Require durable admission for sponsored relay sends and seller authorization for sponsored file storage funding. Preserve checked sponsorship and admission limits across relayer restarts, and bound sponsored unlocks by file and seller.
|
|
51
|
+
- Omit ambient cookies and HTTP authentication from SDK RPC and 1Click requests.
|
|
52
|
+
- Sponsored `share` registrations from the CLI, the MCP server and the browser seller check the NEAR outcome against the contract call only, without the relayer-only hosting reservation, so a successful registration no longer ends as `transaction_uncertain`.
|
|
53
|
+
- Share equivalent byte, record validation and directory sync helpers while preserving public exports and error behavior.
|
|
54
|
+
- Hosting lifetime is now the shop's policy. Hosted selling accepts any future publication expiry from the selected shop, or `null` for no planned expiry, instead of refusing expiries more than seven days away. An expiry at or before the current time is still refused with `file_expired`, and malformed values are refused. `Shared.expiresAt` and the browser seller's `view().result.expiresAt` are now `number | null`. Saved completed sales stay readable after their expiry. The browser seller's `quote.hostedDays` comes from the new optional `fileLifetimeDays` option instead of a fixed 7, and is absent when the page does not pass it.
|
|
55
|
+
- Validate optional shop rules and expose descriptive text with shop provenance in discovery, catalog and hosted share output.
|
|
56
|
+
- Raise the default sponsored registration allowance to two per seller and IP bucket per UTC day.
|
package/CLI.md
ADDED
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
# annon CLI
|
|
2
|
+
|
|
3
|
+
Build with `pnpm build`. The `@defdone/annon` package ships the `annon` bin;
|
|
4
|
+
in this checkout run `node packages/annon/dist/node/main.js` in its place.
|
|
5
|
+
Run `annon --help` for all flags. All commands return JSON; `--json` uses one compact
|
|
6
|
+
JSON line and disables interactive prompts. Success is `{ "ok": true, "result": ... }`;
|
|
7
|
+
errors are `{ "ok": false, "error": { "code": ..., "message": ... } }`.
|
|
8
|
+
|
|
9
|
+
Create a public configuration file and name it with `--config /path/config.json` or
|
|
10
|
+
`ANNON_CONFIG`. The default is `~/.config/annon/config.json`:
|
|
11
|
+
|
|
12
|
+
```json
|
|
13
|
+
{
|
|
14
|
+
"contractId": "your-reviewed-contract.near",
|
|
15
|
+
"network": "near:mainnet",
|
|
16
|
+
"nearRpc": "https://rpc.mainnet.fastnear.com",
|
|
17
|
+
"baseRpc": "https://base.example/rpc-with-key",
|
|
18
|
+
"stateDir": "/absolute/private/annon-state",
|
|
19
|
+
"relayer": "https://your-reviewed-relayer.example",
|
|
20
|
+
"maxPrice": "0.2"
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Contract ID and NEAR RPC must be supplied by human configuration or CLI flags for contract operations. Browser login alone uses a public RPC default for ownership verification. Base RPC is required only for Base purchases, Base listing creation and resuming Base unlock. NEAR-only verify/status and purchases need no Base RPC. No deployment is implicitly trusted. The first interactive command asks whether you trust
|
|
25
|
+
the configured contract to release file keys. `--trust-contract` records explicit trust
|
|
26
|
+
without a prompt. Trust is keyed by network, NEAR RPC and contract; changing any requires
|
|
27
|
+
new trust. An offer cannot select a different contract. MCP shares the trust store. For a server, human configuration may set `trustContract: true` or `ANNON_TRUST_CONTRACT=true`; tool calls cannot grant trust.
|
|
28
|
+
|
|
29
|
+
Flags override environment variables, which override config. Config fields have matching
|
|
30
|
+
`ANNON_CONTRACT_ID`, `ANNON_NETWORK`, `ANNON_NEAR_RPC`, `ANNON_BASE_RPC`,
|
|
31
|
+
`ANNON_STATE_DIR`, and `ANNON_RELAYER` variables. Endpoints use HTTPS; HTTP is allowed
|
|
32
|
+
only on localhost. Endpoint URLs cannot contain credentials or query parameters.
|
|
33
|
+
The relayer is optional when a NEAR wallet submits transactions. Direct register/reopen
|
|
34
|
+
calls use the caller's prepaid contract storage balance; fund it using the deployment's
|
|
35
|
+
storage interface before selling or recovering. The SDK exports `storageDeposit(wallet, contractId, amountYocto)`; choose the amount explicitly. Insufficient storage is reported as `storage_required`.
|
|
36
|
+
|
|
37
|
+
## Keys and saved purchases
|
|
38
|
+
|
|
39
|
+
Use `annon login` for per-action browser wallet approval, or `annon init --agent` for key references, remote signing and a persisted daily budget. See [README.md](README.md) for login, `--no-open`, `--signer`, keychain creation and the HTTP signer contract. The legacy explicit local-key sources below remain available. No key discovery occurs.
|
|
40
|
+
|
|
41
|
+
Select `--wallet evm|solana|near` or `ANNON_WALLET`. Local key values are accepted from environment variables or explicitly named files:
|
|
42
|
+
|
|
43
|
+
| Wallet | Environment | Named file flag / environment |
|
|
44
|
+
| --- | --- | --- |
|
|
45
|
+
| EVM | `ANNON_EVM_PRIVATE_KEY`: `0x` and 64 hex digits | `--evm-key-file` / `ANNON_EVM_KEY_FILE`, containing that text |
|
|
46
|
+
| Solana | `ANNON_SOLANA_KEYPAIR`: JSON array of 64 bytes | `--solana-key-file` / `ANNON_SOLANA_KEY_FILE`, standard Solana keypair JSON |
|
|
47
|
+
| NEAR | `ANNON_NEAR_CREDENTIALS`: credential JSON | `--near-key-file` / `ANNON_NEAR_KEY_FILE`, near-cli-rs credential JSON with `account_id`, `public_key`, `private_key` (ed25519) |
|
|
48
|
+
|
|
49
|
+
NEAR files may omit `account_id` when `--near-account` / `ANNON_NEAR_ACCOUNT` supplies it.
|
|
50
|
+
On macOS, with no NEAR file or credential env value, explicitly select both
|
|
51
|
+
`--near-account alice.near --near-public-key ed25519:PUBLIC_KEY` (or `ANNON_NEAR_ACCOUNT`,
|
|
52
|
+
`ANNON_NEAR_PUBLIC_KEY`) to read the near-cli-rs native keychain entry:
|
|
53
|
+
service `near-mainnet-alice.near`, account `alice.near:ed25519:PUBLIC_KEY`.
|
|
54
|
+
Other platforms use the credential JSON file or environment. No keychain enumeration occurs.
|
|
55
|
+
|
|
56
|
+
Sell, buy, open, recover and stop also require a user-held random 32-byte backup secret,
|
|
57
|
+
encoded as 64 lowercase hex characters in `ANNON_BACKUP_SECRET`, or in the file named by
|
|
58
|
+
`--backup-secret-file` / `ANNON_BACKUP_SECRET_FILE`. Create it with a cryptographic random
|
|
59
|
+
generator and keep it outside the repository. It is never derived from a wallet signature.
|
|
60
|
+
`verify` and accepted/read-only `status` need neither a wallet nor this secret. A pending Base `status` with saved state and a backup secret may send `unlock` through the configured relayer or NEAR wallet. Status can update encrypted local state and backups: expired/canceled Base payments are marked with `paymentState`, preserving the purchase, attempts and recovery key. It never deletes the purchase record.
|
|
61
|
+
|
|
62
|
+
State directories are created with mode 0700 and records/outputs with 0600. Keep existing
|
|
63
|
+
state directories private. Purchases and recovery grants are encrypted by the SDK; portable
|
|
64
|
+
encrypted backups are under `stateDir/backups`. Public headers and resource URLs are saved
|
|
65
|
+
separately for later downloading. Preserve state after timeouts. Losing local state does not
|
|
66
|
+
lose recovery rights: the same recovery wallet can create a fresh grant on a new device with
|
|
67
|
+
a new backup secret. Keys, signed payment payloads and decrypted file contents are never
|
|
68
|
+
returned in CLI/MCP results. Plaintext is written only to the explicitly named output.
|
|
69
|
+
|
|
70
|
+
## Commands
|
|
71
|
+
|
|
72
|
+
Identity syntax is `evm:0xADDRESS`, `solana:BASE58_OR_HEX`, or `near:account.near`.
|
|
73
|
+
Prices are decimal USDC with at most six decimals. Splits use integer basis points,
|
|
74
|
+
totaling 10000. The first split recipient gets the rounding remainder.
|
|
75
|
+
|
|
76
|
+
```sh
|
|
77
|
+
annon sell report.pdf --price 0.2 --split near:alice.near:10000 --wallet near --output report.pay2
|
|
78
|
+
annon sell report.pdf --resume 0xFILE_ID --wallet near --output resumed.pay2
|
|
79
|
+
annon sell report.pdf --price 0.2 --split evm:0x1111111111111111111111111111111111111111:10000 --wallet evm --base
|
|
80
|
+
annon buy https://host.example/report --route near --wallet near
|
|
81
|
+
annon buy offer.json --url https://host.example/report --route base --wallet evm --max-price 0.2
|
|
82
|
+
annon buy https://host.example/report --route 1click --wallet solana --from-chain solana
|
|
83
|
+
annon status 0xPURCHASE_ID --json
|
|
84
|
+
annon open 0xPURCHASE_ID --output report.pdf
|
|
85
|
+
annon open report.pay2 --purchase /private/purchase-backup.json --output report.pdf
|
|
86
|
+
annon recover --recovery near:alice.near --wallet near --json
|
|
87
|
+
annon open /private/recovery-backup.json --url https://host.example/report --output recovered.pdf
|
|
88
|
+
annon verify report.pay2 --json
|
|
89
|
+
annon verify https://host.example/report --json
|
|
90
|
+
annon stop 0xFILE_ID --wallet near
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
IDs in these commands are placeholders for full `0x` plus 64 lowercase hex digits.
|
|
94
|
+
`sell` creates a PAY2 file; arrange hosting separately. `buy` accepts the HTTPS resource URL
|
|
95
|
+
or a named file containing decoded x402 `PAYMENT-REQUIRED` JSON. An offer file requires `--url` with the independently selected resource URL; it must match the offer. It checks the public header
|
|
96
|
+
and registered terms before the SDK authorizes payment. Every buy requires `--max-price`, `ANNON_MAX_PRICE` or config `maxPrice` (decimal USDC); the offer never supplies the cap. A configured cap also bounds an explicit flag. The default route is direct NEAR for
|
|
97
|
+
a NEAR wallet, 1Click when `--from-chain` is given, otherwise Base for an EVM wallet.
|
|
98
|
+
Explicit Base fails if that route or a funded EOA is unavailable; it never silently chooses
|
|
99
|
+
another payment route. A file whose final on-chain terms have no Base payee (files from NEAR and
|
|
100
|
+
Solana sellers) has no Base route: `--route base` fails with `route_unavailable` (exit 2) before any
|
|
101
|
+
wallet step, and an EVM wallet without `--route` gets `origin_required`. Pay such a file with
|
|
102
|
+
`--route 1click --from-chain base` (or a configured Base `--origin`) to spend USDC held on Base. After an uncertain reply,
|
|
103
|
+
retain the saved backup and check status rather than buying again. Resume the existing purchase with `status` and `open`. A saved live or accepted purchase blocks another buy with `purchase_open`. Only an explicit `--force` (MCP `force: true`) creates another purchase despite that saved purchase.
|
|
104
|
+
|
|
105
|
+
1Click accepts `--from-chain solana` or `sol` (ID `sol`), `ethereum` or `eth` (ID `eth`),
|
|
106
|
+
`arbitrum`/`arb`, `polygon`/`pol`, `optimism`/`op`, `avalanche`/`avax`, and `berachain`/`bera`.
|
|
107
|
+
Other chain IDs pass through unchanged. EVM refund defaults use `eth`, `base`, `arb`, `pol`, `op`,
|
|
108
|
+
`avax`, `bsc`, `gnosis`, `bera`, `scroll`, `monad`, `xlayer`, `abs`, and `plasma`.
|
|
109
|
+
The optional
|
|
110
|
+
`--from-asset` (the exact `nep141:` asset ID). Without an asset it selects the unique USDC
|
|
111
|
+
entry for that blockchain in 1Click's token list. Symbols such as `sUSDC` are not USDC matches. For BTC, other tokens, or ambiguous USDC
|
|
112
|
+
entries, specify `--from-asset`. `--refund-to` must name a refund address on the source
|
|
113
|
+
chain; it defaults to the selected wallet's address only when the chain family matches.
|
|
114
|
+
These also have `ANNON_FROM_CHAIN`, `ANNON_FROM_ASSET`, `ANNON_REFUND_TO` equivalents. Only
|
|
115
|
+
`--from-chain` or `--origin` selects 1Click automatically: with `ANNON_FROM_CHAIN`, name
|
|
116
|
+
`--route 1click` explicitly, or a NEAR wallet pays directly on NEAR.
|
|
117
|
+
Human configuration can define named `origins`, for example `{"base-usdc":{"fromChain":"base","fromAsset":"nep141:base-0x833589fcd6edb6e08f4c7c32d4f71b54bda02913.omft.near","usdcDecimals":6}}`, or the same JSON in `ANNON_ORIGINS`. Select one with `--origin base-usdc`. Each may specify `refundTo`; otherwise the configured `ANNON_REFUND_TO` or matching wallet address is used.
|
|
118
|
+
|
|
119
|
+
For a human 1Click purchase, the SDK saves the live EXACT_OUTPUT quote and encrypted purchase record before confirmation. The terms show the source chain, asset, symbol and token contract when known, input amount in human and base units, and deposit cutoff. No funds are sent by quoting or confirming these instructions. Recovery proof follows review. Declining buys nothing and leaves an unpaid encrypted purchase record. The same live quote supplies the returned instructions. After review and recovery proof, at least ten minutes must remain before the deposit cutoff, otherwise the CLI returns `quote_expired`: "The 1Click quote expired. Run buy again." Do not fund that quote; the saved purchase still blocks a plain `buy`, so request a fresh quote with `buy --force`. Human terminal mode requires a prompt before requesting a quote. Explicit assets bypass token lookup; human units then use the quote's formatted amount when available.
|
|
120
|
+
|
|
121
|
+
Successful CLI JSON and agent results also include `source` with `chain`, `asset`, `amount`, `amountFormatted` when known, and `depositBefore`, plus available symbol, decimals and contract metadata. JSON and agent modes do not add an interactive prompt. A 1Click failure before deposit instructions return releases the agent budget reservation; returning instructions keeps it reserved.
|
|
122
|
+
|
|
123
|
+
The result includes `instructions.address`, `amount` in source token base units, `asset`,
|
|
124
|
+
`chain`, optional `memo`, and `qrData`. Fund these externally with the wallet you already use.
|
|
125
|
+
Never omit a required memo. `instructions.depositBefore` is the cutoff for a **confirmed** deposit;
|
|
126
|
+
`purchaseExpiresAt` is the later contract delivery deadline. The SDK reserves ten minutes between them,
|
|
127
|
+
refuses insufficient windows or a swap estimate longer than that buffer, and checks the entire echoed
|
|
128
|
+
quote request. Origin-chain confirmation time must fit before `depositBefore`; an estimate is not a
|
|
129
|
+
settlement guarantee. Do not deposit after that cutoff even if the service address stays active.
|
|
130
|
+
The three recorded quotes return an address-inactivity `quote.deadline` 72 hours after the echoed
|
|
131
|
+
request deadline. That extension must not extend the buyer's cutoff or contract purchase expiry.
|
|
132
|
+
The [1Click OpenAPI](https://1click.chaindefuser.com/docs/v0/openapi.yaml) describes request `deadline`
|
|
133
|
+
as the start of refund handling, response `deadline` as address inactivity, and `timeEstimate` as
|
|
134
|
+
execution time after deposit confirmation. Late delivery can be refused by Annon; service SUCCESS
|
|
135
|
+
alone does not prove acceptance. `status` resumes a saved paid Base purchase by requesting unlock, then checks final NEAR acceptance. An unsafe payment returns `settlement_pending` immediately with exit code 4 (pending); 1Click SUCCESS alone
|
|
136
|
+
does not grant access.
|
|
137
|
+
|
|
138
|
+
The signing wallet is also the recovery identity. A supplied `--recovery kind:id` must match the
|
|
139
|
+
local wallet or configured `signer.identity`; a mismatch is refused with `wrong_identity` before
|
|
140
|
+
payment. Refunds from Annon go to that wallet's Intents identity; 1Click source-chain refunds use
|
|
141
|
+
`--refund-to`.
|
|
142
|
+
For moderated files, pass `--moderator account.near` on buy only after deciding to trust
|
|
143
|
+
that moderator, who can block release. A seller sets it with the same flag on sell.
|
|
144
|
+
|
|
145
|
+
`open` accepts a saved purchase ID, encrypted purchase/recovery backup, or a local PAY2 file
|
|
146
|
+
with `--purchase`. It uses saved resource metadata or `--file`/`--url`, then SDK grant proofs
|
|
147
|
+
and authenticated decryption. New-device recovery may require `--url` or a local PAY2 file.
|
|
148
|
+
Existing output files are never overwritten. `verify` checks a local file's header and body;
|
|
149
|
+
a URL checks only its public header. Verification does not prove future host availability.
|
|
150
|
+
|
|
151
|
+
Opening a Base purchase requests unlock before the grant-proved download. It also resends its saved signed payload with the download when present;
|
|
152
|
+
it does not create a fresh payment authorization after a lost reply.
|
|
153
|
+
|
|
154
|
+
Key release transport timeout retries are bounded to three attempts with backoff, using the same
|
|
155
|
+
unlock/reopen/claim request. In-flight relayer replies (`202` pending, or a legacy duplicate `409`)
|
|
156
|
+
are polled every five seconds for at most three minutes. A known transaction hash is retained
|
|
157
|
+
across outcome timeouts, so it is looked up without reposting. If still pending, retain state and retry. Registration, transfers and payment authorization are never
|
|
158
|
+
blindly retried. Raw upstream errors are intentionally suppressed to avoid leaking secrets.
|
|
159
|
+
|
|
160
|
+
| Exit | Meaning |
|
|
161
|
+
| --- | --- |
|
|
162
|
+
| 0 | Command completed; buy may still require a deposit or settlement |
|
|
163
|
+
| 1 | Operation failed; inspect final status and retained encrypted state before retrying |
|
|
164
|
+
| 2 | Invalid arguments, configuration, wallet source or missing local input |
|
|
165
|
+
| 3 | First-use contract trust required or declined |
|
|
166
|
+
| 4 | `status` reports pending; acceptance has not been observed (not proof of payment failure) |
|
|
167
|
+
|
|
168
|
+
## SDK seller resume and CKD configuration
|
|
169
|
+
|
|
170
|
+
`sell` saves an encrypted sell job and portable backup before registration. Retain the original
|
|
171
|
+
plaintext and its file ID; `sdk.resumeSell({ fileId, data, seller, publish })` reconstructs the
|
|
172
|
+
same ciphertext, checks the registered commitment, and completes header publication/hosting.
|
|
173
|
+
It uses `reopenSeller` if registration landed without a usable CKD response, and retains the
|
|
174
|
+
CKD secret in the encrypted job only for publication retries. After publication, the saved job and its current
|
|
175
|
+
portable backup contain public terms/metadata and a `published` marker, with `fileKey`,
|
|
176
|
+
`sellerSecret` and `ckdSecret` cleared. Seller one-time keys are cleared from their records and
|
|
177
|
+
current backups after the CKD response is opened. Recovery of a published listing needs control of the registered seller
|
|
178
|
+
wallet and the existing PAY2 ciphertext; request a fresh CKD response with `reopenSeller` to open
|
|
179
|
+
that file. Before publication, resume requires the original plaintext and the pending sell job.
|
|
180
|
+
Plaintext alone can create a new listing, but cannot reproduce the old ciphertext after cleanup. A published job cannot recreate ciphertext using a retained file key. User-made
|
|
181
|
+
backup copies and external backup history cannot be erased by the SDK; remove obsolete pre-publication
|
|
182
|
+
copies if this retention policy matters to you. `sdk.reopenSeller({ fileId, seller })`
|
|
183
|
+
also works on a fresh device and backs up its new one-time key before the call. These are SDK
|
|
184
|
+
methods; the CLI exposes `sell original.pdf --resume 0xFILE_ID`, and MCP exposes
|
|
185
|
+
`annon_sell` with `target` and `resume`. A failure after saving the registration job reports `fileId`
|
|
186
|
+
in the safe error so it can be resumed without inspecting backups. Base split creation occurs before the
|
|
187
|
+
saved registration job, so a failed split deployment still needs separate reconciliation.
|
|
188
|
+
|
|
189
|
+
The SDK reads `get_config.mpc` and `ckd_domain`, then that account's `public_key` at finality.
|
|
190
|
+
An optional human `mpcKey` / `ANNON_MPC_KEY` pins the observed value and fails closed on a
|
|
191
|
+
mismatch. The low-level `openAnswer` requires this key explicitly; it has no mainnet default.
|
|
192
|
+
Recovery isolates failures per purchase in batch mode and returns safe `errors` in CLI/MCP.
|
|
193
|
+
An expired pending reopen without a final grant gets a new backed-up key, nonce and deadline;
|
|
194
|
+
the preceding revision remains in an encrypted revision backup.
|
|
195
|
+
|
|
196
|
+
Agent policy applies when the pinned config has `agent: true`, the launcher sets
|
|
197
|
+
`ANNON_AGENT=true`, or the MCP adapter forces it. Agent config must contain a decimal USDC
|
|
198
|
+
`maxPrice`, even when the launcher supplies an environment cap. Per-call `--contract-id`,
|
|
199
|
+
`--near-rpc`, `--base-rpc`, `--relayer`, `--network`, `--trust-contract`, `--moderator`,
|
|
200
|
+
`--max-price`, `--state-dir` and alternate config paths are refused. Init and login are refused
|
|
201
|
+
once agent policy is active. Buy targets must be secure URLs; local offer files are refused.
|
|
202
|
+
Offer header URLs must share the advertised resource origin in every mode.
|
|
203
|
+
|
|
204
|
+
In every agent mode, `ANNON_STATE_DIR` is ignored; the config owns `stateDir` and its budget
|
|
205
|
+
ledger. Config `maxPrice` is required. If `ANNON_MAX_PRICE` is present, the effective cap is the
|
|
206
|
+
smaller of environment and config. Absent `allowedResources` permits any HTTPS URL or HTTP localhost URL within mandatory
|
|
207
|
+
`maxPrice` and `dailyBudget`. An explicit empty list denies every URL. Entries may be exact
|
|
208
|
+
URLs or path prefixes ending in `/*`, on the same origin and port. Prefixes cannot cross
|
|
209
|
+
path boundaries or authorize another origin. `ANNON_ALLOWED_RESOURCES`, when present,
|
|
210
|
+
further restricts the effective list, including when config leaves it open.
|
|
211
|
+
These environment settings can only tighten policy, regardless of the agent-mode trigger.
|
|
212
|
+
Deployment and trust overrides (`ANNON_CONTRACT_ID`, `ANNON_NETWORK`, `ANNON_NEAR_RPC`,
|
|
213
|
+
`ANNON_BASE_RPC`, `ANNON_RELAYER`, `ANNON_TRUST_CONTRACT`, `ANNON_MODERATORS`,
|
|
214
|
+
`ANNON_MPC_KEY` and `ANNON_ORIGINS`) are ignored in agent mode unless the launcher explicitly
|
|
215
|
+
sets `ANNON_AGENT=true`. In that explicit mode, the launcher owns those values.
|
|
216
|
+
The resource allowlist applies to `open --url` and to saved download URLs too.
|
|
217
|
+
If the home config enables agent mode, an alternate `ANNON_CONFIG` is refused. Use
|
|
218
|
+
`ANNON_AGENT=true` or the MCP launcher to keep agent mode enabled independently of config contents.
|
|
219
|
+
|
|
220
|
+
For a 1Click USDC source, price and daily limits apply to the quoted source amount, including
|
|
221
|
+
its quoted fees. Every configured origin must set `usdcDecimals` to declare its source USDC
|
|
222
|
+
precision or `maxSourceAmount` to cap its source base units. Token catalog decimals do not set
|
|
223
|
+
spending policy.
|
|
224
|
+
For other assets, configure `maxSourceAmount` on that origin in source base units; the quoted
|
|
225
|
+
amount must fit it. The destination USDC amount still counts toward the daily USDC budget.
|
|
226
|
+
Quotes without enough source policy are refused before deposit instructions are released.
|
|
227
|
+
|
|
228
|
+
A saved live or accepted purchase blocks another buy of that file. Resume its status and open
|
|
229
|
+
it using its purchase ID. Use `buy --force` only when you explicitly want another purchase.
|
|
230
|
+
A supplied `--recovery` must match the configured signer.
|
|
231
|
+
Base purchases check the trusted relayer's eligibility decision and registered split before signing.
|
|
232
|
+
|
|
233
|
+
Completed-download cooldowns return `download_limited` and `retryAfterSeconds` immediately.
|
|
234
|
+
Other host overloads retry within a total automatic wait of 60 seconds. When the next wait would
|
|
235
|
+
exceed that budget, the full remaining hint is returned. CLI JSON includes the error and exit code 4;
|
|
236
|
+
human output states the wait. MCP stores download and settlement waits locally and refuses repeat
|
|
237
|
+
requests until they elapse, including after restart. Wait, then reuse the same purchase and output
|
|
238
|
+
path. Buying again to bypass a wait spends money unnecessarily.
|
|
239
|
+
|
|
240
|
+
Agent mode also requires a human-set `workDir`. Relative `sell.target`/`output` and
|
|
241
|
+
`open.file`/`output` paths start there. Local `verify` targets, non-ID `open` targets and
|
|
242
|
+
non-ID `open --purchase` backup paths also start there. Verify URLs and purchase IDs retain
|
|
243
|
+
their existing meanings. Canonical paths must stay inside it, including symlink
|
|
244
|
+
targets and parents of new outputs; parent traversal (`..`) is refused with `path_not_allowed`.
|
|
245
|
+
The sell default output is checked too. `ANNON_WORK_DIR` is accepted only when the launcher
|
|
246
|
+
explicitly sets `ANNON_AGENT=true`. That flag also pins the config to
|
|
247
|
+
`~/.config/annon/config.json`; a different `ANNON_CONFIG` is an error.
|
|
248
|
+
|
|
249
|
+
MCP is the policy boundary: tools cannot replace the operator config, environment or credentials.
|
|
250
|
+
A shell agent running as the same OS user is not contained by these checks; it can edit that
|
|
251
|
+
user's files or run another client. Configure process and OS permissions for that threat model.
|
|
252
|
+
Browser opener processes receive only executable lookup and desktop routing variables, including
|
|
253
|
+
`BROWSER`, desktop session identifiers and `LANG`, excluding signing and backup credentials.
|
|
254
|
+
|
|
255
|
+
Relayer HTTP 429 and 503 responses with short `Retry-After` delays are retried at most three
|
|
256
|
+
times. Delays above 60 seconds return `relayer_rate_limited` or `relayer_unavailable` immediately.
|
|
257
|
+
HTTP 425 always keeps `settlement_pending` guidance: agents, JSON and status return immediately;
|
|
258
|
+
human open retries at 10, 20, 30, 40 and 60 seconds, with `Retry-After` as a minimum. A hint above
|
|
259
|
+
60 seconds returns immediately for later resumption. Keep the saved purchase and never pay again.
|
|
260
|
+
Before a Base payment through a configured relayer, the client checks its advertised contract,
|
|
261
|
+
unlock support, disabled state and minimum sponsored price.
|
|
262
|
+
|
|
263
|
+
A final unlock CKD answer can supply the first open using exactly the same final-grant and MPC
|
|
264
|
+
pairing verification as `claim_key`. An optional configured MPC pin remains enforced, but is not
|
|
265
|
+
required for this optimization. Missing or invalid answers fall back to verified `claim_key`.
|
|
266
|
+
|
|
267
|
+
Streaming sell/open accepts regular files only, refusing FIFOs; long output basenames can exceed the filesystem name limit because temporary files append a random suffix. Local verify still buffers the file.
|
|
268
|
+
Interrupted processes may leave private `.tmp` plaintext files or `.annon-spool-*` encrypted directories beside the output; remove these leftovers before retrying.
|
|
269
|
+
Outputs are published with a hard link, so the output directory must be on a filesystem that supports hard links (not exFAT or FAT32, and not some network or FUSE mounts); otherwise the final step fails with no output written.
|
|
270
|
+
|
|
271
|
+
## Purchase storage and sponsored splits
|
|
272
|
+
|
|
273
|
+
Self-funded NEAR sellers can use `annon sell <file> --price <USDC> --split <split>
|
|
274
|
+
--storage-budget 0.05`. The budget is NEAR, separate from registration storage and from
|
|
275
|
+
the signed terms. Registration is followed by explicit wallet funding before publication.
|
|
276
|
+
A definite funding refusal clears the uncertainty state and can be retried on resume.
|
|
277
|
+
Saved sell jobs record funding intent before sending and never automatically replenish
|
|
278
|
+
a completed or uncertain allocation. After uncertainty, inspect the transaction and explicitly
|
|
279
|
+
fund with `annon fund` if needed; resume requires the configured target to be available
|
|
280
|
+
before accepting that uncertain allocation as resolved. The human config field `storageBudget` supplies the same decimal-NEAR
|
|
281
|
+
target. In agent/MCP mode it is the only source; per-call storage funding overrides are
|
|
282
|
+
refused. Sponsored registrations use the relayer allocation instead.
|
|
283
|
+
|
|
284
|
+
`annon fund <file-id> <NEAR>` allocates nonwithdrawable NEAR using a NEAR wallet.
|
|
285
|
+
`annon budget <file-id>` reads available yoctoNEAR and the admission requirement.
|
|
286
|
+
After an uncertain funding result, check the file's storage balance with `annon budget <file-id>` before funding again; a new run is a new allocation.
|
|
287
|
+
Funding is human-only: agent mode refuses `fund` with `human_only`, and MCP exposes
|
|
288
|
+
no funding tool. `--storage-budget` requires a self-registered NEAR sale; other routes
|
|
289
|
+
refuse the flag. Self-registered sales without an allocation return a warning.
|
|
290
|
+
The SDK exports `fundFileStorage(wallet, contract, fileId, amountYocto, prepaid?)`
|
|
291
|
+
and `fileStorageBalance(rpc, contract, fileId)`; zero-attachment prepaid funding can spend
|
|
292
|
+
only the caller's own prepaid balance.
|
|
293
|
+
|
|
294
|
+
NEAR and 1Click buy preflight refuses before payment with `file_storage_low` if the
|
|
295
|
+
file cannot cover the 4,096-byte admission allowance. The contract checks again at receipt;
|
|
296
|
+
preflight cannot reserve capacity. Base unlock stays caller-funded and needs no file budget.
|
|
297
|
+
Existing claims and recovery continue after a file budget is depleted.
|
|
298
|
+
|
|
299
|
+
Sponsored sell obtains the relayer fee and treasuries from `/v1/capabilities`, adds the
|
|
300
|
+
required treasury share and proportionally scales the other shares. Base listings use
|
|
301
|
+
one EVM treasury share at the larger route requirement. Rounding goes to an original
|
|
302
|
+
non-treasury recipient; the treasury share rounds up by less than one basis point. Interactive CLI asks approval of the resulting split
|
|
303
|
+
before registering or creating a Base split. Config `maxProtocolFee` defaults to
|
|
304
|
+
`{ "fixed": "30000", "bps": 100 }` (0.03 USDC plus 100 bps); `fixed` is USDC base units.
|
|
305
|
+
JSON, agent and MCP sells refuse higher advertised fees with `protocol_fee_above_max`.
|
|
306
|
+
Interactive CLI shows the advertised fee and whether it exceeds the ceiling before
|
|
307
|
+
approval. Agent URL paths refuse `%2f` and `%5c`, case-insensitively.
|
|
308
|
+
JSON/agent modes return the resulting split in `terms`.
|
|
309
|
+
Self-funded listings have no compulsory protocol fee. An eight-recipient split needs a
|
|
310
|
+
free slot or an existing treasury recipient before sponsorship can add a treasury.
|
|
311
|
+
|
|
312
|
+
## Shop discovery
|
|
313
|
+
|
|
314
|
+
Use discovery before configuring a wallet or contract:
|
|
315
|
+
|
|
316
|
+
```sh
|
|
317
|
+
annon shops
|
|
318
|
+
annon shop add https://shop.example/demo --id example
|
|
319
|
+
annon catalog --shop example --search notes --limit 20 --offset 0
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
`shop add` saves a local alias for the canonical `/.well-known/annon-shop.json` URL. It grants no deployment trust. Configure `shopDirectoryUrl` to read a directory; no directory is selected by default. Local `shops` and optional `defaultShop` belong to the human configuration and cannot be changed by remote documents.
|
|
323
|
+
|
|
324
|
+
```json
|
|
325
|
+
{
|
|
326
|
+
"shopDirectoryUrl": "https://directory.example/shops.json",
|
|
327
|
+
"shops": [
|
|
328
|
+
{
|
|
329
|
+
"id": "example",
|
|
330
|
+
"manifest": "https://shop.example/.well-known/annon-shop.json"
|
|
331
|
+
}
|
|
332
|
+
],
|
|
333
|
+
"defaultShop": "example"
|
|
334
|
+
}
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
Both listing and catalog results contain `items`, `total`, and `nextOffset` (`null` at the end). `shops` searches shop names; `catalog` searches file name, title and description. Search ignores case. Catalogs sort by newest creation time, then file ID; limits default to 20 and accept 1 through 100. Offsets are nonnegative integers. `--shop` takes a local alias or a manifest URL and defaults to `defaultShop`. A shop that cannot be read stays in the `shops` list with its `manifest`, `id`, `trusted` and an `error` code instead of `info`.
|
|
338
|
+
|
|
339
|
+
Discovery uses HTTPS, omits credentials, rejects redirects and times out after 10 seconds. Limits are 64 KiB per manifest, 256 KiB and 100 shops per directory, and 8 MiB and 10000 entries per catalog. An oversized response fails with `too_large` without partial results.
|
|
340
|
+
|
|
341
|
+
For a reviewed deployment, a human can add `profile` to a local shop with `network`, `contract`, `nearRpc`, `baseRpc`, `relayer`, and `host`. RPC URLs and service origins come from that local profile. Manifest deployment changes fail with `config_conflict`. Discovery information does not authorize a purchase. Buy a catalog entry using its resource `url` through the normal `annon buy` workflow, which independently verifies the configured deployment, final chain terms, header and price.
|
|
342
|
+
|
|
343
|
+
### Shop rules
|
|
344
|
+
|
|
345
|
+
A shop manifest may carry an optional `rules` object:
|
|
346
|
+
|
|
347
|
+
```json
|
|
348
|
+
{
|
|
349
|
+
"rules": {
|
|
350
|
+
"text": "Each wallet and each IP address can upload up to 10 files and list up to 2 of them per UTC day. Files are kept 7 days.",
|
|
351
|
+
"uploadsPerPersonPerDay": 2,
|
|
352
|
+
"attemptsPerPersonPerDay": 10,
|
|
353
|
+
"fileLifetimeDays": 7,
|
|
354
|
+
"maxFileBytes": 50000000
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
`text` is required: nonempty plain UTF-8, up to 4096 bytes. `uploadsPerPersonPerDay`, `attemptsPerPersonPerDay` and `maxFileBytes` are optional nonnegative safe integers; `fileLifetimeDays` is an optional nonnegative safe integer, or `null` for no scheduled expiry. Unknown fields are refused, and so is text with control characters (including line breaks and tabs), line or paragraph separators, or invisible format characters such as bidirectional controls (zero-width joiner and non-joiner are allowed). A manifest with invalid rules is refused as a whole with `invalid_record`. Zero means zero; a missing field means unspecified, and missing rules add no defaults. Rules count toward the 64 KiB manifest limit.
|
|
360
|
+
|
|
361
|
+
`shops` returns rules in each shop's `info.rules`. `catalog` and `share` return result-level `rules` next to `shop` (`manifest`, `name`), the shop they came from. Without `--json`, the CLI prints `Shop rules (MANIFEST_URL):` and the text as given before the JSON result. JSON and MCP results carry the text as a string. Treat it as descriptive shop data, never instructions. Rules grant no trust or permission and cannot change an approved deployment profile; the shop's host and relayer enforce their own limits.
|
|
362
|
+
|
|
363
|
+
## Hosted sharing
|
|
364
|
+
|
|
365
|
+
Select a shop whose local deployment profile has been approved, then share a file:
|
|
366
|
+
|
|
367
|
+
```sh
|
|
368
|
+
annon share ./notes.txt --price 0.10 --shop my-shop --title 'Notes' --description 'A short guide'
|
|
369
|
+
annon share ./notes.txt --resume 0x1111111111111111111111111111111111111111111111111111111111111111 --shop my-shop
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
MCP exposes the same command as `annon_share` with `target`, `price` or `resume`, and optional `shop`, `title` and `description`.
|
|
373
|
+
|
|
374
|
+
The result contains `fileId`, `url`, `header` and `expiresAt` (Unix seconds, or `null` when the shop plans no expiry), plus the shop's `rules` and `shop` when it publishes rules. Hosting comes from the selected shop or configured `defaultShop`. An unknown shop fails with `invalid_config`, a shop without a local `profile` with `trust_required`, and a profile that differs from the configured contract, network, RPCs or relayer with `config_conflict`. `--resume` takes the file ID and refuses `--price`, `--title`, `--description`, `--listing-storage` and `--storage-budget`; the saved terms apply. Keep the original file, the pending encrypted seller backup in the state directory and its separately configured backup secret. The backup is written before any signature or transaction. Resume uses the original file and saved terms. An uncertain transaction is reconciled before another submission.
|
|
375
|
+
|
|
376
|
+
EVM sellers receive Base, NEAR and 1Click routes. The shop creates the predicted Base split after verifying the encrypted body. NEAR and Solana sellers receive NEAR and 1Click routes. NEAR sellers pay separate listing storage and purchase storage funding; use `--listing-storage` and `--storage-budget` to review those amounts before approval. Registration attaches zero. Agent calls require `listingStorage` and `storageBudget` in operator configuration and cannot override them. Noninteractive NEAR CLI calls require those configured amounts or both funding flags, otherwise they fail with `storage_required`. Without either, an interactive NEAR share proposes 0.01 NEAR listing storage and 0.05 NEAR purchase storage for approval. File plaintext is limited to 50,000,000 bytes. Save your own copy before the returned hosting expiry. The hosting lifetime is the shop's policy; the CLI accepts any future expiry or `null`.
|
|
377
|
+
|
|
378
|
+
Shop limits answer with error codes: the host with `rate_limited` (daily upload count per wallet, per IP or overall, with `retryAfterSeconds`), `host_capacity` or `too_large`; the relayer with `limited` (a relayer admission limit, such as an hourly request limit or a daily sponsorship quota; wait `retryAfterSeconds`) or `budget`. None of these refusals spends the seller's funds. Resume the saved sale later with `--resume` rather than starting another one.
|