1 module tagion.tools.wallet.WalletOptions;
2 
3 import std.path;
4 import tagion.basic.Types : FileExtension;
5 import tagion.services.options;
6 import tagion.utils.JSONCommon;
7 import tagion.wallet.KeyRecover : standard_questions;
8 
9 enum default_wallet_config_filename="wallet".setExtension(FileExtension.json);
10 /**
11 *
12  * struct WalletOptions
13  * Struct wallet options files and network status storage models
14  */
15 struct WalletOptions {
16     /** account file name/path */
17     string accountfile;
18     /** wallet file name/path */
19     string walletfile;
20     /** questions file name/path */
21     string quizfile;
22     /** device file name/path */
23     string devicefile;
24     /** contract file name/path */
25     string contractfile;
26     /** bills file name/path */
27     string billsfile;
28     /** payments request file name/path */
29     string paymentrequestsfile;
30     /** address part of network socket */
31     string addr;
32     /** port part of network socket */
33     ushort port;
34 
35     string[] questions;
36 
37     string contract_address;
38     string dart_address;
39     string dart_shell_endpoint;
40     string contract_shell_endpoint;
41     string faucet_shell_endpoint;
42     /**
43     * @brief set default values for wallet
44     */
45     void setDefault() nothrow {
46         accountfile = "account".setExtension(FileExtension.hibon);
47         walletfile = "wallet".setExtension(FileExtension.hibon);
48         quizfile = "quiz".setExtension(FileExtension.hibon);
49         contractfile = "contract".setExtension(FileExtension.hibon);
50         billsfile = "bills".setExtension(FileExtension.hibon);
51         paymentrequestsfile = "paymentrequests".setExtension(FileExtension.hibon);
52         devicefile = "device".setExtension(FileExtension.hibon);
53         addr = "http://0.0.0.0:8080";
54         questions = standard_questions.dup;
55         contract_address = contract_sock_addr("Node_0_" ~ "CONTRACT_");
56         dart_address = contract_sock_addr("Node_0_" ~ "DART_");
57         dart_shell_endpoint = "/api/v1/dart";
58         contract_shell_endpoint = "/api/v1/contract";
59         faucet_shell_endpoint = "/api/v1/invoice2pay";
60 
61         port = 10800;
62     }
63 
64     mixin JSONCommon;
65     mixin JSONConfig;
66 }