Java Code Examples for org.fisco.bcos.web3j.utils.Numeric#prependHexPrefix()
The following examples show how to use
org.fisco.bcos.web3j.utils.Numeric#prependHexPrefix() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Transaction.java From web3sdk with Apache License 2.0 | 6 votes |
public Transaction( String from, BigInteger nonce, BigInteger gasPrice, BigInteger gasLimit, String to, BigInteger value, String data) { this.from = from; this.to = to; this.gas = gasLimit; this.gasPrice = gasPrice; this.value = value; if (data != null) { if (this.to != null && !this.to.equals("")) { this.data = Numeric.prependHexPrefix(data); } else { this.data = data; } } this.nonce = nonce; }
Example 2
Source File: TopicTools.java From web3sdk with Apache License 2.0 | 5 votes |
public static String byteNToTopic(byte[] b) { // byte[] can't be more than 32 byte if (b.length > 32) { throw new IllegalArgumentException("byteN can't be more than 32 byte"); } Bytes bs = new Bytes(b.length, b); return Numeric.prependHexPrefix(TypeEncoder.encode(bs)); }
Example 3
Source File: Credentials.java From web3sdk with Apache License 2.0 | 4 votes |
public static Credentials create(ECKeyPair ecKeyPair) { String address = Numeric.prependHexPrefix(Keys.getAddress(ecKeyPair)); return new Credentials(ecKeyPair, address); }