@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/api/api.d.ts CHANGED
@@ -1,103 +1,324 @@
1
1
  import type { ForwardMPCClientV2 } from '@dynamic-labs-wallet/forward-mpc-client';
2
- import type { RoomTypeEnum, SignMessageEvmTransaction, SignMessageEvmUserOperation, SignMessageSvmTransaction } from '@dynamic-labs/sdk-api-core';
3
- import { type BackupLocation } from '../constants.js';
4
- import type { ThresholdSignatureScheme } from '../mpc/constants.js';
5
- import { AuthMode, type BackupLocationWithExternalKeyShareId, type BitcoinConfig, type EncryptedDelegatedKeyShareEnvelope, type ILogger, type KeygenCompleteResponse, type OpenRoomResponse, type RefreshResponse, type ReshareResponse, type ShareSetType, type TraceContext, type WaasWalletResponse } from '../types.js';
2
+ import type { BackupKeySharesToLocationsRequest, CreateRoomsRequest, CreateRoomsWithoutWalletIdRequest, CreateWaasAccountRequest, ExportAleoViewKeyRequest, ExportWaasWalletPrivateKeyRequest, ImportWaasPrivateKeyRequest, InlineObject1, InlineObject2, InlineObject4, InlineResponse2003, InlineResponse2005, NoncesResponse, ReshareRequest as ApiReshareRequest, SignMessageWithWaasRequest, SignMessageContext, SignMessageEvmTransaction, WaasPolicyRule, SignMessageEvmUserOperation, SignMessageSvmTransaction } from '#internal/sdk-api-core';
3
+ import { type AddSignerCeremonyComplete, type CreateCeremonyComplete, type ShareSetCeremonyComplete, type SlowDeliveryMeta } from '../eventStream/utils.js';
4
+ import { ThresholdSignatureScheme } from '../mpc/constants.js';
5
+ import { AuthMode, type AddBusinessAccountMemberRequest, type GetBusinessAccountRequest, type RequestWithTraceContext, type ApprovalQuorumRequestContext, type CreateConfidentialSeedRequest, type CreateConfidentialSeedResponse, type SignConfidentialTransactionsRequest, type SignConfidentialTransactionsResponse, type SignConfidentialTransferRequest, type SignConfidentialTransferResponse, type SvmConfidentialBalanceRequest, type SvmConfidentialBalanceResponse, type BackupLocationWithExternalKeyShareId, type BitcoinConfig, type EncryptedDelegatedKeyShareEnvelope, type ExportApprovalQuorumRequest, type ILogger, type KeygenCompleteResponse, type LinkWalletToBusinessAccountRequest, type OpenRoomResponse, type ReshareApprovalQuorumRequest, type ReshareResponse, type RevokeDelegationResponse, type SignAndBroadcastResponse, type SignAndBroadcastOptions, type TraceContext, type WaasWalletResponse } from '../types.js';
6
+ import { type BusinessAccountActionRequired, type CreateBusinessAccountSdkRequest, type BusinessAccount, type BusinessAccountDetail, type BusinessAccountList, type BusinessAccountMember, type BusinessAccountGovernance, type BusinessAccountGovernedOptions, type BusinessAccountProposal, type BusinessAccountSigner, type BusinessAccountSignedIntent, type BusinessAccountSignerType, type TargetSignerIdentity } from '../businessAccounts/types.js';
7
+ import type { EarnChainName, EarnEarnings, EarnVaultActionResponse, EarnVaultDetails, EarnVaultListResponse, EarnVaultPosition, EarnVaultPositionPerformance, EarnVaultRewardsResponse } from '../earn/types.js';
6
8
  import { BaseClient } from './client.js';
