Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Channels and Hooks Examples

This directory contains examples of creating channels and hooks using both the TypeScript SDK and Solidity scripts.

Setup

  1. Get pnpm installed.
  2. Create a copy of .env file by copying the content from .env.example, follow the instruction to set it up.
  3. Install dependencies by running: pnpm install.
  4. Optional: You may want to test against a local anvil node.
    1. To setup and run anvil locally, see Anvil document.
    2. Follow the README.md file in protocol folder to deploy the contracts to anvil node

TypeScript Examples

The TypeScript examples use the @ecp.eth/sdk package to interact with the protocol.

Create a channel:

npm run create-channel

Solidity Examples

The Solidity examples use Foundry to interact with the protocol directly.

Setup

  1. Ensure Foundry is installed:
curl -L https://foundry.paradigm.xyz | bash
foundryup

Running the Examples

Create a channel:

forge script solidity/CreateChannel.s.sol --rpc-url $RPC_URL --broadcast

Replace $RPC_URL with the url of RPC node for the target chain.

Notes

  • DO NOT use your real wallet or private key for testing
  • Make sure you have enough ETH to pay for the channel creation fee
  • The private key should be kept secure and never committed to version control
  • The examples use the mainnet network by default