Java Code Examples for org.web3j.abi.datatypes.Function#getInputParameters()

The following examples show how to use org.web3j.abi.datatypes.Function#getInputParameters() . 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: FunctionEncoder.java    From client-sdk-java with Apache License 2.0 5 votes vote down vote up
public static String encode(Function function) {
    List<Type> parameters = function.getInputParameters();

    String methodSignature = buildMethodSignature(function.getName(), parameters);
    String methodId = buildMethodId(methodSignature);

    StringBuilder result = new StringBuilder();
    result.append(methodId);

    return encodeParameters(parameters, result);
}
 
Example 2
Source File: FunctionEncoder.java    From etherscan-explorer with GNU General Public License v3.0 5 votes vote down vote up
public static String encode(Function function) {
    List<Type> parameters = function.getInputParameters();

    String methodSignature = buildMethodSignature(function.getName(), parameters);
    String methodId = buildMethodId(methodSignature);

    StringBuilder result = new StringBuilder();
    result.append(methodId);

    return encodeParameters(parameters, result);
}
 
Example 3
Source File: AssetDefinitionService.java    From alpha-wallet-android with MIT License 5 votes vote down vote up
public String generateTransactionPayload(Token token, BigInteger tokenId, FunctionDefinition def)
{
    TokenDefinition td = getAssetDefinition(token.tokenInfo.chainId, token.tokenInfo.address);
    if (td == null) return "";
    Function function = tokenscriptUtility.generateTransactionFunction(token, tokenId, td, def, this);
    if (function.getInputParameters() == null)
    {
        return null;
    }
    else
    {
        return FunctionEncoder.encode(function);
    }
}
 
Example 4
Source File: DefaultFunctionEncoder.java    From web3j with Apache License 2.0 5 votes vote down vote up
@Override
public String encodeFunction(final Function function) {
    final List<Type> parameters = function.getInputParameters();

    final String methodSignature = buildMethodSignature(function.getName(), parameters);
    final String methodId = buildMethodId(methodSignature);

    final StringBuilder result = new StringBuilder();
    result.append(methodId);

    return encodeParameters(parameters, result);
}