使用solana web3.js连接到本地主机
我正在构建一个微型下一个React应用程序(用于测试目的)来测试我制作的JS脚本,该脚本应该在我的帐户上铸造NFT。我关注 this 使一切都起作用。 但是,当我尝试这两个中的任何一个:
const connection = new Connection(
clusterApiUrl('devnet'),
);
const connection = new Connection(
"http://127.0.0.1:8899",
);
然后我会在创建功能中出现错误:
let mint = await createMint(
connection,
mintRequester, // payer
mintRequester.publicKey, // mint
null, // freeze
0,
);
错误是:
Unhandled Runtime Error
TypeError: unexpected type, use Uint8Array
Source
scripts/mint.ts (48:4) @ async*_callee$
46 |
47 | let mint = await createMint(
> 48 | connection,
| ^
49 | mintRequester, // payer
50 | mintRequester.publicKey, // mint
51 | null, // freeze
注意:testNet
超时,不能使用它
I'm building a miniature next react app (for test purpose) to test a js script that i made, that is supposed to mint NFT on my account. I'm following this to makes everything works.
But, when i try any of these two:
const connection = new Connection(
clusterApiUrl('devnet'),
);
const connection = new Connection(
"http://127.0.0.1:8899",
);
then i get an error in createMint function:
let mint = await createMint(
connection,
mintRequester, // payer
mintRequester.publicKey, // mint
null, // freeze
0,
);
the error is:
Unhandled Runtime Error
TypeError: unexpected type, use Uint8Array
Source
scripts/mint.ts (48:4) @ async*_callee$
46 |
47 | let mint = await createMint(
> 48 | connection,
| ^
49 | mintRequester, // payer
50 | mintRequester.publicKey, // mint
51 | null, // freeze
note: testnet
timeout, cant use it
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用localhost时,请确保运行
solana-test-validator
。Make sure to run
solana-test-validator
when using localhost.