コード例 #1
0
ファイル: transaction_logger.py プロジェクト: xgenvn/t-bears
def send_transaction_with_logger(icon_service, signed_transaction, uri):
    tx_dict = make_dict_to_rpc_dict(signed_transaction.signed_transaction_dict,
                                    'icx_transaction')
    Logger.info(f"Send request to {uri}. Request body: {tx_dict}",
                TBEARS_CLI_TAG)

    return icon_service.send_transaction(signed_transaction, True)
コード例 #2
0
ファイル: command_util.py プロジェクト: ssdred1250/iconnex
    def run(self, args):
        if not hasattr(self, args.command):
            print(f"Wrong command {args.command}")
            return

        Logger.info(f"Run '{args.command}' command", TBEARS_CLI_TAG)

        # run command
        return getattr(self, args.command)(vars(args))
コード例 #3
0
    def run(self, args):
        if not hasattr(self, args.command):
            raise TBearsCommandException(f"Invalid command {args.command}")

        user_input = vars(args)
        conf = self.get_icon_conf(args.command, args=user_input)

        Logger.info(f"Run '{args.command}' command with config: {conf}", TBEARS_CLI_TAG)

        # run command
        return getattr(self, args.command)(conf)
コード例 #4
0
    def send(self, request) -> dict:
        """Send request to URI

        :param request: JSON-RPC request
        :return: response dictionary of request.
        """
        Logger.info(f"Send request to {self.__uri}. Request body: {request}",
                    TBEARS_CLI_TAG)

        # if query doesn't change any state of iconservice or loopchain, use 'send' method
        response = requests.post(url=self.__uri, json=request)
        try:
            response_json = response.json()
        except ValueError:
            if not response.ok:
                raise IconClientException(
                    f"Got error response. Response status_code: [{response.status_code}]"
                )
        else:
            return response_json
コード例 #5
0
ファイル: transaction_logger.py プロジェクト: xgenvn/t-bears
def call_with_logger(icon_service, call_obj, uri):
    call_dict = make_call_dict_to_rpc_dict(call_obj)
    Logger.info(f"Send request to {uri}. Request body: {call_dict}",
                TBEARS_CLI_TAG)

    return icon_service.call(call_obj, True)