1use nomiscript::{EntityKind, HostFnSpec, PairElement, WasmType};
9
10#[must_use]
11pub fn all_compiler_specs() -> Vec<HostFnSpec> {
12 vec![
13 HostFnSpec::new("rpc-protocol-version", "nomi", "rpc_protocol_version")
14 .returns(WasmType::I32),
15 HostFnSpec::new("rpc-session-user-id", "nomi", "rpc_session_user_id_capture")
16 .returns(WasmType::StringRef),
17 HostFnSpec::new("account-count", "nomi", "account_account_count").returns(WasmType::I32),
18 HostFnSpec::new("list-accounts", "nomi", "account_list_accounts")
19 .returns(WasmType::PairRef(PairElement::Entity(EntityKind::Account))),
20 HostFnSpec::new("get-account", "nomi", "account_get_account")
21 .with_params(vec![WasmType::StringRef])
22 .returns(WasmType::EntityRef(EntityKind::Account)),
23 HostFnSpec::new("get-balance", "nomi", "account_get_balance")
24 .with_params(vec![WasmType::StringRef])
25 .returns(WasmType::Ratio),
26 HostFnSpec::new(
27 "get-account-commodities",
28 "nomi",
29 "account_get_account_commodities",
30 )
31 .with_params(vec![WasmType::StringRef])
32 .returns(WasmType::PairRef(PairElement::Entity(
33 EntityKind::Commodity,
34 ))),
35 HostFnSpec::new("set-account-tag", "nomi", "account_set_account_tag")
36 .with_params(vec![
37 WasmType::StringRef,
38 WasmType::StringRef,
39 WasmType::StringRef,
40 ])
41 .returns(WasmType::I32),
42 HostFnSpec::new("create-account", "nomi", "account_create_account")
43 .with_params(vec![WasmType::StringRef])
44 .returns(WasmType::StringRef),
45 HostFnSpec::new(
46 "list-accounts-for-manage",
47 "nomi",
48 "account_list_accounts_for_manage",
49 )
50 .returns(WasmType::PairRef(PairElement::Entity(EntityKind::Account))),
51 HostFnSpec::new(
52 "get-account-for-manage",
53 "nomi",
54 "account_get_account_for_manage",
55 )
56 .with_params(vec![WasmType::StringRef])
57 .returns(WasmType::EntityRef(EntityKind::Account)),
58 HostFnSpec::new("account-balance", "nomi", "account_account_balance")
59 .with_params(vec![WasmType::StringRef])
60 .returns(WasmType::Commodity),
61 HostFnSpec::new("list-commodities", "nomi", "commodity_list_commodities").returns(
62 WasmType::PairRef(PairElement::Entity(EntityKind::Commodity)),
63 ),
64 HostFnSpec::new("get-commodity", "nomi", "commodity_get_commodity")
65 .with_params(vec![WasmType::StringRef])
66 .returns(WasmType::EntityRef(EntityKind::Commodity)),
67 HostFnSpec::new("create-commodity", "nomi", "commodity_create_commodity")
68 .with_params(vec![WasmType::StringRef, WasmType::StringRef])
69 .returns(WasmType::StringRef),
70 HostFnSpec::new("convert-commodity", "nomi", "commodity_convert_commodity")
71 .with_params(vec![WasmType::Commodity, WasmType::StringRef])
72 .returns(WasmType::Commodity),
73 HostFnSpec::new("get-version", "nomi", "config_get_version").returns(WasmType::StringRef),
74 HostFnSpec::new("get-build-date", "nomi", "config_get_build_date")
75 .returns(WasmType::StringRef),
76 HostFnSpec::new("get-config", "nomi", "config_get_config")
77 .with_params(vec![WasmType::StringRef])
78 .returns(WasmType::StringRef),
79 HostFnSpec::new("set-config", "nomi", "config_set_config")
80 .with_params(vec![WasmType::StringRef, WasmType::StringRef])
81 .returns(WasmType::I32),
82 HostFnSpec::new("list-transactions", "nomi", "transaction_list_transactions").returns(
83 WasmType::PairRef(PairElement::Entity(EntityKind::Transaction)),
84 ),
85 HostFnSpec::new("get-transaction", "nomi", "transaction_get_transaction")
86 .with_params(vec![WasmType::StringRef])
87 .returns(WasmType::EntityRef(EntityKind::Transaction)),
88 HostFnSpec::new(
89 "create-transaction",
90 "nomi",
91 "transaction_create_transaction",
92 )
93 .with_params(vec![WasmType::StringRef])
94 .returns(WasmType::StringRef),
95 HostFnSpec::new(
96 "update-transaction",
97 "nomi",
98 "transaction_update_transaction",
99 )
100 .with_params(vec![WasmType::StringRef])
101 .returns(WasmType::StringRef),
102 HostFnSpec::new(
103 "delete-transaction",
104 "nomi",
105 "transaction_delete_transaction",
106 )
107 .with_params(vec![WasmType::StringRef])
108 .returns(WasmType::I32),
109 HostFnSpec::new(
110 "set-transaction-tag",
111 "nomi",
112 "transaction_set_transaction_tag",
113 )
114 .with_params(vec![
115 WasmType::StringRef,
116 WasmType::StringRef,
117 WasmType::StringRef,
118 ])
119 .returns(WasmType::I32),
120 HostFnSpec::new(
121 "get-transaction-tag",
122 "nomi",
123 "transaction_get_transaction_tag",
124 )
125 .with_params(vec![WasmType::StringRef, WasmType::StringRef])
126 .returns(WasmType::StringRef),
127 HostFnSpec::new("list-ssh-keys", "nomi", "ssh_key_list_ssh_keys")
128 .returns(WasmType::PairRef(PairElement::Entity(EntityKind::SshKey))),
129 HostFnSpec::new(
130 "lookup-user-by-ssh-key",
131 "nomi",
132 "ssh_key_lookup_user_by_ssh_key",
133 )
134 .with_params(vec![WasmType::StringRef])
135 .returns(WasmType::StringRef),
136 HostFnSpec::new("remove-ssh-key", "nomi", "ssh_key_remove_ssh_key")
137 .with_params(vec![WasmType::StringRef])
138 .returns(WasmType::I32),
139 HostFnSpec::new("user-has-ssh-key", "nomi", "ssh_key_user_has_ssh_key")
140 .returns(WasmType::I32),
141 HostFnSpec::new("list-splits", "nomi", "split_list_splits")
142 .with_params(vec![WasmType::StringRef])
143 .returns(WasmType::PairRef(PairElement::Entity(EntityKind::Split))),
144 HostFnSpec::new(
145 "list-splits-by-transaction",
146 "nomi",
147 "split_list_splits_by_transaction",
148 )
149 .with_params(vec![WasmType::StringRef])
150 .returns(WasmType::PairRef(PairElement::Entity(EntityKind::Split))),
151 HostFnSpec::new("set-split-tag", "nomi", "split_set_split_tag")
152 .with_params(vec![
153 WasmType::StringRef,
154 WasmType::StringRef,
155 WasmType::StringRef,
156 ])
157 .returns(WasmType::I32),
158 HostFnSpec::new("get-split-tag", "nomi", "split_get_split_tag")
159 .with_params(vec![WasmType::StringRef, WasmType::StringRef])
160 .returns(WasmType::StringRef),
161 HostFnSpec::new("verify-user-password", "nomi", "user_verify_user_password")
162 .with_params(vec![WasmType::StringRef, WasmType::StringRef])
163 .returns(WasmType::StringRef),
164 HostFnSpec::new("balance-report", "nomi", "report_balance_report")
165 .returns(WasmType::EntityRef(EntityKind::ReportNode)),
166 HostFnSpec::new("activity-report", "nomi", "report_activity_report")
167 .with_params(vec![WasmType::StringRef, WasmType::StringRef])
168 .returns(WasmType::StringRef),
169 HostFnSpec::new("category-breakdown", "nomi", "report_category_breakdown")
170 .with_params(vec![WasmType::StringRef, WasmType::StringRef])
171 .returns(WasmType::StringRef),
172 HostFnSpec::new("set-draft-note", "nomi", "template_set_draft_note")
173 .with_params(vec![WasmType::StringRef])
174 .returns(WasmType::I32),
175 HostFnSpec::new("set-draft-date", "nomi", "template_set_draft_date")
176 .with_params(vec![WasmType::StringRef])
177 .returns(WasmType::I32),
178 HostFnSpec::new("draft-split", "nomi", "template_draft_split")
179 .with_params(vec![
180 WasmType::EntityRef(EntityKind::Account),
181 WasmType::EntityRef(EntityKind::Commodity),
182 WasmType::Ratio,
183 ])
184 .returns(WasmType::I32),
185 HostFnSpec::new("draft-tag", "nomi", "template_draft_tag")
186 .with_params(vec![WasmType::StringRef, WasmType::StringRef])
187 .returns(WasmType::I32),
188 HostFnSpec::new("draft-split-tag", "nomi", "template_draft_split_tag")
189 .with_params(vec![
190 WasmType::I32,
191 WasmType::StringRef,
192 WasmType::StringRef,
193 ])
194 .returns(WasmType::I32),
195 ]
196}