@Test public void fromURI() { URI uri = NeoURI.fromURI(BEGIN_TX_ASSET_AMOUNT).buildURI().getURI(); assertThat(uri, is(URI.create(BEGIN_TX_ASSET_AMOUNT))); }
public static NeoURI fromURI(String uriString) throws IllegalFormatException { if (uriString == null) { throw new IllegalArgumentException("The provided String is null."); } String[] baseAndQuery = uriString.split("\\?"); String[] beginTx = baseAndQuery[0].split(":"); if (!beginTx[0].equals(NEO_SCHEME) || beginTx.length != 2 || uriString.length() < MIN_NEP9_URI_LENGTH) { throw new IllegalArgumentException("The provided string does not conform to the NEP-9 standard."); } NeoURI neoURI = new NeoURI(); neoURI.toAddress(beginTx[1]); if (baseAndQuery.length == 2) { String[] query = baseAndQuery[1].split("&"); for (String singleQuery : query) { String[] singleQueryParts = singleQuery.split("=", 2); if (singleQueryParts.length != 2) throw new IllegalArgumentException("This uri contains invalid queries."); if (singleQueryParts[0].equals("asset") && neoURI.asset == null) { String assetID = singleQueryParts[1]; if (assetID.equals(NeoToken.SYMBOL)) { neoURI.asset = NeoToken.SCRIPT_HASH; } else if (assetID.equals(GasToken.SYMBOL)) { neoURI.asset = GasToken.SCRIPT_HASH; } else { neoURI.asset = new ScriptHash(assetID); } } else if (singleQueryParts[0].equals("amount") && neoURI.amount == null) { neoURI.amount = new BigDecimal(singleQueryParts[1]); } } } return neoURI; }
NeoURI { public static NeoURI fromURI(String uriString) throws IllegalFormatException { if (uriString == null) { throw new IllegalArgumentException("The provided String is null."); } String[] baseAndQuery = uriString.split("\\?"); String[] beginTx = baseAndQuery[0].split(":"); if (!beginTx[0].equals(NEO_SCHEME) || beginTx.length != 2 || uriString.length() < MIN_NEP9_URI_LENGTH) { throw new IllegalArgumentException("The provided string does not conform to the NEP-9 standard."); } NeoURI neoURI = new NeoURI(); neoURI.toAddress(beginTx[1]); if (baseAndQuery.length == 2) { String[] query = baseAndQuery[1].split("&"); for (String singleQuery : query) { String[] singleQueryParts = singleQuery.split("=", 2); if (singleQueryParts.length != 2) throw new IllegalArgumentException("This uri contains invalid queries."); if (singleQueryParts[0].equals("asset") && neoURI.asset == null) { String assetID = singleQueryParts[1]; if (assetID.equals(NeoToken.SYMBOL)) { neoURI.asset = NeoToken.SCRIPT_HASH; } else if (assetID.equals(GasToken.SYMBOL)) { neoURI.asset = GasToken.SCRIPT_HASH; } else { neoURI.asset = new ScriptHash(assetID); } } else if (singleQueryParts[0].equals("amount") && neoURI.amount == null) { neoURI.amount = new BigDecimal(singleQueryParts[1]); } } } return neoURI; } }
NeoURI { public static NeoURI fromURI(String uriString) throws IllegalFormatException { if (uriString == null) { throw new IllegalArgumentException("The provided String is null."); } String[] baseAndQuery = uriString.split("\\?"); String[] beginTx = baseAndQuery[0].split(":"); if (!beginTx[0].equals(NEO_SCHEME) || beginTx.length != 2 || uriString.length() < MIN_NEP9_URI_LENGTH) { throw new IllegalArgumentException("The provided string does not conform to the NEP-9 standard."); } NeoURI neoURI = new NeoURI(); neoURI.toAddress(beginTx[1]); if (baseAndQuery.length == 2) { String[] query = baseAndQuery[1].split("&"); for (String singleQuery : query) { String[] singleQueryParts = singleQuery.split("=", 2); if (singleQueryParts.length != 2) throw new IllegalArgumentException("This uri contains invalid queries."); if (singleQueryParts[0].equals("asset") && neoURI.asset == null) { String assetID = singleQueryParts[1]; if (assetID.equals(NeoToken.SYMBOL)) { neoURI.asset = NeoToken.SCRIPT_HASH; } else if (assetID.equals(GasToken.SYMBOL)) { neoURI.asset = GasToken.SCRIPT_HASH; } else { neoURI.asset = new ScriptHash(assetID); } } else if (singleQueryParts[0].equals("amount") && neoURI.amount == null) { neoURI.amount = new BigDecimal(singleQueryParts[1]); } } } return neoURI; } NeoURI();  NeoURI(Neow3j neow3j); }
NeoURI { public static NeoURI fromURI(String uriString) throws IllegalFormatException { if (uriString == null) { throw new IllegalArgumentException("The provided String is null."); } String[] baseAndQuery = uriString.split("\\?"); String[] beginTx = baseAndQuery[0].split(":"); if (!beginTx[0].equals(NEO_SCHEME) || beginTx.length != 2 || uriString.length() < MIN_NEP9_URI_LENGTH) { throw new IllegalArgumentException("The provided string does not conform to the NEP-9 standard."); } NeoURI neoURI = new NeoURI(); neoURI.toAddress(beginTx[1]); if (baseAndQuery.length == 2) { String[] query = baseAndQuery[1].split("&"); for (String singleQuery : query) { String[] singleQueryParts = singleQuery.split("=", 2); if (singleQueryParts.length != 2) throw new IllegalArgumentException("This uri contains invalid queries."); if (singleQueryParts[0].equals("asset") && neoURI.asset == null) { String assetID = singleQueryParts[1]; if (assetID.equals(NeoToken.SYMBOL)) { neoURI.asset = NeoToken.SCRIPT_HASH; } else if (assetID.equals(GasToken.SYMBOL)) { neoURI.asset = GasToken.SCRIPT_HASH; } else { neoURI.asset = new ScriptHash(assetID); } } else if (singleQueryParts[0].equals("amount") && neoURI.amount == null) { neoURI.amount = new BigDecimal(singleQueryParts[1]); } } } return neoURI; } NeoURI();  NeoURI(Neow3j neow3j); static NeoURI fromURI(String uriString); TransactionBuilder buildTransfer(); NeoURI toAddress(String address); NeoURI toAddress(ScriptHash address); NeoURI asset(byte[] asset); NeoURI asset(ScriptHash asset); NeoURI asset(String asset); NeoURI amount(String amount); NeoURI amount(Integer amount); NeoURI amount(BigInteger amount); NeoURI amount(BigDecimal amount); NeoURI neow3j(Neow3j neow3j); NeoURI wallet(Wallet wallet); NeoURI buildURI(); URI getURI(); String getURIAsString(); String getToAddress(); ScriptHash getAddressAsScriptHash(); ScriptHash getAsset(); String getAssetAsString(); String getAssetAsAddress(); BigDecimal getAmount(); String getAmountAsString(); }
NeoURI { public static NeoURI fromURI(String uriString) throws IllegalFormatException { if (uriString == null) { throw new IllegalArgumentException("The provided String is null."); } String[] baseAndQuery = uriString.split("\\?"); String[] beginTx = baseAndQuery[0].split(":"); if (!beginTx[0].equals(NEO_SCHEME) || beginTx.length != 2 || uriString.length() < MIN_NEP9_URI_LENGTH) { throw new IllegalArgumentException("The provided string does not conform to the NEP-9 standard."); } NeoURI neoURI = new NeoURI(); neoURI.toAddress(beginTx[1]); if (baseAndQuery.length == 2) { String[] query = baseAndQuery[1].split("&"); for (String singleQuery : query) { String[] singleQueryParts = singleQuery.split("=", 2); if (singleQueryParts.length != 2) throw new IllegalArgumentException("This uri contains invalid queries."); if (singleQueryParts[0].equals("asset") && neoURI.asset == null) { String assetID = singleQueryParts[1]; if (assetID.equals(NeoToken.SYMBOL)) { neoURI.asset = NeoToken.SCRIPT_HASH; } else if (assetID.equals(GasToken.SYMBOL)) { neoURI.asset = GasToken.SCRIPT_HASH; } else { neoURI.asset = new ScriptHash(assetID); } } else if (singleQueryParts[0].equals("amount") && neoURI.amount == null) { neoURI.amount = new BigDecimal(singleQueryParts[1]); } } } return neoURI; } NeoURI();  NeoURI(Neow3j neow3j); static NeoURI fromURI(String uriString); TransactionBuilder buildTransfer(); NeoURI toAddress(String address); NeoURI toAddress(ScriptHash address); NeoURI asset(byte[] asset); NeoURI asset(ScriptHash asset); NeoURI asset(String asset); NeoURI amount(String amount); NeoURI amount(Integer amount); NeoURI amount(BigInteger amount); NeoURI amount(BigDecimal amount); NeoURI neow3j(Neow3j neow3j); NeoURI wallet(Wallet wallet); NeoURI buildURI(); URI getURI(); String getURIAsString(); String getToAddress(); ScriptHash getAddressAsScriptHash(); ScriptHash getAsset(); String getAssetAsString(); String getAssetAsAddress(); BigDecimal getAmount(); String getAmountAsString();  }