Преглед изворни кода

Fixed issue when using a raw array key

Abderrahim Ajakka пре 1 година
родитељ
комит
f2fa914b38
1 измењених фајлова са 2 додато и 1 уклоњено
  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