@dynamic-labs-wallet/core 0.0.353 → 0.1.0-request-signing

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 (82) hide show
  1. package/index.cjs +2636 -368
  2. package/index.esm.js +2552 -331
  3. package/package.json +21 -8
  4. package/src/api/api.d.ts +551 -123
  5. package/src/api/api.d.ts.map +1 -1
  6. package/src/api/client.d.ts +33 -1
  7. package/src/api/client.d.ts.map +1 -1
  8. package/src/api/index.d.ts +3 -0
  9. package/src/api/index.d.ts.map +1 -1
  10. package/src/api/requestSigner.d.ts +19 -0
  11. package/src/api/requestSigner.d.ts.map +1 -0
  12. package/src/api/signAndBroadcastRequestTooLargeError.d.ts +8 -0
  13. package/src/api/signAndBroadcastRequestTooLargeError.d.ts.map +1 -0
  14. package/src/api/types.d.ts +26 -0
  15. package/src/api/types.d.ts.map +1 -0
  16. package/src/businessAccounts/businessAccountClient.d.ts +128 -0
  17. package/src/businessAccounts/businessAccountClient.d.ts.map +1 -0
  18. package/src/businessAccounts/index.d.ts +3 -0
  19. package/src/businessAccounts/index.d.ts.map +1 -0
  20. package/src/businessAccounts/types.d.ts +121 -0
  21. package/src/businessAccounts/types.d.ts.map +1 -0
  22. package/src/constants.d.ts +30 -15
  23. package/src/constants.d.ts.map +1 -1
  24. package/src/earn/earnClient.d.ts +79 -0
  25. package/src/earn/earnClient.d.ts.map +1 -0
  26. package/src/earn/index.d.ts +3 -0
  27. package/src/earn/index.d.ts.map +1 -0
  28. package/src/earn/types.d.ts +23 -0
  29. package/src/earn/types.d.ts.map +1 -0
  30. package/src/eventStream/signingConsentRequiredError.d.ts +33 -0
  31. package/src/eventStream/signingConsentRequiredError.d.ts.map +1 -0
  32. package/src/eventStream/utils.d.ts +88 -4
  33. package/src/eventStream/utils.d.ts.map +1 -1
  34. package/src/exportIntent.d.ts +13 -0
  35. package/src/exportIntent.d.ts.map +1 -0
  36. package/src/index.d.ts +8 -0
  37. package/src/index.d.ts.map +1 -1
  38. package/src/internal/sdk-api-core/index.d.ts +2 -0
  39. package/src/internal/sdk-api-core/index.d.ts.map +1 -0
  40. package/src/mpc/constants.d.ts +17 -0
  41. package/src/mpc/constants.d.ts.map +1 -1
  42. package/src/mpc/index.d.ts +1 -0
  43. package/src/mpc/index.d.ts.map +1 -1
  44. package/src/mpc/privateKey.d.ts +20 -0
  45. package/src/mpc/privateKey.d.ts.map +1 -0
  46. package/src/mpc/utils.d.ts +1 -0
  47. package/src/mpc/utils.d.ts.map +1 -1
  48. package/src/reshareIntent.d.ts +14 -0
  49. package/src/reshareIntent.d.ts.map +1 -0
  50. package/src/services/axiosErrorResponse.d.ts +18 -3
  51. package/src/services/axiosErrorResponse.d.ts.map +1 -1
  52. package/src/signingIntent.d.ts +28 -0
  53. package/src/signingIntent.d.ts.map +1 -0
  54. package/src/types.d.ts +961 -88
  55. package/src/types.d.ts.map +1 -1
  56. package/src/utils/attachRequestIds.d.ts +8 -0
  57. package/src/utils/attachRequestIds.d.ts.map +1 -0
  58. package/src/utils/forwardMpcEnclaveUrl.d.ts +9 -0
  59. package/src/utils/forwardMpcEnclaveUrl.d.ts.map +1 -0
  60. package/src/utils/forwardMpcErrorHandling.d.ts +44 -1
  61. package/src/utils/forwardMpcErrorHandling.d.ts.map +1 -1
  62. package/src/utils/forwardMpcFallback.d.ts +33 -0
  63. package/src/utils/forwardMpcFallback.d.ts.map +1 -0
  64. package/src/utils/index.d.ts +9 -0
  65. package/src/utils/index.d.ts.map +1 -1
  66. package/src/utils/isEvmCompatibleChain/index.d.ts +2 -0
  67. package/src/utils/isEvmCompatibleChain/index.d.ts.map +1 -0
  68. package/src/utils/isEvmCompatibleChain/isEvmCompatibleChain.d.ts +28 -0
  69. package/src/utils/isEvmCompatibleChain/isEvmCompatibleChain.d.ts.map +1 -0
  70. package/src/utils/keyShare.d.ts +8 -0
  71. package/src/utils/keyShare.d.ts.map +1 -1
  72. package/src/utils/messageSerialization.d.ts.map +1 -1
  73. package/src/utils/rawMessage.d.ts +4 -0
  74. package/src/utils/rawMessage.d.ts.map +1 -0
  75. package/src/utils/serializeError.d.ts +16 -0
  76. package/src/utils/serializeError.d.ts.map +1 -0
  77. package/src/utils/toJsonSafeContext.d.ts +4 -0
  78. package/src/utils/toJsonSafeContext.d.ts.map +1 -0
  79. package/src/utils/uuid.d.ts +2 -0
  80. package/src/utils/uuid.d.ts.map +1 -0
  81. package/src/utils/withTraceId.d.ts +7 -0
  82. package/src/utils/withTraceId.d.ts.map +1 -0
package/src/types.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import type { ForwardMPCClientV2 } from '@dynamic-labs-wallet/forward-mpc-client';
2
- import type { SignMessageContext } from '@dynamic-labs/sdk-api-core';
2
+ import type { BackupKeySharesToLocationsRequestLocations, DelegatedShareDeliveryRequestEncryptedDelegatedShare, LinkBusinessAccountWalletSdkRequest, OpenRoomResponseForReshare, OpenRoomResponseWithServerKeygenIds, ProjectSettingsSdkWaasICloud, RefreshKeySharesResponse, SignMessageApprovalQuorum, SignMessageContext, SignMessageWithWaasRequest, WaasPolicyRule, WaasShareSet, WaasWalletProperties as ApiWaasWalletProperties, WaasWalletShareSetType, WalletKeyShareInfo } from '#internal/sdk-api-core';
3
3
  import type { BackupLocation, WalletOperation } from './constants.js';
4
4
  import type { ThresholdSignatureScheme } from './mpc/index.js';
