|
|
|
@ -6,6 +6,9 @@ import conflux.web3j.Cfx;
|
|
|
|
|
import conflux.web3j.RpcException; |
|
|
|
|
import conflux.web3j.request.Call; |
|
|
|
|
import conflux.web3j.response.UsedGasAndCollateral; |
|
|
|
|
import conflux.web3j.types.RawTransaction; |
|
|
|
|
import conflux.web3j.types.SendTransactionResult; |
|
|
|
|
import conflux.web3j.types.TransactionBuilder; |
|
|
|
|
import org.web3j.abi.FunctionEncoder; |
|
|
|
|
import org.web3j.abi.TypeReference; |
|
|
|
|
import org.web3j.abi.datatypes.Address; |
|
|
|
@ -42,7 +45,7 @@ public class ConfluxExecutor {
|
|
|
|
|
org.web3j.abi.Utils.typeMap(_tokenIds, Uint256.class))); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public String awardItemData(Account.Option option, String address, List<BigInteger> _tokenIds,List<String> tokenURIs) throws Exception { |
|
|
|
|
public String awardItemData(Account.Option option, String address, List<BigInteger> _tokenIds, List<String> tokenURIs) throws Exception { |
|
|
|
|
return this.account.call(option, |
|
|
|
|
new conflux.web3j.types.Address(this.contract), |
|
|
|
|
"awardItemData", |
|
|
|
@ -87,6 +90,7 @@ public class ConfluxExecutor {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 估算gas limit storage 出来 带有元数据 |
|
|
|
|
* |
|
|
|
|
* @param cfx |
|
|
|
|
* @param account |
|
|
|
|
* @param contractAddress |
|
|
|
@ -96,9 +100,9 @@ public class ConfluxExecutor {
|
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
public UsedGasAndCollateral getEstimateData(Cfx cfx, conflux.web3j.types.Address account, |
|
|
|
|
conflux.web3j.types.Address contractAddress, |
|
|
|
|
String address, |
|
|
|
|
List<BigInteger> _tokenIds,List<String> tokenURIs) { |
|
|
|
|
conflux.web3j.types.Address contractAddress, |
|
|
|
|
String address, |
|
|
|
|
List<BigInteger> _tokenIds, List<String> tokenURIs) { |
|
|
|
|
Call call = new Call(); |
|
|
|
|
call.setFrom(account); |
|
|
|
|
call.setTo(contractAddress); |
|
|
|
@ -120,4 +124,14 @@ public class ConfluxExecutor {
|
|
|
|
|
return cfx.estimateGasAndCollateral(call).sendAndGet(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public String safeTransferFrom(Account.Option option, String from, String to, List<BigInteger> tokenId) throws Exception { |
|
|
|
|
return this.account.call(option, |
|
|
|
|
new conflux.web3j.types.Address(this.contract), |
|
|
|
|
"safeTransferFrom", |
|
|
|
|
new Address(from), |
|
|
|
|
new Address(to), |
|
|
|
|
new org.web3j.abi.datatypes.DynamicArray<>( |
|
|
|
|
Uint256.class, |
|
|
|
|
org.web3j.abi.Utils.typeMap(tokenId, Uint256.class))); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|