Skip to content

Instantly share code, notes, and snippets.

@shredding
Last active January 20, 2021 08:33
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/9f808f9e447ad53cb1f32940710702a3 to your computer and use it in GitHub Desktop.
Save shredding/9f808f9e447ad53cb1f32940710702a3 to your computer and use it in GitHub Desktop.
from stellar_sdk import TransactionBuilder, Server, Network
import requests
server = Server(horizon_url='https://horizon.stellar.org')
builder = TransactionBuilder(server.load_account(<ADD YOUR PUBLIC_KEY>), Network.PUBLIC_NETWORK_PASSPHRASE)
tx_xdr = builder.append_manage_buy_offer_op(
selling_code='USD',
selling_issuer='GDUKMGUGDZQK6YHYA5Z6AY2G4XDSZPSZ3SW5UN3ARVMO6QSRDWP5YLEX',
buying_code='TSLA',
buying_issuer='GBRDHSZL4ZKOI2PTUMM53N3NICZXC5OX3KPCD4WD4NG4XGCBC2ZA3KAG',
amount='1.00',
price=’826.00'
).build().to_xdr()
tx = requests.post('https://dsq.technology/sep-8/tx-approve/', data={'tx': tx_xdr}).json()[‘tx’]
server.submit_transaction(
requests.post('https://dsq.technology/sep-8/tx-approve/', data={'tx': tx_xdr}).json()[‘tx’]
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment