Giter Site home page Giter Site logo

kinecosystem / android-stellar-sdk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lightsail-network/java-stellar-sdk

10.0 10.0 3.0 6.87 MB

Home Page: https://stellar.github.io/java-stellar-sdk/

License: Apache License 2.0

Java 95.97% Logos 0.21% RPC 3.83%

android-stellar-sdk's People

Contributors

bartekn avatar bjfish avatar drefrati avatar efritze avatar irisli avatar juandynomite avatar michaeljmonte avatar nullstyle avatar synesso avatar yosriz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

android-stellar-sdk's Issues

Fix broken SSE 'stream' APIs

'stream' supported operations Accounts/Ledgers/Transactions/Payments/EffectsRequestBuilder, are broken with the conversion to Android

java.lang.IllegalArgumentException: unexpected url: GAYWNB2QS44BYJLDASCDKIO4X6Z4B2WHTZQPADLQZURLRQVRVGNA7HM5

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) 

Error run app

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)

getOfferIdFromResult() doesn't consider claimed offers

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();
     }
 
     /**

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.