Currently working through the documentation and trying to come up with a working example to create a new account, having some issues with JsonRpcProvider
- wanted to post the full example here because I think its useful for any searchers
const keyStore = new nearLib.keyStores.UnencryptedFileSystemKeyStore('/path/to/file.txt');
const provider = new nearLib.providers.JsonRpcProvider('default') // TAKES URL
const signer = new nearLib.InMemorySigner(keyStore)
const connection = new nearLib.Connection("default", provider, signer);
const master_account = new nearLib.Account(connection, 'chicken');
const local_creator = new nearLib.accountCreator.LocalAccountCreator(master_account, 1000000000000);
const newAccount = await local_creator.createAccount('new_account_id',nearLib.utils.KeyPairEd25519.fromRandom().toString())
Not sure what URL to pass into the provider
!
Url of a network, e.g. our testnet: https://rpc.nearprotocol.com