Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
805 changes: 8 additions & 797 deletions docs/build-decentralized-apps/01-quickstart-solidity-remix.mdx

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Build on Arbitrum or dive deeper into the network.
- [Contract addresses](/build-decentralized-apps/reference/contract-addresses) — key Arbitrum contract addresses
- [Chain info and RPC endpoints](/for-devs/dev-tools-and-resources/chain-info) — chain IDs, RPC URLs, and network parameters
- [How to estimate gas](/build-decentralized-apps/how-to-estimate-gas) — understand gas costs on Arbitrum
- [Quickstart: Build a dApp](/build-decentralized-apps/quickstart-solidity-remix) — deploy your first contract on Arbitrum
- [Quickstart: Build a dApp](/build-decentralized-apps/quickstart-solidity) — deploy your first contract on Arbitrum
- [Run a full node](/run-arbitrum-node/run-full-node) — run your own Arbitrum node

import KnowMoreToolsBox from '../../for-devs/partials/_know-more-tools-box-partial.mdx';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Before implementing and deploying a custom gateway, it is strongly encouraged to

In this how-to, you'll learn how to bridge your own token between Ethereum (the parent chain) and Arbitrum (the child chain), using a custom gateway. For alternative ways of bridging tokens, check out the [token bridging overview](/build-decentralized-apps/token-bridging/get-started.mdx).

