Search in sources :

Example 1 with CryptoCurrencyAccount

use of io.bisq.core.payment.CryptoCurrencyAccount in project bisq-api by mrosseel.

the class MainViewModelHeadless method setupDevDummyPaymentAccounts.

private void setupDevDummyPaymentAccounts() {
    if (user.getPaymentAccounts() != null && user.getPaymentAccounts().isEmpty()) {
        PerfectMoneyAccount perfectMoneyAccount = new PerfectMoneyAccount();
        perfectMoneyAccount.init();
        perfectMoneyAccount.setAccountNr("dummy_" + new Random().nextInt(100));
        // Don't translate only for dev
        perfectMoneyAccount.setAccountName("PerfectMoney dummy");
        perfectMoneyAccount.setSelectedTradeCurrency(GlobalSettings.getDefaultTradeCurrency());
        user.addPaymentAccount(perfectMoneyAccount);
        if (p2PService.isBootstrapped()) {
            accountAgeWitnessService.publishMyAccountAgeWitness(perfectMoneyAccount.getPaymentAccountPayload());
        } else {
            p2PService.addP2PServiceListener(new BootstrapListener() {

                @Override
                public void onUpdatedDataReceived() {
                    accountAgeWitnessService.publishMyAccountAgeWitness(perfectMoneyAccount.getPaymentAccountPayload());
                }
            });
        }
        CryptoCurrencyAccount cryptoCurrencyAccount = new CryptoCurrencyAccount();
        cryptoCurrencyAccount.init();
        // Don't translate only for dev
        cryptoCurrencyAccount.setAccountName("ETH dummy");
        cryptoCurrencyAccount.setAddress("0x" + new Random().nextInt(1000000));
        cryptoCurrencyAccount.setSingleTradeCurrency(CurrencyUtil.getCryptoCurrency("ETH").get());
        user.addPaymentAccount(cryptoCurrencyAccount);
    }
}
Also used : BootstrapListener(io.bisq.network.p2p.BootstrapListener) CryptoCurrencyAccount(io.bisq.core.payment.CryptoCurrencyAccount) PerfectMoneyAccount(io.bisq.core.payment.PerfectMoneyAccount)

Aggregations

CryptoCurrencyAccount (io.bisq.core.payment.CryptoCurrencyAccount)1 PerfectMoneyAccount (io.bisq.core.payment.PerfectMoneyAccount)1 BootstrapListener (io.bisq.network.p2p.BootstrapListener)1