TRON -> TRON_MAINNET

This commit is contained in:
Stephan D
2026-02-01 03:35:16 +01:00
parent be3fd6075f
commit 8faed5cbaa
28 changed files with 452 additions and 90 deletions

View File

@@ -104,7 +104,7 @@ func TestAssetConversionRoundTrip(t *testing.T) {
ContractAddress: "0xabc",
}
model := assetFromProto(proto)
if model == nil || model.Chain != "TRON" || model.TokenSymbol != "USDT" || model.ContractAddress != "0xabc" {
if model == nil || model.Chain != "TRON_MAINNET" || model.TokenSymbol != "USDT" || model.ContractAddress != "0xabc" {
t.Fatalf("assetFromProto mismatch: %#v", model)
}
back := assetToProto(model)

View File

@@ -6,8 +6,8 @@ import (
"testing"
"github.com/tech/sendico/payments/orchestrator/storage/model"
pmodel "github.com/tech/sendico/pkg/model"
mloggerfactory "github.com/tech/sendico/pkg/mlogger/factory"
pmodel "github.com/tech/sendico/pkg/model"
paymenttypes "github.com/tech/sendico/pkg/payments/types"
moneyv1 "github.com/tech/sendico/pkg/proto/common/money/v1"
orchestratorv1 "github.com/tech/sendico/pkg/proto/payments/orchestrator/v1"
@@ -27,7 +27,7 @@ func TestDefaultPlanBuilder_BuildsPlanFromRoutes_CryptoToCard(t *testing.T) {
ManagedWallet: &model.ManagedWalletEndpoint{
ManagedWalletRef: "wallet-1",
Asset: &paymenttypes.Asset{
Chain: "TRON",
Chain: "TRON_MAINNET",
TokenSymbol: "USDT",
},
},
@@ -52,7 +52,7 @@ func TestDefaultPlanBuilder_BuildsPlanFromRoutes_CryptoToCard(t *testing.T) {
routes := &stubRouteStore{
routes: []*model.PaymentRoute{
{FromRail: model.RailCrypto, ToRail: model.RailCardPayout, Network: "TRON", IsEnabled: true},
{FromRail: model.RailCrypto, ToRail: model.RailCardPayout, Network: "TRON_MAINNET", IsEnabled: true},
},
}
@@ -61,7 +61,7 @@ func TestDefaultPlanBuilder_BuildsPlanFromRoutes_CryptoToCard(t *testing.T) {
{
FromRail: model.RailCrypto,
ToRail: model.RailCardPayout,
Network: "TRON",
Network: "TRON_MAINNET",
IsEnabled: true,
Steps: []model.OrchestrationStep{
{StepID: "crypto_send", Rail: model.RailCrypto, Operation: "payout.crypto"},
@@ -81,7 +81,7 @@ func TestDefaultPlanBuilder_BuildsPlanFromRoutes_CryptoToCard(t *testing.T) {
ID: "crypto-tron",
InstanceID: "crypto-tron-1",
Rail: model.RailCrypto,
Network: "TRON",
Network: "TRON_MAINNET",
Currencies: []string{"USDT"},
Capabilities: model.RailCapabilities{
CanPayOut: true,
@@ -148,7 +148,7 @@ func TestDefaultPlanBuilder_ErrorsWhenRouteMissing(t *testing.T) {
Type: model.EndpointTypeManagedWallet,
ManagedWallet: &model.ManagedWalletEndpoint{
ManagedWalletRef: "wallet-1",
Asset: &paymenttypes.Asset{Chain: "TRON"},
Asset: &paymenttypes.Asset{Chain: "TRON_MAINNET"},
},
},
Destination: model.PaymentEndpoint{
@@ -221,7 +221,7 @@ func TestBuildPlanFromTemplate_ProviderSettlementUsesNetAmountWhenFixReceived(t
},
}
plan, err := builder.buildPlanFromTemplate(ctx, payment, quote, template, model.RailCrypto, model.RailProviderSettlement, "TRON", "", registry)
plan, err := builder.buildPlanFromTemplate(ctx, payment, quote, template, model.RailCrypto, model.RailProviderSettlement, "TRON_MAINNET", "", registry)
if err != nil {
t.Fatalf("expected plan, got error: %v", err)
}
@@ -247,7 +247,7 @@ func TestDefaultPlanBuilder_UsesSourceCurrencyForCryptoSendWithFX(t *testing.T)
ManagedWallet: &model.ManagedWalletEndpoint{
ManagedWalletRef: "wallet-2",
Asset: &paymenttypes.Asset{
Chain: "TRON",
Chain: "TRON_MAINNET",
TokenSymbol: "USDT",
},
},
@@ -275,7 +275,7 @@ func TestDefaultPlanBuilder_UsesSourceCurrencyForCryptoSendWithFX(t *testing.T)
routes := &stubRouteStore{
routes: []*model.PaymentRoute{
{FromRail: model.RailCrypto, ToRail: model.RailCardPayout, Network: "TRON", IsEnabled: true},
{FromRail: model.RailCrypto, ToRail: model.RailCardPayout, Network: "TRON_MAINNET", IsEnabled: true},
},
}
@@ -284,7 +284,7 @@ func TestDefaultPlanBuilder_UsesSourceCurrencyForCryptoSendWithFX(t *testing.T)
{
FromRail: model.RailCrypto,
ToRail: model.RailCardPayout,
Network: "TRON",
Network: "TRON_MAINNET",
IsEnabled: true,
Steps: []model.OrchestrationStep{
{StepID: "crypto_send", Rail: model.RailCrypto, Operation: "payout.crypto"},
@@ -304,7 +304,7 @@ func TestDefaultPlanBuilder_UsesSourceCurrencyForCryptoSendWithFX(t *testing.T)
ID: "crypto-tron",
InstanceID: "crypto-tron-2",
Rail: model.RailCrypto,
Network: "TRON",
Network: "TRON_MAINNET",
Currencies: []string{"USDT"},
Capabilities: model.RailCapabilities{
CanPayOut: true,

View File

@@ -24,7 +24,7 @@ func ensureGatewayForAction(ctx context.Context, logger mlogger.Logger, registry
logger.Warn("Failed to validate gateway", zap.Error(err),
zap.String("instance_id", instanceID), zap.String("rail", string(rail)),
zap.String("network", network), zap.String("action", string(action)),
zap.String("direction", sendDirectionLabel(dir)), zap.Int("ralis_qty", len(cache)),
zap.String("direction", sendDirectionLabel(dir)), zap.Int("rails_qty", len(cache)),
)
return nil, err
}
@@ -36,7 +36,7 @@ func ensureGatewayForAction(ctx context.Context, logger mlogger.Logger, registry
logger.Warn("Failed to select gateway", zap.Error(err),
zap.String("instance_id", instanceID), zap.String("rail", string(rail)),
zap.String("network", network), zap.String("action", string(action)),
zap.String("direction", sendDirectionLabel(dir)), zap.Int("ralis_qty", len(cache)),
zap.String("direction", sendDirectionLabel(dir)), zap.Int("rails_qty", len(cache)),
)
return nil, err
}

View File

@@ -94,7 +94,7 @@ func TestExecutePayment_ChainFailure(t *testing.T) {
store := newStubPaymentsStore()
routes := &stubRoutesStore{
routes: []*model.PaymentRoute{
{FromRail: model.RailCrypto, ToRail: model.RailLedger, Network: "TRON", IsEnabled: true},
{FromRail: model.RailCrypto, ToRail: model.RailLedger, Network: "TRON_MAINNET", IsEnabled: true},
},
}
plans := &stubPlanTemplatesStore{
@@ -102,7 +102,7 @@ func TestExecutePayment_ChainFailure(t *testing.T) {
{
FromRail: model.RailCrypto,
ToRail: model.RailLedger,
Network: "TRON",
Network: "TRON_MAINNET",
IsEnabled: true,
Steps: []model.OrchestrationStep{
{StepID: "crypto_send", Rail: model.RailCrypto, Operation: "payout.crypto"},
@@ -132,7 +132,7 @@ func TestExecutePayment_ChainFailure(t *testing.T) {
ID: "crypto-tron",
InstanceID: "crypto-tron-1",
Rail: model.RailCrypto,
Network: "TRON",
Network: "TRON_MAINNET",
Currencies: []string{"USDT"},
Capabilities: model.RailCapabilities{
CanPayOut: true,
@@ -162,7 +162,7 @@ func TestExecutePayment_ChainFailure(t *testing.T) {
ManagedWallet: &model.ManagedWalletEndpoint{
ManagedWalletRef: "wallet-src",
Asset: &paymenttypes.Asset{
Chain: "TRON",
Chain: "TRON_MAINNET",
TokenSymbol: "USDT",
},
},