@dynamic-labs/utils 4.91.3 → 4.91.5
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/CHANGELOG.md +17 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +4 -4
- package/src/errors/AccessBlockedError.cjs +3 -0
- package/src/errors/AccessBlockedError.d.ts +1 -0
- package/src/errors/AccessBlockedError.js +3 -0
- package/src/errors/AccountExistsError.cjs +2 -2
- package/src/errors/AccountExistsError.d.ts +1 -1
- package/src/errors/AccountExistsError.js +2 -2
- package/src/errors/ChainalysisError.cjs +2 -2
- package/src/errors/ChainalysisError.d.ts +1 -1
- package/src/errors/ChainalysisError.js +2 -2
- package/src/errors/CookieInvalidError.cjs +1 -1
- package/src/errors/CookieInvalidError.js +1 -1
- package/src/errors/CustomError.cjs +4 -2
- package/src/errors/CustomError.d.ts +7 -4
- package/src/errors/CustomError.js +4 -2
- package/src/errors/EmailAlreadyExistsError.cjs +2 -2
- package/src/errors/EmailAlreadyExistsError.d.ts +1 -1
- package/src/errors/EmailAlreadyExistsError.js +2 -2
- package/src/errors/EmbeddedWalletException.cjs +2 -2
- package/src/errors/EmbeddedWalletException.d.ts +1 -1
- package/src/errors/EmbeddedWalletException.js +2 -2
- package/src/errors/GateBlockedError.cjs +1 -1
- package/src/errors/GateBlockedError.js +1 -1
- package/src/errors/GetAddressCancelledError.cjs +1 -1
- package/src/errors/GetAddressCancelledError.js +1 -1
- package/src/errors/InsufficientFundsError.cjs +1 -1
- package/src/errors/InsufficientFundsError.js +1 -1
- package/src/errors/InvalidEmbeddedWalletSessionKeyError.cjs +1 -1
- package/src/errors/InvalidEmbeddedWalletSessionKeyError.js +1 -1
- package/src/errors/InvalidPhoneNumberError.cjs +2 -2
- package/src/errors/InvalidPhoneNumberError.d.ts +1 -1
- package/src/errors/InvalidPhoneNumberError.js +2 -2
- package/src/errors/InvalidPrimaryWalletOrConnectorError.cjs +1 -1
- package/src/errors/InvalidPrimaryWalletOrConnectorError.js +1 -1
- package/src/errors/MetaMaskError.cjs +2 -2
- package/src/errors/MetaMaskError.d.ts +1 -1
- package/src/errors/MetaMaskError.js +2 -2
- package/src/errors/MissingEnvironmentIdError.cjs +1 -1
- package/src/errors/MissingEnvironmentIdError.js +1 -1
- package/src/errors/NoAccessError.cjs +2 -2
- package/src/errors/NoAccessError.d.ts +2 -1
- package/src/errors/NoAccessError.js +2 -2
- package/src/errors/NotSupportedError.cjs +3 -0
- package/src/errors/NotSupportedError.d.ts +1 -0
- package/src/errors/NotSupportedError.js +3 -0
- package/src/errors/RequestChannelNotHandledError.cjs +3 -0
- package/src/errors/RequestChannelNotHandledError.d.ts +1 -0
- package/src/errors/RequestChannelNotHandledError.js +3 -0
- package/src/errors/ResponseError.cjs +7 -1
- package/src/errors/ResponseError.js +7 -1
- package/src/errors/SandboxMaximumThresholdReachedError.cjs +1 -1
- package/src/errors/SandboxMaximumThresholdReachedError.js +1 -1
- package/src/errors/SmsVerificationError.cjs +3 -0
- package/src/errors/SmsVerificationError.d.ts +1 -0
- package/src/errors/SmsVerificationError.js +3 -0
- package/src/errors/SocialAccountAlreadyExistsError.cjs +2 -2
- package/src/errors/SocialAccountAlreadyExistsError.d.ts +1 -1
- package/src/errors/SocialAccountAlreadyExistsError.js +2 -2
- package/src/errors/TooManyEmailVerificationsError.cjs +2 -2
- package/src/errors/TooManyEmailVerificationsError.d.ts +1 -1
- package/src/errors/TooManyEmailVerificationsError.js +2 -2
- package/src/errors/TransactionConfirmationTimeoutError.cjs +1 -1
- package/src/errors/TransactionConfirmationTimeoutError.js +1 -1
- package/src/errors/TransactionFailedError.cjs +1 -1
- package/src/errors/TransactionFailedError.js +1 -1
- package/src/errors/TransactionGasCannotBeSponsoredError.cjs +1 -1
- package/src/errors/TransactionGasCannotBeSponsoredError.js +1 -1
- package/src/errors/UserHasAccountWithEmailError.cjs +2 -2
- package/src/errors/UserHasAccountWithEmailError.d.ts +1 -1
- package/src/errors/UserHasAccountWithEmailError.js +2 -2
- package/src/errors/UserRejectedTransactionError.cjs +1 -1
- package/src/errors/UserRejectedTransactionError.js +1 -1
- package/src/errors/UsernameAlreadyExistsError.cjs +2 -2
- package/src/errors/UsernameAlreadyExistsError.d.ts +1 -1
- package/src/errors/UsernameAlreadyExistsError.js +2 -2
- package/src/errors/VerificationDataCollectionError.cjs +1 -1
- package/src/errors/VerificationDataCollectionError.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
|
|
2
|
+
### [4.91.5](https://github.com/dynamic-labs/dynamic-auth/compare/v4.91.4...v4.91.5) (2026-07-02)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* revoke WaaS signed-session callback on client rebuild to stop iOS nonce race ([#11766](https://github.com/dynamic-labs/dynamic-auth/issues/11766)) ([c895b5d](https://github.com/dynamic-labs/dynamic-auth/commit/c895b5d0987d62a9f5597741dbeae0ec7fedfe5b))
|
|
8
|
+
* **sdk-react-core:** allow sendOneTimeCode to target non-primary chain wallets ([#11777](https://github.com/dynamic-labs/dynamic-auth/issues/11777)) ([63f82af](https://github.com/dynamic-labs/dynamic-auth/commit/63f82af7c52be595bc2948ec88ee9c919ac9275a))
|
|
9
|
+
* **webview-controller:** resolve post-login wallet race in Viem and ZeroDev controllers ([#11774](https://github.com/dynamic-labs/dynamic-auth/issues/11774)) ([95ed26e](https://github.com/dynamic-labs/dynamic-auth/commit/95ed26eee09d9aff5a5af6517ab7e1360ef5f337))
|
|
10
|
+
|
|
11
|
+
### [4.91.4](https://github.com/dynamic-labs/dynamic-auth/compare/v4.91.3...v4.91.4) (2026-07-01)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* conditionally use /op/ route for AA transactions based on block explorer support ([#11628](https://github.com/dynamic-labs/dynamic-auth/issues/11628)) ([95822dc](https://github.com/dynamic-labs/dynamic-auth/commit/95822dc0edbcd739afe870f0b3881555fdb17eb6))
|
|
17
|
+
* require error codes in all SDK error classes ([#11761](https://github.com/dynamic-labs/dynamic-auth/issues/11761)) ([5744811](https://github.com/dynamic-labs/dynamic-auth/commit/5744811efdd1e415aaf51eec5b3300b323ec1347))
|
|
18
|
+
|
|
2
19
|
### [4.91.3](https://github.com/dynamic-labs/dynamic-auth/compare/v4.91.2...v4.91.3) (2026-06-30)
|
|
3
20
|
|
|
4
21
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/utils",
|
|
3
|
-
"version": "4.91.
|
|
3
|
+
"version": "4.91.5",
|
|
4
4
|
"description": "A React SDK for implementing wallet web3 authentication and authorization to your website.",
|
|
5
5
|
"author": "Dynamic Labs, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@dynamic-labs/sdk-api-core": "0.0.1046",
|
|
22
22
|
"tldts": "6.0.16",
|
|
23
|
-
"@dynamic-labs/assert-package-version": "4.91.
|
|
24
|
-
"@dynamic-labs/logger": "4.91.
|
|
25
|
-
"@dynamic-labs/types": "4.91.
|
|
23
|
+
"@dynamic-labs/assert-package-version": "4.91.5",
|
|
24
|
+
"@dynamic-labs/logger": "4.91.5",
|
|
25
|
+
"@dynamic-labs/types": "4.91.5",
|
|
26
26
|
"buffer": "6.0.3",
|
|
27
27
|
"eventemitter3": "5.0.1"
|
|
28
28
|
},
|
|
@@ -6,6 +6,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var DynamicError = require('./DynamicError.cjs');
|
|
7
7
|
|
|
8
8
|
class AccessBlockedError extends DynamicError.DynamicError {
|
|
9
|
+
constructor(message = 'Access blocked', code = 'access_blocked') {
|
|
10
|
+
super(message, code);
|
|
11
|
+
}
|
|
9
12
|
}
|
|
10
13
|
|
|
11
14
|
exports.AccessBlockedError = AccessBlockedError;
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var DynamicError = require('./DynamicError.cjs');
|
|
7
7
|
|
|
8
8
|
class AccountExistsError extends DynamicError.DynamicError {
|
|
9
|
-
constructor(errorMessage, errorPayload) {
|
|
10
|
-
super(errorMessage);
|
|
9
|
+
constructor(errorMessage, errorPayload, code = 'account_exists') {
|
|
10
|
+
super(errorMessage, code);
|
|
11
11
|
this.errorMessage = errorMessage;
|
|
12
12
|
this.errorPayload = errorPayload;
|
|
13
13
|
}
|
|
@@ -9,6 +9,6 @@ type AccountExistsPayload = {
|
|
|
9
9
|
export declare class AccountExistsError extends DynamicError {
|
|
10
10
|
errorMessage: string;
|
|
11
11
|
errorPayload: AccountExistsPayload;
|
|
12
|
-
constructor(errorMessage: string, errorPayload: AccountExistsPayload);
|
|
12
|
+
constructor(errorMessage: string, errorPayload: AccountExistsPayload, code?: string);
|
|
13
13
|
}
|
|
14
14
|
export {};
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { DynamicError } from './DynamicError.js';
|
|
3
3
|
|
|
4
4
|
class AccountExistsError extends DynamicError {
|
|
5
|
-
constructor(errorMessage, errorPayload) {
|
|
6
|
-
super(errorMessage);
|
|
5
|
+
constructor(errorMessage, errorPayload, code = 'account_exists') {
|
|
6
|
+
super(errorMessage, code);
|
|
7
7
|
this.errorMessage = errorMessage;
|
|
8
8
|
this.errorPayload = errorPayload;
|
|
9
9
|
}
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var DynamicError = require('./DynamicError.cjs');
|
|
7
7
|
|
|
8
8
|
class ChainalysisError extends DynamicError.DynamicError {
|
|
9
|
-
constructor(walletPublicKey) {
|
|
10
|
-
super('This address is not approved for access');
|
|
9
|
+
constructor(walletPublicKey, code = 'chainalysis_blocked') {
|
|
10
|
+
super('This address is not approved for access', code);
|
|
11
11
|
this.walletPublicKey = walletPublicKey;
|
|
12
12
|
}
|
|
13
13
|
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { DynamicError } from './DynamicError.js';
|
|
3
3
|
|
|
4
4
|
class ChainalysisError extends DynamicError {
|
|
5
|
-
constructor(walletPublicKey) {
|
|
6
|
-
super('This address is not approved for access');
|
|
5
|
+
constructor(walletPublicKey, code = 'chainalysis_blocked') {
|
|
6
|
+
super('This address is not approved for access', code);
|
|
7
7
|
this.walletPublicKey = walletPublicKey;
|
|
8
8
|
}
|
|
9
9
|
}
|
|
@@ -4,12 +4,14 @@
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* Extend this class to allow usage of instanceof
|
|
7
|
+
* Extend this class to allow usage of instanceof.
|
|
8
|
+
*
|
|
9
|
+
* Every error must carry a machine-readable `code` so callers can branch on
|
|
10
|
+
* it without parsing human-readable messages.
|
|
8
11
|
*/
|
|
9
12
|
class CustomError extends Error {
|
|
10
13
|
constructor(message, code) {
|
|
11
14
|
super(message);
|
|
12
|
-
this.code = undefined;
|
|
13
15
|
this.code = code;
|
|
14
16
|
Object.setPrototypeOf(this, this.constructor.prototype);
|
|
15
17
|
}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { ErrorCode } from './ErrorCode';
|
|
2
2
|
/**
|
|
3
|
-
* Extend this class to allow usage of instanceof
|
|
3
|
+
* Extend this class to allow usage of instanceof.
|
|
4
|
+
*
|
|
5
|
+
* Every error must carry a machine-readable `code` so callers can branch on
|
|
6
|
+
* it without parsing human-readable messages.
|
|
4
7
|
*/
|
|
5
8
|
export declare class CustomError extends Error {
|
|
6
|
-
code: ErrorCode | string
|
|
7
|
-
constructor(message
|
|
9
|
+
code: ErrorCode | string;
|
|
10
|
+
constructor(message: string, code: ErrorCode | string);
|
|
8
11
|
toJSON(): {
|
|
9
|
-
code: string | ErrorCode
|
|
12
|
+
code: string | ErrorCode;
|
|
10
13
|
error: string;
|
|
11
14
|
};
|
|
12
15
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
/**
|
|
3
|
-
* Extend this class to allow usage of instanceof
|
|
3
|
+
* Extend this class to allow usage of instanceof.
|
|
4
|
+
*
|
|
5
|
+
* Every error must carry a machine-readable `code` so callers can branch on
|
|
6
|
+
* it without parsing human-readable messages.
|
|
4
7
|
*/
|
|
5
8
|
class CustomError extends Error {
|
|
6
9
|
constructor(message, code) {
|
|
7
10
|
super(message);
|
|
8
|
-
this.code = undefined;
|
|
9
11
|
this.code = code;
|
|
10
12
|
Object.setPrototypeOf(this, this.constructor.prototype);
|
|
11
13
|
}
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var DynamicError = require('./DynamicError.cjs');
|
|
7
7
|
|
|
8
8
|
class EmailAlreadyExistsError extends DynamicError.DynamicError {
|
|
9
|
-
constructor() {
|
|
10
|
-
super(
|
|
9
|
+
constructor(message = 'Email already exists', code = 'email_already_exists') {
|
|
10
|
+
super(message, code);
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { DynamicError } from './DynamicError.js';
|
|
3
3
|
|
|
4
4
|
class EmailAlreadyExistsError extends DynamicError {
|
|
5
|
-
constructor() {
|
|
6
|
-
super(
|
|
5
|
+
constructor(message = 'Email already exists', code = 'email_already_exists') {
|
|
6
|
+
super(message, code);
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var DynamicError = require('./DynamicError.cjs');
|
|
7
7
|
|
|
8
8
|
class EmbeddedWalletException extends DynamicError.DynamicError {
|
|
9
|
-
constructor(message) {
|
|
10
|
-
super(message);
|
|
9
|
+
constructor(message, code = 'embedded_wallet_error') {
|
|
10
|
+
super(message, code);
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -7,7 +7,7 @@ var DynamicError = require('./DynamicError.cjs');
|
|
|
7
7
|
|
|
8
8
|
class GateBlockedError extends DynamicError.DynamicError {
|
|
9
9
|
constructor(walletPublicKey) {
|
|
10
|
-
super('This address is blocked by the gate');
|
|
10
|
+
super('This address is blocked by the gate', 'gate_blocked');
|
|
11
11
|
this.walletPublicKey = walletPublicKey;
|
|
12
12
|
}
|
|
13
13
|
}
|
|
@@ -3,7 +3,7 @@ import { DynamicError } from './DynamicError.js';
|
|
|
3
3
|
|
|
4
4
|
class GateBlockedError extends DynamicError {
|
|
5
5
|
constructor(walletPublicKey) {
|
|
6
|
-
super('This address is blocked by the gate');
|
|
6
|
+
super('This address is blocked by the gate', 'gate_blocked');
|
|
7
7
|
this.walletPublicKey = walletPublicKey;
|
|
8
8
|
}
|
|
9
9
|
}
|
|
@@ -15,7 +15,7 @@ var CustomError = require('./CustomError.cjs');
|
|
|
15
15
|
*/
|
|
16
16
|
class GetAddressCancelledError extends CustomError.CustomError {
|
|
17
17
|
constructor() {
|
|
18
|
-
super('Get address call was cancelled');
|
|
18
|
+
super('Get address call was cancelled', 'get_address_cancelled');
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
|
|
@@ -7,7 +7,7 @@ var DynamicError = require('./DynamicError.cjs');
|
|
|
7
7
|
|
|
8
8
|
class InsufficientFundsError extends DynamicError.DynamicError {
|
|
9
9
|
constructor() {
|
|
10
|
-
super(InsufficientFundsError.message);
|
|
10
|
+
super(InsufficientFundsError.message, 'insufficient_funds');
|
|
11
11
|
}
|
|
12
12
|
static isInstance(err) {
|
|
13
13
|
var _a;
|
|
@@ -3,7 +3,7 @@ import { DynamicError } from './DynamicError.js';
|
|
|
3
3
|
|
|
4
4
|
class InsufficientFundsError extends DynamicError {
|
|
5
5
|
constructor() {
|
|
6
|
-
super(InsufficientFundsError.message);
|
|
6
|
+
super(InsufficientFundsError.message, 'insufficient_funds');
|
|
7
7
|
}
|
|
8
8
|
static isInstance(err) {
|
|
9
9
|
var _a;
|
|
@@ -7,7 +7,7 @@ var DynamicError = require('./DynamicError.cjs');
|
|
|
7
7
|
|
|
8
8
|
class InvalidEmbeddedWalletSessionKeyError extends DynamicError.DynamicError {
|
|
9
9
|
constructor(error) {
|
|
10
|
-
super(error !== null && error !== void 0 ? error : 'Invalid embedded wallet session key.');
|
|
10
|
+
super(error !== null && error !== void 0 ? error : 'Invalid embedded wallet session key.', 'invalid_embedded_wallet_session_key');
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -3,7 +3,7 @@ import { DynamicError } from './DynamicError.js';
|
|
|
3
3
|
|
|
4
4
|
class InvalidEmbeddedWalletSessionKeyError extends DynamicError {
|
|
5
5
|
constructor(error) {
|
|
6
|
-
super(error !== null && error !== void 0 ? error : 'Invalid embedded wallet session key.');
|
|
6
|
+
super(error !== null && error !== void 0 ? error : 'Invalid embedded wallet session key.', 'invalid_embedded_wallet_session_key');
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var DynamicError = require('./DynamicError.cjs');
|
|
7
7
|
|
|
8
8
|
class InvalidPhoneNumberError extends DynamicError.DynamicError {
|
|
9
|
-
constructor(error) {
|
|
10
|
-
super(error !== null && error !== void 0 ? error : 'Invalid phone number.');
|
|
9
|
+
constructor(error, code = 'invalid_phone') {
|
|
10
|
+
super(error !== null && error !== void 0 ? error : 'Invalid phone number.', code);
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { DynamicError } from './DynamicError.js';
|
|
3
3
|
|
|
4
4
|
class InvalidPhoneNumberError extends DynamicError {
|
|
5
|
-
constructor(error) {
|
|
6
|
-
super(error !== null && error !== void 0 ? error : 'Invalid phone number.');
|
|
5
|
+
constructor(error, code = 'invalid_phone') {
|
|
6
|
+
super(error !== null && error !== void 0 ? error : 'Invalid phone number.', code);
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var DynamicError = require('./DynamicError.cjs');
|
|
7
7
|
|
|
8
8
|
class InvalidPrimaryWalletOrConnectorError extends DynamicError.DynamicError {
|
|
9
|
-
constructor(code) {
|
|
9
|
+
constructor(code = 'invalid_primary_wallet_or_connector') {
|
|
10
10
|
super('Primary wallet is not properly set or the wallet connector is missing from DynamicContextProvider settings.', code);
|
|
11
11
|
}
|
|
12
12
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { DynamicError } from './DynamicError.js';
|
|
3
3
|
|
|
4
4
|
class InvalidPrimaryWalletOrConnectorError extends DynamicError {
|
|
5
|
-
constructor(code) {
|
|
5
|
+
constructor(code = 'invalid_primary_wallet_or_connector') {
|
|
6
6
|
super('Primary wallet is not properly set or the wallet connector is missing from DynamicContextProvider settings.', code);
|
|
7
7
|
}
|
|
8
8
|
}
|
|
@@ -21,11 +21,11 @@ class MetaMaskError extends CustomError.CustomError {
|
|
|
21
21
|
* @returns A new [MetaMaskError]
|
|
22
22
|
*/
|
|
23
23
|
static fromError(error) {
|
|
24
|
-
var _a, _b;
|
|
24
|
+
var _a, _b, _c;
|
|
25
25
|
if (error instanceof Object) {
|
|
26
26
|
const errorObject = error;
|
|
27
27
|
const dynamicErrorCode = (_b = metaMaskErrorMap[(_a = errorObject.code) !== null && _a !== void 0 ? _a : '']) !== null && _b !== void 0 ? _b : ErrorCode.ErrorCode.DEFAULT;
|
|
28
|
-
return new MetaMaskError(errorObject.message, dynamicErrorCode);
|
|
28
|
+
return new MetaMaskError((_c = errorObject.message) !== null && _c !== void 0 ? _c : 'MetaMask error', dynamicErrorCode);
|
|
29
29
|
}
|
|
30
30
|
return new MetaMaskError(String(error), ErrorCode.ErrorCode.DEFAULT);
|
|
31
31
|
}
|
|
@@ -3,7 +3,7 @@ import { ErrorCode } from './ErrorCode';
|
|
|
3
3
|
/** Mapping of metamask error codes to dynamic [ErrorCode]s */
|
|
4
4
|
export declare const metaMaskErrorMap: Record<string, ErrorCode>;
|
|
5
5
|
export declare class MetaMaskError extends CustomError {
|
|
6
|
-
constructor(message
|
|
6
|
+
constructor(message: string, code: ErrorCode);
|
|
7
7
|
/**
|
|
8
8
|
* Creates a [MetaMaskError] from an unknown error (thrown by MetaMask)
|
|
9
9
|
*
|
|
@@ -17,11 +17,11 @@ class MetaMaskError extends CustomError {
|
|
|
17
17
|
* @returns A new [MetaMaskError]
|
|
18
18
|
*/
|
|
19
19
|
static fromError(error) {
|
|
20
|
-
var _a, _b;
|
|
20
|
+
var _a, _b, _c;
|
|
21
21
|
if (error instanceof Object) {
|
|
22
22
|
const errorObject = error;
|
|
23
23
|
const dynamicErrorCode = (_b = metaMaskErrorMap[(_a = errorObject.code) !== null && _a !== void 0 ? _a : '']) !== null && _b !== void 0 ? _b : ErrorCode.DEFAULT;
|
|
24
|
-
return new MetaMaskError(errorObject.message, dynamicErrorCode);
|
|
24
|
+
return new MetaMaskError((_c = errorObject.message) !== null && _c !== void 0 ? _c : 'MetaMask error', dynamicErrorCode);
|
|
25
25
|
}
|
|
26
26
|
return new MetaMaskError(String(error), ErrorCode.DEFAULT);
|
|
27
27
|
}
|
|
@@ -7,7 +7,7 @@ var DynamicError = require('./DynamicError.cjs');
|
|
|
7
7
|
|
|
8
8
|
class MissingEnvironmentIdError extends DynamicError.DynamicError {
|
|
9
9
|
constructor() {
|
|
10
|
-
super('You are missing the environmentId field in yours DynamicContextProvider settings prop');
|
|
10
|
+
super('You are missing the environmentId field in yours DynamicContextProvider settings prop', 'missing_environment_id');
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -3,7 +3,7 @@ import { DynamicError } from './DynamicError.js';
|
|
|
3
3
|
|
|
4
4
|
class MissingEnvironmentIdError extends DynamicError {
|
|
5
5
|
constructor() {
|
|
6
|
-
super('You are missing the environmentId field in yours DynamicContextProvider settings prop');
|
|
6
|
+
super('You are missing the environmentId field in yours DynamicContextProvider settings prop', 'missing_environment_id');
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var DynamicError = require('./DynamicError.cjs');
|
|
7
7
|
|
|
8
8
|
class NoAccessError extends DynamicError.DynamicError {
|
|
9
|
-
constructor({ walletPublicKey, email, phoneNumber, socialProvider, socialUsername, }) {
|
|
10
|
-
super('User does not have access');
|
|
9
|
+
constructor({ walletPublicKey, email, phoneNumber, socialProvider, socialUsername, code = 'no_access', }) {
|
|
10
|
+
super('User does not have access', code);
|
|
11
11
|
this.email = email;
|
|
12
12
|
this.walletPublicKey = walletPublicKey;
|
|
13
13
|
this.phoneNumber = phoneNumber;
|
|
@@ -5,11 +5,12 @@ export declare class NoAccessError extends DynamicError {
|
|
|
5
5
|
phoneNumber?: string;
|
|
6
6
|
socialProvider?: string;
|
|
7
7
|
socialUsername?: string;
|
|
8
|
-
constructor({ walletPublicKey, email, phoneNumber, socialProvider, socialUsername, }: {
|
|
8
|
+
constructor({ walletPublicKey, email, phoneNumber, socialProvider, socialUsername, code, }: {
|
|
9
9
|
email?: string;
|
|
10
10
|
walletPublicKey?: string;
|
|
11
11
|
phoneNumber?: string;
|
|
12
12
|
socialProvider?: string;
|
|
13
13
|
socialUsername?: string;
|
|
14
|
+
code?: string;
|
|
14
15
|
});
|
|
15
16
|
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { DynamicError } from './DynamicError.js';
|
|
3
3
|
|
|
4
4
|
class NoAccessError extends DynamicError {
|
|
5
|
-
constructor({ walletPublicKey, email, phoneNumber, socialProvider, socialUsername, }) {
|
|
6
|
-
super('User does not have access');
|
|
5
|
+
constructor({ walletPublicKey, email, phoneNumber, socialProvider, socialUsername, code = 'no_access', }) {
|
|
6
|
+
super('User does not have access', code);
|
|
7
7
|
this.email = email;
|
|
8
8
|
this.walletPublicKey = walletPublicKey;
|
|
9
9
|
this.phoneNumber = phoneNumber;
|
|
@@ -6,6 +6,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var DynamicError = require('./DynamicError.cjs');
|
|
7
7
|
|
|
8
8
|
class NotSupportedError extends DynamicError.DynamicError {
|
|
9
|
+
constructor(message = 'Not supported', code = 'not_supported') {
|
|
10
|
+
super(message, code);
|
|
11
|
+
}
|
|
9
12
|
}
|
|
10
13
|
|
|
11
14
|
exports.NotSupportedError = NotSupportedError;
|
|
@@ -6,6 +6,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var DynamicError = require('./DynamicError.cjs');
|
|
7
7
|
|
|
8
8
|
class RequestChannelNotHandledError extends DynamicError.DynamicError {
|
|
9
|
+
constructor(message = 'Request channel not handled', code = 'request_channel_not_handled') {
|
|
10
|
+
super(message, code);
|
|
11
|
+
}
|
|
9
12
|
}
|
|
10
13
|
|
|
11
14
|
exports.RequestChannelNotHandledError = RequestChannelNotHandledError;
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
import { DynamicError } from './DynamicError.js';
|
|
3
3
|
|
|
4
4
|
class RequestChannelNotHandledError extends DynamicError {
|
|
5
|
+
constructor(message = 'Request channel not handled', code = 'request_channel_not_handled') {
|
|
6
|
+
super(message, code);
|
|
7
|
+
}
|
|
5
8
|
}
|
|
6
9
|
|
|
7
10
|
export { RequestChannelNotHandledError };
|
|
@@ -18,7 +18,13 @@ class ResponseError extends CustomError.CustomError {
|
|
|
18
18
|
|
|
19
19
|
Json data:${jsonData ? '\n' + JSON.stringify(jsonData, null, 2) : ' No data'}
|
|
20
20
|
`.trim();
|
|
21
|
-
|
|
21
|
+
const jsonCode = jsonData &&
|
|
22
|
+
typeof jsonData === 'object' &&
|
|
23
|
+
'code' in jsonData &&
|
|
24
|
+
typeof jsonData['code'] === 'string'
|
|
25
|
+
? jsonData['code']
|
|
26
|
+
: undefined;
|
|
27
|
+
super(messageError, jsonCode !== null && jsonCode !== void 0 ? jsonCode : `http_${cause.status}`);
|
|
22
28
|
this.jsonData = jsonData;
|
|
23
29
|
this.response = cause;
|
|
24
30
|
this.cause = cause;
|
|
@@ -14,7 +14,13 @@ class ResponseError extends CustomError {
|
|
|
14
14
|
|
|
15
15
|
Json data:${jsonData ? '\n' + JSON.stringify(jsonData, null, 2) : ' No data'}
|
|
16
16
|
`.trim();
|
|
17
|
-
|
|
17
|
+
const jsonCode = jsonData &&
|
|
18
|
+
typeof jsonData === 'object' &&
|
|
19
|
+
'code' in jsonData &&
|
|
20
|
+
typeof jsonData['code'] === 'string'
|
|
21
|
+
? jsonData['code']
|
|
22
|
+
: undefined;
|
|
23
|
+
super(messageError, jsonCode !== null && jsonCode !== void 0 ? jsonCode : `http_${cause.status}`);
|
|
18
24
|
this.jsonData = jsonData;
|
|
19
25
|
this.response = cause;
|
|
20
26
|
this.cause = cause;
|
|
@@ -7,7 +7,7 @@ var DynamicError = require('./DynamicError.cjs');
|
|
|
7
7
|
|
|
8
8
|
class SandboxMaximumThresholdReachedError extends DynamicError.DynamicError {
|
|
9
9
|
constructor(errorMessage) {
|
|
10
|
-
super(errorMessage);
|
|
10
|
+
super(errorMessage, 'sandbox_maximum_threshold_reached');
|
|
11
11
|
this.errorMessage = errorMessage;
|
|
12
12
|
}
|
|
13
13
|
}
|
|
@@ -3,7 +3,7 @@ import { DynamicError } from './DynamicError.js';
|
|
|
3
3
|
|
|
4
4
|
class SandboxMaximumThresholdReachedError extends DynamicError {
|
|
5
5
|
constructor(errorMessage) {
|
|
6
|
-
super(errorMessage);
|
|
6
|
+
super(errorMessage, 'sandbox_maximum_threshold_reached');
|
|
7
7
|
this.errorMessage = errorMessage;
|
|
8
8
|
}
|
|
9
9
|
}
|
|
@@ -6,6 +6,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var DynamicError = require('./DynamicError.cjs');
|
|
7
7
|
|
|
8
8
|
class SmsVerificationError extends DynamicError.DynamicError {
|
|
9
|
+
constructor(message, code) {
|
|
10
|
+
super(message, code);
|
|
11
|
+
}
|
|
9
12
|
}
|
|
10
13
|
|
|
11
14
|
exports.SmsVerificationError = SmsVerificationError;
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var DynamicError = require('./DynamicError.cjs');
|
|
7
7
|
|
|
8
8
|
class SocialAccountAlreadyExistsError extends DynamicError.DynamicError {
|
|
9
|
-
constructor() {
|
|
10
|
-
super(
|
|
9
|
+
constructor(message = 'Social account already exists', code = 'social_account_already_exists') {
|
|
10
|
+
super(message, code);
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { DynamicError } from './DynamicError.js';
|
|
3
3
|
|
|
4
4
|
class SocialAccountAlreadyExistsError extends DynamicError {
|
|
5
|
-
constructor() {
|
|
6
|
-
super(
|
|
5
|
+
constructor(message = 'Social account already exists', code = 'social_account_already_exists') {
|
|
6
|
+
super(message, code);
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var DynamicError = require('./DynamicError.cjs');
|
|
7
7
|
|
|
8
8
|
class TooManyEmailVerificationsError extends DynamicError.DynamicError {
|
|
9
|
-
constructor() {
|
|
10
|
-
super(
|
|
9
|
+
constructor(message = 'Too many email verification attempts.', code = 'too_many_verification_attempts') {
|
|
10
|
+
super(message, code);
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { DynamicError } from './DynamicError.js';
|
|
3
3
|
|
|
4
4
|
class TooManyEmailVerificationsError extends DynamicError {
|
|
5
|
-
constructor() {
|
|
6
|
-
super(
|
|
5
|
+
constructor(message = 'Too many email verification attempts.', code = 'too_many_verification_attempts') {
|
|
6
|
+
super(message, code);
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
|
|
@@ -7,7 +7,7 @@ var DynamicError = require('./DynamicError.cjs');
|
|
|
7
7
|
|
|
8
8
|
class TransactionConfirmationTimeoutError extends DynamicError.DynamicError {
|
|
9
9
|
constructor(transactionSignature) {
|
|
10
|
-
super(`Transaction confirmation timed out. Signature: ${transactionSignature}
|
|
10
|
+
super(`Transaction confirmation timed out. Signature: ${transactionSignature}`, 'transaction_confirmation_timeout');
|
|
11
11
|
this.transactionSignature = transactionSignature;
|
|
12
12
|
}
|
|
13
13
|
}
|
|
@@ -3,7 +3,7 @@ import { DynamicError } from './DynamicError.js';
|
|
|
3
3
|
|
|
4
4
|
class TransactionConfirmationTimeoutError extends DynamicError {
|
|
5
5
|
constructor(transactionSignature) {
|
|
6
|
-
super(`Transaction confirmation timed out. Signature: ${transactionSignature}
|
|
6
|
+
super(`Transaction confirmation timed out. Signature: ${transactionSignature}`, 'transaction_confirmation_timeout');
|
|
7
7
|
this.transactionSignature = transactionSignature;
|
|
8
8
|
}
|
|
9
9
|
}
|
|
@@ -7,7 +7,7 @@ var DynamicError = require('./DynamicError.cjs');
|
|
|
7
7
|
|
|
8
8
|
class TransactionFailedError extends DynamicError.DynamicError {
|
|
9
9
|
constructor(chainError) {
|
|
10
|
-
super(`Transaction failed: ${JSON.stringify(chainError)}
|
|
10
|
+
super(`Transaction failed: ${JSON.stringify(chainError)}`, 'transaction_failed');
|
|
11
11
|
this.chainError = chainError;
|
|
12
12
|
}
|
|
13
13
|
}
|
|
@@ -3,7 +3,7 @@ import { DynamicError } from './DynamicError.js';
|
|
|
3
3
|
|
|
4
4
|
class TransactionFailedError extends DynamicError {
|
|
5
5
|
constructor(chainError) {
|
|
6
|
-
super(`Transaction failed: ${JSON.stringify(chainError)}
|
|
6
|
+
super(`Transaction failed: ${JSON.stringify(chainError)}`, 'transaction_failed');
|
|
7
7
|
this.chainError = chainError;
|
|
8
8
|
}
|
|
9
9
|
}
|
|
@@ -7,7 +7,7 @@ var DynamicError = require('./DynamicError.cjs');
|
|
|
7
7
|
|
|
8
8
|
class TransactionGasCannotBeSponsoredError extends DynamicError.DynamicError {
|
|
9
9
|
constructor() {
|
|
10
|
-
super(TransactionGasCannotBeSponsoredError.message);
|
|
10
|
+
super(TransactionGasCannotBeSponsoredError.message, 'transaction_gas_cannot_be_sponsored');
|
|
11
11
|
}
|
|
12
12
|
static isInstance(err) {
|
|
13
13
|
var _a;
|
|
@@ -3,7 +3,7 @@ import { DynamicError } from './DynamicError.js';
|
|
|
3
3
|
|
|
4
4
|
class TransactionGasCannotBeSponsoredError extends DynamicError {
|
|
5
5
|
constructor() {
|
|
6
|
-
super(TransactionGasCannotBeSponsoredError.message);
|
|
6
|
+
super(TransactionGasCannotBeSponsoredError.message, 'transaction_gas_cannot_be_sponsored');
|
|
7
7
|
}
|
|
8
8
|
static isInstance(err) {
|
|
9
9
|
var _a;
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var DynamicError = require('./DynamicError.cjs');
|
|
7
7
|
|
|
8
8
|
class UserHasAccountWithEmailError extends DynamicError.DynamicError {
|
|
9
|
-
constructor(error) {
|
|
10
|
-
super(error);
|
|
9
|
+
constructor(error, code = 'user_has_account_with_email') {
|
|
10
|
+
super(error, code);
|
|
11
11
|
this.error = error;
|
|
12
12
|
}
|
|
13
13
|
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { DynamicError } from './DynamicError.js';
|
|
3
3
|
|
|
4
4
|
class UserHasAccountWithEmailError extends DynamicError {
|
|
5
|
-
constructor(error) {
|
|
6
|
-
super(error);
|
|
5
|
+
constructor(error, code = 'user_has_account_with_email') {
|
|
6
|
+
super(error, code);
|
|
7
7
|
this.error = error;
|
|
8
8
|
}
|
|
9
9
|
}
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var DynamicError = require('./DynamicError.cjs');
|
|
7
7
|
|
|
8
8
|
class UsernameAlreadyExistsError extends DynamicError.DynamicError {
|
|
9
|
-
constructor() {
|
|
10
|
-
super(
|
|
9
|
+
constructor(message = 'Username already exists', code = 'username_already_exists') {
|
|
10
|
+
super(message, code);
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { DynamicError } from './DynamicError.js';
|
|
3
3
|
|
|
4
4
|
class UsernameAlreadyExistsError extends DynamicError {
|
|
5
|
-
constructor() {
|
|
6
|
-
super(
|
|
5
|
+
constructor(message = 'Username already exists', code = 'username_already_exists') {
|
|
6
|
+
super(message, code);
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
|
|
@@ -8,7 +8,7 @@ var DynamicError = require('./DynamicError.cjs');
|
|
|
8
8
|
/** Used when trying to get necessary data for verification OTPs */
|
|
9
9
|
class VerificationDataCollectionError extends DynamicError.DynamicError {
|
|
10
10
|
constructor(message) {
|
|
11
|
-
super('Failed to get verification data: ' + message);
|
|
11
|
+
super('Failed to get verification data: ' + message, 'verification_data_collection_error');
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
|
|
@@ -4,7 +4,7 @@ import { DynamicError } from './DynamicError.js';
|
|
|
4
4
|
/** Used when trying to get necessary data for verification OTPs */
|
|
5
5
|
class VerificationDataCollectionError extends DynamicError {
|
|
6
6
|
constructor(message) {
|
|
7
|
-
super('Failed to get verification data: ' + message);
|
|
7
|
+
super('Failed to get verification data: ' + message, 'verification_data_collection_error');
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
|