├── .gitignore ├── .idea └── codeStyles │ └── codeStyleConfig.xml ├── .travis.yml ├── CONTRIBUTING.md ├── EXAMPLES.md ├── LICENSE ├── README.md ├── build.gradle ├── docs └── temp.txt ├── documents ├── complete_workflow.pdf └── error_model.pdf ├── eosiojava ├── build.gradle └── src │ ├── main │ └── java │ │ └── one │ │ └── block │ │ └── eosiojava │ │ ├── enums │ │ ├── AlgorithmEmployed.java │ │ └── package-info.java │ │ ├── error │ │ ├── EosioError.java │ │ ├── ErrorConstants.java │ │ ├── abiProvider │ │ │ ├── AbiProviderError.java │ │ │ ├── GetAbiError.java │ │ │ └── package-info.java │ │ ├── package-info.java │ │ ├── rpcProvider │ │ │ ├── GetBlockInfoRpcError.java │ │ │ ├── GetBlockRpcError.java │ │ │ ├── GetInfoRpcError.java │ │ │ ├── GetRawAbiRpcError.java │ │ │ ├── GetRequiredKeysRpcError.java │ │ │ ├── PushTransactionRpcError.java │ │ │ ├── RpcProviderError.java │ │ │ ├── SendTransactionRpcError.java │ │ │ └── package-info.java │ │ ├── serializationProvider │ │ │ ├── DeserializeAbiError.java │ │ │ ├── DeserializeError.java │ │ │ ├── DeserializePackedTransactionError.java │ │ │ ├── DeserializeTransactionError.java │ │ │ ├── SerializationProviderError.java │ │ │ ├── SerializeAbiError.java │ │ │ ├── SerializeError.java │ │ │ ├── SerializePackedTransactionError.java │ │ │ ├── SerializeTransactionError.java │ │ │ └── package-info.java │ │ ├── session │ │ │ ├── TransactionBroadCastEmptySignatureError.java │ │ │ ├── TransactionBroadCastError.java │ │ │ ├── TransactionCreateSignatureRequestAbiError.java │ │ │ ├── TransactionCreateSignatureRequestEmptyAvailableKeyError.java │ │ │ ├── TransactionCreateSignatureRequestError.java │ │ │ ├── TransactionCreateSignatureRequestKeyError.java │ │ │ ├── TransactionCreateSignatureRequestRequiredKeysEmptyError.java │ │ │ ├── TransactionCreateSignatureRequestRequiredKeysError.java │ │ │ ├── TransactionCreateSignatureRequestRpcError.java │ │ │ ├── TransactionCreateSignatureRequestSerializationError.java │ │ │ ├── TransactionGetSignatureDeserializationError.java │ │ │ ├── TransactionGetSignatureError.java │ │ │ ├── TransactionGetSignatureNotAllowModifyTransactionError.java │ │ │ ├── TransactionGetSignatureSigningError.java │ │ │ ├── TransactionPrepareError.java │ │ │ ├── TransactionPrepareInputError.java │ │ │ ├── TransactionPrepareRpcError.java │ │ │ ├── TransactionProcessorConstructorInputError.java │ │ │ ├── TransactionProcessorError.java │ │ │ ├── TransactionPushTransactionError.java │ │ │ ├── TransactionSendTransactionError.java │ │ │ ├── TransactionSerializeError.java │ │ │ ├── TransactionSignAndBroadCastError.java │ │ │ ├── TransactionSignError.java │ │ │ └── package-info.java │ │ ├── signatureProvider │ │ │ ├── GetAvailableKeysError.java │ │ │ ├── SignTransactionError.java │ │ │ ├── SignatureProviderError.java │ │ │ └── package-info.java │ │ └── utilities │ │ │ ├── Base58ManipulationError.java │ │ │ ├── DerToPemConversionError.java │ │ │ ├── EOSFormatterError.java │ │ │ ├── EosFormatterSignatureIsNotCanonicalError.java │ │ │ ├── LowSVerificationError.java │ │ │ ├── PEMProcessorError.java │ │ │ └── package-info.java │ │ ├── implementations │ │ ├── ABIProviderImpl.java │ │ └── package-info.java │ │ ├── interfaces │ │ ├── IABIProvider.java │ │ ├── IRPCProvider.java │ │ ├── ISerializationProvider.java │ │ ├── ISignatureProvider.java │ │ └── package-info.java │ │ ├── models │ │ ├── AbiEosSerializationObject.java │ │ ├── EOSIOName.java │ │ ├── package-info.java │ │ ├── rpcProvider │ │ │ ├── Action.java │ │ │ ├── Authorization.java │ │ │ ├── ContextFreeData.java │ │ │ ├── EosioEndPoint.java │ │ │ ├── RPCConfig.java │ │ │ ├── Transaction.java │ │ │ ├── TransactionConfig.java │ │ │ ├── package-info.java │ │ │ ├── request │ │ │ │ ├── GetBlockInfoRequest.java │ │ │ │ ├── GetBlockRequest.java │ │ │ │ ├── GetRawAbiRequest.java │ │ │ │ ├── GetRequiredKeysRequest.java │ │ │ │ ├── PushTransactionRequest.java │ │ │ │ ├── SendTransactionRequest.java │ │ │ │ └── package-info.java │ │ │ └── response │ │ │ │ ├── Detail.java │ │ │ │ ├── GetBlockInfoResponse.java │ │ │ │ ├── GetBlockResponse.java │ │ │ │ ├── GetInfoResponse.java │ │ │ │ ├── GetRawAbiResponse.java │ │ │ │ ├── GetRequiredKeysResponse.java │ │ │ │ ├── PushTransactionResponse.java │ │ │ │ ├── RPCResponseError.java │ │ │ │ ├── RpcError.java │ │ │ │ ├── SendTransactionResponse.java │ │ │ │ └── package-info.java │ │ └── signatureProvider │ │ │ ├── BinaryAbi.java │ │ │ ├── EosioTransactionSignatureRequest.java │ │ │ ├── EosioTransactionSignatureResponse.java │ │ │ └── package-info.java │ │ ├── session │ │ ├── TransactionProcessor.java │ │ ├── TransactionSession.java │ │ └── package-info.java │ │ └── utilities │ │ ├── ByteFormatter.java │ │ ├── DateFormatter.java │ │ ├── EOSFormatter.java │ │ ├── PEMProcessor.java │ │ ├── Utils.java │ │ └── package-info.java │ └── test │ └── java │ └── one │ └── block │ └── eosiojava │ ├── ABIProviderTest.java │ ├── DateFormatterTest.java │ ├── EOSFormatterTest.java │ ├── EosioErrorTest.java │ ├── PEMProcessorTest.java │ ├── RpcModelTest.java │ ├── models │ ├── ActionTest.java │ ├── ContextFreeDataTest.java │ └── EosioTransactionSignatureRequestTest.java │ └── session │ ├── NegativeTransactionProcessorTest.java │ ├── TransactionProcessorTest.java │ └── TransactionSessionTest.java ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── img ├── Android_Robot.png └── java-logo.png ├── scripts └── deploy-artifactory.sh └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm 2 | .idea/ 3 | *.iml 4 | 5 | local.properties 6 | 7 | # CMake 8 | cmake-build-*/ 9 | 10 | # File-based project format 11 | *.iws 12 | 13 | # IntelliJ 14 | out/ 15 | 16 | # mpeltonen/sbt-idea plugin 17 | .idea_modules/ 18 | 19 | # JIRA plugin 20 | atlassian-ide-plugin.xml 21 | 22 | # Crashlytics plugin (for Android Studio and IntelliJ) 23 | com_crashlytics_export_strings.xml 24 | crashlytics.properties 25 | crashlytics-build.properties 26 | fabric.properties 27 | 28 | ### Java ### 29 | *.class 30 | 31 | # Mobile Tools for Java (J2ME) 32 | .mtj.tmp/ 33 | 34 | # Package Files # 35 | *.jar 36 | *.war 37 | *.ear 38 | 39 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 40 | hs_err_pid* 41 | 42 | ### Gradle ### 43 | .gradle 44 | /build/ 45 | /**/build/ 46 | 47 | # Ignore Gradle GUI config 48 | gradle-app.setting 49 | 50 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) 51 | !gradle-wrapper.jar 52 | 53 | # Cache of project 54 | .gradletasknamecache 55 | 56 | # # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 57 | # gradle/wrapper/gradle-wrapper.properties 58 | gradle.properties 59 | 60 | # OS generated files # 61 | ###################### 62 | .DS_Store 63 | -------------------------------------------------------------------------------- /.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | jdk: oraclejdk11 3 | dist: trusty 4 | before_cache: 5 | - "rm -f $HOME/.gradle/caches/modules-2/modules-2.lock" 6 | - "rm -fr $HOME/.gradle/caches/*/plugin-resolution/" 7 | before_install: 8 | - echo "artifactory_username=$ARTIFACTORY_USERNAME" > gradle.properties 9 | - echo "artifactory_password=$ARTIFACTORY_PASSWORD" >> gradle.properties 10 | - echo "artifactory_path_android_libraries=https://blockone.jfrog.io/blockone/android-libs" >> gradle.properties 11 | - echo "artifactory_contextURL=https://blockone.jfrog.io/blockone" >> gradle.properties 12 | - echo "artifactory_repo=default" >> gradle.properties 13 | 14 | before_deploy: 15 | - echo "artifactory_username=$ARTIFACTORY_USERNAME" > gradle.properties 16 | - echo "artifactory_password=$ARTIFACTORY_PASSWORD" >> gradle.properties 17 | - echo "artifactory_path_android_libraries=https://blockone.jfrog.io/blockone/android-libs" >> gradle.properties 18 | - echo "artifactory_contextURL=https://blockone.jfrog.io/blockone" >> gradle.properties 19 | - echo "artifactory_repo=default" >> gradle.properties 20 | 21 | deploy: 22 | - skip_cleanup: true 23 | # feature branches deploy to feature-local 24 | - provider: script 25 | skip_cleanup: true 26 | script: "bash scripts/deploy-artifactory.sh 'android-libs-feature-local'" 27 | on: 28 | all_branches: true 29 | condition: ${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH} =~ ^feature\/.*$ 30 | # develop deploys to dev local 31 | - provider: script 32 | skip_cleanup: true 33 | script: "bash scripts/deploy-artifactory.sh 'android-libs-dev-local'" 34 | on: 35 | branch: 36 | - develop 37 | # release branches and master deploy to release local 38 | - provider: script 39 | skip_cleanup: true 40 | script: "bash scripts/deploy-artifactory.sh 'android-libs-release-local'" 41 | on: 42 | all_branches: true 43 | condition: $TRAVIS_BRANCH == master || ${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH} =~ ^release\/.*$ 44 | # tagged releases from master, go to distribution 45 | - provider: script 46 | skip_cleanup: true 47 | script: "bash scripts/deploy-artifactory.sh 'eosiojava-product-eosio-dist'" 48 | on: 49 | tags: true 50 | branch: master 51 | 52 | after_deploy: 53 | - echo "cleaning up properties" 54 | - rm gradle.properties 55 | 56 | cache: 57 | directories: 58 | - $HOME/.gradle/caches/ 59 | - $HOME/.gradle/wrapper/ 60 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017-2019 block.one and its contributors. All rights reserved. 2 | 3 | The MIT License 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | buildscript { 5 | repositories { 6 | mavenCentral() 7 | } 8 | } 9 | 10 | allprojects { 11 | repositories { 12 | mavenCentral() 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /docs/temp.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /documents/complete_workflow.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EOSIO/eosio-java/dd0dbd2e6e15a5ac799de40c633126b90e82116e/documents/complete_workflow.pdf -------------------------------------------------------------------------------- /documents/error_model.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EOSIO/eosio-java/dd0dbd2e6e15a5ac799de40c633126b90e82116e/documents/error_model.pdf -------------------------------------------------------------------------------- /eosiojava/build.gradle: -------------------------------------------------------------------------------- 1 | 2 | plugins { 3 | id 'java-library' 4 | //Remove 'com.jfrog.artifactory' plugin if you are not using Artifactory 5 | id 'com.jfrog.artifactory' version '4.9.5' 6 | //Remove 'com.jfrog.bintray' plugin if you are not using Bintray 7 | id 'com.jfrog.bintray' version '1.7.3' 8 | id 'maven-publish' 9 | 10 | } 11 | 12 | group 'one.block' 13 | 14 | repositories { 15 | jcenter() 16 | mavenCentral() 17 | 18 | //Remove maven{} block if you are not using Artifactory 19 | maven { 20 | credentials{ 21 | username artifactory_username 22 | password artifactory_password 23 | } 24 | url artifactory_contextURL 25 | } 26 | } 27 | sourceCompatibility = 1.8 28 | targetCompatibility = 1.8 29 | dependencies { 30 | api 'org.jetbrains:annotations:16.0.1' 31 | api 'com.google.code.gson:gson:2.8.5' 32 | api 'org.bouncycastle:bcprov-jdk15on:1.61' 33 | api 'org.bouncycastle:bcpkix-jdk15on:1.61' 34 | // This works on android and non-android, but is necessary to keep us to 1.7 targets. 35 | api 'com.google.guava:guava:27.1-android' 36 | testCompile 'junit:junit:4.12' 37 | testCompile 'org.mockito:mockito-core:2.26.0' 38 | api 'org.bitcoinj:bitcoinj-core:0.15.2' 39 | api 'org.slf4j:slf4j-jdk14:1.7.25' 40 | } 41 | 42 | test { 43 | testLogging { 44 | events "passed", "skipped", "failed" 45 | } 46 | } 47 | 48 | def libraryGroupId = 'one.block' 49 | def libraryArtifactId = 'eosiojava' 50 | def libraryVersion = '1.0.0' 51 | 52 | task sourcesJar(type: Jar, dependsOn: classes){ 53 | classifier = 'sources' 54 | from sourceSets.main.allSource 55 | } 56 | 57 | javadoc.failOnError = false 58 | task javadocJar(type: Jar, dependsOn: javadoc){ 59 | classifier = 'javadoc' 60 | from javadoc.destinationDir 61 | } 62 | 63 | artifacts { 64 | archives sourcesJar 65 | archives javadocJar 66 | } 67 | 68 | publishing { 69 | publications { 70 | jar(MavenPublication) { 71 | from components.java 72 | 73 | artifact sourcesJar { 74 | classifier "sources" 75 | } 76 | 77 | artifact javadocJar { 78 | classifier "javadoc" 79 | } 80 | 81 | groupId libraryGroupId 82 | version libraryVersion 83 | artifactId libraryArtifactId 84 | 85 | artifact("$buildDir/libs/${artifactId}.jar") 86 | } 87 | } 88 | } 89 | 90 | //Remove artifactory{} block if you are not using Artifactory 91 | artifactory { 92 | contextUrl = artifactory_contextURL 93 | publish { 94 | repository { 95 | repoKey = artifactory_repo 96 | 97 | username = artifactory_username 98 | password = artifactory_password 99 | } 100 | defaults { 101 | publications('jar') 102 | publishArtifacts = true 103 | 104 | properties = ['qa.level': 'basic', 'q.os': 'android', 'dev.team': 'core'] 105 | publishPom = true 106 | } 107 | } 108 | } 109 | 110 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/enums/AlgorithmEmployed.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.enums; 2 | 3 | /** 4 | * Enum of supported algorithms which are employed in eosio-java library 5 | */ 6 | public enum AlgorithmEmployed { 7 | /** 8 | * Supported SECP256r1 (prime256v1) algorithm curve 9 | */ 10 | SECP256R1("secp256r1"), 11 | 12 | /** 13 | * Supported SECP256k1 algorithm curve 14 | */ 15 | SECP256K1("secp256k1"), 16 | 17 | /** 18 | * Supported prime256v1 algorithm curve 19 | */ 20 | PRIME256V1("prime256v1"); 21 | 22 | private String str; 23 | 24 | /** 25 | * Initialize AlgorithmEmployed enum object with a String value 26 | * @param str - input String value of enums in AlgorithmEmployed 27 | */ 28 | AlgorithmEmployed(String str) { 29 | this.str = str; 30 | } 31 | 32 | /** 33 | * Gets string value of AlgorithmEmployed's enum 34 | * @return string value of AlgorithmEmployed's enum 35 | */ 36 | public String getString() { 37 | return str; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/enums/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2019 block.one all rights reserved. 3 | */ 4 | 5 | /** 6 | * Provides the enums necessary for using in eosio-java core. 7 | */ 8 | 9 | package one.block.eosiojava.enums; -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/EosioError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error; 2 | 3 | import com.google.gson.Gson; 4 | import com.google.gson.GsonBuilder; 5 | import com.google.gson.JsonObject; 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | /** 9 | * Error class is used when there is an exception while attempting to process anything inside the 10 | * Eosio-java library 11 | */ 12 | public class EosioError extends Exception { 13 | 14 | /** 15 | * Create an EosioError with a null message and original exception. 16 | */ 17 | public EosioError() { 18 | super(); 19 | } 20 | 21 | /** 22 | * Construct an EosioError with the given message. 23 | * 24 | * @param message - Message text for the exception. 25 | */ 26 | public EosioError(@NotNull String message) { 27 | super(message); 28 | } 29 | 30 | /** 31 | * Construct an EosioError with the given message and original exception. 32 | * 33 | * @param message - Message text for the exception. 34 | * @param exception - Original root exception for the error. 35 | */ 36 | public EosioError(@NotNull String message, @NotNull Exception exception) { 37 | super(message, exception); 38 | } 39 | 40 | /** 41 | * Construct an EosioError with the given original exception. 42 | * 43 | * @param exception - Original root exception for the error. 44 | */ 45 | public EosioError(@NotNull Exception exception) { 46 | super(exception); 47 | } 48 | 49 | /** 50 | * Construct a JSON formatted string describing the error code and reason. 51 | * 52 | * @return A JSON formatted string 53 | */ 54 | @NotNull 55 | public String asJsonString() { 56 | JsonObject errInfo = new JsonObject(); 57 | errInfo.addProperty("errorCode", this.getClass().getSimpleName()); 58 | errInfo.addProperty("reason", this.getLocalizedMessage()); 59 | JsonObject err = new JsonObject(); 60 | err.addProperty("errorType", "EosioError"); 61 | err.add("errorInfo", errInfo); 62 | Gson gson = new GsonBuilder().setPrettyPrinting().create(); 63 | String jsonString = gson.toJson(err); 64 | return jsonString; 65 | } 66 | 67 | } 68 | 69 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/abiProvider/AbiProviderError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.abiProvider; 2 | 3 | import one.block.eosiojava.error.EosioError; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | /** 7 | * Error class is used when there is an exception while attempting to call any method in an 8 | * AbiProvider implementation. 9 | */ 10 | public class AbiProviderError extends EosioError { 11 | 12 | public AbiProviderError() { 13 | } 14 | 15 | public AbiProviderError(@NotNull String message) { 16 | super(message); 17 | } 18 | 19 | public AbiProviderError(@NotNull String message, 20 | @NotNull Exception exception) { 21 | super(message, exception); 22 | } 23 | 24 | public AbiProviderError(@NotNull Exception exception) { 25 | super(exception); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/abiProvider/GetAbiError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.abiProvider; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | /** 6 | * Error class is used when there is an exception while attempting to call the GetAbi or GetAbis methods 7 | * of IABIProvider {@link one.block.eosiojava.interfaces.IABIProvider}. 8 | */ 9 | public class GetAbiError extends AbiProviderError { 10 | 11 | public GetAbiError() { 12 | } 13 | 14 | public GetAbiError(@NotNull String message) { 15 | super(message); 16 | } 17 | 18 | public GetAbiError(@NotNull String message, 19 | @NotNull Exception exception) { 20 | super(message, exception); 21 | } 22 | 23 | public GetAbiError(@NotNull Exception exception) { 24 | super(exception); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/abiProvider/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Provides the classes necessary for describe meaningful exceptions that occur during an ABI Provider implementation like: 3 | * {@link one.block.eosiojava.error.abiProvider.GetAbiError} 4 | */ 5 | 6 | package one.block.eosiojava.error.abiProvider; -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Provides the classes/constants necessary to describe meaningful exceptions that occur in all processes 3 | * of eosio-java like: 4 | * {@link one.block.eosiojava.session.TransactionProcessor} transaction processing flow, 5 | * {@link one.block.eosiojava.utilities.EOSFormatter} utilities and other processes. 6 | */ 7 | 8 | package one.block.eosiojava.error; -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/rpcProvider/GetBlockInfoRpcError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.rpcProvider; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | /** 6 | * Error class is used when there is an exception while attempting to use the RPC call, getBlockInfo(). 7 | */ 8 | public class GetBlockInfoRpcError extends RpcProviderError{ 9 | 10 | public GetBlockInfoRpcError() { 11 | } 12 | 13 | public GetBlockInfoRpcError(@NotNull String message) { 14 | super(message); 15 | } 16 | 17 | public GetBlockInfoRpcError(@NotNull String message, 18 | @NotNull Exception exception) { 19 | super(message, exception); 20 | } 21 | 22 | public GetBlockInfoRpcError(@NotNull Exception exception) { 23 | super(exception); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/rpcProvider/GetBlockRpcError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.rpcProvider; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | /** 6 | * Error class is used when there is an exception while attempting to use the RPC call, getBlock(). 7 | */ 8 | public class GetBlockRpcError extends RpcProviderError{ 9 | 10 | public GetBlockRpcError() { 11 | } 12 | 13 | public GetBlockRpcError(@NotNull String message) { 14 | super(message); 15 | } 16 | 17 | public GetBlockRpcError(@NotNull String message, 18 | @NotNull Exception exception) { 19 | super(message, exception); 20 | } 21 | 22 | public GetBlockRpcError(@NotNull Exception exception) { 23 | super(exception); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/rpcProvider/GetInfoRpcError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.rpcProvider; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | /** 6 | * Error class is used when there is an exception while attempting to use the RPC call, getInfo(). 7 | */ 8 | public class GetInfoRpcError extends RpcProviderError{ 9 | 10 | public GetInfoRpcError() { 11 | } 12 | 13 | public GetInfoRpcError(@NotNull String message) { 14 | super(message); 15 | } 16 | 17 | public GetInfoRpcError(@NotNull String message, 18 | @NotNull Exception exception) { 19 | super(message, exception); 20 | } 21 | 22 | public GetInfoRpcError(@NotNull Exception exception) { 23 | super(exception); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/rpcProvider/GetRawAbiRpcError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.rpcProvider; 2 | 3 | import one.block.eosiojava.error.EosioError; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | /** 7 | * Error class is used when there is an exception while attempting to use the RPC call, getRawAbi(). 8 | */ 9 | public class GetRawAbiRpcError extends EosioError { 10 | 11 | public GetRawAbiRpcError() { 12 | } 13 | 14 | public GetRawAbiRpcError(@NotNull String message) { 15 | super(message); 16 | } 17 | 18 | public GetRawAbiRpcError(@NotNull String message, 19 | @NotNull Exception exception) { 20 | super(message, exception); 21 | } 22 | 23 | public GetRawAbiRpcError(@NotNull Exception exception) { 24 | super(exception); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/rpcProvider/GetRequiredKeysRpcError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.rpcProvider; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | /** 6 | * Error class is used when there is an exception while attempting to use the RPC call, 7 | * getRequiredKeys(). 8 | */ 9 | public class GetRequiredKeysRpcError extends RpcProviderError { 10 | 11 | public GetRequiredKeysRpcError() { 12 | } 13 | 14 | public GetRequiredKeysRpcError(@NotNull String message) { 15 | super(message); 16 | } 17 | 18 | public GetRequiredKeysRpcError(@NotNull String message, 19 | @NotNull Exception exception) { 20 | super(message, exception); 21 | } 22 | 23 | public GetRequiredKeysRpcError(@NotNull Exception exception) { 24 | super(exception); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/rpcProvider/PushTransactionRpcError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.rpcProvider; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | /** 6 | * Error class is used when there is an exception while attempting to use the RPC call, 7 | * pushTransaction(). 8 | */ 9 | public class PushTransactionRpcError extends RpcProviderError { 10 | 11 | public PushTransactionRpcError() { 12 | } 13 | 14 | public PushTransactionRpcError(@NotNull String message) { 15 | super(message); 16 | } 17 | 18 | public PushTransactionRpcError(@NotNull String message, 19 | @NotNull Exception exception) { 20 | super(message, exception); 21 | } 22 | 23 | public PushTransactionRpcError(@NotNull Exception exception) { 24 | super(exception); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/rpcProvider/RpcProviderError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.rpcProvider; 2 | 3 | import one.block.eosiojava.error.EosioError; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | /** 7 | * Error class is used when there is an exception while attempting to use any RPC call. 8 | *
9 | * Any exception class which is used in an RPC Provider should extend this Error class. 10 | */ 11 | public class RpcProviderError extends EosioError { 12 | 13 | public RpcProviderError() { 14 | } 15 | 16 | public RpcProviderError(@NotNull String message) { 17 | super(message); 18 | } 19 | 20 | public RpcProviderError(@NotNull String message, 21 | @NotNull Exception exception) { 22 | super(message, exception); 23 | } 24 | 25 | public RpcProviderError(@NotNull Exception exception) { 26 | super(exception); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/rpcProvider/SendTransactionRpcError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.rpcProvider; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | /** 6 | * Error class is used when there is an exception while attempting to use the RPC call, 7 | * sendTransaction(). 8 | */ 9 | public class SendTransactionRpcError extends RpcProviderError { 10 | 11 | public SendTransactionRpcError() { 12 | } 13 | 14 | public SendTransactionRpcError(@NotNull String message) { 15 | super(message); 16 | } 17 | 18 | public SendTransactionRpcError(@NotNull String message, 19 | @NotNull Exception exception) { 20 | super(message, exception); 21 | } 22 | 23 | public SendTransactionRpcError(@NotNull Exception exception) { 24 | super(exception); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/rpcProvider/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Provides the classes necessary for describe meaningful exceptions that occur during an PRC Provider implementation like: 3 | * {@link one.block.eosiojava.error.rpcProvider.GetInfoRpcError} 4 | */ 5 | 6 | package one.block.eosiojava.error.rpcProvider; -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/serializationProvider/DeserializeAbiError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.serializationProvider; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | /** 6 | * Error class is used when there is an exception while attempting to call deserializeAbi() of 7 | * Serialization Provider 8 | */ 9 | public class DeserializeAbiError extends SerializationProviderError { 10 | 11 | public DeserializeAbiError() { 12 | } 13 | 14 | public DeserializeAbiError(@NotNull String message) { 15 | super(message); 16 | } 17 | 18 | public DeserializeAbiError(@NotNull String message, 19 | @NotNull Exception exception) { 20 | super(message, exception); 21 | } 22 | 23 | public DeserializeAbiError(@NotNull Exception exception) { 24 | super(exception); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/serializationProvider/DeserializeError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.serializationProvider; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | /** 6 | * Error class is used when there is an exception while attempting to call deserialize() of 7 | * Serialization Provider 8 | */ 9 | public class DeserializeError extends SerializationProviderError { 10 | 11 | public DeserializeError() { 12 | } 13 | 14 | public DeserializeError(@NotNull String message) { 15 | super(message); 16 | } 17 | 18 | public DeserializeError(@NotNull String message, 19 | @NotNull Exception exception) { 20 | super(message, exception); 21 | } 22 | 23 | public DeserializeError(@NotNull Exception exception) { 24 | super(exception); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/serializationProvider/DeserializePackedTransactionError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.serializationProvider; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | /** 6 | * Error class is used when there is an exception while attempting to call deserializeTransaction() 7 | * of Serialization Provider 8 | */ 9 | public class DeserializePackedTransactionError extends SerializationProviderError { 10 | 11 | public DeserializePackedTransactionError() { 12 | } 13 | 14 | public DeserializePackedTransactionError(@NotNull String message) { 15 | super(message); 16 | } 17 | 18 | public DeserializePackedTransactionError(@NotNull String message, 19 | @NotNull Exception exception) { 20 | super(message, exception); 21 | } 22 | 23 | public DeserializePackedTransactionError(@NotNull Exception exception) { 24 | super(exception); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/serializationProvider/DeserializeTransactionError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.serializationProvider; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | /** 6 | * Error class is used when there is an exception while attempting to call deserializeTransaction() 7 | * of Serialization Provider 8 | */ 9 | public class DeserializeTransactionError extends SerializationProviderError { 10 | 11 | public DeserializeTransactionError() { 12 | } 13 | 14 | public DeserializeTransactionError(@NotNull String message) { 15 | super(message); 16 | } 17 | 18 | public DeserializeTransactionError(@NotNull String message, 19 | @NotNull Exception exception) { 20 | super(message, exception); 21 | } 22 | 23 | public DeserializeTransactionError(@NotNull Exception exception) { 24 | super(exception); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/serializationProvider/SerializationProviderError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.serializationProvider; 2 | 3 | import one.block.eosiojava.error.EosioError; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | /** 7 | * Error class is used when there is an exception while attempting to call any method of Serialization Provider. 8 | *
9 | * Any exception class which is used for Serialization Provider should extend this Error class. 10 | */ 11 | public class SerializationProviderError extends EosioError { 12 | 13 | public SerializationProviderError() { 14 | } 15 | 16 | public SerializationProviderError(@NotNull String message) { 17 | super(message); 18 | } 19 | 20 | public SerializationProviderError(@NotNull String message, 21 | @NotNull Exception exception) { 22 | super(message, exception); 23 | } 24 | 25 | public SerializationProviderError(@NotNull Exception exception) { 26 | super(exception); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/serializationProvider/SerializeAbiError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.serializationProvider; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | /** 6 | * Error class is used when there is an exception while attempting to call serializeAbi() 7 | * of Serialization Provider 8 | */ 9 | public class SerializeAbiError extends SerializationProviderError { 10 | 11 | public SerializeAbiError() { 12 | } 13 | 14 | public SerializeAbiError(@NotNull String message) { 15 | super(message); 16 | } 17 | 18 | public SerializeAbiError(@NotNull String message, 19 | @NotNull Exception exception) { 20 | super(message, exception); 21 | } 22 | 23 | public SerializeAbiError(@NotNull Exception exception) { 24 | super(exception); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/serializationProvider/SerializeError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.serializationProvider; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | /** 6 | * Error class is used when there is an exception while attempting to call serialize() 7 | * of Serialization Provider 8 | */ 9 | public class SerializeError extends SerializationProviderError { 10 | 11 | public SerializeError() { 12 | } 13 | 14 | public SerializeError(@NotNull String message) { 15 | super(message); 16 | } 17 | 18 | public SerializeError(@NotNull String message, 19 | @NotNull Exception exception) { 20 | super(message, exception); 21 | } 22 | 23 | public SerializeError(@NotNull Exception exception) { 24 | super(exception); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/serializationProvider/SerializePackedTransactionError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.serializationProvider; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | /** 6 | * Error class is used when there is an exception while attempting to call serializeTransaction() of 7 | * Serialization Provider 8 | */ 9 | public class SerializePackedTransactionError extends SerializationProviderError { 10 | 11 | public SerializePackedTransactionError() { 12 | } 13 | 14 | public SerializePackedTransactionError(@NotNull String message) { 15 | super(message); 16 | } 17 | 18 | public SerializePackedTransactionError(@NotNull String message, 19 | @NotNull Exception exception) { 20 | super(message, exception); 21 | } 22 | 23 | public SerializePackedTransactionError(@NotNull Exception exception) { 24 | super(exception); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/serializationProvider/SerializeTransactionError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.serializationProvider; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | /** 6 | * Error class is used when there is an exception while attempting to call serializeTransaction() of 7 | * Serialization Provider 8 | */ 9 | public class SerializeTransactionError extends SerializationProviderError { 10 | 11 | public SerializeTransactionError() { 12 | } 13 | 14 | public SerializeTransactionError(@NotNull String message) { 15 | super(message); 16 | } 17 | 18 | public SerializeTransactionError(@NotNull String message, 19 | @NotNull Exception exception) { 20 | super(message, exception); 21 | } 22 | 23 | public SerializeTransactionError(@NotNull Exception exception) { 24 | super(exception); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/serializationProvider/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Provides the classes necessary to describe meaningful exceptions that occur during a Serialization Provider implementation like: 3 | * {@link one.block.eosiojava.error.serializationProvider.SerializeTransactionError} 4 | */ 5 | 6 | package one.block.eosiojava.error.serializationProvider; -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/session/TransactionBroadCastEmptySignatureError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.session; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | /** 6 | * Error would be thrown from TransactionProcessor#BroadCast if signatures is empty 7 | */ 8 | public class TransactionBroadCastEmptySignatureError extends TransactionBroadCastError { 9 | 10 | public TransactionBroadCastEmptySignatureError() { 11 | } 12 | 13 | public TransactionBroadCastEmptySignatureError(@NotNull String message) { 14 | super(message); 15 | } 16 | 17 | public TransactionBroadCastEmptySignatureError(@NotNull String message, 18 | @NotNull Exception exception) { 19 | super(message, exception); 20 | } 21 | 22 | public TransactionBroadCastEmptySignatureError(@NotNull Exception exception) { 23 | super(exception); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/session/TransactionBroadCastError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.session; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | /** 6 | * Error class is used when there is an exception while attempting to call broadCast() of TransactionProcessor 7 | */ 8 | public class TransactionBroadCastError extends TransactionProcessorError { 9 | 10 | public TransactionBroadCastError() { 11 | } 12 | 13 | public TransactionBroadCastError(@NotNull String message) { 14 | super(message); 15 | } 16 | 17 | public TransactionBroadCastError(@NotNull String message, 18 | @NotNull Exception exception) { 19 | super(message, exception); 20 | } 21 | 22 | public TransactionBroadCastError(@NotNull Exception exception) { 23 | super(exception); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/session/TransactionCreateSignatureRequestAbiError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.session; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | /** 6 | * Error class is used when there is an exception while attempting to call getAbi() inside 7 | * createSignature() of TransactionProcessor 8 | */ 9 | public class TransactionCreateSignatureRequestAbiError extends TransactionCreateSignatureRequestError{ 10 | 11 | public TransactionCreateSignatureRequestAbiError() { 12 | } 13 | 14 | public TransactionCreateSignatureRequestAbiError(@NotNull String message) { 15 | super(message); 16 | } 17 | 18 | public TransactionCreateSignatureRequestAbiError(@NotNull String message, 19 | @NotNull Exception exception) { 20 | super(message, exception); 21 | } 22 | 23 | public TransactionCreateSignatureRequestAbiError(@NotNull Exception exception) { 24 | super(exception); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/session/TransactionCreateSignatureRequestEmptyAvailableKeyError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.session; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | /** 6 | * Error class is used when there is an exception while attempting to call getAvailableKeys() 7 | * inside createSignatureRequest() of TransactionProcessor. 8 | *
9 | * Gets thrown when the result of GetAvailableKeys() is empty. 10 | */ 11 | public class TransactionCreateSignatureRequestEmptyAvailableKeyError extends TransactionCreateSignatureRequestError { 12 | 13 | public TransactionCreateSignatureRequestEmptyAvailableKeyError() { 14 | } 15 | 16 | public TransactionCreateSignatureRequestEmptyAvailableKeyError(@NotNull String message) { 17 | super(message); 18 | } 19 | 20 | public TransactionCreateSignatureRequestEmptyAvailableKeyError(@NotNull String message, 21 | @NotNull Exception exception) { 22 | super(message, exception); 23 | } 24 | 25 | public TransactionCreateSignatureRequestEmptyAvailableKeyError(@NotNull Exception exception) { 26 | super(exception); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/session/TransactionCreateSignatureRequestError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.session; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | /** 6 | * Error class is used when there is an exception while attempting to call any method related to the 7 | * signing process inside getSignature() of TransactionProcessor. 8 | */ 9 | public class TransactionCreateSignatureRequestError extends TransactionProcessorError { 10 | 11 | public TransactionCreateSignatureRequestError() { 12 | } 13 | 14 | public TransactionCreateSignatureRequestError(@NotNull String message) { 15 | super(message); 16 | } 17 | 18 | public TransactionCreateSignatureRequestError(@NotNull String message, 19 | @NotNull Exception exception) { 20 | super(message, exception); 21 | } 22 | 23 | public TransactionCreateSignatureRequestError(@NotNull Exception exception) { 24 | super(exception); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/session/TransactionCreateSignatureRequestKeyError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.session; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | /** 6 | * Error class is used when there is an exception while attempting to call getAvailableKeys() 7 | * inside createSignatureRequest() of TransactionProcessor 8 | */ 9 | public class TransactionCreateSignatureRequestKeyError extends TransactionCreateSignatureRequestError { 10 | 11 | public TransactionCreateSignatureRequestKeyError() { 12 | } 13 | 14 | public TransactionCreateSignatureRequestKeyError(@NotNull String message) { 15 | super(message); 16 | } 17 | 18 | public TransactionCreateSignatureRequestKeyError(@NotNull String message, 19 | @NotNull Exception exception) { 20 | super(message, exception); 21 | } 22 | 23 | public TransactionCreateSignatureRequestKeyError(@NotNull Exception exception) { 24 | super(exception); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/session/TransactionCreateSignatureRequestRequiredKeysEmptyError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.session; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | /** 6 | * Error class is used when there is an exception while attempting to call getRequiredKeys() 7 | * inside createSignatureRequest() of TransactionProcessor. 8 | *
9 | * Gets thrown if GetRequiredKeys() returns an empty list. 10 | */ 11 | public class TransactionCreateSignatureRequestRequiredKeysEmptyError extends TransactionCreateSignatureRequestError { 12 | 13 | public TransactionCreateSignatureRequestRequiredKeysEmptyError() { 14 | } 15 | 16 | public TransactionCreateSignatureRequestRequiredKeysEmptyError(@NotNull String message) { 17 | super(message); 18 | } 19 | 20 | public TransactionCreateSignatureRequestRequiredKeysEmptyError(@NotNull String message, 21 | @NotNull Exception exception) { 22 | super(message, exception); 23 | } 24 | 25 | public TransactionCreateSignatureRequestRequiredKeysEmptyError(@NotNull Exception exception) { 26 | super(exception); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/session/TransactionCreateSignatureRequestRequiredKeysError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.session; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | /** 6 | * Error class is used when there is an exception while attempting to call getRequiredKeys() inside 7 | * createSignatureRequest() of TransactionProcessor 8 | */ 9 | public class TransactionCreateSignatureRequestRequiredKeysError extends TransactionCreateSignatureRequestError { 10 | 11 | public TransactionCreateSignatureRequestRequiredKeysError() { 12 | } 13 | 14 | public TransactionCreateSignatureRequestRequiredKeysError(@NotNull String message) { 15 | super(message); 16 | } 17 | 18 | public TransactionCreateSignatureRequestRequiredKeysError(@NotNull String message, 19 | @NotNull Exception exception) { 20 | super(message, exception); 21 | } 22 | 23 | public TransactionCreateSignatureRequestRequiredKeysError(@NotNull Exception exception) { 24 | super(exception); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/session/TransactionCreateSignatureRequestRpcError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.session; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | /** 6 | * Error class is used when there is an exception while attempting to call any RPC call inside 7 | * createSignatureRequest() of TransactionProcessor 8 | */ 9 | public class TransactionCreateSignatureRequestRpcError extends TransactionCreateSignatureRequestError { 10 | 11 | public TransactionCreateSignatureRequestRpcError() { 12 | } 13 | 14 | public TransactionCreateSignatureRequestRpcError(@NotNull String message) { 15 | super(message); 16 | } 17 | 18 | public TransactionCreateSignatureRequestRpcError(@NotNull String message, 19 | @NotNull Exception exception) { 20 | super(message, exception); 21 | } 22 | 23 | public TransactionCreateSignatureRequestRpcError(@NotNull Exception exception) { 24 | super(exception); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/session/TransactionCreateSignatureRequestSerializationError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.session; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | /** 6 | * Error class is used when there is an exception while attempting to call Serialization method 7 | * inside createSignatureRequest() of TransactionProcessor 8 | */ 9 | public class TransactionCreateSignatureRequestSerializationError extends TransactionCreateSignatureRequestError { 10 | 11 | public TransactionCreateSignatureRequestSerializationError() { 12 | } 13 | 14 | public TransactionCreateSignatureRequestSerializationError(@NotNull String message) { 15 | super(message); 16 | } 17 | 18 | public TransactionCreateSignatureRequestSerializationError(@NotNull String message, 19 | @NotNull Exception exception) { 20 | super(message, exception); 21 | } 22 | 23 | public TransactionCreateSignatureRequestSerializationError(@NotNull Exception exception) { 24 | super(exception); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/session/TransactionGetSignatureDeserializationError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.session; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | /** 6 | * Error class is used when there is an exception while attempting to call any deserialization 7 | * method inside createSignatureRequest() of TransactionProcessor 8 | */ 9 | public class TransactionGetSignatureDeserializationError extends TransactionGetSignatureError { 10 | 11 | public TransactionGetSignatureDeserializationError() { 12 | } 13 | 14 | public TransactionGetSignatureDeserializationError(@NotNull String message) { 15 | super(message); 16 | } 17 | 18 | public TransactionGetSignatureDeserializationError(@NotNull String message, 19 | @NotNull Exception exception) { 20 | super(message, exception); 21 | } 22 | 23 | public TransactionGetSignatureDeserializationError(@NotNull Exception exception) { 24 | super(exception); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/session/TransactionGetSignatureError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.session; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | /** 6 | * Error class is used when there is an exception while attempting to call getSignature() of TransactionProcessor 7 | */ 8 | public class TransactionGetSignatureError extends TransactionProcessorError { 9 | 10 | public TransactionGetSignatureError() { 11 | } 12 | 13 | public TransactionGetSignatureError(@NotNull String message) { 14 | super(message); 15 | } 16 | 17 | public TransactionGetSignatureError(@NotNull String message, 18 | @NotNull Exception exception) { 19 | super(message, exception); 20 | } 21 | 22 | public TransactionGetSignatureError(@NotNull Exception exception) { 23 | super(exception); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/session/TransactionGetSignatureNotAllowModifyTransactionError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.session; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | /** 6 | * Error class is used when there is an exception while attempting to call getSignature() inside TransactionProcessor. 7 | *
8 | * Gets thrown when Signature provider modifies a transaction but TransactionProcessor is not set to allow that. 9 | */ 10 | public class TransactionGetSignatureNotAllowModifyTransactionError extends TransactionGetSignatureError { 11 | 12 | public TransactionGetSignatureNotAllowModifyTransactionError() { 13 | } 14 | 15 | public TransactionGetSignatureNotAllowModifyTransactionError(@NotNull String message) { 16 | super(message); 17 | } 18 | 19 | public TransactionGetSignatureNotAllowModifyTransactionError(@NotNull String message, 20 | @NotNull Exception exception) { 21 | super(message, exception); 22 | } 23 | 24 | public TransactionGetSignatureNotAllowModifyTransactionError(@NotNull Exception exception) { 25 | super(exception); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/session/TransactionGetSignatureSigningError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.session; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | /** 6 | * Error class is used when there is an exception while attempting to call getSignature() of TransactionProcessor 7 | */ 8 | public class TransactionGetSignatureSigningError extends TransactionGetSignatureError { 9 | 10 | public TransactionGetSignatureSigningError() { 11 | } 12 | 13 | public TransactionGetSignatureSigningError(@NotNull String message) { 14 | super(message); 15 | } 16 | 17 | public TransactionGetSignatureSigningError(@NotNull String message, 18 | @NotNull Exception exception) { 19 | super(message, exception); 20 | } 21 | 22 | public TransactionGetSignatureSigningError(@NotNull Exception exception) { 23 | super(exception); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/session/TransactionPrepareError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.session; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | /** 6 | * Error class is used when there is an exception while attempting to call prepare() of TransactionProcessor 7 | */ 8 | public class TransactionPrepareError extends TransactionProcessorError{ 9 | 10 | public TransactionPrepareError() { 11 | } 12 | 13 | public TransactionPrepareError(@NotNull String message) { 14 | super(message); 15 | } 16 | 17 | public TransactionPrepareError(@NotNull String message, 18 | @NotNull Exception exception) { 19 | super(message, exception); 20 | } 21 | 22 | public TransactionPrepareError(@NotNull Exception exception) { 23 | super(exception); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/session/TransactionPrepareInputError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.session; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | /** 6 | * Error class is used when there is an exception while attempting to call prepare() inside TransactionProcessor. 7 | *
8 | * Gets thrown if input for Prepare() is invalid. 9 | */ 10 | public class TransactionPrepareInputError extends TransactionPrepareError { 11 | 12 | public TransactionPrepareInputError() { 13 | } 14 | 15 | public TransactionPrepareInputError(@NotNull String message) { 16 | super(message); 17 | } 18 | 19 | public TransactionPrepareInputError(@NotNull String message, 20 | @NotNull Exception exception) { 21 | super(message, exception); 22 | } 23 | 24 | public TransactionPrepareInputError(@NotNull Exception exception) { 25 | super(exception); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/session/TransactionPrepareRpcError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.session; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | /** 6 | * Error class is used when there is an exception while attempting make any RPC calls inside 7 | * prepare() of TransactionProcessor 8 | */ 9 | public class TransactionPrepareRpcError extends TransactionPrepareError { 10 | 11 | public TransactionPrepareRpcError() { 12 | } 13 | 14 | public TransactionPrepareRpcError(@NotNull String message) { 15 | super(message); 16 | } 17 | 18 | public TransactionPrepareRpcError(@NotNull String message, 19 | @NotNull Exception exception) { 20 | super(message, exception); 21 | } 22 | 23 | public TransactionPrepareRpcError(@NotNull Exception exception) { 24 | super(exception); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/session/TransactionProcessorConstructorInputError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.session; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | /** 6 | * Error class is used when there is an exception while attempting to initialize TransactionProcessor 7 | */ 8 | public class TransactionProcessorConstructorInputError extends TransactionProcessorError { 9 | 10 | public TransactionProcessorConstructorInputError() { 11 | } 12 | 13 | public TransactionProcessorConstructorInputError(@NotNull String message) { 14 | super(message); 15 | } 16 | 17 | public TransactionProcessorConstructorInputError(@NotNull String message, 18 | @NotNull Exception exception) { 19 | super(message, exception); 20 | } 21 | 22 | public TransactionProcessorConstructorInputError(@NotNull Exception exception) { 23 | super(exception); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/session/TransactionProcessorError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.session; 2 | 3 | import one.block.eosiojava.error.EosioError; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | /** 7 | * Error class is used when there is an exception while attempting to call any method of TransactionProcessor 8 | */ 9 | public class TransactionProcessorError extends EosioError { 10 | 11 | public TransactionProcessorError() { 12 | } 13 | 14 | public TransactionProcessorError(@NotNull String message) { 15 | super(message); 16 | } 17 | 18 | public TransactionProcessorError(@NotNull String message, 19 | @NotNull Exception exception) { 20 | super(message, exception); 21 | } 22 | 23 | public TransactionProcessorError(@NotNull Exception exception) { 24 | super(exception); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/session/TransactionPushTransactionError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.session; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | /** 6 | * Error class is used when there is an exception while attempting to call pushTransaction() of TransactionProcessor 7 | */ 8 | public class TransactionPushTransactionError extends TransactionProcessorError { 9 | 10 | public TransactionPushTransactionError() { 11 | } 12 | 13 | public TransactionPushTransactionError(@NotNull String message) { 14 | super(message); 15 | } 16 | 17 | public TransactionPushTransactionError(@NotNull String message, 18 | @NotNull Exception exception) { 19 | super(message, exception); 20 | } 21 | 22 | public TransactionPushTransactionError(@NotNull Exception exception) { 23 | super(exception); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/session/TransactionSendTransactionError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.session; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | /** 6 | * Error class is used when there is an exception while attempting to call sendTransaction() of TransactionProcessor 7 | */ 8 | public class TransactionSendTransactionError extends TransactionProcessorError { 9 | 10 | public TransactionSendTransactionError() { 11 | } 12 | 13 | public TransactionSendTransactionError(@NotNull String message) { 14 | super(message); 15 | } 16 | 17 | public TransactionSendTransactionError(@NotNull String message, 18 | @NotNull Exception exception) { 19 | super(message, exception); 20 | } 21 | 22 | public TransactionSendTransactionError(@NotNull Exception exception) { 23 | super(exception); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/session/TransactionSerializeError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.session; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | /** 6 | * Error class is used when there is an exception while attempting to call serialize() of TransactionProcessor 7 | */ 8 | public class TransactionSerializeError extends TransactionProcessorError { 9 | 10 | public TransactionSerializeError() { 11 | } 12 | 13 | public TransactionSerializeError(@NotNull String message) { 14 | super(message); 15 | } 16 | 17 | public TransactionSerializeError(@NotNull String message, 18 | @NotNull Exception exception) { 19 | super(message, exception); 20 | } 21 | 22 | public TransactionSerializeError(@NotNull Exception exception) { 23 | super(exception); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/session/TransactionSignAndBroadCastError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.session; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | /** 6 | * Error class is used when there is an exception while attempting to call signAndBroadCast() of TransactionProcessor 7 | */ 8 | public class TransactionSignAndBroadCastError extends TransactionProcessorError { 9 | 10 | public TransactionSignAndBroadCastError() { 11 | } 12 | 13 | public TransactionSignAndBroadCastError(@NotNull String message) { 14 | super(message); 15 | } 16 | 17 | public TransactionSignAndBroadCastError(@NotNull String message, 18 | @NotNull Exception exception) { 19 | super(message, exception); 20 | } 21 | 22 | public TransactionSignAndBroadCastError(@NotNull Exception exception) { 23 | super(exception); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/session/TransactionSignError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.session; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | /** 6 | * Error class is used when there is an exception while attempting to call sign() of TransactionProcessor 7 | */ 8 | public class TransactionSignError extends TransactionProcessorError { 9 | 10 | public TransactionSignError() { 11 | } 12 | 13 | public TransactionSignError(@NotNull String message) { 14 | super(message); 15 | } 16 | 17 | public TransactionSignError(@NotNull String message, 18 | @NotNull Exception exception) { 19 | super(message, exception); 20 | } 21 | 22 | public TransactionSignError(@NotNull Exception exception) { 23 | super(exception); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/session/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Provides the classes necessary to describe meaningful exceptions that occur during {@link 3 | * one.block.eosiojava.session.TransactionProcessor} and {@link one.block.eosiojava.session.TransactionSession} 4 | * implementations like: {@link one.block.eosiojava.error.session.TransactionGetSignatureError} 5 | */ 6 | 7 | package one.block.eosiojava.error.session; -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/signatureProvider/GetAvailableKeysError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.signatureProvider; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | /** 6 | * Error class is used when there is an exception while attempting to call getAvailableKeys() of SignatureProvider 7 | */ 8 | public class GetAvailableKeysError extends SignatureProviderError { 9 | 10 | public GetAvailableKeysError() { 11 | } 12 | 13 | public GetAvailableKeysError(@NotNull String message) { 14 | super(message); 15 | } 16 | 17 | public GetAvailableKeysError(@NotNull String message, 18 | @NotNull Exception exception) { 19 | super(message, exception); 20 | } 21 | 22 | public GetAvailableKeysError(@NotNull Exception exception) { 23 | super(exception); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/signatureProvider/SignTransactionError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.signatureProvider; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | /** 6 | * Error class is used when there is an exception while attempting to call signTransaction() of SignatureProvider 7 | */ 8 | public class SignTransactionError extends SignatureProviderError { 9 | 10 | public SignTransactionError() { 11 | } 12 | 13 | public SignTransactionError(@NotNull String message) { 14 | super(message); 15 | } 16 | 17 | public SignTransactionError(@NotNull String message, 18 | @NotNull Exception exception) { 19 | super(message, exception); 20 | } 21 | 22 | public SignTransactionError(@NotNull Exception exception) { 23 | super(exception); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/signatureProvider/SignatureProviderError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.signatureProvider; 2 | 3 | import one.block.eosiojava.error.EosioError; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | /** 7 | * Error class is used when there is an exception while attempting to call any method of SignatureProvider 8 | */ 9 | public class SignatureProviderError extends EosioError { 10 | 11 | public SignatureProviderError() { 12 | } 13 | 14 | public SignatureProviderError(@NotNull String message) { 15 | super(message); 16 | } 17 | 18 | public SignatureProviderError(@NotNull String message, 19 | @NotNull Exception exception) { 20 | super(message, exception); 21 | } 22 | 23 | public SignatureProviderError(@NotNull Exception exception) { 24 | super(exception); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/signatureProvider/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Provides the classes necessary to describe meaningful exceptions that occur during a signature 3 | * provider implementation like {@link one.block.eosiojava.error.signatureProvider.SignTransactionError} 4 | */ 5 | 6 | package one.block.eosiojava.error.signatureProvider; -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/utilities/Base58ManipulationError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.utilities; 2 | 3 | import one.block.eosiojava.error.EosioError; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | /** 7 | * Error is thrown for exceptions that occur during Base58 8 | * encoding or decoding operations. 9 | */ 10 | public class Base58ManipulationError extends EosioError { 11 | public Base58ManipulationError() { 12 | } 13 | 14 | public Base58ManipulationError(@NotNull String message) { 15 | super(message); 16 | } 17 | 18 | public Base58ManipulationError(@NotNull String message, 19 | @NotNull Exception exception) { 20 | super(message, exception); 21 | } 22 | 23 | public Base58ManipulationError(@NotNull Exception exception) { 24 | super(exception); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/utilities/DerToPemConversionError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.error.utilities; 2 | 3 | import one.block.eosiojava.error.EosioError; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | /** 7 | * Error is thrown for exceptions involving conversions of keys 8 | * or signatures from DER encoded format to PEM. 9 | */ 10 | public class DerToPemConversionError extends EosioError { 11 | public DerToPemConversionError() { 12 | } 13 | 14 | public DerToPemConversionError(@NotNull String message) { 15 | super(message); 16 | } 17 | 18 | public DerToPemConversionError(@NotNull String message, 19 | @NotNull Exception exception) { 20 | super(message, exception); 21 | } 22 | 23 | public DerToPemConversionError(@NotNull Exception exception) { 24 | super(exception); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/utilities/EOSFormatterError.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package one.block.eosiojava.error.utilities; 4 | 5 | import one.block.eosiojava.error.EosioError; 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | /** 9 | * Error class is used when there is an exception while attempting to call any method of EOSFormatter 10 | */ 11 | public class EOSFormatterError extends EosioError { 12 | 13 | public EOSFormatterError() { 14 | } 15 | 16 | public EOSFormatterError(@NotNull String message) { 17 | super(message); 18 | } 19 | 20 | public EOSFormatterError(@NotNull String message, 21 | @NotNull Exception exception) { 22 | super(message, exception); 23 | } 24 | 25 | public EOSFormatterError(@NotNull Exception exception) { 26 | super(exception); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/utilities/EosFormatterSignatureIsNotCanonicalError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2019 block.one all rights reserved. 3 | */ 4 | 5 | package one.block.eosiojava.error.utilities; 6 | 7 | import org.jetbrains.annotations.NotNull; 8 | 9 | /** 10 | * Error class is used when there is an exception while attempting to convert a 11 | * signature to EOS format and the signature is not canonical. 12 | *
13 | * * This exception only happens with signatures signed by a key generated by the SECP256K1 14 | * algorithm. 15 | *
16 | * * The signature must be recreated and tested to pass this exception. 17 | */ 18 | public class EosFormatterSignatureIsNotCanonicalError extends EOSFormatterError{ 19 | public EosFormatterSignatureIsNotCanonicalError() { 20 | } 21 | 22 | public EosFormatterSignatureIsNotCanonicalError(@NotNull String message) { 23 | super(message); 24 | } 25 | 26 | public EosFormatterSignatureIsNotCanonicalError(@NotNull String message, @NotNull Exception exception) { 27 | super(message, exception); 28 | } 29 | 30 | public EosFormatterSignatureIsNotCanonicalError(@NotNull Exception exception) { 31 | super(exception); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/utilities/LowSVerificationError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2019 block.one all rights reserved. 3 | */ 4 | 5 | package one.block.eosiojava.error.utilities; 6 | 7 | import org.jetbrains.annotations.NotNull; 8 | 9 | /** 10 | * Error thrown when exception occurs during signature manipulations. Specifically, this 11 | * error indicates that a failure occurred while verifying whether the value of S was low. 12 | */ 13 | public class LowSVerificationError extends EOSFormatterError { 14 | 15 | public LowSVerificationError() { 16 | } 17 | 18 | public LowSVerificationError(@NotNull String message) { 19 | super(message); 20 | } 21 | 22 | public LowSVerificationError(@NotNull String message, 23 | @NotNull Exception exception) { 24 | super(message, exception); 25 | } 26 | 27 | public LowSVerificationError(@NotNull Exception exception) { 28 | super(exception); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/utilities/PEMProcessorError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2019 block.one all rights reserved. 3 | */ 4 | 5 | package one.block.eosiojava.error.utilities; 6 | 7 | import one.block.eosiojava.error.EosioError; 8 | import org.jetbrains.annotations.NotNull; 9 | 10 | /** 11 | * Error that originates from the {@link one.block.eosiojava.utilities.PEMProcessor} class. 12 | */ 13 | public class PEMProcessorError extends EosioError { 14 | 15 | public PEMProcessorError() { 16 | } 17 | 18 | public PEMProcessorError(@NotNull String message) { 19 | super(message); 20 | } 21 | 22 | public PEMProcessorError(@NotNull String message, 23 | @NotNull Exception exception) { 24 | super(message, exception); 25 | } 26 | 27 | public PEMProcessorError(@NotNull Exception exception) { 28 | super(exception); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/error/utilities/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Provides the classes necessary to describe meaningful exceptions that occur while using 3 | * eosio-java utilities. like {@link one.block.eosiojava.error.utilities.PEMProcessorError} 4 | */ 5 | 6 | package one.block.eosiojava.error.utilities; -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/implementations/ABIProviderImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2019 block.one all rights reserved. 3 | */ 4 | 5 | package one.block.eosiojava.implementations; 6 | 7 | import com.google.common.base.Strings; 8 | import java.util.ArrayList; 9 | import java.util.HashMap; 10 | import java.util.HashSet; 11 | import java.util.List; 12 | import java.util.Map; 13 | import java.util.concurrent.ConcurrentHashMap; 14 | import one.block.eosiojava.error.ErrorConstants; 15 | import one.block.eosiojava.error.abiProvider.GetAbiError; 16 | import one.block.eosiojava.interfaces.IABIProvider; 17 | import one.block.eosiojava.interfaces.IRPCProvider; 18 | import one.block.eosiojava.interfaces.ISerializationProvider; 19 | import one.block.eosiojava.models.EOSIOName; 20 | import one.block.eosiojava.models.rpcProvider.request.GetRawAbiRequest; 21 | import one.block.eosiojava.models.rpcProvider.response.GetRawAbiResponse; 22 | import one.block.eosiojava.utilities.ByteFormatter; 23 | import org.jetbrains.annotations.NotNull; 24 | 25 | /** 26 | * Default ABI Provider implementation, providing in memory caching of previously fetched 27 | * ABI's as well as fetching of ABI's using the provided RPC provider. 28 | */ 29 | 30 | public class ABIProviderImpl implements IABIProvider { 31 | 32 | private @NotNull IRPCProvider rpcProvider; 33 | private @NotNull ISerializationProvider serializationProvider; 34 | private @NotNull Map abiCache = new ConcurrentHashMap<>(); 35 | 36 | /** 37 | * Initialize a new ABI Provider, passing the necessary RPC provider to fetch ABI's 38 | * if they are not found in the cache. 39 | * 40 | * @param rpcProvider RPC provider implementation to use to fetch ABIs if they are not 41 | * in the cache. 42 | * @param serializationProvider Serialization provider implementation to use to deserialize 43 | * the ABIs for return and storage in the cache. 44 | */ 45 | public ABIProviderImpl(@NotNull IRPCProvider rpcProvider, 46 | @NotNull ISerializationProvider serializationProvider) { 47 | this.rpcProvider = rpcProvider; 48 | this.serializationProvider = serializationProvider; 49 | } 50 | 51 | /** 52 | * Return a map of ABIs given the chain id and account names desired. The in-memory cache 53 | * will be checked first and any missing ABIs will be fetched via the RPC provider and placed 54 | * in the cache. This call is synchronous. Developers should wrap it 55 | * in an asynchronous mechanism to avoid blocking if necessary. 56 | * 57 | * @param chainId the chain id 58 | * @param accounts the accounts - duplicate names will be removed 59 | * @return Map of ABIs keyed by the account 60 | * @throws GetAbiError If there is an error retrieving or deserializing any of the ABIs 61 | */ 62 | @Override 63 | public @NotNull Map getAbis(@NotNull String chainId, 64 | @NotNull List accounts) throws GetAbiError { 65 | 66 | Map returnAbis = new HashMap<>(); 67 | List uniqAccounts = new ArrayList<>(new HashSet<>(accounts)); 68 | 69 | for (EOSIOName account : uniqAccounts) { 70 | String abiJsonString = getAbi(chainId, account); 71 | returnAbis.put(account.getAccountName(), abiJsonString); 72 | } 73 | 74 | return returnAbis; 75 | } 76 | 77 | /** 78 | * Return an ABI given the chain id and account name desired. The in-memory cache 79 | * will be checked first and if missing the ABI will be fetched via the RPC provider 80 | * and placed in the cache. This call is synchronous. Developers should wrap it 81 | * in an asynchronous mechanism to avoid blocking if necessary. 82 | * @param chainId the chain id 83 | * @param account the account 84 | * @return abiJsonString - the deserialized JSON string for the requested ABI 85 | * @throws GetAbiError If there is an error retrieving or deserializing the ABI. 86 | */ 87 | @Override 88 | public @NotNull String getAbi(@NotNull String chainId, @NotNull EOSIOName account) 89 | throws GetAbiError { 90 | 91 | String abiJsonString; 92 | String cacheKey = chainId + account.getAccountName(); 93 | 94 | abiJsonString = this.abiCache.get(cacheKey); 95 | if (!Strings.isNullOrEmpty(abiJsonString)) { 96 | return abiJsonString; 97 | } 98 | 99 | GetRawAbiRequest getRawAbiRequest = new GetRawAbiRequest(account.getAccountName()); 100 | try { 101 | GetRawAbiResponse getRawAbiResponse = this.rpcProvider.getRawAbi(getRawAbiRequest); 102 | if (getRawAbiResponse == null) { 103 | throw new GetAbiError(ErrorConstants.NO_RESPONSE_RETRIEVING_ABI); 104 | } 105 | 106 | String abi = getRawAbiResponse.getAbi(); 107 | if (Strings.isNullOrEmpty(abi)) { 108 | throw new GetAbiError(ErrorConstants.MISSING_ABI_FROM_RESPONSE); 109 | } 110 | 111 | ByteFormatter abiByteFormatter = ByteFormatter.createFromBase64(abi); 112 | 113 | String calculatedHash = abiByteFormatter.sha256().toHex().toLowerCase(); 114 | String verificationHash = getRawAbiResponse.getAbiHash().toLowerCase(); 115 | if (!calculatedHash.equals(verificationHash)) { 116 | throw new GetAbiError(ErrorConstants.CALCULATED_HASH_NOT_EQUAL_RETURNED); 117 | } 118 | 119 | if (!account.getAccountName().equals(getRawAbiResponse.getAccountName())) { 120 | throw new GetAbiError(ErrorConstants.REQUESTED_ACCCOUNT_NOT_EQUAL_RETURNED); 121 | } 122 | 123 | abiJsonString = this.serializationProvider.deserializeAbi(abiByteFormatter.toHex()); 124 | if (abiJsonString.isEmpty()) { 125 | throw new GetAbiError(ErrorConstants.NO_ABI_FOUND); 126 | } 127 | 128 | this.abiCache.put(cacheKey, abiJsonString); 129 | 130 | } catch (Exception ex) { 131 | throw new GetAbiError(ErrorConstants.ERROR_RETRIEVING_ABI, ex); 132 | } 133 | 134 | return abiJsonString; 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/implementations/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Provides implementation classes for default implementation of eosio-java provider interfaces like 3 | * {@link one.block.eosiojava.interfaces.IABIProvider} 4 | */ 5 | 6 | package one.block.eosiojava.implementations; -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/interfaces/IABIProvider.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.interfaces; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | import one.block.eosiojava.error.abiProvider.GetAbiError; 6 | import one.block.eosiojava.models.EOSIOName; 7 | import org.jetbrains.annotations.NotNull; 8 | 9 | /** 10 | * Interface of ABI Provider 11 | */ 12 | public interface IABIProvider { 13 | 14 | /** 15 | * Gets multiple ABI by list of EOSIOName. 16 | *
17 | * Check ABIProviderImpl.getABIs() flow in "complete workflow" 18 | * doc for more detail about the implementation 19 | * 20 | * @param chainId the chain id 21 | * @param accounts the accounts 22 | * @return the abis 23 | * @throws GetAbiError thrown if there are any exceptions during the getAbi process. 24 | */ 25 | @NotNull 26 | Map getAbis(@NotNull String chainId, @NotNull List accounts) throws GetAbiError; 27 | 28 | /** 29 | * Gets abi by EOSIOName. 30 | *
31 | * Check ABIProviderImpl.getABI() flow in "complete workflow" 32 | * doc for more detail about the implementation 33 | * 34 | * @param chainId the chain id 35 | * @param account the account 36 | * @return the abi 37 | * @throws GetAbiError thrown if there are any exceptions during the getAbis process. 38 | */ 39 | @NotNull 40 | String getAbi(@NotNull String chainId, @NotNull EOSIOName account) throws GetAbiError; 41 | } 42 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/interfaces/IRPCProvider.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.interfaces; 2 | 3 | import one.block.eosiojava.error.rpcProvider.GetBlockInfoRpcError; 4 | import one.block.eosiojava.error.rpcProvider.GetInfoRpcError; 5 | import one.block.eosiojava.error.rpcProvider.GetRawAbiRpcError; 6 | import one.block.eosiojava.error.rpcProvider.GetRequiredKeysRpcError; 7 | import one.block.eosiojava.error.rpcProvider.SendTransactionRpcError; 8 | import one.block.eosiojava.models.rpcProvider.request.GetBlockInfoRequest; 9 | import one.block.eosiojava.models.rpcProvider.request.GetRawAbiRequest; 10 | import one.block.eosiojava.models.rpcProvider.request.GetRequiredKeysRequest; 11 | import one.block.eosiojava.models.rpcProvider.request.SendTransactionRequest; 12 | 13 | import one.block.eosiojava.models.rpcProvider.response.GetBlockInfoResponse; 14 | import one.block.eosiojava.models.rpcProvider.response.GetInfoResponse; 15 | import one.block.eosiojava.models.rpcProvider.response.GetRawAbiResponse; 16 | import one.block.eosiojava.models.rpcProvider.response.GetRequiredKeysResponse; 17 | import one.block.eosiojava.models.rpcProvider.response.SendTransactionResponse; 18 | import org.jetbrains.annotations.NotNull; 19 | 20 | /** 21 | * The interface of an RPC provider. 22 | */ 23 | public interface IRPCProvider { 24 | 25 | /** 26 | * Returns an object containing various details about the blockchain. 27 | * 28 | * @return the latest info/status of a chain. 29 | * @throws GetInfoRpcError thrown if there are any exceptions/backend errors during the 30 | * getInfo() process. 31 | */ 32 | @NotNull 33 | GetInfoResponse getInfo() throws GetInfoRpcError; 34 | 35 | /** 36 | * Returns an object containing various details about a specific block on the blockchain. 37 | * 38 | * @param getBlockInfoRequest Info of a specific block. 39 | * @return the info/status of a specific block in the request 40 | * @throws GetBlockInfoRpcError thrown if there are any exceptions/backend error during the 41 | * getBlockInfo() process. 42 | */ 43 | @NotNull 44 | GetBlockInfoResponse getBlockInfo(GetBlockInfoRequest getBlockInfoRequest) throws GetBlockInfoRpcError; 45 | 46 | /** 47 | * Gets raw abi for a given contract. 48 | * 49 | * @param getRawAbiRequest Info of a specific smart contract. 50 | * @return the serialized ABI of a smart contract in the request. 51 | * @throws GetRawAbiRpcError thrown if there are any exceptions/backend error during the 52 | * getRawAbi() process. 53 | */ 54 | @NotNull 55 | GetRawAbiResponse getRawAbi(GetRawAbiRequest getRawAbiRequest) throws GetRawAbiRpcError; 56 | 57 | /** 58 | * Returns the required keys needed to sign a transaction. 59 | * 60 | * @param getRequiredKeysRequest Info to get required keys 61 | * @return the required keys to sign a transaction 62 | * @throws GetRequiredKeysRpcError thrown if there are any exceptions/backend error during the 63 | * getRequiredKeys() process. 64 | */ 65 | @NotNull 66 | GetRequiredKeysResponse getRequiredKeys(GetRequiredKeysRequest getRequiredKeysRequest) throws GetRequiredKeysRpcError; 67 | 68 | /** 69 | * This method expects a transaction in JSON format and will attempt to apply it to the blockchain. 70 | * 71 | * @param sendTransactionRequest the transaction to push with signatures. 72 | * @return the send transaction response 73 | * @throws SendTransactionRpcError thrown if there are any exceptions/backend error during the 74 | * sendTransaction() process. 75 | */ 76 | @NotNull 77 | SendTransactionResponse sendTransaction(SendTransactionRequest sendTransactionRequest) throws SendTransactionRpcError; 78 | } 79 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/interfaces/ISerializationProvider.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.interfaces; 2 | 3 | 4 | import one.block.eosiojava.error.serializationProvider.DeserializeAbiError; 5 | import one.block.eosiojava.error.serializationProvider.DeserializeError; 6 | import one.block.eosiojava.error.serializationProvider.DeserializePackedTransactionError; 7 | import one.block.eosiojava.error.serializationProvider.DeserializeTransactionError; 8 | import one.block.eosiojava.error.serializationProvider.SerializeAbiError; 9 | import one.block.eosiojava.error.serializationProvider.SerializeError; 10 | import one.block.eosiojava.error.serializationProvider.SerializePackedTransactionError; 11 | import one.block.eosiojava.error.serializationProvider.SerializeTransactionError; 12 | import one.block.eosiojava.models.AbiEosSerializationObject; 13 | 14 | /** 15 | * Interface of Serialization Provider 16 | */ 17 | public interface ISerializationProvider { 18 | 19 | /** 20 | * Perform a deserialization process to convert a hex string to a JSON string given the parameters 21 | * provided in the input deserilizationObject. The result will be placed in the json field of 22 | * the deserilizationObject and can be accessed with getJson(). 23 | * 24 | * @param deserilizationObject Input object passing the hex string to be converted as well 25 | * as other parameters to control the deserialization process. 26 | * @throws DeserializeError A deserialization error is thrown if there are any exceptions during the 27 | * conversion process. 28 | */ 29 | void deserialize(AbiEosSerializationObject deserilizationObject) throws DeserializeError; 30 | 31 | /** 32 | * Perform a serialization process to convert a JSON string to a HEX string given the parameters 33 | * provided in the input serializationObject. The result will be placed in the hex field of 34 | * the serializationObject and can be accessed with getHex(). 35 | * 36 | * @param serializationObject Input object passing the JSON string to be converted as well 37 | * as other parameters to control the serialization process. 38 | * @throws SerializeError A serialization error is thrown if there are any exceptions during the 39 | * conversion process. 40 | */ 41 | void serialize(AbiEosSerializationObject serializationObject) throws SerializeError; 42 | 43 | /** 44 | * Convenience method to transform a transaction hex string to a JSON string. 45 | * 46 | * @param hex Hex string representing the transaction to deserialize. 47 | * @return Deserialized JSON string representing the transaction hex. 48 | * @throws DeserializeTransactionError A deserialization error is thrown if there are any exceptions during the 49 | * conversion process. 50 | */ 51 | String deserializeTransaction(String hex) throws DeserializeTransactionError; 52 | 53 | /** 54 | * Convenience method to transform a transaction JSON string to a hex string. 55 | * 56 | * @param json JSON string representing the transaction to serialize. 57 | * @return Serialized hex string representing the transaction JSON. 58 | * @throws SerializeTransactionError A serialization error is thrown if there are any exceptions during the 59 | * conversion process. 60 | */ 61 | String serializeTransaction(String json) throws SerializeTransactionError; 62 | 63 | /** 64 | * Convenience method to transform an ABI hex string to a JSON string. 65 | * 66 | * @param hex Hex string representing the ABI to deserialize. 67 | * @return Deserialized JSON string representing the ABI hex. 68 | * @throws DeserializeAbiError A deserialization error is thrown if there are any exceptions during the 69 | * conversion process. 70 | */ 71 | String deserializeAbi(String hex) throws DeserializeAbiError; 72 | 73 | /** 74 | * Convenience method to transform an ABI JSON string to a hex string. 75 | * 76 | * @param json JSON string representing the ABI to serialize. 77 | * @return Serialized hex string representing the ABI JSON. 78 | * @throws SerializeAbiError A serialization error is thrown if there are any exceptions during the 79 | * conversion process. 80 | */ 81 | String serializeAbi(String json) throws SerializeAbiError; 82 | 83 | /** 84 | * Convenience method to transform a packed transaction (v0) hex string to a JSON string. 85 | * 86 | * @param hex - Hex string representing the packed transaction (v0) to deserialize. 87 | * @return - Deserialized JSON string representing the transaction hex. 88 | * @throws DeserializePackedTransactionError - A deserialization error is thrown if there are any exceptions during the 89 | * * conversion process. 90 | */ 91 | String deserializePackedTransaction(String hex) throws DeserializePackedTransactionError; 92 | 93 | /** 94 | * Convenience method to transform a serialized transaction (v0) JSON string to a hex string. 95 | * 96 | * @param json - JSON string representing the serialized transaction (v0) to serialize. 97 | * @return - Serialized hex string representing the transaction JSON. 98 | * @throws SerializePackedTransactionError - A serialization error is thrown if there are any exceptions during the 99 | * * conversion process. 100 | */ 101 | String serializePackedTransaction(String json) throws SerializePackedTransactionError; 102 | } 103 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/interfaces/ISignatureProvider.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.interfaces; 2 | 3 | import java.util.List; 4 | import one.block.eosiojava.error.signatureProvider.GetAvailableKeysError; 5 | import one.block.eosiojava.error.signatureProvider.SignTransactionError; 6 | import one.block.eosiojava.models.signatureProvider.EosioTransactionSignatureRequest; 7 | import one.block.eosiojava.models.signatureProvider.EosioTransactionSignatureResponse; 8 | import org.jetbrains.annotations.NotNull; 9 | 10 | /** 11 | * The interface of Signature provider. 12 | */ 13 | public interface ISignatureProvider { 14 | 15 | /** 16 | * Sign a transaction in Signature Provider
Check signTransaction flow() in "complete 17 | * workflow" for more detail 18 | * 19 | * @param eosioTransactionSignatureRequest the request 20 | * @return the response 21 | * @throws SignTransactionError thrown if there are any exceptions during the signing process. 22 | */ 23 | @NotNull 24 | EosioTransactionSignatureResponse signTransaction( 25 | @NotNull EosioTransactionSignatureRequest eosioTransactionSignatureRequest) 26 | throws SignTransactionError; 27 | 28 | /** 29 | * Gets available keys from signature provider
Check createSignatureRequest() flow in 30 | * "complete workflow" for more detail of how the method is used 31 | * 32 | * @return the available keys of signature provider in EOS format 33 | * @throws GetAvailableKeysError thrown if there are any exceptions during the get available keys process. 34 | */ 35 | @NotNull 36 | List getAvailableKeys() throws GetAvailableKeysError; 37 | } 38 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/interfaces/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Provides interfaces for requisite eosio-java components that are used as parameters in {@link 3 | * one.block.eosiojava.session.TransactionProcessor}. This includes interfaces for an ABI provider, 4 | * RPC provider, Serialization provider and Signature provider. 5 | */ 6 | 7 | package one.block.eosiojava.interfaces; -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/models/AbiEosSerializationObject.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.models; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.jetbrains.annotations.Nullable; 5 | 6 | /** 7 | * The request/response object to pass to Serialization Provider for generic serialization/deserialization 8 | */ 9 | public class AbiEosSerializationObject { 10 | 11 | /** 12 | * A string representing the contract name that is to be serialized or de-serialized. 13 | */ 14 | private @Nullable String contract; 15 | 16 | /** 17 | * A string representing an action that is used in conjunction with the contract (above). 18 | */ 19 | private @NotNull String name; 20 | 21 | /** 22 | * A string representing the type name for the serialize action lookup for this serialize conversion. 23 | */ 24 | private @Nullable String type; 25 | 26 | /** 27 | * The Hex String to deserialize to a JSON String. 28 | *
29 | * Leave this field blank for serialization. 30 | */ 31 | private @NotNull String hex = ""; 32 | 33 | /** 34 | * The JSON data String to serialize to binary. 35 | *
36 | * Leave this field blank for deserialization. 37 | */ 38 | private @NotNull String json = ""; 39 | 40 | /** 41 | * A String representation of the ABI to use for conversion. 42 | */ 43 | private @NotNull String abi; 44 | 45 | /** 46 | * Gets contract. 47 | *
48 | * A string representing the contract name that is to be serialized or de-serialized. 49 | * @return the contract. 50 | */ 51 | @Nullable 52 | public String getContract() { 53 | return contract; 54 | } 55 | 56 | /** 57 | * Gets name. 58 | *
59 | * A string representing the type name for the serialize action lookup for this serialize conversion. 60 | * 61 | * @return the action name. 62 | */ 63 | @NotNull 64 | public String getName() { 65 | return name; 66 | } 67 | 68 | /** 69 | * Gets type. 70 | *
71 | * A string representing the type name for the serialize action lookup for this serialize conversion. 72 | * 73 | * @return the type. 74 | */ 75 | @Nullable 76 | public String getType() { 77 | return type; 78 | } 79 | 80 | /** 81 | * Gets Hex. 82 | *
83 | * The Hex String to deserialize to a JSON String. 84 | *
85 | * This field is blank for serialization. 86 | * 87 | * @return the hex. 88 | */ 89 | @NotNull 90 | public String getHex() { 91 | return hex; 92 | } 93 | 94 | /** 95 | * Gets the json. 96 | *
97 | * The JSON data String to serialize to binary. 98 | *
99 | * Leave this field blank for deserialization. 100 | * @return the json. 101 | */ 102 | @NotNull 103 | public String getJson() { 104 | return json; 105 | } 106 | 107 | /** 108 | * Gets the abi. 109 | *
110 | * A String representation of the ABI to use for conversion. 111 | * @return the abi. 112 | */ 113 | @NotNull 114 | public String getAbi() { 115 | return abi; 116 | } 117 | 118 | /** 119 | * Sets Hex. 120 | *
121 | * The Hex String to deserialize to a JSON String. 122 | *
123 | * Set this field to blank for serialization. 124 | * 125 | * @param hex - input hex value. 126 | */ 127 | public void setHex(@NotNull String hex) { 128 | this.hex = hex; 129 | } 130 | 131 | /** 132 | * Set json. 133 | *
134 | * The JSON data String to serialize to binary. 135 | *
136 | * Set this field to blank for deserialization. 137 | * @param json - input json value. 138 | */ 139 | public void setJson(@NotNull String json) { 140 | this.json = json; 141 | } 142 | 143 | /** 144 | * Initialize AbiEosSerializationObject 145 | * 146 | * @param contract - the contract name. 147 | * @param name - the action name. 148 | * @param type - the type name. 149 | * @param abi - the abi to use for conversion. 150 | */ 151 | public AbiEosSerializationObject(@Nullable String contract, 152 | @NotNull String name, @Nullable String type, 153 | @NotNull String abi) { 154 | this.contract = contract; 155 | this.name = name; 156 | this.type = type; 157 | this.abi = abi; 158 | } 159 | 160 | } 161 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/models/EOSIOName.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.models; 2 | 3 | import java.util.Objects; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | /** 7 | * Class holds block chain account name. 8 | */ 9 | public class EOSIOName { 10 | 11 | /** 12 | * EOSIO account name in String format. 13 | */ 14 | @NotNull private String accountName; 15 | 16 | /** 17 | * Initialize EOSIOName object with EOSIO account name in String format 18 | * 19 | * @param accountName - input EOSIO account name in String format. 20 | */ 21 | public EOSIOName(@NotNull String accountName) { 22 | this.accountName = accountName; 23 | } 24 | 25 | /** 26 | * Get EOSIO account name in String format. 27 | * 28 | * @return EOSIO account name in String format. 29 | */ 30 | @NotNull 31 | public String getAccountName() { 32 | return accountName; 33 | } 34 | 35 | /** 36 | * Get EOSIO account name 37 | * 38 | * @param accountName input EOSIO account name in string format. 39 | */ 40 | public void setAccountName(@NotNull String accountName) { 41 | this.accountName = accountName; 42 | } 43 | 44 | @Override 45 | public boolean equals(Object o) { 46 | if (this == o) { 47 | return true; 48 | } 49 | if (o == null || getClass() != o.getClass()) { 50 | return false; 51 | } 52 | EOSIOName eosioName = (EOSIOName) o; 53 | return getAccountName().equals(eosioName.getAccountName()); 54 | } 55 | 56 | @Override 57 | public int hashCode() { 58 | return Objects.hash(getAccountName()); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/models/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Provides model classes for using on providers like {@link one.block.eosiojava.interfaces.ISignatureProvider}, 3 | * {@link one.block.eosiojava.interfaces.IRPCProvider} and {@link one.block.eosiojava.interfaces.IABIProvider} 4 | */ 5 | 6 | package one.block.eosiojava.models; -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/models/rpcProvider/Action.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.models.rpcProvider; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | import java.io.Serializable; 5 | import java.util.List; 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | /** 9 | * The action to execute on the contract. 10 | */ 11 | public class Action implements Serializable { 12 | 13 | /** 14 | * The contract account name. 15 | */ 16 | @SerializedName("account") 17 | @NotNull 18 | private String account; 19 | 20 | /** 21 | * The Contract action name. 22 | */ 23 | @SerializedName("name") 24 | @NotNull 25 | private String name; 26 | 27 | /** 28 | * The Authorization (actor and permission) to make transaction 29 | */ 30 | @SerializedName("authorization") 31 | @NotNull 32 | private List authorization; 33 | 34 | /** 35 | * The Action Data are the arguments to the contract.
This field could hold hex or json 36 | * string depending on the step in the processing flow.
JSON type: This is the un-serialized 37 | * version which has action data for an action in smart contract. Hex type: This is the serialized 38 | * version of JSON type which is serialized by SerializationProvider.
Check the 39 | * "Complete Workflow" diagram for more information. 40 | */ 41 | @SerializedName("data") 42 | @NotNull 43 | private String data; 44 | 45 | /** 46 | * Whether or not this action is a contextFree action. 47 | */ 48 | @SerializedName("isContextFree") 49 | @NotNull 50 | private boolean isContextFree; 51 | 52 | /** 53 | * Action return value after transaction processing. 54 | */ 55 | private transient Object returnValue; 56 | 57 | /** 58 | * Instantiates a new action. 59 | * 60 | * @param account the Contract account name. 61 | * @param name the Contract action name. 62 | * @param authorization the Authorization (actor and permission) to make transaction 63 | * @param data the action data (arguments to the contract) 64 | * @param isContextFree whether or not the action is context free 65 | */ 66 | public Action(@NotNull String account, @NotNull String name, 67 | @NotNull List authorization, @NotNull String data, 68 | @NotNull boolean isContextFree) { 69 | this.account = account; 70 | this.name = name; 71 | this.authorization = authorization; 72 | this.data = data; 73 | this.isContextFree = isContextFree; 74 | } 75 | 76 | public Action(@NotNull String account, @NotNull String name, 77 | @NotNull List authorization, @NotNull String data) { 78 | this(account, name, authorization, data, false); 79 | } 80 | 81 | /** 82 | * Gets contract account name. 83 | * 84 | * @return the contract account name. 85 | */ 86 | @NotNull 87 | public String getAccount() { 88 | return account; 89 | } 90 | 91 | /** 92 | * Sets contract account name. 93 | * 94 | * @param account the contract account name. 95 | */ 96 | public void setAccount(@NotNull String account) { 97 | this.account = account; 98 | } 99 | 100 | /** 101 | * Gets contract action name. 102 | * 103 | * @return the contact action name. 104 | */ 105 | @NotNull 106 | public String getName() { 107 | return name; 108 | } 109 | 110 | /** 111 | * Sets contact action name. 112 | * 113 | * @param name the contact action name. 114 | */ 115 | public void setName(@NotNull String name) { 116 | this.name = name; 117 | } 118 | 119 | /** 120 | * Gets authorization (actor and permission) to make transaction. 121 | * 122 | * @return the authorization (actor and permission) to make transaction. 123 | */ 124 | @NotNull 125 | public List getAuthorization() { 126 | return authorization; 127 | } 128 | 129 | /** 130 | * Sets authorization (actor and permission) to make transaction 131 | * 132 | * @param authorization the authorization (actor and permission) to make transaction. 133 | */ 134 | public void setAuthorization( 135 | @NotNull List authorization) { 136 | this.authorization = authorization; 137 | } 138 | 139 | /** 140 | * Gets action data. 141 | * 142 | * @return the action data. 143 | */ 144 | @NotNull 145 | public String getData() { 146 | return data; 147 | } 148 | 149 | /** 150 | * Sets action data. 151 | * 152 | * @param data the action data. 153 | */ 154 | public void setData(@NotNull String data) { 155 | this.data = data; 156 | } 157 | 158 | /** 159 | * Gets whether or not this action has data 160 | * 161 | * @return whether or not this action has data 162 | */ 163 | public boolean hasData() { return !this.data.isEmpty(); } 164 | 165 | /** 166 | * Gets whether or not this action is context free. 167 | * 168 | * @return whether or not this action is context free. 169 | */ 170 | @NotNull 171 | public boolean getIsContextFree() { return this.isContextFree; } 172 | 173 | /** 174 | * Sets whether or not this action is context free. 175 | * 176 | * @param isContextFree whether or not this action is context free. 177 | */ 178 | public void setIsContextFree(@NotNull boolean isContextFree) { this.isContextFree = isContextFree; } 179 | 180 | /** 181 | * Gets the action's return value after transaction processing. 182 | * @return returnValue action return value after transaction processing. If there wasn't one, returns null. 183 | */ 184 | public Object getReturnValue() { 185 | return returnValue; 186 | } 187 | 188 | /** 189 | * Sets the action return value. 190 | * @param returnValue return value of the action after transaction processing, if there is one. If there is not, 191 | * the value should be null. 192 | */ 193 | public void setReturnValue(Object returnValue) { 194 | this.returnValue = returnValue; 195 | } 196 | 197 | } 198 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/models/rpcProvider/Authorization.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.models.rpcProvider; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | import java.io.Serializable; 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | /** 8 | * The Authorization of {@link Action} 9 | */ 10 | public class Authorization implements Serializable { 11 | 12 | /** 13 | * The Actor name. 14 | */ 15 | @SerializedName("actor") 16 | @NotNull 17 | private String actor; 18 | 19 | /** 20 | * The Permission of the actor. 21 | */ 22 | @SerializedName("permission") 23 | @NotNull 24 | private String permission; 25 | 26 | /** 27 | * Instantiates a new Authorization. 28 | * 29 | * @param actor the actor name. 30 | * @param permission the permission of the actor. 31 | */ 32 | public Authorization(@NotNull String actor, @NotNull String permission) { 33 | this.actor = actor; 34 | this.permission = permission; 35 | } 36 | 37 | /** 38 | * Gets actor name. 39 | * 40 | * @return the actor name. 41 | */ 42 | @NotNull 43 | public String getActor() { 44 | return actor; 45 | } 46 | 47 | /** 48 | * Sets actor name. 49 | * 50 | * @param actor the actor name. 51 | */ 52 | public void setActor(@NotNull String actor) { 53 | this.actor = actor; 54 | } 55 | 56 | /** 57 | * Gets permission of the actor. 58 | * 59 | * @return the permission of the actor. 60 | */ 61 | public String getPermission() { 62 | return permission; 63 | } 64 | 65 | /** 66 | * Sets permission of the actor. 67 | * 68 | * @param permission the permission of the actor. 69 | */ 70 | public void setPermission(@NotNull String permission) { 71 | this.permission = permission; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/models/rpcProvider/ContextFreeData.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.models.rpcProvider; 2 | 3 | import java.nio.ByteBuffer; 4 | import one.block.eosiojava.interfaces.IRPCProvider; 5 | import one.block.eosiojava.interfaces.ISignatureProvider; 6 | import one.block.eosiojava.models.signatureProvider.EosioTransactionSignatureRequest; 7 | import org.bitcoinj.core.Sha256Hash; 8 | import org.bouncycastle.util.encoders.Hex; 9 | import org.jetbrains.annotations.NotNull; 10 | 11 | import java.util.List; 12 | 13 | /** 14 | * The ContextFreeData class which holds raw context free data, its bytes, and methods to format 15 | * the data to pass to the signatureProvider and rpcProvider. 16 | */ 17 | public class ContextFreeData { 18 | /** 19 | * The list of raw data being added as context free data. 20 | */ 21 | @NotNull 22 | private List data; 23 | 24 | /** 25 | * The raw data converted to bytes to be used later for formatting. 26 | */ 27 | @NotNull 28 | private byte[] rawBytes; 29 | 30 | /** 31 | * Instantiates a new ContextFreeData. 32 | * 33 | * @param contextFreeData the list of raw data to be added 34 | */ 35 | public ContextFreeData(@NotNull List contextFreeData) { 36 | this.setData(contextFreeData); 37 | } 38 | 39 | /** 40 | * Gets the list of raw data. 41 | * @return the raw data 42 | */ 43 | @NotNull 44 | public List getData() { 45 | return this.data; 46 | } 47 | 48 | /** 49 | * Gets the raw data converted to bytes. 50 | * @return the converted raw data in bytes 51 | */ 52 | @NotNull 53 | public byte[] getBytes() { 54 | return this.rawBytes; 55 | } 56 | 57 | /** 58 | * Gets the hex representation of the data to be used by {@link IRPCProvider#sendTransaction(SendTransactionRequest)} 59 | * @return the hexed data 60 | */ 61 | public String getHexed() { 62 | if (!this.hasData()) { 63 | return ""; 64 | } 65 | 66 | return Hex.toHexString(this.getBytes()).toUpperCase(); 67 | } 68 | 69 | /** 70 | * Gets the 32 byte serialized representation of the data to be used by {@link ISignatureProvider#signTransaction(EosioTransactionSignatureRequest)} 71 | * @return the 32 byte serialized data 72 | */ 73 | public String getSerialized() { 74 | if (!this.hasData()) { 75 | return ""; 76 | } 77 | 78 | return Hex.toHexString(Sha256Hash.hash(this.getBytes())); 79 | } 80 | 81 | /** 82 | * Determines whether or not the instance contains data 83 | * @return boolean to determine if instance contains data 84 | */ 85 | public boolean hasData() { 86 | return !this.data.isEmpty(); 87 | } 88 | 89 | /** 90 | * Sets the raw data converted to bytes. 91 | * @param bytes the converted raw data in bytes 92 | */ 93 | private void setBytes(byte[] bytes) { 94 | this.rawBytes = bytes; 95 | } 96 | 97 | /** 98 | * Sets both raw data and its bytes with prefixes. 99 | * @param contextFreeData list of raw data to be set 100 | */ 101 | private void setData(List contextFreeData) { 102 | this.data = contextFreeData; 103 | if (!this.hasData()) { 104 | this.setBytes(new byte[0]); 105 | return; 106 | } 107 | 108 | ByteBuffer buffer = ByteBuffer.allocate(this.getTotalBytes(this.data)); 109 | 110 | pushPrefix(buffer, this.data.size()); 111 | 112 | for(String cfd : this.data) { 113 | byte[] cfdBytes = cfd.getBytes(); 114 | pushPrefix(buffer, cfdBytes.length); 115 | buffer.put(cfdBytes); 116 | } 117 | 118 | this.setBytes(buffer.array()); 119 | } 120 | 121 | /** 122 | * Add the prefix for the data to the end of the buffer. 123 | * @param buffer the buffer to append bytes to 124 | * @param length the length of the data to determine prefix length 125 | */ 126 | private void pushPrefix(ByteBuffer buffer, int length) { 127 | while(true) { 128 | if (this.isLessThan128(length)) { 129 | buffer.put((byte)length); 130 | break; 131 | } else { 132 | buffer.put((byte)(0x80 | (length & 0x7f))); 133 | length = this.subtract128(length); 134 | } 135 | } 136 | } 137 | 138 | /** 139 | * Determines how many bytes to allocate to the ByteBuffer 140 | * @param contextFreeData list of raw data 141 | * @return integer representing the number of bytes to allocate to the ByteBuffer 142 | */ 143 | private Integer getTotalBytes(List contextFreeData) { 144 | int bytes = this.getByteSizePrefix(contextFreeData.size()); 145 | for(String cfd : contextFreeData) { 146 | byte[] cfdBytes = cfd.getBytes(); 147 | bytes += this.getByteSizePrefix(cfdBytes.length) + cfdBytes.length; 148 | } 149 | return bytes; 150 | } 151 | 152 | /** 153 | * Determines the number of bytes in the prefix 154 | * @param length the length of the bytes 155 | * @return the number of bytes in the prefix 156 | */ 157 | private Integer getByteSizePrefix(int length) { 158 | int size = 0; 159 | while(true) { 160 | if (this.isLessThan128(length)) { 161 | size++; 162 | break; 163 | } else { 164 | size++; 165 | length = this.subtract128(length); 166 | } 167 | } 168 | 169 | return size; 170 | } 171 | 172 | /** 173 | * Determines whether or not there needs to be a bitwise shift to increase prefix size 174 | * @param length the length of the bytes 175 | * @return whether or not there needs to be a bitwise shift to increase prefix size 176 | */ 177 | private boolean isLessThan128(int length) { 178 | return length >>> 7 == 0; 179 | } 180 | 181 | /** 182 | * Conducts bitwise shift to increase prefix size 183 | * @param length the length of the bytes 184 | * @return the updated length 185 | */ 186 | private int subtract128(int length) { 187 | return length >>> 7; 188 | } 189 | } 190 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/models/rpcProvider/EosioEndPoint.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.models.rpcProvider; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | import java.net.MalformedURLException; 5 | import java.net.URL; 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | /** 9 | * The EndPoint for Rpc provider 10 | */ 11 | public class EosioEndPoint { 12 | 13 | /** 14 | * The Protocol. 15 | */ 16 | @SerializedName("protocol") 17 | @NotNull 18 | private String protocol; 19 | 20 | /** 21 | * The Port. 22 | */ 23 | @SerializedName("port") 24 | private int port; 25 | 26 | /** 27 | * The Host. 28 | */ 29 | @SerializedName("host") 30 | @NotNull 31 | private String host; 32 | 33 | /** 34 | * Instantiates a new Eosio end point. 35 | * 36 | * @param protocol the protocol 37 | * @param port the port 38 | * @param host the host 39 | */ 40 | public EosioEndPoint(@NotNull String protocol, int port, @NotNull String host) { 41 | this.protocol = protocol; 42 | this.port = port; 43 | this.host = host; 44 | } 45 | 46 | /** 47 | * Gets protocol. 48 | * 49 | * @return the protocol 50 | */ 51 | @NotNull 52 | public String getProtocol() { 53 | return protocol; 54 | } 55 | 56 | /** 57 | * Sets protocol. 58 | * 59 | * @param protocol the protocol 60 | */ 61 | public void setProtocol(@NotNull String protocol) { 62 | this.protocol = protocol; 63 | } 64 | 65 | /** 66 | * Gets port. 67 | * 68 | * @return the port 69 | */ 70 | @NotNull 71 | public int getPort() { 72 | return port; 73 | } 74 | 75 | /** 76 | * Sets port. 77 | * 78 | * @param port the port 79 | */ 80 | public void setPort(int port) { 81 | this.port = port; 82 | } 83 | 84 | /** 85 | * Gets host. 86 | * 87 | * @return the host 88 | */ 89 | @NotNull 90 | public String getHost() { 91 | return host; 92 | } 93 | 94 | /** 95 | * Sets host. 96 | * 97 | * @param host the host 98 | */ 99 | @NotNull 100 | public void setHost(@NotNull String host) { 101 | this.host = host; 102 | } 103 | 104 | /** 105 | * Return {@link URL} object of the endpoint 106 | * @return {@link URL} object of the endpoint 107 | * @throws MalformedURLException if an unknown protocol is specified. 108 | */ 109 | public URL toURL() throws MalformedURLException { 110 | return new URL(this.protocol, this.host, this.port, ""); 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/models/rpcProvider/RPCConfig.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.models.rpcProvider; 2 | 3 | /** 4 | * The config class for RPC provider 5 | */ 6 | public class RPCConfig { 7 | 8 | /** 9 | * The Connection timeout. 10 | */ 11 | private long connectionTimeout; 12 | 13 | /** 14 | * The Read timeout. 15 | */ 16 | private long readTimeout; 17 | 18 | /** 19 | * Instantiates a new Rpc config. 20 | * 21 | * @param connectionTimeout the connection timeout 22 | * @param readTimeout the read timeout 23 | */ 24 | public RPCConfig(long connectionTimeout, long readTimeout) { 25 | this.connectionTimeout = connectionTimeout; 26 | this.readTimeout = readTimeout; 27 | } 28 | 29 | /** 30 | * Gets connection timeout. 31 | * 32 | * @return the connection timeout 33 | */ 34 | public long getConnectionTimeout() { 35 | return connectionTimeout; 36 | } 37 | 38 | /** 39 | * Sets connection timeout. 40 | * 41 | * @param connectionTimeout the connection timeout 42 | */ 43 | public void setConnectionTimeout(long connectionTimeout) { 44 | this.connectionTimeout = connectionTimeout; 45 | } 46 | 47 | /** 48 | * Gets read timeout. 49 | * 50 | * @return the read timeout 51 | */ 52 | public long getReadTimeout() { 53 | return readTimeout; 54 | } 55 | 56 | /** 57 | * Sets read timeout. 58 | * 59 | * @param readTimeout the read timeout 60 | */ 61 | public void setReadTimeout(long readTimeout) { 62 | this.readTimeout = readTimeout; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/models/rpcProvider/Transaction.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.models.rpcProvider; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | import java.io.Serializable; 5 | import java.math.BigInteger; 6 | import java.util.List; 7 | import one.block.eosiojava.models.rpcProvider.response.GetBlockResponse; 8 | import one.block.eosiojava.models.rpcProvider.response.GetInfoResponse; 9 | import org.jetbrains.annotations.NotNull; 10 | 11 | /** 12 | * The Transaction class which has data of actions for each transaction. It holds the serialized 13 | * action data that will be sent to the blockchain. 14 | */ 15 | public class Transaction implements Serializable { 16 | 17 | /** 18 | * The maximum lifespan of the transaction. It will be calculated if the value is not set. 19 | * It is based on {@link GetInfoResponse#getHeadBlockTime()} 20 | */ 21 | @SerializedName("expiration") 22 | @NotNull 23 | private String expiration; 24 | 25 | /** 26 | * The reference block number used for Transaction as Proof-of-Stake (TAPOS). It will be 27 | * calculated if the value is not set. It is based on {@link 28 | * GetInfoResponse#getHeadBlockNum()} 29 | */ 30 | @SerializedName("ref_block_num") 31 | @NotNull 32 | private BigInteger refBlockNum; 33 | 34 | /** 35 | * The Ref block prefix which will be calculated if the value is not set. Its value get assigned 36 | * from {@link GetBlockResponse#getRefBlockPrefix()} 37 | */ 38 | @SerializedName("ref_block_prefix") 39 | @NotNull 40 | private BigInteger refBlockPrefix; 41 | 42 | @SerializedName("max_net_usage_words") 43 | @NotNull 44 | private BigInteger maxNetUsageWords; 45 | 46 | @SerializedName("max_cpu_usage_ms") 47 | @NotNull 48 | private BigInteger maxCpuUsageMs; 49 | 50 | @SerializedName("delay_sec") 51 | @NotNull 52 | private BigInteger delaySec; 53 | 54 | @SerializedName("context_free_actions") 55 | @NotNull 56 | private List contextFreeActions; 57 | 58 | /** 59 | * The Actions which have data about action of an account with hex/json data for the detail 60 | */ 61 | @SerializedName("actions") 62 | @NotNull 63 | private List actions; 64 | 65 | @SerializedName("transaction_extensions") 66 | @NotNull 67 | private List transactionExtensions; 68 | 69 | /** 70 | * Instantiates a new Transaction. 71 | * 72 | * @param expiration the expiration 73 | * @param refBlockNum the ref block num 74 | * @param refBlockPrefix the ref block prefix 75 | * @param maxNetUsageWords the max net usage words 76 | * @param maxCpuUsageMs the max cpu usage ms 77 | * @param delaySec the delay sec 78 | * @param contextFreeActions the context free actions 79 | * @param actions the actions 80 | * @param transactionExtensions the transaction extensions 81 | */ 82 | public Transaction(@NotNull String expiration, @NotNull BigInteger refBlockNum, 83 | @NotNull BigInteger refBlockPrefix, 84 | @NotNull BigInteger maxNetUsageWords, 85 | @NotNull BigInteger maxCpuUsageMs, @NotNull BigInteger delaySec, 86 | @NotNull List contextFreeActions, 87 | @NotNull List actions, @NotNull List transactionExtensions) { 88 | this.expiration = expiration; 89 | this.refBlockNum = refBlockNum; 90 | this.refBlockPrefix = refBlockPrefix; 91 | this.maxNetUsageWords = maxNetUsageWords; 92 | this.maxCpuUsageMs = maxCpuUsageMs; 93 | this.delaySec = delaySec; 94 | this.contextFreeActions = contextFreeActions; 95 | this.actions = actions; 96 | this.transactionExtensions = transactionExtensions; 97 | } 98 | 99 | /** 100 | * Gets expiration. 101 | *
102 | * It is calculated if the value is not set. It is based on {@link 103 | * GetInfoResponse#getHeadBlockTime()} 104 | * 105 | * @return the expiration 106 | */ 107 | @NotNull 108 | public String getExpiration() { 109 | return expiration; 110 | } 111 | 112 | /** 113 | * Sets expiration. 114 | *
115 | * It is calculated if the value is not set. It is based on {@link 116 | * GetInfoResponse#getHeadBlockTime()} 117 | * 118 | * @param expiration the expiration 119 | */ 120 | public void setExpiration(@NotNull String expiration) { 121 | this.expiration = expiration; 122 | } 123 | 124 | /** 125 | * Gets ref block number. 126 | *
127 | * It is calculated if the value is not set. Its value gets assigned from {@link 128 | * GetBlockResponse#getRefBlockPrefix()} 129 | * 130 | * @return the ref block number 131 | */ 132 | @NotNull 133 | public BigInteger getRefBlockNum() { 134 | return refBlockNum; 135 | } 136 | 137 | /** 138 | * Sets ref block number. 139 | *
140 | * It is calculated if the value is not set. Its value gets assigned from {@link 141 | * GetBlockResponse#getRefBlockPrefix()} 142 | * 143 | * @param refBlockNum the ref block number 144 | */ 145 | public void setRefBlockNum(@NotNull BigInteger refBlockNum) { 146 | this.refBlockNum = refBlockNum; 147 | } 148 | 149 | /** 150 | * Gets ref block prefix. 151 | *
152 | * It is calculated if the value is not set. Its value gets assigned from {@link 153 | * GetBlockResponse#getRefBlockPrefix()} 154 | * 155 | * @return the ref block prefix 156 | */ 157 | @NotNull 158 | public BigInteger getRefBlockPrefix() { 159 | return refBlockPrefix; 160 | } 161 | 162 | /** 163 | * Sets ref block prefix. 164 | *
165 | * It is calculated if the value is not set. Its value gets assigned from {@link 166 | * GetBlockResponse#getRefBlockPrefix()} 167 | * 168 | * @param refBlockPrefix the ref block prefix. 169 | */ 170 | public void setRefBlockPrefix(@NotNull BigInteger refBlockPrefix) { 171 | this.refBlockPrefix = refBlockPrefix; 172 | } 173 | 174 | @NotNull 175 | public BigInteger getMaxNetUsageWords() { 176 | return maxNetUsageWords; 177 | } 178 | 179 | public void setMaxNetUsageWords(@NotNull BigInteger maxNetUsageWords) { 180 | this.maxNetUsageWords = maxNetUsageWords; 181 | } 182 | 183 | @NotNull 184 | public BigInteger getMaxCpuUsageMs() { 185 | return maxCpuUsageMs; 186 | } 187 | 188 | public void setMaxCpuUsageMs(@NotNull BigInteger maxCpuUsageMs) { 189 | this.maxCpuUsageMs = maxCpuUsageMs; 190 | } 191 | 192 | @NotNull 193 | public BigInteger getDelaySec() { 194 | return delaySec; 195 | } 196 | 197 | public void setDelaySec(@NotNull BigInteger delaySec) { 198 | this.delaySec = delaySec; 199 | } 200 | 201 | @NotNull 202 | public List getContextFreeActions() { 203 | return contextFreeActions; 204 | } 205 | 206 | public void setContextFreeActions(@NotNull List contextFreeActions) { 207 | this.contextFreeActions = contextFreeActions; 208 | } 209 | 210 | @NotNull 211 | public List getActions() { 212 | return actions; 213 | } 214 | 215 | public void setActions(@NotNull List actions) { 216 | this.actions = actions; 217 | } 218 | 219 | @NotNull 220 | public List getTransactionExtensions() { 221 | return transactionExtensions; 222 | } 223 | 224 | public void setTransactionExtensions(@NotNull List transactionExtensions) { 225 | this.transactionExtensions = transactionExtensions; 226 | } 227 | } 228 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/models/rpcProvider/TransactionConfig.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.models.rpcProvider; 2 | 3 | import one.block.eosiojava.interfaces.IRPCProvider; 4 | import one.block.eosiojava.models.rpcProvider.request.GetBlockInfoRequest; 5 | import one.block.eosiojava.models.rpcProvider.request.GetBlockRequest; 6 | import one.block.eosiojava.models.rpcProvider.response.GetInfoResponse; 7 | 8 | /** 9 | * A configuration class that allows the developer to change certain defaults associated with a 10 | * Transaction. 11 | */ 12 | public class TransactionConfig { 13 | 14 | /** 15 | * Default blocks behind to use if blocksbehind is not set or instance of this class is not 16 | * used 17 | */ 18 | private static final int DEFAULT_BLOCKS_BEHIND = 3; 19 | 20 | /** 21 | * Default expires seconds to use if expires seconds is not set or instance of this class is not 22 | * used 23 | */ 24 | private static final int DEFAULT_EXPIRES_SECONDS = 5 * 60; 25 | 26 | /** 27 | * Default useLastIrreversible to use last irreversible block rather than blocksBehind when 28 | * calculating TAPOS 29 | */ 30 | private static final boolean DEFAULT_USE_LAST_IRREVERSIBLE = true; 31 | 32 | /** 33 | * The Expires seconds. 34 | *
35 | * Append this value to {@link GetInfoResponse#getHeadBlockTime()} in second then assign it to 36 | * {@link Transaction#setExpiration(String)} 37 | */ 38 | private int expiresSeconds = DEFAULT_EXPIRES_SECONDS; 39 | 40 | /** 41 | * The amount blocks behind from head block. 42 | *
43 | * It is an argument to calculate head block number to call {@link 44 | * one.block.eosiojava.interfaces.IRPCProvider#getBlockInfo(GetBlockInfoRequest)} 45 | */ 46 | private int blocksBehind = DEFAULT_BLOCKS_BEHIND; 47 | 48 | /** 49 | * Use the last irreversible block when calculating TAPOS rather than blocks behind. 50 | *
51 | * Mutually exclusive with {@link TransactionConfig#setBlocksBehind(int)}. If set, 52 | * {@link TransactionConfig#getBlocksBehind()} will be ignored and TAPOS will be calculated by fetching the last 53 | * irreversible block with {@link IRPCProvider#getInfo()} and the expiration for the transaction 54 | * will be set {@link TransactionConfig#setExpiresSeconds(int)} after that block's time. 55 | */ 56 | private boolean useLastIrreversible = DEFAULT_USE_LAST_IRREVERSIBLE; 57 | 58 | /** 59 | * Gets the expiration time for the transaction. 60 | *
61 | * Append this value to {@link GetInfoResponse#getHeadBlockTime()} in seconds. Assign it to 62 | * {@link Transaction#setExpiration(String)}. 63 | * 64 | * @return when the transaction expires (in seconds) 65 | */ 66 | public int getExpiresSeconds() { 67 | return expiresSeconds; 68 | } 69 | 70 | /** 71 | * Sets the expiration time for the transaction. 72 | *
73 | * Append this value to {@link GetInfoResponse#getHeadBlockTime()} in second then assign it to 74 | * {@link Transaction#setExpiration(String)} 75 | * 76 | * @param expiresSeconds when the transaction expires (in seconds) 77 | */ 78 | public void setExpiresSeconds(int expiresSeconds) { 79 | this.expiresSeconds = expiresSeconds; 80 | } 81 | 82 | /** 83 | * Gets blocks behind. 84 | *
85 | * It is an argument to calculate head block number to call {@link one.block.eosiojava.interfaces.IRPCProvider#getBlockInfo(GetBlockInfoRequest)} 86 | * @return the blocks behind 87 | */ 88 | public int getBlocksBehind() { 89 | return blocksBehind; 90 | } 91 | 92 | /** 93 | * Sets blocks behind. 94 | *
95 | * It is an argument to calculate head block number to call {@link 96 | * one.block.eosiojava.interfaces.IRPCProvider#getBlockInfo(GetBlockInfoRequest)} 97 | * @param blocksBehind the blocks behind 98 | */ 99 | public void setBlocksBehind(int blocksBehind) { 100 | this.blocksBehind = blocksBehind; 101 | } 102 | 103 | /** 104 | * Gets useLastIrreversible. 105 | *
106 | * It is an argument to calculate TAPOS from the last irreversible block rather than blocks behind the head block 107 | * @return useLastIrreversible whether to use the last irreversible block for calculating TAPOS 108 | */ 109 | public boolean getUseLastIrreversible() { return useLastIrreversible; } 110 | 111 | /** 112 | * Sets useLastIrreversible. 113 | *
114 | * It is an argument to calculate TAPOS from the last irreversible block rather than blocks behind the head block 115 | * @param useLastIrreversible whether to use the last irreversible block 116 | */ 117 | public void setUseLastIrreversible(boolean useLastIrreversible) { 118 | this.useLastIrreversible = useLastIrreversible; 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/models/rpcProvider/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Provides request/response model classes for RPC provider {@link one.block.eosiojava.interfaces.IRPCProvider} 3 | */ 4 | 5 | package one.block.eosiojava.models.rpcProvider; -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/models/rpcProvider/request/GetBlockInfoRequest.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.models.rpcProvider.request; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | import java.math.BigInteger; 7 | 8 | /** 9 | * The request class for getBlockInfo() RPC call {@link one.block.eosiojava.interfaces.IRPCProvider#getBlockInfo(GetBlockInfoRequest)} 10 | */ 11 | public class GetBlockInfoRequest { 12 | 13 | /** 14 | * Instantiates a new GetBlockInfoRequest. 15 | * 16 | * @param blockNum the block number 17 | */ 18 | public GetBlockInfoRequest(@NotNull BigInteger blockNum) { 19 | this.blockNum = blockNum; 20 | } 21 | 22 | /** 23 | * Provide a block number 24 | */ 25 | @SerializedName("block_num") 26 | @NotNull 27 | private BigInteger blockNum; 28 | 29 | /** 30 | * Gets block number. 31 | * 32 | * @return the block number 33 | */ 34 | @NotNull 35 | public BigInteger getBlockNum() { 36 | return blockNum; 37 | } 38 | 39 | /** 40 | * Sets block number. 41 | * 42 | * @param blockNum the block number 43 | */ 44 | public void setBlockNum(@NotNull BigInteger blockNum) { 45 | this.blockNum = blockNum; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/models/rpcProvider/request/GetBlockRequest.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.models.rpcProvider.request; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | /** 7 | * The request class for getBlock() RPC call {@link one.block.eosiojava.interfaces.IRPCProvider#getBlockInfo(GetBlockInfoRequest)} 8 | */ 9 | public class GetBlockRequest { 10 | 11 | /** 12 | * Instantiates a new GetBlockRequest. 13 | * 14 | * @param blockNumOrId the block number or a block id 15 | */ 16 | public GetBlockRequest(@NotNull String blockNumOrId) { 17 | this.blockNumOrId = blockNumOrId; 18 | } 19 | 20 | /** 21 | * Provide a block number or a block id 22 | */ 23 | @SerializedName("block_num_or_id") 24 | @NotNull 25 | private String blockNumOrId; 26 | 27 | /** 28 | * Gets block number or a block id. 29 | * 30 | * @return the block number or a block id 31 | */ 32 | @NotNull 33 | public String getBlockNumOrId() { 34 | return blockNumOrId; 35 | } 36 | 37 | /** 38 | * Sets block number or a block id. 39 | * 40 | * @param blockNumOrId the block number or a block id 41 | */ 42 | public void setBlockNumOrId(@NotNull String blockNumOrId) { 43 | this.blockNumOrId = blockNumOrId; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/models/rpcProvider/request/GetRawAbiRequest.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.models.rpcProvider.request; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | /** 7 | * The request class of getRawAbi() RPC call {@link one.block.eosiojava.interfaces.IRPCProvider#getRawAbi(GetRawAbiRequest)} 8 | */ 9 | public class GetRawAbiRequest { 10 | 11 | /** 12 | * Instantiates a new GetRawAbiRequest. 13 | * 14 | * @param accountName the String representation of EOSIO name type 15 | */ 16 | public GetRawAbiRequest(@NotNull String accountName) { 17 | this.accountName = accountName; 18 | } 19 | 20 | /** 21 | * The string representation of EOSIO name type 22 | */ 23 | @SerializedName("account_name") 24 | @NotNull 25 | private String accountName; 26 | 27 | /** 28 | * Gets the string representation of EOSIO name type 29 | * 30 | * @return the string representation of EOSIO name type 31 | */ 32 | @NotNull 33 | public String getAccountName() { 34 | return accountName; 35 | } 36 | 37 | /** 38 | * Sets the string representation of EOSIO name type 39 | * 40 | * @param accountName the string representation of EOSIO name type 41 | */ 42 | public void setAccountName(@NotNull String accountName) { 43 | this.accountName = accountName; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/models/rpcProvider/request/GetRequiredKeysRequest.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.models.rpcProvider.request; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | import java.util.List; 5 | import one.block.eosiojava.models.rpcProvider.Transaction; 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | /** 9 | * The request of getRequiredKeys RPC call {@link one.block.eosiojava.interfaces.IRPCProvider#getRequiredKeys(GetRequiredKeysRequest)} 10 | */ 11 | public class GetRequiredKeysRequest { 12 | 13 | /** 14 | * The available keys which come from a Signature Provider or are manually set. 15 | */ 16 | @SerializedName("available_keys") 17 | @NotNull 18 | private List availableKeys; 19 | 20 | /** 21 | * The Transaction which will be broadcast to the blockchain.
Actions of the 22 | * transaction have to be serialized. 23 | */ 24 | @SerializedName("transaction") 25 | @NotNull 26 | private Transaction transaction; 27 | 28 | /** 29 | * Instantiates a new GetRequiredKeysRequest. 30 | * 31 | * @param availableKeys the available keys which come from a SignatureProvider or are manually set 32 | * @param transaction the transaction which will be broadcast to the blockchain. Actions of 33 | * the transaction have to be serialized. 34 | */ 35 | public GetRequiredKeysRequest(@NotNull List availableKeys, 36 | @NotNull Transaction transaction) { 37 | this.availableKeys = availableKeys; 38 | this.transaction = transaction; 39 | } 40 | 41 | /** 42 | * Gets available keys which come from a Signature Provider or are manually set. 43 | * 44 | * @return the available keys 45 | */ 46 | @NotNull 47 | public List getAvailableKeys() { 48 | return availableKeys; 49 | } 50 | 51 | /** 52 | * Sets available keys which come from a Signature Provider or are manually set. 53 | * 54 | * @param availableKeys the available keys 55 | */ 56 | public void setAvailableKeys(@NotNull List availableKeys) { 57 | this.availableKeys = availableKeys; 58 | } 59 | 60 | /** 61 | * Gets transaction. The Transaction which will be broadcast to the blockchain. 62 | *
63 | * Actions of the transaction have to be serialized. 64 | * 65 | * @return the transaction 66 | */ 67 | @NotNull 68 | public Transaction getTransaction() { 69 | return transaction; 70 | } 71 | 72 | /** 73 | * Sets transaction. The Transaction which will be broadcast to the blockchain.
Actions 74 | * of the transaction have to be serialized. 75 | * 76 | * @param transaction the transaction 77 | */ 78 | public void setTransaction(@NotNull Transaction transaction) { 79 | this.transaction = transaction; 80 | } 81 | 82 | } 83 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/models/rpcProvider/request/PushTransactionRequest.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.models.rpcProvider.request; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | import java.util.List; 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | /** 8 | * The request of PushTransactionRequest RPC call. 9 | */ 10 | public class PushTransactionRequest extends SendTransactionRequest { 11 | 12 | /** 13 | * Instantiates a new PushTransactionRequest. 14 | * 15 | * @param signatures the list of signatures required to authorize transaction 16 | * @param compression the compression used, usually 0. 17 | * @param packagedContextFreeData the context free data in hex 18 | * @param packTrx the packed Transaction (serialized transaction). It is serialized version 19 | * of {@link one.block.eosiojava.models.rpcProvider.Transaction}. 20 | */ 21 | public PushTransactionRequest(@NotNull List signatures, int compression, 22 | String packagedContextFreeData, @NotNull String packTrx) { 23 | super(signatures, compression, packagedContextFreeData, packTrx); 24 | } 25 | 26 | /** 27 | * Gets list of signatures required to authorize transaction. 28 | * 29 | * @return the list of signatures 30 | */ 31 | @NotNull 32 | public List getSignatures() { 33 | return super.getSignatures(); 34 | } 35 | 36 | /** 37 | * Sets list of signatures required to authorize transaction. 38 | * 39 | * @param signatures the list of signatures. 40 | */ 41 | public void setSignatures(@NotNull List signatures) { 42 | super.setSignatures(signatures); 43 | } 44 | 45 | /** 46 | * Gets the compression used, usually 0. 47 | * 48 | * @return the compression. 49 | */ 50 | public int getCompression() { 51 | return super.getCompression(); 52 | } 53 | 54 | /** 55 | * Sets the compression used, usually 0. 56 | * 57 | * @param compression the compression. 58 | */ 59 | public void setCompression(int compression) { 60 | super.setCompression(compression); 61 | } 62 | 63 | /** 64 | * Gets packaged context free data in hex. 65 | * 66 | * @return the packaged context free data in hex. 67 | */ 68 | public String getPackagedContextFreeData() { 69 | return super.getPackagedContextFreeData(); 70 | } 71 | 72 | /** 73 | * Sets packaged context free data in hex 74 | * 75 | * @param packagedContextFreeData the packaged context free data in hex. 76 | */ 77 | public void setPackagedContextFreeData(String packagedContextFreeData) { 78 | super.setPackagedContextFreeData(packagedContextFreeData); 79 | } 80 | 81 | /** 82 | * Gets the packed transaction (serialized transaction). 83 | *
It is serialized version of {@link one.block.eosiojava.models.rpcProvider.Transaction}. 84 | * 85 | * @return the Pack Transaction (Serialized Transaction). 86 | */ 87 | @NotNull 88 | public String getPackTrx() { 89 | return super.getPackTrx(); 90 | } 91 | 92 | /** 93 | * Sets the packed transaction (serialized transaction). 94 | *
It is the serialized version of {@link one.block.eosiojava.models.rpcProvider.Transaction}. 95 | * 96 | * @param packTrx the packed transaction (serialized transaction). 97 | */ 98 | public void setPackTrx(@NotNull String packTrx) { 99 | super.setPackTrx(packTrx); 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/models/rpcProvider/request/SendTransactionRequest.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.models.rpcProvider.request; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | import java.util.List; 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | /** 8 | * The request of SendTransactionRequest RPC call {@link one.block.eosiojava.interfaces.IRPCProvider#sendTransaction(SendTransactionRequest)} 9 | */ 10 | public class SendTransactionRequest { 11 | 12 | /** 13 | * List of signatures required to authorize transaction 14 | */ 15 | @SerializedName("signatures") 16 | @NotNull 17 | private List signatures; 18 | 19 | /** 20 | * The compression used, usually 0. 21 | */ 22 | @SerializedName("compression") 23 | private int compression; 24 | 25 | /** 26 | * Context free data in hex 27 | */ 28 | @SerializedName("packed_context_free_data") 29 | private String packagedContextFreeData; 30 | 31 | /** 32 | * The Pack Transaction (Serialized Transaction). 33 | *
It is serialized version of {@link one.block.eosiojava.models.rpcProvider.Transaction}. 34 | */ 35 | @SerializedName("packed_trx") 36 | @NotNull 37 | private String packTrx; 38 | 39 | /** 40 | * Instantiates a new SendTransactionRequest. 41 | * 42 | * @param signatures the list of signatures required to authorize transaction 43 | * @param compression the compression used, usually 0. 44 | * @param packagedContextFreeData the context free data in hex 45 | * @param packTrx the packed Transaction (serialized transaction). It is serialized version 46 | * of {@link one.block.eosiojava.models.rpcProvider.Transaction}. 47 | */ 48 | public SendTransactionRequest(@NotNull List signatures, int compression, 49 | String packagedContextFreeData, @NotNull String packTrx) { 50 | this.signatures = signatures; 51 | this.compression = compression; 52 | this.packagedContextFreeData = packagedContextFreeData; 53 | this.packTrx = packTrx; 54 | } 55 | 56 | /** 57 | * Gets list of signatures required to authorize transaction. 58 | * 59 | * @return the list of signatures 60 | */ 61 | @NotNull 62 | public List getSignatures() { 63 | return signatures; 64 | } 65 | 66 | /** 67 | * Sets list of signatures required to authorize transaction. 68 | * 69 | * @param signatures the list of signatures. 70 | */ 71 | public void setSignatures(@NotNull List signatures) { 72 | this.signatures = signatures; 73 | } 74 | 75 | /** 76 | * Gets the compression used, usually 0. 77 | * 78 | * @return the compression. 79 | */ 80 | public int getCompression() { 81 | return compression; 82 | } 83 | 84 | /** 85 | * Sets the compression used, usually 0. 86 | * 87 | * @param compression the compression. 88 | */ 89 | public void setCompression(int compression) { 90 | this.compression = compression; 91 | } 92 | 93 | /** 94 | * Gets packaged context free data in hex. 95 | * 96 | * @return the packaged context free data in hex. 97 | */ 98 | public String getPackagedContextFreeData() { 99 | return packagedContextFreeData; 100 | } 101 | 102 | /** 103 | * Sets packaged context free data in hex 104 | * 105 | * @param packagedContextFreeData the packaged context free data in hex. 106 | */ 107 | public void setPackagedContextFreeData(String packagedContextFreeData) { 108 | this.packagedContextFreeData = packagedContextFreeData; 109 | } 110 | 111 | /** 112 | * Gets the packed transaction (serialized transaction). 113 | *
It is serialized version of {@link one.block.eosiojava.models.rpcProvider.Transaction}. 114 | * 115 | * @return the Pack Transaction (Serialized Transaction). 116 | */ 117 | @NotNull 118 | public String getPackTrx() { 119 | return packTrx; 120 | } 121 | 122 | /** 123 | * Sets the packed transaction (serialized transaction). 124 | *
It is the serialized version of {@link one.block.eosiojava.models.rpcProvider.Transaction}. 125 | * 126 | * @param packTrx the packed transaction (serialized transaction). 127 | */ 128 | public void setPackTrx(@NotNull String packTrx) { 129 | this.packTrx = packTrx; 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/models/rpcProvider/request/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Provides request model classes for RPC provider {@link one.block.eosiojava.interfaces.IRPCProvider} 3 | */ 4 | 5 | package one.block.eosiojava.models.rpcProvider.request; -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/models/rpcProvider/response/Detail.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.models.rpcProvider.response; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | import java.math.BigInteger; 5 | 6 | /** 7 | * The Error Detail of {@link RPCResponseError} 8 | */ 9 | public class Detail { 10 | 11 | /** 12 | * The error message. 13 | */ 14 | @SerializedName("message") 15 | private String message; 16 | 17 | /** 18 | * The error file on backend. 19 | */ 20 | @SerializedName("file") 21 | private String file; 22 | 23 | /** 24 | * The error line number on backend. 25 | */ 26 | @SerializedName("line_number") 27 | private BigInteger lineNumber; 28 | 29 | /** 30 | * The method that caused the error on backend. 31 | */ 32 | @SerializedName("method") 33 | private String method; 34 | 35 | /** 36 | * Gets the error message. 37 | * 38 | * @return the error message 39 | */ 40 | public String getMessage() { 41 | return message; 42 | } 43 | 44 | /** 45 | * Gets the error file from backend. 46 | * 47 | * @return the error file 48 | */ 49 | public String getFile() { 50 | return file; 51 | } 52 | 53 | /** 54 | * Gets the error line number from backend. 55 | * 56 | * @return the error line number 57 | */ 58 | public BigInteger getLineNumber() { 59 | return lineNumber; 60 | } 61 | 62 | /** 63 | * Gets the method that caused the error from backend. 64 | * 65 | * @return the method causing the error 66 | */ 67 | public String getMethod() { 68 | return method; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/models/rpcProvider/response/GetBlockInfoResponse.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.models.rpcProvider.response; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | import java.math.BigInteger; 5 | import java.util.List; 6 | import java.util.Map; 7 | import one.block.eosiojava.models.rpcProvider.request.GetBlockRequest; 8 | 9 | /** 10 | * The response of getBlockInfo() RPC call {@link one.block.eosiojava.interfaces.IRPCProvider#getBlockInfo(GetBlockInfoRequest)} 11 | */ 12 | public class GetBlockInfoResponse { 13 | 14 | /** 15 | * The timestamp for the block from blockchain. 16 | *
17 | * Format: Date/time string in the format YYYY-MM-DDTHH:MM:SS.sss 18 | */ 19 | @SerializedName("timestamp") 20 | private String timestamp; 21 | 22 | /** 23 | * The block producer name. 24 | */ 25 | @SerializedName("producer") 26 | private String producer; 27 | 28 | @SerializedName("confirmed") 29 | private BigInteger confirmed; 30 | 31 | @SerializedName("previous") 32 | private String previous; 33 | 34 | @SerializedName("transaction_mroot") 35 | private String transactionMroot; 36 | 37 | @SerializedName("action_mroot") 38 | private String actionMroot; 39 | 40 | @SerializedName("schedule_version") 41 | private BigInteger scheduleVersion; 42 | 43 | @SerializedName("producer_signature") 44 | private String producerSignature; 45 | 46 | /** 47 | * The block id 48 | */ 49 | @SerializedName("id") 50 | private String id; 51 | 52 | /** 53 | * The block number. This is used to construct the refBlockNum of 54 | * {@link one.block.eosiojava.models.rpcProvider.Transaction}. 55 | */ 56 | @SerializedName("block_num") 57 | private BigInteger blockNum; 58 | 59 | /** 60 | * The reference block prefix. This is used to construct refBlockPrefix of 61 | * {@link one.block.eosiojava.models.rpcProvider.Transaction}. 62 | */ 63 | @SerializedName("ref_block_prefix") 64 | private BigInteger refBlockPrefix; 65 | 66 | /** 67 | * Gets the timestamp for the block from the blockchain. 68 | *
69 | * Format: Date/time string in the format YYYY-MM-DDTHH:MM:SS.sss. 70 | * 71 | * @return the timestamp 72 | */ 73 | public String getTimestamp() { 74 | return timestamp; 75 | } 76 | 77 | /** 78 | * Gets the block producer name. 79 | * 80 | * @return block producer name 81 | */ 82 | public String getProducer() { 83 | return producer; 84 | } 85 | 86 | public BigInteger getConfirmed() { 87 | return confirmed; 88 | } 89 | 90 | public String getPrevious() { 91 | return previous; 92 | } 93 | 94 | public String getTransactionMroot() { 95 | return transactionMroot; 96 | } 97 | 98 | public String getActionMroot() { 99 | return actionMroot; 100 | } 101 | 102 | public BigInteger getScheduleVersion() { 103 | return scheduleVersion; 104 | } 105 | 106 | public String getProducerSignature() { 107 | return producerSignature; 108 | } 109 | 110 | /** 111 | * Gets the block id. 112 | * 113 | * @return the block id 114 | */ 115 | public String getId() { 116 | return id; 117 | } 118 | 119 | /** 120 | * Gets the block number. Which is used to construct refBlockNum field of 121 | * {@link one.block.eosiojava.models.rpcProvider.Transaction} 122 | * 123 | * @return the block number. 124 | */ 125 | public BigInteger getBlockNum() { 126 | return blockNum; 127 | } 128 | 129 | /** 130 | * Gets reference block prefix. This is used for refBlockPrefix field of 131 | * {@link one.block.eosiojava.models.rpcProvider.Transaction}. 132 | * 133 | * @return the ref block prefix 134 | */ 135 | public BigInteger getRefBlockPrefix() { 136 | return refBlockPrefix; 137 | } 138 | } 139 | 140 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/models/rpcProvider/response/GetBlockResponse.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.models.rpcProvider.response; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | import java.math.BigInteger; 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | import one.block.eosiojava.models.rpcProvider.request.GetBlockInfoRequest; 9 | import one.block.eosiojava.models.rpcProvider.request.GetBlockRequest; 10 | 11 | /** 12 | * The response of getBlock() RPC call {@link one.block.eosiojava.interfaces.IRPCProvider#getBlockInfo(GetBlockInfoRequest)} 13 | */ 14 | public class GetBlockResponse { 15 | 16 | /** 17 | * The timestamp for the block from blockchain. 18 | *
19 | * Format: Date/time string in the format YYYY-MM-DDTHH:MM:SS.sss 20 | */ 21 | @SerializedName("timestamp") 22 | private String timestamp; 23 | 24 | /** 25 | * The block producer name. 26 | */ 27 | @SerializedName("producer") 28 | private String producer; 29 | 30 | @SerializedName("confirmed") 31 | private BigInteger confirmed; 32 | 33 | @SerializedName("previous") 34 | private String previous; 35 | 36 | @SerializedName("transaction_mroot") 37 | private String transactionMroot; 38 | 39 | @SerializedName("action_mroot") 40 | private String actionMroot; 41 | 42 | @SerializedName("schedule_version") 43 | private BigInteger scheduleVersion; 44 | 45 | @SerializedName("new_producers") 46 | private String newProducers; 47 | 48 | @SerializedName("header_extensions") 49 | private List headerExtensions; 50 | 51 | @SerializedName("producer_signature") 52 | private String producerSignature; 53 | 54 | @SerializedName("transactions") 55 | private List transactions; 56 | 57 | @SerializedName("block_extensions") 58 | private List blockExtensions; 59 | 60 | /** 61 | * The block id 62 | */ 63 | @SerializedName("id") 64 | private String id; 65 | 66 | /** 67 | * The block number. This is used to construct the refBlockNum of 68 | * {@link one.block.eosiojava.models.rpcProvider.Transaction}. 69 | */ 70 | @SerializedName("block_num") 71 | private BigInteger blockNum; 72 | 73 | /** 74 | * The reference block prefix. This is used to construct refBlockPrefix of 75 | * {@link one.block.eosiojava.models.rpcProvider.Transaction}. 76 | */ 77 | @SerializedName("ref_block_prefix") 78 | private BigInteger refBlockPrefix; 79 | 80 | /** 81 | * Gets the timestamp for the block from the blockchain. 82 | *
83 | * Format: Date/time string in the format YYYY-MM-DDTHH:MM:SS.sss. 84 | * 85 | * @return the timestamp 86 | */ 87 | public String getTimestamp() { 88 | return timestamp; 89 | } 90 | 91 | /** 92 | * Gets the block producer name. 93 | * 94 | * @return block producer name 95 | */ 96 | public String getProducer() { 97 | return producer; 98 | } 99 | 100 | public BigInteger getConfirmed() { 101 | return confirmed; 102 | } 103 | 104 | public String getPrevious() { 105 | return previous; 106 | } 107 | 108 | public String getTransactionMroot() { 109 | return transactionMroot; 110 | } 111 | 112 | public String getActionMroot() { 113 | return actionMroot; 114 | } 115 | 116 | public BigInteger getScheduleVersion() { 117 | return scheduleVersion; 118 | } 119 | 120 | public Object getNewProducers() { 121 | return newProducers; 122 | } 123 | 124 | public List getHeaderExtensions() { 125 | return headerExtensions; 126 | } 127 | 128 | public String getProducerSignature() { 129 | return producerSignature; 130 | } 131 | 132 | public List getTransactions() { 133 | return transactions; 134 | } 135 | 136 | public List getBlockExtensions() { 137 | return blockExtensions; 138 | } 139 | 140 | /** 141 | * Gets the block id. 142 | * 143 | * @return the block id 144 | */ 145 | public String getId() { 146 | return id; 147 | } 148 | 149 | /** 150 | * Gets the block number. Which is used to construct refBlockNum field of 151 | * {@link one.block.eosiojava.models.rpcProvider.Transaction} 152 | * 153 | * @return the block number. 154 | */ 155 | public BigInteger getBlockNum() { 156 | return blockNum; 157 | } 158 | 159 | /** 160 | * Gets reference block prefix. This is used for refBlockPrefix field of 161 | * {@link one.block.eosiojava.models.rpcProvider.Transaction}. 162 | * 163 | * @return the ref block prefix 164 | */ 165 | public BigInteger getRefBlockPrefix() { 166 | return refBlockPrefix; 167 | } 168 | } 169 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/models/rpcProvider/response/GetInfoResponse.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.models.rpcProvider.response; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | import java.math.BigInteger; 5 | import java.util.List; 6 | import one.block.eosiojava.interfaces.IRPCProvider; 7 | import one.block.eosiojava.models.rpcProvider.Transaction; 8 | import one.block.eosiojava.models.rpcProvider.request.GetBlockInfoRequest; 9 | import one.block.eosiojava.models.rpcProvider.request.GetBlockRequest; 10 | 11 | /** 12 | * The response of getInfo() RPC call {@link IRPCProvider#getInfo()}. 13 | */ 14 | public class GetInfoResponse { 15 | 16 | @SerializedName("server_version") 17 | private String serverVersion; 18 | 19 | /** 20 | * The chain id of the blockchain being queried. It is an argument need in the following method 21 | * call: {@link one.block.eosiojava.utilities.EOSFormatter#prepareSerializedTransactionForSigning(String, 22 | * String)} 23 | */ 24 | @SerializedName("chain_id") 25 | private String chainId; 26 | 27 | /** 28 | * The head block number. It is an argument used to specify the reference block to call {@link 29 | * one.block.eosiojava.interfaces.IRPCProvider#getBlock(GetBlockRequest)} at {@link 30 | * one.block.eosiojava.session.TransactionProcessor#prepare(List)} 31 | */ 32 | @SerializedName("head_block_num") 33 | private BigInteger headBlockNum; 34 | 35 | @SerializedName("last_irreversible_block_num") 36 | private BigInteger lastIrreversibleBlockNum; 37 | 38 | @SerializedName("last_irreversible_block_id") 39 | private String lastIrreversibleBlockId; 40 | 41 | /** 42 | * The head block id. 43 | */ 44 | @SerializedName("head_block_id") 45 | private String headBlockId; 46 | 47 | /** 48 | * The head block time. It is used to calculate expiration time for {@link 49 | * Transaction#setExpiration(String)}} at {@link one.block.eosiojava.session.TransactionProcessor#prepare(List)} 50 | */ 51 | @SerializedName("head_block_time") 52 | private String headBlockTime; 53 | 54 | /** 55 | * The head block producer name. 56 | */ 57 | @SerializedName("head_block_producer") 58 | private String headBlockProducer; 59 | 60 | @SerializedName("virtual_block_cpu_limit") 61 | private BigInteger virtualBlockCpuLimit; 62 | 63 | @SerializedName("virtual_block_net_limit") 64 | private BigInteger virtualBlockNetLimit; 65 | 66 | @SerializedName("block_cpu_limit") 67 | private BigInteger blockCpuLimit; 68 | 69 | @SerializedName("block_net_limit") 70 | private BigInteger blockNetLimit; 71 | 72 | @SerializedName("server_version_string") 73 | private String serverVersionString; 74 | 75 | public String getServerVersion() { 76 | return serverVersion; 77 | } 78 | 79 | /** 80 | * Gets the chain id of the blockchain transactions are being sent to. It is an argument used in {@link 81 | * one.block.eosiojava.utilities.EOSFormatter#prepareSerializedTransactionForSigning(String, 82 | * String)} 83 | * 84 | * @return the chain id. 85 | */ 86 | public String getChainId() { 87 | return chainId; 88 | } 89 | 90 | /** 91 | * Gets the head block number. It is an argument used to specify the reference block to call {@link 92 | * one.block.eosiojava.interfaces.IRPCProvider#getBlockInfo(GetBlockInfoRequest)} at {@link 93 | * one.block.eosiojava.session.TransactionProcessor#prepare(List)} 94 | * @return the head block number. 95 | */ 96 | public BigInteger getHeadBlockNum() { 97 | return headBlockNum; 98 | } 99 | 100 | public BigInteger getLastIrreversibleBlockNum() { 101 | return lastIrreversibleBlockNum; 102 | } 103 | 104 | public String getLastIrreversibleBlockId() { 105 | return lastIrreversibleBlockId; 106 | } 107 | 108 | /** 109 | * The head block id. 110 | * @return head block id. 111 | */ 112 | public String getHeadBlockId() { 113 | return headBlockId; 114 | } 115 | 116 | /** 117 | * Gets the head block time. This is used to calculate expiration time for {@link 118 | * Transaction#setExpiration(String)}} at {@link one.block.eosiojava.session.TransactionProcessor#prepare(List)} 119 | * @return the head block time. 120 | */ 121 | public String getHeadBlockTime() { 122 | return headBlockTime; 123 | } 124 | 125 | /** 126 | * Gets the head block producer name. 127 | * 128 | * @return the head block producer name. 129 | */ 130 | public String getHeadBlockProducer() { 131 | return headBlockProducer; 132 | } 133 | 134 | public BigInteger getVirtualBlockCpuLimit() { 135 | return virtualBlockCpuLimit; 136 | } 137 | 138 | public BigInteger getVirtualBlockNetLimit() { 139 | return virtualBlockNetLimit; 140 | } 141 | 142 | public BigInteger getBlockCpuLimit() { 143 | return blockCpuLimit; 144 | } 145 | 146 | public BigInteger getBlockNetLimit() { 147 | return blockNetLimit; 148 | } 149 | 150 | public String getServerVersionString() { 151 | return serverVersionString; 152 | } 153 | } 154 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/models/rpcProvider/response/GetRawAbiResponse.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.models.rpcProvider.response; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | import one.block.eosiojava.models.rpcProvider.request.GetRawAbiRequest; 5 | 6 | /** 7 | * The response of getRawAbi() RPC call {@link one.block.eosiojava.interfaces.IRPCProvider#getRawAbi(GetRawAbiRequest)} 8 | */ 9 | public class GetRawAbiResponse { 10 | 11 | /** 12 | * The account name (contract name) found in {@link one.block.eosiojava.models.EOSIOName} 13 | */ 14 | @SerializedName("account_name") 15 | private String accountName; 16 | 17 | @SerializedName("code_hash") 18 | private String codeHash; 19 | 20 | @SerializedName("abi_hash") 21 | private String abiHash; 22 | 23 | /** 24 | * The ABI (raw ABI) of the account name (contract name) 25 | *
26 | * This ABI is used to serialize a contract's action data. 27 | */ 28 | @SerializedName("abi") 29 | private String abi; 30 | 31 | /** 32 | * Gets the account name (contract name) found in {@link one.block.eosiojava.models.EOSIOName} 33 | * 34 | * @return the account name. 35 | */ 36 | public String getAccountName() { 37 | return accountName; 38 | } 39 | 40 | public String getCodeHash() { 41 | return codeHash; 42 | } 43 | 44 | public String getAbiHash() { 45 | return abiHash; 46 | } 47 | 48 | /** 49 | * Gets The ABI (raw ABI) of the account name (contract name). 50 | *
51 | * This ABI is used to serialize a contract's action data. 52 | * 53 | * @return the raw ABI 54 | */ 55 | public String getAbi() { 56 | return abi; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/models/rpcProvider/response/GetRequiredKeysResponse.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.models.rpcProvider.response; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | import java.util.List; 5 | import one.block.eosiojava.models.rpcProvider.request.GetRequiredKeysRequest; 6 | 7 | /** 8 | * The response of getRequiredKeys() RPC call {@link one.block.eosiojava.interfaces.IRPCProvider#getRequiredKeys(GetRequiredKeysRequest)} 9 | */ 10 | public class GetRequiredKeysResponse { 11 | 12 | /** 13 | * The required public EOSIO keys to sign the transaction. It gets assigned to {@link 14 | * one.block.eosiojava.models.signatureProvider.EosioTransactionSignatureRequest#setSigningPublicKeys(List)}, 15 | * which is passed to a Signature Provider to sign a transaction. 16 | */ 17 | @SerializedName("required_keys") 18 | private List requiredKeys; 19 | 20 | /** 21 | * Gets the required public EOSIO keys to sign the transaction. It gets assigned to {@link 22 | * one.block.eosiojava.models.signatureProvider.EosioTransactionSignatureRequest#setSigningPublicKeys(List)}, 23 | * which is passed to a Signature Provider to sign a transaction. 24 | * @return The required public EOSIO keys. 25 | */ 26 | public List getRequiredKeys() { 27 | return requiredKeys; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/models/rpcProvider/response/PushTransactionResponse.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.models.rpcProvider.response; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | import java.lang.reflect.Array; 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | import java.util.Map; 9 | import one.block.eosiojava.models.rpcProvider.request.PushTransactionRequest; 10 | 11 | /** 12 | * The response of the pushTransaction() RPC call 13 | */ 14 | public class PushTransactionResponse extends SendTransactionResponse { 15 | 16 | /** 17 | * Gets the transaction id of the successful transaction. 18 | * 19 | * @return The successful transaction id. 20 | */ 21 | public String getTransactionId() { 22 | return super.getTransactionId(); 23 | } 24 | 25 | /** 26 | * Gets the processed detail information of the successful transaction. 27 | * 28 | * @return The successful processed details of the transaction. 29 | */ 30 | public Map getProcessed() { 31 | return super.getProcessed(); 32 | } 33 | 34 | /** 35 | * Return action values, if any. The returned values are placed in their respective actions. 36 | * The array must contain null for the actions that do not return action values. 37 | * There may be more action values than input actions due to inline actions or notifications 38 | * but input (request) actions are always returned first and in the same order as they were 39 | * submitted. 40 | * 41 | * @return ArrayList of Objects containing the return values from the response. 42 | */ 43 | public ArrayList getActionValues() { 44 | return super.getActionValues(); 45 | } 46 | 47 | /** 48 | * Get the action value at the specified index, if it exists and return it as the passed in type. 49 | * @param index The index of the action value returns to retrieve. 50 | * @param clazz The class type to cast the action value to, if found. 51 | * @return The action value as the desired type or null if not found or is the wrong type. 52 | * @throws ClassCastException if the value cannot be cast to the requested type. 53 | * @throws IndexOutOfBoundsException if an incorrect index is requested. 54 | */ 55 | public T getActionValueAtIndex(int index, Class clazz) throws IndexOutOfBoundsException, ClassCastException { 56 | return super.getActionValueAtIndex(index, clazz); 57 | } 58 | } -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/models/rpcProvider/response/RPCResponseError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.models.rpcProvider.response; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | import java.math.BigInteger; 5 | 6 | /** 7 | * The generic response error could be thrown from Rpc calls of {@link one.block.eosiojava.interfaces.IRPCProvider} 8 | */ 9 | public class RPCResponseError { 10 | 11 | /** 12 | * The error Code. 13 | */ 14 | @SerializedName("code") 15 | private BigInteger code; 16 | 17 | /** 18 | * The error Message. 19 | */ 20 | @SerializedName("message") 21 | private String message; 22 | 23 | /** 24 | * The Error detail. 25 | */ 26 | @SerializedName("error") 27 | private RpcError error; 28 | 29 | /** 30 | * Gets error code. 31 | * 32 | * @return the error code. 33 | */ 34 | public BigInteger getCode() { 35 | return code; 36 | } 37 | 38 | /** 39 | * Gets error message. 40 | * 41 | * @return the error message. 42 | */ 43 | public String getMessage() { 44 | return message; 45 | } 46 | 47 | /** 48 | * Gets error detail. 49 | * 50 | * @return the error detail. 51 | */ 52 | public RpcError getError() { 53 | return error; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/models/rpcProvider/response/RpcError.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.models.rpcProvider.response; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | import java.math.BigInteger; 5 | import java.util.List; 6 | 7 | /** 8 | * The error detail of {@link RPCResponseError} 9 | */ 10 | public class RpcError { 11 | 12 | /** 13 | * The error code. 14 | */ 15 | @SerializedName("code") 16 | private BigInteger code; 17 | 18 | /** 19 | * The error name. 20 | */ 21 | @SerializedName("name") 22 | private String name; 23 | 24 | @SerializedName("what") 25 | private String what; 26 | 27 | /** 28 | * A more comprehensive explanation of the error. 29 | */ 30 | @SerializedName("details") 31 | private List details; 32 | 33 | /** 34 | * Gets the error code. 35 | * 36 | * @return the code 37 | */ 38 | public BigInteger getCode() { 39 | return code; 40 | } 41 | 42 | /** 43 | * Gets the name. 44 | * 45 | * @return the name 46 | */ 47 | public String getName() { 48 | return name; 49 | } 50 | 51 | public String getWhat() { 52 | return what; 53 | } 54 | 55 | /** 56 | * Gets a more comprehensive explanation of the error. 57 | * 58 | * @return the deeper details 59 | */ 60 | public List getDetails() { 61 | return details; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/models/rpcProvider/response/SendTransactionResponse.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.models.rpcProvider.response; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | import java.beans.Transient; 6 | import java.lang.reflect.Array; 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | import java.util.Map; 10 | import one.block.eosiojava.models.rpcProvider.request.SendTransactionRequest; 11 | 12 | /** 13 | * The response of the sendTransaction() RPC call 14 | * {@link one.block.eosiojava.interfaces.IRPCProvider#sendTransaction(SendTransactionRequest)} 15 | */ 16 | public class SendTransactionResponse { 17 | 18 | /** 19 | * The transaction id of the successful transaction. 20 | */ 21 | @SerializedName("transaction_id") 22 | private String transactionId; 23 | 24 | @SerializedName("processed") 25 | private Map processed; 26 | 27 | private transient static final String ACTION_TRACES_NAME = "action_traces"; 28 | 29 | private transient static final String RETURN_VALUE_DATA_NAME = "return_value_data"; 30 | 31 | /** 32 | * Gets the transaction id of the successful transaction. 33 | * 34 | * @return The successful transaction id. 35 | */ 36 | public String getTransactionId() { 37 | return transactionId; 38 | } 39 | 40 | /** 41 | * Gets the processed detail information of the successful transaction. 42 | * 43 | * @return The successful processed details of the transaction. 44 | */ 45 | public Map getProcessed() { 46 | return processed; 47 | } 48 | 49 | /** 50 | * Return action values, if any. The returned values are placed in their respective actions. 51 | * The array must contain null for the actions that do not return action values. 52 | * There may be more action values than input actions due to inline actions or notifications 53 | * but input (request) actions are always returned first and in the same order as they were 54 | * submitted. 55 | * 56 | * @return ArrayList of Objects containing the return values from the response. 57 | */ 58 | public ArrayList getActionValues() { 59 | ArrayList returnValues = new ArrayList(); 60 | if (processed == null) { return returnValues; } 61 | if (!processed.containsKey(ACTION_TRACES_NAME)) { return returnValues; } 62 | for (Map trace : (List) processed.get(ACTION_TRACES_NAME)) { 63 | returnValues.add(trace.getOrDefault(RETURN_VALUE_DATA_NAME, null)); 64 | } 65 | return returnValues; 66 | } 67 | 68 | /** 69 | * Get the action value at the specified index, if it exists and return it as the passed in type. 70 | * @param index The index of the action value returns to retrieve. 71 | * @param clazz The class type to cast the action value to, if found. 72 | * @param Typed return. 73 | * @return The action value as the desired type or null if not found or is the wrong type. 74 | * @throws ClassCastException if the value cannot be cast to the requested type. 75 | * @throws IndexOutOfBoundsException if an incorrect index is requested. 76 | */ 77 | public T getActionValueAtIndex(int index, Class clazz) throws IndexOutOfBoundsException, ClassCastException { 78 | ArrayList actionValues = getActionValues(); 79 | if (actionValues == null) { return null; } 80 | Object actionValuesObj = actionValues.get(index); 81 | return clazz.cast(actionValuesObj); 82 | } 83 | } -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/models/rpcProvider/response/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Provides response model classes for RPC provider {@link one.block.eosiojava.interfaces.IRPCProvider} 3 | */ 4 | 5 | package one.block.eosiojava.models.rpcProvider.response; -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/models/signatureProvider/BinaryAbi.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.models.signatureProvider; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | /** 7 | * This class holds data of the ABI and its contract account name that is passed to a Signature 8 | * Provider inside {@link EosioTransactionSignatureRequest} 9 | */ 10 | public class BinaryAbi { 11 | 12 | /** 13 | * The contract account name. 14 | */ 15 | @SerializedName("account_name") 16 | @NotNull 17 | private String accountName; 18 | 19 | /** 20 | * The ABI. 21 | */ 22 | @SerializedName("abi") 23 | @NotNull 24 | private String abi; 25 | 26 | /** 27 | * Instantiates a new Binary abi. 28 | * 29 | * @param accountName the contract account name 30 | * @param abi the ABI 31 | */ 32 | public BinaryAbi(@NotNull String accountName, @NotNull String abi) { 33 | this.accountName = accountName; 34 | this.abi = abi; 35 | } 36 | 37 | /** 38 | * Gets contract account name. 39 | * 40 | * @return the contract account name 41 | */ 42 | @NotNull 43 | public String getAccountName() { 44 | return accountName; 45 | } 46 | 47 | /** 48 | * Sets contract account name. 49 | * 50 | * @param accountName the contract account name 51 | */ 52 | public void setAccountName(@NotNull String accountName) { 53 | this.accountName = accountName; 54 | } 55 | 56 | /** 57 | * Gets ABI. 58 | * 59 | * @return the ABI 60 | */ 61 | @NotNull 62 | public String getAbi() { 63 | return abi; 64 | } 65 | 66 | /** 67 | * Sets ABI. 68 | * 69 | * @param abi the ABI 70 | */ 71 | public void setAbi(@NotNull String abi) { 72 | this.abi = abi; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/models/signatureProvider/EosioTransactionSignatureRequest.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.models.signatureProvider; 2 | 3 | import java.util.List; 4 | import one.block.eosiojava.models.rpcProvider.ContextFreeData; 5 | import one.block.eosiojava.models.rpcProvider.response.GetInfoResponse; 6 | import org.bouncycastle.util.encoders.Hex; 7 | 8 | /** 9 | * The request object that will be sent to SignatureProvider. It contains the transaction that will 10 | * need to be signed. 11 | */ 12 | public class EosioTransactionSignatureRequest { 13 | 14 | /** 15 | * The serialized (Hex) version of {@link one.block.eosiojava.models.rpcProvider.Transaction}. 16 | *
17 | * It is the result of {@link one.block.eosiojava.interfaces.ISerializationProvider#serializeTransaction(String)} 18 | */ 19 | private String serializedTransaction; 20 | 21 | /** 22 | * The serialized (Hex) version of all concatenated context free data 23 | */ 24 | private String serializedContextFreeData; 25 | 26 | /** 27 | * The EOSIO public keys which will be used to find the private keys (or key identities) to sign 28 | * the serialized transaction. 29 | */ 30 | private List signingPublicKeys; 31 | 32 | /** 33 | * The chain id of the target blockchain. 34 | *
35 | * Its value comes from {@link GetInfoResponse#getChainId()} 36 | */ 37 | private String chainId; 38 | 39 | /** 40 | * The list of ABIs passed to the signature provider. 41 | */ 42 | private List abis; 43 | 44 | /** 45 | * Whether the serialized transaction is modifiable. 46 | *
47 | * If the signature provider modifies the serialized transaction and returns it in the response {@link 48 | * EosioTransactionSignatureResponse#getSerializedTransaction()} and this field is false then 49 | * {@link one.block.eosiojava.error.session.TransactionGetSignatureNotAllowModifyTransactionError} 50 | * will be thrown. 51 | */ 52 | private boolean isModifiable; 53 | 54 | /** 55 | * Instantiates a new Eosio transaction signature request. 56 | * 57 | * @param serializedTransaction the serialized transaction 58 | * @param signingPublicKeys the signing public keys 59 | * @param chainId the chain id 60 | * @param abis the ABIs 61 | * @param isModifiable boolean to indicate whether the signature provider is able to modify the 62 | * transaction 63 | * @param serializedContextFreeData the serialized contextFreeData 64 | */ 65 | public EosioTransactionSignatureRequest(String serializedTransaction, 66 | List signingPublicKeys, String chainId, List abis, 67 | boolean isModifiable, String serializedContextFreeData) { 68 | this.serializedTransaction = serializedTransaction; 69 | this.signingPublicKeys = signingPublicKeys; 70 | this.chainId = chainId; 71 | this.abis = abis; 72 | this.isModifiable = isModifiable; 73 | this.setSerializedContextFreeData(serializedContextFreeData); 74 | } 75 | 76 | /** 77 | * Instantiates a new Eosio transaction signature request. 78 | * 79 | * @param serializedTransaction the serialized transaction 80 | * @param signingPublicKeys the signing public keys 81 | * @param chainId the chain id 82 | * @param abis the ABIs 83 | * @param isModifiable boolean to indicate whether the signature provider is able to modify the 84 | * transaction 85 | */ 86 | public EosioTransactionSignatureRequest(String serializedTransaction, 87 | List signingPublicKeys, String chainId, List abis, 88 | boolean isModifiable) { 89 | this(serializedTransaction, signingPublicKeys, chainId, abis, isModifiable, ""); 90 | } 91 | 92 | /** 93 | * Gets the serialized transaction. 94 | *
95 | * The serialized (Hex) version of {@link one.block.eosiojava.models.rpcProvider.Transaction}. 96 | *
97 | * It is the result of {@link one.block.eosiojava.interfaces.ISerializationProvider#serializeTransaction(String)} 98 | * 99 | * @return the serialized transaction 100 | */ 101 | public String getSerializedTransaction() { 102 | return serializedTransaction; 103 | } 104 | 105 | /** 106 | * Sets the serialized transaction. 107 | *
108 | * The serialized (Hex) version of {@link one.block.eosiojava.models.rpcProvider.Transaction}. 109 | *
110 | * It is the result of {@link one.block.eosiojava.interfaces.ISerializationProvider#serializeTransaction(String)} 111 | * 112 | * @param serializedTransaction the serialized transaction 113 | */ 114 | public void setSerializedTransaction(String serializedTransaction) { 115 | this.serializedTransaction = serializedTransaction; 116 | } 117 | 118 | /** 119 | * Gets the serialized contextFreeData. 120 | * It is the result of {@link ContextFreeData#getSerialized()} 121 | * 122 | * @return the serialized contextFreeData 123 | */ 124 | public String getSerializedContextFreeData() { 125 | return serializedContextFreeData; 126 | } 127 | 128 | /** 129 | * Sets the serialized contextFreeData. 130 | * It is the result of {@link ContextFreeData#getSerialized()} 131 | * 132 | * @param serializedContextFreeData the serialized contextFreeData 133 | */ 134 | public void setSerializedContextFreeData(String serializedContextFreeData) { 135 | this.serializedContextFreeData = serializedContextFreeData.isEmpty() ? Hex.toHexString(new byte[32]) : serializedContextFreeData; 136 | } 137 | 138 | /** 139 | * Gets the signing public key. 140 | *
141 | * The EOSIO public key that will be used to find the private keys (or key identities) to sign 142 | * the serialized transaction. 143 | * 144 | * @return the signing public key 145 | */ 146 | public List getSigningPublicKeys() { 147 | return signingPublicKeys; 148 | } 149 | 150 | /** 151 | * Sets the signing public key. 152 | *
153 | * The EOSIO public key that will be used to find the private keys (or key identities) to sign 154 | * the serialized transaction. 155 | * 156 | * @param signingPublicKeys the signing public key 157 | */ 158 | public void setSigningPublicKeys(List signingPublicKeys) { 159 | this.signingPublicKeys = signingPublicKeys; 160 | } 161 | 162 | /** 163 | * Gets the chain id. 164 | *
165 | * The chain id of the target blockchain. 166 | *
167 | * Its value comes from {@link GetInfoResponse#getChainId()} 168 | * 169 | * @return the chain id 170 | */ 171 | public String getChainId() { 172 | return chainId; 173 | } 174 | 175 | /** 176 | * Sets the chain id. 177 | *
178 | * The chain id of the target blockchain. 179 | *
180 | * Its value comes from {@link GetInfoResponse#getChainId()} 181 | * 182 | * @param chainId the chain id 183 | */ 184 | public void setChainId(String chainId) { 185 | this.chainId = chainId; 186 | } 187 | 188 | /** 189 | * Gets ABIs. 190 | *
191 | * The list of ABIs that is passed to the signature provider. 192 | * 193 | * @return the abis 194 | */ 195 | public List getAbis() { 196 | return abis; 197 | } 198 | 199 | /** 200 | * Sets ABIs. 201 | *
202 | * The list of ABIs that are passed to the signature provider. 203 | * 204 | * @param abis the abis 205 | */ 206 | public void setAbis(List abis) { 207 | this.abis = abis; 208 | } 209 | 210 | /** 211 | * isModifiable boolean. 212 | *
213 | * If the signature provider modifies the serialized transaction and returns it in the response {@link 214 | * EosioTransactionSignatureResponse#getSerializedTransaction()} but this field is false then 215 | * {@link one.block.eosiojava.error.session.TransactionGetSignatureNotAllowModifyTransactionError} 216 | * will be thrown. 217 | * 218 | * @return the boolean 219 | */ 220 | public boolean isModifiable() { 221 | return isModifiable; 222 | } 223 | 224 | /** 225 | * Sets isModifiable. 226 | *
227 | * If the signature provider modifies the serialized transaction and returns it in the response {@link 228 | * EosioTransactionSignatureResponse#getSerializedTransaction()} but this field is false then 229 | * {@link one.block.eosiojava.error.session.TransactionGetSignatureNotAllowModifyTransactionError} 230 | * will be thrown. 231 | * 232 | * @param modifiable the modifiable 233 | */ 234 | public void setModifiable(boolean modifiable) { 235 | isModifiable = modifiable; 236 | } 237 | } 238 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/models/signatureProvider/EosioTransactionSignatureResponse.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.models.signatureProvider; 2 | 3 | import java.util.List; 4 | import one.block.eosiojava.error.signatureProvider.SignatureProviderError; 5 | import one.block.eosiojava.models.rpcProvider.ContextFreeData; 6 | import org.jetbrains.annotations.NotNull; 7 | import org.jetbrains.annotations.Nullable; 8 | 9 | /** 10 | * The response object returned from the SignatureProvider after the transaction has been signed. 11 | */ 12 | public class EosioTransactionSignatureResponse { 13 | 14 | /** 15 | * The serialized (Hex) version of {@link one.block.eosiojava.models.rpcProvider.Transaction}. 16 | *
17 | * It is the result of {@link one.block.eosiojava.interfaces.ISerializationProvider#serializeTransaction(String)} 18 | *
19 | * The transaction could have been modified by the signature provider. 20 | *
21 | * If signature provider modifies the serialized transaction returned in the response {@link 22 | * EosioTransactionSignatureResponse#getSerializedTransaction()} but {@link 23 | * EosioTransactionSignatureRequest#isModifiable()} is false then {@link 24 | * one.block.eosiojava.error.session.TransactionGetSignatureNotAllowModifyTransactionError} will 25 | * be thrown 26 | */ 27 | @NotNull 28 | private String serializedTransaction; 29 | 30 | /** 31 | * The serialized (Hex) version of {@link one.block.eosiojava.models.rpcProvider.ContextFreeData}. 32 | *
33 | * It is the result of {@link ContextFreeData#getSerialized()} 34 | */ 35 | @NotNull 36 | private String serializedContextFreeData; 37 | 38 | /** 39 | * The signatures that are signed by private keys of {@link EosioTransactionSignatureRequest#getSigningPublicKeys()} 40 | */ 41 | @NotNull 42 | private List signatures; 43 | 44 | /** 45 | * The error that occurred during signing. 46 | */ 47 | @Nullable 48 | private SignatureProviderError error; 49 | 50 | public EosioTransactionSignatureResponse(@NotNull String serializedTransaction, @NotNull String serializedContextFreeData, 51 | @NotNull List signatures, @Nullable SignatureProviderError error) { 52 | this.serializedTransaction = serializedTransaction; 53 | this.serializedContextFreeData = serializedContextFreeData; 54 | this.signatures = signatures; 55 | this.error = error; 56 | } 57 | 58 | public EosioTransactionSignatureResponse(@NotNull String serializedTransaction, 59 | @NotNull List signatures, @Nullable SignatureProviderError error) { 60 | this(serializedTransaction, "", signatures, error); 61 | } 62 | 63 | /** 64 | * Gets the serialized transaction. 65 | * 66 | * @return the serialize transaction 67 | */ 68 | @NotNull 69 | public String getSerializedTransaction() { 70 | return serializedTransaction; 71 | } 72 | 73 | /** 74 | * Gets signatures. 75 | * 76 | * @return the signatures 77 | */ 78 | @NotNull 79 | public List getSignatures() { 80 | return signatures; 81 | } 82 | 83 | /** 84 | * Gets error. 85 | * 86 | * @return the error 87 | */ 88 | @Nullable 89 | public SignatureProviderError getError() { 90 | return error; 91 | } 92 | 93 | /** 94 | * Gets serialized context free data. 95 | * 96 | * @return the serialized context free data 97 | */ 98 | @NotNull 99 | public String getSerializedContextFreeData() { return serializedContextFreeData; } 100 | } 101 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/models/signatureProvider/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Provides model classes for Signature provider {@link one.block.eosiojava.interfaces.ISignatureProvider} 3 | */ 4 | 5 | package one.block.eosiojava.models.signatureProvider; -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/session/TransactionSession.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.session; 2 | 3 | import one.block.eosiojava.error.session.TransactionProcessorConstructorInputError; 4 | import one.block.eosiojava.interfaces.IABIProvider; 5 | import one.block.eosiojava.interfaces.IRPCProvider; 6 | import one.block.eosiojava.interfaces.ISerializationProvider; 7 | import one.block.eosiojava.interfaces.ISignatureProvider; 8 | import one.block.eosiojava.models.rpcProvider.Transaction; 9 | import org.jetbrains.annotations.NotNull; 10 | 11 | /** 12 | * Transaction Session class has a factory role for creating {@link TransactionProcessor} object from providers instances 13 | */ 14 | public class TransactionSession { 15 | 16 | /** 17 | * Serialization provider to be used as a reference on {@link TransactionProcessor} object 18 | *
19 | * Responsible for serialization/deserialization between JSON and Hex for communicate with EOSIO chain 20 | */ 21 | @NotNull 22 | private ISerializationProvider serializationProvider; 23 | 24 | /** 25 | * Rpc provider to be used as a reference on {@link TransactionProcessor} object 26 | *
27 | * Responsible for communicate with EOSIO chain 28 | */ 29 | @NotNull 30 | private IRPCProvider rpcProvider; 31 | 32 | /** 33 | * ABI Provider to be used as a reference on {@link TransactionProcessor} object 34 | *
35 | * Responsible for managing ABIs for serialization/deserialization 36 | */ 37 | @NotNull 38 | private IABIProvider abiProvider; 39 | 40 | /** 41 | * Signature provider to be used as a reference on {@link TransactionProcessor} object 42 | *
43 | * Responsible for managing keys, create signature to make transaction to EOSIO chain 44 | */ 45 | @NotNull 46 | private ISignatureProvider signatureProvider; 47 | 48 | /** 49 | * Initialize TransactionSession object which acts like a factory to create {@link TransactionProcessor} object from providers instances. 50 | * 51 | * @param serializationProvider serialization provider. 52 | * @param rpcProvider Rpc provider. 53 | * @param abiProvider ABI provider. 54 | * @param signatureProvider signature provider. 55 | */ 56 | public TransactionSession( 57 | @NotNull ISerializationProvider serializationProvider, 58 | @NotNull IRPCProvider rpcProvider, @NotNull IABIProvider abiProvider, 59 | @NotNull ISignatureProvider signatureProvider) { 60 | this.serializationProvider = serializationProvider; 61 | this.rpcProvider = rpcProvider; 62 | this.abiProvider = abiProvider; 63 | this.signatureProvider = signatureProvider; 64 | } 65 | 66 | /** 67 | * Create and return a new instance of TransactionProcessor 68 | * 69 | * @return new instance of TransactionProcessor 70 | */ 71 | public TransactionProcessor getTransactionProcessor() { 72 | return new TransactionProcessor(this.serializationProvider, this.rpcProvider, 73 | this.abiProvider, this.signatureProvider); 74 | } 75 | 76 | /** 77 | * Create and return a new instance of TransactionProcessor with preset transaction 78 | * 79 | * @param transaction - preset transaction 80 | * @return new instance of TransactionProcessor 81 | * @throws TransactionProcessorConstructorInputError thrown if initializing {@link TransactionProcessor} get error. 82 | */ 83 | public TransactionProcessor getTransactionProcessor(Transaction transaction) throws TransactionProcessorConstructorInputError { 84 | return new TransactionProcessor(this.serializationProvider, this.rpcProvider, 85 | this.abiProvider, this.signatureProvider, transaction); 86 | } 87 | 88 | //region getters 89 | 90 | /** 91 | * Get serialization provider to be used as a reference on {@link TransactionProcessor} object 92 | *
93 | * Responsible for serialization/deserialization between JSON and Hex for communicate with EOSIO chain 94 | * @return the serialization provider 95 | */ 96 | @NotNull 97 | public ISerializationProvider getSerializationProvider() { 98 | return serializationProvider; 99 | } 100 | 101 | /** 102 | * Get rpc provider to be used as a reference on {@link TransactionProcessor} object 103 | *
104 | * Responsible for communicate with EOSIO chain 105 | * @return the rpc provider. 106 | */ 107 | @NotNull 108 | public IRPCProvider getRpcProvider() { 109 | return rpcProvider; 110 | } 111 | 112 | /** 113 | * Get ABI Provider to be used as a reference on {@link TransactionProcessor} object 114 | *
115 | * Responsible for managing ABIs for serialization/deserialization 116 | * @return the rpc provider. 117 | */ 118 | @NotNull 119 | public IABIProvider getAbiProvider() { 120 | return abiProvider; 121 | } 122 | 123 | /** 124 | * Get signature provider to be used as a reference on {@link TransactionProcessor} object 125 | *
126 | * Responsible for managing keys, create signature to make transaction to EOSIO chain 127 | * @return the signature provider. 128 | */ 129 | @NotNull 130 | public ISignatureProvider getSignatureProvider() { 131 | return signatureProvider; 132 | } 133 | //endregion 134 | } 135 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/session/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Provides the core classes to handle transaction manipulation. 3 | */ 4 | 5 | package one.block.eosiojava.session; -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/utilities/ByteFormatter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2019 block.one all rights reserved. 3 | */ 4 | 5 | package one.block.eosiojava.utilities; 6 | 7 | import com.google.common.base.CharMatcher; 8 | import com.google.common.base.Strings; 9 | import org.bitcoinj.core.Sha256Hash; 10 | import org.bouncycastle.util.encoders.Base64; 11 | import org.bouncycastle.util.encoders.Hex; 12 | import org.jetbrains.annotations.NotNull; 13 | 14 | /** 15 | * This class provides methods for transforming and formatting byte data to and from different 16 | * formats in use on the blockchain. 17 | */ 18 | public class ByteFormatter { 19 | 20 | private static final int BASE64_PADDING = 4; 21 | private static final char BASE64_PADDING_CHAR = '='; 22 | 23 | @NotNull 24 | private byte[] context; 25 | 26 | public ByteFormatter(@NotNull byte[] context) { 27 | this.context = context; 28 | } 29 | 30 | /** 31 | * Create and initialize a ByteFormatter from a Base64 encoded string. The Base64 string 32 | * will have its padding checked and adjusted if necessary. 33 | * 34 | * @param base64String - Base64 encoded string. 35 | * @return - Initialized ByteFormatter 36 | */ 37 | public static ByteFormatter createFromBase64(@NotNull String base64String) { 38 | // Base64 encoded strings must be an even multiple of 4 if they are handled with padding. 39 | // The strings that we get back from the blockchain in the JSON do not follow this 40 | // strictly so we have to adjust the string if necessary before decoding. The padding 41 | // character is '='. So we remove all existing padding characters and then pad the 42 | // string to the nearest multiple of 4. 43 | String trimmed = CharMatcher.is(BASE64_PADDING_CHAR).removeFrom(base64String); 44 | String padded = Strings.padEnd(trimmed, 45 | (trimmed.length() + BASE64_PADDING - 1) / BASE64_PADDING * BASE64_PADDING, 46 | BASE64_PADDING_CHAR); 47 | return new ByteFormatter(Base64.decode(padded)); 48 | } 49 | 50 | /** 51 | * Create and initialize a ByteFormatter from a hex encoded string. 52 | * 53 | * @param hexString - Hex encoded string. 54 | * @return - Initialized ByteFormatter 55 | */ 56 | public static ByteFormatter createFromHex(@NotNull String hexString) { 57 | byte[] data = Hex.decode(hexString); 58 | return new ByteFormatter(data); 59 | } 60 | 61 | /** 62 | * Convert the current ByteFormatter contents to a Hex encoded string and return it. 63 | * @return - Hex encoded string representation of the current formatter context. 64 | */ 65 | public String toHex() { 66 | return Hex.toHexString(this.context); 67 | } 68 | 69 | /** 70 | * Calculate the sha256 hash of the current ByteFormatter context and return it as a new 71 | * ByteFormatter. 72 | * 73 | * @return - New ByteFormatter containing the sha256 hash of the current one. 74 | */ 75 | public ByteFormatter sha256() { 76 | return new ByteFormatter(Sha256Hash.hash(this.context)); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/utilities/DateFormatter.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.utilities; 2 | 3 | import java.text.ParseException; 4 | import java.text.SimpleDateFormat; 5 | import java.util.Calendar; 6 | import java.util.Date; 7 | import java.util.TimeZone; 8 | 9 | /** 10 | * This class provides utility methods to handle the formatting of dates and times to supported patterns. 11 | */ 12 | public class DateFormatter { 13 | 14 | /** 15 | * Blockchain pattern for SimpleDateFormat 16 | */ 17 | public static final String BACKEND_DATE_PATTERN = "yyyy-MM-dd'T'HH:mm:ss.SSS"; 18 | 19 | /** 20 | * Blockchain pattern for SimpleDateFormat. It includes timezone. 21 | */ 22 | public static final String BACKEND_DATE_PATTERN_WITH_TIMEZONE = "yyyy-MM-dd'T'HH:mm:ss.SSS zzz"; 23 | 24 | /** 25 | * Blockchain timezone/time standard for SimpleDateFormat 26 | */ 27 | public static final String BACKEND_DATE_TIME_ZONE = "UTC"; 28 | 29 | private DateFormatter() {} 30 | 31 | /** 32 | * Converting backend time to millisecond. 33 | *

34 | * Backend time pattern "yyyy-MM-dd'T'HH:mm:ss.sss" in GMT. 35 | * @param backendTime input backend time. 36 | * @return Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by parsed input backend time. 37 | * @throws ParseException thrown if the input does not match with any supported datetime pattern. 38 | */ 39 | public static long convertBackendTimeToMilli(String backendTime) throws ParseException { 40 | String[] datePatterns = new String[]{ 41 | BACKEND_DATE_PATTERN, BACKEND_DATE_PATTERN_WITH_TIMEZONE 42 | }; 43 | 44 | for (String datePattern : datePatterns) { 45 | try { 46 | SimpleDateFormat sdf = new SimpleDateFormat(datePattern); 47 | sdf.setTimeZone(TimeZone.getTimeZone(BACKEND_DATE_TIME_ZONE)); 48 | Date parsedDate = sdf.parse(backendTime); 49 | return parsedDate.getTime(); 50 | } catch (ParseException ex) { 51 | // Keep going even if exception is thrown for trying different date pattern 52 | } catch (IllegalArgumentException ex) { 53 | // Keep going even if exception is thrown for trying different date pattern 54 | } 55 | } 56 | 57 | throw new ParseException("Unable to parse input backend time with supported date patterns!", 0); 58 | } 59 | 60 | /** 61 | * Convert milliseconds to time string format used on blockchain. 62 | *

63 | * Backend time pattern "yyyy-MM-dd'T'HH:mm:ss.sss" in GMT 64 | * @param timeInMilliSeconds input number of milliseconds 65 | * @return String format of input number of milliseconds 66 | */ 67 | public static String convertMilliSecondToBackendTimeString(long timeInMilliSeconds) { 68 | SimpleDateFormat sdf = new SimpleDateFormat(BACKEND_DATE_PATTERN); 69 | sdf.setTimeZone(TimeZone.getTimeZone(BACKEND_DATE_TIME_ZONE)); 70 | 71 | Calendar calendar = Calendar.getInstance(); 72 | calendar.setTimeInMillis(timeInMilliSeconds); 73 | 74 | return sdf.format(calendar.getTime()); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/utilities/Utils.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.utilities; 2 | 3 | import com.google.gson.Gson; 4 | import com.google.gson.GsonBuilder; 5 | import java.io.ByteArrayInputStream; 6 | import java.io.ByteArrayOutputStream; 7 | import java.io.IOException; 8 | import java.io.ObjectInputStream; 9 | import java.io.ObjectOutputStream; 10 | import java.io.Serializable; 11 | 12 | /** 13 | * This class provides generic utility methods 14 | */ 15 | public class Utils { 16 | 17 | private Utils() {} 18 | 19 | /** 20 | * Clone an object 21 | * 22 | * @param object input object 23 | * @param - Class of the object 24 | * @return the cloned object. 25 | * @throws IOException Any exception thrown by the underlying OutputStream. 26 | * @throws ClassNotFoundException Class of a serialized object cannot be found. 27 | */ 28 | public static T clone(T object) throws IOException, ClassNotFoundException { 29 | ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); 30 | ObjectOutputStream objectOutputStream = new ObjectOutputStream(byteArrayOutputStream); 31 | objectOutputStream.writeObject(object); // Could clone only the Transaction (i.e. this.transaction) 32 | ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray()); 33 | ObjectInputStream objectInputStream = new ObjectInputStream(byteArrayInputStream); 34 | return (T) objectInputStream.readObject(); 35 | } 36 | 37 | /** 38 | * Getting a GSON object with a date time pattern 39 | * @param datePattern - input date time pattern 40 | * @return Configured GSON object with input. 41 | */ 42 | public static Gson getGson(String datePattern) { 43 | return new GsonBuilder() 44 | .setDateFormat(datePattern) 45 | .disableHtmlEscaping() 46 | .create(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /eosiojava/src/main/java/one/block/eosiojava/utilities/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Provides the utility classes to support handling key conversion, byte handling, datetime handling and pem processing. 3 | */ 4 | 5 | package one.block.eosiojava.utilities; -------------------------------------------------------------------------------- /eosiojava/src/test/java/one/block/eosiojava/DateFormatterTest.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava; 2 | 3 | import java.text.ParseException; 4 | import one.block.eosiojava.utilities.DateFormatter; 5 | import org.junit.Assert; 6 | import org.junit.Test; 7 | 8 | public class DateFormatterTest { 9 | 10 | @Test 11 | public void testConvertBackendTimeToMilli() throws ParseException { 12 | this.convertStrDateToMilliAndVerify("2019-09-11T19:38:05.000"); 13 | this.convertStrDateToMilliAndVerify("2019-01-01T19:38:05.000"); 14 | this.convertStrDateToMilliAndVerify("2019-09-11T00:38:05.000"); 15 | this.convertStrDateToMilliAndVerify("2019-09-11T00:00:00.000"); 16 | this.convertStrDateToMilliAndVerify("2019-01-01T00:00:00.000"); 17 | this.convertStrDateToMilliAndVerify("1900-01-01T00:00:00.000"); 18 | } 19 | 20 | @Test 21 | public void testIncreaseTime() throws ParseException { 22 | this.increaseTimeByMilliSecondToStrDateAndVerify("2019-09-11T19:38:05.000", 300 * 1000, 23 | "2019-09-11T19:43:05.000"); 24 | this.increaseTimeByMilliSecondToStrDateAndVerify("2019-01-01T19:38:05.000", 180 * 1000, 25 | "2019-01-01T19:41:05.000"); 26 | this.increaseTimeByMilliSecondToStrDateAndVerify("2019-09-11T00:38:05.000", 600 * 1000, 27 | "2019-09-11T00:48:05.000"); 28 | this.increaseTimeByMilliSecondToStrDateAndVerify("2019-09-11T00:00:00.000", 300 * 1000, 29 | "2019-09-11T00:05:00.000"); 30 | this.increaseTimeByMilliSecondToStrDateAndVerify("2019-01-01T00:00:00.000", 300 * 1000, 31 | "2019-01-01T00:05:00.000"); 32 | this.increaseTimeByMilliSecondToStrDateAndVerify("1900-01-01T00:00:00.000", 300 * 1000, 33 | "1900-01-01T00:05:00.000"); 34 | } 35 | 36 | private void convertStrDateToMilliAndVerify(String strDate) throws ParseException { 37 | long milliSeconds = DateFormatter.convertBackendTimeToMilli(strDate); 38 | String convertedStrDate = DateFormatter.convertMilliSecondToBackendTimeString(milliSeconds); 39 | Assert.assertEquals(strDate, convertedStrDate); 40 | } 41 | 42 | private void increaseTimeByMilliSecondToStrDateAndVerify(String strDate, 43 | long appendMilliSeconds, String strDateAfterAppended) 44 | throws ParseException { 45 | long milliSeconds = DateFormatter.convertBackendTimeToMilli(strDate); 46 | milliSeconds += appendMilliSeconds; 47 | String convertedStrDate = DateFormatter.convertMilliSecondToBackendTimeString(milliSeconds); 48 | Assert.assertEquals(strDateAfterAppended, convertedStrDate); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /eosiojava/src/test/java/one/block/eosiojava/EosioErrorTest.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package one.block.eosiojava; 4 | 5 | import one.block.eosiojava.error.EosioError; 6 | import one.block.eosiojava.error.serializationProvider.SerializationProviderError; 7 | import org.junit.Test; 8 | 9 | import java.io.IOException; 10 | 11 | import static org.junit.Assert.*; 12 | 13 | public class EosioErrorTest { 14 | 15 | @Test 16 | public void errroMessage() { 17 | EosioError err = new EosioError("Parsing Error!"); 18 | String description = err.getLocalizedMessage(); 19 | assertEquals("Parsing Error!", description); 20 | 21 | Exception origError = new IOException("File Not Found"); 22 | EosioError err2 = new EosioError( 23 | "Could not find resource.", 24 | origError); 25 | assertEquals("Could not find resource.", err2.getLocalizedMessage()); 26 | 27 | assertEquals("File Not Found", err2.getCause().getMessage()); 28 | } 29 | 30 | @Test 31 | public void asJsonString() { 32 | String jsonResult = "{\n" + 33 | " \"errorType\": \"EosioError\",\n" + 34 | " \"errorInfo\": {\n" + 35 | " \"errorCode\": \"SerializationProviderError\",\n" + 36 | " \"reason\": \"Serialization Provider Failure\"\n" + 37 | " }\n" + 38 | "}"; 39 | SerializationProviderError err2 = new SerializationProviderError("Serialization Provider Failure"); 40 | String errJsonString = err2.asJsonString(); 41 | assertEquals(jsonResult, errJsonString); 42 | } 43 | 44 | } -------------------------------------------------------------------------------- /eosiojava/src/test/java/one/block/eosiojava/models/ActionTest.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.models; 2 | 3 | import java.util.ArrayList; 4 | import one.block.eosiojava.models.rpcProvider.Action; 5 | import one.block.eosiojava.models.rpcProvider.Authorization; 6 | import org.junit.Test; 7 | import static junit.framework.TestCase.*; 8 | 9 | public class ActionTest { 10 | Action action; 11 | 12 | public void setup() { 13 | action = new Action("Account", "Name", new ArrayList(), "{\"data\": \"test\"}"); 14 | } 15 | 16 | public void setup(boolean isContextFree) { 17 | action = new Action("Account", "Name", new ArrayList(), "{\"data\": \"test\"}", isContextFree); 18 | } 19 | 20 | @Test 21 | public void testCreateActionWithDefaultConstructor() { 22 | this.setup(); 23 | assertFalse(action.getIsContextFree()); 24 | } 25 | 26 | @Test 27 | public void testCreateActionWithOverloadedConstructor() { 28 | this.setup(false); 29 | assertFalse(action.getIsContextFree()); 30 | } 31 | 32 | @Test 33 | public void testCreateContextFreeActionWithOverloadedConstructor() { 34 | this.setup(true); 35 | assertTrue(action.getIsContextFree()); 36 | } 37 | 38 | @Test 39 | public void testSetIsContextFree() { 40 | this.setup(); 41 | action.setIsContextFree(true); 42 | 43 | assertTrue(action.getIsContextFree()); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /eosiojava/src/test/java/one/block/eosiojava/models/EosioTransactionSignatureRequestTest.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.models; 2 | 3 | import java.util.ArrayList; 4 | import one.block.eosiojava.models.signatureProvider.BinaryAbi; 5 | import one.block.eosiojava.models.signatureProvider.EosioTransactionSignatureRequest; 6 | import org.bouncycastle.util.encoders.Hex; 7 | import org.junit.Test; 8 | import static junit.framework.TestCase.*; 9 | 10 | public class EosioTransactionSignatureRequestTest { 11 | EosioTransactionSignatureRequest request; 12 | 13 | public void setup() { 14 | this.setup(null); 15 | } 16 | 17 | public void setup(String contextFreeData) { 18 | if (contextFreeData == null) { 19 | request = new EosioTransactionSignatureRequest("", new ArrayList(), "", new ArrayList(), false); 20 | } else { 21 | request = new EosioTransactionSignatureRequest("", new ArrayList(), "", new ArrayList(), false, contextFreeData); 22 | } 23 | } 24 | 25 | @Test 26 | public void testCreateWithoutContextFreeDataSetsTo32Zeros() { 27 | this.setup(); 28 | 29 | assertEquals(request.getSerializedContextFreeData(), Hex.toHexString(new byte[32])); 30 | } 31 | 32 | @Test 33 | public void testCreateWithContextFreeDataSetsParameter() { 34 | String serializedContextFreeData = "6595140530fcbd94469196e5e6d73af65693910df8fcf5d3088c3616bff5ee9f"; 35 | this.setup(serializedContextFreeData); 36 | 37 | assertEquals(request.getSerializedContextFreeData(), serializedContextFreeData); 38 | } 39 | 40 | @Test 41 | public void testSetSerializedContextFreeDataWithEmptyStringSetsTo32Zeros() { 42 | String serializedContextFreeData = Hex.toHexString(new byte[32]); 43 | this.setup(); 44 | 45 | request.setSerializedContextFreeData(""); 46 | 47 | assertEquals(request.getSerializedContextFreeData(), serializedContextFreeData); 48 | } 49 | 50 | @Test 51 | public void testSetSerializedContextFreeDataWithDataReturnsData() { 52 | String serializedContextFreeData = "6595140530fcbd94469196e5e6d73af65693910df8fcf5d3088c3616bff5ee9f"; 53 | this.setup(); 54 | 55 | request.setSerializedContextFreeData(serializedContextFreeData); 56 | 57 | assertEquals(request.getSerializedContextFreeData(), serializedContextFreeData); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /eosiojava/src/test/java/one/block/eosiojava/session/TransactionSessionTest.java: -------------------------------------------------------------------------------- 1 | package one.block.eosiojava.session; 2 | 3 | import static org.junit.Assert.assertNotNull; 4 | import static org.mockito.Mockito.mock; 5 | 6 | import one.block.eosiojava.interfaces.IABIProvider; 7 | import one.block.eosiojava.interfaces.IRPCProvider; 8 | import one.block.eosiojava.interfaces.ISerializationProvider; 9 | import one.block.eosiojava.interfaces.ISignatureProvider; 10 | import org.junit.Before; 11 | import org.junit.Test; 12 | 13 | public class TransactionSessionTest { 14 | 15 | private TransactionSession session; 16 | 17 | @Before 18 | public void setUpTransactionSession() { 19 | this.session = new TransactionSession( 20 | mock(ISerializationProvider.class), 21 | mock(IRPCProvider.class), 22 | mock(IABIProvider.class), 23 | mock(ISignatureProvider.class)); 24 | } 25 | 26 | @Test 27 | public void getTransactionProcessor() { 28 | TransactionProcessor processor = this.session.getTransactionProcessor(); 29 | assertNotNull(processor); 30 | } 31 | 32 | @Test 33 | public void getSerializationProvider() { 34 | assertNotNull(this.session.getSerializationProvider()); 35 | } 36 | 37 | @Test 38 | public void getRpcProvider() { 39 | assertNotNull(this.session.getRpcProvider()); 40 | } 41 | 42 | @Test 43 | public void getAbiProvider() { 44 | assertNotNull(this.session.getAbiProvider()); 45 | } 46 | 47 | @Test 48 | public void getSignatureProvider() { 49 | assertNotNull(this.session.getSignatureProvider()); 50 | } 51 | } -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EOSIO/eosio-java/dd0dbd2e6e15a5ac799de40c633126b90e82116e/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Mar 08 19:34:29 CST 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-bin.zip -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /img/Android_Robot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EOSIO/eosio-java/dd0dbd2e6e15a5ac799de40c633126b90e82116e/img/Android_Robot.png -------------------------------------------------------------------------------- /img/java-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EOSIO/eosio-java/dd0dbd2e6e15a5ac799de40c633126b90e82116e/img/java-logo.png -------------------------------------------------------------------------------- /scripts/deploy-artifactory.sh: -------------------------------------------------------------------------------- 1 | DEST_REPO=$1 && \ 2 | echo "publishing to $DEST_REPO on Artifactory" && \ 3 | ./gradlew clean artifactoryPublish -Partifactory_repo=$DEST_REPO -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':eosiojava' 2 | --------------------------------------------------------------------------------