Beispiel #1
0
    def push_action(
            self, action, data,
            permission="", expiration_sec=30, 
            skip_signature=0, dont_broadcast=0, forceUnique=0,
            max_cpu_usage=0, max_net_usage=0,
            ref_block=""):
        if not permission:
            permission = account_object.name
        else:
            try: # permission is an account:
                permission = permission.name
            except: # permission is the name of an account:
                permission = permission

        account_object.action = cleos.PushAction(
            account_object, action, data,
            permission, expiration_sec, 
            skip_signature, dont_broadcast, forceUnique,
            max_cpu_usage, max_net_usage,
            ref_block,
            is_verbose=account_object.is_verbose)

        if not account_object.action.error:
            try:
                account_object._console = account_object.action.console
                if account_object.is_verbose > 0:
                    print(account_object._console + "\n")
            except:
                pass

        return account_object.action
Beispiel #2
0
    def test_72(self):
        global account_test
        get_info = cleos.GetInfo(is_verbose=-1)
        push_create = cleos.PushAction(
            account_test,
            "create",
            '{"issuer":"eosio", "maximum_supply":"1000000000.0000 EOS", \
                "can_freeze":0, "can_recall":0, "can_whitelist":0}',
            permission=account_test)
        self.assertTrue(not push_create.error, "PushAction create")
        try:
            print(push_create.console)
            print(push_create.data)
        except:
            pass

        global account_master
        push_issue = cleos.PushAction(
            account_test,
            "issue",
            '{"to":"alice", "quantity":"100.0000 EOS", \
                "memo":"100.0000 EOS to alice"}',
            permission=account_master)
        self.assertTrue(not push_issue.error, "PushAction issue")
        print(push_issue.console)
        print(push_issue.data)

        global account_alice
        push_transfer = cleos.PushAction(
            account_test,
            "transfer",
            '{"from":"alice", "to":"carol", "quantity":"25.0000 EOS", \
            "memo":"100.0000 EOS to carol"}',
            permission=account_alice)
        self.assertTrue(not push_transfer.error, "PushAction issue")
        print(push_transfer.console)
        print(push_transfer.data)
Beispiel #3
0
    def push_action(
            self, action, data,
            permission="", expiration_sec=30,
            skip_signature=0, dont_broadcast=0, forceUnique=0,
            max_cpu_usage=0, max_net_usage=0,
            ref_block="",
            is_verbose=1,
            json=False,
            output=False
        ):
        if not permission:
            permission = self.account.name
        else:
            try: # permission is an account:
                permission = permission.name
            except: # permission is the name of an account:
                permission = permission

        if output:
            is_verbose = 0
            json = True

        if not isinstance(data, str):
            data = pjson.dumps(data)
    
        self.action = cleos.PushAction(
            self.account.name, action, data,
            permission, expiration_sec, 
            skip_signature, dont_broadcast, forceUnique,
            max_cpu_usage, max_net_usage,
            ref_block,
            self.is_verbose > 0 and is_verbose > 0, json)

        if not self.action.error:
            try:
                self._console = self.action.console
                if self.is_verbose:
                    print(self._console + "\n") 
            except:
                pass

        return self.action