@dynamic-labs-wallet/core 0.0.297 → 0.0.299
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.js
CHANGED
|
@@ -253,6 +253,18 @@ const MPC_CHAIN_CONFIG = {
|
|
|
253
253
|
0
|
|
254
254
|
],
|
|
255
255
|
signingAlgorithm: "ED25519"
|
|
256
|
+
},
|
|
257
|
+
TEMPO: {
|
|
258
|
+
// Uses secp256k1 ECDSA (EVM-compatible)
|
|
259
|
+
// Same derivation path as EVM since Tempo uses Ethereum-style addresses
|
|
260
|
+
derivationPath: [
|
|
261
|
+
44,
|
|
262
|
+
60,
|
|
263
|
+
0,
|
|
264
|
+
0,
|
|
265
|
+
0
|
|
266
|
+
],
|
|
267
|
+
signingAlgorithm: "ECDSA"
|
|
256
268
|
}
|
|
257
269
|
};
|
|
258
270
|
var ThresholdSignatureScheme = /*#__PURE__*/ function(ThresholdSignatureScheme) {
|
|
@@ -1262,13 +1274,19 @@ const STATUS_MESSAGES = {
|
|
|
1262
1274
|
401: 'Authorization header or cookie is required',
|
|
1263
1275
|
403: 'Forbidden',
|
|
1264
1276
|
422: 'Unprocessable content',
|
|
1277
|
+
429: 'Rate limited',
|
|
1265
1278
|
500: 'Internal server error'
|
|
1266
1279
|
};
|
|
1280
|
+
const isCloudflareRateLimitError = (error)=>{
|
|
1281
|
+
var _error_response, _error_response1;
|
|
1282
|
+
const data = (_error_response = error.response) == null ? void 0 : _error_response.data;
|
|
1283
|
+
return ((_error_response1 = error.response) == null ? void 0 : _error_response1.status) === 429 && (data == null ? void 0 : data['cloudflare_error']) === true;
|
|
1284
|
+
};
|
|
1267
1285
|
const handleAxiosError = (error, message, context, logger)=>{
|
|
1268
1286
|
var _error_config, _error_config1, _error_response, _error_response1, _error_response2;
|
|
1269
1287
|
const requestUrl = (_error_config = error.config) == null ? void 0 : _error_config.url;
|
|
1270
1288
|
const requestBaseUrl = (_error_config1 = error.config) == null ? void 0 : _error_config1.baseURL;
|
|
1271
|
-
|
|
1289
|
+
const logPayload = _extends({
|
|
1272
1290
|
message,
|
|
1273
1291
|
error: (_error_response = error.response) == null ? void 0 : _error_response.data,
|
|
1274
1292
|
status: (_error_response1 = error.response) == null ? void 0 : _error_response1.status
|
|
@@ -1278,7 +1296,9 @@ const handleAxiosError = (error, message, context, logger)=>{
|
|
|
1278
1296
|
requestUrl
|
|
1279
1297
|
}, {
|
|
1280
1298
|
context
|
|
1281
|
-
})
|
|
1299
|
+
});
|
|
1300
|
+
const logLevel = isCloudflareRateLimitError(error) ? 'warn' : 'error';
|
|
1301
|
+
logger[logLevel]('[DynamicWaasWalletClient] Axios error: ', logPayload);
|
|
1282
1302
|
const status = (_error_response2 = error.response) == null ? void 0 : _error_response2.status;
|
|
1283
1303
|
const resolvedStatus = status && STATUS_MESSAGES[status] ? status : 500;
|
|
1284
1304
|
throw new WalletApiError(resolvedStatus, STATUS_MESSAGES[resolvedStatus]);
|
|
@@ -1354,6 +1374,7 @@ exports.getTSSConfig = getTSSConfig;
|
|
|
1354
1374
|
exports.getVersionNamespace = getVersionNamespace;
|
|
1355
1375
|
exports.getVersionWithoutNamespace = getVersionWithoutNamespace;
|
|
1356
1376
|
exports.handleAxiosError = handleAxiosError;
|
|
1377
|
+
exports.isCloudflareRateLimitError = isCloudflareRateLimitError;
|
|
1357
1378
|
exports.parseNamespacedVersion = parseNamespacedVersion;
|
|
1358
1379
|
exports.serializeMessageForForwardMPC = serializeMessageForForwardMPC;
|
|
1359
1380
|
exports.verifiedCredentialNameToChainEnum = verifiedCredentialNameToChainEnum;
|
package/index.esm.js
CHANGED
|
@@ -251,6 +251,18 @@ const MPC_CHAIN_CONFIG = {
|
|
|
251
251
|
0
|
|
252
252
|
],
|
|
253
253
|
signingAlgorithm: "ED25519"
|
|
254
|
+
},
|
|
255
|
+
TEMPO: {
|
|
256
|
+
// Uses secp256k1 ECDSA (EVM-compatible)
|
|
257
|
+
// Same derivation path as EVM since Tempo uses Ethereum-style addresses
|
|
258
|
+
derivationPath: [
|
|
259
|
+
44,
|
|
260
|
+
60,
|
|
261
|
+
0,
|
|
262
|
+
0,
|
|
263
|
+
0
|
|
264
|
+
],
|
|
265
|
+
signingAlgorithm: "ECDSA"
|
|
254
266
|
}
|
|
255
267
|
};
|
|
256
268
|
var ThresholdSignatureScheme = /*#__PURE__*/ function(ThresholdSignatureScheme) {
|
|
@@ -1260,13 +1272,19 @@ const STATUS_MESSAGES = {
|
|
|
1260
1272
|
401: 'Authorization header or cookie is required',
|
|
1261
1273
|
403: 'Forbidden',
|
|
1262
1274
|
422: 'Unprocessable content',
|
|
1275
|
+
429: 'Rate limited',
|
|
1263
1276
|
500: 'Internal server error'
|
|
1264
1277
|
};
|
|
1278
|
+
const isCloudflareRateLimitError = (error)=>{
|
|
1279
|
+
var _error_response, _error_response1;
|
|
1280
|
+
const data = (_error_response = error.response) == null ? void 0 : _error_response.data;
|
|
1281
|
+
return ((_error_response1 = error.response) == null ? void 0 : _error_response1.status) === 429 && (data == null ? void 0 : data['cloudflare_error']) === true;
|
|
1282
|
+
};
|
|
1265
1283
|
const handleAxiosError = (error, message, context, logger)=>{
|
|
1266
1284
|
var _error_config, _error_config1, _error_response, _error_response1, _error_response2;
|
|
1267
1285
|
const requestUrl = (_error_config = error.config) == null ? void 0 : _error_config.url;
|
|
1268
1286
|
const requestBaseUrl = (_error_config1 = error.config) == null ? void 0 : _error_config1.baseURL;
|
|
1269
|
-
|
|
1287
|
+
const logPayload = _extends({
|
|
1270
1288
|
message,
|
|
1271
1289
|
error: (_error_response = error.response) == null ? void 0 : _error_response.data,
|
|
1272
1290
|
status: (_error_response1 = error.response) == null ? void 0 : _error_response1.status
|
|
@@ -1276,10 +1294,12 @@ const handleAxiosError = (error, message, context, logger)=>{
|
|
|
1276
1294
|
requestUrl
|
|
1277
1295
|
}, {
|
|
1278
1296
|
context
|
|
1279
|
-
})
|
|
1297
|
+
});
|
|
1298
|
+
const logLevel = isCloudflareRateLimitError(error) ? 'warn' : 'error';
|
|
1299
|
+
logger[logLevel]('[DynamicWaasWalletClient] Axios error: ', logPayload);
|
|
1280
1300
|
const status = (_error_response2 = error.response) == null ? void 0 : _error_response2.status;
|
|
1281
1301
|
const resolvedStatus = status && STATUS_MESSAGES[status] ? status : 500;
|
|
1282
1302
|
throw new WalletApiError(resolvedStatus, STATUS_MESSAGES[resolvedStatus]);
|
|
1283
1303
|
};
|
|
1284
1304
|
|
|
1285
|
-
export { AuthMode, BITCOIN_ADDRESS_TYPE_CONFIG, BITCOIN_DERIVATION_PATHS, BackupLocation, BitcoinAddressType, BitcoinNetwork, 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, DynamicTraceElapsedTimeHeader, DynamicTraceIdHeader, ENCRYPTED_SHARES_STORAGE_SUFFIX, ENVIRONMENT_ENUM, FEATURE_FLAGS, IFRAME_DOMAIN_MAP, MPC_CHAIN_CONFIG, MPC_CONFIG, MPC_RELAY_DEV_API_URL, MPC_RELAY_PREPROD_API_URL, MPC_RELAY_PROD_API_URL, MPC_RELAY_URL_MAP, 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, SOLANA_RPC_URL, SigningAlgorithm, SuccessEventType, ThresholdSignatureScheme, URL_PATTERNS, WalletApiError, WalletOperation, WalletReadyState, chain, chainEnumToVerifiedCredentialName, formatNamespacedVersion, getBitcoinChainConfig, getClientThreshold, getDynamicServerThreshold, getEnvironmentFromUrl, getMPCChainConfig, getRequiredExternalKeyShareId, getReshareConfig, getServerWalletReshareConfig, getTSSConfig, getVersionNamespace, getVersionWithoutNamespace, handleAxiosError, parseNamespacedVersion, serializeMessageForForwardMPC, verifiedCredentialNameToChainEnum };
|
|
1305
|
+
export { AuthMode, BITCOIN_ADDRESS_TYPE_CONFIG, BITCOIN_DERIVATION_PATHS, BackupLocation, BitcoinAddressType, BitcoinNetwork, 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, DynamicTraceElapsedTimeHeader, DynamicTraceIdHeader, ENCRYPTED_SHARES_STORAGE_SUFFIX, ENVIRONMENT_ENUM, FEATURE_FLAGS, IFRAME_DOMAIN_MAP, MPC_CHAIN_CONFIG, MPC_CONFIG, MPC_RELAY_DEV_API_URL, MPC_RELAY_PREPROD_API_URL, MPC_RELAY_PROD_API_URL, MPC_RELAY_URL_MAP, 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, SOLANA_RPC_URL, SigningAlgorithm, SuccessEventType, ThresholdSignatureScheme, URL_PATTERNS, WalletApiError, WalletOperation, WalletReadyState, chain, chainEnumToVerifiedCredentialName, formatNamespacedVersion, getBitcoinChainConfig, getClientThreshold, getDynamicServerThreshold, getEnvironmentFromUrl, getMPCChainConfig, getRequiredExternalKeyShareId, getReshareConfig, getServerWalletReshareConfig, getTSSConfig, getVersionNamespace, getVersionWithoutNamespace, handleAxiosError, isCloudflareRateLimitError, parseNamespacedVersion, serializeMessageForForwardMPC, verifiedCredentialNameToChainEnum };
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/mpc/constants.ts"],"names":[],"mappings":"AAAA,oBAAY,gBAAgB;IAC1B,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,MAAM,WAAW;CAClB;AAED,eAAO,MAAM,wBAAwB;;;CAGpC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,2BAA2B,EAAE,MAAM,CAC9C,MAAM,EACN;IAAE,cAAc,EAAE,MAAM,EAAE,CAAC;IAAC,gBAAgB,EAAE,gBAAgB,CAAA;CAAE,CAUjE,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,cAAc,EAAE,MAAM,EAAE,CAAC;IAAC,gBAAgB,EAAE,gBAAgB,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/mpc/constants.ts"],"names":[],"mappings":"AAAA,oBAAY,gBAAgB;IAC1B,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,MAAM,WAAW;CAClB;AAED,eAAO,MAAM,wBAAwB;;;CAGpC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,2BAA2B,EAAE,MAAM,CAC9C,MAAM,EACN;IAAE,cAAc,EAAE,MAAM,EAAE,CAAC;IAAC,gBAAgB,EAAE,gBAAgB,CAAA;CAAE,CAUjE,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,cAAc,EAAE,MAAM,EAAE,CAAC;IAAC,gBAAgB,EAAE,gBAAgB,CAAA;CAAE,CA0C7G,CAAC;AAEF,oBAAY,wBAAwB;IAClC,UAAU,eAAe;IACzB,YAAY,iBAAiB;IAC7B,aAAa,kBAAkB;CAChC;AAED,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;CAmBtB,CAAC;AAEF,oBAAY,wBAAwB;IAClC,SAAS,cAAc;IACvB,IAAI,SAAS;CACd"}
|
|
@@ -4,6 +4,7 @@ export declare class WalletApiError extends Error {
|
|
|
4
4
|
status: number;
|
|
5
5
|
constructor(status: number, message: string);
|
|
6
6
|
}
|
|
7
|
+
export declare const isCloudflareRateLimitError: (error: AxiosError) => boolean;
|
|
7
8
|
export declare const handleAxiosError: (error: AxiosError, message: string, context: Record<string, unknown>, logger: Logger) => never;
|
|
8
9
|
export type { AxiosError } from 'axios';
|
|
9
10
|
//# sourceMappingURL=axiosErrorResponse.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"axiosErrorResponse.d.ts","sourceRoot":"","sources":["../../src/services/axiosErrorResponse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEnD,qBAAa,cAAe,SAAQ,KAAK;IACvC,MAAM,EAAE,MAAM,CAAC;gBAEH,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAK5C;
|
|
1
|
+
{"version":3,"file":"axiosErrorResponse.d.ts","sourceRoot":"","sources":["../../src/services/axiosErrorResponse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEnD,qBAAa,cAAe,SAAQ,KAAK;IACvC,MAAM,EAAE,MAAM,CAAC;gBAEH,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAK5C;AAWD,eAAO,MAAM,0BAA0B,UAAW,UAAU,KAAG,OAG9D,CAAC;AAEF,eAAO,MAAM,gBAAgB,UACpB,UAAU,WACR,MAAM,WACN,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,UACxB,MAAM,UAkBf,CAAC;AAEF,YAAY,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC"}
|