使用 near-lib 创建新的 NEAR 帐户 - JsonRpcProvider 问题
Creating a new NEAR account using near-lib - JsonRpcProvider issues
目前正在阅读文档并尝试提出一个工作示例来创建一个新帐户,JsonRpcProvider
有一些问题 - 想在此处 post 完整示例,因为我认为它对任何搜索者都有用
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())
不确定 URL 传递给 provider
!
Url 网络,例如我们的测试网:https://rpc.nearprotocol.com
目前正在阅读文档并尝试提出一个工作示例来创建一个新帐户,JsonRpcProvider
有一些问题 - 想在此处 post 完整示例,因为我认为它对任何搜索者都有用
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())
不确定 URL 传递给 provider
!
Url 网络,例如我们的测试网:https://rpc.nearprotocol.com