public static Amount FromParser(BinaryParser parser, int?hint = null) { var value = AmountValue.FromParser(parser); if (!value.IsIou) { return(new Amount(value)); } var curr = Currency.FromParser(parser); var issuer = AccountId.FromParser(parser); return(new Amount(value, curr, issuer)); }
public static PathSet FromParser(BinaryParser parser, int?hint = null) { var pathSet = new PathSet(); Path path = null; while (!parser.End()) { byte type = parser.ReadOne(); if (type == PathsetEndByte) { break; } if (path == null) { path = new Path(); pathSet.Add(path); } if (type == PathSeparatorByte) { path = null; continue; } AccountId account = null; AccountId issuer = null; Currency currency = null; if ((type & PathHop.TypeAccount) != 0) { account = AccountId.FromParser(parser); } if ((type & PathHop.TypeCurrency) != 0) { currency = Currency.FromParser(parser); } if ((type & PathHop.TypeIssuer) != 0) { issuer = AccountId.FromParser(parser); } var hop = new PathHop(account, issuer, currency); path.Add(hop); } return(pathSet); }
public AccountId ReadAccountId() { return(AccountId.FromParser(_parser)); }