org.web3j.abi.datatypes.generated.Uint256 Java Examples

The following examples show how to use org.web3j.abi.datatypes.generated.Uint256. 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: Arrays.java    From web3j with Apache License 2.0 6 votes vote down vote up
public RemoteFunctionCall<List> dynamicReverse(List<BigInteger> input) {
    final Function function = new Function(FUNC_DYNAMICREVERSE, 
            java.util.Arrays.<Type>asList(new org.web3j.abi.datatypes.DynamicArray<org.web3j.abi.datatypes.generated.Uint256>(
                    org.web3j.abi.datatypes.generated.Uint256.class,
                    org.web3j.abi.Utils.typeMap(input, org.web3j.abi.datatypes.generated.Uint256.class))), 
            java.util.Arrays.<TypeReference<?>>asList(new TypeReference<DynamicArray<Uint256>>() {}));
    return new RemoteFunctionCall<List>(function,
            new Callable<List>() {
                @Override
                @SuppressWarnings("unchecked")
                public List call() throws Exception {
                    List<Type> result = (List<Type>) executeCallSingleValueReturn(function, List.class);
                    return convertToNative(result);
                }
            });
}
 
Example #2
Source File: TypeDecoderTest.java    From web3j with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
@Test
public void multiDimArrays() throws Exception {
    byte[] bytes1d = new byte[] {1, 2, 3};
    byte[][] bytes2d = new byte[][] {bytes1d, bytes1d, bytes1d};
    final byte[][][] bytes3d = new byte[][][] {bytes2d, bytes2d, bytes2d};

    assertEquals(TypeDecoder.instantiateType("bytes", bytes1d), (new DynamicBytes(bytes1d)));

    Type twoDim = TypeDecoder.instantiateType("uint256[][3]", bytes2d);
    assertTrue(twoDim instanceof StaticArray3);
    StaticArray3<DynamicArray<Uint256>> staticArray3 =
            (StaticArray3<DynamicArray<Uint256>>) twoDim;
    assertEquals(staticArray3.getComponentType(), DynamicArray.class);
    DynamicArray<Uint256> row1 = staticArray3.getValue().get(1);
    assertEquals(row1.getValue().get(2), new Uint256(3));

    Type threeDim = TypeDecoder.instantiateType("uint256[][3][3]", bytes3d);
    assertTrue(threeDim instanceof StaticArray3);
    StaticArray3<StaticArray3<DynamicArray<Uint256>>> staticArray3StaticArray3 =
            (StaticArray3<StaticArray3<DynamicArray<Uint256>>>) threeDim;
    assertEquals(staticArray3StaticArray3.getComponentType(), StaticArray3.class);
    row1 = staticArray3StaticArray3.getValue().get(1).getValue().get(1);
    assertEquals(row1.getValue().get(1), (new Uint256(2)));
}
 
Example #3
Source File: Arrays.java    From web3j with Apache License 2.0 6 votes vote down vote up
public RemoteFunctionCall<List> multiDynamic(List<List<BigInteger>> input) {
    final Function function = new Function(FUNC_MULTIDYNAMIC, 
            java.util.Arrays.<Type>asList(new org.web3j.abi.datatypes.DynamicArray<org.web3j.abi.datatypes.generated.StaticArray2>(
                    org.web3j.abi.datatypes.generated.StaticArray2.class,
                    org.web3j.abi.Utils.typeMap(input, org.web3j.abi.datatypes.generated.StaticArray2.class,
            org.web3j.abi.datatypes.generated.Uint256.class))), 
            java.util.Arrays.<TypeReference<?>>asList(new TypeReference<DynamicArray<Uint256>>() {}));
    return new RemoteFunctionCall<List>(function,
            new Callable<List>() {
                @Override
                @SuppressWarnings("unchecked")
                public List call() throws Exception {
                    List<Type> result = (List<Type>) executeCallSingleValueReturn(function, List.class);
                    return convertToNative(result);
                }
            });
}
 
