Skip to content

Commit

Permalink
chore: fix against new gadget updates
Browse files Browse the repository at this point in the history
  • Loading branch information
drewstone committed Nov 17, 2024
1 parent 5f1dac7 commit 8d911ae
Show file tree
Hide file tree
Showing 16 changed files with 116 additions and 136 deletions.
8 changes: 7 additions & 1 deletion components/GithubFileReaderDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ const GithubFileReaderDisplay: React.FC<GithubFileReaderDisplayProps> = ({
);
}

const getGithubLineLink = () => {
// Add line numbers to GitHub URL
const lineFragment = toLine ? `#L${fromLine}-L${toLine}` : `#L${fromLine}`;
return `${url}${lineFragment}`;
};

return (
<div className="my-6 overflow-hidden border border-gray-200 dark:border-gray-800 rounded-lg">
<div className="flex justify-between items-center px-4 py-2 bg-gray-50 dark:bg-gray-800/50 border-b border-gray-200 dark:border-gray-800">
Expand All @@ -106,7 +112,7 @@ const GithubFileReaderDisplay: React.FC<GithubFileReaderDisplayProps> = ({
Lines {fromLine}-{toLine || "end"}
</span>
<a
href={url}
href={getGithubLineLink()}
target="_blank"
rel="noopener noreferrer"
className="p-1.5 rounded-md hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-400 transition-colors duration-200"
Expand Down
3 changes: 1 addition & 2 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import nextra from "nextra";
import { withPlausibleProxy } from "next-plausible";

/**
* @type {import('next').NextConfig}
Expand Down Expand Up @@ -52,4 +51,4 @@ const withNextra = nextra({
latex: true,
});

export default withPlausibleProxy()(withNextra(nextConfig));
export default withNextra(nextConfig);
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
"lucide-react": "^0.378.0",
"ms": "^2.1.3",
"next": "13.0.0",
"next-plausible": "^3.12.0",
"next-sitemap": "^4.2.3",
"next-themes": "^0.2.0",
"nextra": "^2.13.4",
Expand All @@ -55,7 +54,6 @@
"react-hot-toast": "2.4.0",
"react-icons": "^4.12.0",
"react-lite-youtube-embed": "^2.4.0",
"react-syntax-highlighter": "^15.6.1",
"react-use": "^17.4.0",
"react-use-measure": "^2.1.1",
"rehype-katex": "5.0.0",
Expand Down
36 changes: 28 additions & 8 deletions pages/developers/blueprint-contexts/eigenlayer-context.mdx
Original file line number Diff line number Diff line change
@@ -1,21 +1,41 @@
import GithubFileReaderDisplay from '../../../components/GithubFileReaderDisplay';
---
title: Eigenlayer Context
---

import GithubFileReaderDisplay from '/components/GithubFileReaderDisplay';

# Eigenlayer Context

The `EigenlayerContext` trait provides a standardized interface for interacting with Eigenlayer services and utilities in your Blueprint.

## Overview

The `EigenlayerContext` trait provides access to core Eigenlayer services:
The `EigenlayerContext` trait provides access to core Eigenlayer services and functionality:

### Core Services

- AVS Registry Reader/Writer - For interacting with the AVS registry contracts
- Operator Info Service - For managing operator information and state
- BLS Aggregation Service - For handling BLS signature aggregation

### Operator Management

- Query operator stakes and details
- Track stake history and updates
- Retrieve operator public keys
- Get operator IDs and addresses

### Stake Management

- Get stake information for specific blocks
- Track total stake history
- Query stake updates and changes
- Monitor stake across different quorums

<GithubFileReaderDisplay
url="https://github.com/tangle-network/gadget/blob/main/sdk/src/ctx.rs"
fromLine={108}
toLine={140}
fromLine={125}
toLine={238}
title="EigenlayerContext Trait Definition"
/>

Expand All @@ -27,8 +47,8 @@ First, define your context struct that implements the `EigenlayerContext` trait:

<GithubFileReaderDisplay
url="https://github.com/tangle-network/gadget/blob/main/blueprints/incredible-squaring-eigenlayer/src/contexts/aggregator.rs"
fromLine={45}
toLine={57}
fromLine={43}
toLine={56}
title="Aggregator Context Definition"
/>

Expand All @@ -49,7 +69,7 @@ Finally, instantiate your context in your main runner:

<GithubFileReaderDisplay
url="https://github.com/tangle-network/gadget/blob/main/blueprints/incredible-squaring-eigenlayer/src/main.rs"
fromLine={71}
toLine={84}
fromLine={27}
toLine={45}
title="Instantiating the Context"
/>
10 changes: 7 additions & 3 deletions pages/developers/blueprint-contexts/evm-provider-context.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import GithubFileReaderDisplay from '../../../components/GithubFileReaderDisplay';
---
title: EVM Provider Context
---

import GithubFileReaderDisplay from '/components/GithubFileReaderDisplay';

# EVM Provider Context

Expand All @@ -10,8 +14,8 @@ The `EvmProviderContext` trait provides access to an EVM provider:

<GithubFileReaderDisplay
url="https://github.com/tangle-network/gadget/blob/main/sdk/src/ctx.rs"
fromLine={62}
toLine={71}
fromLine={81}
toLine={90}
title="EvmProviderContext Trait Definition"
/>

Expand Down
12 changes: 8 additions & 4 deletions pages/developers/blueprint-contexts/keystore-context.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import GithubFileReaderDisplay from '../../../components/GithubFileReaderDisplay';
---
title: Keystore Context
---

import GithubFileReaderDisplay from '/components/GithubFileReaderDisplay';

# Keystore Context

Expand All @@ -16,8 +20,8 @@ The `KeystoreContext` trait provides access to a `GenericKeystore` that implemen

<GithubFileReaderDisplay
url="https://github.com/tangle-network/gadget/blob/main/sdk/src/ctx.rs"
fromLine={50}
toLine={54}
fromLine={69}
toLine={73}
title="KeystoreContext Trait Definition"
/>

Expand Down Expand Up @@ -49,7 +53,7 @@ The `KeystoreContext` trait provides comprehensive key management capabilities t

<GithubFileReaderDisplay
url="https://github.com/tangle-network/gadget/blob/main/sdk/src/keystore/backend/mod.rs"
fromLine={21}
fromLine={16}
toLine={27}
title="GenericKeystore Implementation"
/>
Expand Down
10 changes: 7 additions & 3 deletions pages/developers/blueprint-contexts/service-context.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import GithubFileReaderDisplay from '../../../components/GithubFileReaderDisplay';
---
title: Tangle Service Context
---

import GithubFileReaderDisplay from '/components/GithubFileReaderDisplay';

# Service Context

Expand All @@ -15,8 +19,8 @@ The `ServiceContext` trait provides access to service-related functionality that

<GithubFileReaderDisplay
url="https://github.com/tangle-network/gadget/blob/main/sdk/src/ctx.rs"
fromLine={82}
toLine={104}
fromLine={101}
toLine={123}
title="ServiceContext Trait Definition"
/>

Expand Down
10 changes: 7 additions & 3 deletions pages/developers/blueprint-contexts/tangle-client-context.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import GithubFileReaderDisplay from '../../../components/GithubFileReaderDisplay';
---
title: Tangle Client Context
---

import GithubFileReaderDisplay from '/components/GithubFileReaderDisplay';

# Tangle Client Context

Expand All @@ -15,8 +19,8 @@ The `TangleClientContext` trait provides access to a Subxt client that enables:

<GithubFileReaderDisplay
url="https://github.com/tangle-network/gadget/blob/main/sdk/src/ctx.rs"
fromLine={73}
toLine={80}
fromLine={92}
toLine={99}
title="TangleClientContext Trait Definition"
/>

Expand Down
10 changes: 5 additions & 5 deletions pages/developers/blueprint-event-listeners/evm-contracts.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import GithubFileReaderDisplay from '@/components/GithubFileReaderDisplay'

---
title: EVM Contract Listeners
---

## title: EVM Contract Listeners
import GithubFileReaderDisplay from '@/components/GithubFileReaderDisplay'

# EVM Contract Listeners

Expand All @@ -24,7 +24,7 @@ Like the `TangleEventListener`, the `EvmContractEventListener` is already implem

<GithubFileReaderDisplay
url="https://github.com/tangle-network/gadget/blob/main/blueprints/incredible-squaring-eigenlayer/src/jobs/initialize_task.rs"
fromLine={14}
fromLine={13}
toLine={52}
title="Example Blueprint Job with EVM Contract Event Listener"
/>
Expand All @@ -35,7 +35,7 @@ EVM Contract events benefit from a simple pre-processor that extracts the parame

<GithubFileReaderDisplay
url="https://github.com/tangle-network/gadget/blob/main/blueprints/incredible-squaring-eigenlayer/src/jobs/initialize_task.rs"
fromLine={59}
fromLine={54}
toLine={67}
title="Example EVM Contract Event Pre-processor"
/>
8 changes: 6 additions & 2 deletions pages/developers/blueprint-event-listeners/introduction.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
title: Event Listeners
---

import GithubFileReaderDisplay from '@/components/GithubFileReaderDisplay';

## Event Listeners
Expand All @@ -21,8 +25,8 @@ Event listeners in the SDK are designed to be flexible and allow developers to c

<GithubFileReaderDisplay
url="https://github.com/tangle-network/gadget/blob/main/sdk/src/event_listener/mod.rs"
fromLine={12}
toLine={21}
fromLine={14}
toLine={23}
title="Event Listener Trait Definition"
/>

Expand Down
22 changes: 11 additions & 11 deletions pages/developers/blueprint-event-listeners/periodic-listeners.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import GithubFileReaderDisplay from "../../../components/GithubFileReaderDisplay";

---
title: Periodic Listeners
---

## title: Periodic Listeners
import GithubFileReaderDisplay from "/components/GithubFileReaderDisplay";

# Periodic Listeners

Expand Down Expand Up @@ -46,9 +46,9 @@ We can make a `PeriodicEventListener` that ticks every 6000ms to check the statu
Start by defining our inner event listener (`T` = `WebPoller`, in this case), and implement the `EventListener` trait.

<GithubFileReaderDisplay
url="https://github.com/tangle-network/gadget/blob/main/blueprints/examples/src/examples/periodic_web_poller.rs"
fromLine={48}
toLine={83}
url="https://github.com/tangle-network/gadget/blob/main/blueprints/examples/src/periodic_web_poller.rs"
fromLine={50}
toLine={85}
title="Example WebPoller `EventListener` Implementation"
/>

Expand All @@ -57,17 +57,17 @@ Start by defining our inner event listener (`T` = `WebPoller`, in this case), an
Implement the pre-processor and post-processors for the event listener:

<GithubFileReaderDisplay
url="https://github.com/tangle-network/gadget/blob/main/blueprints/examples/src/examples/periodic_web_poller.rs#L29-L46"
fromLine={29}
toLine={46}
url="https://github.com/tangle-network/gadget/blob/main/blueprints/examples/src/periodic_web_poller.rs"
fromLine={31}
toLine={48}
title="Example WebPoller Pre-Processor and Post-Processor"
/>

Integrate the event listener inside the `job`:

<GithubFileReaderDisplay
url="https://github.com/tangle-network/gadget/blob/main/blueprints/examples/src/examples/periodic_web_poller.rs#L14-L27"
url="https://github.com/tangle-network/gadget/blob/main/blueprints/examples/src/periodic_web_poller.rs"
fromLine={14}
toLine={27}
toLine={29}
title="Example Job with Periodic Web Poller Listener"
/>
16 changes: 8 additions & 8 deletions pages/developers/blueprint-event-listeners/tangle-job-calls.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import GithubFileReaderDisplay from '@/components/GithubFileReaderDisplay';

---
title: Tangle Job Call Listeners
---

## title: Tangle Job Call Listeners
import GithubFileReaderDisplay from '@/components/GithubFileReaderDisplay';

# Tangle Job Call Listeners

Expand Down Expand Up @@ -33,7 +33,7 @@ The `TangleEventListener` is already implemented and ready to use. Simply regist
will automatically work with the Tangle network.

<GithubFileReaderDisplay
url="https://github.com/tangle-network/blueprint-template/blob/main/src/lib.rs#L11-L32"
url="https://github.com/tangle-network/blueprint-template/blob/main/src/lib.rs"
fromLine={11}
toLine={32}
title="Example Blueprint Job with Tangle JobCalled Event Listener"
Expand All @@ -52,7 +52,7 @@ The pre-processor for Tangle job calls handles the following tasks:
3. Prepares the data for processing by the job handler

<GithubFileReaderDisplay
url="https://github.com/tangle-network/gadget/blob/main/sdk/src/event_listener/tangle/jobs.rs#L7-L51"
url="https://github.com/tangle-network/gadget/blob/main/sdk/src/event_listener/tangle/jobs.rs"
fromLine={7}
toLine={51}
title="Tangle Job Call Pre-processor Implementation"
Expand All @@ -67,8 +67,8 @@ The post-processor for Tangle job calls handles the following tasks:
3. Handles any cleanup or finalization required after job execution

<GithubFileReaderDisplay
url="https://github.com/tangle-network/gadget/blob/main/sdk/src/event_listener/tangle/jobs.rs#L54-L73"
fromLine={54}
toLine={73}
url="https://github.com/tangle-network/gadget/blob/main/sdk/src/event_listener/tangle/jobs.rs"
fromLine={53}
toLine={74}
title="Tangle Job Call Post-processor Implementation"
/>
Loading

0 comments on commit 8d911ae

Please sign in to comment.