@stellar-registry/perch-contracts 0.1.2 → 0.2.1

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/adapter.d.ts CHANGED
@@ -1,321 +1,11 @@
1
1
  /** sha256 of the wasm these bindings were generated from. */
2
- export declare const WASM_SHA256 = "95869bab4b89e5a4306ffe0d7a9e91931a56518ef18b3f61e95df86145dda63e";
2
+ export declare const WASM_SHA256 = "cd9ac55d7cafa9c544c4b6e6b5e45e3c767cde99885aef78a8965d752edfd6b8";
3
3
  import { Buffer } from "buffer";
4
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";
5
+ import type { u32, u64 } from "@stellar/stellar-sdk/contract";
6
6
  export * from "@stellar/stellar-sdk";
7
7
  export * as contract from "@stellar/stellar-sdk/contract";
8
8
  export * as rpc from "@stellar/stellar-sdk/rpc";
9
- /**
10
- * What a completion hands back to the account.
11
- */
12
- export interface Completion {
13
- /**
14
- * The attempt that completed.
15
- */
16
- attempt_id: u64;
17
- /**
18
- * The credentials that occupied the replaced signer slots **in the
19
- * attempt's source document**, as derived at T1: the applied document
20
- * for lost-key, the baseline for compromise. The account fingerprints
21
- * them over canonical keys and revokes them together with every
22
- * credential the completion removed from its current document. Without
23
- * these, a baseline credential replaced by a compromise recovery, and
24
- * already absent from the current document, would stay unrevoked and
25
- * could be restored by a later recovery from the same baseline.
26
- */
27
- replaced: Array<Credential>;
28
- }
29
- /**
30
- * What `rcv_sync` did, so the account knows which of its own effects to
31
- * apply (spec §10).
32
- */
33
- export type SyncOutcome = {
34
- tag: "Unchanged";
35
- values: void;
36
- } | {
37
- tag: "Enrolled";
38
- values: void;
39
- } | {
40
- tag: "Reconfigured";
41
- values: void;
42
- } | {
43
- tag: "Removed";
44
- values: void;
45
- } | {
46
- tag: "Completed";
47
- values: readonly [Completion];
48
- };
49
- /**
50
- * Which phase of an account upgrade `rcv_upgrade` is checking (spec §12).
51
- */
52
- export type UpgradeStep = {
53
- tag: "Schedule";
54
- values: readonly [UpgradeSubject, u32];
55
- } | {
56
- tag: "Execute";
57
- values: readonly [u64];
58
- };
59
- /**
60
- * Everything a recovery controller can refuse. Codes are sequential from 1
61
- * in declaration order and are wire format: append new variants at the
62
- * end, never reorder.
63
- */
64
- export declare const RecoveryError: {
65
- /**
66
- * No configuration is enrolled for this account at this controller.
67
- */
68
- 1: {
69
- message: string;
70
- };
71
- /**
72
- * An attempt is authorized and live: begin, policy changes, and upgrades are refused until it completes, is cancelled, or expires.
73
- */
74
- 2: {
75
- message: string;
76
- };
77
- /**
78
- * No attempt with this id exists for the account.
79
- */
80
- 3: {
81
- message: string;
82
- };
83
- /**
84
- * The attempt is terminal, expired, from an older epoch, or invalidated by a sibling's authorization.
85
- */
86
- 4: {
87
- message: string;
88
- };
89
- /**
90
- * Initiation evidence for an attempt that is no longer collecting.
91
- */
92
- 5: {
93
- message: string;
94
- };
95
- /**
96
- * Completion before `executable_after`.
97
- */
98
- 6: {
99
- message: string;
100
- };
101
- /**
102
- * The completion context, or the compiled document hash, does not match the authorized attempt's target.
103
- */
104
- 7: {
105
- message: string;
106
- };
107
- /**
108
- * The address is not an enrolled guardian.
109
- */
110
- 8: {
111
- message: string;
112
- };
113
- /**
114
- * This guardian or factor already counted for this statement.
115
- */
116
- 9: {
117
- message: string;
118
- };
119
- /**
120
- * The enrolled mode has no guardian factor.
121
- */
122
- 10: {
123
- message: string;
124
- };
125
- /**
126
- * The enrolled mode has no ZK factor.
127
- */
128
- 11: {
129
- message: string;
130
- };
131
- /**
132
- * The adapter refused the proof (its `ZkAdapterError` says why).
133
- */
134
- 12: {
135
- message: string;
136
- };
137
- /**
138
- * The proof's nullifier is spent.
139
- */
140
- 13: {
141
- message: string;
142
- };
143
- /**
144
- * The statement's freshness bound has passed or reaches too far.
145
- */
146
- 14: {
147
- message: string;
148
- };
149
- /**
150
- * The statement cannot be encoded (a non-contract account or controller).
151
- */
152
- 15: {
153
- message: string;
154
- };
155
- /**
156
- * Recorded approvals do not satisfy the enrolled condition for this reconfiguration or upgrade.
157
- */
158
- 16: {
159
- message: string;
160
- };
161
- /**
162
- * The account's `max-cancels` is used up.
163
- */
164
- 17: {
165
- message: string;
166
- };
167
- /**
168
- * Owner cancellation is only available under `Loss`.
169
- */
170
- 18: {
171
- message: string;
172
- };
173
- /**
174
- * The replacement set breaks a §7.3 rule, or derivation refused it.
175
- */
176
- 19: {
177
- message: string;
178
- };
179
- /**
180
- * The target or a replacement contains a revoked credential.
181
- */
182
- 20: {
183
- message: string;
184
- };
185
- /**
186
- * 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).
187
- */
188
- 21: {
189
- message: string;
190
- };
191
- /**
192
- * Compromise recovery with no baseline enrolled.
193
- */
194
- 22: {
195
- message: string;
196
- };
197
- /**
198
- * Compromise recovery before the baseline's content was published.
199
- */
200
- 23: {
201
- message: string;
202
- };
203
- /**
204
- * The published document does not hash to the enrolled baseline.
205
- */
206
- 24: {
207
- message: string;
208
- };
209
- /**
210
- * The adapter's circuit id or tree depth does not match the enrolled factor and pool.
211
- */
212
- 25: {
213
- message: string;
214
- };
215
- /**
216
- * The ZK factor changed without a new enrollment id.
217
- */
218
- 26: {
219
- message: string;
220
- };
221
- /**
222
- * The configuration is malformed (for example, the account is one of its own guardians, or the quorum is out of range).
223
- */
224
- 27: {
225
- message: string;
226
- };
227
- /**
228
- * An upgrade request recorded under an older epoch.
229
- */
230
- 28: {
231
- message: string;
232
- };
233
- /**
234
- * A ledger-sequence computation overflowed `u32`.
235
- */
236
- 29: {
237
- message: string;
238
- };
239
- /**
240
- * The policy was attached to a context rule of the wrong shape.
241
- */
242
- 30: {
243
- message: string;
244
- };
245
- /**
246
- * A credential the replacement set replaces still appears in the target (a swap or a no-op replacement, spec §7.3 rule 8).
247
- */
248
- 31: {
249
- message: string;
250
- };
251
- };
252
- /**
253
- * A signer credential, shaped like OZ `stellar_accounts::smart_account::Signer`.
254
- */
255
- export type Credential = {
256
- tag: "Delegated";
257
- values: readonly [string];
258
- } | {
259
- tag: "External";
260
- values: readonly [string, Buffer];
261
- };
262
- /**
263
- * One designated signer slot and the credential that replaces whatever
264
- * that slot holds in the source document.
265
- */
266
- export interface Replacement {
267
- /**
268
- * The credential the target document gives that signer id.
269
- */
270
- credential: Credential;
271
- /**
272
- * A document signer id listed in the enrolled `recovery.replaceable`.
273
- */
274
- signer_id: string;
275
- }
276
- /**
277
- * A ZK enrollment a recovery completion installs.
278
- *
279
- * The commitment is bound here, not only the id: completion runs under the
280
- * zero-signer recovery rule, so nothing signs its arguments, and a
281
- * commitment supplied only at completion could be swapped by whoever
282
- * submits the completing transaction first — handing them the account's
283
- * next ZK factor.
284
- */
285
- export interface ZkEnrollment {
286
- /**
287
- * The new leaf's inner commitment, `Poseidon2(DOM_LEAF, secret)`.
288
- * Derivation writes `id` and `commitment` into the target document's
289
- * recovery section, so the target hash binds them, and the completing
290
- * `apply_doc` inserts the leaf from the compiled target, never from a
291
- * call argument.
292
- */
293
- commitment: Buffer;
294
- /**
295
- * The new enrollment id. Must never have been enrolled for this
296
- * account before.
297
- */
298
- id: Buffer;
299
- }
300
- /**
301
- * Everything a `LostKey`/`Compromise` attempt changes about the source
302
- * document. See `docs/recovery/spec.md` §7.
303
- */
304
- export interface ReplacementSet {
305
- /**
306
- * Signer replacements in strictly ascending `signer_id` byte order
307
- * (sorted, no duplicates) — the one canonical order.
308
- */
309
- signers: Array<Replacement>;
310
- /**
311
- * The fresh ZK enrollment the completion installs, required exactly
312
- * when the enrolled mode has a ZK factor (a ZK-evidenced completion
313
- * consumes the enrolled credential, so it must install a fresh one).
314
- * Empty or one entry — a `Vec` because `#[contracttype]` cannot derive
315
- * `Option<CustomStruct>`.
316
- */
317
- zk_enrollment: Array<ZkEnrollment>;
318
- }
319
9
  /**
320
10
  * Which enrolled ZK factor a statement is checked against. The controller
321
11
  * builds this from its stored configuration — never from caller input.
@@ -438,157 +128,6 @@ export declare const ProofVerifierError: {
438
128
  message: string;
439
129
  };
440
130
  };
441
- /**
442
- * Who may change the recovery configuration, and whether an authorized
443
- * attempt freezes ordinary activity (spec §2, §9).
444
- */
445
- export type RecoveryProfile = {
446
- tag: "Loss";
447
- values: void;
448
- } | {
449
- tag: "Protected";
450
- values: void;
451
- };
452
- /**
453
- * The ZK factor (spec §3.1, §3.4).
454
- */
455
- export interface CompiledZkFactor {
456
- /**
457
- * The constructorless ZK adapter the controller calls.
458
- */
459
- adapter: string;
460
- /**
461
- * `sha256` of the adapter's verification key; must equal the adapter's
462
- * `circuit_id()`.
463
- */
464
- circuit_id: Buffer;
465
- /**
466
- * The current credential's inner commitment, `Poseidon2(DOM_LEAF,
467
- * secret)`, from which the account inserts the leaf.
468
- */
469
- commitment: Buffer;
470
- /**
471
- * The current credential's id, bound into its leaf and nullifier.
472
- */
473
- enrollment_id: Buffer;
474
- /**
475
- * The membership pool roots are accepted from.
476
- */
477
- pool: string;
478
- }
479
- /**
480
- * The guardian factor.
481
- */
482
- export interface CompiledGuardianSet {
483
- /**
484
- * Guardian addresses (`G...` or `C...`), never the account itself.
485
- */
486
- guardians: Array<string>;
487
- /**
488
- * `1 <= quorum <= guardians.len()`.
489
- */
490
- quorum: u32;
491
- }
492
- /**
493
- * Which factors a statement needs.
494
- */
495
- export type CompiledRecoveryMode = {
496
- tag: "GuardianOnly";
497
- values: readonly [CompiledGuardianSet];
498
- } | {
499
- tag: "ZkOnly";
500
- values: readonly [CompiledZkFactor];
501
- } | {
502
- tag: "Combined";
503
- values: readonly [CompiledGuardianSet, CompiledZkFactor];
504
- };
505
- /**
506
- * A compiled `recovery` member.
507
- */
508
- export interface CompiledRecoveryConfig {
509
- /**
510
- * The enrolled baseline's canonical document hash, if compromise
511
- * recovery is enrolled.
512
- */
513
- baseline: Option<Buffer>;
514
- /**
515
- * [`config_hash`] of the canonical JSON of the recovery member, computed
516
- * by the doc compiler (spec §3.2). Configuration
517
- * identity: two compiled configurations with the same `config_hash` are
518
- * the same configuration.
519
- */
520
- config_hash: Buffer;
521
- /**
522
- * The adopted controller instance.
523
- */
524
- controller: string;
525
- /**
526
- * Ledgers from an attempt's authorization until it can complete.
527
- */
528
- delay_ledgers: u32;
529
- /**
530
- * The evidence window of a collecting attempt and the completion
531
- * window of an authorized one, in ledgers.
532
- */
533
- expiry_ledgers: u32;
534
- /**
535
- * Lifetime cap on evidence-based cancellations of authorized attempts.
536
- */
537
- max_cancels: u32;
538
- /**
539
- * The factors evidence must satisfy.
540
- */
541
- mode: CompiledRecoveryMode;
542
- /**
543
- * Who may change the configuration, and whether an authorized attempt
544
- * freezes the account.
545
- */
546
- profile: RecoveryProfile;
547
- /**
548
- * Signer ids (not credential fingerprints) a recovery may replace, so
549
- * rotating a key does not change the configuration (#92).
550
- */
551
- replaceable: Array<string>;
552
- }
553
- /**
554
- * One pending account upgrade (spec §12).
555
- *
556
- * Staleness is judged against the account's own **recovery generation**, a
557
- * `u64` the account keeps in its own storage. It starts at 0 and is never
558
- * reset. It advances on every `rcv_sync` outcome other than `Unchanged`
559
- * (`controller::SyncOutcome::bumps_generation`) and on every executed
560
- * upgrade.
561
- *
562
- * The controller's epoch cannot play this role. It belongs to one
563
- * controller and does not exist while the account is unenrolled, so a
564
- * request scheduled unenrolled would survive enrolling recovery and
565
- * removing it again: the final state has no controller, just as at
566
- * scheduling.
567
- */
568
- export interface UpgradeRequest {
569
- /**
570
- * The adopted controller's epoch when scheduled, if a controller was
571
- * adopted. Passed back as `UpgradeStep::Execute` so the controller can
572
- * check it too.
573
- */
574
- controller_epoch: Option<u64>;
575
- /**
576
- * The first ledger at which the request may execute.
577
- */
578
- executable_at: u32;
579
- /**
580
- * The account's recovery generation when the request was scheduled.
581
- */
582
- generation: u64;
583
- /**
584
- * Per-account, never reused.
585
- */
586
- request_id: u64;
587
- /**
588
- * The exact Wasm the account will run.
589
- */
590
- wasm_hash: Buffer;
591
- }
592
131
  /**
593
132
  * What a `Reconfigure` statement changes the enrolled configuration to.
594
133
  */