Example #4
Source File: TokenERC20.java    From Android-Wallet-Token-ERC20 with Apache License 2.0 6 votes vote down vote up
public Observable<TransferEventResponse> transferEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    final Event event = new Event("Transfer", 
            Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}, new TypeReference<Address>() {}),
            Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
    EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(event));
    return web3j.ethLogObservable(filter).map(new Func1<Log, TransferEventResponse>() {
        @Override
        public TransferEventResponse call(Log log) {
            EventValues eventValues = extractEventParameters(event, log);
            TransferEventResponse typedResponse = new TransferEventResponse();
            typedResponse.from = (String) eventValues.getIndexedValues().get(0).getValue();
            typedResponse.to = (String) eventValues.getIndexedValues().get(1).getValue();
            typedResponse.value = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue();
            return typedResponse;
        }
    });
}
 
Example #5
Source File: FunctionWrappersIT.java    From etherscan-explorer with GNU General Public License v3.0 6 votes vote down vote up
@Test
public void testFibonacciNotify() throws Exception {
    Fibonacci fibonacci = Fibonacci.load(
            "0x3c05b2564139fb55820b18b72e94b2178eaace7d", Web3j.build(new HttpService()),
            ALICE, GAS_PRICE, GAS_LIMIT);

    TransactionReceipt transactionReceipt = fibonacci.fibonacciNotify(
            BigInteger.valueOf(15)).send();

    Fibonacci.NotifyEventResponse result = fibonacci.getNotifyEvents(transactionReceipt).get(0);

    assertThat(result.input,
            equalTo(new Uint256(BigInteger.valueOf(15))));

    assertThat(result.result,
            equalTo(new Uint256(BigInteger.valueOf(610))));
}
 
Example #6
Source File: FunctionReturnDecoderTest.java    From web3j with Apache License 2.0 6 votes vote down vote up
@Test
@SuppressWarnings("unchecked")
public void testDecodeStaticArrayValue() {
    List<TypeReference<Type>> outputParameters = new ArrayList<>(1);
    outputParameters.add(
            (TypeReference)
                    new TypeReference.StaticArrayTypeReference<StaticArray<Uint256>>(2) {});
    outputParameters.add((TypeReference) new TypeReference<Uint256>() {});

    List<Type> decoded =
            FunctionReturnDecoder.decode(
                    "0x0000000000000000000000000000000000000000000000000000000000000037"
                            + "0000000000000000000000000000000000000000000000000000000000000001"
                            + "000000000000000000000000000000000000000000000000000000000000000a",
                    outputParameters);

    StaticArray2<Uint256> uint256StaticArray2 =
            new StaticArray2<>(
                    new Uint256(BigInteger.valueOf(55)), new Uint256(BigInteger.ONE));

    List<Type> expected = Arrays.asList(uint256StaticArray2, new Uint256(BigInteger.TEN));
    assertEquals(decoded, (expected));
}
 
Example #7
Source File: PublicResolver.java    From etherscan-explorer with GNU General Public License v3.0 6 votes vote down vote up
public Observable<ABIChangedEventResponse> aBIChangedEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    final Event event = new Event("ABIChanged", 
            Arrays.<TypeReference<?>>asList(new TypeReference<Bytes32>() {}, new TypeReference<Uint256>() {}),
            Arrays.<TypeReference<?>>asList());
    EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(event));
    return web3j.ethLogObservable(filter).map(new Func1<Log, ABIChangedEventResponse>() {
        @Override
        public ABIChangedEventResponse call(Log log) {
            EventValues eventValues = extractEventParameters(event, log);
            ABIChangedEventResponse typedResponse = new ABIChangedEventResponse();
            typedResponse.node = (byte[]) eventValues.getIndexedValues().get(0).getValue();
            typedResponse.contentType = (BigInteger) eventValues.getIndexedValues().get(1).getValue();
            return typedResponse;
        }
    });
}
 
