Load Keypair

load a wallet from the filesystem

New Way

import { createKeyPairSignerFromBytes } from '@solana/web3.js'
import walletSecret from './wallet.json'

const main = async () => {
    const keypairBytes = new Uint8Array(walletSecret);
    const wallet = await createKeyPairFromBytes(keypairBytes);
    console.log("wallet: ", wallet);
}

main();

Old Way

import { Keypair } from "@solana/web3.js";
import walletSecret from './wallet.json'

const wallet = Keypair.fromSecretKey(new Uint8Array(walletSecret));