示例#1
0
def load_blocks():
    coda_client = Client()
    query = '''
    {
        blocks {
            nodes {
                creator
                transactions {
                    userCommands {
                        from
                        to
                    }
                }
                protocolState {
                    blockchainState {
                      date
                    }
                }
                snarkJobs {
                    prover
                    fee
                    workIds
                }
            }
        }
    }
    '''
    response = coda_client._send_query(query)
    return response["data"]["blocks"]["nodes"]
示例#2
0
 def __init__(self, client_args, public_key, privkey_pass, min_tx_amount=AGENT_MIN_TX, max_tx_amount=AGENT_MAX_TX, min_fee_amount=AGENT_MIN_FEE, max_fee_amount=AGENT_MAX_FEE):
     self.coda = Client(**client_args)
     self.public_key = public_key
     self.privkey_pass = privkey_pass
     self.min_tx_amount = min_tx_amount
     self.max_tx_amount = max_tx_amount
     self.min_fee_amount = min_fee_amount
     self.max_fee_amount = max_fee_amount
     self.to_account = None
示例#3
0
logger = logging.getLogger(__name__)
c = yaml.load(open('config.yml', encoding='utf8'), Loader=yaml.SafeLoader)
print("version 1.2.4")

WORKER_PUB_KEY = str(c["WORKER_PUB_KEY"])
WORKER_FEE = float(c["WORKER_FEE"])
CHECK_PERIOD_SEC = int(c["CHECK_PERIOD_SEC"])
STOP_WORKER_FOR_MIN = int(c["STOP_WORKER_FOR_MIN"])
STOP_WORKER_BEFORE_MIN = int(c["STOP_WORKER_BEFORE_MIN"])
GRAPHQL_HOST = str(c["GRAPHQL_HOST"])
GRAPHQL_PORT = int(c["GRAPHQL_PORT"])
# MINA --> nanomina
WORKER_FEE = int(WORKER_FEE * 1e9)

try:
    coda = Client(graphql_host=GRAPHQL_HOST, graphql_port=GRAPHQL_PORT)
    WORKER_PUB_KEY = parse_worker_pubkey()

except:
    logger.fatal(
        f'😿 Can\'t connect to graphql {GRAPHQL_HOST}:{GRAPHQL_PORT}.\n'
        f'Check troubleshooting manual - https://github.com/c29r3/mina-snark-stopper#troubleshooting'
    )
    exit(1)

print(f'Worker public key:  {WORKER_PUB_KEY}\n'
      f'Worker fee:         {WORKER_FEE}\n'
      f'Check period(sec):  {CHECK_PERIOD_SEC}\n'
      f'Stop before(min):   {STOP_WORKER_BEFORE_MIN}\n')

while True:
    def test_send_payment(self, mock_post, snapshot):
        mock_post.return_value = self._mock_response(json_data={"data": "foo"})

        client = Client()
        client.send_payment("to_pk", "from_pk", "amount", "fee", "memo")
        snapshot.assert_match(mock_post.call_args_list)
    def test_create_wallet_no_args(self, mock_post, snapshot):
        mock_post.return_value = self._mock_response(json_data={"data": "foo"})

        client = Client()
        client.create_wallet()
        snapshot.assert_match(mock_post.call_args_list)
    def test_set_current_snark_worker(self, mock_post, snapshot):
        mock_post.return_value = self._mock_response(json_data={"data": "foo"})

        client = Client()
        client.set_current_snark_worker("pk", "fee")
        snapshot.assert_match(mock_post.call_args_list)
    def test_get_sync_status(self, mock_post, snapshot):
        mock_post.return_value = self._mock_response(json_data={"data": "foo"})

        client = Client()
        client.get_sync_status()
        snapshot.assert_match(mock_post.call_args_list)