def test_request_account_info(self):
     remote = Remote()
     if not isinstance(remote.connect(), Exception):
         req = remote.request_account_info(
             {'account': 'jsMwaJ7EA4y7QgdvQzaD2CqzQQN4v7vLFK'})
         result = remote.parse_account_info(req.submit())
         logger.info(result)
Exemple #2
0
 def test_submit():
     remote = Remote()
     if not isinstance(remote.connect(), Exception):
         req = remote.request_account_info(
             {'account': 'j9fE48ebcvwnKSGnPdtN6jGNM9yVBMVaH8'})
         result = req.submit()
         logger.info(result)
 def test_request_account_tums(self):
     remote = Remote()
     if not isinstance(remote.connect(), Exception):
         req = remote.request_account_tums(
             {'account': 'jEkffY8XtkEtkUKyYQT1Fv7MDp3grAtwdH'})
         result = remote.parse_account_tums(req.submit())
         logger.info(result)
Exemple #4
0
    def test_build_account():
        remote = Remote()
        options_property = {
                'type': 'property',
                'account': 'j9fE48ebcvwnKSGnPdtN6jGNM9yVBMVaH8',
                'set_flag': '2'
        }
        options_delegate = {
                'type': 'delegate',
                'account': 'j9fE48ebcvwnKSGnPdtN6jGNM9yVBMVaH8',
                'delegate_key': 'jEmEWuLQXgtBaro86hScnBpjN3TgKSoQGD',
                'set_flag': '123'
        }
        if not isinstance(remote.connect(), Exception):
            tx = remote.build_account_set_tx(options_property)
            tx.set_secret('ssTkYQLLYiZs7Sosp12sB43TocUbd')
            s = tx.submit()
            result = remote.parse_payment(s)
            logger.info(result)

            tx = remote.build_account_set_tx(options_delegate)
            tx.set_secret('ssTkYQLLYiZs7Sosp12sB43TocUbd')
            s = tx.submit()
            result = remote.parse_payment(s)
            logger.info(result)
 def test_request_account_offers(self):
     remote = Remote()
     if not isinstance(remote.connect(), Exception):
         req = remote.request_account_offers(
             {'account': 'jJvkUPnBNQ4Wy5QGBKwMa8ftS5s9EDYXER'})
         result = remote.parse_request_account_offers(req.submit())
         logger.info(result)
 def test_transaction(self):
     remote = Remote()
     if not isinstance(remote.connect(), Exception):
         req = remote.request_tx({
             'hash':
             '82C2C652431B63179E7CC775C3C1DBEC7AF1A6E91CC5A2671B195C19C76D701C'
         })
         result = remote.parse_transaction(req.submit())
         logger.info(result)
Exemple #7
0
    def test_get_transaction_type():
        remote = Remote()
        options = {
            'account': 'jB7rxgh43ncbTX4WeMoeadiGMfmfqY2xLZ',
            'sequence': 688
        }

        if not isinstance(remote.connect(), Exception):
            req = remote.build_offer_cancel_tx(options)
            result = req.get_transaction_type()
            logger.info(result)
    def test_build_offer_cancel():
        remote = Remote(local_sign=True)
        options = {
            'sequence': 1777,
            'account': 'jB7rxgh43ncbTX4WeMoeadiGMfmfqY2xLZ',
        }

        if not isinstance(remote.connect(), Exception):
            tx = remote.build_offer_cancel_tx(options)
            tx.set_secret('sn37nYrQ6KPJvTFmaBYokS3FjXUWd')
            s = tx.submit()
            result = remote.parse_payment(s)
            logger.info(result)
Exemple #9
0
    def test_call_contract():
        remote = Remote(local_sign=True)
        options = {
            'account': 'j9fE48ebcvwnKSGnPdtN6jGNM9yVBMVaH8',
            'destination': 'jD2WwwJcjh3RtzQFnXe8joq72FN6KrVuji',
            'foo': 'foo',
            'params': ['j9fE48ebcvwnKSGnPdtN6jGNM9yVBMVaH8']
        }

        if not isinstance(remote.connect(), Exception):
            tx = remote.call_contract_tx(options)
            tx.set_secret('ssTkYQLLYiZs7Sosp12sB43TocUbd')
            s = tx.submit()
            result = remote.parse_contract(s)
            logger.info(result)
 def test_request_orderbook(self):
     remote = Remote(local_sign=True)
     if not isinstance(remote.connect(), Exception):
         req = remote.request_order_book({
             'gets': {
                 'currency': 'SWT',
                 'issuer': ''
             },
             'pays': {
                 'currency': 'CNY',
                 'issuer': 'jBciDE8Q3uJjf111VeiUNM775AMKHEbBLS'
             },
             'limit': 20
         })
         temp = req.submit()
         result = remote.parse_orderbook_info(temp)
         logger.info(result)
Exemple #11
0
 def test_create_pay_object():
     remote = Remote(local_sign=True)
     if not isinstance(remote.connect(), Exception):
         options = {
             'account': 'jB7rxgh43ncbTX4WeMoeadiGMfmfqY2xLZ',
             'to': 'jEmEWuLQXgtBaro86hScnBpjN3TgKSoQGD',
             'amount': {
                 "value": 444440.01,
                 "currency": "SWT",
                 "issuer": ""
             }
         }
         tx = remote.build_payment_tx(options)
         tx.set_secret('sn37nYrQ6KPJvTFmaBYokS3FjXUWd')
         tx.add_memo('给jDUjqoDZLhzx4DCf6pvSivjkjgtRESY62c支付0.5swt.')  # 可选
         #tx.add_memo('给')  # 可选
         s = tx.submit()
         result = remote.parse_payment(s)
         logger.info(result)
Exemple #12
0
 def test_create_pay_object():
     remote = Remote(local_sign=True)
     if not isinstance(remote.connect(), Exception):
         options = {
             'account': 'j9fE48ebcvwnKSGnPdtN6jGNM9yVBMVaH8',
             'to': 'jEmEWuLQXgtBaro86hScnBpjN3TgKSoQGD',
             'amount': {
                 "value": 0.01,
                 "currency": "SWT",
                 "issuer": ""
             }
         }
         tx = remote.build_payment_tx(options)
         tx.set_secret('ssTkYQLLYiZs7Sosp12sB43TocUbd')
         tx.add_memo('给jDUjqoDZLhzx4DCf6pvSivjkjgtRESY62c支付0.5swt.')  # 可选
         tx.add_memo('给')  # 可选
         s = tx.submit()
         result = remote.parse_payment(s)
         logger.info(result)
Exemple #13
0
    def test_deploy_contract():
        remote = Remote(local_sign=True)
        payload = 'result={}; ' + \
            'function Init(t) result=scGetAccountBalance(t) ' + \
            'return result end; ' + \
            'function foo(t) result=scGetAccountBalance(t) ' + \
            'return result end'
        options = {
            'account': 'j9fE48ebcvwnKSGnPdtN6jGNM9yVBMVaH8',
            'amount': 10,
            'payload': str_to_hex(payload),
            'params': ['j9fE48ebcvwnKSGnPdtN6jGNM9yVBMVaH8']
        }

        if not isinstance(remote.connect(), Exception):
            tx = remote.deploy_contract_tx(options)
            tx.set_secret('ssTkYQLLYiZs7Sosp12sB43TocUbd')
            s = tx.submit()
            result = remote.parse_contract(s)
            logger.info(result)
    def test_build_offer_create():
        remote = Remote(local_sign=True)
        options = {
            'type': 'Sell',
            'account': 'jB7rxgh43ncbTX4WeMoeadiGMfmfqY2xLZ',
            'taker_gets': {
                'value': '0.01',
                'currency': '8100000036000020160622201606300120000002',
                'issuer': 'jBciDE8Q3uJjf111VeiUNM775AMKHEbBLS'
            },
            'taker_pays': {
                'value': '1',
                'currency': 'SWT',
                'issuer': ''
            }
        }

        if not isinstance(remote.connect(), Exception):
            tx = remote.build_offer_create_tx(options)
            tx.set_secret('sn37nYrQ6KPJvTFmaBYokS3FjXUWd')
            s = tx.submit()
            result = remote.parse_payment(s)
            logger.info(result)
