psibase 0.26.0

Library and command-line tool for interacting with psibase networks
Documentation
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
#[crate::service(name = "guilds", dispatch = false, psibase_mod = "crate")]
#[allow(non_snake_case, unused_variables)]
pub mod Service {
    use crate::{
        services::{
            auth_dyn::{self},
            transact::ServiceMethod,
        },
        AccountNumber, Memo,
    };

    /// Get scores for all guild members in a fractal.
    ///
    /// # Arguments
    /// * `fractal` - The account number of the fractal.
    #[action]
    fn get_scores(fractal: AccountNumber) -> Vec<(AccountNumber, u32)> {
        unimplemented!()
    }

    /// Is active
    ///
    /// Check if an account is considered active in an occupation
    ///
    /// # Arguments
    /// * `fractal` - Fractal.
    /// * `member` - Fractal member.
    #[action]
    fn is_active(fractal: AccountNumber, member: AccountNumber) -> bool {
        unimplemented!()
    }

    /// On Invite Accept.
    ///
    /// Used by invite hook
    ///
    /// # Arguments
    /// * `invite_id` - Unique ID of invite.
    /// * `accepter` - Account name which accepted the invite
    #[action]
    #[allow(non_snake_case)]
    fn onInvAccept(invite_id: u32, accepter: AccountNumber) {
        unimplemented!()
    }

    /// This curve maps guild rank to the value used to weight guild member scores.
    ///
    /// # Arguments
    /// * `curve_id` - An identifier for a particular weighting curve
    #[action]
    fn set_guild_weight_curve(curve_id: u8) {
        unimplemented!()
    }

    /// Auto-join fractal
    ///
    /// When enabled, new guild members in ranked guilds are automatically added to the fractal.
    ///
    /// # Arguments
    /// * `enabled` - True to enable auto-join, false to disable.
    #[action]
    fn set_auto_join(enabled: bool) {
        unimplemented!()
    }

    /// Has policy action used by AuthDyn service.
    ///
    /// # Arguments
    /// * `account` - Account being checked.
    #[action]
    pub fn has_policy(account: AccountNumber) -> bool {
        unimplemented!()
    }

    /// Creates a guild within a fractal.
    ///
    /// # Arguments
    /// * `fractal` - Fractal to serve as jurisdiction of guild.
    /// * `guild_account` - The account number for the new guild.
    /// * `display_name` - The display name of the guild.
    /// * `council_role` - Council role account.
    /// * `rep_role` - Representative role account.
    #[action]
    fn create_guild(
        fractal: AccountNumber,
        guild_account: AccountNumber,
        display_name: Memo,
        council_role: AccountNumber,
        rep_role: AccountNumber,
    ) {
        unimplemented!()
    }

    /// Check if a role ID is mapped for a fractal.
    ///
    /// # Arguments
    /// * `fractal` - The account number of the fractal.
    /// * `role_id` - Role ID to check.
    #[action]
    fn is_role_ok(fractal: AccountNumber, role_id: u8) -> bool {
        unimplemented!()
    }

    /// Set guild display name
    ///
    /// # Arguments
    /// * `display_name` - New display name of the guild.
    #[action]
    fn set_g_disp(display_name: Memo) {
        unimplemented!()
    }

    /// Set role mapping
    ///
    /// # Arguments
    /// * `role_id` - Role ID.
    /// * `guild` - Guild account to map to
    #[action]
    fn set_role_map(role_id: u8, guild: AccountNumber) {
        unimplemented!()
    }

    /// Set guild bio
    ///
    /// # Arguments
    /// * `bio` - New bio of the guild.
    #[action]
    fn set_g_bio(bio: Memo) {
        unimplemented!()
    }

    /// Called when an evaluation in a fractal is finalized.
    ///
    /// # Arguments
    /// * `evaluation_id` - The ID of the evaluation.
    #[action]
    fn on_eval_fin(evaluation_id: u32) {
        unimplemented!()
    }

    /// Set guild description
    ///
    /// # Arguments
    /// * `description` - New description of the guild.
    #[action]
    fn set_g_desc(description: String) {
        unimplemented!()
    }

    /// Set guild application extra info
    ///
    /// # Arguments
    /// * `guild_account` - The guild being applied to.
    /// * `extra_info` - Extra information to update on the application.
    #[action]
    fn set_g_app(guild_account: AccountNumber, extra_info: String) {
        unimplemented!()
    }

    /// Set ranked guilds
    ///
    /// # Arguments
    /// * `ranked_guilds` - Ordered guilds to be ranked, affects scores.
    #[action]
    fn set_rguilds(ranked_guilds: Vec<AccountNumber>) {
        unimplemented!()
    }

    /// Register candidacy.
    ///
    /// Register your candidacy to serve on a Guild council.
    ///
    /// # Arguments
    /// * `guild` - Guild candidate is member of
    /// * `active`- True to become a candidate, False to retire
    #[action]
    fn reg_can(guild: AccountNumber, active: bool) {
        unimplemented!()
    }

    /// Set rank ordering threshold
    ///
    /// # Arguments
    /// * `rank_ordering_threshold` - Minimum number of scorers required to enable rank ordering.
    #[action]
    fn set_thres(rank_ordering_threshold: u8) {
        unimplemented!()
    }

    /// Set candidacy cooldown
    ///
    /// # Arguments
    /// * `candidacy_cooldown` - Seconds a guild member must wait between toggling candidacy.
    #[action]
    fn set_can_cd(candidacy_cooldown: u32) {
        unimplemented!()
    }

    /// Kick member from guild
    ///
    /// # Arguments
    /// * `member` - Guild member to be kicked.
    #[action]
    fn guild_kick(member: AccountNumber) {
        unimplemented!()
    }

    /// Delete guild invite.
    ///
    ///
    /// # Arguments
    /// * `invite_id` - Unique ID generated by invite.
    #[action]
    fn del_g_inv(invite_id: u32) {
        unimplemented!()
    }

    /// Apply to join a guild
    ///
    /// # Arguments
    /// * `guild_account` - The account number for the guild.
    /// * `extra_info` - Relevant information to the application.
    #[action]
    fn apply_guild(guild_account: AccountNumber, extra_info: String) {
        unimplemented!()
    }

    /// Cancel the sender's pending application to a guild.
    ///
    /// # Arguments
    /// * `guild_account` - The account number for the guild.
    #[action]
    fn cancel_g_app(guild_account: AccountNumber) {
        unimplemented!()
    }

    /// Add a member to a fractal.
    ///
    /// # Arguments
    /// * `fractal` - The account number of the fractal.
    #[action]
    fn add_member(fractal: AccountNumber) {
        unimplemented!()
    }

    /// Attest Guild Membership application
    ///
    /// # Arguments
    /// * `guild_account` - The account number for the guild.
    /// * `applicant` - Applicant to attest.
    /// * `comment` - Any comment relevant to the application.
    /// * `endorses` - True if in favour of the application.
    #[action]
    fn at_mem_app(
        guild_account: AccountNumber,
        applicant: AccountNumber,
        comment: String,
        endorses: bool,
    ) {
        unimplemented!()
    }

    /// Remove the sender's attestation on a guild membership application.
    ///
    /// # Arguments
    /// * `guild_account` - The account number for the guild.
    /// * `applicant` - Applicant whose attestation is being withdrawn.
    #[action]
    fn rm_attest(guild_account: AccountNumber, applicant: AccountNumber) {
        unimplemented!()
    }

    /// Starts an evaluation for the specified guild.
    ///
    /// # Arguments
    /// * `guild_account` - The account number for the guild.
    #[action]
    fn start_eval(guild_account: AccountNumber) {
        unimplemented!()
    }

    /// Sets the schedule for an evaluation type within a fractal.
    ///
    /// # Arguments
    /// * `registration` - Unix seconds timestamp for the start of the registration phase.
    /// * `deliberation` - Unix seconds timestamp for the start of the deliberation phase.
    /// * `submission` - Unix seconds timestamp for the start of the submission phase.
    /// * `finish_by` - Unix seconds timestamp for the start of the evaluation completion phase.
    /// * `interval_seconds` - Interval in seconds for recurring evaluations.
    #[action]
    fn set_schedule(
        registration: u32,
        deliberation: u32,
        submission: u32,
        finish_by: u32,
        interval_seconds: u32,
    ) {
        unimplemented!()
    }

