public static AccountID fromString(String value) { if (value.length() == 160 / 4) { return fromAddressBytes(B16.decode(value)); } else { if (value.startsWith("r") && value.length() >= 26) { return fromAddress(value); } AccountID accountID = accountForAlias(value); if (accountID == null) { throw new UnknownAlias("Alias unset: " + value); } return accountID; } }
public boolean isNativeIssuer() { return equals(XRP_ISSUER); }
@Override public String toString() { return id.toString(); } }
public static AccountID fromBytes(byte[] bytes) { return new AccountID(bytes, encodeAddress(bytes)); }
@Override public Hash160 fromString(String value) { if (value.startsWith("r")) { return newInstance(AccountID.fromAddress(value).bytes()); } return super.fromString(value); } }
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 void analyzeDump() throws IOException, JSONException { BufferedReader bufferedReader = openDumpReader(); AccountID giveAwayAccount = AccountID.fromAddress("rMTzGg7nPPEMJthjgEBfiPZGoAM7MEVa1r"); tr.initiatingAccount().equals(giveAwayAccount)) { Amount amount = tr.txn.get(Amount.Amount);
@Override public AccountID fromString(String value) { return AccountID.fromString(value); } }
static public AccountID fromSeedBytes(byte[] seed) { return fromKeyPair(Seed.getKeyPair(seed)); }
static public AccountID fromAddress(String address) { byte[] bytes = getB58IdentiferCodecs().decodeAddress(address); return new AccountID(bytes, address); }
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; }
private Amount(BigDecimal value, String currency, String issuer) { this(value, currency); if (issuer != null) { this.issuer = AccountID.fromString(issuer); } }
static public AccountID fromSeedString(String seed) { return fromKeyPair(Seed.getKeyPair(seed)); }
public static AccountID fromKeyPair(IKeyPair kp) { byte[] bytes = kp.pub160Hash(); return new AccountID(bytes, encodeAddress(bytes)); }
/** * See {@link com.ripple.core.fields.Field#TakerGetsCurrency} * See {@link com.ripple.core.fields.Field#TakerGetsIssuer} * * TODO: better handling of Taker(Gets|Pays)(Issuer|Curency) * maybe special subclasses of AccountID / Currency * respectively? */ public static Issue from160s(Hash160 currency, Hash160 issuer) { return new Issue(new Currency(currency.bytes()), new AccountID(issuer.toBytes())); }
@Override protected void onNewIntent(Intent intent) { log(Level.INFO, intent.getAction()); super.onNewIntent(intent); Uri data = intent.getData(); if (data != null) { if (data.getPath().matches("^/+contact.*")) { String to = data.getQueryParameter("to"); AccountID contact = AccountID.fromAddress(to); // We haven't bootstrapped yet if (contactsAdapter.isEmpty()) { if (!contactsAddresses.contains(contact)) { contactsAddresses.add(contact); } } // We've already bootstrapped contacts from the blobvault else { int position; position = contactsAddresses.indexOf(contact); if (position == -1) { unshiftContact(to.substring(0, 16) + "...", to); contacts.setSelection(0, true); } else { contacts.setSelection(position, true); } } } } }
public String issuerString() { if (issuer == null) { return ""; } return issuer.toString(); }
/** * Thread: ui thread */ private void pushContact(String niq, String address) { // parallel arrays for key/value contactsAdapter.add(niq); contactsAddresses.add(AccountID.fromString(address)); }
public static AccountID fromPassPhrase(String phrase) { return fromKeyPair(Seed.fromPassPhrase(phrase).keyPair()); }