@dynamic-labs-wallet/core 0.0.354 → 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 +2632 -367
  2. package/index.esm.js +2550 -332
  3. package/package.json +21 -8
  4. package/src/api/api.d.ts +550 -121
  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 +29 -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 +89 -5
  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 +960 -91
  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,29 +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[];
52
151
  };
53
- export type OpenRoomResponse = {
54
- roomId: string;
55
- serverKeygenIds: string[];
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;
56
165
  };
57
- export type ReshareResponse = {
58
- roomId: string;
59
- serverKeygenIds: string[];
60
- newServerKeygenIds: 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;
61
188
  };
62
- export type RefreshResponse = {
63
- roomId: string;
64
- serverKeygenIds: 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;
65
202
  };
66
203
  export declare enum SuccessEventType {
67
204
  KeygenComplete = "keygen_complete",
68
205
  RoomCreated = "room_created",
69
- CeremonyComplete = "ceremony_complete"
206
+ CeremonyComplete = "ceremony_complete",
207
+ ConsentRequired = "consent_required"
70
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
+ };
71
449
  export type InitializeResult = {
72
450
  error: unknown | null;
73
451
  traceContext?: TraceContext;
@@ -76,8 +454,7 @@ export interface KeyShareBackupInfo {
76
454
  passwordEncrypted: boolean;
77
455
  backups: Record<BackupLocation, BackupLocationWithExternalKeyShareId[]>;
78
456
  }
79
- export interface WaasWalletProperties {
80
- derivationPath?: string;
457
+ export interface WaasWalletProperties extends Omit<ApiWaasWalletProperties, 'thresholdSignatureScheme'> {
81
458
  keyShares?: KeyShareInfo[];
82
459
  thresholdSignatureScheme?: ThresholdSignatureScheme;
83
460
  }
@@ -86,22 +463,47 @@ export interface WaasWalletResponse {
86
463
  accountAddress: string;
87
464
  chainName: string;
88
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;
89
478
  thresholdSignatureScheme: string;
90
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[];
91
486
  };
92
487
  }
93
- export interface KeyShareInfo {
94
- id: string;
95
- keygenId: string;
488
+ export interface KeyShareInfo extends WalletKeyShareInfo {
96
489
  backupLocation: BackupLocation;
97
- passwordEncrypted: boolean;
98
- externalKeyShareId?: string;
490
+ keygenId: NonNullable<WalletKeyShareInfo['keygenId']>;
99
491
  }
100
492
  export type FeatureFlags = Record<string, boolean>;
101
- export type ICloudConfig = {
102
- containerIdentifier?: string;
103
- apiToken?: string;
104
- 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']>}`;
105
507
  };
106
508
  export interface DynamicWalletClientProps {
107
509
  environmentId: string;
@@ -120,6 +522,8 @@ export interface DynamicWalletClientProps {
120
522
  debug?: boolean;
121
523
  baseMPCRelayApiUrl?: string;
122
524
  featureFlags?: FeatureFlags;
525
+ /** Targets for the one-off Argon2id (v3) re-backup, sourced from the LaunchDarkly JSON flag. */
526
+ argon2idRebackupTargets?: Argon2idRebackupTarget[];
123
527
  authMode?: AuthMode;
124
528
  sdkVersion?: string;
125
529
  forwardMPCClient?: ForwardMPCClientV2;
@@ -144,6 +548,7 @@ export type BackupData = {
144
548
  version: string;
145
549
  createdAt: string;
146
550
  accountAddress: string;
551
+ shareSetId?: string;
147
552
  thresholdSignatureScheme: ThresholdSignatureScheme;
148
553
  hasPassword: boolean;
149
554
  encryption?: EncryptionMetadata;
@@ -165,9 +570,23 @@ export type IframeRequestMessages = {
165
570
  createWalletAccount: (request: RequestWithTraceContext<CreateWalletAccountRequest>) => Promise<CreateWalletAccountResponse | MessageTransportErrorResponse>;
166
571
  getWallets: (request: RequestWithTraceContext<GetWalletsRequest>) => Promise<GetWalletResponse[] | MessageTransportErrorResponse>;
167
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>;
168
582
  getWallet: (request: RequestWithTraceContext<GetWalletRequest>) => Promise<GetWalletResponse | MessageTransportErrorResponse>;
169
583
  signMessage: (request: RequestWithTraceContext<RequestWithElevatedAccessToken<SignMessageRequest>>) => Promise<string | MessageTransportErrorResponse>;
170
- 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>;
171
590
  signTypedData: (request: RequestWithTraceContext<RequestWithElevatedAccessToken<SignTypedDataRequest>>) => Promise<string | MessageTransportErrorResponse>;
172
591
  requiresPasswordForOperation: (request: RequestWithTraceContext<RequiresPasswordForOperationRequest>) => Promise<boolean | MessageTransportErrorResponse>;
173
592
  signTransaction: (request: RequestWithTraceContext<RequestWithElevatedAccessToken<SignTransactionRequest>>) => Promise<string | MessageTransportErrorResponse>;
@@ -176,14 +595,18 @@ export type IframeRequestMessages = {
176
595
  backupKeySharesToICloud: (request: RequestWithTraceContext<BackupKeySharesToICloudRequest>) => Promise<void | MessageTransportErrorResponse>;
177
596
  exportClientKeysharesFromGoogleDrive: (request: RequestWithTraceContext<ExportClientKeysharesFromGoogleDriveRequest>) => Promise<void | MessageTransportErrorResponse>;
178
597
  delegateKeyShares: (request: RequestWithTraceContext<DelegateKeySharesRequest>) => Promise<void | MessageTransportErrorResponse>;
598
+ offlineRecovery: (request: RequestWithTraceContext<OfflineRecoveryRequest>) => Promise<void | MessageTransportErrorResponse>;
179
599
  revokeDelegation: (request: RequestWithTraceContext<RevokeDelegationRequest>) => Promise<void | MessageTransportErrorResponse>;
180
600
  refreshWalletAccountShares: (request: RequestWithTraceContext<RequestWithElevatedAccessToken<RefreshWalletAccountSharesRequest>>) => Promise<void | MessageTransportErrorResponse>;
181
601
  reshare: (request: RequestWithTraceContext<RequestWithElevatedAccessToken<ReshareRequest>>) => Promise<void | MessageTransportErrorResponse>;
182
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>;
183
605
  verifyPassword: (request: RequestWithTraceContext<VerifyPasswordRequest>) => Promise<void | MessageTransportErrorResponse>;
184
- updatePassword: (request: RequestWithTraceContext<UpdatePasswordRequest>) => Promise<void | MessageTransportErrorResponse>;
185
- 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>;
186
608
  importPrivateKey: (request: RequestWithTraceContext<ImportPrivateKeyRequest>) => Promise<CreateWalletAccountResponse | MessageTransportErrorResponse>;
609
+ migrateFromFireblocks: (request: RequestWithTraceContext<MigrateFromFireblocksRequest>) => Promise<MigrateFromFireblocksResponse | MessageTransportErrorResponse>;
187
610
  exportClientKeyshares: (request: RequestWithTraceContext<ExportClientKeysharesRequest>) => Promise<void | MessageTransportErrorResponse>;
188
611
  offlineExportPrivateKey: (request: RequestWithTraceContext<OfflineExportPrivateKeyRequest>) => Promise<OfflineExportPrivateKeyResponse | MessageTransportErrorResponse>;
189
612
  displayICloudSignIn: (request: {
@@ -205,11 +628,17 @@ export type IframeRequestMessages = {
205
628
  getClientKeyShare: (request: GetClientKeyShareRequest) => Promise<GetClientKeyShareResponse | MessageTransportErrorResponse>;
206
629
  setClientKeyShare: (request: SetClientKeyShareRequest) => Promise<void | MessageTransportErrorResponse>;
207
630
  removeClientKeyShare: (request: RemoveClientKeyShareRequest) => Promise<void | MessageTransportErrorResponse>;
631
+ isICloudBackupAuthenticated: (request: IsICloudBackupAuthenticatedRequest) => Promise<IsICloudBackupAuthenticatedResponse | MessageTransportErrorResponse>;
632
+ saveICloudBackup: (request: SaveICloudBackupRequest) => Promise<void | MessageTransportErrorResponse>;
208
633
  getSignedSessionId: (request: GetSignedSessionIdRequest) => Promise<GetSignedSessionIdResponse | MessageTransportErrorResponse>;
634
+ notifyUnauthorized: (request: NotifyUnauthorizedRequest) => Promise<void | MessageTransportErrorResponse>;
209
635
  unlockWallet: (request: RequestWithTraceContext<UnlockWalletRequest>) => Promise<GetWalletResponse | MessageTransportErrorResponse>;
636
+ lockWallets: (request: RequestWithTraceContext<LockWalletsRequest>) => Promise<void | MessageTransportErrorResponse>;
210
637
  getWalletRecoveryState: (request: RequestWithTraceContext<GetWalletRecoveryStateRequest>) => Promise<WalletRecoveryState | MessageTransportErrorResponse>;
211
638
  getPrivateBalance: (request: RequestWithTraceContext<RequestWithElevatedAccessToken<GetPrivateBalanceRequest>>) => Promise<GetPrivateBalanceResponse | MessageTransportErrorResponse>;
212
- 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>;
213
642
  createTransferTransaction: (request: RequestWithTraceContext<RequestWithElevatedAccessToken<CreateTransferTransactionRequest>>) => Promise<CreateTransferTransactionResponse | MessageTransportErrorResponse>;
214
643
  submitTransaction: (request: RequestWithTraceContext<RequestWithElevatedAccessToken<SubmitTransactionRequest>>) => Promise<SubmitTransactionResponse | MessageTransportErrorResponse>;
215
644
  revertTransaction: (request: RequestWithTraceContext<RequestWithElevatedAccessToken<RevertTransactionRequest>>) => Promise<RevertTransactionResponse | MessageTransportErrorResponse>;
@@ -221,6 +650,8 @@ export type CreateWalletAccountRequest = {
221
650
  signedSessionId: string;
222
651
  authToken?: string;
223
652
  bitcoinConfig?: BitcoinConfig;
653
+ /** When set, the wallet is owned by this business account (signer row created server-side). */
654
+ businessAccountId?: string;
224
655
  };
225
656
  export type CreateWalletAccountResponse = {
226
657
  chainName: string;
@@ -232,22 +663,64 @@ export type GetWalletsRequest = {
232
663
  chainName: string;
233
664
  authToken?: string;
234
665
  };
235
- 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;
236
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[];
237
707
  };
708
+ export type AddBusinessAccountSignerReshareRequest = AddBusinessAccountSignerReshareBase & SignerTarget;
238
709
  /**
239
- * The kind of share set a wallet row represents. `rootUser` is the user's own
240
- * signing share set; `delegated` is a separate share set used by a delegated
241
- * 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.
242
716
  */
243
- export type ShareSetType = 'rootUser' | 'delegated' | 'server';
717
+ export type ShareSetType = `${WaasWalletShareSetType}`;
244
718
  /**
245
719
  * Metadata for a share set the auth principal is aware of but doesn't sign with
246
720
  * directly (e.g., a `delegated` share set surfaced alongside the rootUser).
247
- * Mirrors redcoast's `WaasShareSet` schema.
721
+ * Uses the backend schema with wire-format timestamps and the SDK's public enum.
248
722
  */
249
- export type ShareSet = {
250
- shareSetId: string;
723
+ export type ShareSet = Omit<WaasShareSet, 'createdAt' | 'shareSetType' | 'thresholdSignatureScheme'> & {
251
724
  shareSetType: ShareSetType;
252
725
  thresholdSignatureScheme: ThresholdSignatureScheme;
253
726
  createdAt: string;
@@ -262,6 +735,16 @@ export type GetWalletResponse = {
262
735
  /** Identifier of the primary share set (the one this principal signs with). */
263
736
  shareSetId?: string;
264
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;
265
748
  /**
266
749
  * Other active share sets that exist on this wallet (e.g., a delegated share
267
750
  * set surfaced alongside rootUser). Read-only awareness — the SDK never picks
@@ -279,39 +762,55 @@ export type GetWalletRequest = {
279
762
  signedSessionId: string;
280
763
  authToken?: string;
281
764
  };
282
- export type SignMessageRequest = {
765
+ export type SignMessageRequest = Pick<SignMessageWithWaasRequest, 'message'> & {
283
766
  chainName: string;
284
- message: string;
285
767
  accountAddress: string;
286
768
  password?: string;
287
769
  signedSessionId: string;
288
770
  authToken?: string;
289
771
  mfaToken?: string;
290
772
  context?: string;
773
+ approvalQuorum?: ApprovalQuorumRequestContext;
291
774
  bitcoinConfig?: BitcoinConfig;
292
775
  };
293
- export type SignMessageRequestBrowser = {
776
+ export type SignMessageRequestBrowser = Omit<SignMessageRequest, 'context'> & Pick<SignMessageWithWaasRequest, 'context'>;
777
+ export type PrepareSigningIntentRequest = {
294
778
  chainName: string;
295
- message: string;
296
779
  accountAddress: string;
297
- password?: string;
298
- signedSessionId: string;
780
+ businessAccountId: string;
781
+ initiatorUserId: string;
782
+ completeBy?: string;
299
783
  authToken?: string;
300
- mfaToken?: string;
301
- 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;
302
789
  bitcoinConfig?: BitcoinConfig;
303
- };
304
- export type SignRawMessageRequest = {
305
- chainName: string;
790
+ } | {
791
+ kind: 'typedData';
792
+ typedData: string;
793
+ } | {
794
+ kind: 'raw';
306
795
  message: string;
307
- accountAddress: string;
308
- password?: string;
309
- signedSessionId: string;
310
- authToken?: string;
311
- mfaToken?: string;
312
- context?: SignMessageContext;
796
+ rawSign: NonNullable<SignMessageContext['rawSign']>;
313
797
  bitcoinConfig?: BitcoinConfig;
314
- };
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;
315
814
  export type RequiresPasswordForOperationRequest = {
316
815
  chainName: string;
317
816
  accountAddress: string;
@@ -328,6 +827,33 @@ export type SignTransactionRequest = {
328
827
  mfaToken?: string;
329
828
  chainId?: string;
330
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;
331
857
  };
332
858
  export type SignTypedDataRequest = {
333
859
  chainName: string;
@@ -337,6 +863,7 @@ export type SignTypedDataRequest = {
337
863
  signedSessionId: string;
338
864
  authToken?: string;
339
865
  mfaToken?: string;
866
+ approvalQuorum?: ApprovalQuorumRequestContext;
340
867
  };
341
868
  export type IsPasswordEncryptedRequest = {
342
869
  chainName: string;
@@ -348,16 +875,30 @@ export type BackupKeySharesToGoogleDriveRequest = {
348
875
  accountAddress: string;
349
876
  password?: string;
350
877
  signedSessionId: string;
878
+ sessionPublicKey?: string;
351
879
  authToken?: string;
352
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;
353
887
  };
354
888
  export type BackupKeySharesToICloudRequest = {
355
889
  chainName: string;
356
890
  accountAddress: string;
357
891
  password?: string;
358
892
  signedSessionId: string;
893
+ sessionPublicKey?: string;
359
894
  authToken?: string;
360
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;
361
902
  };
362
903
  export type ExportClientKeysharesFromGoogleDriveRequest = {
363
904
  chainName: string;
@@ -367,19 +908,58 @@ export type ExportClientKeysharesFromGoogleDriveRequest = {
367
908
  authToken?: string;
368
909
  googleDriveAccessToken?: string;
369
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';
370
915
  export type DelegateKeySharesRequest = {
371
916
  chainName: string;
372
917
  accountAddress: string;
373
918
  password?: string;
374
919
  signedSessionId: string;
920
+ sessionPublicKey?: string;
921
+ authToken?: string;
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;
375
942
  authToken?: string;
376
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;
377
956
  };
378
957
  export type RevokeDelegationRequest = {
379
958
  chainName: string;
380
959
  accountAddress: string;
381
960
  password?: string;
382
961
  signedSessionId: string;
962
+ sessionPublicKey?: string;
383
963
  authToken?: string;
384
964
  mfaToken?: string;
385
965
  };
@@ -388,6 +968,7 @@ export type RefreshWalletAccountSharesRequest = {
388
968
  accountAddress: string;
389
969
  password?: string;
390
970
  signedSessionId: string;
971
+ sessionPublicKey?: string;
391
972
  authToken?: string;
392
973
  mfaToken?: string;
393
974
  };
@@ -398,8 +979,13 @@ export type ReshareRequest = {
398
979
  newThresholdSignatureScheme: ThresholdSignatureScheme;
399
980
  password?: string;
400
981
  signedSessionId: string;
982
+ sessionPublicKey?: string;
401
983
  authToken?: string;
402
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;
403
989
  };
404
990
  export type ExportPrivateKeyRequest = {
405
991
  chainName: string;
@@ -409,6 +995,146 @@ export type ExportPrivateKeyRequest = {
409
995
  authToken?: string;
410
996
  mfaToken?: string;
411
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;
412
1138
  };
413
1139
  export type ProveAleoTransactionRequest = {
414
1140
  chainName: 'ALEO';
@@ -462,23 +1188,32 @@ export type VerifyPasswordRequest = {
462
1188
  signedSessionId: string;
463
1189
  authToken?: string;
464
1190
  };
465
- export type UpdatePasswordRequest = {
466
- chainName: string;
467
- accountAddress: string;
1191
+ export type PasswordOverride = {
1192
+ walletId: string;
468
1193
  existingPassword: string;
469
- newPassword: string;
470
- signedSessionId: string;
471
- authToken?: string;
472
- 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[];
473
1199
  };
474
1200
  export type SetPasswordRequest = {
475
1201
  chainName: string;
476
1202
  accountAddress: string;
477
1203
  newPassword: string;
478
1204
  signedSessionId: string;
1205
+ sessionPublicKey?: string;
479
1206
  authToken?: string;
480
1207
  passwordUpdateBatchId?: string;
481
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
+ };
482
1217
  export type ImportPrivateKeyRequest = {
483
1218
  chainName: string;
484
1219
  privateKey: string;
@@ -490,6 +1225,73 @@ export type ImportPrivateKeyRequest = {
490
1225
  addressType?: string;
491
1226
  /** ID of the legacy embedded wallet being upgraded to v3 */
492
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
+ };
493
1295
  };
494
1296
  export type ExportClientKeysharesRequest = {
495
1297
  chainName: string;
@@ -511,11 +1313,20 @@ export type OfflineExportPrivateKeyResponse = {
511
1313
  */
512
1314
  export type GetSignedSessionIdRequest = Record<string, never>;
513
1315
  /**
514
- * 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).
515
1320
  */
516
1321
  export type GetSignedSessionIdResponse = {
517
1322
  signedSessionId: string;
1323
+ publicKey?: string;
518
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>;
519
1330
  /**
520
1331
  * Internal: Request from iframe to host to get client key shares from secure storage
521
1332
  */
@@ -541,6 +1352,23 @@ export type SetClientKeyShareRequest = {
541
1352
  export type RemoveClientKeyShareRequest = {
542
1353
  accountAddress: string;
543
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
+ };
544
1372
  export type UnlockWalletRequest = {
545
1373
  chainName: string;
546
1374
  accountAddress: string;
@@ -548,6 +1376,12 @@ export type UnlockWalletRequest = {
548
1376
  signedSessionId: string;
549
1377
  authToken?: string;
550
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
+ };
551
1385
  export type GetWalletRecoveryStateRequest = {
552
1386
  chainName: string;
553
1387
  accountAddress: string;
@@ -568,6 +1402,8 @@ export type GetPrivateBalanceRequest = {
568
1402
  signedSessionId: string;
569
1403
  authToken?: string;
570
1404
  mfaToken?: string;
1405
+ /** Midnight network to operate on: 0/'preview' (default) or 1/'mainnet'. */
1406
+ networkId?: number | string;
571
1407
  };
572
1408
  /**
573
1409
  * Midnight-specific. Mirrors the three balance dimensions Midnight
@@ -583,8 +1419,18 @@ export type GetPrivateBalanceResponse = {
583
1419
  * Compact contract-minted shielded tokens (native NIGHT does not
584
1420
  * currently exist on the shielded side). */
585
1421
  shielded: Record<string, string>;
586
- 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
+ };
587
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;
588
1434
  };
589
1435
  /**
590
1436
  * Midnight-specific. "Dust" is Midnight's continuously-generated gas
@@ -593,14 +1439,7 @@ export type GetPrivateBalanceResponse = {
593
1439
  * registration, NIGHT holders produce no Dust and can't pay fees.
594
1440
  * No-op for any other chain.
595
1441
  */
596
- export type RegisterDustRequest = {
597
- chainName: string;
598
- accountAddress: string;
599
- password?: string;
600
- signedSessionId: string;
601
- authToken?: string;
602
- mfaToken?: string;
603
- };
1442
+ export type { GetPrivateBalanceRequest as RegisterDustRequest };
604
1443
  /** Midnight-specific. See `RegisterDustRequest`. */
605
1444
  export type RegisterDustResponse = {
606
1445
  /** Current dust balance at the time of the call. 0 is normal right after
@@ -650,6 +1489,8 @@ export type CreateTransferTransactionRequest = {
650
1489
  signedSessionId: string;
651
1490
  authToken?: string;
652
1491
  mfaToken?: string;
1492
+ /** Midnight network to operate on: 0/'preview' (default) or 1/'mainnet'. */
1493
+ networkId?: number | string;
653
1494
  };
654
1495
  /** Midnight-specific. See `CreateTransferTransactionRequest`. */
655
1496
  export type CreateTransferTransactionResponse = {
@@ -678,11 +1519,20 @@ export type SubmitTransactionRequest = {
678
1519
  signedSessionId: string;
679
1520
  authToken?: string;
680
1521
  mfaToken?: string;
1522
+ /** Midnight network to operate on: 0/'preview' (default) or 1/'mainnet'. */
1523
+ networkId?: number | string;
681
1524
  };
682
1525
  /** Midnight-specific. See `SubmitTransactionRequest`. */
683
1526
  export type SubmitTransactionResponse = {
684
- /** On-chain transaction hash / identifier returned by the ledger. */
1527
+ /** Canonical on-chain transaction hash — what block explorers index by. */
685
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;
686
1536
  /** Unshielded balance after the tx (only present when waitForBalance was true). */
687
1537
  balanceAfter?: string;
688
1538
  };
@@ -718,6 +1568,8 @@ export type RevertTransactionRequest = {
718
1568
  signedSessionId: string;
719
1569
  authToken?: string;
720
1570
  mfaToken?: string;
1571
+ /** Midnight network to operate on: 0/'preview' (default) or 1/'mainnet'. */
1572
+ networkId?: number | string;
721
1573
  };
722
1574
  /** Midnight-specific. See `RevertTransactionRequest`. */
723
1575
  export type RevertTransactionResponse = {
@@ -731,21 +1583,37 @@ export type RevertTransactionResponse = {
731
1583
  /** Human-readable summary. */
732
1584
  message: string;
733
1585
  };
734
- 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 = {
735
1597
  chainName: string;
736
1598
  accountAddress: string;
1599
+ /** Base64-encoded UnboundTransaction (`signature`/`proof`/`pre-binding`). */
1600
+ transaction: string;
1601
+ /** Optional ISO-8601 transaction expiry. */
1602
+ ttl?: string;
737
1603
  password?: string;
738
1604
  signedSessionId: string;
739
1605
  authToken?: string;
740
1606
  mfaToken?: string;
1607
+ /** Midnight network to operate on: 0/'preview' (default) or 1/'mainnet'. */
1608
+ networkId?: number | string;
741
1609
  };
742
- export type GetWalletProviderResponse = {
743
- coinPublicKey: string;
744
- encryptionPublicKey: string;
745
- status: 'ready';
1610
+ export type BalanceWalletProviderTransactionResponse = {
1611
+ /** Base64-encoded FinalizedTransaction (`signature`/`proof`/`binding`). */
1612
+ transaction: string;
746
1613
  };
747
1614
  export type MessageTransportErrorResponse = {
748
1615
  error: string;
1616
+ name?: string;
749
1617
  };
750
1618
  /**
751
1619
  * Abstraction for the communication channel between the SDK and its
@@ -785,21 +1653,22 @@ export interface SecureStorageAdapter {
785
1653
  setClientKeyShare(accountAddress: string, shares: unknown[]): Promise<void>;
786
1654
  removeClientKeyShare(accountAddress: string): Promise<void>;
787
1655
  }
788
- 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'> & {
789
1666
  location: BackupLocation;
790
- externalKeyShareId?: string;
1667
+ externalKeyShareIds?: string[];
791
1668
  id?: string;
792
- keygenId?: string;
793
- passwordEncrypted?: boolean;
794
- };
795
- export type EncryptedDelegatedKeyShareEnvelope = {
796
- alg: string;
797
- iv: string;
798
- ct: string;
799
- tag: string;
800
- ek: string;
801
- kid?: string;
1669
+ tokenSource?: `${NonNullable<BackupKeySharesToLocationsRequestLocations['tokenSource']>}`;
802
1670
  };
1671
+ export type EncryptedDelegatedKeyShareEnvelope = DelegatedShareDeliveryRequestEncryptedDelegatedShare;
803
1672
  export interface ILogger {
804
1673
  debug(message: string, context?: object, error?: Error): void;
805
1674
  debug(message: string, ...args: any[]): void;