Skip to content

Integrate Open CryptoPay payment standard#1299

Open
reubenyap wants to merge 4 commits intocypherstack:stagingfrom
reubenyap:claude/integrate-open-cryptopay-8mI4H
Open

Integrate Open CryptoPay payment standard#1299
reubenyap wants to merge 4 commits intocypherstack:stagingfrom
reubenyap:claude/integrate-open-cryptopay-8mI4H

Conversation

@reubenyap
Copy link
Copy Markdown

@reubenyap reubenyap commented Apr 20, 2026

Summary

Adds Open CryptoPay QR support with method/network validation, quote expiry checks, fee-floor enforcement, and raw signed transaction submission where required by the OCP flow.

This also adds minimal Ethereum mainnet ERC-20 support for tokens already enabled in the wallet. ERC-20 matching uses the token contract address from the EIP-681 transaction URI as the authority; symbols are only used for display and initial asset filtering.

Supported OCP Flows

  • Detects Open CryptoPay URLs embedded in QR LNURL payloads.
  • Fetches payment details and quotes over HTTPS.
  • Filters available payment methods by wallet coin, OCP method, network, and enabled token contract.
  • Supports native ETH through the existing send flow.
  • Supports enabled Ethereum mainnet ERC-20 tokens through TokenSendView.
  • Submits raw signed hex to the OCP provider for EVM/ERC-20, BTC, and Firo instead of broadcasting locally first.
  • Keeps non-OCP send and token-send behavior unchanged.

Safety Checks

  • Rejects unsupported methods such as Lightning/BinancePay/unknown chains.
  • Rejects ERC-20 URIs unless they are Ethereum mainnet transfer calls with recipient, raw amount, and an enabled matching contract.
  • Enforces quote expiration before opening send and again immediately before OCP submission.
  • Enforces OCP minFee for supported fee models.
  • Verifies recipient, amount, method, asset, and token contract before provider submission.
  • Uses HTTPS-only OCP calls, callback host validation, and request timeouts.

Limitations

  • ERC-20 support is limited to Ethereum mainnet tokens already enabled in the wallet.
  • No token auto-import, custom-token lookup, token chooser UI, Polygon/Base/Arbitrum/BSC support, Lightning support, BinancePay support, or Monero OCP support is added.
  • OCP callback host validation assumes the callback host matches the LNURL host.

Test Plan

  • Added parser coverage for native ETH and ERC-20 EIP-681 URIs.
  • Covered invalid chain id, wrong function, missing recipient, missing amount, and malformed token contract cases.
  • Manually reviewed native ETH and ERC-20 routing paths.
  • Verified OCP-only raw signing paths are gated behind OpenCryptoPayCommit.
  • Ran formatting and diff whitespace checks.

@reubenyap reubenyap force-pushed the claude/integrate-open-cryptopay-8mI4H branch 3 times, most recently from 86f77e8 to 6187a48 Compare April 27, 2026 11:02
Add Open CryptoPay QR handling, payment details fetching, method selection, and native-wallet send routing with HTTPS and callback host hardening.
Filter OCP methods by supported wallet network, enforce quote expiry and minimum fees, and route raw-hex settlement through the provider where required.
Add EIP-681 parsing and route Ethereum mainnet ERC-20 OCP payments through the existing token send flow, using enabled token contract addresses as the authority.
@reubenyap reubenyap force-pushed the claude/integrate-open-cryptopay-8mI4H branch from fda549f to e2c1393 Compare April 27, 2026 16:24
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