本文整理汇总了Java中org.web3j.tx.TransactionManager类的典型用法代码示例。如果您正苦于以下问题:Java TransactionManager类的具体用法?Java TransactionManager怎么用?Java TransactionManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TransactionManager类属于org.web3j.tx包,在下文中一共展示了TransactionManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: callHash
import org.web3j.tx.TransactionManager; //导入依赖的package包/类
private byte[] callHash(String name, Type...parameters) throws InterruptedException, ExecutionException {
Function function = new Function(name,
Arrays.asList(parameters),
Arrays.asList(new TypeReference<Bytes32>() {})
);
String encodedFunction = FunctionEncoder.encode(function);
TransactionManager transactionManager = cfg.getTransactionManager(cfg.getMainAddress());
String channelLibraryAddress = contractsProperties.getAddress().get("ChannelLibrary").toString();
org.web3j.protocol.core.methods.response.EthCall ethCall = web3j.ethCall(
Transaction.createEthCallTransaction(
transactionManager.getFromAddress(), channelLibraryAddress, encodedFunction),
DefaultBlockParameterName.LATEST)
.sendAsync().get();
String value = ethCall.getValue();
List<Type> list = FunctionReturnDecoder.decode(value, function.getOutputParameters());
return ((Bytes32) list.get(0)).getValue();
}
开发者ID:papyrusglobal,项目名称:state-channels,代码行数:21,代码来源:HashTest.java
示例2: create
import org.web3j.tx.TransactionManager; //导入依赖的package包/类
private <T extends Contract> T create(Class<T> type, TransactionReceipt rc) {
try {
Constructor<T> constructor = type.getDeclaredConstructor(
String.class,
Web3j.class, TransactionManager.class,
BigInteger.class, BigInteger.class);
constructor.setAccessible(true);
T contract = constructor.newInstance(null, web3j, transactionManager, rpcProperties.getGasPrice(), rpcProperties.getGasLimit());
contract.setContractAddress(rc.getContractAddress());
contract.setTransactionReceipt(rc);
return contract;
} catch (Exception e) {
throw Throwables.propagate(e);
}
}
开发者ID:papyrusglobal,项目名称:state-channels,代码行数:17,代码来源:ContractsManager.java
示例3: refill
import org.web3j.tx.TransactionManager; //导入依赖的package包/类
public void refill(BigDecimal minBalance, String address, Supplier<TransactionManager> managerSupplier) throws InterruptedException, ExecutionException {
BigDecimal balance = ethereumService.getBalance(address, Convert.Unit.ETHER);
log.info("Balance of {} is {}", address, balance);
if (minBalance != null && minBalance.signum() > 0) {
if (balance.compareTo(minBalance) < 0) {
TransactionManager manager = managerSupplier.get();
log.info("Refill {} ETH from {} to {}", minBalance, manager.getFromAddress(), address);
try {
new Transfer(web3j, manager).sendFunds(address, minBalance, Convert.Unit.ETHER).send();
} catch (Exception e) {
log.warn("Refill failed", e);
}
log.info("Balance after refill of {} is {}", address, ethereumService.getBalance(address, Convert.Unit.ETHER));
}
}
}
开发者ID:papyrusglobal,项目名称:state-channels,代码行数:19,代码来源:BalanceRefillService.java
示例4: generateJavaFiles
import org.web3j.tx.TransactionManager; //导入依赖的package包/类
void generateJavaFiles(
String contractName, String bin, List<AbiDefinition> abi, String destinationDir,
String basePackageName, Map<String, String> addresses)
throws IOException, ClassNotFoundException {
String className = Strings.capitaliseFirstLetter(contractName);
TypeSpec.Builder classBuilder = createClassBuilder(className, bin);
classBuilder.addMethod(buildConstructor(Credentials.class, CREDENTIALS));
classBuilder.addMethod(buildConstructor(TransactionManager.class,
TRANSACTION_MANAGER));
classBuilder.addMethods(
buildFunctionDefinitions(className, classBuilder, abi));
classBuilder.addMethod(buildLoad(className, Credentials.class, CREDENTIALS));
classBuilder.addMethod(buildLoad(className, TransactionManager.class,
TRANSACTION_MANAGER));
addAddressesSupport(classBuilder, addresses);
write(basePackageName, classBuilder.build(), destinationDir);
}
开发者ID:web3j,项目名称:web3j,代码行数:22,代码来源:SolidityFunctionWrapper.java
示例5: ContractsManager
import org.web3j.tx.TransactionManager; //导入依赖的package包/类
public ContractsManager(String fromAddress, EthRpcProperties rpcProperties, Web3j web3j, ContractsProperties contractsProperties, TransactionManager transactionManager) {
this.web3j = web3j;
this.rpcProperties = rpcProperties;
this.transactionManager = transactionManager;
this.contractsProperties = contractsProperties;
registry = loadPredeployedContract(EndpointRegistryContract.class);
token = loadPredeployedContract(StandardToken.class, "Token");
this.fromAddress = new Address(fromAddress);
tokenService = new TokenService(token, this.fromAddress);
channelManager = loadPredeployedContract(ChannelManagerContract.class);
}
开发者ID:papyrusglobal,项目名称:state-channels,代码行数:13,代码来源:ContractsManager.java
示例6: load
import org.web3j.tx.TransactionManager; //导入依赖的package包/类
public <C extends Contract> C load(Class<C> contractClass, Address address) {
try {
//String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit
Method method = contractClass.getDeclaredMethod("load", String.class, Web3j.class, TransactionManager.class, BigInteger.class, BigInteger.class);
Object contract = method.invoke(null, address.toString(), web3j, transactionManager, rpcProperties.getGasPrice(), rpcProperties.getGasLimit());
return contractClass.cast(contract);
} catch (Exception e) {
throw Throwables.propagate(e);
}
}
开发者ID:papyrusglobal,项目名称:state-channels,代码行数:11,代码来源:ContractsManager.java
示例7: deployContract
import org.web3j.tx.TransactionManager; //导入依赖的package包/类
public Address deployContract(TransactionManager transactionManager, String binary, Map<String, Address> libraries, Type... constructorArgs) throws IOException, InterruptedException, TransactionException {
ContractLinker linker = new ContractLinker(binary);
if (libraries != null && !libraries.isEmpty()) {
libraries.forEach(linker::link);
}
linker.assertLinked();
String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.<Type>asList(constructorArgs));
String data = linker.getBinary() + encodedConstructor;
EthSendTransaction transactionResponse = transactionManager.sendTransaction(
properties.getGasPrice(), properties.getGasLimit(), null, data, BigInteger.ZERO);
if (transactionResponse.hasError()) {
throw new RuntimeException("Error processing transaction request: "
+ transactionResponse.getError().getMessage());
}
String transactionHash = transactionResponse.getTransactionHash();
Optional<TransactionReceipt> receiptOptional =
sendTransactionReceiptRequest(transactionHash, web3j);
long millis = properties.getSleep().toMillis();
int attempts = properties.getAttempts();
for (int i = 0; i < attempts; i++) {
if (!receiptOptional.isPresent()) {
Thread.sleep(millis);
receiptOptional = sendTransactionReceiptRequest(transactionHash, web3j);
} else {
String contractAddress = receiptOptional.get().getContractAddress();
return new Address(contractAddress);
}
}
throw new TransactionException("Transaction receipt was not generated after " + (millis * attempts / 1000)
+ " seconds for transaction: " + transactionHash);
}
开发者ID:papyrusglobal,项目名称:state-channels,代码行数:37,代码来源:DeployService.java
示例8: deploy
import org.web3j.tx.TransactionManager; //导入依赖的package包/类
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);
}
开发者ID:web3j,项目名称:quorum,代码行数:8,代码来源:HumanStandardToken.java
示例9: deploy
import org.web3j.tx.TransactionManager; //导入依赖的package包/类
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);
}
开发者ID:web3j,项目名称:web3j,代码行数:8,代码来源:HumanStandardToken.java
示例10: ModumToken
import org.web3j.tx.TransactionManager; //导入依赖的package包/类
private ModumToken(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit);
}
开发者ID:modum-io,项目名称:tokenapp-backend,代码行数:4,代码来源:ModumToken.java
示例11: deploy
import org.web3j.tx.TransactionManager; //导入依赖的package包/类
public static Future<ModumToken> deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit, BigInteger initialWeiValue) {
return deployAsync(ModumToken.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, "", initialWeiValue);
}
开发者ID:modum-io,项目名称:tokenapp-backend,代码行数:4,代码来源:ModumToken.java
示例12: load
import org.web3j.tx.TransactionManager; //导入依赖的package包/类
public static ModumToken load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
return new ModumToken(contractAddress, web3j, transactionManager, gasPrice, gasLimit);
}
开发者ID:modum-io,项目名称:tokenapp-backend,代码行数:4,代码来源:ModumToken.java
示例13: getTransactionManager
import org.web3j.tx.TransactionManager; //导入依赖的package包/类
public TransactionManager getTransactionManager() {
return transactionManager;
}
开发者ID:papyrusglobal,项目名称:state-channels,代码行数:4,代码来源:ContractsManager.java
示例14: createManager
import org.web3j.tx.TransactionManager; //导入依赖的package包/类
public ContractsManager createManager(TransactionManager transactionManager, String fromAddress) {
return new ContractsManager(fromAddress, ethProperties.getRpc(), web3j, contractsProperties, transactionManager);
}
开发者ID:papyrusglobal,项目名称:state-channels,代码行数:4,代码来源:ContractsManagerFactory.java
示例15: Echo_sol_Echo
import org.web3j.tx.TransactionManager; //导入依赖的package包/类
private Echo_sol_Echo(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit);
}
开发者ID:CDCgov,项目名称:blockchain-collab,代码行数:4,代码来源:Echo_sol_Echo.java
示例16: deploy
import org.web3j.tx.TransactionManager; //导入依赖的package包/类
public static Future<Echo_sol_Echo> deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit, BigInteger initialWeiValue) {
return deployAsync(Echo_sol_Echo.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, "", initialWeiValue);
}
开发者ID:CDCgov,项目名称:blockchain-collab,代码行数:4,代码来源:Echo_sol_Echo.java
示例17: load
import org.web3j.tx.TransactionManager; //导入依赖的package包/类
public static Echo_sol_Echo load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
return new Echo_sol_Echo(contractAddress, web3j, transactionManager, gasPrice, gasLimit);
}
开发者ID:CDCgov,项目名称:blockchain-collab,代码行数:4,代码来源:Echo_sol_Echo.java
示例18: BankAccount
import org.web3j.tx.TransactionManager; //导入依赖的package包/类
private BankAccount(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit);
}
开发者ID:SenthuranSivananthan,项目名称:devops-blockchain-jenkins,代码行数:4,代码来源:BankAccount.java
示例19: deploy
import org.web3j.tx.TransactionManager; //导入依赖的package包/类
public static Future<BankAccount> deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit, BigInteger initialWeiValue) {
return deployAsync(BankAccount.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, "", initialWeiValue);
}
开发者ID:SenthuranSivananthan,项目名称:devops-blockchain-jenkins,代码行数:4,代码来源:BankAccount.java
示例20: load
import org.web3j.tx.TransactionManager; //导入依赖的package包/类
public static BankAccount load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
return new BankAccount(contractAddress, web3j, transactionManager, gasPrice, gasLimit);
}
开发者ID:SenthuranSivananthan,项目名称:devops-blockchain-jenkins,代码行数:4,代码来源:BankAccount.java
注:本文中的org.web3j.tx.TransactionManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论