I'm stuck between a rock and a hard place right now.
I'm developing an app with react native, and users need to be able to import their wallets via their private keys (and hopefully mnemonic phrases)
However, when I use the eas toolchain to build my app, I run into an issue with the Solana/web3.js package I was using to do this.
My current code is this:
import * as b58 from "bs58";
import * as bip39 from "bip39";
import * as solanaWeb3 from "@solana/web3.js";
export function deriveSolAddressFromKey(key: string): string {
try {
return solanaWeb3.Keypair.fromSecretKey(
b58.decode(key.toString().trim())
).publicKey.toBase58();
}
catch (e) {
console.error(e);
}
}
export function deriveSolAddressFromMemonic(phrase: string): string {
const seed = bip39.mnemonicToSeedSync(phrase, "");
const keypair = solanaWeb3.Keypair.fromSeed(seed.slice(0, 32));
return keypair.publicKey.toBase58();
}
How can I do this without the use of solana/web3.js?