Developer Guide

Build with Mesh or extend it.

Project Structure

mesh-contracts/
├── Frontend/          # React app
├── relayer/           # Cross-chain service
├── evm_contracts/     # Ethereum contracts
├── sui_contracts/     # Sui contracts
└── docs/              # Documentation

Development Setup

1. Clone and install

git clone https://github.com/ashwanth511/mesh
cd mesh

# Frontend
cd Frontend && npm install

# Relayer
cd ../relayer && npm install

2. Install blockchain tools

3. Set up environment

Building and Testing

Frontend:

Contracts:

Relayer:

Key Technologies

Frontend (React):

  • React 18 with TypeScript

  • Wagmi for Ethereum wallets

  • Sui SDK for Sui wallets

  • Vite for building

Ethereum (Solidity):

  • Foundry development framework

  • OpenZeppelin security libraries

  • 1inch Fusion+ integration

  • ethers.js for interaction

Sui (Move):

  • Move programming language

  • Sui SDK for JavaScript

  • Generic contract design

  • Capability-based security

Relayer (TypeScript):

  • Node.js backend service

  • Event-driven architecture

  • Cross-chain coordination

  • Secret management

Extending Mesh

Add new token pairs:

  1. Deploy contracts for new tokens

  2. Update relayer configuration

  3. Add token info to frontend

  4. Test with small amounts

Modify swap logic:

  1. Update smart contracts

  2. Deploy new versions

  3. Update relayer to handle changes

  4. Test thoroughly

Build integrations:

  1. Use Mesh contracts in your app

  2. Connect to relayer API

  3. Handle swap events

  4. Provide user interface

API Reference

Smart Contract Functions:

Relayer Events:

  • SwapCreated

  • SwapFilled

  • SwapCompleted

  • SwapCancelled

Best Practices

Security:

  • Always test on testnets first

  • Audit contract changes

  • Use secure key management

  • Monitor for unusual activity

Performance:

  • Optimize gas usage

  • Use efficient data structures

  • Implement proper error handling

  • Monitor system resources

UX:

  • Provide clear status updates

  • Handle errors gracefully

  • Make wallets easy to connect

  • Show realistic time estimates

Contributing

  1. Fork the repository

  2. Create feature branch

  3. Make your changes

  4. Add tests

  5. Submit pull request

Areas for contribution:

  • New blockchain integrations

  • UI/UX improvements

  • Gas optimization

  • Documentation

  • Testing coverage

Last updated