Exemple #15
0
    def test_set_relation():
        remote = Remote()
        options_trust = {
                'type': 'trust',
                'account': 'j9fE48ebcvwnKSGnPdtN6jGNM9yVBMVaH8',
                'target': 'jEmEWuLQXgtBaro86hScnBpjN3TgKSoQGD',
                'limit': {
                    "value": "600000000000",
                    "currency": "CCA",
                    "issuer": "js7M6x28mYDiZVJJtfJ84ydrv2PthY9W9u"
                }
        }
        options_authorize = {
                'type': 'authorize',
                'account': 'j9fE48ebcvwnKSGnPdtN6jGNM9yVBMVaH8',
                'target': 'jEmEWuLQXgtBaro86hScnBpjN3TgKSoQGD',
                'limit': {
                    "value": "0.5",
                    "currency": "CCA",
                    "issuer": "js7M6x28mYDiZVJJtfJ84ydrv2PthY9W9u"
                }
        }
        options_freeze = {
            'type': 'freeze',
            'account': 'j9fE48ebcvwnKSGnPdtN6jGNM9yVBMVaH8',
            'target': 'jEmEWuLQXgtBaro86hScnBpjN3TgKSoQGD',
            'limit': {
                "value": "0.5",
                "currency": "CCA",
                "issuer": "js7M6x28mYDiZVJJtfJ84ydrv2PthY9W9u"
            }
        }
        if not isinstance(remote.connect(), Exception):
            tx = remote.build_relation_tx(options_trust)
            tx.set_secret('ssTkYQLLYiZs7Sosp12sB43TocUbd')
            s = tx.submit()
            result = remote.parse_payment(s)
            logger.info(result)

            tx = remote.build_relation_tx(options_authorize)
            tx.set_secret('ssTkYQLLYiZs7Sosp12sB43TocUbd')
            s = tx.submit()
            result = remote.parse_payment(s)
            logger.info(result)

            tx = remote.build_relation_tx(options_freeze)
            tx.set_secret('ssTkYQLLYiZs7Sosp12sB43TocUbd')
            s = tx.submit()
            result = remote.parse_payment(s)
            logger.info(result)
    def test_ledger(self):
        remote = Remote()
        if not isinstance(remote.connect(), Exception):
            req = remote.request_ledger({
                'ledger_index': '943501',
                'transactions': True
            })
            temp = req.submit()
            result = remote.parse_ledger(temp, req)
            logger.info(result)

            req = remote.request_ledger({
                'ledger_hash':
                '1F91E2FBCF7BCF26D02024657460FE3718F701D2497F12F54C24D56521912E61'
            })
            temp = req.submit()
            result = remote.parse_ledger(temp, req)
            logger.info(result)

            req = remote.request_ledger({'transactions': True})
            temp = req.submit()
            result = remote.parse_ledger(temp, req)
            logger.info(result)
    def test_request_account_relations(self):
        remote = Remote()
        if not isinstance(remote.connect(), Exception):
            req = remote.request_account_relations({
                'account': 'jEkffY8XtkEtkUKyYQT1Fv7MDp3grAtwdH',
                'type': 'trust'
            })
            result = remote.parse_request_account_relations(req.submit())
            logger.info(result)

            req = remote.request_account_relations({
                'account': 'jEkffY8XtkEtkUKyYQT1Fv7MDp3grAtwdH',
                'type': 'authorize'
            })
            result = remote.parse_request_account_relations(req.submit())
            logger.info(result)

            req = remote.request_account_relations({
                'account': 'jEkffY8XtkEtkUKyYQT1Fv7MDp3grAtwdH',
                'type': 'freeze'
            })
            result = remote.parse_request_account_relations(req.submit())
            logger.info(result)
Exemple #18
0
 def test_generate():
     result = Wallet.generate()
     logger.info(result)
Exemple #19
0
 def test_from_secret():
     result = Wallet.from_secret('ss2A7yahPhoduQjmG7z9BHu3uReDk123')
     logger.info(result)
 def test_conn(self):
     remote = Remote()
     if not isinstance(remote.connect(), Exception):
         result = remote.get_connect_info()
         logger.info(result)
 def test_server_info(self):
     remote = Remote()
     if not isinstance(remote.connect(), Exception):
         req = remote.request_server_info()
         result = remote.parse_server_info(req.submit())
         logger.info(result)
 def test_ledger_closed(self):
     remote = Remote(local_sign=True)
     if not isinstance(remote.connect(), Exception):
         req = remote.request_ledger_closed()
         result = remote.parse_ledger_closed(req.submit())
         logger.info(result)