9
+ import type { RequestSigner } from './requestSigner.js';
10
+ import type { AleoFeemasterPolicyResponse, AleoScannerPublicKeyResponse, BackupKeySharesResponse, GetAvailableEVMGaslessRelayerResponse, GetEVMSponsoredTransactionStatusResponse, GetSVMSponsorAddressResponse, SponsorEVMTransactionRequest, SponsorEVMTransactionResponse, SponsorSVMTransactionRequest, SponsorSVMTransactionResponse, StoreEncryptedBackupResponse, WalletAdditionalAddressRequest } from './types.js';
11
+ export type DynamicApiClientOptions = {
12
+ environmentId: string;
13
+ authToken?: string;
14
+ backupServiceAuthToken?: string;
15
+ baseApiUrl?: string;
16
+ authMode?: AuthMode;
17
+ sdkVersion?: string;
18
+ forwardMPCClient?: ForwardMPCClientV2;
19
+ baseClientKeysharesRelayApiUrl?: string;
20
+ logger?: ILogger;
21
+ /** Use server SDK routes (/api/v0/server) instead of browser SDK routes (/api/v0/sdk). */
22
+ isServerSdk?: boolean;
23
+ /** Fired when a backend call returns 401. See BaseClient. */
24
+ onUnauthorized?: () => void;
25
+ /** Signs every Dynamic API request (request-signing proof). See BaseClient. */
26
+ requestSigner?: RequestSigner;
27
+ };
28
+ type SignMessageChainContext = (SignMessageEvmTransaction | SignMessageSvmTransaction | SignMessageEvmUserOperation) & {
29
+ approvalQuorum?: ApprovalQuorumRequestContext;
30
+ };
31
+ export type CreateWalletAccountApiRequest = Omit<CreateWaasAccountRequest, 'chain' | 'thresholdSignatureScheme' | 'addressType' | 'delegateToProjectEnvironment' | 'variant'> & {
32
+ chainName: string;
33
+ dynamicRequestId?: string;
34
+ thresholdSignatureScheme: ThresholdSignatureScheme;
35
+ bitcoinConfig?: BitcoinConfig;
36
+ traceContext?: TraceContext;
37
+ /** Opt in to an `encryptedWalletApiKey` in the response. Sent as the `delegateToProjectEnvironment` request field. */
38
+ returnEncryptedWalletApiKey?: boolean;
39
+ };
40
+ type SignMessageApiRequest = Omit<SignMessageWithWaasRequest, 'context' | 'approvalQuorum'> & {
41
+ dynamicRequestId?: string;
42
+ walletId: string;
43
+ onError?: (error: Error) => void;
44
+ mfaToken?: string;
45
+ elevatedAccessToken?: string;
46
+ context?: SignMessageChainContext;
47
+ approvalQuorum?: ApprovalQuorumRequestContext;
48
+ forwardMPCClientEnabled?: boolean;
49
+ traceContext?: TraceContext;
50
+ bitcoinConfig?: BitcoinConfig;
51
+ };
52
+ type AleoApiRequest<T extends {
53
+ network: string;
54
+ }> = RequestWithTraceContext<Omit<T, 'network'> & {
55
+ network: `${T['network']}`;
56
+ }>;
7
57
  export declare class DynamicApiClient extends BaseClient {
8
- constructor({ environmentId, authToken, backupServiceAuthToken, baseApiUrl, authMode, sdkVersion, forwardMPCClient, baseClientKeysharesRelayApiUrl, logger, }: {
9
- environmentId: string;
10
- authToken?: string;
11
- backupServiceAuthToken?: string;
12
- baseApiUrl?: string;
13
- authMode?: AuthMode;
14
- sdkVersion?: string;
15
- forwardMPCClient?: ForwardMPCClientV2;
16
- baseClientKeysharesRelayApiUrl?: string;
17
- logger?: ILogger;
18
- });
58
+ /**
59
+ * When true, routes use `/api/v0/server` prefix (authenticated via API key)
60
+ * instead of `/api/v0/sdk` (authenticated via JWT).
61
+ * @see DYNT-537
62
+ */
63
+ private readonly sdkRoutePrefix;
64
+ /** Cached `${sdkRoutePrefix}/${environmentId}/waas` — base for all waas-scoped endpoints. */
65
+ private readonly waasRoutePrefix;
66
+ /**
67
+ * Cached `${BROWSER_SDK_ROUTE_PREFIX}/${environmentId}/evm` — always uses the browser/sdk
68
+ * prefix regardless of `isServerSdk`. Used for redcoast endpoints that only exist under
69
+ * `/sdk/` without scope restrictions (e.g. `evm/availableGaslessRelayer`) until redcoast
70
+ * drops the `GaslessRead` scope requirement from the `/server/` parity route.
71
+ */
72
+ private readonly sdkEvmRoutePrefix;
73
+ /** Cached `${sdkRoutePrefix}/${environmentId}/businessAccounts` — business-account endpoints sit beside `/waas`, not under it. */
74
+ private readonly businessAccountsRoutePrefix;
75
+ /**
76
+ * Cached `${BROWSER_SDK_ROUTE_PREFIX}/${environmentId}/yield` — always uses the browser/sdk
77
+ * prefix regardless of `isServerSdk`, because redcoast only registers the yield (Earn)
78
+ * routes under `/sdk/` today.
79
+ */
80
+ private readonly sdkYieldRoutePrefix;
81
+ constructor({ environmentId, authToken, backupServiceAuthToken, baseApiUrl, authMode, sdkVersion, forwardMPCClient, baseClientKeysharesRelayApiUrl, logger, isServerSdk, onUnauthorized, requestSigner, }: DynamicApiClientOptions);
82
+ /** List the yield vaults enabled for the environment. */
83
+ listYieldVaults({ traceContext }?: {
84
+ traceContext?: TraceContext;
85
+ }): Promise<EarnVaultListResponse>;
86
+ /** Full detail for a single vault, including the asset and contract metadata needed to deposit. */
87
+ getYieldVaultDetails({ vaultId, traceContext, }: {
88
+ vaultId: string;
89
+ traceContext?: TraceContext;
90
+ }): Promise<EarnVaultDetails>;
91
+ /** An owner's shares and underlying assets in a vault. */
92
+ getYieldVaultPosition({ vaultId, ownerAddress, traceContext, }: {
93
+ vaultId: string;
94
+ ownerAddress: string;
95
+ traceContext?: TraceContext;
96
+ }): Promise<EarnVaultPosition>;
97
+ /** Rewards accrued by an owner in a vault. */
98
+ getYieldVaultRewards({ vaultId, ownerAddress, traceContext, }: {
99
+ vaultId: string;
100
+ ownerAddress: string;
101
+ traceContext?: TraceContext;
102
+ }): Promise<EarnVaultRewardsResponse>;
103
+ /** Indexed performance of an owner's position in a vault (trails the chain head). */
104
+ getYieldVaultPositionPerformance({ vaultId, ownerAddress, traceContext, }: {
105
+ vaultId: string;
106
+ ownerAddress: string;
107
+ traceContext?: TraceContext;
108
+ }): Promise<EarnVaultPositionPerformance>;
109
+ /** An owner's earnings across every vault on a chain, with USD totals and a per-vault breakdown. */
110
+ getYieldEarnings({ ownerAddress, chainId, chainName, traceContext, }: {
111
+ ownerAddress: string;
112
+ chainId: number;
113
+ chainName?: EarnChainName;
114
+ traceContext?: TraceContext;
115
+ }): Promise<EarnEarnings>;
116
+ /** Build the unsigned deposit transaction (plus ERC-20 approval when the allowance is short). */
117
+ yieldVaultDeposit({ vaultId, ownerAddress, amount, receiverAddress, traceContext, }: {
118
+ vaultId: string;
119
+ ownerAddress: string;
120
+ amount: string;
121
+ receiverAddress?: string;
122
+ traceContext?: TraceContext;
123
+ }): Promise<EarnVaultActionResponse>;
124
+ /** Build the unsigned withdrawal transaction. */
125
+ yieldVaultWithdraw({ vaultId, ownerAddress, amount, receiverAddress, traceContext, }: {
126
+ vaultId: string;
127
+ ownerAddress: string;
128
+ amount: string;
129
+ receiverAddress?: string;
130
+ traceContext?: TraceContext;
131
+ }): Promise<EarnVaultActionResponse>;
132
+ /** Build the unsigned reward-claim transaction. */
133
+ yieldVaultClaim({ vaultId, ownerAddress, traceContext, }: {
134
+ vaultId: string;
135
+ ownerAddress: string;
136
+ traceContext?: TraceContext;
137
+ }): Promise<EarnVaultActionResponse>;
19
138
  getBackupRelayToken({ traceContext }: {
20
139
  traceContext?: TraceContext;
21
140
  }): Promise<any>;
22
- authenticateApiToken({ environmentId }: {
141
+ /**
142
+ * In cookie mode the relay token is fetched once at iframe boot and never
143
+ * refreshed, so session rotation or token expiry leaves it stale (DYNT-2309).
144
+ * Wraps each relay call: re-mint only when the pinned token is missing or
145
+ * expiring, and retry once with a fresh token when the relay rejects the call
146
+ * with 403 (revoked session after rotation). The API client authenticates via
147
+ * cookie, so the new token always carries the live session. A 401 is left to
148
+ * the existing onUnauthorized handling — session genuinely invalid.
149
+ */
150
+ private withBackupTokenRefresh;
151
+ private isBackupTokenExpiringSoon;
152
+ private backupRelayTokenRefresh?;
153
+ private mintBackupRelayToken;
154
+ authenticateApiToken({ environmentId, signingPublicKey, }: {
23
155
  environmentId: string;
24
- }): Promise<import("axios").AxiosResponse<any, any, {}>>;
25
- createWalletAccount({ chainName, clientKeygenIds, dynamicRequestId, thresholdSignatureScheme, skipLock, bitcoinConfig, onError, onCeremonyComplete, traceContext, }: {
26
- chainName: string;
27
- dynamicRequestId?: string;
28
- clientKeygenIds: string[];
29
- thresholdSignatureScheme: ThresholdSignatureScheme;
30
- skipLock?: boolean;
31
- bitcoinConfig?: BitcoinConfig;
156
+ /** Hex-encoded raw P-256 public key, bound into the resulting JWT's session_public_key claim. */
157
+ signingPublicKey?: string;
158
+ }): Promise<import("axios").AxiosResponse<any, undefined, {}, any>>;
159
+ createWalletAccount({ chainName, clientKeygenIds, dynamicRequestId, thresholdSignatureScheme, skipLock, bitcoinConfig, businessAccountId, returnEncryptedWalletApiKey, onError, onCeremonyComplete, onSlowDelivery, traceContext, }: CreateWalletAccountApiRequest & {
32
160
  onError?: (error: Error) => void;
33
- onCeremonyComplete?: (accountAddress: string, walletId: string, shareSetId?: string, shareSetType?: ShareSetType) => void;
34
- traceContext?: TraceContext;
161
+ onCeremonyComplete?: (completion: CreateCeremonyComplete) => void;
162
+ /** Diagnostic: fires once if keygen_complete hasn't arrived within the watchdog window. */
163
+ onSlowDelivery?: (meta: SlowDeliveryMeta) => void;
35
164
  }): Promise<KeygenCompleteResponse>;
36
- signMessage({ dynamicRequestId, walletId, shareSetId, message, onError, isFormatted, mfaToken, elevatedAccessToken, roomId, context, forwardMPCClientEnabled, traceContext, bitcoinConfig, }: {
165
+ /**
166
+ * Plain-JSON (non-SSE) request to the `/create` endpoint. Does NOT synchronously
167
+ * create the wallet: it initiates the server keygen ceremony (mints the MPC room,
168
+ * enqueues the async worker that builds the wallet) and returns `{ roomId,
169
+ * serverKeygenIds }`. With `poll: true` it instead reads the in-flight ceremony,
170
+ * returning the wallet identity (`walletId`/`accountAddress`/`shareSetId`) once the
171
+ * worker has finished. The wallet is the product of the full ceremony, not this call.
172
+ */
173
+ requestWalletCreationJson({ chainName, clientKeygenIds, dynamicRequestId, thresholdSignatureScheme, skipLock, bitcoinConfig, businessAccountId, returnEncryptedWalletApiKey, idempotencyKey, timeoutMs, traceContext, poll, }: CreateWalletAccountApiRequest & {
174
+ idempotencyKey: string;
175
+ timeoutMs?: number;
176
+ /**
177
+ * Read-only poll for an already-claimed ceremony (same idempotency key).
178
+ * The server returns the current ceremony state without claiming a new
179
+ * attempt or enqueuing a worker, so a poll can never create a second wallet.
180
+ */
181
+ poll?: boolean;
182
+ }): Promise<KeygenCompleteResponse>;
183
+ signMessage({ dynamicRequestId, walletId, shareSetId, message, onError, isFormatted, mfaToken, elevatedAccessToken, roomId, context, approvalQuorum, forwardMPCClientEnabled, traceContext, bitcoinConfig, }: SignMessageApiRequest): Promise<import("@dynamic-labs/sdk-api-core").OpenRoomResponseWithServerKeygenIds>;
184
+ /**
185
+ * Plain-JSON (non-SSE) variant of `signMessage`. Hits the same
186
+ * `/signMessage` endpoint; the `x-idempotency-key` header tells the backend
187
+ * (when `enable-http-waas-transport-signmessage` is on) to respond with the
188
+ * OpenRoomResponse synchronously instead of streaming `room_created` over SSE.
189
+ * Unlike wallet creation, no completion polling is needed — the response is final.
190
+ *
191
+ * @throws SigningConsentRequiredError when a governed wallet needs approvers' consent first
192
+ * (the backend answers 202 `consent_required` instead of a room).
193
+ */
194
+ requestSignMessageJson({ dynamicRequestId, walletId, shareSetId, message, onError, isFormatted, mfaToken, elevatedAccessToken, roomId, context, approvalQuorum, idempotencyKey, forwardMPCClientEnabled, traceContext, bitcoinConfig, }: SignMessageApiRequest & {
195
+ idempotencyKey: string;
196
+ }): Promise<OpenRoomResponse>;
197
+ /**
198
+ * Starts a sign-and-broadcast: Dynamic opens a signing room, you sign in it, and Dynamic then sends the transaction. The signature never comes back.
199
+ *
200
+ * @param params.walletId - The wallet that signs.
201
+ * @param params.shareSetId - Which of the wallet's key sets to use. Defaults to its active one.
202
+ * @param params.message - The transaction as the bytes to sign (RLP hex on EVM, message bytes on Solana). Not hashed.
203
+ * @param params.context - What the message does in readable form (chain, recipient, amount). Dynamic checks it against the wallet and its policies.
204
+ * @param params.broadcastOptions - Solana send settings: other required signers' signatures, and skipping the pre-send dry run.
205
+ * @param params.isFormatted - `true` if the message is already a hash. `false` for a serialized transaction.
206
+ * @param params.requestedCertainty - How sure to be before calling it confirmed: `fast`, `safe` or `final`, or `chain:` plus a chain-specific value. Defaults to `safe`.
207
+ * @param params.externalReference - Your own label, returned on every event. Not unique.
208
+ * @param params.roomId - A signing room you already opened; Dynamic opens one when omitted.
209
+ * @param params.approvalQuorum - Approvers' consent for a governed wallet, sent on the retry after `intent_required`.
210
+ * @param params.idempotencyKey - Makes a retry safe: the same key replays the stored answer instead of sending twice.
211
+ * @param params.dynamicRequestId - Id of this one request, to match client and server logs.
212
+ * @param params.traceContext - Ties this call's logs to the server's, across retries. Created when omitted.
213
+ * @param params.mfaToken - Proof of the user's multi-factor check, when the wallet needs one.
214
+ * @param params.elevatedAccessToken - Proof of a recent re-login, when the wallet needs one.
215
+ * @param params.onError - Called with the failure's message, never the raw error.
216
+ * @returns The transaction record: its id, its status, and the signing room while signing is pending.
217
+ * @throws SignAndBroadcastRequestTooLargeError when the body is over the server limit.
218
+ * @throws SigningConsentRequiredError when a governed wallet needs approvers' consent first.
219
+ * @throws WalletApiError when the server rejects it, with its reason and code.
220
+ */
221
+ signAndBroadcast({ dynamicRequestId, walletId, shareSetId, context, broadcastOptions, message, isFormatted, requestedCertainty, externalReference, roomId, approvalQuorum, idempotencyKey, onError, mfaToken, elevatedAccessToken, traceContext, }: {
37
222
  dynamicRequestId?: string;
38
223
  walletId: string;
39
224
  shareSetId?: string;
225
+ context: SignMessageContext;
226
+ broadcastOptions?: SignAndBroadcastOptions;
40
227
  message: string;
41
- onError?: (error: Error) => void;
42
228
  isFormatted?: boolean;
229
+ requestedCertainty?: string;
230
+ externalReference?: string;
231
+ roomId?: string;
232
+ approvalQuorum?: ApprovalQuorumRequestContext;
233
+ idempotencyKey: string;
234
+ onError?: (error: Error) => void;
43
235
  mfaToken?: string;
44
236
  elevatedAccessToken?: string;
45
- roomId?: string;
46
- context?: SignMessageEvmTransaction | SignMessageSvmTransaction | SignMessageEvmUserOperation;
47
- forwardMPCClientEnabled?: boolean;
48
237
  traceContext?: TraceContext;
49
- bitcoinConfig?: BitcoinConfig;
50
- }): Promise<OpenRoomResponse>;
238
+ }): Promise<SignAndBroadcastResponse>;
51
239
  refreshWalletAccountShares({ dynamicRequestId, walletId, shareSetId, onError, onCeremonyComplete, mfaToken, elevatedAccessToken, traceContext, }: {
52
240
  dynamicRequestId?: string;
53
241
  walletId: string;
54
242
  shareSetId?: string;
55
243
  onError?: (error: Error) => void;
56
- onCeremonyComplete?: (accountAddress: string, walletId: string, shareSetId?: string, shareSetType?: ShareSetType) => void;
244
+ onCeremonyComplete?: (completion: ShareSetCeremonyComplete) => void;
57
245
  mfaToken?: string;
58
246
  elevatedAccessToken?: string;
59
247
  traceContext?: TraceContext;
60
- }): Promise<RefreshResponse>;
61
- reshare({ walletId, shareSetId, dynamicRequestId, clientKeygenIds, oldThresholdSignatureScheme, newThresholdSignatureScheme, delegateToProjectEnvironment, revokeDelegation, mfaToken, elevatedAccessToken, onError, onCeremonyComplete, traceContext, }: {
248
+ }): Promise<import("@dynamic-labs/sdk-api-core").RefreshKeySharesResponse>;
249
+ reshare({ walletId, shareSetId, dynamicRequestId, clientKeygenIds, oldThresholdSignatureScheme, newThresholdSignatureScheme, delegateToProjectEnvironment, revokeDelegation, mfaToken, elevatedAccessToken, onError, onCeremonyComplete, traceContext, initialSignerRules, reshareKind, offlineRecoveryEncryptionKey, approvalQuorum, proposalId, }: Omit<ApiReshareRequest, 'oldThresholdSignatureScheme' | 'newThresholdSignatureScheme' | 'reshareKind' | 'offlineRecoveryEncryptionKey' | 'approvalQuorum'> & {
62
250
  dynamicRequestId?: string;
63
251
  walletId: string;
64
- shareSetId?: string;
65
- clientKeygenIds: string[];
66
252
  oldThresholdSignatureScheme: ThresholdSignatureScheme;
67
253
  newThresholdSignatureScheme: ThresholdSignatureScheme;
68
- delegateToProjectEnvironment?: boolean;
69
- revokeDelegation?: boolean;
70
254
  mfaToken?: string;
71
255
  elevatedAccessToken?: string;
72
256
  onError?: (error: Error) => void;
73
- onCeremonyComplete?: (accountAddress: string, walletId: string, shareSetId?: string, shareSetType?: ShareSetType) => void;
257
+ onCeremonyComplete?: (completion: ShareSetCeremonyComplete) => void;
74
258
  traceContext?: TraceContext;
75
- }): Promise<ReshareResponse>;
76
- exportKey({ mfaToken, elevatedAccessToken, dynamicRequestId, walletId, shareSetId, exportId, bitcoinConfig, onError, traceContext, }: {
259
+ /**
260
+ * What kind of share this ceremony mints. Omitted defaults to `rootUser`
261
+ * server-side. `offlineRecovery` makes redcoast mint an independent 2/2
262
+ * set and leave rootUser untouched.
263
+ */
264
+ reshareKind?: `${NonNullable<ApiReshareRequest['reshareKind']>}`;
265
+ /**
266
+ * Caller-supplied RSA public key the recovery share is encrypted to
267
+ * (`offlineRecovery` reshare only — rejected server-side otherwise).
268
+ */
269
+ offlineRecoveryEncryptionKey?: {
270
+ alg: 'HYBRID-RSA-AES-256';
271
+ publicKeyPemB64: string;
272
+ };
273
+ /** The initiator's signed reshare Intent, sent with the first reshare call on a governed wallet. */
274
+ approvalQuorum?: ReshareApprovalQuorumRequest;
275
+ /** The approved reshare proposal being redeemed, from the consent error the reshare call raised. */
276
+ proposalId?: string;
277
+ }): Promise<import("@dynamic-labs/sdk-api-core").OpenRoomResponseForReshare>;
278
+ exportKey({ mfaToken, elevatedAccessToken, dynamicRequestId, walletId, shareSetId, exportId, bitcoinConfig, approvalQuorum, proposalId, onError, traceContext, }: Omit<ExportWaasWalletPrivateKeyRequest, 'addressType' | 'approvalQuorum'> & {
77
279
  mfaToken?: string;
78
280
  elevatedAccessToken?: string;
79
281
  dynamicRequestId?: string;
80
282
  walletId: string;
81
- shareSetId?: string;
82
- exportId: string;
83
283
  bitcoinConfig?: BitcoinConfig;
284
+ /** The initiator's signed export Intent, sent with the first export call. */
285
+ approvalQuorum?: ExportApprovalQuorumRequest;
286
+ /** The approved export proposal being redeemed. */
287
+ proposalId?: string;
84
288
  onError?: (error: Error) => void;
85
289
  traceContext?: TraceContext;
290
+ }): Promise<import("@dynamic-labs/sdk-api-core").OpenRoomResponseWithServerKeygenIds>;
291
+ /**
292
+ * Plain-JSON (non-SSE) variant of `exportKey`. Hits the same
293
+ * `/privateKey/export` endpoint; the `x-idempotency-key` header tells the
294
+ * backend (when `enable-http-waas-transport-export` is on) to respond with
295
+ * the OpenRoomResponse synchronously instead of streaming `room_created`
296
+ * over SSE.
297
+ */
298
+ requestExportKeyJson({ mfaToken, elevatedAccessToken, dynamicRequestId, walletId, shareSetId, exportId, bitcoinConfig, onError, traceContext, idempotencyKey, timeoutMs, }: Omit<ExportWaasWalletPrivateKeyRequest, 'addressType'> & {
299
+ mfaToken?: string;
300
+ elevatedAccessToken?: string;
301
+ dynamicRequestId?: string;
302
+ walletId: string;
303
+ bitcoinConfig?: BitcoinConfig;
304
+ onError?: (error: Error) => void;
305
+ traceContext?: TraceContext;
306
+ idempotencyKey: string;
307
+ timeoutMs?: number;
86
308
  }): Promise<OpenRoomResponse>;
87
309
  /**
88
310
  * Kick off the Aleo view-key export MPC ceremony. Returns the MPC room once
89
311
  * redcoast + wallet-service have joined; the client then joins the same
90
312
  * room via Sodot's `exportViewKey` to receive the view key.
91
313
  */
92
- exportAleoViewKey({ mfaToken, elevatedAccessToken, dynamicRequestId, walletId, exportId, onError, traceContext, }: {
314
+ exportAleoViewKey({ mfaToken, elevatedAccessToken, dynamicRequestId, walletId, exportId, onError, traceContext, }: ExportAleoViewKeyRequest & {
93
315
  mfaToken?: string;
94
316
  elevatedAccessToken?: string;
95
317
  dynamicRequestId?: string;
96
318
  walletId: string;
97
- exportId: string;
98
319
  onError?: (error: Error) => void;
99
320
  traceContext?: TraceContext;
100
- }): Promise<OpenRoomResponse>;
321
+ }): Promise<import("@dynamic-labs/sdk-api-core").OpenRoomResponseWithServerKeygenIds>;
101
322
  /**
102
323
  * Kick off the Aleo signRequest MPC ceremony. Returns the MPC room once
103
324
  * redcoast + wallet-service have joined; the client then joins the same
@@ -111,7 +332,7 @@ export declare class DynamicApiClient extends BaseClient {
111
332
  payload: unknown;
112
333
  onError?: (error: Error) => void;
113
334
  traceContext?: TraceContext;
114
- }): Promise<OpenRoomResponse>;
335
+ }): Promise<import("@dynamic-labs/sdk-api-core").OpenRoomResponseWithServerKeygenIds>;
115
336
  /**
116
337
  * Fetch the Aleo Feemaster sponsorship policy for a network. Redcoast
117
338
  * holds the ANF Bearer key server-side and forwards. Caller usually
@@ -121,12 +342,7 @@ export declare class DynamicApiClient extends BaseClient {
121
342
  getAleoFeemasterPolicy({ network, traceContext, }: {
122
343
  network: 'testnet' | 'mainnet';
123
344
  traceContext?: TraceContext;
124
- }): Promise<{
125
- allowed_programs: Array<{
126
- program_id: string;
127
- allowed_functions?: string[] | null;
128
- }> | null;
129
- }>;
345
+ }): Promise<AleoFeemasterPolicyResponse>;
130
346
  /**
131
347
  * Coverage check via the redcoast convenience endpoint — server-side
132
348
  * walks the (cached) policy and returns a boolean.
@@ -143,14 +359,7 @@ export declare class DynamicApiClient extends BaseClient {
143
359
  * ProvingRequest. Throws on quota errors or service failures so the
144
360
  * caller can fall back to user-paid fees.
145
361
  */
146
- requestAleoFeeAuthorization({ network, authorization, priorityFee, traceContext, }: {
147
- network: 'testnet' | 'mainnet';
148
- authorization: string;
149
- priorityFee?: number;
150
- traceContext?: TraceContext;
151
- }): Promise<{
152
- feeAuthorization: string;
153
- }>;
362
+ requestAleoFeeAuthorization({ network, authorization, priorityFee, traceContext, }: AleoApiRequest<InlineObject1>): Promise<InlineResponse2003>;
154
363
  /**
155
364
  * Aleo RecordScanner — fetch the ephemeral public key Provable will
156
365
  * use to encrypt the next view-key registration. Forwards through
@@ -159,23 +368,13 @@ export declare class DynamicApiClient extends BaseClient {
159
368
  getAleoScannerPubkey({ network, traceContext, }: {
160
369
  network: 'testnet' | 'mainnet';
161
370
  traceContext?: TraceContext;
162
- }): Promise<{
163
- public_key: string;
164
- key_id: string;
165
- }>;
371
+ }): Promise<AleoScannerPublicKeyResponse>;
166
372
  /**
167
373
  * Aleo RecordScanner — register an encrypted view key. Body carries
168
374
  * the iframe's `crypto_box_seal` ciphertext; redcoast forwards it
169
375
  * verbatim. Server returns the assigned scanner UUID.
170
376
  */
171
- registerAleoScanner({ network, keyId, ciphertext, traceContext, }: {
172
- network: 'testnet' | 'mainnet';
173
- keyId: string;
174
- ciphertext: string;
175
- traceContext?: TraceContext;
176
- }): Promise<{
177
- uuid: string;
178
- } & Record<string, unknown>>;
377
+ registerAleoScanner({ network, keyId, ciphertext, traceContext, }: AleoApiRequest<InlineObject2>): Promise<InlineResponse2005 & Record<string, unknown>>;
179
378
  /**
180
379
  * Aleo RecordScanner — find owned records by uuid + filter. The filter
181
380
  * shape is passed through to Provable verbatim; the iframe handles
@@ -191,11 +390,7 @@ export declare class DynamicApiClient extends BaseClient {
191
390
  /**
192
391
  * Aleo RecordScanner — revoke a registration UUID.
193
392
  */
194
- revokeAleoScanner({ network, uuid, traceContext, }: {
195
- network: 'testnet' | 'mainnet';
196
- uuid: string;
197
- traceContext?: TraceContext;
198
- }): Promise<Record<string, unknown>>;
393
+ revokeAleoScanner({ network, uuid, traceContext, }: AleoApiRequest<InlineObject4>): Promise<Record<string, unknown>>;
199
394
  getDelegatedEncryptionKey({ environmentId, traceContext, }: {
200
395
  environmentId: string;
201
396
  traceContext?: TraceContext;
@@ -212,35 +407,44 @@ export declare class DynamicApiClient extends BaseClient {
212
407
  data: any;
213
408
  status: number;
214
409
  }>;
215
- storeEncryptedBackupByWallet({ walletId, encryptedKeyShares, passwordEncrypted, signedSessionId, encryptionVersion, requiresSignedSessionId, dynamicRequestId, traceContext, }: {
410
+ revokeDelegation({ walletId, shareSetId, signedSessionId, requiresSignedSessionId, dynamicRequestId, traceContext, }: {
411
+ walletId: string;
412
+ shareSetId: string;
413
+ dynamicRequestId: string;
414
+ signedSessionId?: string;
415
+ requiresSignedSessionId?: boolean;
416
+ traceContext?: TraceContext;
417
+ }): Promise<RevokeDelegationResponse>;
418
+ storeEncryptedBackupByWallet({ walletId, encryptedKeyShares, passwordEncrypted, passwordSetByBA, signedSessionId, sessionPublicKey, encryptionVersion, requiresSignedSessionId, dynamicRequestId, traceContext, sendLocation, shareSetId, businessAccountId, passwordUpdateBatchId, }: {
216
419
  walletId: string;
217
420
  shareSetId?: string;
218
421
  encryptedKeyShares: string[];
219
422
  passwordEncrypted: boolean;
423
+ passwordSetByBA?: boolean;
220
424
  dynamicRequestId: string;
221
425
  signedSessionId?: string;
426
+ sessionPublicKey?: string;
222
427
  encryptionVersion?: string;
223
428
  requiresSignedSessionId?: boolean;
224
429
  traceContext?: TraceContext;
225
- }): Promise<any>;
226
- markKeySharesAsBackedUp({ walletId, shareSetId, locations, dynamicRequestId, traceContext, passwordUpdateBatchId, }: {
430
+ /**
431
+ * When true, selects the flow where, after storing the share, CKS calls
432
+ * redcoast's backup/locations endpoint itself to report its own DYNAMIC
433
+ * entry, instead of returning keyShareIds for the caller to activate
434
+ * separately.
435
+ */
436
+ sendLocation?: boolean;
437
+ businessAccountId?: string;
438
+ passwordUpdateBatchId?: string;
439
+ }): Promise<StoreEncryptedBackupResponse>;
440
+ markKeySharesAsBackedUp({ walletId, shareSetId, locations, dynamicRequestId, traceContext, passwordUpdateBatchId, businessAccountId, }: Omit<BackupKeySharesToLocationsRequest, 'locations'> & {
227
441
  walletId: string;
228
- shareSetId?: string;
229
442
  locations: BackupLocationWithExternalKeyShareId[];
230
443
  dynamicRequestId: string;
231
444
  traceContext?: TraceContext;
232
- passwordUpdateBatchId?: string;
233
- }): Promise<{
234
- message: string;
235
- walletId: string;
236
- passwordUpdateStatus?: 'pending' | 'activated';
237
- locationsWithKeyShares: {
238
- location: BackupLocation;
239
- id: string;
240
- keygenId: string;
241
- externalKeyShareId?: string;
242
- }[];
243
- }>;
445
+ /** Set so redcoast maps the backup to the business-account signer's share set. */
446
+ businessAccountId?: string;
447
+ }): Promise<BackupKeySharesResponse>;
244
448
  recoverEncryptedBackupByWallet({ walletId, externalKeyShareIds, signedSessionId, mfaToken, requiresSignedSessionId, traceContext, userId, }: {
245
449
  walletId: string;
246
450
  shareSetId?: string;
@@ -255,17 +459,20 @@ export declare class DynamicApiClient extends BaseClient {
255
459
  oauthAccountId: string;
256
460
  traceContext?: TraceContext;
257
461
  }): Promise<any>;
258
- importPrivateKey({ chainName, dynamicRequestId, clientKeygenIds, thresholdSignatureScheme, bitcoinConfig, onError, onCeremonyComplete, traceContext, legacyWalletId, }: {
462
+ importPrivateKey({ chainName, dynamicRequestId, clientKeygenIds, thresholdSignatureScheme, bitcoinConfig, onError, onCeremonyComplete, traceContext, legacyWalletId, variant, }: Omit<ImportWaasPrivateKeyRequest, 'chain' | 'thresholdSignatureScheme' | 'variant'> & {
259
463
  dynamicRequestId?: string;
260
464
  chainName: string;
261
- clientKeygenIds: string[];
262
465
  thresholdSignatureScheme: ThresholdSignatureScheme;
263
466
  bitcoinConfig?: BitcoinConfig;
264
467
  onError?: (error: Error) => void;
265
- onCeremonyComplete?: (accountAddress: string, walletId: string, shareSetId?: string, shareSetType?: ShareSetType) => void;
468
+ onCeremonyComplete?: (completion: CreateCeremonyComplete) => void;
266
469
  traceContext?: TraceContext;
267
- /** ID of the legacy embedded wallet being upgraded to v3 */
268
- legacyWalletId?: string;
470
+ /**
471
+ * ed25519 chains only: 'ed25519Standard' marks a raw 32-byte scalar import
472
+ * (non-exportable Ed25519). Persisted server-side in WaasWalletSettings and
473
+ * used for the import + later sign. Omitted → ed25519Exportable.
474
+ */
475
+ variant?: `${NonNullable<ImportWaasPrivateKeyRequest['variant']>}`;
269
476
  }): Promise<KeygenCompleteResponse>;
270
477
  getUser(dynamicRequestId: string, traceContext?: TraceContext): Promise<any>;
271
478
  refreshUser(traceContext?: TraceContext): Promise<any>;
@@ -282,43 +489,265 @@ export declare class DynamicApiClient extends BaseClient {
282
489
  walletAddress: string;
283
490
  traceContext?: TraceContext;
284
491
  }): Promise<WaasWalletResponse>;
285
- delegatedSignMessage({ walletId, message, isFormatted, dynamicRequestId, onError, context, traceContext, }: {
492
+ /** Create a business account; the caller's JWT user is seeded as the first owner. */
493
+ createBusinessAccount({ request, traceContext, }: {
494
+ request: CreateBusinessAccountSdkRequest;
495
+ traceContext?: TraceContext;
496
+ }): Promise<BusinessAccount>;
497
+ /** List business accounts the caller is a member of. */
498
+ listBusinessAccounts({ traceContext, }?: {
499
+ traceContext?: TraceContext;
500
+ }): Promise<BusinessAccountList>;
501
+ /** Get a business account with embedded members + signers. 404 if the caller is not a member. */
502
+ getBusinessAccountById({ businessAccountId, traceContext, }: RequestWithTraceContext<Omit<GetBusinessAccountRequest, 'authToken'>>): Promise<BusinessAccountDetail>;
503
+ listBusinessAccountProposals({ businessAccountId, status, traceContext, }: {
504
+ businessAccountId: string;
505
+ status?: string;
506
+ traceContext?: TraceContext;
507
+ }): Promise<BusinessAccountProposal[]>;
508
+ getBusinessAccountProposal({ businessAccountId, proposalId, traceContext, }: {
509
+ businessAccountId: string;
510
+ proposalId: string;
511
+ traceContext?: TraceContext;
512
+ }): Promise<BusinessAccountProposal>;
513
+ recordBusinessAccountProposalApproval({ businessAccountId, proposalId, approvedAt, signature, traceContext, }: {
514
+ businessAccountId: string;
515
+ proposalId: string;
516
+ approvedAt: string;
517
+ signature: string;
518
+ traceContext?: TraceContext;
519
+ }): Promise<BusinessAccountProposal>;
520
+ executeBusinessAccountProposal({ businessAccountId, proposalId, traceContext, }: {
521
+ businessAccountId: string;
522
+ proposalId: string;
523
+ traceContext?: TraceContext;
524
+ }): Promise<{
525
+ version: number;
526
+ } | BusinessAccountActionRequired>;
527
+ /**
528
+ * Sends a governed mutation. A 202 consent-pending body resolves as-is; the
529
+ * 422 `intent_required` refusal is rejected by axios before its body is read,
530
+ * so it is re-raised as `BusinessAccountIntentRequiredError` for the caller to sign.
531
+ */
532
+ private submitBusinessAccountMutation;
533
+ updateBusinessAccountMemberRole({ businessAccountId, userId, role, autoExecute, signedIntent, traceContext, }: BusinessAccountGovernedOptions & {
534
+ businessAccountId: string;
535
+ userId: string;
536
+ role: string;
537
+ traceContext?: TraceContext;
538
+ }): Promise<BusinessAccountMember | BusinessAccountActionRequired>;
539
+ getBusinessAccountGovernance({ businessAccountId, traceContext, }: {
540
+ businessAccountId: string;
541
+ traceContext?: TraceContext;
542
+ }): Promise<{
543
+ governance: BusinessAccountGovernance;
544
+ }>;
545
+ /** Replaces the whole governance section. Itself governed, so it can answer with the same refusals. */
546
+ setBusinessAccountGovernance({ businessAccountId, governance, autoExecute, signedIntent, traceContext, }: BusinessAccountGovernedOptions & {
547
+ businessAccountId: string;
548
+ governance: BusinessAccountGovernance;
549
+ traceContext?: TraceContext;
550
+ }): Promise<{
551
+ version: number;
552
+ } | BusinessAccountActionRequired>;
553
+ /**
554
+ * Add an existing wallet to a business account. No ceremony — the server
555
+ * transfers ownership and registers the caller as owner + signer bound to
556
+ * their existing share set. Omit `businessAccountId` to find-or-create the
557
+ * per-wallet business account. Returns the business-account detail. Idempotent.
558
+ */
559
+ linkWalletToBusinessAccount({ walletId, businessAccountId, traceContext, }: RequestWithTraceContext<Omit<LinkWalletToBusinessAccountRequest, 'authToken'>>): Promise<BusinessAccountDetail>;
560
+ /**
561
+ * Add a member to a business account. Resolve the target by `userId`, or by
562
+ * `identifier` + `identifierType` (e.g. an email) — the user is created if
563
+ * absent, mirroring addBusinessAccountSigner.
564
+ */
565
+ addBusinessAccountMember({ businessAccountId, userId, identifier, identifierType, smsCountryCode, socialProvider, role, autoExecute, signedIntent, traceContext, }: RequestWithTraceContext<Omit<AddBusinessAccountMemberRequest, 'authToken'>> & BusinessAccountGovernedOptions): Promise<BusinessAccountMember | BusinessAccountActionRequired>;
566
+ /**
567
+ * Add a signer to a business-account wallet. Resolve the target by `userId`, or by
568
+ * `identifier` + `identifierType` (e.g. an email). Returns a PENDING signer
569
+ * (HTTP 202, `shareSetId: null`) — the reshare ceremony that mints the share
570
+ * is a follow-up and not yet performed server-side.
571
+ */
572
+ addBusinessAccountSigner({ businessAccountId, walletId, signerType, userId, identifier, identifierType, serverIdentifier, smsCountryCode, socialProvider, traceContext, }: TargetSignerIdentity & {
573
+ businessAccountId: string;
286
574
  walletId: string;
575
+ signerType: BusinessAccountSignerType;
576
+ traceContext?: TraceContext;
577
+ }): Promise<BusinessAccountSigner>;
578
+ /**
579
+ * SSE ceremony for addSigner. Same-parties 2/2 -> 2/2 reshare on the signers
580
+ * endpoint: the caller's existing client share participates as the remaining
581
+ * party (clientKeygenIds = [existing], no new party). The server runs the
582
+ * reshare with `newServerKeygenIds=[]` and persists the result as a NEW
583
+ * isolated share set for the target signer — it does not refresh the
584
+ * caller's set in place.
585
+ *
586
+ * Returns the room (createEventStreamPromise) + the new `shareSetId` via
587
+ * onCeremonyComplete. The resulting client share is reshared locally and
588
+ * seeded to the client-keyshare-service on the target's behalf (see
589
+ * `seedBusinessAccountSignerShare`).
590
+ */
591
+ addBusinessAccountSignerCeremony({ businessAccountId, walletId, clientKeygenIds, oldThresholdSignatureScheme, signerType, userId, identifier, identifierType, serverIdentifier, signedIntent, initialSignerRules, dynamicRequestId, elevatedAccessToken, onError, onCeremonyComplete, traceContext, }: Pick<TargetSignerIdentity, 'userId' | 'identifier' | 'identifierType' | 'serverIdentifier'> & {
592
+ businessAccountId: string;
593
+ walletId: string;
594
+ clientKeygenIds: string[];
595
+ oldThresholdSignatureScheme: ThresholdSignatureScheme;
596
+ signerType: BusinessAccountSignerType;
597
+ /**
598
+ * Signed intent for a governed account — omit on the first call. If the
599
+ * ceremony answers action-required, sign the returned intent and retry
600
+ * with `signedIntent` set.
601
+ */
602
+ signedIntent?: BusinessAccountSignedIntent;
603
+ /** Optional rules to seed the new signer's policy layer with at mint time. */
604
+ initialSignerRules?: WaasPolicyRule[];
605
+ dynamicRequestId?: string;
606
+ elevatedAccessToken?: string;
607
+ onError?: (error: Error) => void;
608
+ onCeremonyComplete?: (completion: AddSignerCeremonyComplete) => void;
609
+ traceContext?: TraceContext;
610
+ }): Promise<ReshareResponse | BusinessAccountActionRequired>;
611
+ /**
612
+ * On-behalf KSS write for addSigner: store the added signer's freshly-reshared
613
+ * client share in the client-keyshare-service keyed to the ADDED signer's
614
+ * partition via `targetUserId` in the body. Uses the caller's relay auth (the
615
+ * business-account-membership gate is FF-bypassed for now; the client-keyshare-service
616
+ * reads `targetUserId` and inserts-if-empty). Returns the stored keyShareId(s)
617
+ * to thread as `externalKeyShareId` into `markKeySharesAsBackedUp`.
618
+ * Hardened auth (scoped grant token) is the follow-up — DYNT-1071/1072.
619
+ */
620
+ backupOnBehalfOfAddedSigner({ walletId, targetUserId, encryptedAccountCredentials, passwordEncrypted, encryptionVersion, clientKeyshareBackupGrant, signedSessionId, dynamicRequestId, traceContext, }: {
621
+ walletId: string;
622
+ targetUserId: string;
623
+ encryptedAccountCredentials: string[];
624
+ passwordEncrypted: boolean;
625
+ encryptionVersion?: string;
626
+ /** RS256 scoped JWT minted by redcoast on the `ceremony_complete` SSE
627
+ * event. Single-use (jti enforced atomically by CKS), 60s, scoped to one
628
+ * (caller, target, wallet, businessAccount). CKS routes the share to
629
+ * `act.target_user_id`. */
630
+ clientKeyshareBackupGrant?: string;
631
+ /** Caller's signed-session signature. Sent alongside the grant for
632
+ * belt-and-suspenders replay protection (grant `jti` is the primary check
633
+ * in CKS; this catches replay at the session layer too). */
634
+ signedSessionId?: string;
635
+ dynamicRequestId: string;
636
+ traceContext?: TraceContext;
637
+ }): Promise<{
287
638
  message: string;
288
- isFormatted?: boolean;
639
+ keyShareIds: string[];
640
+ }>;
641
+ delegatedSignMessage({ walletId, shareSetId, message, isFormatted, dynamicRequestId, onError, context, traceContext, }: Pick<SignMessageWithWaasRequest, 'message' | 'isFormatted'> & {
642
+ walletId: string;
643
+ /**
644
+ * Optional. The `shareSetId` from the `wallet.delegation.created`
645
+ * webhook payload (a `WaasWallets.id`). When omitted, redcoast resolves
646
+ * the right share set by walletId + shareSetType — see PR #9480.
647
+ */
648
+ shareSetId?: string;
289
649
  dynamicRequestId: string;
290
650
  onError?: (error: Error) => void;
291
- context?: SignMessageEvmTransaction | SignMessageSvmTransaction | SignMessageEvmUserOperation;
651
+ context?: SignMessageChainContext;
292
652
  traceContext?: TraceContext;
293
- }): Promise<OpenRoomResponse>;
294
- createRooms({ walletId, roomType, roomCount, traceContext, }: {
653
+ }): Promise<import("@dynamic-labs/sdk-api-core").OpenRoomResponseWithServerKeygenIds>;
654
+ createRooms({ walletId, roomType, roomCount, traceContext, }: Partial<CreateRoomsRequest> & {
295
655
  walletId: string;
296
- roomType?: RoomTypeEnum;
297
- roomCount?: number;
298
656
  traceContext?: TraceContext;
299
657
  }): Promise<any>;
300
- createRoomsWithoutWalletId({ roomType, thresholdSignatureScheme, roomCount, traceContext, }: {
301
- roomType: RoomTypeEnum;
658
+ createRoomsWithoutWalletId({ roomType, thresholdSignatureScheme, roomCount, traceContext, }: Omit<CreateRoomsWithoutWalletIdRequest, 'thresholdSignatureScheme'> & {
302
659
  thresholdSignatureScheme: ThresholdSignatureScheme;
303
- roomCount?: number;
304
660
  traceContext?: TraceContext;
305
661
  }): Promise<any>;
306
- requestSvmSponsoredTransaction({ transaction, traceContext, }: {
307
- /** Base64-encoded unsigned Solana transaction. */
308
- transaction: string;
662
+ requestSvmSponsoredTransaction({ transaction, userId, traceContext, }: SponsorSVMTransactionRequest & {
309
663
  traceContext?: TraceContext;
310
- }): Promise<{
311
- transaction: string;
664
+ }): Promise<SponsorSVMTransactionResponse>;
665
+ getSvmSponsorAddress({ traceContext, }?: {
666
+ traceContext?: TraceContext;
667
+ }): Promise<GetSVMSponsorAddressResponse>;
668
+ private buildTraceHeaders;
669
+ private throwGaslessApiError;
670
+ sponsorEVMTransaction({ request, traceContext, }: {
671
+ request: SponsorEVMTransactionRequest;
672
+ traceContext?: TraceContext;
673
+ }): Promise<SponsorEVMTransactionResponse>;
674
+ getEVMSponsoredTransactionStatus({ requestId, traceContext, }: {
675
+ requestId: string;
676
+ traceContext?: TraceContext;
677
+ }): Promise<GetEVMSponsoredTransactionStatusResponse>;
678
+ getAvailableEVMGaslessRelayer({ chainId, traceContext, }: {
679
+ chainId: number;
680
+ traceContext?: TraceContext;
681
+ }): Promise<GetAvailableEVMGaslessRelayerResponse>;
682
+ getNonces({ count }?: {
683
+ count?: number;
684
+ }): Promise<NoncesResponse>;
685
+ /**
686
+ * Nonces from the public `/api/v0/sdk` route regardless of client type, so no token is sent: safe to call
687
+ * from a request signer, whose own calls would otherwise each need a nonce first.
688
+ */
689
+ getAuthServiceNonces({ count }?: {
690
+ count?: number;
691
+ }): Promise<NoncesResponse>;
692
+ private fetchNonces;
693
+ /**
694
+ * Resolves this environment's server identity — a real userId the server
695
+ * itself is authenticated as, but with no discoverable email/externalUserId
696
+ * of its own. Feed the returned userId into `businessAccounts.addMember`
697
+ * to add the server as a business-account member. Server-only — always
698
+ * uses `/api/v0/server`, regardless of `isServerSdk`, since this client is
699
+ * shared with the browser SDK (via `BusinessAccountClient`) and the route
700
+ * doesn't exist under `/api/v0/sdk`.
701
+ */
702
+ getServerIdentity(): Promise<{
703
+ userId: string;
312
704
  }>;
313
705
  updateAdditionalAddresses({ walletId, additionalAddresses, dynamicRequestId, traceContext, }: {
314
706
  walletId: string;
315
- additionalAddresses: {
316
- address: string;
317
- type: string;
318
- publicKey: string;
319
- }[];
707
+ additionalAddresses: WalletAdditionalAddressRequest[];
320
708
  dynamicRequestId?: string;
321
709
  traceContext?: TraceContext;
322
710
  }): Promise<any>;
711
+ /**
712
+ * Generates a Token-2022 confidential-transfer seed inside the enclave and
713
+ * stores the sealed result in CKS. Returns the public ElGamal key.
714
+ */
715
+ createConfidentialSeed({ walletId, request, traceContext, }: {
716
+ walletId: string;
717
+ request: CreateConfidentialSeedRequest;
718
+ traceContext?: TraceContext;
719
+ }): Promise<CreateConfidentialSeedResponse>;
720
+ /**
721
+ * Builds Token-2022 confidential-transfer transactions in the enclave.
722
+ * Returns base64 unsigned transactions in broadcast order plus a binding
723
+ * tag; sign them through `signConfidentialTransactions`.
724
+ */
725
+ signConfidentialTransfer({ walletId, request, traceContext, }: {
726
+ walletId: string;
727
+ request: SignConfidentialTransferRequest;
728
+ traceContext?: TraceContext;
729
+ }): Promise<SignConfidentialTransferResponse>;
730
+ /**
731
+ * Second half of the confidential-transfer ceremony: provisions one MPC
732
+ * room per transaction and dispatches the enclave co-sign. Returns the
733
+ * room ids for the client share to join.
734
+ */
735
+ signConfidentialTransactions({ walletId, request, mfaToken, elevatedAccessToken, traceContext, }: {
736
+ walletId: string;
737
+ request: SignConfidentialTransactionsRequest;
738
+ mfaToken?: string;
739
+ elevatedAccessToken?: string;
740
+ traceContext?: TraceContext;
741
+ }): Promise<SignConfidentialTransactionsResponse>;
742
+ /**
743
+ * Decrypts a confidential token account's available and pending balances
744
+ * inside the enclave, using the wallet's stored confidential seed.
745
+ */
746
+ getSvmConfidentialBalance({ walletId, request, traceContext, }: {
747
+ walletId: string;
748
+ request: SvmConfidentialBalanceRequest;
749
+ traceContext?: TraceContext;
750
+ }): Promise<SvmConfidentialBalanceResponse>;
323
751
  }
752
+ export {};
324
753
  //# sourceMappingURL=api.d.ts.map