@stellar-registry/perch-contracts 0.1.1 → 0.2.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/account.d.ts CHANGED
@@ -1,31 +1,152 @@
1
1
  /** sha256 of the wasm these bindings were generated from. */
2
- export declare const WASM_SHA256 = "d99d56fc2d07a14c2259f0994d97316d23ae90db26835f4c977939c2b3b593aa";
2
+ export declare const WASM_SHA256 = "cc56a2d36669dba65c9089ba9c133e284d4b2f9bff826e2d52876e66b5e14428";
3
+ /** These bindings describe a build no deployment runs yet. */
4
+ export declare const DEPLOYED = false;
3
5
  import { Buffer } from "buffer";
4
6
  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";
7
+ import type { u32, u64, i128, Option } from "@stellar/stellar-sdk/contract";
6
8
  export * from "@stellar/stellar-sdk";
7
9
  export * as contract from "@stellar/stellar-sdk/contract";
8
10
  export * as rpc from "@stellar/stellar-sdk/rpc";
9
11
  /**
10
- * One pending account upgrade (spec §12).
12
+ * Represents different types of signers in the smart account system.
13
+ */
14
+ export type Signer = {
15
+ tag: "Delegated";
16
+ values: readonly [string];
17
+ } | {
18
+ tag: "External";
19
+ values: readonly [string, Buffer];
20
+ };
21
+ /**
22
+ * The authorization payload passed to `__check_auth`, bundling cryptographic
23
+ * proofs with context rule selection.
24
+ *
25
+ * This struct carries two distinct pieces of information that are both
26
+ * required for authorization but cannot be derived from each other:
27
+ *
28
+ * - `signers` maps each [`Signer`] to its raw signature bytes, providing
29
+ * cryptographic proof that the signer actually signed the transaction
30
+ * payload. A context rule stores which signer *identities* are authorized
31
+ * (via `signer_ids`), but the rule does not contain the signatures
32
+ * themselves — those must be supplied here.
11
33
  *
12
- * Staleness is judged against the account's own **recovery generation**, a
13
- * `u64` the account keeps in its own storage. It starts at 0 and is never
14
- * reset. It advances on every `rcv_sync` outcome other than `Unchanged`
15
- * (`controller::SyncOutcome::bumps_generation`) and on every executed
16
- * upgrade.
34
+ * - `context_rule_ids` tells the system which rule to validate for each auth
35
+ * context. Because multiple rules can exist for the same context type, the
36
+ * caller must explicitly select one per context rather than relying on
37
+ * auto-discovery. Each entry is aligned by index with the `auth_contexts`
38
+ * passed to `__check_auth`.
17
39
  *
18
- * The controller's epoch cannot play this role. It belongs to one
19
- * controller and does not exist while the account is unenrolled, so a
20
- * request scheduled unenrolled would survive enrolling recovery and
21
- * removing it again: the final state has no controller, just as at
22
- * scheduling.
40
+ * The length of `context_rule_ids` must equal the number of auth contexts;
41
+ * a mismatch is rejected with
42
+ * [`SmartAccountError::ContextRuleIdsLen
43
+ */
44
+ export interface AuthPayload {
45
+ /**
46
+ * Per-context rule IDs, aligned by index with `auth_contexts`.
47
+ */
48
+ context_rule_ids: Array<u32>;
49
+ /**
50
+ * Signature data mapped to each signer.
51
+ */
52
+ signers: Map<Signer, Buffer>;
53
+ }
54
+ /**
55
+ * A complete context rule defining authorization requirements.
56
+ */
57
+ export interface ContextRule {
58
+ /**
59
+ * The type of context this rule applies to.
60
+ */
61
+ context_type: ContextRuleType;
62
+ /**
63
+ * Unique identifier for the context rule.
64
+ */
65
+ id: u32;
66
+ /**
67
+ * Human-readable name for the context rule.
68
+ */
69
+ name: string;
70
+ /**
71
+ * List of policy contracts that must be satisfied.
72
+ */
73
+ policies: Array<string>;
74
+ /**
75
+ * Global registry IDs for each policy, positionally aligned with
76
+ * `policies`.
77
+ */
78
+ policy_ids: Array<u32>;
79
+ /**
80
+ * Global registry IDs for each signer, positionally aligned with
81
+ * `signers`.
82
+ */
83
+ signer_ids: Array<u32>;
84
+ /**
85
+ * List of signers authorized by this rule.
86
+ */
87
+ signers: Array<Signer>;
88
+ /**
89
+ * Optional expiration ledger sequence for the rule.
90
+ */
91
+ valid_until: Option<u32>;
92
+ }
93
+ /**
94
+ * Types of contexts that can be authorized by smart account rules.
95
+ */
96
+ export type ContextRuleType = {
97
+ tag: "Default";
98
+ values: void;
99
+ } | {
100
+ tag: "CallContract";
101
+ values: readonly [string];
102
+ } | {
103
+ tag: "CreateContract";
104
+ values: readonly [Buffer];
105
+ } | {
106
+ tag: "CreateContractExternalRef";
107
+ values: readonly [string, string];
108
+ };
109
+ /**
110
+ * Error codes for smart account operations.
111
+ */
112
+ export declare const SmartAccountError: {
113
+ /**
114
+ * The specified context rule does not exist.
115
+ */
116
+ 3000: {
117
+ message: string;
118
+ };
119
+ /**
120
+ * The provided context cannot be validated against any rule.
121
+ */
122
+ 3002: {
123
+ message: string;
124
+ };
125
+ /**
126
+ * External signature verification failed.
127
+ */
128
+ 3003: {
129
+ message: string;
130
+ };
131
+ /**
132
+ * context_rule_ids length does not match auth_contexts length.
133
+ */
134
+ 3014: {
135
+ message: string;
136
+ };
137
+ /**
138
+ * A signer in `AuthPayload` is not part of any selected context rule.
139
+ */
140
+ 3016: {
141
+ message: string;
142
+ };
143
+ };
144
+ /**
145
+ * A pending account upgrade.
23
146
  */
