ledger-core
Bech32Parameters.h
1 /*
2  *
3  * Bech32Parameters
4  *
5  * Created by El Khalil Bellakrid on 14/02/2019.
6  *
7  * The MIT License (MIT)
8  *
9  * Copyright (c) 2019 Ledger
10  *
11  * Permission is hereby granted, free of charge, to any person obtaining a copy
12  * of this software and associated documentation files (the "Software"), to deal
13  * in the Software without restriction, including without limitation the rights
14  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15  * copies of the Software, and to permit persons to whom the Software is
16  * furnished to do so, subject to the following conditions:
17  *
18  * The above copyright notice and this permission notice shall be included in all
19  * copies or substantial portions of the Software.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27  * SOFTWARE.
28  *
29  */
30 
31 
32 #ifndef LEDGER_CORE_BECH32PARAMETERS_H
33 #define LEDGER_CORE_BECH32PARAMETERS_H
34 
35 #ifndef LIBCORE_EXPORT
36  #if defined(_MSC_VER)
37  #include <libcore_export.h>
38  #else
39  #define LIBCORE_EXPORT
40  #endif
41 #endif
42 
43 #include <string>
44 #include <vector>
45 #include <soci.h>
46 namespace ledger {
47  namespace core {
48  namespace Bech32Parameters {
49 
50  struct Bech32Struct {
51  std::string name;
52  std::string hrp;
53  std::string separator;
54  size_t checksumSize;
55  std::vector<unsigned long long> generator;
56  std::vector<uint8_t> P2WPKHVersion;
57  std::vector<uint8_t> P2WSHVersion;
58 
59  Bech32Struct() = default;
60  Bech32Struct(const std::string &_name,
61  const std::string &_hrp,
62  const std::string &_separator,
63  size_t _checksumSize,
64  const std::vector<unsigned long long> &_generator,
65  const std::vector<uint8_t> &_P2WPKHVersion,
66  const std::vector<uint8_t> &_P2WSHVersion) : name(_name),
67  hrp(_hrp),
68  separator(_separator),
69  checksumSize(_checksumSize),
70  generator(_generator),
71  P2WPKHVersion(_P2WPKHVersion),
72  P2WSHVersion(_P2WSHVersion)
73 
74  {};
75 
76  };
77  extern LIBCORE_EXPORT const Bech32Struct getBech32Params(const std::string &networkIdentifier);
78  extern LIBCORE_EXPORT const std::vector<Bech32Struct> ALL;
79  bool insertParameters(soci::session& sql, const Bech32Struct &params);
80  }
81  }
82 }
83 #endif //LEDGER_CORE_BECH32PARAMETERS_H
Definition: Account.cpp:8
Definition: Bech32Parameters.h:50