Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
overcat committed Aug 11, 2019
1 parent 9a6d926 commit bd9a5c3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 27 deletions.
21 changes: 3 additions & 18 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ py-stellar-sdk
:alt: Read the Docs
:target: https://stellar-sdk.readthedocs.io/en/latest/

.. image:: https://img.shields.io/codecov/c/github/StellarCN/py-stellar-base.svg?style=flat-square&maxAge=1800
.. image:: https://img.shields.io/codecov/c/github/StellarCN/py-stellar-base/v2?style=flat-square&maxAge=1800
:alt: Codecov
:target: https://codecov.io/gh/StellarCN/py-stellar-base

Expand Down Expand Up @@ -49,23 +49,8 @@ Install and update using `pipenv`_ or `pip`_:
A Simple Example
----------------

.. code-block:: python
# Alice pay 10.25 XLM to Bob
from stellar_sdk import Server, Keypair, TransactionBuilder
alice_keypair = Keypair.from_secret("SBFZCHU5645DOKRWYBXVOXY2ELGJKFRX6VGGPRYUWHQ7PMXXJNDZFMKD")
bob_address = "GA7YNBW5CBTJZ3ZZOWX3ZNBKD6OE7A7IHUQVWMY62W2ZBG2SGZVOOPVH"
server = Server()
alice_account = server.load_account(alice_keypair.public_key())
transaction = TransactionBuilder(alice_account)\
.add_text_memo("Hello, Stellar!")\
.append_payment_op(bob_address, "10.25", "XLM")\
.build()
transaction.sign(alice_keypair)
response = server.submit_transaction(transaction)
print(response)
.. literalinclude:: ./examples/payment.py
:language: python

Links
-----
Expand Down
22 changes: 13 additions & 9 deletions examples/payment.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
from stellar_base.builder import Builder
# Alice pay 10.25 XLM to Bob
from stellar_sdk import Server, Keypair, TransactionBuilder

alice_secret = 'SCB6JIZUC3RDHLRGFRTISOUYATKEE63EP7MCHNZNXQMQGZSLZ5CNRTKK'
bob_address = 'GA7YNBW5CBTJZ3ZZOWX3ZNBKD6OE7A7IHUQVWMY62W2ZBG2SGZVOOPVH'
alice_keypair = Keypair.from_secret("SBFZCHU5645DOKRWYBXVOXY2ELGJKFRX6VGGPRYUWHQ7PMXXJNDZFMKD")
bob_address = "GA7YNBW5CBTJZ3ZZOWX3ZNBKD6OE7A7IHUQVWMY62W2ZBG2SGZVOOPVH"

builder = Builder(secret=alice_secret, horizon_uri='https://horizon.stellar.org', network='PUBLIC')
builder.add_text_memo("Hello, Stellar!").append_payment_op(
destination=bob_address, amount='12.25', asset_code='XLM')
builder.sign()
response = builder.submit()
print(response)
server = Server()
alice_account = server.load_account(alice_keypair.public_key())
transaction = TransactionBuilder(alice_account) \
.add_text_memo("Hello, Stellar!") \
.append_payment_op(bob_address, "10.25", "XLM") \
.build()
transaction.sign(alice_keypair)
response = server.submit_transaction(transaction)
print(response)

0 comments on commit bd9a5c3

Please sign in to comment.