2014-04-29 12:26:51 +00:00
|
|
|
/*
|
2019-06-17 18:27:55 +00:00
|
|
|
* This file is part of the Trezor project, https://trezor.io/
|
2014-04-29 12:26:51 +00:00
|
|
|
*
|
|
|
|
* Copyright (C) 2014 Pavol Rusnak <stick@satoshilabs.com>
|
|
|
|
*
|
|
|
|
* This library is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __COINS_H__
|
|
|
|
#define __COINS_H__
|
|
|
|
|
2017-10-30 21:13:09 +00:00
|
|
|
#include <stdbool.h>
|
2019-03-29 16:10:31 +00:00
|
|
|
#include <stdint.h>
|
2014-04-29 12:26:51 +00:00
|
|
|
|
2017-12-09 18:28:53 +00:00
|
|
|
#include "bip32.h"
|
2017-12-09 14:38:37 +00:00
|
|
|
#include "hasher.h"
|
2014-04-29 12:26:51 +00:00
|
|
|
|
2017-10-30 21:13:09 +00:00
|
|
|
typedef struct _CoinInfo {
|
2019-03-29 16:10:31 +00:00
|
|
|
const char *coin_name;
|
|
|
|
const char *coin_shortcut;
|
|
|
|
uint64_t maxfee_kb;
|
|
|
|
const char *signed_message_header;
|
2019-12-09 16:43:30 +00:00
|
|
|
uint32_t decimals;
|
2019-03-29 16:10:31 +00:00
|
|
|
bool has_segwit;
|
|
|
|
bool has_fork_id;
|
|
|
|
bool force_bip143;
|
|
|
|
bool decred;
|
|
|
|
// address types > 0xFF represent a two-byte prefix in big-endian order
|
|
|
|
uint32_t address_type;
|
|
|
|
uint32_t address_type_p2sh;
|
|
|
|
uint32_t xpub_magic;
|
|
|
|
uint32_t xpub_magic_segwit_p2sh;
|
|
|
|
uint32_t xpub_magic_segwit_native;
|
|
|
|
uint32_t fork_id;
|
|
|
|
const char *bech32_prefix;
|
|
|
|
const char *cashaddr_prefix;
|
|
|
|
uint32_t coin_type;
|
2019-08-09 14:01:28 +00:00
|
|
|
bool negative_fee;
|
2019-03-29 16:10:31 +00:00
|
|
|
const char *curve_name;
|
|
|
|
const curve_info *curve;
|
2020-03-09 21:23:27 +00:00
|
|
|
bool extra_data;
|
|
|
|
bool timestamp;
|
2020-03-12 14:13:08 +00:00
|
|
|
bool overwintered;
|
2017-10-30 21:13:09 +00:00
|
|
|
} CoinInfo;
|
2017-08-14 12:42:59 +00:00
|
|
|
|
2017-12-24 13:41:48 +00:00
|
|
|
#include "coin_info.h"
|
2014-04-29 12:26:51 +00:00
|
|
|
|
2017-10-30 21:13:09 +00:00
|
|
|
const CoinInfo *coinByName(const char *name);
|
|
|
|
const CoinInfo *coinByAddressType(uint32_t address_type);
|
2018-05-22 16:40:15 +00:00
|
|
|
const CoinInfo *coinBySlip44(uint32_t coin_type);
|
2019-03-29 16:10:31 +00:00
|
|
|
bool coinExtractAddressType(const CoinInfo *coin, const char *addr,
|
|
|
|
uint32_t *address_type);
|
|
|
|
bool coinExtractAddressTypeRaw(const CoinInfo *coin, const uint8_t *addr_raw,
|
|
|
|
uint32_t *address_type);
|
2014-04-29 12:26:51 +00:00
|
|
|
|
|
|
|
#endif
|