1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
use std::{error::Error, process::ExitStatusError};

use cosm_tome::{chain::response::ChainResponse, modules::cosmwasm::error::CosmwasmError};
use inquire::InquireError;
use interactive_parse::error::SchemaError;
#[cfg(feature = "ledger")]
use ledger_utility::error::LedgerUtilityError;
use thiserror::Error;

pub type DeployResult<T> = core::result::Result<T, DeployError>;

#[derive(Error, Debug)]
pub enum DeployError {
    #[error("{0}")]
    Error(String),

    #[error("{0}")]
    Generic(String),

    #[error(transparent)]
    Keyring(#[from] keyring::Error),

    #[error("{0}")]
    ExitStatus(#[from] ExitStatusError),

    #[cfg(feature = "ledger")]
    #[error("{0}")]
    LedgerUtilityError(#[from] LedgerUtilityError),

    #[error("invalid admin address")]
    AdminAddress,

    #[error("{0}")]
    Io(#[from] std::io::Error),

    #[error("{0}")]
    Cosmwasm(#[from] CosmwasmError),

    #[error("{0}")]
    InteractiveParse(#[from] SchemaError),

    #[error("{0}")]
    Std(#[from] Box<dyn Error>),

    #[error("{0}")]
    Inquire(#[from] InquireError),

    #[error("{0}")]
    Serde(#[from] serde_json::Error),

    #[error("{0}")]
    Clap(#[from] clap::error::Error),

    #[error("invalid mnemonic")]
    Mnemonic,

    #[error("invalid derivation path")]
    DerivationPath,

    #[error("Account id error")]
    AccountId { id: String },

    #[error("Cosmos Sdk Error {:?}", res)]
    CosmosSdk { res: ChainResponse },

    #[error("Unsupported shell, must use bash or zsh")]
    UnsupportedShell,

    #[error("Chain already exists")]
    ChainAlreadyExists,

    #[error("Contract already exists")]
    ContractAlreadyExists,

    #[error("Contract not found")]
    ContractNotFound,

    #[error("Env already exists")]
    EnvAlreadyExists,

    #[error("Invalid directory")]
    InvalidDir,

    #[error("Contract does not have an address")]
    NoAddr,

    #[error("Error parsing chain")]
    ChainId { chain_id: String },

    #[error("Error parsing denom")]
    Denom { name: String },

    #[error("Empty response")]
    EmptyResponse,

    #[error("Key already exists")]
    KeyAlreadyExists,

    #[error("Key not found")]
    KeyNotFound { key_name: String },

    #[error("Code id not found")]
    CodeIdNotFound,

    #[error("Env not found")]
    EnvNotFound,

    #[error("Contract address not found")]
    AddrNotFound,

    #[error("{} Config file not found, perhaps you need to run \"deploy init\"?", "Deploy Error")]
    ConfigNotFound {},

    #[error("Invalid derivation path.")]
    DerviationPath,
}