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::I32),
45 HostFnSpec::new("create-account", "nomi", "account_create_account")
46 .with_params(vec![WasmType::StringRef, WasmType::StringRef])
47 .returns(WasmType::StringRef),
48 HostFnSpec::new(
49 "list-accounts-for-manage",
50 "nomi",
51 "account_list_accounts_for_manage",
52 )
53 .returns(WasmType::PairRef(PairElement::Entity(EntityKind::Account))),
54 HostFnSpec::new(
55 "get-account-for-manage",
56 "nomi",
57 "account_get_account_for_manage",
58 )
59 .with_params(vec![WasmType::StringRef])
60 .returns(WasmType::EntityRef(EntityKind::Account)),
61 HostFnSpec::new("account-balance", "nomi", "account_account_balance")
62 .with_params(vec![WasmType::StringRef])
63 .returns(WasmType::Commodity),
64 HostFnSpec::new("list-commodities", "nomi", "commodity_list_commodities").returns(
65 WasmType::PairRef(PairElement::Entity(EntityKind::Commodity)),
66 ),
67 HostFnSpec::new("get-commodity", "nomi", "commodity_get_commodity")
68 .with_params(vec![WasmType::StringRef])
69 .returns(WasmType::EntityRef(EntityKind::Commodity)),
70 HostFnSpec::new("create-commodity", "nomi", "commodity_create_commodity")
71 .with_params(vec![WasmType::StringRef, WasmType::StringRef])
72 .returns(WasmType::StringRef),
73 HostFnSpec::new("convert-commodity", "nomi", "commodity_convert_commodity")
74 .with_params(vec![WasmType::Commodity, WasmType::StringRef])
75 .returns(WasmType::Commodity),
76 HostFnSpec::new("convert-amount", "nomi", "commodity_convert_amount")
77 .with_params(vec![
78 WasmType::StringRef,
79 WasmType::StringRef,
80 WasmType::StringRef,
81 ])
82 .returns(WasmType::StringRef),
83 HostFnSpec::new("get-version", "nomi", "config_get_version").returns(WasmType::StringRef),
84 HostFnSpec::new("get-build-date", "nomi", "config_get_build_date")
85 .returns(WasmType::StringRef),
86 HostFnSpec::new("get-config", "nomi", "config_get_config")
87 .with_params(vec![WasmType::StringRef])
88 .returns(WasmType::StringRef),
89 HostFnSpec::new("set-config", "nomi", "config_set_config")
90 .with_params(vec![WasmType::StringRef, WasmType::StringRef])
91 .returns(WasmType::I32),
92 HostFnSpec::new("list-transactions", "nomi", "transaction_list_transactions")
93 .with_params(vec![WasmType::StringRef])
94 .returns(WasmType::PairRef(PairElement::Entity(
95 EntityKind::Transaction,
96 ))),
97 HostFnSpec::new("get-transaction", "nomi", "transaction_get_transaction")
98 .with_params(vec![WasmType::StringRef])
99 .returns(WasmType::EntityRef(EntityKind::Transaction)),
100 HostFnSpec::new(
101 "get-transaction-detail",
102 "nomi",
103 "transaction_get_transaction_detail",
104 )
105 .with_params(vec![WasmType::StringRef])
106 .returns(WasmType::StringRef),
107 HostFnSpec::new(
108 "create-transaction",
109 "nomi",
110 "transaction_create_transaction",
111 )
112 .with_params(vec![WasmType::StringRef])
113 .returns(WasmType::StringRef),
114 HostFnSpec::new(
115 "create-transaction-logical",
116 "nomi",
117 "transaction_create_transaction_logical",
118 )
119 .with_params(vec![WasmType::StringRef])
120 .returns(WasmType::StringRef),
121 HostFnSpec::new(
122 "update-transaction",
123 "nomi",
124 "transaction_update_transaction",
125 )
126 .with_params(vec![WasmType::StringRef])
127 .returns(WasmType::StringRef),
128 HostFnSpec::new(
129 "update-transaction-logical",
130 "nomi",
131 "transaction_update_transaction_logical",
132 )
133 .with_params(vec![WasmType::StringRef])
134 .returns(WasmType::StringRef),
135 HostFnSpec::new(
136 "delete-transaction",
137 "nomi",
138 "transaction_delete_transaction",
139 )
140 .with_params(vec![WasmType::StringRef])
141 .returns(WasmType::I32),
142 HostFnSpec::new(
143 "set-transaction-tag",
144 "nomi",
145 "transaction_set_transaction_tag",
146 )
147 .with_params(vec![
148 WasmType::StringRef,
149 WasmType::StringRef,
150 WasmType::StringRef,
151 ])
152 .returns(WasmType::I32),
153 HostFnSpec::new(
154 "get-transaction-tag",
155 "nomi",
156 "transaction_get_transaction_tag",
157 )
158 .with_params(vec![WasmType::StringRef, WasmType::StringRef])
159 .returns(WasmType::StringRef),
160 HostFnSpec::new("list-ssh-keys", "nomi", "ssh_key_list_ssh_keys")
161 .returns(WasmType::PairRef(PairElement::Entity(EntityKind::SshKey))),
162 HostFnSpec::new(
163 "lookup-user-by-ssh-key",
164 "nomi",
165 "ssh_key_lookup_user_by_ssh_key",
166 )
167 .with_params(vec![WasmType::StringRef])
168 .returns(WasmType::StringRef),
169 HostFnSpec::new("remove-ssh-key", "nomi", "ssh_key_remove_ssh_key")
170 .with_params(vec![WasmType::StringRef])
171 .returns(WasmType::I32),
172 HostFnSpec::new("user-has-ssh-key", "nomi", "ssh_key_user_has_ssh_key")
173 .returns(WasmType::I32),
174 HostFnSpec::new("list-splits", "nomi", "split_list_splits")
175 .with_params(vec![WasmType::StringRef])
176 .returns(WasmType::PairRef(PairElement::Entity(EntityKind::Split))),
177 HostFnSpec::new(
178 "list-splits-by-transaction",
179 "nomi",
180 "split_list_splits_by_transaction",
181 )
182 .with_params(vec![WasmType::StringRef])
183 .returns(WasmType::PairRef(PairElement::Entity(EntityKind::Split))),
184 HostFnSpec::new("set-split-tag", "nomi", "split_set_split_tag")
185 .with_params(vec![
186 WasmType::StringRef,
187 WasmType::StringRef,
188 WasmType::StringRef,
189 ])
190 .returns(WasmType::I32),
191 HostFnSpec::new("get-split-tag", "nomi", "split_get_split_tag")
192 .with_params(vec![WasmType::StringRef, WasmType::StringRef])
193 .returns(WasmType::StringRef),
194 HostFnSpec::new("verify-user-password", "nomi", "user_verify_user_password")
195 .with_params(vec![WasmType::StringRef, WasmType::StringRef])
196 .returns(WasmType::StringRef),
197 HostFnSpec::new("balance-report", "nomi", "report_balance_report")
198 .returns(WasmType::StringRef),
199 HostFnSpec::new("activity-report", "nomi", "report_activity_report")
200 .with_params(vec![WasmType::StringRef, WasmType::StringRef])
201 .returns(WasmType::StringRef),
202 HostFnSpec::new("category-breakdown", "nomi", "report_category_breakdown")
203 .with_params(vec![WasmType::StringRef, WasmType::StringRef])
204 .returns(WasmType::StringRef),
205 HostFnSpec::new("set-draft-note", "nomi", "template_set_draft_note")
206 .with_params(vec![WasmType::StringRef])
207 .returns(WasmType::I32),
208 HostFnSpec::new("set-draft-date", "nomi", "template_set_draft_date")
209 .with_params(vec![WasmType::StringRef])
210 .returns(WasmType::I32),
211 HostFnSpec::new("draft-split", "nomi", "template_draft_split")
212 .with_params(vec![
213 WasmType::EntityRef(EntityKind::Account),
214 WasmType::EntityRef(EntityKind::Commodity),
215 WasmType::Ratio,
216 ])
217 .returns(WasmType::I32),
218 HostFnSpec::new("draft-tag", "nomi", "template_draft_tag")
219 .with_params(vec![WasmType::StringRef, WasmType::StringRef])
220 .returns(WasmType::I32),
221 HostFnSpec::new("draft-split-tag", "nomi", "template_draft_split_tag")
222 .with_params(vec![
223 WasmType::I32,
224 WasmType::StringRef,
225 WasmType::StringRef,
226 ])
227 .returns(WasmType::I32),
228 ]
229}