Skip to content

Add dApp payment request flow - #90

Open
Jim8y wants to merge 5 commits into
neoorder:masterfrom
Jim8y:codex/dapp-payment-request
Open

Add dApp payment request flow#90
Jim8y wants to merge 5 commits into
neoorder:masterfrom
Jim8y:codex/dapp-payment-request

Conversation

@Jim8y

@Jim8y Jim8y commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a high-level dApp payment request flow on top of the existing dAPI transaction pipeline.

  • Adds requestPayment to the injected OneGate dAPI provider.
  • Accepts asset, from, to, amount, data, purpose, details, and timeoutSeconds.
  • Reuses the existing transaction preview and wallet authorization popup so users see token, amount, fee, sender/recipient, and dApp-provided purpose/details before signing.
  • Signs and submits the transaction only after password/biometric authorization.
  • Waits for block inclusion and checks getapplicationlog for HALT before returning success.
  • Shows the success toast only after confirmed success; failures/timeouts are returned to the dApp as dAPI errors.
  • Keeps existing send behavior unchanged for compatibility.

Validation

  • dAPI surface contract check passed.
  • DEVELOPER_DIR=/Applications/Xcode-26.5.0.app/Contents/Developer dotnet build OneGateApp/OneGateApp.csproj -f net10.0-ios -c Debug -p:RuntimeIdentifier=iossimulator-arm64 -p:EnableCodeSigning=false passed.
  • dotnet restore/build OneGateApp/OneGateApp.csproj -f net10.0-android -c Debug -p:RuntimeIdentifier=android-arm64 ... passed.
  • Installed and launched on iOS Simulator iPhone 17 Pro.
  • Installed and launched on Android emulator onegate_api36.

Notes

The SDK helper is in a companion PR in r3e-network/neo-miniapps-platform. End-to-end payment confirmation still requires a funded test wallet and a dApp calling the new SDK helper.

@Jim8y

Jim8y commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

Simulator validation screenshots

Validation build: codex/dapp-payment-request (a32a90a). Screenshots are stored as GitHub Release assets on the fork; no screenshots are committed to the repo.

iOS Simulator

iOS launch

Android Emulator

Android launch

@Jim8y

Jim8y commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

Companion SDK PR: r3e-network/neo-miniapps-platform#251.

@Jim8y
Jim8y force-pushed the codex/dapp-payment-request branch from a32a90a to 5707054 Compare July 13, 2026 10:43
@Jim8y Jim8y changed the title [codex] Add dApp payment request flow Add dApp payment request flow Jul 13, 2026
@Jim8y

Jim8y commented Jul 13, 2026

Copy link
Copy Markdown
Contributor Author

Synced the branch with the latest master and resolved the localization conflicts without dropping either side.

Validation after the merge:

  • All 15 resource files parse as XML, contain 332 unique keys, and include both the current master transaction/address-book strings and the four payment-request strings.
  • git diff --check passed.
  • Android arm64 bundled build passed, installed on onegate_api36, and cold-launched in 2.8 seconds with no ANR or fatal exception.
  • iOS simulator arm64 build passed, installed on iPhone 17 Pro / iOS 26.5, and remained running with no new crash report.

Android

Android master-sync validation

iOS

iOS master-sync validation

The screenshots are external release assets and are not committed to the repository.

This PR remains draft. The remaining gate is a funded end-to-end dApp payment that proves authorization, broadcast, block inclusion, HALT application-log status, and the SDK response. The launch screenshots are merge-regression evidence only, not payment-flow proof.

@Jim8y

Jim8y commented Jul 18, 2026

Copy link
Copy Markdown
Contributor Author

@erikzhang Before I take this draft further, could you confirm whether a dApp-initiated NEP-17 payment request through the existing NEP-21 bridge is an acceptable direction? I will keep the PR draft and will not expand the SDK/API surface until that direction is confirmed.

…request

# Conflicts:
#	OneGateApp/Pages/LaunchDAppPage.xaml.dAPI.cs
@Jim8y

Jim8y commented Jul 19, 2026

Copy link
Copy Markdown
Contributor Author

Synced with the latest master and resolved the dAPI conflict.

