kinecosystem / android-stellar-sdk Goto Github PK
View Code? Open in Web Editor NEWThis project forked from lightsail-network/java-stellar-sdk
Home Page: https://stellar.github.io/java-stellar-sdk/
License: Apache License 2.0
This project forked from lightsail-network/java-stellar-sdk
Home Page: https://stellar.github.io/java-stellar-sdk/
License: Apache License 2.0
OkHttp default timeout is 10 sec, as transaction post is synchronous and will return after transaction is complete (see https://www.stellar.org/developers/horizon/reference/endpoints/transactions-create.html), we should control or increase this value.
FYI @berryve
'stream' supported operations Accounts/Ledgers/Transactions/Payments/EffectsRequestBuilder, are broken with the conversion to Android
fix sample app to provide minimal example
Sample App Getting crashed!!! Getting Illegal Argument Exception.
04-18 19:54:59.255 13383-13383/org.stellar.android.sample E/AndroidRuntime: FATAL EXCEPTION: main
Process: org.stellar.android.sample, PID: 13383
java.lang.RuntimeException: Unable to start activity ComponentInfo{org.stellar.android.sample/org.stellar.android.sample.MainActivity}: java.lang.IllegalArgumentException: unexpected url: GAYWNB2QS44BYJLDASCDKIO4X6Z4B2WHTZQPADLQZURLRQVRVGNA7HM5
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2426)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2490)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1354)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5443)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
Caused by: java.lang.IllegalArgumentException: unexpected url: GAYWNB2QS44BYJLDASCDKIO4X6Z4B2WHTZQPADLQZURLRQVRVGNA7HM5
at okhttp3.Request$Builder.url(Request.java:143)
at org.stellar.sdk.requests.ResponseHandler.handleGetRequest(ResponseHandler.java:37)
at org.stellar.sdk.requests.AccountsRequestBuilder.account(AccountsRequestBuilder.java:29)
at org.stellar.android.sample.MainActivity.onCreate(MainActivity.java:25)
at android.app.Activity.performCreate(Activity.java:6259)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1130)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2379)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2490)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1354)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5443)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
Caused by: java.lang.IllegalArgumentException: unexpected url: GDK5J266OHB2CEYMN7N4M5AJ2LWM7FUVMXKVVSNXOC23ZIZNIRFXHGAS
at okhttp3.Request$Builder.url(Request.java:143)
at org.stellar.sdk.requests.ResponseHandler.handleGetRequest(ResponseHandler.java:37)
In the case where the offer's been immediately consumed,
getOffersClaimed() rather than getOffer() needs to be called. The
following patch fixes it (I think).
Note that the existing code has [0] hardcoded in one place where [position] is meant.
diff --git a/android-stellar-sdk/src/main/java/org/stellar/sdk/responses/SubmitTransactionResponse.java b/android-stellar-sdk/src/main/java/org/stellar/sdk/responses/SubmitTransactionResponse.java index af4189a..99a9234 100644 --- a/android-stellar-sdk/src/main/java/org/stellar/sdk/responses/SubmitTransactionResponse.java +++ b/android-stellar-sdk/src/main/java/org/stellar/sdk/responses/SubmitTransactionResponse.java @@ -95,11 +95,13 @@ public class SubmitTransactionResponse extends Response { return null; } - if (result.getResult().getResults()[0].getTr().getManageOfferResult().getSuccess().getOffer().getOffer() == null) { + if (result.getResult().getResults()[position].getTr().getManageOfferResult().getSuccess().getOffer().getOffer() != null) { + return result.getResult().getResults()[position].getTr().getManageOfferResult().getSuccess().getOffer().getOffer().getOfferID().getUint64(); + } else if (result.getResult().getResults()[position].getTr().getManageOfferResult().getSuccess().getOffersClaimed() != null) { + return result.getResult().getResults()[position].getTr().getManageOfferResult().getSuccess().getOffersClaimed()[0].getOfferID().getUint64(); + } else { return null; } - - return result.getResult().getResults()[0].getTr().getManageOfferResult().getSuccess().getOffer().getOffer().getOfferID().getUint64(); } /**
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.