Saltar al contenido principal
Superteam Brasil
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 Keypair from @solana/web3.js
  • Generate a new keypair
  • Return an object with publicKey (base58 string) and isValid (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 !== undefined
Public key should be a valid base58 string
Entrada: Esperado: typeof result.publicKey === 'string' && result.publicKey.length >= 32
isValid should be true
Entrada: Esperado: result.isValid === true

Discusión