Class ContractFunctionParameters

java.lang.Object
com.hedera.hashgraph.sdk.ContractFunctionParameters

public final class ContractFunctionParameters extends Object
Builder for encoding parameters for a Solidity contract constructor/function call.

If you require a type which is not supported here, please let us know on this Github issue.

  • Field Details

    • ADDRESS_LEN

      public static final int ADDRESS_LEN
      The length of a Solidity address in bytes.
      See Also:
    • ADDRESS_LEN_HEX

      public static final int ADDRESS_LEN_HEX
      The length of a hexadecimal-encoded Solidity address, in ASCII characters (bytes).
      See Also:
    • SELECTOR_LEN

      public static final int SELECTOR_LEN
      Function selector length in bytes
      See Also:
    • SELECTOR_LEN_HEX

      public static final int SELECTOR_LEN_HEX
      Function selector length in hex characters
      See Also:
  • Constructor Details

    • ContractFunctionParameters

      public ContractFunctionParameters()
  • Method Details

    • int256

      static com.google.protobuf.ByteString int256(long val, int bitWidth)
    • int256

      static com.google.protobuf.ByteString int256(long val, int bitWidth, boolean signed)
    • getTruncatedBytes

      static byte[] getTruncatedBytes(BigInteger bigInt, int bitWidth)
    • int256

      static com.google.protobuf.ByteString int256(BigInteger bigInt, int bitWidth)
    • uint256

      static com.google.protobuf.ByteString uint256(long val, int bitWidth)
    • uint256

      static com.google.protobuf.ByteString uint256(BigInteger bigInt, int bitWidth)
    • leftPad32

      static com.google.protobuf.ByteString leftPad32(com.google.protobuf.ByteString input)
    • leftPad32

      static com.google.protobuf.ByteString leftPad32(com.google.protobuf.ByteString input, boolean negative)
    • leftPad32

      static com.google.protobuf.ByteString leftPad32(byte[] input, boolean negative)
    • rightPad32

      static com.google.protobuf.ByteString rightPad32(com.google.protobuf.ByteString input)
    • addString

      public ContractFunctionParameters addString(String param)
      Add a parameter of type string.

      For Solidity addresses, use addAddress(String).

      Parameters:
      param - The String to be added
      Returns:
      this
    • addStringArray

      public ContractFunctionParameters addStringArray(String[] strings)
      Add a parameter of type string[].
      Parameters:
      strings - The array of Strings to be added
      Returns:
      this
      Throws:
      NullPointerException - if any value in `strings` is null
    • addBytes

      public ContractFunctionParameters addBytes(byte[] param)
      Add a parameter of type bytes, a byte-string.
      Parameters:
      param - The byte-string to be added
      Returns:
      this
    • addBytesArray

      public ContractFunctionParameters addBytesArray(byte[][] param)
      Add a parameter of type bytes[], an array of byte-strings.
      Parameters:
      param - The array of byte-strings to be added
      Returns:
      this
    • addBytes4

      public ContractFunctionParameters addBytes4(byte[] param)
      Add a parameter of type bytes4, a 4-byte fixed-length byte-string.
      Parameters:
      param - The 4-byte array to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if the length of the byte array is not 4.
    • addBytes4Array

      public ContractFunctionParameters addBytes4Array(byte[][] param)
      Add a parameter of type bytes4[], an array of 4-byte fixed-length byte-strings.
      Parameters:
      param - The array of 4-byte arrays to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if the length of any byte array is not 4.
    • addBytes32

      public ContractFunctionParameters addBytes32(byte[] param)
      Add a parameter of type bytes32, a 32-byte byte-string.

      If applicable, the array will be right-padded with zero bytes to a length of 32 bytes.

      Parameters:
      param - The byte-string to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if the length of the byte array is greater than 32.
    • addBytes32Array

      public ContractFunctionParameters addBytes32Array(byte[][] param)
      Add a parameter of type bytes32[], an array of 32-byte byte-strings.

      Each byte array will be right-padded with zero bytes to a length of 32 bytes.

      Parameters:
      param - The array of byte-strings to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if the length of any byte array is greater than 32.
    • addBool

      public ContractFunctionParameters addBool(boolean bool)
      Add a boolean parameter
      Parameters:
      bool - The bool to be added
      Returns:
      this
    • addBoolArray

      public ContractFunctionParameters addBoolArray(boolean[] param)
      Add a boolean array parameter
      Parameters:
      param - The array of booleans to be added
      Returns:
      this
    • addInt8

      public ContractFunctionParameters addInt8(byte value)
      Add an 8-bit integer.

      The implementation is wasteful as we must pad to 32-bytes to store 1 byte.

      Parameters:
      value - The value to be added
      Returns:
      this
    • addInt16

      public ContractFunctionParameters addInt16(int value)
      Add a 16-bit integer.
      Parameters:
      value - The integer to be added
      Returns:
      this
    • addInt24

      public ContractFunctionParameters addInt24(int value)
      Add a 24-bit integer.
      Parameters:
      value - The integer to be added
      Returns:
      this
    • addInt32

      public ContractFunctionParameters addInt32(int value)
      Add a 32-bit integer.
      Parameters:
      value - The integer to be added
      Returns:
      this
    • addInt40

      public ContractFunctionParameters addInt40(long value)
      Add a 40-bit integer.
      Parameters:
      value - The integer to be added
      Returns:
      this
    • addInt48

      public ContractFunctionParameters addInt48(long value)
      Add a 48-bit integer.
      Parameters:
      value - The integer to be added
      Returns:
      this
    • addInt56

      public ContractFunctionParameters addInt56(long value)
      Add a 56-bit integer.
      Parameters:
      value - The integer to be added
      Returns:
      this
    • addInt64

      public ContractFunctionParameters addInt64(long value)
      Add a 64-bit integer.
      Parameters:
      value - The integer to be added
      Returns:
      this
    • addInt72

      public ContractFunctionParameters addInt72(BigInteger value)
      Add a 72-bit integer.
      Parameters:
      value - The integer to be added
      Returns:
      this
    • addInt80

      public ContractFunctionParameters addInt80(BigInteger value)
      Add a 80-bit integer.
      Parameters:
      value - The integer to be added
      Returns:
      this
    • addInt88

      public ContractFunctionParameters addInt88(BigInteger value)
      Add a 88-bit integer.
      Parameters:
      value - The integer to be added
      Returns:
      this
    • addInt96

      public ContractFunctionParameters addInt96(BigInteger value)
      Add a 96-bit integer.
      Parameters:
      value - The integer to be added
      Returns:
      this
    • addInt104

      public ContractFunctionParameters addInt104(BigInteger value)
      Add a 104-bit integer.
      Parameters:
      value - The integer to be added
      Returns:
      this
    • addInt112

      public ContractFunctionParameters addInt112(BigInteger value)
      Add a 112-bit integer.
      Parameters:
      value - The integer to be added
      Returns:
      this
    • addInt120

      public ContractFunctionParameters addInt120(BigInteger value)
      Add a 120-bit integer.
      Parameters:
      value - The integer to be added
      Returns:
      this
    • addInt128

      public ContractFunctionParameters addInt128(BigInteger value)
      Add a 128-bit integer.
      Parameters:
      value - The integer to be added
      Returns:
      this
    • addInt136

      public ContractFunctionParameters addInt136(BigInteger value)
      Add a 136-bit integer.
      Parameters:
      value - The integer to be added
      Returns:
      this
    • addInt144

      public ContractFunctionParameters addInt144(BigInteger value)
      Add a 144-bit integer.
      Parameters:
      value - The integer to be added
      Returns:
      this
    • addInt152

      public ContractFunctionParameters addInt152(BigInteger value)
      Add a 152-bit integer.
      Parameters:
      value - The integer to be added
      Returns:
      this
    • addInt160

      public ContractFunctionParameters addInt160(BigInteger value)
      Add a 160-bit integer.
      Parameters:
      value - The integer to be added
      Returns:
      this
    • addInt168

      public ContractFunctionParameters addInt168(BigInteger value)
      Add a 168-bit integer.
      Parameters:
      value - The integer to be added
      Returns:
      this
    • addInt176

      public ContractFunctionParameters addInt176(BigInteger value)
      Add a 176-bit integer.
      Parameters:
      value - The integer to be added
      Returns:
      this
    • addInt184

      public ContractFunctionParameters addInt184(BigInteger value)
      Add a 184-bit integer.
      Parameters:
      value - The integer to be added
      Returns:
      this
    • addInt192

      public ContractFunctionParameters addInt192(BigInteger value)
      Add a 192-bit integer.
      Parameters:
      value - The integer to be added
      Returns:
      this
    • addInt200

      public ContractFunctionParameters addInt200(BigInteger value)
      Add a 200-bit integer.
      Parameters:
      value - The integer to be added
      Returns:
      this
    • addInt208

      public ContractFunctionParameters addInt208(BigInteger value)
      Add a 208-bit integer.
      Parameters:
      value - The integer to be added
      Returns:
      this
    • addInt216

      public ContractFunctionParameters addInt216(BigInteger value)
      Add a 216-bit integer.
      Parameters:
      value - The integer to be added
      Returns:
      this
    • addInt224

      public ContractFunctionParameters addInt224(BigInteger value)
      Add a 224-bit integer.
      Parameters:
      value - The integer to be added
      Returns:
      this
    • addInt232

      public ContractFunctionParameters addInt232(BigInteger value)
      Add a 232-bit integer.
      Parameters:
      value - The integer to be added
      Returns:
      this
    • addInt240

      public ContractFunctionParameters addInt240(BigInteger value)
      Add a 240-bit integer.
      Parameters:
      value - The integer to be added
      Returns:
      this
    • addInt248

      public ContractFunctionParameters addInt248(BigInteger value)
      Add a 248-bit integer.
      Parameters:
      value - The integer to be added
      Returns:
      this
    • addInt256

      public ContractFunctionParameters addInt256(BigInteger value)
      Add a 256-bit integer.
      Parameters:
      value - The integer to be added
      Returns:
      this
    • addInt8Array

      public ContractFunctionParameters addInt8Array(byte[] intArray)
      Add a dynamic array of 8-bit integers.

      The implementation is wasteful as we must pad to 32-bytes to store 1 byte.

      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
    • addInt16Array

      public ContractFunctionParameters addInt16Array(int[] intArray)
      Add a dynamic array of 16-bit integers.
      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
    • addInt24Array

      public ContractFunctionParameters addInt24Array(int[] intArray)
      Add a dynamic array of 24-bit integers.
      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
    • addInt32Array

      public ContractFunctionParameters addInt32Array(int[] intArray)
      Add a dynamic array of 32-bit integers.
      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
    • addInt40Array

      public ContractFunctionParameters addInt40Array(long[] intArray)
      Add a dynamic array of 40-bit integers.
      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
    • addInt48Array

      public ContractFunctionParameters addInt48Array(long[] intArray)
      Add a dynamic array of 48-bit integers.
      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
    • addInt56Array

      public ContractFunctionParameters addInt56Array(long[] intArray)
      Add a dynamic array of 56-bit integers.
      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
    • addInt64Array

      public ContractFunctionParameters addInt64Array(long[] intArray)
      Add a dynamic array of 64-bit integers.
      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
    • addInt72Array

      public ContractFunctionParameters addInt72Array(BigInteger[] intArray)
      Add a dynamic array of 72-bit integers.
      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
    • addInt80Array

      public ContractFunctionParameters addInt80Array(BigInteger[] intArray)
      Add a dynamic array of 80-bit integers.
      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
    • addInt88Array

      public ContractFunctionParameters addInt88Array(BigInteger[] intArray)
      Add a dynamic array of 88-bit integers.
      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
    • addInt96Array

      public ContractFunctionParameters addInt96Array(BigInteger[] intArray)
      Add a dynamic array of 96-bit integers.
      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
    • addInt104Array

      public ContractFunctionParameters addInt104Array(BigInteger[] intArray)
      Add a dynamic array of 104-bit integers.
      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
    • addInt112Array

      public ContractFunctionParameters addInt112Array(BigInteger[] intArray)
      Add a dynamic array of 112-bit integers.
      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
    • addInt120Array

      public ContractFunctionParameters addInt120Array(BigInteger[] intArray)
      Add a dynamic array of 120-bit integers.
      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
    • addInt128Array

      public ContractFunctionParameters addInt128Array(BigInteger[] intArray)
      Add a dynamic array of 128-bit integers.
      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
    • addInt136Array

      public ContractFunctionParameters addInt136Array(BigInteger[] intArray)
      Add a dynamic array of 136-bit integers.
      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
    • addInt144Array

      public ContractFunctionParameters addInt144Array(BigInteger[] intArray)
      Add a dynamic array of 144-bit integers.
      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
    • addInt152Array

      public ContractFunctionParameters addInt152Array(BigInteger[] intArray)
      Add a dynamic array of 152-bit integers.
      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
    • addInt160Array

      public ContractFunctionParameters addInt160Array(BigInteger[] intArray)
      Add a dynamic array of 160-bit integers.
      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
    • addInt168Array

      public ContractFunctionParameters addInt168Array(BigInteger[] intArray)
      Add a dynamic array of 168-bit integers.
      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
    • addInt176Array

      public ContractFunctionParameters addInt176Array(BigInteger[] intArray)
      Add a dynamic array of 176-bit integers.
      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
    • addInt184Array

      public ContractFunctionParameters addInt184Array(BigInteger[] intArray)
      Add a dynamic array of 184-bit integers.
      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
    • addInt192Array

      public ContractFunctionParameters addInt192Array(BigInteger[] intArray)
      Add a dynamic array of 192-bit integers.
      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
    • addInt200Array

      public ContractFunctionParameters addInt200Array(BigInteger[] intArray)
      Add a dynamic array of 200-bit integers.
      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
    • addInt208Array

      public ContractFunctionParameters addInt208Array(BigInteger[] intArray)
      Add a dynamic array of 208-bit integers.
      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
    • addInt216Array

      public ContractFunctionParameters addInt216Array(BigInteger[] intArray)
      Add a dynamic array of 216-bit integers.
      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
    • addInt224Array

      public ContractFunctionParameters addInt224Array(BigInteger[] intArray)
      Add a dynamic array of 224-bit integers.
      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
    • addInt232Array

      public ContractFunctionParameters addInt232Array(BigInteger[] intArray)
      Add a dynamic array of 232-bit integers.
      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
    • addInt240Array

      public ContractFunctionParameters addInt240Array(BigInteger[] intArray)
      Add a dynamic array of 240-bit integers.
      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
    • addInt248Array

      public ContractFunctionParameters addInt248Array(BigInteger[] intArray)
      Add a dynamic array of 248-bit integers.
      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
    • addInt256Array

      public ContractFunctionParameters addInt256Array(BigInteger[] intArray)
      Add a dynamic array of 256-bit integers.
      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
    • addUint8

      public ContractFunctionParameters addUint8(byte value)
      Add an unsigned 8-bit integer.

      The implementation is wasteful as we must pad to 32-bytes to store 1 byte.

      Parameters:
      value - The integer to be added
      Returns:
      this
    • addUint16

      public ContractFunctionParameters addUint16(int value)
      Add a 16-bit unsigned integer.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      value - The integer to be added
      Returns:
      this
    • addUint24

      public ContractFunctionParameters addUint24(int value)
      Add a 24-bit unsigned integer.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      value - The integer to be added
      Returns:
      this
    • addUint32

      public ContractFunctionParameters addUint32(int value)
      Add a 32-bit unsigned integer.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      value - The integer to be added
      Returns:
      this
    • addUint40

      public ContractFunctionParameters addUint40(long value)
      Add a 40-bit unsigned integer.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      value - The integer to be added
      Returns:
      this
    • addUint48

      public ContractFunctionParameters addUint48(long value)
      Add a 48-bit unsigned integer.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      value - The integer to be added
      Returns:
      this
    • addUint56

      public ContractFunctionParameters addUint56(long value)
      Add a 56-bit unsigned integer.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      value - The integer to be added
      Returns:
      this
    • addUint64

      public ContractFunctionParameters addUint64(long value)
      Add a 64-bit unsigned integer.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      value - The integer to be added
      Returns:
      this
    • addUint72

      public ContractFunctionParameters addUint72(BigInteger value)
      Add a 72-bit unsigned integer.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      value - The integer to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint80

      public ContractFunctionParameters addUint80(BigInteger value)
      Add a 80-bit unsigned integer.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      value - The integer to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint88

      public ContractFunctionParameters addUint88(BigInteger value)
      Add a 88-bit unsigned integer.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      value - The integer to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint96

      public ContractFunctionParameters addUint96(BigInteger value)
      Add a 96-bit unsigned integer.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      value - The integer to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint104

      public ContractFunctionParameters addUint104(BigInteger value)
      Add a 104-bit unsigned integer.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      value - The integer to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint112

      public ContractFunctionParameters addUint112(BigInteger value)
      Add a 112-bit unsigned integer.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      value - The integer to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint120

      public ContractFunctionParameters addUint120(BigInteger value)
      Add a 120-bit unsigned integer.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      value - The integer to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint128

      public ContractFunctionParameters addUint128(BigInteger value)
      Add a 128-bit unsigned integer.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      value - The integer to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint136

      public ContractFunctionParameters addUint136(BigInteger value)
      Add a 136-bit unsigned integer.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      value - The integer to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint144

      public ContractFunctionParameters addUint144(BigInteger value)
      Add a 144-bit unsigned integer.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      value - The integer to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint152

      public ContractFunctionParameters addUint152(BigInteger value)
      Add a 152-bit unsigned integer.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      value - The integer to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint160

      public ContractFunctionParameters addUint160(BigInteger value)
      Add a 160-bit unsigned integer.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      value - The integer to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint168

      public ContractFunctionParameters addUint168(BigInteger value)
      Add a 168-bit unsigned integer.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      value - The integer to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint176

      public ContractFunctionParameters addUint176(BigInteger value)
      Add a 176-bit unsigned integer.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      value - The integer to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint184

      public ContractFunctionParameters addUint184(BigInteger value)
      Add a 184-bit unsigned integer.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      value - The integer to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint192

      public ContractFunctionParameters addUint192(BigInteger value)
      Add a 192-bit unsigned integer.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      value - The integer to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint200

      public ContractFunctionParameters addUint200(BigInteger value)
      Add a 200-bit unsigned integer.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      value - The integer to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint208

      public ContractFunctionParameters addUint208(BigInteger value)
      Add a 208-bit unsigned integer.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      value - The integer to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint216

      public ContractFunctionParameters addUint216(BigInteger value)
      Add a 216-bit unsigned integer.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      value - The integer to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint224

      public ContractFunctionParameters addUint224(BigInteger value)
      Add a 224-bit unsigned integer.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      value - The integer to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint232

      public ContractFunctionParameters addUint232(BigInteger value)
      Add a 232-bit unsigned integer.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      value - The integer to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint240

      public ContractFunctionParameters addUint240(BigInteger value)
      Add a 240-bit unsigned integer.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      value - The integer to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint248

      public ContractFunctionParameters addUint248(BigInteger value)
      Add a 248-bit unsigned integer.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      value - The integer to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint256

      public ContractFunctionParameters addUint256(BigInteger value)
      Add a 256-bit unsigned integer.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      value - The integer to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint8Array

      public ContractFunctionParameters addUint8Array(byte[] intArray)
      Add a dynamic array of unsigned 8-bit integers.

      The implementation is wasteful as we must pad to 32-bytes to store 1 byte.

      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
    • addUint16Array

      public ContractFunctionParameters addUint16Array(int[] intArray)
      Add a dynamic array of 16-bit unsigned integers.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
    • addUint24Array

      public ContractFunctionParameters addUint24Array(int[] intArray)
      Add a dynamic array of 24-bit unsigned integers.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
    • addUint32Array

      public ContractFunctionParameters addUint32Array(int[] intArray)
      Add a dynamic array of 32-bit unsigned integers.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
    • addUint40Array

      public ContractFunctionParameters addUint40Array(long[] intArray)
      Add a dynamic array of 40-bit unsigned integers.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
    • addUint48Array

      public ContractFunctionParameters addUint48Array(long[] intArray)
      Add a dynamic array of 48-bit unsigned integers.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
    • addUint56Array

      public ContractFunctionParameters addUint56Array(long[] intArray)
      Add a dynamic array of 56-bit unsigned integers.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
    • addUint64Array

      public ContractFunctionParameters addUint64Array(long[] intArray)
      Add a dynamic array of 64-bit unsigned integers.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
    • addUint72Array

      public ContractFunctionParameters addUint72Array(BigInteger[] intArray)
      Add a dynamic array of 72-bit unsigned integers.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint80Array

      public ContractFunctionParameters addUint80Array(BigInteger[] intArray)
      Add a dynamic array of 80-bit unsigned integers.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint88Array

      public ContractFunctionParameters addUint88Array(BigInteger[] intArray)
      Add a dynamic array of 88-bit unsigned integers.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint96Array

      public ContractFunctionParameters addUint96Array(BigInteger[] intArray)
      Add a dynamic array of 96-bit unsigned integers.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint104Array

      public ContractFunctionParameters addUint104Array(BigInteger[] intArray)
      Add a dynamic array of 104-bit unsigned integers.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint112Array

      public ContractFunctionParameters addUint112Array(BigInteger[] intArray)
      Add a dynamic array of 112-bit unsigned integers.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint120Array

      public ContractFunctionParameters addUint120Array(BigInteger[] intArray)
      Add a dynamic array of 120-bit unsigned integers.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint128Array

      public ContractFunctionParameters addUint128Array(BigInteger[] intArray)
      Add a dynamic array of 128-bit unsigned integers.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint136Array

      public ContractFunctionParameters addUint136Array(BigInteger[] intArray)
      Add a dynamic array of 136-bit unsigned integers.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint144Array

      public ContractFunctionParameters addUint144Array(BigInteger[] intArray)
      Add a dynamic array of 144-bit unsigned integers.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint152Array

      public ContractFunctionParameters addUint152Array(BigInteger[] intArray)
      Add a dynamic array of 152-bit unsigned integers.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint160Array

      public ContractFunctionParameters addUint160Array(BigInteger[] intArray)
      Add a dynamic array of 160-bit unsigned integers.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint168Array

      public ContractFunctionParameters addUint168Array(BigInteger[] intArray)
      Add a dynamic array of 168-bit unsigned integers.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint176Array

      public ContractFunctionParameters addUint176Array(BigInteger[] intArray)
      Add a dynamic array of 176-bit unsigned integers.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint184Array

      public ContractFunctionParameters addUint184Array(BigInteger[] intArray)
      Add a dynamic array of 184-bit unsigned integers.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint192Array

      public ContractFunctionParameters addUint192Array(BigInteger[] intArray)
      Add a dynamic array of 192-bit unsigned integers.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint200Array

      public ContractFunctionParameters addUint200Array(BigInteger[] intArray)
      Add a dynamic array of 200-bit unsigned integers.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint208Array

      public ContractFunctionParameters addUint208Array(BigInteger[] intArray)
      Add a dynamic array of 208-bit unsigned integers.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint216Array

      public ContractFunctionParameters addUint216Array(BigInteger[] intArray)
      Add a dynamic array of 216-bit unsigned integers.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint224Array

      public ContractFunctionParameters addUint224Array(BigInteger[] intArray)
      Add a dynamic array of 224-bit unsigned integers.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint232Array

      public ContractFunctionParameters addUint232Array(BigInteger[] intArray)
      Add a dynamic array of 232-bit unsigned integers.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint240Array

      public ContractFunctionParameters addUint240Array(BigInteger[] intArray)
      Add a dynamic array of 240-bit unsigned integers.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint248Array

      public ContractFunctionParameters addUint248Array(BigInteger[] intArray)
      Add a dynamic array of 248-bit unsigned integers.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addUint256Array

      public ContractFunctionParameters addUint256Array(BigInteger[] intArray)
      Add a dynamic array of 256-bit unsigned integers.

      The value will be treated as unsigned during encoding (it will be zero-padded instead of sign-extended to 32 bytes).

      Parameters:
      intArray - The array of integers to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if bigInt.signum() < 0.
    • addAddress

      public ContractFunctionParameters addAddress(String address)
      Add a 40-character hex-encoded Solidity address parameter with the type address.

      Note: adding a address payable or contract parameter must also use this function as the ABI does not support those types directly.

      Parameters:
      address - The address to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if the address is not exactly 40 characters long or fails to decode as hexadecimal.
    • addAddressArray

      public ContractFunctionParameters addAddressArray(String[] addresses)
      Add an array of 40-character hex-encoded Solidity addresses as a address[] param.
      Parameters:
      addresses - The array of addresses to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if any value is not exactly 40 characters long or fails to decode as hexadecimal.
      NullPointerException - if any value in the array is null.
    • addFunction

      public ContractFunctionParameters addFunction(String address, byte[] selector)
      Add a Solidity function reference as a 20-byte contract address and a 4-byte function selector.
      Parameters:
      address - a hex-encoded 40-character Solidity address.
      selector - a
      Returns:
      this
      Throws:
      IllegalArgumentException - if address is not 40 characters or selector is not 4 bytes.
    • addFunction

      public ContractFunctionParameters addFunction(String address, ContractFunctionSelector selector)
      Add a Solidity function reference as a 20-byte contract address and a constructed ContractFunctionSelector. The ContractFunctionSelector may not be modified after this call.
      Parameters:
      address - The address used in the function to be added
      selector - The selector used in the function to be added
      Returns:
      this
      Throws:
      IllegalArgumentException - if address is not 40 characters.
    • toBytes

      public com.google.protobuf.ByteString toBytes(@Nullable String funcName)
      Get the encoding of the currently added parameters as a ByteString.

      You may continue to add parameters and call this again.

      Returns:
      the Solidity encoding of the call parameters in the order they were added.