24
147
  export interface UpgradeRequest {
25
148
  /**
26
- * The adopted controller's epoch when scheduled, if a controller was
27
- * adopted. Passed back as `UpgradeStep::Execute` so the controller can
28
- * check it too.
149
+ * The adopted controller's epoch when scheduled, if any.
29
150
  */
30
151
  controller_epoch: Option<u64>;
31
152
  /**
@@ -46,8 +167,85 @@ export interface UpgradeRequest {
46
167
  wasm_hash: Buffer;
47
168
  }
48
169
  /**
49
- * The shared infra an account resolves, pinned when it was built (see
50
- * [`infra`]): what a deployment check compares with its manifest.
170
+ * `rule_eval::Cap`: its limit, its period in ledgers, and the argument
171
+ * holding the amount.
172
+ */
173
+ export type StoredCap = readonly [i128, u32, u32];
174
+ /**
175
+ * `rule_eval::Val`.
176
+ */
177
+ export type StoredVal = {
178
+ tag: "I128";
179
+ values: readonly [i128];
180
+ } | {
181
+ tag: "U64";
182
+ values: readonly [u64];
183
+ } | {
184
+ tag: "Bool";
185
+ values: readonly [boolean];
186
+ } | {
187
+ tag: "Bytes";
188
+ values: readonly [Buffer];
189
+ } | {
190
+ tag: "Address";
191
+ values: readonly [string];
192
+ } | {
193
+ tag: "Symbol";
194
+ values: readonly [string];
195
+ } | {
196
+ tag: "String";
197
+ values: readonly [string];
198
+ } | {
199
+ tag: "Other";
200
+ values: readonly [Buffer];
201
+ };
202
+ /**
203
+ * `rule_eval::Cond`. An `ArgIn` holds its values as strings, the one form
204
+ * a document's `string-in` lowers to: [`StoredCond::from_cond`] refuses an
205
+ * `ArgIn` of any other value.
206
+ */
207
+ export type StoredCond = {
208
+ tag: "ArgEq";
209
+ values: readonly [u32, StoredVal];
210
+ } | {
211
+ tag: "ArgI128AtMost";
212
+ values: readonly [u32, i128];
213
+ } | {
214
+ tag: "ArgIn";
215
+ values: readonly [u32, Array<string>];
216
+ } | {
217
+ tag: "ArgStrPrefix";
218
+ values: readonly [u32, string];
219
+ };
220
+ /**
221
+ * `rule_eval::Rule`, as a tuple of its fields in this order: its contract,
222
+ * functions, conditions, signers, threshold, cap (zero or one: a
223
+ * `#[contracttype]` has no `Option` of a `#[contracttype]` struct), last
224
+ * ledger, grant generation, and exact root (a singleton when it has one).
225
+ * Its signers are positions in the signer table of the record that holds
226
+ * it ([`StoredRule::from_rule`], [`StoredRule::to_rule`]). The accessors
227
+ * name the fields.
228
+ */
229
+ export type StoredRule = readonly [string, StoredFunctions, Array<StoredCond>, Array<u32>, u32, Array<StoredCap>, Option<u32>, Option<u64>, Option<Array<StoredAuthRoot>>];
230
+ /**
231
+ * Exact authorization-entry root in host form.
232
+ */
233
+ export interface StoredAuthRoot {
234
+ contract: string;
235
+ function: string;
236
+ }
237
+ /**
238
+ * `rule_eval::Functions`.
239
+ */
240
+ export type StoredFunctions = {
241
+ tag: "AnyExcept";
242
+ values: readonly [Array<string>];
243
+ } | {
244
+ tag: "Only";
245
+ values: readonly [Array<string>];
246
+ };
247
+ /**
248
+ * The shared infra contracts this account pins at build time.
51
249
  */
52
250
  export interface InfraPins {
53
251
  doc_compiler: string;
@@ -55,79 +253,498 @@ export interface InfraPins {
55
253
  spending_limit: string;
56
254
  }
57
255
  /**
58
- * The `Protected` freeze, mirrored from the adopted controller through
59
- * [`PerchSmartAccount::rcv_gate`]: while `ledger < until`, the account
60
- * authorizes nothing but `attempt_id`'s completion.
256
+ * The `Protected` freeze: while `ledger < until`, the account authorizes
257
+ * only `attempt_id`'s completion.
61
258
  */
62
259
  export interface FreezeGate {
260
+ /**
261
+ * The authorized attempt.
262
+ */
63
263
  attempt_id: u64;
64
264
  /**
65
- * The authorized attempt's `expires_at`.
66
- */
67
- until: u32;
68
- }
265
+ * The authorized attempt's `expires_at`.
266
+ */
267
+ until: u32;
268
+ }
269
+ /**
270
+ * A grant document as applied.
271
+ */
272
+ export interface GrantRecord {
273
+ /**
274
+ * Its canonical `doc_hash`.
275
+ */
276
+ doc_hash: Buffer;
277
+ /**
278
+ * The grant generation it was applied under; wiped once
279
+ * `grant_generation` moves past it.
280
+ */
281
+ gen: u64;
282
+ /**
283
+ * Every context rule it installed, with its id.
284
+ */
285
+ rules: Array<InstalledRule>;
286
+ }
287
+ /**
288
+ * Everything the account's entry points can refuse. Compiler and controller failures flatten in via `#[from_contract_client]`, converted by `??`.
289
+ */
290
+ export declare const PerchAccountError: {
291
+ /**
292
+ * The document keeps no constraint-free, never-expiring self-admin rule with a signer (anti-brick).
293
+ */
294
+ 1: {
295
+ message: string;
296
+ };
297
+ /**
298
+ * The document names a revoked credential.
299
+ */
300
+ 2: {
301
+ message: string;
302
+ };
303
+ /**
304
+ * The document reuses a ZK enrollment id this account enrolled before.
305
+ */
306
+ 3: {
307
+ message: string;
308
+ };
309
+ /**
310
+ * The document changes the ZK factor without a new enrollment id.
311
+ */
312
+ 4: {
313
+ message: string;
314
+ };
315
+ /**
316
+ * `execute` was asked to call an invoker-only hook.
317
+ */
318
+ 5: {
319
+ message: string;
320
+ };
321
+ /**
322
+ * The account has no adopted recovery controller.
323
+ */
324
+ 6: {
325
+ message: string;
326
+ };
327
+ /**
328
+ * No upgrade is scheduled.
329
+ */
330
+ 7: {
331
+ message: string;
332
+ };
333
+ /**
334
+ * The request id is not the pending upgrade's.
335
+ */
336
+ 8: {
337
+ message: string;
338
+ };
339
+ /**
340
+ * The upgrade delay has not elapsed.
341
+ */
342
+ 9: {
343
+ message: string;
344
+ };
345
+ /**
346
+ * A ledger computation overflowed `u32`.
347
+ */
348
+ 10: {
349
+ message: string;
350
+ };
351
+ /**
352
+ * A completion returned a credential that cannot be fingerprinted.
353
+ */
354
+ 11: {
355
+ message: string;
356
+ };
357
+ /**
358
+ * The recovery generation moved since scheduling; the request can never execute.
359
+ */
360
+ 12: {
361
+ message: string;
362
+ };
363
+ /**
364
+ * The submitted document bytes are not UTF-8.
365
+ */
366
+ 13: {
367
+ message: string;
368
+ };
369
+ /**
370
+ * The document failed fail-closed parsing (unknown field, bad shape, unsupported version, duplicate key, …).
371
+ */
372
+ 14: {
373
+ message: string;
374
+ };
375
+ /**
376
+ * The document failed semantic validation (dangling signer ref, malformed address or key, ambiguous empty list, …) or names its verifiers as the compiler does not take.
377
+ */
378
+ 15: {
379
+ message: string;
380
+ };
381
+ /**
382
+ * The document names no network, or a network that is not this chain.
383
+ */
384
+ 16: {
385
+ message: string;
386
+ };
387
+ /**
388
+ * The document cannot be lowered to rules: a rule with self-authenticating principals, or too many constraints.
389
+ */
390
+ 17: {
391
+ message: string;
392
+ };
393
+ /**
394
+ * The document exceeds a cap on signers, rules, bytes, or name length.
395
+ */
396
+ 18: {
397
+ message: string;
398
+ };
399
+ /**
400
+ * A signer's external `key` is not its verifier-canonical form.
401
+ */
402
+ 19: {
403
+ message: string;
404
+ };
405
+ /**
406
+ * `derive_target`: the current document enrolls no recovery.
407
+ */
408
+ 20: {
409
+ message: string;
410
+ };
411
+ /**
412
+ * `derive_target`: the replacement set breaks spec §7.3 rules 1-3, or the action is not a recovery attempt.
413
+ */
414
+ 21: {
415
+ message: string;
416
+ };
417
+ /**
418
+ * `derive_target`: the ZK enrollment is missing, unexpected, or reuses the enrolled id.
419
+ */
420
+ 22: {
421
+ message: string;
422
+ };
423
+ /**
424
+ * `derive_target`: the target has no constraint-free self-admin rule with a signer (the anti-brick check).
425
+ */
426
+ 23: {
427
+ message: string;
428
+ };
429
+ /**
430
+ * No configuration is enrolled for this account at this controller.
431
+ */
432
+ 24: {
433
+ message: string;
434
+ };
435
+ /**
436
+ * An attempt is authorized and live, which blocks begin, policy changes, and upgrades.
437
+ */
438
+ 25: {
439
+ message: string;
440
+ };
441
+ /**
442
+ * No attempt with this id exists for the account.
443
+ */
444
+ 26: {
445
+ message: string;
446
+ };
447
+ /**
448
+ * The attempt is terminal, expired, from an older epoch, or invalidated by a sibling's authorization.
449
+ */
450
+ 27: {
451
+ message: string;
452
+ };
453
+ /**
454
+ * Initiation evidence for an attempt that is no longer collecting.
455
+ */
456
+ 28: {
457
+ message: string;
458
+ };
459
+ /**
460
+ * Completion before `executable_after`.
461
+ */
462
+ 29: {
463
+ message: string;
464
+ };
465
+ /**
466
+ * The completion context, or the compiled document hash, does not match the authorized attempt's target.
467
+ */
468
+ 30: {
469
+ message: string;
470
+ };
471
+ /**
472
+ * The address is not an enrolled guardian.
473
+ */
474
+ 31: {
475
+ message: string;
476
+ };
477
+ /**
478
+ * This guardian or factor already counted for this statement.
479
+ */
480
+ 32: {
481
+ message: string;
482
+ };
483
+ /**
484
+ * The enrolled mode has no guardian factor.
485
+ */
486
+ 33: {
487
+ message: string;
488
+ };
489
+ /**
490
+ * The enrolled mode has no ZK factor.
491
+ */
492
+ 34: {
493
+ message: string;
494
+ };
495
+ /**
496
+ * The adapter refused the proof (its `ZkAdapterError` says why).
497
+ */
498
+ 35: {
499
+ message: string;
500
+ };
501
+ /**
502
+ * The proof's nullifier is spent.
503
+ */
504
+ 36: {
505
+ message: string;
506
+ };
507
+ /**
508
+ * The statement's freshness bound has passed or reaches too far.
509
+ */
510
+ 37: {
511
+ message: string;
512
+ };
513
+ /**
514
+ * The statement cannot be encoded (a non-contract account or controller).
515
+ */
516
+ 38: {
517
+ message: string;
518
+ };
519
+ /**
520
+ * Recorded approvals do not satisfy the enrolled condition for this reconfiguration or upgrade.
521
+ */
522
+ 39: {
523
+ message: string;
524
+ };
525
+ /**
526
+ * The account's `max-cancels` is used up.
527
+ */
528
+ 40: {
529
+ message: string;
530
+ };
531
+ /**
532
+ * Owner cancellation is only available under `Loss`.
533
+ */
534
+ 41: {
535
+ message: string;
536
+ };
537
+ /**
538
+ * The replacement set breaks a §7.3 rule, or derivation refused it.
539
+ */
540
+ 42: {
541
+ message: string;
542
+ };
543
+ /**
544
+ * The target or a replacement contains a revoked credential.
545
+ */
546
+ 43: {
547
+ message: string;
548
+ };
549
+ /**
550
+ * The ZK enrollment id was enrolled for this account before.
551
+ */
552
+ 44: {
553
+ message: string;
554
+ };
555
+ /**
556
+ * Compromise recovery with no baseline enrolled.
557
+ */
558
+ 45: {
559
+ message: string;
560
+ };
561
+ /**
562
+ * Compromise recovery before the baseline's content was published.
563
+ */
564
+ 46: {
565
+ message: string;
566
+ };
567
+ /**
568
+ * The published document does not hash to the enrolled baseline.
569
+ */
570
+ 47: {
571
+ message: string;
572
+ };
573
+ /**
574
+ * The adapter's circuit id or tree depth does not match the enrolled factor and pool.
575
+ */
576
+ 48: {
577
+ message: string;
578
+ };
579
+ /**
580
+ * The ZK factor changed without a new enrollment id.
581
+ */
582
+ 49: {
583
+ message: string;
584
+ };
585
+ /**
586
+ * The configuration is malformed.
587
+ */
588
+ 50: {
589
+ message: string;
590
+ };
591
+ /**
592
+ * An upgrade request recorded under an older epoch.
593
+ */
594
+ 51: {
595
+ message: string;
596
+ };
597
+ /**
598
+ * A ledger-sequence computation overflowed `u32`.
599
+ */
600
+ 52: {
601
+ message: string;
602
+ };
603
+ /**
604
+ * A hook was called for a recovery rule of the wrong shape.
605
+ */
606
+ 53: {
607
+ message: string;
608
+ };
609
+ /**
610
+ * The target keeps a credential the replacement set replaces.
611
+ */
612
+ 54: {
613
+ message: string;
614
+ };
615
+ /**
616
+ * The account is not at `apply_doc`'s `expected_revision`.
617
+ */
618
+ 55: {
619
+ message: string;
620
+ };
621
+ /**
622
+ * A completed recovery would overflow the grant generation.
623
+ */
624
+ 56: {
625
+ message: string;
626
+ };
627
+ /**
628
+ * A grant document has a `recovery` member, a self-admin rule, a rule on the account or its recovery contracts, a guardian approval, or a token-admin function.
629
+ */
630
+ 57: {
631
+ message: string;
632
+ };
633
+ /**
634
+ * No grant document has this grant id.
635
+ */
636
+ 58: {
637
+ message: string;
638
+ };
639
+ /**
640
+ * `gc_grant` was given a live grant; `remove_grant` removes it.
641
+ */
642
+ 59: {
643
+ message: string;
644
+ };
645
+ /**
646
+ * The document names a credential from a grant a recovery has wiped.
647
+ */
648
+ 60: {
649
+ message: string;
650
+ };
651
+ /**
652
+ * The compiled document's model is missing, duplicated, unreadable, or does not match its rules.
653
+ */
654
+ 61: {
655
+ message: string;
656
+ };
657
+ /**
658
+ * A rule other than the recovery rule asks for no signer (INV-1).
659
+ */
660
+ 62: {
661
+ message: string;
662
+ };
663
+ /**
664
+ * A grant document is not in normal form, or has a rule already expired.
665
+ */
666
+ 63: {
667
+ message: string;
668
+ };
669
+ /**
670
+ * A constructor admin signer's verifier is not one `perch/verifiers` deployed.
671
+ */
672
+ 64: {
673
+ message: string;
674
+ };
675
+ /**
676
+ * Cross-contract call aborted
677
+ */
678
+ 0: {
679
+ message: string;
680
+ };
681
+ /**
682
+ * Unknown error from cross-contract call
683
+ */
684
+ 2147483647: {
685
+ message: string;
686
+ };
687
+ };
69
688
  /**
70
- * Constants of the deployed account wasm a wallet checks before it builds
71
- * anything for this account: what [`PerchSmartAccount::capabilities`]
72
- * returns.
689
+ * Constants of this wasm a wallet checks before building for the account.
73
690
  */
74
691
  export interface AccountCapabilities {
75
692
  /**
76
- * How a document is applied: `one_tx`, one `apply_doc` transaction.
693
+ * `one_tx` (account document) and `grant_v1` (grant documents).
77
694
  */
78
695
  apply_modes: Array<string>;
79
696
  /**
80
- * What a signer signs: `addr_oz_v1`, OZ's
81
- * `sha256(bound_payload || context_rule_ids.to_xdr())`, where
82
- * `bound_payload = sha256(AUTH_ADDR_DOMAIN || account_id ||
83
- * signature_payload)` binds the account's own address so a signature
84
- * cannot be replayed on another account ([`AUTH_ADDR_DOMAIN`]). The
85
- * earlier `oz_rule_ids` scheme omitted the account address; a client
86
- * reads this symbol to tell which digest an account expects.
697
+ * What signers sign: `addr_oz_v1`, bound to the account's address.
87
698
  */
88
699
  auth_digest: string;
89
700
  /**
90
- * How the applied `doc_hash` is computed: `canon_v1`, `sha256` of the
91
- * CANON v1 canonical bytes.
701
+ * How `doc_hash` is computed: `canon_v1`.
92
702
  */
93
703
  doc_identity: string;
94
704
  /**
95
- * [`INTERFACE_VERSION`].
705
+ * The interface version.
96
706
  */
97
707
  interface_version: u32;
98
708
  /**
99
- * [`SNAPSHOT_VERSION`].
709
+ * The `AccountConfiguration` layout version.
100
710
  */
101
711
  snapshot_version: u32;
102
712
  }
103
713
  /**
104
- * Everything rule selection and signing need, read at one ledger: what
105
- * [`PerchSmartAccount::configuration`] returns.
714
+ * What rule selection and signing need for the account document, read at one
715
+ * ledger.
106
716
  */
107
717
  export interface AccountConfiguration {
108
718
  /**
109
- * The applied document's `doc_hash`, or `None` before the first apply.
719
+ * The applied document's `doc_hash`, if any.
110
720
  */
111
721
  doc_hash: Option<Buffer>;
112
722
  /**
113
- * The `Protected` freeze: zero or one entries (a `Vec` because
114
- * `#[contracttype]` has no conversion for `Option` of a custom struct).
115
- * It is in force while the ledger is below its `until`.
723
+ * The `Protected` freeze: zero or one entries.
116
724
  */
117
725
  gate: Array<FreezeGate>;
726
+ /**
727
+ * The shared infra the account pins.
728
+ */
118
729
  infra: InfraPins;
730
+ /**
731
+ * The adopted recovery controller, if any.
732
+ */
119
733
  recovery_controller: Option<string>;
734
+ /**
735
+ * The recovery generation.
736
+ */
120
737
  recovery_generation: u64;
121
738
  /**
122
- * The zero-signer recovery rule's OZ id, if one is installed.
739
+ * The recovery rule's id, if installed.
123
740
  */
124
741
  recovery_rule: Option<u32>;
125
742
  /**
126
- * The configuration revision every other field belongs to.
743
+ * The revision every other field belongs to.
127
744
  */
128
745
  revision: u64;
129
746
  /**
130
- * Every installed context rule, with its OZ id.
747
+ * Every installed admin context rule, with its id.
131
748
  */
132
749
  rules: Array<InstalledRule>;
133
750
  }
@@ -135,20 +752,37 @@ export interface AccountConfiguration {
135
752
  * One context rule as the account installed it.
136
753
  */
137
754
  export interface InstalledRule {
755
+ /**
756
+ * Exact root of this account's authorization entry, if constrained.
757
+ */
758
+ auth_root: Option<Array<StoredAuthRoot>>;
759
+ /**
760
+ * The contract the rule authorizes calls to.
761
+ */
138
762
  context_type: ContextRuleType;
139
763
  /**
140
- * The OZ context-rule id.
764
+ * The rule id.
141
765
  */
142
766
  id: u32;
767
+ /**
768
+ * The rule's name.
769
+ */
143
770
  name: string;
771
+ /**
772
+ * The policies attached to the rule.
773
+ */
144
774
  policies: Array<InstalledPolicy>;
145
775
  /**
146
- * The zero-signer recovery rule. Document rules are matched by name;
147
- * the recovery rule by this flag, so a document rule that happens to be
148
- * named `recovery` is never confused with it.
776
+ * Whether this is the zero-signer recovery rule.
149
777
  */
150
778
  recovery: boolean;
779
+ /**
780
+ * The rule's signers.
781
+ */
151
782
  signers: Array<Signer>;
783
+ /**
784
+ * The inclusive last valid ledger, if bounded.
785
+ */
152
786
  valid_until: Option<u32>;
153
787
  }
154
788
  /**
@@ -156,13 +790,35 @@ export interface InstalledRule {
156
790
  */
157
791
  export interface InstalledPolicy {
158
792
  /**
159
- * `sha256` of the install parameters' XDR. A policy whose parameters
160
- * change is uninstalled and installed again; one whose parameters are
161
- * unchanged is left alone.
793
+ * `sha256` of the install parameters' XDR.
162
794
  */
163
795
  params: Buffer;
796
+ /**
797
+ * The policy contract.
798
+ */
164
799
  policy: string;
165
800
  }
801
+ /**
802
+ * Contract executable used for creating a new contract and used in
803
+ * `CreateContractHostFnContext`.
804
+ */
805
+ export type ContractExecutable = {
806
+ tag: "Wasm";
807
+ values: readonly [Buffer];
808
+ } | {
809
+ tag: "ExternalRef";
810
+ values: readonly [ContractExecutableRef];
811
+ };
812
+ /**
813
+ * Executable referenced via a persistent storage entry owned by a contract,
814
+ * either this contract or another contract.
815
+ *
816
+ * The persistent storage entry owned by the `owner` has the `tag` as its key.
817
+ */
818
+ export interface ContractExecutableRef {
819
+ owner: string;
820
+ tag: string;
821
+ }
166
822
  /**
167
823
  * Context of a single authorized call performed by an address.
168
824
  *
@@ -191,14 +847,6 @@ export interface ContractContext {
191
847
  contract: string;
192
848
  fn_name: string;
193
849
  }
194
- /**
195
- * Contract executable used for creating a new contract and used in
196
- * `CreateContractHostFnContext`.
197
- */
198
- export type ContractExecutable = {
199
- tag: "Wasm";
200
- values: readonly [Buffer];
201
- };
202
850
  /**
203
851
  * Authorization context for `create_contract` host function that creates a
204
852
  * new contract on behalf of authorizer address.
@@ -218,204 +866,14 @@ export interface CreateContractWithConstructorHostFnContext {
218
866
  executable: ContractExecutable;
219
867
  salt: Buffer;
220
868
  }
221
- /**
222
- * Error codes for smart account operations.
223
- */
224
- export declare const SmartAccountError: {
225
- /**
226
- * The specified context rule does not exist.
227
- */
228
- 3000: {
229
- message: string;
230
- };
231
- /**
232
- * The provided context cannot be validated against any rule.
233
- */
234
- 3002: {
235
- message: string;
236
- };
237
- /**
238
- * External signature verification failed.
239
- */
240
- 3003: {
241
- message: string;
242
- };
243
- /**
244
- * Context rule must have at least one signer or policy.
245
- */
246
- 3004: {
247
- message: string;
248
- };
249
- /**
250
- * The valid_until timestamp is in the past.
251
- */
252
- 3005: {
253
- message: string;
254
- };
255
- /**
256
- * The specified signer was not found.
257
- */
258
- 3006: {
259
- message: string;
260
- };
261
- /**
262
- * The signer already exists in the context rule.
263
- */
264
- 3007: {
265
- message: string;
266
- };
267
- /**
268
- * The specified policy was not found.
269
- */
270
- 3008: {
271
- message: string;
272
- };
273
- /**
274
- * The policy already exists in the context rule.
275
- */
276
- 3009: {
277
- message: string;
278
- };
279
- /**
280
- * Too many signers in the context rule.
281
- */
282
- 3010: {
283
- message: string;
284
- };
285
- /**
286
- * Too many policies in the context rule.
287
- */
288
- 3011: {
289
- message: string;
290
- };
291
- /**
292
- * An internal ID counter (context rule, signer, or policy) has reached
293
- * its maximum value (`u32::MAX`) and cannot be incremented further.
294
- */
295
- 3012: {
296
- message: string;
297
- };
298
- /**
299
- * External signer key data exceeds the maximum allowed size.
300
- */
301
- 3013: {
302
- message: string;
303
- };
304
- /**
305
- * context_rule_ids length does not match auth_contexts length.
306
- */
307
- 3014: {
308
- message: string;
309
- };
310
- /**
311
- * Context rule name exceeds the maximum allowed length.
312
- */
313
- 3015: {
314
- message: string;
315
- };
869
+ export interface Client {
316
870
  /**
317
- * A signer in `AuthPayload` is not part of any selected context rule.
871
+ * Construct and simulate a grant 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.
872
+ * The grant document under `grant` as applied, if any.
318
873
  */
319
- 3016: {
320
- message: string;
321
- };
322
- };
323
- /**
324
- * Represents different types of signers in the smart account system.
325
- */
326
- export type Signer = {
327
- tag: "Delegated";
328
- values: readonly [string];
329
- } | {
330
- tag: "External";
331
- values: readonly [string, Buffer];
332
- };
333
- /**
334
- * The authorization payload passed to `__check_auth`, bundling cryptographic
335
- * proofs with context rule selection.
336
- *
337
- * This struct carries two distinct pieces of information that are both
338
- * required for authorization but cannot be derived from each other:
339
- *
340
- * - `signers` maps each [`Signer`] to its raw signature bytes, providing
341
- * cryptographic proof that the signer actually signed the transaction
342
- * payload. A context rule stores which signer *identities* are authorized
343
- * (via `signer_ids`), but the rule does not contain the signatures
344
- * themselves — those must be supplied here.
345
- *
346
- * - `context_rule_ids` tells the system which rule to validate for each auth
347
- * context. Because multiple rules can exist for the same context type, the
348
- * caller must explicitly select one per context rather than relying on
349
- * auto-discovery. Each entry is aligned by index with the `auth_contexts`
350
- * passed to `__check_auth`.
351
- *
352
- * The length of `context_rule_ids` must equal the number of auth contexts;
353
- * a mismatch is rejected with
354
- * [`SmartAccountError::ContextRuleIdsLen
355
- */
356
- export interface AuthPayload {
357
- /**
358
- * Per-context rule IDs, aligned by index with `auth_contexts`.
359
- */
360
- context_rule_ids: Array<u32>;
361
- /**
362
- * Signature data mapped to each signer.
363
- */
364
- signers: Map<Signer, Buffer>;
365
- }
366
- /**
367
- * A complete context rule defining authorization requirements.
368
- */
369
- export interface ContextRule {
370
- /**
371
- * The type of context this rule applies to.
372
- */
373
- context_type: ContextRuleType;
374
- /**
375
- * Unique identifier for the context rule.
376
- */
377
- id: u32;
378
- /**
379
- * Human-readable name for the context rule.
380
- */
381
- name: string;
382
- /**
383
- * List of policy contracts that must be satisfied.
384
- */
385
- policies: Array<string>;
386
- /**
387
- * Global registry IDs for each policy, positionally aligned with
388
- * `policies`.
389
- */
390
- policy_ids: Array<u32>;
391
- /**
392
- * Global registry IDs for each signer, positionally aligned with
393
- * `signers`.
394
- */
395
- signer_ids: Array<u32>;
396
- /**
397
- * List of signers authorized by this rule.
398
- */
399
- signers: Array<Signer>;
400
- /**
401
- * Optional expiration ledger sequence for the rule.
402
- */
403
- valid_until: Option<u32>;
404
- }
405
- /**
406
- * Types of contexts that can be authorized by smart account rules.
407
- */
408
- export type ContextRuleType = {
409
- tag: "Default";
410
- values: void;
411
- } | {
412
- tag: "CallContract";
413
- values: readonly [string];
414
- } | {
415
- tag: "CreateContract";
416
- values: readonly [Buffer];
417
- };
418
- export interface Client {
874
+ grant: ({ grant }: {
875
+ grant: u32;
876
+ }, options?: MethodOptions) => Promise<AssembledTransaction<Option<GrantRecord>>>;
419
877
  /**
420
878
  * Construct and simulate a infra 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.
421
879
  * Every shared contract this account pins at build time.
@@ -423,22 +881,26 @@ export interface Client {
423
881
  infra: (options?: MethodOptions) => Promise<AssembledTransaction<InfraPins>>;
424
882
  /**
425
883
  * Construct and simulate a renew 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.
426
- * Extend the account's instance, applied document, and the named
427
- * revoked-set and enrolled-id entries to the network maximum.
428
- * Permissionless; changes no meaning.
884
+ * Extend the account's instance, document, and the named revoked and
885
+ * enrolled entries to the maximum TTL. Permissionless.
429
886
  */
430
887
  renew: ({ fingerprints, enrollment_ids }: {
431
888
  fingerprints: Array<Buffer>;
432
889
  enrollment_ids: Array<Buffer>;
433
890
  }, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
891
+ /**
892
+ * Construct and simulate a grants 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.
893
+ * The grant ids at index positions `start..start + count`, wiped ones
894
+ * included.
895
+ */
896
+ grants: ({ start, count }: {
897
+ start: u32;
898
+ count: u32;
899
+ }, options?: MethodOptions) => Promise<AssembledTransaction<Array<u32>>>;
434
900
  /**
435
901
  * Construct and simulate a execute 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.
436
- * Call `target_fn` on `target` as this account (the account becomes
437
- * the invoker, so `target`'s `require_auth` of this account passes).
438
- * Requires the account's authorization of this exact call. Refuses the
439
- * invoker-only hook names: otherwise whoever can authorize `execute`
440
- * could reach a controller, policy, or pool hook as the account
441
- * (spec §15).
902
+ * Call `target_fn` on `target` as this account. Owner authorization;
903
+ * refuses invoker-only hooks.
442
904
  */
443
905
  execute: ({ target, target_fn, target_args }: {
444
906
  target: string;
@@ -447,18 +909,22 @@ export interface Client {
447
909
  }, options?: MethodOptions) => Promise<AssembledTransaction<Result<any>>>;
448
910
  /**
449
911
  * Construct and simulate a document 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.
450
- * The applied document's canonical bytes with the revision they belong
451
- * to; `None` before the first `apply_doc`.
912
+ * The applied account document's canonical bytes, with the revision they
913
+ * belong to.
452
914
  */
453
915
  document: (options?: MethodOptions) => Promise<AssembledTransaction<readonly [u64, Option<Buffer>]>>;
916
+ /**
917
+ * Construct and simulate a gc_grant 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.
918
+ * Remove a grant document a recovery wiped, and its rules.
919
+ * Permissionless.
920
+ */
921
+ gc_grant: ({ grant }: {
922
+ grant: u32;
923
+ }, options?: MethodOptions) => Promise<AssembledTransaction<Result<void>>>;
454
924
  /**
455
925
  * Construct and simulate a rcv_gate 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.
456
- * Invoker-only: the adopted controller sets (`frozen_until > 0`) or
457
- * clears (`0`) the `Protected` freeze for `attempt_id`. The account
458
- * mirrors the freeze rather than asking the controller from
459
- * `__check_auth`, because an account approving as a guardian through
460
- * the same controller instance runs `__check_auth` while that
461
- * controller is on the call stack, and the host refuses re-entry.
926
+ * Invoker-only: the adopted controller sets (`frozen_until > 0`) or clears
927
+ * (`0`) the `Protected` freeze.
462
928
  */
463
929
  rcv_gate: ({ attempt_id, frozen_until }: {
464
930
  attempt_id: u64;
@@ -466,34 +932,22 @@ export interface Client {
466
932
  }, options?: MethodOptions) => Promise<AssembledTransaction<Result<void>>>;
467
933
  /**
468
934
  * Construct and simulate a revision 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.
469
- * The configuration revision: 0 after the constructor, advanced by one
470
- * in every successful `apply_doc` (whatever it changes, a re-apply of
471
- * the same document included) and every executed upgrade. Freeze
472
- * changes, recovery attempts, evidence, and cancellations do not
473
- * advance it. Never decreases and never repeats, so unlike `doc_hash` it
474
- * tells A -> B -> A apart.
935
+ * The configuration revision: advanced by every `apply_doc` and executed
936
+ * upgrade; never repeats.
475
937
  */
476
938
  revision: (options?: MethodOptions) => Promise<AssembledTransaction<u64>>;
939
+ /**
940
+ * Construct and simulate a rule_set 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.
941
+ * The rule-eval rules `__check_auth` evaluates, aligned with
942
+ * `installed_rules`, their signers positions in `rule_signers`.
943
+ */
944
+ rule_set: (options?: MethodOptions) => Promise<AssembledTransaction<Array<StoredRule>>>;
477
945
  /**
478
946
  * Construct and simulate a apply_doc 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.
479
- * Apply a policy document — **the only way authorization changes**.
480
- * The two shared, immutable infra contracts (the stateless doc compiler
481
- * and the interpreter) are derived from the build-time-pinned
482
- * [`stateless_registry`] (see [`infra`]), never passed in. Brings the
483
- * installed rules to the document in one invocation, changing only the
484
- * rules that differ, and returns the canonical `doc_hash`.
485
- *
486
- * Authorized by the owner (any ordinary rule scoped to the account),
487
- * or, for a recovery completion only, by the zero-signer recovery rule
488
- * whose controller checks the exact target. On an account with an
489
- * adopted controller, the controller's `rcv_sync` classifies the call
490
- * before any rule changes and refuses what the profile does not allow
491
- * (`docs/recovery/spec.md` §10). `approval_valid_until` is the
492
- * freshness bound a `Protected` reconfiguration's recorded approvals
493
- * were given for; it is ignored otherwise.
494
- *
495
- * With `expected_revision`, the call refuses with `StaleRevision`
496
- * unless the account is still at that [`Self::revision`], so a
947
+ * Apply the account document and return its `doc_hash`. Owner
948
+ * authorization, or the recovery rule for a completion. Refuses
949
+ * `StaleRevision` unless the account is at `expected_revision`, if given.
950
+ * `approval_valid_until` bounds a `Protected` reconfiguration's approvals.
497
951
  */
498
952
  apply_doc: ({ doc_json, approval_valid_until, expected_revision }: {
499
953
  doc_json: Buffer;
@@ -509,16 +963,27 @@ export interface Client {
509
963
  }, options?: MethodOptions) => Promise<AssembledTransaction<boolean>>;
510
964
  /**
511
965
  * Construct and simulate a applied_doc 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.
512
- * The applied document's canonical bytes, or `None` before the first
513
- * `apply_doc`. Under CANON v1, `sha256` of them is
514
- * [`Self::applied_doc_hash`].
966
+ * The applied account document's canonical bytes, if any.
515
967
  */
516
968
  applied_doc: (options?: MethodOptions) => Promise<AssembledTransaction<Option<Buffer>>>;
969
+ /**
970
+ * Construct and simulate a apply_grant 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.
971
+ * Apply a grant document under `grant` and return its `doc_hash`. Owner
972
+ * authorization.
973
+ */
974
+ apply_grant: ({ grant, doc_json }: {
975
+ grant: u32;
976
+ doc_json: Buffer;
977
+ }, options?: MethodOptions) => Promise<AssembledTransaction<Result<Buffer>>>;
978
+ /**
979
+ * Construct and simulate a grant_count 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.
980
+ * How many grant ids have a record, wiped ones included.
981
+ */
982
+ grant_count: (options?: MethodOptions) => Promise<AssembledTransaction<u32>>;
517
983
  /**
518
984
  * Construct and simulate a capabilities 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.
519
- * Constants of this account's wasm: interface and snapshot versions,
520
- * the document identity and authorization digest schemes, and the apply
521
- * modes.
985
+ * Constants of this wasm: interface and snapshot versions, digest schemes,
986
+ * and apply modes.
522
987
  */
523
988
  capabilities: (options?: MethodOptions) => Promise<AssembledTransaction<AccountCapabilities>>;
524
989
  /**
@@ -526,16 +991,38 @@ export interface Client {
526
991
  * The doc compiler this account pins at build time.
527
992
  */
528
993
  doc_compiler: (options?: MethodOptions) => Promise<AssembledTransaction<string>>;
994
+ /**
995
+ * Construct and simulate a remove_grant 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.
996
+ * Remove the grant document under `grant` and its rules. Owner
997
+ * authorization.
998
+ */
999
+ remove_grant: ({ grant }: {
1000
+ grant: u32;
1001
+ }, options?: MethodOptions) => Promise<AssembledTransaction<Result<void>>>;
1002
+ /**
1003
+ * Construct and simulate a rule_signers 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.
1004
+ * The signer table of the account document's stored rules: each signer
1005
+ * once, at the position `rule_set` names it by.
1006
+ */
1007
+ rule_signers: (options?: MethodOptions) => Promise<AssembledTransaction<Array<Signer>>>;
529
1008
  /**
530
1009
  * Construct and simulate a configuration 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.
531
- * Everything rule selection and signing need, read at one ledger, with
532
- * the revision it belongs to.
1010
+ * The account document's configuration, read at one ledger.
533
1011
  */
534
1012
  configuration: (options?: MethodOptions) => Promise<AssembledTransaction<AccountConfiguration>>;
1013
+ /**
1014
+ * Construct and simulate a grant_signers 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.
1015
+ * The signer table of the grant document under `grant`, if any: each
1016
+ * signer once, at the position `grant_rule_set` names it by, in the
1017
+ * order its rules first name them.
1018
+ */
1019
+ grant_signers: ({ grant }: {
1020
+ grant: u32;
1021
+ }, options?: MethodOptions) => Promise<AssembledTransaction<Option<Array<Signer>>>>;
535
1022
  /**
536
1023
  * Construct and simulate a recovery_gate 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.
537
- * The `Protected` freeze, if one was set and has not been cleared. It
538
- * is in force while the current ledger is below `until`.
1024
+ * The `Protected` freeze, if set; in force while the ledger is below
1025
+ * `until`.
539
1026
  */
540
1027
  recovery_gate: (options?: MethodOptions) => Promise<AssembledTransaction<Option<FreezeGate>>>;
541
1028
  /**
@@ -543,6 +1030,14 @@ export interface Client {
543
1030
  * Cancel the pending upgrade. Owner authorization.
544
1031
  */
545
1032
  cancel_upgrade: (options?: MethodOptions) => Promise<AssembledTransaction<Result<void>>>;
1033
+ /**
1034
+ * Construct and simulate a grant_rule_set 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.
1035
+ * The rule-eval rules of the grant document under `grant`, aligned with
1036
+ * its record's rules, their signers positions in `grant_signers`.
1037
+ */
1038
+ grant_rule_set: ({ grant }: {
1039
+ grant: u32;
1040
+ }, options?: MethodOptions) => Promise<AssembledTransaction<Array<StoredRule>>>;
546
1041
  /**
547
1042
  * Construct and simulate a is_enrolled_id 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.
548
1043
  * Whether this account ever enrolled a ZK enrollment id.
@@ -552,34 +1047,23 @@ export interface Client {
552
1047
  }, options?: MethodOptions) => Promise<AssembledTransaction<boolean>>;
553
1048
  /**
554
1049
  * Construct and simulate a cancel_recovery 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.
555
- * A `Loss` owner's cancellation of a recovery attempt (spec T7). The
556
- * controller refuses it under `Protected`.
1050
+ * A `Loss` owner's cancellation of a recovery attempt.
557
1051
  */
558
1052
  cancel_recovery: ({ attempt_id }: {
559
1053
  attempt_id: u64;
560
1054
  }, options?: MethodOptions) => Promise<AssembledTransaction<Result<void>>>;
561
1055
  /**
562
1056
  * Construct and simulate a execute_upgrade 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.
563
- * Execute the pending upgrade once its delay has elapsed. Owner
564
- * authorization. If the recovery generation moved since scheduling
565
- * (any enrollment, reconfiguration, removal, controller switch,
566
- * completed recovery, or executed upgrade), the request is stale and
567
- * the call refuses with `StaleUpgrade`. The refusal leaves the request
568
- * in place, since a failed invocation keeps none of its writes; it can
569
- * never execute, because the generation never decreases, and stays
570
- * until `schedule_upgrade` replaces it, `cancel_upgrade` removes it, or
571
- * a completion clears it. Otherwise the controller, if one is adopted,
572
- * checks its epoch and bumps it (refusing during an authorized
573
- * attempt), the generation advances, and the Wasm is replaced after
574
- * this invocation.
1057
+ * Execute the pending upgrade once its delay has passed. Owner
1058
+ * authorization. Refuses `StaleUpgrade` if the recovery generation moved
1059
+ * since scheduling.
575
1060
  */
576
1061
  execute_upgrade: ({ request_id }: {
577
1062
  request_id: u64;
578
1063
  }, options?: MethodOptions) => Promise<AssembledTransaction<Result<void>>>;
579
1064
  /**
580
1065
  * Construct and simulate a installed_rules 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.
581
- * Every context rule the account has installed, with its OZ id. The
582
- * document's rules are matched against these by `apply_doc`.
1066
+ * Every context rule the account document installed, with its id.
583
1067
  */
584
1068
  installed_rules: (options?: MethodOptions) => Promise<AssembledTransaction<Array<InstalledRule>>>;
585
1069
  /**
@@ -589,27 +1073,35 @@ export interface Client {
589
1073
  pending_upgrade: (options?: MethodOptions) => Promise<AssembledTransaction<Option<UpgradeRequest>>>;
590
1074
  /**
591
1075
  * Construct and simulate a applied_doc_hash 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.
592
- * The canonical `doc_hash` of the currently applied policy document, or
593
- * `None` if only the constructor's admin rule exists. Anyone can check
594
- * installed == reviewed.
1076
+ * The applied account document's canonical `doc_hash`, if any.
595
1077
  */
596
1078
  applied_doc_hash: (options?: MethodOptions) => Promise<AssembledTransaction<Option<Buffer>>>;
597
1079
  /**
598
1080
  * Construct and simulate a get_context_rule 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.
599
- * See [`Self::get_context_rules_count`].
1081
+ * The context rule with this id; panics if there is none.
600
1082
  */
601
1083
  get_context_rule: ({ context_rule_id }: {
602
1084
  context_rule_id: u32;
603
1085
  }, options?: MethodOptions) => Promise<AssembledTransaction<ContextRule>>;
1086
+ /**
1087
+ * Construct and simulate a grant_generation 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.
1088
+ * The grant generation: advanced only by completed recoveries. A grant
1089
+ * applied under another is wiped.
1090
+ */
1091
+ grant_generation: (options?: MethodOptions) => Promise<AssembledTransaction<u64>>;
1092
+ /**
1093
+ * Construct and simulate a grant_signer_ids 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.
1094
+ * The signer ids of the grant document under `grant`, in declaration
1095
+ * order, if any: with its rules, they give back its canonical text.
1096
+ */
1097
+ grant_signer_ids: ({ grant }: {
1098
+ grant: u32;
1099
+ }, options?: MethodOptions) => Promise<AssembledTransaction<Option<Array<string>>>>;
604
1100
  /**
605
1101
  * Construct and simulate a schedule_upgrade 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.
606
- * Schedule an upgrade to `wasm_hash`, executable after
607
- * [`ACCOUNT_UPGRADE_DELAY_LEDGERS`] (spec §12). Owner authorization;
608
- * under `Protected` also the condition's recorded approval of
609
- * `Upgrade { request_id, wasm_hash }` fresh until
610
- * `approval_valid_until` (`next_upgrade_request_id` names the id to
611
- * approve). Refused while a recovery attempt is authorized. Replaces any
612
- * earlier request. Returns the request id.
1102
+ * Schedule an upgrade to `wasm_hash` after the upgrade delay, replacing
1103
+ * any pending one, and return its id. Owner authorization; under
1104
+ * `Protected`, also approvals fresh until `approval_valid_until`.
613
1105
  */
614
1106
  schedule_upgrade: ({ wasm_hash, approval_valid_until }: {
615
1107
  wasm_hash: Buffer;
@@ -622,19 +1114,34 @@ export interface Client {
622
1114
  recovery_controller: (options?: MethodOptions) => Promise<AssembledTransaction<Option<string>>>;
623
1115
  /**
624
1116
  * Construct and simulate a recovery_generation 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.
625
- * The account's recovery generation (spec §12).
1117
+ * The account's recovery generation.
626
1118
  */
627
1119
  recovery_generation: (options?: MethodOptions) => Promise<AssembledTransaction<u64>>;
1120
+ /**
1121
+ * Construct and simulate a grant_verifier_names 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.
1122
+ * Each signer's `verifier-name` in the grant document under `grant`,
1123
+ * aligned with `grant_signer_ids`, if any: empty where a signer has
1124
+ * none, and no entries when no signer has one.
1125
+ */
1126
+ grant_verifier_names: ({ grant }: {
1127
+ grant: u32;
1128
+ }, options?: MethodOptions) => Promise<AssembledTransaction<Option<Array<string>>>>;
1129
+ /**
1130
+ * Construct and simulate a credential_generation 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.
1131
+ * The last grant generation a grant document named this credential under,
1132
+ * if any.
1133
+ */
1134
+ credential_generation: ({ fingerprint }: {
1135
+ fingerprint: Buffer;
1136
+ }, options?: MethodOptions) => Promise<AssembledTransaction<Option<u64>>>;
628
1137
  /**
629
1138
  * Construct and simulate a get_context_rules_count 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.
630
- * Read-only rule surface, re-exposed here because `SmartAccount` itself
631
- * is deliberately not exported by doc-only accounts.
1139
+ * The count of context rules, grants' and expired ones included.
632
1140
  */
633
1141
  get_context_rules_count: (options?: MethodOptions) => Promise<AssembledTransaction<u32>>;
634
1142
  /**
635
1143
  * Construct and simulate a next_upgrade_request_id 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.
636
- * The id the next `schedule_upgrade` will assign: what `Protected`
637
- * approvers approve.
1144
+ * The id the next `schedule_upgrade` assigns.
638
1145
  */
639
1146
  next_upgrade_request_id: (options?: MethodOptions) => Promise<AssembledTransaction<u64>>;
640
1147
  }
@@ -656,20 +1163,30 @@ export declare class Client extends ContractClient {
656
1163
  }): Promise<AssembledTransaction<T>>;
657
1164
  constructor(options: ContractClientOptions);
658
1165
  readonly fromJSON: {
1166
+ grant: (json: string) => AssembledTransaction<Option<GrantRecord>>;
659
1167
  infra: (json: string) => AssembledTransaction<InfraPins>;
660
1168
  renew: (json: string) => AssembledTransaction<null>;
1169
+ grants: (json: string) => AssembledTransaction<number[]>;
661
1170
  execute: (json: string) => AssembledTransaction<Result<any, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
662
1171
  document: (json: string) => AssembledTransaction<readonly [bigint, Option<Buffer<ArrayBufferLike>>]>;
1172
+ gc_grant: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
663
1173
  rcv_gate: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
664
1174
  revision: (json: string) => AssembledTransaction<bigint>;
1175
+ rule_set: (json: string) => AssembledTransaction<StoredRule[]>;
665
1176
  apply_doc: (json: string) => AssembledTransaction<Result<Buffer<ArrayBufferLike>, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
666
1177
  is_revoked: (json: string) => AssembledTransaction<boolean>;
667
1178
  applied_doc: (json: string) => AssembledTransaction<Option<Buffer<ArrayBufferLike>>>;
1179
+ apply_grant: (json: string) => AssembledTransaction<Result<Buffer<ArrayBufferLike>, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
1180
+ grant_count: (json: string) => AssembledTransaction<number>;
668
1181
  capabilities: (json: string) => AssembledTransaction<AccountCapabilities>;
669
1182
  doc_compiler: (json: string) => AssembledTransaction<string>;
1183
+ remove_grant: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
1184
+ rule_signers: (json: string) => AssembledTransaction<Signer[]>;
670
1185
  configuration: (json: string) => AssembledTransaction<AccountConfiguration>;
1186
+ grant_signers: (json: string) => AssembledTransaction<Option<Signer[]>>;
671
1187
  recovery_gate: (json: string) => AssembledTransaction<Option<FreezeGate>>;
672
1188
  cancel_upgrade: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
1189
+ grant_rule_set: (json: string) => AssembledTransaction<StoredRule[]>;
673
1190
  is_enrolled_id: (json: string) => AssembledTransaction<boolean>;
674
1191
  cancel_recovery: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
675
1192
  execute_upgrade: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
@@ -677,9 +1194,13 @@ export declare class Client extends ContractClient {
677
1194
  pending_upgrade: (json: string) => AssembledTransaction<Option<UpgradeRequest>>;
678
1195
  applied_doc_hash: (json: string) => AssembledTransaction<Option<Buffer<ArrayBufferLike>>>;
679
1196
  get_context_rule: (json: string) => AssembledTransaction<ContextRule>;
1197
+ grant_generation: (json: string) => AssembledTransaction<bigint>;
1198
+ grant_signer_ids: (json: string) => AssembledTransaction<Option<string[]>>;
680
1199
  schedule_upgrade: (json: string) => AssembledTransaction<Result<bigint, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
681
1200
  recovery_controller: (json: string) => AssembledTransaction<Option<string>>;
682
1201
  recovery_generation: (json: string) => AssembledTransaction<bigint>;
1202
+ grant_verifier_names: (json: string) => AssembledTransaction<Option<string[]>>;
1203
+ credential_generation: (json: string) => AssembledTransaction<Option<bigint>>;
683
1204
  get_context_rules_count: (json: string) => AssembledTransaction<number>;
684
1205
  next_upgrade_request_id: (json: string) => AssembledTransaction<bigint>;
685
1206
  };