@dynamic-labs-wallet/core 1.0.57 → 1.0.58

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.
package/index.cjs CHANGED
@@ -922,7 +922,7 @@ const getRequiredExternalKeyShareId = (ks)=>{
922
922
  * before it is posted and surfaces in Datadog exactly as the recovery path does.
923
923
  */ const assertDynamicLocationsHaveExternalKeyShareId = (locations)=>locations.filter((location)=>location.location === BackupLocation.DYNAMIC).forEach((location)=>getRequiredExternalKeyShareId(location));
924
924
 
925
- var version = "1.0.57";
925
+ var version = "1.0.58";
926
926
 
927
927
  class BaseClient {
928
928
  /**
@@ -2090,6 +2090,33 @@ const serializeMessageForForwardMPC = ({ message, isFormatted = false, chainName
2090
2090
  return serializedMessage;
2091
2091
  };
2092
2092
 
2093
+ // Mirrors forward-mpc-client's ErrorCode values (the /utils subpath does not
2094
+ // export the ErrorCode const, so the codes are inlined here).
2095
+ const RECOVERED_CONNECTION_CHURN_CODES = new Set([
2096
+ 'CONNECTION_FAILED',
2097
+ 'CONNECTION_TIMEOUT',
2098
+ 'NOT_CONNECTED',
2099
+ 'TRANSPORT_CLOSED',
2100
+ 'HANDSHAKE_FAILED'
2101
+ ]);
2102
+ /**
2103
+ * Returns true when a classified Forward MPC error is recovered connection
2104
+ * churn that should be logged at `warn` rather than `error`.
2105
+ *
2106
+ * The Forward MPC enclave is an optimization side-channel: the client retries
2107
+ * connections internally, and `shouldFallback` is true for every Forward MPC
2108
+ * failure mode — relay-based MPC is a fully functional safety net, so a
2109
+ * connection-lifecycle failure never blocks a user operation on its own.
2110
+ * Terminal failures (both paths failing) are logged at the operation sites.
2111
+ *
2112
+ * Churn covers rate-limited upgrades and the transport-lifecycle error codes
2113
+ * (connect/reconnect failures, timeouts, socket closes, and handshake-request
2114
+ * timeouts — production evidence shows these concentrate on hostile/flaky
2115
+ * networks). Attestation failures, HANDSHAKE_INVALID_RESPONSE, SERVER_ERROR,
2116
+ * and unclassified errors are NOT churn: they indicate enclave tampering or
2117
+ * protocol breakage and must stay at `error` so monitors can page on them.
2118
+ */ const isRecoveredForwardMpcConnectionChurn = (classification)=>classification.errorType === 'RATE_LIMITED' || classification.errorCode !== undefined && RECOVERED_CONNECTION_CHURN_CODES.has(classification.errorCode);
2119
+
2093
2120
  /**
2094
2121
  * Normalizes an unknown thrown value into flat, log-friendly fields.
2095
2122
  *
@@ -2338,6 +2365,7 @@ exports.getVersionNamespace = getVersionNamespace;
2338
2365
  exports.getVersionWithoutNamespace = getVersionWithoutNamespace;
2339
2366
  exports.handleAxiosError = handleAxiosError;
2340
2367
  exports.isEvmCompatibleChain = isEvmCompatibleChain;
2368
+ exports.isRecoveredForwardMpcConnectionChurn = isRecoveredForwardMpcConnectionChurn;
2341
2369
  exports.parseNamespacedVersion = parseNamespacedVersion;
2342
2370
  exports.serializeError = serializeError;
2343
2371
  exports.serializeMessageForForwardMPC = serializeMessageForForwardMPC;
package/index.esm.js CHANGED
@@ -922,7 +922,7 @@ const getRequiredExternalKeyShareId = (ks)=>{
922
922
  * before it is posted and surfaces in Datadog exactly as the recovery path does.
923
923
  */ const assertDynamicLocationsHaveExternalKeyShareId = (locations)=>locations.filter((location)=>location.location === BackupLocation.DYNAMIC).forEach((location)=>getRequiredExternalKeyShareId(location));
924
924
 
925
- var version = "1.0.57";
925
+ var version = "1.0.58";
926
926
 
927
927
  class BaseClient {
928
928
  /**
@@ -2090,6 +2090,33 @@ const serializeMessageForForwardMPC = ({ message, isFormatted = false, chainName
2090
2090
  return serializedMessage;
2091
2091
  };
2092
2092
 
2093
+ // Mirrors forward-mpc-client's ErrorCode values (the /utils subpath does not
2094
+ // export the ErrorCode const, so the codes are inlined here).
2095
+ const RECOVERED_CONNECTION_CHURN_CODES = new Set([
2096
+ 'CONNECTION_FAILED',
2097
+ 'CONNECTION_TIMEOUT',
2098
+ 'NOT_CONNECTED',
2099
+ 'TRANSPORT_CLOSED',
2100
+ 'HANDSHAKE_FAILED'
2101
+ ]);
2102
+ /**
2103
+ * Returns true when a classified Forward MPC error is recovered connection
2104
+ * churn that should be logged at `warn` rather than `error`.
2105
+ *
2106
+ * The Forward MPC enclave is an optimization side-channel: the client retries
2107
+ * connections internally, and `shouldFallback` is true for every Forward MPC
2108
+ * failure mode — relay-based MPC is a fully functional safety net, so a
2109
+ * connection-lifecycle failure never blocks a user operation on its own.
2110
+ * Terminal failures (both paths failing) are logged at the operation sites.
2111
+ *
2112
+ * Churn covers rate-limited upgrades and the transport-lifecycle error codes
2113
+ * (connect/reconnect failures, timeouts, socket closes, and handshake-request
2114
+ * timeouts — production evidence shows these concentrate on hostile/flaky
2115
+ * networks). Attestation failures, HANDSHAKE_INVALID_RESPONSE, SERVER_ERROR,
2116
+ * and unclassified errors are NOT churn: they indicate enclave tampering or
2117
+ * protocol breakage and must stay at `error` so monitors can page on them.
2118
+ */ const isRecoveredForwardMpcConnectionChurn = (classification)=>classification.errorType === 'RATE_LIMITED' || classification.errorCode !== undefined && RECOVERED_CONNECTION_CHURN_CODES.has(classification.errorCode);
2119
+
2093
2120
  /**
2094
2121
  * Normalizes an unknown thrown value into flat, log-friendly fields.
2095
2122
  *
@@ -2237,4 +2264,4 @@ const handleAxiosError = (error, message, context, _logger)=>{
2237
2264
  throw new WalletApiError(resolvedStatus, STATUS_MESSAGES[resolvedStatus]);
2238
2265
  };
2239
2266
 
2240
- export { AuthMode, BITCOIN_ADDRESS_TYPE_CONFIG, BITCOIN_DERIVATION_PATHS, BROWSER_SDK_ROUTE_PREFIX, BackupLocation, BitcoinAddressType, BitcoinNetwork, BusinessAccountClient, BusinessAccountMemberRole, BusinessAccountSignerType, CreateRoomPartiesOptions, DELEGATED_SHARE_COUNT, DYNAMIC_AUTH_BASE_API_URL_MAP, DYNAMIC_AUTH_DEV_BASE_API_URL, DYNAMIC_AUTH_PREPROD_BASE_API_URL, DYNAMIC_AUTH_PROD_BASE_API_URL, DYNAMIC_CLIENT_RELAY_REDCOAST_API_KEY_MAP, DYNAMIC_CLIENT_RELAY_REDCOAST_APP_ID_MAP, DYNAMIC_FORWARD_MPC_DEV_ENCLAVE_URL, DYNAMIC_FORWARD_MPC_ENCLAVE_ATTESTATION_CONFIG_MAP, DYNAMIC_FORWARD_MPC_ENCLAVE_URL_MAP, DYNAMIC_FORWARD_MPC_PREPROD_ENCLAVE_URL, DYNAMIC_FORWARD_MPC_PROD_ENCLAVE_URL, DYNAMIC_KEYSHARES_RELAY_MAP, DYNAMIC_KEYSHARES_RELAY_PREPROD_BASE_API_URL, DYNAMIC_KEYSHARES_RELAY_PROD_BASE_API_URL, DynamicApiClient, DynamicClientSessionSignature, DynamicElevatedAccessTokenHeader, DynamicForwardMPCHeader, DynamicMfaTokenHeader, DynamicRequestIdHeader, DynamicSessionPublicKeyHeader, DynamicTraceElapsedTimeHeader, DynamicTraceIdHeader, ENCRYPTED_SHARES_STORAGE_SUFFIX, ENVIRONMENT_ENUM, EVM_COMPATIBLE_CHAINS, FEATURE_FLAGS, IFRAME_DOMAIN_MAP, Logger, MIDNIGHT_DERIVATION_PATHS, MPC_CHAIN_CONFIG, MPC_CONFIG, MPC_RELAY_DEV_API_URL, MPC_RELAY_PREPROD_API_URL, MPC_RELAY_PROD_API_URL, MPC_RELAY_URL_MAP, NoopLogger, PREPROD_RELAY_API_KEY, PREPROD_RELAY_APP_ID, PROD_RELAY_API_KEY, PROD_RELAY_APP_ID, RELAY_API_KEY_HEADER, RELAY_APP_ID_HEADER, SDK_NAMESPACE, SERVER_SDK_ROUTE_PREFIX, SOLANA_RPC_URL, SuccessEventType, ThresholdSignatureScheme, URL_PATTERNS, WalletApiError, WalletOperation, WalletReadyState, assertDynamicLocationsHaveExternalKeyShareId, chain, chainEnumToVerifiedCredentialName, formatNamespacedVersion, getBitcoinChainConfig, getClientThreshold, getDynamicServerThreshold, getEnvironmentFromUrl, getMPCChainConfig, getRequiredExternalKeyShareId, getReshareConfig, getServerWalletReshareConfig, getTSSConfig, getVersionNamespace, getVersionWithoutNamespace, handleAxiosError, isEvmCompatibleChain, parseNamespacedVersion, serializeError, serializeMessageForForwardMPC, verifiedCredentialNameToChainEnum };
2267
+ export { AuthMode, BITCOIN_ADDRESS_TYPE_CONFIG, BITCOIN_DERIVATION_PATHS, BROWSER_SDK_ROUTE_PREFIX, BackupLocation, BitcoinAddressType, BitcoinNetwork, BusinessAccountClient, BusinessAccountMemberRole, BusinessAccountSignerType, CreateRoomPartiesOptions, DELEGATED_SHARE_COUNT, DYNAMIC_AUTH_BASE_API_URL_MAP, DYNAMIC_AUTH_DEV_BASE_API_URL, DYNAMIC_AUTH_PREPROD_BASE_API_URL, DYNAMIC_AUTH_PROD_BASE_API_URL, DYNAMIC_CLIENT_RELAY_REDCOAST_API_KEY_MAP, DYNAMIC_CLIENT_RELAY_REDCOAST_APP_ID_MAP, DYNAMIC_FORWARD_MPC_DEV_ENCLAVE_URL, DYNAMIC_FORWARD_MPC_ENCLAVE_ATTESTATION_CONFIG_MAP, DYNAMIC_FORWARD_MPC_ENCLAVE_URL_MAP, DYNAMIC_FORWARD_MPC_PREPROD_ENCLAVE_URL, DYNAMIC_FORWARD_MPC_PROD_ENCLAVE_URL, DYNAMIC_KEYSHARES_RELAY_MAP, DYNAMIC_KEYSHARES_RELAY_PREPROD_BASE_API_URL, DYNAMIC_KEYSHARES_RELAY_PROD_BASE_API_URL, DynamicApiClient, DynamicClientSessionSignature, DynamicElevatedAccessTokenHeader, DynamicForwardMPCHeader, DynamicMfaTokenHeader, DynamicRequestIdHeader, DynamicSessionPublicKeyHeader, DynamicTraceElapsedTimeHeader, DynamicTraceIdHeader, ENCRYPTED_SHARES_STORAGE_SUFFIX, ENVIRONMENT_ENUM, EVM_COMPATIBLE_CHAINS, FEATURE_FLAGS, IFRAME_DOMAIN_MAP, Logger, MIDNIGHT_DERIVATION_PATHS, MPC_CHAIN_CONFIG, MPC_CONFIG, MPC_RELAY_DEV_API_URL, MPC_RELAY_PREPROD_API_URL, MPC_RELAY_PROD_API_URL, MPC_RELAY_URL_MAP, NoopLogger, PREPROD_RELAY_API_KEY, PREPROD_RELAY_APP_ID, PROD_RELAY_API_KEY, PROD_RELAY_APP_ID, RELAY_API_KEY_HEADER, RELAY_APP_ID_HEADER, SDK_NAMESPACE, SERVER_SDK_ROUTE_PREFIX, SOLANA_RPC_URL, SuccessEventType, ThresholdSignatureScheme, URL_PATTERNS, WalletApiError, WalletOperation, WalletReadyState, assertDynamicLocationsHaveExternalKeyShareId, chain, chainEnumToVerifiedCredentialName, formatNamespacedVersion, getBitcoinChainConfig, getClientThreshold, getDynamicServerThreshold, getEnvironmentFromUrl, getMPCChainConfig, getRequiredExternalKeyShareId, getReshareConfig, getServerWalletReshareConfig, getTSSConfig, getVersionNamespace, getVersionWithoutNamespace, handleAxiosError, isEvmCompatibleChain, isRecoveredForwardMpcConnectionChurn, parseNamespacedVersion, serializeError, serializeMessageForForwardMPC, verifiedCredentialNameToChainEnum };
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@dynamic-labs-wallet/core",
3
- "version": "1.0.57",
3
+ "version": "1.0.58",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "dependencies": {
7
7
  "@dynamic-labs/sdk-api-core": "^0.0.984",
8
- "@dynamic-labs-wallet/primitives": "1.0.57",
8
+ "@dynamic-labs-wallet/primitives": "1.0.58",
9
9
  "axios": "1.16.0",
10
10
  "uuid": "11.1.0"
11
11
  },
@@ -1,7 +1,26 @@
1
+ import type { ForwardMpcErrorClassification } from '@dynamic-labs-wallet/forward-mpc-client/utils';
1
2
  /**
2
3
  * Re-export error classification utilities from forward-mpc-client.
3
4
  * These utilities help standardize Forward MPC error handling across the SDK.
4
5
  */
5
6
  export { classifyForwardMpcError, isForwardMpcError, isAttestationError, } from '@dynamic-labs-wallet/forward-mpc-client/utils';
6
7
  export type { ForwardMpcErrorType, ForwardMpcErrorClassification } from '@dynamic-labs-wallet/forward-mpc-client/utils';
8
+ /**
9
+ * Returns true when a classified Forward MPC error is recovered connection
10
+ * churn that should be logged at `warn` rather than `error`.
11
+ *
12
+ * The Forward MPC enclave is an optimization side-channel: the client retries
13
+ * connections internally, and `shouldFallback` is true for every Forward MPC
14
+ * failure mode — relay-based MPC is a fully functional safety net, so a
15
+ * connection-lifecycle failure never blocks a user operation on its own.
16
+ * Terminal failures (both paths failing) are logged at the operation sites.
17
+ *
18
+ * Churn covers rate-limited upgrades and the transport-lifecycle error codes
19
+ * (connect/reconnect failures, timeouts, socket closes, and handshake-request
20
+ * timeouts — production evidence shows these concentrate on hostile/flaky
21
+ * networks). Attestation failures, HANDSHAKE_INVALID_RESPONSE, SERVER_ERROR,
22
+ * and unclassified errors are NOT churn: they indicate enclave tampering or
23
+ * protocol breakage and must stay at `error` so monitors can page on them.
24
+ */
25
+ export declare const isRecoveredForwardMpcConnectionChurn: (classification: ForwardMpcErrorClassification) => boolean;
7
26
  //# sourceMappingURL=forwardMpcErrorHandling.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"forwardMpcErrorHandling.d.ts","sourceRoot":"","sources":["../../src/utils/forwardMpcErrorHandling.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,+CAA+C,CAAC;AAEvD,YAAY,EAAE,mBAAmB,EAAE,6BAA6B,EAAE,MAAM,+CAA+C,CAAC"}
1
+ {"version":3,"file":"forwardMpcErrorHandling.d.ts","sourceRoot":"","sources":["../../src/utils/forwardMpcErrorHandling.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,+CAA+C,CAAC;AAEnG;;;GAGG;AACH,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,+CAA+C,CAAC;AAEvD,YAAY,EAAE,mBAAmB,EAAE,6BAA6B,EAAE,MAAM,+CAA+C,CAAC;AAYxH;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,oCAAoC,mBAAoB,6BAA6B,KAAG,OAEO,CAAC"}