Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@web3auth/base

Package Overview
Dependencies
Maintainers
2
Versions
123
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@web3auth/base - npm Package Compare versions

Comparing version 7.3.1 to 8.0.0-alpha.0

src/adapter/IAdapter.d.ts

95

dist/base.cjs.js

@@ -81,2 +81,3 @@ /******/ (() => { // webpackBootstrap

getSolanaChainConfig: () => (/* reexport */ getSolanaChainConfig),
getXrplChainConfig: () => (/* reexport */ getXrplChainConfig),
isHexStrict: () => (/* reexport */ isHexStrict),

@@ -104,2 +105,3 @@ log: () => (/* reexport */ loglevel),

SOLANA: "solana",
XRPL: "xrpl",
OTHER: "other"

@@ -123,2 +125,4 @@ };

return 1;
} else if (chainNamespace === CHAIN_NAMESPACES.XRPL) {
return 1;
}

@@ -131,2 +135,3 @@ throw new Error(`Chain namespace ${chainNamespace} is not supported`);

return {
logo: "https://images.toruswallet.io/eth.svg",
chainNamespace,

@@ -136,3 +141,3 @@ chainId: "0x1",

displayName: "Ethereum Mainnet",
blockExplorer: "https://etherscan.io/",
blockExplorerUrl: "https://etherscan.io/",
ticker: "ETH",

@@ -145,2 +150,3 @@ tickerName: "Ethereum",

return {
logo: "https://images.toruswallet.io/eth.svg",
chainNamespace,

@@ -150,3 +156,3 @@ chainId: "0x5",

displayName: "Goerli Testnet",
blockExplorer: "https://goerli.etherscan.io/",
blockExplorerUrl: "https://goerli.etherscan.io/",
ticker: "ETH",

@@ -159,2 +165,3 @@ tickerName: "Ethereum",

return {
logo: "https://images.toruswallet.io/eth.svg",
chainNamespace,

@@ -164,3 +171,3 @@ chainId: "0xaa36a7",

displayName: "Sepolia Testnet",
blockExplorer: "https://sepolia.etherscan.io/",
blockExplorerUrl: "https://sepolia.etherscan.io/",
ticker: "ETH",

@@ -173,2 +180,3 @@ tickerName: "Ethereum",

return {
logo: "https://images.toruswallet.io/polygon.svg",
chainNamespace,

@@ -178,3 +186,3 @@ chainId: "0x89",

displayName: "Polygon Mainnet",
blockExplorer: "https://polygonscan.com",
blockExplorerUrl: "https://polygonscan.com",
ticker: "MATIC",

@@ -186,2 +194,3 @@ tickerName: "Polygon"

return {
logo: "https://images.toruswallet.io/polygon.svg",
chainNamespace,

@@ -191,3 +200,3 @@ chainId: "0x13881",

displayName: "Polygon Mumbai Testnet",
blockExplorer: "https://mumbai.polygonscan.com/",
blockExplorerUrl: "https://mumbai.polygonscan.com/",
ticker: "MATIC",

@@ -200,2 +209,3 @@ tickerName: "Polygon",

return {
logo: "https://images.toruswallet.io/bnb.png",
chainNamespace,

@@ -205,3 +215,3 @@ chainId: "0x38",

displayName: "Binance SmartChain Mainnet",
blockExplorer: "https://bscscan.com",
blockExplorerUrl: "https://bscscan.com",
ticker: "BNB",

@@ -214,2 +224,3 @@ tickerName: "Binance SmartChain",

return {
logo: "https://images.toruswallet.io/bnb.png",
chainNamespace,

@@ -219,3 +230,3 @@ chainId: "0x61",

displayName: "Binance SmartChain Testnet",
blockExplorer: "https://testnet.bscscan.com",
blockExplorerUrl: "https://testnet.bscscan.com",
ticker: "BNB",

@@ -228,2 +239,3 @@ tickerName: "Binance SmartChain",

return {
logo: "https://images.toruswallet.io/cro.svg",
chainNamespace,

@@ -233,3 +245,3 @@ chainId: "0x19",

displayName: "Cronos Mainnet",
blockExplorer: "https://cronoscan.com/",
blockExplorerUrl: "https://cronoscan.com/",
ticker: "CRO",

@@ -241,2 +253,3 @@ tickerName: "Cronos"

return {
logo: "https://images.toruswallet.io/cro.svg",
chainNamespace,

@@ -246,3 +259,3 @@ chainId: "0x152",

displayName: "Cronos Testnet",
blockExplorer: "https://cronoscan.com/",
blockExplorerUrl: "https://cronoscan.com/",
ticker: "CRO",

@@ -255,2 +268,3 @@ tickerName: "Cronos",

return {
logo: "https://images.toruswallet.io/klay.svg",
chainNamespace,

@@ -260,3 +274,3 @@ chainId: "0x2019",

displayName: "Klaytn Mainnet",
blockExplorer: "https://scope.klaytn.com",
blockExplorerUrl: "https://scope.klaytn.com",
ticker: "KLAY",

@@ -273,2 +287,3 @@ tickerName: "Klaytn",

return {
logo: "https://images.toruswallet.io/sol.svg",
chainNamespace,

@@ -278,3 +293,3 @@ chainId: "0x1",

displayName: "Solana Mainnet",
blockExplorer: "https://explorer.solana.com",
blockExplorerUrl: "https://explorer.solana.com",
ticker: "SOL",

@@ -286,2 +301,3 @@ tickerName: "Solana",

return {
logo: "https://images.toruswallet.io/sol.svg",
chainNamespace,

@@ -291,3 +307,3 @@ chainId: "0x2",

displayName: "Solana Testnet",
blockExplorer: "https://explorer.solana.com?cluster=testnet",
blockExplorerUrl: "https://explorer.solana.com?cluster=testnet",
ticker: "SOL",

@@ -299,2 +315,3 @@ tickerName: "Solana",

return {
logo: "https://images.toruswallet.io/sol.svg",
chainNamespace,

@@ -304,3 +321,3 @@ chainId: "0x3",

displayName: "Solana Devnet",
blockExplorer: "https://explorer.solana.com?cluster=devnet",
blockExplorerUrl: "https://explorer.solana.com?cluster=devnet",
ticker: "SOL",

@@ -313,2 +330,48 @@ tickerName: "Solana",

};
const getXrplChainConfig = chainId => {
const chainNamespace = CHAIN_NAMESPACES.XRPL;
if (chainId === 1) {
return {
chainNamespace,
decimals: 15,
chainId: "0x1",
logo: "https://images.toruswallet.io/XRP.svg",
rpcTarget: "https://ripple-node.tor.us",
wsTarget: "wss://s2.ripple.com",
ticker: "XRP",
tickerName: "XRPL",
displayName: "xrpl mainnet",
blockExplorerUrl: "https://livenet.xrpl.org"
};
} else if (chainId === 2) {
return {
chainNamespace,
decimals: 15,
chainId: "0x2",
logo: "https://images.toruswallet.io/XRP.svg",
rpcTarget: "https://testnet-ripple-node.tor.us",
wsTarget: "wss://s.altnet.rippletest.net",
ticker: "XRP",
tickerName: "XRPL",
displayName: "xrpl testnet",
blockExplorerUrl: "https://testnet.xrpl.org",
isTestnet: true
};
} else if (chainId === 3) {
return {
chainNamespace,
decimals: 15,
chainId: "0x3",
logo: "https://images.toruswallet.io/XRP.svg",
rpcTarget: "https://devnet-ripple-node.tor.us",
wsTarget: "wss://s.devnet.rippletest.net/",
ticker: "XRP",
tickerName: "XRPL",
displayName: "xrpl devnet",
blockExplorerUrl: "https://devnet.xrpl.org",
isTestnet: true
};
}
return null;
};
const getChainConfig = (chainNamespace, chainId) => {

@@ -321,2 +384,4 @@ if (chainNamespace === CHAIN_NAMESPACES.OTHER) return null;

return getSolanaChainConfig(finalChainId);
} else if (chainNamespace === CHAIN_NAMESPACES.XRPL) {
return getXrplChainConfig(finalChainId);
}

@@ -637,2 +702,3 @@ return null;

defineProperty_default()(this, "web3AuthNetwork", openlogin_utils_namespaceObject.OPENLOGIN_NETWORK.MAINNET);
defineProperty_default()(this, "useCoreKitKey", undefined);
defineProperty_default()(this, "rehydrated", false);

@@ -667,2 +733,5 @@ // should be added in constructor or from setAdapterSettings function

}
if ((options === null || options === void 0 ? void 0 : options.useCoreKitKey) !== undefined) {
this.useCoreKitKey = options.useCoreKitKey;
}
const customChainConfig = options.chainConfig;

@@ -669,0 +738,0 @@ if (customChainConfig) {

@@ -14,2 +14,3 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';

SOLANA: "solana",
XRPL: "xrpl",
OTHER: "other"

@@ -32,2 +33,4 @@ };

return 1;
} else if (chainNamespace === CHAIN_NAMESPACES.XRPL) {
return 1;
}

@@ -40,2 +43,3 @@ throw new Error(`Chain namespace ${chainNamespace} is not supported`);

return {
logo: "https://images.toruswallet.io/eth.svg",
chainNamespace,

@@ -45,3 +49,3 @@ chainId: "0x1",

displayName: "Ethereum Mainnet",
blockExplorer: "https://etherscan.io/",
blockExplorerUrl: "https://etherscan.io/",
ticker: "ETH",

@@ -54,2 +58,3 @@ tickerName: "Ethereum",

return {
logo: "https://images.toruswallet.io/eth.svg",
chainNamespace,

@@ -59,3 +64,3 @@ chainId: "0x5",

displayName: "Goerli Testnet",
blockExplorer: "https://goerli.etherscan.io/",
blockExplorerUrl: "https://goerli.etherscan.io/",
ticker: "ETH",

@@ -68,2 +73,3 @@ tickerName: "Ethereum",

return {
logo: "https://images.toruswallet.io/eth.svg",
chainNamespace,

@@ -73,3 +79,3 @@ chainId: "0xaa36a7",

displayName: "Sepolia Testnet",
blockExplorer: "https://sepolia.etherscan.io/",
blockExplorerUrl: "https://sepolia.etherscan.io/",
ticker: "ETH",

@@ -82,2 +88,3 @@ tickerName: "Ethereum",

return {
logo: "https://images.toruswallet.io/polygon.svg",
chainNamespace,

@@ -87,3 +94,3 @@ chainId: "0x89",

displayName: "Polygon Mainnet",
blockExplorer: "https://polygonscan.com",
blockExplorerUrl: "https://polygonscan.com",
ticker: "MATIC",

@@ -95,2 +102,3 @@ tickerName: "Polygon"

return {
logo: "https://images.toruswallet.io/polygon.svg",
chainNamespace,

@@ -100,3 +108,3 @@ chainId: "0x13881",

displayName: "Polygon Mumbai Testnet",
blockExplorer: "https://mumbai.polygonscan.com/",
blockExplorerUrl: "https://mumbai.polygonscan.com/",
ticker: "MATIC",

@@ -109,2 +117,3 @@ tickerName: "Polygon",

return {
logo: "https://images.toruswallet.io/bnb.png",
chainNamespace,

@@ -114,3 +123,3 @@ chainId: "0x38",

displayName: "Binance SmartChain Mainnet",
blockExplorer: "https://bscscan.com",
blockExplorerUrl: "https://bscscan.com",
ticker: "BNB",

@@ -123,2 +132,3 @@ tickerName: "Binance SmartChain",

return {
logo: "https://images.toruswallet.io/bnb.png",
chainNamespace,

@@ -128,3 +138,3 @@ chainId: "0x61",

displayName: "Binance SmartChain Testnet",
blockExplorer: "https://testnet.bscscan.com",
blockExplorerUrl: "https://testnet.bscscan.com",
ticker: "BNB",

@@ -137,2 +147,3 @@ tickerName: "Binance SmartChain",

return {
logo: "https://images.toruswallet.io/cro.svg",
chainNamespace,

@@ -142,3 +153,3 @@ chainId: "0x19",

displayName: "Cronos Mainnet",
blockExplorer: "https://cronoscan.com/",
blockExplorerUrl: "https://cronoscan.com/",
ticker: "CRO",

@@ -150,2 +161,3 @@ tickerName: "Cronos"

return {
logo: "https://images.toruswallet.io/cro.svg",
chainNamespace,

@@ -155,3 +167,3 @@ chainId: "0x152",

displayName: "Cronos Testnet",
blockExplorer: "https://cronoscan.com/",
blockExplorerUrl: "https://cronoscan.com/",
ticker: "CRO",

@@ -164,2 +176,3 @@ tickerName: "Cronos",

return {
logo: "https://images.toruswallet.io/klay.svg",
chainNamespace,

@@ -169,3 +182,3 @@ chainId: "0x2019",

displayName: "Klaytn Mainnet",
blockExplorer: "https://scope.klaytn.com",
blockExplorerUrl: "https://scope.klaytn.com",
ticker: "KLAY",

@@ -182,2 +195,3 @@ tickerName: "Klaytn",

return {
logo: "https://images.toruswallet.io/sol.svg",
chainNamespace,

@@ -187,3 +201,3 @@ chainId: "0x1",

displayName: "Solana Mainnet",
blockExplorer: "https://explorer.solana.com",
blockExplorerUrl: "https://explorer.solana.com",
ticker: "SOL",

@@ -195,2 +209,3 @@ tickerName: "Solana",

return {
logo: "https://images.toruswallet.io/sol.svg",
chainNamespace,

@@ -200,3 +215,3 @@ chainId: "0x2",

displayName: "Solana Testnet",
blockExplorer: "https://explorer.solana.com?cluster=testnet",
blockExplorerUrl: "https://explorer.solana.com?cluster=testnet",
ticker: "SOL",

@@ -208,2 +223,3 @@ tickerName: "Solana",

return {
logo: "https://images.toruswallet.io/sol.svg",
chainNamespace,

@@ -213,3 +229,3 @@ chainId: "0x3",

displayName: "Solana Devnet",
blockExplorer: "https://explorer.solana.com?cluster=devnet",
blockExplorerUrl: "https://explorer.solana.com?cluster=devnet",
ticker: "SOL",

@@ -222,2 +238,48 @@ tickerName: "Solana",

};
const getXrplChainConfig = chainId => {
const chainNamespace = CHAIN_NAMESPACES.XRPL;
if (chainId === 1) {
return {
chainNamespace,
decimals: 15,
chainId: "0x1",
logo: "https://images.toruswallet.io/XRP.svg",
rpcTarget: "https://ripple-node.tor.us",
wsTarget: "wss://s2.ripple.com",
ticker: "XRP",
tickerName: "XRPL",
displayName: "xrpl mainnet",
blockExplorerUrl: "https://livenet.xrpl.org"
};
} else if (chainId === 2) {
return {
chainNamespace,
decimals: 15,
chainId: "0x2",
logo: "https://images.toruswallet.io/XRP.svg",
rpcTarget: "https://testnet-ripple-node.tor.us",
wsTarget: "wss://s.altnet.rippletest.net",
ticker: "XRP",
tickerName: "XRPL",
displayName: "xrpl testnet",
blockExplorerUrl: "https://testnet.xrpl.org",
isTestnet: true
};
} else if (chainId === 3) {
return {
chainNamespace,
decimals: 15,
chainId: "0x3",
logo: "https://images.toruswallet.io/XRP.svg",
rpcTarget: "https://devnet-ripple-node.tor.us",
wsTarget: "wss://s.devnet.rippletest.net/",
ticker: "XRP",
tickerName: "XRPL",
displayName: "xrpl devnet",
blockExplorerUrl: "https://devnet.xrpl.org",
isTestnet: true
};
}
return null;
};
const getChainConfig = (chainNamespace, chainId) => {

@@ -230,2 +292,4 @@ if (chainNamespace === CHAIN_NAMESPACES.OTHER) return null;

return getSolanaChainConfig(finalChainId);
} else if (chainNamespace === CHAIN_NAMESPACES.XRPL) {
return getXrplChainConfig(finalChainId);
}

@@ -531,2 +595,3 @@ return null;

_defineProperty(this, "web3AuthNetwork", OPENLOGIN_NETWORK.MAINNET);
_defineProperty(this, "useCoreKitKey", undefined);
_defineProperty(this, "rehydrated", false);

@@ -561,2 +626,5 @@ // should be added in constructor or from setAdapterSettings function

}
if ((options === null || options === void 0 ? void 0 : options.useCoreKitKey) !== undefined) {
this.useCoreKitKey = options.useCoreKitKey;
}
const customChainConfig = options.chainConfig;

@@ -742,3 +810,3 @@ if (customChainConfig) {

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, WEB3AUTH_NETWORK, WalletInitializationError, WalletLoginError, WalletOperationsError, WalletProviderError, 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, WEB3AUTH_NETWORK, WalletInitializationError, WalletLoginError, WalletOperationsError, WalletProviderError, Web3AuthError, authServer, checkIfTokenIsExpired, clearToken, getChainConfig, getEvmChainConfig, getSavedToken, getSolanaChainConfig, getXrplChainConfig, isHexStrict, log, saveToken, signChallenge, storageAvailable, verifySignedChallenge };
//# sourceMappingURL=base.esm.js.map

@@ -86,2 +86,3 @@ import { JRPCRequest, JRPCResponse, Maybe, RequestArguments, SafeEventEmitter, SendCallBack } from "@toruslabs/openlogin-jrpc";

web3AuthNetwork: OPENLOGIN_NETWORK_TYPE;
useCoreKitKey: boolean | undefined;
clientId: string;

@@ -110,2 +111,3 @@ status: ADAPTER_STATUS_TYPE;

web3AuthNetwork: OPENLOGIN_NETWORK_TYPE;
useCoreKitKey: boolean;
protected rehydrated: boolean;

@@ -112,0 +114,0 @@ protected chainConfig: CustomChainConfig | null;

import { ChainNamespaceType, CustomChainConfig } from "./IChainInterface";
export declare const getEvmChainConfig: (chainId: number) => CustomChainConfig | null;
export declare const getSolanaChainConfig: (chainId: number) => CustomChainConfig | null;
export declare const getXrplChainConfig: (chainId: number) => CustomChainConfig | null;
export declare const getChainConfig: (chainNamespace: ChainNamespaceType, chainId?: number | string) => CustomChainConfig | null;
export declare const CHAIN_NAMESPACES: {
readonly EIP155: "eip155";
readonly SOLANA: "solana";
readonly XRPL: "xrpl";
readonly OTHER: "other";

@@ -35,3 +36,3 @@ };

*/
blockExplorer: string;
blockExplorerUrl: string;
/**

@@ -49,2 +50,10 @@ * Default currency ticker of the network (e.g: ETH)

decimals?: number;
/**
* Logo for the token
*/
logo: string;
/**
* Whether the network is testnet or not
*/
isTestnet?: boolean;
};
import { SafeEventEmitter } from "@toruslabs/openlogin-jrpc";
import { ADAPTER_STATUS_TYPE, IProvider, UserAuthInfo, UserInfo } from "../adapter/IAdapter";
import { WhiteLabelData } from "@toruslabs/openlogin-utils";
import { ADAPTER_STATUS_TYPE, IAdapter, IBaseProvider, IProvider, OPENLOGIN_NETWORK_TYPE, UserAuthInfo, UserInfo } from "../adapter/IAdapter";
import { CustomChainConfig } from "../chain/IChainInterface";

@@ -11,2 +12,3 @@ import { WALLET_ADAPTER_TYPE } from "../wallet";

provider: IProvider | null;
walletAdapters: Record<string, IAdapter<unknown>>;
init(): Promise<void>;

@@ -28,1 +30,52 @@ /**

}
export interface Web3AuthNoModalOptions {
/**
* Client id for web3auth.
* You can obtain your client id from the web3auth developer dashboard.
* You can set any random string for this on localhost.
*/
clientId: string;
/**
* custom chain configuration for chainNamespace
*
* @defaultValue mainnet config of provided chainNamespace
*/
chainConfig: Partial<CustomChainConfig> & Pick<CustomChainConfig, "chainNamespace">;
/**
* setting to true will enable logs
*
* @defaultValue false
*/
enableLogging?: boolean;
/**
* setting to "local" will persist social login session accross browser tabs.
*
* @defaultValue "local"
*/
storageKey?: "session" | "local";
/**
* sessionTime (in seconds) for idToken issued by Web3Auth for server side verification.
* @defaultValue 86400
*
* Note: max value can be 7 days (86400 * 7) and min can be 1 day (86400)
*/
sessionTime?: number;
/**
* Web3Auth Network to use for the session & the issued idToken
* @defaultValue mainnet
*/
web3AuthNetwork?: OPENLOGIN_NETWORK_TYPE;
/**
* Uses core-kit key with web3auth provider
* @defaultValue false
*/
useCoreKitKey?: boolean;
/**
* WhiteLabel options for web3auth
*/
uiConfig?: WhiteLabelData;
/**
* Private key provider for your chain namespace
*/
privateKeyProvider?: IBaseProvider<string>;
}

12

package.json
{
"name": "@web3auth/base",
"version": "7.3.1",
"version": "8.0.0-alpha.0",
"homepage": "https://github.com/Web3Auth/Web3Auth#readme",

@@ -23,7 +23,7 @@ "license": "ISC",

"@toruslabs/http-helpers": "^6.0.0",
"@toruslabs/openlogin": "^6.2.2",
"@toruslabs/openlogin-jrpc": "^6.2.2",
"@toruslabs/openlogin-utils": "^6.2.2",
"@toruslabs/openlogin": "^6.2.5",
"@toruslabs/openlogin-jrpc": "^6.2.8",
"@toruslabs/openlogin-utils": "^6.2.5",
"jwt-decode": "^4.0.0",
"loglevel": "^1.8.1",
"loglevel": "^1.9.1",
"ts-custom-error": "^3.3.1"

@@ -59,3 +59,3 @@ },

},
"gitHead": "ef1b6198d0ee045bf63ef3338affbccdeb473d42"
"gitHead": "ef1bb1e8518e7c242f5371ea872341eaad755361"
}

@@ -85,2 +85,3 @@ import { JRPCRequest, JRPCResponse, Maybe, RequestArguments, SafeEventEmitter, SendCallBack } from "@toruslabs/openlogin-jrpc";

web3AuthNetwork: OPENLOGIN_NETWORK_TYPE;
useCoreKitKey: boolean | undefined;
clientId: string;

@@ -110,2 +111,4 @@ status: ADAPTER_STATUS_TYPE;

public useCoreKitKey: boolean = undefined;
protected rehydrated = false;

@@ -155,2 +158,5 @@

}
if (options?.useCoreKitKey !== undefined) {
this.useCoreKitKey = options.useCoreKitKey;
}
const customChainConfig = options.chainConfig;

@@ -157,0 +163,0 @@ if (customChainConfig) {

@@ -7,2 +7,4 @@ import { CHAIN_NAMESPACES, ChainNamespaceType, CustomChainConfig } from "./IChainInterface";

return 1;
} else if (chainNamespace === CHAIN_NAMESPACES.XRPL) {
return 1;
}

@@ -16,2 +18,3 @@ throw new Error(`Chain namespace ${chainNamespace} is not supported`);

return {
logo: "https://images.toruswallet.io/eth.svg",
chainNamespace,

@@ -21,3 +24,3 @@ chainId: "0x1",

displayName: "Ethereum Mainnet",
blockExplorer: "https://etherscan.io/",
blockExplorerUrl: "https://etherscan.io/",
ticker: "ETH",

@@ -30,2 +33,3 @@ tickerName: "Ethereum",

return {
logo: "https://images.toruswallet.io/eth.svg",
chainNamespace,

@@ -35,3 +39,3 @@ chainId: "0x5",

displayName: "Goerli Testnet",
blockExplorer: "https://goerli.etherscan.io/",
blockExplorerUrl: "https://goerli.etherscan.io/",
ticker: "ETH",

@@ -44,2 +48,3 @@ tickerName: "Ethereum",

return {
logo: "https://images.toruswallet.io/eth.svg",
chainNamespace,

@@ -49,3 +54,3 @@ chainId: "0xaa36a7",

displayName: "Sepolia Testnet",
blockExplorer: "https://sepolia.etherscan.io/",
blockExplorerUrl: "https://sepolia.etherscan.io/",
ticker: "ETH",

@@ -58,2 +63,3 @@ tickerName: "Ethereum",

return {
logo: "https://images.toruswallet.io/polygon.svg",
chainNamespace,

@@ -63,3 +69,3 @@ chainId: "0x89",

displayName: "Polygon Mainnet",
blockExplorer: "https://polygonscan.com",
blockExplorerUrl: "https://polygonscan.com",
ticker: "MATIC",

@@ -71,2 +77,3 @@ tickerName: "Polygon",

return {
logo: "https://images.toruswallet.io/polygon.svg",
chainNamespace,

@@ -76,3 +83,3 @@ chainId: "0x13881",

displayName: "Polygon Mumbai Testnet",
blockExplorer: "https://mumbai.polygonscan.com/",
blockExplorerUrl: "https://mumbai.polygonscan.com/",
ticker: "MATIC",

@@ -85,2 +92,3 @@ tickerName: "Polygon",

return {
logo: "https://images.toruswallet.io/bnb.png",
chainNamespace,

@@ -90,3 +98,3 @@ chainId: "0x38",

displayName: "Binance SmartChain Mainnet",
blockExplorer: "https://bscscan.com",
blockExplorerUrl: "https://bscscan.com",
ticker: "BNB",

@@ -99,2 +107,3 @@ tickerName: "Binance SmartChain",

return {
logo: "https://images.toruswallet.io/bnb.png",
chainNamespace,

@@ -104,3 +113,3 @@ chainId: "0x61",

displayName: "Binance SmartChain Testnet",
blockExplorer: "https://testnet.bscscan.com",
blockExplorerUrl: "https://testnet.bscscan.com",
ticker: "BNB",

@@ -113,2 +122,3 @@ tickerName: "Binance SmartChain",

return {
logo: "https://images.toruswallet.io/cro.svg",
chainNamespace,

@@ -118,3 +128,3 @@ chainId: "0x19",

displayName: "Cronos Mainnet",
blockExplorer: "https://cronoscan.com/",
blockExplorerUrl: "https://cronoscan.com/",
ticker: "CRO",

@@ -126,2 +136,3 @@ tickerName: "Cronos",

return {
logo: "https://images.toruswallet.io/cro.svg",
chainNamespace,

@@ -131,3 +142,3 @@ chainId: "0x152",

displayName: "Cronos Testnet",
blockExplorer: "https://cronoscan.com/",
blockExplorerUrl: "https://cronoscan.com/",
ticker: "CRO",

@@ -140,2 +151,3 @@ tickerName: "Cronos",

return {
logo: "https://images.toruswallet.io/klay.svg",
chainNamespace,

@@ -145,3 +157,3 @@ chainId: "0x2019",

displayName: "Klaytn Mainnet",
blockExplorer: "https://scope.klaytn.com",
blockExplorerUrl: "https://scope.klaytn.com",
ticker: "KLAY",

@@ -160,2 +172,3 @@ tickerName: "Klaytn",

return {
logo: "https://images.toruswallet.io/sol.svg",
chainNamespace,

@@ -165,3 +178,3 @@ chainId: "0x1",

displayName: "Solana Mainnet",
blockExplorer: "https://explorer.solana.com",
blockExplorerUrl: "https://explorer.solana.com",
ticker: "SOL",

@@ -173,2 +186,3 @@ tickerName: "Solana",

return {
logo: "https://images.toruswallet.io/sol.svg",
chainNamespace,

@@ -178,3 +192,3 @@ chainId: "0x2",

displayName: "Solana Testnet",
blockExplorer: "https://explorer.solana.com?cluster=testnet",
blockExplorerUrl: "https://explorer.solana.com?cluster=testnet",
ticker: "SOL",

@@ -186,2 +200,3 @@ tickerName: "Solana",

return {
logo: "https://images.toruswallet.io/sol.svg",
chainNamespace,

@@ -191,3 +206,3 @@ chainId: "0x3",

displayName: "Solana Devnet",
blockExplorer: "https://explorer.solana.com?cluster=devnet",
blockExplorerUrl: "https://explorer.solana.com?cluster=devnet",
ticker: "SOL",

@@ -202,2 +217,50 @@ tickerName: "Solana",

export const getXrplChainConfig = (chainId: number): CustomChainConfig | null => {
const chainNamespace = CHAIN_NAMESPACES.XRPL;
if (chainId === 1) {
return {
chainNamespace,
decimals: 15,
chainId: "0x1",
logo: "https://images.toruswallet.io/XRP.svg",
rpcTarget: "https://ripple-node.tor.us",
wsTarget: "wss://s2.ripple.com",
ticker: "XRP",
tickerName: "XRPL",
displayName: "xrpl mainnet",
blockExplorerUrl: "https://livenet.xrpl.org",
};
} else if (chainId === 2) {
return {
chainNamespace,
decimals: 15,
chainId: "0x2",
logo: "https://images.toruswallet.io/XRP.svg",
rpcTarget: "https://testnet-ripple-node.tor.us",
wsTarget: "wss://s.altnet.rippletest.net",
ticker: "XRP",
tickerName: "XRPL",
displayName: "xrpl testnet",
blockExplorerUrl: "https://testnet.xrpl.org",
isTestnet: true,
};
} else if (chainId === 3) {
return {
chainNamespace,
decimals: 15,
chainId: "0x3",
logo: "https://images.toruswallet.io/XRP.svg",
rpcTarget: "https://devnet-ripple-node.tor.us",
wsTarget: "wss://s.devnet.rippletest.net/",
ticker: "XRP",
tickerName: "XRPL",
displayName: "xrpl devnet",
blockExplorerUrl: "https://devnet.xrpl.org",
isTestnet: true,
};
}
return null;
};
export const getChainConfig = (chainNamespace: ChainNamespaceType, chainId?: number | string): CustomChainConfig | null => {

@@ -210,4 +273,6 @@ if (chainNamespace === CHAIN_NAMESPACES.OTHER) return null;

return getSolanaChainConfig(finalChainId);
} else if (chainNamespace === CHAIN_NAMESPACES.XRPL) {
return getXrplChainConfig(finalChainId);
}
return null;
};
export const CHAIN_NAMESPACES = {
EIP155: "eip155",
SOLANA: "solana",
XRPL: "xrpl",
OTHER: "other",

@@ -41,3 +42,3 @@ } as const;

*/
blockExplorer: string;
blockExplorerUrl: string;
/**

@@ -55,2 +56,10 @@ * Default currency ticker of the network (e.g: ETH)

decimals?: number;
/**
* Logo for the token
*/
logo: string;
/**
* Whether the network is testnet or not
*/
isTestnet?: boolean;
};
import { SafeEventEmitter } from "@toruslabs/openlogin-jrpc";
import { WhiteLabelData } from "@toruslabs/openlogin-utils";
import { ADAPTER_STATUS_TYPE, IProvider, UserAuthInfo, UserInfo } from "../adapter/IAdapter";
import { ADAPTER_STATUS_TYPE, IAdapter, IBaseProvider, IProvider, OPENLOGIN_NETWORK_TYPE, UserAuthInfo, UserInfo } from "../adapter/IAdapter";
import { CustomChainConfig } from "../chain/IChainInterface";

@@ -13,2 +14,3 @@ import { WALLET_ADAPTER_TYPE } from "../wallet";

provider: IProvider | null;
walletAdapters: Record<string, IAdapter<unknown>>;
init(): Promise<void>;

@@ -26,1 +28,58 @@ /**

}
export interface Web3AuthNoModalOptions {
/**
* Client id for web3auth.
* You can obtain your client id from the web3auth developer dashboard.
* You can set any random string for this on localhost.
*/
clientId: string;
/**
* custom chain configuration for chainNamespace
*
* @defaultValue mainnet config of provided chainNamespace
*/
chainConfig: Partial<CustomChainConfig> & Pick<CustomChainConfig, "chainNamespace">;
/**
* setting to true will enable logs
*
* @defaultValue false
*/
enableLogging?: boolean;
/**
* setting to "local" will persist social login session accross browser tabs.
*
* @defaultValue "local"
*/
storageKey?: "session" | "local";
/**
* sessionTime (in seconds) for idToken issued by Web3Auth for server side verification.
* @defaultValue 86400
*
* Note: max value can be 7 days (86400 * 7) and min can be 1 day (86400)
*/
sessionTime?: number;
/**
* Web3Auth Network to use for the session & the issued idToken
* @defaultValue mainnet
*/
web3AuthNetwork?: OPENLOGIN_NETWORK_TYPE;
/**
* Uses core-kit key with web3auth provider
* @defaultValue false
*/
useCoreKitKey?: boolean;
/**
* WhiteLabel options for web3auth
*/
uiConfig?: WhiteLabelData;
/**
* Private key provider for your chain namespace
*/
privateKeyProvider?: IBaseProvider<string>;
}

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc