本文整理了Java中org.web3j.abi.datatypes.Address
类的一些代码示例,展示了Address
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Address
类的具体详情如下:
包路径:org.web3j.abi.datatypes.Address
类名称:Address
[英]Address type, which is equivalent to uint160.
[中]地址类型,相当于uint160。
代码示例来源:origin: web3j/web3j
static Address decodeAddress(String input) {
return new Address(decodeNumeric(input, Uint160.class));
}
代码示例来源:origin: web3j/web3j
@Test
public void testToString() {
assertThat(new Address("00052b08330e05d731e38c856c1043288f7d9744").toString(),
is("0x00052b08330e05d731e38c856c1043288f7d9744"));
assertThat(new Address("0x00052b08330e05d731e38c856c1043288f7d9744").toString(),
is("0x00052b08330e05d731e38c856c1043288f7d9744"));
}
}
代码示例来源:origin: web3j/web3j
static String encodeAddress(Address address) {
return encodeNumeric(address.toUint160());
}
代码示例来源:origin: web3j/web3j
@Test
public void testAddress() {
Address address = new Address("0xbe5422d15f39373eb0a97ff8c10fbd0e40e29338");
assertThat(address.getTypeAsString(), is("address"));
assertThat(TypeEncoder.encodeAddress(address),
is("000000000000000000000000be5422d15f39373eb0a97ff8c10fbd0e40e29338"));
}
代码示例来源:origin: web3j/web3j
@Override
public String getValue() {
return toString();
}
代码示例来源:origin: AppStoreFoundation/asf-sdk
@Override public Observable<Long> getNonce(Address address) {
return Observable.fromCallable(
() -> web3j.ethGetTransactionCount(address.getValue(), DefaultBlockParameterName.PENDING)
.send())
.map(ethGetTransactionCount -> ethGetTransactionCount.getTransactionCount()
.longValue());
}
代码示例来源:origin: org.web3j/abi
@Override
public String getValue() {
return toString();
}
代码示例来源:origin: AppStoreFoundation/asf-sdk
@Override
public String getContractAddressById(String fromAddress, int chainId, String contractId) {
List<Type> arguments = new ArrayList<>();
List<TypeReference<?>> returnValues = new ArrayList<>();
returnValues.add(new TypeReference<Address>() {
});
arguments.add(stringToBytes32(contractId));
Function getContractAddressById =
new Function("getContractAddressById", arguments, returnValues);
String encodedFunction = FunctionEncoder.encode(getContractAddressById);
Transaction ethCallTransaction = createEthCallTransaction(fromAddress,
proxyContractAddressProvider.getProxyContractAddress(chainId), encodedFunction);
try {
EthCall rawResponse = web3jProvider.get(chainId)
.ethCall(ethCallTransaction, DefaultBlockParameterName.LATEST)
.send();
if (!rawResponse.hasError()) {
List<Type> response = FunctionReturnDecoder.decode(rawResponse.getValue(),
getContractAddressById.getOutputParameters());
return ((Address) response.get(0)).getValue();
} else {
throw new RuntimeException(mapErrorToMessage(rawResponse.getError()));
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: web3j/web3j
@Deprecated
public static RemoteCall<PublicResolver> deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit, String ensAddr) {
String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(ensAddr)));
return deployRemoteCall(PublicResolver.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, encodedConstructor);
}
代码示例来源:origin: AppStoreFoundation/asf-sdk
static String extractToFromEthTransaction(String input) {
String valueHex = input.substring(10, input.length() - ((256 >> 2)));
Address address = new Address(decodeInt(Hex.decode(valueHex), 0));
return address.toString();
}
代码示例来源:origin: org.web3j/abi
static String encodeAddress(Address address) {
return encodeNumeric(address.toUint160());
}
代码示例来源:origin: web3j/web3j
@Deprecated
public static RemoteCall<PublicResolver> deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit, String ensAddr) {
String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(ensAddr)));
return deployRemoteCall(PublicResolver.class, web3j, credentials, gasPrice, gasLimit, BINARY, encodedConstructor);
}
代码示例来源:origin: web3j/web3j
public RemoteCall<TransactionReceipt> setResolver(byte[] node, String resolver) {
final Function function = new Function(
FUNC_SETRESOLVER,
Arrays.<Type>asList(new org.web3j.abi.datatypes.generated.Bytes32(node),
new org.web3j.abi.datatypes.Address(resolver)),
Collections.<TypeReference<?>>emptyList());
return executeRemoteCallTransaction(function);
}
代码示例来源:origin: web3j/web3j
public RemoteCall<TransactionReceipt> setOwner(byte[] node, String owner) {
final Function function = new Function(
FUNC_SETOWNER,
Arrays.<Type>asList(new org.web3j.abi.datatypes.generated.Bytes32(node),
new org.web3j.abi.datatypes.Address(owner)),
Collections.<TypeReference<?>>emptyList());
return executeRemoteCallTransaction(function);
}
代码示例来源:origin: web3j/web3j
public RemoteCall<TransactionReceipt> setAddr(byte[] node, String addr) {
final Function function = new Function(
FUNC_SETADDR,
Arrays.<Type>asList(new org.web3j.abi.datatypes.generated.Bytes32(node),
new org.web3j.abi.datatypes.Address(addr)),
Collections.<TypeReference<?>>emptyList());
return executeRemoteCallTransaction(function);
}
代码示例来源:origin: web3j/web3j
private Function allowance(String owner, String spender) {
return new Function(
"allowance",
Arrays.asList(new Address(owner), new Address(spender)),
Collections.singletonList(new TypeReference<Uint256>() {}));
}
代码示例来源:origin: web3j/web3j
public static RemoteCall<PublicResolver> deploy(Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider, String ensAddr) {
String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(ensAddr)));
return deployRemoteCall(PublicResolver.class, web3j, credentials, contractGasProvider, BINARY, encodedConstructor);
}
代码示例来源:origin: web3j/web3j
public static RemoteCall<PublicResolver> deploy(Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider, String ensAddr) {
String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(ensAddr)));
return deployRemoteCall(PublicResolver.class, web3j, transactionManager, contractGasProvider, BINARY, encodedConstructor);
}
代码示例来源:origin: web3j/web3j
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);
}
代码示例来源:origin: web3j/web3j
public RemoteCall<TransactionReceipt> setSubnodeOwner(byte[] node, byte[] label, String owner) {
final Function function = new Function(
FUNC_SETSUBNODEOWNER,
Arrays.<Type>asList(new org.web3j.abi.datatypes.generated.Bytes32(node),
new org.web3j.abi.datatypes.generated.Bytes32(label),
new org.web3j.abi.datatypes.Address(owner)),
Collections.<TypeReference<?>>emptyList());
return executeRemoteCallTransaction(function);
}
内容来源于网络,如有侵权,请联系作者删除!