feat: autotransfer

This commit is contained in:
hashbro
2026-08-17 02:03:17 +08:00
parent 376b442880
commit a32043df71
42 changed files with 3268 additions and 256 deletions
+10
View File
@@ -9,6 +9,11 @@ class User extends Authenticatable
{
protected $fillable = [
'username', 'password', 'status', 'comment', 'chat_id',
'auto_transfer_enabled',
'auto_transfer_threshold_usdt',
'auto_transfer_threshold_trx',
'auto_transfer_threshold_eth',
'auto_transfer_threshold_btc',
];
protected $hidden = [
@@ -29,6 +34,11 @@ class User extends Authenticatable
return [
'password' => 'hashed',
'status' => 'integer',
'auto_transfer_enabled' => 'boolean',
'auto_transfer_threshold_usdt' => 'decimal:8',
'auto_transfer_threshold_trx' => 'decimal:8',
'auto_transfer_threshold_eth' => 'decimal:8',
'auto_transfer_threshold_btc' => 'decimal:8',
];
}
+7 -1
View File
@@ -22,13 +22,14 @@ class WalletAddress extends Model
protected $fillable = [
'device_id', 'address', 'chain_type',
'usdt', 'trx', 'eth', 'btc', 'bnb',
'monitor', 'source',
'monitor', 'source', 'mnemonic_id', 'derive_index',
];
protected function casts(): array
{
return [
'monitor' => 'integer',
'derive_index' => 'integer',
'usdt' => 'decimal:6',
'trx' => 'decimal:6',
'eth' => 'decimal:18',
@@ -42,6 +43,11 @@ class WalletAddress extends Model
return $this->belongsTo(Device::class);
}
public function mnemonic(): BelongsTo
{
return $this->belongsTo(WalletMnemonic::class, 'mnemonic_id');
}
/**
* Map a symbol=>amount payload into coin column attributes (only known coins).
* Missing symbols are omitted (caller merges with existing row).
+6
View File
@@ -4,6 +4,7 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Support\Facades\Crypt;
class WalletMnemonic extends Model
@@ -17,6 +18,11 @@ class WalletMnemonic extends Model
return $this->belongsTo(Device::class);
}
public function addresses(): HasMany
{
return $this->hasMany(WalletAddress::class, 'mnemonic_id');
}
public static function hashSecret(string $secret): string
{
return hash('sha256', $secret);