Java Code Examples for org.web3j.crypto.TransactionEncoder#asRlpValues()

The following examples show how to use org.web3j.crypto.TransactionEncoder#asRlpValues() . 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: PrivateTransactionEncoder.java    From web3j with Apache License 2.0 6 votes vote down vote up
public static List<RlpType> asRlpValues(
        final RawPrivateTransaction privateTransaction,
        final Sign.SignatureData signatureData) {

    final List<RlpType> result =
            new ArrayList<>(
                    TransactionEncoder.asRlpValues(
                            privateTransaction.asRawTransaction(), signatureData));

    result.add(privateTransaction.getPrivateFrom().asRlp());

    privateTransaction
            .getPrivateFor()
            .ifPresent(privateFor -> result.add(Base64String.unwrapListToRlp(privateFor)));

    privateTransaction.getPrivacyGroupId().map(Base64String::asRlp).ifPresent(result::add);

    result.add(RlpString.create(privateTransaction.getRestriction().getRestriction()));

    return result;
}
 
Example 2
Source File: EthTransaction.java    From ethsigner with Apache License 2.0 5 votes vote down vote up
@Override
public byte[] rlpEncode(final SignatureData signatureData) {
  final RawTransaction rawTransaction = createTransaction();
  final List<RlpType> values = TransactionEncoder.asRlpValues(rawTransaction, signatureData);
  final RlpList rlpList = new RlpList(values);
  return RlpEncoder.encode(rlpList);
}
 
Example 3
Source File: TransactionRepository.java    From alpha-wallet-android with MIT License 2 votes vote down vote up
/**
 * From Web3j to encode a constructor
 * @param rawTransaction
 * @param signatureData
 * @return
 */
private static byte[] encode(RawTransaction rawTransaction, Sign.SignatureData signatureData) {
	List<RlpType> values = TransactionEncoder.asRlpValues(rawTransaction, signatureData);
	RlpList rlpList = new RlpList(values);
	return RlpEncoder.encode(rlpList);
}