Familiarity with [Arbitrum's token bridge system](/how-arbitrum-works/deep-dives/token-bridging.mdx), smart contracts, and decentralized application development is expected. If you're new to developing on Arbitrum, consider reviewing our [Quickstart: Build a dApp with Arbitrum (Solidity, Remix)](/build-decentralized-apps/01-quickstart-solidity-remix.mdx) before proceeding. We'll use [Arbitrum's SDK](https://github.com/OffchainLabs/arbitrum-sdk) throughout this how-to, although no prior knowledge is required.
Familiarity with [Arbitrum's token bridge system](/how-arbitrum-works/deep-dives/token-bridging.mdx), smart contracts, and decentralized application development is expected. If you're new to developing on Arbitrum, consider reviewing our [Quickstart: Build a dApp with Arbitrum (Solidity)](/build-decentralized-apps/quickstart-solidity) before proceeding. We'll use [Arbitrum's SDK](https://github.com/OffchainLabs/arbitrum-sdk) throughout this how-to, although no prior knowledge is required.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Familiarity with [Arbitrum's token bridge system](/how-arbitrum-works/deep-dives/token-bridging.mdx), smart contracts, and decentralized application development is expected. If you're new to developing on Arbitrum, consider reviewing our [Quickstart: Build a dApp with Arbitrum (Solidity)](/build-decentralized-apps/quickstart-solidity) before proceeding. We'll use [Arbitrum's SDK](https://github.com/OffchainLabs/arbitrum-sdk) throughout this how-to, although no prior knowledge is required.
Familiarity with [Arbitrum's token bridge system](/how-arbitrum-works/deep-dives/token-bridging.mdx), smart contracts, and decentralized application development is expected. If you're new to developing on Arbitrum, consider reviewing our [Quickstart: Build an app with Arbitrum (Solidity)](/build-decentralized-apps/quickstart-solidity) before proceeding. We'll use [Arbitrum's SDK](https://github.com/OffchainLabs/arbitrum-sdk) throughout this how-to, although no prior knowledge is required.


We will go through all the steps involved in the process. However, if you want to jump straight to the code, we have created a [custom gateway bridging tutorial script](https://github.com/OffchainLabs/arbitrum-tutorials/tree/master/packages/custom-gateway-bridging) that encapsulates the entire process.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ displayed_sidebar: buildAppsSidebar

In this how-to, you'll learn how to bridge your own token between Ethereum (parent chain) and Arbitrum (child chain), using [Arbitrum's generic-custom gateway](/how-arbitrum-works/deep-dives/token-bridging.mdx#the-arbitrum-generic-custom-gateway). For alternative ways of bridging tokens, check out the [token bridging overview](/how-arbitrum-works/deep-dives/token-bridging.mdx).

Familiarity with [Arbitrum's token bridge system](/how-arbitrum-works/deep-dives/token-bridging.mdx), smart contracts, and blockchain development is expected. If you're new to blockchain development, consider reviewing our [Quickstart: Build a dApp with Arbitrum (Solidity, Hardhat)](/build-decentralized-apps/01-quickstart-solidity-remix.mdx) before proceeding. We'll use [Arbitrum's SDK](https://github.com/OffchainLabs/arbitrum-sdk) throughout this how-to, although no prior knowledge is required.
Familiarity with [Arbitrum's token bridge system](/how-arbitrum-works/deep-dives/token-bridging.mdx), smart contracts, and blockchain development is expected. If you're new to blockchain development, consider reviewing our [Quickstart: Build a dApp with Arbitrum (Solidity, Hardhat)](/build-decentralized-apps/quickstart-solidity) before proceeding. We'll use [Arbitrum's SDK](https://github.com/OffchainLabs/arbitrum-sdk) throughout this how-to, although no prior knowledge is required.

We'll go through all the steps involved in the process. However, if you want to jump straight to the code, we've created a [custom token bridging tutorial script](https://github.com/OffchainLabs/arbitrum-tutorials/tree/master/packages/custom-token-bridging) that encapsulates the entire process.

Expand Down
2 changes: 1 addition & 1 deletion docs/for-devs/oracles/api3/api3.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ contract ARBPriceConsumer {
}
```

You can adapt this contract to your needs. Just remember to use the address of the asset you want to request the price for in the appropriate network and to **deploy your contract to the same network**. Remember we have a [Quickstart](/build-decentralized-apps/01-quickstart-solidity-remix.mdx) available that goes through the process of compiling and deploying a contract.
You can adapt this contract to your needs. Just remember to use the address of the asset you want to request the price for in the appropriate network and to **deploy your contract to the same network**. Remember we have a [Quickstart](/build-decentralized-apps/quickstart-solidity) available that goes through the process of compiling and deploying a contract.

## More examples

Expand Down
2 changes: 1 addition & 1 deletion docs/for-devs/oracles/chainlink/chainlink.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ contract ARBPriceConsumer {
}
```

You can adapt this contract to your needs. Just remember to use the address of the asset you want to request the price for in the appropriate network, and to **deploy your contract to the same network**. Remember we have a [Quickstart](/build-decentralized-apps/01-quickstart-solidity-remix.mdx) available that goes through the process of compiling and deploying a contract.
You can adapt this contract to your needs. Just remember to use the address of the asset you want to request the price for in the appropriate network, and to **deploy your contract to the same network**. Remember we have a [Quickstart](/build-decentralized-apps/quickstart-solidity) available that goes through the process of compiling and deploying a contract.

## More examples

Expand Down
2 changes: 1 addition & 1 deletion docs/for-devs/oracles/trellor/trellor.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ contract ARBPriceConsumer is UsingTellor {
}
```

You can adapt this contract to your needs. Just remember to use the ticker of the assets you want to request the price for and to **deploy your contract to the appropriate network, with the address of the Oracle contract in that network**. Remember, we have a [Quickstart](/build-decentralized-apps/01-quickstart-solidity-remix.mdx) available that goes through the process of compiling and deploying a contract.
You can adapt this contract to your needs. Just remember to use the ticker of the assets you want to request the price for and to **deploy your contract to the appropriate network, with the address of the Oracle contract in that network**. Remember, we have a [Quickstart](/build-decentralized-apps/quickstart-solidity) available that goes through the process of compiling and deploying a contract.

## See also

Expand Down
24 changes: 20 additions & 4 deletions docs/get-started/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,26 @@ Deploy smart contracts to Arbitrum One, Arbitrum Nova, or any Arbitrum chain.
gap: '20px',
}}
>
<Card title="Quickstart (Solidity)" description="Deploy your first Solidity smart contract to Arbitrum using Remix." href="/build-decentralized-apps/quickstart-solidity-remix" />
<Card title="Quickstart (Rust)" description="Deploy your first Rust smart contract using Arbitrum Stylus." href="/stylus/quickstart" />
<Card title="Explore Stylus" description="Write EVM-compatible smart contracts in Rust, C, and other languages that compile to Wasm." href="/stylus/gentle-introduction" />
<Card title="Chain info" description="Chain IDs, RPC endpoints, and network parameters." href="/for-devs/dev-tools-and-resources/chain-info" />
<Card
title="Quickstart (Solidity)"
description="Deploy your first Solidity smart contract to Arbitrum using the Solidity lab."
href="/build-decentralized-apps/quickstart-solidity"
/>
<Card
title="Quickstart (Rust)"
description="Deploy your first Rust smart contract using Arbitrum Stylus."
href="/stylus/quickstart"
/>
<Card
title="Explore Stylus"
description="Write EVM-compatible smart contracts in Rust, C, and other languages that compile to Wasm."
href="/stylus/gentle-introduction"
/>
<Card
title="Chain info"
description="Chain IDs, RPC endpoints, and network parameters."
href="/for-devs/dev-tools-and-resources/chain-info"
/>
</div>

## Launch your own chain
Expand Down
3 changes: 2 additions & 1 deletion docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ const config = {
],
require.resolve('docusaurus-plugin-fathom'),
require.resolve('docusaurus-plugin-sass'),
require.resolve('./src/plugins/interactive-tutorials'),
[
'@signalwire/docusaurus-plugin-llms-txt',
{
Expand Down Expand Up @@ -256,7 +257,7 @@ const config = {
items: [
{
label: 'Build with Solidity',
to: '/build-decentralized-apps/quickstart-solidity-remix',
to: '/build-decentralized-apps/quickstart-solidity',
},
{
label: 'Build with Stylus',
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
"prismjs": "^1.29.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-joyride": "^3.0.2",
"react-syntax-highlighter": "^15.6.1",
"rehype-katex": "7",
"remark-math": "6",
Expand Down
151 changes: 151 additions & 0 deletions src/components/InteractiveTutorials/CodeWalkthrough.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
import React, { useMemo, useState } from 'react';
import clsx from 'clsx';
import { usePrismTheme } from '@docusaurus/theme-common';
import Highlight, { defaultProps, Language } from 'prism-react-renderer';
import { parseCodeTitle, parseCodeWalkthrough } from './codeWalkthroughParser';
import styles from './styles.module.css';

type Props = {
children: string;
className?: string;
language?: string;
metastring?: string;
title?: string;
};

function normalizeLanguage(language?: string, className?: string): string {
const fromClassName = className?.match(/language-([^\s]+)/)?.[1];
return (language || fromClassName || 'text').toLowerCase();
}

function resolveHighlightLanguage(language: string): string {
if (defaultProps.Prism.languages[language]) return language;
if (language === 'solidity' || language === 'rust') return 'clike';
if (language === 'shell' || language === 'sh') return 'bash';
return 'text';
}

function isActiveLine(lineNumber: number, startLine: number, endLine: number): boolean {
return lineNumber >= startLine && lineNumber <= endLine;
}

export function CodeWalkthrough({
children,
className,
language: languageProp,
metastring,
title,
}: Props) {
const parsed = useMemo(() => parseCodeWalkthrough(children), [children]);
const language = normalizeLanguage(languageProp, className);
const highlightLanguage = resolveHighlightLanguage(language);
const prismTheme = usePrismTheme();
const [activeIndex, setActiveIndex] = useState(0);
const activeStep = parsed.steps[activeIndex];
const resolvedTitle = parseCodeTitle(metastring, title);

const copyCode = async () => {
if (typeof navigator === 'undefined' || !navigator.clipboard) return;
await navigator.clipboard.writeText(parsed.code);
};

if (parsed.steps.length === 0) {
return (
<pre className={className}>
<code>{children}</code>
</pre>
);
}

return (
<div className={styles.codeWalkthrough}>
<div className={styles.walkthroughCodePane}>
<div className={styles.walkthroughCodeHeader}>
<span>{resolvedTitle || language}</span>
<button type="button" onClick={copyCode} className={styles.secondaryButton}>
Copy
</button>
</div>
<Highlight
Prism={defaultProps.Prism}
theme={prismTheme}
code={parsed.code}
language={highlightLanguage as Language}
>
{({ className: highlightClassName, style, tokens, getLineProps, getTokenProps }) => (
<pre
className={clsx(highlightClassName, styles.walkthroughPre, 'thin-scrollbar')}
style={style}
tabIndex={0}
>
<code>
{tokens.map((line, index) => {
const lineNumber = index + 1;
const lineProps = getLineProps({ line });
const { key: lineKey, ...linePropsWithoutKey } = lineProps;
return (
<span
key={lineKey || index}
{...linePropsWithoutKey}
className={clsx(
lineProps.className,
styles.walkthroughLine,
activeStep &&
isActiveLine(lineNumber, activeStep.startLine, activeStep.endLine) &&
styles.walkthroughLineActive,
)}
>
<span className={styles.walkthroughLineNumber}>{lineNumber}</span>
<span className={styles.walkthroughLineContent}>
{line.map((token, key) => {
const tokenProps = getTokenProps({ token });
const { key: tokenKey, ...tokenPropsWithoutKey } = tokenProps;

return <span key={tokenKey || key} {...tokenPropsWithoutKey} />;
})}
</span>
</span>
);
})}
</code>
</pre>
)}
</Highlight>
</div>
<div className={styles.walkthroughSteps}>
{parsed.steps.map((step, index) => (
<button
key={step.id}
type="button"
className={clsx(styles.walkthroughStep, index === activeIndex && styles.activeStep)}
onClick={() => setActiveIndex(index)}
>
<span className={styles.stepKicker}>
{index + 1} / {parsed.steps.length}
</span>
<span className={styles.stepTitle}>{step.title}</span>
{step.body && <span className={styles.stepBody}>{step.body}</span>}
</button>
))}
<div className={styles.walkthroughControls}>
<button
type="button"
className={styles.secondaryButton}
disabled={activeIndex === 0}
onClick={() => setActiveIndex((value) => Math.max(0, value - 1))}
>
Previous
</button>
<button
type="button"
className={styles.primaryButton}
disabled={activeIndex === parsed.steps.length - 1}
onClick={() => setActiveIndex((value) => Math.min(parsed.steps.length - 1, value + 1))}
>
Next
</button>
</div>
</div>
</div>
);
}
23 changes: 23 additions & 0 deletions src/components/InteractiveTutorials/InteractiveTutorialShell.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React, { ReactNode, useEffect } from 'react';
import styles from './styles.module.css';

type Props = {
children: ReactNode;
estimatedTime?: string;
tutorialKind?: string;
};

export function InteractiveTutorialShell({ children }: Props) {
useEffect(() => {
document.body.classList.add('interactive-tutorial-page');
return () => document.body.classList.remove('interactive-tutorial-page');
}, []);

return (
<div className={styles.tutorialShell}>
<div data-interactive-tutorial-content className={styles.tutorialContent}>
{children}
</div>
</div>
);
}
Loading
Loading