Skip to content

Read the 1Click endpoint, partner key and app fee from remote config - #719

Open
n13 wants to merge 2 commits into
mainfrom
n13/one-click-remote-config
Open

n13 wants to merge 2 commits into
mainfrom
n13/one-click-remote-config

Conversation

@n13

@n13 n13 commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • No 1Click server is built into the app any more: AppConstants.oneClickEndpoint is gone
  • RemoteConfigModel gains oneClickEndpoint (nullable, no default), nearPartnerJwt (near.partner.jwt) and swapAppFee from swapFeeBips + swapFeeRecipient. swapAvailable is false without an endpoint, on both platforms and in override builds. A non-URL endpoint, a negative fee or a fee without a recipient is refused with the whole config (logged, previous config kept).
  • OneClickService / SwapService take a required endpoint; with none served every call throws StateError('No 1Click endpoint is configured'). The key goes out as X-API-Key and the fee as appFees whenever set, to whichever endpoint is configured; the echoed fee is not checked (the signature does not cover it, the proxy strips it).
  • swapServiceProvider / oneClickServiceProvider rebuild from those config values via select; the swap screens already reload on a service change, so a quersi edit takes effect on the next resume.
  • mobile-app/docs/near-intents-swaps.md deleted; 1Click/proxy documentation lives in the private proxy repo.

