Skip to content

Commit 026103a

Browse files
committed
feat: add machine drawings in README.md to clarify explanation
1 parent bc14aa5 commit 026103a

File tree

5 files changed

+16
-0
lines changed

5 files changed

+16
-0
lines changed

packages/event-listener/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ yarn add @lit-protocol/event-listener
2020

2121
## Core Concepts
2222

23+
![State Machine](./graphs/stateMachine.png)
24+
2325
### State Machine
2426

2527
A state machine consists of states, and transitions between those states which are triggered based on a collection of Listeners.
@@ -66,6 +68,8 @@ Listeners monitor various events and feed data to transitions:
6668

6769
Here's a simple example that mints a PKP, a Capacity Delegation NFT and then runs a Lit Action every hour:
6870

71+
![Run LitAction Interval](./graphs/runLitActionInterval.png)
72+
6973
```typescript
7074
async function runLitActionInterval() {
7175
const stateMachine = StateMachine.fromDefinition({
@@ -147,6 +151,8 @@ There care cases where such a declarative interface won't be enough for your use
147151

148152
Here is an example that listens to Ethereum block hashes, looking for those that end in '0'
149153

154+
![Listen Ethereum Blocks](./graphs/ethZeroBlockhash.png)
155+
150156
```typescript
151157
async function monitorEthereumBlocksWithHashEndingWithZero() {
152158
const litNodeClient = new LitNodeClient({
@@ -232,6 +238,8 @@ By leveraging context from the State Machine in combination with Lit PKPs, it is
232238

233239
In this example, when a State Machine PKP receives USDC in Base Sepolia, it will send the same amount to the sender but in Ethereum Sepolia.
234240

241+
![USDC Bridge](./graphs/usdcBridge.png)
242+
235243
```typescript
236244
async function bridgeBaseSepoliaUSDCToEthereumSepolia() {
237245
const evmSourceNetwork = LIT_EVM_CHAINS.baseSepolia;
@@ -374,3 +382,11 @@ async function bridgeBaseSepoliaUSDCToEthereumSepolia() {
374382
}
375383
bridgeBaseSepoliaUSDCToEthereumSepolia().catch(console.error);
376384
```
385+
386+
### Chain Signatures example
387+
388+
With some minor modifications, the previous example can be adapted to listen transaction requests in a source chain and broadcast transactions in, another, destination chain.
389+
390+
To see the example with the full implementation, check the [Chain Signatures example](https://github.com/LIT-Protocol/chain-signatures).
391+
392+
This opens up a wide range of possibilities, such as cross-chain messaging, token swaps, gas sponsorship, offchain multisigs, and more.
16.3 KB
Loading
24.8 KB
Loading
74.2 KB
Loading
50.4 KB
Loading

0 commit comments

Comments
 (0)