Skip to content

feat: add Greenfield API endpoints for Tron USDt addresses - #33

Open
learntheropes wants to merge 18 commits into
btcpayserver-tether:developfrom
learntheropes:feature/tron-greenfield
Open

feat: add Greenfield API endpoints for Tron USDt addresses#33
learntheropes wants to merge 18 commits into
btcpayserver-tether:developfrom
learntheropes:feature/tron-greenfield

Conversation

@learntheropes

Copy link
Copy Markdown
Contributor

Summary

  • Adds POST /api/v1/stores/{storeId}/tronUSDtlike/{paymentMethodId}/addresses — adds a Tron address (validates Tron format, rejects duplicates)
  • Adds DELETE /api/v1/stores/{storeId}/tronUSDtlike/{paymentMethodId}/addresses/{address} — removes a Tron address
  • Includes Swagger/OpenAPI documentation for both endpoints

Note: depends on feature/evm-greenfield (#31).

Test plan

  • POST endpoint rejects invalid Tron 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:09
@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

This PR expands the USDt plugin’s Greenfield API and EVM-chain support by adding address-management endpoints and updating configuration/UI wiring to handle multiple EVM USDt-like chains (including Polygon/Amoy), alongside a .NET SDK/TFM and dependency upgrade.

Changes:

  • Add Greenfield endpoints (and Swagger docs) for managing EVM and Tron USDt-like addresses.
  • Refactor “Ethereum” USDt-like configuration into a multi-chain EVM configuration, and add Polygon/Amoy defaults + UI/navigation.
  • Upgrade to .NET 10 and update Nethereum/Npgsql dependencies.

Reviewed changes

Copilot reviewed 27 out of 27 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
global.json Bump repo SDK to .NET 10
BTCPayServer.Plugins.USDt/BTCPayServer.Plugins.USDt.csproj Move plugin to net10.0 + dependency upgrades
BTCPayServer.Plugins.USDt.Tests/BTCPayServer.Plugins.USDt.Tests.csproj Move tests to net10.0
BTCPayServer.Plugins.USDt/USDtPlugin.cs Add Polygon config + refactor ETH→EVM wiring + payment link chainId
BTCPayServer.Plugins.USDt/Configuration/USDtPluginConfiguration.cs Rename Ethereum config dict to EVM dict
BTCPayServer.Plugins.USDt/Configuration/Ethereum/EthUSDtLikeConfigurationItem.cs Add BlockTimeSeconds + ChainId to config
BTCPayServer.Plugins.USDt/Configuration/Constants.cs Add chain name constants (Sepolia/Polygon/Amoy)
BTCPayServer.Plugins.USDt/Services/Payments/EthUSDtPaymentLinkExtension.cs Add EIP-681 chainId in payment links
BTCPayServer.Plugins.USDt/Services/EthUSDtRPCProvider.cs Use EVM config dict + block-time-based sync threshold
BTCPayServer.Plugins.USDt/Services/EthUSDtListener.cs Iterate EVM config dict for listeners
BTCPayServer.Plugins.USDt/Services/EthUSDtLikeSummaryUpdaterHostedService.cs Iterate EVM config dict for summary updates
BTCPayServer.Plugins.USDt/Controllers/UIEthUSDtLikeStoreController.cs Multi-chain EVM store UI support + Polygon view selection
BTCPayServer.Plugins.USDt/Controllers/UIEthUSDtLikeServerController.cs Multi-chain server config route and lookup by paymentMethodId
BTCPayServer.Plugins.USDt/Controllers/UITronUSDtLikeStoreController.cs Use GetStoreDataOrNull + minor parsing tweak
BTCPayServer.Plugins.USDt/Controllers/UITronUSDtLikeServerController.cs Minor parsing tweak
BTCPayServer.Plugins.USDt/Controllers/GreenfieldEthUSDtLikeStoreController.cs New EVM Greenfield store endpoints
BTCPayServer.Plugins.USDt/Controllers/GreenfieldTronUSDtLikeStoreController.cs Add Tron Greenfield address add/delete endpoints
BTCPayServer.Plugins.USDt/Controllers/SwaggerProvider.cs Extend Swagger JSON for EVM + Tron address endpoints
BTCPayServer.Plugins.USDt/Controllers/Models/EthUSDtPaymentMethodInformation.cs New EVM response + add-address request models
BTCPayServer.Plugins.USDt/Controllers/Models/TronUSDtPaymentMethodInformation.cs Add Tron add-address request model
BTCPayServer.Plugins.USDt/Controllers/ViewModels/EthUSDtLikeServerConfigViewModel.cs Make DisplayName settable for POST binding
BTCPayServer.Plugins.USDt/Views/UIEthUSDtLikeServer/GetServerConfig.cshtml Active-page key per EVM paymentMethodId + hidden DisplayName
BTCPayServer.Plugins.USDt/Views/UIEthUSDtLikeStore/GetStorePolygonUSDtLikePaymentMethod.cshtml New Polygon store payment-method settings page
BTCPayServer.Plugins.USDt/Views/Shared/EthUSDtLike/StoreWalletsNavEthUSDtExtension.cshtml Update nav to EVM config dict + GetStoreDataOrNull
BTCPayServer.Plugins.USDt/Views/Shared/TronUSDtLike/StoreWalletsNavTronUSDtExtension.cshtml Use GetStoreDataOrNull
BTCPayServer.Plugins.USDt/Views/Shared/EthUSDtLike/ServerNavEthUSDtExtension.cshtml Render server nav entries for each EVM chain

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

Comment thread global.json
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>
@learntheropes
learntheropes force-pushed the feature/tron-greenfield branch from d082064 to db45a7c Compare April 6, 2026 06:19
learntheropes and others added 4 commits April 6, 2026 03:32
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>
Adds POST /api/v1/stores/{storeId}/tronUSDtlike/{paymentMethodId}/addresses
to add a Tron address and DELETE .../addresses/{address} to remove one.
Includes Swagger documentation for both endpoints.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Both EVM and Tron add-address endpoints now accept a list of addresses
in a single request instead of one at a time. Invalid and duplicate
addresses are reported together in the error response.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…points

Inject StoreRepository and call UpdateStore after adding or removing
addresses so changes survive the request. Also fixes AddAddress to accept
an array of addresses matching the EVM endpoint behaviour.

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