@web3auth/base
Advanced tools
Comparing version 5.0.0-alpha.0 to 5.0.1-alpha.0
@@ -69,2 +69,3 @@ /******/ (() => { // webpackBootstrap | ||
"WalletLoginError": () => (/* reexport */ WalletLoginError), | ||
"WalletOperationsError": () => (/* reexport */ WalletOperationsError), | ||
"Web3AuthError": () => (/* reexport */ Web3AuthError), | ||
@@ -456,2 +457,32 @@ "authServer": () => (/* reexport */ authServer), | ||
}); | ||
class WalletOperationsError extends Web3AuthError { | ||
constructor(code, message) { | ||
// takes care of stack and proto | ||
super(code, message); | ||
// Set name explicitly as minification can mangle class names | ||
Object.defineProperty(this, "name", { | ||
value: "WalletOperationsError" | ||
}); | ||
} | ||
static fromCode(code) { | ||
let extraMessage = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ""; | ||
return new WalletOperationsError(code, `${WalletOperationsError.messages[code]}, ${extraMessage}`); | ||
} | ||
// Custom methods | ||
static chainIDNotAllowed() { | ||
let extraMessage = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ""; | ||
return WalletOperationsError.fromCode(5201, extraMessage); | ||
} | ||
static operationNotAllowed() { | ||
let extraMessage = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ""; | ||
return WalletOperationsError.fromCode(5202, extraMessage); | ||
} | ||
} | ||
defineProperty_default()(WalletOperationsError, "messages", { | ||
5000: "Custom", | ||
5201: "Provided chainId is not allowed", | ||
5202: "This operation is not allowed" | ||
}); | ||
;// CONCATENATED MODULE: ./src/wallet/index.ts | ||
@@ -567,3 +598,3 @@ | ||
// we reconnect without killing existing wallet connect session on calling connect again. | ||
if (this.name === WALLET_ADAPTERS.WALLET_CONNECT_V1 && this.status === ADAPTER_STATUS.CONNECTING) return;else if (this.status === ADAPTER_STATUS.CONNECTING) throw WalletInitializationError.notReady("Already connecting"); | ||
if ((this.name === WALLET_ADAPTERS.WALLET_CONNECT_V1 || this.name === WALLET_ADAPTERS.WALLET_CONNECT_V2) && this.status === ADAPTER_STATUS.CONNECTING) return;else if (this.status === ADAPTER_STATUS.CONNECTING) throw WalletInitializationError.notReady("Already connecting"); | ||
if (this.status === ADAPTER_STATUS.CONNECTED) throw WalletLoginError.connectionError("Already connected"); | ||
@@ -570,0 +601,0 @@ if (this.status !== ADAPTER_STATUS.READY) throw WalletLoginError.connectionError("Wallet adapter is not ready yet, Please wait for init function to resolve before calling connect/connectTo function"); |
@@ -356,2 +356,30 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty'; | ||
}); | ||
class WalletOperationsError extends Web3AuthError { | ||
constructor(code, message) { | ||
// takes care of stack and proto | ||
super(code, message); | ||
// Set name explicitly as minification can mangle class names | ||
Object.defineProperty(this, "name", { | ||
value: "WalletOperationsError" | ||
}); | ||
} | ||
static fromCode(code) { | ||
let extraMessage = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ""; | ||
return new WalletOperationsError(code, `${WalletOperationsError.messages[code]}, ${extraMessage}`); | ||
} | ||
// Custom methods | ||
static chainIDNotAllowed() { | ||
let extraMessage = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ""; | ||
return WalletOperationsError.fromCode(5201, extraMessage); | ||
} | ||
static operationNotAllowed() { | ||
let extraMessage = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ""; | ||
return WalletOperationsError.fromCode(5202, extraMessage); | ||
} | ||
} | ||
_defineProperty(WalletOperationsError, "messages", { | ||
5000: "Custom", | ||
5201: "Provided chainId is not allowed", | ||
5202: "This operation is not allowed" | ||
}); | ||
@@ -454,3 +482,3 @@ function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } | ||
// we reconnect without killing existing wallet connect session on calling connect again. | ||
if (this.name === WALLET_ADAPTERS.WALLET_CONNECT_V1 && this.status === ADAPTER_STATUS.CONNECTING) return;else if (this.status === ADAPTER_STATUS.CONNECTING) throw WalletInitializationError.notReady("Already connecting"); | ||
if ((this.name === WALLET_ADAPTERS.WALLET_CONNECT_V1 || this.name === WALLET_ADAPTERS.WALLET_CONNECT_V2) && this.status === ADAPTER_STATUS.CONNECTING) return;else if (this.status === ADAPTER_STATUS.CONNECTING) throw WalletInitializationError.notReady("Already connecting"); | ||
if (this.status === ADAPTER_STATUS.CONNECTED) throw WalletLoginError.connectionError("Already connected"); | ||
@@ -616,3 +644,3 @@ if (this.status !== ADAPTER_STATUS.READY) throw WalletLoginError.connectionError("Wallet adapter is not ready yet, Please wait for init function to resolve before calling connect/connectTo function"); | ||
export { ADAPTER_CATEGORY, ADAPTER_EVENTS, ADAPTER_NAMES, ADAPTER_NAMESPACES, ADAPTER_STATUS, BaseAdapter, BaseNetworkSwitch, CHAIN_NAMESPACES, EVM_ADAPTERS, MULTI_CHAIN_ADAPTERS, PROVIDER_EVENTS, SOLANA_ADAPTERS, WALLET_ADAPTERS, WalletInitializationError, WalletLoginError, Web3AuthError, authServer, checkIfTokenIsExpired, clearToken, getChainConfig, getEvmChainConfig, getSavedToken, getSolanaChainConfig, isHexStrict, log, saveToken, signChallenge, storageAvailable, verifySignedChallenge }; | ||
export { ADAPTER_CATEGORY, ADAPTER_EVENTS, ADAPTER_NAMES, ADAPTER_NAMESPACES, ADAPTER_STATUS, BaseAdapter, BaseNetworkSwitch, CHAIN_NAMESPACES, EVM_ADAPTERS, MULTI_CHAIN_ADAPTERS, PROVIDER_EVENTS, SOLANA_ADAPTERS, WALLET_ADAPTERS, WalletInitializationError, WalletLoginError, WalletOperationsError, Web3AuthError, authServer, checkIfTokenIsExpired, clearToken, getChainConfig, getEvmChainConfig, getSavedToken, getSolanaChainConfig, isHexStrict, log, saveToken, signChallenge, storageAvailable, verifySignedChallenge }; | ||
//# sourceMappingURL=base.esm.js.map |
@@ -173,2 +173,3 @@ import { OPENLOGIN_NETWORK_TYPE, OpenloginUserInfo } from "@toruslabs/openlogin"; | ||
} | ||
export type WalletConnectV2Data = WalletConnectV1Data; | ||
export interface IAdapterDataEvent { | ||
@@ -175,0 +176,0 @@ adapterName: string; |
@@ -49,1 +49,8 @@ import { CustomError } from "ts-custom-error"; | ||
} | ||
export declare class WalletOperationsError extends Web3AuthError { | ||
protected static messages: ErrorCodes; | ||
constructor(code: number, message?: string); | ||
static fromCode(code: number, extraMessage?: string): IWeb3AuthError; | ||
static chainIDNotAllowed(extraMessage?: string): IWeb3AuthError; | ||
static operationNotAllowed(extraMessage?: string): IWeb3AuthError; | ||
} |
{ | ||
"name": "@web3auth/base", | ||
"version": "5.0.0-alpha.0", | ||
"version": "5.0.1-alpha.0", | ||
"homepage": "https://github.com/Web3Auth/Web3Auth#readme", | ||
@@ -22,5 +22,5 @@ "license": "ISC", | ||
"dependencies": { | ||
"@toruslabs/http-helpers": "^3.2.0", | ||
"@toruslabs/openlogin": "^3.1.0", | ||
"@toruslabs/openlogin-jrpc": "^3.0.0", | ||
"@toruslabs/http-helpers": "^3.3.0", | ||
"@toruslabs/openlogin": "^3.2.0", | ||
"@toruslabs/openlogin-jrpc": "^3.2.0", | ||
"jwt-decode": "^3.1.2", | ||
@@ -54,3 +54,3 @@ "loglevel": "^1.8.1", | ||
}, | ||
"gitHead": "f8efd80b6c25a5c9af2057ed723ca9fb7f3f8e40" | ||
"gitHead": "e871ee25f8339ffbef8abd120b6080df560a51ff" | ||
} |
@@ -57,6 +57,6 @@ # Web3Auth Base (Basic Types and Interface for Web3Auth) | ||
## 💬 Troubleshooting and Discussions | ||
## 💬 Troubleshooting and Support | ||
- Have a look at our [GitHub Discussions](https://github.com/Web3Auth/Web3Auth/discussions?discussions_q=sort%3Atop) to see if anyone has any questions or issues you might be having. | ||
- Checkout our [Troubleshooting Documentation Page](https://web3auth.io/docs/troubleshooting) to know the common issues and solutions | ||
- Join our [Discord](https://discord.gg/web3auth) to join our community and get private integration support or help with your integration. | ||
- Have a look at our [Community Portal](https://community.web3auth.io/) to see if anyone has any questions or issues you might be having. Feel free to reate new topics and we'll help you out as soon as possible. | ||
- Checkout our [Troubleshooting Documentation Page](https://web3auth.io/docs/troubleshooting) to know the common issues and solutions. | ||
- For Priority Support, please have a look at our [Pricing Page](https://web3auth.io/pricing.html) for the plan that suits your needs. |
@@ -145,3 +145,7 @@ import { OPENLOGIN_NETWORK, OPENLOGIN_NETWORK_TYPE, OpenloginUserInfo } from "@toruslabs/openlogin"; | ||
// we reconnect without killing existing wallet connect session on calling connect again. | ||
if (this.name === WALLET_ADAPTERS.WALLET_CONNECT_V1 && this.status === ADAPTER_STATUS.CONNECTING) return; | ||
if ( | ||
(this.name === WALLET_ADAPTERS.WALLET_CONNECT_V1 || this.name === WALLET_ADAPTERS.WALLET_CONNECT_V2) && | ||
this.status === ADAPTER_STATUS.CONNECTING | ||
) | ||
return; | ||
else if (this.status === ADAPTER_STATUS.CONNECTING) throw WalletInitializationError.notReady("Already connecting"); | ||
@@ -278,2 +282,3 @@ | ||
export type WalletConnectV2Data = WalletConnectV1Data; | ||
export interface IAdapterDataEvent { | ||
@@ -280,0 +285,0 @@ adapterName: string; |
@@ -177,1 +177,30 @@ import { CustomError } from "ts-custom-error"; | ||
} | ||
export class WalletOperationsError extends Web3AuthError { | ||
protected static messages: ErrorCodes = { | ||
5000: "Custom", | ||
5201: "Provided chainId is not allowed", | ||
5202: "This operation is not allowed", | ||
}; | ||
public constructor(code: number, message?: string) { | ||
// takes care of stack and proto | ||
super(code, message); | ||
// Set name explicitly as minification can mangle class names | ||
Object.defineProperty(this, "name", { value: "WalletOperationsError" }); | ||
} | ||
public static fromCode(code: number, extraMessage = ""): IWeb3AuthError { | ||
return new WalletOperationsError(code, `${WalletOperationsError.messages[code]}, ${extraMessage}`); | ||
} | ||
// Custom methods | ||
public static chainIDNotAllowed(extraMessage = ""): IWeb3AuthError { | ||
return WalletOperationsError.fromCode(5201, extraMessage); | ||
} | ||
public static operationNotAllowed(extraMessage = ""): IWeb3AuthError { | ||
return WalletOperationsError.fromCode(5202, extraMessage); | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1970772
4089