I'm trying to write an integration test to call a method on a Near Protocol contract.
I've got as far as creating the account object, and now need to set the key pair to be able to make the call.
I can see that I can get the private key value by logging in on the near-cli and getting the key from the .nearcredentials folder. But it seems like I need to encode this before setting the key in the store.
const keyStore = new keyStores.InMemoryKeyStore();
const config = {
keyStore,
networkId: "testnet",
nodeUrl: "https://rpc.testnet.near.org",
};
const near = await connect(config);
const account = await near.account("my_account.testnet");
const keyPair = ???
await keyStore.setKey(config.networkId, "my_account.testnet", keyPair);
const result = await account.functionCall({
contractId: "nft-example.my_account.testnet",
methodName: "nft_metadata"
})