Atrás
+10 XP
4/12
Challenge: Generate a Keypair
Now it is your turn! Write a function that generates a new Solana keypair and returns an object with the public key (as a base58 string) and a boolean indicating whether the keypair is valid.
Requirements
- Import
Keypairfrom@solana/web3.js - Generate a new keypair
- Return an object with
publicKey(base58 string) andisValid(boolean) - A keypair is valid if the public key is on the ed25519 curve
Casos de Prueba
Should return an object with publicKey and isValid
Entrada:
Esperado: typeof result === 'object' && result.publicKey && result.isValid !== undefinedPublic key should be a valid base58 string
Entrada:
Esperado: typeof result.publicKey === 'string' && result.publicKey.length >= 32isValid should be true
Entrada:
Esperado: result.isValid === true