Skip to content

Commit

Permalink
Chainlink local (#2012)
Browse files Browse the repository at this point in the history
* chainlink-local api ref

* chainlink-local api ref

* First edit pass: intro page and minor formatting stuff in API pages

* Baseline architecture page + main page minor fix

* Edit 1 on architecture page

* Revisions round 2

* Link fix

* Baseline local simulator guide

* First edit pass on local simulator guide

* Local simulator guide: edit round 2 plus images

* Add to sidebar; formatting fix

* Baseline simulator fork content plus attempted boilerplate to use PageTabs

* chainlink local

* add index

* add index

* fix formatting

* fix formatting

* fix formatting

* fix links

* fix links

* fix links

* hardhat guides

* index

* fix links

* install instructions

* remix

* remix

* remix

* remix

* remix

* remix

* contributing

* video

* architecture

* nit

* refer in CCIP

* nit

* edit: architecture

* edit: ccip guides index pages

* edit: ccip hardhat guides

* edit: sidebar and ccip remix guide

* edit: data feeds api pages, main intro page

* edit: ccip foundry guides

* edit: miscellaneous nits

* nit

* pin @chainlink/local version

---------

Co-authored-by: Crystal Gomes <thedriftofwords@users.noreply.github.com>
  • Loading branch information
aelmanaa and thedriftofwords authored Aug 14, 2024
1 parent cd31d53 commit f0dd559
Show file tree
Hide file tree
Showing 51 changed files with 3,245 additions and 18 deletions.
11 changes: 11 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"@chainlink/contracts": "1.2.0",
"@chainlink/contracts-ccip": "1.4.0",
"@chainlink/design-system": "^0.1.50",
"@chainlink/local": "^0.2.1",
"@chainlink/solana-sdk": "^0.2.2",
"@metamask/detect-provider": "^2.0.0",
"@metamask/providers": "^10.2.1",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions public/samples/CCIP/TestCCIPLocalSimulator.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

// solhint-disable no-unused-import
import {CCIPLocalSimulator} from "@chainlink/local/src/ccip/CCIPLocalSimulator.sol";
7 changes: 7 additions & 0 deletions src/components/Header/getNavigationProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ const desktopSubProductsNav = [
href: "/chainlink-nodes",
icon: nodesLogo.src,
},
{ label: "Chainlink Local", href: "/chainlink-local", icon: quickstartLogo.src },
{
label: "Quickstarts",
href: "/quickstarts",
Expand Down Expand Up @@ -135,6 +136,12 @@ const docsSections = [
icon: nodesLogo.src,
subProducts: getSubProducts(sidebar.nodeOperator),
},
{
label: "Chainlink Local",
href: "/chainlink-local",
icon: quickstartLogo.src,
subProducts: getSubProducts(sidebar.chainlinkLocal),
},
{
label: "General",
href: "/resources",
Expand Down
100 changes: 84 additions & 16 deletions src/components/LeftSidebar/LeftSidebar.astro
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
---
import { Sections } from "~/content/config"
import { SIDEBAR, MENU, SectionContent } from "../../config"
import { SIDEBAR, SectionContent } from "../../config"
import { flattenChildren } from "../../scripts/flatten-children"
import ActiveIcon from "./ActiveIcon.astro"
export type Props = {
currentPage: string
section?: Sections
Expand Down Expand Up @@ -47,6 +48,19 @@ const isCurrentPageMatch = (sectionUrl: string, currentPage: string, highlightAs
return false
}
// This function checks if any of the nested pages match the current page
const isAnyPageMatch = (contents: SectionContent[], currentPage: string): boolean => {
return contents.some((content) => {
if (isCurrentPageMatch(content.url, currentPage)) {
return true
}
if (content.children && isAnyPageMatch(content.children, currentPage)) {
return true
}
return false
})
}
---

<nav aria-labelledby="grid-left">
Expand All @@ -68,7 +82,7 @@ const isCurrentPageMatch = (sectionUrl: string, currentPage: string, highlightAs
<>
<li>
<a
class="nav-link"
class={`nav-link ${isCurrentPageMatch(child.url, currentPage) ? "active" : ""}`}
href={`${Astro.site?.pathname}${child.url}`}
aria-current={
isCurrentPageMatch(child.url, currentPage, child.highlightAsCurrent) ? "page" : "false"
Expand All @@ -78,19 +92,68 @@ const isCurrentPageMatch = (sectionUrl: string, currentPage: string, highlightAs
{child.title}
</a>
</li>
{child.children &&
child.children.map((childItem) => (
<li>
<a
class="nav-link nested"
href={`${Astro.site?.pathname}${childItem.url}`}
aria-current={isCurrentPageMatch(childItem.url, currentPage) ? "page" : "false"}
>
<ActiveIcon />
{childItem.title}
</a>
</li>
))}
{child.children && (
<ul class="nav-group-entries nested">
{child.children.map((childItem) => (
<>
<li>
<a
class={`nav-link ${
isCurrentPageMatch(childItem.url, currentPage) ? "active" : ""
} nested`}
href={`${Astro.site?.pathname}${childItem.url}`}
aria-current={isCurrentPageMatch(childItem.url, currentPage) ? "page" : "false"}
>
<ActiveIcon />
{childItem.title}
</a>
</li>
{childItem.children && (
<ul class="nav-group-entries nested">
{childItem.children.map((subChildItem) => (
<>
<li>
<a
class={`nav-link ${
isCurrentPageMatch(subChildItem.url, currentPage) ? "active" : ""
} nested`}
href={`${Astro.site?.pathname}${subChildItem.url}`}
aria-current={
isCurrentPageMatch(subChildItem.url, currentPage) ? "page" : "false"
}
>
<ActiveIcon />
{subChildItem.title}
</a>
</li>
{subChildItem.children && (
<ul class="nav-group-entries nested">
{subChildItem.children.map((deepChildItem) => (
<li>
<a
class={`nav-link ${
isCurrentPageMatch(deepChildItem.url, currentPage) ? "active" : ""
} nested`}
href={`${Astro.site?.pathname}${deepChildItem.url}`}
aria-current={
isCurrentPageMatch(deepChildItem.url, currentPage) ? "page" : "false"
}
>
<ActiveIcon />
{deepChildItem.title}
</a>
</li>
))}
</ul>
)}
</>
))}
</ul>
)}
</>
))}
</ul>
)}
</>
))}
</ul>
Expand Down Expand Up @@ -143,6 +206,10 @@ const isCurrentPageMatch = (sectionUrl: string, currentPage: string, highlightAs
margin-bottom: var(--space-2x);
}

.nav-group-entries.nested {
margin-left: var(--space-4x);
}

details summary {
cursor: pointer;
display: flex;
Expand Down Expand Up @@ -182,12 +249,13 @@ const isCurrentPageMatch = (sectionUrl: string, currentPage: string, highlightAs
.nav-link[aria-current="page"] {
font-weight: 500;
}

:global(:root.theme-dark) .nav-link[aria-current="page"] {
color: hsla(var(--color-base-white), 100%, 1);
}

.nav-link.nested {
padding-left: var(--space-5x);
padding-left: var(--space-4x);
}
</style>

Expand Down
72 changes: 71 additions & 1 deletion src/config/sidebar.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import { Sections } from "../content/config"
import chainlinkLocalAPIReference from "./sidebar/chainlink-local/api-reference.json"
export type SectionContent = {
title: string
url: string
highlightAsCurrent?: string[]
children?: { title: string; url: string }[]
children?: SectionContent[]
}
type SectionEntry = {
section: string
contents: SectionContent[]
}

const chainlinkLocalAPIReferenceTyped = chainlinkLocalAPIReference as SectionEntry

export const SIDEBAR: Partial<Record<Sections, SectionEntry[]>> = {
dataFeeds: [
{
Expand Down Expand Up @@ -982,6 +985,10 @@ export const SIDEBAR: Partial<Record<Sections, SectionEntry[]>> = {
title: "Transfer Tokens with Data - Defensive Example",
url: "ccip/tutorials/programmable-token-transfers-defensive",
},
{
title: "Test CCIP Locally",
url: "ccip/tutorials/test-ccip-locally",
},
{
title: "Offchain",
url: "ccip/tutorials/offchain",
Expand Down Expand Up @@ -1139,6 +1146,69 @@ export const SIDEBAR: Partial<Record<Sections, SectionEntry[]>> = {
],
},
],
chainlinkLocal: [
{
section: "Chainlink Local",
contents: [
{
title: "Overview",
url: "chainlink-local",
},
{
title: "Architecture",
url: "chainlink-local/learn/architecture",
},
{
title: "Contributing",
url: "chainlink-local/learn/contributing",
},
],
},
{
section: "Build - CCIP",
contents: [
{
title: "Foundry",
url: "chainlink-local/build/ccip/foundry",
children: [
{
title: "Using the CCIP Local Simulator",
url: "chainlink-local/build/ccip/foundry/local-simulator",
},
{
title: "Using the CCIP Local Simulator in forked environments",
url: "chainlink-local/build/ccip/foundry/local-simulator-fork",
},
],
},
{
title: "Hardhat",
url: "chainlink-local/build/ccip/hardhat",
children: [
{
title: "Using the CCIP Local Simulator",
url: "chainlink-local/build/ccip/hardhat/local-simulator",
},
{
title: "Using the CCIP Local Simulator in forked environments",
url: "chainlink-local/build/ccip/hardhat/local-simulator-fork",
},
],
},
{
title: "Remix IDE",
url: "chainlink-local/build/ccip/remix",
children: [
{
title: "Using the CCIP Local Simulator",
url: "chainlink-local/build/ccip/remix/local-simulator",
},
],
},
],
},
{ ...chainlinkLocalAPIReferenceTyped },
],
nodeOperator: [
{
section: "Chainlink Nodes",
Expand Down
75 changes: 75 additions & 0 deletions src/config/sidebar/chainlink-local/api-reference.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"section": "API Reference",
"contents": [
{
"title": "Solidity",
"url": "chainlink-local/api-reference/solidity",
"children": [
{
"title": "CCIP",
"url": "chainlink-local/api-reference/solidity/ccip",
"children": [
{
"title": "BurnMintERC677Helper",
"url": "chainlink-local/api-reference/solidity/ccip/burnminterc677helper"
},
{ "title": "CCIPLocalSimulator", "url": "chainlink-local/api-reference/solidity/ccip/cciplocalsimulator" },
{
"title": "CCIPLocalSimulatorFork",
"url": "chainlink-local/api-reference/solidity/ccip/cciplocalsimulatorfork"
},
{ "title": "MockEvm2EvmOffRamp", "url": "chainlink-local/api-reference/solidity/ccip/mockevm2evmofframp" },
{ "title": "Register", "url": "chainlink-local/api-reference/solidity/ccip/register" }
]
},
{
"title": "Data Feeds",
"url": "chainlink-local/api-reference/solidity/data-feeds",
"children": [
{
"title": "MockOffchainAggregator",
"url": "chainlink-local/api-reference/solidity/data-feeds/mockoffchainaggregator"
},
{
"title": "MockV3Aggregator",
"url": "chainlink-local/api-reference/solidity/data-feeds/mockv3aggregator"
},
{
"title": "Interfaces",
"url": "chainlink-local/api-reference/solidity/data-feeds/interfaces",
"children": [
{
"title": "AggregatorInterface",
"url": "chainlink-local/api-reference/solidity/data-feeds/interfaces/aggregatorinterface"
},
{
"title": "AggregatorV2V3Interface",
"url": "chainlink-local/api-reference/solidity/data-feeds/interfaces/aggregatorv2v3interface"
},
{
"title": "AggregatorV3Interface",
"url": "chainlink-local/api-reference/solidity/data-feeds/interfaces/aggregatorv3interface"
}
]
}
]
},
{
"title": "Shared",
"url": "chainlink-local/api-reference/solidity/shared",
"children": [
{ "title": "LinkToken", "url": "chainlink-local/api-reference/solidity/shared/linktoken" },
{ "title": "WETH9", "url": "chainlink-local/api-reference/solidity/shared/weth9" }
]
}
]
},
{
"title": "JavaScript",
"url": "chainlink-local/api-reference/javascript",
"children": [
{ "title": "CCIPLocalSimulatorFork", "url": "chainlink-local/api-reference/javascript/cciplocalsimulatorfork" }
]
}
]
}
1 change: 1 addition & 0 deletions src/content/ccip/tutorials/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ You can explore several comprehensive guides to learn about cross-chain interope
- [Transfer Tokens](/ccip/tutorials/cross-chain-tokens)
- [Transfer Tokens with Data](/ccip/tutorials/programmable-token-transfers)
- [Transfer Tokens with Data - Defensive Example](/ccip/tutorials/programmable-token-transfers-defensive)
- [Test CCIP Locally](/ccip/tutorials/test-ccip-locally)
- [Offchain](/ccip/tutorials/offchain)
- [Transfer Tokens between EOAs](/ccip/tutorials/cross-chain-tokens-from-eoa)
- [Checking CCIP Message Status](/ccip/tutorials/get-status-offchain)
Expand Down
Loading

0 comments on commit f0dd559

Please sign in to comment.