Skip to content

Instantly share code, notes, and snippets.

@shredding
Created October 12, 2020 14:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shredding/19d65894722d3da1096314f197171969 to your computer and use it in GitHub Desktop.
Save shredding/19d65894722d3da1096314f197171969 to your computer and use it in GitHub Desktop.
from stellar_sdk import TransactionBuilder, Server, Network
import requests
STELLAR_TOML = 'https://api.dstoq.com/.well-known/stellar.toml'
PUBLIC_KEY = 'your-public-key'
APPROVAL_SERVER = 'https://api.dstoq.com/core/sign/tx'
server = Server(horizon_url='https://horizon.stellar.org')
builder = TransactionBuilder(server.load_account(PUBLIC_KEY), Network.PUBLIC_NETWORK_PASSPHRASE)
tx_xdr = builder.append_manage_buy_offer_op(
selling_code='XLM',
selling_issuer=None,
buying_code='DEMO',
buying_issuer='GDWHDCUYIA7LDEIL6XOPYBSRYG3JOFPC2ZF5ZHGTINU4T5E7YA6AMNH5',
amount='1.00',
price='1.00'
).build().to_xdr()
requests.post(APPROVAL_SERVER, data={'tx': tx_xdr}).json()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment