CoinZcoin.php 838 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php

namespace App\Coin;

use App\Deposit;
use App\Project;
use Illuminate\Console\Command;

use Monero\WalletCommon;
use Monero\WalletZcoin;

class CoinZcoin implements Coin
{
    public function newWallet() : WalletCommon
    {
        return new WalletZcoin();
    }

    public function onNotifyGetTransactions(Command $command, WalletCommon $wallet)
    {
        $skip_txes = Deposit::whereNotNull('tx_id')->where('confirmations', '>', 10)->count();
        return $wallet->scanIncomingTransfers($skip_txes)->each(function ($tx) {
            $project = Project::where('address', $tx->address)->first();
            if ($project) {
                $tx->subaddr_index = $project->subaddr_index;
            }
        });
    }

    public function subaddrIndex($addressDetails, $project)
    {
        return $project->id;
    }
}