@stellar-registry/perch-contracts 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/pool.d.ts ADDED
@@ -0,0 +1,1027 @@
1
+ /** sha256 of the wasm these bindings were generated from. */
2
+ export declare const WASM_SHA256 = "5389aef52582831184715bd06ff34e6265800e4b439536af6664882498626105";
3
+ import { Buffer } from "buffer";
4
+ import { AssembledTransaction, Client as ContractClient, ClientOptions as ContractClientOptions, MethodOptions, Result } from "@stellar/stellar-sdk/contract";
5
+ import type { u32, u64, Option } from "@stellar/stellar-sdk/contract";
6
+ export * from "@stellar/stellar-sdk";
7
+ export * as contract from "@stellar/stellar-sdk/contract";
8
+ export * as rpc from "@stellar/stellar-sdk/rpc";
9
+ /**
10
+ * A tree's public summary.
11
+ */
12
+ export interface TreeInfo {
13
+ capacity: u64;
14
+ /**
15
+ * The latest root (the empty-tree root before any insertion).
16
+ */
17
+ root: Buffer;
18
+ /**
19
+ * Full, and never written again.
20
+ */
21
+ sealed: boolean;
22
+ /**
23
+ * Leaves inserted so far.
24
+ */
25
+ size: u64;
26
+ tree_id: u32;
27
+ }
28
+ /**
29
+ * Where an insertion landed (the `LeafInserted` event's payload).
30
+ * `(tree_id, index)` is the leaf's permanent position; `root` is the
31
+ * tree's root right after the insertion.
32
+ */
33
+ export interface Insertion {
34
+ index: u64;
35
+ leaf: Buffer;
36
+ root: Buffer;
37
+ tree_id: u32;
38
+ }
39
+ /**
40
+ * Everything the pool can refuse.
41
+ */
42
+ export declare const PoolError: {
43
+ /**
44
+ * The commitment is not a canonical BN254 field element (`>= r`).
45
+ */
46
+ 1: {
47
+ message: string;
48
+ };
49
+ /**
50
+ * The inserting address is not a contract. Leaves bind a contract id.
51
+ */
52
+ 2: {
53
+ message: string;
54
+ };
55
+ /**
56
+ * This account already inserted a leaf under this enrollment id.
57
+ */
58
+ 3: {
59
+ message: string;
60
+ };
61
+ /**
62
+ * No tree with this id has been opened.
63
+ */
64
+ 4: {
65
+ message: string;
66
+ };
67
+ /**
68
+ * A page request exceeds `MAX_PAGE`.
69
+ */
70
+ 5: {
71
+ message: string;
72
+ };
73
+ /**
74
+ * The tree id counter would overflow (2^32 full trees).
75
+ */
76
+ 6: {
77
+ message: string;
78
+ };
79
+ };
80
+ /**
81
+ * A leaf's permanent position.
82
+ */
83
+ export interface LeafPosition {
84
+ index: u64;
85
+ tree_id: u32;
86
+ }
87
+ export type PoolKey = {
88
+ tag: "CurrentTree";
89
+ values: void;
90
+ } | {
91
+ tag: "Tree";
92
+ values: readonly [u32];
93
+ } | {
94
+ tag: "Root";
95
+ values: readonly [u32, Buffer];
96
+ } | {
97
+ tag: "Leaf";
98
+ values: readonly [u32, u64];
99
+ } | {
100
+ tag: "Enrollment";
101
+ values: readonly [string, Buffer];
102
+ };
103
+ export interface TreeState {
104
+ /**
105
+ * `frontier[level]` is the most recent node at `level` that was a left
106
+ * child: the left sibling the next right child at that level hashes
107
+ * with. Entries are written before they are ever read.
108
+ */
109
+ frontier: Array<Buffer>;
110
+ /**
111
+ * The root after the latest insertion.
112
+ */
113
+ root: Buffer;
114
+ /**
115
+ * Leaves inserted so far; also the index the next insertion takes.
116
+ */
117
+ size: u64;
118
+ }
119
+ /**
120
+ * What a completion hands back to the account.
121
+ */
122
+ export interface Completion {
123
+ /**
124
+ * The attempt that completed.
125
+ */
126
+ attempt_id: u64;
127
+ /**
128
+ * The credentials that occupied the replaced signer slots **in the
129
+ * attempt's source document**, as derived at T1: the applied document
130
+ * for lost-key, the baseline for compromise. The account fingerprints
131
+ * them over canonical keys and revokes them together with every
132
+ * credential the completion removed from its current document. Without
133
+ * these, a baseline credential replaced by a compromise recovery, and
134
+ * already absent from the current document, would stay unrevoked and
135
+ * could be restored by a later recovery from the same baseline.
136
+ */
137
+ replaced: Array<Credential>;
138
+ }
139
+ /**
140
+ * What `rcv_sync` did, so the account knows which of its own effects to
141
+ * apply (spec §10).
142
+ */
143
+ export type SyncOutcome = {
144
+ tag: "Unchanged";
145
+ values: void;
146
+ } | {
147
+ tag: "Enrolled";
148
+ values: void;
149
+ } | {
150
+ tag: "Reconfigured";
151
+ values: void;
152
+ } | {
153
+ tag: "Removed";
154
+ values: void;
155
+ } | {
156
+ tag: "Completed";
157
+ values: readonly [Completion];
158
+ };
159
+ /**
160
+ * Which phase of an account upgrade `rcv_upgrade` is checking (spec §12).
161
+ */
162
+ export type UpgradeStep = {
163
+ tag: "Schedule";
164
+ values: readonly [UpgradeSubject, u32];
165
+ } | {
166
+ tag: "Execute";
167
+ values: readonly [u64];
168
+ };
169
+ /**
170
+ * Everything a recovery controller can refuse. Codes are sequential from 1
171
+ * in declaration order and are wire format: append new variants at the
172
+ * end, never reorder.
173
+ */
174
+ export declare const RecoveryError: {
175
+ /**
176
+ * No configuration is enrolled for this account at this controller.
177
+ */
178
+ 1: {
179
+ message: string;
180
+ };
181
+ /**
182
+ * An attempt is authorized and live: begin, policy changes, and upgrades are refused until it completes, is cancelled, or expires.
183
+ */
184
+ 2: {
185
+ message: string;
186
+ };
187
+ /**
188
+ * No attempt with this id exists for the account.
189
+ */
190
+ 3: {
191
+ message: string;
192
+ };
193
+ /**
194
+ * The attempt is terminal, expired, from an older epoch, or invalidated by a sibling's authorization.
195
+ */
196
+ 4: {
197
+ message: string;
198
+ };
199
+ /**
200
+ * Initiation evidence for an attempt that is no longer collecting.
201
+ */
202
+ 5: {
203
+ message: string;
204
+ };
205
+ /**
206
+ * Completion before `executable_after`.
207
+ */
208
+ 6: {
209
+ message: string;
210
+ };
211
+ /**
212
+ * The completion context, or the compiled document hash, does not match the authorized attempt's target.
213
+ */
214
+ 7: {
215
+ message: string;
216
+ };
217
+ /**
218
+ * The address is not an enrolled guardian.
219
+ */
220
+ 8: {
221
+ message: string;
222
+ };
223
+ /**
224
+ * This guardian or factor already counted for this statement.
225
+ */
226
+ 9: {
227
+ message: string;
228
+ };
229
+ /**
230
+ * The enrolled mode has no guardian factor.
231
+ */
232
+ 10: {
233
+ message: string;
234
+ };
235
+ /**
236
+ * The enrolled mode has no ZK factor.
237
+ */
238
+ 11: {
239
+ message: string;
240
+ };
241
+ /**
242
+ * The adapter refused the proof (its `ZkAdapterError` says why).
243
+ */
244
+ 12: {
245
+ message: string;
246
+ };
247
+ /**
248
+ * The proof's nullifier is spent.
249
+ */
250
+ 13: {
251
+ message: string;
252
+ };
253
+ /**
254
+ * The statement's freshness bound has passed or reaches too far.
255
+ */
256
+ 14: {
257
+ message: string;
258
+ };
259
+ /**
260
+ * The statement cannot be encoded (a non-contract account or controller).
261
+ */
262
+ 15: {
263
+ message: string;
264
+ };
265
+ /**
266
+ * Recorded approvals do not satisfy the enrolled condition for this reconfiguration or upgrade.
267
+ */
268
+ 16: {
269
+ message: string;
270
+ };
271
+ /**
272
+ * The account's `max-cancels` is used up.
273
+ */
274
+ 17: {
275
+ message: string;
276
+ };
277
+ /**
278
+ * Owner cancellation is only available under `Loss`.
279
+ */
280
+ 18: {
281
+ message: string;
282
+ };
283
+ /**
284
+ * The replacement set breaks a §7.3 rule, or derivation refused it.
285
+ */
286
+ 19: {
287
+ message: string;
288
+ };
289
+ /**
290
+ * The target or a replacement contains a revoked credential.
291
+ */
292
+ 20: {
293
+ message: string;
294
+ };
295
+ /**
296
+ * The ZK enrollment id was enrolled for this account before (the controller checks the account's `is_enrolled_id` at T1; the pure `derive_target` cannot see the account's history).
297
+ */
298
+ 21: {
299
+ message: string;
300
+ };
301
+ /**
302
+ * Compromise recovery with no baseline enrolled.
303
+ */
304
+ 22: {
305
+ message: string;
306
+ };
307
+ /**
308
+ * Compromise recovery before the baseline's content was published.
309
+ */
310
+ 23: {
311
+ message: string;
312
+ };
313
+ /**
314
+ * The published document does not hash to the enrolled baseline.
315
+ */
316
+ 24: {
317
+ message: string;
318
+ };
319
+ /**
320
+ * The adapter's circuit id or tree depth does not match the enrolled factor and pool.
321
+ */
322
+ 25: {
323
+ message: string;
324
+ };
325
+ /**
326
+ * The ZK factor changed without a new enrollment id.
327
+ */
328
+ 26: {
329
+ message: string;
330
+ };
331
+ /**
332
+ * The configuration is malformed (for example, the account is one of its own guardians, or the quorum is out of range).
333
+ */
334
+ 27: {
335
+ message: string;
336
+ };
337
+ /**
338
+ * An upgrade request recorded under an older epoch.
339
+ */
340
+ 28: {
341
+ message: string;
342
+ };
343
+ /**
344
+ * A ledger-sequence computation overflowed `u32`.
345
+ */
346
+ 29: {
347
+ message: string;
348
+ };
349
+ /**
350
+ * The policy was attached to a context rule of the wrong shape.
351
+ */
352
+ 30: {
353
+ message: string;
354
+ };
355
+ /**
356
+ * A credential the replacement set replaces still appears in the target (a swap or a no-op replacement, spec §7.3 rule 8).
357
+ */
358
+ 31: {
359
+ message: string;
360
+ };
361
+ };
362
+ /**
363
+ * A signer credential, shaped like OZ `stellar_accounts::smart_account::Signer`.
364
+ */
365
+ export type Credential = {
366
+ tag: "Delegated";
367
+ values: readonly [string];
368
+ } | {
369
+ tag: "External";
370
+ values: readonly [string, Buffer];
371
+ };
372
+ /**
373
+ * One designated signer slot and the credential that replaces whatever
374
+ * that slot holds in the source document.
375
+ */
376
+ export interface Replacement {
377
+ /**
378
+ * The credential the target document gives that signer id.
379
+ */
380
+ credential: Credential;
381
+ /**
382
+ * A document signer id listed in the enrolled `recovery.replaceable`.
383
+ */
384
+ signer_id: string;
385
+ }
386
+ /**
387
+ * A ZK enrollment a recovery completion installs.
388
+ *
389
+ * The commitment is bound here, not only the id: completion runs under the
390
+ * zero-signer recovery rule, so nothing signs its arguments, and a
391
+ * commitment supplied only at completion could be swapped by whoever
392
+ * submits the completing transaction first — handing them the account's
393
+ * next ZK factor.
394
+ */
395
+ export interface ZkEnrollment {
396
+ /**
397
+ * The new leaf's inner commitment, `Poseidon2(DOM_LEAF, secret)`.
398
+ * Derivation writes `id` and `commitment` into the target document's
399
+ * recovery section, so the target hash binds them, and the completing
400
+ * `apply_doc` inserts the leaf from the compiled target, never from a
401
+ * call argument.
402
+ */
403
+ commitment: Buffer;
404
+ /**
405
+ * The new enrollment id. Must never have been enrolled for this
406
+ * account before.
407
+ */
408
+ id: Buffer;
409
+ }
410
+ /**
411
+ * Everything a `LostKey`/`Compromise` attempt changes about the source
412
+ * document. See `docs/recovery/spec.md` §7.
413
+ */
414
+ export interface ReplacementSet {
415
+ /**
416
+ * Signer replacements in strictly ascending `signer_id` byte order
417
+ * (sorted, no duplicates) — the one canonical order.
418
+ */
419
+ signers: Array<Replacement>;
420
+ /**
421
+ * The fresh ZK enrollment the completion installs, required exactly
422
+ * when the enrolled mode has a ZK factor (a ZK-evidenced completion
423
+ * consumes the enrolled credential, so it must install a fresh one).
424
+ * Empty or one entry — a `Vec` because `#[contracttype]` cannot derive
425
+ * `Option<CustomStruct>`.
426
+ */
427
+ zk_enrollment: Array<ZkEnrollment>;
428
+ }
429
+ /**
430
+ * Which enrolled ZK factor a statement is checked against. The controller
431
+ * builds this from its stored configuration — never from caller input.
432
+ */
433
+ export interface ZkBinding {
434
+ /**
435
+ * The circuit identity the enrolling document named. The adapter
436
+ * refuses any binding whose `circuit_id` is not its own.
437
+ */
438
+ circuit_id: Buffer;
439
+ /**
440
+ * The enrolled credential's id, bound into its leaf and its nullifier.
441
+ * A leaf enrolled under any other id — including the account's own
442
+ * earlier enrollments — cannot satisfy a proof for this binding.
443
+ */
444
+ enrollment_id: Buffer;
445
+ /**
446
+ * The enrolled membership pool. Roots are accepted only from this pool.
447
+ */
448
+ pool: string;
449
+ }
450
+ /**
451
+ * One ZK proof as submitted.
452
+ */
453
+ export interface ZkEvidence {
454
+ /**
455
+ * The credential's nullifier (the circuit's second public input).
456
+ */
457
+ nullifier: Buffer;
458
+ /**
459
+ * The serialized proof.
460
+ */
461
+ proof: Buffer;
462
+ /**
463
+ * The root the proof was generated against; must be acceptable to the
464
+ * enrolled pool for `tree_id`.
465
+ */
466
+ root: Buffer;
467
+ /**
468
+ * The pool tree the proof's Merkle path is in.
469
+ */
470
+ tree_id: u32;
471
+ }
472
+ /**
473
+ * Everything [`ZkAdapterInterface::verify`] can refuse. Each is a refusal
474
+ * of this evidence only; none is a statement about the account.
475
+ */
476
+ export declare const ZkAdapterError: {
477
+ /**
478
+ * The binding names a circuit this adapter does not verify.
479
+ */
480
+ 1: {
481
+ message: string;
482
+ };
483
+ /**
484
+ * The statement cannot be projected (its account or controller is not a contract address).
485
+ */
486
+ 2: {
487
+ message: string;
488
+ };
489
+ /**
490
+ * The root or nullifier is not a canonical field element.
491
+ */
492
+ 3: {
493
+ message: string;
494
+ };
495
+ /**
496
+ * The enrolled pool does not accept `(tree_id, root)`.
497
+ */
498
+ 4: {
499
+ message: string;
500
+ };
501
+ /**
502
+ * The enrolled pool could not be called.
503
+ */
504
+ 5: {
505
+ message: string;
506
+ };
507
+ /**
508
+ * The proof is not the length/shape the circuit produces.
509
+ */
510
+ 6: {
511
+ message: string;
512
+ };
513
+ /**
514
+ * The verifier rejected the proof.
515
+ */
516
+ 7: {
517
+ message: string;
518
+ };
519
+ /**
520
+ * The verifier could not be called or failed to parse its own key.
521
+ */
522
+ 8: {
523
+ message: string;
524
+ };
525
+ };
526
+ /**
527
+ * A backend verifier's refusals. Same names, order, and codes (1, 2, 3)
528
+ * as Nido's constructorless `nido-recovery-verifier`, so either can sit
529
+ * behind an adapter unchanged.
530
+ */
531
+ export declare const ProofVerifierError: {
532
+ /**
533
+ * VkParseError
534
+ */
535
+ 1: {
536
+ message: string;
537
+ };
538
+ /**
539
+ * ProofParseError
540
+ */
541
+ 2: {
542
+ message: string;
543
+ };
544
+ /**
545
+ * VerificationFailed
546
+ */
547
+ 3: {
548
+ message: string;
549
+ };
550
+ };
551
+ /**
552
+ * Who may change the recovery configuration, and whether an authorized
553
+ * attempt freezes ordinary activity (spec §2, §9).
554
+ */
555
+ export type RecoveryProfile = {
556
+ tag: "Loss";
557
+ values: void;
558
+ } | {
559
+ tag: "Protected";
560
+ values: void;
561
+ };
562
+ /**
563
+ * The ZK factor (spec §3.1, §3.4).
564
+ */
565
+ export interface CompiledZkFactor {
566
+ /**
567
+ * The constructorless ZK adapter the controller calls.
568
+ */
569
+ adapter: string;
570
+ /**
571
+ * `sha256` of the adapter's verification key; must equal the adapter's
572
+ * `circuit_id()`.
573
+ */
574
+ circuit_id: Buffer;
575
+ /**
576
+ * The current credential's inner commitment, `Poseidon2(DOM_LEAF,
577
+ * secret)`, from which the account inserts the leaf.
578
+ */
579
+ commitment: Buffer;
580
+ /**
581
+ * The current credential's id, bound into its leaf and nullifier.
582
+ */
583
+ enrollment_id: Buffer;
584
+ /**
585
+ * The membership pool roots are accepted from.
586
+ */
587
+ pool: string;
588
+ }
589
+ /**
590
+ * The guardian factor.
591
+ */
592
+ export interface CompiledGuardianSet {
593
+ /**
594
+ * Guardian addresses (`G...` or `C...`), never the account itself.
595
+ */
596
+ guardians: Array<string>;
597
+ /**
598
+ * `1 <= quorum <= guardians.len()`.
599
+ */
600
+ quorum: u32;
601
+ }
602
+ /**
603
+ * Which factors a statement needs.
604
+ */
605
+ export type CompiledRecoveryMode = {
606
+ tag: "GuardianOnly";
607
+ values: readonly [CompiledGuardianSet];
608
+ } | {
609
+ tag: "ZkOnly";
610
+ values: readonly [CompiledZkFactor];
611
+ } | {
612
+ tag: "Combined";
613
+ values: readonly [CompiledGuardianSet, CompiledZkFactor];
614
+ };
615
+ /**
616
+ * A compiled `recovery` member.
617
+ */
618
+ export interface CompiledRecoveryConfig {
619
+ /**
620
+ * The enrolled baseline's canonical document hash, if compromise
621
+ * recovery is enrolled.
622
+ */
623
+ baseline: Option<Buffer>;
624
+ /**
625
+ * [`config_hash`] of the canonical JSON of the recovery member, computed
626
+ * by the doc compiler (spec §3.2). Configuration
627
+ * identity: two compiled configurations with the same `config_hash` are
628
+ * the same configuration.
629
+ */
630
+ config_hash: Buffer;
631
+ /**
632
+ * The adopted controller instance.
633
+ */
634
+ controller: string;
635
+ delay_ledgers: u32;
636
+ expiry_ledgers: u32;
637
+ max_cancels: u32;
638
+ mode: CompiledRecoveryMode;
639
+ profile: RecoveryProfile;
640
+ /**
641
+ * Signer ids (not credential fingerprints) a recovery may replace, so
642
+ * rotating a key does not change the configuration (#92).
643
+ */
644
+ replaceable: Array<string>;
645
+ }
646
+ /**
647
+ * One pending account upgrade (spec §12).
648
+ *
649
+ * Staleness is judged against the account's own **recovery generation**, a
650
+ * `u64` the account keeps in its own storage. It starts at 0 and is never
651
+ * reset. It advances on every `rcv_sync` outcome other than `Unchanged`
652
+ * (`controller::SyncOutcome::bumps_generation`) and on every executed
653
+ * upgrade.
654
+ *
655
+ * The controller's epoch cannot play this role. It belongs to one
656
+ * controller and does not exist while the account is unenrolled, so a
657
+ * request scheduled unenrolled would survive enrolling recovery and
658
+ * removing it again: the final state has no controller, just as at
659
+ * scheduling.
660
+ */
661
+ export interface UpgradeRequest {
662
+ /**
663
+ * The adopted controller's epoch when scheduled, if a controller was
664
+ * adopted. Passed back as `UpgradeStep::Execute` so the controller can
665
+ * check it too.
666
+ */
667
+ controller_epoch: Option<u64>;
668
+ /**
669
+ * The first ledger at which the request may execute.
670
+ */
671
+ executable_at: u32;
672
+ /**
673
+ * The account's recovery generation when the request was scheduled.
674
+ */
675
+ generation: u64;
676
+ /**
677
+ * Per-account, never reused.
678
+ */
679
+ request_id: u64;
680
+ /**
681
+ * The exact Wasm the account will run.
682
+ */
683
+ wasm_hash: Buffer;
684
+ }
685
+ /**
686
+ * What a `Reconfigure` statement changes the enrolled configuration to.
687
+ */
688
+ export type ConfigChange = {
689
+ tag: "Remove";
690
+ values: void;
691
+ } | {
692
+ tag: "Set";
693
+ values: readonly [Buffer];
694
+ };
695
+ /**
696
+ * The subject of a `Cancel` statement.
697
+ */
698
+ export interface CancelSubject {
699
+ /**
700
+ * The attempt being cancelled.
701
+ */
702
+ attempt_id: u64;
703
+ /**
704
+ * That attempt's own initiation statement digest, so cancellation
705
+ * evidence names exactly one proposal, not just an id.
706
+ */
707
+ attempt_statement: Buffer;
708
+ }
709
+ /**
710
+ * The enrolled configuration a statement is evaluated against.
711
+ */
712
+ export interface ConfigBinding {
713
+ /**
714
+ * `sha256("perch/recovery/config" || canonical JSON of the enrolled
715
+ * document's recovery member)`, as [`crate::config::config_hash`]
716
+ * computes it (`docs/recovery/spec.md` §3.2). Binds the whole
717
+ * configuration: profile, mode, guardians, quorum, ZK adapter, circuit
718
+ * id, pool, enrollment id and commitment, controller, baseline,
719
+ * replaceable signer ids, and timing.
720
+ */
721
+ config_hash: Buffer;
722
+ /**
723
+ * The controller's per-account configuration epoch. It increments on
724
+ * every enrollment, reconfiguration, removal, completed recovery, and
725
+ * executed account upgrade, so evidence produced under one epoch is
726
+ * dead under every later one.
727
+ */
728
+ epoch: u64;
729
+ }
730
+ /**
731
+ * The subject of a `LostKey` or `Compromise` attempt.
732
+ */
733
+ export interface AttemptSubject {
734
+ /**
735
+ * The controller-assigned, per-account, never-reused attempt id.
736
+ */
737
+ attempt_id: u64;
738
+ /**
739
+ * [`crate::credential::ReplacementSet::hash`] of the declared
740
+ * replacements.
741
+ */
742
+ replacements_hash: Buffer;
743
+ /**
744
+ * `LostKey`: the canonical hash of the account's applied document when
745
+ * the attempt began (the agreed snapshot). `Compromise`: the enrolled
746
+ * baseline's canonical hash.
747
+ */
748
+ source_doc_hash: Buffer;
749
+ /**
750
+ * The canonical hash of the target document, derived on-chain from
751
+ * the source and the replacement set — never caller-chosen.
752
+ */
753
+ target_doc_hash: Buffer;
754
+ }
755
+ /**
756
+ * The action domain a statement authorizes. Evidence for one action never
757
+ * satisfies another: the action code is the encoding's 26th byte and selects
758
+ * the subject layout, so two statements that differ only in action have
759
+ * different digests (and different encoded lengths for most pairs).
760
+ *
761
+ * The numeric codes are part of the wire format.
762
+ */
763
+ export declare enum RecoveryAction {
764
+ LostKey = 1,
765
+ Compromise = 2,
766
+ Cancel = 3,
767
+ Reconfigure = 4,
768
+ Upgrade = 5
769
+ }
770
+ /**
771
+ * Everything encoding a statement or its parts can refuse.
772
+ */
773
+ export declare const StatementError: {
774
+ /**
775
+ * `account` is not a contract (`C...`) address.
776
+ */
777
+ 1: {
778
+ message: string;
779
+ };
780
+ /**
781
+ * `controller` is not a contract (`C...`) address.
782
+ */
783
+ 2: {
784
+ message: string;
785
+ };
786
+ /**
787
+ * A credential names an address shape the recovery stack does not accept (muxed, claimable-balance, liquidity-pool, ...).
788
+ */
789
+ 3: {
790
+ message: string;
791
+ };
792
+ /**
793
+ * A replacement set's signer ids are not strictly ascending (sorted, no duplicates), so it has no single canonical encoding.
794
+ */
795
+ 4: {
796
+ message: string;
797
+ };
798
+ /**
799
+ * A replacement set replaces nothing.
800
+ */
801
+ 5: {
802
+ message: string;
803
+ };
804
+ /**
805
+ * The current ledger is past the statement's `valid_until_ledger`.
806
+ */
807
+ 6: {
808
+ message: string;
809
+ };
810
+ /**
811
+ * A provider-chosen `valid_until_ledger` reaches further past the current ledger than the enrolled `expiry_ledgers` allows.
812
+ */
813
+ 7: {
814
+ message: string;
815
+ };
816
+ };
817
+ /**
818
+ * The subject of an `Upgrade` statement.
819
+ */
820
+ export interface UpgradeSubject {
821
+ /**
822
+ * The account's per-account, never-reused upgrade request id.
823
+ */
824
+ request_id: u64;
825
+ /**
826
+ * The exact Wasm hash the account would run after the upgrade.
827
+ */
828
+ wasm_hash: Buffer;
829
+ }
830
+ /**
831
+ * Timing terms, all in ledger-sequence units.
832
+ */
833
+ export interface StatementTiming {
834
+ /**
835
+ * The enrolled `delay-ledgers`: ledgers between an attempt becoming
836
+ * authorized and becoming completable.
837
+ */
838
+ delay_ledgers: u32;
839
+ /**
840
+ * The enrolled `expiry-ledgers`: the evidence window for a collecting
841
+ * attempt, the completion window for an authorized one, and the upper
842
+ * bound on how far ahead a provider-chosen `valid_until_ledger` may
843
+ * reach.
844
+ */
845
+ expiry_ledgers: u32;
846
+ /**
847
+ * The last ledger sequence (inclusive) at which this evidence may be
848
+ * accepted. The controller fixes it for attempt-bound actions:
849
+ * `LostKey`/`Compromise` use the attempt's evidence deadline, and
850
+ * `Cancel` the last ledger the attempt could possibly be live, so
851
+ * approvals collected over several transactions all sign one
852
+ * statement. For `Reconfigure`/`Upgrade` the evidence provider chooses
853
+ * it, within `expiry_ledgers` of submission.
854
+ */
855
+ valid_until_ledger: u32;
856
+ }
857
+ /**
858
+ * The action-specific part of a statement. The variant determines
859
+ * [`RecoveryStatement::action`]; there is no separate action field that
860
+ * could disagree with it.
861
+ */
862
+ export type StatementSubject = {
863
+ tag: "LostKey";
864
+ values: readonly [AttemptSubject];
865
+ } | {
866
+ tag: "Compromise";
867
+ values: readonly [AttemptSubject];
868
+ } | {
869
+ tag: "Cancel";
870
+ values: readonly [CancelSubject];
871
+ } | {
872
+ tag: "Reconfigure";
873
+ values: readonly [ConfigChange];
874
+ } | {
875
+ tag: "Upgrade";
876
+ values: readonly [UpgradeSubject];
877
+ };
878
+ /**
879
+ * The one recovery statement. See the module docs.
880
+ */
881
+ export interface RecoveryStatement {
882
+ /**
883
+ * The recovering account. Must be a contract address.
884
+ */
885
+ account: string;
886
+ config: ConfigBinding;
887
+ /**
888
+ * The controller instance evaluating the evidence (for `Reconfigure`,
889
+ * the currently adopted one, even when the change adopts another).
890
+ * Must be a contract address.
891
+ */
892
+ controller: string;
893
+ /**
894
+ * The network id (`sha256` of the network passphrase), as
895
+ * `Env::ledger().network_id()` returns it.
896
+ */
897
+ network_id: Buffer;
898
+ subject: StatementSubject;
899
+ timing: StatementTiming;
900
+ }
901
+ export interface Client {
902
+ /**
903
+ * Construct and simulate a tree transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
904
+ */
905
+ tree: ({ tree_id }: {
906
+ tree_id: u32;
907
+ }, options?: MethodOptions) => Promise<AssembledTransaction<Result<TreeInfo>>>;
908
+ /**
909
+ * Construct and simulate a depth transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
910
+ * `MembershipPoolInterface::depth`: see [`TREE_DEPTH`].
911
+ */
912
+ depth: (options?: MethodOptions) => Promise<AssembledTransaction<u32>>;
913
+ /**
914
+ * Construct and simulate a leaves transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
915
+ * A page of `tree_id`'s leaves, for rebuilding witnesses from storage.
916
+ */
917
+ leaves: ({ tree_id, start, count }: {
918
+ tree_id: u32;
919
+ start: u64;
920
+ count: u32;
921
+ }, options?: MethodOptions) => Promise<AssembledTransaction<Result<Array<Buffer>>>>;
922
+ /**
923
+ * Construct and simulate a version transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
924
+ * See [`VERSION`].
925
+ */
926
+ version: (options?: MethodOptions) => Promise<AssembledTransaction<u32>>;
927
+ /**
928
+ * Construct and simulate a enrollment transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
929
+ * Where `account`'s enrollment `enrollment_id` landed, if it exists.
930
+ */
931
+ enrollment: ({ account, enrollment_id }: {
932
+ account: string;
933
+ enrollment_id: Buffer;
934
+ }, options?: MethodOptions) => Promise<AssembledTransaction<Option<LeafPosition>>>;
935
+ /**
936
+ * Construct and simulate a rcv_insert transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
937
+ * Insert `commitment` (`H(DOM_LEAF, secret)`) for `account` under
938
+ * `enrollment_id` (spec §14.2). Invoker-only: `account.require_auth()`
939
+ * is satisfiable only by the account's own code calling, because the
940
+ * account refuses to sign reserved `rcv_*` names (spec §15). The pool,
941
+ * not the caller, derives the stored leaf from the account and the id,
942
+ * and refuses a second insertion under the same id. Returns nothing:
943
+ * the leaf's position is in the `LeafInserted` event and in
944
+ * [`Self::enrollment`].
945
+ */
946
+ rcv_insert: ({ account, enrollment_id, commitment }: {
947
+ account: string;
948
+ enrollment_id: Buffer;
949
+ commitment: Buffer;
950
+ }, options?: MethodOptions) => Promise<AssembledTransaction<Result<void>>>;
951
+ /**
952
+ * Construct and simulate a renew_root transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
953
+ * Permissionless keep-alive for one historical root a prover relies on.
954
+ */
955
+ renew_root: ({ tree_id, root }: {
956
+ tree_id: u32;
957
+ root: Buffer;
958
+ }, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
959
+ /**
960
+ * Construct and simulate a renew_tree transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
961
+ * Permissionless keep-alive: extend `tree_id`'s state and latest root
962
+ * (and the current-tree pointer) to the network's maximum TTL. Changes
963
+ * nothing else.
964
+ */
965
+ renew_tree: ({ tree_id }: {
966
+ tree_id: u32;
967
+ }, options?: MethodOptions) => Promise<AssembledTransaction<Result<void>>>;
968
+ /**
969
+ * Construct and simulate a current_tree transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
970
+ * The tree insertions currently go into.
971
+ */
972
+ current_tree: (options?: MethodOptions) => Promise<AssembledTransaction<u32>>;
973
+ /**
974
+ * Construct and simulate a renew_leaves transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
975
+ * Permissionless keep-alive for a page of `tree_id`'s leaves.
976
+ */
977
+ renew_leaves: ({ tree_id, start, count }: {
978
+ tree_id: u32;
979
+ start: u64;
980
+ count: u32;
981
+ }, options?: MethodOptions) => Promise<AssembledTransaction<Result<void>>>;
982
+ /**
983
+ * Construct and simulate a is_known_root transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
984
+ * `MembershipPoolInterface::is_known_root`: whether `root` is a root
985
+ * tree `tree_id` of this pool has ever had.
986
+ */
987
+ is_known_root: ({ tree_id, root }: {
988
+ tree_id: u32;
989
+ root: Buffer;
990
+ }, options?: MethodOptions) => Promise<AssembledTransaction<boolean>>;
991
+ /**
992
+ * Construct and simulate a renew_enrollment transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
993
+ * Permissionless keep-alive for one enrollment's record and leaf.
994
+ */
995
+ renew_enrollment: ({ account, enrollment_id }: {
996
+ account: string;
997
+ enrollment_id: Buffer;
998
+ }, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
999
+ }
1000
+ export declare class Client extends ContractClient {
1001
+ readonly options: ContractClientOptions;
1002
+ static deploy<T = Client>(
1003
+ /** Options for initializing a Client as well as for calling a method, with extras specific to deploying. */
1004
+ options: MethodOptions & Omit<ContractClientOptions, "contractId"> & {
1005
+ /** The hash of the Wasm blob, which must already be installed on-chain. */
1006
+ wasmHash: Buffer | string;
1007
+ /** Salt used to generate the contract's ID. Passed through to {@link Operation.createCustomContract}. Default: random. */
1008
+ salt?: Buffer | Uint8Array;
1009
+ /** The format used to decode `wasmHash`, if it's provided as a string. */
1010
+ format?: "hex" | "base64";
1011
+ }): Promise<AssembledTransaction<T>>;
1012
+ constructor(options: ContractClientOptions);
1013
+ readonly fromJSON: {
1014
+ tree: (json: string) => AssembledTransaction<Result<TreeInfo, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
1015
+ depth: (json: string) => AssembledTransaction<number>;
1016
+ leaves: (json: string) => AssembledTransaction<Result<Buffer<ArrayBufferLike>[], import("@stellar/stellar-sdk/contract").ErrorMessage>>;
1017
+ version: (json: string) => AssembledTransaction<number>;
1018
+ enrollment: (json: string) => AssembledTransaction<Option<LeafPosition>>;
1019
+ rcv_insert: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
1020
+ renew_root: (json: string) => AssembledTransaction<null>;
1021
+ renew_tree: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
1022
+ current_tree: (json: string) => AssembledTransaction<number>;
1023
+ renew_leaves: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
1024
+ is_known_root: (json: string) => AssembledTransaction<boolean>;
1025
+ renew_enrollment: (json: string) => AssembledTransaction<null>;
1026
+ };
1027
+ }