feat: autotransfer
This commit is contained in:
@@ -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',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -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).
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user