Example #8
Source File: PublicResolver.java    From etherscan-explorer with GNU General Public License v3.0 6 votes vote down vote up
public RemoteCall<Tuple2<BigInteger, byte[]>> ABI(byte[] node, BigInteger contentTypes) {
    final Function function = new Function("ABI",
            Arrays.<Type>asList(new org.web3j.abi.datatypes.generated.Bytes32(node),
            new org.web3j.abi.datatypes.generated.Uint256(contentTypes)),
            Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}, new TypeReference<DynamicBytes>() {}));
    return new RemoteCall<Tuple2<BigInteger, byte[]>>(
            new Callable<Tuple2<BigInteger, byte[]>>() {
                @Override
                public Tuple2<BigInteger, byte[]> call() throws Exception {
                    List<Type> results = executeCallMultipleValueReturn(function);;
                    return new Tuple2<BigInteger, byte[]>(
                            (BigInteger) results.get(0).getValue(),
                            (byte[]) results.get(1).getValue());
                }
            });
}
 
Example #9
Source File: Arrays.java    From web3j with Apache License 2.0 6 votes vote down vote up
public RemoteFunctionCall<List> multiFixed(List<List<BigInteger>> input) {
    final Function function = new Function(FUNC_MULTIFIXED, 
            java.util.Arrays.<Type>asList(new org.web3j.abi.datatypes.generated.StaticArray6<org.web3j.abi.datatypes.generated.StaticArray2>(
                    org.web3j.abi.datatypes.generated.StaticArray2.class,
                    org.web3j.abi.Utils.typeMap(input, org.web3j.abi.datatypes.generated.StaticArray2.class,
            org.web3j.abi.datatypes.generated.Uint256.class))), 
            java.util.Arrays.<TypeReference<?>>asList(new TypeReference<DynamicArray<Uint256>>() {}));
    return new RemoteFunctionCall<List>(function,
            new Callable<List>() {
                @Override
                @SuppressWarnings("unchecked")
                public List call() throws Exception {
                    List<Type> result = (List<Type>) executeCallSingleValueReturn(function, List.class);
                    return convertToNative(result);
                }
            });
}
 
Example #10
Source File: ContractTest.java    From web3j with Apache License 2.0 6 votes vote down vote up
@Test
public void testProcessEvent() {
    TransactionReceipt transactionReceipt = new TransactionReceipt();
    Log log = new Log();
    log.setTopics(
            Arrays.asList(
                    // encoded function
                    "0xfceb437c298f40d64702ac26411b2316e79f3c28ffa60edfc891ad4fc8ab82ca",
                    // indexed value
                    "0000000000000000000000003d6cb163f7c72d20b0fcd6baae5889329d138a4a"));
    // non-indexed value
    log.setData("0000000000000000000000000000000000000000000000000000000000000001");

    transactionReceipt.setLogs(singletonList(log));

    EventValues eventValues = contract.processEvent(transactionReceipt).get(0);

    assertEquals(
            singletonList(new Address("0x3d6cb163f7c72d20b0fcd6baae5889329d138a4a")),
            eventValues.getIndexedValues());
    assertEquals(singletonList(new Uint256(BigInteger.ONE)), eventValues.getNonIndexedValues());
}
 
Example #11
Source File: ContractTest.java    From web3j with Apache License 2.0 5 votes vote down vote up
@Test
public void testTransaction() throws Exception {
    TransactionReceipt transactionReceipt = new TransactionReceipt();
    transactionReceipt.setTransactionHash(TRANSACTION_HASH);
    transactionReceipt.setStatus(TXN_SUCCESS_STATUS);

    prepareTransaction(transactionReceipt);

    assertEquals(
            transactionReceipt,
            contract.performTransaction(
                            new Address(BigInteger.TEN), new Uint256(BigInteger.ONE))
                    .send());
}
 
