feat: add Greenfield API endpoints for EVM USDt chains - #31
Open
learntheropes wants to merge 15 commits into
Open
feat: add Greenfield API endpoints for EVM USDt chains#31learntheropes wants to merge 15 commits into
learntheropes wants to merge 15 commits into
Conversation
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>
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
This was referenced Apr 6, 2026
There was a problem hiding this comment.
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/DELETEendpoints 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
chainIdand 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.
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GET /api/v1/stores/{storeId}/evmUSDtlike/{paymentMethodId}— returns store configuration with address list, availability, and balancesPOST /api/v1/stores/{storeId}/evmUSDtlike/{paymentMethodId}/addresses— adds an EVM address (validates EVM format, rejects duplicates)DELETE /api/v1/stores/{storeId}/evmUSDtlike/{paymentMethodId}/addresses/{address}— removes an addressCovers all EVM chains registered in
EVMUSDtLikeConfigurationItems(ETH mainnet, Sepolia, Polygon PoS, Amoy).Note: depends on
feature/net10(.NET 10 migration).Test plan
🤖 Generated with Claude Code