Skip to content

Commit d72e584

Browse files
authored
explain import (#1823)
1 parent 2753a4c commit d72e584

13 files changed

+76
-93
lines changed

src/content/ccip/api-reference/ccip-receiver.mdx

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,9 @@ date: Last Modified
44
title: "CCIPReceiver API Reference"
55
---
66

7-
import { Aside, CopyText } from "@components"
8-
import { Tabs } from "@components/Tabs"
9-
10-
<Aside type="note" title="Add Chainlink CCIP to your project">
11-
If you need to integrate Chainlink CCIP into your project, install the [@chainlink/contracts-ccip NPM package](https://www.npmjs.com/package/@chainlink/contracts-ccip).
12-
13-
<Tabs sharedStore="package" client:visible>
14-
<Fragment slot="tab.1">npm</Fragment>
15-
<Fragment slot="tab.2">yarn</Fragment>
16-
<Fragment slot="panel.1">
17-
If you use [NPM](https://www.npmjs.com/):
18-
```shell
19-
npm install @chainlink/contracts-ccip --save
20-
```
21-
</Fragment>
22-
<Fragment slot="panel.2">
23-
If you use [Yarn](https://yarnpkg.com/):
24-
```shell
25-
yarn add @chainlink/contracts-ccip
26-
```
27-
</Fragment>
28-
</Tabs>
29-
</Aside>
7+
import CcipCommon from "@features/ccip/CcipCommon.astro"
8+
9+
<CcipCommon callout="importCCIPPackage" />
3010

3111
CCIP receiver contracts inherit from _CCIPReceiver_.
3212

src/content/ccip/api-reference/client.mdx

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,9 @@ date: Last Modified
44
title: "Client Library API Reference"
55
---
66

7-
import { Aside, CopyText } from "@components"
8-
import { Tabs } from "@components/Tabs"
9-
10-
<Aside type="note" title="Add Chainlink CCIP to your project">
11-
If you need to integrate Chainlink CCIP into your project, install the [@chainlink/contracts-ccip NPM package](https://www.npmjs.com/package/@chainlink/contracts-ccip).
12-
13-
<Tabs sharedStore="package" client:visible>
14-
<Fragment slot="tab.1">npm</Fragment>
15-
<Fragment slot="tab.2">yarn</Fragment>
16-
<Fragment slot="panel.1">
17-
If you use [NPM](https://www.npmjs.com/):
18-
```shell
19-
npm install @chainlink/contracts-ccip --save
20-
```
21-
</Fragment>
22-
<Fragment slot="panel.2">
23-
If you use [Yarn](https://yarnpkg.com/):
24-
```shell
25-
yarn add @chainlink/contracts-ccip
26-
```
27-
</Fragment>
28-
</Tabs>
29-
</Aside>
7+
import CcipCommon from "@features/ccip/CcipCommon.astro"
8+
9+
<CcipCommon callout="importCCIPPackage" />
3010

3111
CCIP senders and receivers use the _CCIP Client Library_ to build CCIP messages.
3212

src/content/ccip/api-reference/errors.mdx

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,9 @@ date: Last Modified
44
title: "Errors API Reference"
55
---
66

7-
import { Aside, CopyText } from "@components"
8-
import { Tabs } from "@components/Tabs"
7+
import CcipCommon from "@features/ccip/CcipCommon.astro"
98

10-
<Aside type="note" title="Add Chainlink CCIP to your project">
11-
If you need to integrate Chainlink CCIP into your project, install the [@chainlink/contracts-ccip NPM package](https://www.npmjs.com/package/@chainlink/contracts-ccip).
12-
13-
<Tabs sharedStore="package" client:visible>
14-
<Fragment slot="tab.1">npm</Fragment>
15-
<Fragment slot="tab.2">yarn</Fragment>
16-
<Fragment slot="panel.1">
17-
If you use [NPM](https://www.npmjs.com/):
18-
```shell
19-
npm install @chainlink/contracts-ccip --save
20-
```
21-
</Fragment>
22-
<Fragment slot="panel.2">
23-
If you use [Yarn](https://yarnpkg.com/):
24-
```shell
25-
yarn add @chainlink/contracts-ccip
26-
```
27-
</Fragment>
28-
</Tabs>
29-
</Aside>
9+
<CcipCommon callout="importCCIPPackage" />
3010

3111
When invoking the `ccipSend` [function](/ccip/api-reference/i-router-client#ccipsend), it is possible to encounter various errors. These might be thrown either by the CCIP router or by one of the downstream contracts called by the CCIP router. Below is a compiled list of potential errors you might encounter. Referencing this list will enable you to capture and handle these exceptions gracefully.
3212

src/content/ccip/api-reference/i-router-client.mdx

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,10 @@ date: Last Modified
44
title: "IRouterClient API Reference"
55
---
66

7-
import { Aside, CopyText } from "@components"
8-
import { Tabs } from "@components/Tabs"
9-
10-
<Aside type="note" title="Add Chainlink CCIP to your project">
11-
If you need to integrate Chainlink CCIP into your project, install the [@chainlink/contracts-ccip NPM package](https://www.npmjs.com/package/@chainlink/contracts-ccip).
12-
13-
<Tabs sharedStore="package" client:visible>
14-
<Fragment slot="tab.1">npm</Fragment>
15-
<Fragment slot="tab.2">yarn</Fragment>
16-
<Fragment slot="panel.1">
17-
If you use [NPM](https://www.npmjs.com/):
18-
```shell
19-
npm install @chainlink/contracts-ccip --save
20-
```
21-
</Fragment>
22-
<Fragment slot="panel.2">
23-
If you use [Yarn](https://yarnpkg.com/):
24-
```shell
25-
yarn add @chainlink/contracts-ccip
26-
```
27-
</Fragment>
28-
</Tabs>
29-
</Aside>
7+
import { Aside } from "@components"
8+
import CcipCommon from "@features/ccip/CcipCommon.astro"
9+
10+
<CcipCommon callout="importCCIPPackage" />
3011

3112
To send messages through CCIP, users must interact with the `IRouterClient` interface.
3213
After you import `IRouterClient.sol`, you can initialize a router client instance:
@@ -133,7 +114,7 @@ function ccipSend(uint64 destinationChainSelector, struct Client.EVM2AnyMessage
133114
Request a message to be sent to the destination chain.
134115

135116
<Aside type="caution">
136-
If the `msg.value` exceeds the required fee from `getFee`, the over overpayment is accepted with no refund.
117+
If the `msg.value` exceeds the required fee from `getFee`, the overpayment is accepted with no refund.
137118
</Aside>
138119

139120
#### Parameters

src/content/ccip/tutorials/cross-chain-tokens.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,8 @@ You will transfer _0.001 CCIP-BnM_. The CCIP fees for using CCIP will be paid in
190190

191191
## Explanation
192192

193+
<CcipCommon callout="importCCIPPackage" />
194+
193195
The smart contract featured in this tutorial is designed to interact with CCIP to transfer a supported token to an account on a destination chain. The contract code contains supporting comments clarifying the functions, events, and underlying logic. This section further explains initializing the contract and transferring tokens.
194196

195197
### Initializing of the contract

src/content/ccip/tutorials/manual-execution.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ whatsnext:
1212
---
1313

1414
import { CodeSample, ClickToZoom, CopyText, Aside } from "@components"
15+
import CcipCommon from "@features/ccip/CcipCommon.astro"
1516

1617
<Aside type="note">
1718
Read the CCIP [manual execution](/ccip/concepts/manual-execution) conceptual page to understand how manual execution
@@ -223,6 +224,8 @@ You will increase the gas limit and trigger manual execution:
223224

224225
## Explanation
225226

227+
<CcipCommon callout="importCCIPPackage" />
228+
226229
The smart contract used in this tutorial is configured to use CCIP for transferring and receiving tokens with data, similar to the contract in the [_Transfer Tokens with Data_](/ccip/tutorials/programmable-token-transfers) tutorial. For a detailed understanding of the contract code, refer to the [code explanation](/ccip/tutorials/programmable-token-transfers#explanation) section of that tutorial.
227230

228231
A key distinction in this tutorial is the intentional setup of a low gas limit of `20,000` for building the CCIP message. This specific gas limit setting is expected to fail the message delivery on the receiver contract in the destination chain:

src/content/ccip/tutorials/programmable-token-transfers-defensive.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ whatsnext:
1212
---
1313

1414
import { CodeSample, ClickToZoom, CopyText, Aside } from "@components"
15+
import CcipCommon from "@features/ccip/CcipCommon.astro"
1516

1617
This tutorial extends the [programmable token transfers example](/ccip/tutorials/programmable-token-transfers). It uses Chainlink CCIP to transfer tokens and arbitrary data between smart contracts on different blockchains, and focuses on defensive coding in the receiver contract. In the event of a specified error during the CCIP message reception, the contract locks the tokens. Locking the tokens allows the owner to recover and redirect them as needed. Defensive coding is crucial as it enables the recovery of locked tokens and ensures the protection of your users' assets.
1718

@@ -180,6 +181,8 @@ You will transfer _0.001 CCIP-BnM_ and a text. The CCIP fees for using CCIP will
180181

181182
## Explanation
182183

184+
<CcipCommon callout="importCCIPPackage" />
185+
183186
The smart contract featured in this tutorial is designed to interact with CCIP to transfer and receive tokens and data. The contract code is similar to the [_Transfer Tokens with Data_](/ccip/tutorials/programmable-token-transfers) tutorial. Hence, you can refer to its [code explanation](/ccip/tutorials/programmable-token-transfers#explanation). We will only explain the main differences.
184187

185188
### Sending messages

src/content/ccip/tutorials/programmable-token-transfers.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ You will transfer _0.001 CCIP-BnM_ and a text. The CCIP fees for using CCIP will
213213

214214
## Explanation
215215

216+
<CcipCommon callout="importCCIPPackage" />
217+
216218
The smart contract featured in this tutorial is designed to interact with CCIP to transfer and receive tokens and data. The contract code contains supporting comments clarifying the functions, events, and underlying logic. Here we will further explain initializing the contract and sending data with tokens.
217219

218220
### Initializing the contract

src/content/ccip/tutorials/send-arbitrary-data-receipt-acknowledgment.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ whatsnext:
1212
---
1313

1414
import { CodeSample, ClickToZoom, CopyText, Aside } from "@components"
15+
import CcipCommon from "@features/ccip/CcipCommon.astro"
1516

1617
This tutorial will teach you how to use Chainlink CCIP to send arbitrary data between smart contracts on different blockchains and how to track the status of each sent message in the sender contract on the source chain. Tracking the status of sent messages allows your smart contracts to execute actions after the receiver acknowledges it received the message. In this example, the sender contract emits an event after it receives acknowledgment from the receiver.
1718

@@ -337,6 +338,8 @@ When the _message tracker_ receives the acknowledgment message, the `ccipReceive
337338

338339
## Explanation
339340

341+
<CcipCommon callout="importCCIPPackage" />
342+
340343
The smart contracts featured in this tutorial are designed to interact with CCIP to send and receive messages with an acknowledgment of receipt mechanism. The contract code across both contracts contains supporting comments clarifying the functions, events, and underlying logic.
341344

342345
Refer to the [Send Arbitrary Data](/ccip/tutorials/send-arbitrary-data#explanation) tutorial for more explanation about [initializing the contracts](/ccip/tutorials/send-arbitrary-data#initializing-of-the-contract), [sending data, paying in LINK](/ccip/tutorials/send-arbitrary-data#sending-data-and-pay-in-link), and [receiving data](/ccip/tutorials/send-arbitrary-data#receiving-data).

src/content/ccip/tutorials/send-arbitrary-data.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ You will use CCIP to send a text. The CCIP fees for using CCIP will be paid in n
195195

196196
## Explanation
197197

198+
<CcipCommon callout="importCCIPPackage" />
199+
198200
The smart contract featured in this tutorial is designed to interact with CCIP to send and receive messages. The contract code contains supporting comments clarifying the functions, events, and underlying logic. Here we will further explain initializing the contract and sending and receiving data.
199201

200202
### Initializing of the contract

src/content/ccip/tutorials/usdc.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ title: "Transfer USDC with Data"
55
---
66

77
import { Aside, ClickToZoom, CodeSample, CopyText } from "@components"
8+
import CcipCommon from "@features/ccip/CcipCommon.astro"
89

910
USDC is a digital dollar backed 100% and is always redeemable 1:1 for US dollars. The [stablecoin](https://chain.link/education-hub/stablecoins) is issued by [Circle](https://www.circle.com/en/usdc) on multiple blockchain platforms.
1011

@@ -43,6 +44,8 @@ The following describes the operational process:
4344
In this tutorial, you will send a _string_ text and USDC tokens from a smart contract on _Avalanche Fuji_ to a smart contract on _Polygon Mumbai_. You will pay CCIP fees in LINK.
4445
For simplicity, we will use the same contract example as the [Transfer Tokens with Data](/ccip/tutorials/programmable-token-transfers#tutorial) tutorial but for production code, we recommend to apply defensive coding (read the [Transfer Tokens With Data - Defensive Example](/ccip/tutorials/programmable-token-transfers-defensive) tutorial to learn more).
4546

47+
<CcipCommon callout="importCCIPPackage" />
48+
4649
### Before you begin
4750

4851
1. You should understand how to write, compile, deploy, and fund a smart contract. If you need to brush up on the basics, read this [tutorial](/quickstarts/deploy-your-first-contract), which will guide you through using the [Solidity programming language](https://soliditylang.org/), interacting with the [MetaMask wallet](https://metamask.io) and working within the [Remix Development Environment](https://remix.ethereum.org/).

src/features/ccip/CcipCommon.astro

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@ const thirdPartyApps = await Astro.glob("./third-party-apps.mdx")
55
const ThirdPartyAppsComponent = thirdPartyApps[0].Content
66
const SupportedNetworksConcepts = await Astro.glob("./Supported-networks-concepts.mdx")
77
const SupportedNetworksConceptsComponent = SupportedNetworksConcepts[0].Content
8+
const ImportCCIPPackage = await Astro.glob("./ImportCCIPPackage.mdx")
9+
const ImportCCIPPackageComponent = ImportCCIPPackage[0].Content
810
911
export type Props = {
10-
callout?: "extraArgsCallout" | "thirdPartyApps" | "supportedNetworksConcepts"
12+
callout?: "extraArgsCallout" | "thirdPartyApps" | "supportedNetworksConcepts" | "importCCIPPackage"
1113
}
1214
const { callout } = Astro.props as Props
1315
---
1416

1517
{callout === "extraArgsCallout" && <ExtraArgsCalloutComponent />}
1618
{callout === "thirdPartyApps" && <ThirdPartyAppsComponent />}
1719
{callout === "supportedNetworksConcepts" && <SupportedNetworksConceptsComponent />}
20+
{callout === "importCCIPPackage" && <ImportCCIPPackageComponent />}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { Aside, CopyText } from "@components"
2+
import { Tabs } from "@components/Tabs"
3+
4+
<Aside type="note" title="Integrate Chainlink CCIP into your project">
5+
<Tabs sharedStore="package" client:visible>
6+
<Fragment slot="tab.1">npm</Fragment>
7+
<Fragment slot="tab.2">yarn</Fragment>
8+
<Fragment slot="tab.3">foundry</Fragment>
9+
<Fragment slot="panel.1">
10+
11+
If you use [NPM](https://www.npmjs.com/), install the [@chainlink/contracts-ccip NPM
12+
package](https://www.npmjs.com/package/@chainlink/contracts-ccip) and provide the version number:
13+
14+
```shell
15+
npm install @chainlink/[email protected]
16+
```
17+
18+
</Fragment>
19+
<Fragment slot="panel.2">
20+
21+
If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/contracts-ccip NPM
22+
package](https://www.npmjs.com/package/@chainlink/contracts-ccip) and provide the version number:
23+
24+
```shell
25+
yarn add @chainlink/[email protected]
26+
```
27+
28+
</Fragment>
29+
<Fragment slot="panel.3">
30+
31+
If you use [Foundry](https://book.getfoundry.sh/), install a specific [CCIP GitHub
32+
release](https://github.com/smartcontractkit/ccip/releases):
33+
34+
```shell
35+
forge install smartcontractkit/[email protected]
36+
```
37+
38+
</Fragment>
39+
40+
</Tabs>
41+
</Aside>

0 commit comments

Comments
 (0)