Example #12
Source File: HumanStandardToken.java    From etherscan-explorer with GNU General Public License v3.0 5 votes vote down vote up
public RemoteCall<BigInteger> allowance(String _owner, String _spender) {
    final Function function = new Function("allowance", 
            Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(_owner), 
            new org.web3j.abi.datatypes.Address(_spender)), 
            Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
    return executeRemoteCallSingleValueReturn(function, BigInteger.class);
}
 
Example #13
Source File: ERC20.java    From web3j with Apache License 2.0 5 votes vote down vote up
public RemoteCall<TransactionReceipt> approve(String _spender, BigInteger _value) {
    final Function function = new Function(
            FUNC_APPROVE, 
            Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(_spender), 
            new org.web3j.abi.datatypes.generated.Uint256(_value)), 
            Collections.<TypeReference<?>>emptyList());
    return executeRemoteCallTransaction(function);
}
 
Example #14
Source File: BlindAuction.java    From web3j with Apache License 2.0 5 votes vote down vote up
@Deprecated
public static RemoteCall<BlindAuction> deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit, BigInteger _biddingTime, BigInteger _revealTime, String _beneficiary) {
    String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.<Type>asList(new org.web3j.abi.datatypes.generated.Uint256(_biddingTime),
            new org.web3j.abi.datatypes.generated.Uint256(_revealTime), 
            new org.web3j.abi.datatypes.Address(_beneficiary)));
    return deployRemoteCall(BlindAuction.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, encodedConstructor);
}
 
Example #15
Source File: HumanStandardToken.java    From etherscan-explorer with GNU General Public License v3.0 5 votes vote down vote up
public RemoteCall<TransactionReceipt> transfer(String _to, BigInteger _value) {
    final Function function = new Function(
            "transfer", 
            Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(_to), 
            new org.web3j.abi.datatypes.generated.Uint256(_value)), 
            Collections.<TypeReference<?>>emptyList());
    return executeRemoteCallTransaction(function);
}
 
Example #16
Source File: TypeDecoderTest.java    From web3j with Apache License 2.0 5 votes vote down vote up
@Test
public void testEmptyStaticArray() {
    assertThrows(
            UnsupportedOperationException.class,
            () ->
                    TypeDecoder.decodeStaticArray(
                            "0000000000000000000000000000000000000000000000000000000000000000",
                            0,
                            new TypeReference.StaticArrayTypeReference<StaticArray<Uint256>>(
                                    0) {},
                            0));
}
 
Example #17
Source File: TokenRepository.java    From trust-wallet-android-source with GNU General Public License v3.0 5 votes vote down vote up
private BigDecimal getBalance(Wallet wallet, TokenInfo tokenInfo) throws Exception {
    org.web3j.abi.datatypes.Function function = balanceOf(wallet.address);
    String responseValue = callSmartContractFunction(function, tokenInfo.address, wallet);

    List<Type> response = FunctionReturnDecoder.decode(
            responseValue, function.getOutputParameters());
    if (response.size() == 1) {
        return new BigDecimal(((Uint256) response.get(0)).getValue());
    } else {
        return null;
    }
}
 
Example #18
Source File: HumanStandardToken.java    From etherscan-explorer with GNU General Public License v3.0 5 votes vote down vote up
public RemoteCall<TransactionReceipt> transferFrom(String _from, String _to, BigInteger _value) {
    final Function function = new Function(
            "transferFrom", 
            Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(_from), 
            new org.web3j.abi.datatypes.Address(_to), 
            new org.web3j.abi.datatypes.generated.Uint256(_value)), 
            Collections.<TypeReference<?>>emptyList());
    return executeRemoteCallTransaction(function);
}
 
