@particle-network/auth
Advanced tools
Comparing version 0.5.3 to 0.5.4
@@ -68,2 +68,4 @@ "use strict"; | ||
support_auth_types: (_a = config === null || config === void 0 ? void 0 : config.supportAuthTypes) !== null && _a !== void 0 ? _a : types_1.AuthTypes.join(","), | ||
account: config === null || config === void 0 ? void 0 : config.emailOrPhoneAccount, | ||
login_form_mode: config === null || config === void 0 ? void 0 : config.loginFormMode, | ||
}); | ||
@@ -70,0 +72,0 @@ return new Promise((resolve, reject) => { |
@@ -9,2 +9,3 @@ "use strict"; | ||
if (!config) { | ||
//for solana wallet adapter | ||
config = { | ||
@@ -18,11 +19,20 @@ projectId: "34c6b829-5b89-44e8-90a9-6d982787b9c9", | ||
} | ||
if (typeof config.chainName === "string" && | ||
typeof config.chainId === "number" && | ||
if ((!config.chainName || typeof config.chainName === "string") && | ||
(!config.chainId || typeof config.chainId === "number") && | ||
typeof config.projectId === "string" && | ||
typeof config.clientKey === "string" && | ||
typeof config.appId === "string") { | ||
if (!Object.keys(types_1.supportChains).includes(config.chainName) || | ||
!types_1.supportChains[config.chainName].includes(config.chainId)) { | ||
throw types_1.AuthError.unsupportedChain(); | ||
if (config.chainName) { | ||
if (!Object.keys(types_1.supportChains).includes(config.chainName) || | ||
(config.chainId && !types_1.supportChains[config.chainName].includes(config.chainId))) { | ||
throw types_1.AuthError.unsupportedChain(); | ||
} | ||
if (!config.chainId) { | ||
config.chainId = types_1.supportChains[config.chainName][0]; | ||
} | ||
} | ||
else { | ||
config.chainName = "ethereum"; | ||
config.chainId = 1; | ||
} | ||
this.config = config; | ||
@@ -38,4 +48,7 @@ this.auth = new auth_1.Auth(this.config); | ||
} | ||
setChainInfo(chain) { | ||
return this.auth.setChainInfo(chain); | ||
} | ||
} | ||
exports.ParticleNetwork = ParticleNetwork; | ||
//# sourceMappingURL=particle-network.js.map |
@@ -17,3 +17,5 @@ /// <reference types="node" /> | ||
preferredAuthType?: AuthType; | ||
emailOrPhoneAccount?: string; | ||
supportAuthTypes?: string; | ||
loginFormMode?: boolean; | ||
}): Promise<UserInfo>; | ||
@@ -20,0 +22,0 @@ logout(): Promise<void>; |
import { Auth } from "./auth"; | ||
import { UIMode, Config } from "./types"; | ||
import { UIMode, Config, ChainInfo, Wallet } from "./types"; | ||
export declare class ParticleNetwork { | ||
@@ -11,2 +11,3 @@ readonly auth: Auth; | ||
}): void; | ||
setChainInfo(chain: ChainInfo): Promise<Wallet[]>; | ||
} |
@@ -68,4 +68,4 @@ export declare class AuthError { | ||
appId: string; | ||
chainName: ChainName; | ||
chainId: number; | ||
chainName?: ChainName; | ||
chainId?: number; | ||
authUrl?: string; | ||
@@ -72,0 +72,0 @@ } |
{ | ||
"name": "@particle-network/auth", | ||
"version": "0.5.3", | ||
"version": "0.5.4", | ||
"files": [ | ||
@@ -5,0 +5,0 @@ "lib", |
Sorry, the diff of this file is not supported yet
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
53111
675