=> {
@@ -439,236 +297,137 @@ function App() {
privKey: new BN(coreKitInstance.metadataKey!, "hex"),
input: { message: "KEY_NOT_FOUND" },
});
- uiConsole('reset');
+ uiConsole("reset");
setProvider(null);
- }
-
- const sendTransaction = async () => {
- if (!web3) {
- uiConsole("web3 not initialized yet");
- return;
- }
- const fromAddress = (await web3.eth.getAccounts())[0];
-
- const destination = "0x2E464670992574A613f10F7682D5057fB507Cc21";
- const amount = web3.utils.toWei("0.0001"); // Convert 1 ether to wei
-
- // Submit transaction to the blockchain and wait for it to be mined
- uiConsole("Sending transaction...");
- const receipt = await web3.eth.sendTransaction({
- from: fromAddress,
- to: destination,
- value: amount,
- });
- uiConsole(receipt);
};
- const createSecurityQuestion = async (question: string, answer: string) => {
+ const exportTssKey = async () => {
if (!coreKitInstance) {
throw new Error("coreKitInstance is not set");
}
- await securityQuestion.setSecurityQuestion({ mpcCoreKit: coreKitInstance, question, answer, shareType: TssShareType.RECOVERY });
- setNewQuestion(undefined);
- let result = await securityQuestion.getQuestion(coreKitInstance);
- if (result) {
- setQuestion(question);
- }
- }
+ const key = await coreKitInstance._UNSAFE_exportTssKey();
+ console.log('key', key);
+ let web3Local = new Web3("https://eth.llamarpc.com");
- const changeSecurityQuestion = async (newQuestion: string, newAnswer: string, answer: string) => {
- if (!coreKitInstance) {
- throw new Error("coreKitInstance is not set");
- }
- await securityQuestion.changeSecurityQuestion({ mpcCoreKit: coreKitInstance, newQuestion, newAnswer, answer });
- let result = await securityQuestion.getQuestion(coreKitInstance);
- if (result) {
- setQuestion(question);
- }
- }
- const deleteSecurityQuestion = async () => {
- if (!coreKitInstance) {
- throw new Error("coreKitInstance is not set");
- }
- await securityQuestion.deleteSecurityQuestion(coreKitInstance);
- setQuestion(undefined);
-
- }
+ let account = web3Local.eth.accounts.privateKeyToAccount(`0x${key}`);
+ console.log('account', account);
+ let gas = await web3Local.eth.estimateGas({ to: "0x2E464670992574A613f10F7682D5057fB507Cc21", value: "1000000000000000000" })
+ let signedTx = await account.signTransaction({ to: "0x2E464670992574A613f10F7682D5057fB507Cc21", value: "1000000000000000000", gas: gas});
+ console.log('signedTx', signedTx);
+ return key;
+ };
- const enableMFA = async () => {
- if (!coreKitInstance) {
- throw new Error("coreKitInstance is not set");
+ const importTssKey = async (importedTssKey: string) => {
+ let email = window.prompt("Enter new email to import your key");
+ while (email == null) {
+ window.alert("Please enter valid/non-empty email");
+ email = window.prompt("Enter new email to import your key");
}
- const factorKey = await coreKitInstance.enableMFA({});
- const factorKeyMnemonic = await keyToMnemonic(factorKey);
- uiConsole("MFA enabled, device factor stored in local store, deleted hashed cloud key, your backup factor key: ", factorKeyMnemonic);
- }
+ setMockEmail(email);
+ setLoading(true);
+ // import key to new instance
+ let { idToken, parsedToken } = await mockLogin(email);
- const commit = async () => {
- if (!coreKitInstance) {
- throw new Error("coreKitInstance is not set");
- }
- await coreKitInstance.commitChanges();
- }
-
- const loggedInView = (
- <>
- Account Details
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Recovery/ Key Manipulation
-
-
Enabling MFA
-
-
-
-
Manual Factors Manipulation
-
-
-
-
-
-
-
-
- setFactorPubToDelete(e.target.value)}>
-
-
-
- setBackupFactorKey(e.target.value)}>
-
-
-
-
-
Security Question
-
-
{question}
-
-
-
-
-
-
-
- Blockchain Calls
-
-
-
-
-
+ const newCoreKitInstance = new Web3AuthMPCCoreKit({
+ web3AuthClientId: "BPi5PB_UiIZ-cPz1GtV5i1I2iOSOHuimiXBI0e-Oe_u6X3oVAbCiAZOTEBtTXw4tsluTITPqA8zMsfxIKMjiqNQ",
+ web3AuthNetwork: selectedNetwork,
+ uxMode: "redirect",
+ manualSync: true,
+ setupProviderOnInit: false,
+ });
+ await newCoreKitInstance.init({ handleRedirectResult: false, rehydrate: false });
+ uiConsole("TSS Private Key: ", importedTssKey);
+
+ await newCoreKitInstance.loginWithJWT({
+ verifier: "torus-test-health",
+ verifierId: parsedToken.email,
+ idToken: idToken,
+ importTssKey: importedTssKey,
+ });
+ uiConsole(JSON.stringify({
+ tssPriKey: importedTssKey,
+ coreKitStatus: newCoreKitInstance.status,
+ }));
+ coreKitInstance = newCoreKitInstance;
+
+ setUpProvider();
+ setCoreKitStatus(newCoreKitInstance.status);
+ setLoading(false);
+ };
-
-
-
+ const recoverTssKey = async (factorKeys: string[]) => {
+ const recoverMpcInstance = new Web3AuthMPCCoreKit({
+ web3AuthClientId: "BPi5PB_UiIZ-cPz1GtV5i1I2iOSOHuimiXBI0e-Oe_u6X3oVAbCiAZOTEBtTXw4tsluTITPqA8zMsfxIKMjiqNQ",
+ web3AuthNetwork: selectedNetwork,
+ uxMode: "redirect",
+ manualSync: true,
+ setupProviderOnInit: false,
+ // sessionTime: 3600, // <== can provide variable session time based on user subscribed plan
+ });
+ await recoverMpcInstance.init({ handleRedirectResult: false, rehydrate: false });
+
+ let recoveredTssKey = await recoverMpcInstance._UNSAFE_recoverTssKey(factorKeys);
+ uiConsole("Recovered TSS Private Key: ", recoveredTssKey);
+ // let web3Local = new Web3("https://eth.llamarpc.com");
+ // let account = web3Local.eth.accounts.privateKeyToAccount(recoveredTssKey);
+ // let signedTx = await account.signTransaction({ to: "0x2E464670992574A613f10F7682D5057fB507Cc21", value: "1000000000000000000" });
+ // console.log(signedTx);
+ return recoveredTssKey;
+ };
-
+ const exportTssKeyImportTssKey = async (newOauthLogin?: string) => {
+ console.log('exportTssKeyImportTssKeyFunc', newOauthLogin);
+ let key = await exportTssKey();
+ console.log('key', key);
+ await logout();
+ // wait for 2 sec before import and login
+ await new Promise(r => setTimeout(r, 2000));
+ await importTssKey(key);
+ };
-
+ const recoverTssKeyImportTssKey = async () => {
+ const deviceShare = isHex(deviceFactorKey) ? deviceFactorKey : mnemonicToKey(deviceFactorKey);
+ const recoveryShare = isHex(recoveryFactor) ? recoveryFactor : mnemonicToKey(recoveryFactor);
+ const factorKeys = [deviceShare, recoveryShare];
+ let key = await recoverTssKey(factorKeys);
+ await importTssKey(key);
+ };
-
+ const getPubXFromFactorKey = async (recoveryFactor: string) => {
+ const factorKey = isHex(recoveryFactor) ? recoveryFactor : mnemonicToKey(recoveryFactor);
+ // start with a new initialized instance
+ const coreKitInst = new Web3AuthMPCCoreKit({
+ web3AuthClientId: "BPi5PB_UiIZ-cPz1GtV5i1I2iOSOHuimiXBI0e-Oe_u6X3oVAbCiAZOTEBtTXw4tsluTITPqA8zMsfxIKMjiqNQ",
+ web3AuthNetwork: selectedNetwork,
+ uxMode: "redirect",
+ manualSync: true,
+ setupProviderOnInit: false,
+ });
+ await coreKitInst.init({ handleRedirectResult: false, rehydrate: false });
-
+ const factorKeyBN = new BN(factorKey, "hex");
-
+ const factorKeyMetadata = await coreKitInst.tKey?.storageLayer.getMetadata({ privKey: factorKeyBN });
+ if (!factorKeyMetadata || factorKeyMetadata.message === "KEY_NOT_FOUND") {
+ throw new Error("no metadata for your factor key, reset your account");
+ }
-
-
- >
- );
+ const shareStore0 = ShareStore.fromJSON(factorKeyMetadata);
+ await coreKitInst.tKey.initialize({ withShare: shareStore0 });
+ let pubX = coreKitInst.tKey.getMetadata().pubKey.x.toString("hex");
+
+ // reset to initialized instance
+ await coreKitInst.init();
+ console.log('pubX', pubX);
+ return pubX;
+ }
const unloggedInView = (
<>
- setMockEmail(e.target.value)}>
+
+ setMockEmail(e.target.value)} />
@@ -676,8 +435,7 @@ function App() {
-
-
+
@@ -689,10 +447,7 @@ function App() {
-
-
-
setAnswer(e.target.value)}>
@@ -700,12 +455,31 @@ function App() {
Recover Using Security Answer
-
-
+
+
+
Recover account with factors
+
+
+
+ {loading &&
}```
+
>
);
@@ -714,17 +488,35 @@ function App() {
-
{coreKitStatus === COREKIT_STATUS.LOGGED_IN ? loggedInView : unloggedInView}
+
+ {coreKitStatus === COREKIT_STATUS.LOGGED_IN ? (
+
+ ) : (
+ unloggedInView
+ )}
+
diff --git a/demo/redirect-flow-example/src/LoggedinView.tsx b/demo/redirect-flow-example/src/LoggedinView.tsx
new file mode 100644
index 00000000..83b7c856
--- /dev/null
+++ b/demo/redirect-flow-example/src/LoggedinView.tsx
@@ -0,0 +1,207 @@
+import { Web3AuthMPCCoreKit, Point, keyToMnemonic, TssShareType, generateFactorKey, mnemonicToKey } from "@web3auth/mpc-core-kit";
+import { useState } from "react";
+import SecurityQuestion from "./components/SecurityQuestion";
+import BlockchainCalls from "./components/BlockchainCalls";
+import { CHAIN_NAMESPACE } from "./utils";
+import Web3 from "web3";
+import LoadingSpinner from "./components/LoadingIndicator";
+
+interface ILoggedinViewProps {
+ web3: Web3;
+ coreKitInstance: Web3AuthMPCCoreKit;
+ criticalResetAccount: () => void;
+ logout: () => void;
+ switchChain: (namespace: CHAIN_NAMESPACE) => void;
+ inputBackupFactorKey: () => void;
+ exportImportTssKey: () => void;
+}
+
+function uiConsole(...args: any[]): void {
+ const el = document.querySelector("#console>p");
+ if (el) {
+ el.innerHTML = JSON.stringify(args || {}, null, 2);
+ }
+ console.log(...args);
+}
+
+function LoggedinView({ web3, coreKitInstance, criticalResetAccount, logout, inputBackupFactorKey, switchChain, exportImportTssKey }: ILoggedinViewProps) {
+ const [exportTssShareType, setExportTssShareType] = useState
(TssShareType.DEVICE);
+ const [factorPubToDelete, setFactorPubToDelete] = useState("");
+ const [backupFactorKey, setBackupFactorKey] = useState(undefined);
+ const [loading, setLoading] = useState(false);
+
+ const getUserInfo = async () => {
+ const userInfo = coreKitInstance.getUserInfo();
+ uiConsole(userInfo);
+ };
+
+ const keyDetails = async () => {
+ if (!coreKitInstance) {
+ throw new Error("coreKitInstance not found");
+ }
+ uiConsole(coreKitInstance.getKeyDetails());
+ };
+
+ const listFactors = async () => {
+ if (!coreKitInstance) {
+ throw new Error("coreKitInstance not found");
+ }
+ const factorPubs = coreKitInstance.tKey.metadata.factorPubs;
+ if (!factorPubs) {
+ throw new Error("factorPubs not found");
+ }
+ const pubsHex = factorPubs[coreKitInstance.tKey.tssTag].map((pub: any) => {
+ return Point.fromTkeyPoint(pub).toBufferSEC1(true).toString("hex");
+ });
+ uiConsole(pubsHex);
+ };
+
+ const commit = async () => {
+ if (!coreKitInstance) {
+ throw new Error("coreKitInstance is not set");
+ }
+ await coreKitInstance.commitChanges();
+ };
+
+ const enableMFA = async () => {
+ setLoading(true);
+ if (!coreKitInstance) {
+ throw new Error("coreKitInstance is not set");
+ }
+ const factorKey = await coreKitInstance.enableMFA({});
+ const factorKeyMnemonic = keyToMnemonic(factorKey);
+
+ uiConsole("MFA enabled, device factor stored in local store, deleted hashed cloud key, your backup factor key: ", factorKeyMnemonic);
+ setLoading(false);
+ };
+
+ const exportFactor = async (): Promise => {
+ if (!coreKitInstance) {
+ throw new Error("coreKitInstance is not set");
+ }
+ uiConsole("export share type: ", exportTssShareType);
+ const factorKey = generateFactorKey();
+ await coreKitInstance.createFactor({
+ shareType: exportTssShareType,
+ factorKey: factorKey.private,
+ });
+ let mnemonic = keyToMnemonic(factorKey.private.toString("hex"));
+ let key = mnemonicToKey(mnemonic);
+
+ uiConsole("Export factor key: ", factorKey);
+ console.log("menmonic : ", mnemonic);
+ console.log("key: ", key);
+ };
+
+ const deleteFactor = async (): Promise => {
+ if (!coreKitInstance) {
+ throw new Error("coreKitInstance is not set");
+ }
+ const pubBuffer = Buffer.from(factorPubToDelete, "hex");
+ const pub = Point.fromBufferSEC1(pubBuffer);
+ await coreKitInstance.deleteFactor(pub.toTkeyPoint());
+ uiConsole("factor deleted");
+ };
+
+ const unsafeExportTssKey = async () => {
+ const exportedTssKey = await coreKitInstance._UNSAFE_exportTssKey();
+ let web3Local = new Web3("https://eth.llamarpc.com");
+
+ let account = web3Local.eth.accounts.privateKeyToAccount(`0x${exportedTssKey}`);
+ console.log('account', account);
+ let gas = await web3Local.eth.estimateGas({ to: "0x2E464670992574A613f10F7682D5057fB507Cc21", value: "1000000000000000000" })
+ let signedTx = await account.signTransaction({ to: "0x2E464670992574A613f10F7682D5057fB507Cc21", value: "1000000000000000000", gas: gas});
+ console.log('signedTx', signedTx);
+ uiConsole(exportedTssKey);
+ }
+
+ const exportAndImportTssKey = () => {
+ console.log('exportAndImportTssKey', exportAndImportTssKey);
+ exportImportTssKey();
+ }
+
+ return (
+
+
Account Details
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Recovery/ Key Manipulation
+
+
Enabling MFA
+
+
+
+
Manual Factors Manipulation
+
+
+
+
+
+
+
+ setFactorPubToDelete(e.target.value)}>
+
+
+
+ setBackupFactorKey(e.target.value)}>
+
+
+
+
+
+
+
+
+ {loading &&
}
+
+ );
+}
+
+export default LoggedinView;
diff --git a/demo/redirect-flow-example/src/components/BlockchainCalls.tsx b/demo/redirect-flow-example/src/components/BlockchainCalls.tsx
new file mode 100644
index 00000000..9ee5367d
--- /dev/null
+++ b/demo/redirect-flow-example/src/components/BlockchainCalls.tsx
@@ -0,0 +1,152 @@
+import Web3 from "web3";
+import { Web3AuthMPCCoreKit } from "@web3auth/mpc-core-kit";
+import { CHAIN_CONFIGS, uiConsole } from "../utils";
+
+interface IBlockchainCalls {
+ web3: Web3;
+ coreKitInstance: Web3AuthMPCCoreKit;
+ switchChain: (namespace: keyof typeof CHAIN_CONFIGS) => void;
+}
+
+const BlockchainCalls = ({ web3, coreKitInstance, switchChain }: IBlockchainCalls) => {
+
+ const getChainID = async () => {
+ if (!web3) {
+ uiConsole("web3 not initialized yet");
+ return;
+ }
+ const chainId = await web3.eth.getChainId();
+ uiConsole(chainId);
+ return chainId;
+ };
+
+ const getAccounts = async () => {
+ if (!web3) {
+ uiConsole("web3 not initialized yet");
+ return;
+ }
+ const address = (await web3.eth.getAccounts())[0];
+ uiConsole(address);
+ return address;
+ };
+
+ const setTSSWalletIndex = async (index=0) => {
+ coreKitInstance.setTssWalletIndex(index);
+ // log new account details
+ await getAccounts();
+ }
+
+ const getBalance = async () => {
+ if (!web3) {
+ uiConsole("web3 not initialized yet");
+ return;
+ }
+ const address = (await web3.eth.getAccounts())[0];
+ const balance = web3.utils.fromWei(
+ await web3.eth.getBalance(address) // Balance is in wei
+ );
+ uiConsole(balance);
+ return balance;
+ };
+
+ const signMessage = async (): Promise => {
+ if (!web3) {
+ uiConsole("web3 not initialized yet");
+ return;
+ }
+ const fromAddress = (await web3.eth.getAccounts())[0];
+ const originalMessage = [
+ {
+ type: "string",
+ name: "fullName",
+ value: "Satoshi Nakamoto",
+ },
+ {
+ type: "uint32",
+ name: "userId",
+ value: "1212",
+ },
+ ];
+ const params = [originalMessage, fromAddress];
+ const method = "eth_signTypedData";
+ const signedMessage = await (web3.currentProvider as any)?.sendAsync({
+ id: 1,
+ method,
+ params,
+ fromAddress,
+ });
+ uiConsole(signedMessage);
+ };
+
+ const sendTransaction = async () => {
+ if (!web3) {
+ uiConsole("web3 not initialized yet");
+ return;
+ }
+ const fromAddress = (await web3.eth.getAccounts())[0];
+
+ const destination = "0x2E464670992574A613f10F7682D5057fB507Cc21";
+ const amount = web3.utils.toWei("0.0001"); // Convert 1 ether to wei
+
+ // Submit transaction to the blockchain and wait for it to be mined
+ uiConsole("Sending transaction...");
+ const receipt = await web3.eth.sendTransaction({
+ from: fromAddress,
+ to: destination,
+ value: amount,
+ });
+ uiConsole(receipt);
+ };
+
+ return (
+ <>
+ Blockchain Calls
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ >
+ )
+}
+
+export default BlockchainCalls;
diff --git a/demo/redirect-flow-example/src/components/LoadingIndicator.tsx b/demo/redirect-flow-example/src/components/LoadingIndicator.tsx
new file mode 100644
index 00000000..3832e0fe
--- /dev/null
+++ b/demo/redirect-flow-example/src/components/LoadingIndicator.tsx
@@ -0,0 +1,18 @@
+import "./styles.css";
+
+const LoadingSpinner = () => {
+ return (
+
+ );
+}
+
+export default LoadingSpinner;
diff --git a/demo/redirect-flow-example/src/components/SecurityQuestion.tsx b/demo/redirect-flow-example/src/components/SecurityQuestion.tsx
new file mode 100644
index 00000000..2696148b
--- /dev/null
+++ b/demo/redirect-flow-example/src/components/SecurityQuestion.tsx
@@ -0,0 +1,88 @@
+import { useState } from "react";
+import { TssSecurityQuestion, TssShareType, Web3AuthMPCCoreKit } from "@web3auth/mpc-core-kit";
+
+
+interface ISecurityQuestionProps {
+ // createSecurityQuestion: (question: string, answer: string) => void;
+ // changeSecurityQuestion: (question: string, newAnswer: string, oldAnswer: string) => void;
+ // deleteSecurityQuestion: () => void;
+ coreKitInstance: Web3AuthMPCCoreKit
+}
+
+const SecurityQuestion = ({ coreKitInstance }: ISecurityQuestionProps) => {
+ const securityQuestion: TssSecurityQuestion = new TssSecurityQuestion();
+
+ const [question, setQuestion] = useState(undefined);
+ const [newQuestion, setNewQuestion] = useState(undefined);
+ const [answer, setAnswer] = useState(undefined);
+ const [newAnswer, setNewAnswer] = useState(undefined);
+
+ const createSecurityQuestion = async (question: string, answer: string) => {
+ if (!coreKitInstance) {
+ throw new Error("coreKitInstance is not set");
+ }
+ await securityQuestion.setSecurityQuestion({ mpcCoreKit: coreKitInstance, question, answer, shareType: TssShareType.RECOVERY });
+ setNewQuestion(undefined);
+ let result = securityQuestion.getQuestion(coreKitInstance);
+ if (result) {
+ setQuestion(question);
+ }
+ }
+
+ const changeSecurityQuestion = async (newQuestion: string, newAnswer: string, answer: string) => {
+ if (!coreKitInstance) {
+ throw new Error("coreKitInstance is not set");
+ }
+ await securityQuestion.changeSecurityQuestion({ mpcCoreKit: coreKitInstance, newQuestion, newAnswer, answer });
+ let result = securityQuestion.getQuestion(coreKitInstance);
+ if (result) {
+ setQuestion(question);
+ }
+ }
+
+ const deleteSecurityQuestion = async () => {
+ if (!coreKitInstance) {
+ throw new Error("coreKitInstance is not set");
+ }
+ await securityQuestion.deleteSecurityQuestion(coreKitInstance);
+ setQuestion(undefined);
+ }
+
+ return (
+ <>
+ Security Question
+
+ {question}
+
+
+
+
+
+
+ >
+ )
+}
+
+export default SecurityQuestion;
diff --git a/demo/redirect-flow-example/src/components/styles.css b/demo/redirect-flow-example/src/components/styles.css
new file mode 100644
index 00000000..7398c828
--- /dev/null
+++ b/demo/redirect-flow-example/src/components/styles.css
@@ -0,0 +1,54 @@
+.lds-wrapper {
+ position: absolute;
+ width: 100vw;
+ height: 100vh;
+ top: 0;
+ left: 0;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ background: rgba(0, 0, 0, 0.2);
+}
+
+.lds-container {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+}
+
+.lds-ring {
+ display: inline-block;
+ position: relative;
+ width: 80px;
+ height: 80px;
+}
+.lds-ring div {
+ box-sizing: border-box;
+ display: block;
+ position: absolute;
+ width: 64px;
+ height: 64px;
+ margin: 8px;
+ border: 5px solid #0346ff;
+ border-radius: 50%;
+ animation: lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
+ border-color: #0346ff transparent transparent transparent;
+}
+.lds-ring div:nth-child(1) {
+ animation-delay: -0.45s;
+}
+.lds-ring div:nth-child(2) {
+ animation-delay: -0.3s;
+}
+.lds-ring div:nth-child(3) {
+ animation-delay: -0.15s;
+}
+@keyframes lds-ring {
+ 0% {
+ transform: rotate(0deg);
+ }
+ 100% {
+ transform: rotate(360deg);
+ }
+}
\ No newline at end of file
diff --git a/demo/redirect-flow-example/src/utils.ts b/demo/redirect-flow-example/src/utils.ts
new file mode 100644
index 00000000..347dfa25
--- /dev/null
+++ b/demo/redirect-flow-example/src/utils.ts
@@ -0,0 +1,50 @@
+import { CHAIN_NAMESPACES } from "@web3auth/base";
+
+export function uiConsole(...args: any[]): void {
+ const el = document.querySelector("#console>p");
+ if (el) {
+ el.innerHTML = JSON.stringify(args || {}, null, 2);
+ }
+ console.log(...args);
+};
+
+export const CHAIN_CONFIGS = {
+ SEPOLIA: {
+ chainId: "0xaa36a7", // for wallet connect make sure to pass in this chain in the loginSettings of the adapter.
+ displayName: "Ethereum Sepolia",
+ chainNamespace: CHAIN_NAMESPACES.EIP155,
+ tickerName: "Ethereum Sepolia",
+ ticker: "ETH",
+ decimals: 18,
+ rpcTarget: "https://rpc.ankr.com/eth_sepolia",
+ blockExplorer: "https://sepolia.etherscan.io",
+ logo: "https://cryptologos.cc/logos/ethereum-eth-logo.png",
+ },
+ POLYGON: {
+ chainNamespace: CHAIN_NAMESPACES.EIP155,
+ chainId: "0x89", // hex of 137, polygon mainnet
+ rpcTarget: "https://rpc.ankr.com/polygon",
+ // Avoid using public rpcTarget in production.
+ // Use services like Infura, Quicknode etc
+ displayName: "Polygon Mainnet",
+ blockExplorer: "https://polygonscan.com",
+ ticker: "MATIC",
+ tickerName: "MATIC",
+ },
+ OPBNB: {
+ chainNamespace: CHAIN_NAMESPACES.EIP155,
+ chainId: "0xCC", // hex of 1261120
+ rpcTarget: "https://opbnb-mainnet-rpc.bnbchain.org",
+ // Avoid using public rpcTarget in production.
+ // Use services like Infura, Quicknode etc
+ displayName: "opBNB Mainnet",
+ blockExplorer: "https://opbnbscan.com",
+ ticker: "BNB",
+ tickerName: "opBNB",
+ },
+}
+export type CHAIN_NAMESPACE = keyof typeof CHAIN_CONFIGS;
+
+export function isHex(val: string) {
+ return Boolean(val.match(/^(0x)?[0-9a-f]+$/i))
+}
diff --git a/package-lock.json b/package-lock.json
index 9b54d0c2..19327fec 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -3150,12 +3150,12 @@
}
},
"node_modules/@ljharb/through": {
- "version": "2.3.12",
- "resolved": "https://registry.npmjs.org/@ljharb/through/-/through-2.3.12.tgz",
- "integrity": "sha512-ajo/heTlG3QgC8EGP6APIejksVAYt4ayz4tqoP3MolFELzcH1x1fzwEYRJTPO0IELutZ5HQ0c26/GqAYy79u3g==",
+ "version": "2.3.13",
+ "resolved": "https://registry.npmjs.org/@ljharb/through/-/through-2.3.13.tgz",
+ "integrity": "sha512-/gKJun8NNiWGZJkGzI/Ragc53cOdcLNdzjLaIa+GEjguQs0ulsurx8WN0jijdK9yPqDvziX995sMRLyLt1uZMQ==",
"dev": true,
"dependencies": {
- "call-bind": "^1.0.5"
+ "call-bind": "^1.0.7"
},
"engines": {
"node": ">= 0.4"
@@ -3365,6 +3365,21 @@
"node": ">= 18"
}
},
+ "node_modules/@octokit/core/node_modules/@octokit/openapi-types": {
+ "version": "20.0.0",
+ "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz",
+ "integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA==",
+ "dev": true
+ },
+ "node_modules/@octokit/core/node_modules/@octokit/types": {
+ "version": "12.6.0",
+ "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz",
+ "integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==",
+ "dev": true,
+ "dependencies": {
+ "@octokit/openapi-types": "^20.0.0"
+ }
+ },
"node_modules/@octokit/endpoint": {
"version": "9.0.4",
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-9.0.4.tgz",
@@ -3378,6 +3393,21 @@
"node": ">= 18"
}
},
+ "node_modules/@octokit/endpoint/node_modules/@octokit/openapi-types": {
+ "version": "20.0.0",
+ "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz",
+ "integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA==",
+ "dev": true
+ },
+ "node_modules/@octokit/endpoint/node_modules/@octokit/types": {
+ "version": "12.6.0",
+ "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz",
+ "integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==",
+ "dev": true,
+ "dependencies": {
+ "@octokit/openapi-types": "^20.0.0"
+ }
+ },
"node_modules/@octokit/graphql": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-7.0.2.tgz",
@@ -3392,12 +3422,27 @@
"node": ">= 18"
}
},
- "node_modules/@octokit/openapi-types": {
+ "node_modules/@octokit/graphql/node_modules/@octokit/openapi-types": {
"version": "20.0.0",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz",
"integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA==",
"dev": true
},
+ "node_modules/@octokit/graphql/node_modules/@octokit/types": {
+ "version": "12.6.0",
+ "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz",
+ "integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==",
+ "dev": true,
+ "dependencies": {
+ "@octokit/openapi-types": "^20.0.0"
+ }
+ },
+ "node_modules/@octokit/openapi-types": {
+ "version": "22.1.0",
+ "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-22.1.0.tgz",
+ "integrity": "sha512-pGUdSP+eEPfZiQHNkZI0U01HLipxncisdJQB4G//OAmfeO8sqTQ9KRa0KF03TUPCziNsoXUrTg4B2Q1EX++T0Q==",
+ "dev": true
+ },
"node_modules/@octokit/plugin-paginate-rest": {
"version": "9.2.0",
"resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-9.2.0.tgz",
@@ -3413,6 +3458,21 @@
"@octokit/core": ">=5"
}
},
+ "node_modules/@octokit/plugin-paginate-rest/node_modules/@octokit/openapi-types": {
+ "version": "20.0.0",
+ "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz",
+ "integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA==",
+ "dev": true
+ },
+ "node_modules/@octokit/plugin-paginate-rest/node_modules/@octokit/types": {
+ "version": "12.6.0",
+ "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz",
+ "integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==",
+ "dev": true,
+ "dependencies": {
+ "@octokit/openapi-types": "^20.0.0"
+ }
+ },
"node_modules/@octokit/plugin-request-log": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/@octokit/plugin-request-log/-/plugin-request-log-4.0.0.tgz",
@@ -3440,15 +3500,30 @@
"@octokit/core": ">=5"
}
},
+ "node_modules/@octokit/plugin-rest-endpoint-methods/node_modules/@octokit/openapi-types": {
+ "version": "20.0.0",
+ "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz",
+ "integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA==",
+ "dev": true
+ },
+ "node_modules/@octokit/plugin-rest-endpoint-methods/node_modules/@octokit/types": {
+ "version": "12.6.0",
+ "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz",
+ "integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==",
+ "dev": true,
+ "dependencies": {
+ "@octokit/openapi-types": "^20.0.0"
+ }
+ },
"node_modules/@octokit/request": {
- "version": "8.2.0",
- "resolved": "https://registry.npmjs.org/@octokit/request/-/request-8.2.0.tgz",
- "integrity": "sha512-exPif6x5uwLqv1N1irkLG1zZNJkOtj8bZxuVHd71U5Ftuxf2wGNvAJyNBcPbPC+EBzwYEbBDdSFb8EPcjpYxPQ==",
+ "version": "8.4.0",
+ "resolved": "https://registry.npmjs.org/@octokit/request/-/request-8.4.0.tgz",
+ "integrity": "sha512-9Bb014e+m2TgBeEJGEbdplMVWwPmL1FPtggHQRkV+WVsMggPtEkLKPlcVYm/o8xKLkpJ7B+6N8WfQMtDLX2Dpw==",
"dev": true,
"dependencies": {
- "@octokit/endpoint": "^9.0.0",
- "@octokit/request-error": "^5.0.0",
- "@octokit/types": "^12.0.0",
+ "@octokit/endpoint": "^9.0.1",
+ "@octokit/request-error": "^5.1.0",
+ "@octokit/types": "^13.1.0",
"universal-user-agent": "^6.0.0"
},
"engines": {
@@ -3456,12 +3531,12 @@
}
},
"node_modules/@octokit/request-error": {
- "version": "5.0.1",
- "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-5.0.1.tgz",
- "integrity": "sha512-X7pnyTMV7MgtGmiXBwmO6M5kIPrntOXdyKZLigNfQWSEQzVxR4a4vo49vJjTWX70mPndj8KhfT4Dx+2Ng3vnBQ==",
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-5.1.0.tgz",
+ "integrity": "sha512-GETXfE05J0+7H2STzekpKObFe765O5dlAKUTLNGeH+x47z7JjXHfsHKo5z21D/o/IOZTUEI6nyWyR+bZVP/n5Q==",
"dev": true,
"dependencies": {
- "@octokit/types": "^12.0.0",
+ "@octokit/types": "^13.1.0",
"deprecation": "^2.0.0",
"once": "^1.4.0"
},
@@ -3470,27 +3545,27 @@
}
},
"node_modules/@octokit/rest": {
- "version": "20.0.2",
- "resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-20.0.2.tgz",
- "integrity": "sha512-Ux8NDgEraQ/DMAU1PlAohyfBBXDwhnX2j33Z1nJNziqAfHi70PuxkFYIcIt8aIAxtRE7KVuKp8lSR8pA0J5iOQ==",
+ "version": "20.1.0",
+ "resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-20.1.0.tgz",
+ "integrity": "sha512-STVO3itHQLrp80lvcYB2UIKoeil5Ctsgd2s1AM+du3HqZIR35ZH7WE9HLwUOLXH0myA0y3AGNPo8gZtcgIbw0g==",
"dev": true,
"dependencies": {
- "@octokit/core": "^5.0.0",
- "@octokit/plugin-paginate-rest": "^9.0.0",
+ "@octokit/core": "^5.0.2",
+ "@octokit/plugin-paginate-rest": "^9.1.5",
"@octokit/plugin-request-log": "^4.0.0",
- "@octokit/plugin-rest-endpoint-methods": "^10.0.0"
+ "@octokit/plugin-rest-endpoint-methods": "^10.2.0"
},
"engines": {
"node": ">= 18"
}
},
"node_modules/@octokit/types": {
- "version": "12.6.0",
- "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz",
- "integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==",
+ "version": "13.4.1",
+ "resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.4.1.tgz",
+ "integrity": "sha512-Y73oOAzRBAUzR/iRAbGULzpNkX8vaxKCqEtg6K74Ff3w9f5apFnWtE/2nade7dMWWW3bS5Kkd6DJS4HF04xreg==",
"dev": true,
"dependencies": {
- "@octokit/openapi-types": "^20.0.0"
+ "@octokit/openapi-types": "^22.1.0"
}
},
"node_modules/@pkgjs/parseargs": {
@@ -3844,9 +3919,9 @@
]
},
"node_modules/@rushstack/eslint-patch": {
- "version": "1.7.2",
- "resolved": "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.7.2.tgz",
- "integrity": "sha512-RbhOOTCNoCrbfkRyoXODZp75MlpiHMgbE5MEBZAnnnLyQNgrigEj4p0lzsMDyc1zVsJDLrivB58tgg3emX0eEA==",
+ "version": "1.10.2",
+ "resolved": "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.10.2.tgz",
+ "integrity": "sha512-hw437iINopmQuxWPSUEvqE56NCPsiU8N4AYtfHmJFckclktzK9YQJieD3XkDCDH4OjL+C7zgPUh73R/nrcHrqw==",
"dev": true
},
"node_modules/@scure/base": {
@@ -3913,9 +3988,9 @@
}
},
"node_modules/@socket.io/component-emitter": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.0.tgz",
- "integrity": "sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg=="
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.1.tgz",
+ "integrity": "sha512-dzJtaDAAoXx4GCOJpbB2eG/Qj8VDpdwkLsWGzGm+0L7E8/434RyMbAHmk9ubXWVAb9nXmc44jUf8GKqVDiKezg=="
},
"node_modules/@szmarczak/http-timer": {
"version": "5.0.1",
@@ -5288,9 +5363,9 @@
}
},
"node_modules/@types/eslint": {
- "version": "8.56.5",
- "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.56.5.tgz",
- "integrity": "sha512-u5/YPJHo1tvkSF2CE0USEkxon82Z5DBy2xR+qfyYNszpX9qcs4sT6uq2kBbj4BXY1+DBGDPnrhMZV3pKWGNukw==",
+ "version": "8.56.9",
+ "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.56.9.tgz",
+ "integrity": "sha512-W4W3KcqzjJ0sHg2vAq9vfml6OhsJ53TcUjUqfzzZf/EChUtwspszj/S0pzMxnfRcO55/iGq47dscXw71Fxc4Zg==",
"dev": true,
"dependencies": {
"@types/estree": "*",
@@ -5700,27 +5775,26 @@
"integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==",
"dev": true
},
- "node_modules/@walletconnect/types": {
- "version": "1.8.0",
- "resolved": "https://registry.npmjs.org/@walletconnect/types/-/types-1.8.0.tgz",
- "integrity": "sha512-Cn+3I0V0vT9ghMuzh1KzZvCkiAxTq+1TR2eSqw5E5AVWfmCtECFkVZBP6uUJZ8YjwLqXheI+rnjqPy7sVM4Fyg==",
- "deprecated": "WalletConnect's v1 SDKs are now deprecated. Please upgrade to a v2 SDK. For details see: https://docs.walletconnect.com/"
- },
- "node_modules/@web3auth-mpc/base": {
- "version": "2.1.9",
- "resolved": "https://registry.npmjs.org/@web3auth-mpc/base/-/base-2.1.9.tgz",
- "integrity": "sha512-T91A+1Vu4C3//5Hj94bhMUaerOu3nVwGfELON2FH16yXNPQsNZPwyBuBoROUYdTp4fOZvCG4OtLiw+g8dPncaA==",
+ "node_modules/@walletconnect/jsonrpc-types": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/@walletconnect/jsonrpc-types/-/jsonrpc-types-1.0.3.tgz",
+ "integrity": "sha512-iIQ8hboBl3o5ufmJ8cuduGad0CQm3ZlsHtujv9Eu16xq89q+BG7Nh5VLxxUgmtpnrePgFkTwXirCTkwJH1v+Yw==",
"dependencies": {
- "@toruslabs/http-helpers": "^3.2.0",
- "@toruslabs/openlogin-jrpc": "^2.6.0",
- "jwt-decode": "^3.1.2",
- "loglevel": "^1.8.0",
- "ts-custom-error": "^3.2.2"
- },
- "peerDependencies": {
- "@babel/runtime": "^7.x"
+ "keyvaluestorage-interface": "^1.0.0",
+ "tslib": "1.14.1"
}
},
+ "node_modules/@walletconnect/jsonrpc-types/node_modules/tslib": {
+ "version": "1.14.1",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
+ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="
+ },
+ "node_modules/@walletconnect/relay-api/node_modules/tslib": {
+ "version": "1.14.1",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
+ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==",
+ "extraneous": true
+ },
"node_modules/@web3auth-mpc/base-provider": {
"version": "2.1.9",
"resolved": "https://registry.npmjs.org/@web3auth-mpc/base-provider/-/base-provider-2.1.9.tgz",
@@ -5736,7 +5810,7 @@
"@babel/runtime": "7.x"
}
},
- "node_modules/@web3auth-mpc/base/node_modules/@toruslabs/http-helpers": {
+ "node_modules/@web3auth-mpc/base-provider/node_modules/@toruslabs/http-helpers": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/@toruslabs/http-helpers/-/http-helpers-3.4.0.tgz",
"integrity": "sha512-CoeJSL32mpp0gmYjxv48odu6pfjHk/rbJHDwCtYPcMHAl+qUQ/DTpVOOn9U0fGkD+fYZrQmZbRkXFgLhiT0ajQ==",
@@ -5758,6 +5832,21 @@
}
}
},
+ "node_modules/@web3auth-mpc/base-provider/node_modules/@web3auth-mpc/base": {
+ "version": "2.1.9",
+ "resolved": "https://registry.npmjs.org/@web3auth-mpc/base/-/base-2.1.9.tgz",
+ "integrity": "sha512-T91A+1Vu4C3//5Hj94bhMUaerOu3nVwGfELON2FH16yXNPQsNZPwyBuBoROUYdTp4fOZvCG4OtLiw+g8dPncaA==",
+ "dependencies": {
+ "@toruslabs/http-helpers": "^3.2.0",
+ "@toruslabs/openlogin-jrpc": "^2.6.0",
+ "jwt-decode": "^3.1.2",
+ "loglevel": "^1.8.0",
+ "ts-custom-error": "^3.2.2"
+ },
+ "peerDependencies": {
+ "@babel/runtime": "^7.x"
+ }
+ },
"node_modules/@web3auth-mpc/ethereum-provider": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/@web3auth-mpc/ethereum-provider/-/ethereum-provider-2.3.0.tgz",
@@ -5789,23 +5878,36 @@
"resolved": "https://registry.npmjs.org/@toruslabs/http-helpers/-/http-helpers-3.4.0.tgz",
"integrity": "sha512-CoeJSL32mpp0gmYjxv48odu6pfjHk/rbJHDwCtYPcMHAl+qUQ/DTpVOOn9U0fGkD+fYZrQmZbRkXFgLhiT0ajQ==",
"dependencies": {
- "lodash.merge": "^4.6.2",
- "loglevel": "^1.8.1"
- },
- "engines": {
- "node": ">=14.17.0",
- "npm": ">=6.x"
+ "@walletconnect/jsonrpc-types": "^1.0.2",
+ "tslib": "1.14.1"
+ }
+ },
+ "node_modules/@web3auth-mpc/ethereum-provider/node_modules/@walletconnect/types": {
+ "version": "1.8.0",
+ "resolved": "https://registry.npmjs.org/@walletconnect/types/-/types-1.8.0.tgz",
+ "integrity": "sha512-Cn+3I0V0vT9ghMuzh1KzZvCkiAxTq+1TR2eSqw5E5AVWfmCtECFkVZBP6uUJZ8YjwLqXheI+rnjqPy7sVM4Fyg==",
+ "deprecated": "WalletConnect's v1 SDKs are now deprecated. Please upgrade to a v2 SDK. For details see: https://docs.walletconnect.com/"
+ },
+ "node_modules/@web3auth-mpc/ethereum-provider/node_modules/@web3auth-mpc/base": {
+ "version": "2.1.9",
+ "resolved": "https://registry.npmjs.org/@web3auth-mpc/base/-/base-2.1.9.tgz",
+ "integrity": "sha512-T91A+1Vu4C3//5Hj94bhMUaerOu3nVwGfELON2FH16yXNPQsNZPwyBuBoROUYdTp4fOZvCG4OtLiw+g8dPncaA==",
+ "dependencies": {
+ "@toruslabs/http-helpers": "^3.2.0",
+ "@toruslabs/openlogin-jrpc": "^2.6.0",
+ "jwt-decode": "^3.1.2",
+ "loglevel": "^1.8.0",
+ "ts-custom-error": "^3.2.2"
},
"peerDependencies": {
- "@babel/runtime": "^7.x",
- "@sentry/types": "^7.x"
- },
- "peerDependenciesMeta": {
- "@sentry/types": {
- "optional": true
- }
+ "@babel/runtime": "^7.x"
}
},
+ "node_modules/@web3auth-mpc/ethereum-provider/node_modules/tslib": {
+ "version": "1.14.1",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
+ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="
+ },
"node_modules/@web3auth/base": {
"version": "7.3.2",
"resolved": "https://registry.npmjs.org/@web3auth/base/-/base-7.3.2.tgz",
@@ -7504,9 +7606,9 @@
}
},
"node_modules/caniuse-lite": {
- "version": "1.0.30001591",
- "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001591.tgz",
- "integrity": "sha512-PCzRMei/vXjJyL5mJtzNiUCKP59dm8Apqc3PH8gJkMnMXZGox93RbE76jHsmLwmIo6/3nsYIpJtx0O7u5PqFuQ==",
+ "version": "1.0.30001610",
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001610.tgz",
+ "integrity": "sha512-QFutAY4NgaelojVMjY63o6XlZyORPaLfyMnsl3HgnWdJUcX6K0oaJymHjH8PT5Gk7sTm8rvC/c5COUQKXqmOMA==",
"dev": true,
"funding": [
{
@@ -7921,9 +8023,9 @@
"dev": true
},
"node_modules/core-js-compat": {
- "version": "3.36.0",
- "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.36.0.tgz",
- "integrity": "sha512-iV9Pd/PsgjNWBXeq8XRtWVSgz2tKAfhfvBs7qxYty+RlRd+OCksaWmOnc4JKrTc1cToXL1N0s3l/vwlxPtdElw==",
+ "version": "3.37.0",
+ "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.37.0.tgz",
+ "integrity": "sha512-vYq4L+T8aS5UuFg4UwDhc7YNRWVeVZwltad9C/jV3R2LgVOpS9BDr7l/WL6BN0dbV3k1XejPTHqqEzJgsa0frA==",
"dev": true,
"dependencies": {
"browserslist": "^4.22.3"
@@ -8461,9 +8563,9 @@
}
},
"node_modules/electron-to-chromium": {
- "version": "1.4.687",
- "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.687.tgz",
- "integrity": "sha512-Ic85cOuXSP6h7KM0AIJ2hpJ98Bo4hyTUjc4yjMbkvD+8yTxEhfK9+8exT2KKYsSjnCn2tGsKVSZwE7ZgTORQCw==",
+ "version": "1.4.738",
+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.738.tgz",
+ "integrity": "sha512-lwKft2CLFztD+vEIpesrOtCrko/TFnEJlHFdRhazU7Y/jx5qc4cqsocfVrBg4So4gGe9lvxnbLIoev47WMpg+A==",
"dev": true
},
"node_modules/elliptic": {
@@ -9700,11 +9802,22 @@
}
},
"node_modules/ethereum-bloom-filters": {
- "version": "1.0.10",
- "resolved": "https://registry.npmjs.org/ethereum-bloom-filters/-/ethereum-bloom-filters-1.0.10.tgz",
- "integrity": "sha512-rxJ5OFN3RwjQxDcFP2Z5+Q9ho4eIdEmSc2ht0fCu8Se9nbXjZ7/031uXoUYJ87KHCOdVeiUuwSnoS7hmYAGVHA==",
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/ethereum-bloom-filters/-/ethereum-bloom-filters-1.1.0.tgz",
+ "integrity": "sha512-J1gDRkLpuGNvWYzWslBQR9cDV4nd4kfvVTE/Wy4Kkm4yb3EYRSlyi0eB/inTsSTTVyA0+HyzHgbr95Fn/Z1fSw==",
"dependencies": {
- "js-sha3": "^0.8.0"
+ "@noble/hashes": "^1.4.0"
+ }
+ },
+ "node_modules/ethereum-bloom-filters/node_modules/@noble/hashes": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz",
+ "integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==",
+ "engines": {
+ "node": ">= 16"
+ },
+ "funding": {
+ "url": "https://paulmillr.com/funding/"
}
},
"node_modules/ethereum-cryptography": {
@@ -11116,12 +11229,12 @@
}
},
"node_modules/inquirer": {
- "version": "9.2.14",
- "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-9.2.14.tgz",
- "integrity": "sha512-4ByIMt677Iz5AvjyKrDpzaepIyMewNvDcvwpVVRZNmy9dLakVoVgdCHZXbK1SlVJra1db0JZ6XkJyHsanpdrdQ==",
+ "version": "9.2.17",
+ "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-9.2.17.tgz",
+ "integrity": "sha512-Vr3Ia2ud5sGnioURkE69endl4SkeJcMzTF6SosKcX5GALJfId7C+JvO5ZZb6y1LOXnEofCPbwzoQ1q0e8Gaduw==",
"dev": true,
"dependencies": {
- "@ljharb/through": "^2.3.12",
+ "@ljharb/through": "^2.3.13",
"ansi-escapes": "^4.3.2",
"chalk": "^5.3.0",
"cli-cursor": "^3.1.0",
@@ -11954,9 +12067,9 @@
}
},
"node_modules/issue-parser": {
- "version": "6.0.0",
- "resolved": "https://registry.npmjs.org/issue-parser/-/issue-parser-6.0.0.tgz",
- "integrity": "sha512-zKa/Dxq2lGsBIXQ7CUZWTHfvxPC2ej0KfO7fIPqLlHB9J2hJ7rGhZ5rilhuufylr4RXYPzJUeFjKxz305OsNlA==",
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/issue-parser/-/issue-parser-7.0.0.tgz",
+ "integrity": "sha512-jgAw78HO3gs9UrKqJNQvfDj9Ouy8Mhu40fbEJ8yXff4MW8+/Fcn9iFjyWUQ6SKbX8ipPk3X5A3AyfYHRu6uVLw==",
"dev": true,
"dependencies": {
"lodash.capitalize": "^4.2.1",
@@ -11966,7 +12079,7 @@
"lodash.uniqby": "^4.7.0"
},
"engines": {
- "node": ">=10.13"
+ "node": "^18.17 || >=20.6.1"
}
},
"node_modules/iterate-iterator": {
@@ -12372,6 +12485,11 @@
"json-buffer": "3.0.1"
}
},
+ "node_modules/keyvaluestorage-interface": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/keyvaluestorage-interface/-/keyvaluestorage-interface-1.0.0.tgz",
+ "integrity": "sha512-8t6Q3TclQ4uZynJY9IGr2+SsIGwK9JHcO6ootkHCGA0CrQCRy+VkouYNO2xicET6b9al7QKzpebNow+gkpCL8g=="
+ },
"node_modules/kind-of": {
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz",
@@ -13793,9 +13911,9 @@
}
},
"node_modules/open": {
- "version": "10.0.3",
- "resolved": "https://registry.npmjs.org/open/-/open-10.0.3.tgz",
- "integrity": "sha512-dtbI5oW7987hwC9qjJTyABldTaa19SuyJse1QboWv3b0qCcrrLNVDqBx1XgELAjh9QTVQaP/C5b1nhQebd1H2A==",
+ "version": "10.1.0",
+ "resolved": "https://registry.npmjs.org/open/-/open-10.1.0.tgz",
+ "integrity": "sha512-mnkeQ1qP5Ue2wd+aivTD3NHd/lZ96Lu0jgf0pwktLPtx6cTZiH7tyeGRRHs0zX0rbrahXPnXlUnbeXyaBBuIaw==",
"dev": true,
"dependencies": {
"default-browser": "^5.2.1",
@@ -14429,9 +14547,9 @@
}
},
"node_modules/pony-cause": {
- "version": "2.1.10",
- "resolved": "https://registry.npmjs.org/pony-cause/-/pony-cause-2.1.10.tgz",
- "integrity": "sha512-3IKLNXclQgkU++2fSi93sQ6BznFuxSLB11HdvZQ6JW/spahf/P1pAHBQEahr20rs0htZW0UDkM1HmA+nZkXKsw==",
+ "version": "2.1.11",
+ "resolved": "https://registry.npmjs.org/pony-cause/-/pony-cause-2.1.11.tgz",
+ "integrity": "sha512-M7LhCsdNbNgiLYiP4WjsfLUuFmCfnjdF6jKe2R9NKl4WFN+HZPGHJZ9lnLP7f9ZnKe3U9nuWD0szirmj+migUg==",
"engines": {
"node": ">=12.0.0"
}
@@ -14613,9 +14731,9 @@
}
},
"node_modules/qs": {
- "version": "6.11.2",
- "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.2.tgz",
- "integrity": "sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA==",
+ "version": "6.12.1",
+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.12.1.tgz",
+ "integrity": "sha512-zWmv4RSuB9r2mYQw3zxQuHWeU+42aKi1wWig/j4ele4ygELZ7PEO6MM7rim9oAQH2A5MWfsAVf/jPvTPgCbvUQ==",
"dev": true,
"dependencies": {
"side-channel": "^1.0.4"
@@ -14866,9 +14984,9 @@
}
},
"node_modules/release-it": {
- "version": "17.1.1",
- "resolved": "https://registry.npmjs.org/release-it/-/release-it-17.1.1.tgz",
- "integrity": "sha512-b+4Tu2eb5f2wIdIe5E9hre0evbMQrXp/kRq0natHsHYJVqu1Bd4/h2a+swFi0faGmC3cJdB16uYR6LscG9SchQ==",
+ "version": "17.2.0",
+ "resolved": "https://registry.npmjs.org/release-it/-/release-it-17.2.0.tgz",
+ "integrity": "sha512-Cidaq5W4apZSpdEDQd2TJhH7GZAwfaG+ewe60p7B7+txyCHYR/T6lGvkKinJmePpdHsM0fzA05yGGXKCiHJHmA==",
"dev": true,
"funding": [
{
@@ -14882,7 +15000,7 @@
],
"dependencies": {
"@iarna/toml": "2.2.5",
- "@octokit/rest": "20.0.2",
+ "@octokit/rest": "20.1.0",
"async-retry": "1.3.3",
"chalk": "5.3.0",
"cosmiconfig": "9.0.0",
@@ -14890,14 +15008,14 @@
"git-url-parse": "14.0.0",
"globby": "14.0.1",
"got": "13.0.0",
- "inquirer": "9.2.14",
+ "inquirer": "9.2.17",
"is-ci": "3.0.1",
- "issue-parser": "6.0.0",
+ "issue-parser": "7.0.0",
"lodash": "4.17.21",
"mime-types": "2.1.35",
"new-github-release-url": "2.0.0",
"node-fetch": "3.3.2",
- "open": "10.0.3",
+ "open": "10.1.0",
"ora": "8.0.1",
"os-name": "5.1.0",
"promise.allsettled": "1.0.7",
@@ -14906,14 +15024,14 @@
"shelljs": "0.8.5",
"update-notifier": "7.0.0",
"url-join": "5.0.0",
- "wildcard-match": "5.1.2",
+ "wildcard-match": "5.1.3",
"yargs-parser": "21.1.1"
},
"bin": {
"release-it": "bin/release-it.js"
},
"engines": {
- "node": ">=18"
+ "node": "^18.18.0 || ^20.8.0 || ^21.0.0"
}
},
"node_modules/release-it/node_modules/chalk": {
@@ -15849,9 +15967,9 @@
}
},
"node_modules/socks": {
- "version": "2.8.1",
- "resolved": "https://registry.npmjs.org/socks/-/socks-2.8.1.tgz",
- "integrity": "sha512-B6w7tkwNid7ToxjZ08rQMT8M9BJAf8DKx8Ft4NivzH0zBUfd6jldGcisJn/RLgxcX3FPNDdNQCUEMMT79b+oCQ==",
+ "version": "2.8.3",
+ "resolved": "https://registry.npmjs.org/socks/-/socks-2.8.3.tgz",
+ "integrity": "sha512-l5x7VUUWbjVFbafGLxPWkYsHIhEvmF85tbIeFZWc8ZPtoMyybuEhL7Jye/ooC4/d48FgOjSJXgsF/AJPYCW8Zw==",
"dev": true,
"dependencies": {
"ip-address": "^9.0.5",
@@ -17237,9 +17355,9 @@
}
},
"node_modules/webpack-bundle-analyzer": {
- "version": "4.10.1",
- "resolved": "https://registry.npmjs.org/webpack-bundle-analyzer/-/webpack-bundle-analyzer-4.10.1.tgz",
- "integrity": "sha512-s3P7pgexgT/HTUSYgxJyn28A+99mmLq4HsJepMPzu0R8ImJc52QNqaFYW1Z2z2uIb1/J3eYgaAWVpaC+v/1aAQ==",
+ "version": "4.10.2",
+ "resolved": "https://registry.npmjs.org/webpack-bundle-analyzer/-/webpack-bundle-analyzer-4.10.2.tgz",
+ "integrity": "sha512-vJptkMm9pk5si4Bv922ZbKLV8UTT4zib4FPgXMhgzUny0bfDDkLXAVQs3ly3fS4/TN9ROFtb0NFrm04UXFE/Vw==",
"dev": true,
"dependencies": {
"@discoveryjs/json-ext": "0.5.7",
@@ -17250,7 +17368,6 @@
"escape-string-regexp": "^4.0.0",
"gzip-size": "^6.0.0",
"html-escaper": "^2.0.2",
- "is-plain-object": "^5.0.0",
"opener": "^1.5.2",
"picocolors": "^1.0.0",
"sirv": "^2.0.3",
@@ -17284,15 +17401,6 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
- "node_modules/webpack-bundle-analyzer/node_modules/is-plain-object": {
- "version": "5.0.0",
- "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz",
- "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==",
- "dev": true,
- "engines": {
- "node": ">=0.10.0"
- }
- },
"node_modules/webpack-bundle-analyzer/node_modules/ws": {
"version": "7.5.9",
"resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz",
@@ -17620,9 +17728,9 @@
"dev": true
},
"node_modules/wildcard-match": {
- "version": "5.1.2",
- "resolved": "https://registry.npmjs.org/wildcard-match/-/wildcard-match-5.1.2.tgz",
- "integrity": "sha512-qNXwI591Z88c8bWxp+yjV60Ch4F8Riawe3iGxbzquhy8Xs9m+0+SLFBGb/0yCTIDElawtaImC37fYZ+dr32KqQ==",
+ "version": "5.1.3",
+ "resolved": "https://registry.npmjs.org/wildcard-match/-/wildcard-match-5.1.3.tgz",
+ "integrity": "sha512-a95hPUk+BNzSGLntNXYxsjz2Hooi5oL7xOfJR6CKwSsSALh7vUNuTlzsrZowtYy38JNduYFRVhFv19ocqNOZlg==",
"dev": true
},
"node_modules/windows-release": {
diff --git a/tests/factors.spec.ts b/tests/factors.spec.ts
index 14d43eb2..48733a87 100644
--- a/tests/factors.spec.ts
+++ b/tests/factors.spec.ts
@@ -18,7 +18,7 @@ import {
WEB3AUTH_NETWORK,
Web3AuthMPCCoreKit,
} from "../src";
-import { AsyncMemoryStorage, criticalResetAccount, mockLogin } from "./setup";
+import { AsyncMemoryStorage, criticalResetAccount, mockLogin, stringGen } from "./setup";
type FactorTestVariable = {
types: TssShareType;
@@ -142,6 +142,9 @@ export const FactorManipulationTest = async (
await t.test("enable MFA", async function () {
const instance = await newInstance();
instance.setTssWalletIndex(1);
+ if (testVariable.manualSync) {
+ await instance.commitChanges();
+ }
const recoverFactor = await instance.enableMFA({});
if (testVariable.manualSync) {
@@ -184,7 +187,7 @@ const variable: FactorTestVariable[] = [
{ types: TssShareType.RECOVERY, manualSync: false, asyncStorage: new AsyncMemoryStorage() },
];
-const email = "testmail102";
+const email = `${stringGen(10)}@${stringGen(5)}.${stringGen(3)}`;
variable.forEach(async (testVariable) => {
const newCoreKitLogInInstance = async (ignoreError: boolean) => {
const instance = new Web3AuthMPCCoreKit({