public Amount(BigDecimal value, String currency) { isNative = false; this.currency = Currency.fromString(currency); this.setAndCheckValue(value); }
public Issue issue(String code) { return new Issue(Currency.fromString(code), this); }
static public Hop fromJSONObject(JSONObject json) { Hop hop = new Hop(); if (json.has("account")) { hop.account = AccountID.fromAddress(json.getString("account")); } if (json.has("issuer")) { hop.issuer = AccountID.fromAddress(json.getString("issuer")); } if (json.has("currency")) { hop.currency = Currency.fromString(json.getString("currency")); } if (json.has("type")) { hop.type = json.getInt("type"); } return hop; }
private static Issue fromStringPair(String[] split) { if (split.length == 2) { return new Issue(Currency.fromString(split[0]), AccountID.fromString(split[1])); } else if (split[0].equals("XRP")) { return new Issue(Currency.XRP, AccountID.XRP_ISSUER); } else { throw new RuntimeException("Issue string must be XRP or $currency/$issuer"); } }
public static AccountLine fromJSON(AccountID orientedTo, JSONObject line) { AccountLine l = new AccountLine(); AccountID peer = AccountID.fromAddress(line.getString("account")); BigDecimal balance = new BigDecimal(line.getString("balance")); BigDecimal limit = new BigDecimal(line.getString("limit")); BigDecimal limit_peer = new BigDecimal(line.getString("limit_peer")); l.currency = Currency.fromString(line.getString("currency")); l.balance = new Amount(balance, l.currency, peer); l.limit = new Amount(limit, l.currency, peer); l.limit_peer = new Amount(limit_peer, l.currency, orientedTo); l.freeze = line.optBoolean("freeze", false); l.freeze_peer = line.optBoolean("freeze_peer", false); l.authorized = line.optBoolean("authorized", false); l.authorized_peer = line.optBoolean("authorized_peer", false); l.no_ripple = line.optBoolean("no_ripple", false); l.no_ripple_peer = line.optBoolean("no_ripple_peer", false); l.quality_in = line.optInt("quality_in", 0); l.quality_out = line.optInt("quality_out", 0); return l; }
/** * Thread: UI thread */ public void setSelectedCurrency() { String selectedCurrency = (String) currencySpinner.getSelectedItem(); destinationCurrency = Currency.fromString(selectedCurrency); normalizeDestinationAmount(); if (flow != null) { client.run(setFlowCurrency); } }
BigDecimal slippageFactor = new BigDecimal("1.001"); BigDecimal amount = new BigDecimal("0.0000001"); Currency USD = Currency.fromString("USD");