5
+ import type { CreateBusinessAccountSdkRequest, BusinessAccount, BusinessAccountActionRequired, BusinessAccountDetail, BusinessAccountIntent, BusinessAccountList, BusinessAccountMember, BusinessAccountMemberRole, BusinessAccountSigner, SignerTarget, TargetSignerIdentity } from './businessAccounts/types.js';
5
6
  export type TraceContext = {
6
7
  traceId?: string;
7
8
  startTime?: number;
@@ -45,25 +46,406 @@ export type KeygenResult = {
45
46
  pubkey: string;
46
47
  secretShare: string;
47
48
  };
48
- export type KeygenCompleteResponse = {
49
+ export type { EncryptedWalletApiKey } from '#internal/sdk-api-core';
50
+ export type KeygenCompleteResponse = OpenRoomResponse & {
49
51
  walletId: string;
50
- roomId: string;
51
- serverKeygenIds: string[];
52
+ /**
53
+ * Server clock at the moment the event was written to the SSE stream.
54
+ * Date.now() - emittedAtMs approximates transit/buffering lag; device clock
55
+ * skew makes it indicative, not exact.
56
+ */
57
+ emittedAtMs?: number;
58
+ /**
59
+ * HTTP-transport only. Populated once the async create ceremony has finished
60
+ * (the `completed` dedup branch of `/create`): the client polls `/create`
61
+ * with the same idempotency key after its relay keygen, and these fields
62
+ * stand in for the SSE `ceremony_complete` event that HTTP mode never streams.
63
+ * Absent while the ceremony is still `inProcess`.
64
+ */
65
+ accountAddress?: string;
66
+ shareSetId?: string;
67
+ };
68
+ export type OpenRoomResponse = OpenRoomResponseWithServerKeygenIds;
69
+ /** How Dynamic sends the signed transaction. Only Solana reads these. */
70
+ export type SignAndBroadcastOptions = {
71
+ /** Signatures from the transaction's other required signers; Dynamic adds only the wallet's own. */
72
+ cosignerSignatures?: {
73
+ publicKey: string;
74
+ signature: string;
75
+ }[];
76
+ skipPreflight?: boolean;
77
+ };
78
+ /** The transaction record; `room` is set while signing is pending. */
79
+ export type SignAndBroadcastResponse = {
80
+ transactionId: string;
81
+ status: string;
82
+ room?: OpenRoomResponse;
83
+ };
84
+ /** Token-2022 confidential-transfer operations the enclave supports. */
85
+ export type ConfidentialTransferOperation = 'configureAccount' | 'deposit' | 'transfer' | 'applyPendingBalance' | 'withdraw';
86
+ /** Raw `getAccountInfo` fields the offline enclave needs for a Solana account. */
87
+ export type ConfidentialAccountState = {
88
+ /** Base64 account data. */
89
+ data: string;
90
+ lamports: string;
91
+ owner: string;
92
+ };
93
+ export type CreateConfidentialSeedRequest = {
94
+ solanaAddress: string;
95
+ derivationVersion?: number;
96
+ };
97
+ export type CreateConfidentialSeedResponse = {
98
+ chain: string;
99
+ derivationVersion: number;
100
+ elgamalPubkey: string;
101
+ solanaAddress: string;
102
+ };
103
+ export type SvmConfidentialBalanceRequest = {
104
+ accountState: ConfidentialAccountState;
105
+ derivationVersion?: number;
106
+ mint: string;
107
+ solanaAddress: string;
108
+ tokenAccount: string;
109
+ };
110
+ /** Decrypted balances in base units, decimal-encoded. */
111
+ export type SvmConfidentialBalanceResponse = {
112
+ availableBalance: string;
113
+ pendingBalance: string;
114
+ };
115
+ export type SignConfidentialTransferRequest = {
116
+ accountState?: ConfidentialAccountState;
117
+ amount?: string;
118
+ auditorElgamalPubkey?: string;
119
+ chainId: string;
120
+ decimals?: number;
121
+ derivationVersion?: number;
122
+ destinationAccountState?: ConfidentialAccountState;
123
+ destinationTokenAccount?: string;
124
+ feePayer?: string;
125
+ lamportsPerByte: string;
126
+ lastValidBlockHeight: string;
127
+ mint: string;
128
+ operation: ConfidentialTransferOperation;
129
+ recentBlockhash: string;
130
+ solanaAddress: string;
131
+ tokenAccount: string;
132
+ };
133
+ export type SignConfidentialTransferResponse = {
134
+ /** Base64 unsigned transactions in broadcast order; the wallet's signature slot is zeroed. */
135
+ serializedTransactions: string[];
136
+ /** Enclave-issued tag binding the batch; submit unchanged to `signConfidentialTransactions`. */
137
+ transactionsTag: string;
138
+ };
139
+ export type SignConfidentialTransactionsRequest = {
140
+ /** Base58 public key the batch signs for; must match the wallet bound by `transactionsTag`. */
141
+ solanaAddress: string;
142
+ /** The base64 transactions returned by `signConfidentialTransfer`, unchanged and in order. */
143
+ serializedTransactions: string[];
144
+ transactionsTag: string;
145
+ /** SVM cluster identifier (genesis hash) — sanity check against the tag's binding. */
146
+ chainId?: string;
147
+ };
148
+ export type SignConfidentialTransactionsResponse = {
149
+ /** The MPC room id for the operation (exactly one for Solana v1); the enclave waits in it for the client share. */
150
+ roomIds: string[];
151
+ };
152
+ /** Iframe-bound request for `createConfidentialSeed`; the wallet client supplies the rest. */
153
+ export type CreateConfidentialSeedBrowserRequest = CreateConfidentialSeedRequest & {
154
+ chainName: string;
155
+ walletId: string;
156
+ authToken?: string;
157
+ };
158
+ /** Iframe-bound request for `getConfidentialBalance`; `rpcUrl` stays client-side and is required when `accountState` is omitted. */
159
+ export type GetConfidentialBalanceBrowserRequest = Omit<SvmConfidentialBalanceRequest, 'accountState'> & {
160
+ accountState?: ConfidentialAccountState;
161
+ chainName: string;
162
+ walletId: string;
163
+ authToken?: string;
164
+ rpcUrl?: string;
52
165
  };
53
- export type OpenRoomResponse = {
54
- roomId: string;
55
- serverKeygenIds: string[];
166
+ /** Iframe-bound request for `signConfidentialTransfer`; `rpcUrl`/`broadcast` stay client-side. */
167
+ export type SignConfidentialTransferBrowserRequest = Omit<SignConfidentialTransferRequest, 'chainId' | 'lamportsPerByte' | 'lastValidBlockHeight' | 'recentBlockhash'> & {
168
+ chainName: string;
169
+ walletId: string;
170
+ authToken?: string;
171
+ chainId?: string;
172
+ lamportsPerByte?: string;
173
+ /** Fetched from `rpcUrl` when omitted. */
174
+ lastValidBlockHeight?: string;
175
+ recentBlockhash?: string;
176
+ /** Solana JSON-RPC endpoint, required to fetch account state / blockhash or to broadcast. */
177
+ rpcUrl?: string;
178
+ broadcast?: boolean;
179
+ broadcastOptions?: {
180
+ skipPreflight?: boolean;
181
+ preflightCommitment?: string;
182
+ };
183
+ /** Signing credentials — the client share joins the enclave's MPC rooms. */
184
+ password?: string;
185
+ signedSessionId: string;
186
+ mfaToken?: string;
187
+ elevatedAccessToken?: string;
56
188
  };
57
- export type ReshareResponse = {
58
- roomId: string;
59
- serverKeygenIds: string[];
60
- newServerKeygenIds: string[];
189
+ export type SignConfidentialTransferBrowserResponse = {
190
+ /** Base64 signed transactions, in broadcast order. */
191
+ serializedTransactions: string[];
192
+ /** Base58 signatures collected from the per-transaction MPC rooms. */
193
+ signatures: string[];
194
+ /** Present only when `broadcast` was requested. */
195
+ transactionIds?: string[];
196
+ };
197
+ export type ReshareResponse = OpenRoomResponseForReshare;
198
+ export type RefreshResponse = RefreshKeySharesResponse;
199
+ export type RevokeDelegationResponse = {
200
+ walletId: string;
201
+ shareSetId: string;
61
202
  };
62
203
  export declare enum SuccessEventType {
63
204
  KeygenComplete = "keygen_complete",
64
205
  RoomCreated = "room_created",
65
- CeremonyComplete = "ceremony_complete"
206
+ CeremonyComplete = "ceremony_complete",
207
+ ConsentRequired = "consent_required"
66
208
  }
209
+ /** The complete unsigned business-account intent, signed by the initiator's session key. */
210
+ export type SigningIntentEnvelope = {
211
+ accountAddress: string;
212
+ actionType: 'waasSigningQuorumApprove';
213
+ businessAccountId: string;
214
+ createdAt: string;
215
+ completeBy?: string;
216
+ initiatorUserId: string;
217
+ intentId: string;
218
+ walletId: string;
219
+ };
220
+ export type EvmSigningIntentLimits = {
221
+ maxGas: string;
222
+ maxFeePerGas: string;
223
+ maxPriorityFeePerGas: string;
224
+ maxTotalFee: string;
225
+ };
226
+ /** Signed marker that the transaction's nonce, blockhash or block reference may be refreshed at sign time. */
227
+ export type SigningIntentLifetime<T extends 'nonce' | 'blockhash' | 'expiration' = 'nonce' | 'blockhash' | 'expiration'> = {
228
+ refreshable: T;
229
+ };
230
+ export type MessageOperation = {
231
+ kind: 'message';
232
+ chainName: string;
233
+ message: string;
234
+ payload: string;
235
+ };
236
+ export type TypedDataOperation = {
237
+ kind: 'typedData';
238
+ chainName: 'EVM';
239
+ typedData: string;
240
+ payload: string;
241
+ };
242
+ export type RawOperation = {
243
+ kind: 'raw';
244
+ chainName: string;
245
+ rawSign: NonNullable<SignMessageContext['rawSign']>;
246
+ payload: string;
247
+ };
248
+ export type Eip7702AuthOperation = {
249
+ kind: 'eip7702Auth';
250
+ chainName: 'EVM';
251
+ eip7702Auth: NonNullable<SignMessageContext['eip7702Auth']>;
252
+ payload: string;
253
+ };
254
+ export type EvmTransactionOperation = {
255
+ kind: 'transaction';
256
+ chainName: 'EVM';
257
+ chainId: string;
258
+ from: string;
259
+ to: string | null;
260
+ value: string;
261
+ data: string;
262
+ nonce: string;
263
+ };
264
+ export type SvmTransactionOperation = {
265
+ kind: 'transaction';
266
+ chainName: 'SVM';
267
+ chainId: string;
268
+ messageVersion: 'legacy' | 'v0';
269
+ feePayer: string;
270
+ header: {
271
+ numRequiredSignatures: number;
272
+ numReadonlySignedAccounts: number;
273
+ numReadonlyUnsignedAccounts: number;
274
+ };
275
+ staticAccountKeys: string[];
276
+ instructions: {
277
+ programIdIndex: number;
278
+ accountKeyIndexes: number[];
279
+ data: string;
280
+ }[];
281
+ };
282
+ export type TronTransactionOperation = {
283
+ kind: 'transaction';
284
+ chainName: 'TRON';
285
+ chainId: string;
286
+ contractType: 'TransferContract' | 'TriggerSmartContract';
287
+ from: string;
288
+ to: string;
289
+ value: string;
290
+ data: string;
291
+ feeLimit: string;
292
+ };
293
+ export type StellarMemo = {
294
+ type: 'none';
295
+ } | {
296
+ type: 'text';
297
+ value: string;
298
+ } | {
299
+ type: 'id';
300
+ value: string;
301
+ } | {
302
+ type: 'hash' | 'return';
303
+ value: string;
304
+ };
305
+ export type StellarOperation = {
306
+ type: 'payment';
307
+ destination: string;
308
+ asset: string;
309
+ amount: string;
310
+ } | {
311
+ type: 'pathPaymentStrictSend';
312
+ destination: string;
313
+ sendAsset: string;
314
+ sendAmount: string;
315
+ destAsset: string;
316
+ destMin: string;
317
+ path: string[];
318
+ } | {
319
+ type: 'pathPaymentStrictReceive';
320
+ destination: string;
321
+ sendAsset: string;
322
+ sendMax: string;
323
+ destAsset: string;
324
+ destAmount: string;
325
+ path: string[];
326
+ } | {
327
+ type: 'createAccount';
328
+ destination: string;
329
+ startingBalance: string;
330
+ } | {
331
+ type: 'changeTrust';
332
+ asset: string;
333
+ limit: string;
334
+ };
335
+ export type StellarTransactionOperation = {
336
+ kind: 'transaction';
337
+ chainName: 'STELLAR';
338
+ /** `1` for the public network, `2` for testnet, `3` for futurenet. */
339
+ chainId: '1' | '2' | '3';
340
+ source: string;
341
+ /** The total fee in stroops. */
342
+ fee: string;
343
+ memo: StellarMemo;
344
+ operations: StellarOperation[];
345
+ };
346
+ export type BtcTransactionOperation = {
347
+ kind: 'transaction';
348
+ chainName: 'BTC';
349
+ /** `1` for Bitcoin mainnet, `2` for every other network. */
350
+ chainId: string;
351
+ txid: string;
352
+ feeSats: string;
353
+ outputs: {
354
+ script: string;
355
+ valueSats: string;
356
+ }[];
357
+ /** The signature hashes of the inputs the wallet signs; one approval covers a signature for each. */
358
+ sighashes: string[];
359
+ };
360
+ export type SigningIntent = SigningIntentEnvelope & ({
361
+ operation: MessageOperation;
362
+ limits?: never;
363
+ lifetime?: never;
364
+ } | {
365
+ operation: TypedDataOperation;
366
+ limits?: never;
367
+ lifetime?: never;
368
+ } | {
369
+ operation: RawOperation;
370
+ limits?: never;
371
+ lifetime?: never;
372
+ } | {
373
+ operation: Eip7702AuthOperation;
374
+ limits?: never;
375
+ lifetime?: never;
376
+ } | {
377
+ operation: EvmTransactionOperation;
378
+ limits: EvmSigningIntentLimits;
379
+ lifetime?: SigningIntentLifetime<'nonce'>;
380
+ } | {
381
+ operation: SvmTransactionOperation;
382
+ limits?: never;
383
+ lifetime: SigningIntentLifetime<'blockhash'>;
384
+ } | {
385
+ operation: TronTransactionOperation;
386
+ limits?: never;
387
+ lifetime: SigningIntentLifetime<'expiration'>;
388
+ } | {
389
+ operation: StellarTransactionOperation;
390
+ limits?: never;
391
+ lifetime: SigningIntentLifetime<'expiration'>;
392
+ } | {
393
+ operation: BtcTransactionOperation;
394
+ limits?: never;
395
+ lifetime?: never;
396
+ });
397
+ export type PreparedEvmTransactionSigningIntent = Pick<Extract<SigningIntent, {
398
+ operation: EvmTransactionOperation;
399
+ }>, 'operation' | 'limits' | 'lifetime'>;
400
+ export type PreparedSvmTransactionSigningIntent = Pick<Extract<SigningIntent, {
401
+ operation: SvmTransactionOperation;
402
+ }>, 'operation' | 'limits' | 'lifetime'>;
403
+ export type PreparedTronTransactionSigningIntent = Pick<Extract<SigningIntent, {
404
+ operation: TronTransactionOperation;
405
+ }>, 'operation' | 'limits' | 'lifetime'>;
406
+ export type PreparedStellarTransactionSigningIntent = Pick<Extract<SigningIntent, {
407
+ operation: StellarTransactionOperation;
408
+ }>, 'operation' | 'limits' | 'lifetime'>;
409
+ export type PreparedBtcTransactionSigningIntent = Pick<Extract<SigningIntent, {
410
+ operation: BtcTransactionOperation;
411
+ }>, 'operation' | 'limits' | 'lifetime'>;
412
+ export type PreparedTransactionSigningIntent = PreparedEvmTransactionSigningIntent | PreparedSvmTransactionSigningIntent | PreparedTronTransactionSigningIntent | PreparedStellarTransactionSigningIntent | PreparedBtcTransactionSigningIntent;
413
+ /**
414
+ * A signMessage/signTransaction SSE stream ends with this instead of the success event when
415
+ * the wallet belongs to a business account with an unmet signing-quorum requirement. Mirrors
416
+ * `BusinessAccountActionRequired`'s shape. `INTENT_REQUIRED`: sign `intent` and retry with
417
+ * `approvalQuorum`. `APPROVALS_REQUIRED`: a quorum of other members must approve `proposalId` first.
418
+ */
419
+ export type SigningQuorumActionRequired = Omit<BusinessAccountActionRequired, 'intent'> & {
420
+ intent?: SigningIntent;
421
+ };
422
+ /**
423
+ * Sent as the top-level `approvalQuorum` field on a signMessage retry, after
424
+ * the Initiator signs the Intent redcoast returned. Threaded through every
425
+ * SDK layer as its own param, to match redcoast's `ApprovalQuorumBundle`
426
+ * schema. Never populate `intent`/`intentSignature` speculatively — only in
427
+ * response to a `needsIntent` outcome, with the exact intent that was signed.
428
+ */
429
+ export type ApprovalQuorumRequestContext = Partial<Omit<SignMessageApprovalQuorum, 'intent'>> & {
430
+ intent?: SigningIntent;
431
+ };
432
+ /**
433
+ * Common fields shared by every chain client's `signMessage`/`signTransaction`
434
+ * (and EVM/Tempo's `signTypedData`). Generic over the context type so chains
435
+ * with a specialized alias (e.g. Tempo's `TempoSignMessageContext`) can still
436
+ * share this shape. All non-universal fields are optional so a chain that
437
+ * doesn't use one (e.g. `elevatedAccessToken`, `traceContext`) can simply omit it.
438
+ */
439
+ export type BaseSignParams<TContext = SignMessageContext> = {
440
+ password?: string;
441
+ signedSessionId: string;
442
+ mfaToken?: string;
443
+ elevatedAccessToken?: string;
444
+ context?: TContext;
445
+ approvalQuorum?: ApprovalQuorumRequestContext;
446
+ onError?: (error: Error) => void;
447
+ traceContext?: TraceContext;
448
+ };
67
449
  export type InitializeResult = {
68
450
  error: unknown | null;
69
451
  traceContext?: TraceContext;
@@ -72,8 +454,7 @@ export interface KeyShareBackupInfo {
72
454
  passwordEncrypted: boolean;
73
455
  backups: Record<BackupLocation, BackupLocationWithExternalKeyShareId[]>;
74
456
  }
75
- export interface WaasWalletProperties {
76
- derivationPath?: string;
457
+ export interface WaasWalletProperties extends Omit<ApiWaasWalletProperties, 'thresholdSignatureScheme'> {
77
458
  keyShares?: KeyShareInfo[];
78
459
  thresholdSignatureScheme?: ThresholdSignatureScheme;
79
460
  }
@@ -82,22 +463,47 @@ export interface WaasWalletResponse {
82
463
  accountAddress: string;
83
464
  chainName: string;
84
465
  derivationPath: string;
466
+ /** Client key-share pointers scoped to the authenticated principal. */
467
+ keyShares?: Array<Omit<KeyShareInfo, 'keygenId'> & {
468
+ keygenId?: string;
469
+ }>;
470
+ /**
471
+ * Primary share-set id (`WaasWallets.id`) for this wallet, surfaced as a
472
+ * single source of truth that callers can echo back to the server as
473
+ * `shareSetId` on subsequent operations. This is NOT `keyShares[].id` —
474
+ * see WalletProperties.keyShares for that.
475
+ */
476
+ shareSetId?: string;
477
+ shareSetType?: ShareSetType;
85
478
  thresholdSignatureScheme: string;
86
479
  walletId: string;
480
+ /**
481
+ * Other active share sets on this wallet (e.g. a `delegated` row
482
+ * alongside `rootUser`). Read-only awareness — the primary share set
483
+ * above is always the one used for signing on this principal.
484
+ */
485
+ otherShareSets?: ShareSet[];
87
486
  };
88
487
  }
89
- export interface KeyShareInfo {
90
- id: string;
91
- keygenId: string;
488
+ export interface KeyShareInfo extends WalletKeyShareInfo {
92
489
  backupLocation: BackupLocation;
93
- passwordEncrypted: boolean;
94
- externalKeyShareId?: string;
490
+ keygenId: NonNullable<WalletKeyShareInfo['keygenId']>;
95
491
  }
96
492
  export type FeatureFlags = Record<string, boolean>;
97
- export type ICloudConfig = {
98
- containerIdentifier?: string;
99
- apiToken?: string;
100
- environment?: 'development' | 'production';
493
+ /**
494
+ * One affected target for the one-off Argon2id (v3) re-backup. The v3 backup is no
495
+ * longer decryptable because its key derivation is only deterministic within a
496
+ * specific environment/setup, so it breaks when that environment changes.
497
+ * `externalKeyShareId` is that no-longer-decryptable v3 backup id; it is compared
498
+ * against the wallet's current dynamic id to decide whether a re-backup is needed.
499
+ */
500
+ export type Argon2idRebackupTarget = {
501
+ userId: string;
502
+ walletId: string;
503
+ externalKeyShareId: string;
504
+ };
505
+ export type ICloudConfig = Omit<ProjectSettingsSdkWaasICloud, 'environment'> & {
506
+ environment?: `${NonNullable<ProjectSettingsSdkWaasICloud['environment']>}`;
101
507
  };
102
508
  export interface DynamicWalletClientProps {
103
509
  environmentId: string;
@@ -116,6 +522,8 @@ export interface DynamicWalletClientProps {
116
522
  debug?: boolean;
117
523
  baseMPCRelayApiUrl?: string;
118
524
  featureFlags?: FeatureFlags;
525
+ /** Targets for the one-off Argon2id (v3) re-backup, sourced from the LaunchDarkly JSON flag. */
526
+ argon2idRebackupTargets?: Argon2idRebackupTarget[];
119
527
  authMode?: AuthMode;
120
528
  sdkVersion?: string;
121
529
  forwardMPCClient?: ForwardMPCClientV2;
@@ -140,6 +548,7 @@ export type BackupData = {
140
548
  version: string;
141
549
  createdAt: string;
142
550
  accountAddress: string;
551
+ shareSetId?: string;
143
552
  thresholdSignatureScheme: ThresholdSignatureScheme;
144
553
  hasPassword: boolean;
145
554
  encryption?: EncryptionMetadata;
@@ -161,9 +570,23 @@ export type IframeRequestMessages = {
161
570
  createWalletAccount: (request: RequestWithTraceContext<CreateWalletAccountRequest>) => Promise<CreateWalletAccountResponse | MessageTransportErrorResponse>;
162
571
  getWallets: (request: RequestWithTraceContext<GetWalletsRequest>) => Promise<GetWalletResponse[] | MessageTransportErrorResponse>;
163
572
  getAllWallets: (request: RequestWithTraceContext<GetAllWalletsRequest>) => Promise<GetWalletResponse[] | MessageTransportErrorResponse>;
573
+ createBusinessAccount: (request: RequestWithTraceContext<CreateBusinessAccountRequest>) => Promise<BusinessAccount | MessageTransportErrorResponse>;
574
+ listBusinessAccounts: (request: RequestWithTraceContext<ListBusinessAccountsRequest>) => Promise<BusinessAccountList | MessageTransportErrorResponse>;
575
+ getBusinessAccount: (request: RequestWithTraceContext<GetBusinessAccountRequest>) => Promise<BusinessAccountDetail | MessageTransportErrorResponse>;
576
+ linkWalletToBusinessAccount: (request: RequestWithTraceContext<LinkWalletToBusinessAccountRequest>) => Promise<BusinessAccountDetail | MessageTransportErrorResponse>;
577
+ addBusinessAccountMember: (request: RequestWithTraceContext<AddBusinessAccountMemberRequest>) => Promise<BusinessAccountMember | BusinessAccountActionRequired | MessageTransportErrorResponse>;
578
+ addBusinessAccountSigner: (request: RequestWithTraceContext<AddBusinessAccountSignerRequest>) => Promise<BusinessAccountSigner | MessageTransportErrorResponse>;
579
+ reshareToNewSignerShareSet: (request: RequestWithTraceContext<AddBusinessAccountSignerReshareRequest>) => Promise<{
580
+ shareSetId: string;
581
+ } | BusinessAccountActionRequired | MessageTransportErrorResponse>;
164
582
  getWallet: (request: RequestWithTraceContext<GetWalletRequest>) => Promise<GetWalletResponse | MessageTransportErrorResponse>;
165
583
  signMessage: (request: RequestWithTraceContext<RequestWithElevatedAccessToken<SignMessageRequest>>) => Promise<string | MessageTransportErrorResponse>;
166
- signRawMessage: (request: RequestWithTraceContext<RequestWithElevatedAccessToken<SignRawMessageRequest>>) => Promise<string | MessageTransportErrorResponse>;
584
+ createConfidentialSeed: (request: RequestWithTraceContext<CreateConfidentialSeedBrowserRequest>) => Promise<CreateConfidentialSeedResponse | MessageTransportErrorResponse>;
585
+ signConfidentialTransfer: (request: RequestWithTraceContext<SignConfidentialTransferBrowserRequest>) => Promise<SignConfidentialTransferBrowserResponse | MessageTransportErrorResponse>;
586
+ getConfidentialBalance: (request: RequestWithTraceContext<GetConfidentialBalanceBrowserRequest>) => Promise<SvmConfidentialBalanceResponse | MessageTransportErrorResponse>;
587
+ prepareSigningIntent: (request: RequestWithTraceContext<PrepareSigningIntentRequest>) => Promise<SigningIntent | MessageTransportErrorResponse>;
588
+ resumeSigningIntent: (request: RequestWithTraceContext<RequestWithElevatedAccessToken<ResumeSigningIntentRequest>>) => Promise<string | MessageTransportErrorResponse>;
589
+ signRawMessage: (request: RequestWithTraceContext<RequestWithElevatedAccessToken<SignMessageRequestBrowser>>) => Promise<string | MessageTransportErrorResponse>;
167
590
  signTypedData: (request: RequestWithTraceContext<RequestWithElevatedAccessToken<SignTypedDataRequest>>) => Promise<string | MessageTransportErrorResponse>;
168
591
  requiresPasswordForOperation: (request: RequestWithTraceContext<RequiresPasswordForOperationRequest>) => Promise<boolean | MessageTransportErrorResponse>;
169
592
  signTransaction: (request: RequestWithTraceContext<RequestWithElevatedAccessToken<SignTransactionRequest>>) => Promise<string | MessageTransportErrorResponse>;
@@ -172,14 +595,18 @@ export type IframeRequestMessages = {
172
595
  backupKeySharesToICloud: (request: RequestWithTraceContext<BackupKeySharesToICloudRequest>) => Promise<void | MessageTransportErrorResponse>;
173
596
  exportClientKeysharesFromGoogleDrive: (request: RequestWithTraceContext<ExportClientKeysharesFromGoogleDriveRequest>) => Promise<void | MessageTransportErrorResponse>;
174
597
  delegateKeyShares: (request: RequestWithTraceContext<DelegateKeySharesRequest>) => Promise<void | MessageTransportErrorResponse>;
598
+ offlineRecovery: (request: RequestWithTraceContext<OfflineRecoveryRequest>) => Promise<void | MessageTransportErrorResponse>;
175
599
  revokeDelegation: (request: RequestWithTraceContext<RevokeDelegationRequest>) => Promise<void | MessageTransportErrorResponse>;
176
600
  refreshWalletAccountShares: (request: RequestWithTraceContext<RequestWithElevatedAccessToken<RefreshWalletAccountSharesRequest>>) => Promise<void | MessageTransportErrorResponse>;
177
601
  reshare: (request: RequestWithTraceContext<RequestWithElevatedAccessToken<ReshareRequest>>) => Promise<void | MessageTransportErrorResponse>;
178
602
  exportPrivateKey: (request: RequestWithTraceContext<RequestWithElevatedAccessToken<ExportPrivateKeyRequest>>) => Promise<void | MessageTransportErrorResponse>;
603
+ prepareExportIntent: (request: RequestWithTraceContext<PrepareExportIntentRequest>) => Promise<ExportIntent | MessageTransportErrorResponse>;
604
+ prepareReshareIntent: (request: RequestWithTraceContext<PrepareReshareIntentRequest>) => Promise<ReshareIntent | MessageTransportErrorResponse>;
179
605
  verifyPassword: (request: RequestWithTraceContext<VerifyPasswordRequest>) => Promise<void | MessageTransportErrorResponse>;
180
- updatePassword: (request: RequestWithTraceContext<UpdatePasswordRequest>) => Promise<void | MessageTransportErrorResponse>;
181
- setPassword: (request: RequestWithTraceContext<SetPasswordRequest>) => Promise<void | MessageTransportErrorResponse>;
606
+ updatePassword: (request: RequestWithTraceContext<UpdatePasswordRequest>) => Promise<PasswordUpdateResponse | void | MessageTransportErrorResponse>;
607
+ setPassword: (request: RequestWithTraceContext<SetPasswordRequest>) => Promise<PasswordUpdateResponse | void | MessageTransportErrorResponse>;
182
608
  importPrivateKey: (request: RequestWithTraceContext<ImportPrivateKeyRequest>) => Promise<CreateWalletAccountResponse | MessageTransportErrorResponse>;
609
+ migrateFromFireblocks: (request: RequestWithTraceContext<MigrateFromFireblocksRequest>) => Promise<MigrateFromFireblocksResponse | MessageTransportErrorResponse>;
183
610
  exportClientKeyshares: (request: RequestWithTraceContext<ExportClientKeysharesRequest>) => Promise<void | MessageTransportErrorResponse>;
184
611
  offlineExportPrivateKey: (request: RequestWithTraceContext<OfflineExportPrivateKeyRequest>) => Promise<OfflineExportPrivateKeyResponse | MessageTransportErrorResponse>;
185
612
  displayICloudSignIn: (request: {
@@ -201,11 +628,17 @@ export type IframeRequestMessages = {
201
628
  getClientKeyShare: (request: GetClientKeyShareRequest) => Promise<GetClientKeyShareResponse | MessageTransportErrorResponse>;
202
629
  setClientKeyShare: (request: SetClientKeyShareRequest) => Promise<void | MessageTransportErrorResponse>;
203
630
  removeClientKeyShare: (request: RemoveClientKeyShareRequest) => Promise<void | MessageTransportErrorResponse>;
631
+ isICloudBackupAuthenticated: (request: IsICloudBackupAuthenticatedRequest) => Promise<IsICloudBackupAuthenticatedResponse | MessageTransportErrorResponse>;
632
+ saveICloudBackup: (request: SaveICloudBackupRequest) => Promise<void | MessageTransportErrorResponse>;
204
633
  getSignedSessionId: (request: GetSignedSessionIdRequest) => Promise<GetSignedSessionIdResponse | MessageTransportErrorResponse>;
634
+ notifyUnauthorized: (request: NotifyUnauthorizedRequest) => Promise<void | MessageTransportErrorResponse>;
205
635
  unlockWallet: (request: RequestWithTraceContext<UnlockWalletRequest>) => Promise<GetWalletResponse | MessageTransportErrorResponse>;
636
+ lockWallets: (request: RequestWithTraceContext<LockWalletsRequest>) => Promise<void | MessageTransportErrorResponse>;
206
637
  getWalletRecoveryState: (request: RequestWithTraceContext<GetWalletRecoveryStateRequest>) => Promise<WalletRecoveryState | MessageTransportErrorResponse>;
207
638
  getPrivateBalance: (request: RequestWithTraceContext<RequestWithElevatedAccessToken<GetPrivateBalanceRequest>>) => Promise<GetPrivateBalanceResponse | MessageTransportErrorResponse>;
208
- registerDust: (request: RequestWithTraceContext<RequestWithElevatedAccessToken<RegisterDustRequest>>) => Promise<RegisterDustResponse | MessageTransportErrorResponse>;
639
+ getWalletProvider: (request: RequestWithTraceContext<RequestWithElevatedAccessToken<GetPrivateBalanceRequest>>) => Promise<GetWalletProviderResponse | MessageTransportErrorResponse>;
640
+ balanceWalletProviderTransaction: (request: RequestWithTraceContext<RequestWithElevatedAccessToken<BalanceWalletProviderTransactionRequest>>) => Promise<BalanceWalletProviderTransactionResponse | MessageTransportErrorResponse>;
641
+ registerDust: (request: RequestWithTraceContext<RequestWithElevatedAccessToken<GetPrivateBalanceRequest>>) => Promise<RegisterDustResponse | MessageTransportErrorResponse>;
209
642
  createTransferTransaction: (request: RequestWithTraceContext<RequestWithElevatedAccessToken<CreateTransferTransactionRequest>>) => Promise<CreateTransferTransactionResponse | MessageTransportErrorResponse>;
210
643
  submitTransaction: (request: RequestWithTraceContext<RequestWithElevatedAccessToken<SubmitTransactionRequest>>) => Promise<SubmitTransactionResponse | MessageTransportErrorResponse>;
211
644
  revertTransaction: (request: RequestWithTraceContext<RequestWithElevatedAccessToken<RevertTransactionRequest>>) => Promise<RevertTransactionResponse | MessageTransportErrorResponse>;
@@ -217,6 +650,8 @@ export type CreateWalletAccountRequest = {
217
650
  signedSessionId: string;
218
651
  authToken?: string;
219
652
  bitcoinConfig?: BitcoinConfig;
653
+ /** When set, the wallet is owned by this business account (signer row created server-side). */
654
+ businessAccountId?: string;
220
655
  };
221
656
  export type CreateWalletAccountResponse = {
222
657
  chainName: string;
@@ -228,22 +663,64 @@ export type GetWalletsRequest = {
228
663
  chainName: string;
229
664
  authToken?: string;
230
665
  };
231
- export type GetAllWalletsRequest = {
666
+ export type GetAllWalletsRequest = Pick<GetWalletsRequest, 'chainName'>;
667
+ export type CreateBusinessAccountRequest = {
668
+ authToken?: string;
669
+ request?: CreateBusinessAccountSdkRequest;
670
+ };
671
+ export type ListBusinessAccountsRequest = {
672
+ authToken?: string;
673
+ };
674
+ export type GetBusinessAccountRequest = {
675
+ authToken?: string;
676
+ businessAccountId: string;
677
+ };
678
+ export type LinkWalletToBusinessAccountRequest = Pick<LinkBusinessAccountWalletSdkRequest, 'walletId' | 'businessAccountId'> & {
679
+ authToken?: string;
680
+ };
681
+ export type AddBusinessAccountMemberRequest = TargetSignerIdentity & GetBusinessAccountRequest & {
682
+ role?: BusinessAccountMemberRole;
683
+ };
684
+ export type AddBusinessAccountSignerRequest = GetBusinessAccountRequest & SignerTarget & {
685
+ walletId: string;
686
+ };
687
+ /** addSigner via the SSE reshare ceremony (chain-specific; needs the wallet's signing context). */
688
+ export type AddBusinessAccountSignerReshareBase = {
689
+ authToken?: string;
232
690
  chainName: string;
691
+ accountAddress: string;
692
+ businessAccountId: string;
693
+ signedSessionId: string;
694
+ password?: string;
695
+ targetSignerPassword?: string;
696
+ elevatedAccessToken?: string;
697
+ /**
698
+ * The signed intent for a governed account, added to the retry once a first
699
+ * call answers `BusinessAccountActionRequired` with `reason:
700
+ * 'INTENT_REQUIRED'`. Omit on the first call.
701
+ */
702
+ intent?: BusinessAccountIntent;
703
+ /** Signature over `canonicalizeJson(intent)`. Required together with `intent`. */
704
+ intentSignature?: string;
705
+ /** Optional rules to seed the new signer's policy layer with at mint time. */
706
+ initialSignerRules?: WaasPolicyRule[];
233
707
  };
708
+ export type AddBusinessAccountSignerReshareRequest = AddBusinessAccountSignerReshareBase & SignerTarget;
234
709
  /**
235
- * The kind of share set a wallet row represents. `rootUser` is the user's own
236
- * signing share set; `delegated` is a separate share set used by a delegated
237
- * server; `server` is a server-internal share set type.
710
+ * Share-set roles the SDK can encounter. `rootUser` is the wallet's primary
711
+ * set; `delegated` is a signing set held by the developer's project
712
+ * environment; `server` is a server-internal share set type;
713
+ * `offlineRecovery` is an independent 2/2 set for offline recovery — its
714
+ * client half lives in the user's cloud provider and its server half is
715
+ * delivered to the developer.
238
716
  */
239
- export type ShareSetType = 'rootUser' | 'delegated' | 'server';
717
+ export type ShareSetType = `${WaasWalletShareSetType}`;
240
718
  /**
241
719
  * Metadata for a share set the auth principal is aware of but doesn't sign with
242
720
  * directly (e.g., a `delegated` share set surfaced alongside the rootUser).
243
- * Mirrors redcoast's `WaasShareSet` schema.
721
+ * Uses the backend schema with wire-format timestamps and the SDK's public enum.
244
722
  */
245
- export type ShareSet = {
246
- shareSetId: string;
723
+ export type ShareSet = Omit<WaasShareSet, 'createdAt' | 'shareSetType' | 'thresholdSignatureScheme'> & {
247
724
  shareSetType: ShareSetType;
248
725
  thresholdSignatureScheme: ThresholdSignatureScheme;
249
726
  createdAt: string;
@@ -258,6 +735,16 @@ export type GetWalletResponse = {
258
735
  /** Identifier of the primary share set (the one this principal signs with). */
259
736
  shareSetId?: string;
260
737
  shareSetType?: ShareSetType;
738
+ /** Business account that owns this wallet; absent for personal wallets. */
739
+ businessAccountId?: string;
740
+ /**
741
+ * `BusinessAccountSigner.addedByUserId` — the user who provisioned this
742
+ * principal's share set on the wallet. When it differs from the current
743
+ * user, the share set was created on their behalf and its encrypted blob
744
+ * cannot be decrypted with their own password. Null/undefined for signer
745
+ * rows created before the field was tracked.
746
+ */
747
+ businessAccountSignerAddedByUserId?: string | null;
261
748
  /**
262
749
  * Other active share sets that exist on this wallet (e.g., a delegated share
263
750
  * set surfaced alongside rootUser). Read-only awareness — the SDK never picks
@@ -275,39 +762,55 @@ export type GetWalletRequest = {
275
762
  signedSessionId: string;
276
763
  authToken?: string;
277
764
  };
278
- export type SignMessageRequest = {
765
+ export type SignMessageRequest = Pick<SignMessageWithWaasRequest, 'message'> & {
279
766
  chainName: string;
280
- message: string;
281
767
  accountAddress: string;
282
768
  password?: string;
283
769
  signedSessionId: string;
284
770
  authToken?: string;
285
771
  mfaToken?: string;
286
772
  context?: string;
773
+ approvalQuorum?: ApprovalQuorumRequestContext;
287
774
  bitcoinConfig?: BitcoinConfig;
288
775
  };
289
- export type SignMessageRequestBrowser = {
776
+ export type SignMessageRequestBrowser = Omit<SignMessageRequest, 'context'> & Pick<SignMessageWithWaasRequest, 'context'>;
777
+ export type PrepareSigningIntentRequest = {
290
778
  chainName: string;
291
- message: string;
292
779
  accountAddress: string;
293
- password?: string;
294
- signedSessionId: string;
780
+ businessAccountId: string;
781
+ initiatorUserId: string;
782
+ completeBy?: string;
295
783
  authToken?: string;
296
- mfaToken?: string;
297
- context?: SignMessageContext;
784
+ /** The Dynamic wallet id the Intent signs. The iframe resolves it from the wallet when omitted; `createSigningIntent` refuses a request without one. */
785
+ walletId?: string;
786
+ } & ({
787
+ kind: 'message';
788
+ message: string;
298
789
  bitcoinConfig?: BitcoinConfig;
299
- };
300
- export type SignRawMessageRequest = {
301
- chainName: string;
790
+ } | {
791
+ kind: 'typedData';
792
+ typedData: string;
793
+ } | {
794
+ kind: 'raw';
302
795
  message: string;
303
- accountAddress: string;
304
- password?: string;
305
- signedSessionId: string;
306
- authToken?: string;
307
- mfaToken?: string;
308
- context?: SignMessageContext;
796
+ rawSign: NonNullable<SignMessageContext['rawSign']>;
309
797
  bitcoinConfig?: BitcoinConfig;
310
- };
798
+ } | {
799
+ kind: 'eip7702Auth';
800
+ eip7702Auth: NonNullable<SignMessageContext['eip7702Auth']>;
801
+ } | {
802
+ kind: 'transaction';
803
+ transaction: string;
804
+ chainId?: string;
805
+ bitcoinConfig?: BitcoinConfig;
806
+ signingIndexes?: number[];
807
+ allowedSighash?: number[];
808
+ allowedWitnessScripts?: string[];
809
+ refreshLimits?: EvmSigningIntentLimits;
810
+ /** EVM only: opt in to a signed refreshable nonce. Default keeps the nonce pinned. */
811
+ refreshableNonce?: boolean;
812
+ });
813
+ export type WithoutChainName<T> = T extends unknown ? Omit<T, 'chainName'> : never;
311
814
  export type RequiresPasswordForOperationRequest = {
312
815
  chainName: string;
313
816
  accountAddress: string;
@@ -324,6 +827,33 @@ export type SignTransactionRequest = {
324
827
  mfaToken?: string;
325
828
  chainId?: string;
326
829
  bitcoinConfig?: BitcoinConfig;
830
+ signingIndexes?: number[];
831
+ allowedSighash?: number[];
832
+ allowedWitnessScripts?: string[];
833
+ context?: SignMessageContext;
834
+ /** One approval covers one operation, including all of its signing targets. */
835
+ approvalQuorum?: ApprovalQuorumRequestContext;
836
+ };
837
+ /** An approved signing intent to resume exactly within its signed constraints. */
838
+ export type ResumeSigningIntentRequest = {
839
+ authToken?: string;
840
+ chainName: string;
841
+ intent: SigningIntent;
842
+ /**
843
+ * Chain value for an intent with a refreshable lifetime: the nonce (EVM),
844
+ * blockhash (SVM), block reference (TRON, a JSON object with `refBlockBytes`
845
+ * and `refBlockHash` as hex and `expiration` and `timestamp` in milliseconds)
846
+ * or account sequence and time bounds (STELLAR, a JSON object with the
847
+ * account's current `sequence` as Horizon returns it, and `minTime` and
848
+ * `maxTime` in seconds, all as decimal strings).
849
+ * Rejected for an intent that is not refreshable. Optional for EVM, where the
850
+ * signed nonce is the default. Required for SVM, TRON and STELLAR, because
851
+ * the signed intent carries no blockhash, block reference or sequence.
852
+ */
853
+ lifetimeValue?: string;
854
+ mfaToken?: string;
855
+ password?: string;
856
+ signedSessionId: string;
327
857
  };
328
858
  export type SignTypedDataRequest = {
329
859
  chainName: string;
@@ -333,6 +863,7 @@ export type SignTypedDataRequest = {
333
863
  signedSessionId: string;
334
864
  authToken?: string;
335
865
  mfaToken?: string;
866
+ approvalQuorum?: ApprovalQuorumRequestContext;
336
867
  };
337
868
  export type IsPasswordEncryptedRequest = {
338
869
  chainName: string;
@@ -344,16 +875,30 @@ export type BackupKeySharesToGoogleDriveRequest = {
344
875
  accountAddress: string;
345
876
  password?: string;
346
877
  signedSessionId: string;
878
+ sessionPublicKey?: string;
347
879
  authToken?: string;
348
880
  googleDriveAccessToken?: string;
881
+ /** When false, the cloud copy encrypts with the environment default key instead of the wallet password, so Drive recovery does not depend on it. Defaults to true. */
882
+ shouldBackupWithPassword?: boolean;
883
+ /** The initiator's signed reshare Intent, from `prepareReshareIntent`, on a governed wallet. */
884
+ approvalQuorum?: ReshareApprovalQuorumRequest;
885
+ /** The approved reshare proposal to redeem, from the `APPROVALS_REQUIRED` consent error. */
886
+ proposalId?: string;
349
887
  };
350
888
  export type BackupKeySharesToICloudRequest = {
351
889
  chainName: string;
352
890
  accountAddress: string;
353
891
  password?: string;
354
892
  signedSessionId: string;
893
+ sessionPublicKey?: string;
355
894
  authToken?: string;
356
895
  signInButtonId?: string;
896
+ /** When false, the cloud copy encrypts with the environment default key instead of the wallet password, so iCloud recovery does not depend on it. Defaults to true. */
897
+ shouldBackupWithPassword?: boolean;
898
+ /** The initiator's signed reshare Intent, from `prepareReshareIntent`, on a governed wallet. */
899
+ approvalQuorum?: ReshareApprovalQuorumRequest;
900
+ /** The approved reshare proposal to redeem, from the `APPROVALS_REQUIRED` consent error. */
901
+ proposalId?: string;
357
902
  };
358
903
  export type ExportClientKeysharesFromGoogleDriveRequest = {
359
904
  chainName: string;
@@ -363,19 +908,58 @@ export type ExportClientKeysharesFromGoogleDriveRequest = {
363
908
  authToken?: string;
364
909
  googleDriveAccessToken?: string;
365
910
  };
911
+ export type { SignMessageContext, SignMessageEvmTypedData, NonceResponse, SignMessageRawSign, GetEVMSponsoredTransactionStatusResponseStatusEnum, SignMessageEvmTransaction, JwtVerifiedCredential, ProjectSettings, WaasWalletSettings, ZerodevBundlerProvider, DelegatedShareDeliveryRequestEncryptedDelegatedShare, ProjectSettingsSdkWaasFireblocksMigration, EmailVerificationCreateResponse, SdkUser, VerifyResponse, EIP7702Authorization, WaasPolicyRule, WaasPolicyArgumentConstraint, WaasPolicyRuleValueLimit, WaasPolicyRuleOperationRestrictions, } from '#internal/sdk-api-core';
912
+ export { WaasChainEnum } from '@dynamic-labs/sdk-api-core/models/WaasChainEnum';
913
+ export { WaasPolicyConstraintCondition } from '@dynamic-labs/sdk-api-core/models/WaasPolicyConstraintCondition';
914
+ export { WaasPolicyRuleType } from '@dynamic-labs/sdk-api-core/models/WaasPolicyRuleType';
366
915
  export type DelegateKeySharesRequest = {
367
916
  chainName: string;
368
917
  accountAddress: string;
369
918
  password?: string;
370
919
  signedSessionId: string;
920
+ sessionPublicKey?: string;
371
921
  authToken?: string;
372
922
  mfaToken?: string;
923
+ /** Optional rules to seed the delegated Signer's policy layer with at mint time. */
924
+ initialSignerRules?: WaasPolicyRule[];
925
+ /** The initiator's signed reshare Intent, from `prepareReshareIntent`, on a governed wallet. */
926
+ approvalQuorum?: ReshareApprovalQuorumRequest;
927
+ /** The approved reshare proposal to redeem, from the `APPROVALS_REQUIRED` consent error. */
928
+ proposalId?: string;
929
+ };
930
+ /**
931
+ * Backup locations that can hold an offline-recovery share set's client half.
932
+ * Narrower than `BackupLocation` on purpose — the protocol should not admit
933
+ * `DYNAMIC` or `DELEGATED` here.
934
+ */
935
+ export type OfflineRecoveryCloudProvider = BackupLocation.GOOGLE_DRIVE | BackupLocation.ICLOUD;
936
+ export type OfflineRecoveryRequest = {
937
+ chainName: string;
938
+ accountAddress: string;
939
+ password?: string;
940
+ signedSessionId: string;
941
+ sessionPublicKey?: string;
942
+ authToken?: string;
943
+ mfaToken?: string;
944
+ /** Which cloud provider holds the exported set's client share. Defaults to Google Drive. */
945
+ cloudProvider?: OfflineRecoveryCloudProvider;
946
+ /** Provider-specific credential, when the host already holds one (Google Drive OAuth token today). */
947
+ cloudProviderAccessToken?: string;
948
+ /** Optional base64-encoded RSA public key the delivered recovery share is encrypted to. When omitted, defaults to the developer encryption key configured in the developer admin dashboard. */
949
+ recoveryEncryptionPublicKey?: string;
950
+ /** When false, the delivered cloud copy encrypts with the environment default key instead of the wallet password. Defaults to true. */
951
+ shouldBackupWithPassword?: boolean;
952
+ /** The initiator's signed reshare Intent, from `prepareReshareIntent`, on a governed wallet. */
953
+ approvalQuorum?: ReshareApprovalQuorumRequest;
954
+ /** The approved reshare proposal to redeem, from the `APPROVALS_REQUIRED` consent error. */
955
+ proposalId?: string;
373
956
  };
374
957
  export type RevokeDelegationRequest = {
375
958
  chainName: string;
376
959
  accountAddress: string;
377
960
  password?: string;
378
961
  signedSessionId: string;
962
+ sessionPublicKey?: string;
379
963
  authToken?: string;
380
964
  mfaToken?: string;
381
965
  };
@@ -384,6 +968,7 @@ export type RefreshWalletAccountSharesRequest = {
384
968
  accountAddress: string;
385
969
  password?: string;
386
970
  signedSessionId: string;
971
+ sessionPublicKey?: string;
387
972
  authToken?: string;
388
973
  mfaToken?: string;
389
974
  };
@@ -394,8 +979,13 @@ export type ReshareRequest = {
394
979
  newThresholdSignatureScheme: ThresholdSignatureScheme;
395
980
  password?: string;
396
981
  signedSessionId: string;
982
+ sessionPublicKey?: string;
397
983
  authToken?: string;
398
984
  mfaToken?: string;
985
+ /** The initiator's signed reshare Intent, sent with the first reshare call. */
986
+ approvalQuorum?: ReshareApprovalQuorumRequest;
987
+ /** The approved reshare proposal being redeemed, from the `SigningConsentRequiredError` the reshare call raised. */
988
+ proposalId?: string;
399
989
  };
400
990
  export type ExportPrivateKeyRequest = {
401
991
  chainName: string;
@@ -405,6 +995,146 @@ export type ExportPrivateKeyRequest = {
405
995
  authToken?: string;
406
996
  mfaToken?: string;
407
997
  bitcoinConfig?: BitcoinConfig;
998
+ /** The initiator's signed export Intent, sent with the first export call. */
999
+ approvalQuorum?: ExportApprovalQuorumRequest;
1000
+ /** The approved export proposal being redeemed, from the `SigningConsentRequiredError` the export call raised. */
1001
+ proposalId?: string;
1002
+ };
1003
+ /**
1004
+ * The Intent the initiator signs to start an export that needs approvals. It
1005
+ * binds one `exportId`. Field names match redcoast's and wallet-service's `ExportIntent`.
1006
+ */
1007
+ export type ExportIntent = {
1008
+ accountAddress: string;
1009
+ actionType: 'waasExportQuorumApprove';
1010
+ businessAccountId: string;
1011
+ completeBy: string;
1012
+ createdAt: string;
1013
+ initiatorUserId: string;
1014
+ intentId: string;
1015
+ operation: {
1016
+ exportId: string;
1017
+ kind: 'export';
1018
+ restriction: 'blockExport';
1019
+ };
1020
+ walletId: string;
1021
+ };
1022
+ /** What `createExportIntent` needs: the identity the Intent binds. */
1023
+ export type ExportIntentParams = {
1024
+ accountAddress: string;
1025
+ businessAccountId: string;
1026
+ completeBy?: string;
1027
+ exportId: string;
1028
+ initiatorUserId: string;
1029
+ walletId: string;
1030
+ };
1031
+ /**
1032
+ * The initiator's signed export Intent, sent as `approvalQuorum` on the export
1033
+ * call. When the wallet's policy needs approvals the export answers with a
1034
+ * `SigningConsentRequiredError` instead of starting: `INTENT_REQUIRED` when none
1035
+ * was sent, otherwise `APPROVALS_REQUIRED` with the `proposalId` to redeem once
1036
+ * the approvers have approved.
1037
+ */
1038
+ export type ExportApprovalQuorumRequest = {
1039
+ intent: ExportIntent;
1040
+ intentSignature: string;
1041
+ };
1042
+ /**
1043
+ * The recovery key an offline-recovery reshare encrypts the server's share to,
1044
+ * as redcoast forwards it. The intent must echo it exactly, `kid` included, so
1045
+ * take it from the `INTENT_REQUIRED` consent error rather than building it.
1046
+ */
1047
+ export type ReshareRecoveryEncryptionKey = {
1048
+ alg: 'HYBRID-RSA-AES-256';
1049
+ kid: string;
1050
+ publicKeyPemB64: string;
1051
+ };
1052
+ /**
1053
+ * The reshare a `ReshareIntent` approves: its operation, the threshold it
1054
+ * moves to and, for an offline recovery, the recovery key. Approvals bind to
1055
+ * what the reshare IS, never to an attempt id or a roomId. Field names match
1056
+ * redcoast's and wallet-service's `ReshareIntentOperation`.
1057
+ */
1058
+ export type ReshareIntentOperation = {
1059
+ kind: 'reshare';
1060
+ newThresholdSignatureScheme: ThresholdSignatureScheme;
1061
+ /** Required for `offlineRecovery`; absent otherwise. */
1062
+ offlineRecoveryEncryptionKey?: ReshareRecoveryEncryptionKey;
1063
+ reshareType: GovernedReshareOperation;
1064
+ };
1065
+ /**
1066
+ * The Intent the initiator signs to start a reshare that needs approvals.
1067
+ * Field names match redcoast's and wallet-service's `ReshareIntent`.
1068
+ */
1069
+ export type ReshareIntent = {
1070
+ accountAddress: string;
1071
+ actionType: 'waasReshareQuorumApprove';
1072
+ businessAccountId: string;
1073
+ completeBy: string;
1074
+ createdAt: string;
1075
+ initiatorUserId: string;
1076
+ intentId: string;
1077
+ operation: ReshareIntentOperation;
1078
+ walletId: string;
1079
+ };
1080
+ /** What `createReshareIntent` needs: the reshare's request fields plus the identity the Intent binds. */
1081
+ export type ReshareIntentParams = {
1082
+ accountAddress: string;
1083
+ businessAccountId: string;
1084
+ completeBy?: string;
1085
+ initiatorUserId: string;
1086
+ newThresholdSignatureScheme: ThresholdSignatureScheme;
1087
+ /** The recovery key from the `INTENT_REQUIRED` consent error (offlineRecovery reshare only). */
1088
+ offlineRecoveryEncryptionKey?: ReshareRecoveryEncryptionKey;
1089
+ reshareType: GovernedReshareOperation;
1090
+ walletId: string;
1091
+ };
1092
+ /**
1093
+ * The initiator's signed reshare Intent, sent as `approvalQuorum` on the
1094
+ * reshare call. Mirrors the export flow: the reshare answers with a
1095
+ * `SigningConsentRequiredError` instead of starting — `INTENT_REQUIRED` when
1096
+ * no quorum was sent, otherwise `APPROVALS_REQUIRED` with the `proposalId` to
1097
+ * redeem once the approvers have approved.
1098
+ */
1099
+ export type ReshareApprovalQuorumRequest = {
1100
+ intent: ReshareIntent;
1101
+ intentSignature: string;
1102
+ };
1103
+ /**
1104
+ * Builds the export Intent for this wallet. Runs no ceremony, makes no API
1105
+ * call and needs no MFA token; the caller signs the result with the session key.
1106
+ */
1107
+ export type PrepareExportIntentRequest = {
1108
+ accountAddress: string;
1109
+ authToken?: string;
1110
+ bitcoinConfig?: BitcoinConfig;
1111
+ businessAccountId: string;
1112
+ chainName: string;
1113
+ completeBy?: string;
1114
+ initiatorUserId: string;
1115
+ password?: string;
1116
+ signedSessionId: string;
1117
+ };
1118
+ /** The approval-gated reshare operations `prepareReshareIntent` builds an Intent for. */
1119
+ export type GovernedReshareOperation = 'cloudBackup' | 'delegatedAccess' | 'offlineRecovery';
1120
+ /**
1121
+ * Builds the reshare Intent for one of the governed reshare entry points
1122
+ * (`backupKeySharesToGoogleDrive`/`backupKeySharesToICloud`,
1123
+ * `delegateKeyShares`, `offlineRecovery`). Runs no ceremony and makes no API
1124
+ * call; the caller signs the result with the session key.
1125
+ */
1126
+ export type PrepareReshareIntentRequest = {
1127
+ accountAddress: string;
1128
+ authToken?: string;
1129
+ businessAccountId: string;
1130
+ chainName: string;
1131
+ completeBy?: string;
1132
+ initiatorUserId: string;
1133
+ /** Required for `offlineRecovery`: the key from the `INTENT_REQUIRED` consent error. */
1134
+ offlineRecoveryEncryptionKey?: ReshareRecoveryEncryptionKey;
1135
+ operation: GovernedReshareOperation;
1136
+ password?: string;
1137
+ signedSessionId: string;
408
1138
  };
409
1139
  export type ProveAleoTransactionRequest = {
410
1140
  chainName: 'ALEO';
@@ -458,23 +1188,32 @@ export type VerifyPasswordRequest = {
458
1188
  signedSessionId: string;
459
1189
  authToken?: string;
460
1190
  };
461
- export type UpdatePasswordRequest = {
462
- chainName: string;
463
- accountAddress: string;
1191
+ export type PasswordOverride = {
1192
+ walletId: string;
464
1193
  existingPassword: string;
465
- newPassword: string;
466
- signedSessionId: string;
467
- authToken?: string;
468
- passwordUpdateBatchId?: string;
1194
+ };
1195
+ export type UpdatePasswordRequest = SetPasswordRequest & {
1196
+ existingPassword: string;
1197
+ /** Existing credentials for wallets that do not use the user's current password. */
1198
+ passwordOverrides?: PasswordOverride[];
469
1199
  };
470
1200
  export type SetPasswordRequest = {
471
1201
  chainName: string;
472
1202
  accountAddress: string;
473
1203
  newPassword: string;
474
1204
  signedSessionId: string;
1205
+ sessionPublicKey?: string;
475
1206
  authToken?: string;
476
1207
  passwordUpdateBatchId?: string;
477
1208
  };
1209
+ /**
1210
+ * Outcome of one wallet's check-in to a password-update batch. The server activates the
1211
+ * batch on the last wallet's check-in, so `pending` is expected for the others.
1212
+ * Undefined when the update did not carry a `passwordUpdateBatchId`.
1213
+ */
1214
+ export type PasswordUpdateResponse = {
1215
+ passwordUpdateStatus?: 'pending' | 'activated';
1216
+ };
478
1217
  export type ImportPrivateKeyRequest = {
479
1218
  chainName: string;
480
1219
  privateKey: string;
@@ -486,6 +1225,73 @@ export type ImportPrivateKeyRequest = {
486
1225
  addressType?: string;
487
1226
  /** ID of the legacy embedded wallet being upgraded to v3 */
488
1227
  legacyWalletId?: string;
1228
+ /**
1229
+ * For ed25519 chains (SVM/TON/SUI) only: when true, `privateKey` is a raw
1230
+ * 32-byte signing scalar (hex) exported from an external MPC system (e.g.
1231
+ * Fireblocks Embedded Wallets), not a seed / standard secret key. Routes the
1232
+ * import through the non-exportable Ed25519 protocol.
1233
+ */
1234
+ isRawScalarImport?: boolean;
1235
+ };
1236
+ export type MigrateFromFireblocksRequest = {
1237
+ password?: string;
1238
+ signedSessionId: string;
1239
+ authToken?: string;
1240
+ fireblocks: {
1241
+ deviceId: string;
1242
+ jwt: string;
1243
+ walletPassword: string;
1244
+ ncwStorage: Record<string, string>;
1245
+ /**
1246
+ * SLIP-0044 coin types per chain name for BIP44 derivation off the takeover xprv.
1247
+ * Defaults: EVM=60 (mainnet ETH), BTC=0. Sepolia/other testnets pass `{ EVM: 1 }`.
1248
+ * The override applies to every migrated account — one call cannot mix mainnet
1249
+ * and testnet addresses of the same chain; migrate them in separate calls.
1250
+ */
1251
+ coinTypes?: Record<string, number>;
1252
+ /**
1253
+ * Expected wallet address per chain name (the address Fireblocks held) for
1254
+ * Fireblocks account 0. When present, the iframe verifies the imported Dynamic
1255
+ * address matches it so a wrong derivation fails loudly instead of producing a
1256
+ * silent, unusable wallet.
1257
+ */
1258
+ expectedAddresses?: Record<string, string>;
1259
+ /**
1260
+ * Additional Fireblocks accounts to migrate. Each entry migrates the addresses
1261
+ * that account holds into new wallets, one per chain. `expectedAddresses` above
1262
+ * is shorthand for account 0 — an `accounts` entry with `accountIndex: 0`
1263
+ * merges into it rather than migrating the same wallet twice.
1264
+ */
1265
+ accounts?: {
1266
+ /** The Fireblocks account index (BIP44 account field) to derive keys at. */
1267
+ accountIndex: number;
1268
+ expectedAddresses: Record<string, string>;
1269
+ }[];
1270
+ };
1271
+ };
1272
+ export type MigratedWalletResult = {
1273
+ chainName: string;
1274
+ /** The Fireblocks account this wallet came from; 0 for `expectedAddresses`. */
1275
+ fireblocksAccountIndex?: number;
1276
+ result: {
1277
+ ok: true;
1278
+ account: CreateWalletAccountResponse;
1279
+ fireblocksAlgorithm: string;
1280
+ fireblocksKeyId: string;
1281
+ alreadyMigrated?: false;
1282
+ } | {
1283
+ ok: true;
1284
+ alreadyMigrated: true;
1285
+ } | {
1286
+ ok: false;
1287
+ errorCode: string;
1288
+ };
1289
+ };
1290
+ export type MigrateFromFireblocksResponse = {
1291
+ wallets: MigratedWalletResult[];
1292
+ migration: {
1293
+ fireblocksDeviceId: string;
1294
+ };
489
1295
  };
490
1296
  export type ExportClientKeysharesRequest = {
491
1297
  chainName: string;
@@ -507,11 +1313,20 @@ export type OfflineExportPrivateKeyResponse = {
507
1313
  */
508
1314
  export type GetSignedSessionIdRequest = Record<string, never>;
509
1315
  /**
510
- * Internal: Response from host to iframe with the signed session ID
1316
+ * Internal: Response from host to iframe with the signed session ID and the
1317
+ * session public key it was signed with. `publicKey` is optional so older hosts
1318
+ * stay compatible (the backup header is then omitted and the keyshare service
1319
+ * logs it as absent).
511
1320
  */
512
1321
  export type GetSignedSessionIdResponse = {
513
1322
  signedSessionId: string;
1323
+ publicKey?: string;
514
1324
  };
1325
+ /**
1326
+ * Internal: Request from iframe to host signalling that a backend call returned
1327
+ * 401. Carries no payload — the host reacts by logging the user out.
1328
+ */
1329
+ export type NotifyUnauthorizedRequest = Record<string, never>;
515
1330
  /**
516
1331
  * Internal: Request from iframe to host to get client key shares from secure storage
517
1332
  */
@@ -537,6 +1352,23 @@ export type SetClientKeyShareRequest = {
537
1352
  export type RemoveClientKeyShareRequest = {
538
1353
  accountAddress: string;
539
1354
  };
1355
+ /**
1356
+ * Internal: Request from iframe to host to check whether the host's iCloud backup
1357
+ * adapter can currently back up (the device's iCloud account is signed in)
1358
+ */
1359
+ export type IsICloudBackupAuthenticatedRequest = Record<string, never>;
1360
+ /**
1361
+ * Internal: Response from host to iframe with the iCloud backup adapter's auth state
1362
+ */
1363
+ export type IsICloudBackupAuthenticatedResponse = {
1364
+ isAuthenticated: boolean;
1365
+ };
1366
+ /**
1367
+ * Internal: Request from iframe to host to save a client key share backup to iCloud
1368
+ */
1369
+ export type SaveICloudBackupRequest = {
1370
+ backupData: unknown;
1371
+ };
540
1372
  export type UnlockWalletRequest = {
541
1373
  chainName: string;
542
1374
  accountAddress: string;
@@ -544,6 +1376,12 @@ export type UnlockWalletRequest = {
544
1376
  signedSessionId: string;
545
1377
  authToken?: string;
546
1378
  };
1379
+ export type LockWalletsRequest = {
1380
+ chainName: string;
1381
+ /** When set, only this wallet is re-locked; omitted locks every unlocked wallet. */
1382
+ accountAddress?: string;
1383
+ authToken?: string;
1384
+ };
547
1385
  export type GetWalletRecoveryStateRequest = {
548
1386
  chainName: string;
549
1387
  accountAddress: string;
@@ -564,6 +1402,8 @@ export type GetPrivateBalanceRequest = {
564
1402
  signedSessionId: string;
565
1403
  authToken?: string;
566
1404
  mfaToken?: string;
1405
+ /** Midnight network to operate on: 0/'preview' (default) or 1/'mainnet'. */
1406
+ networkId?: number | string;
567
1407
  };
568
1408
  /**
569
1409
  * Midnight-specific. Mirrors the three balance dimensions Midnight
@@ -579,8 +1419,18 @@ export type GetPrivateBalanceResponse = {
579
1419
  * Compact contract-minted shielded tokens (native NIGHT does not
580
1420
  * currently exist on the shielded side). */
581
1421
  shielded: Record<string, string>;
582
- dust: string;
1422
+ /** Dust balance plus its generation cap (v4 `DustFullInfo.maxCap`,
1423
+ * summed across the wallet's dust coins). `cap` enables the dust
1424
+ * fill/generation gauge in consumers. */
1425
+ dust: {
1426
+ balance: string;
1427
+ cap: string;
1428
+ };
583
1429
  address: string;
1430
+ /** False while dust is still syncing in the background. Balance reads
1431
+ * resolve once shielded + unshielded are synced, so dust may be
1432
+ * incomplete — consumers can show a "dust loading" state and poll. */
1433
+ dustSynced: boolean;
584
1434
  };
585
1435
  /**
586
1436
  * Midnight-specific. "Dust" is Midnight's continuously-generated gas
@@ -589,14 +1439,7 @@ export type GetPrivateBalanceResponse = {
589
1439
  * registration, NIGHT holders produce no Dust and can't pay fees.
590
1440
  * No-op for any other chain.
591
1441
  */
592
- export type RegisterDustRequest = {
593
- chainName: string;
594
- accountAddress: string;
595
- password?: string;
596
- signedSessionId: string;
597
- authToken?: string;
598
- mfaToken?: string;
599
- };
1442
+ export type { GetPrivateBalanceRequest as RegisterDustRequest };
600
1443
  /** Midnight-specific. See `RegisterDustRequest`. */
601
1444
  export type RegisterDustResponse = {
602
1445
  /** Current dust balance at the time of the call. 0 is normal right after
@@ -646,6 +1489,8 @@ export type CreateTransferTransactionRequest = {
646
1489
  signedSessionId: string;
647
1490
  authToken?: string;
648
1491
  mfaToken?: string;
1492
+ /** Midnight network to operate on: 0/'preview' (default) or 1/'mainnet'. */
1493
+ networkId?: number | string;
649
1494
  };
650
1495
  /** Midnight-specific. See `CreateTransferTransactionRequest`. */
651
1496
  export type CreateTransferTransactionResponse = {
@@ -674,11 +1519,20 @@ export type SubmitTransactionRequest = {
674
1519
  signedSessionId: string;
675
1520
  authToken?: string;
676
1521
  mfaToken?: string;
1522
+ /** Midnight network to operate on: 0/'preview' (default) or 1/'mainnet'. */
1523
+ networkId?: number | string;
677
1524
  };
678
1525
  /** Midnight-specific. See `SubmitTransactionRequest`. */
679
1526
  export type SubmitTransactionResponse = {
680
- /** On-chain transaction hash / identifier returned by the ledger. */
1527
+ /** Canonical on-chain transaction hash — what block explorers index by. */
681
1528
  txHash: string;
1529
+ /**
1530
+ * Submission identifier the ledger returns. Distinct from `txHash`: inclusion
1531
+ * is observed by polling `transactions(offset: { identifier })`, so watching
1532
+ * with the hash never resolves even for a transaction that succeeded.
1533
+ * midnight-js `submitTx` consumers need this one.
1534
+ */
1535
+ txIdentifier?: string;
682
1536
  /** Unshielded balance after the tx (only present when waitForBalance was true). */
683
1537
  balanceAfter?: string;
684
1538
  };
@@ -714,6 +1568,8 @@ export type RevertTransactionRequest = {
714
1568
  signedSessionId: string;
715
1569
  authToken?: string;
716
1570
  mfaToken?: string;
1571
+ /** Midnight network to operate on: 0/'preview' (default) or 1/'mainnet'. */
1572
+ networkId?: number | string;
717
1573
  };
718
1574
  /** Midnight-specific. See `RevertTransactionRequest`. */
719
1575
  export type RevertTransactionResponse = {
@@ -727,21 +1583,37 @@ export type RevertTransactionResponse = {
727
1583
  /** Human-readable summary. */
728
1584
  message: string;
729
1585
  };
730
- export type GetWalletProviderRequest = {
1586
+ export type { GetPrivateBalanceRequest as GetWalletProviderRequest };
1587
+ export type GetWalletProviderResponse = {
1588
+ coinPublicKey: string;
1589
+ encryptionPublicKey: string;
1590
+ status: 'ready';
1591
+ };
1592
+ /**
1593
+ * Midnight-specific. Balances a midnight-js UnboundTransaction inside the
1594
+ * embedded-wallet iframe, where shielded, DUST, and MPC key material remains.
1595
+ */
1596
+ export type BalanceWalletProviderTransactionRequest = {
731
1597
  chainName: string;
732
1598
  accountAddress: string;
1599
+ /** Base64-encoded UnboundTransaction (`signature`/`proof`/`pre-binding`). */
1600
+ transaction: string;
1601
+ /** Optional ISO-8601 transaction expiry. */
1602
+ ttl?: string;
733
1603
  password?: string;
734
1604
  signedSessionId: string;
735
1605
  authToken?: string;
736
1606
  mfaToken?: string;
1607
+ /** Midnight network to operate on: 0/'preview' (default) or 1/'mainnet'. */
1608
+ networkId?: number | string;
737
1609
  };
738
- export type GetWalletProviderResponse = {
739
- coinPublicKey: string;
740
- encryptionPublicKey: string;
741
- status: 'ready';
1610
+ export type BalanceWalletProviderTransactionResponse = {
1611
+ /** Base64-encoded FinalizedTransaction (`signature`/`proof`/`binding`). */
1612
+ transaction: string;
742
1613
  };
743
1614
  export type MessageTransportErrorResponse = {
744
1615
  error: string;
1616
+ name?: string;
745
1617
  };
746
1618
  /**
747
1619
  * Abstraction for the communication channel between the SDK and its
@@ -781,21 +1653,22 @@ export interface SecureStorageAdapter {
781
1653
  setClientKeyShare(accountAddress: string, shares: unknown[]): Promise<void>;
782
1654
  removeClientKeyShare(accountAddress: string): Promise<void>;
783
1655
  }
784
- export type BackupLocationWithExternalKeyShareId = {
1656
+ /**
1657
+ * Adapter interface for backing up client key shares to iCloud from the host.
1658
+ * Used by native mobile apps, where the hosted iframe cannot show CloudKit JS's
1659
+ * sign-in button and the device's own iCloud account is used instead.
1660
+ */
1661
+ export interface ICloudBackupAdapter {
1662
+ isAuthenticated(): Promise<boolean>;
1663
+ saveBackup(backupData: unknown): Promise<void>;
1664
+ }
1665
+ export type BackupLocationWithExternalKeyShareId = Omit<BackupKeySharesToLocationsRequestLocations, 'location' | 'tokenSource'> & {
785
1666
  location: BackupLocation;
786
- externalKeyShareId?: string;
1667
+ externalKeyShareIds?: string[];
787
1668
  id?: string;
788
- keygenId?: string;
789
- passwordEncrypted?: boolean;
790
- };
791
- export type EncryptedDelegatedKeyShareEnvelope = {
792
- alg: string;
793
- iv: string;
794
- ct: string;
795
- tag: string;
796
- ek: string;
797
- kid?: string;
1669
+ tokenSource?: `${NonNullable<BackupKeySharesToLocationsRequestLocations['tokenSource']>}`;
798
1670
  };
1671
+ export type EncryptedDelegatedKeyShareEnvelope = DelegatedShareDeliveryRequestEncryptedDelegatedShare;
799
1672
  export interface ILogger {
800
1673
  debug(message: string, context?: object, error?: Error): void;
801
1674
  debug(message: string, ...args: any[]): void;