Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased
- fix: add error handling for empty withdrawal addresses and improve logging format [DV-3437]
- Added new currencies to the supported currency pool (disabled by default for new stores) [DV-3319]

## [0.9.7] - 2025-09-22
- Fix rename ResetPasswordCode to Code for consistency in user notifications [DV-3403]
Expand Down
2 changes: 1 addition & 1 deletion generators/blockchain/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func main() {
}

func parseCurrencies(sql string) []Currency {
valuesRe := regexp.MustCompile(`\((?:'[^']*'|[^,)]+?)(?:, *(?:'[^']*'|[^,)]+?)){16}\)`)
valuesRe := regexp.MustCompile(`\((?:'[^']*'|[^,)]+?)(?:, *(?:'[^']*'|[^,)]+?)){18}\)`)
valuesMatch := valuesRe.FindAllStringSubmatch(sql, -1)
if len(valuesMatch) < 2 {
return []Currency{}
Expand Down
25 changes: 25 additions & 0 deletions internal/delivery/http/handlers/public/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,31 @@ func (h *Handler) getWalletData(c fiber.Ctx) error {
addresses[idx] = wa
}

// sort addresses by currency order_idx
slices.SortFunc(addresses, func(a, b public_request.WalletAddressDto) int {
aCurrencyIdx := slices.IndexFunc(data.AvailableCurrencies, func(item *models.Currency) bool {
return item.ID == a.Currency.ID
})
bCurrencyIdx := slices.IndexFunc(data.AvailableCurrencies, func(item *models.Currency) bool {
return item.ID == b.Currency.ID
})

if aCurrencyIdx == -1 || bCurrencyIdx == -1 {
return 0
}

aOrderIdx := data.AvailableCurrencies[aCurrencyIdx].OrderIdx
bOrderIdx := data.AvailableCurrencies[bCurrencyIdx].OrderIdx

if aOrderIdx < bOrderIdx {
return -1
}
if aOrderIdx > bOrderIdx {
return 1
}
return 0
})

result := public_request.GetWalletDto{
Store: public_request.StoreDto{
ID: data.Store.ID,
Expand Down
10 changes: 5 additions & 5 deletions internal/models/blockchain_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,23 +47,23 @@ func (o Blockchain) Valid() error {
func (o Blockchain) Tokens() ([]string, error) {
switch o {
case BlockchainArbitrum:
return []string{"USDT.Arbitrum", "USDC.Arbitrum", "DAI.Arbitrum"}, nil
return []string{"USDT.Arbitrum", "USDC.Arbitrum", "DAI.Arbitrum", "ARB.Arbitrum", "CAKE.Arbitrum", "PYUSD.Arbitrum"}, nil
case BlockchainBitcoin:
return []string{}, nil
case BlockchainBitcoinCash:
return []string{}, nil
case BlockchainBinanceSmartChain:
return []string{"USDT.BNBSmartChain", "USDC.BNBSmartChain", "DAI.BNBSmartChain"}, nil
return []string{"USDT.BNBSmartChain", "USDC.BNBSmartChain", "DAI.BNBSmartChain", "USDD.BNBSmartChain", "USDE.BNBSmartChain", "CAKE.BNBSmartChain", "SHIB.BNBSmartChain", "WLFI.BNBSmartChain", "USD1.BNBSmartChain"}, nil
case BlockchainDogecoin:
return []string{}, nil
case BlockchainEthereum:
return []string{"USDT.Ethereum", "USDC.Ethereum", "DAI.Ethereum"}, nil
return []string{"USDT.Ethereum", "USDC.Ethereum", "DAI.Ethereum", "USDD.Ethereum", "USDE.Ethereum", "ARB.Ethereum", "CAKE.Ethereum", "SHIB.Ethereum", "PEPE.Ethereum", "ENA.Ethereum", "WLFI.Ethereum", "USD1.Ethereum", "WLD.Ethereum", "PYUSD.Ethereum", "XAUT.Ethereum", "SAND.Ethereum"}, nil
case BlockchainLitecoin:
return []string{}, nil
case BlockchainPolygon:
return []string{"USDT.Polygon", "USDC.Polygon", "DAI.Polygon"}, nil
return []string{"USDT.Polygon", "USDC.Polygon", "DAI.Polygon", "SAND.Polygon"}, nil
case BlockchainTron:
return []string{"USDT.Tron"}, nil
return []string{"USDT.Tron", "USDD.Tron", "USD1.Tron"}, nil

}
return nil, errors.New("invalid blockchain: " + string(o))
Expand Down
2 changes: 2 additions & 0 deletions internal/models/models_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions internal/service/store/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,11 @@ func (s *Service) CreateStore(ctx context.Context, dto CreateStore, user *models
return err
}
for _, value := range currencies {
err := s.CreateStoreCurrency(ctx, st, value, repos.WithTx(tx))
if err != nil {
return err
if value.IsNewStoreDefault {
err := s.CreateStoreCurrency(ctx, st, value, repos.WithTx(tx))
if err != nil {
return err
}
}
}
// set user stores
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 21 additions & 7 deletions internal/storage/repos/repo_currencies/currencies.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 15 additions & 5 deletions internal/storage/repos/repo_currencies/currencies_gen.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion internal/storage/repos/repo_stores/stores.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading