1

目前正在阅读文档并尝试提出一个工作示例来创建一个新帐户,但遇到一些问题JsonRpcProvider- 想在此处发布完整示例,因为我认为它对任何搜索者都有用

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

4

1 回答 1

2

网络的 URL,例如我们的测试网:https://rpc.nearprotocol.com

于 2019-11-06T02:00:25.553 回答