示例#1
0
 def test_federation_payment(self, setup):
     builder_fed = Builder(
         address='GBTCBCWLE6YVTR5Y5RRZC36Z37OH22G773HECWEIZTZJSN4WTG3CSOES',
         sequence=100)
     builder_fed.federation_payment(fed_address="fed*fed-domain.com",
                                    amount="100.5",
                                    asset_code="XLM")
     builder = Builder(
         address='GBTCBCWLE6YVTR5Y5RRZC36Z37OH22G773HECWEIZTZJSN4WTG3CSOES',
         sequence=100).add_text_memo("hello memo").append_payment_op(
             destination=
             'GBTCBCWLE6YVTR5Y5RRZC36Z37OH22G773HECWEIZTZJSN4WTG3CSOES',
             asset_code='XLM',
             amount="100.5")
     assert builder_fed.hash() == builder.hash()
示例#2
0
 def test_import_from_xdr(self, setup, test_data):
     builder = Builder(secret=test_data.cold_secret, sequence=1, horizon_uri=setup.horizon_endpoint_uri,
                       network=setup.network) \
         .append_manage_data_op("hello", "world") \
         .add_time_bounds({'minTime': 1534392138, 'maxTime': 1534392238})
     builder.sign()
     old_xdr = builder.gen_xdr()
     old_hash = builder.hash()
     new_hash = Builder(
         secret=test_data.cold_secret).import_from_xdr(old_xdr).hash()
     assert new_hash == old_hash
示例#3
0
 def test_import_from_xdr_custom_network(self, setup, test_data):
     builder = Builder(secret=test_data.cold_secret, sequence=1, horizon_uri=setup.horizon_endpoint_uri,
                       network='CUSTOM_NETWORK') \
         .append_manage_data_op("hello", "world")
     builder.sign()
     old_xdr = builder.gen_xdr()
     old_hash = builder.hash()
     new_hash = Builder(
         secret=test_data.cold_secret,
         network='CUSTOM_NETWORK').import_from_xdr(old_xdr).hash()
     assert new_hash == old_hash
示例#4
0
def payment(target_address: str, amount: str, network, source_secret):
    config = configs[network]
    src_address = Keypair.from_seed(source_secret).address().decode()
    builder = Builder(secret=source_secret,
                      horizon_uri=config['HORIZON_URL'],
                      network=network)
    builder.append_payment_op(destination=target_address,
                              asset_code='HOT',
                              asset_issuer=config['ISSUER_HOT'],
                              amount=amount)
    builder.sign()
    print("###############   TX   #################")
    print('Payment {} HOT from {} to {}'.format(amount, src_address,
                                                target_address))
    print('Network: {}'.format(network))
    print('Sequence: {}'.format(builder.sequence))
    print('Hash: {}'.format(builder.hash()))
    print("#########################################")
    click.confirm('Correct?', abort=True)
    print('Submitting...')
    builder.submit()
    print('success')
    return True