The final audit found and fixed a remote-debug approval gap: requestPayment now requires explicit remote approval before the existing signing and broadcast path can run.

Validation:

  • Debug protocol tests: 6/6 passed
  • Browser mock tests: 16/16 passed
  • Android Debug build: passed with 0 warnings and 0 errors
  • iOS simulator arm64 build: passed with 0 errors
  • Android and iOS both displayed the real payment preview with token, amount, destination, purpose, details, and fee
  • Android cancellation returned dAPI error 10006; no signing or broadcast occurred

Android

Android payment preview

iOS

iOS payment preview

The screenshots are external release assets and are not committed to the repository.

This remains draft for now. The funded success path still needs to prove authorization, broadcast, block inclusion, HALT application-log status, and the SDK result. The companion SDK PR is also still draft with failing repository checks, and the requested API-direction confirmation has not yet been received.

@Jim8y
Jim8y marked this pull request as ready for review July 26, 2026 01:19
Copilot AI review requested due to automatic review settings July 26, 2026 01:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds a new requestPayment dAPI method that reuses the existing transaction-preview + authorization popup, then confirms inclusion and successful execution (HALT) before reporting success back to the calling dApp. This builds a higher-level “payment request” flow on top of the current transaction pipeline while keeping send unchanged.

Changes:

  • Added requestPayment to the injected dAPI provider and implemented the RPC handler + confirmation polling.
  • Extended the existing SendTransactionPopup to optionally display dApp-provided request details.
  • Added localized strings for the new payment-request UI across supported languages.

Reviewed changes

Copilot reviewed 21 out of 22 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
OneGateApp/Properties/Strings.resx Adds base (en) strings for payment request UI.
OneGateApp/Properties/Strings.Designer.cs Regenerates strongly-typed accessors for new strings.
OneGateApp/Properties/Strings.de.resx Adds German translations for payment request UI.
OneGateApp/Properties/Strings.es.resx Adds Spanish translations for payment request UI.
OneGateApp/Properties/Strings.fr.resx Adds French translations for payment request UI.
OneGateApp/Properties/Strings.id.resx Adds Indonesian translations for payment request UI.
OneGateApp/Properties/Strings.it.resx Adds Italian translations for payment request UI.
OneGateApp/Properties/Strings.ja.resx Adds Japanese translations for payment request UI.
OneGateApp/Properties/Strings.ko.resx Adds Korean translations for payment request UI.
OneGateApp/Properties/Strings.nl.resx Adds Dutch translations for payment request UI.
OneGateApp/Properties/Strings.pt-BR.resx Adds Brazilian Portuguese translations for payment request UI.
OneGateApp/Properties/Strings.ru.resx Adds Russian translations for payment request UI.
OneGateApp/Properties/Strings.tr.resx Adds Turkish translations for payment request UI.
OneGateApp/Properties/Strings.vi.resx Adds Vietnamese translations for payment request UI.
OneGateApp/Properties/Strings.zh-Hans.resx Adds Simplified Chinese translations for payment request UI.
OneGateApp/Properties/Strings.zh-Hant.resx Adds Traditional Chinese translations for payment request UI.
OneGateApp/Pages/LaunchDAppPage.xaml.cs Exposes requestPayment on the injected provider method list.
OneGateApp/Pages/LaunchDAppPage.xaml.dAPI.cs Implements RequestPayment, customizes the existing send popup, and adds on-chain confirmation logic.
OneGateApp/Models/DAppPaymentRequest.cs Introduces request DTO, validation, timeout mapping, and display detail formatting.
OneGateApp/Models/DAppPaymentResult.cs Introduces result DTO returned to the dApp after confirmation.
OneGateApp/Controls/Popups/SendTransactionPopup.xaml.cs Adds bindable request-details state for the popup.
OneGateApp/Controls/Popups/SendTransactionPopup.xaml Renders request details block when present.
Files not reviewed (1)
  • OneGateApp/Properties/Strings.Designer.cs: Generated file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

DateTime deadline = DateTime.UtcNow + timeout;
while (DateTime.UtcNow < deadline)
{
await Task.Delay(TimeSpan.FromSeconds(3));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants