@@ -12,14 +12,16 @@ import {
1212 parseToken ,
1313 factorKeyCurve ,
1414 makeEthereumSigner ,
15+ SigType ,
1516} from "@web3auth/mpc-core-kit" ;
1617import Web3 from "web3" ;
1718import { CHAIN_NAMESPACES , CustomChainConfig , IProvider } from "@web3auth/base" ;
1819import { EthereumSigningProvider } from "@web3auth/ethereum-mpc-provider" ;
1920import { BN } from "bn.js" ;
2021import { KeyType , Point } from "@tkey/common-types" ;
21- import { tssLib } from "@toruslabs/tss-dkls-lib" ;
22+ // import { tssLib } from "@toruslabs/tss-dkls-lib";
2223// import{ tssLib } from "@toruslabs/tss-frost-lib";
24+ import { tssLib } from "@toruslabs/tss-frost-lib-bip340" ;
2325
2426import "./App.css" ;
2527import jwt , { Algorithm } from "jsonwebtoken" ;
@@ -171,7 +173,7 @@ function App() {
171173 if ( ! factorPubs ) {
172174 throw new Error ( "factorPubs not found" ) ;
173175 }
174- const pubsHex = factorPubs [ coreKitInstance . tKey . tssTag ] . map ( ( pub : Point ) => {
176+ const pubsHex = factorPubs [ coreKitInstance . tKey . tssTag ] . map ( pub => {
175177 return pub . toSEC1 ( factorKeyCurve , true ) . toString ( "hex" ) ;
176178 } ) ;
177179 uiConsole ( pubsHex ) ;
@@ -357,14 +359,15 @@ function App() {
357359 }
358360 const address = ( await web3 . eth . getAccounts ( ) ) [ 0 ] ;
359361 const balance = web3 . utils . fromWei (
360- await web3 . eth . getBalance ( address ) // Balance is in wei
362+ await web3 . eth . getBalance ( address ) , // Balance is in wei
363+ "ether"
361364 ) ;
362365 uiConsole ( balance ) ;
363366 return balance ;
364367 } ;
365368
366369 const signMessage = async ( ) : Promise < any > => {
367- if ( coreKitInstance . keyType === "secp256k1" ) {
370+ if ( coreKitInstance . sigType === SigType . ecdsa_secp256k1 ) {
368371 if ( ! web3 ) {
369372 uiConsole ( "web3 not initialized yet" ) ;
370373 return ;
@@ -376,7 +379,7 @@ function App() {
376379
377380
378381 uiConsole ( signedMessage ) ;
379- } else if ( coreKitInstance . keyType === " ed25519" ) {
382+ } else if ( coreKitInstance . sigType === SigType . ed25519 || coreKitInstance . sigType === SigType . bip340 ) {
380383 const msg = Buffer . from ( "hello signer!" ) ;
381384 const sig = await coreKitInstance . sign ( msg ) ;
382385 uiConsole ( sig . toString ( "hex" ) ) ;
@@ -512,7 +515,7 @@ function App() {
512515 const fromAddress = ( await web3 . eth . getAccounts ( ) ) [ 0 ] ;
513516
514517 const destination = "0x2E464670992574A613f10F7682D5057fB507Cc21" ;
515- const amount = web3 . utils . toWei ( "0.0001" ) ; // Convert 1 ether to wei
518+ const amount = web3 . utils . toWei ( "0.0001" , "ether" ) ; // Convert 1 ether to wei
516519
517520 // Submit transaction to the blockchain and wait for it to be mined
518521 uiConsole ( "Sending transaction..." ) ;
0 commit comments