gpt4 book ai didi

javascript - 使用 near-lib 创建新的 NEAR 帐户 - JsonRpcProvider 问题

转载 作者:行者123 更新时间:2023-11-30 13:48:47 25 4
gpt4 key购买 nike

目前正在阅读文档并尝试想出一个工作示例来创建一个新帐户,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!

最佳答案

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

关于javascript - 使用 near-lib 创建新的 NEAR 帐户 - JsonRpcProvider 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58721558/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com