Skip to content

feat: add Greenfield API endpoints for EVM USDt chains - #31

Open
learntheropes wants to merge 15 commits into
btcpayserver-tether:developfrom
learntheropes:feature/evm-greenfield
Open

feat: add Greenfield API endpoints for EVM USDt chains#31
learntheropes wants to merge 15 commits into
btcpayserver-tether:developfrom
learntheropes:feature/evm-greenfield

Conversation

@learntheropes

Copy link
Copy Markdown
Contributor

Summary

  • Adds GET /api/v1/stores/{storeId}/evmUSDtlike/{paymentMethodId} — returns store configuration with address list, availability, and balances
  • Adds POST /api/v1/stores/{storeId}/evmUSDtlike/{paymentMethodId}/addresses — adds an EVM address (validates EVM format, rejects duplicates)
  • Adds DELETE /api/v1/stores/{storeId}/evmUSDtlike/{paymentMethodId}/addresses/{address} — removes an address
  • Includes Swagger/OpenAPI documentation for all three endpoints

Covers all EVM chains registered in EVMUSDtLikeConfigurationItems (ETH mainnet, Sepolia, Polygon PoS, Amoy).

Note: depends on feature/net10 (.NET 10 migration).

Test plan

  • GET endpoint returns 404 when payment method not configured
  • GET endpoint returns address list with balance and availability for configured addresses
  • POST endpoint rejects invalid EVM addresses with 400
  • POST endpoint rejects duplicate addresses with 400
  • POST endpoint adds address and persists it
  • DELETE endpoint returns 404 for unknown address
  • DELETE endpoint removes address and persists the change

🤖 Generated with Claude Code

rockstardev and others added 13 commits January 18, 2026 10:36
Adds USDT on Polygon PoS as a second EVM chain alongside Ethereum,
reusing the existing EVM infrastructure (EthUSDtRPCProvider,
EthUSDtListener, EthUSDtLikeSummaryUpdaterHostedService) which
iterates EVMUSDtLikeConfigurationItems and handles all chains
automatically. No new hosted services are needed.

Changes:
- Add Constants.PolygonChainName and AmoyChainName
- Add BlockTimeSeconds to EthUSDtLikeConfigurationItem (ETH=12s, Polygon=2s)
  for correct sync threshold calculation
- Add ChainId to EthUSDtLikeConfigurationItem (ETH=1, Polygon=137)
  for correct EIP-681 QR code generation
- Rename EthereumUSDtLikeConfigurationItems to EVMUSDtLikeConfigurationItems
- Add GetPolygonUSDtHardcodedConfig with mainnet (chainId=137,
  contract=0xc2132d..., polygon-rpc.com, polygonscan.com) and Amoy testnet
- Add GetEVMUSDtDefaultConfigurationItem dispatcher by payment method ID
- Update UIEthUSDtLikeServerController to handle any EVM chain via
  {paymentMethodId} route param
- Add chain-specific store view GetStorePolygonUSDtLikePaymentMethod
- Wire Polygon in RegisterServices with its own payment handler,
  payment link extension, checkout model, and transaction link provider
- Add hidden DisplayName input in server config view to fix POST validation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- TargetFramework: net8.0 → net10.0
- LangVersion: 12 → 13
- Npgsql.EntityFrameworkCore.PostgreSQL: 8.0.11 → 10.0.0
- global.json SDK: 8.0.404 → 10.0.100
- Minimum BTCPayServer version: >=2.0.0 → >=2.3.7 (first .NET 10 release)
- Replace HttpContext.GetStoreData() with GetStoreDataOrNull() per breaking change
- Update btcpayserver submodule to latest master

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds GET /api/v1/stores/{storeId}/evmUSDtlike/{paymentMethodId} to
retrieve store configuration with address balances and availability,
POST .../addresses to add an EVM address, and DELETE .../addresses/{address}
to remove one. Includes Swagger documentation for all three endpoints.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 6, 2026 06:03
@socket-security

socket-security Bot commented Apr 6, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatednethereum.contracts@​4.20.0 ⏵ 6.1.0100 +1010090100100
Updatednethereum.hex@​4.20.0 ⏵ 6.1.0100 +410090100100
Updatednethereum.rpc@​4.20.0 ⏵ 6.1.0100 +410090100100
Updatednethereum.standardtokeneip20@​4.20.0 ⏵ 6.1.0100 +410090100100
Updatednethereum.web3@​4.20.0 ⏵ 6.1.0100 +1810090100100
Updatednpgsql.entityframeworkcore.postgresql@​8.0.11 ⏵ 10.0.010010090100100

View full report

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 Greenfield API endpoints and multi-chain configuration support for EVM-based USDt payment methods (Ethereum + Polygon/Amoy), alongside the repo’s .NET 10 migration.