Example #19
Source File: TransactionHandler.java    From alpha-wallet-android with MIT License 5 votes vote down vote up
public List<BigInteger> getBalanceArray(String address, String contractAddress) throws Exception
{
    List<BigInteger> result = new ArrayList<>();
    org.web3j.abi.datatypes.Function function = balanceOfArray(address);
    List<Uint256> indices = callSmartContractFunctionArray(function, contractAddress, address);
    if (indices == null) throw new BadContract();
    for (Uint256 val : indices)
    {
        result.add(val.getValue());
    }
    return result;
}
 
Example #20
Source File: MetaCoin.java    From etherscan-explorer with GNU General Public License v3.0 5 votes vote down vote up
public RemoteCall<TransactionReceipt> sendCoin(String receiver, BigInteger amount) {
    final Function function = new Function(
            "sendCoin", 
            Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(receiver), 
            new org.web3j.abi.datatypes.generated.Uint256(amount)), 
            Collections.<TypeReference<?>>emptyList());
    return executeRemoteCallTransaction(function);
}
 
Example #21
Source File: ContractTest.java    From etherscan-explorer with GNU General Public License v3.0 5 votes vote down vote up
private Contract deployContract(TransactionReceipt transactionReceipt)
        throws Exception {

    prepareTransaction(transactionReceipt);

    String encodedConstructor = FunctionEncoder.encodeConstructor(
            Arrays.<Type>asList(new Uint256(BigInteger.TEN)));

    return TestContract.deployRemoteCall(
            TestContract.class, web3j, SampleKeys.CREDENTIALS,
            ManagedTransaction.GAS_PRICE, Contract.GAS_LIMIT,
            "0xcafed00d", encodedConstructor, BigInteger.ZERO).send();
}
 
Example #22
Source File: ContractTest.java    From etherscan-explorer with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testTransactionFailed() throws Exception {
    thrown.expect(TransactionException.class);
    thrown.expectMessage(
            "Transaction has failed with status: 0x0. Gas used: 1. (not-enough gas?)");

    TransactionReceipt transactionReceipt = new TransactionReceipt();
    transactionReceipt.setTransactionHash(TRANSACTION_HASH);
    transactionReceipt.setStatus("0x0");
    transactionReceipt.setGasUsed("0x1");

    prepareTransaction(transactionReceipt);
    contract.performTransaction(
            new Address(BigInteger.TEN), new Uint256(BigInteger.ONE)).send();
}
 
Example #23
Source File: HumanStandardToken.java    From client-sdk-java with Apache License 2.0 5 votes vote down vote up
@Deprecated
public static RemoteCall<HumanStandardToken> deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit,
		BigInteger _initialAmount, String _tokenName, BigInteger _decimalUnits, String _tokenSymbol) {
	String encodedConstructor = FunctionEncoder.encodeConstructor(
			Arrays.<Type>asList(new org.web3j.abi.datatypes.generated.Uint256(_initialAmount), new org.web3j.abi.datatypes.Utf8String(_tokenName),
					new org.web3j.abi.datatypes.generated.Uint8(_decimalUnits), new org.web3j.abi.datatypes.Utf8String(_tokenSymbol)));
	return deployRemoteCall(HumanStandardToken.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, encodedConstructor);
}
 
Example #24
Source File: HumanStandardToken.java    From web3j-quorum with Apache License 2.0 5 votes vote down vote up
public RemoteCall<BigInteger> allowance(String _owner, String _spender) {
    final Function function = new Function(FUNC_ALLOWANCE,
            Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(_owner),
                    new org.web3j.abi.datatypes.Address(_spender)),
            Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
    return executeRemoteCallSingleValueReturn(function, BigInteger.class);
}
 
Example #25
Source File: HumanStandardToken.java    From web3j-quorum with Apache License 2.0 5 votes vote down vote up
@Deprecated
public static RemoteCall<HumanStandardToken> deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit, BigInteger _initialAmount, String _tokenName, BigInteger _decimalUnits, String _tokenSymbol) {
    String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.<Type>asList(new org.web3j.abi.datatypes.generated.Uint256(_initialAmount),
            new org.web3j.abi.datatypes.Utf8String(_tokenName),
            new org.web3j.abi.datatypes.generated.Uint8(_decimalUnits),
            new org.web3j.abi.datatypes.Utf8String(_tokenSymbol)));
    return deployRemoteCall(HumanStandardToken.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, encodedConstructor);
}
 
