-
Notifications
You must be signed in to change notification settings - Fork 249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UnencryptedFileSystemKeyStore can't find Keypair #1451
Comments
i have verified the key exists, here, so i'm not really sure what to do. |
Just tested sending transaction in your way and didn"t catch any problems. My code looks like this: test('testUnencryptedFileSystemKeyStore', async () => {
const keyStore = new keyStores.UnencryptedFileSystemKeyStore(`${homedir()}/.near-credentials/`);
console.info(keyStore);
const nearTest = await connect(<ConnectConfig>{
networkId: 'testnet',
keyStore: keyStore,
nodeUrl: 'https://rpc.testnet.near.org',
helperUrl: 'https://helper.nearprotocol.com'
})
console.info(nearTest);
const account = await nearTest.account('true-pull.testnet');
console.info(account);
let resp = await account.signAndSendTransaction({
receiverId: 'alexkushnir.testnet',
actions: [functionCall("sign",
Buffer.from(JSON.stringify(args),
BigInt(300000000000000),
BigInt(1))]
});
console.info(resp);
}, 30000); I would delve into this, if you see any differences between our steps please contact me. My advise is to double check the existing json, pass the logs to the code |
@AlexKushnir1 What should the key file look like? I've verified its existence, how can I verify its validity? I created the account using |
just for sanity checks, I verified the accounts existence in I also verified the keys contents manually, again.
|
I was able to get this working by loading the key directly from the keystore, then defining a new, memory based keystore and loading the extracted key into it like such: const filekeystore = new keyStores.UnencryptedFileSystemKeyStore(`${homedir()}/.near-credentials/`)
let key = await filekeystore.getKey("testnet", "bta-251494586")
console.log("getKey", !!key ? "pass" : "fail")
let keystore = new keyStores.InMemoryKeyStore()
keystore.setKey("testnet", "bta-251494586.testnet", key) |
Prerequisites
near-api-js
.Description
When running some test code for my NEAR DEX app, I ran into some issues with signing and sending transactions with an
UnencryptedFileSystemKeyStore
object.Reproducible demo
No response
Steps to reproduce
near create TEST_ACCOUNT_ID --useFaucet
Expected behavior
transaction should execute and res should resolve to a transaction result
Actual behavior
instead, Near spits out this error:
again, i have verified the key file exists at
$HOME/.near-credentials/testnet/bta-251494586.json
and is valid.Your environment
Self-service
The text was updated successfully, but these errors were encountered: