예제 #1
0
 def trust_asset(setup, secret_key, memo_text=None):
     """A helper to establish a trustline"""
     builder = Builder(secret=secret_key,
                       horizon_uri=setup.horizon_endpoint_uri,
                       network=setup.network)
     builder.append_trust_op(setup.test_asset.issuer, setup.test_asset.code)
     if memo_text:
         builder.add_text_memo(memo_text[:28])  # max memo length is 28
     builder.sign()
     reply = builder.submit()
     return reply.get('hash')
예제 #2
0
 def send_asset(cls, setup, secret_key, address, amount, memo_text=None):
     """A helper to send asset"""
     builder = Builder(secret=secret_key,
                       horizon_uri=setup.horizon_endpoint_uri,
                       network=setup.network)
     builder.append_payment_op(address, amount, setup.test_asset.code,
                               setup.test_asset.issuer)
     if memo_text:
         builder.add_text_memo(memo_text[:28])  # max memo length is 28
     builder.sign()
     reply = builder.submit()
     return reply.get('hash')
예제 #3
0
 async def trust_asset(setup, secret_key, memo_text=None):
     """A helper to establish a trustline"""
     async with Horizon(setup.horizon_endpoint_uri) as horizon:
         builder = Builder(secret=secret_key,
                           horizon=horizon,
                           network_name=setup.network,
                           fee=100)
         builder.append_trust_op(setup.test_asset.issuer,
                                 setup.test_asset.code)
         if memo_text:
             builder.add_text_memo(memo_text[:28])  # max memo length is 28
         builder.sign()
         reply = await builder.submit()
     return reply.get('hash')
예제 #4
0
 async def send_asset(cls,
                      setup,
                      secret_key,
                      address,
                      amount,
                      memo_text=None):
     """A helper to send asset"""
     async with Horizon(setup.horizon_endpoint_uri) as horizon:
         builder = Builder(secret=secret_key,
                           horizon=horizon,
                           network_name=setup.network,
                           fee=100)
         builder.append_payment_op(address, amount, setup.test_asset.code,
                                   setup.test_asset.issuer)
         if memo_text:
             builder.add_text_memo(memo_text[:28])  # max memo length is 28
         builder.sign()
         reply = await builder.submit()
     return reply.get('hash')
예제 #5
0
from kin_base.builder import Builder

alice_secret = 'SCB6JIZUC3RDHLRGFRTISOUYATKEE63EP7MCHNZNXQMQGZSLZ5CNRTKK'
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='KIN')
builder.sign()
response = builder.submit()
print(response)