marvin-we / steem-java-api-wrapper Goto Github PK
View Code? Open in Web Editor NEWAn API Wrapper for Steem written in Java
License: GNU General Public License v3.0
An API Wrapper for Steem written in Java
License: GNU General Public License v3.0
[INFO] Running eu.bittrade.libs.steemj.configuration.SteemJConfigTest
[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.002 s <<< FAILURE! - in eu.bittrade.libs.steemj.configuration.SteemJConfigTest
[ERROR] testSettingsThrougSystemProperties(eu.bittrade.libs.steemj.configuration.SteemJConfigTest) Time elapsed: 0.002 s <<< FAILURE!
java.lang.AssertionError:
Expected: "dez1337"
but: was ""
at eu.bittrade.libs.steemj.configuration.SteemJConfigTest.testSettingsThrougSystemProperties(SteemJConfigTest.java:36)
I could not find a BlogOperation. or like this.
If so, can I upload the image together?
When parsing a CommentOptionsExtension a first empty array element is added.
If a field is not required it does not need to be set
account_id_type
account_authority_id_type
...
implement performRequest for maps
Latest code has compilation issues.
Please commit class Discussion.
e.g. in method getBlock
if seems there's an error in the json mapping / databind which pops up when trying to look at a relatively newer account. If I replace it with my account ( @alexpmorris or yours @Dez1337 ), it works fine. For example, if I try this one:
Map<Integer, AccountActivity> accountHistory = steemApiWrapper.getAccountHistory("randowhale", 100, 100);
It results in the following exception:
Exception in thread "main" java.lang.IllegalArgumentException: Conflicting getter definitions for property "memo_key": eu.bittrade.libs.steem.api.wrapper.models.operations.AccountCreateWithDelegationOperation#getMemoKey(0 params) vs eu.bittrade.libs.steem.api.wrapper.models.operations.AccountCreateWithDelegationOperation#getJson_metadata(0 params)
at [Source: UNKNOWN; line: -1, column: -1] (through reference chain: eu.bittrade.libs.steem.api.wrapper.models.AccountActivity["op"])
at com.fasterxml.jackson.databind.ObjectMapper._convert(ObjectMapper.java:3726)
at com.fasterxml.jackson.databind.ObjectMapper.convertValue(ObjectMapper.java:3654)
at eu.bittrade.libs.steem.api.wrapper.SteemApiWrapper.getAccountHistory(SteemApiWrapper.java:211)
at SteemAPIUsageExample.main(SteemAPIUsageExample.java:47)
Steem only allows account names with lower case letters. Increase the usability by transforming the given account names to lower case.
see post on steemit
Instead of:
setAuthor(new AccountName("dez1337"));
Add methods to allow:
setAuthor("dez1337");
Which creates an AccountName object internally.
13:18:29.049 [pool-2-thread-7] ERROR eu.bittrade.steem.steemstats.datacollector.QueueWorker - Thread 2086638082 died for an unexpected reason when processing block 3585.
[...]
Caused by: com.fasterxml.jackson.databind.exc.InvalidFormatException: Can not deserialize value of type long from String "12704523629717466956": not a valid Long value
at [Source: UNKNOWN; line: -1, column: -1] (through reference chain: java.util.ArrayList[0]->eu.bittrade.libs.steemj.base.models.AppliedOperation["op"]->eu.bittrade.libs.steemj.base.models.operations.PowOperation["nonce"])
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.8.8</version>
<type>bundle</type>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.8.8</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.8.8</version>
</dependency>
<dependency>
<groupId>org.glassfish.tyrus.bundles</groupId>
<artifactId>tyrus-standalone-client</artifactId>
<version>1.13.1</version>
</dependency>
<dependency>
<groupId>org.bitcoinj</groupId>
<artifactId>bitcoinj-core</artifactId>
<version>0.14.4</version>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>org.exparity</groupId>
<artifactId>hamcrest-date</artifactId>
<version>2.0.4</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>com.madgag.spongycastle</groupId>
<artifactId>core</artifactId>
<version>1.56.0.0</version>
</dependency>
<dependency>
<groupId>com.madgag.spongycastle</groupId>
<artifactId>prov</artifactId>
<version>1.56.0.0</version>
</dependency>
<dependency>
<groupId>com.madgag.spongycastle</groupId>
<artifactId>pkix</artifactId>
<version>1.54.0.0</version>
</dependency>
<dependency>
<groupId>com.madgag.spongycastle</groupId>
<artifactId>pg</artifactId>
<version>1.54.0.0</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.57</version>
</dependency>
I did not build it in Maven before I added it.
I want to add this to the wiki. Please add it as a contributor.
Create a new account that can be used for testing. It should provide data for all methods (open orders, etc.)
Implement this method to receive all operations of a block as "getBlock" only contain "normal" operations.
As the model objects are the ones a programmer actually works with they should be documented pretty good.
As the response in case of erros is quite dynamic the current way of transforming them into exceptions only works in a few cases. If it does not work strange stack traces like this are thrown:
eu.bittrade.libs.steemj.exceptions.SteemTransformationException: Could not transform the response into an object.
at eu.bittrade.libs.steemj.communication.CommunicationHandler.performRequest(CommunicationHandler.java:163)
at eu.bittrade.libs.steemj.SteemApiWrapper.verifyAuthority(SteemApiWrapper.java:1383)
at eu.bittrade.libs.steemj.base.models.operations.CommentOperationIT.verifyTransaction(CommentOperationIT.java:125)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "active" (class eu.bittrade.libs.steemj.base.models.error.SteemData), not marked as ignorable (8 known properties: "call.method", "posting", "what", "call.params", "type", "name", "id", "api"])
at [Source: (String)"{"id":11,"error":{"code":1,"message":"3030000 tx_missing_posting_auth: missing required posting authority\nMissing Posting Authority dez1337\n {\"id\":\"dez1337\",\"posting\":{\"weight_threshold\":1,\"account_auths\":[],\"key_auths\":[[\"STM79rHgAa75LkJJrhhr4fSM8ccBoLwod3HaAAxzihNRFKZSvTvZ5\",1]]},\"active\":{\"weight_threshold\":1,\"account_auths\":[],\"key_auths\":[[\"STM5eKV7jKw6gFCtUenjQhvkzTA8WZtd6gcHjPHtndt47gEkMGjef\",1]]},\"owner\":{\"weight_threshold\":1,\"account_auths\":[],\"key_au"[truncated 11541 chars]; line: 1, column: 6329] (through reference chain: eu.bittrade.libs.steemj.base.models.error.SteemError["error"]->eu.bittrade.libs.steemj.base.models.error.SteemErrorDetails["data"]->eu.bittrade.libs.steemj.base.models.error.SteemErrorData["stack"]->java.lang.Object[][0]->eu.bittrade.libs.steemj.base.models.error.SteemStack["data"]->eu.bittrade.libs.steemj.base.models.error.SteemData["active"])
at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:60)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnknownProperty(DeserializationContext.java:822)
at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:1148)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:1547)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownVanilla(BeanDeserializerBase.java:1525)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:293)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:136)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:287)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:195)
at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:21)
at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:136)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:287)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:136)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:287)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:136)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:287)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4011)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2992)
at eu.bittrade.libs.steemj.communication.CommunicationHandler.performRequest(CommunicationHandler.java:161)
... 26 more
This needs to be improved.
As it is not usable for the different fields. Instead create an extended Timestamp type.
and How many amount of vote power did I vote before?
how to calculed that?
i can't found any way.
title is question.
Hi,
I've pulled the code but i see compile time errors. Basically few classes are missing. Below are the errors.
Hi,
I am not able to post comment to one post.. I am getting error "Missing Posting Authority ". I've configured correct posting key and not sure what is the issue.
below is the code i am using.
`CommentOperation commentOperation = new CommentOperation();
commentOperation.setAuthor(new AccountName("<comment_posting_username>"));
commentOperation.setBody("text");
commentOperation.setPermlink("re-<permalink_of_post>");
commentOperation.setJsonMetadata("{}");
commentOperation.setParentAuthor(new AccountName("<username>"));
commentOperation.setParentPermlink("<post_permalink>");
commentOperation.setTitle("-");
List<Operation> operations = new ArrayList<Operation>();
operations.add(commentOperation);
GlobalProperties globalProperties = steemApiWrapper.getDynamicGlobalProperties();
int refBlockNum = (globalProperties.getHeadBlockNumber() & 0xFFFF);
Transaction transaction = new Transaction();
transaction.setRefBlockNum(refBlockNum);
transaction.setRefBlockPrefix(globalProperties.getHeadBlockId());
transaction.setOperations(operations);
try {
transaction.sign();
} catch (SteemInvalidTransactionException e) {
LOGGER.error("A propblem occured while signing your Transaction.", e);
}
steemApiWrapper.broadcastTransaction(transaction);
LOGGER.info("The HEX representation of this transaction it {}.", steemApiWrapper.getTransactionHex(transaction));`
Calling steemApiWrapper.getOrderBook(1)
results in an error response.
15:01:23.360 [AWT-EventQueue-0] DEBUG eu.bittrade.libs.steemj.communication.CommunicationHandler - Raw JSON response: {"id":9,"error":{"code":1,"message":"10 assert_exception: Assert Exception\nitr != _by_name.end(): no method with name 'get_order_book'\n {\"name\":\"get_order_book\",\"api\":{\"get_api_by_name\":1,\"get_version\":2,\"login\":0}}\n th_a api_connection.hpp:109 call\n\n {\"call.method\":\"call\",\"call.params\":[\"login_api\",\"get_order_book\",[\"1\"]]}\n th_a websocket_api.cpp:124 on_message","data":{"code":10,"name":"assert_exception","message":"Assert Exception","stack":[{"context":{"level":"error","file":"api_connection.hpp","line":109,"method":"call","hostname":"","thread_name":"th_a","timestamp":"2017-06-28T13:01:23"},"format":"itr != _by_name.end(): no method with name '${name}'","data":{"name":"get_order_book","api":{"get_api_by_name":1,"get_version":2,"login":0}}},{"context":{"level":"warn","file":"websocket_api.cpp","line":124,"method":"on_message","hostname":"","thread_name":"th_a","timestamp":"2017-06-28T13:01:23"},"format":"","data":{"call.method":"call","call.params":["login_api","get_order_book",["1"]]}}]}}} 15:01:23.368 [AWT-EventQueue-0] DEBUG eu.bittrade.libs.steemj.communication.CommunicationHandler - Could not parse the response. Trying to transform it to an error object.
Could there be something wrong with my config? I geta similar error when calling steemApiWrapper.getFeedHistory()
This is my first issue on github, so please forgive me if I've missed any important steps.
Hi, please forgive me if this question is too elementary but I'm struggling to build my project when using the latest version of the API.
It's my first time building with a local dependency in maven, so I'm sure I've done something wrong here.
I added the API to my project as a maven project (using the pom.xml) All the dependencies seem to be linking up OK but when I build I'm getting the error
ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console. Set system property 'org.apache.logging.log4j.simplelog.StatusLogger.level' to TRACE to show Log4j2 internal initialization logging.
Stack overflow hasn't been much help as most of the recommendations involve creating a log4j2 file manually, which doesn't seem right.
Any insight into this problem would be greatly appreciated.
UPDATE: I get the same error when adding the jar file directly
There are multiple fields with a "wrong" type. (int instead of short, ...)
getBlock().getTransactions().getOperations only contains "normal" Operations?
when i send, "안녕하세요" ( it means 'hi or hello' ) in korean, steemj print error.
Unrecognized field "active" but it was correct, why? when i change the comment's body to english ('hi').
It works! I think. it was cjk character problem or utf-8 encoding problem!
--nrecognized field "active" (class eu.bittrade.libs.steem.api.wrapper.models.error.SteemData), not marked as ignorable (8 known properties: "call.method", "posting", "what", "call.params", "type", "name", "id", "api"])
at [Source: {"id":11,"error":{"code":1,"message":"3030000 tx_missing_posting_auth: missing required posting authority\nMissing Posting Authority sesangsokuro\n {"id":"sesangsokuro","posting":{"weight_threshold":1,"account_auths":[],"key_auths":
----------------------something my key ----------------
th_a transaction.cpp:129 verify_authority\n\n {"ops":[["comment",{"parent_author":"jin.lee","parent_permlink":"6smnbc","author":"sesangsokuro","permlink":"re-6smnbc-20170625t180512535z","title":"","body":"안녕하세요","json_metadata":"{\"tags\":[\"kr-newbie\"],\"app\":\"steemup/0.1\"}"}]],"sigs":
...
line: 1, column: 4104] (through reference chain: eu.bittrade.libs.steem.api.wrapper.models.error.SteemError["error"]->eu.bittrade.libs.steem.api.wrapper.models.error.SteemErrorDetails["data"]->eu.bittrade.libs.steem.api.wrapper.models.error.SteemErrorData["stack"]->java.lang.Object[][0]->eu.bittrade.libs.steem.api.wrapper.models.error.SteemStack["data"]->eu.bittrade.libs.steem.api.wrapper.models.error.SteemData["active"])
at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:62)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnknownProperty(DeserializationContext.java:834)
at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:1093)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:1478)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownVanilla(BeanDeserializerBase.java:1456)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:282)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:140)
at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:504)
at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:111)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:276)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:140)
at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:196)
at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:20)
at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:504)
at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:111)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:276)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:140)
at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:504)
at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:111)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:276)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:140)
at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:504)
at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:111)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:276)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:140)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3798)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2842)
at eu.bittrade.libs.steem.api.wrapper.communication.CommunicationHandler.performRequest(CommunicationHandler.java:161)
... 3 more
I can't handle this. help!
Check for null values to make sure that we do not have fields that have been removed
Private Keys
Credentials
There is no real reason to use ASCII as the default encoding - It only makes it harder to use SteemJ.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.