Through the proxy (oneClickEndpoint: https://oneclick.quantus.com) the proxy's own key and fee apply (one-click-proxy PR on n13/fee-override makes it replace the wallet's fee instead of refusing it, deploy that first). Pointed at https://1click.chaindefuser.com the remote config key and fee apply.

quersi wallet_config.json keys: oneClickEndpoint, near.partner.jwt (already served), swapFeeBips, swapFeeRecipient.

Test plan

  • quantus_sdk: one_click_service_test, swap_service_test, swap_token_search_test — 57 pass (key header, fee body, no endpoint fails before any request, base path honoured).
  • mobile-app: remote_config_notifier_test, swap_flow_test, home_intent_gating_test, app_lifecycle_manager_test, encrypted_send_near_intents_guard_test, encrypted_send_strategy_test — all pass.
  • melos run format clean; melos run analyze hung past 20 s on this machine (no result), the test runs compiled every changed file.

No 1Click address is built into the app any more. `oneClickEndpoint`,
`near.partner.jwt`, `swapFeeBips` and `swapFeeRecipient` come from quersi,
so our proxy and a direct 1Click call can be swapped without a release.
Without an endpoint swap is not offered on either platform and every 1Click
call fails with a StateError. The key goes out as X-API-Key and the fee as
appFees whenever they are set; the proxy drops the key and replaces the fee
with its own, so its values apply while it is in the path. A non-URL
endpoint, a negative fee or a fee without a recipient is refused with the
whole config and logged. The swap doc leaves the app tree.
@n13 n13 added the bot-review Request automated review from review-bot label Oct 26, 2026

@n13 n13 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: Request changes
Reviewer: GPT-6.1 Sol

Reviewed head fb1746e55eb2566b9955b209f42ce2cec364c96b against base 29277c8ed5bb62b4853c800e082ae168fa8e7dd6.

  1. [P2] Preserve ordinary encrypted sends when the swap endpoint is absent. one_click_provider.dart:5–7 now builds the recipient-check service with a null endpoint, while enableOneClickNearWarning still defaults to true. An endpoint-less config therefore does more than hide swaps: recipient validation lets the failed lookup through, but EncryptedSendStrategy.submit repeats it for every multi-input spend and returns SendFailed("Couldn't verify the address…"), even for an ordinary recipient. I reproduced this through the actual provider with a two-input plan. The live wallet-config response at review time also omits oneClickEndpoint and sets enableOneClickNearWarning: true, so this is a current rollout failure. Keep a separately configured, usable recipient-lookup endpoint when new swaps are unavailable, or otherwise make the endpoint/guard rollout consistent before shipping; preserve the deposit-address safety check. Add integration coverage for both recipient validation and multi-input submission without overriding the production provider with a working service.

  2. [P3] Reject endpoints with an empty host. remote_config_model.dart:177–184 accepts https://: Dart reports an authority, but its host is empty. A targeted test confirms that this config is accepted and swapAvailable becomes true. The service then has no usable HTTP destination. Consequently an endpoint typo replaces the last working config instead of following the promised invalid-config rejection path. Require a nonempty host and cover hostless URLs in the rejection tests.

Validation: 57 focused SDK tests and 105 mobile tests passed; two additional temporary probes reproduced the findings. Formatting passed across 864 files with no changes, and git diff --check passed. Local tests used Flutter 3.44.4 with disposable SDK-compatible dependency resolution because the installed SDK cannot honor the PR's Flutter 3.47.7 lockfiles; tracked lockfiles were restored afterward. Root analysis was stopped at the required 10-second cap and is incomplete locally. GitHub Analyze and dependency-cooldown checks passed; the CI run also passed all three package test steps. No PR code was changed.

@n13 n13 removed the bot-review Request automated review from review-bot label Oct 26, 2026
Without an oneClickEndpoint the deposit-address guard had nothing to ask
and threw, which failed every multi-input encrypted send and tripped the
recipient check while enableOneClickNearWarning was on, as the live
config has it. The check now needs the flag and an endpoint; with neither,
recipients pass without a lookup, as with the flag off. Covered against
the production provider for both the recipient screen and submission.

An endpoint without a host, such as https://, is refused like any other
unusable value instead of replacing the last working config.
@n13 n13 added the bot-review-fix Fixes for the automated review are pushed; review again label Oct 27, 2026

@n13 n13 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: Approve
Reviewer: GPT-6.1 Sol

Reviewed head 5b8b818ac10187944a7ec36c253ff7e1a6cf6b85 against base 29277c8ed5bb62b4853c800e082ae168fa8e7dd6. No blocking findings.

The follow-up resolves both findings from the previous head: recipient validation and multi-input encrypted-send submission now share the endpoint-aware guard, and hostless HTTP(S) URLs are rejected before replacing a usable configuration. The remaining diff consistently carries the configured endpoint, partner key and app fee through the services, preserves base-path prefixes, and rebuilds the providers when their relevant configuration changes.

Validation:

  • Focused flutter test --no-pub --reporter=expanded runs passed: 57 SDK tests (one_click_service_test, swap_service_test, swap_token_search_test) and 108 mobile tests (remote_config_notifier_test, swap_flow_test, home_intent_gating_test, app_lifecycle_manager_test, encrypted_send_near_intents_guard_test, encrypted_send_strategy_test).
  • One additional temporary integration test passed using the production providers: endpoint/key/fee updates reach outgoing requests, unchanged configuration preserves service identity, and removing the endpoint prevents further HTTP requests.
  • dart run melos exec -- dart format lib test --line-length=120 --output=none --set-exit-if-changed passed across 864 files, with no changes. git diff --check passed.
  • Root analysis via dart run melos exec --concurrency=1 -- "flutter analyze . --fatal-infos" was stopped at the required 10-second cap. Cold wallet, miner and SDK analysis passed; mobile analysis remained incomplete locally.

Local tests used Flutter 3.44.4 with temporary offline dependency resolution because this machine cannot honor the Flutter 3.47.7 lockfiles. All tracked lockfiles were restored; no PR code was changed. GitHub CI completed successfully, including formatting, analysis and all three package test steps (mobile, SDK and cold wallet). Dependency-cooldown checks also passed. Live settlement and the separately documented proxy deployment were not exercised.

@n13 n13 removed the bot-review-fix Fixes for the automated review are pushed; review again label Oct 27, 2026

This branch has not been deployed

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