org.web3j.abi.datatypes.Address.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(130)

本文整理了Java中org.web3j.abi.datatypes.Address.<init>()方法的一些代码示例,展示了Address.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Address.<init>()方法的具体详情如下:
包路径:org.web3j.abi.datatypes.Address
类名称:Address
方法名:<init>

Address.<init>介绍

暂无

代码示例

代码示例来源: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: 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

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 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);
}

代码示例来源:origin: web3j/web3j

private Function balanceOf(String owner) {
  return new Function(
      "balanceOf",
      Collections.singletonList(new Address(owner)),
      Collections.singletonList(new TypeReference<Uint256>() {}));
}

代码示例来源:origin: web3j/web3j

private Function transferFrom(String from, String to, BigInteger value) {
  return new Function(
      "transferFrom",
      Arrays.asList(new Address(from), new Address(to), new Uint256(value)),
      Collections.singletonList(new TypeReference<Bool>() {}));
}

代码示例来源:origin: web3j/web3j

public RemoteCall<BigInteger> getBalanceInEth(String addr) {
  final Function function = new Function(FUNC_GETBALANCEINETH, 
      Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(addr)), 
      Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
  return executeRemoteCallSingleValueReturn(function, BigInteger.class);
}

代码示例来源:origin: web3j/web3j

public RemoteCall<TransactionReceipt> transferFrom(String _from, String _to, BigInteger _value) {
  final Function function = new Function(
      FUNC_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);
}

代码示例来源:origin: web3j/web3j

public RemoteCall<BigInteger> balanceOf(String _owner) {
  final Function function = new Function(FUNC_BALANCEOF, 
      Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(_owner)), 
      Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
  return executeRemoteCallSingleValueReturn(function, BigInteger.class);
}

代码示例来源:origin: web3j/web3j

public RemoteCall<BigInteger> getBalance(String addr) {
  final Function function = new Function(FUNC_GETBALANCE, 
      Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(addr)), 
      Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
  return executeRemoteCallSingleValueReturn(function, BigInteger.class);
}

代码示例来源:origin: web3j/web3j

private Function approve(String spender, BigInteger value) {
  return new Function(
      "approve",
      Arrays.asList(new Address(spender), new Uint256(value)),
      Collections.singletonList(new TypeReference<Bool>() {}));
}

代码示例来源:origin: web3j/web3j

private Function transfer(String to, BigInteger value) {
  return new Function(
      "transfer",
      Arrays.asList(new Address(to), new Uint256(value)),
      Collections.singletonList(new TypeReference<Bool>() {}));
}

代码示例来源:origin: web3j/web3j

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);
}

代码示例来源:origin: web3j/web3j

public RemoteCall<TransactionReceipt> transfer(String _to, BigInteger _value) {
  final Function function = new Function(
      FUNC_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);
}

代码示例来源:origin: web3j/web3j

public RemoteCall<TransactionReceipt> sendCoin(String receiver, BigInteger amount) {
  final Function function = new Function(
      FUNC_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);
}

代码示例来源:origin: web3j/web3j

@Test
  public void testToString() {
    assertThat(new Address("00052b08330e05d731e38c856c1043288f7d9744").toString(),
        is("0x00052b08330e05d731e38c856c1043288f7d9744"));
    assertThat(new Address("0x00052b08330e05d731e38c856c1043288f7d9744").toString(),
        is("0x00052b08330e05d731e38c856c1043288f7d9744"));
  }
}

代码示例来源:origin: web3j/web3j

public RemoteCall<TransactionReceipt> approveAndCall(String _spender, BigInteger _value, byte[] _extraData) {
  final Function function = new Function(
      FUNC_APPROVEANDCALL, 
      Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(_spender), 
      new org.web3j.abi.datatypes.generated.Uint256(_value), 
      new org.web3j.abi.datatypes.DynamicBytes(_extraData)), 
      Collections.<TypeReference<?>>emptyList());
  return executeRemoteCallTransaction(function);
}

代码示例来源:origin: web3j/web3j

@Test
public void testAddress() {
  Address address = new Address("0xbe5422d15f39373eb0a97ff8c10fbd0e40e29338");
  assertThat(address.getTypeAsString(), is("address"));
  assertThat(TypeEncoder.encodeAddress(address),
      is("000000000000000000000000be5422d15f39373eb0a97ff8c10fbd0e40e29338"));
}

相关文章