From 99a4a9b4f9fabcca63b2cd0cef8e94189fef413d Mon Sep 17 00:00:00 2001 From: Akshay Date: Tue, 29 Nov 2022 00:15:39 +0530 Subject: [PATCH 1/8] SCIP gateway api v2 --- pom.xml | 2 +- .../de/api/exceptions/ExceptionCode.java | 3 ++ ...ocationAlreadyConfirmedStateException.java | 15 +++++++++ .../de/api/interfaces/BlockchainAdapter.java | 32 ++++++++++++++++++- 4 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 src/main/java/blockchains/iaas/uni/stuttgart/de/api/exceptions/InvocationAlreadyConfirmedStateException.java diff --git a/pom.xml b/pom.xml index 843f5f9..d09caec 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ blockchains.iaas.uni.stuttgart.de blockchain-access-layer-api - 1.0.1-SNAPSHOT + 2.0.0-SNAPSHOT 8 diff --git a/src/main/java/blockchains/iaas/uni/stuttgart/de/api/exceptions/ExceptionCode.java b/src/main/java/blockchains/iaas/uni/stuttgart/de/api/exceptions/ExceptionCode.java index 27381a7..a242592 100644 --- a/src/main/java/blockchains/iaas/uni/stuttgart/de/api/exceptions/ExceptionCode.java +++ b/src/main/java/blockchains/iaas/uni/stuttgart/de/api/exceptions/ExceptionCode.java @@ -73,4 +73,7 @@ public class ExceptionCode { * This is an asynchronous error. */ public static final int Timeout = -32201; + + public static final int InvocationAlreadyConfirmed = -32202; + } diff --git a/src/main/java/blockchains/iaas/uni/stuttgart/de/api/exceptions/InvocationAlreadyConfirmedStateException.java b/src/main/java/blockchains/iaas/uni/stuttgart/de/api/exceptions/InvocationAlreadyConfirmedStateException.java new file mode 100644 index 0000000..347d000 --- /dev/null +++ b/src/main/java/blockchains/iaas/uni/stuttgart/de/api/exceptions/InvocationAlreadyConfirmedStateException.java @@ -0,0 +1,15 @@ +package blockchains.iaas.uni.stuttgart.de.api.exceptions; + +public class InvocationAlreadyConfirmedStateException extends BalException { + @Override + public int getCode() { + return ExceptionCode.InvocationAlreadyConfirmed; + } + + public InvocationAlreadyConfirmedStateException() { + } + + public InvocationAlreadyConfirmedStateException(String message) { + super(message); + } +} diff --git a/src/main/java/blockchains/iaas/uni/stuttgart/de/api/interfaces/BlockchainAdapter.java b/src/main/java/blockchains/iaas/uni/stuttgart/de/api/interfaces/BlockchainAdapter.java index 4b43213..3172d6b 100644 --- a/src/main/java/blockchains/iaas/uni/stuttgart/de/api/interfaces/BlockchainAdapter.java +++ b/src/main/java/blockchains/iaas/uni/stuttgart/de/api/interfaces/BlockchainAdapter.java @@ -83,9 +83,12 @@ public interface BlockchainAdapter { CompletableFuture invokeSmartContract( String smartContractPath, String functionIdentifier, + List typeArguments, List inputs, List outputs, - double requiredConfidence + double requiredConfidence, + List signers, + long minimumNumberOfSignatures ) throws BalException; /** @@ -115,10 +118,37 @@ Observable subscribeToEvent(String smartContractAddress, String even */ CompletableFuture queryEvents(String smartContractAddress, String eventIdentifier, List outputParameters, String filter, TimeFrame timeFrame) throws BalException; + /** * Tests the connection settings with the underlying blockchain * * @return true if the connection is successful, an error message otherwise. */ String testConnection(); + + void signInvocation(String correlationId, String signature); + List getPendingInvocations(); + + /** + * Replaces a smart contract function invocation with a new invocation. + * @param correlationId the identifier of the invocation which should be replaced with a new one + * @param smartContractPath the path to the smart contract + * @param functionIdentifier the function name + * @param inputs the input parameters of the function to be invoked + * @param outputs the output parameters of the function to be invoked + * @param requiredConfidence the degree-of-confidence required to be achieved before sending a callback message to the invoker. + * @return a completable future that emits a new transaction object holding the result of the invocation. + * @throws NotSupportedException if the underlying blockchain system does not support smart contracts. + */ + CompletableFuture tryReplaceInvocation(String correlationId, String smartContractPath, + String functionIdentifier, + List typeArguments, + List inputs, + List outputs, + double requiredConfidence, + List signers, + long minimumNumberOfSignatures); + + void tryCancelInvocation(String correlationId); + } From 3a4d8d05462fd2b8619caee32ce39428ccd1bb9c Mon Sep 17 00:00:00 2001 From: Akshay Date: Wed, 30 Nov 2022 20:01:21 +0530 Subject: [PATCH 2/8] WIP --- .../de/api/interfaces/BlockchainAdapter.java | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/main/java/blockchains/iaas/uni/stuttgart/de/api/interfaces/BlockchainAdapter.java b/src/main/java/blockchains/iaas/uni/stuttgart/de/api/interfaces/BlockchainAdapter.java index 3172d6b..c0d54a0 100644 --- a/src/main/java/blockchains/iaas/uni/stuttgart/de/api/interfaces/BlockchainAdapter.java +++ b/src/main/java/blockchains/iaas/uni/stuttgart/de/api/interfaces/BlockchainAdapter.java @@ -126,12 +126,14 @@ CompletableFuture queryEvents(String smartContractAddress, String e */ String testConnection(); - void signInvocation(String correlationId, String signature); - List getPendingInvocations(); + boolean signInvocation(String correlationId, String signature); + + List getPendingInvocations(); /** * Replaces a smart contract function invocation with a new invocation. - * @param correlationId the identifier of the invocation which should be replaced with a new one + * + * @param correlationId the identifier of the invocation which should be replaced with a new one * @param smartContractPath the path to the smart contract * @param functionIdentifier the function name * @param inputs the input parameters of the function to be invoked @@ -141,13 +143,13 @@ CompletableFuture queryEvents(String smartContractAddress, String e * @throws NotSupportedException if the underlying blockchain system does not support smart contracts. */ CompletableFuture tryReplaceInvocation(String correlationId, String smartContractPath, - String functionIdentifier, - List typeArguments, - List inputs, - List outputs, - double requiredConfidence, - List signers, - long minimumNumberOfSignatures); + String functionIdentifier, + List typeArguments, + List inputs, + List outputs, + double requiredConfidence, + List signers, + long minimumNumberOfSignatures); void tryCancelInvocation(String correlationId); From f87953c73d71db7007feeb93f81a825b59f9665a Mon Sep 17 00:00:00 2001 From: Akshay Date: Wed, 11 Jan 2023 17:04:01 +0100 Subject: [PATCH 3/8] V2 changes --- pom.xml | 2 +- .../api/exceptions/CancelRejectedError.java | 31 +++++++++++++++++++ .../de/api/exceptions/ExceptionCode.java | 8 +++-- .../InvocationNotFoundException.java | 31 +++++++++++++++++++ .../api/exceptions/ReplaceRejectedError.java | 31 +++++++++++++++++++ .../de/api/interfaces/BlockchainAdapter.java | 27 ++++++---------- 6 files changed, 109 insertions(+), 21 deletions(-) create mode 100644 src/main/java/blockchains/iaas/uni/stuttgart/de/api/exceptions/CancelRejectedError.java create mode 100644 src/main/java/blockchains/iaas/uni/stuttgart/de/api/exceptions/InvocationNotFoundException.java create mode 100644 src/main/java/blockchains/iaas/uni/stuttgart/de/api/exceptions/ReplaceRejectedError.java diff --git a/pom.xml b/pom.xml index 8bd4556..f06c498 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ blockchains.iaas.uni.stuttgart.de blockchain-access-layer-api - 2.0.1-SNAPSHOT + 2.0.2 8 diff --git a/src/main/java/blockchains/iaas/uni/stuttgart/de/api/exceptions/CancelRejectedError.java b/src/main/java/blockchains/iaas/uni/stuttgart/de/api/exceptions/CancelRejectedError.java new file mode 100644 index 0000000..2d45696 --- /dev/null +++ b/src/main/java/blockchains/iaas/uni/stuttgart/de/api/exceptions/CancelRejectedError.java @@ -0,0 +1,31 @@ +/******************************************************************************** + * Copyright (c) 2023 Institute for the Architecture of Application System - + * University of Stuttgart + * Author: Akshay Patel + * + * This program and the accompanying materials are made available under the + * terms the Apache Software License 2.0 + * which is available at https://www.apache.org/licenses/LICENSE-2.0. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ +package blockchains.iaas.uni.stuttgart.de.api.exceptions; + +import com.github.arteam.simplejsonrpc.core.annotation.JsonRpcError; + +@JsonRpcError(code = ExceptionCode.CancelRejectedError, message = "The specified invocation cannot be cancelled") +public class CancelRejectedError extends BalException { + + public CancelRejectedError() { + super(); + } + + public CancelRejectedError(String message) { + super(message); + } + + @Override + public int getCode() { + return ExceptionCode.CancelRejectedError; + } +} diff --git a/src/main/java/blockchains/iaas/uni/stuttgart/de/api/exceptions/ExceptionCode.java b/src/main/java/blockchains/iaas/uni/stuttgart/de/api/exceptions/ExceptionCode.java index a242592..60a2b88 100644 --- a/src/main/java/blockchains/iaas/uni/stuttgart/de/api/exceptions/ExceptionCode.java +++ b/src/main/java/blockchains/iaas/uni/stuttgart/de/api/exceptions/ExceptionCode.java @@ -15,7 +15,7 @@ public class ExceptionCode { public static final int UnknownError = 0; /** - * The blockchain instance, smart contract, event or function are not found + * The blockchain instance, smart contract, or invocation, event or function are not found */ public static final int NotFound = -32000; /** @@ -74,6 +74,10 @@ public class ExceptionCode { */ public static final int Timeout = -32201; - public static final int InvocationAlreadyConfirmed = -32202; + public static final int CancelRejectedError = -32209; + + public static final int ReplaceRejectedError = -32210; + + public static final int InvalidMessageSignedError = -32211; } diff --git a/src/main/java/blockchains/iaas/uni/stuttgart/de/api/exceptions/InvocationNotFoundException.java b/src/main/java/blockchains/iaas/uni/stuttgart/de/api/exceptions/InvocationNotFoundException.java new file mode 100644 index 0000000..cc95bf9 --- /dev/null +++ b/src/main/java/blockchains/iaas/uni/stuttgart/de/api/exceptions/InvocationNotFoundException.java @@ -0,0 +1,31 @@ +/******************************************************************************** + * Copyright (c) 2023 Institute for the Architecture of Application System - + * University of Stuttgart + * Author: Akshay Patel + * + * This program and the accompanying materials are made available under the + * terms the Apache Software License 2.0 + * which is available at https://www.apache.org/licenses/LICENSE-2.0. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ +package blockchains.iaas.uni.stuttgart.de.api.exceptions; + +import com.github.arteam.simplejsonrpc.core.annotation.JsonRpcError; + +@JsonRpcError(code = ExceptionCode.NotFound, message = "The specified invocation with given correlation id cannot be found") +public class InvocationNotFoundException extends BalException { + + public InvocationNotFoundException() { + super(); + } + + public InvocationNotFoundException(String message) { + super(message); + } + + @Override + public int getCode() { + return ExceptionCode.NotFound; + } +} diff --git a/src/main/java/blockchains/iaas/uni/stuttgart/de/api/exceptions/ReplaceRejectedError.java b/src/main/java/blockchains/iaas/uni/stuttgart/de/api/exceptions/ReplaceRejectedError.java new file mode 100644 index 0000000..f8cd8c6 --- /dev/null +++ b/src/main/java/blockchains/iaas/uni/stuttgart/de/api/exceptions/ReplaceRejectedError.java @@ -0,0 +1,31 @@ +/******************************************************************************** + * Copyright (c) 2023 Institute for the Architecture of Application System - + * University of Stuttgart + * Author: Akshay Patel + * + * This program and the accompanying materials are made available under the + * terms the Apache Software License 2.0 + * which is available at https://www.apache.org/licenses/LICENSE-2.0. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ +package blockchains.iaas.uni.stuttgart.de.api.exceptions; + +import com.github.arteam.simplejsonrpc.core.annotation.JsonRpcError; + +@JsonRpcError(code = ExceptionCode.ReplaceRejectedError, message = "The specified invocation cannot be replaced") +public class ReplaceRejectedError extends BalException { + + public ReplaceRejectedError() { + super(); + } + + public ReplaceRejectedError(String message) { + super(message); + } + + @Override + public int getCode() { + return ExceptionCode.ReplaceRejectedError; + } +} diff --git a/src/main/java/blockchains/iaas/uni/stuttgart/de/api/interfaces/BlockchainAdapter.java b/src/main/java/blockchains/iaas/uni/stuttgart/de/api/interfaces/BlockchainAdapter.java index edad1e8..0b7b298 100644 --- a/src/main/java/blockchains/iaas/uni/stuttgart/de/api/interfaces/BlockchainAdapter.java +++ b/src/main/java/blockchains/iaas/uni/stuttgart/de/api/interfaces/BlockchainAdapter.java @@ -89,6 +89,8 @@ CompletableFuture invokeSmartContract( List outputs, double requiredConfidence, long timeoutMillis, + String signature, + String signer, List signers, long minimumNumberOfSignatures @@ -119,8 +121,10 @@ Observable subscribeToEvent(String smartContractAddress, String even * @param timeFrame The timeFrame in which to consider event occurrences. * @return A completable future containing a list of matching occurrences. */ - CompletableFuture queryEvents(String smartContractAddress, String eventIdentifier, List outputParameters, - String filter, TimeFrame timeFrame) throws BalException; + CompletableFuture queryEvents(String smartContractAddress, String eventIdentifier, + List typeArguments, List outputParameters, String filter, + TimeFrame timeFrame) + throws BalException; /** * Tests the connection settings with the underlying blockchain @@ -129,31 +133,18 @@ CompletableFuture queryEvents(String smartContractAddress, String e */ String testConnection(); - boolean signInvocation(String correlationId, String signature); - List getPendingInvocations(); - - /** - * Replaces a smart contract function invocation with a new invocation. - * - * @param correlationId the identifier of the invocation which should be replaced with a new one - * @param smartContractPath the path to the smart contract - * @param functionIdentifier the function name - * @param inputs the input parameters of the function to be invoked - * @param outputs the output parameters of the function to be invoked - * @param requiredConfidence the degree-of-confidence required to be achieved before sending a callback message to the invoker. - * @return a completable future that emits a new transaction object holding the result of the invocation. - * @throws NotSupportedException if the underlying blockchain system does not support smart contracts. - */ CompletableFuture tryReplaceInvocation(String correlationId, String smartContractPath, String functionIdentifier, List typeArguments, List inputs, List outputs, double requiredConfidence, + String signature, + String signer, List signers, long minimumNumberOfSignatures); - void tryCancelInvocation(String correlationId); + boolean tryCancelInvocation(String correlationId); } From f41f78233c356bafa22b46357e1ae464eb74348d Mon Sep 17 00:00:00 2001 From: Akshay Date: Wed, 11 Jan 2023 17:32:38 +0100 Subject: [PATCH 4/8] Fix build error --- pom.xml | 2 +- .../InvocationAlreadyConfirmedStateException.java | 15 --------------- 2 files changed, 1 insertion(+), 16 deletions(-) delete mode 100644 src/main/java/blockchains/iaas/uni/stuttgart/de/api/exceptions/InvocationAlreadyConfirmedStateException.java diff --git a/pom.xml b/pom.xml index f06c498..cf8678d 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ blockchains.iaas.uni.stuttgart.de blockchain-access-layer-api - 2.0.2 + 2.0.3 8 diff --git a/src/main/java/blockchains/iaas/uni/stuttgart/de/api/exceptions/InvocationAlreadyConfirmedStateException.java b/src/main/java/blockchains/iaas/uni/stuttgart/de/api/exceptions/InvocationAlreadyConfirmedStateException.java deleted file mode 100644 index 347d000..0000000 --- a/src/main/java/blockchains/iaas/uni/stuttgart/de/api/exceptions/InvocationAlreadyConfirmedStateException.java +++ /dev/null @@ -1,15 +0,0 @@ -package blockchains.iaas.uni.stuttgart.de.api.exceptions; - -public class InvocationAlreadyConfirmedStateException extends BalException { - @Override - public int getCode() { - return ExceptionCode.InvocationAlreadyConfirmed; - } - - public InvocationAlreadyConfirmedStateException() { - } - - public InvocationAlreadyConfirmedStateException(String message) { - super(message); - } -} From c21c3e3acf1ca17cd5a18cafde9fab4efa291b63 Mon Sep 17 00:00:00 2001 From: Akshay Date: Wed, 11 Jan 2023 19:04:29 +0100 Subject: [PATCH 5/8] Add interface methods for delegated subscriptions --- pom.xml | 2 +- .../de/api/interfaces/BlockchainAdapter.java | 34 ++++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index cf8678d..40ffca2 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ blockchains.iaas.uni.stuttgart.de blockchain-access-layer-api - 2.0.3 + 2.0.4 8 diff --git a/src/main/java/blockchains/iaas/uni/stuttgart/de/api/interfaces/BlockchainAdapter.java b/src/main/java/blockchains/iaas/uni/stuttgart/de/api/interfaces/BlockchainAdapter.java index 0b7b298..104f30e 100644 --- a/src/main/java/blockchains/iaas/uni/stuttgart/de/api/interfaces/BlockchainAdapter.java +++ b/src/main/java/blockchains/iaas/uni/stuttgart/de/api/interfaces/BlockchainAdapter.java @@ -1,7 +1,8 @@ /******************************************************************************** - * Copyright (c) 2018-2022 Institute for the Architecture of Application System - + * Copyright (c) 2018-2023 Institute for the Architecture of Application System - * University of Stuttgart * Author: Ghareeb Falazi + * Co-author: Akshay Patel * * This program and the accompanying materials are made available under the * terms the Apache Software License 2.0 @@ -16,6 +17,8 @@ import blockchains.iaas.uni.stuttgart.de.api.exceptions.InvalidTransactionException; import blockchains.iaas.uni.stuttgart.de.api.exceptions.NotSupportedException; import blockchains.iaas.uni.stuttgart.de.api.model.*; +import com.github.arteam.simplejsonrpc.core.annotation.JsonRpcOptional; +import com.github.arteam.simplejsonrpc.core.annotation.JsonRpcParam; import io.reactivex.Observable; import java.math.BigDecimal; @@ -147,4 +150,33 @@ CompletableFuture tryReplaceInvocation(String correlationId, String boolean tryCancelInvocation(String correlationId); + /* + * This method should be implemented by the plugin to indicate whether the plugin is capable of handling subscription + * and the callbacks both. + * */ + boolean canHandleDelegatedSubscription(); + + /* + * This method is an alternative to initial gateway implementation where the gateway acts as a centralized entity + * and handles subscriptions and callbacks. Using this method, a plugin can must invoke callbacks on its own rather + * than gateway managing the callbacks. + * */ + boolean delegatedSubscribe(String functionIdentifier, + String eventIdentifier, + List outputParameters, + double degreeOfConfidence, + String filter, + String callbackUrl, + String correlationId); + + /* + * This method is an alternative to initial gateway implementation where the gateway acts as a centralized entity + * and handles subscriptions, callbacks and cancelling subscriptions. + * */ + boolean delegatedUnsubscribe(String functionIdentifier, + String eventIdentifier, + List typeArguments, + List parameters, + String correlationId); + } From ee1037af2145da379640aa38e260d5b26de683ae Mon Sep 17 00:00:00 2001 From: Akshay Date: Wed, 11 Jan 2023 19:30:23 +0100 Subject: [PATCH 6/8] Update delegated unsubscribe method --- pom.xml | 2 +- .../uni/stuttgart/de/api/interfaces/BlockchainAdapter.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 40ffca2..53ce547 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ blockchains.iaas.uni.stuttgart.de blockchain-access-layer-api - 2.0.4 + 2.0.5 8 diff --git a/src/main/java/blockchains/iaas/uni/stuttgart/de/api/interfaces/BlockchainAdapter.java b/src/main/java/blockchains/iaas/uni/stuttgart/de/api/interfaces/BlockchainAdapter.java index 104f30e..dc269cc 100644 --- a/src/main/java/blockchains/iaas/uni/stuttgart/de/api/interfaces/BlockchainAdapter.java +++ b/src/main/java/blockchains/iaas/uni/stuttgart/de/api/interfaces/BlockchainAdapter.java @@ -173,7 +173,8 @@ boolean delegatedSubscribe(String functionIdentifier, * This method is an alternative to initial gateway implementation where the gateway acts as a centralized entity * and handles subscriptions, callbacks and cancelling subscriptions. * */ - boolean delegatedUnsubscribe(String functionIdentifier, + boolean delegatedUnsubscribe(String smartContractPath, + String functionIdentifier, String eventIdentifier, List typeArguments, List parameters, From 3d44c60e7fc653c31896b0aa1d82fdfce2b8bb87 Mon Sep 17 00:00:00 2001 From: Akshay Date: Sun, 29 Jan 2023 21:55:29 +0100 Subject: [PATCH 7/8] Update to version 2.0.6 --- pom.xml | 7 ++++++- .../uni/stuttgart/de/api/interfaces/BlockchainAdapter.java | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 53ce547..0eb4d31 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ blockchains.iaas.uni.stuttgart.de blockchain-access-layer-api - 2.0.5 + 2.0.6 8 @@ -61,5 +61,10 @@ 5.4.0 test + + org.apache.commons + commons-lang3 + 3.12.0 + \ No newline at end of file diff --git a/src/main/java/blockchains/iaas/uni/stuttgart/de/api/interfaces/BlockchainAdapter.java b/src/main/java/blockchains/iaas/uni/stuttgart/de/api/interfaces/BlockchainAdapter.java index dc269cc..8533033 100644 --- a/src/main/java/blockchains/iaas/uni/stuttgart/de/api/interfaces/BlockchainAdapter.java +++ b/src/main/java/blockchains/iaas/uni/stuttgart/de/api/interfaces/BlockchainAdapter.java @@ -17,9 +17,8 @@ import blockchains.iaas.uni.stuttgart.de.api.exceptions.InvalidTransactionException; import blockchains.iaas.uni.stuttgart.de.api.exceptions.NotSupportedException; import blockchains.iaas.uni.stuttgart.de.api.model.*; -import com.github.arteam.simplejsonrpc.core.annotation.JsonRpcOptional; -import com.github.arteam.simplejsonrpc.core.annotation.JsonRpcParam; import io.reactivex.Observable; +import org.apache.commons.lang3.tuple.ImmutablePair; import java.math.BigDecimal; import java.util.List; @@ -95,6 +94,7 @@ CompletableFuture invokeSmartContract( String signature, String signer, List signers, + List> signatures, long minimumNumberOfSignatures ) throws BalException; From dcf61a040a0d4d7502f216991b4c03147b5d67e8 Mon Sep 17 00:00:00 2001 From: Akshay Date: Sun, 5 Feb 2023 23:12:50 +0100 Subject: [PATCH 8/8] Add new exception type: InsufficientFunds --- pom.xml | 2 +- .../InsufficientFundsException.java | 32 +++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 src/main/java/blockchains/iaas/uni/stuttgart/de/api/exceptions/InsufficientFundsException.java diff --git a/pom.xml b/pom.xml index 0eb4d31..8390e8f 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ blockchains.iaas.uni.stuttgart.de blockchain-access-layer-api - 2.0.6 + 2.0.7 8 diff --git a/src/main/java/blockchains/iaas/uni/stuttgart/de/api/exceptions/InsufficientFundsException.java b/src/main/java/blockchains/iaas/uni/stuttgart/de/api/exceptions/InsufficientFundsException.java new file mode 100644 index 0000000..daaaacf --- /dev/null +++ b/src/main/java/blockchains/iaas/uni/stuttgart/de/api/exceptions/InsufficientFundsException.java @@ -0,0 +1,32 @@ +/******************************************************************************** + * Copyright (c) 2023 Institute for the Architecture of Application System - + * University of Stuttgart + * Author: Akshay Patel + * + * This program and the accompanying materials are made available under the + * terms the Apache Software License 2.0 + * which is available at https://www.apache.org/licenses/LICENSE-2.0. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ +package blockchains.iaas.uni.stuttgart.de.api.exceptions; + +import com.github.arteam.simplejsonrpc.core.annotation.JsonRpcError; + +@JsonRpcError(code = ExceptionCode.InsufficientFunds, message = "Not enough funds to invoke the state-changing\n" + + "smart contract function.") +public class InsufficientFundsException extends BalException { + + public InsufficientFundsException() { + super(); + } + + public InsufficientFundsException(String message) { + super(message); + } + + @Override + public int getCode() { + return ExceptionCode.InsufficientFunds; + } +}