Procházet zdrojové kódy

Fixed issue when using a raw array key

Abderrahim Ajakka před 1 rokem
rodič
revize
f2fa914b38
1 změnil soubory, kde provedl 2 přidání a 1 odebrání
  1. 2 1
      helpers/wallet.ts

+ 2 - 1
helpers/wallet.ts

@@ -6,7 +6,8 @@ import { derivePath } from 'ed25519-hd-key';
 export function getWallet(wallet: string): Keypair {
   // most likely someone pasted the private key in binary format
   if (wallet.startsWith('[')) {
-    return Keypair.fromSecretKey(JSON.parse(wallet));
+    const raw = new Uint8Array(JSON.parse(wallet))
+    return Keypair.fromSecretKey(raw);
   }
 
   // most likely someone pasted mnemonic