# Print out
            print("last_op: %s | block:%s | from %s -> to: %s | fee: %f %s | amount: %f %s | memo: %s" % (
                      opID, block, 
                      from_account["name"], to_account["name"],
                      fee_amount, fee_asset["symbol"],
                      amount_amount, amount_asset["symbol"],
                      memomsg))

if __name__ == '__main__':

    ## RPC connections
    host     = "localhost"
    port     = 8090
    user     = ""
    password = ""

    ## Monitor definitions
    protocol = GrapheneMonitor
    protocol.last_op = last_op ## last operation logged
    protocol.account_id = "1.2.%s" % accountID.split(".")[2]  ## account to monitor

    ## Open Up Graphene Websocket API
    api      = GrapheneWebsocket(host, port, user, password, protocol)

    ## Set Callback for object changes
    api.setObjectCallbacks({accountID : protocol.onAccountUpdate})

    ## Run the Websocket connection continuously
    api.connect()
    api.run_forever()
Exemple #2
0
            # Request to Faucet
            headers = {'content-type': 'text/plain'}
            query = "refcode[code]=%s&refcode[account]=%s&refcode[asset_symbol]=%s&refcode[asset_amount]=%s&refcode[send_to]=%s" % (
                ref_code, from_account["name"], amount_asset["symbol"],
                op["amount"]["amount"], email)
            print("--- query: %s" % query)
            response = requests.post(config.faucet_url,
                                     params=query,
                                     headers=headers)


if __name__ == '__main__':
    ## Monitor definitions
    protocol = GrapheneMonitor
    protocol.last_op = config.last_op  ## last operation logged
    protocol.account_id = "1.2.%s" % config.accountID.split(".")[
        2]  ## account to monitor

    ## Open Up Graphene Websocket API
    api = GrapheneWebsocket(config.host, config.port, config.user,
                            config.password, protocol)

    print(api)

    ## Set Callback for object changes
    api.setObjectCallbacks({config.accountID: protocol.onAccountUpdate})

    ## Run the Websocket connection continuously
    api.connect()
    api.run_forever()