Пример #1
0
def generate_keys(count, coin, laser):
    with open('config.json') as json_file:
        config_json = json.load(json_file)
        base_file_name = config_json['base_file_name']
        asset_id_file_name = config_json['asset_id_file_name']
        private_file_name = config_json['private_file_name']
        public_file_name = config_json['public_file_name']
        sequence_file_name = config_json['sequence_file_name']

    max_iterator_count = int(count)

    try:
        factory = CoinFactory()
        crypto_keygen_service = factory.get_coin_service(coin)

        if max_iterator_count > 0:
            coin_list = crypto_keygen_service.generate_list(max_iterator_count)
            save_coins_list(crypto_keygen_service, coin_list, base_file_name)
            save_asset_ids(crypto_keygen_service, coin_list,
                           asset_id_file_name)
            save_private_keys(crypto_keygen_service, coin_list,
                              private_file_name)
            save_public_keys(crypto_keygen_service, coin_list,
                             public_file_name)
            save_sequence_coin_id(laser, coin_list, sequence_file_name)
        else:
            print("Iterator count should be > 0")
    except Exception as e:
        print(e)
Пример #2
0
def lambda_handler(event, context):
    requestBody = json.loads(event["body"])
    blockchain = requestBody["blockchain"]
    quantity = requestBody["quantity"]

    coin = blockchain.upper()
    factory = CoinFactory()
    crypto_keygen_service = factory.get_coin_service(coin)

    coins = crypto_keygen_service.generate_list(quantity)

    res = [{
        "wif": coin.wif,
        "address": coin.address,
        "snip": crypto_keygen_service.generate_asset_id(coin)
    } for coin in coins]

    body = json.dumps({
        'data': res,
        'metadata': {
            'blockchain': blockchain,
            'quantity': quantity
        }
    })

    return {'statusCode': 200, 'body': body}
Пример #3
0
    def init(self):
        currencies = CoinFactory.get_available_currencies()
        self.currency = currencies[0]

        self.select_currency(self.currency)

        pygame.mixer.init()
Пример #4
0
    def __init__(self, coin_checker_frame):
        self.coin_checker_frame = coin_checker_frame

        top_frame = tkinter.Frame(self.coin_checker_frame, borderwidth=3)

        currencies = CoinFactory.get_available_currencies()
        self.currencies = currencies

        self.coin_checker_controller = CoinCheckerController(
            self, coin_checker_frame)

        self.header_widget = HeaderWidget(
            top_frame,
            currencies=self.currencies,
            on_currency_selected=self.coin_checker_controller.
            on_currency_selected,
            on_refreshed=self.coin_checker_controller.on_refreshed)
        top_frame.pack(fill=tkinter.X)

        bottom_frame_width = 650
        bottom_frame_height = 350

        bottom_frame = tkinter.Frame(self.coin_checker_frame,
                                     height=bottom_frame_height,
                                     width=bottom_frame_width,
                                     borderwidth=3)
        self.footer_widget = FooterWidget(
            bottom_frame,
            frame_width=bottom_frame_width,
            frame_height=bottom_frame_height,
            on_qr_code_scanned=self.coin_checker_controller.on_qr_code_scanned)
        bottom_frame.pack(fill=tkinter.BOTH, expand=True)

        self.coin_checker_controller.init()
Пример #5
0
    def __init__(self, root):
        self.root = root
        self.currencies = CoinFactory.get_available_currencies()

        combo_frame = tkinter.Frame(root, pady=15)
        tkinter.Label(combo_frame, text="Select currency").pack()
        # Adding combobox drop down list
        self.crypto_chosen = ttk.Combobox(combo_frame,
                                          width=27,
                                          values=self.currencies)
        # self.crypto_chosen.bind("<<ComboboxSelected>>", self.on_currency_checkbox_selected)
        self.crypto_chosen.current(0)
        self.crypto_chosen.pack()
        combo_frame.pack()

        count_frame = tkinter.Frame(root, pady=15)
        tkinter.Label(count_frame, text="Select count").pack()
        default_count = tkinter.StringVar()
        default_count.set(10)
        self.count_spin = tkinter.Spinbox(count_frame,
                                          from_=1,
                                          to=1000,
                                          textvariable=default_count)
        self.count_spin.pack()
        count_frame.pack()

        self.lasers = load_lasers()
        laser_frame = tkinter.Frame(root, pady=15)
        tkinter.Label(laser_frame, text="Select laser").pack()
        # Adding combobox drop down list
        self.laser_chosen = ttk.Combobox(laser_frame,
                                         width=27,
                                         values=self.lasers)
        # self.crypto_chosen.bind("<<ComboboxSelected>>", self.on_currency_checkbox_selected)
        self.laser_chosen.current(0)
        self.laser_chosen.pack()
        laser_frame.pack()

        btn_frame = tkinter.Frame(root, pady=15)
        generate_btn = tkinter.Button(btn_frame,
                                      text="Generate",
                                      width=20,
                                      height=2)
        generate_btn.config(command=self.on_generate_clicked)
        generate_btn.pack()
        btn_frame.pack()

        # Progress bar widget
        progress_frame = tkinter.Frame(root)
        self.progress = Progressbar(progress_frame,
                                    orient=tkinter.HORIZONTAL,
                                    length=100,
                                    mode='indeterminate')
        self.progress.pack()
        progress_frame.pack()

        self.keygen_controller = KeygenController(self, root)
Пример #6
0
def test_coin(currency, private_key, address):
    service = CoinFactory.get_coin_service(currency)
    gen_address = service.get_address(private_key)
    assert gen_address == address
 def select_currency(self, currency):
     self.currency = currency
     self.coin_service = CoinFactory.get_coin_service(self.currency)
     self.change_state(States.SCAN_COIN_STATE)
     self.root.set_currency(currency)
     print("Selected currency: ", self.currency)