@t3foundry/tasra-sdk 0.3.1 → 0.4.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.
Files changed (255) hide show
  1. package/CHANGELOG.md +1067 -28
  2. package/README.md +15 -0
  3. package/dist/app/approvals.d.ts +66 -4
  4. package/dist/app/approvals.js +153 -16
  5. package/dist/app/authorization.d.ts +1 -1
  6. package/dist/app/authorization.js +1 -1
  7. package/dist/app/browser.d.ts +63 -0
  8. package/dist/app/browser.js +242 -0
  9. package/dist/app/client.d.ts +114 -13
  10. package/dist/app/client.js +302 -76
  11. package/dist/app/identity.js +21 -9
  12. package/dist/app/index.d.ts +28 -3
  13. package/dist/app/index.js +16 -1
  14. package/dist/app/memory-store.d.ts +7 -0
  15. package/dist/app/memory-store.js +55 -0
  16. package/dist/app/node.d.ts +34 -6
  17. package/dist/app/node.js +387 -64
  18. package/dist/app/paid-allowance.d.ts +325 -0
  19. package/dist/app/paid-allowance.js +1290 -0
  20. package/dist/app/paid-approval.d.ts +122 -0
  21. package/dist/app/paid-approval.js +379 -0
  22. package/dist/app/paid-journal.d.ts +51 -0
  23. package/dist/app/paid-journal.js +117 -0
  24. package/dist/app/paid-keys.d.ts +12 -0
  25. package/dist/app/paid-keys.js +20 -0
  26. package/dist/app/paid-operation.d.ts +821 -0
  27. package/dist/app/paid-operation.js +1720 -0
  28. package/dist/app/paid-reservation.d.ts +157 -0
  29. package/dist/app/paid-reservation.js +323 -0
  30. package/dist/app/paid-session.d.ts +147 -0
  31. package/dist/app/paid-session.js +578 -0
  32. package/dist/app/payer-queue.d.ts +11 -0
  33. package/dist/app/payer-queue.js +27 -0
  34. package/dist/app/policy-bootstrap.d.ts +342 -0
  35. package/dist/app/policy-bootstrap.js +365 -0
  36. package/dist/app/policy-operation.d.ts +47 -0
  37. package/dist/app/policy-operation.js +101 -0
  38. package/dist/app/ready-slot.d.ts +12 -0
  39. package/dist/app/ready-slot.js +5 -2
  40. package/dist/app/rotation-lock.d.ts +38 -0
  41. package/dist/app/rotation-lock.js +42 -0
  42. package/dist/app/session-decrypt.d.ts +135 -0
  43. package/dist/app/session-decrypt.js +335 -0
  44. package/dist/app/session-grants.d.ts +349 -0
  45. package/dist/app/session-grants.js +811 -0
  46. package/dist/app/signing-intents.d.ts +78 -0
  47. package/dist/app/signing-intents.js +95 -0
  48. package/dist/app/store-commit.d.ts +63 -0
  49. package/dist/app/store-commit.js +126 -0
  50. package/dist/app/store-errors.d.ts +8 -0
  51. package/dist/app/store-errors.js +11 -0
  52. package/dist/app/tasra-client.d.ts +2 -0
  53. package/dist/app/tasra-client.js +1 -1
  54. package/dist/app/wallet.js +4 -1
  55. package/dist/auth/holderProof.d.ts +3 -0
  56. package/dist/auth/holderProof.js +8 -7
  57. package/dist/auth/verifier.d.ts +4 -2
  58. package/dist/auth/verifier.js +5 -2
  59. package/dist/chain/abis/index.d.ts +6178 -4101
  60. package/dist/chain/abis/index.js +3 -0
  61. package/dist/chain/abis/keyRegistry.d.ts +256 -0
  62. package/dist/chain/abis/keyRegistry.js +333 -0
  63. package/dist/chain/abis/prepaidFaultOracle.d.ts +321 -0
  64. package/dist/chain/abis/prepaidFaultOracle.js +413 -0
  65. package/dist/chain/abis/settlement.d.ts +2203 -703
  66. package/dist/chain/abis/settlement.js +2685 -764
  67. package/dist/chain/allowance.d.ts +358 -0
  68. package/dist/chain/allowance.js +800 -0
  69. package/dist/chain/billing.d.ts +85 -0
  70. package/dist/chain/billing.js +197 -0
  71. package/dist/chain/chainId.d.ts +13 -0
  72. package/dist/chain/chainId.js +26 -0
  73. package/dist/chain/client.d.ts +15 -1
  74. package/dist/chain/client.js +57 -1
  75. package/dist/chain/commitmentRecovery.d.ts +51 -0
  76. package/dist/chain/commitmentRecovery.js +38 -0
  77. package/dist/chain/committeeClient.d.ts +17 -10
  78. package/dist/chain/committeeClient.js +64 -16
  79. package/dist/chain/committeeDraw.d.ts +12 -0
  80. package/dist/chain/committeeDraw.js +56 -0
  81. package/dist/chain/custodyHealth.d.ts +212 -0
  82. package/dist/chain/custodyHealth.js +365 -0
  83. package/dist/chain/deployments.js +2 -0
  84. package/dist/chain/events.js +2 -0
  85. package/dist/chain/headFollower.d.ts +77 -0
  86. package/dist/chain/headFollower.js +219 -0
  87. package/dist/chain/headPrefetch.d.ts +23 -0
  88. package/dist/chain/headPrefetch.js +67 -0
  89. package/dist/chain/index.d.ts +50 -8
  90. package/dist/chain/index.js +28 -3
  91. package/dist/chain/keeperExecution.d.ts +44 -0
  92. package/dist/chain/keeperExecution.js +127 -0
  93. package/dist/chain/keeperRecovery.d.ts +78 -0
  94. package/dist/chain/keeperRecovery.js +91 -0
  95. package/dist/chain/node.d.ts +24 -1
  96. package/dist/chain/node.js +88 -43
  97. package/dist/chain/offchain.d.ts +2 -0
  98. package/dist/chain/paidAgentTransport.d.ts +38 -0
  99. package/dist/chain/paidAgentTransport.js +1 -0
  100. package/dist/chain/paidEpoch.d.ts +66 -0
  101. package/dist/chain/paidEpoch.js +139 -0
  102. package/dist/chain/paidPacing.d.ts +81 -0
  103. package/dist/chain/paidPacing.js +136 -0
  104. package/dist/chain/pinnedReads.d.ts +49 -0
  105. package/dist/chain/pinnedReads.js +218 -0
  106. package/dist/chain/prepaid.d.ts +383 -0
  107. package/dist/chain/prepaid.js +1046 -0
  108. package/dist/chain/prepaidEscape.d.ts +274 -0
  109. package/dist/chain/prepaidEscape.js +432 -0
  110. package/dist/chain/prepaidFault.d.ts +94 -0
  111. package/dist/chain/prepaidFault.js +148 -0
  112. package/dist/chain/receipt.d.ts +24 -0
  113. package/dist/chain/receipt.js +82 -0
  114. package/dist/chain/registeredAgent.d.ts +68 -3
  115. package/dist/chain/registeredAgent.js +143 -42
  116. package/dist/chain/registeredOperation.d.ts +10 -1
  117. package/dist/chain/registeredOperation.js +18 -3
  118. package/dist/chain/registeredPaidAgent.d.ts +254 -0
  119. package/dist/chain/registeredPaidAgent.js +889 -0
  120. package/dist/chain/registeredRelay.d.ts +31 -1
  121. package/dist/chain/registeredRelay.js +164 -43
  122. package/dist/chain/relayVoucher.d.ts +64 -0
  123. package/dist/chain/relayVoucher.js +69 -0
  124. package/dist/chain/reservation.d.ts +239 -0
  125. package/dist/chain/reservation.js +746 -0
  126. package/dist/chain/reshareRoster.d.ts +64 -0
  127. package/dist/chain/reshareRoster.js +85 -0
  128. package/dist/chain/revertReason.d.ts +8 -0
  129. package/dist/chain/revertReason.js +2 -1
  130. package/dist/chain/rotationLock.d.ts +130 -0
  131. package/dist/chain/rotationLock.js +168 -0
  132. package/dist/chain/serviceRequestPolicy.d.ts +47 -0
  133. package/dist/chain/serviceRequestPolicy.js +86 -0
  134. package/dist/chain/services.d.ts +7 -0
  135. package/dist/chain/services.js +44 -4
  136. package/dist/chain/slotClient.js +11 -2
  137. package/dist/chain/slotHandoff.d.ts +81 -0
  138. package/dist/chain/slotHandoff.js +166 -0
  139. package/dist/chain/slotSeed.d.ts +47 -5
  140. package/dist/chain/slotSeed.js +173 -42
  141. package/dist/chain/verifierSnapshot.d.ts +36 -0
  142. package/dist/chain/verifierSnapshot.js +197 -0
  143. package/dist/chain/write.d.ts +111 -21
  144. package/dist/chain/write.js +378 -146
  145. package/dist/committee/blsSharing.d.ts +53 -0
  146. package/dist/committee/blsSharing.js +90 -0
  147. package/dist/committee/client.d.ts +62 -23
  148. package/dist/committee/client.js +288 -72
  149. package/dist/committee/dual-operation.d.ts +165 -0
  150. package/dist/committee/dual-operation.js +229 -0
  151. package/dist/committee/dual-sign.d.ts +26 -1
  152. package/dist/committee/dual-sign.js +85 -7
  153. package/dist/committee/ecdsa.d.ts +38 -0
  154. package/dist/committee/ecdsa.js +87 -15
  155. package/dist/committee/evidence.d.ts +30 -0
  156. package/dist/committee/evidence.js +65 -0
  157. package/dist/committee/execution.d.ts +414 -0
  158. package/dist/committee/execution.js +446 -0
  159. package/dist/committee/extraction.js +33 -26
  160. package/dist/committee/index.d.ts +30 -7
  161. package/dist/committee/index.js +18 -6
  162. package/dist/committee/keeperExecution.d.ts +37 -0
  163. package/dist/committee/keeperExecution.js +141 -0
  164. package/dist/committee/oauth.d.ts +14 -4
  165. package/dist/committee/oauth.js +17 -5
  166. package/dist/committee/payment.d.ts +369 -0
  167. package/dist/committee/payment.js +339 -0
  168. package/dist/committee/recovery.d.ts +136 -0
  169. package/dist/committee/recovery.js +204 -0
  170. package/dist/committee/recoveryJson.d.ts +2 -0
  171. package/dist/committee/recoveryJson.js +87 -0
  172. package/dist/committee/request.d.ts +63 -27
  173. package/dist/committee/request.js +77 -66
  174. package/dist/committee/session-grant.d.ts +320 -0
  175. package/dist/committee/session-grant.js +397 -0
  176. package/dist/committee/status-refresh.d.ts +257 -0
  177. package/dist/committee/status-refresh.js +619 -0
  178. package/dist/committee/token.d.ts +163 -15
  179. package/dist/committee/token.js +247 -10
  180. package/dist/crypto/bn254.d.ts +70 -0
  181. package/dist/crypto/bn254.js +222 -0
  182. package/dist/crypto/ibe.d.ts +32 -0
  183. package/dist/crypto/ibe.js +56 -8
  184. package/dist/crypto/index.d.ts +1 -1
  185. package/dist/crypto/index.js +1 -1
  186. package/dist/crypto/kem.d.ts +31 -0
  187. package/dist/crypto/kem.js +113 -7
  188. package/dist/crypto/recipient.d.ts +75 -0
  189. package/dist/crypto/recipient.js +107 -0
  190. package/dist/decryption/client.d.ts +10 -16
  191. package/dist/decryption/client.js +8 -76
  192. package/dist/decryption/index.d.ts +2 -0
  193. package/dist/decryption/index.js +2 -0
  194. package/dist/decryption/sealed.d.ts +72 -0
  195. package/dist/decryption/sealed.js +147 -0
  196. package/dist/decryption/session.d.ts +115 -0
  197. package/dist/decryption/session.js +358 -0
  198. package/dist/errors.d.ts +406 -1
  199. package/dist/errors.js +400 -5
  200. package/dist/index.d.ts +9 -2
  201. package/dist/index.js +6 -1
  202. package/dist/internal/bounded.d.ts +66 -0
  203. package/dist/internal/bounded.js +126 -0
  204. package/dist/internal/network.d.ts +4 -0
  205. package/dist/internal/network.js +40 -0
  206. package/dist/internal/retryAfter.d.ts +8 -0
  207. package/dist/internal/retryAfter.js +28 -0
  208. package/dist/internal/sleep.d.ts +6 -0
  209. package/dist/internal/sleep.js +15 -0
  210. package/dist/internal/typedData.d.ts +13 -0
  211. package/dist/internal/typedData.js +77 -0
  212. package/dist/internal/viemErrors.d.ts +26 -0
  213. package/dist/internal/viemErrors.js +49 -0
  214. package/dist/oid4vp/binding.d.ts +27 -1
  215. package/dist/oid4vp/binding.js +36 -1
  216. package/dist/oid4vp/jose.d.ts +4 -2
  217. package/dist/oid4vp/jose.js +39 -7
  218. package/dist/oid4vp/request-object.d.ts +61 -4
  219. package/dist/oid4vp/request-object.js +140 -5
  220. package/dist/oid4vp/verifier-agent.d.ts +18 -8
  221. package/dist/oid4vp/verifier-agent.js +48 -6
  222. package/dist/oid4vp/wallet.d.ts +2 -4
  223. package/dist/oid4vp/wallet.js +1 -0
  224. package/dist/retry.d.ts +78 -0
  225. package/dist/retry.js +137 -0
  226. package/dist/signing/frost.d.ts +1 -1
  227. package/dist/verifier-agent/index.d.ts +41 -5
  228. package/dist/verifier-agent/index.js +124 -9
  229. package/dist/verifier-agent/payment.d.ts +7 -0
  230. package/dist/verifier-agent/payment.js +17 -0
  231. package/docs/api.md +8 -2
  232. package/docs/application-api.md +25 -2
  233. package/docs/chain.md +155 -9
  234. package/docs/consumer-migrations.md +61 -0
  235. package/docs/encrypted-notes.md +3 -2
  236. package/docs/encryption.md +4 -2
  237. package/docs/errors.md +14 -1
  238. package/docs/flows.md +2 -2
  239. package/docs/funding.md +902 -0
  240. package/docs/native-approvals.md +63 -0
  241. package/docs/reference/README.md +9 -8
  242. package/docs/reference/app-browser.md +232 -0
  243. package/docs/reference/app-node.md +38 -8
  244. package/docs/reference/app.md +4621 -805
  245. package/docs/reference/chain-node.md +74 -16
  246. package/docs/reference/chain.md +6740 -1592
  247. package/docs/reference/committee.md +5630 -987
  248. package/docs/reference/main.md +1439 -140
  249. package/docs/reference/oid4vp.md +297 -144
  250. package/docs/reference/verifier-agent.md +77 -35
  251. package/docs/signing.md +6 -0
  252. package/examples/encrypted-notes.ts +21 -6
  253. package/examples/getting-started.ts +2 -7
  254. package/examples/live-config.ts +24 -17
  255. package/package.json +17 -5