    /// Called when a user registers for an evaluation in a fractal.
    ///
    /// # Arguments
    /// * `evaluation_id` - The ID of the evaluation.
    /// * `account` - The account number of the registering user.
    #[action]
    fn on_ev_reg(evaluation_id: u32, account: AccountNumber) {
        unimplemented!()
    }

    /// Called when a user unregisters from an evaluation in a fractal.
    ///
    /// # Arguments
    /// * `evaluation_id` - The ID of the evaluation.
    /// * `account` - The account number of the unregistering user.
    #[action]
    fn on_ev_unreg(_evaluation_id: u32, _account: AccountNumber) {}

    /// Called when a user submits an attestation for decrypted proposals in a fractal evaluation.
    ///
    /// # Arguments
    /// * `evaluation_id` - The ID of the evaluation.
    /// * `group_number` - The group number within the evaluation.
    /// * `user` - The account number of the user submitting the attestation.
    /// * `attestation` - The attestation data.
    #[action]
    fn on_attest(
        evaluation_id: u32,
        group_number: u32,
        _user: AccountNumber,
        attestation: Vec<u8>,
    ) {
        unimplemented!()
    }

    /// Forcibly remove the current representative of the guild.
    ///
    /// Called by council role account of the guild.
    #[action]
    fn remove_g_rep() {
        unimplemented!()
    }

    /// Set a new representative of the Guild.
    ///
    /// # Arguments
    /// * `new_representative` - The account number of the new representative.
    #[action]
    fn set_g_rep(new_representative: AccountNumber) {
        unimplemented!()
    }

    /// Resign as representative of a guild.
    ///
    /// Called by current representative of guild.
    #[action]
    fn resign_g_rep() {
        unimplemented!()
    }

    /// Invite a guild member.
    ///
    /// Must be called by pre existing guild member.
    ///
    /// # Arguments
    /// * `guild` - Guild invitee will join.
    /// * `invite_id` - Unique ID generated by invite.
    /// * `invite_payload` - An opaque payload to pass through to the invite service.
    /// * `num_accounts` - Number of invites to create
    /// * `pre_attest` - Inviter attests to the application prior to its creation
    #[action]
    fn inv_g_member(
        guild: AccountNumber,
        invite_id: u32,
        invite_payload: Vec<u8>,
        num_accounts: u16,
        pre_attest: bool,
    ) {
        unimplemented!()
    }

    /// Called when a group finalizes its result in an evaluation.
    ///
    /// # Arguments
    /// * `evaluation_id` - The ID of the evaluation.
    /// * `group_number` - The group number within the evaluation.
    /// * `group_result` - The result data of the group.
    #[action]
    fn on_grp_fin(evaluation_id: u32, group_number: u32, group_result: Vec<u8>) {
        unimplemented!()
    }

    /// Get auth policy used by fractals service.
    ///
    /// # Arguments
    /// * `fractal` - Account being checked.
    /// * `role_id` - Role ID
    #[action]
    fn role_policy(fractal: AccountNumber, role_id: u8) -> auth_dyn::policy::DynamicAuthPolicy {
        unimplemented!()
    }

    /// Get policy action used by AuthDyn service.
    ///
    /// # Arguments
    /// * `account` - Account being checked.
    /// * `method` - Optional method being checked.
    #[action]
    fn get_policy(
        account: AccountNumber,
        method: Option<ServiceMethod>,
    ) -> auth_dyn::policy::DynamicAuthPolicy {
        unimplemented!()
    }

    #[event(history)]
    pub fn evaluation_finished(guild: AccountNumber, evaluation_id: u32) {}

    #[event(history)]
    pub fn scheduled_evaluation(
        fractal: AccountNumber,
        guild: AccountNumber,
        evaluation_id: u32,
        registration: u32,
        deliberation: u32,
        submission: u32,
        finish_by: u32,
    ) {
    }
}

#[test]
fn verify_schema() {
    crate::assert_schema_matches_package::<Wrapper>();
}