在node环境直接运行是可以的,但是到了next.js前端页面就会触发跨域问题
// @solana/web3.js const connection = new Connection(rpc); const walletKey = new PublicKey("xx"); connection.getBalance(walletKey).then(result => { console.log("wallet bal: ", result); });