@@ -1,5 +1,5 @@
1
1
  import { type RuleInput } from './ruleInput.js';
2
- import { type SlotSeed } from './slotSeed.js';
2
+ import { type SlotSeed, type SlotSeedFailure } from './slotSeed.js';
3
3
  import { type Account, type Address, type Chain, type Hex, type PublicClient, type Transport, type WalletClient } from 'viem';
4
4
  import { type RegisteredRelayConfig, type RelayReceipt, type RelayAttempt } from './registeredRelay.js';
5
5
  export type { RelayReceipt } from './registeredRelay.js';
@@ -32,7 +32,7 @@ export type SlotMode = 'frost' | 'bls' | 'tecdsa' | 'bls-bn254' | 'tecdsa-p256';
32
32
  /**
33
33
  * Authorization family recorded at creation. The default unspecified value declares no family. This label is not included in the committee-selection commitment.
34
34
  */
35
- export type SlotAuthType = 'unspecified' | 'oid4vp' | 'oauth';
35
+ export type SlotAuthType = 'unspecified' | 'oid4vp' | 'oauth' | 'governance';
36
36
  /**
37
37
  * Map a `KeyRegistry.AuthType` ordinal read from chain back to its label.
38
38
  * @param ordinal The `auth` field of `KeyRegistry.getKeySlot`.
@@ -75,12 +75,14 @@ export interface WriteClientWalletConfig extends WriteClientConfigBase {
75
75
  */
