use of com.radixdlt.api.core.model.entities.AccountVaultEntity in project radixdlt by radixdlt.
the class ConstructionParseMessageTest method buildUnsignedTxnWithMessage.
private byte[] buildUnsignedTxnWithMessage(String message) throws Exception {
var accountAddress = REAddr.ofPubKeyAccount(self);
var otherAddress = REAddr.ofPubKeyAccount(PrivateKeys.ofNumeric(2).getPublicKey());
var entityOperationGroups = List.of(List.of(EntityOperation.from(new AccountVaultEntity(accountAddress), ResourceOperation.withdraw(new TokenResource("xrd", REAddr.ofNativeToken()), UInt256.ONE)), EntityOperation.from(new AccountVaultEntity(otherAddress), ResourceOperation.deposit(new TokenResource("xrd", REAddr.ofNativeToken()), UInt256.ONE))));
var operationTxBuilder = new OperationTxBuilder(message, entityOperationGroups, currentForkView);
var builder = radixEngine.constructWithFees(operationTxBuilder, false, accountAddress, NotEnoughNativeTokensForFeesException::new);
var unsignedTransaction = builder.buildForExternalSign();
return unsignedTransaction.blob();
}
use of com.radixdlt.api.core.model.entities.AccountVaultEntity in project radixdlt by radixdlt.
the class ConstructionParseTransferTest method buildUnsignedTransferTxn.
private byte[] buildUnsignedTransferTxn(REAddr from, REAddr to) throws Exception {
final UInt256 toTransfer = transferAmount();
var entityOperationGroups = List.of(List.of(EntityOperation.from(new AccountVaultEntity(from), ResourceOperation.withdraw(new TokenResource("xrd", REAddr.ofNativeToken()), toTransfer)), EntityOperation.from(new AccountVaultEntity(to), ResourceOperation.deposit(new TokenResource("xrd", REAddr.ofNativeToken()), toTransfer))));
var operationTxBuilder = new OperationTxBuilder(null, entityOperationGroups, currentForkView);
var builder = radixEngine.constructWithFees(operationTxBuilder, false, from, NotEnoughNativeTokensForFeesException::new);
var unsignedTransaction = builder.buildForExternalSign();
return unsignedTransaction.blob();
}
use of com.radixdlt.api.core.model.entities.AccountVaultEntity in project radixdlt by radixdlt.
the class TxWithMessageTest method buildSignedTxn.
private Txn buildSignedTxn(REAddr from, REAddr to, String message) throws Exception {
var toTransfer = UInt256.ONE;
var entityOperationGroups = List.of(List.of(EntityOperation.from(new AccountVaultEntity(from), ResourceOperation.withdraw(new TokenResource("xrd", REAddr.ofNativeToken()), toTransfer)), EntityOperation.from(new AccountVaultEntity(to), ResourceOperation.deposit(new TokenResource("xrd", REAddr.ofNativeToken()), toTransfer))));
var operationTxBuilder = new OperationTxBuilder(message, entityOperationGroups, currentForkView);
var builder = radixEngine.constructWithFees(operationTxBuilder, false, from, NotEnoughNativeTokensForFeesException::new);
return builder.signAndBuild(hashSigner::sign);
}
Aggregations