The Solana CLI uses the 'array of numbers' format for Solana private keys (eg. ~/.config/solana/id.json).
We should make svmPrivateKey either default to Array<Number> or let people specify Array<Number> | string and throw an error if their private key isn't decodable using either.
Workaround for short term:
import { readFile } from "node:fs/promises";
import { getBase58Decoder } from "@solana/codecs";
// Solana private keys usually use 'array of numbers'
// format, so convert to base58
const loadPrivateKeyAndConvertToBase58 = async (
keyFilePath: string,
): Promise<string> => {
const keyBytes = JSON.parse(
await readFile(keyFilePath, "utf-8"),
) as Array<number>;
return getBase58Decoder().decode(new Uint8Array(keyBytes));
};