Right now I'm playing around with the test server
Server server = new Server("https://horizon-testnet.stellar.org");
The Stellar getting started guides are very well written, but definitely incomplete. They only cover creating accounts and sending/receiving (with Java examples).
I want to create an Asset and then offer it up for sale on the (test network) Stellar distributed exchange.
My Asset is
Asset testAsset = Asset.createNonNativeAsset("TEST", issuingKeys);
I created the asset, created a trustline to another test account, and then I sent the account 5,000 TEST. It all worked well. I want to write a program that sends sell orders to the distributed exchange.
I can't figure out how to create offers. The correct class seems to be
ManageOfferOperation.Builder. It requires parameters Asset, Asset, String, String.
Assuming I didn't create the Asset, this means I'll need to create an Asset object for the Asset I want to trade? Like:
Asset sellTestAsset = Asset.createNonNativeAsset("TEST", ACCOUNT_OBJECT);
createNonNativeAsset requires an
KeyPair object. So, I'll need to find the issuing public ID of whatever asset I want to trade, and make a KeyPair?
KeyPair testIssuer = KeyPair.fromAccountId("PUBLIC_ID_HERE");
And then add this as a parameter to
Asset.createNonNativeAsset.? Going to the ManageOfferOperation constructor:
Builder firstOffer = new ManageOfferOperation.Builder(sellTestAsset, sellTestAsset, "10", "10");
This seems a bit excessive, and I'm still having trouble with ManageOfferOperation.