Example #1
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)
Example #2
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)