Example #26
Source File: HumanStandardToken.java    From client-sdk-java with Apache License 2.0 5 votes vote down vote up
public RemoteCall<BigInteger> allowance(String _owner, String _spender) {
	final Function function = new Function(FUNC_ALLOWANCE,
			Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(_owner), new org.web3j.abi.datatypes.Address(_spender)),
			Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {
			}));
	return executeRemoteCallSingleValueReturn(function, BigInteger.class);
}
 
Example #27
Source File: ContractTest.java    From web3j with Apache License 2.0 5 votes vote down vote up
@Test
public void testTransactionFailed() throws IOException {
    TransactionReceipt transactionReceipt = createFailedTransactionReceipt();
    prepareCall(null);

    assertThrows(
            TransactionException.class,
            () -> {
                prepareTransaction(transactionReceipt);

                contract.performTransaction(
                                new Address(BigInteger.TEN), new Uint256(BigInteger.ONE))
                        .send();
            });
}
 
Example #28
Source File: TypeDecoderTest.java    From etherscan-explorer with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testDynamicArray() {
    assertThat(TypeDecoder.decodeDynamicArray(
            "0000000000000000000000000000000000000000000000000000000000000000",  // length
            0,
            new TypeReference<DynamicArray<Uint256>>() { }
            ),
            equalTo(DynamicArray.empty("uint256")));

    assertThat(TypeDecoder.decodeDynamicArray(
            "0000000000000000000000000000000000000000000000000000000000000002"  // length
                    + "000000000000000000000000000000000000000000000000000000000000000a"
                    + "0000000000000000000000000000000000000000000000007fffffffffffffff",
            0,
            new TypeReference<DynamicArray<Uint256>>() { }
            ),
            equalTo(new DynamicArray<Uint256>(
                    new Uint256(BigInteger.TEN),
                    new Uint256(BigInteger.valueOf(Long.MAX_VALUE)))));

    assertThat(TypeDecoder.decodeDynamicArray(
            "0000000000000000000000000000000000000000000000000000000000000002"  // length
                    + "000000000000000000000000000000000000000000000000000000000000000d"
                    + "48656c6c6f2c20776f726c642100000000000000000000000000000000000000"
                    + "000000000000000000000000000000000000000000000000000000000000000d"
                    + "776f726c64212048656c6c6f2c00000000000000000000000000000000000000",
            0,
            new TypeReference<DynamicArray<Utf8String>>() { }
            ),
            equalTo(new DynamicArray<Utf8String>(
                    new Utf8String("Hello, world!"),
                    new Utf8String("world! Hello,"))));
}
 
Example #29
Source File: ContractTest.java    From client-sdk-java with Apache License 2.0 5 votes vote down vote up
public List<EventValues> processEvent(TransactionReceipt transactionReceipt) {
    Event event = new Event("Event",
            Arrays.<TypeReference<?>>asList(
                    new TypeReference<Address>(true) { },
                    new TypeReference<Uint256>() { }));
    return extractEventParameters(event, transactionReceipt);
}
 
Example #30
Source File: TokenRepository.java    From ETHWallet with GNU General Public License v3.0 5 votes vote down vote up
public static String createTokenTransferData(String to, BigInteger tokenAmount) {
    List<Type> params = Arrays.asList(new Address(to), new Uint256(tokenAmount));

    List<TypeReference<?>> returnTypes = Collections.singletonList(new TypeReference<Bool>() {
    });

    Function function = new Function("transfer", params, returnTypes);
    //Numeric.hexStringToByteArray(Numeric.cleanHexPrefix(encodedFunction))
    return FunctionEncoder.encode(function);
}