@@ -659,68 +198,6 @@ export interface AttemptSubject {
659
198
  */
660
199
  target_doc_hash: Buffer;
661
200
  }
662
- /**
663
- * The action domain a statement authorizes. Evidence for one action never
664
- * satisfies another: the action code is the encoding's 26th byte and selects
665
- * the subject layout, so two statements that differ only in action have
666
- * different digests (and different encoded lengths for most pairs).
667
- *
668
- * The numeric codes are part of the wire format.
669
- */
670
- export declare enum RecoveryAction {
671
- LostKey = 1,
672
- Compromise = 2,
673
- Cancel = 3,
674
- Reconfigure = 4,
675
- Upgrade = 5
676
- }
677
- /**
678
- * Everything encoding a statement or its parts can refuse.
679
- */
680
- export declare const StatementError: {
681
- /**
682
- * `account` is not a contract (`C...`) address.
683
- */
684
- 1: {
685
- message: string;
686
- };
687
- /**
688
- * `controller` is not a contract (`C...`) address.
689
- */
690
- 2: {
691
- message: string;
692
- };
693
- /**
694
- * A credential names an address shape the recovery stack does not accept (muxed, claimable-balance, liquidity-pool, ...).
695
- */
696
- 3: {
697
- message: string;
698
- };
699
- /**
700
- * A replacement set's signer ids are not strictly ascending (sorted, no duplicates), so it has no single canonical encoding.
701
- */
702
- 4: {
703
- message: string;
704
- };
705
- /**
706
- * A replacement set replaces nothing.
707
- */
708
- 5: {
709
- message: string;
710
- };
711
- /**
712
- * The current ledger is past the statement's `valid_until_ledger`.
713
- */
714
- 6: {
715
- message: string;
716
- };
717
- /**
718
- * A provider-chosen `valid_until_ledger` reaches further past the current ledger than the enrolled `expiry_ledgers` allows.
719
- */
720
- 7: {
721
- message: string;
722
- };
723
- };
724
201
  /**
725
202
  * The subject of an `Upgrade` statement.
726
203
  */