2

Sorry for another illiterate question, but how the heck do you parse the https://horizon-testnet.stellar.org/accounts/ACCOUNT_PUBLIC_ID/offers page? There is almost no documentation on this.

I have successfully submitted an offer to the Stellar distributed exchange, but now I need to edit it and view other offers I may have created.

It looks like these are the class the SDK uses, but I'm at a loss for correct implementation: https://stellar.github.io/java-stellar-sdk/org/stellar/sdk/responses/OfferResponse.html and https://stellar.github.io/java-stellar-sdk/org/stellar/sdk/requests/OffersRequestBuilder.html

4
package org.stellar.sdk;

import org.stellar.sdk.responses.OfferResponse;
import org.stellar.sdk.responses.Page;

public class GetOffersForAccount {
    public static void main(String[] args) {
        Server server = new Server("https://horizon.stellar.org");
        try {
            KeyPair account = KeyPair.fromAccountId("GB5XET2RN2AM2U7Y6UTAJGEMNGFGYUKU3CLGMBVYKZSGAK37XMZQLM2C");
            Page<OfferResponse> offers = server.offers().forAccount(account).execute();
            System.out.println(offers.getRecords().get(0).getId());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.