Ejemplo n.º 1
0
void lisk_get_address_from_public_key(const uint8_t *public_key,
                                      char *address) {
  uint64_t digest[4];
  sha256_Raw(public_key, 32, (uint8_t *)digest);
  bn_format_uint64(digest[0], NULL, "L", 0, 0, false, address,
                   MAX_LISK_ADDRESS_SIZE);
}
Ejemplo n.º 2
0
void layoutRequireConfirmMultisig(LiskTransactionAsset *asset) {
  char keys_group_str[25];
  char life_time_str[14];
  char min_str[8];

  bn_format_uint64(asset->multisignature.keys_group_count,
                   "Keys group length: ", NULL, 0, 0, false, keys_group_str,
                   sizeof(keys_group_str));
  bn_format_uint64(asset->multisignature.life_time, "Life time: ", NULL, 0, 0,
                   false, life_time_str, sizeof(life_time_str));
  bn_format_uint64(asset->multisignature.min, "Min: ", NULL, 0, 0, false,
                   min_str, sizeof(min_str));

  layoutDialogSwipe(&bmp_icon_question, _("Cancel"), _("Confirm"), NULL,
                    _("Confirm transaction"), keys_group_str, life_time_str,
                    min_str, NULL, NULL);
}
Ejemplo n.º 3
0
void layoutConfirmTx(const CoinInfo *coin, uint64_t amount_out, uint64_t amount_fee)
{
	char str_out[32], str_fee[32];
	bn_format_uint64(amount_out, NULL, coin->coin_shortcut, BITCOIN_DIVISIBILITY, 0, false, str_out, sizeof(str_out));
	bn_format_uint64(amount_fee, NULL, coin->coin_shortcut, BITCOIN_DIVISIBILITY, 0, false, str_fee, sizeof(str_fee));
	layoutDialogSwipe(&bmp_icon_question,
		_("Cancel"),
		_("Confirm"),
		NULL,
		_("Really send"),
		str_out,
		_("from your wallet?"),
		_("Fee included:"),
		str_fee,
		NULL
	);
}
Ejemplo n.º 4
0
void layoutConfirmOutput(const CoinInfo *coin, const TxOutputType *out)
{
	char str_out[32 + 3];
	bn_format_uint64(out->amount, NULL, coin->coin_shortcut, BITCOIN_DIVISIBILITY, 0, false, str_out, sizeof(str_out) - 3);
	strlcat(str_out, " to", sizeof(str_out));
	const char *address = out->address;
	const char *extra_line = (out->address_n_count > 0) ? address_n_str(out->address_n, out->address_n_count, false) : 0;
	render_address_dialog(coin, address, _("Confirm sending"), str_out, extra_line);
}
Ejemplo n.º 5
0
void layoutRequireConfirmCastVotes(LiskTransactionAsset *asset) {
  uint8_t plus = 0;
  uint8_t minus = 0;
  char add_votes_txt[13];
  char remove_votes_txt[16];

  for (int i = 0; i < asset->votes_count; i++) {
    if (asset->votes[i][0] == '+') {
      plus += 1;
    } else {
      minus += 1;
    }
  }

  bn_format_uint64(plus, "Add ", NULL, 0, 0, false, add_votes_txt,
                   sizeof(add_votes_txt));
  bn_format_uint64(minus, "Remove ", NULL, 0, 0, false, remove_votes_txt,
                   sizeof(remove_votes_txt));

  layoutDialogSwipe(&bmp_icon_question, _("Cancel"), _("Confirm"), NULL,
                    _("Confirm transaction"), add_votes_txt, remove_votes_txt,
                    NULL, NULL, NULL);
}
Ejemplo n.º 6
0
void layoutFeeOverThreshold(const CoinInfo *coin, uint64_t fee)
{
	char str_fee[32];
	bn_format_uint64(fee, NULL, coin->coin_shortcut, BITCOIN_DIVISIBILITY, 0, false, str_fee, sizeof(str_fee));
	layoutDialogSwipe(&bmp_icon_question,
		_("Cancel"),
		_("Confirm"),
		NULL,
		_("Fee"),
		str_fee,
		_("is unexpectedly high."),
		NULL,
		_("Send anyway?"),
		NULL
	);
}
Ejemplo n.º 7
0
void layoutConfirmOmni(const uint8_t *data, uint32_t size)
{
	const char *desc;
	char str_out[32];
	const uint32_t tx_type = *(const uint32_t *)(data + 4);
	if (tx_type == 0x00000000 && size == 20) {  // OMNI simple send
		desc = _("Simple send of ");
		const uint32_t currency = *(const uint32_t *)(data + 8);
		const char *suffix = "UNKN";
		switch (currency) {
			case 1:
				suffix = "OMNI";
				break;
			case 2:
				suffix = "tOMNI";
				break;
			case 3:
				suffix = "MAID";
				break;
			case 31:
				suffix = "USDT";
				break;
		}
		const uint64_t amount = *(const uint64_t *)(data + 12);
		bn_format_uint64(amount, NULL, suffix, BITCOIN_DIVISIBILITY, 0, false, str_out, sizeof(str_out));
	} else {
		desc = _("Unknown transaction");
		str_out[0] = 0;
	}
	layoutDialogSwipe(&bmp_icon_question,
		_("Cancel"),
		_("Confirm"),
		NULL,
		_("Confirm OMNI Transaction:"),
		NULL,
		desc,
		NULL,
		str_out,
		NULL
	);
}
Ejemplo n.º 8
0
static void lisk_format_value(uint64_t value, char *formated_value) {
  bn_format_uint64(value, NULL, " LSK", 8, 0, false, formated_value,
                   MAX_LISK_VALUE_SIZE);
}