今天就跟大家聊聊有關web3.js中怎么實現跨鏈調用SimpleChain,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結了以下內容,希望大家根據這篇文章可以有所收獲。
創(chuàng)新互聯建站是一家專業(yè)提供永靖企業(yè)網站建設,專注與成都網站設計、網站建設、H5頁面制作、小程序制作等業(yè)務。10年已為永靖眾多企業(yè)、政府機構等服務。創(chuàng)新互聯專業(yè)的建站公司優(yōu)惠進行中。
查看RPC接口
首先我們需要熟悉Simplechain的跨鏈 接口,熟悉了接口以后我們就可以直接上手操作。
首先你需要安裝node環(huán)境,然后使用npm安裝跨鏈包。命令如下:
npm install @sipc/web3
安裝完以后就可以在你的工程項目面集成跨鏈。主要的方法有:getCtxQuery
,getCtxOwner
,getCtxOwnerByPage
,getCtxContent
,getCtxContentByPage
,ctxGet
,ctxGetByNumber
, ctxQueryDestValue
, getCtxTakerByPage
, getCtxStats
, getPoolStats
。
npm庫
const rpcUrl = "http://192.168.4.104:8546" const Web3 = require('@sipc/web3') const web3 = new Web3(new Web3.providers.HttpProvider(rpcUrl)); (async function () { const blockNumber = await web3.eth.getBlockNumber() const chainId = await web3.cross.net.getId() const owner = await web3.cross.getCtxOwnerByPage("0x6407d2a4cd26fdd884dc2ed4a4f8882e413d84f6", 2, 1) const poolStats = await web3.cross.getPoolStats() const stats = await web3.cross.getCtxStats() for(const item of owner.data['909']){ console.log(item.txHash) } console.log(blockNumber, chainId, owner, poolStats, stats ) })()
看完上述內容,你們對web3.js中怎么實現跨鏈調用SimpleChain有進一步的了解嗎?如果還想了解更多知識或者相關內容,請關注創(chuàng)新互聯行業(yè)資訊頻道,感謝大家的支持。
網站題目:web3.js中怎么實現跨鏈調用SimpleChain
地址分享:http://www.chinadenli.net/article42/ippjec.html
成都網站建設公司_創(chuàng)新互聯,為您提供云服務器、App開發(fā)、外貿建站、做網站、定制網站、動態(tài)網站
聲明:本網站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