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("get-balances", "nomi", "account_get_balances")
27 .with_params(vec![WasmType::StringRef])
28 .returns(WasmType::PairRef(PairElement::StringRef)),
29 HostFnSpec::new(
30 "get-account-commodities",
31 "nomi",
32 "account_get_account_commodities",
33 )
34 .with_params(vec![WasmType::StringRef])
35 .returns(WasmType::PairRef(PairElement::Entity(
36 EntityKind::Commodity,
37 ))),
38 HostFnSpec::new("set-account-tag", "nomi", "account_set_account_tag")
39 .with_params(vec![
40 WasmType::StringRef,
41 WasmType::StringRef,
42 WasmType::StringRef,
43 ])
44 .returns(WasmType::Bool),
45 HostFnSpec::new("clear-account-tag", "nomi", "account_clear_account_tag")
46 .with_params(vec![WasmType::StringRef, WasmType::StringRef])
47 .returns(WasmType::Bool),
48 HostFnSpec::new("set-commodity-tag", "nomi", "commodity_set_commodity_tag")
49 .with_params(vec![
50 WasmType::StringRef,
51 WasmType::StringRef,
52 WasmType::StringRef,
53 ])
54 .returns(WasmType::Bool),
55 HostFnSpec::new(
56 "clear-commodity-tag",
57 "nomi",
58 "commodity_clear_commodity_tag",
59 )
60 .with_params(vec![WasmType::StringRef, WasmType::StringRef])
61 .returns(WasmType::Bool),
62 HostFnSpec::new("delete-tag", "nomi", "tag_delete_tag")
63 .with_params(vec![WasmType::StringRef])
64 .returns(WasmType::Bool),
65 HostFnSpec::new("delete-template", "nomi", "template_store_delete_template")
66 .with_params(vec![WasmType::StringRef])
67 .returns(WasmType::Bool),
68 HostFnSpec::new("delete-script", "nomi", "script_store_delete_script")
69 .with_params(vec![WasmType::StringRef])
70 .returns(WasmType::Bool),
71 HostFnSpec::new("run-script", "nomi", "script_store_run_script")
72 .with_params(vec![WasmType::StringRef, WasmType::StringRef])
73 .returns(WasmType::AnyRef),
74 HostFnSpec::new("list-scripts", "nomi", "script_store_list_scripts")
75 .returns(WasmType::PairRef(PairElement::AnyRef)),
76 HostFnSpec::new("list-tags", "nomi", "tag_list_tags")
77 .returns(WasmType::PairRef(PairElement::Entity(EntityKind::Tag))),
78 HostFnSpec::new("create-account", "nomi", "account_create_account")
79 .with_params(vec![WasmType::StringRef, WasmType::StringRef])
80 .returns(WasmType::StringRef),
81 HostFnSpec::new("merge-accounts", "nomi", "account_merge_accounts")
82 .with_params(vec![WasmType::StringRef, WasmType::StringRef])
83 .returns(WasmType::StringRef),
84 HostFnSpec::new(
85 "list-accounts-for-manage",
86 "nomi",
87 "account_list_accounts_for_manage",
88 )
89 .returns(WasmType::PairRef(PairElement::Entity(EntityKind::Account))),
90 HostFnSpec::new(
91 "get-account-for-manage",
92 "nomi",
93 "account_get_account_for_manage",
94 )
95 .with_params(vec![WasmType::StringRef])
96 .returns(WasmType::EntityRef(EntityKind::Account)),
97 HostFnSpec::new("account-balance", "nomi", "account_account_balance")
98 .with_params(vec![WasmType::StringRef])
99 .returns(WasmType::Commodity),
100 HostFnSpec::new("list-commodities", "nomi", "commodity_list_commodities").returns(
101 WasmType::PairRef(PairElement::Entity(EntityKind::Commodity)),
102 ),
103 HostFnSpec::new("get-commodity", "nomi", "commodity_get_commodity")
104 .with_params(vec![WasmType::StringRef])
105 .returns(WasmType::EntityRef(EntityKind::Commodity)),
106 HostFnSpec::new("create-commodity", "nomi", "commodity_create_commodity")
107 .with_params(vec![WasmType::StringRef, WasmType::StringRef])
108 .returns(WasmType::StringRef),
109 HostFnSpec::new("convert-commodity", "nomi", "commodity_convert_commodity")
110 .with_params(vec![WasmType::Commodity, WasmType::StringRef])
111 .returns(WasmType::Commodity),
112 HostFnSpec::new("convert-amount", "nomi", "commodity_convert_amount")
113 .with_params(vec![
114 WasmType::StringRef,
115 WasmType::StringRef,
116 WasmType::StringRef,
117 ])
118 .returns(WasmType::StringRef),
119 HostFnSpec::new("get-version", "nomi", "config_get_version").returns(WasmType::StringRef),
120 HostFnSpec::new("get-build-date", "nomi", "config_get_build_date")
121 .returns(WasmType::StringRef),
122 HostFnSpec::new("get-config", "nomi", "config_get_config")
123 .with_params(vec![WasmType::StringRef])
124 .returns(WasmType::StringRef),
125 HostFnSpec::new("set-config", "nomi", "config_set_config")
126 .with_params(vec![WasmType::StringRef, WasmType::StringRef])
127 .returns(WasmType::Bool),
128 HostFnSpec::new("list-config", "nomi", "config_list_config")
129 .returns(WasmType::PairRef(PairElement::AnyRef)),
130 HostFnSpec::new("format-date", "nomi", "date_format_date")
131 .with_params(vec![WasmType::StringRef])
132 .returns(WasmType::StringRef),
133 HostFnSpec::new("list-transactions", "nomi", "transaction_list_transactions")
134 .with_params(vec![WasmType::StringRef])
135 .returns(WasmType::PairRef(PairElement::Entity(
136 EntityKind::Transaction,
137 ))),
138 HostFnSpec::new("get-transaction", "nomi", "transaction_get_transaction")
139 .with_params(vec![WasmType::StringRef])
140 .returns(WasmType::EntityRef(EntityKind::Transaction)),
141 HostFnSpec::new(
142 "get-transaction-detail",
143 "nomi",
144 "transaction_get_transaction_detail",
145 )
146 .with_params(vec![WasmType::StringRef])
147 .returns(WasmType::StringRef),
148 HostFnSpec::new(
149 "get-transaction-logical",
150 "nomi",
151 "transaction_get_transaction_logical",
152 )
153 .with_params(vec![WasmType::StringRef])
154 .returns(WasmType::StringRef),
155 HostFnSpec::new(
156 "create-transaction",
157 "nomi",
158 "transaction_create_transaction",
159 )
160 .with_params(vec![WasmType::StringRef])
161 .returns(WasmType::StringRef),
162 HostFnSpec::new(
163 "create-transaction-logical",
164 "nomi",
165 "transaction_create_transaction_logical",
166 )
167 .with_params(vec![WasmType::StringRef])
168 .returns(WasmType::StringRef),
169 HostFnSpec::new(
170 "update-transaction",
171 "nomi",
172 "transaction_update_transaction",
173 )
174 .with_params(vec![WasmType::StringRef])
175 .returns(WasmType::StringRef),
176 HostFnSpec::new(
177 "update-transaction-logical",
178 "nomi",
179 "transaction_update_transaction_logical",
180 )
181 .with_params(vec![WasmType::StringRef])
182 .returns(WasmType::StringRef),
183 HostFnSpec::new(
184 "delete-transaction",
185 "nomi",
186 "transaction_delete_transaction",
187 )
188 .with_params(vec![WasmType::StringRef])
189 .returns(WasmType::Bool),
190 HostFnSpec::new(
191 "set-transaction-tag",
192 "nomi",
193 "transaction_set_transaction_tag",
194 )
195 .with_params(vec![
196 WasmType::StringRef,
197 WasmType::StringRef,
198 WasmType::StringRef,
199 ])
200 .returns(WasmType::Bool),
201 HostFnSpec::new(
202 "get-transaction-tag",
203 "nomi",
204 "transaction_get_transaction_tag",
205 )
206 .with_params(vec![WasmType::StringRef, WasmType::StringRef])
207 .returns(WasmType::StringRef),
208 HostFnSpec::new("form-descriptor", "nomi", "forms_form_descriptor")
209 .with_params(vec![WasmType::StringRef])
210 .returns(WasmType::StringRef),
211 HostFnSpec::new("form-options", "nomi", "forms_form_options")
212 .with_params(vec![WasmType::StringRef])
213 .returns(WasmType::StringRef),
214 HostFnSpec::new("load-form", "nomi", "forms_load_form")
215 .with_params(vec![WasmType::StringRef, WasmType::StringRef])
216 .returns(WasmType::StringRef),
217 HostFnSpec::new("submit-form", "nomi", "forms_submit_form")
218 .with_params(vec![WasmType::StringRef, WasmType::StringRef])
219 .returns(WasmType::AnyRef),
220 HostFnSpec::new("merge-preview", "nomi", "forms_merge_preview")
221 .with_params(vec![WasmType::StringRef])
222 .returns(WasmType::AnyRef),
223 HostFnSpec::new("filter-rows", "nomi", "forms_filter_rows")
224 .with_params(vec![WasmType::StringRef])
225 .returns(WasmType::AnyRef),
226 HostFnSpec::new("filter-text", "nomi", "forms_filter_text")
227 .with_params(vec![WasmType::StringRef])
228 .returns(WasmType::StringRef),
229 HostFnSpec::new("list-ssh-keys", "nomi", "ssh_key_list_ssh_keys")
230 .returns(WasmType::PairRef(PairElement::Entity(EntityKind::SshKey))),
231 HostFnSpec::new("remove-ssh-key", "nomi", "ssh_key_remove_ssh_key")
232 .with_params(vec![WasmType::StringRef])
233 .returns(WasmType::Bool),
234 HostFnSpec::new("user-has-ssh-key", "nomi", "ssh_key_user_has_ssh_key")
235 .returns(WasmType::Bool),
236 HostFnSpec::new("list-splits", "nomi", "split_list_splits")
237 .with_params(vec![WasmType::StringRef])
238 .returns(WasmType::PairRef(PairElement::Entity(EntityKind::Split))),
239 HostFnSpec::new(
240 "list-splits-by-transaction",
241 "nomi",
242 "split_list_splits_by_transaction",
243 )
244 .with_params(vec![WasmType::StringRef])
245 .returns(WasmType::PairRef(PairElement::Entity(EntityKind::Split))),
246 HostFnSpec::new("set-split-tag", "nomi", "split_set_split_tag")
247 .with_params(vec![
248 WasmType::StringRef,
249 WasmType::StringRef,
250 WasmType::StringRef,
251 ])
252 .returns(WasmType::Bool),
253 HostFnSpec::new("get-split-tag", "nomi", "split_get_split_tag")
254 .with_params(vec![WasmType::StringRef, WasmType::StringRef])
255 .returns(WasmType::StringRef),
256 HostFnSpec::new("get-split-tags", "nomi", "split_get_split_tags")
257 .with_params(vec![WasmType::StringRef, WasmType::StringRef])
258 .returns(WasmType::PairRef(PairElement::StringRef)),
259 HostFnSpec::new("balance-report", "nomi", "report_balance_report")
260 .returns(WasmType::StringRef),
261 HostFnSpec::new("activity-report", "nomi", "report_activity_report")
262 .with_params(vec![WasmType::StringRef, WasmType::StringRef])
263 .returns(WasmType::StringRef),
264 HostFnSpec::new("category-breakdown", "nomi", "report_category_breakdown")
265 .with_params(vec![WasmType::StringRef, WasmType::StringRef])
266 .returns(WasmType::StringRef),
267 HostFnSpec::new("report-csv", "nomi", "report_report_csv")
268 .with_params(vec![WasmType::StringRef])
269 .returns(WasmType::StringRef),
270 HostFnSpec::new("report-chart-render", "nomi", "chart_report_chart_render")
271 .with_params(vec![
272 WasmType::StringRef,
273 WasmType::StringRef,
274 WasmType::StringRef,
275 WasmType::StringRef,
276 WasmType::I32,
277 WasmType::I32,
278 WasmType::I32,
279 WasmType::I32,
280 ])
281 .returns(WasmType::AnyRef),
282 HostFnSpec::new("set-draft-note", "nomi", "template_set_draft_note")
283 .with_params(vec![WasmType::StringRef])
284 .returns(WasmType::Bool),
285 HostFnSpec::new("set-draft-date", "nomi", "template_set_draft_date")
286 .with_params(vec![WasmType::StringRef])
287 .returns(WasmType::Bool),
288 HostFnSpec::new("draft-split", "nomi", "template_draft_split")
289 .with_params(vec![
290 WasmType::EntityRef(EntityKind::Account),
291 WasmType::EntityRef(EntityKind::Commodity),
292 WasmType::Ratio,
293 ])
294 .returns(WasmType::I32),
295 HostFnSpec::new("draft-tag", "nomi", "template_draft_tag")
296 .with_params(vec![WasmType::StringRef, WasmType::StringRef])
297 .returns(WasmType::Bool),
298 HostFnSpec::new("draft-split-tag", "nomi", "template_draft_split_tag")
299 .with_params(vec![
300 WasmType::I32,
301 WasmType::StringRef,
302 WasmType::StringRef,
303 ])
304 .returns(WasmType::Bool),
305 ]
306}