Пример #1
0
    def system_newaccount(self, creator_account, created_account, owner_key,
                          active_key, stake_net_quantity, stake_cpu_quantity,
                          transfer, buy_ram_kbytes):
        newaccount_binargs = self.get_system_newaccount_binargs(
            creator_account, created_account, owner_key, active_key)
        buyrambytes_binargs = self.get_system_buyrambytes_binargs(
            creator_account, created_account, buy_ram_kbytes * 1024)
        delegatebw_binargs = self.get_system_delegatebw_binargs(
            creator_account, created_account, stake_net_quantity,
            stake_cpu_quantity, transfer)

        transaction, chain_id = TransactionBuilder(
            self).build_sign_transaction_request((
                Action('eosio', 'newaccount', creator_account, 'active',
                       newaccount_binargs),
                Action('eosio', 'buyrambytes', creator_account, 'active',
                       buyrambytes_binargs),
                Action('eosio', 'delegatebw', creator_account, 'active',
                       delegatebw_binargs),
            ))

        available_public_keys = self.wallet_get_public_keys()
        required_public_keys = self.chain_get_required_keys(
            transaction, available_public_keys)['required_keys']
        signed_transaction = self.wallet_sign_transaction(
            transaction, required_public_keys, chain_id)
        return self.chain_push_transaction(signed_transaction)
Пример #2
0
 def reponse_newuser(self, username):
     new_user_binargs = self.chain_abi_json_to_bin({
         "code": "reponse",
         "action": "newuser",
         "args": {
             "newb": username
         }
     })['binargs']
     transaction, chain_id = TransactionBuilder(
         self).build_sign_transaction_request(
             (Action('reponse', 'newuser', username, 'active',
                     new_user_binargs), ))
     available_public_keys = self.wallet_get_public_keys()
     required_public_keys = self.chain_get_required_keys(
         transaction, available_public_keys)['required_keys']
     signed_transaction = self.wallet_sign_transaction(
         transaction, required_public_keys, chain_id)
     return self.chain_push_transaction(signed_transaction)
Пример #3
0
 def reponse_exchange(self, accnt_name, point):
     exchange_binargs = self.chain_abi_json_to_bin({
         "code": "reponse",
         "action": "exchangep",
         "args": {
             "acnt": accnt_name,
             "point": point
         }
     })['binargs']
     transaction, chain_id = TransactionBuilder(
         self).build_sign_transaction_request(
             (Action('reponse', 'exchangep', 'reponse', 'active',
                     exchange_binargs), ))
     available_public_keys = self.wallet_get_public_keys()
     required_public_keys = self.chain_get_required_keys(
         transaction, available_public_keys)['required_keys']
     signed_transaction = self.wallet_sign_transaction(
         transaction, required_public_keys, chain_id)
     return self.chain_push_transaction(signed_transaction)
Пример #4
0
 def reponse_adopt(self, quser, question_id, answer_id):
     adopt_binargs = self.chain_abi_json_to_bin({
         "code": "reponse",
         "action": "adopt",
         "args": {
             "quser": quser,
             "question_id": question_id,
             "answer_id": answer_id
         }
     })['binargs']
     transaction, chain_id = TransactionBuilder(
         self).build_sign_transaction_request(
             (Action('reponse', 'adopt', quser, 'active', adopt_binargs), ))
     available_public_keys = self.wallet_get_public_keys()
     required_public_keys = self.chain_get_required_keys(
         transaction, available_public_keys)['required_keys']
     signed_transaction = self.wallet_sign_transaction(
         transaction, required_public_keys, chain_id)
     return self.chain_push_transaction(signed_transaction)
Пример #5
0
 def reponse_badge(self, accnt_name, point, challenge, bhash):
     badge_binargs = self.chain_abi_json_to_bin({
         "code": "reponse",
         "action": "badge",
         "args": {
             "acnt": accnt_name,
             "point": point,
             'challenge': challenge,
             'hash': bhash
         }
     })['binargs']
     transaction, chain_id = TransactionBuilder(
         self).build_sign_transaction_request(
             (Action('reponse', 'badge', 'reponse', 'active',
                     badge_binargs), ))
     available_public_keys = self.wallet_get_public_keys()
     required_public_keys = self.chain_get_required_keys(
         transaction, available_public_keys)['required_keys']
     signed_transaction = self.wallet_sign_transaction(
         transaction, required_public_keys, chain_id)
     return self.chain_push_transaction(signed_transaction)
Пример #6
0
 def reponse_newansw(self, auser, ahash, question_id, answer_id):
     new_answ_binargs = self.chain_abi_json_to_bin({
         "code": "reponse",
         "action": "answer",
         "args": {
             "auser": auser,
             "hash": ahash,
             "question_id": question_id,
             "answer_id": answer_id
         }
     })['binargs']
     transaction, chain_id = TransactionBuilder(
         self).build_sign_transaction_request(
             (Action('reponse', 'answer', 'reponse', 'active',
                     new_answ_binargs), ))
     available_public_keys = self.wallet_get_public_keys()
     required_public_keys = self.chain_get_required_keys(
         transaction, available_public_keys)['required_keys']
     signed_transaction = self.wallet_sign_transaction(
         transaction, required_public_keys, chain_id)
     return self.chain_push_transaction(signed_transaction)
Пример #7
0
 def reponse_newques(self, username, point, qhash, idx):
     new_ques_binargs = self.chain_abi_json_to_bin({
         "code": "reponse",
         "action": "question",
         "args": {
             "from": username,
             "rewards": point,
             "hash": qhash,
             "question_id": idx
         }
     })['binargs']
     transaction, chain_id = TransactionBuilder(
         self).build_sign_transaction_request(
             (Action('reponse', 'question', username, 'active',
                     new_ques_binargs), ))
     available_public_keys = self.wallet_get_public_keys()
     required_public_keys = self.chain_get_required_keys(
         transaction, available_public_keys)['required_keys']
     signed_transaction = self.wallet_sign_transaction(
         transaction, required_public_keys, chain_id)
     return self.chain_push_transaction(signed_transaction)
Пример #8
0
 def reponse_vote(self, voter, point, table_name, content_id, vhash):
     vote_binargs = self.chain_abi_json_to_bin({
         "code": "reponse",
         "action": "vote",
         "args": {
             "voter": voter,
             "point": point,
             'table_name': table_name,
             'content_id': content_id,
             'hash': vhash
         }
     })['binargs']
     transaction, chain_id = TransactionBuilder(
         self).build_sign_transaction_request(
             (Action('reponse', 'vote', 'reponse', 'active',
                     vote_binargs), ))
     available_public_keys = self.wallet_get_public_keys()
     required_public_keys = self.chain_get_required_keys(
         transaction, available_public_keys)['required_keys']
     signed_transaction = self.wallet_sign_transaction(
         transaction, required_public_keys, chain_id)
     return self.chain_push_transaction(signed_transaction)