Changes:

  • Introduces Greenfield GET/POST/DELETE endpoints for managing EVM USDt address lists per store/payment method.
  • Extends the plugin from “Ethereum-only” to a generalized EVM configuration set (Ethereum, Sepolia, Polygon PoS, Amoy), including server/store UI updates.
  • Updates EIP-681 payment links to include EIP-155 chainId and adjusts sync logic using per-chain block times.

Reviewed changes

Copilot reviewed 26 out of 26 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
global.json Pins repo SDK to .NET 10.0.100 for the migration.
BTCPayServer.Plugins.USDt/Views/UIEthUSDtLikeStore/GetStorePolygonUSDtLikePaymentMethod.cshtml Adds Polygon (and reused for Amoy) store settings view for address management.
BTCPayServer.Plugins.USDt/Views/UIEthUSDtLikeServer/GetServerConfig.cshtml Makes server config page/payment method selection dynamic by paymentMethodId.
BTCPayServer.Plugins.USDt/Views/Shared/TronUSDtLike/StoreWalletsNavTronUSDtExtension.cshtml Uses nullable store accessor in nav extension.
BTCPayServer.Plugins.USDt/Views/Shared/EthUSDtLike/StoreWalletsNavEthUSDtExtension.cshtml Switches nav rendering to EVM configuration set and nullable store accessor.
BTCPayServer.Plugins.USDt/Views/Shared/EthUSDtLike/ServerNavEthUSDtExtension.cshtml Renders server nav entries per configured EVM chain.
BTCPayServer.Plugins.USDt/USDtPlugin.cs Adds Polygon/Amoy configs, wiring, and shared EVM helpers; bumps BTCPay dependency.
BTCPayServer.Plugins.USDt/Services/Payments/EthUSDtPaymentLinkExtension.cs Adds chainId support to generated EIP-681 payment links.
BTCPayServer.Plugins.USDt/Services/EthUSDtRPCProvider.cs Iterates EVM configs and uses per-chain block time for sync status.
BTCPayServer.Plugins.USDt/Services/EthUSDtListener.cs Extends listener to iterate all EVM configs instead of only Ethereum.
BTCPayServer.Plugins.USDt/Services/EthUSDtLikeSummaryUpdaterHostedService.cs Extends summary updater to iterate all EVM configs.
BTCPayServer.Plugins.USDt/Controllers/ViewModels/EthUSDtLikeServerConfigViewModel.cs Adjusts DisplayName mutability for server config postback.
BTCPayServer.Plugins.USDt/Controllers/UITronUSDtLikeStoreController.cs Uses nullable store accessor; adjusts address splitting.
BTCPayServer.Plugins.USDt/Controllers/UITronUSDtLikeServerController.cs Adjusts header splitting implementation.
BTCPayServer.Plugins.USDt/Controllers/UIEthUSDtLikeStoreController.cs Updates store UI controller to support multiple EVM chains and per-chain views.
BTCPayServer.Plugins.USDt/Controllers/UIEthUSDtLikeServerController.cs Updates server UI routes/actions to be per-payment-method EVM configuration.
BTCPayServer.Plugins.USDt/Controllers/SwaggerProvider.cs Adds OpenAPI entries for the new EVM Greenfield endpoints.
BTCPayServer.Plugins.USDt/Controllers/Models/EthUSDtPaymentMethodInformation.cs Adds response/request models for the Greenfield EVM endpoints.
BTCPayServer.Plugins.USDt/Controllers/GreenfieldTronUSDtLikeStoreController.cs Uses nullable store accessor in Greenfield Tron controller.
BTCPayServer.Plugins.USDt/Controllers/GreenfieldEthUSDtLikeStoreController.cs Adds Greenfield EVM USDt endpoints (GET/POST/DELETE).
BTCPayServer.Plugins.USDt/Configuration/USDtPluginConfiguration.cs Renames Ethereum-only config dictionary to EVMUSDtLikeConfigurationItems.
BTCPayServer.Plugins.USDt/Configuration/Ethereum/EthUSDtLikeConfigurationItem.cs Adds per-chain BlockTimeSeconds and ChainId config.
BTCPayServer.Plugins.USDt/Configuration/Constants.cs Adds chain constants (Sepolia/Polygon/Amoy) and converts Sepolia name to const.
BTCPayServer.Plugins.USDt/BTCPayServer.Plugins.USDt.csproj Migrates to net10.0 and bumps core dependencies (Nethereum/Npgsql EF).
BTCPayServer.Plugins.USDt.Tests/BTCPayServer.Plugins.USDt.Tests.csproj Migrates tests to net10.0.

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

Comment thread BTCPayServer.Plugins.USDt/Controllers/GreenfieldEthUSDtLikeStoreController.cs Outdated
Comment thread BTCPayServer.Plugins.USDt/USDtPlugin.cs
learntheropes and others added 2 commits April 6, 2026 03:18
The add-address endpoint now accepts a list of addresses in a single
request. Invalid and duplicate addresses are reported together in the
error response.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Inject StoreRepository and call UpdateStore after adding or removing
addresses so changes survive the request.

Co-Authored-By: Claude Sonnet 4.6 <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.

4 participants