Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chainlink local #2012

Merged
merged 49 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
f90c492
chainlink-local api ref
aelmanaa Jul 20, 2024
c7378bb
chainlink-local api ref
aelmanaa Jul 20, 2024
4d61650
First edit pass: intro page and minor formatting stuff in API pages
thedriftofwords Jul 30, 2024
c627b72
Baseline architecture page + main page minor fix
thedriftofwords Jul 30, 2024
e634966
Edit 1 on architecture page
thedriftofwords Jul 30, 2024
2070670
Revisions round 2
thedriftofwords Aug 2, 2024
decb314
Link fix
thedriftofwords Aug 2, 2024
80f9d3d
Baseline local simulator guide
thedriftofwords Aug 2, 2024
da813e6
First edit pass on local simulator guide
thedriftofwords Aug 2, 2024
e8b86c8
Local simulator guide: edit round 2 plus images
thedriftofwords Aug 2, 2024
17f6bdd
Add to sidebar; formatting fix
thedriftofwords Aug 2, 2024
8903206
Baseline simulator fork content plus attempted boilerplate to use Pag…
thedriftofwords Aug 2, 2024
6723939
chainlink local
aelmanaa Aug 6, 2024
8cedd24
add index
aelmanaa Aug 6, 2024
b1a12a9
add index
aelmanaa Aug 6, 2024
8884659
fix formatting
aelmanaa Aug 6, 2024
6f25aa2
fix formatting
aelmanaa Aug 6, 2024
9fa2985
fix formatting
aelmanaa Aug 6, 2024
757df9f
fix links
aelmanaa Aug 6, 2024
c74f6b0
fix links
aelmanaa Aug 6, 2024
1578637
fix links
aelmanaa Aug 6, 2024
94797c7
hardhat guides
aelmanaa Aug 8, 2024
2d4ec3a
index
aelmanaa Aug 8, 2024
e2a2bd2
fix links
aelmanaa Aug 8, 2024
e605cf0
install instructions
aelmanaa Aug 8, 2024
53f9c57
remix
aelmanaa Aug 8, 2024
362ff70
remix
aelmanaa Aug 8, 2024
7694206
remix
aelmanaa Aug 8, 2024
cf87382
remix
aelmanaa Aug 8, 2024
58ec4ca
remix
aelmanaa Aug 8, 2024
a97210d
remix
aelmanaa Aug 8, 2024
5326077
contributing
aelmanaa Aug 8, 2024
1ed337a
video
aelmanaa Aug 8, 2024
66e7e3f
architecture
aelmanaa Aug 9, 2024
62cf0a4
nit
aelmanaa Aug 9, 2024
c40b1ac
refer in CCIP
aelmanaa Aug 9, 2024
a80f7f5
nit
aelmanaa Aug 9, 2024
2006cdf
Merge branch 'main' into ccip-local
aelmanaa Aug 9, 2024
e7ceb4b
edit: architecture
thedriftofwords Aug 11, 2024
3d1dc50
edit: ccip guides index pages
thedriftofwords Aug 11, 2024
f8c5353
edit: ccip hardhat guides
thedriftofwords Aug 11, 2024
20fdeb2
Merge branch 'main' into ccip-local
thedriftofwords Aug 14, 2024
1ed8045
edit: sidebar and ccip remix guide
thedriftofwords Aug 14, 2024
0ab7fb1
edit: data feeds api pages, main intro page
thedriftofwords Aug 14, 2024
b33409e
edit: ccip foundry guides
thedriftofwords Aug 14, 2024
8ba7fa0
Merge branch 'main' into ccip-local
aelmanaa Aug 14, 2024
bd40b7b
edit: miscellaneous nits
thedriftofwords Aug 14, 2024
3278821
nit
aelmanaa Aug 14, 2024
e8813e4
pin @chainlink/local version
aelmanaa Aug 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -978,6 +981,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 @@ -1135,6 +1142,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 CCIP local simulator",
url: "chainlink-local/build/ccip/foundry/local-simulator",
},
{
title: "Using 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 CCIP local simulator",
url: "chainlink-local/build/ccip/hardhat/local-simulator",
},
{
title: "Using CCIP Local Simulator in Forked Environments",
url: "chainlink-local/build/ccip/hardhat/local-simulator-fork",
},
],
},
{
title: "RemixIDE",
url: "chainlink-local/build/ccip/remix",
children: [
{
title: "Using 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