Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

236
Visualizações
Converting string to Public Key

I am trying to convert a public key saved as a string to an anchor_lang PubKey object in rust. What is the procedure to convert a string to a PubKey object?

about 4 years ago · Santiago Gelvez
3 Respostas
Responde à pergunta

0

If your public key can be static

pub const YOUR_PUBKEY: Pubkey = solana_program::pubkey!("base58_pubkey")

Otherwise

let your_pubkey = Pubkey::from_str("base58_pubkey").unwrap();
about 4 years ago · Santiago Gelvez Relatório

0

Here is an exact example (the string will vary with what you have) that converts a base58 string to Solana Pubkey:

let pk_key = Pubkey::from_str("SDMHqNqN82QSjEaEuqybmpXsjtX98YuTsX6YCdT99to").unwrap();
about 4 years ago · Santiago Gelvez Relatório

0

I've never used solana before, so I am not sure exactly how one would do this. Looking through their docs, it looks like PubKey implements the FromStr trait. This has a from_str function that takes a &str and parses it into a PubKey.

about 4 years ago · Santiago Gelvez Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda