帖子
分享您的知识。
Bolke 88
Jan 05, 2025
专家问答
How to switch from testnetConnection to custom RPC in Sui.js?
I'm working on a project using Sui.js and I need to connect to a custom RPC URL instead of using the default testnetConnection. How can I achieve this? I've seen a lot about connecting via testnetConnection, but I need guidance on using a custom setup for my RPC endpoint.
- Move CLI
0
1
分享
评论
答案
1tomek180
Jan 6 2025, 21:05要testnetConnection
在中从使用切换到自定义 RPC URL@mysten/sui.js
,应JsonRpcProvider``Connection
改为使用指定自定义 URL 的对象来初始化. 以下是如何在项目中实现这一目标的示例:
import { Connection, JsonRpcProvider } from '@mysten/sui.js';
const connection = new Connection({
fullnode: 'YOUR_CUSTOM_RPC_URL',
});
const provider = new JsonRpcProvider(connection);
此代码片段设置了与您的自定义 RPC 端点的连接,而不是默认的测试网连接. 请务必'YOUR_CUSTOM_RPC_URL'
使用实际的 RPC 网址替换.
0
最佳答案
评论
你知道答案吗?
请登录并分享。
Move is an executable bytecode language used to implement custom transactions and smart contracts.
148帖子231答案