Ver código fonte

Fixed issue when using a raw array key

Abderrahim Ajakka 1 ano atrás
pai
commit
f2fa914b38
1 arquivos alterados com 2 adições e 1 exclusões
  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