@stellar-registry/perch-contracts 0.0.0-stage → 0.1.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.
@@ -0,0 +1,686 @@
1
+ /** sha256 of the wasm these bindings were generated from. */
2
+ export declare const WASM_SHA256 = "d99d56fc2d07a14c2259f0994d97316d23ae90db26835f4c977939c2b3b593aa";
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
+ * One pending account upgrade (spec §12).
11
+ *
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.
17
+ *
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.
23
+ */
24
+ export interface UpgradeRequest {
25
+ /**
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.
29
+ */
30
+ controller_epoch: Option<u64>;
31
+ /**
32
+ * The first ledger at which the request may execute.
33
+ */
34
+ executable_at: u32;
35
+ /**
36
+ * The account's recovery generation when the request was scheduled.
37
+ */
38
+ generation: u64;
39
+ /**
40
+ * Per-account, never reused.
41
+ */
42
+ request_id: u64;
43
+ /**
44
+ * The exact Wasm the account will run.
45
+ */
46
+ wasm_hash: Buffer;
47
+ }
48
+ /**
49
+ * The shared infra an account resolves, pinned when it was built (see
50
+ * [`infra`]): what a deployment check compares with its manifest.
51
+ */
52
+ export interface InfraPins {
53
+ doc_compiler: string;
54
+ interpreter: string;
55
+ spending_limit: string;
56
+ }
57
+ /**
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.
61
+ */
62
+ export interface FreezeGate {
63
+ attempt_id: u64;
64
+ /**
65
+ * The authorized attempt's `expires_at`.
66
+ */
67
+ until: u32;
68
+ }
69
+ /**
70
+ * Constants of the deployed account wasm a wallet checks before it builds
71
+ * anything for this account: what [`PerchSmartAccount::capabilities`]
72
+ * returns.
73
+ */
74
+ export interface AccountCapabilities {
75
+ /**
76
+ * How a document is applied: `one_tx`, one `apply_doc` transaction.
77
+ */
78
+ apply_modes: Array<string>;
79
+ /**
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.
87
+ */
88
+ auth_digest: string;
89
+ /**
90
+ * How the applied `doc_hash` is computed: `canon_v1`, `sha256` of the
91
+ * CANON v1 canonical bytes.
92
+ */
93
+ doc_identity: string;
94
+ /**
95
+ * [`INTERFACE_VERSION`].
96
+ */
97
+ interface_version: u32;
98
+ /**
99
+ * [`SNAPSHOT_VERSION`].
100
+ */
101
+ snapshot_version: u32;
102
+ }
103
+ /**
104
+ * Everything rule selection and signing need, read at one ledger: what
105
+ * [`PerchSmartAccount::configuration`] returns.
106
+ */
107
+ export interface AccountConfiguration {
108
+ /**
109
+ * The applied document's `doc_hash`, or `None` before the first apply.
110
+ */
111
+ doc_hash: Option<Buffer>;
112
+ /**
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`.
116
+ */
117
+ gate: Array<FreezeGate>;
118
+ infra: InfraPins;
119
+ recovery_controller: Option<string>;
120
+ recovery_generation: u64;
121
+ /**
122
+ * The zero-signer recovery rule's OZ id, if one is installed.
123
+ */
124
+ recovery_rule: Option<u32>;
125
+ /**
126
+ * The configuration revision every other field belongs to.
127
+ */
128
+ revision: u64;
129
+ /**
130
+ * Every installed context rule, with its OZ id.
131
+ */
132
+ rules: Array<InstalledRule>;
133
+ }
134
+ /**
135
+ * One context rule as the account installed it.
136
+ */
137
+ export interface InstalledRule {
138
+ context_type: ContextRuleType;
139
+ /**
140
+ * The OZ context-rule id.
141
+ */
142
+ id: u32;
143
+ name: string;
144
+ policies: Array<InstalledPolicy>;
145
+ /**
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.
149
+ */
150
+ recovery: boolean;
151
+ signers: Array<Signer>;
152
+ valid_until: Option<u32>;
153
+ }
154
+ /**
155
+ * One policy attached to an installed rule.
156
+ */
157
+ export interface InstalledPolicy {
158
+ /**
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.
162
+ */
163
+ params: Buffer;
164
+ policy: string;
165
+ }
166
+ /**
167
+ * Context of a single authorized call performed by an address.
168
+ *
169
+ * Custom account contracts that implement `__check_auth` special function
170
+ * receive a list of `Context` values corresponding to all the calls that
171
+ * need to be authorized.
172
+ */
173
+ export type Context = {
174
+ tag: "Contract";
175
+ values: readonly [ContractContext];
176
+ } | {
177
+ tag: "CreateContractHostFn";
178
+ values: readonly [CreateContractHostFnContext];
179
+ } | {
180
+ tag: "CreateContractWithCtorHostFn";
181
+ values: readonly [CreateContractWithConstructorHostFnContext];
182
+ };
183
+ /**
184
+ * Authorization context of a single contract call.
185
+ *
186
+ * This struct corresponds to a `require_auth_for_args` call for an address
187
+ * from `contract` function with `fn_name` name and `args` arguments.
188
+ */
189
+ export interface ContractContext {
190
+ args: Array<any>;
191
+ contract: string;
192
+ fn_name: string;
193
+ }
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
+ /**
203
+ * Authorization context for `create_contract` host function that creates a
204
+ * new contract on behalf of authorizer address.
205
+ */
206
+ export interface CreateContractHostFnContext {
207
+ executable: ContractExecutable;
208
+ salt: Buffer;
209
+ }
210
+ /**
211
+ * Authorization context for `create_contract` host function that creates a
212
+ * new contract on behalf of authorizer address.
213
+ * This is the same as `CreateContractHostFnContext`, but also has
214
+ * contract constructor arguments.
215
+ */
216
+ export interface CreateContractWithConstructorHostFnContext {
217
+ constructor_args: Array<any>;
218
+ executable: ContractExecutable;
219
+ salt: Buffer;
220
+ }
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
+ };
316
+ /**
317
+ * A signer in `AuthPayload` is not part of any selected context rule.
318
+ */
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 {
419
+ /**
420
+ * 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
+ * Every shared contract this account pins at build time.
422
+ */
423
+ infra: (options?: MethodOptions) => Promise<AssembledTransaction<InfraPins>>;
424
+ /**
425
+ * 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.
429
+ */
430
+ renew: ({ fingerprints, enrollment_ids }: {
431
+ fingerprints: Array<Buffer>;
432
+ enrollment_ids: Array<Buffer>;
433
+ }, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
434
+ /**
435
+ * 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).
442
+ */
443
+ execute: ({ target, target_fn, target_args }: {
444
+ target: string;
445
+ target_fn: string;
446
+ target_args: Array<any>;
447
+ }, options?: MethodOptions) => Promise<AssembledTransaction<Result<any>>>;
448
+ /**
449
+ * 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`.
452
+ */
453
+ document: (options?: MethodOptions) => Promise<AssembledTransaction<readonly [u64, Option<Buffer>]>>;
454
+ /**
455
+ * 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.
462
+ */
463
+ rcv_gate: ({ attempt_id, frozen_until }: {
464
+ attempt_id: u64;
465
+ frozen_until: u32;
466
+ }, options?: MethodOptions) => Promise<AssembledTransaction<Result<void>>>;
467
+ /**
468
+ * 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.
475
+ */
476
+ revision: (options?: MethodOptions) => Promise<AssembledTransaction<u64>>;
477
+ /**
478
+ * 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
497
+ */
498
+ apply_doc: ({ doc_json, approval_valid_until, expected_revision }: {
499
+ doc_json: Buffer;
500
+ approval_valid_until: u32;
501
+ expected_revision: Option<u64>;
502
+ }, options?: MethodOptions) => Promise<AssembledTransaction<Result<Buffer>>>;
503
+ /**
504
+ * Construct and simulate a is_revoked 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.
505
+ * Whether a credential fingerprint is permanently revoked.
506
+ */
507
+ is_revoked: ({ fingerprint }: {
508
+ fingerprint: Buffer;
509
+ }, options?: MethodOptions) => Promise<AssembledTransaction<boolean>>;
510
+ /**
511
+ * 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`].
515
+ */
516
+ applied_doc: (options?: MethodOptions) => Promise<AssembledTransaction<Option<Buffer>>>;
517
+ /**
518
+ * 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.
522
+ */
523
+ capabilities: (options?: MethodOptions) => Promise<AssembledTransaction<AccountCapabilities>>;
524
+ /**
525
+ * Construct and simulate a doc_compiler 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.
526
+ * The doc compiler this account pins at build time.
527
+ */
528
+ doc_compiler: (options?: MethodOptions) => Promise<AssembledTransaction<string>>;
529
+ /**
530
+ * 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.
533
+ */
534
+ configuration: (options?: MethodOptions) => Promise<AssembledTransaction<AccountConfiguration>>;
535
+ /**
536
+ * 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`.
539
+ */
540
+ recovery_gate: (options?: MethodOptions) => Promise<AssembledTransaction<Option<FreezeGate>>>;
541
+ /**
542
+ * Construct and simulate a cancel_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.
543
+ * Cancel the pending upgrade. Owner authorization.
544
+ */
545
+ cancel_upgrade: (options?: MethodOptions) => Promise<AssembledTransaction<Result<void>>>;
546
+ /**
547
+ * 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
+ * Whether this account ever enrolled a ZK enrollment id.
549
+ */
550
+ is_enrolled_id: ({ enrollment_id }: {
551
+ enrollment_id: Buffer;
552
+ }, options?: MethodOptions) => Promise<AssembledTransaction<boolean>>;
553
+ /**
554
+ * 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`.
557
+ */
558
+ cancel_recovery: ({ attempt_id }: {
559
+ attempt_id: u64;
560
+ }, options?: MethodOptions) => Promise<AssembledTransaction<Result<void>>>;
561
+ /**
562
+ * 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.
575
+ */
576
+ execute_upgrade: ({ request_id }: {
577
+ request_id: u64;
578
+ }, options?: MethodOptions) => Promise<AssembledTransaction<Result<void>>>;
579
+ /**
580
+ * 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`.
583
+ */
584
+ installed_rules: (options?: MethodOptions) => Promise<AssembledTransaction<Array<InstalledRule>>>;
585
+ /**
586
+ * Construct and simulate a pending_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.
587
+ * The scheduled upgrade, if any.
588
+ */
589
+ pending_upgrade: (options?: MethodOptions) => Promise<AssembledTransaction<Option<UpgradeRequest>>>;
590
+ /**
591
+ * 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.
595
+ */
596
+ applied_doc_hash: (options?: MethodOptions) => Promise<AssembledTransaction<Option<Buffer>>>;
597
+ /**
598
+ * 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`].
600
+ */
601
+ get_context_rule: ({ context_rule_id }: {
602
+ context_rule_id: u32;
603
+ }, options?: MethodOptions) => Promise<AssembledTransaction<ContextRule>>;
604
+ /**
605
+ * 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.
613
+ */
614
+ schedule_upgrade: ({ wasm_hash, approval_valid_until }: {
615
+ wasm_hash: Buffer;
616
+ approval_valid_until: u32;
617
+ }, options?: MethodOptions) => Promise<AssembledTransaction<Result<u64>>>;
618
+ /**
619
+ * Construct and simulate a recovery_controller 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.
620
+ * The adopted recovery controller, if any.
621
+ */
622
+ recovery_controller: (options?: MethodOptions) => Promise<AssembledTransaction<Option<string>>>;
623
+ /**
624
+ * 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).
626
+ */
627
+ recovery_generation: (options?: MethodOptions) => Promise<AssembledTransaction<u64>>;
628
+ /**
629
+ * 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.
632
+ */
633
+ get_context_rules_count: (options?: MethodOptions) => Promise<AssembledTransaction<u32>>;
634
+ /**
635
+ * 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.
638
+ */
639
+ next_upgrade_request_id: (options?: MethodOptions) => Promise<AssembledTransaction<u64>>;
640
+ }
641
+ export declare class Client extends ContractClient {
642
+ readonly options: ContractClientOptions;
643
+ static deploy<T = Client>(
644
+ /** Constructor/Initialization Args for the contract's `__constructor` method */
645
+ { admin_signers }: {
646
+ admin_signers: Array<Signer>;
647
+ },
648
+ /** Options for initializing a Client as well as for calling a method, with extras specific to deploying. */
649
+ options: MethodOptions & Omit<ContractClientOptions, "contractId"> & {
650
+ /** The hash of the Wasm blob, which must already be installed on-chain. */
651
+ wasmHash: Buffer | string;
652
+ /** Salt used to generate the contract's ID. Passed through to {@link Operation.createCustomContract}. Default: random. */
653
+ salt?: Buffer | Uint8Array;
654
+ /** The format used to decode `wasmHash`, if it's provided as a string. */
655
+ format?: "hex" | "base64";
656
+ }): Promise<AssembledTransaction<T>>;
657
+ constructor(options: ContractClientOptions);
658
+ readonly fromJSON: {
659
+ infra: (json: string) => AssembledTransaction<InfraPins>;
660
+ renew: (json: string) => AssembledTransaction<null>;
661
+ execute: (json: string) => AssembledTransaction<Result<any, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
662
+ document: (json: string) => AssembledTransaction<readonly [bigint, Option<Buffer<ArrayBufferLike>>]>;
663
+ rcv_gate: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
664
+ revision: (json: string) => AssembledTransaction<bigint>;
665
+ apply_doc: (json: string) => AssembledTransaction<Result<Buffer<ArrayBufferLike>, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
666
+ is_revoked: (json: string) => AssembledTransaction<boolean>;
667
+ applied_doc: (json: string) => AssembledTransaction<Option<Buffer<ArrayBufferLike>>>;
668
+ capabilities: (json: string) => AssembledTransaction<AccountCapabilities>;
669
+ doc_compiler: (json: string) => AssembledTransaction<string>;
670
+ configuration: (json: string) => AssembledTransaction<AccountConfiguration>;
671
+ recovery_gate: (json: string) => AssembledTransaction<Option<FreezeGate>>;
672
+ cancel_upgrade: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
673
+ is_enrolled_id: (json: string) => AssembledTransaction<boolean>;
674
+ cancel_recovery: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
675
+ execute_upgrade: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
676
+ installed_rules: (json: string) => AssembledTransaction<InstalledRule[]>;
677
+ pending_upgrade: (json: string) => AssembledTransaction<Option<UpgradeRequest>>;
678
+ applied_doc_hash: (json: string) => AssembledTransaction<Option<Buffer<ArrayBufferLike>>>;
679
+ get_context_rule: (json: string) => AssembledTransaction<ContextRule>;
680
+ schedule_upgrade: (json: string) => AssembledTransaction<Result<bigint, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
681
+ recovery_controller: (json: string) => AssembledTransaction<Option<string>>;
682
+ recovery_generation: (json: string) => AssembledTransaction<bigint>;
683
+ get_context_rules_count: (json: string) => AssembledTransaction<number>;
684
+ next_upgrade_request_id: (json: string) => AssembledTransaction<bigint>;
685
+ };
686
+ }