npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@wandevs/message

v0.2.2

Published

Wanchain Message Bridge

Downloads

10

Readme

Wanchain Message Bridge (WMB)

Wanchain Message Bridge (WMB) is a decentralized messaging protocol that allows messages to be transmitted between different blockchain networks, including Wanchain and other networks.

The protocol is implemented through the Wanchain Message Bridge smart contracts, which enable the transmission of messages between different chains.

The contract code mainly consists of two parts: one part is WmbGateway, and the other part is WmbApp and WmbRetryableApp.

WMB Gateway

The WMB Gateway is a smart contract that acts as an intermediary between the Wanchain Message Bridge and the external blockchain networks. It provides a secure and efficient mechanism for transferring messages between the different networks.

Deployed SC address

Testnet

| Network | Contract Address | | --- | --- | | Wanchain Testnet | 0xEB14407Edc497a73934dE08D5c3079BB1F5f145D | | Ethereum Goerli Testnet | 0x9454C2F15F308098163623D5E7deCe366793efD3 | | Avalanche Fuji Testnet | 0x8Ee72C8194ec8A527B1D4981742727437091C913 | | XDC testnet | 0x8c1b9daD87BFC48DF48b15baA19d0FB163030169 | | Arbitrum Goerli Testnet | 0x294B79d3D13DAb36C51C8E4Cf3c2Cd3948F0bA4C | | Optimism Goerli Testnet | 0x9B9492466F70e0dA0f4ef0aC27a53550B0769232 | | Polygon Mumbai Testnet | 0x61F4aBa60A158E180521264a793fCb2901fCe998 |

Mainnet

| Network | Address | Bip44 chainId | | --- | --- | --- | | Polygon | 0x7280E3b8c686c68207aCb1A4D656b2FC8079c033 | 2147484614 | | BSC | 0x7280E3b8c686c68207aCb1A4D656b2FC8079c033 | 2147484362 | | Wanchain | 0x7280E3b8c686c68207aCb1A4D656b2FC8079c033 | 2153201998 | | Avalanche | 0x7280E3b8c686c68207aCb1A4D656b2FC8079c033 | 2147492648 | | Optimism | 0x7280E3b8c686c68207aCb1A4D656b2FC8079c033 | 2147484262 | | Arbitrum | 0x7280E3b8c686c68207aCb1A4D656b2FC8079c033 | 1073741826 | | Energi | 0x7280E3b8c686c68207aCb1A4D656b2FC8079c033 | 2147493445 | | Ethereum | 0x7280E3b8c686c68207aCb1A4D656b2FC8079c033 | 2147483708 |

WMB App

WMB App is a smart contract that can be inherited by third-party DApps to interact with the WMB Gateway. It provides a customizable interface for interacting with the WMB Gateway and handling incoming messages.

WMB Retryable App

WMB Retryable App is a smart contract that can be inherited by third-party DApps to interact with the WMB Gateway. It provides a customizable interface for interacting with the WMB Gateway and handling incoming messages. It also provides a retry mechanism for handling failed messages.

Compile & Test

// SPDX-License-Identifier: MIT
pragma solidity 0.8.18;
import "@wandevs/message/contracts/app/WmbApp.sol";

contract MyContract is WmbApp {
    
    constructor(address admin, address _wmbGateway) WmbApp() {
        initialize(admin, _wmbGateway);
        // 你的初始化代码
    }

    function _wmbReceive(
        bytes calldata data,
        bytes32 messageId,
        uint256 fromChainId,
        address fromSC
    ) internal override {
		// do something you want...
    }

    function sendMessage(
        uint256 toChainId, address toAddress, 
        bytes memory msgData, uint256 gasLimit) public payable {
        uint256 fee = estimateFee(toChainId, gasLimit);
        require(msg.value >= fee, "Insufficient fee");
        _dispatchMessage(toChainId, toAddress, msgData, msg.value);
    }

    function sendMessageBatch(
        uint256 toChainId, Message[] memory messages, uint256 gasLimit) 
        public payable {
        uint256 fee = estimateFee(toChainId, gasLimit);
        require(msg.value >= fee, "Insufficient fee");
        _dispatchMessageBatch(toChainId, messages, msg.value);
    }
}

Sandbox Environment

Check sandbox.md for more details.