Search in sources :

Example 1 with NotEnoughNativeTokensForFeesException

use of com.radixdlt.api.core.model.NotEnoughNativeTokensForFeesException in project radixdlt by radixdlt.

the class ConstructionSubmitTest method buildSignedTxn.

private Txn buildSignedTxn(REAddr from, REAddr to) 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(null, entityOperationGroups, currentForkView);
    var builder = radixEngine.constructWithFees(operationTxBuilder, false, from, NotEnoughNativeTokensForFeesException::new);
    return builder.signAndBuild(hashSigner::sign);
}
Also used : OperationTxBuilder(com.radixdlt.api.core.model.OperationTxBuilder) TokenResource(com.radixdlt.api.core.model.TokenResource) NotEnoughNativeTokensForFeesException(com.radixdlt.api.core.model.NotEnoughNativeTokensForFeesException) AccountVaultEntity(com.radixdlt.api.core.model.entities.AccountVaultEntity)

Example 2 with NotEnoughNativeTokensForFeesException

use of com.radixdlt.api.core.model.NotEnoughNativeTokensForFeesException in project radixdlt by radixdlt.

the class MempoolHandlerTest method buildSignedTxn.

private Txn buildSignedTxn(REAddr from, REAddr to) throws Exception {
    final UInt256 toTransfer = getLiquidAmount().toSubunits().subtract(Amount.ofTokens(1).toSubunits());
    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);
    return builder.signAndBuild(hashSigner::sign);
}
Also used : OperationTxBuilder(com.radixdlt.api.core.model.OperationTxBuilder) TokenResource(com.radixdlt.api.core.model.TokenResource) NotEnoughNativeTokensForFeesException(com.radixdlt.api.core.model.NotEnoughNativeTokensForFeesException) AccountVaultEntity(com.radixdlt.api.core.model.entities.AccountVaultEntity) UInt256(com.radixdlt.utils.UInt256)

Example 3 with NotEnoughNativeTokensForFeesException

use of com.radixdlt.api.core.model.NotEnoughNativeTokensForFeesException in project radixdlt by radixdlt.

the class KeySignHandlerTest method buildUnsignedTxn.

private byte[] buildUnsignedTxn(REAddr from, REAddr to) throws Exception {
    var entityOperationGroups = List.of(List.of(EntityOperation.from(new AccountVaultEntity(from), ResourceOperation.withdraw(new TokenResource("xrd", REAddr.ofNativeToken()), UInt256.ONE)), EntityOperation.from(new AccountVaultEntity(to), ResourceOperation.deposit(new TokenResource("xrd", REAddr.ofNativeToken()), UInt256.ONE))));
    var operationTxBuilder = new OperationTxBuilder(null, entityOperationGroups, currentForkView);
    var builder = radixEngine.constructWithFees(operationTxBuilder, false, from, NotEnoughNativeTokensForFeesException::new);
    return builder.buildForExternalSign().blob();
}
Also used : OperationTxBuilder(com.radixdlt.api.core.model.OperationTxBuilder) TokenResource(com.radixdlt.api.core.model.TokenResource) NotEnoughNativeTokensForFeesException(com.radixdlt.api.core.model.NotEnoughNativeTokensForFeesException) AccountVaultEntity(com.radixdlt.api.core.model.entities.AccountVaultEntity)

Example 4 with NotEnoughNativeTokensForFeesException

use of com.radixdlt.api.core.model.NotEnoughNativeTokensForFeesException in project radixdlt by radixdlt.

the class MempoolTransactionHandlerTest method buildSignedTxn.

private Txn buildSignedTxn(REAddr from, REAddr to) throws Exception {
    final UInt256 toTransfer = getLiquidAmount().toSubunits().subtract(Amount.ofTokens(1).toSubunits());
    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);
    return builder.signAndBuild(hashSigner::sign);
}
Also used : OperationTxBuilder(com.radixdlt.api.core.model.OperationTxBuilder) TokenResource(com.radixdlt.api.core.model.TokenResource) NotEnoughNativeTokensForFeesException(com.radixdlt.api.core.model.NotEnoughNativeTokensForFeesException) AccountVaultEntity(com.radixdlt.api.core.model.entities.AccountVaultEntity) UInt256(com.radixdlt.utils.UInt256)

Example 5 with NotEnoughNativeTokensForFeesException

use of com.radixdlt.api.core.model.NotEnoughNativeTokensForFeesException in project radixdlt by radixdlt.

the class ConstructionFinalizeTest method buildUnsignedTransferTxn.

private UnsignedTxnData buildUnsignedTransferTxn(REAddr from, REAddr to) throws Exception {
    final UInt256 toTransfer = getLiquidAmount().toSubunits().subtract(Amount.ofTokens(1).toSubunits());
    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);
    return builder.buildForExternalSign();
}
Also used : OperationTxBuilder(com.radixdlt.api.core.model.OperationTxBuilder) TokenResource(com.radixdlt.api.core.model.TokenResource) NotEnoughNativeTokensForFeesException(com.radixdlt.api.core.model.NotEnoughNativeTokensForFeesException) AccountVaultEntity(com.radixdlt.api.core.model.entities.AccountVaultEntity) UInt256(com.radixdlt.utils.UInt256)

Aggregations

NotEnoughNativeTokensForFeesException (com.radixdlt.api.core.model.NotEnoughNativeTokensForFeesException)10 OperationTxBuilder (com.radixdlt.api.core.model.OperationTxBuilder)8 TokenResource (com.radixdlt.api.core.model.TokenResource)8 AccountVaultEntity (com.radixdlt.api.core.model.entities.AccountVaultEntity)8 UInt256 (com.radixdlt.utils.UInt256)4 UpdateVoteResponse (com.radixdlt.api.core.openapitools.model.UpdateVoteResponse)2 TxBuilderException (com.radixdlt.atom.TxBuilderException)2 Txn (com.radixdlt.atom.Txn)2 RadixEngineException (com.radixdlt.engine.RadixEngineException)2 MempoolDuplicateException (com.radixdlt.mempool.MempoolDuplicateException)2 MempoolFullException (com.radixdlt.mempool.MempoolFullException)2 MempoolRejectedException (com.radixdlt.mempool.MempoolRejectedException)2