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

Martinh/cctp tutorial #71

Open
wants to merge 41 commits into
base: main
Choose a base branch
from
Open

Martinh/cctp tutorial #71

wants to merge 41 commits into from

Conversation

martin0995
Copy link
Collaborator

Description

CCTP tutorial page.

Checklist

  • Required - I have added a label to this PR 🏷️
  • Required - I have run my changes through Grammarly
  • If pages have been moved, I have created redirects in the wormhole-mkdocs repo

@martin0995 martin0995 added the A0 - New Content Pull request contains new content pages label Sep 12, 2024
Copy link
Collaborator

@eshaben eshaben left a comment

Choose a reason for hiding this comment

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

Nice job! Left some comments that sort of attempt to make the steps throughout the guide a little bit more concise and also a recommendation to try out different formats to see if maybe using a different format will improve readability. I'll leave that to you to test out and see what works best 🙂

.snippets/code/tutorials/messaging/cctp/snippet-1.ts Outdated Show resolved Hide resolved
.snippets/code/tutorials/messaging/cctp/snippet-1.ts Outdated Show resolved Hide resolved
tutorials/messaging/.pages Outdated Show resolved Hide resolved
tutorials/messaging/cctp.md Outdated Show resolved Hide resolved
tutorials/messaging/cctp.md Show resolved Hide resolved
tutorials/messaging/cctp.md Outdated Show resolved Hide resolved
tutorials/messaging/cctp.md Outdated Show resolved Hide resolved
tutorials/messaging/cctp.md Outdated Show resolved Hide resolved
tutorials/messaging/cctp.md Outdated Show resolved Hide resolved
tutorials/messaging/cctp.md Outdated Show resolved Hide resolved
Copy link
Collaborator

@eshaben eshaben left a comment

Choose a reason for hiding this comment

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

Nice! I have not tested the actual code. @ilariae would you mind reviewing and testing this please?

Before you begin, ensure you have the following:

- [Node.js and npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm){target=\_blank} installed on your machine
- [USDC tokens](https://faucet.circle.com/){target=\_blank} on supported chains
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd add the specific testnet chains that this tutorial uses here. So they know what tokens to get to follow along with the tutorial

" - USDC tokens{target=_blank} on supported chains. This tutorial uses X"


Before initiating a cross-chain transfer, you must set up the chain context and signers for both the source and destination chains.

1. **Initialize the Wormhole SDK** - initialize the `wormhole` function for the `Testnet` environment, and we specify the platforms (EVM and Solana) we want to support. This allows us to interact with both EVM-compatible chains like Avalanche and non-EVM chains like Solana if needed
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
1. **Initialize the Wormhole SDK** - initialize the `wormhole` function for the `Testnet` environment, and we specify the platforms (EVM and Solana) we want to support. This allows us to interact with both EVM-compatible chains like Avalanche and non-EVM chains like Solana if needed
1. **Initialize the Wormhole SDK** - initialize the `wormhole` function for the `Testnet` environment and specify the platforms (EVM and Solana) to support. This allows us to interact with both EVM-compatible chains like Avalanche and non-EVM chains like Solana if needed

!!! note
You can replace `'Testnet'` with `'Mainnet'` if you want to perform transfers on MainNet.

2. **Set up source and destination chains** - we specify the source chain (Avalanche) and the destination chain (Solana) using the `getChain` method. This allows us to define where to send the USDC and where to receive them
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
2. **Set up source and destination chains** - we specify the source chain (Avalanche) and the destination chain (Solana) using the `getChain` method. This allows us to define where to send the USDC and where to receive them
2. **Set up source and destination chains** - specify the source chain (Avalanche) and the destination chain (Solana) using the `getChain` method. This allows us to define where to send the USDC and where to receive them

1. **Initialize the Wormhole SDK** - initialize the `wormhole` function for the `Testnet` environment, and we specify the platforms (EVM and Solana) we want to support. This allows us to interact with both EVM-compatible chains like Avalanche and non-EVM chains like Solana if needed

```typescript
--8<-- "code/tutorials/messaging/cctp/cctp-sdk-2.ts:10:11"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
--8<-- "code/tutorials/messaging/cctp/cctp-sdk-2.ts:10:11"
--8<-- "code/tutorials/messaging/cctp/cctp-sdk-2.ts:11:11"

This seems a little weird as the function is never closed with a matching }), so I think it should just be the one line

--8<-- "code/tutorials/messaging/cctp/cctp-sdk-2.ts:14:15"
```

3. **Configure the signers** - the `getSigner` function retrieves the signers responsible for signing transactions on the respective chains. This ensures that transactions are correctly authorized on both the source and destination chains
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
3. **Configure the signers** - the `getSigner` function retrieves the signers responsible for signing transactions on the respective chains. This ensures that transactions are correctly authorized on both the source and destination chains
3. **Configure the signers** - use the `getSigner` function to retrieve the signers responsible for signing transactions on the respective chains. This ensures that transactions are correctly authorized on both the source and destination chains

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you please actually go through the rest of guide and make these steps like action items? Instead of saying this does this, it should be like do this to achieve this


You will need to provide the below requirements to complete the partial transfer:

- **Transaction ID (`txid`)** - the transaction hash from the source chain where the transfer was initiated
Copy link
Collaborator

Choose a reason for hiding this comment

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

this variable should be txId


You can find the full code for the manual USDC transfer script below:

???- tip "`partial-transfer.ts`"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please use the code admonition instead for all these expandable elements that show the whole file

Comment on lines +110 to +112
In a manual USDC transfer, you perform each step of the cross-chain transfer process individually. This approach allows for greater control and flexibility over how the transfer is executed, which can be helpful in scenarios where you need to customize certain aspects of the transfer, such as gas management, specific chain selection, or signing transactions manually.

Manual transfers give developers more control over each step, making them useful for custom setups, testing, or when automation isn't available.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
In a manual USDC transfer, you perform each step of the cross-chain transfer process individually. This approach allows for greater control and flexibility over how the transfer is executed, which can be helpful in scenarios where you need to customize certain aspects of the transfer, such as gas management, specific chain selection, or signing transactions manually.
Manual transfers give developers more control over each step, making them useful for custom setups, testing, or when automation isn't available.
In a manual USDC transfer, you perform each step of the cross-chain transfer process individually. This approach allows for greater control and flexibility over how the transfer is executed, which can be helpful in scenarios where you need to customize certain aspects of the transfer, such as gas management, specific chain selection, or signing transactions manually.

I felt like that line was a bit repetitive of the previous para


Manual transfers give developers more control over each step, making them useful for custom setups, testing, or when automation isn't available.

This section will guide you through performing a manual USDC transfer across chains using the Wormhole SDK and Circle’s Cross-Chain Transfer Protocol (CCTP).
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
This section will guide you through performing a manual USDC transfer across chains using the Wormhole SDK and Circle’s Cross-Chain Transfer Protocol (CCTP).
This section will guide you through performing a manual USDC transfer across chains using the Wormhole SDK and Circle’s CCTP.


## Conclusion

In this tutorial, you’ve gained hands-on experience with Circle’s Cross-Chain Transfer Protocol (CCTP) and the Wormhole SDK. You’ve learned to perform manual and automatic USDC transfers across multiple chains and recover partial transfers if needed.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
In this tutorial, you’ve gained hands-on experience with Circle’s Cross-Chain Transfer Protocol (CCTP) and the Wormhole SDK. You’ve learned to perform manual and automatic USDC transfers across multiple chains and recover partial transfers if needed.
In this tutorial, you’ve gained hands-on experience with Circle’s CCTP and the Wormhole SDK. You’ve learned to perform manual and automatic USDC transfers across multiple chains and recover partial transfers if needed.

No need to keep spelling out CCTP after doing it the first time

Copy link
Collaborator

@eshaben eshaben left a comment

Choose a reason for hiding this comment

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

Also, can you please add a card to the index page for the Tutorials > Messaging section? Just noticed this was missing. I created a ticket in Jira and assigned it to you to add the other missing one for the token transfers tutorial

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A0 - New Content Pull request contains new content pages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants