|
1 | | -import { COREKIT_STATUS, CoreKitMode, makeEthereumSigner, UserInfo, WEB3AUTH_NETWORK, Web3AuthMPCCoreKit } from "@web3auth/mpc-core-kit"; |
| 1 | +import { COREKIT_STATUS, CoreKitMode, makeEthereumSigner, UserInfo, WEB3AUTH_NETWORK, Web3AuthMPCCoreKit } from "@guru_test/mpc-core-kit"; |
2 | 2 | // import { PasskeysPlugin } from "@web3auth/mpc-passkey-plugin"; |
3 | 3 | import React, { createContext, useContext, useState, useEffect } from "react"; |
4 | 4 | import { tssLib as tssLibDkls } from "@toruslabs/tss-dkls-lib"; |
@@ -56,6 +56,7 @@ interface CoreKitContextType { |
56 | 56 | setKeyType: React.Dispatch<React.SetStateAction<KeyType>>; |
57 | 57 | keyType: KeyType; |
58 | 58 | networkName: "ETH" | "SOL" | "BTC" | undefined; |
| 59 | + coin: "ETH" | "SOL" | "SATS" | undefined; |
59 | 60 | } |
60 | 61 |
|
61 | 62 | // Create the context with default values |
@@ -86,6 +87,7 @@ const CoreKitContext = createContext<CoreKitContextType>({ |
86 | 87 | getShareDescriptions: () => { }, |
87 | 88 | shareDescriptions: null, |
88 | 89 | networkName: undefined, |
| 90 | + coin: undefined, |
89 | 91 | setKeyType: () => { }, |
90 | 92 | keyType: localStorage.getItem("keyType") as KeyType || KeyType.secp256k1, |
91 | 93 | existingModules: [], |
@@ -119,13 +121,18 @@ export const CoreKitProvider: React.FC<CoreKitProviderProps> = ({ children }) => |
119 | 121 | const [existingModules, setExistingModules] = React.useState<string[]>([]); |
120 | 122 | const [keyType, setKeyType] = React.useState<KeyType>(localStorage.getItem("keyType") as KeyType || KeyType.secp256k1); |
121 | 123 | const [networkName, setNetworkName] = useState<"ETH" | "SOL" | "BTC">(); |
| 124 | + const [coin, setCoin] = useState<"ETH" | "SOL" | "SATS">(); |
122 | 125 |
|
123 | 126 | useEffect(() => { |
124 | 127 | localStorage.setItem("keyType", keyType); |
125 | 128 | setNetworkName(keyType === KeyType.secp256k1 ? "ETH" |
126 | 129 | : keyType === KeyType.ed25519 ? "SOL" |
127 | 130 | : "BTC" |
128 | 131 | ); |
| 132 | + setCoin(keyType === KeyType.secp256k1 ? "ETH" |
| 133 | + : keyType === KeyType.ed25519 ? "SOL" |
| 134 | + : "SATS" |
| 135 | + ); |
129 | 136 | setCoreKitInstance(new Web3AuthMPCCoreKit({ |
130 | 137 | ...initialWeb3AuthConfig, |
131 | 138 | tssLib: keyType === KeyType.secp256k1 ? tssLibDkls : keyType === "BTC" as KeyType ? tssLibFrostBip340 : tssLibFrost, |
@@ -209,7 +216,7 @@ export const CoreKitProvider: React.FC<CoreKitProviderProps> = ({ children }) => |
209 | 216 | getShareDescriptions, |
210 | 217 | shareDescriptions, existingModules, |
211 | 218 | keyType, setKeyType, |
212 | | - networkName, |
| 219 | + networkName, coin, |
213 | 220 | }}>{children}</CoreKitContext.Provider> |
214 | 221 | ); |
215 | 222 | }; |
|
0 commit comments