@web3auth/base
Advanced tools
Comparing version 8.8.0 to 8.12.0
@@ -91,3 +91,5 @@ /******/ (() => { // webpackBootstrap | ||
log: () => (/* reexport */ loglevel), | ||
normalizeWalletName: () => (/* reexport */ normalizeWalletName), | ||
saveToken: () => (/* reexport */ saveToken), | ||
serializeError: () => (/* reexport */ serializeError), | ||
signerHost: () => (/* reexport */ signerHost), | ||
@@ -820,2 +822,22 @@ storageAvailable: () => (/* reexport */ storageAvailable) | ||
}; | ||
// Normalize wallet name to a standard format, used for external wallets that are auto-detected by MIPD (EIP-6963 and Wallet Standard) | ||
const normalizeWalletName = name => { | ||
let normalizedName = name.toLowerCase(); | ||
// remove decriptive part after | e.g. "Crypto.com | Defi Wallet" => "Crypto.com" | ||
normalizedName = normalizedName.split("|")[0]; | ||
// replace - with space e.g. "Trust - Wallet" => "Trust Wallet" | ||
normalizedName = normalizedName.replace(/-/g, " "); | ||
// replace multiple spaces with single space | ||
normalizedName = normalizedName.replace(/\s+/g, " "); | ||
// remove trailing "wallet" e.g. "Trust Wallet" => "Trust", "GateWallet" => "Gate" | ||
normalizedName = normalizedName.replace(/wallet$/i, "").trim(); | ||
// replace space with - | ||
normalizedName = normalizedName.replace(/\s/g, "-"); | ||
return normalizedName; | ||
}; | ||
;// CONCATENATED MODULE: ./src/adapter/utils.ts | ||
@@ -910,2 +932,5 @@ | ||
} | ||
static walletPluginNotConnected(extraMessage = "", cause) { | ||
return WalletServicesPluginError.fromCode(5223, extraMessage, cause); | ||
} | ||
} | ||
@@ -922,3 +947,4 @@ defineProperty_default()(WalletServicesPluginError, "messages", { | ||
5221: "Web3Auth is not initialized", | ||
5222: "Invalid session inside wallet services. Please report this issue." | ||
5222: "Invalid session inside wallet services. Please report this issue.", | ||
5223: "Wallet plugin is not connected Yet. Please wait for plugin to connect and listen via `connected` event on the plugin" | ||
}); | ||
@@ -925,0 +951,0 @@ ;// CONCATENATED MODULE: ./src/plugin/IPlugin.ts |
@@ -699,2 +699,22 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty'; | ||
// Normalize wallet name to a standard format, used for external wallets that are auto-detected by MIPD (EIP-6963 and Wallet Standard) | ||
const normalizeWalletName = name => { | ||
let normalizedName = name.toLowerCase(); | ||
// remove decriptive part after | e.g. "Crypto.com | Defi Wallet" => "Crypto.com" | ||
normalizedName = normalizedName.split("|")[0]; | ||
// replace - with space e.g. "Trust - Wallet" => "Trust Wallet" | ||
normalizedName = normalizedName.replace(/-/g, " "); | ||
// replace multiple spaces with single space | ||
normalizedName = normalizedName.replace(/\s+/g, " "); | ||
// remove trailing "wallet" e.g. "Trust Wallet" => "Trust", "GateWallet" => "Gate" | ||
normalizedName = normalizedName.replace(/wallet$/i, "").trim(); | ||
// replace space with - | ||
normalizedName = normalizedName.replace(/\s/g, "-"); | ||
return normalizedName; | ||
}; | ||
const checkIfTokenIsExpired = token => { | ||
@@ -777,2 +797,5 @@ const decoded = jwtDecode(token); | ||
} | ||
static walletPluginNotConnected(extraMessage = "", cause) { | ||
return WalletServicesPluginError.fromCode(5223, extraMessage, cause); | ||
} | ||
} | ||
@@ -789,3 +812,4 @@ _defineProperty(WalletServicesPluginError, "messages", { | ||
5221: "Web3Auth is not initialized", | ||
5222: "Invalid session inside wallet services. Please report this issue." | ||
5222: "Invalid session inside wallet services. Please report this issue.", | ||
5223: "Wallet plugin is not connected Yet. Please wait for plugin to connect and listen via `connected` event on the plugin" | ||
}); | ||
@@ -817,2 +841,2 @@ | ||
export { ADAPTER_CATEGORY, ADAPTER_EVENTS, ADAPTER_NAMES, ADAPTER_NAMESPACES, ADAPTER_STATUS, BaseAdapter, CHAIN_NAMESPACES, EVM_ADAPTERS, EVM_PLUGINS, MULTI_CHAIN_ADAPTERS, PLUGIN_EVENTS, PLUGIN_NAMESPACES, PLUGIN_STATUS, PROVIDER_EVENTS, SOLANA_ADAPTERS, SOLANA_PLUGINS, WALLET_ADAPTERS, WALLET_PLUGINS, WEB3AUTH_NETWORK, WalletInitializationError, WalletLoginError, WalletOperationsError, WalletProviderError, WalletServicesPluginError, Web3AuthError, checkIfTokenIsExpired, clearToken, fetchProjectConfig, getChainConfig, getEvmChainConfig, getSavedToken, getSolanaChainConfig, getXrplChainConfig, isHexStrict, loglevel as log, saveToken, signerHost, storageAvailable }; | ||
export { ADAPTER_CATEGORY, ADAPTER_EVENTS, ADAPTER_NAMES, ADAPTER_NAMESPACES, ADAPTER_STATUS, BaseAdapter, CHAIN_NAMESPACES, EVM_ADAPTERS, EVM_PLUGINS, MULTI_CHAIN_ADAPTERS, PLUGIN_EVENTS, PLUGIN_NAMESPACES, PLUGIN_STATUS, PROVIDER_EVENTS, SOLANA_ADAPTERS, SOLANA_PLUGINS, WALLET_ADAPTERS, WALLET_PLUGINS, WEB3AUTH_NETWORK, WalletInitializationError, WalletLoginError, WalletOperationsError, WalletProviderError, WalletServicesPluginError, Web3AuthError, checkIfTokenIsExpired, clearToken, fetchProjectConfig, getChainConfig, getEvmChainConfig, getSavedToken, getSolanaChainConfig, getXrplChainConfig, isHexStrict, loglevel as log, normalizeWalletName, saveToken, serializeError, signerHost, storageAvailable }; |
@@ -11,2 +11,3 @@ import { CustomError } from "ts-custom-error"; | ||
}; | ||
export declare function serializeError(args: unknown[]): [Error, unknown[]]; | ||
export declare abstract class Web3AuthError extends CustomError implements IWeb3AuthError { | ||
@@ -13,0 +14,0 @@ code: number; |
@@ -17,2 +17,3 @@ import { ErrorCodes, IWeb3AuthError, Web3AuthError } from "../errors"; | ||
static invalidSession(extraMessage?: string, cause?: unknown): IWeb3AuthError; | ||
static walletPluginNotConnected(extraMessage?: string, cause?: unknown): IWeb3AuthError; | ||
} |
@@ -17,1 +17,2 @@ import type { OPENLOGIN_NETWORK_TYPE, WhiteLabelData } from "@toruslabs/openlogin-utils"; | ||
export declare const fetchProjectConfig: (clientId: string, web3AuthNetwork: OPENLOGIN_NETWORK_TYPE) => Promise<PROJECT_CONFIG_RESPONSE>; | ||
export declare const normalizeWalletName: (name: string) => string; |
{ | ||
"name": "@web3auth/base", | ||
"version": "8.8.0", | ||
"version": "8.12.0", | ||
"homepage": "https://github.com/Web3Auth/Web3Auth#readme", | ||
@@ -58,3 +58,3 @@ "license": "ISC", | ||
}, | ||
"gitHead": "389c9e0a27379d51ad45ec6ae4f6fdf794e71468" | ||
"gitHead": "a28b5149be344ed07bac9316266e6dbd8fe1d3d2" | ||
} |
Sorry, the diff of this file is too big to display
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
266782
2361