Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

172
Views
Solana method cannot convert string to Base58 format

I'm using @solana/web3.js and have this code:

const web3 = require("@solana/web3.js");
const clusterApi = process.env.SOLANA_CLUSTER;
module.exports = {
    getConfirmedSignaturesForAddress: async address => {
    try {
      const connection = new web3.Connection(web3.clusterApiUrl(clusterApi), "confirmed");

      const result = await connection.getSignaturesForAddress(address, {
        limit: 25
      });

      return {
        tx: result,
        status: true
      };
    } catch (e) {
      return {
        status: false,
        error: e.message
      };
    }
  }
}

And every time I call this function I get this error:

{ status: false, error: 'address.toBase58 is not a function' }

I was trying to send it already converted to Base58, but it just doesn't work. What's wrong?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

This is how I solved this problem. Generally speaking, you need to convert it not just by converting to pure Base58, but like this:

const web3 = require("@solana/web3.js");
const bip39 = require("bip39");

const getKeyFromMemonic = async mnemonic => {
  return new Promise((resolve, reject) => {
    bip39
      .mnemonicToSeed(mnemonic)
      .then(buffer => {
        const a = new Uint8Array(buffer.toJSON().data.slice(0, 32));
        const key = web3.Keypair.fromSeed(a);
        resolve(key);
      })
      .catch(err => reject(err));
  });
};

getSignaturesForAddress: async address => {
    try {
      const key = await getKeyFromMemonic(address);

      const connection = new web3.Connection(web3.clusterApiUrl(clusterApi), "confirmed");

      const result = await connection.getSignaturesForAddress(key.publicKey);

      return {
        tx: result,
        status: true
      };
    } catch (e) {
      return {
        status: false,
        error: e.message
      };
    }
  }
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!