Search in sources :

Example 6 with WalletData

use of org.opentransactions.otapi.WalletData in project otapij by FellowTraveler.

the class Helpers method getWalletData.

public static WalletData getWalletData() {
    WalletData walletData = null;
    Storable storable = null;
    if (otapi.Exists("moneychanger", "gui_wallet.dat")) {
        storable = otapi.QueryObject(StoredObjectType.STORED_OBJ_WALLET_DATA, "moneychanger", "gui_wallet.dat");
        if (storable == null) {
            return null;
        }
        walletData = WalletData.ot_dynamic_cast(storable);
    } else {
        storable = otapi.CreateObject(StoredObjectType.STORED_OBJ_WALLET_DATA);
        if (storable == null) {
            return null;
        }
        walletData = WalletData.ot_dynamic_cast(storable);
    }
    return walletData;
}
Also used : WalletData(org.opentransactions.otapi.WalletData) Storable(org.opentransactions.otapi.Storable)

Example 7 with WalletData

use of org.opentransactions.otapi.WalletData in project otapij by FellowTraveler.

the class RippleAccount method loadServerDetails.

public String[] loadServerDetails(String serverID) {
    String[] details = null;
    WalletData walletData = Helpers.getWalletData();
    if (walletData == null) {
        System.out.println("loadServerDetails - walletData returns null");
        return null;
    }
    for (int i = 0; i < walletData.GetRippleServerCount(); i++) {
        RippleServer rippleServer = walletData.GetRippleServer(i);
        if (rippleServer == null) {
            continue;
        }
        System.out.println("serverID:" + serverID + " rippleServer.getServer_id():" + rippleServer.getServer_id());
        if (serverID.equals(rippleServer.getServer_id())) {
            details = new String[5];
            details[0] = rippleServer.getServer_host() == null ? "" : rippleServer.getServer_host();
            details[1] = rippleServer.getNamefield_id() == null || rippleServer.getNamefield_id().trim().length() < 1 ? Configuration.getRippleUsernameID() : rippleServer.getNamefield_id();
            details[2] = rippleServer.getPassfield_id() == null || rippleServer.getPassfield_id().trim().length() < 1 ? Configuration.getRipplePasswordID() : rippleServer.getPassfield_id();
            details[3] = rippleServer.getRipple_username() == null ? "" : rippleServer.getRipple_username();
            details[4] = rippleServer.getRipple_password() == null ? "" : rippleServer.getRipple_password();
            break;
        }
    }
    return details;
}
Also used : RippleServer(org.opentransactions.otapi.RippleServer) WalletData(org.opentransactions.otapi.WalletData)

Aggregations

WalletData (org.opentransactions.otapi.WalletData)7 Storable (org.opentransactions.otapi.Storable)3 RippleServer (org.opentransactions.otapi.RippleServer)2 HashMap (java.util.HashMap)1 BitcoinServer (org.opentransactions.otapi.BitcoinServer)1