76
76
  export type WriteClientConfig = WriteClientKeyConfig | WriteClientWalletConfig;
77
77
  /**
78
- * Recovery and timing controls for commit-reveal creation. Accountant seed discovery is attempted first; unavailable seeds fall back to a beacon epoch wait.
78
+ * Recovery and timing controls for commit-reveal creation. Creation uses only the accountant-seeded path: the seed is asked for concurrently, retried within a bounded window, and its absence is a typed error ({@link SlotSeedUnavailableError}); there is no beacon-epoch wait.
79
79
  */
80
80
  export interface CommitRevealOptions {
81
81
  /** Durable creation flow. Awaited before submission and after receiving each hash.
82
- * Enabling recovery disables automatic transaction resubmission and chain-time nudges.
82
+ * Enabling recovery disables automatic transaction resubmission.
83
83
  * Only supply hashes from the same persisted intent; never reconstruct lost salts.
84
+ * Resuming a beacon-epoch commitment made by an older SDK checks its target epoch ONCE and throws
85
+ * {@link SlotRevealNotYetError} until it is reached; it never waits.
84
86
  */
85
87
  recovery?: {
86
88
  commitTx?: Hex;
@@ -95,22 +97,22 @@ export interface CommitRevealOptions {
95
97
  };
96
98
  /** Cancel cooperative creation waits; already submitted transactions remain on chain. */
97
99
  signal?: AbortSignal;
98
- /**
99
- * Maximum beacon-epoch wait in milliseconds when no accountant seed is available.
100
- */
101
- maxWaitMs?: number;
102
- /** Progress during that wait. Not called on the seeded path - there is no wait to report. */
103
- onEpoch?: (cur: number, target: number) => void;
104
- /**
105
- * Attempt accountant seed discovery by default. Set false to wait for the beacon epoch instead; both paths bind the draw to the committed creation intent.
106
- */
107
- slotSeed?: boolean;
108
100
  /** Accountant base URLs for the seed request. Resolved from `NodeRegistry` when omitted. */
109
101
  accountantUrls?: string[];
110
- /** Per-accountant HTTP timeout for the seed request. */
102
+ /** Per-accountant HTTP timeout for the seed request (default 20 s, capped by the retry window). */
111
103
  slotSeedTimeoutMs?: number;
112
- /** The seed that was obtained, or `null` when the epoch wait is being used instead. */
113
- onSeed?: (seed: SlotSeed | null) => void;
104
+ /**
105
+ * Total time to keep re-asking the accountant set while it answers "not yet" (404 before its
106
+ * view reaches the commit receipt, 503 while it leads another creation's round, 429, a timeout).
107
+ * Backs off with jitter and honours `Retry-After`. Default {@link DEFAULT_SLOT_SEED_RETRY_MS} (90 s).
108
+ */
109
+ slotSeedRetryMs?: number;
110
+ /** Stagger between the concurrent asks of one round (default {@link DEFAULT_SLOT_SEED_HEDGE_MS}; 0 asks every accountant at once). */
111
+ slotSeedHedgeMs?: number;
112
+ /** The seed that was obtained, before the reveal is sent. */
113
+ onSeed?: (seed: SlotSeed) => void;
114
+ /** Why no seed was obtained (each accountant's last answer), just before {@link SlotSeedUnavailableError} is thrown. */
115
+ onSeedError?: (failure: SlotSeedFailure) => void;
114
116
  }
115
117
  /**
116
118
  * Slot key mode, keeper threshold, private authorization rule and creation policies.
@@ -134,9 +136,11 @@ export interface CreateSlotArgs extends RuleInput {
134
136
  mode: SlotMode;
135
137
  /**
136
138
  * `KeyRegistry.AuthType` for this slot - how a holder authorises against the rule.
137
- * Defaults to `'unspecified'` (ordinal 0), which declares nothing and is what every
138
- * slot predating the field reads as. Set it when the rule is an OID4VP-DCQL query
139
- * (`'oid4vp'`) or an OAuth/OIDC token rule (`'oauth'`).
139
+ * Defaults to `'unspecified'` (ordinal 0), interpreted as OID4VP by current
140
+ * keepers. Choose `'oid4vp'` for wallet credentials or `'oauth'` for OAuth/OIDC.
141
+ * The separate administrative `'bls-bn254'` mode requires `'governance'`
142
+ * (ordinal 3); this type cannot authorize customer key modes or wallet grants.
143
+ * Update fleet readers to support ordinal 3 before creating authority slots.
140
144
  */
141
145
  authType?: SlotAuthType;
142
146
  /** Committee-draw filter tags; default `["keykeeper"]`. */
@@ -197,6 +201,52 @@ export type ProposeRuleArgs = ({
197
201
  /** The slot's rule salt (from creation). Amendments reuse it; it is never minted here. */
198
202
  ruleSalt: Hex;
199
203
  };
204
+ /**
205
+ * Outcome of {@link TasraWriteClient.lockKeyRotation}: the lock was sent and confirmed, or the
206
+ * slot was already locked and nothing was sent.
207
+ */
208
+ export type RotationLockResult = {
209
+ /** The lock transaction mined and the chain now shows the creator's lock. */
210
+ phase: 'locked';
211
+ /** Slot that was locked. */
212
+ slotId: Hex;
213
+ /** Transaction that carried the lock. */
214
+ txHash: Hex;
215
+ /** Relay receipt when the call was relayed. */
216
+ relay?: RelayReceipt;
217
+ } | {
218
+ /** Nothing was sent: no rotation could change this slot's key already. */
219
+ phase: 'already-locked';
220
+ /** Slot that was found locked. */
221
+ slotId: Hex;
222
+ /** The creator locked it earlier. */
223
+ lockedByCreator: boolean;
224
+ /** It is a threshold-ECDSA slot, locked by its mode. */
225
+ lockedByMode: boolean;
226
+ /** No transaction. */
227
+ txHash?: undefined;
228
+ };
229
+ /** Outcome of {@link TasraWriteClient.proposeSlotTransfer}. */
230
+ export interface SlotTransferProposal {
231
+ /** Slot offered. */
232
+ slotId: Hex;
233
+ /** Transaction that carried the offer. */
234
+ txHash: Hex;
235
+ /** Wallet that may accept. */
236
+ to: Address;
237
+ /** Rule admin, which does not move with the slot; `null` when the rule is immutable. */
238
+ ruleAdmin: Address | null;
239
+ /** Guardian, which does not move with the slot. */
240
+ guardian: Address | null;
241
+ /** True when this account is also the rule admin and so needs the second hand-off. */
242
+ callerIsRuleAdmin: boolean;
243
+ /** Prepaid TSRA base units the slot holds, which go with it; set when a Settlement address is configured. */
244
+ prepaidBalance?: bigint;
245
+ /** Of that, base units reserved by accepted requests, which still settle; set where the Settlement has reservations. */
246
+ reservedBalance?: bigint;
247
+ /** Relay receipt, when the offer was gas-sponsored. */
248
+ relay?: RelayReceipt;
249
+ }
200
250
  /** A confirmed `proposeRuleUpdate`, decoded from its `RuleUpdateProposed` event. */
201
251
  export interface ProposeRuleResult {
202
252
  /** Slot whose rule amendment was proposed. */
@@ -234,6 +284,8 @@ export declare function resolveAmendmentRule(a: ProposeRuleArgs, what: string):
234
284
  * @param what Caller name used in error messages.
235
285
  */
236
286
  export declare function amendmentPreflight(rule: string, state: AmendmentOnChain, slotId: Hex, what: string): Promise<void>;
287
+ /** How long a write step waits for its receipt: viem's waitForTransactionReceipt default, unchanged. */
288
+ export declare const WRITE_RECEIPT_TIMEOUT_MS = 180000;
237
289
  /**
238
290
  * Compute the salted rule commitment. OID4VP queries and `kk_oauth` policy envelopes use canonical JSON; other rule formats retain their exact bytes.
239
291
  * @param ruleSalt Private 32-byte salt saved with the slot creation intent.
@@ -278,7 +330,7 @@ export interface TasraWriteClient {
278
330
  relay?: RelayReceipt;
279
331
  }>;
280
332
  /**
281
- * Create a slot using commit-reveal, trying an accountant seed before waiting for a beacon epoch. Persist the slot ID and rule salt; prepared creation preserves them before submission.
333
+ * Create a slot using commit-reveal with an accountant seed; never waits for a beacon epoch (throws `SlotSeedUnavailableError` without a seed). Persist the slot ID and rule salt; prepared creation preserves them before submission.
282
334
  * Policy envelopes are checked as for `createSlot`; `rule` in the result is the exact string committed.
283
335
  */
284
336
  createSlotCommitReveal(args: (CreateSlotArgs | CreateSlotFromPolicyArgs) & CommitRevealOptions): Promise<{
@@ -308,10 +360,12 @@ export interface TasraWriteClient {
308
360
  transferTsra(to: Address, amount: bigint): Promise<Hex>;
309
361
  /**
310
362
  * Request a new distributed key generation epoch for the slot.
363
+ * A slot whose rotation is locked (by its creator, or a threshold-ECDSA slot by its mode) is refused before signing as a `RotationLockError` with code `locked`; the chain would revert `RotationLocked()`, which is final.
311
364
  */
312
365
  rotateKey(slotId: Hex, reason?: string): Promise<Hex>;
313
366
  /**
314
367
  * Redistribute the slot key among the supplied operators using the new threshold.
368
+ * On a threshold-ECDSA slot the roster must keep at least the current `k` members (only staying members re-deal the key) and `k` must be at least 2; otherwise it is refused before signing as a `ReshareRosterError`.
315
369
  */
316
370
  reshareKey(slotId: Hex, newOperators: Address[], k: number, n: number, reason?: string): Promise<Hex>;
317
371
  /**
@@ -352,6 +406,42 @@ export interface TasraWriteClient {
352
406
  * Activate the pending amendment; anyone may send it. Refuses `no-pending`, `timelock` (judged on the latest block timestamp, not the local clock) and `below-threshold` before signing.
353
407
  */
354
408
  activateRuleUpdate(slotId: Hex): Promise<Hex>;
409
+ /**
410
+ * Offer the slot to `to` as its next creator, signed by the current creator. It moves only when `to` accepts with acceptSlotTransfer; a new offer replaces an earlier one.
411
+ * Only the creator moves: the rule admin and the guardian stay, and the result names them. When this account is also the rule admin, hand that role over separately with proposeRuleAdminTransfer.
412
+ * At acceptance every delegation and unused prepaid payment intent this account signed for the slot stops working; reservations already accepted still settle. The prepaid credit goes with the slot and nothing is refunded; the result carries the balance when a Settlement address is configured.
413
+ * Refused before signing, as a `SlotHandoffError`: `no-slot`, `cancelled`, `unsupported` (a KeyRegistry without the hand-off), `not-creator`, `same-holder`, `already-offered`, `self-custody` (the slot's own threshold account, which could never sign a paid operation of itself again) and `contract-holder` (keepers accept creator signatures from an externally owned account only).
414
+ */
415
+ proposeSlotTransfer(slotId: Hex, to: Address): Promise<SlotTransferProposal>;
416
+ /**
417
+ * Withdraw the pending creator offer, signed by the creator. Refuses `not-creator` and `nothing-pending` before signing.
418
+ */
419
+ withdrawSlotTransfer(slotId: Hex): Promise<Hex>;
420
+ /**
421
+ * Become the slot's creator, signed by the offered wallet. Refuses `nothing-pending`, `not-offered` and `self-custody` before signing.
422
+ * Afterwards sign fresh delegations for the apps that use the slot and update their configuration: the previous creator's delegations no longer verify.
423
+ */
424
+ acceptSlotTransfer(slotId: Hex): Promise<Hex>;
425
+ /**
426
+ * Offer the slot's rule admin role to `to`, signed by the rule admin. It moves only when `to` accepts. It can never go to the guardian, and the guardian is not asked.
427
+ * Refuses `immutable`, `not-admin`, `same-holder`, `guardian` and `already-offered` before signing.
428
+ */
429
+ proposeRuleAdminTransfer(slotId: Hex, to: Address): Promise<Hex>;
430
+ /**
431
+ * Withdraw the pending rule admin offer, signed by the rule admin. Refuses `not-admin` and `nothing-pending` before signing.
432
+ */
433
+ withdrawRuleAdminTransfer(slotId: Hex): Promise<Hex>;
434
+ /**
435
+ * Become the slot's rule admin, signed by the offered wallet. Refuses `nothing-pending`, `not-offered` and `guardian` before signing.
436
+ */
437
+ acceptRuleAdminTransfer(slotId: Hex): Promise<Hex>;
438
+ /**
439
+ * Lock the slot's key against every rotation, for good, signed by its creator (`KeyRegistry.lockKeyRotation`, relayed when a relay is configured).
440
+ * After it, every rotation path reverts `RotationLocked()` for everyone, the creator included; resharing still works, because it moves the shares and keeps the key.
441
+ * Set-once: a slot that is already locked resolves `already-locked` without sending. That includes every threshold-ECDSA slot (`tecdsa`, `tecdsa-p256`), which the network locks by its mode, so such a slot never emits `KeyRotationLocked`; read the state with `isRotationLocked`.
442
+ * Refused before signing, as a `RotationLockError`: `no-slot`, `cancelled`, `unsupported` (a KeyRegistry without the lock) and `not-creator`; `not-confirmed` when the transaction mined but the chain does not show the lock.
443
+ */
444
+ lockKeyRotation(slotId: Hex): Promise<RotationLockResult>;
355
445
  /**
356
446
  * Buy TSRA with approved EURC while enforcing the minimum output amount.
357
447
  */