feat: bnb

This commit is contained in:
hashbro
2026-09-26 12:27:12 +08:00
parent 534b36a2d2
commit ad09fdff88
23 changed files with 475 additions and 82 deletions
@@ -159,9 +159,10 @@ class WalletAddressController extends Controller
if ($amount === '' || strcasecmp($amount, 'all') === 0 || $amount === '全部') {
$amount = null;
} else {
$decimals = match ($asset) {
'ETH', 'BNB' => 18,
'BTC' => 8,
$decimals = match (true) {
$asset === 'ETH', $asset === 'BNB' => 18,
$asset === 'BTC' => 8,
$asset === 'USDT' && $chain === 'bsc' => 18,
default => 6,
};
if (! preg_match('/^\d+(\.\d{1,'.$decimals.'})?$/', $amount)) {
@@ -207,6 +208,9 @@ class WalletAddressController extends Controller
if (str_contains($type, 'TRON') || $type === 'TRX') {
return 'tron';
}
if (str_contains($type, 'BSC') || str_contains($type, 'BNB') || str_contains($type, 'BINANCE')) {
return 'bsc';
}
if (str_contains($type, 'ETH') || str_contains($type, 'EVM')) {
return 'eth';
}
@@ -234,6 +238,7 @@ class WalletAddressController extends Controller
{
return match ($chain) {
'eth' => ['ETH', 'USDT', 'BNB'],
'bsc' => ['BNB', 'USDT'],
'btc' => ['BTC'],
default => ['USDT', 'TRX'],
};