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

move files around for tutorials reorg #168

Merged
merged 56 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
feef8aa
initial content
Sep 18, 2024
ada142f
sync
Sep 18, 2024
8df8d76
prerequisites
Sep 18, 2024
44c5acd
prerequisites
Sep 18, 2024
39010a7
Merge branch 'ilariae/token-bridge' of https://github.com/wormhole-fo…
Sep 19, 2024
69f253d
Merge branch 'main' of https://github.com/wormhole-foundation/wormhol…
Sep 19, 2024
6c46418
content
Sep 23, 2024
4879614
Merge branch 'main' of https://github.com/wormhole-foundation/wormhol…
Sep 23, 2024
abc2739
get started with token bridge page
Sep 23, 2024
1596647
token bridge learn update
Sep 23, 2024
15baabd
grammarly check and minor changes
Sep 23, 2024
84281d2
Merge branch 'main' of https://github.com/wormhole-foundation/wormhol…
Sep 23, 2024
f151923
Merge branch 'main' of https://github.com/wormhole-foundation/wormhol…
Sep 25, 2024
6a51aa5
Merge branch 'main' of https://github.com/wormhole-foundation/wormhol…
Sep 30, 2024
7b08a13
Update build/contract-integrations/token-bridge.md
ilariae Sep 30, 2024
3631664
Update build/contract-integrations/token-bridge.md
ilariae Sep 30, 2024
a4439e8
Update build/contract-integrations/token-bridge.md
ilariae Sep 30, 2024
1c6e87f
minor fix
Sep 30, 2024
e24d0ed
added diagram
Sep 30, 2024
4b8c7d5
Apply suggestions from code review
ilariae Oct 1, 2024
15d2d44
Merge branch 'ilariae/token-bridge' of https://github.com/wormhole-fo…
Oct 1, 2024
5bd9cda
Merge branch 'main' of https://github.com/wormhole-foundation/wormhol…
Oct 1, 2024
c7b7ff7
minor learn fix
Oct 1, 2024
f9ee9c6
Merge branch 'main' of https://github.com/wormhole-foundation/wormhol…
Oct 12, 2024
f9ff9eb
Merge branch 'main' of https://github.com/wormhole-foundation/wormhol…
Oct 21, 2024
1d5abbf
sync
Nov 28, 2024
2f80963
comments
Nov 29, 2024
e8ca50e
Merge branch 'main' of https://github.com/wormhole-foundation/wormhol…
Dec 9, 2024
a4dc093
move files around for tutorials reorg
eshaben Dec 10, 2024
cd6880c
update file name
eshaben Dec 10, 2024
4501262
index pages
Dec 17, 2024
15c1a39
Merge branch 'main' of https://github.com/wormhole-foundation/wormhol…
Dec 17, 2024
3815208
token attestation
Dec 17, 2024
172d262
token transfers
Dec 17, 2024
36a5c83
redemption
Dec 17, 2024
9235381
grammarly
Dec 17, 2024
bcec89f
index cards
Dec 18, 2024
654f00c
sync and resolve conflict
Dec 18, 2024
a957b6b
index cards
Dec 18, 2024
9a7127a
meta descriptions
Dec 18, 2024
6a700f6
Apply suggestions from code review
ilariae Dec 19, 2024
9dbd01e
Merge branch 'ilariae/token-bridge' of https://github.com/wormhole-fo…
Dec 19, 2024
4545cde
Merge branch 'main' into reorg-tutorials
ilariae Dec 20, 2024
0562294
Merge branch 'reorg-tutorials' of https://github.com/wormhole-foundat…
Dec 23, 2024
e23ba8e
Merge branch 'main' of https://github.com/wormhole-foundation/wormhol…
Dec 23, 2024
80e6f45
additional resources
Dec 23, 2024
ab4128b
tutorial repo redirects
Dec 23, 2024
6b23a82
github icon
Dec 23, 2024
1602a9f
remove gateway
Dec 23, 2024
85438ab
Martinh/xassets (#148)
martin0995 Dec 23, 2024
fba90bb
Merge branch 'main' into reorg-tutorials
ilariae Dec 23, 2024
a4d847e
Apply suggestions from code review
eshaben Dec 23, 2024
c92b694
remove token bridge stuff
eshaben Dec 23, 2024
132b230
rename cross-chain contracts to contract integrations
eshaben Dec 23, 2024
a28bb0a
minor fix
eshaben Dec 23, 2024
1eace62
Update tutorials/by-product/index.md
eshaben Dec 23, 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
2 changes: 0 additions & 2 deletions build/contract-integrations/.pages
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ nav:
- index.md
- 'Wormhole Relayer': 'wormhole-relayers.md'
- 'Core Contracts': 'core-contracts.md'
# - 'Token Bridge': 'token-bridge.md'
- 'CCTP': 'cctp.md'
- native-token-transfers
- multigov
- 'Development Environment': 'dev-env.md'
- 'FAQs': 'faqs.md'
2 changes: 1 addition & 1 deletion build/contract-integrations/wormhole-relayers.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,4 @@ See the [Wormhole CLI tool docs](/docs/build/toolkit/cli/) for installation and

## Step-by-Step Tutorial

For detailed, step-by-step guidance on creating cross-chain contracts that interact with the Wormhole relayer, refer to the [Create Cross-Chain Contracts](/docs/tutorials/messaging/cross-chain-contracts/) tutorial.
For detailed, step-by-step guidance on creating cross-chain contracts that interact with the Wormhole relayer, refer to the [Create Cross-Chain Contracts](/docs/tutorials/by-product/contract-integrations/cross-chain-contracts/) tutorial.
4 changes: 2 additions & 2 deletions build/toolkit/solidity-sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,5 +162,5 @@ The SDK includes built-in support for Forge-based testing, which allows you to t

For a detailed example, check out the below repositories:

- [Cross chain messaging](/docs/tutorials/messaging/cross-chain-contracts/){target=\_blank}
- [Cross chain token transfer](/docs/tutorials/messaging/cross-chain-token-contracts/){target=\_blank}
- [Cross chain messaging](/docs/tutorials/by-product/contract-integrations/cross-chain-contracts/){target=\_blank}
- [Cross chain token transfer](/docs/tutorials/by-product/contract-integrations/cross-chain-token-contracts/){target=\_blank}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion learn/governance/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Discover everything you need to know about MultiGov, Wormhole's cross-chain gove

Access step-by-step guides for executing cross-chain governance actions, including treasury management proposals with MultiGov and Wormhole.

[:octicons-arrow-right-16: Create MultiGov solutions](/docs/tutorials/multigov/)
[:octicons-arrow-right-16: Create MultiGov solutions](/docs/tutorials/by-product/multigov/)

- :octicons-question-16:{ .lg .middle } **Technical FAQs**

Expand Down
4 changes: 2 additions & 2 deletions tutorials/.pages
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
title: Tutorials
nav:
- index.md
- messaging
- multigov
- by-product
# - end-to-end
8 changes: 8 additions & 0 deletions tutorials/by-product/.pages
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
title: Tutorials by Product
nav:
- index.md
- connect
- contract-integrations
- native-token-transfers
- multigov
- wormhole-sdk
4 changes: 4 additions & 0 deletions tutorials/by-product/connect/.pages
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
title: Connect
nav:
- index.md
- 'Integrate Connect into a React DApp': react-dapp.md
34 changes: 34 additions & 0 deletions tutorials/by-product/connect/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
title: Wormhole Connect Tutorials
description: Enable cross-chain connectivity with Wormhole Connect. Learn integration and simplify user experiences across multiple blockchains.
---

# Connect Tutorials

Wormhole Connect makes it simple to link your application to multiple blockchain ecosystems. These tutorials will teach you how to integrate Connect into your projects, streamline cross-chain interactions, simplify user onboarding, and deliver a smoother overall experience.

<div class="grid cards" markdown>

- :octicons-repo-16:{ .lg .middle } **Integrate Connect into a React DApp**

---

Learn how to incorporate Wormhole Connect into a React application. This step-by-step tutorial guides you through enabling cross-chain token transfers and interactions, bridging assets between networks, and enhancing the user experience with streamlined blockchain connectivity.

[:octicons-arrow-right-16: Start building](/docs/tutorials/by-product/connect/react-dapp/)

</div>

## Additional Resources

<div class="grid cards" markdown>

- :octicons-tools-16:{ .lg .middle } **Connect**

---

Get deeper insights into setting up and customizing Wormhole Connect. Explore advanced guides, best practices, and configuration tips to streamline your cross-chain integrations.

[:octicons-arrow-right-16: Learn more](/docs/build/applications/connect/)

</div>
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
---
title: Transfer Tokens Cross-Chain with Connect
title: Integrate Connect into a React DApp Tutorial
description: Learn how to use Wormhole Connect to transfers tokens cross-chain seamlessly between Sui and Avalanche Fuji with this step-by-step guide.
---

# Cross-Chain Token Transfers with Wormhole Connect
# Integrate Connect into a React DApp

:simple-github: [Source code on GitHub](https://github.com/wormhole-foundation/demo-basic-connect){target=\_blank}

## Introduction

Expand Down Expand Up @@ -127,38 +129,38 @@ To transfer tokens from Sui to Fuji in the Wormhole Connect interface:
2. Choose **Fuji** as the destination network and connect your wallet with the Fuji network
3. Enter the amount of SUI tokens you wish to transfer

![](/docs/images/tutorials/connect/connect-1.webp)
![](/docs/images/tutorials/by-product/connect/react-dapp/connect-1.webp)

4. Choose to view other routes

![](/docs/images/tutorials/connect/connect-2.webp)
![](/docs/images/tutorials/by-product/connect/react-dapp/connect-2.webp)

5. Select the manual bridge option, which will require two transactions: one on the source chain (Sui) and one on the destination chain (Fuji)

!!! note
It is recommended to use the manual bridge option for this tutorial. The automatic bridge feature is currently undergoing improvements, while the manual bridge ensures that transfers complete successfully.

![](/docs/images/tutorials/connect/connect-3.webp)
![](/docs/images/tutorials/by-product/connect/react-dapp/connect-3.webp)

6. Review and confirm the transfer on Sui. This will lock your tokens on the Sui chain

![](/docs/images/tutorials/connect/connect-4.webp)
![](/docs/images/tutorials/by-product/connect/react-dapp/connect-4.webp)

7. Follow the on-screen prompts to approve the transaction. You will be asked to sign with your Sui wallet

![](/docs/images/tutorials/connect/connect-5.webp)
![](/docs/images/tutorials/by-product/connect/react-dapp/connect-5.webp)

Once the transaction has been submitted, Wormhole Connect will display the progress of the transfer. Monitor the status until you’re prompted to complete the transaction on the destination chain. You can also track your transactions on [Wormholescan](https://wormholescan.io/#/?network=Testnet){target=\_blank}.

## Claim Tokens on Fuji

After the Sui transaction is complete, confirm the final transaction on Fuji by claiming the wrapped tokens. You will be asked to confirm the transaction with your Fuji wallet.

![](/docs/images/tutorials/connect/connect-6.webp)
![](/docs/images/tutorials/by-product/connect/react-dapp/connect-6.webp)

Once confirmed, check your Fuji wallet to verify that the wrapped SUI tokens have been successfully received.

![](/docs/images/tutorials/connect/connect-7.webp)
![](/docs/images/tutorials/by-product/connect/react-dapp/connect-7.webp)

## Resources

Expand Down
5 changes: 5 additions & 0 deletions tutorials/by-product/contract-integrations/.pages
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
title: Contract Integrations
nav:
- index.md
- 'Create Messaging Contracts': 'cross-chain-contracts.md'
- 'Create Token Transfer Contracts': 'cross-chain-token-contracts.md'
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Create Cross-Chain Contracts
description: Learn how to create cross-chain contracts using Wormhole's Solidity SDK. Deploy contracts on Avalanche and Celo Testnets and send messages across chains.
---

# Create Cross-Chain Contracts
# Create Cross-Chain Messaging Contracts

## Introduction

Expand Down Expand Up @@ -55,15 +55,15 @@ Key functions include:
Here's the core of the contract:

```solidity
--8<-- "code/tutorials/messaging/cross-chain-contracts/snippet-1.sol:24:43"
--8<-- "code/tutorials/by-product/contract-integrations/cross-chain-contracts/snippet-1.sol:24:43"
```

You can find the full code for the `MessageSender.sol` below.

??? code "MessageSender.sol"

```solidity
--8<-- "code/tutorials/messaging/cross-chain-contracts/snippet-1.sol"
--8<-- "code/tutorials/by-product/contract-integrations/cross-chain-contracts/snippet-1.sol"
```

### Receiver Contract: MessageReceiver
Expand All @@ -81,24 +81,24 @@ Key implementation details include:
- **`isRegisteredSender`** - restricts the processing of messages to only those from registered senders, preventing unauthorized cross-chain communication

```solidity
--8<-- "code/tutorials/messaging/cross-chain-contracts/snippet-2.sol:12:13"
--8<-- "code/tutorials/messaging/cross-chain-contracts/snippet-2.sol:22:39"
--8<-- "code/tutorials/by-product/contract-integrations/cross-chain-contracts/snippet-2.sol:12:13"
--8<-- "code/tutorials/by-product/contract-integrations/cross-chain-contracts/snippet-2.sol:22:39"
```

#### Message Processing

The `receiveWormholeMessages` is the core function that processes the received message. It checks that the Wormhole relayer sent the message, decodes the payload, and emits an event with the message content. It is essential to verify the message sender to prevent unauthorized messages.

```solidity
--8<-- "code/tutorials/messaging/cross-chain-contracts/snippet-2.sol:42:64"
--8<-- "code/tutorials/by-product/contract-integrations/cross-chain-contracts/snippet-2.sol:42:64"
```

You can find the full code for the `MessageReceiver.sol` below.

??? code "MessageReceiver.sol"

```solidity
--8<-- "code/tutorials/messaging/cross-chain-contracts/snippet-2.sol"
--8<-- "code/tutorials/by-product/contract-integrations/cross-chain-contracts/snippet-2.sol"
```

## Deploy Contracts
Expand Down Expand Up @@ -165,7 +165,7 @@ The repository includes:

The expected output should be similar to this:

--8<-- "code/tutorials/messaging/cross-chain-contracts/snippet-7.html"
--8<-- "code/tutorials/by-product/contract-integrations/cross-chain-contracts/snippet-7.html"

### Deployment Process

Expand All @@ -176,19 +176,19 @@ Both deployment scripts, `deploySender.js` and `deployReceiver.js`, perform the
=== "`chains.json`"

```json
--8<-- "code/tutorials/messaging/cross-chain-contracts/snippet-9.json"
--8<-- "code/tutorials/by-product/contract-integrations/cross-chain-contracts/snippet-9.json"
```

=== "`deploySender.js`"

```javascript
--8<-- "code/tutorials/messaging/cross-chain-contracts/snippet-5.js:7:15"
--8<-- "code/tutorials/by-product/contract-integrations/cross-chain-contracts/snippet-5.js:7:15"
```

=== "`deployReceiver.js`"

```javascript
--8<-- "code/tutorials/messaging/cross-chain-contracts/snippet-6.js:7:15"
--8<-- "code/tutorials/by-product/contract-integrations/cross-chain-contracts/snippet-6.js:7:15"
```

!!! note
Expand All @@ -199,49 +199,49 @@ Both deployment scripts, `deploySender.js` and `deployReceiver.js`, perform the
=== "`deploySender.js`"

```javascript
--8<-- "code/tutorials/messaging/cross-chain-contracts/snippet-5.js:18:19"
--8<-- "code/tutorials/by-product/contract-integrations/cross-chain-contracts/snippet-5.js:18:19"
```

=== "`deployReceiver.js`"

```javascript
--8<-- "code/tutorials/messaging/cross-chain-contracts/snippet-6.js:18:19"
--8<-- "code/tutorials/by-product/contract-integrations/cross-chain-contracts/snippet-6.js:18:19"
```

3. **Deploy the contract** - the contract is deployed to the network specified in the configuration. Upon successful deployment, the contract address is returned, which is crucial for interacting with the contract later on

=== "`deploySender.js`"

```javascript
--8<-- "code/tutorials/messaging/cross-chain-contracts/snippet-5.js:36:39"
--8<-- "code/tutorials/by-product/contract-integrations/cross-chain-contracts/snippet-5.js:36:39"
```

=== "`deployReceiver.js`"

```javascript
--8<-- "code/tutorials/messaging/cross-chain-contracts/snippet-6.js:39:42"
--8<-- "code/tutorials/by-product/contract-integrations/cross-chain-contracts/snippet-6.js:39:42"
```

4. **Register the `MessageSender` on the target chain** - after you deploy the `MessageReceiver` contract on the Celo Alfajores network, the sender contract address from Avalanche Fuji needs to be registered. This ensures that only messages from the registered `MessageSender` contract are processed

This additional step is essential to enforce emitter validation, preventing unauthorized senders from delivering messages to the `MessageReceiver` contract

```javascript
--8<-- "code/tutorials/messaging/cross-chain-contracts/snippet-6.js:55:66"
--8<-- "code/tutorials/by-product/contract-integrations/cross-chain-contracts/snippet-6.js:55:66"
```

You can find the full code for the `deploySender.js` and `deployReceiver.js` below.

??? code "deploySender.js"

```javascript
--8<-- "code/tutorials/messaging/cross-chain-contracts/snippet-5.js"
--8<-- "code/tutorials/by-product/contract-integrations/cross-chain-contracts/snippet-5.js"
```

??? code "deployReceiver.js"

```javascript
--8<-- "code/tutorials/messaging/cross-chain-contracts/snippet-6.js"
--8<-- "code/tutorials/by-product/contract-integrations/cross-chain-contracts/snippet-6.js"
```

### Deploy the Sender Contract
Expand All @@ -256,7 +256,7 @@ The sender contract will handle quoting and sending messages cross-chain.

2. Once deployed, the contract address will be displayed. You may check the contract on the [Avalanche Fuji Explorer](https://testnet.snowtrace.io/){target=\_blank}

--8<-- "code/tutorials/messaging/cross-chain-contracts/snippet-8.html"
--8<-- "code/tutorials/by-product/contract-integrations/cross-chain-contracts/snippet-8.html"


### Deploy the Receiver Contract
Expand Down Expand Up @@ -286,53 +286,53 @@ Let's break down the script step by step.
2. **`deployedContracts.json`** - stores the addresses of the deployed sender and receiver contracts. This file is dynamically updated when contracts are deployed, but users can also manually add their own deployed contract addresses if needed

```javascript
--8<-- "code/tutorials/messaging/cross-chain-contracts/snippet-3.js:8:16"
--8<-- "code/tutorials/by-product/contract-integrations/cross-chain-contracts/snippet-3.js:8:16"
```

2. **Configure the provider and signer** - the script first reads the chain configurations and extracts the contract addresses. One essential step in interacting with a blockchain is setting up a _provider_. A provider is your connection to the blockchain network. It allows your script to interact with the blockchain, retrieve data, and send transactions. In this case, we're using a JSON-RPC provider

Next, we configure the wallet, which will be used to sign transactions. The wallet is created using the private key and the provider. This ensures that all transactions sent from this wallet are broadcast to the Avalanche Fuji network:

```javascript
--8<-- "code/tutorials/messaging/cross-chain-contracts/snippet-3.js:34:35"
--8<-- "code/tutorials/by-product/contract-integrations/cross-chain-contracts/snippet-3.js:34:35"
```

After setting up the wallet, the script loads the ABI for the `MessageSender.sol` contract and creates an instance of it:

```javascript
--8<-- "code/tutorials/messaging/cross-chain-contracts/snippet-3.js:38:43"
--8<-- "code/tutorials/by-product/contract-integrations/cross-chain-contracts/snippet-3.js:38:43"
```

3. **Set up the message details** - the next part of the script defines the target chain (Celo) and the target address (the receiver contract on Celo):

```javascript
--8<-- "code/tutorials/messaging/cross-chain-contracts/snippet-3.js:55:56"
--8<-- "code/tutorials/by-product/contract-integrations/cross-chain-contracts/snippet-3.js:55:56"
```

You can customize the message that will be sent across chains:

```javascript
--8<-- "code/tutorials/messaging/cross-chain-contracts/snippet-3.js:59:59"
--8<-- "code/tutorials/by-product/contract-integrations/cross-chain-contracts/snippet-3.js:59:59"
```

4. **Estimate cross-chain cost** - before sending the message, we dynamically calculate the cross-chain cost using the `quoteCrossChainCost` function:

```javascript
--8<-- "code/tutorials/messaging/cross-chain-contracts/snippet-3.js:62:62"
--8<-- "code/tutorials/by-product/contract-integrations/cross-chain-contracts/snippet-3.js:62:62"
```

This ensures that the transaction includes enough funds to cover the gas fees for the cross-chain message.

5. **Send a message** - with everything set up, the message is sent using the `sendMessage` function:

```javascript
--8<-- "code/tutorials/messaging/cross-chain-contracts/snippet-3.js:65:72"
--8<-- "code/tutorials/by-product/contract-integrations/cross-chain-contracts/snippet-3.js:65:72"
```

After sending, the script waits for the transaction to be confirmed:

```javascript
--8<-- "code/tutorials/messaging/cross-chain-contracts/snippet-3.js:75:75"
--8<-- "code/tutorials/by-product/contract-integrations/cross-chain-contracts/snippet-3.js:75:75"
```

6. **Run the script** - to send the message, run the following command:
Expand All @@ -345,14 +345,14 @@ If everything is set up correctly, the message will be sent from the Avalanche F

The console should output something similar to this:

--8<-- "code/tutorials/messaging/cross-chain-contracts/snippet-4.html"
--8<-- "code/tutorials/by-product/contract-integrations/cross-chain-contracts/snippet-4.html"

You can find the full code for the `sendMessage.js` below.

??? code "sendMessage.js"

```solidity
--8<-- "code/tutorials/messaging/cross-chain-contracts/snippet-3.js"
--8<-- "code/tutorials/by-product/contract-integrations/cross-chain-contracts/snippet-3.js"
```

## Conclusion
Expand Down
Loading