From 0f8c9f65af88e726888903891d74b386b574a909 Mon Sep 17 00:00:00 2001 From: Ilaria Enache Date: Wed, 18 Jun 2025 13:20:54 +0200 Subject: [PATCH 1/6] Disable solidity sdk docs until v1.0 --- tools/.pages | 2 +- .../get-started.md => .solidity-sdk/.get-started.md} | 0 tools/{solidity-sdk => .solidity-sdk}/.pages | 0 .../sdk-reference.md => .solidity-sdk/.sdk-reference.md} | 0 4 files changed, 1 insertion(+), 1 deletion(-) rename tools/{solidity-sdk/get-started.md => .solidity-sdk/.get-started.md} (100%) rename tools/{solidity-sdk => .solidity-sdk}/.pages (100%) rename tools/{solidity-sdk/sdk-reference.md => .solidity-sdk/.sdk-reference.md} (100%) diff --git a/tools/.pages b/tools/.pages index 71eb47ba5..907a2aace 100644 --- a/tools/.pages +++ b/tools/.pages @@ -1,7 +1,7 @@ title: Developer Tools nav: - typescript-sdk -- solidity-sdk +# - solidity-sdk - cli - 'Wormholescan Explorer': https://wormholescan.io/ - 'Wormholescan API': https://wormholescan.io/#/developers/api-doc \ No newline at end of file diff --git a/tools/solidity-sdk/get-started.md b/tools/.solidity-sdk/.get-started.md similarity index 100% rename from tools/solidity-sdk/get-started.md rename to tools/.solidity-sdk/.get-started.md diff --git a/tools/solidity-sdk/.pages b/tools/.solidity-sdk/.pages similarity index 100% rename from tools/solidity-sdk/.pages rename to tools/.solidity-sdk/.pages diff --git a/tools/solidity-sdk/sdk-reference.md b/tools/.solidity-sdk/.sdk-reference.md similarity index 100% rename from tools/solidity-sdk/sdk-reference.md rename to tools/.solidity-sdk/.sdk-reference.md From b46a1822399797d84d03ea43f3687a3fc020d00b Mon Sep 17 00:00:00 2001 From: Ilaria Enache Date: Wed, 18 Jun 2025 13:22:16 +0200 Subject: [PATCH 2/6] llms check --- llms-files/llms-basics.txt | 4 +- llms-files/llms-connect.txt | 2 +- llms-files/llms-multigov.txt | 2 +- llms-files/llms-ntt.txt | 2 +- llms-files/llms-queries.txt | 2 +- llms-files/llms-relayers.txt | 2 +- llms-files/llms-settlement.txt | 2 +- llms-files/llms-solidity-sdk.txt | 2594 ++++++++++++++-------------- llms-files/llms-token-bridge.txt | 2 +- llms-files/llms-transfer.txt | 2 +- llms-files/llms-typescript-sdk.txt | 2 +- llms-full.txt | 2592 +++++++++++++-------------- llms.txt | 4 +- 13 files changed, 2606 insertions(+), 2606 deletions(-) diff --git a/llms-files/llms-basics.txt b/llms-files/llms-basics.txt index f116e8e9f..c578ef157 100644 --- a/llms-files/llms-basics.txt +++ b/llms-files/llms-basics.txt @@ -21,7 +21,7 @@ Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/re Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/protocol/infrastructure/vaas.md [type: other] Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/protocol/introduction.md [type: other] Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/protocol/security.md [type: other] -Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/tools/solidity-sdk/get-started.md [type: other] +Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/tools/.solidity-sdk/.get-started.md [type: other] ## Full content for each doc page @@ -2097,7 +2097,7 @@ For more information about submitting to the bug bounty programs, refer to the [ The [SECURITY.md](https://github.com/wormhole-foundation/wormhole/blob/main/SECURITY.md){target=\blank} from the official repository has the latest security policies and updates. --- END CONTENT --- -Doc-Content: https://wormhole.com/docs/tools/solidity-sdk/get-started/ +Doc-Content: https://wormhole.com/docs/tools/.solidity-sdk/.get-started/ --- BEGIN CONTENT --- --- title: Get Started with the Solidity SDK diff --git a/llms-files/llms-connect.txt b/llms-files/llms-connect.txt index 2a38636c2..c46fe4da4 100644 --- a/llms-files/llms-connect.txt +++ b/llms-files/llms-connect.txt @@ -3858,7 +3858,7 @@ For more information about submitting to the bug bounty programs, refer to the [ The [SECURITY.md](https://github.com/wormhole-foundation/wormhole/blob/main/SECURITY.md){target=\blank} from the official repository has the latest security policies and updates. --- END CONTENT --- -Doc-Content: https://wormhole.com/docs/tools/solidity-sdk/get-started/ +Doc-Content: https://wormhole.com/docs/tools/.solidity-sdk/.get-started/ --- BEGIN CONTENT --- --- title: Get Started with the Solidity SDK diff --git a/llms-files/llms-multigov.txt b/llms-files/llms-multigov.txt index 428c5ac45..40862e5f9 100644 --- a/llms-files/llms-multigov.txt +++ b/llms-files/llms-multigov.txt @@ -3118,7 +3118,7 @@ For more information about submitting to the bug bounty programs, refer to the [ The [SECURITY.md](https://github.com/wormhole-foundation/wormhole/blob/main/SECURITY.md){target=\blank} from the official repository has the latest security policies and updates. --- END CONTENT --- -Doc-Content: https://wormhole.com/docs/tools/solidity-sdk/get-started/ +Doc-Content: https://wormhole.com/docs/tools/.solidity-sdk/.get-started/ --- BEGIN CONTENT --- --- title: Get Started with the Solidity SDK diff --git a/llms-files/llms-ntt.txt b/llms-files/llms-ntt.txt index 13fc991cd..e00be022d 100644 --- a/llms-files/llms-ntt.txt +++ b/llms-files/llms-ntt.txt @@ -4129,7 +4129,7 @@ For more information about submitting to the bug bounty programs, refer to the [ The [SECURITY.md](https://github.com/wormhole-foundation/wormhole/blob/main/SECURITY.md){target=\blank} from the official repository has the latest security policies and updates. --- END CONTENT --- -Doc-Content: https://wormhole.com/docs/tools/solidity-sdk/get-started/ +Doc-Content: https://wormhole.com/docs/tools/.solidity-sdk/.get-started/ --- BEGIN CONTENT --- --- title: Get Started with the Solidity SDK diff --git a/llms-files/llms-queries.txt b/llms-files/llms-queries.txt index 834397973..41f39c79a 100644 --- a/llms-files/llms-queries.txt +++ b/llms-files/llms-queries.txt @@ -2884,7 +2884,7 @@ For more information about submitting to the bug bounty programs, refer to the [ The [SECURITY.md](https://github.com/wormhole-foundation/wormhole/blob/main/SECURITY.md){target=\blank} from the official repository has the latest security policies and updates. --- END CONTENT --- -Doc-Content: https://wormhole.com/docs/tools/solidity-sdk/get-started/ +Doc-Content: https://wormhole.com/docs/tools/.solidity-sdk/.get-started/ --- BEGIN CONTENT --- --- title: Get Started with the Solidity SDK diff --git a/llms-files/llms-relayers.txt b/llms-files/llms-relayers.txt index deb6ededc..50115be7c 100644 --- a/llms-files/llms-relayers.txt +++ b/llms-files/llms-relayers.txt @@ -2637,7 +2637,7 @@ For more information about submitting to the bug bounty programs, refer to the [ The [SECURITY.md](https://github.com/wormhole-foundation/wormhole/blob/main/SECURITY.md){target=\blank} from the official repository has the latest security policies and updates. --- END CONTENT --- -Doc-Content: https://wormhole.com/docs/tools/solidity-sdk/get-started/ +Doc-Content: https://wormhole.com/docs/tools/.solidity-sdk/.get-started/ --- BEGIN CONTENT --- --- title: Get Started with the Solidity SDK diff --git a/llms-files/llms-settlement.txt b/llms-files/llms-settlement.txt index 879e877cf..a527fb19d 100644 --- a/llms-files/llms-settlement.txt +++ b/llms-files/llms-settlement.txt @@ -2590,7 +2590,7 @@ For more information about submitting to the bug bounty programs, refer to the [ The [SECURITY.md](https://github.com/wormhole-foundation/wormhole/blob/main/SECURITY.md){target=\blank} from the official repository has the latest security policies and updates. --- END CONTENT --- -Doc-Content: https://wormhole.com/docs/tools/solidity-sdk/get-started/ +Doc-Content: https://wormhole.com/docs/tools/.solidity-sdk/.get-started/ --- BEGIN CONTENT --- --- title: Get Started with the Solidity SDK diff --git a/llms-files/llms-solidity-sdk.txt b/llms-files/llms-solidity-sdk.txt index 0c1d3619e..897e2048a 100644 --- a/llms-files/llms-solidity-sdk.txt +++ b/llms-files/llms-solidity-sdk.txt @@ -13,1595 +13,1595 @@ You are an AI developer assistant for Wormhole (https://wormhole.com). Your task - If unsure, respond with “Not specified in the documentation. ## List of doc pages: +Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/tools/.solidity-sdk/.get-started.md [type: other] +Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/tools/.solidity-sdk/.sdk-reference.md [type: other] Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/tools/cli/get-started.md [type: other] Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/tools/dev-env.md [type: other] Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/tools/faqs.md [type: other] -Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/tools/solidity-sdk/get-started.md [type: other] -Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/tools/solidity-sdk/sdk-reference.md [type: other] ## Full content for each doc page -Doc-Content: https://wormhole.com/docs/tools/cli/get-started/ +Doc-Content: https://wormhole.com/docs/tools/.solidity-sdk/.get-started/ --- BEGIN CONTENT --- --- -title: Wormhole CLI -description: Learn how to install and use the Wormhole CLI, including commands and examples for managing multichain deployments, generating VAAs, and querying contract info. -categories: Solidity-SDK, Typescript-SDK +title: Get Started with the Solidity SDK +description: Follow this guide to use the Wormhole Solidity SDK's interfaces and tools to help you quickly build on-chain integrations using smart contracts. +categories: Basics, Solidity-SDK --- -# Wormhole CLI - -This tool is a command-line interface to Wormhole, allowing you to perform various actions, such as querying a transaction's status or submitting token transfers. - -## Installation +# Get Started with the Solidity SDK -Clone the repository and change directories to the appropriate directory: +The [Wormhole Solidity SDK](https://github.com/wormhole-foundation/wormhole-solidity-sdk){target=\_blank} provides Solidity interfaces, prebuilt contracts, and testing tools to help Solidity developers build on-chain Wormhole integrations via smart contracts. You can use the [Wormhole TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank} for off-chain integrations without writing Solidity. -```bash -git clone https://github.com/wormhole-foundation/wormhole && -cd wormhole/clients/js -``` +## Install the SDK -Build and install the CLI tool: +Use Foundry's [`forge`](https://book.getfoundry.sh/forge/){target=\_blank} to install the SDK using the following command: ```bash -make install +forge install wormhole-foundation/wormhole-solidity-sdk ``` -This installs two binaries, `worm-fetch-governance` and `worm` on your `$PATH`. To use `worm`, set up `$HOME/.wormhole/.env` with your private keys, based on `.env.sample` in this folder. +## Key Components -## Usage +The following key components and features work together to make your on-chain Wormhole integration easier to build. -You can interact with the Wormhole CLI by typing `worm` and including the `command` and any necessary subcommands and parameters. +??? interface "Base contracts" -| Command | Description | -|--------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------| -| `worm aptos INSERT_COMMAND` | Aptos utilities | -| `worm edit-vaa INSERT_COMMAND` | Edits or generates a VAA | -| `worm evm INSERT_COMMAND` | EVM utilities | -| `worm generate INSERT_COMMAND` | Generate VAAs (Devnet and Testnet only) | -| `worm info INSERT_COMMAND` | Contract, chain, RPC, and address information utilities | -| `worm near INSERT_NETWORK, INSERT_ACCOUNT` | NEAR utilities | -| `worm parse INSERT_VAA` | Parse a VAA (can be in either hex or base64 format) | -| `worm recover INSERT_DIGEST INSERT_SIGNATURE` | Recover an address from a signature | -| `worm status INSERT_NETWORK, INSERT_CHAIN, INSERT_TXN_HASH` | Prints information about the automatic delivery initiated on the specified network, chain, and transaction hash | -| `worm submit INSERT_VAA` | Execute a VAA | -| `worm sui INSERT_COMMAND` | Sui utilities | -| `worm transfer INSERT_SOURCE_CHAIN, INSERT_DESTINATION_CHAIN, INSERT_DESTINATION_ADDRESS, INSERT_AMOUNT, INSERT_NETWORK` | Transfers a token | -| `worm verify-vaa INSERT_VAA, INSERT_NETWORK` | Verifies a VAA by querying the Core Contract on Ethereum | + Leverage base contracts to send and receive messages and tokens. -You can also refer to the below options, available with all `worm` commands: + - [**`Base.sol`**](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/b9e129e65d34827d92fceeed8c87d3ecdfc801d0/src/Base.sol){target=\_blank}: Uses Wormhole interfaces to authorize and verify a registered sender. + - [**`TokenBase.sol`**](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/b9e129e65d34827d92fceeed8c87d3ecdfc801d0/src/TokenBase.sol){target=\_blank}: Uses `TokenReceiver` and `TokenSender` contracts to define functions for transferring tokens. + - [**`CCTPBase.sol`**](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/b9e129e65d34827d92fceeed8c87d3ecdfc801d0/src/CCTPBase.sol){target=\_blank}: Uses `CCTPSender` and `CCTPReceiver` contracts to define functions for transferring USDC. -```bash -Options: - --help Show help [boolean] - --version Show version number [boolean] -``` +??? interface "Interfaces" -### Subcommands + Use interfaces to ensure consistent interactions with the protocol regardless of the supported chain you use. -??? interface "Aptos" - ```bash - worm aptos INSERT_COMMAND + - [**`ITokenBridge.sol`**](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/b9e129e65d34827d92fceeed8c87d3ecdfc801d0/src/interfaces/ITokenBridge.sol){target=\_blank}: Defines key structs and functions for token attestation, wrapping and transferring tokens, monitoring transaction progress. + - [**CCTP Interfaces**](https://github.com/wormhole-foundation/wormhole-solidity-sdk/tree/b9e129e65d34827d92fceeed8c87d3ecdfc801d0/src/interfaces/CCTPInterfaces){target=\_blank}: A set of interfaces for USDC transfers via CCTP for sending, relaying, and receiving messages and tokens. + - [**`IWormholeReceiver.sol`**](https://github.com/wormhole-foundation/wormhole/blob/main/relayer/ethereum/contracts/interfaces/relayer/IWormholeReceiver.sol){target=\_blank}: Defines the `receiveWormholeMessages` function. + - [**`IWormholeRelayer.sol`**](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/b9e129e65d34827d92fceeed8c87d3ecdfc801d0/src/interfaces/IWormholeRelayer.sol){target=\_blank}: Defines key structs and functions to identify, send, and deliver messages and follow the progress of transactions. -Commands: - worm aptos init-token-bridge Init token bridge contract - worm aptos init-wormhole Init Wormhole core contract - worm aptos deploy Deploy an Aptos package - worm aptos deploy-resource Deploy an Aptos package using a - resource account - worm aptos send-example-message Send example message - - worm aptos derive-resource-account Derive resource account address - - worm aptos derive-wrapped-address Derive wrapped coin type - - worm aptos hash-contracts Hash contract bytecodes for upgrade - worm aptos upgrade Perform upgrade after VAA has been - submitted - worm aptos migrate Perform migration after contract - upgrade - worm aptos faucet Request money from the faucet for a - given account - worm aptos start-validator Start a local aptos validator +??? interface "Constants" -Options: - --help Show help [boolean] - --version Show version number [boolean] - ``` + Auto-generated Solidity constants help avoid manual entry errors and ensure consistent delivery. -??? interface "Edit VAA" - ```bash - worm edit-vaa INSERT_COMMAND + - [**Wormhole Chain ID's**](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/b9e129e65d34827d92fceeed8c87d3ecdfc801d0/src/Chains.sol){target=\_blank}: Generated list of Wormhole Chain ID's for supported chains. + - [**Circle CCTP Domain IDs**](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/b9e129e65d34827d92fceeed8c87d3ecdfc801d0/src/CCTPAndTokenBase.sol){target=\_blank}: Generated list of defined CCTP domain ID's to ensure USDC transfers use the correct domain for a given chain. + - [**`chainConsts.ts`**](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/75ddcec06ffe9d62603d023357caa576c5ea101c/gen/chainConsts.ts){target=\_blank}: Returns values to identify properties and contract addresses for each supported chain. -Options: - --help Show help [boolean] - --version Show version number [boolean] - -v, --vaa vaa in hex format [string] [required] - -n, --network Network - [required] [choices: "mainnet", "testnet", "devnet"] - --guardian-set-index, --gsi guardian set index [number] - --signatures, --sigs comma separated list of signatures [string] - --wormscanurl, --wsu url to wormscan entry for the vaa that - includes signatures [string] - --wormscan, --ws if specified, will query the wormscan entry - for the vaa to get the signatures [boolean] - --emitter-chain-id, --ec emitter chain id to be used in the vaa - [number] - --emitter-address, --ea emitter address to be used in the vaa[string] - --nonce, --no nonce to be used in the vaa [number] - --sequence, --seq sequence number to be used in the vaa[string] - --consistency-level, --cl consistency level to be used in the vaa - [number] - --timestamp, --ts timestamp to be used in the vaa in unix - seconds [number] - -p, --payload payload in hex format [string] - --guardian-secret, --gs Guardian's secret key [string] - ``` +## Example Usage -??? interface "EVM" - ```bash - worm evm INSERT_COMMAND +The following demo illustrates the use of Wormhole Solidity SDK-based smart contracts to send testnet USDC between supported chains. -Commands: - worm evm address-from-secret Compute a 20 byte eth address from a 32 - byte private key - worm evm storage-update Update a storage slot on an EVM fork - during testing (anvil or hardhat) - worm evm chains Return all EVM chains - worm evm info Query info about the on-chain state of - the contract - worm evm hijack Override the guardian set of the core - bridge contract during testing (anvil - or hardhat) - worm evm start-validator Start a local EVM validator +### Prerequisites +Before you begin, ensure you have the following: -Options: - --help Show help [boolean] - --version Show version number [boolean] - --rpc RPC endpoint [string] - ``` +- [Node.js and npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm){target=\_blank} installed +- [TypeScript](https://www.typescriptlang.org/download/){target=\_blank} installed +- [Foundry](https://book.getfoundry.sh/getting-started/installation){target=\_blank} installed +- Testnet tokens for two supported chains. This example uses [testnet AVAX for Avalanche Fuji](https://core.app/tools/testnet-faucet/?subnet=c&token=c){target=\_blank} and [testnet CELO for Celo Alfajores](https://faucet.celo.org/alfajores){target=\_blank} and can be adapted to any supported chains +- [USDC testnet tokens](https://faucet.circle.com/){target=\_blank} on your source chain for cross-chain transfer -??? interface "Generate" - ```bash - worm generate INSERT_COMMAND +### Set Up a Project -Commands: - worm generate registration Generate registration VAA - worm generate upgrade Generate contract upgrade VAA - worm generate attestation Generate a token attestation VAA - worm generate recover-chain-id Generate a recover chain ID VAA - worm generate Sets the default delivery provider - set-default-delivery-provider for the Wormhole Relayer contract +Follow these steps to prepare your development environment: -Options: - --help Show help [boolean] - --version Show version number [boolean] - -g, --guardian-secret Guardians' secret keys (CSV) [string] [required] - ``` +1. Create a directory for your project, navigate into it, and install the Wormhole Solidity SDK: -??? interface "Info" ```bash - worm info INSERT_COMMAND - -Commands: - worm info chain-id Print the wormhole chain ID integer - associated with the specified chain - name - worm info contract Print contract address - - worm info emitter
Print address in emitter address - format - worm info origin
Print the origin chain and address - of the asset that corresponds to the - given chain and address. - worm info registrations Print chain registrations - - worm info rpc Print RPC address - worm info wrapped Print the wrapped address on the - target chain that corresponds with - the specified origin chain and - address. - -Options: - --help Show help [boolean] - --version Show version number [boolean]
+ mkdir solidity-token-transfer + cd solidity-token-transfer + forge install wormhole-foundation/wormhole-solidity-sdk ``` -??? interface "NEAR" - ```bash - worm near INSERT_COMMAND - -Commands: - worm near contract-update Submit a contract update using our specific - APIs - worm near deploy Submit a contract update using near APIs - -Options: - --help Show help [boolean] - --version Show version number [boolean] - -m, --module Module to query [choices: "Core", "NFTBridge", "TokenBridge"] - -n, --network Network [required] [choices: "mainnet", "testnet", "devnet"] - --account Near deployment account [string] [required] - --attach Attach some near [string] - --target Near account to upgrade [string] - --mnemonic Near private keys [string] - --key Near private key [string] - -r, --rpc Override default rpc endpoint url [string] - ``` +2. Install dependencies for use with your transfer script, including the Wormhole TypeScript SDK, and initiate a new Node.js project: -??? interface "Parse" ```bash - worm parse INSERT_VAA + npm init -y && npm install @wormhole-foundation/sdk ethers -D tsx typescript + ``` -Positionals: - vaa vaa [string] +### Create and Deploy Contracts -Options: - --help Show help [boolean] - --version Show version number [boolean] - ``` +This project uses sender and receiver contracts to access the `WormholeRelayer` interface's [`TokenSender`](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/baa085006586a43c42858d355e3ffb743b80d7a4/src/WormholeRelayer/TokenBase.sol#L24){target=\_blank} and [`TokenReceiver`](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/baa085006586a43c42858d355e3ffb743b80d7a4/src/WormholeRelayer/TokenBase.sol#L147){target=\_blank} base classes to simplify sending tokens across chains. -??? interface "Recover" - ```bash - worm recover INSERT_DIGEST INSERT_SIGNATURE +Follow these steps to create and deploy your sender and receiver Solidity contracts: -Positionals: - digest digest [string] - signature signature [string] +1. Use the following example code to create `CrossChainSender.sol`: -Options: - --help Show help [boolean] - --version Show version number [boolean] - ``` + ```solidity title="CrossChainSender.sol" + // SPDX-License-Identifier: MIT +pragma solidity ^0.8.13; -??? interface "Status" - ```bash - worm status INSERT_NETWORK, INSERT_CHAIN, INSERT_TXN_HASH +import "lib/wormhole-solidity-sdk/src/WormholeRelayerSDK.sol"; +import "lib/wormhole-solidity-sdk/src/interfaces/IERC20.sol"; -Positionals: - network Network [choices: - 'mainnet', - 'testnet', - 'devnet'] - chain Source chain - [choices: - 'unset', - 'solana', - 'ethereum', - 'terra', - 'bsc', - 'polygon', - 'avalanche', - 'oasis', - 'algorand', - 'aurora', - 'fantom', - 'karura', - 'acala', - 'klaytn', - 'celo', - 'near', - 'moonbeam', - 'neon', - 'terra2', - 'injective', - 'osmosis', - 'sui', - 'aptos', - 'arbitrum', - 'optimism', - 'gnosis', - 'pythnet', - 'xpla', - 'btc', - 'base', - 'sei', - 'rootstock', - 'scroll', - 'mantle', - 'blast', - 'xlayer', - 'linea', - 'berachain', - 'seievm', - 'wormchain', - 'cosmoshub', - 'evmos', - 'kujira', - 'neutron', - 'celestia', - 'stargaze', - 'seda', - 'dymension', - 'provenance', - 'sepolia', - 'arbitrum_sepolia', - 'base_sepolia', - 'optimism_sepolia', - 'holesky', - 'polygon_sepolia'] - tx Source transaction hash [string] - -Options: - --help Show help [boolean] - --version Show version number [boolean] - ``` +// Extend the TokenSender contract inherited from TokenBase +contract CrossChainSender is TokenSender { + uint256 constant GAS_LIMIT = 250_000; + // Initialize the contract with the Wormhole relayer, Token Bridge, + // and Wormhole Core Contract addresses + constructor( + address _wormholeRelayer, + address _tokenBridge, + address _wormhole + ) TokenBase(_wormholeRelayer, _tokenBridge, _wormhole) {} -??? interface "Submit" - ```bash - worm submit INSERT_VAA + // Calculate the estimated cost for multichain token transfer using + // the wormholeRelayer to get the delivery cost and add the message fee + function quoteCrossChainDeposit( + uint16 targetChain + ) public view returns (uint256 cost) { + uint256 deliveryCost; + (deliveryCost, ) = wormholeRelayer.quoteEVMDeliveryPrice( + targetChain, + 0, + GAS_LIMIT + ); -Positionals: - vaa vaa [string] + cost = deliveryCost + wormhole.messageFee(); + } -Options: - --help Show help [boolean] - --version Show version number [boolean] - -c, --chain chain name -[choices: 'unset', - 'solana', - 'ethereum', - 'terra', - 'bsc', - 'polygon', - 'avalanche', - 'oasis', - 'algorand', - 'aurora', - 'fantom', - 'karura', - 'acala', - 'klaytn', - 'celo', - 'near', - 'moonbeam', - 'neon', - 'terra2', - 'injective', - 'osmosis', - 'sui', - 'aptos', - 'arbitrum', - 'optimism', - 'gnosis', - 'pythnet', - 'xpla', - 'btc', - 'base', - 'sei', - 'rootstock', - 'scroll', - 'mantle', - 'blast', - 'xlayer', - 'linea', - 'berachain', - 'seievm', - 'wormchain', - 'cosmoshub', - 'evmos', - 'kujira', - 'neutron', - 'celestia', - 'stargaze', - 'seda', - 'dymension', - 'provenance', - 'sepolia', - 'arbitrum_sepolia', - 'base_sepolia', - 'optimism_sepolia', - 'holesky', - 'polygon_sepolia'] - -n, --network Network - [required] - [choices: - 'mainnet', - 'testnet', - 'devnet'] - -a, --contract-address Contract to submit VAA to (override config) [string] - --rpc RPC endpoint [string] - --all-chains, --ac Submit the VAA to all chains except for the origin - chain specified in the payload - [boolean] [default: false] + // Send tokens and payload to the recipient on the target chain + function sendCrossChainDeposit( + uint16 targetChain, + address targetReceiver, + address recipient, + uint256 amount, + address token + ) public payable { + // Calculate the estimated cost for the multichain deposit + uint256 cost = quoteCrossChainDeposit(targetChain); + require( + msg.value == cost, + "msg.value must equal quoteCrossChainDeposit(targetChain)" + ); + // Transfer the tokens from the sender to this contract + IERC20(token).transferFrom(msg.sender, address(this), amount); + // Encode the recipient address into the payload + bytes memory payload = abi.encode(recipient); + // Initiate the multichain transfer using the wormholeRelayer + sendTokenWithPayloadToEvm( + targetChain, + targetReceiver, + payload, + 0, + GAS_LIMIT, + token, + amount + ); + } +} ``` -??? interface "Sui" - ```bash - worm sui INSERT_COMMAND + This contract extends `TokenSender`, gaining access to its functionality. It initializes the contract with the required addresses, calculates estimated transfer costs, defines transfer parameters, and initiates the transfer using the `sendTokenWithPayloadToEvm` function from `WormholeRelayer`. -Commands: - worm sui build-coin Build wrapped coin and dump bytecode. +2. Use the following example code to create `CrossChainReceiver.sol`: - Example: - worm sui build-coin -d 8 -v V__0_1_1 -n - testnet -r - "https://fullnode.testnet.sui.io:443" - worm sui deploy Deploy a Sui package - worm sui init-example-message-app Initialize example core message app - worm sui init-token-bridge Initialize token bridge contract - worm sui init-wormhole Initialize wormhole core contract - worm sui publish-example-message Publish message from example app via - core bridge - worm sui setup-devnet Setup devnet by deploying and - initializing core and token bridges and - submitting chain registrations. - worm sui objects Get owned objects by owner - worm sui package-id Get package ID from State object ID - worm sui tx Get transaction details + ```solidity title="CrossChainSender.sol" + // SPDX-License-Identifier: MIT +pragma solidity ^0.8.13; -Options: - --help Show help [boolean] - --version Show version number [boolean] - ``` +import "lib/wormhole-solidity-sdk/src/WormholeRelayerSDK.sol"; +import "lib/wormhole-solidity-sdk/src/interfaces/IERC20.sol"; -??? interface "Transfer" - ```bash - worm transfer INSERT_SOURCE_CHAIN, INSERT_DESTINATION_CHAIN, INSERT_DESTINATION_ADDRESS, INSERT_AMOUNT, INSERT_NETWORK +// Extend the TokenReceiver contract inherited from TokenBase +contract CrossChainReceiver is TokenReceiver { + // Initialize the contract with the Wormhole relayer, Token Bridge, + // and Wormhole Core Contract addresses + constructor( + address _wormholeRelayer, + address _tokenBridge, + address _wormhole + ) TokenBase(_wormholeRelayer, _tokenBridge, _wormhole) {} -Options: - --help Show help [boolean] - --version Show version number [boolean] - --src-chain source chain [required] [choices: - 'solana', - 'ethereum', - 'terra', - 'bsc', - 'polygon', - 'avalanche', - 'oasis', - 'algorand', - 'aurora', - 'fantom', - 'karura', - 'acala', - 'klaytn', - 'celo', - 'near', - 'moonbeam', - 'neon', - 'terra2', - 'injective', - 'osmosis', - 'sui', - 'aptos', - 'arbitrum', - 'optimism', - 'gnosis', - 'pythnet', - 'xpla', - 'btc', - 'base', - 'sei', - 'rootstock', - 'scroll', - 'mantle', - 'blast', - 'xlayer', - 'linea', - 'berachain', - 'seievm', - 'wormchain', - 'cosmoshub', - 'evmos', - 'kujira', - 'neutron', - 'celestia', - 'stargaze', - 'seda', - 'dymension', - 'provenance', - 'sepolia', - 'arbitrum_sepolia', - 'base_sepolia', - 'optimism_sepolia', - 'holesky', - 'polygon_sepolia'] - --dst-chain destination chain - [required] [choices: - 'solana', - 'ethereum', - 'terra', - 'bsc', - 'polygon', - 'avalanche', - 'oasis', - 'algorand', - 'aurora', - 'fantom', - 'karura', - 'acala', - 'klaytn', - 'celo', - 'near', - 'moonbeam', - 'neon', - 'terra2', - 'injective', - 'osmosis', - 'sui', - 'aptos', - 'arbitrum', - 'optimism', - 'gnosis', - 'pythnet', - 'xpla', - 'btc', - 'base', - 'sei', - 'rootstock', - 'scroll', - 'mantle', - 'blast', - 'xlayer', - 'linea', - 'berachain', - 'seievm', - 'wormchain', - 'cosmoshub', - 'evmos', - 'kujira', - 'neutron', - 'celestia', - 'stargaze', - 'seda', - 'dymension', - 'provenance', - 'sepolia', - 'arbitrum_sepolia', - 'base_sepolia', - 'optimism_sepolia', - 'holesky', - 'polygon_sepolia'] - --dst-addr destination address [string] [required] - --token-addr token address [string] [default: native token] - --amount token amount [string] [required] - -n, --network Network [required] [choices: "mainnet", "testnet", "devnet"] - --rpc RPC endpoint [string] - ``` + // Receive the multichain payload and tokens + // Verify the transfer is from a registered sender + function receivePayloadAndTokens( + bytes memory payload, + TokenReceived[] memory receivedTokens, + bytes32 sourceAddress, + uint16 sourceChain, + bytes32 // deliveryHash + ) + internal + override + onlyWormholeRelayer + isRegisteredSender(sourceChain, sourceAddress) + { + // Ensure the payload is not empty and only has one token transfer + require(receivedTokens.length == 1, "Expected 1 token transfer"); -??? interface "Verify VAA" - ```bash - worm verify-vaa INSERT_VAA, INSERT_NETWORK + // Decode the recipient address from the payload + address recipient = abi.decode(payload, (address)); -Options: - --help Show help [boolean] - --version Show version number [boolean] - -v, --vaa vaa in hex format [string] [required] - -n, --network Network [required] [choices: "mainnet", "testnet", "devnet"] + // Transfer the received tokens to the intended recipient + IERC20(receivedTokens[0].tokenAddress).transfer( + recipient, + receivedTokens[0].amount + ); + } +} ``` -## Examples - -### Generate a VAA - -Use `generate` to create VAAs for testing. For example, use the following command to create an NFT bridge registration VAA: + This contract extends `TokenReceiver`, gaining access to its functionality. It initializes the contract with the required addresses, receives the payload and tokens, verifies the transfer is from a registered sender, decodes the recipient address, and transfers the tokens to the recipient. -```bash -worm generate registration --module NFTBridge \ - --chain bsc \ - --contract-address 0x706abc4E45D419950511e474C7B9Ed348A4a716c \ - --guardian-secret cfb12303a19cde580bb4dd771639b0d26bc68353645571a8cff516ab2ee113a0 -``` +3. Deploy the contracts using your preferred deployment method. Make sure you deploy `CrossChainSender.sol` to your desired source chain and `CrossChainReceiver.sol` to the target chain. Save the deployed contract addresses for each contract. You will need them for your transfer script. -The below example generates a token attestation VAA: +## Use Contracts to Transfer USDC -```bash -worm generate attestation --emitter-chain ethereum \ - --emitter-address 11111111111111111111111111111115 \ - --chain ethereum \ - --token-address 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 \ - --decimals 6 \ - --symbol USDC \ - --name USDC \ - --guardian-secret cfb12303a19cde580bb4dd771639b0d26bc68353645571a8cff516ab2ee113a0 -``` +1. Once your contracts are deployed, create a `transfer.ts` file to handle the multichain transfer logic: -### Parse a VAA + ```bash + touch script/transfer.ts + ``` -Use `parse` to parse a VAA into JSON: +2. Set up secure access to your wallets. This guide assumes you are loading your private key(s) from a secure keystore of your choice, such as a secrets manager or a CLI-based tool like [`cast wallet`](https://book.getfoundry.sh/reference/cast/cast-wallet){target=\_blank}. -```bash -worm parse $(worm-fetch-governance 13940208096455381020) -``` + !!! warning + If you use a `.env` file during development, add it to your `.gitignore` to exclude it from version control. Never commit private keys or mnemonics to your repository. -This example will fetch governance VAA `13940208096455381020` and print it as JSON: +3. Open `transfer.ts` and add the following code: -```bash -# ...signatures elided -timestamp: 1651416474, -nonce: 1570649151, -emitterChain: 1, -emitterAddress: '0000000000000000000000000000000000000000000000000000000000000004', -sequence: 13940208096455381020n, -consistencyLevel: 32, -payload: { - module: 'Core', - type: 'GuardianSetUpgrade', - chain: 0, - newGuardianSetIndex: 2, - newGuardianSetLength: 19, - newGuardianSet: [ - '58cc3ae5c097b213ce3c81979e1b9f9570746aa5', - 'ff6cb952589bde862c25ef4392132fb9d4a42157', - '114de8460193bdf3a2fcf81f86a09765f4762fd1', - '107a0086b32d7a0977926a205131d8731d39cbeb', - '8c82b2fd82faed2711d59af0f2499d16e726f6b2', - '11b39756c042441be6d8650b69b54ebe715e2343', - '54ce5b4d348fb74b958e8966e2ec3dbd4958a7cd', - '66b9590e1c41e0b226937bf9217d1d67fd4e91f5', - '74a3bf913953d695260d88bc1aa25a4eee363ef0', - '000ac0076727b35fbea2dac28fee5ccb0fea768e', - 'af45ced136b9d9e24903464ae889f5c8a723fc14', - 'f93124b7c738843cbb89e864c862c38cddcccf95', - 'd2cc37a4dc036a8d232b48f62cdd4731412f4890', - 'da798f6896a3331f64b48c12d1d57fd9cbe70811', - '71aa1be1d36cafe3867910f99c09e347899c19c3', - '8192b6e7387ccd768277c17dab1b7a5027c0b3cf', - '178e21ad2e77ae06711549cfbb1f9c7a9d8096e8', - '5e1487f35515d02a92753504a8d75471b9f49edb', - '6fbebc898f403e4773e95feb15e80c9a99c8348d' - ] -} -``` + ```typescript title="transfer.ts" + import { ethers } from 'ethers'; +import fs from 'fs'; +import path from 'path'; +import readlineSync from 'readline-sync'; +import { fileURLToPath } from 'url'; +import { wormhole, chainToChainId } from '@wormhole-foundation/sdk'; +import evm from '@wormhole-foundation/sdk/evm'; -### Submit VAAs +// Replace with your contract address and chain names +const AVALANCHE_SENDER_ADDRESS = 'INSERT_AVALANCHE_SENDER_CONTRACT_ADDRESS'; +const CELO_RECEIVER_ADDRESS = 'INSERT_CELO_RECEIVER_ADDRESS'; +const AVALANCHE_CHAIN_NAME = 'Avalanche'; +const CELO_CHAIN_NAME = 'Celo'; -Use `submit` to submit a VAA to a chain. It first parses the VAA and determines the destination chain and module. For example, a contract upgrade contains both the target chain and module, so the only required argument is the network moniker (`mainnet` or `testnet`): +// Fetch the contract ABI from the local filesystem +// This example uses the `out` directory from a Foundry deployment +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); +const SENDER_ABI_PATH = path.resolve( + __dirname, + '../out/CrossChainSender.sol/CrossChainSender.json' +); -```bash -worm submit $(cat my-nft-registration.txt) --network mainnet -``` +(async function () { + try { + console.log('Initializing Wormhole SDK...'); + const wh = await wormhole('Testnet', [evm]); + const sendChain = wh.getChain(AVALANCHE_CHAIN_NAME); + const rcvChain = wh.getChain(CELO_CHAIN_NAME); -The script will ask you to specify the target chain for VAAs that don't have a specific target chain (like registrations or Guardian set upgrades). For example, to submit a Guardian set upgrade on all chains, simply run: + // The EVM_PRIVATE_KEY value must be loaded securely beforehand, + // for example via a keystore, secrets manager, or environment variables + // (not recommended) + const EVM_PRIVATE_KEY = EVM_PRIVATE_KEY!; + if (!EVM_PRIVATE_KEY) { + console.error('EVM_PRIVATE_KEY is not set in your .env file.'); + process.exit(1); + } -```bash -worm-fetch-governance 13940208096455381020 > guardian-upgrade.txt -worm submit $(cat guardian-upgrade.txt) --network mainnet --chain oasis -worm submit $(cat guardian-upgrade.txt) --network mainnet --chain aurora -worm submit $(cat guardian-upgrade.txt) --network mainnet --chain fantom -worm submit $(cat guardian-upgrade.txt) --network mainnet --chain karura -worm submit $(cat guardian-upgrade.txt) --network mainnet --chain acala -worm submit $(cat guardian-upgrade.txt) --network mainnet --chain klaytn -worm submit $(cat guardian-upgrade.txt) --network mainnet --chain avalanche -worm submit $(cat guardian-upgrade.txt) --network mainnet --chain polygon -worm submit $(cat guardian-upgrade.txt) --network mainnet --chain bsc -worm submit $(cat guardian-upgrade.txt) --network mainnet --chain solana -worm submit $(cat guardian-upgrade.txt) --network mainnet --chain terra -worm submit $(cat guardian-upgrade.txt) --network mainnet --chain ethereum -worm submit $(cat guardian-upgrade.txt) --network mainnet --chain celo -``` + // Get the RPC URL or Provider from the SDK + const sourceRpcOrProvider = await sendChain.getRpc(); + let sourceProvider: ethers.JsonRpcProvider; + if ( + sourceRpcOrProvider && + typeof (sourceRpcOrProvider as any).getBlockNumber === 'function' + ) { + sourceProvider = sourceRpcOrProvider as ethers.JsonRpcProvider; + } else if (typeof sourceRpcOrProvider === 'string') { + sourceProvider = new ethers.JsonRpcProvider(sourceRpcOrProvider); + } else if ( + Array.isArray(sourceRpcOrProvider) && + typeof sourceRpcOrProvider[0] === 'string' + ) { + sourceProvider = new ethers.JsonRpcProvider(sourceRpcOrProvider[0]); + } else { + console.error( + 'Could not get a valid RPC URL or Provider from SDK:', + sourceRpcOrProvider + ); + process.exit(1); + } -The VAA payload type (Guardian set upgrade) specifies that this VAA should go to the core bridge, and the tool directs it there. + // Create the wallet using the provider and private key + const sourceWallet = new ethers.Wallet(EVM_PRIVATE_KEY, sourceProvider); -### Fetch Contract Information + // Load the sender contract ABI + if (!fs.existsSync(SENDER_ABI_PATH)) { + console.error(`ABI file not found at ${SENDER_ABI_PATH}`); + process.exit(1); + } + const CrossChainSenderArtifact = JSON.parse( + fs.readFileSync(SENDER_ABI_PATH, 'utf8') + ); + const senderAbi = CrossChainSenderArtifact.abi; -To get info about a contract (only EVM supported at this time), use the following command: + // Create new sender contract instance + const senderContract = new ethers.Contract( + AVALANCHE_SENDER_ADDRESS, + senderAbi, + sourceWallet + ); -```bash -worm evm info -c bsc -n mainnet -m TokenBridge -``` + // Get user input for token transfer parameters + const tokenAddress = readlineSync.question( + 'Enter the (ERC20) token contract address on Avalanche: ' + ); + const recipientAddress = readlineSync.question( + 'Enter the recipient address on Celo: ' + ); + const amountStr = readlineSync.question( + 'Enter the amount of tokens to transfer: ' + ); -Running this command generates the following output: + // Approve sending tokens from the source wallet to the sender contract + const tokenContract = new ethers.Contract( + tokenAddress, + [ + 'function decimals() view returns (uint8)', + 'function approve(address spender, uint256 amount) public returns (bool)', + 'function allowance(address owner, address spender) view returns (uint256)', + ], + sourceWallet + ); -```bash -{ - "address": "0xB6F6D86a8f9879A9c87f643768d9efc38c1Da6E7", - "wormhole": "0x98f3c9e6E3fAce36bAAd05FE09d375Ef1464288B", - "implementation": "0x621199f6beB2ba6fbD962E8A52A320EA4F6D4aA3", - "isInitialized": true, - "tokenImplementation": "0x7f8C5e730121657E17E452c5a1bA3fA1eF96f22a", - "chainId": 4, - "finality": 15, - "evmChainId": "56", - "isFork": false, - "governanceChainId": 1, - "governanceContract": "0x0000000000000000000000000000000000000000000000000000000000000004", - "WETH": "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", - "registrations": { - "Solana": "0xec7372995d5cc8732397fb0ad35c0121e0eaa90d26f828a534cab54391b3a4f5", - "Ethereum": "0x0000000000000000000000003ee18b2214aff97000d974cf647e7c347e8fa585", - "Terra": "0x0000000000000000000000007cf7b764e38a0a5e967972c1df77d432510564e2", - "Polygon": "0x0000000000000000000000005a58505a96d1dbf8df91cb21b54419fc36e93fde", - "Avalanche": "0x0000000000000000000000000e082f06ff657d94310cb8ce8b0d9a04541d8052", - "Oasis": "0x0000000000000000000000005848c791e09901b40a9ef749f2a6735b418d7564", - "Algorand": "0x67e93fa6c8ac5c819990aa7340c0c16b508abb1178be9b30d024b8ac25193d45", - "Aurora": "0x00000000000000000000000051b5123a7b0f9b2ba265f9c4c8de7d78d52f510f", - "Fantom": "0x0000000000000000000000007c9fc5741288cdfdd83ceb07f3ea7e22618d79d2", - "Karura": "0x000000000000000000000000ae9d7fe007b3327aa64a32824aaac52c42a6e624", - "Acala": "0x000000000000000000000000ae9d7fe007b3327aa64a32824aaac52c42a6e624", - "Klaytn": "0x0000000000000000000000005b08ac39eaed75c0439fc750d9fe7e1f9dd0193f", - "Celo": "0x000000000000000000000000796dff6d74f3e27060b71255fe517bfb23c93eed", - "Near": "0x148410499d3fcda4dcfd68a1ebfcdddda16ab28326448d4aae4d2f0465cdfcb7", - "Moonbeam": "0x000000000000000000000000b1731c586ca89a23809861c6103f0b96b3f57d92", - "Neon": "0x0000000000000000000000000000000000000000000000000000000000000000", - "Terra2": "0xa463ad028fb79679cfc8ce1efba35ac0e77b35080a1abe9bebe83461f176b0a3", - "Injective": "0x00000000000000000000000045dbea4617971d93188eda21530bc6503d153313", - "Osmosis": "0x0000000000000000000000000000000000000000000000000000000000000000", - "Sui": "0xccceeb29348f71bdd22ffef43a2a19c1f5b5e17c5cca5411529120182672ade5", - "Aptos": "0x0000000000000000000000000000000000000000000000000000000000000001", - "Arbitrum": "0x0000000000000000000000000b2402144bb366a632d14b83f244d2e0e21bd39c", - "Optimism": "0x0000000000000000000000001d68124e65fafc907325e3edbf8c4d84499daa8b", - "Gnosis": "0x0000000000000000000000000000000000000000000000000000000000000000", - "Pythnet": "0x0000000000000000000000000000000000000000000000000000000000000000", - "Xpla": "0x8f9cf727175353b17a5f574270e370776123d90fd74956ae4277962b4fdee24c", - "Btc": "0x0000000000000000000000000000000000000000000000000000000000000000", - "Base": "0x0000000000000000000000008d2de8d2f73f1f4cab472ac9a881c9b123c79627", - "Sei": "0x86c5fd957e2db8389553e1728f9c27964b22a8154091ccba54d75f4b10c61f5e", - "Rootstock": "0x0000000000000000000000000000000000000000000000000000000000000000", - "Scroll": "0x00000000000000000000000024850c6f61c438823f01b7a3bf2b89b72174fa9d", - "Mantle": "0x00000000000000000000000024850c6f61c438823f01b7a3bf2b89b72174fa9d", - "Blast": "0x00000000000000000000000024850c6f61c438823f01b7a3bf2b89b72174fa9d", - "Xlayer": "0x0000000000000000000000005537857664b0f9efe38c9f320f75fef23234d904", - "Linea": "0x0000000000000000000000000000000000000000000000000000000000000000", - "Berachain": "0x0000000000000000000000000000000000000000000000000000000000000000", - "Seievm": "0x0000000000000000000000000000000000000000000000000000000000000000", - "Snaxchain": "0x0000000000000000000000000000000000000000000000000000000000000000", - "Wormchain": "0xaeb534c45c3049d380b9d9b966f9895f53abd4301bfaff407fa09dea8ae7a924", - "Cosmoshub": "0x0000000000000000000000000000000000000000000000000000000000000000", - "Evmos": "0x0000000000000000000000000000000000000000000000000000000000000000", - "Kujira": "0x0000000000000000000000000000000000000000000000000000000000000000", - "Neutron": "0x0000000000000000000000000000000000000000000000000000000000000000", - "Celestia": "0x0000000000000000000000000000000000000000000000000000000000000000", - "Stargaze": "0x0000000000000000000000000000000000000000000000000000000000000000", - "Seda": "0x0000000000000000000000000000000000000000000000000000000000000000", - "Dymension": "0x0000000000000000000000000000000000000000000000000000000000000000", - "Provenance": "0x0000000000000000000000000000000000000000000000000000000000000000", - "Sepolia": "0x0000000000000000000000000000000000000000000000000000000000000000", - "ArbitrumSepolia": "0x0000000000000000000000000000000000000000000000000000000000000000", - "BaseSepolia": "0x0000000000000000000000000000000000000000000000000000000000000000", - "OptimismSepolia": "0x0000000000000000000000000000000000000000000000000000000000000000", - "Holesky": "0x0000000000000000000000000000000000000000000000000000000000000000", - "PolygonSepolia": "0x0000000000000000000000000000000000000000000000000000000000000000" + // Convert the amount to the correct units based on token decimals + const decimals = Number(await tokenContract.decimals()); + const amountToTransfer = ethers.parseUnits(amountStr, decimals); + + // Get a transfer cost quote + const targetChainId = chainToChainId(rcvChain.chain); + const cost = await senderContract.quoteCrossChainDeposit(targetChainId); + // Approve the sender contract to spend the tokens + const approveTx = await tokenContract.approve( + AVALANCHE_SENDER_ADDRESS, + amountToTransfer + ); + await approveTx.wait(); + + // Initiate the transfer + console.log( + `Initiating cross-chain transfer to ${CELO_RECEIVER_ADDRESS} on ${rcvChain.chain}...` + ); + const transferTx = await senderContract.sendCrossChainDeposit( + targetChainId, + CELO_RECEIVER_ADDRESS, + recipientAddress, + amountToTransfer, + tokenAddress, + { value: cost } + ); + console.log(`Transfer transaction sent: ${transferTx.hash}`); + await transferTx.wait(); + console.log(`✅ Transfer initiated successfully!`); + } catch (error) { + console.error('An error occurred:', error); + process.exit(1); } -} -``` -You can get the contract address for a module as follows: + process.exit(0); +})(); + ``` -```bash -worm info rpc INSERT_NETWORK INSERT_CHAIN INSERT_MODULE -``` + This script defines the sender and receiver contract addresses, fetches the necessary ABI information, creates a connected signer, converts decimals, calculates the estimated transfer cost, and initiates the token transfer. -To get the contract address for `NFTBridge` on BSC Mainnet, for example, you can provide the following command: +3. Run the script using the following command: -```bash -worm info contract mainnet bsc NFTBridge -``` + ```bash + npx tsx script/transfer.ts + ``` -### Fetch Chain Information +4. Follow the prompts in the terminal. This example uses Avalanche Fuji as the source chain, Celo Testnet as the target, [Avalanche Fuji testnet USDC](https://developers.circle.com/stablecoins/usdc-on-test-networks){target=\_blank}, and a developer wallet as the recipient address. You will see terminal output similar to the following: -You can get the RPC address for a chain as follows: +
+npx tsx script/transfer.ts +Initializing Wormhole SDK... +Enter the (ERC20) token contract address on Avalanche: 0x5425890298aed601595a70ab815c96711a31bc65 +Enter the recipient address on Celo: 0xCD8Bcd9A793a7381b3C66C763c3f463f70De4e12 +Initiating cross-chain transfer to 0xff97a7141833fbe829249d4e8952A8e73a4a2fbd on Celo... +Transfer transaction sent: 0x2d819aadf88309eb19f59a510aba1f2892b54487f9e287feadd150181a28f771 +✅ Transfer initiated successfully! + +
-```bash -worm info rpc INSERT_NETWORK INSERT_CHAIN -``` +Congratulations! You've successfully created and deployed Wormhole Solidity SDK-based smart contracts and used them to send testnet USDC across blockchains. Consider the following options to build upon what you've accomplished. -To get the RPC address for BSC Mainnet, for example, you can provide the following command: +## Next Steps -```bash -worm info rpc mainnet bsc -``` +- [**Get Started with Messaging**](/docs/products/messaging/get-started/): Send a message across blockchains using the Wormhole TypeScript SDK to eliminate smart contract development and auditing overhead. --- END CONTENT --- -Doc-Content: https://wormhole.com/docs/tools/dev-env/ +Doc-Content: https://wormhole.com/docs/tools/.solidity-sdk/.sdk-reference/ --- BEGIN CONTENT --- --- -title: Local Dev Environment -description: Learn how to configure a development environment to build with Wormhole, including using the CLI, local validators, testing on public test networks, and more. -categories: Solidity-SDK, Typescript-SDK +title: Solidity SDK +description: How to use the Wormhole Solidity SDK for cross-chain messaging, token transfers, and integrating decentralized applications on EVM-compatible blockchains. +categories: Solidity-SDK --- -# Development Environment - -Developers building for smart contract integration will want to set up a development environment to allow testing the full integration, possibly including VAA generation and relaying. +# Solidity SDK -## Tooling Installation +This page covers all you need to know about the functionality offered through the Wormhole Solidity SDK. -The [Wormhole CLI Tool](/docs/tools/cli/get-started/){target=\_blank} should be installed regardless of the environments chosen. Each environment has its own set of recommended tools. To begin working with a specific environment, see the recommended tools on the respective [environment page](/docs/products/reference/supported-networks/){target=\_blank}. +
-## Development Stages +- :octicons-download-16:{ .lg .middle } **Installation** -Different approaches to development and testing are recommended at various stages of application development. + --- -### Initial Development + Find installation instructions using Foundry and Forge to pull the necessary libraries into your project. -During the initial development of an on-chain application, the best option is to use the native tools available in the environment. You can visit the following resources for more information: + [:custom-arrow: Install the SDK](/docs/tools/solidity-sdk/get-started/#installation) -- **[Environment](https://github.com/wormhole-foundation/wormhole){target=\_blank}** - select the folder for the desired network to learn about the recommended native toolset -- **[Mock Guardian](https://github.com/wormhole-foundation/wormhole/blob/main/sdk/js/src/mock/wormhole.ts){target=\_blank}** - it's recommended to set up a mock Guardian or Emitter to provide signed VAAsFor any program methods that require some message be sent or received. -- **[Wormhole Scaffolding repository](https://github.com/wormhole-foundation/wormhole-scaffolding/blob/main/evm/ts-test/01_hello_world.ts){target=\_blank}** - example mock Guardian test +- :octicons-download-16:{ .lg .middle } **Source Code** -Relying on native tools when possible allows for more rapid prototyping and iteration. + --- -### Integration + Want to go straight to the source? Check out the Solidity SDK GitHub repository. -For integration to Wormhole and with multiple chains, the simplest option is to use the chains' Testnets. In choosing which chains to use for integration testing, consider which chains in a given environment provide easy access to Testnet tokens and where block times are fast. Find links for Testnet faucets in the [blockchain details section](/docs/products/reference/supported-networks/){target=\_blank}. A developer may prefer standing up a set of local validators instead of using the Testnet. For this option, [Tilt](https://github.com/wormhole-foundation/wormhole/blob/main/DEVELOP.md){target=\_blank} is available to run local instances of all the chains Wormhole supports. + [:custom-arrow: View GitHub Repository](https://github.com/wormhole-foundation/wormhole-solidity-sdk){target=\_blank} -!!! note - Variation in host environments causes unique issues, and the computational intensity of multiple simultaneous local validators can make setting them up difficult or time-consuming. You may prefer Testnets for the simplest integration testing. +
-### Prepare for Deployment +## Key Considerations -Once you've finished the application's initial development and performed integration testing, you should set up a CI test environment. The best option for that is likely to be [Tilt](https://tilt.dev/){target=\_blank} since it allows you to spin up any chains supported by Wormhole in a consistent environment. +Before deploying applications using the Wormhole Solidity SDK, keep these considerations in mind: -## Validator Setup with Tilt - -### Tilt -If you'd like to set up a local validator environment, follow the setup guide for Tilt. Tilt is a full-fledged Kubernetes deployment of every chain connected to Wormhole, along with a Guardian node. It usually takes 30 minutes to spin up fully, but it comes with all chains running out of the box. Refer to the [Tilt](https://github.com/wormhole-foundation/wormhole/blob/main/DEVELOP.md){target=\_blank} page for a complete guide to setting up and configuring Tilt. - -## Deploying to Public Networks - -### Testnet - -When doing integration testing on Testnets, remember that a single Guardian node is watching for transactions on various test networks. Because Testnets only have a single Guardian, there's a slight chance that your VAAs won't be processed. This rate doesn't indicate performance on Mainnet, where 19 Guardians are watching for transactions. The Testnet contract addresses are available on the page for each [environment](/docs/products/reference/supported-networks/){target=\_blank}. The [Wormholescan API](https://docs.wormholescan.io){target=\_blank} offers the following Guardian equivalent Testnet endpoint: + - **IERC-20 remapping** - the SDK provides a remapping mechanism to handle potential conflicts between different implementations of IERC20, ensuring seamless integration with other libraries + - **Testing** - given the cross-chain dependencies, testing all integrations is critical to avoid issues in production environments -```text -https://api.testnet.wormholescan.io -``` +## Concepts and Components -### Mainnet +The Wormhole Solidity SDK consists of key components that streamline cross-chain communication, allowing developers to securely and efficiently interact with Wormhole’s infrastructure. Below are the critical concepts and contracts you'll encounter when working with the SDK. -The Mainnet contract addresses are available on the page for each [environment](/docs/products/reference/supported-networks/){target=\_blank}. The [Wormholescan API](https://docs.wormholescan.io){target=\_blank} offers the following Guardian equivalent Mainnet endpoint: +### Cross-Chain Messaging with the Wormhole Relayer SDK -```text -https://api.wormholescan.io -``` ---- END CONTENT --- +The `WormholeRelayerSDK.sol` contract simplifies cross-chain messaging and asset transfers by integrating several necessary modules, including the Wormhole relayer. By automating message delivery between chains, the Wormhole relayer removes the need for developers to manage relayer infrastructure or handle gas on the target chain. Delivery providers handle the message payload, ensuring secure and efficient communication. -Doc-Content: https://wormhole.com/docs/tools/faqs/ ---- BEGIN CONTENT --- ---- -title: Toolkit FAQs -description: FAQs on Wormhole Toolkit, covering Wormholescan, CLI, SDKs (TypeScript, Solidity), Tilt, error handling, transaction history, and manual VAA submission. -categories: Solidity-SDK, Typescript-SDK ---- +You can refer to the [Wormhole relayer documentation](/docs/products/messaging/guides/wormhole-relayers/){target=\_blank} for more details. -# Toolkit FAQs +Key modules in the SDK include: -## Why does the `toNative` function in the TypeScript SDK return an error? + - **`Base.sol`** - the core module for cross-chain messaging. It provides utility functions like `onlyWormholeRelayer()` and `setRegisteredSender()`, ensuring that only messages from trusted relayers are processed -The `toNative` function may return an error if the platform-specific module (such as Solana or EVM) is not correctly imported or passed into the Wormhole constructor. + - **`TokenBase.sol`** - this module extends the base messaging functionality to support cross-chain token transfers. It includes utilities for securely sending and receiving tokens between EVM-compatible chains -To fix this, ensure the relevant platform module is imported and included when initializing Wormhole. For example, if you're working with Solana, make sure to import the Solana module and pass it into the Wormhole constructor like this: + - **`CCTPBase.sol`** - designed for Circle’s Cross-Chain Transfer Protocol, this module manages asset transfers such as USDC between chains. It includes functionalities for both sending and receiving CCTP-based assets -```typescript -import solana from '@wormhole-foundation/sdk/solana'; -const wh = await wormhole('Testnet', [solana]); -``` + - **`CCTPAndTokenBase.sol`** - a combined module that supports token and CCTP-based asset transfers in a single implementation. This module simplifies development for applications needing to handle both types of transfers -## How can I retrieve the history of previously bridged transactions? +The Wormhole Solidity SDK offers a unified framework for cross-chain communication. Developers can select specific modules based on their application’s requirements, whether for messaging, token transfers, or CCTP. Each module includes built-in security measures, ensuring that only authorized senders or relayers are accepted, thereby protecting the application from unauthorized interactions. -To retrieve the history of previously bridged transactions, you can use the Wormholescan API. Use the following endpoint to query the transaction history for a specific address: +Please refer to the complete `WormholeRelayerSDK.sol` file below for further details. -```bash -https://api.wormholescan.io/api/v1/operations?address=INSERT_ADDRESS -``` +???- code "`WormholeRelayerSDK.sol`" + ```solidity + // SPDX-License-Identifier: Apache 2 +pragma solidity ^0.8.19; -Simply replace `INSERT_ADDRESS_HERE` with the address you want to query. The API will return a list of operations, including details about previously bridged transactions. +import "wormhole-sdk/interfaces/IWormholeReceiver.sol"; +import "wormhole-sdk/interfaces/IWormholeRelayer.sol"; +import "wormhole-sdk/constants/Chains.sol"; +import "wormhole-sdk/Utils.sol"; -???- example "Fetch transaction history for a specific address" - ```bash - curl -X GET "https://api.wormholescan.io/api/v1/operations?address=0x05c009C4C1F1983d4B915C145F4E782de23d3A38" -H "accept: application/json" +import {Base} from "wormhole-sdk/WormholeRelayer/Base.sol"; +import {TokenBase, TokenReceiver, TokenSender} from "wormhole-sdk/WormholeRelayer/TokenBase.sol"; +import {CCTPBase, CCTPReceiver, CCTPSender} from "wormhole-sdk/WormholeRelayer/CCTPBase.sol"; +import {CCTPAndTokenBase, CCTPAndTokenReceiver, CCTPAndTokenSender} from "wormhole-sdk/WormholeRelayer/CCTPAndTokenBase.sol"; ``` -## How can I manually submit a VAA to a destination chain in the correct format? +### Base Contract Overview -To manually submit a VAA (Verifiable Action Approval) to a destination chain, follow these steps: +The `Base.sol` contract is a core part of the Wormhole Solidity SDK, providing essential helper functions and modifiers for managing cross-chain messages securely via the Wormhole Relayer. It handles sender registration and message validation, ensuring only authorized senders from specific chains can send messages. -1. **Obtain the VAA in Base64 format** - navigate to the **Advanced** tab in [Wormholescan](https://wormholescan.io/){target=\_blank} to find the VAA associated with the transaction you want to submit and copy the VAA in base64 format + - **`onlyWormholeRelayer()`** - a modifier that ensures only authorized messages from the Wormhole relayer contract are processed, restricting access to certain functions - ```bash - https://wormholescan.io/#/tx/INSERT_TX_HASH?view=advanced + ```solidity + require( + msg.sender == address(wormholeRelayer), + "Msg.sender is not Wormhole Relayer" + ); + _; + } ``` -2. **Convert the VAA to hex** - you must convert the base64 VAA into a hexadecimal (hex) format before submitting it to the destination chain. This can be done using various online tools or via command-line utilities like `xxd` or a script in a language like Python + - **`setRegisteredSender()`** - restricts message acceptance to a registered sender from a specific chain, ensuring messages are only processed from trusted sources -3. **Submit the VAA through Etherscan (for EVM chains)** - once the VAA is in hex format, go to the [Etherscan UI](https://etherscan.io/){target=\_blank} and submit it through the [`TokenBridge`](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/main/src/interfaces/ITokenBridge.sol){target=\_blank} contract’s method (such as the `CompleteTransfer` function or `CompleteTransferWithPayload`) + ```solidity + uint16 sourceChain, + bytes32 sourceAddress + ) public { + require( + msg.sender == registrationOwner, + "Not allowed to set registered sender" + ); + registeredSenders[sourceChain] = sourceAddress; + } + ``` - - The `TokenBridge` contract addresses for each chain are available in the [Wormhole contract addresses](/docs/products/reference/contract-addresses/){target=\_blank} section +These security measures ensure messages come from the correct source and are processed securely. Please refer to the complete `Base.sol` contract below for further details. - - Interact with the smart contract through the Etherscan UI by pasting the hex-encoded VAA into the appropriate field +???- code "`Base.sol`" + ```solidity + // SPDX-License-Identifier: Apache 2 +pragma solidity ^0.8.19; -Following these steps, you can manually submit a VAA in the proper format to a destination chain. ---- END CONTENT --- +import "wormhole-sdk/interfaces/IWormholeReceiver.sol"; +import "wormhole-sdk/interfaces/IWormholeRelayer.sol"; +import "wormhole-sdk/interfaces/IWormhole.sol"; +import "wormhole-sdk/Utils.sol"; -Doc-Content: https://wormhole.com/docs/tools/solidity-sdk/get-started/ ---- BEGIN CONTENT --- ---- -title: Get Started with the Solidity SDK -description: Follow this guide to use the Wormhole Solidity SDK's interfaces and tools to help you quickly build on-chain integrations using smart contracts. -categories: Basics, Solidity-SDK ---- +abstract contract Base { + IWormholeRelayer public immutable wormholeRelayer; + IWormhole public immutable wormhole; -# Get Started with the Solidity SDK + address registrationOwner; + mapping(uint16 => bytes32) registeredSenders; -The [Wormhole Solidity SDK](https://github.com/wormhole-foundation/wormhole-solidity-sdk){target=\_blank} provides Solidity interfaces, prebuilt contracts, and testing tools to help Solidity developers build on-chain Wormhole integrations via smart contracts. You can use the [Wormhole TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank} for off-chain integrations without writing Solidity. + constructor(address _wormholeRelayer, address _wormhole) { + wormholeRelayer = IWormholeRelayer(_wormholeRelayer); + wormhole = IWormhole(_wormhole); + registrationOwner = msg.sender; + } -## Install the SDK + modifier onlyWormholeRelayer() { + require( + msg.sender == address(wormholeRelayer), + "Msg.sender is not Wormhole Relayer" + ); + _; + } -Use Foundry's [`forge`](https://book.getfoundry.sh/forge/){target=\_blank} to install the SDK using the following command: + modifier isRegisteredSender(uint16 sourceChain, bytes32 sourceAddress) { + require( + registeredSenders[sourceChain] == sourceAddress, + "Not registered sender" + ); + _; + } -```bash -forge install wormhole-foundation/wormhole-solidity-sdk -``` + /** + * Sets the registered address for 'sourceChain' to 'sourceAddress' + * So that for messages from 'sourceChain', only ones from 'sourceAddress' are valid + * + * Assumes only one sender per chain is valid + * Sender is the address that called 'send' on the Wormhole Relayer contract on the source chain) + */ + function setRegisteredSender( + uint16 sourceChain, + bytes32 sourceAddress + ) public { + require( + msg.sender == registrationOwner, + "Not allowed to set registered sender" + ); + registeredSenders[sourceChain] = sourceAddress; + } +} + ``` -## Key Components +### Interface for Cross-Chain Messages -The following key components and features work together to make your on-chain Wormhole integration easier to build. +The Wormhole Solidity SDK interacts with the Wormhole relayer for sending and receiving messages across EVM-compatible chains. The [`IWormholeRelayer`](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/main/src/interfaces/IWormholeRelayer.sol){target=\_blank} includes several interfaces that are central to cross-chain communication, enabling secure and efficient message delivery. -??? interface "Base contracts" +For detailed information on how to implement these interfaces, refer to the [Wormhole Relayer Interfaces documentation](/docs/products/messaging/guides/wormhole-relayers/#wormhole-relayer-interfaces){target=\_blank}. This section covers: - Leverage base contracts to send and receive messages and tokens. + - **`IWormholeRelayer`** – methods for sending cross-chain messages, VAAs, and token transfers + - **`IWormholeReceiver`** – the required implementation for receiving cross-chain messages + - **`quoteEVMDeliveryPrice()`** – how to estimate gas and fees for cross-chain transactions - - [**`Base.sol`**](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/b9e129e65d34827d92fceeed8c87d3ecdfc801d0/src/Base.sol){target=\_blank}: Uses Wormhole interfaces to authorize and verify a registered sender. - - [**`TokenBase.sol`**](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/b9e129e65d34827d92fceeed8c87d3ecdfc801d0/src/TokenBase.sol){target=\_blank}: Uses `TokenReceiver` and `TokenSender` contracts to define functions for transferring tokens. - - [**`CCTPBase.sol`**](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/b9e129e65d34827d92fceeed8c87d3ecdfc801d0/src/CCTPBase.sol){target=\_blank}: Uses `CCTPSender` and `CCTPReceiver` contracts to define functions for transferring USDC. +These interfaces reduce the complexity of cross-chain dApp development by abstracting away the details of relayer infrastructure, ensuring that message delivery is handled efficiently. -??? interface "Interfaces" +### Advanced Concepts - Use interfaces to ensure consistent interactions with the protocol regardless of the supported chain you use. +For developers interested in exploring additional advanced topics, the following sections provide insights into key aspects of the SDK’s functionality. - - [**`ITokenBridge.sol`**](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/b9e129e65d34827d92fceeed8c87d3ecdfc801d0/src/interfaces/ITokenBridge.sol){target=\_blank}: Defines key structs and functions for token attestation, wrapping and transferring tokens, monitoring transaction progress. - - [**CCTP Interfaces**](https://github.com/wormhole-foundation/wormhole-solidity-sdk/tree/b9e129e65d34827d92fceeed8c87d3ecdfc801d0/src/interfaces/CCTPInterfaces){target=\_blank}: A set of interfaces for USDC transfers via CCTP for sending, relaying, and receiving messages and tokens. - - [**`IWormholeReceiver.sol`**](https://github.com/wormhole-foundation/wormhole/blob/main/relayer/ethereum/contracts/interfaces/relayer/IWormholeReceiver.sol){target=\_blank}: Defines the `receiveWormholeMessages` function. - - [**`IWormholeRelayer.sol`**](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/b9e129e65d34827d92fceeed8c87d3ecdfc801d0/src/interfaces/IWormholeRelayer.sol){target=\_blank}: Defines key structs and functions to identify, send, and deliver messages and follow the progress of transactions. +???- note "Error Handling and Reverts" + The SDK defines several custom errors to help developers handle common issues like incorrect gas fees, invalid senders, and more. For example, `InvalidMsgValue` is thrown when the message value for a relayed message is erroneous. -??? interface "Constants" + ```solidity + error InvalidMsgValue(uint256 msgValue, uint256 totalFee); + ``` - Auto-generated Solidity constants help avoid manual entry errors and ensure consistent delivery. +## Usage - - [**Wormhole Chain ID's**](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/b9e129e65d34827d92fceeed8c87d3ecdfc801d0/src/Chains.sol){target=\_blank}: Generated list of Wormhole Chain ID's for supported chains. - - [**Circle CCTP Domain IDs**](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/b9e129e65d34827d92fceeed8c87d3ecdfc801d0/src/CCTPAndTokenBase.sol){target=\_blank}: Generated list of defined CCTP domain ID's to ensure USDC transfers use the correct domain for a given chain. - - [**`chainConsts.ts`**](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/75ddcec06ffe9d62603d023357caa576c5ea101c/gen/chainConsts.ts){target=\_blank}: Returns values to identify properties and contract addresses for each supported chain. +This section covers cross-chain messaging and token transfers and shows how to use the Wormhole Solidity SDK in real-world scenarios. -## Example Usage +### Send a Cross-Chain Message -The following demo illustrates the use of Wormhole Solidity SDK-based smart contracts to send testnet USDC between supported chains. +To send a cross-chain message, inherit from the base contract provided by the SDK and use its helper methods to define your message and sender address. Here’s a basic example: -### Prerequisites -Before you begin, ensure you have the following: +```solidity +pragma solidity ^0.8.19; -- [Node.js and npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm){target=\_blank} installed -- [TypeScript](https://www.typescriptlang.org/download/){target=\_blank} installed -- [Foundry](https://book.getfoundry.sh/getting-started/installation){target=\_blank} installed -- Testnet tokens for two supported chains. This example uses [testnet AVAX for Avalanche Fuji](https://core.app/tools/testnet-faucet/?subnet=c&token=c){target=\_blank} and [testnet CELO for Celo Alfajores](https://faucet.celo.org/alfajores){target=\_blank} and can be adapted to any supported chains -- [USDC testnet tokens](https://faucet.circle.com/){target=\_blank} on your source chain for cross-chain transfer +import "@wormhole-foundation/wormhole-solidity-sdk/src/WormholeRelayer/Base.sol"; -### Set Up a Project +contract CrossChainSender is Base { + constructor( + address _wormholeRelayer, + address _wormhole + ) Base(_wormholeRelayer, _wormhole) {} -Follow these steps to prepare your development environment: + function sendMessage( + bytes memory message, + uint16 targetChain, + bytes32 targetAddress + ) external payable { + // Register sender and send message through WormholeRelayer + setRegisteredSender(targetChain, msg.sender); + onlyWormholeRelayer().sendPayloadToEvm( + targetChain, + address(targetAddress), + message, + 0, + 500_000 + ); + } +} +``` -1. Create a directory for your project, navigate into it, and install the Wormhole Solidity SDK: +This contract extends `Base.sol` and allows sending cross-chain messages securely using the `WormholeRelayer`. - ```bash - mkdir solidity-token-transfer - cd solidity-token-transfer - forge install wormhole-foundation/wormhole-solidity-sdk - ``` +### Send Tokens Across Chains -2. Install dependencies for use with your transfer script, including the Wormhole TypeScript SDK, and initiate a new Node.js project: +The SDK enables seamless token transfers between EVM-compatible chains in addition to sending messages. To facilitate cross-chain token transfers, you can extend the SDK's `TokenSender` and `TokenReceiver` base contracts. - ```bash - npm init -y && npm install @wormhole-foundation/sdk ethers -D tsx typescript - ``` +```solidity +pragma solidity ^0.8.19; -### Create and Deploy Contracts +import "@wormhole-foundation/wormhole-solidity-sdk/src/WormholeRelayer/TokenBase.sol"; -This project uses sender and receiver contracts to access the `WormholeRelayer` interface's [`TokenSender`](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/baa085006586a43c42858d355e3ffb743b80d7a4/src/WormholeRelayer/TokenBase.sol#L24){target=\_blank} and [`TokenReceiver`](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/baa085006586a43c42858d355e3ffb743b80d7a4/src/WormholeRelayer/TokenBase.sol#L147){target=\_blank} base classes to simplify sending tokens across chains. - -Follow these steps to create and deploy your sender and receiver Solidity contracts: - -1. Use the following example code to create `CrossChainSender.sol`: - - ```solidity title="CrossChainSender.sol" - // SPDX-License-Identifier: MIT -pragma solidity ^0.8.13; - -import "lib/wormhole-solidity-sdk/src/WormholeRelayerSDK.sol"; -import "lib/wormhole-solidity-sdk/src/interfaces/IERC20.sol"; - -// Extend the TokenSender contract inherited from TokenBase -contract CrossChainSender is TokenSender { - uint256 constant GAS_LIMIT = 250_000; - // Initialize the contract with the Wormhole relayer, Token Bridge, - // and Wormhole Core Contract addresses +contract CrossChainTokenSender is TokenSender { constructor( address _wormholeRelayer, - address _tokenBridge, address _wormhole - ) TokenBase(_wormholeRelayer, _tokenBridge, _wormhole) {} - - // Calculate the estimated cost for multichain token transfer using - // the wormholeRelayer to get the delivery cost and add the message fee - function quoteCrossChainDeposit( - uint16 targetChain - ) public view returns (uint256 cost) { - uint256 deliveryCost; - (deliveryCost, ) = wormholeRelayer.quoteEVMDeliveryPrice( - targetChain, - 0, - GAS_LIMIT - ); - - cost = deliveryCost + wormhole.messageFee(); - } + ) TokenSender(_wormholeRelayer, _wormhole) {} - // Send tokens and payload to the recipient on the target chain - function sendCrossChainDeposit( - uint16 targetChain, - address targetReceiver, - address recipient, + function sendToken( + address token, uint256 amount, - address token - ) public payable { - // Calculate the estimated cost for the multichain deposit - uint256 cost = quoteCrossChainDeposit(targetChain); - require( - msg.value == cost, - "msg.value must equal quoteCrossChainDeposit(targetChain)" - ); - // Transfer the tokens from the sender to this contract - IERC20(token).transferFrom(msg.sender, address(this), amount); - // Encode the recipient address into the payload - bytes memory payload = abi.encode(recipient); - // Initiate the multichain transfer using the wormholeRelayer - sendTokenWithPayloadToEvm( - targetChain, - targetReceiver, - payload, - 0, - GAS_LIMIT, - token, - amount - ); + uint16 targetChain, + bytes32 targetAddress + ) external payable { + // Send tokens across chains + transferTokenToTarget(token, amount, targetChain, targetAddress); } } - ``` +``` - This contract extends `TokenSender`, gaining access to its functionality. It initializes the contract with the required addresses, calculates estimated transfer costs, defines transfer parameters, and initiates the transfer using the `sendTokenWithPayloadToEvm` function from `WormholeRelayer`. +In this example, `TokenSender` initiates a token transfer to another chain. The SDK’s built-in utilities securely handle token transfers, ensuring proper VAAs are generated and processed. -2. Use the following example code to create `CrossChainReceiver.sol`: +### Receive Tokens Across Chains - ```solidity title="CrossChainSender.sol" - // SPDX-License-Identifier: MIT -pragma solidity ^0.8.13; +To receive tokens on the target chain, implement a contract that inherits from `TokenReceiver` and overrides the `receiveWormholeMessages` function. -import "lib/wormhole-solidity-sdk/src/WormholeRelayerSDK.sol"; -import "lib/wormhole-solidity-sdk/src/interfaces/IERC20.sol"; +```solidity +pragma solidity ^0.8.19; -// Extend the TokenReceiver contract inherited from TokenBase -contract CrossChainReceiver is TokenReceiver { - // Initialize the contract with the Wormhole relayer, Token Bridge, - // and Wormhole Core Contract addresses +import "@wormhole-foundation/wormhole-solidity-sdk/src/WormholeRelayer/TokenBase.sol"; + +contract CrossChainTokenReceiver is TokenReceiver { constructor( address _wormholeRelayer, - address _tokenBridge, address _wormhole - ) TokenBase(_wormholeRelayer, _tokenBridge, _wormhole) {} + ) TokenReceiver(_wormholeRelayer, _wormhole) {} - // Receive the multichain payload and tokens - // Verify the transfer is from a registered sender - function receivePayloadAndTokens( + // Function to handle received tokens from another chain + function receiveWormholeMessages( bytes memory payload, - TokenReceived[] memory receivedTokens, + bytes[] memory additionalMessages, bytes32 sourceAddress, uint16 sourceChain, - bytes32 // deliveryHash - ) - internal - override - onlyWormholeRelayer - isRegisteredSender(sourceChain, sourceAddress) - { - // Ensure the payload is not empty and only has one token transfer - require(receivedTokens.length == 1, "Expected 1 token transfer"); - - // Decode the recipient address from the payload - address recipient = abi.decode(payload, (address)); - - // Transfer the received tokens to the intended recipient - IERC20(receivedTokens[0].tokenAddress).transfer( - recipient, - receivedTokens[0].amount - ); + bytes32 deliveryHash + ) external payable override { + // Process the received tokens here + receiveTokens(payload); } } - ``` - - This contract extends `TokenReceiver`, gaining access to its functionality. It initializes the contract with the required addresses, receives the payload and tokens, verifies the transfer is from a registered sender, decodes the recipient address, and transfers the tokens to the recipient. +``` -3. Deploy the contracts using your preferred deployment method. Make sure you deploy `CrossChainSender.sol` to your desired source chain and `CrossChainReceiver.sol` to the target chain. Save the deployed contract addresses for each contract. You will need them for your transfer script. +In this example, `TokenReceiver` allows the contract to handle tokens sent from the source chain. Once the cross-chain message is received, the `receiveWormholeMessages` function processes the incoming tokens. Always validate the message's authenticity and source. -## Use Contracts to Transfer USDC +!!! note + Always verify the source of incoming messages and tokens to prevent unauthorized access to your contract. Please refer to the [Emitter Verification](/docs/products/messaging/guides/core-contracts/#validating-the-emitter/){target=\_blank} section for more details. -1. Once your contracts are deployed, create a `transfer.ts` file to handle the multichain transfer logic: +## Testing Environment - ```bash - touch script/transfer.ts - ``` +The SDK includes built-in support for Forge-based testing, which allows you to test your cross-chain applications locally before deploying them to production. Testing with the same Solidity compiler version and configuration you plan to use in production is highly recommended to catch any potential issues early. -2. Set up secure access to your wallets. This guide assumes you are loading your private key(s) from a secure keystore of your choice, such as a secrets manager or a CLI-based tool like [`cast wallet`](https://book.getfoundry.sh/reference/cast/cast-wallet){target=\_blank}. +For a detailed example, check out the below repositories: - !!! warning - If you use a `.env` file during development, add it to your `.gitignore` to exclude it from version control. Never commit private keys or mnemonics to your repository. + - [Cross chain messaging](/docs/products/messaging/tutorials/cross-chain-contracts/){target=\_blank} + - [Cross chain token transfer](/docs/products/messaging/tutorials/cross-chain-token-contracts/){target=\_blank} +--- END CONTENT --- -3. Open `transfer.ts` and add the following code: +Doc-Content: https://wormhole.com/docs/tools/cli/get-started/ +--- BEGIN CONTENT --- +--- +title: Wormhole CLI +description: Learn how to install and use the Wormhole CLI, including commands and examples for managing multichain deployments, generating VAAs, and querying contract info. +categories: Solidity-SDK, Typescript-SDK +--- - ```typescript title="transfer.ts" - import { ethers } from 'ethers'; -import fs from 'fs'; -import path from 'path'; -import readlineSync from 'readline-sync'; -import { fileURLToPath } from 'url'; -import { wormhole, chainToChainId } from '@wormhole-foundation/sdk'; -import evm from '@wormhole-foundation/sdk/evm'; +# Wormhole CLI -// Replace with your contract address and chain names -const AVALANCHE_SENDER_ADDRESS = 'INSERT_AVALANCHE_SENDER_CONTRACT_ADDRESS'; -const CELO_RECEIVER_ADDRESS = 'INSERT_CELO_RECEIVER_ADDRESS'; -const AVALANCHE_CHAIN_NAME = 'Avalanche'; -const CELO_CHAIN_NAME = 'Celo'; +This tool is a command-line interface to Wormhole, allowing you to perform various actions, such as querying a transaction's status or submitting token transfers. -// Fetch the contract ABI from the local filesystem -// This example uses the `out` directory from a Foundry deployment -const __filename = fileURLToPath(import.meta.url); -const __dirname = path.dirname(__filename); -const SENDER_ABI_PATH = path.resolve( - __dirname, - '../out/CrossChainSender.sol/CrossChainSender.json' -); +## Installation -(async function () { - try { - console.log('Initializing Wormhole SDK...'); - const wh = await wormhole('Testnet', [evm]); - const sendChain = wh.getChain(AVALANCHE_CHAIN_NAME); - const rcvChain = wh.getChain(CELO_CHAIN_NAME); +Clone the repository and change directories to the appropriate directory: - // The EVM_PRIVATE_KEY value must be loaded securely beforehand, - // for example via a keystore, secrets manager, or environment variables - // (not recommended) - const EVM_PRIVATE_KEY = EVM_PRIVATE_KEY!; - if (!EVM_PRIVATE_KEY) { - console.error('EVM_PRIVATE_KEY is not set in your .env file.'); - process.exit(1); - } +```bash +git clone https://github.com/wormhole-foundation/wormhole && +cd wormhole/clients/js +``` - // Get the RPC URL or Provider from the SDK - const sourceRpcOrProvider = await sendChain.getRpc(); - let sourceProvider: ethers.JsonRpcProvider; - if ( - sourceRpcOrProvider && - typeof (sourceRpcOrProvider as any).getBlockNumber === 'function' - ) { - sourceProvider = sourceRpcOrProvider as ethers.JsonRpcProvider; - } else if (typeof sourceRpcOrProvider === 'string') { - sourceProvider = new ethers.JsonRpcProvider(sourceRpcOrProvider); - } else if ( - Array.isArray(sourceRpcOrProvider) && - typeof sourceRpcOrProvider[0] === 'string' - ) { - sourceProvider = new ethers.JsonRpcProvider(sourceRpcOrProvider[0]); - } else { - console.error( - 'Could not get a valid RPC URL or Provider from SDK:', - sourceRpcOrProvider - ); - process.exit(1); - } +Build and install the CLI tool: - // Create the wallet using the provider and private key - const sourceWallet = new ethers.Wallet(EVM_PRIVATE_KEY, sourceProvider); +```bash +make install +``` - // Load the sender contract ABI - if (!fs.existsSync(SENDER_ABI_PATH)) { - console.error(`ABI file not found at ${SENDER_ABI_PATH}`); - process.exit(1); - } - const CrossChainSenderArtifact = JSON.parse( - fs.readFileSync(SENDER_ABI_PATH, 'utf8') - ); - const senderAbi = CrossChainSenderArtifact.abi; +This installs two binaries, `worm-fetch-governance` and `worm` on your `$PATH`. To use `worm`, set up `$HOME/.wormhole/.env` with your private keys, based on `.env.sample` in this folder. - // Create new sender contract instance - const senderContract = new ethers.Contract( - AVALANCHE_SENDER_ADDRESS, - senderAbi, - sourceWallet - ); +## Usage - // Get user input for token transfer parameters - const tokenAddress = readlineSync.question( - 'Enter the (ERC20) token contract address on Avalanche: ' - ); - const recipientAddress = readlineSync.question( - 'Enter the recipient address on Celo: ' - ); - const amountStr = readlineSync.question( - 'Enter the amount of tokens to transfer: ' - ); +You can interact with the Wormhole CLI by typing `worm` and including the `command` and any necessary subcommands and parameters. - // Approve sending tokens from the source wallet to the sender contract - const tokenContract = new ethers.Contract( - tokenAddress, - [ - 'function decimals() view returns (uint8)', - 'function approve(address spender, uint256 amount) public returns (bool)', - 'function allowance(address owner, address spender) view returns (uint256)', - ], - sourceWallet - ); +| Command | Description | +|--------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------| +| `worm aptos INSERT_COMMAND` | Aptos utilities | +| `worm edit-vaa INSERT_COMMAND` | Edits or generates a VAA | +| `worm evm INSERT_COMMAND` | EVM utilities | +| `worm generate INSERT_COMMAND` | Generate VAAs (Devnet and Testnet only) | +| `worm info INSERT_COMMAND` | Contract, chain, RPC, and address information utilities | +| `worm near INSERT_NETWORK, INSERT_ACCOUNT` | NEAR utilities | +| `worm parse INSERT_VAA` | Parse a VAA (can be in either hex or base64 format) | +| `worm recover INSERT_DIGEST INSERT_SIGNATURE` | Recover an address from a signature | +| `worm status INSERT_NETWORK, INSERT_CHAIN, INSERT_TXN_HASH` | Prints information about the automatic delivery initiated on the specified network, chain, and transaction hash | +| `worm submit INSERT_VAA` | Execute a VAA | +| `worm sui INSERT_COMMAND` | Sui utilities | +| `worm transfer INSERT_SOURCE_CHAIN, INSERT_DESTINATION_CHAIN, INSERT_DESTINATION_ADDRESS, INSERT_AMOUNT, INSERT_NETWORK` | Transfers a token | +| `worm verify-vaa INSERT_VAA, INSERT_NETWORK` | Verifies a VAA by querying the Core Contract on Ethereum | - // Convert the amount to the correct units based on token decimals - const decimals = Number(await tokenContract.decimals()); - const amountToTransfer = ethers.parseUnits(amountStr, decimals); +You can also refer to the below options, available with all `worm` commands: - // Get a transfer cost quote - const targetChainId = chainToChainId(rcvChain.chain); - const cost = await senderContract.quoteCrossChainDeposit(targetChainId); - // Approve the sender contract to spend the tokens - const approveTx = await tokenContract.approve( - AVALANCHE_SENDER_ADDRESS, - amountToTransfer - ); - await approveTx.wait(); +```bash +Options: + --help Show help [boolean] + --version Show version number [boolean] +``` - // Initiate the transfer - console.log( - `Initiating cross-chain transfer to ${CELO_RECEIVER_ADDRESS} on ${rcvChain.chain}...` - ); - const transferTx = await senderContract.sendCrossChainDeposit( - targetChainId, - CELO_RECEIVER_ADDRESS, - recipientAddress, - amountToTransfer, - tokenAddress, - { value: cost } - ); - console.log(`Transfer transaction sent: ${transferTx.hash}`); - await transferTx.wait(); - console.log(`✅ Transfer initiated successfully!`); - } catch (error) { - console.error('An error occurred:', error); - process.exit(1); - } +### Subcommands - process.exit(0); -})(); +??? interface "Aptos" + ```bash + worm aptos INSERT_COMMAND + +Commands: + worm aptos init-token-bridge Init token bridge contract + worm aptos init-wormhole Init Wormhole core contract + worm aptos deploy Deploy an Aptos package + worm aptos deploy-resource Deploy an Aptos package using a + resource account + worm aptos send-example-message Send example message + + worm aptos derive-resource-account Derive resource account address + + worm aptos derive-wrapped-address Derive wrapped coin type + + worm aptos hash-contracts Hash contract bytecodes for upgrade + worm aptos upgrade Perform upgrade after VAA has been + submitted + worm aptos migrate Perform migration after contract + upgrade + worm aptos faucet Request money from the faucet for a + given account + worm aptos start-validator Start a local aptos validator + +Options: + --help Show help [boolean] + --version Show version number [boolean] ``` - This script defines the sender and receiver contract addresses, fetches the necessary ABI information, creates a connected signer, converts decimals, calculates the estimated transfer cost, and initiates the token transfer. +??? interface "Edit VAA" + ```bash + worm edit-vaa INSERT_COMMAND -3. Run the script using the following command: +Options: + --help Show help [boolean] + --version Show version number [boolean] + -v, --vaa vaa in hex format [string] [required] + -n, --network Network + [required] [choices: "mainnet", "testnet", "devnet"] + --guardian-set-index, --gsi guardian set index [number] + --signatures, --sigs comma separated list of signatures [string] + --wormscanurl, --wsu url to wormscan entry for the vaa that + includes signatures [string] + --wormscan, --ws if specified, will query the wormscan entry + for the vaa to get the signatures [boolean] + --emitter-chain-id, --ec emitter chain id to be used in the vaa + [number] + --emitter-address, --ea emitter address to be used in the vaa[string] + --nonce, --no nonce to be used in the vaa [number] + --sequence, --seq sequence number to be used in the vaa[string] + --consistency-level, --cl consistency level to be used in the vaa + [number] + --timestamp, --ts timestamp to be used in the vaa in unix + seconds [number] + -p, --payload payload in hex format [string] + --guardian-secret, --gs Guardian's secret key [string] + ``` +??? interface "EVM" ```bash - npx tsx script/transfer.ts + worm evm INSERT_COMMAND + +Commands: + worm evm address-from-secret Compute a 20 byte eth address from a 32 + byte private key + worm evm storage-update Update a storage slot on an EVM fork + during testing (anvil or hardhat) + worm evm chains Return all EVM chains + worm evm info Query info about the on-chain state of + the contract + worm evm hijack Override the guardian set of the core + bridge contract during testing (anvil + or hardhat) + worm evm start-validator Start a local EVM validator + +Options: + --help Show help [boolean] + --version Show version number [boolean] + --rpc RPC endpoint [string] + ``` + +??? interface "Generate" + ```bash + worm generate INSERT_COMMAND + +Commands: + worm generate registration Generate registration VAA + worm generate upgrade Generate contract upgrade VAA + worm generate attestation Generate a token attestation VAA + worm generate recover-chain-id Generate a recover chain ID VAA + worm generate Sets the default delivery provider + set-default-delivery-provider for the Wormhole Relayer contract + +Options: + --help Show help [boolean] + --version Show version number [boolean] + -g, --guardian-secret Guardians' secret keys (CSV) [string] [required] + ``` + +??? interface "Info" + ```bash + worm info INSERT_COMMAND + +Commands: + worm info chain-id Print the wormhole chain ID integer + associated with the specified chain + name + worm info contract Print contract address + + worm info emitter
Print address in emitter address + format + worm info origin
Print the origin chain and address + of the asset that corresponds to the + given chain and address. + worm info registrations Print chain registrations + + worm info rpc Print RPC address + worm info wrapped Print the wrapped address on the + target chain that corresponds with + the specified origin chain and + address. + +Options: + --help Show help [boolean] + --version Show version number [boolean]
+ ``` + +??? interface "NEAR" + ```bash + worm near INSERT_COMMAND + +Commands: + worm near contract-update Submit a contract update using our specific + APIs + worm near deploy Submit a contract update using near APIs + +Options: + --help Show help [boolean] + --version Show version number [boolean] + -m, --module Module to query [choices: "Core", "NFTBridge", "TokenBridge"] + -n, --network Network [required] [choices: "mainnet", "testnet", "devnet"] + --account Near deployment account [string] [required] + --attach Attach some near [string] + --target Near account to upgrade [string] + --mnemonic Near private keys [string] + --key Near private key [string] + -r, --rpc Override default rpc endpoint url [string] + ``` + +??? interface "Parse" + ```bash + worm parse INSERT_VAA + +Positionals: + vaa vaa [string] + +Options: + --help Show help [boolean] + --version Show version number [boolean] + ``` + +??? interface "Recover" + ```bash + worm recover INSERT_DIGEST INSERT_SIGNATURE + +Positionals: + digest digest [string] + signature signature [string] + +Options: + --help Show help [boolean] + --version Show version number [boolean] + ``` + +??? interface "Status" + ```bash + worm status INSERT_NETWORK, INSERT_CHAIN, INSERT_TXN_HASH + +Positionals: + network Network [choices: + 'mainnet', + 'testnet', + 'devnet'] + chain Source chain + [choices: + 'unset', + 'solana', + 'ethereum', + 'terra', + 'bsc', + 'polygon', + 'avalanche', + 'oasis', + 'algorand', + 'aurora', + 'fantom', + 'karura', + 'acala', + 'klaytn', + 'celo', + 'near', + 'moonbeam', + 'neon', + 'terra2', + 'injective', + 'osmosis', + 'sui', + 'aptos', + 'arbitrum', + 'optimism', + 'gnosis', + 'pythnet', + 'xpla', + 'btc', + 'base', + 'sei', + 'rootstock', + 'scroll', + 'mantle', + 'blast', + 'xlayer', + 'linea', + 'berachain', + 'seievm', + 'wormchain', + 'cosmoshub', + 'evmos', + 'kujira', + 'neutron', + 'celestia', + 'stargaze', + 'seda', + 'dymension', + 'provenance', + 'sepolia', + 'arbitrum_sepolia', + 'base_sepolia', + 'optimism_sepolia', + 'holesky', + 'polygon_sepolia'] + tx Source transaction hash [string] + +Options: + --help Show help [boolean] + --version Show version number [boolean] + ``` + +??? interface "Submit" + ```bash + worm submit INSERT_VAA + +Positionals: + vaa vaa [string] + +Options: + --help Show help [boolean] + --version Show version number [boolean] + -c, --chain chain name +[choices: 'unset', + 'solana', + 'ethereum', + 'terra', + 'bsc', + 'polygon', + 'avalanche', + 'oasis', + 'algorand', + 'aurora', + 'fantom', + 'karura', + 'acala', + 'klaytn', + 'celo', + 'near', + 'moonbeam', + 'neon', + 'terra2', + 'injective', + 'osmosis', + 'sui', + 'aptos', + 'arbitrum', + 'optimism', + 'gnosis', + 'pythnet', + 'xpla', + 'btc', + 'base', + 'sei', + 'rootstock', + 'scroll', + 'mantle', + 'blast', + 'xlayer', + 'linea', + 'berachain', + 'seievm', + 'wormchain', + 'cosmoshub', + 'evmos', + 'kujira', + 'neutron', + 'celestia', + 'stargaze', + 'seda', + 'dymension', + 'provenance', + 'sepolia', + 'arbitrum_sepolia', + 'base_sepolia', + 'optimism_sepolia', + 'holesky', + 'polygon_sepolia'] + -n, --network Network + [required] + [choices: + 'mainnet', + 'testnet', + 'devnet'] + -a, --contract-address Contract to submit VAA to (override config) [string] + --rpc RPC endpoint [string] + --all-chains, --ac Submit the VAA to all chains except for the origin + chain specified in the payload + [boolean] [default: false] + ``` + +??? interface "Sui" + ```bash + worm sui INSERT_COMMAND + +Commands: + worm sui build-coin Build wrapped coin and dump bytecode. + + Example: + worm sui build-coin -d 8 -v V__0_1_1 -n + testnet -r + "https://fullnode.testnet.sui.io:443" + worm sui deploy Deploy a Sui package + worm sui init-example-message-app Initialize example core message app + worm sui init-token-bridge Initialize token bridge contract + worm sui init-wormhole Initialize wormhole core contract + worm sui publish-example-message Publish message from example app via + core bridge + worm sui setup-devnet Setup devnet by deploying and + initializing core and token bridges and + submitting chain registrations. + worm sui objects Get owned objects by owner + worm sui package-id Get package ID from State object ID + worm sui tx Get transaction details + +Options: + --help Show help [boolean] + --version Show version number [boolean] + ``` + +??? interface "Transfer" + ```bash + worm transfer INSERT_SOURCE_CHAIN, INSERT_DESTINATION_CHAIN, INSERT_DESTINATION_ADDRESS, INSERT_AMOUNT, INSERT_NETWORK + +Options: + --help Show help [boolean] + --version Show version number [boolean] + --src-chain source chain [required] [choices: + 'solana', + 'ethereum', + 'terra', + 'bsc', + 'polygon', + 'avalanche', + 'oasis', + 'algorand', + 'aurora', + 'fantom', + 'karura', + 'acala', + 'klaytn', + 'celo', + 'near', + 'moonbeam', + 'neon', + 'terra2', + 'injective', + 'osmosis', + 'sui', + 'aptos', + 'arbitrum', + 'optimism', + 'gnosis', + 'pythnet', + 'xpla', + 'btc', + 'base', + 'sei', + 'rootstock', + 'scroll', + 'mantle', + 'blast', + 'xlayer', + 'linea', + 'berachain', + 'seievm', + 'wormchain', + 'cosmoshub', + 'evmos', + 'kujira', + 'neutron', + 'celestia', + 'stargaze', + 'seda', + 'dymension', + 'provenance', + 'sepolia', + 'arbitrum_sepolia', + 'base_sepolia', + 'optimism_sepolia', + 'holesky', + 'polygon_sepolia'] + --dst-chain destination chain + [required] [choices: + 'solana', + 'ethereum', + 'terra', + 'bsc', + 'polygon', + 'avalanche', + 'oasis', + 'algorand', + 'aurora', + 'fantom', + 'karura', + 'acala', + 'klaytn', + 'celo', + 'near', + 'moonbeam', + 'neon', + 'terra2', + 'injective', + 'osmosis', + 'sui', + 'aptos', + 'arbitrum', + 'optimism', + 'gnosis', + 'pythnet', + 'xpla', + 'btc', + 'base', + 'sei', + 'rootstock', + 'scroll', + 'mantle', + 'blast', + 'xlayer', + 'linea', + 'berachain', + 'seievm', + 'wormchain', + 'cosmoshub', + 'evmos', + 'kujira', + 'neutron', + 'celestia', + 'stargaze', + 'seda', + 'dymension', + 'provenance', + 'sepolia', + 'arbitrum_sepolia', + 'base_sepolia', + 'optimism_sepolia', + 'holesky', + 'polygon_sepolia'] + --dst-addr destination address [string] [required] + --token-addr token address [string] [default: native token] + --amount token amount [string] [required] + -n, --network Network [required] [choices: "mainnet", "testnet", "devnet"] + --rpc RPC endpoint [string] ``` -4. Follow the prompts in the terminal. This example uses Avalanche Fuji as the source chain, Celo Testnet as the target, [Avalanche Fuji testnet USDC](https://developers.circle.com/stablecoins/usdc-on-test-networks){target=\_blank}, and a developer wallet as the recipient address. You will see terminal output similar to the following: - -
-npx tsx script/transfer.ts -Initializing Wormhole SDK... -Enter the (ERC20) token contract address on Avalanche: 0x5425890298aed601595a70ab815c96711a31bc65 -Enter the recipient address on Celo: 0xCD8Bcd9A793a7381b3C66C763c3f463f70De4e12 -Initiating cross-chain transfer to 0xff97a7141833fbe829249d4e8952A8e73a4a2fbd on Celo... -Transfer transaction sent: 0x2d819aadf88309eb19f59a510aba1f2892b54487f9e287feadd150181a28f771 -✅ Transfer initiated successfully! - -
- -Congratulations! You've successfully created and deployed Wormhole Solidity SDK-based smart contracts and used them to send testnet USDC across blockchains. Consider the following options to build upon what you've accomplished. - -## Next Steps - -- [**Get Started with Messaging**](/docs/products/messaging/get-started/): Send a message across blockchains using the Wormhole TypeScript SDK to eliminate smart contract development and auditing overhead. ---- END CONTENT --- - -Doc-Content: https://wormhole.com/docs/tools/solidity-sdk/sdk-reference/ ---- BEGIN CONTENT --- ---- -title: Solidity SDK -description: How to use the Wormhole Solidity SDK for cross-chain messaging, token transfers, and integrating decentralized applications on EVM-compatible blockchains. -categories: Solidity-SDK ---- - -# Solidity SDK - -This page covers all you need to know about the functionality offered through the Wormhole Solidity SDK. - -
- -- :octicons-download-16:{ .lg .middle } **Installation** - - --- +??? interface "Verify VAA" + ```bash + worm verify-vaa INSERT_VAA, INSERT_NETWORK - Find installation instructions using Foundry and Forge to pull the necessary libraries into your project. +Options: + --help Show help [boolean] + --version Show version number [boolean] + -v, --vaa vaa in hex format [string] [required] + -n, --network Network [required] [choices: "mainnet", "testnet", "devnet"] + ``` - [:custom-arrow: Install the SDK](/docs/tools/solidity-sdk/get-started/#installation) +## Examples -- :octicons-download-16:{ .lg .middle } **Source Code** +### Generate a VAA - --- +Use `generate` to create VAAs for testing. For example, use the following command to create an NFT bridge registration VAA: - Want to go straight to the source? Check out the Solidity SDK GitHub repository. +```bash +worm generate registration --module NFTBridge \ + --chain bsc \ + --contract-address 0x706abc4E45D419950511e474C7B9Ed348A4a716c \ + --guardian-secret cfb12303a19cde580bb4dd771639b0d26bc68353645571a8cff516ab2ee113a0 +``` - [:custom-arrow: View GitHub Repository](https://github.com/wormhole-foundation/wormhole-solidity-sdk){target=\_blank} +The below example generates a token attestation VAA: -
+```bash +worm generate attestation --emitter-chain ethereum \ + --emitter-address 11111111111111111111111111111115 \ + --chain ethereum \ + --token-address 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 \ + --decimals 6 \ + --symbol USDC \ + --name USDC \ + --guardian-secret cfb12303a19cde580bb4dd771639b0d26bc68353645571a8cff516ab2ee113a0 +``` -## Key Considerations +### Parse a VAA -Before deploying applications using the Wormhole Solidity SDK, keep these considerations in mind: +Use `parse` to parse a VAA into JSON: - - **IERC-20 remapping** - the SDK provides a remapping mechanism to handle potential conflicts between different implementations of IERC20, ensuring seamless integration with other libraries - - **Testing** - given the cross-chain dependencies, testing all integrations is critical to avoid issues in production environments +```bash +worm parse $(worm-fetch-governance 13940208096455381020) +``` -## Concepts and Components +This example will fetch governance VAA `13940208096455381020` and print it as JSON: -The Wormhole Solidity SDK consists of key components that streamline cross-chain communication, allowing developers to securely and efficiently interact with Wormhole’s infrastructure. Below are the critical concepts and contracts you'll encounter when working with the SDK. +```bash +# ...signatures elided +timestamp: 1651416474, +nonce: 1570649151, +emitterChain: 1, +emitterAddress: '0000000000000000000000000000000000000000000000000000000000000004', +sequence: 13940208096455381020n, +consistencyLevel: 32, +payload: { + module: 'Core', + type: 'GuardianSetUpgrade', + chain: 0, + newGuardianSetIndex: 2, + newGuardianSetLength: 19, + newGuardianSet: [ + '58cc3ae5c097b213ce3c81979e1b9f9570746aa5', + 'ff6cb952589bde862c25ef4392132fb9d4a42157', + '114de8460193bdf3a2fcf81f86a09765f4762fd1', + '107a0086b32d7a0977926a205131d8731d39cbeb', + '8c82b2fd82faed2711d59af0f2499d16e726f6b2', + '11b39756c042441be6d8650b69b54ebe715e2343', + '54ce5b4d348fb74b958e8966e2ec3dbd4958a7cd', + '66b9590e1c41e0b226937bf9217d1d67fd4e91f5', + '74a3bf913953d695260d88bc1aa25a4eee363ef0', + '000ac0076727b35fbea2dac28fee5ccb0fea768e', + 'af45ced136b9d9e24903464ae889f5c8a723fc14', + 'f93124b7c738843cbb89e864c862c38cddcccf95', + 'd2cc37a4dc036a8d232b48f62cdd4731412f4890', + 'da798f6896a3331f64b48c12d1d57fd9cbe70811', + '71aa1be1d36cafe3867910f99c09e347899c19c3', + '8192b6e7387ccd768277c17dab1b7a5027c0b3cf', + '178e21ad2e77ae06711549cfbb1f9c7a9d8096e8', + '5e1487f35515d02a92753504a8d75471b9f49edb', + '6fbebc898f403e4773e95feb15e80c9a99c8348d' + ] +} +``` -### Cross-Chain Messaging with the Wormhole Relayer SDK +### Submit VAAs -The `WormholeRelayerSDK.sol` contract simplifies cross-chain messaging and asset transfers by integrating several necessary modules, including the Wormhole relayer. By automating message delivery between chains, the Wormhole relayer removes the need for developers to manage relayer infrastructure or handle gas on the target chain. Delivery providers handle the message payload, ensuring secure and efficient communication. +Use `submit` to submit a VAA to a chain. It first parses the VAA and determines the destination chain and module. For example, a contract upgrade contains both the target chain and module, so the only required argument is the network moniker (`mainnet` or `testnet`): -You can refer to the [Wormhole relayer documentation](/docs/products/messaging/guides/wormhole-relayers/){target=\_blank} for more details. +```bash +worm submit $(cat my-nft-registration.txt) --network mainnet +``` -Key modules in the SDK include: +The script will ask you to specify the target chain for VAAs that don't have a specific target chain (like registrations or Guardian set upgrades). For example, to submit a Guardian set upgrade on all chains, simply run: - - **`Base.sol`** - the core module for cross-chain messaging. It provides utility functions like `onlyWormholeRelayer()` and `setRegisteredSender()`, ensuring that only messages from trusted relayers are processed +```bash +worm-fetch-governance 13940208096455381020 > guardian-upgrade.txt +worm submit $(cat guardian-upgrade.txt) --network mainnet --chain oasis +worm submit $(cat guardian-upgrade.txt) --network mainnet --chain aurora +worm submit $(cat guardian-upgrade.txt) --network mainnet --chain fantom +worm submit $(cat guardian-upgrade.txt) --network mainnet --chain karura +worm submit $(cat guardian-upgrade.txt) --network mainnet --chain acala +worm submit $(cat guardian-upgrade.txt) --network mainnet --chain klaytn +worm submit $(cat guardian-upgrade.txt) --network mainnet --chain avalanche +worm submit $(cat guardian-upgrade.txt) --network mainnet --chain polygon +worm submit $(cat guardian-upgrade.txt) --network mainnet --chain bsc +worm submit $(cat guardian-upgrade.txt) --network mainnet --chain solana +worm submit $(cat guardian-upgrade.txt) --network mainnet --chain terra +worm submit $(cat guardian-upgrade.txt) --network mainnet --chain ethereum +worm submit $(cat guardian-upgrade.txt) --network mainnet --chain celo +``` - - **`TokenBase.sol`** - this module extends the base messaging functionality to support cross-chain token transfers. It includes utilities for securely sending and receiving tokens between EVM-compatible chains +The VAA payload type (Guardian set upgrade) specifies that this VAA should go to the core bridge, and the tool directs it there. - - **`CCTPBase.sol`** - designed for Circle’s Cross-Chain Transfer Protocol, this module manages asset transfers such as USDC between chains. It includes functionalities for both sending and receiving CCTP-based assets +### Fetch Contract Information - - **`CCTPAndTokenBase.sol`** - a combined module that supports token and CCTP-based asset transfers in a single implementation. This module simplifies development for applications needing to handle both types of transfers +To get info about a contract (only EVM supported at this time), use the following command: -The Wormhole Solidity SDK offers a unified framework for cross-chain communication. Developers can select specific modules based on their application’s requirements, whether for messaging, token transfers, or CCTP. Each module includes built-in security measures, ensuring that only authorized senders or relayers are accepted, thereby protecting the application from unauthorized interactions. +```bash +worm evm info -c bsc -n mainnet -m TokenBridge +``` -Please refer to the complete `WormholeRelayerSDK.sol` file below for further details. +Running this command generates the following output: -???- code "`WormholeRelayerSDK.sol`" - ```solidity - // SPDX-License-Identifier: Apache 2 -pragma solidity ^0.8.19; +```bash +{ + "address": "0xB6F6D86a8f9879A9c87f643768d9efc38c1Da6E7", + "wormhole": "0x98f3c9e6E3fAce36bAAd05FE09d375Ef1464288B", + "implementation": "0x621199f6beB2ba6fbD962E8A52A320EA4F6D4aA3", + "isInitialized": true, + "tokenImplementation": "0x7f8C5e730121657E17E452c5a1bA3fA1eF96f22a", + "chainId": 4, + "finality": 15, + "evmChainId": "56", + "isFork": false, + "governanceChainId": 1, + "governanceContract": "0x0000000000000000000000000000000000000000000000000000000000000004", + "WETH": "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", + "registrations": { + "Solana": "0xec7372995d5cc8732397fb0ad35c0121e0eaa90d26f828a534cab54391b3a4f5", + "Ethereum": "0x0000000000000000000000003ee18b2214aff97000d974cf647e7c347e8fa585", + "Terra": "0x0000000000000000000000007cf7b764e38a0a5e967972c1df77d432510564e2", + "Polygon": "0x0000000000000000000000005a58505a96d1dbf8df91cb21b54419fc36e93fde", + "Avalanche": "0x0000000000000000000000000e082f06ff657d94310cb8ce8b0d9a04541d8052", + "Oasis": "0x0000000000000000000000005848c791e09901b40a9ef749f2a6735b418d7564", + "Algorand": "0x67e93fa6c8ac5c819990aa7340c0c16b508abb1178be9b30d024b8ac25193d45", + "Aurora": "0x00000000000000000000000051b5123a7b0f9b2ba265f9c4c8de7d78d52f510f", + "Fantom": "0x0000000000000000000000007c9fc5741288cdfdd83ceb07f3ea7e22618d79d2", + "Karura": "0x000000000000000000000000ae9d7fe007b3327aa64a32824aaac52c42a6e624", + "Acala": "0x000000000000000000000000ae9d7fe007b3327aa64a32824aaac52c42a6e624", + "Klaytn": "0x0000000000000000000000005b08ac39eaed75c0439fc750d9fe7e1f9dd0193f", + "Celo": "0x000000000000000000000000796dff6d74f3e27060b71255fe517bfb23c93eed", + "Near": "0x148410499d3fcda4dcfd68a1ebfcdddda16ab28326448d4aae4d2f0465cdfcb7", + "Moonbeam": "0x000000000000000000000000b1731c586ca89a23809861c6103f0b96b3f57d92", + "Neon": "0x0000000000000000000000000000000000000000000000000000000000000000", + "Terra2": "0xa463ad028fb79679cfc8ce1efba35ac0e77b35080a1abe9bebe83461f176b0a3", + "Injective": "0x00000000000000000000000045dbea4617971d93188eda21530bc6503d153313", + "Osmosis": "0x0000000000000000000000000000000000000000000000000000000000000000", + "Sui": "0xccceeb29348f71bdd22ffef43a2a19c1f5b5e17c5cca5411529120182672ade5", + "Aptos": "0x0000000000000000000000000000000000000000000000000000000000000001", + "Arbitrum": "0x0000000000000000000000000b2402144bb366a632d14b83f244d2e0e21bd39c", + "Optimism": "0x0000000000000000000000001d68124e65fafc907325e3edbf8c4d84499daa8b", + "Gnosis": "0x0000000000000000000000000000000000000000000000000000000000000000", + "Pythnet": "0x0000000000000000000000000000000000000000000000000000000000000000", + "Xpla": "0x8f9cf727175353b17a5f574270e370776123d90fd74956ae4277962b4fdee24c", + "Btc": "0x0000000000000000000000000000000000000000000000000000000000000000", + "Base": "0x0000000000000000000000008d2de8d2f73f1f4cab472ac9a881c9b123c79627", + "Sei": "0x86c5fd957e2db8389553e1728f9c27964b22a8154091ccba54d75f4b10c61f5e", + "Rootstock": "0x0000000000000000000000000000000000000000000000000000000000000000", + "Scroll": "0x00000000000000000000000024850c6f61c438823f01b7a3bf2b89b72174fa9d", + "Mantle": "0x00000000000000000000000024850c6f61c438823f01b7a3bf2b89b72174fa9d", + "Blast": "0x00000000000000000000000024850c6f61c438823f01b7a3bf2b89b72174fa9d", + "Xlayer": "0x0000000000000000000000005537857664b0f9efe38c9f320f75fef23234d904", + "Linea": "0x0000000000000000000000000000000000000000000000000000000000000000", + "Berachain": "0x0000000000000000000000000000000000000000000000000000000000000000", + "Seievm": "0x0000000000000000000000000000000000000000000000000000000000000000", + "Snaxchain": "0x0000000000000000000000000000000000000000000000000000000000000000", + "Wormchain": "0xaeb534c45c3049d380b9d9b966f9895f53abd4301bfaff407fa09dea8ae7a924", + "Cosmoshub": "0x0000000000000000000000000000000000000000000000000000000000000000", + "Evmos": "0x0000000000000000000000000000000000000000000000000000000000000000", + "Kujira": "0x0000000000000000000000000000000000000000000000000000000000000000", + "Neutron": "0x0000000000000000000000000000000000000000000000000000000000000000", + "Celestia": "0x0000000000000000000000000000000000000000000000000000000000000000", + "Stargaze": "0x0000000000000000000000000000000000000000000000000000000000000000", + "Seda": "0x0000000000000000000000000000000000000000000000000000000000000000", + "Dymension": "0x0000000000000000000000000000000000000000000000000000000000000000", + "Provenance": "0x0000000000000000000000000000000000000000000000000000000000000000", + "Sepolia": "0x0000000000000000000000000000000000000000000000000000000000000000", + "ArbitrumSepolia": "0x0000000000000000000000000000000000000000000000000000000000000000", + "BaseSepolia": "0x0000000000000000000000000000000000000000000000000000000000000000", + "OptimismSepolia": "0x0000000000000000000000000000000000000000000000000000000000000000", + "Holesky": "0x0000000000000000000000000000000000000000000000000000000000000000", + "PolygonSepolia": "0x0000000000000000000000000000000000000000000000000000000000000000" + } +} +``` -import "wormhole-sdk/interfaces/IWormholeReceiver.sol"; -import "wormhole-sdk/interfaces/IWormholeRelayer.sol"; -import "wormhole-sdk/constants/Chains.sol"; -import "wormhole-sdk/Utils.sol"; +You can get the contract address for a module as follows: -import {Base} from "wormhole-sdk/WormholeRelayer/Base.sol"; -import {TokenBase, TokenReceiver, TokenSender} from "wormhole-sdk/WormholeRelayer/TokenBase.sol"; -import {CCTPBase, CCTPReceiver, CCTPSender} from "wormhole-sdk/WormholeRelayer/CCTPBase.sol"; -import {CCTPAndTokenBase, CCTPAndTokenReceiver, CCTPAndTokenSender} from "wormhole-sdk/WormholeRelayer/CCTPAndTokenBase.sol"; - ``` +```bash +worm info rpc INSERT_NETWORK INSERT_CHAIN INSERT_MODULE +``` -### Base Contract Overview +To get the contract address for `NFTBridge` on BSC Mainnet, for example, you can provide the following command: -The `Base.sol` contract is a core part of the Wormhole Solidity SDK, providing essential helper functions and modifiers for managing cross-chain messages securely via the Wormhole Relayer. It handles sender registration and message validation, ensuring only authorized senders from specific chains can send messages. +```bash +worm info contract mainnet bsc NFTBridge +``` - - **`onlyWormholeRelayer()`** - a modifier that ensures only authorized messages from the Wormhole relayer contract are processed, restricting access to certain functions +### Fetch Chain Information - ```solidity - require( - msg.sender == address(wormholeRelayer), - "Msg.sender is not Wormhole Relayer" - ); - _; - } - ``` +You can get the RPC address for a chain as follows: - - **`setRegisteredSender()`** - restricts message acceptance to a registered sender from a specific chain, ensuring messages are only processed from trusted sources +```bash +worm info rpc INSERT_NETWORK INSERT_CHAIN +``` - ```solidity - uint16 sourceChain, - bytes32 sourceAddress - ) public { - require( - msg.sender == registrationOwner, - "Not allowed to set registered sender" - ); - registeredSenders[sourceChain] = sourceAddress; - } - ``` +To get the RPC address for BSC Mainnet, for example, you can provide the following command: -These security measures ensure messages come from the correct source and are processed securely. Please refer to the complete `Base.sol` contract below for further details. +```bash +worm info rpc mainnet bsc +``` +--- END CONTENT --- -???- code "`Base.sol`" - ```solidity - // SPDX-License-Identifier: Apache 2 -pragma solidity ^0.8.19; +Doc-Content: https://wormhole.com/docs/tools/dev-env/ +--- BEGIN CONTENT --- +--- +title: Local Dev Environment +description: Learn how to configure a development environment to build with Wormhole, including using the CLI, local validators, testing on public test networks, and more. +categories: Solidity-SDK, Typescript-SDK +--- -import "wormhole-sdk/interfaces/IWormholeReceiver.sol"; -import "wormhole-sdk/interfaces/IWormholeRelayer.sol"; -import "wormhole-sdk/interfaces/IWormhole.sol"; -import "wormhole-sdk/Utils.sol"; +# Development Environment -abstract contract Base { - IWormholeRelayer public immutable wormholeRelayer; - IWormhole public immutable wormhole; +Developers building for smart contract integration will want to set up a development environment to allow testing the full integration, possibly including VAA generation and relaying. - address registrationOwner; - mapping(uint16 => bytes32) registeredSenders; +## Tooling Installation - constructor(address _wormholeRelayer, address _wormhole) { - wormholeRelayer = IWormholeRelayer(_wormholeRelayer); - wormhole = IWormhole(_wormhole); - registrationOwner = msg.sender; - } +The [Wormhole CLI Tool](/docs/tools/cli/get-started/){target=\_blank} should be installed regardless of the environments chosen. Each environment has its own set of recommended tools. To begin working with a specific environment, see the recommended tools on the respective [environment page](/docs/products/reference/supported-networks/){target=\_blank}. - modifier onlyWormholeRelayer() { - require( - msg.sender == address(wormholeRelayer), - "Msg.sender is not Wormhole Relayer" - ); - _; - } +## Development Stages - modifier isRegisteredSender(uint16 sourceChain, bytes32 sourceAddress) { - require( - registeredSenders[sourceChain] == sourceAddress, - "Not registered sender" - ); - _; - } +Different approaches to development and testing are recommended at various stages of application development. - /** - * Sets the registered address for 'sourceChain' to 'sourceAddress' - * So that for messages from 'sourceChain', only ones from 'sourceAddress' are valid - * - * Assumes only one sender per chain is valid - * Sender is the address that called 'send' on the Wormhole Relayer contract on the source chain) - */ - function setRegisteredSender( - uint16 sourceChain, - bytes32 sourceAddress - ) public { - require( - msg.sender == registrationOwner, - "Not allowed to set registered sender" - ); - registeredSenders[sourceChain] = sourceAddress; - } -} - ``` +### Initial Development -### Interface for Cross-Chain Messages +During the initial development of an on-chain application, the best option is to use the native tools available in the environment. You can visit the following resources for more information: -The Wormhole Solidity SDK interacts with the Wormhole relayer for sending and receiving messages across EVM-compatible chains. The [`IWormholeRelayer`](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/main/src/interfaces/IWormholeRelayer.sol){target=\_blank} includes several interfaces that are central to cross-chain communication, enabling secure and efficient message delivery. +- **[Environment](https://github.com/wormhole-foundation/wormhole){target=\_blank}** - select the folder for the desired network to learn about the recommended native toolset +- **[Mock Guardian](https://github.com/wormhole-foundation/wormhole/blob/main/sdk/js/src/mock/wormhole.ts){target=\_blank}** - it's recommended to set up a mock Guardian or Emitter to provide signed VAAsFor any program methods that require some message be sent or received. +- **[Wormhole Scaffolding repository](https://github.com/wormhole-foundation/wormhole-scaffolding/blob/main/evm/ts-test/01_hello_world.ts){target=\_blank}** - example mock Guardian test -For detailed information on how to implement these interfaces, refer to the [Wormhole Relayer Interfaces documentation](/docs/products/messaging/guides/wormhole-relayers/#wormhole-relayer-interfaces){target=\_blank}. This section covers: +Relying on native tools when possible allows for more rapid prototyping and iteration. - - **`IWormholeRelayer`** – methods for sending cross-chain messages, VAAs, and token transfers - - **`IWormholeReceiver`** – the required implementation for receiving cross-chain messages - - **`quoteEVMDeliveryPrice()`** – how to estimate gas and fees for cross-chain transactions +### Integration -These interfaces reduce the complexity of cross-chain dApp development by abstracting away the details of relayer infrastructure, ensuring that message delivery is handled efficiently. +For integration to Wormhole and with multiple chains, the simplest option is to use the chains' Testnets. In choosing which chains to use for integration testing, consider which chains in a given environment provide easy access to Testnet tokens and where block times are fast. Find links for Testnet faucets in the [blockchain details section](/docs/products/reference/supported-networks/){target=\_blank}. A developer may prefer standing up a set of local validators instead of using the Testnet. For this option, [Tilt](https://github.com/wormhole-foundation/wormhole/blob/main/DEVELOP.md){target=\_blank} is available to run local instances of all the chains Wormhole supports. -### Advanced Concepts +!!! note + Variation in host environments causes unique issues, and the computational intensity of multiple simultaneous local validators can make setting them up difficult or time-consuming. You may prefer Testnets for the simplest integration testing. -For developers interested in exploring additional advanced topics, the following sections provide insights into key aspects of the SDK’s functionality. +### Prepare for Deployment -???- note "Error Handling and Reverts" - The SDK defines several custom errors to help developers handle common issues like incorrect gas fees, invalid senders, and more. For example, `InvalidMsgValue` is thrown when the message value for a relayed message is erroneous. +Once you've finished the application's initial development and performed integration testing, you should set up a CI test environment. The best option for that is likely to be [Tilt](https://tilt.dev/){target=\_blank} since it allows you to spin up any chains supported by Wormhole in a consistent environment. - ```solidity - error InvalidMsgValue(uint256 msgValue, uint256 totalFee); - ``` +## Validator Setup with Tilt -## Usage +### Tilt +If you'd like to set up a local validator environment, follow the setup guide for Tilt. Tilt is a full-fledged Kubernetes deployment of every chain connected to Wormhole, along with a Guardian node. It usually takes 30 minutes to spin up fully, but it comes with all chains running out of the box. Refer to the [Tilt](https://github.com/wormhole-foundation/wormhole/blob/main/DEVELOP.md){target=\_blank} page for a complete guide to setting up and configuring Tilt. -This section covers cross-chain messaging and token transfers and shows how to use the Wormhole Solidity SDK in real-world scenarios. +## Deploying to Public Networks -### Send a Cross-Chain Message +### Testnet -To send a cross-chain message, inherit from the base contract provided by the SDK and use its helper methods to define your message and sender address. Here’s a basic example: +When doing integration testing on Testnets, remember that a single Guardian node is watching for transactions on various test networks. Because Testnets only have a single Guardian, there's a slight chance that your VAAs won't be processed. This rate doesn't indicate performance on Mainnet, where 19 Guardians are watching for transactions. The Testnet contract addresses are available on the page for each [environment](/docs/products/reference/supported-networks/){target=\_blank}. The [Wormholescan API](https://docs.wormholescan.io){target=\_blank} offers the following Guardian equivalent Testnet endpoint: -```solidity -pragma solidity ^0.8.19; +```text +https://api.testnet.wormholescan.io +``` -import "@wormhole-foundation/wormhole-solidity-sdk/src/WormholeRelayer/Base.sol"; +### Mainnet -contract CrossChainSender is Base { - constructor( - address _wormholeRelayer, - address _wormhole - ) Base(_wormholeRelayer, _wormhole) {} +The Mainnet contract addresses are available on the page for each [environment](/docs/products/reference/supported-networks/){target=\_blank}. The [Wormholescan API](https://docs.wormholescan.io){target=\_blank} offers the following Guardian equivalent Mainnet endpoint: - function sendMessage( - bytes memory message, - uint16 targetChain, - bytes32 targetAddress - ) external payable { - // Register sender and send message through WormholeRelayer - setRegisteredSender(targetChain, msg.sender); - onlyWormholeRelayer().sendPayloadToEvm( - targetChain, - address(targetAddress), - message, - 0, - 500_000 - ); - } -} +```text +https://api.wormholescan.io ``` +--- END CONTENT --- -This contract extends `Base.sol` and allows sending cross-chain messages securely using the `WormholeRelayer`. - -### Send Tokens Across Chains +Doc-Content: https://wormhole.com/docs/tools/faqs/ +--- BEGIN CONTENT --- +--- +title: Toolkit FAQs +description: FAQs on Wormhole Toolkit, covering Wormholescan, CLI, SDKs (TypeScript, Solidity), Tilt, error handling, transaction history, and manual VAA submission. +categories: Solidity-SDK, Typescript-SDK +--- -The SDK enables seamless token transfers between EVM-compatible chains in addition to sending messages. To facilitate cross-chain token transfers, you can extend the SDK's `TokenSender` and `TokenReceiver` base contracts. +# Toolkit FAQs -```solidity -pragma solidity ^0.8.19; +## Why does the `toNative` function in the TypeScript SDK return an error? -import "@wormhole-foundation/wormhole-solidity-sdk/src/WormholeRelayer/TokenBase.sol"; +The `toNative` function may return an error if the platform-specific module (such as Solana or EVM) is not correctly imported or passed into the Wormhole constructor. -contract CrossChainTokenSender is TokenSender { - constructor( - address _wormholeRelayer, - address _wormhole - ) TokenSender(_wormholeRelayer, _wormhole) {} +To fix this, ensure the relevant platform module is imported and included when initializing Wormhole. For example, if you're working with Solana, make sure to import the Solana module and pass it into the Wormhole constructor like this: - function sendToken( - address token, - uint256 amount, - uint16 targetChain, - bytes32 targetAddress - ) external payable { - // Send tokens across chains - transferTokenToTarget(token, amount, targetChain, targetAddress); - } -} +```typescript +import solana from '@wormhole-foundation/sdk/solana'; +const wh = await wormhole('Testnet', [solana]); ``` -In this example, `TokenSender` initiates a token transfer to another chain. The SDK’s built-in utilities securely handle token transfers, ensuring proper VAAs are generated and processed. +## How can I retrieve the history of previously bridged transactions? -### Receive Tokens Across Chains +To retrieve the history of previously bridged transactions, you can use the Wormholescan API. Use the following endpoint to query the transaction history for a specific address: -To receive tokens on the target chain, implement a contract that inherits from `TokenReceiver` and overrides the `receiveWormholeMessages` function. +```bash +https://api.wormholescan.io/api/v1/operations?address=INSERT_ADDRESS +``` -```solidity -pragma solidity ^0.8.19; +Simply replace `INSERT_ADDRESS_HERE` with the address you want to query. The API will return a list of operations, including details about previously bridged transactions. -import "@wormhole-foundation/wormhole-solidity-sdk/src/WormholeRelayer/TokenBase.sol"; +???- example "Fetch transaction history for a specific address" + ```bash + curl -X GET "https://api.wormholescan.io/api/v1/operations?address=0x05c009C4C1F1983d4B915C145F4E782de23d3A38" -H "accept: application/json" + ``` -contract CrossChainTokenReceiver is TokenReceiver { - constructor( - address _wormholeRelayer, - address _wormhole - ) TokenReceiver(_wormholeRelayer, _wormhole) {} +## How can I manually submit a VAA to a destination chain in the correct format? - // Function to handle received tokens from another chain - function receiveWormholeMessages( - bytes memory payload, - bytes[] memory additionalMessages, - bytes32 sourceAddress, - uint16 sourceChain, - bytes32 deliveryHash - ) external payable override { - // Process the received tokens here - receiveTokens(payload); - } -} -``` +To manually submit a VAA (Verifiable Action Approval) to a destination chain, follow these steps: -In this example, `TokenReceiver` allows the contract to handle tokens sent from the source chain. Once the cross-chain message is received, the `receiveWormholeMessages` function processes the incoming tokens. Always validate the message's authenticity and source. +1. **Obtain the VAA in Base64 format** - navigate to the **Advanced** tab in [Wormholescan](https://wormholescan.io/){target=\_blank} to find the VAA associated with the transaction you want to submit and copy the VAA in base64 format -!!! note - Always verify the source of incoming messages and tokens to prevent unauthorized access to your contract. Please refer to the [Emitter Verification](/docs/products/messaging/guides/core-contracts/#validating-the-emitter/){target=\_blank} section for more details. + ```bash + https://wormholescan.io/#/tx/INSERT_TX_HASH?view=advanced + ``` -## Testing Environment +2. **Convert the VAA to hex** - you must convert the base64 VAA into a hexadecimal (hex) format before submitting it to the destination chain. This can be done using various online tools or via command-line utilities like `xxd` or a script in a language like Python -The SDK includes built-in support for Forge-based testing, which allows you to test your cross-chain applications locally before deploying them to production. Testing with the same Solidity compiler version and configuration you plan to use in production is highly recommended to catch any potential issues early. +3. **Submit the VAA through Etherscan (for EVM chains)** - once the VAA is in hex format, go to the [Etherscan UI](https://etherscan.io/){target=\_blank} and submit it through the [`TokenBridge`](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/main/src/interfaces/ITokenBridge.sol){target=\_blank} contract’s method (such as the `CompleteTransfer` function or `CompleteTransferWithPayload`) -For a detailed example, check out the below repositories: + - The `TokenBridge` contract addresses for each chain are available in the [Wormhole contract addresses](/docs/products/reference/contract-addresses/){target=\_blank} section - - [Cross chain messaging](/docs/products/messaging/tutorials/cross-chain-contracts/){target=\_blank} - - [Cross chain token transfer](/docs/products/messaging/tutorials/cross-chain-token-contracts/){target=\_blank} + - Interact with the smart contract through the Etherscan UI by pasting the hex-encoded VAA into the appropriate field + +Following these steps, you can manually submit a VAA in the proper format to a destination chain. --- END CONTENT --- ## Basics Concepts [shared: true] @@ -3690,7 +3690,7 @@ For more information about submitting to the bug bounty programs, refer to the [ The [SECURITY.md](https://github.com/wormhole-foundation/wormhole/blob/main/SECURITY.md){target=\blank} from the official repository has the latest security policies and updates. --- END CONTENT --- -Doc-Content: https://wormhole.com/docs/tools/solidity-sdk/get-started/ +Doc-Content: https://wormhole.com/docs/tools/.solidity-sdk/.get-started/ --- BEGIN CONTENT --- --- title: Get Started with the Solidity SDK diff --git a/llms-files/llms-token-bridge.txt b/llms-files/llms-token-bridge.txt index 70ba96db7..3d09f9497 100644 --- a/llms-files/llms-token-bridge.txt +++ b/llms-files/llms-token-bridge.txt @@ -3280,7 +3280,7 @@ For more information about submitting to the bug bounty programs, refer to the [ The [SECURITY.md](https://github.com/wormhole-foundation/wormhole/blob/main/SECURITY.md){target=\blank} from the official repository has the latest security policies and updates. --- END CONTENT --- -Doc-Content: https://wormhole.com/docs/tools/solidity-sdk/get-started/ +Doc-Content: https://wormhole.com/docs/tools/.solidity-sdk/.get-started/ --- BEGIN CONTENT --- --- title: Get Started with the Solidity SDK diff --git a/llms-files/llms-transfer.txt b/llms-files/llms-transfer.txt index 8886537fe..779a7f57f 100644 --- a/llms-files/llms-transfer.txt +++ b/llms-files/llms-transfer.txt @@ -9972,7 +9972,7 @@ For more information about submitting to the bug bounty programs, refer to the [ The [SECURITY.md](https://github.com/wormhole-foundation/wormhole/blob/main/SECURITY.md){target=\blank} from the official repository has the latest security policies and updates. --- END CONTENT --- -Doc-Content: https://wormhole.com/docs/tools/solidity-sdk/get-started/ +Doc-Content: https://wormhole.com/docs/tools/.solidity-sdk/.get-started/ --- BEGIN CONTENT --- --- title: Get Started with the Solidity SDK diff --git a/llms-files/llms-typescript-sdk.txt b/llms-files/llms-typescript-sdk.txt index cc996ce38..7098e9900 100644 --- a/llms-files/llms-typescript-sdk.txt +++ b/llms-files/llms-typescript-sdk.txt @@ -5931,7 +5931,7 @@ For more information about submitting to the bug bounty programs, refer to the [ The [SECURITY.md](https://github.com/wormhole-foundation/wormhole/blob/main/SECURITY.md){target=\blank} from the official repository has the latest security policies and updates. --- END CONTENT --- -Doc-Content: https://wormhole.com/docs/tools/solidity-sdk/get-started/ +Doc-Content: https://wormhole.com/docs/tools/.solidity-sdk/.get-started/ --- BEGIN CONTENT --- --- title: Get Started with the Solidity SDK diff --git a/llms-full.txt b/llms-full.txt index ed511506f..b7883efa3 100644 --- a/llms-full.txt +++ b/llms-full.txt @@ -89,11 +89,11 @@ Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/re Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/protocol/infrastructure/vaas.md Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/protocol/introduction.md Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/protocol/security.md +Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/tools/.solidity-sdk/.get-started.md +Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/tools/.solidity-sdk/.sdk-reference.md Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/tools/cli/get-started.md Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/tools/dev-env.md Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/tools/faqs.md -Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/tools/solidity-sdk/get-started.md -Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/tools/solidity-sdk/sdk-reference.md Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/tools/typescript-sdk/get-started.md Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/tools/typescript-sdk/guides/protocols-payloads.md Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/tools/typescript-sdk/guides/sdk-layout.md @@ -19451,1587 +19451,1587 @@ For more information about submitting to the bug bounty programs, refer to the [ The [SECURITY.md](https://github.com/wormhole-foundation/wormhole/blob/main/SECURITY.md){target=\blank} from the official repository has the latest security policies and updates. --- END CONTENT --- -Doc-Content: https://wormhole.com/docs/tools/cli/get-started/ +Doc-Content: https://wormhole.com/docs/tools/.solidity-sdk/.get-started/ --- BEGIN CONTENT --- --- -title: Wormhole CLI -description: Learn how to install and use the Wormhole CLI, including commands and examples for managing multichain deployments, generating VAAs, and querying contract info. -categories: Solidity-SDK, Typescript-SDK +title: Get Started with the Solidity SDK +description: Follow this guide to use the Wormhole Solidity SDK's interfaces and tools to help you quickly build on-chain integrations using smart contracts. +categories: Basics, Solidity-SDK --- -# Wormhole CLI - -This tool is a command-line interface to Wormhole, allowing you to perform various actions, such as querying a transaction's status or submitting token transfers. - -## Installation +# Get Started with the Solidity SDK -Clone the repository and change directories to the appropriate directory: +The [Wormhole Solidity SDK](https://github.com/wormhole-foundation/wormhole-solidity-sdk){target=\_blank} provides Solidity interfaces, prebuilt contracts, and testing tools to help Solidity developers build on-chain Wormhole integrations via smart contracts. You can use the [Wormhole TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank} for off-chain integrations without writing Solidity. -```bash -git clone https://github.com/wormhole-foundation/wormhole && -cd wormhole/clients/js -``` +## Install the SDK -Build and install the CLI tool: +Use Foundry's [`forge`](https://book.getfoundry.sh/forge/){target=\_blank} to install the SDK using the following command: ```bash -make install +forge install wormhole-foundation/wormhole-solidity-sdk ``` -This installs two binaries, `worm-fetch-governance` and `worm` on your `$PATH`. To use `worm`, set up `$HOME/.wormhole/.env` with your private keys, based on `.env.sample` in this folder. +## Key Components -## Usage +The following key components and features work together to make your on-chain Wormhole integration easier to build. -You can interact with the Wormhole CLI by typing `worm` and including the `command` and any necessary subcommands and parameters. +??? interface "Base contracts" -| Command | Description | -|--------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------| -| `worm aptos INSERT_COMMAND` | Aptos utilities | -| `worm edit-vaa INSERT_COMMAND` | Edits or generates a VAA | -| `worm evm INSERT_COMMAND` | EVM utilities | -| `worm generate INSERT_COMMAND` | Generate VAAs (Devnet and Testnet only) | -| `worm info INSERT_COMMAND` | Contract, chain, RPC, and address information utilities | -| `worm near INSERT_NETWORK, INSERT_ACCOUNT` | NEAR utilities | -| `worm parse INSERT_VAA` | Parse a VAA (can be in either hex or base64 format) | -| `worm recover INSERT_DIGEST INSERT_SIGNATURE` | Recover an address from a signature | -| `worm status INSERT_NETWORK, INSERT_CHAIN, INSERT_TXN_HASH` | Prints information about the automatic delivery initiated on the specified network, chain, and transaction hash | -| `worm submit INSERT_VAA` | Execute a VAA | -| `worm sui INSERT_COMMAND` | Sui utilities | -| `worm transfer INSERT_SOURCE_CHAIN, INSERT_DESTINATION_CHAIN, INSERT_DESTINATION_ADDRESS, INSERT_AMOUNT, INSERT_NETWORK` | Transfers a token | -| `worm verify-vaa INSERT_VAA, INSERT_NETWORK` | Verifies a VAA by querying the Core Contract on Ethereum | + Leverage base contracts to send and receive messages and tokens. -You can also refer to the below options, available with all `worm` commands: + - [**`Base.sol`**](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/b9e129e65d34827d92fceeed8c87d3ecdfc801d0/src/Base.sol){target=\_blank}: Uses Wormhole interfaces to authorize and verify a registered sender. + - [**`TokenBase.sol`**](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/b9e129e65d34827d92fceeed8c87d3ecdfc801d0/src/TokenBase.sol){target=\_blank}: Uses `TokenReceiver` and `TokenSender` contracts to define functions for transferring tokens. + - [**`CCTPBase.sol`**](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/b9e129e65d34827d92fceeed8c87d3ecdfc801d0/src/CCTPBase.sol){target=\_blank}: Uses `CCTPSender` and `CCTPReceiver` contracts to define functions for transferring USDC. -```bash -Options: - --help Show help [boolean] - --version Show version number [boolean] -``` +??? interface "Interfaces" -### Subcommands + Use interfaces to ensure consistent interactions with the protocol regardless of the supported chain you use. -??? interface "Aptos" - ```bash - worm aptos INSERT_COMMAND + - [**`ITokenBridge.sol`**](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/b9e129e65d34827d92fceeed8c87d3ecdfc801d0/src/interfaces/ITokenBridge.sol){target=\_blank}: Defines key structs and functions for token attestation, wrapping and transferring tokens, monitoring transaction progress. + - [**CCTP Interfaces**](https://github.com/wormhole-foundation/wormhole-solidity-sdk/tree/b9e129e65d34827d92fceeed8c87d3ecdfc801d0/src/interfaces/CCTPInterfaces){target=\_blank}: A set of interfaces for USDC transfers via CCTP for sending, relaying, and receiving messages and tokens. + - [**`IWormholeReceiver.sol`**](https://github.com/wormhole-foundation/wormhole/blob/main/relayer/ethereum/contracts/interfaces/relayer/IWormholeReceiver.sol){target=\_blank}: Defines the `receiveWormholeMessages` function. + - [**`IWormholeRelayer.sol`**](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/b9e129e65d34827d92fceeed8c87d3ecdfc801d0/src/interfaces/IWormholeRelayer.sol){target=\_blank}: Defines key structs and functions to identify, send, and deliver messages and follow the progress of transactions. -Commands: - worm aptos init-token-bridge Init token bridge contract - worm aptos init-wormhole Init Wormhole core contract - worm aptos deploy Deploy an Aptos package - worm aptos deploy-resource Deploy an Aptos package using a - resource account - worm aptos send-example-message Send example message - - worm aptos derive-resource-account Derive resource account address - - worm aptos derive-wrapped-address Derive wrapped coin type - - worm aptos hash-contracts Hash contract bytecodes for upgrade - worm aptos upgrade Perform upgrade after VAA has been - submitted - worm aptos migrate Perform migration after contract - upgrade - worm aptos faucet Request money from the faucet for a - given account - worm aptos start-validator Start a local aptos validator +??? interface "Constants" -Options: - --help Show help [boolean] - --version Show version number [boolean] - ``` + Auto-generated Solidity constants help avoid manual entry errors and ensure consistent delivery. -??? interface "Edit VAA" - ```bash - worm edit-vaa INSERT_COMMAND + - [**Wormhole Chain ID's**](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/b9e129e65d34827d92fceeed8c87d3ecdfc801d0/src/Chains.sol){target=\_blank}: Generated list of Wormhole Chain ID's for supported chains. + - [**Circle CCTP Domain IDs**](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/b9e129e65d34827d92fceeed8c87d3ecdfc801d0/src/CCTPAndTokenBase.sol){target=\_blank}: Generated list of defined CCTP domain ID's to ensure USDC transfers use the correct domain for a given chain. + - [**`chainConsts.ts`**](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/75ddcec06ffe9d62603d023357caa576c5ea101c/gen/chainConsts.ts){target=\_blank}: Returns values to identify properties and contract addresses for each supported chain. -Options: - --help Show help [boolean] - --version Show version number [boolean] - -v, --vaa vaa in hex format [string] [required] - -n, --network Network - [required] [choices: "mainnet", "testnet", "devnet"] - --guardian-set-index, --gsi guardian set index [number] - --signatures, --sigs comma separated list of signatures [string] - --wormscanurl, --wsu url to wormscan entry for the vaa that - includes signatures [string] - --wormscan, --ws if specified, will query the wormscan entry - for the vaa to get the signatures [boolean] - --emitter-chain-id, --ec emitter chain id to be used in the vaa - [number] - --emitter-address, --ea emitter address to be used in the vaa[string] - --nonce, --no nonce to be used in the vaa [number] - --sequence, --seq sequence number to be used in the vaa[string] - --consistency-level, --cl consistency level to be used in the vaa - [number] - --timestamp, --ts timestamp to be used in the vaa in unix - seconds [number] - -p, --payload payload in hex format [string] - --guardian-secret, --gs Guardian's secret key [string] - ``` +## Example Usage -??? interface "EVM" - ```bash - worm evm INSERT_COMMAND +The following demo illustrates the use of Wormhole Solidity SDK-based smart contracts to send testnet USDC between supported chains. -Commands: - worm evm address-from-secret Compute a 20 byte eth address from a 32 - byte private key - worm evm storage-update Update a storage slot on an EVM fork - during testing (anvil or hardhat) - worm evm chains Return all EVM chains - worm evm info Query info about the on-chain state of - the contract - worm evm hijack Override the guardian set of the core - bridge contract during testing (anvil - or hardhat) - worm evm start-validator Start a local EVM validator +### Prerequisites +Before you begin, ensure you have the following: -Options: - --help Show help [boolean] - --version Show version number [boolean] - --rpc RPC endpoint [string] - ``` +- [Node.js and npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm){target=\_blank} installed +- [TypeScript](https://www.typescriptlang.org/download/){target=\_blank} installed +- [Foundry](https://book.getfoundry.sh/getting-started/installation){target=\_blank} installed +- Testnet tokens for two supported chains. This example uses [testnet AVAX for Avalanche Fuji](https://core.app/tools/testnet-faucet/?subnet=c&token=c){target=\_blank} and [testnet CELO for Celo Alfajores](https://faucet.celo.org/alfajores){target=\_blank} and can be adapted to any supported chains +- [USDC testnet tokens](https://faucet.circle.com/){target=\_blank} on your source chain for cross-chain transfer -??? interface "Generate" - ```bash - worm generate INSERT_COMMAND +### Set Up a Project -Commands: - worm generate registration Generate registration VAA - worm generate upgrade Generate contract upgrade VAA - worm generate attestation Generate a token attestation VAA - worm generate recover-chain-id Generate a recover chain ID VAA - worm generate Sets the default delivery provider - set-default-delivery-provider for the Wormhole Relayer contract +Follow these steps to prepare your development environment: -Options: - --help Show help [boolean] - --version Show version number [boolean] - -g, --guardian-secret Guardians' secret keys (CSV) [string] [required] - ``` +1. Create a directory for your project, navigate into it, and install the Wormhole Solidity SDK: -??? interface "Info" ```bash - worm info INSERT_COMMAND - -Commands: - worm info chain-id Print the wormhole chain ID integer - associated with the specified chain - name - worm info contract Print contract address - - worm info emitter
Print address in emitter address - format - worm info origin
Print the origin chain and address - of the asset that corresponds to the - given chain and address. - worm info registrations Print chain registrations - - worm info rpc Print RPC address - worm info wrapped Print the wrapped address on the - target chain that corresponds with - the specified origin chain and - address. - -Options: - --help Show help [boolean] - --version Show version number [boolean]
+ mkdir solidity-token-transfer + cd solidity-token-transfer + forge install wormhole-foundation/wormhole-solidity-sdk ``` -??? interface "NEAR" - ```bash - worm near INSERT_COMMAND - -Commands: - worm near contract-update Submit a contract update using our specific - APIs - worm near deploy Submit a contract update using near APIs - -Options: - --help Show help [boolean] - --version Show version number [boolean] - -m, --module Module to query [choices: "Core", "NFTBridge", "TokenBridge"] - -n, --network Network [required] [choices: "mainnet", "testnet", "devnet"] - --account Near deployment account [string] [required] - --attach Attach some near [string] - --target Near account to upgrade [string] - --mnemonic Near private keys [string] - --key Near private key [string] - -r, --rpc Override default rpc endpoint url [string] - ``` +2. Install dependencies for use with your transfer script, including the Wormhole TypeScript SDK, and initiate a new Node.js project: -??? interface "Parse" ```bash - worm parse INSERT_VAA + npm init -y && npm install @wormhole-foundation/sdk ethers -D tsx typescript + ``` -Positionals: - vaa vaa [string] +### Create and Deploy Contracts -Options: - --help Show help [boolean] - --version Show version number [boolean] - ``` +This project uses sender and receiver contracts to access the `WormholeRelayer` interface's [`TokenSender`](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/baa085006586a43c42858d355e3ffb743b80d7a4/src/WormholeRelayer/TokenBase.sol#L24){target=\_blank} and [`TokenReceiver`](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/baa085006586a43c42858d355e3ffb743b80d7a4/src/WormholeRelayer/TokenBase.sol#L147){target=\_blank} base classes to simplify sending tokens across chains. -??? interface "Recover" - ```bash - worm recover INSERT_DIGEST INSERT_SIGNATURE +Follow these steps to create and deploy your sender and receiver Solidity contracts: -Positionals: - digest digest [string] - signature signature [string] +1. Use the following example code to create `CrossChainSender.sol`: -Options: - --help Show help [boolean] - --version Show version number [boolean] - ``` + ```solidity title="CrossChainSender.sol" + // SPDX-License-Identifier: MIT +pragma solidity ^0.8.13; -??? interface "Status" - ```bash - worm status INSERT_NETWORK, INSERT_CHAIN, INSERT_TXN_HASH +import "lib/wormhole-solidity-sdk/src/WormholeRelayerSDK.sol"; +import "lib/wormhole-solidity-sdk/src/interfaces/IERC20.sol"; -Positionals: - network Network [choices: - 'mainnet', - 'testnet', - 'devnet'] - chain Source chain - [choices: - 'unset', - 'solana', - 'ethereum', - 'terra', - 'bsc', - 'polygon', - 'avalanche', - 'oasis', - 'algorand', - 'aurora', - 'fantom', - 'karura', - 'acala', - 'klaytn', - 'celo', - 'near', - 'moonbeam', - 'neon', - 'terra2', - 'injective', - 'osmosis', - 'sui', - 'aptos', - 'arbitrum', - 'optimism', - 'gnosis', - 'pythnet', - 'xpla', - 'btc', - 'base', - 'sei', - 'rootstock', - 'scroll', - 'mantle', - 'blast', - 'xlayer', - 'linea', - 'berachain', - 'seievm', - 'wormchain', - 'cosmoshub', - 'evmos', - 'kujira', - 'neutron', - 'celestia', - 'stargaze', - 'seda', - 'dymension', - 'provenance', - 'sepolia', - 'arbitrum_sepolia', - 'base_sepolia', - 'optimism_sepolia', - 'holesky', - 'polygon_sepolia'] - tx Source transaction hash [string] - -Options: - --help Show help [boolean] - --version Show version number [boolean] - ``` +// Extend the TokenSender contract inherited from TokenBase +contract CrossChainSender is TokenSender { + uint256 constant GAS_LIMIT = 250_000; + // Initialize the contract with the Wormhole relayer, Token Bridge, + // and Wormhole Core Contract addresses + constructor( + address _wormholeRelayer, + address _tokenBridge, + address _wormhole + ) TokenBase(_wormholeRelayer, _tokenBridge, _wormhole) {} -??? interface "Submit" - ```bash - worm submit INSERT_VAA + // Calculate the estimated cost for multichain token transfer using + // the wormholeRelayer to get the delivery cost and add the message fee + function quoteCrossChainDeposit( + uint16 targetChain + ) public view returns (uint256 cost) { + uint256 deliveryCost; + (deliveryCost, ) = wormholeRelayer.quoteEVMDeliveryPrice( + targetChain, + 0, + GAS_LIMIT + ); -Positionals: - vaa vaa [string] + cost = deliveryCost + wormhole.messageFee(); + } -Options: - --help Show help [boolean] - --version Show version number [boolean] - -c, --chain chain name -[choices: 'unset', - 'solana', - 'ethereum', - 'terra', - 'bsc', - 'polygon', - 'avalanche', - 'oasis', - 'algorand', - 'aurora', - 'fantom', - 'karura', - 'acala', - 'klaytn', - 'celo', - 'near', - 'moonbeam', - 'neon', - 'terra2', - 'injective', - 'osmosis', - 'sui', - 'aptos', - 'arbitrum', - 'optimism', - 'gnosis', - 'pythnet', - 'xpla', - 'btc', - 'base', - 'sei', - 'rootstock', - 'scroll', - 'mantle', - 'blast', - 'xlayer', - 'linea', - 'berachain', - 'seievm', - 'wormchain', - 'cosmoshub', - 'evmos', - 'kujira', - 'neutron', - 'celestia', - 'stargaze', - 'seda', - 'dymension', - 'provenance', - 'sepolia', - 'arbitrum_sepolia', - 'base_sepolia', - 'optimism_sepolia', - 'holesky', - 'polygon_sepolia'] - -n, --network Network - [required] - [choices: - 'mainnet', - 'testnet', - 'devnet'] - -a, --contract-address Contract to submit VAA to (override config) [string] - --rpc RPC endpoint [string] - --all-chains, --ac Submit the VAA to all chains except for the origin - chain specified in the payload - [boolean] [default: false] + // Send tokens and payload to the recipient on the target chain + function sendCrossChainDeposit( + uint16 targetChain, + address targetReceiver, + address recipient, + uint256 amount, + address token + ) public payable { + // Calculate the estimated cost for the multichain deposit + uint256 cost = quoteCrossChainDeposit(targetChain); + require( + msg.value == cost, + "msg.value must equal quoteCrossChainDeposit(targetChain)" + ); + // Transfer the tokens from the sender to this contract + IERC20(token).transferFrom(msg.sender, address(this), amount); + // Encode the recipient address into the payload + bytes memory payload = abi.encode(recipient); + // Initiate the multichain transfer using the wormholeRelayer + sendTokenWithPayloadToEvm( + targetChain, + targetReceiver, + payload, + 0, + GAS_LIMIT, + token, + amount + ); + } +} ``` -??? interface "Sui" - ```bash - worm sui INSERT_COMMAND + This contract extends `TokenSender`, gaining access to its functionality. It initializes the contract with the required addresses, calculates estimated transfer costs, defines transfer parameters, and initiates the transfer using the `sendTokenWithPayloadToEvm` function from `WormholeRelayer`. -Commands: - worm sui build-coin Build wrapped coin and dump bytecode. +2. Use the following example code to create `CrossChainReceiver.sol`: - Example: - worm sui build-coin -d 8 -v V__0_1_1 -n - testnet -r - "https://fullnode.testnet.sui.io:443" - worm sui deploy Deploy a Sui package - worm sui init-example-message-app Initialize example core message app - worm sui init-token-bridge Initialize token bridge contract - worm sui init-wormhole Initialize wormhole core contract - worm sui publish-example-message Publish message from example app via - core bridge - worm sui setup-devnet Setup devnet by deploying and - initializing core and token bridges and - submitting chain registrations. - worm sui objects Get owned objects by owner - worm sui package-id Get package ID from State object ID - worm sui tx Get transaction details + ```solidity title="CrossChainSender.sol" + // SPDX-License-Identifier: MIT +pragma solidity ^0.8.13; -Options: - --help Show help [boolean] - --version Show version number [boolean] - ``` +import "lib/wormhole-solidity-sdk/src/WormholeRelayerSDK.sol"; +import "lib/wormhole-solidity-sdk/src/interfaces/IERC20.sol"; -??? interface "Transfer" - ```bash - worm transfer INSERT_SOURCE_CHAIN, INSERT_DESTINATION_CHAIN, INSERT_DESTINATION_ADDRESS, INSERT_AMOUNT, INSERT_NETWORK +// Extend the TokenReceiver contract inherited from TokenBase +contract CrossChainReceiver is TokenReceiver { + // Initialize the contract with the Wormhole relayer, Token Bridge, + // and Wormhole Core Contract addresses + constructor( + address _wormholeRelayer, + address _tokenBridge, + address _wormhole + ) TokenBase(_wormholeRelayer, _tokenBridge, _wormhole) {} -Options: - --help Show help [boolean] - --version Show version number [boolean] - --src-chain source chain [required] [choices: - 'solana', - 'ethereum', - 'terra', - 'bsc', - 'polygon', - 'avalanche', - 'oasis', - 'algorand', - 'aurora', - 'fantom', - 'karura', - 'acala', - 'klaytn', - 'celo', - 'near', - 'moonbeam', - 'neon', - 'terra2', - 'injective', - 'osmosis', - 'sui', - 'aptos', - 'arbitrum', - 'optimism', - 'gnosis', - 'pythnet', - 'xpla', - 'btc', - 'base', - 'sei', - 'rootstock', - 'scroll', - 'mantle', - 'blast', - 'xlayer', - 'linea', - 'berachain', - 'seievm', - 'wormchain', - 'cosmoshub', - 'evmos', - 'kujira', - 'neutron', - 'celestia', - 'stargaze', - 'seda', - 'dymension', - 'provenance', - 'sepolia', - 'arbitrum_sepolia', - 'base_sepolia', - 'optimism_sepolia', - 'holesky', - 'polygon_sepolia'] - --dst-chain destination chain - [required] [choices: - 'solana', - 'ethereum', - 'terra', - 'bsc', - 'polygon', - 'avalanche', - 'oasis', - 'algorand', - 'aurora', - 'fantom', - 'karura', - 'acala', - 'klaytn', - 'celo', - 'near', - 'moonbeam', - 'neon', - 'terra2', - 'injective', - 'osmosis', - 'sui', - 'aptos', - 'arbitrum', - 'optimism', - 'gnosis', - 'pythnet', - 'xpla', - 'btc', - 'base', - 'sei', - 'rootstock', - 'scroll', - 'mantle', - 'blast', - 'xlayer', - 'linea', - 'berachain', - 'seievm', - 'wormchain', - 'cosmoshub', - 'evmos', - 'kujira', - 'neutron', - 'celestia', - 'stargaze', - 'seda', - 'dymension', - 'provenance', - 'sepolia', - 'arbitrum_sepolia', - 'base_sepolia', - 'optimism_sepolia', - 'holesky', - 'polygon_sepolia'] - --dst-addr destination address [string] [required] - --token-addr token address [string] [default: native token] - --amount token amount [string] [required] - -n, --network Network [required] [choices: "mainnet", "testnet", "devnet"] - --rpc RPC endpoint [string] - ``` + // Receive the multichain payload and tokens + // Verify the transfer is from a registered sender + function receivePayloadAndTokens( + bytes memory payload, + TokenReceived[] memory receivedTokens, + bytes32 sourceAddress, + uint16 sourceChain, + bytes32 // deliveryHash + ) + internal + override + onlyWormholeRelayer + isRegisteredSender(sourceChain, sourceAddress) + { + // Ensure the payload is not empty and only has one token transfer + require(receivedTokens.length == 1, "Expected 1 token transfer"); -??? interface "Verify VAA" - ```bash - worm verify-vaa INSERT_VAA, INSERT_NETWORK + // Decode the recipient address from the payload + address recipient = abi.decode(payload, (address)); -Options: - --help Show help [boolean] - --version Show version number [boolean] - -v, --vaa vaa in hex format [string] [required] - -n, --network Network [required] [choices: "mainnet", "testnet", "devnet"] + // Transfer the received tokens to the intended recipient + IERC20(receivedTokens[0].tokenAddress).transfer( + recipient, + receivedTokens[0].amount + ); + } +} ``` -## Examples - -### Generate a VAA - -Use `generate` to create VAAs for testing. For example, use the following command to create an NFT bridge registration VAA: + This contract extends `TokenReceiver`, gaining access to its functionality. It initializes the contract with the required addresses, receives the payload and tokens, verifies the transfer is from a registered sender, decodes the recipient address, and transfers the tokens to the recipient. -```bash -worm generate registration --module NFTBridge \ - --chain bsc \ - --contract-address 0x706abc4E45D419950511e474C7B9Ed348A4a716c \ - --guardian-secret cfb12303a19cde580bb4dd771639b0d26bc68353645571a8cff516ab2ee113a0 -``` +3. Deploy the contracts using your preferred deployment method. Make sure you deploy `CrossChainSender.sol` to your desired source chain and `CrossChainReceiver.sol` to the target chain. Save the deployed contract addresses for each contract. You will need them for your transfer script. -The below example generates a token attestation VAA: +## Use Contracts to Transfer USDC -```bash -worm generate attestation --emitter-chain ethereum \ - --emitter-address 11111111111111111111111111111115 \ - --chain ethereum \ - --token-address 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 \ - --decimals 6 \ - --symbol USDC \ - --name USDC \ - --guardian-secret cfb12303a19cde580bb4dd771639b0d26bc68353645571a8cff516ab2ee113a0 -``` +1. Once your contracts are deployed, create a `transfer.ts` file to handle the multichain transfer logic: -### Parse a VAA + ```bash + touch script/transfer.ts + ``` -Use `parse` to parse a VAA into JSON: +2. Set up secure access to your wallets. This guide assumes you are loading your private key(s) from a secure keystore of your choice, such as a secrets manager or a CLI-based tool like [`cast wallet`](https://book.getfoundry.sh/reference/cast/cast-wallet){target=\_blank}. -```bash -worm parse $(worm-fetch-governance 13940208096455381020) -``` + !!! warning + If you use a `.env` file during development, add it to your `.gitignore` to exclude it from version control. Never commit private keys or mnemonics to your repository. -This example will fetch governance VAA `13940208096455381020` and print it as JSON: +3. Open `transfer.ts` and add the following code: -```bash -# ...signatures elided -timestamp: 1651416474, -nonce: 1570649151, -emitterChain: 1, -emitterAddress: '0000000000000000000000000000000000000000000000000000000000000004', -sequence: 13940208096455381020n, -consistencyLevel: 32, -payload: { - module: 'Core', - type: 'GuardianSetUpgrade', - chain: 0, - newGuardianSetIndex: 2, - newGuardianSetLength: 19, - newGuardianSet: [ - '58cc3ae5c097b213ce3c81979e1b9f9570746aa5', - 'ff6cb952589bde862c25ef4392132fb9d4a42157', - '114de8460193bdf3a2fcf81f86a09765f4762fd1', - '107a0086b32d7a0977926a205131d8731d39cbeb', - '8c82b2fd82faed2711d59af0f2499d16e726f6b2', - '11b39756c042441be6d8650b69b54ebe715e2343', - '54ce5b4d348fb74b958e8966e2ec3dbd4958a7cd', - '66b9590e1c41e0b226937bf9217d1d67fd4e91f5', - '74a3bf913953d695260d88bc1aa25a4eee363ef0', - '000ac0076727b35fbea2dac28fee5ccb0fea768e', - 'af45ced136b9d9e24903464ae889f5c8a723fc14', - 'f93124b7c738843cbb89e864c862c38cddcccf95', - 'd2cc37a4dc036a8d232b48f62cdd4731412f4890', - 'da798f6896a3331f64b48c12d1d57fd9cbe70811', - '71aa1be1d36cafe3867910f99c09e347899c19c3', - '8192b6e7387ccd768277c17dab1b7a5027c0b3cf', - '178e21ad2e77ae06711549cfbb1f9c7a9d8096e8', - '5e1487f35515d02a92753504a8d75471b9f49edb', - '6fbebc898f403e4773e95feb15e80c9a99c8348d' - ] -} -``` + ```typescript title="transfer.ts" + import { ethers } from 'ethers'; +import fs from 'fs'; +import path from 'path'; +import readlineSync from 'readline-sync'; +import { fileURLToPath } from 'url'; +import { wormhole, chainToChainId } from '@wormhole-foundation/sdk'; +import evm from '@wormhole-foundation/sdk/evm'; -### Submit VAAs +// Replace with your contract address and chain names +const AVALANCHE_SENDER_ADDRESS = 'INSERT_AVALANCHE_SENDER_CONTRACT_ADDRESS'; +const CELO_RECEIVER_ADDRESS = 'INSERT_CELO_RECEIVER_ADDRESS'; +const AVALANCHE_CHAIN_NAME = 'Avalanche'; +const CELO_CHAIN_NAME = 'Celo'; -Use `submit` to submit a VAA to a chain. It first parses the VAA and determines the destination chain and module. For example, a contract upgrade contains both the target chain and module, so the only required argument is the network moniker (`mainnet` or `testnet`): +// Fetch the contract ABI from the local filesystem +// This example uses the `out` directory from a Foundry deployment +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); +const SENDER_ABI_PATH = path.resolve( + __dirname, + '../out/CrossChainSender.sol/CrossChainSender.json' +); -```bash -worm submit $(cat my-nft-registration.txt) --network mainnet -``` +(async function () { + try { + console.log('Initializing Wormhole SDK...'); + const wh = await wormhole('Testnet', [evm]); + const sendChain = wh.getChain(AVALANCHE_CHAIN_NAME); + const rcvChain = wh.getChain(CELO_CHAIN_NAME); -The script will ask you to specify the target chain for VAAs that don't have a specific target chain (like registrations or Guardian set upgrades). For example, to submit a Guardian set upgrade on all chains, simply run: + // The EVM_PRIVATE_KEY value must be loaded securely beforehand, + // for example via a keystore, secrets manager, or environment variables + // (not recommended) + const EVM_PRIVATE_KEY = EVM_PRIVATE_KEY!; + if (!EVM_PRIVATE_KEY) { + console.error('EVM_PRIVATE_KEY is not set in your .env file.'); + process.exit(1); + } -```bash -worm-fetch-governance 13940208096455381020 > guardian-upgrade.txt -worm submit $(cat guardian-upgrade.txt) --network mainnet --chain oasis -worm submit $(cat guardian-upgrade.txt) --network mainnet --chain aurora -worm submit $(cat guardian-upgrade.txt) --network mainnet --chain fantom -worm submit $(cat guardian-upgrade.txt) --network mainnet --chain karura -worm submit $(cat guardian-upgrade.txt) --network mainnet --chain acala -worm submit $(cat guardian-upgrade.txt) --network mainnet --chain klaytn -worm submit $(cat guardian-upgrade.txt) --network mainnet --chain avalanche -worm submit $(cat guardian-upgrade.txt) --network mainnet --chain polygon -worm submit $(cat guardian-upgrade.txt) --network mainnet --chain bsc -worm submit $(cat guardian-upgrade.txt) --network mainnet --chain solana -worm submit $(cat guardian-upgrade.txt) --network mainnet --chain terra -worm submit $(cat guardian-upgrade.txt) --network mainnet --chain ethereum -worm submit $(cat guardian-upgrade.txt) --network mainnet --chain celo -``` + // Get the RPC URL or Provider from the SDK + const sourceRpcOrProvider = await sendChain.getRpc(); + let sourceProvider: ethers.JsonRpcProvider; + if ( + sourceRpcOrProvider && + typeof (sourceRpcOrProvider as any).getBlockNumber === 'function' + ) { + sourceProvider = sourceRpcOrProvider as ethers.JsonRpcProvider; + } else if (typeof sourceRpcOrProvider === 'string') { + sourceProvider = new ethers.JsonRpcProvider(sourceRpcOrProvider); + } else if ( + Array.isArray(sourceRpcOrProvider) && + typeof sourceRpcOrProvider[0] === 'string' + ) { + sourceProvider = new ethers.JsonRpcProvider(sourceRpcOrProvider[0]); + } else { + console.error( + 'Could not get a valid RPC URL or Provider from SDK:', + sourceRpcOrProvider + ); + process.exit(1); + } -The VAA payload type (Guardian set upgrade) specifies that this VAA should go to the core bridge, and the tool directs it there. + // Create the wallet using the provider and private key + const sourceWallet = new ethers.Wallet(EVM_PRIVATE_KEY, sourceProvider); -### Fetch Contract Information + // Load the sender contract ABI + if (!fs.existsSync(SENDER_ABI_PATH)) { + console.error(`ABI file not found at ${SENDER_ABI_PATH}`); + process.exit(1); + } + const CrossChainSenderArtifact = JSON.parse( + fs.readFileSync(SENDER_ABI_PATH, 'utf8') + ); + const senderAbi = CrossChainSenderArtifact.abi; -To get info about a contract (only EVM supported at this time), use the following command: + // Create new sender contract instance + const senderContract = new ethers.Contract( + AVALANCHE_SENDER_ADDRESS, + senderAbi, + sourceWallet + ); -```bash -worm evm info -c bsc -n mainnet -m TokenBridge -``` + // Get user input for token transfer parameters + const tokenAddress = readlineSync.question( + 'Enter the (ERC20) token contract address on Avalanche: ' + ); + const recipientAddress = readlineSync.question( + 'Enter the recipient address on Celo: ' + ); + const amountStr = readlineSync.question( + 'Enter the amount of tokens to transfer: ' + ); -Running this command generates the following output: + // Approve sending tokens from the source wallet to the sender contract + const tokenContract = new ethers.Contract( + tokenAddress, + [ + 'function decimals() view returns (uint8)', + 'function approve(address spender, uint256 amount) public returns (bool)', + 'function allowance(address owner, address spender) view returns (uint256)', + ], + sourceWallet + ); -```bash -{ - "address": "0xB6F6D86a8f9879A9c87f643768d9efc38c1Da6E7", - "wormhole": "0x98f3c9e6E3fAce36bAAd05FE09d375Ef1464288B", - "implementation": "0x621199f6beB2ba6fbD962E8A52A320EA4F6D4aA3", - "isInitialized": true, - "tokenImplementation": "0x7f8C5e730121657E17E452c5a1bA3fA1eF96f22a", - "chainId": 4, - "finality": 15, - "evmChainId": "56", - "isFork": false, - "governanceChainId": 1, - "governanceContract": "0x0000000000000000000000000000000000000000000000000000000000000004", - "WETH": "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", - "registrations": { - "Solana": "0xec7372995d5cc8732397fb0ad35c0121e0eaa90d26f828a534cab54391b3a4f5", - "Ethereum": "0x0000000000000000000000003ee18b2214aff97000d974cf647e7c347e8fa585", - "Terra": "0x0000000000000000000000007cf7b764e38a0a5e967972c1df77d432510564e2", - "Polygon": "0x0000000000000000000000005a58505a96d1dbf8df91cb21b54419fc36e93fde", - "Avalanche": "0x0000000000000000000000000e082f06ff657d94310cb8ce8b0d9a04541d8052", - "Oasis": "0x0000000000000000000000005848c791e09901b40a9ef749f2a6735b418d7564", - "Algorand": "0x67e93fa6c8ac5c819990aa7340c0c16b508abb1178be9b30d024b8ac25193d45", - "Aurora": "0x00000000000000000000000051b5123a7b0f9b2ba265f9c4c8de7d78d52f510f", - "Fantom": "0x0000000000000000000000007c9fc5741288cdfdd83ceb07f3ea7e22618d79d2", - "Karura": "0x000000000000000000000000ae9d7fe007b3327aa64a32824aaac52c42a6e624", - "Acala": "0x000000000000000000000000ae9d7fe007b3327aa64a32824aaac52c42a6e624", - "Klaytn": "0x0000000000000000000000005b08ac39eaed75c0439fc750d9fe7e1f9dd0193f", - "Celo": "0x000000000000000000000000796dff6d74f3e27060b71255fe517bfb23c93eed", - "Near": "0x148410499d3fcda4dcfd68a1ebfcdddda16ab28326448d4aae4d2f0465cdfcb7", - "Moonbeam": "0x000000000000000000000000b1731c586ca89a23809861c6103f0b96b3f57d92", - "Neon": "0x0000000000000000000000000000000000000000000000000000000000000000", - "Terra2": "0xa463ad028fb79679cfc8ce1efba35ac0e77b35080a1abe9bebe83461f176b0a3", - "Injective": "0x00000000000000000000000045dbea4617971d93188eda21530bc6503d153313", - "Osmosis": "0x0000000000000000000000000000000000000000000000000000000000000000", - "Sui": "0xccceeb29348f71bdd22ffef43a2a19c1f5b5e17c5cca5411529120182672ade5", - "Aptos": "0x0000000000000000000000000000000000000000000000000000000000000001", - "Arbitrum": "0x0000000000000000000000000b2402144bb366a632d14b83f244d2e0e21bd39c", - "Optimism": "0x0000000000000000000000001d68124e65fafc907325e3edbf8c4d84499daa8b", - "Gnosis": "0x0000000000000000000000000000000000000000000000000000000000000000", - "Pythnet": "0x0000000000000000000000000000000000000000000000000000000000000000", - "Xpla": "0x8f9cf727175353b17a5f574270e370776123d90fd74956ae4277962b4fdee24c", - "Btc": "0x0000000000000000000000000000000000000000000000000000000000000000", - "Base": "0x0000000000000000000000008d2de8d2f73f1f4cab472ac9a881c9b123c79627", - "Sei": "0x86c5fd957e2db8389553e1728f9c27964b22a8154091ccba54d75f4b10c61f5e", - "Rootstock": "0x0000000000000000000000000000000000000000000000000000000000000000", - "Scroll": "0x00000000000000000000000024850c6f61c438823f01b7a3bf2b89b72174fa9d", - "Mantle": "0x00000000000000000000000024850c6f61c438823f01b7a3bf2b89b72174fa9d", - "Blast": "0x00000000000000000000000024850c6f61c438823f01b7a3bf2b89b72174fa9d", - "Xlayer": "0x0000000000000000000000005537857664b0f9efe38c9f320f75fef23234d904", - "Linea": "0x0000000000000000000000000000000000000000000000000000000000000000", - "Berachain": "0x0000000000000000000000000000000000000000000000000000000000000000", - "Seievm": "0x0000000000000000000000000000000000000000000000000000000000000000", - "Snaxchain": "0x0000000000000000000000000000000000000000000000000000000000000000", - "Wormchain": "0xaeb534c45c3049d380b9d9b966f9895f53abd4301bfaff407fa09dea8ae7a924", - "Cosmoshub": "0x0000000000000000000000000000000000000000000000000000000000000000", - "Evmos": "0x0000000000000000000000000000000000000000000000000000000000000000", - "Kujira": "0x0000000000000000000000000000000000000000000000000000000000000000", - "Neutron": "0x0000000000000000000000000000000000000000000000000000000000000000", - "Celestia": "0x0000000000000000000000000000000000000000000000000000000000000000", - "Stargaze": "0x0000000000000000000000000000000000000000000000000000000000000000", - "Seda": "0x0000000000000000000000000000000000000000000000000000000000000000", - "Dymension": "0x0000000000000000000000000000000000000000000000000000000000000000", - "Provenance": "0x0000000000000000000000000000000000000000000000000000000000000000", - "Sepolia": "0x0000000000000000000000000000000000000000000000000000000000000000", - "ArbitrumSepolia": "0x0000000000000000000000000000000000000000000000000000000000000000", - "BaseSepolia": "0x0000000000000000000000000000000000000000000000000000000000000000", - "OptimismSepolia": "0x0000000000000000000000000000000000000000000000000000000000000000", - "Holesky": "0x0000000000000000000000000000000000000000000000000000000000000000", - "PolygonSepolia": "0x0000000000000000000000000000000000000000000000000000000000000000" + // Convert the amount to the correct units based on token decimals + const decimals = Number(await tokenContract.decimals()); + const amountToTransfer = ethers.parseUnits(amountStr, decimals); + + // Get a transfer cost quote + const targetChainId = chainToChainId(rcvChain.chain); + const cost = await senderContract.quoteCrossChainDeposit(targetChainId); + // Approve the sender contract to spend the tokens + const approveTx = await tokenContract.approve( + AVALANCHE_SENDER_ADDRESS, + amountToTransfer + ); + await approveTx.wait(); + + // Initiate the transfer + console.log( + `Initiating cross-chain transfer to ${CELO_RECEIVER_ADDRESS} on ${rcvChain.chain}...` + ); + const transferTx = await senderContract.sendCrossChainDeposit( + targetChainId, + CELO_RECEIVER_ADDRESS, + recipientAddress, + amountToTransfer, + tokenAddress, + { value: cost } + ); + console.log(`Transfer transaction sent: ${transferTx.hash}`); + await transferTx.wait(); + console.log(`✅ Transfer initiated successfully!`); + } catch (error) { + console.error('An error occurred:', error); + process.exit(1); } -} -``` -You can get the contract address for a module as follows: + process.exit(0); +})(); + ``` -```bash -worm info rpc INSERT_NETWORK INSERT_CHAIN INSERT_MODULE -``` + This script defines the sender and receiver contract addresses, fetches the necessary ABI information, creates a connected signer, converts decimals, calculates the estimated transfer cost, and initiates the token transfer. -To get the contract address for `NFTBridge` on BSC Mainnet, for example, you can provide the following command: +3. Run the script using the following command: -```bash -worm info contract mainnet bsc NFTBridge -``` + ```bash + npx tsx script/transfer.ts + ``` -### Fetch Chain Information +4. Follow the prompts in the terminal. This example uses Avalanche Fuji as the source chain, Celo Testnet as the target, [Avalanche Fuji testnet USDC](https://developers.circle.com/stablecoins/usdc-on-test-networks){target=\_blank}, and a developer wallet as the recipient address. You will see terminal output similar to the following: -You can get the RPC address for a chain as follows: +
+npx tsx script/transfer.ts +Initializing Wormhole SDK... +Enter the (ERC20) token contract address on Avalanche: 0x5425890298aed601595a70ab815c96711a31bc65 +Enter the recipient address on Celo: 0xCD8Bcd9A793a7381b3C66C763c3f463f70De4e12 +Initiating cross-chain transfer to 0xff97a7141833fbe829249d4e8952A8e73a4a2fbd on Celo... +Transfer transaction sent: 0x2d819aadf88309eb19f59a510aba1f2892b54487f9e287feadd150181a28f771 +✅ Transfer initiated successfully! + +
-```bash -worm info rpc INSERT_NETWORK INSERT_CHAIN -``` +Congratulations! You've successfully created and deployed Wormhole Solidity SDK-based smart contracts and used them to send testnet USDC across blockchains. Consider the following options to build upon what you've accomplished. -To get the RPC address for BSC Mainnet, for example, you can provide the following command: +## Next Steps -```bash -worm info rpc mainnet bsc -``` +- [**Get Started with Messaging**](/docs/products/messaging/get-started/): Send a message across blockchains using the Wormhole TypeScript SDK to eliminate smart contract development and auditing overhead. --- END CONTENT --- -Doc-Content: https://wormhole.com/docs/tools/dev-env/ +Doc-Content: https://wormhole.com/docs/tools/.solidity-sdk/.sdk-reference/ --- BEGIN CONTENT --- --- -title: Local Dev Environment -description: Learn how to configure a development environment to build with Wormhole, including using the CLI, local validators, testing on public test networks, and more. -categories: Solidity-SDK, Typescript-SDK +title: Solidity SDK +description: How to use the Wormhole Solidity SDK for cross-chain messaging, token transfers, and integrating decentralized applications on EVM-compatible blockchains. +categories: Solidity-SDK --- -# Development Environment - -Developers building for smart contract integration will want to set up a development environment to allow testing the full integration, possibly including VAA generation and relaying. +# Solidity SDK -## Tooling Installation +This page covers all you need to know about the functionality offered through the Wormhole Solidity SDK. -The [Wormhole CLI Tool](/docs/tools/cli/get-started/){target=\_blank} should be installed regardless of the environments chosen. Each environment has its own set of recommended tools. To begin working with a specific environment, see the recommended tools on the respective [environment page](/docs/products/reference/supported-networks/){target=\_blank}. +
-## Development Stages +- :octicons-download-16:{ .lg .middle } **Installation** -Different approaches to development and testing are recommended at various stages of application development. + --- -### Initial Development + Find installation instructions using Foundry and Forge to pull the necessary libraries into your project. -During the initial development of an on-chain application, the best option is to use the native tools available in the environment. You can visit the following resources for more information: + [:custom-arrow: Install the SDK](/docs/tools/solidity-sdk/get-started/#installation) -- **[Environment](https://github.com/wormhole-foundation/wormhole){target=\_blank}** - select the folder for the desired network to learn about the recommended native toolset -- **[Mock Guardian](https://github.com/wormhole-foundation/wormhole/blob/main/sdk/js/src/mock/wormhole.ts){target=\_blank}** - it's recommended to set up a mock Guardian or Emitter to provide signed VAAsFor any program methods that require some message be sent or received. -- **[Wormhole Scaffolding repository](https://github.com/wormhole-foundation/wormhole-scaffolding/blob/main/evm/ts-test/01_hello_world.ts){target=\_blank}** - example mock Guardian test +- :octicons-download-16:{ .lg .middle } **Source Code** -Relying on native tools when possible allows for more rapid prototyping and iteration. + --- -### Integration + Want to go straight to the source? Check out the Solidity SDK GitHub repository. -For integration to Wormhole and with multiple chains, the simplest option is to use the chains' Testnets. In choosing which chains to use for integration testing, consider which chains in a given environment provide easy access to Testnet tokens and where block times are fast. Find links for Testnet faucets in the [blockchain details section](/docs/products/reference/supported-networks/){target=\_blank}. A developer may prefer standing up a set of local validators instead of using the Testnet. For this option, [Tilt](https://github.com/wormhole-foundation/wormhole/blob/main/DEVELOP.md){target=\_blank} is available to run local instances of all the chains Wormhole supports. + [:custom-arrow: View GitHub Repository](https://github.com/wormhole-foundation/wormhole-solidity-sdk){target=\_blank} -!!! note - Variation in host environments causes unique issues, and the computational intensity of multiple simultaneous local validators can make setting them up difficult or time-consuming. You may prefer Testnets for the simplest integration testing. +
-### Prepare for Deployment +## Key Considerations -Once you've finished the application's initial development and performed integration testing, you should set up a CI test environment. The best option for that is likely to be [Tilt](https://tilt.dev/){target=\_blank} since it allows you to spin up any chains supported by Wormhole in a consistent environment. +Before deploying applications using the Wormhole Solidity SDK, keep these considerations in mind: -## Validator Setup with Tilt - -### Tilt -If you'd like to set up a local validator environment, follow the setup guide for Tilt. Tilt is a full-fledged Kubernetes deployment of every chain connected to Wormhole, along with a Guardian node. It usually takes 30 minutes to spin up fully, but it comes with all chains running out of the box. Refer to the [Tilt](https://github.com/wormhole-foundation/wormhole/blob/main/DEVELOP.md){target=\_blank} page for a complete guide to setting up and configuring Tilt. - -## Deploying to Public Networks - -### Testnet - -When doing integration testing on Testnets, remember that a single Guardian node is watching for transactions on various test networks. Because Testnets only have a single Guardian, there's a slight chance that your VAAs won't be processed. This rate doesn't indicate performance on Mainnet, where 19 Guardians are watching for transactions. The Testnet contract addresses are available on the page for each [environment](/docs/products/reference/supported-networks/){target=\_blank}. The [Wormholescan API](https://docs.wormholescan.io){target=\_blank} offers the following Guardian equivalent Testnet endpoint: + - **IERC-20 remapping** - the SDK provides a remapping mechanism to handle potential conflicts between different implementations of IERC20, ensuring seamless integration with other libraries + - **Testing** - given the cross-chain dependencies, testing all integrations is critical to avoid issues in production environments -```text -https://api.testnet.wormholescan.io -``` +## Concepts and Components -### Mainnet +The Wormhole Solidity SDK consists of key components that streamline cross-chain communication, allowing developers to securely and efficiently interact with Wormhole’s infrastructure. Below are the critical concepts and contracts you'll encounter when working with the SDK. -The Mainnet contract addresses are available on the page for each [environment](/docs/products/reference/supported-networks/){target=\_blank}. The [Wormholescan API](https://docs.wormholescan.io){target=\_blank} offers the following Guardian equivalent Mainnet endpoint: +### Cross-Chain Messaging with the Wormhole Relayer SDK -```text -https://api.wormholescan.io -``` ---- END CONTENT --- +The `WormholeRelayerSDK.sol` contract simplifies cross-chain messaging and asset transfers by integrating several necessary modules, including the Wormhole relayer. By automating message delivery between chains, the Wormhole relayer removes the need for developers to manage relayer infrastructure or handle gas on the target chain. Delivery providers handle the message payload, ensuring secure and efficient communication. -Doc-Content: https://wormhole.com/docs/tools/faqs/ ---- BEGIN CONTENT --- ---- -title: Toolkit FAQs -description: FAQs on Wormhole Toolkit, covering Wormholescan, CLI, SDKs (TypeScript, Solidity), Tilt, error handling, transaction history, and manual VAA submission. -categories: Solidity-SDK, Typescript-SDK ---- +You can refer to the [Wormhole relayer documentation](/docs/products/messaging/guides/wormhole-relayers/){target=\_blank} for more details. -# Toolkit FAQs +Key modules in the SDK include: -## Why does the `toNative` function in the TypeScript SDK return an error? + - **`Base.sol`** - the core module for cross-chain messaging. It provides utility functions like `onlyWormholeRelayer()` and `setRegisteredSender()`, ensuring that only messages from trusted relayers are processed -The `toNative` function may return an error if the platform-specific module (such as Solana or EVM) is not correctly imported or passed into the Wormhole constructor. + - **`TokenBase.sol`** - this module extends the base messaging functionality to support cross-chain token transfers. It includes utilities for securely sending and receiving tokens between EVM-compatible chains -To fix this, ensure the relevant platform module is imported and included when initializing Wormhole. For example, if you're working with Solana, make sure to import the Solana module and pass it into the Wormhole constructor like this: + - **`CCTPBase.sol`** - designed for Circle’s Cross-Chain Transfer Protocol, this module manages asset transfers such as USDC between chains. It includes functionalities for both sending and receiving CCTP-based assets -```typescript -import solana from '@wormhole-foundation/sdk/solana'; -const wh = await wormhole('Testnet', [solana]); -``` + - **`CCTPAndTokenBase.sol`** - a combined module that supports token and CCTP-based asset transfers in a single implementation. This module simplifies development for applications needing to handle both types of transfers -## How can I retrieve the history of previously bridged transactions? +The Wormhole Solidity SDK offers a unified framework for cross-chain communication. Developers can select specific modules based on their application’s requirements, whether for messaging, token transfers, or CCTP. Each module includes built-in security measures, ensuring that only authorized senders or relayers are accepted, thereby protecting the application from unauthorized interactions. -To retrieve the history of previously bridged transactions, you can use the Wormholescan API. Use the following endpoint to query the transaction history for a specific address: +Please refer to the complete `WormholeRelayerSDK.sol` file below for further details. -```bash -https://api.wormholescan.io/api/v1/operations?address=INSERT_ADDRESS -``` +???- code "`WormholeRelayerSDK.sol`" + ```solidity + // SPDX-License-Identifier: Apache 2 +pragma solidity ^0.8.19; -Simply replace `INSERT_ADDRESS_HERE` with the address you want to query. The API will return a list of operations, including details about previously bridged transactions. +import "wormhole-sdk/interfaces/IWormholeReceiver.sol"; +import "wormhole-sdk/interfaces/IWormholeRelayer.sol"; +import "wormhole-sdk/constants/Chains.sol"; +import "wormhole-sdk/Utils.sol"; -???- example "Fetch transaction history for a specific address" - ```bash - curl -X GET "https://api.wormholescan.io/api/v1/operations?address=0x05c009C4C1F1983d4B915C145F4E782de23d3A38" -H "accept: application/json" +import {Base} from "wormhole-sdk/WormholeRelayer/Base.sol"; +import {TokenBase, TokenReceiver, TokenSender} from "wormhole-sdk/WormholeRelayer/TokenBase.sol"; +import {CCTPBase, CCTPReceiver, CCTPSender} from "wormhole-sdk/WormholeRelayer/CCTPBase.sol"; +import {CCTPAndTokenBase, CCTPAndTokenReceiver, CCTPAndTokenSender} from "wormhole-sdk/WormholeRelayer/CCTPAndTokenBase.sol"; ``` -## How can I manually submit a VAA to a destination chain in the correct format? +### Base Contract Overview -To manually submit a VAA (Verifiable Action Approval) to a destination chain, follow these steps: +The `Base.sol` contract is a core part of the Wormhole Solidity SDK, providing essential helper functions and modifiers for managing cross-chain messages securely via the Wormhole Relayer. It handles sender registration and message validation, ensuring only authorized senders from specific chains can send messages. -1. **Obtain the VAA in Base64 format** - navigate to the **Advanced** tab in [Wormholescan](https://wormholescan.io/){target=\_blank} to find the VAA associated with the transaction you want to submit and copy the VAA in base64 format + - **`onlyWormholeRelayer()`** - a modifier that ensures only authorized messages from the Wormhole relayer contract are processed, restricting access to certain functions - ```bash - https://wormholescan.io/#/tx/INSERT_TX_HASH?view=advanced + ```solidity + require( + msg.sender == address(wormholeRelayer), + "Msg.sender is not Wormhole Relayer" + ); + _; + } ``` -2. **Convert the VAA to hex** - you must convert the base64 VAA into a hexadecimal (hex) format before submitting it to the destination chain. This can be done using various online tools or via command-line utilities like `xxd` or a script in a language like Python + - **`setRegisteredSender()`** - restricts message acceptance to a registered sender from a specific chain, ensuring messages are only processed from trusted sources -3. **Submit the VAA through Etherscan (for EVM chains)** - once the VAA is in hex format, go to the [Etherscan UI](https://etherscan.io/){target=\_blank} and submit it through the [`TokenBridge`](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/main/src/interfaces/ITokenBridge.sol){target=\_blank} contract’s method (such as the `CompleteTransfer` function or `CompleteTransferWithPayload`) + ```solidity + uint16 sourceChain, + bytes32 sourceAddress + ) public { + require( + msg.sender == registrationOwner, + "Not allowed to set registered sender" + ); + registeredSenders[sourceChain] = sourceAddress; + } + ``` - - The `TokenBridge` contract addresses for each chain are available in the [Wormhole contract addresses](/docs/products/reference/contract-addresses/){target=\_blank} section +These security measures ensure messages come from the correct source and are processed securely. Please refer to the complete `Base.sol` contract below for further details. - - Interact with the smart contract through the Etherscan UI by pasting the hex-encoded VAA into the appropriate field +???- code "`Base.sol`" + ```solidity + // SPDX-License-Identifier: Apache 2 +pragma solidity ^0.8.19; -Following these steps, you can manually submit a VAA in the proper format to a destination chain. ---- END CONTENT --- +import "wormhole-sdk/interfaces/IWormholeReceiver.sol"; +import "wormhole-sdk/interfaces/IWormholeRelayer.sol"; +import "wormhole-sdk/interfaces/IWormhole.sol"; +import "wormhole-sdk/Utils.sol"; -Doc-Content: https://wormhole.com/docs/tools/solidity-sdk/get-started/ ---- BEGIN CONTENT --- ---- -title: Get Started with the Solidity SDK -description: Follow this guide to use the Wormhole Solidity SDK's interfaces and tools to help you quickly build on-chain integrations using smart contracts. -categories: Basics, Solidity-SDK ---- +abstract contract Base { + IWormholeRelayer public immutable wormholeRelayer; + IWormhole public immutable wormhole; -# Get Started with the Solidity SDK + address registrationOwner; + mapping(uint16 => bytes32) registeredSenders; -The [Wormhole Solidity SDK](https://github.com/wormhole-foundation/wormhole-solidity-sdk){target=\_blank} provides Solidity interfaces, prebuilt contracts, and testing tools to help Solidity developers build on-chain Wormhole integrations via smart contracts. You can use the [Wormhole TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank} for off-chain integrations without writing Solidity. + constructor(address _wormholeRelayer, address _wormhole) { + wormholeRelayer = IWormholeRelayer(_wormholeRelayer); + wormhole = IWormhole(_wormhole); + registrationOwner = msg.sender; + } -## Install the SDK + modifier onlyWormholeRelayer() { + require( + msg.sender == address(wormholeRelayer), + "Msg.sender is not Wormhole Relayer" + ); + _; + } -Use Foundry's [`forge`](https://book.getfoundry.sh/forge/){target=\_blank} to install the SDK using the following command: + modifier isRegisteredSender(uint16 sourceChain, bytes32 sourceAddress) { + require( + registeredSenders[sourceChain] == sourceAddress, + "Not registered sender" + ); + _; + } -```bash -forge install wormhole-foundation/wormhole-solidity-sdk -``` + /** + * Sets the registered address for 'sourceChain' to 'sourceAddress' + * So that for messages from 'sourceChain', only ones from 'sourceAddress' are valid + * + * Assumes only one sender per chain is valid + * Sender is the address that called 'send' on the Wormhole Relayer contract on the source chain) + */ + function setRegisteredSender( + uint16 sourceChain, + bytes32 sourceAddress + ) public { + require( + msg.sender == registrationOwner, + "Not allowed to set registered sender" + ); + registeredSenders[sourceChain] = sourceAddress; + } +} + ``` -## Key Components +### Interface for Cross-Chain Messages -The following key components and features work together to make your on-chain Wormhole integration easier to build. +The Wormhole Solidity SDK interacts with the Wormhole relayer for sending and receiving messages across EVM-compatible chains. The [`IWormholeRelayer`](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/main/src/interfaces/IWormholeRelayer.sol){target=\_blank} includes several interfaces that are central to cross-chain communication, enabling secure and efficient message delivery. -??? interface "Base contracts" +For detailed information on how to implement these interfaces, refer to the [Wormhole Relayer Interfaces documentation](/docs/products/messaging/guides/wormhole-relayers/#wormhole-relayer-interfaces){target=\_blank}. This section covers: - Leverage base contracts to send and receive messages and tokens. + - **`IWormholeRelayer`** – methods for sending cross-chain messages, VAAs, and token transfers + - **`IWormholeReceiver`** – the required implementation for receiving cross-chain messages + - **`quoteEVMDeliveryPrice()`** – how to estimate gas and fees for cross-chain transactions - - [**`Base.sol`**](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/b9e129e65d34827d92fceeed8c87d3ecdfc801d0/src/Base.sol){target=\_blank}: Uses Wormhole interfaces to authorize and verify a registered sender. - - [**`TokenBase.sol`**](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/b9e129e65d34827d92fceeed8c87d3ecdfc801d0/src/TokenBase.sol){target=\_blank}: Uses `TokenReceiver` and `TokenSender` contracts to define functions for transferring tokens. - - [**`CCTPBase.sol`**](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/b9e129e65d34827d92fceeed8c87d3ecdfc801d0/src/CCTPBase.sol){target=\_blank}: Uses `CCTPSender` and `CCTPReceiver` contracts to define functions for transferring USDC. +These interfaces reduce the complexity of cross-chain dApp development by abstracting away the details of relayer infrastructure, ensuring that message delivery is handled efficiently. -??? interface "Interfaces" +### Advanced Concepts - Use interfaces to ensure consistent interactions with the protocol regardless of the supported chain you use. +For developers interested in exploring additional advanced topics, the following sections provide insights into key aspects of the SDK’s functionality. - - [**`ITokenBridge.sol`**](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/b9e129e65d34827d92fceeed8c87d3ecdfc801d0/src/interfaces/ITokenBridge.sol){target=\_blank}: Defines key structs and functions for token attestation, wrapping and transferring tokens, monitoring transaction progress. - - [**CCTP Interfaces**](https://github.com/wormhole-foundation/wormhole-solidity-sdk/tree/b9e129e65d34827d92fceeed8c87d3ecdfc801d0/src/interfaces/CCTPInterfaces){target=\_blank}: A set of interfaces for USDC transfers via CCTP for sending, relaying, and receiving messages and tokens. - - [**`IWormholeReceiver.sol`**](https://github.com/wormhole-foundation/wormhole/blob/main/relayer/ethereum/contracts/interfaces/relayer/IWormholeReceiver.sol){target=\_blank}: Defines the `receiveWormholeMessages` function. - - [**`IWormholeRelayer.sol`**](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/b9e129e65d34827d92fceeed8c87d3ecdfc801d0/src/interfaces/IWormholeRelayer.sol){target=\_blank}: Defines key structs and functions to identify, send, and deliver messages and follow the progress of transactions. +???- note "Error Handling and Reverts" + The SDK defines several custom errors to help developers handle common issues like incorrect gas fees, invalid senders, and more. For example, `InvalidMsgValue` is thrown when the message value for a relayed message is erroneous. -??? interface "Constants" + ```solidity + error InvalidMsgValue(uint256 msgValue, uint256 totalFee); + ``` - Auto-generated Solidity constants help avoid manual entry errors and ensure consistent delivery. +## Usage - - [**Wormhole Chain ID's**](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/b9e129e65d34827d92fceeed8c87d3ecdfc801d0/src/Chains.sol){target=\_blank}: Generated list of Wormhole Chain ID's for supported chains. - - [**Circle CCTP Domain IDs**](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/b9e129e65d34827d92fceeed8c87d3ecdfc801d0/src/CCTPAndTokenBase.sol){target=\_blank}: Generated list of defined CCTP domain ID's to ensure USDC transfers use the correct domain for a given chain. - - [**`chainConsts.ts`**](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/75ddcec06ffe9d62603d023357caa576c5ea101c/gen/chainConsts.ts){target=\_blank}: Returns values to identify properties and contract addresses for each supported chain. +This section covers cross-chain messaging and token transfers and shows how to use the Wormhole Solidity SDK in real-world scenarios. -## Example Usage +### Send a Cross-Chain Message -The following demo illustrates the use of Wormhole Solidity SDK-based smart contracts to send testnet USDC between supported chains. +To send a cross-chain message, inherit from the base contract provided by the SDK and use its helper methods to define your message and sender address. Here’s a basic example: -### Prerequisites -Before you begin, ensure you have the following: +```solidity +pragma solidity ^0.8.19; -- [Node.js and npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm){target=\_blank} installed -- [TypeScript](https://www.typescriptlang.org/download/){target=\_blank} installed -- [Foundry](https://book.getfoundry.sh/getting-started/installation){target=\_blank} installed -- Testnet tokens for two supported chains. This example uses [testnet AVAX for Avalanche Fuji](https://core.app/tools/testnet-faucet/?subnet=c&token=c){target=\_blank} and [testnet CELO for Celo Alfajores](https://faucet.celo.org/alfajores){target=\_blank} and can be adapted to any supported chains -- [USDC testnet tokens](https://faucet.circle.com/){target=\_blank} on your source chain for cross-chain transfer +import "@wormhole-foundation/wormhole-solidity-sdk/src/WormholeRelayer/Base.sol"; -### Set Up a Project +contract CrossChainSender is Base { + constructor( + address _wormholeRelayer, + address _wormhole + ) Base(_wormholeRelayer, _wormhole) {} -Follow these steps to prepare your development environment: + function sendMessage( + bytes memory message, + uint16 targetChain, + bytes32 targetAddress + ) external payable { + // Register sender and send message through WormholeRelayer + setRegisteredSender(targetChain, msg.sender); + onlyWormholeRelayer().sendPayloadToEvm( + targetChain, + address(targetAddress), + message, + 0, + 500_000 + ); + } +} +``` -1. Create a directory for your project, navigate into it, and install the Wormhole Solidity SDK: +This contract extends `Base.sol` and allows sending cross-chain messages securely using the `WormholeRelayer`. - ```bash - mkdir solidity-token-transfer - cd solidity-token-transfer - forge install wormhole-foundation/wormhole-solidity-sdk - ``` +### Send Tokens Across Chains -2. Install dependencies for use with your transfer script, including the Wormhole TypeScript SDK, and initiate a new Node.js project: +The SDK enables seamless token transfers between EVM-compatible chains in addition to sending messages. To facilitate cross-chain token transfers, you can extend the SDK's `TokenSender` and `TokenReceiver` base contracts. - ```bash - npm init -y && npm install @wormhole-foundation/sdk ethers -D tsx typescript - ``` +```solidity +pragma solidity ^0.8.19; -### Create and Deploy Contracts +import "@wormhole-foundation/wormhole-solidity-sdk/src/WormholeRelayer/TokenBase.sol"; -This project uses sender and receiver contracts to access the `WormholeRelayer` interface's [`TokenSender`](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/baa085006586a43c42858d355e3ffb743b80d7a4/src/WormholeRelayer/TokenBase.sol#L24){target=\_blank} and [`TokenReceiver`](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/baa085006586a43c42858d355e3ffb743b80d7a4/src/WormholeRelayer/TokenBase.sol#L147){target=\_blank} base classes to simplify sending tokens across chains. - -Follow these steps to create and deploy your sender and receiver Solidity contracts: - -1. Use the following example code to create `CrossChainSender.sol`: - - ```solidity title="CrossChainSender.sol" - // SPDX-License-Identifier: MIT -pragma solidity ^0.8.13; - -import "lib/wormhole-solidity-sdk/src/WormholeRelayerSDK.sol"; -import "lib/wormhole-solidity-sdk/src/interfaces/IERC20.sol"; - -// Extend the TokenSender contract inherited from TokenBase -contract CrossChainSender is TokenSender { - uint256 constant GAS_LIMIT = 250_000; - // Initialize the contract with the Wormhole relayer, Token Bridge, - // and Wormhole Core Contract addresses +contract CrossChainTokenSender is TokenSender { constructor( address _wormholeRelayer, - address _tokenBridge, address _wormhole - ) TokenBase(_wormholeRelayer, _tokenBridge, _wormhole) {} - - // Calculate the estimated cost for multichain token transfer using - // the wormholeRelayer to get the delivery cost and add the message fee - function quoteCrossChainDeposit( - uint16 targetChain - ) public view returns (uint256 cost) { - uint256 deliveryCost; - (deliveryCost, ) = wormholeRelayer.quoteEVMDeliveryPrice( - targetChain, - 0, - GAS_LIMIT - ); - - cost = deliveryCost + wormhole.messageFee(); - } + ) TokenSender(_wormholeRelayer, _wormhole) {} - // Send tokens and payload to the recipient on the target chain - function sendCrossChainDeposit( - uint16 targetChain, - address targetReceiver, - address recipient, + function sendToken( + address token, uint256 amount, - address token - ) public payable { - // Calculate the estimated cost for the multichain deposit - uint256 cost = quoteCrossChainDeposit(targetChain); - require( - msg.value == cost, - "msg.value must equal quoteCrossChainDeposit(targetChain)" - ); - // Transfer the tokens from the sender to this contract - IERC20(token).transferFrom(msg.sender, address(this), amount); - // Encode the recipient address into the payload - bytes memory payload = abi.encode(recipient); - // Initiate the multichain transfer using the wormholeRelayer - sendTokenWithPayloadToEvm( - targetChain, - targetReceiver, - payload, - 0, - GAS_LIMIT, - token, - amount - ); + uint16 targetChain, + bytes32 targetAddress + ) external payable { + // Send tokens across chains + transferTokenToTarget(token, amount, targetChain, targetAddress); } } - ``` +``` - This contract extends `TokenSender`, gaining access to its functionality. It initializes the contract with the required addresses, calculates estimated transfer costs, defines transfer parameters, and initiates the transfer using the `sendTokenWithPayloadToEvm` function from `WormholeRelayer`. +In this example, `TokenSender` initiates a token transfer to another chain. The SDK’s built-in utilities securely handle token transfers, ensuring proper VAAs are generated and processed. -2. Use the following example code to create `CrossChainReceiver.sol`: +### Receive Tokens Across Chains - ```solidity title="CrossChainSender.sol" - // SPDX-License-Identifier: MIT -pragma solidity ^0.8.13; +To receive tokens on the target chain, implement a contract that inherits from `TokenReceiver` and overrides the `receiveWormholeMessages` function. -import "lib/wormhole-solidity-sdk/src/WormholeRelayerSDK.sol"; -import "lib/wormhole-solidity-sdk/src/interfaces/IERC20.sol"; +```solidity +pragma solidity ^0.8.19; -// Extend the TokenReceiver contract inherited from TokenBase -contract CrossChainReceiver is TokenReceiver { - // Initialize the contract with the Wormhole relayer, Token Bridge, - // and Wormhole Core Contract addresses +import "@wormhole-foundation/wormhole-solidity-sdk/src/WormholeRelayer/TokenBase.sol"; + +contract CrossChainTokenReceiver is TokenReceiver { constructor( address _wormholeRelayer, - address _tokenBridge, address _wormhole - ) TokenBase(_wormholeRelayer, _tokenBridge, _wormhole) {} + ) TokenReceiver(_wormholeRelayer, _wormhole) {} - // Receive the multichain payload and tokens - // Verify the transfer is from a registered sender - function receivePayloadAndTokens( + // Function to handle received tokens from another chain + function receiveWormholeMessages( bytes memory payload, - TokenReceived[] memory receivedTokens, + bytes[] memory additionalMessages, bytes32 sourceAddress, uint16 sourceChain, - bytes32 // deliveryHash - ) - internal - override - onlyWormholeRelayer - isRegisteredSender(sourceChain, sourceAddress) - { - // Ensure the payload is not empty and only has one token transfer - require(receivedTokens.length == 1, "Expected 1 token transfer"); - - // Decode the recipient address from the payload - address recipient = abi.decode(payload, (address)); - - // Transfer the received tokens to the intended recipient - IERC20(receivedTokens[0].tokenAddress).transfer( - recipient, - receivedTokens[0].amount - ); + bytes32 deliveryHash + ) external payable override { + // Process the received tokens here + receiveTokens(payload); } } - ``` - - This contract extends `TokenReceiver`, gaining access to its functionality. It initializes the contract with the required addresses, receives the payload and tokens, verifies the transfer is from a registered sender, decodes the recipient address, and transfers the tokens to the recipient. +``` -3. Deploy the contracts using your preferred deployment method. Make sure you deploy `CrossChainSender.sol` to your desired source chain and `CrossChainReceiver.sol` to the target chain. Save the deployed contract addresses for each contract. You will need them for your transfer script. +In this example, `TokenReceiver` allows the contract to handle tokens sent from the source chain. Once the cross-chain message is received, the `receiveWormholeMessages` function processes the incoming tokens. Always validate the message's authenticity and source. -## Use Contracts to Transfer USDC +!!! note + Always verify the source of incoming messages and tokens to prevent unauthorized access to your contract. Please refer to the [Emitter Verification](/docs/products/messaging/guides/core-contracts/#validating-the-emitter/){target=\_blank} section for more details. -1. Once your contracts are deployed, create a `transfer.ts` file to handle the multichain transfer logic: +## Testing Environment - ```bash - touch script/transfer.ts - ``` +The SDK includes built-in support for Forge-based testing, which allows you to test your cross-chain applications locally before deploying them to production. Testing with the same Solidity compiler version and configuration you plan to use in production is highly recommended to catch any potential issues early. -2. Set up secure access to your wallets. This guide assumes you are loading your private key(s) from a secure keystore of your choice, such as a secrets manager or a CLI-based tool like [`cast wallet`](https://book.getfoundry.sh/reference/cast/cast-wallet){target=\_blank}. +For a detailed example, check out the below repositories: - !!! warning - If you use a `.env` file during development, add it to your `.gitignore` to exclude it from version control. Never commit private keys or mnemonics to your repository. + - [Cross chain messaging](/docs/products/messaging/tutorials/cross-chain-contracts/){target=\_blank} + - [Cross chain token transfer](/docs/products/messaging/tutorials/cross-chain-token-contracts/){target=\_blank} +--- END CONTENT --- -3. Open `transfer.ts` and add the following code: +Doc-Content: https://wormhole.com/docs/tools/cli/get-started/ +--- BEGIN CONTENT --- +--- +title: Wormhole CLI +description: Learn how to install and use the Wormhole CLI, including commands and examples for managing multichain deployments, generating VAAs, and querying contract info. +categories: Solidity-SDK, Typescript-SDK +--- - ```typescript title="transfer.ts" - import { ethers } from 'ethers'; -import fs from 'fs'; -import path from 'path'; -import readlineSync from 'readline-sync'; -import { fileURLToPath } from 'url'; -import { wormhole, chainToChainId } from '@wormhole-foundation/sdk'; -import evm from '@wormhole-foundation/sdk/evm'; +# Wormhole CLI -// Replace with your contract address and chain names -const AVALANCHE_SENDER_ADDRESS = 'INSERT_AVALANCHE_SENDER_CONTRACT_ADDRESS'; -const CELO_RECEIVER_ADDRESS = 'INSERT_CELO_RECEIVER_ADDRESS'; -const AVALANCHE_CHAIN_NAME = 'Avalanche'; -const CELO_CHAIN_NAME = 'Celo'; +This tool is a command-line interface to Wormhole, allowing you to perform various actions, such as querying a transaction's status or submitting token transfers. -// Fetch the contract ABI from the local filesystem -// This example uses the `out` directory from a Foundry deployment -const __filename = fileURLToPath(import.meta.url); -const __dirname = path.dirname(__filename); -const SENDER_ABI_PATH = path.resolve( - __dirname, - '../out/CrossChainSender.sol/CrossChainSender.json' -); +## Installation -(async function () { - try { - console.log('Initializing Wormhole SDK...'); - const wh = await wormhole('Testnet', [evm]); - const sendChain = wh.getChain(AVALANCHE_CHAIN_NAME); - const rcvChain = wh.getChain(CELO_CHAIN_NAME); +Clone the repository and change directories to the appropriate directory: - // The EVM_PRIVATE_KEY value must be loaded securely beforehand, - // for example via a keystore, secrets manager, or environment variables - // (not recommended) - const EVM_PRIVATE_KEY = EVM_PRIVATE_KEY!; - if (!EVM_PRIVATE_KEY) { - console.error('EVM_PRIVATE_KEY is not set in your .env file.'); - process.exit(1); - } +```bash +git clone https://github.com/wormhole-foundation/wormhole && +cd wormhole/clients/js +``` - // Get the RPC URL or Provider from the SDK - const sourceRpcOrProvider = await sendChain.getRpc(); - let sourceProvider: ethers.JsonRpcProvider; - if ( - sourceRpcOrProvider && - typeof (sourceRpcOrProvider as any).getBlockNumber === 'function' - ) { - sourceProvider = sourceRpcOrProvider as ethers.JsonRpcProvider; - } else if (typeof sourceRpcOrProvider === 'string') { - sourceProvider = new ethers.JsonRpcProvider(sourceRpcOrProvider); - } else if ( - Array.isArray(sourceRpcOrProvider) && - typeof sourceRpcOrProvider[0] === 'string' - ) { - sourceProvider = new ethers.JsonRpcProvider(sourceRpcOrProvider[0]); - } else { - console.error( - 'Could not get a valid RPC URL or Provider from SDK:', - sourceRpcOrProvider - ); - process.exit(1); - } +Build and install the CLI tool: - // Create the wallet using the provider and private key - const sourceWallet = new ethers.Wallet(EVM_PRIVATE_KEY, sourceProvider); +```bash +make install +``` - // Load the sender contract ABI - if (!fs.existsSync(SENDER_ABI_PATH)) { - console.error(`ABI file not found at ${SENDER_ABI_PATH}`); - process.exit(1); - } - const CrossChainSenderArtifact = JSON.parse( - fs.readFileSync(SENDER_ABI_PATH, 'utf8') - ); - const senderAbi = CrossChainSenderArtifact.abi; +This installs two binaries, `worm-fetch-governance` and `worm` on your `$PATH`. To use `worm`, set up `$HOME/.wormhole/.env` with your private keys, based on `.env.sample` in this folder. - // Create new sender contract instance - const senderContract = new ethers.Contract( - AVALANCHE_SENDER_ADDRESS, - senderAbi, - sourceWallet - ); +## Usage - // Get user input for token transfer parameters - const tokenAddress = readlineSync.question( - 'Enter the (ERC20) token contract address on Avalanche: ' - ); - const recipientAddress = readlineSync.question( - 'Enter the recipient address on Celo: ' - ); - const amountStr = readlineSync.question( - 'Enter the amount of tokens to transfer: ' - ); +You can interact with the Wormhole CLI by typing `worm` and including the `command` and any necessary subcommands and parameters. - // Approve sending tokens from the source wallet to the sender contract - const tokenContract = new ethers.Contract( - tokenAddress, - [ - 'function decimals() view returns (uint8)', - 'function approve(address spender, uint256 amount) public returns (bool)', - 'function allowance(address owner, address spender) view returns (uint256)', - ], - sourceWallet - ); +| Command | Description | +|--------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------| +| `worm aptos INSERT_COMMAND` | Aptos utilities | +| `worm edit-vaa INSERT_COMMAND` | Edits or generates a VAA | +| `worm evm INSERT_COMMAND` | EVM utilities | +| `worm generate INSERT_COMMAND` | Generate VAAs (Devnet and Testnet only) | +| `worm info INSERT_COMMAND` | Contract, chain, RPC, and address information utilities | +| `worm near INSERT_NETWORK, INSERT_ACCOUNT` | NEAR utilities | +| `worm parse INSERT_VAA` | Parse a VAA (can be in either hex or base64 format) | +| `worm recover INSERT_DIGEST INSERT_SIGNATURE` | Recover an address from a signature | +| `worm status INSERT_NETWORK, INSERT_CHAIN, INSERT_TXN_HASH` | Prints information about the automatic delivery initiated on the specified network, chain, and transaction hash | +| `worm submit INSERT_VAA` | Execute a VAA | +| `worm sui INSERT_COMMAND` | Sui utilities | +| `worm transfer INSERT_SOURCE_CHAIN, INSERT_DESTINATION_CHAIN, INSERT_DESTINATION_ADDRESS, INSERT_AMOUNT, INSERT_NETWORK` | Transfers a token | +| `worm verify-vaa INSERT_VAA, INSERT_NETWORK` | Verifies a VAA by querying the Core Contract on Ethereum | - // Convert the amount to the correct units based on token decimals - const decimals = Number(await tokenContract.decimals()); - const amountToTransfer = ethers.parseUnits(amountStr, decimals); +You can also refer to the below options, available with all `worm` commands: - // Get a transfer cost quote - const targetChainId = chainToChainId(rcvChain.chain); - const cost = await senderContract.quoteCrossChainDeposit(targetChainId); - // Approve the sender contract to spend the tokens - const approveTx = await tokenContract.approve( - AVALANCHE_SENDER_ADDRESS, - amountToTransfer - ); - await approveTx.wait(); +```bash +Options: + --help Show help [boolean] + --version Show version number [boolean] +``` - // Initiate the transfer - console.log( - `Initiating cross-chain transfer to ${CELO_RECEIVER_ADDRESS} on ${rcvChain.chain}...` - ); - const transferTx = await senderContract.sendCrossChainDeposit( - targetChainId, - CELO_RECEIVER_ADDRESS, - recipientAddress, - amountToTransfer, - tokenAddress, - { value: cost } - ); - console.log(`Transfer transaction sent: ${transferTx.hash}`); - await transferTx.wait(); - console.log(`✅ Transfer initiated successfully!`); - } catch (error) { - console.error('An error occurred:', error); - process.exit(1); - } +### Subcommands - process.exit(0); -})(); +??? interface "Aptos" + ```bash + worm aptos INSERT_COMMAND + +Commands: + worm aptos init-token-bridge Init token bridge contract + worm aptos init-wormhole Init Wormhole core contract + worm aptos deploy Deploy an Aptos package + worm aptos deploy-resource Deploy an Aptos package using a + resource account + worm aptos send-example-message Send example message + + worm aptos derive-resource-account Derive resource account address + + worm aptos derive-wrapped-address Derive wrapped coin type + + worm aptos hash-contracts Hash contract bytecodes for upgrade + worm aptos upgrade Perform upgrade after VAA has been + submitted + worm aptos migrate Perform migration after contract + upgrade + worm aptos faucet Request money from the faucet for a + given account + worm aptos start-validator Start a local aptos validator + +Options: + --help Show help [boolean] + --version Show version number [boolean] ``` - This script defines the sender and receiver contract addresses, fetches the necessary ABI information, creates a connected signer, converts decimals, calculates the estimated transfer cost, and initiates the token transfer. +??? interface "Edit VAA" + ```bash + worm edit-vaa INSERT_COMMAND -3. Run the script using the following command: +Options: + --help Show help [boolean] + --version Show version number [boolean] + -v, --vaa vaa in hex format [string] [required] + -n, --network Network + [required] [choices: "mainnet", "testnet", "devnet"] + --guardian-set-index, --gsi guardian set index [number] + --signatures, --sigs comma separated list of signatures [string] + --wormscanurl, --wsu url to wormscan entry for the vaa that + includes signatures [string] + --wormscan, --ws if specified, will query the wormscan entry + for the vaa to get the signatures [boolean] + --emitter-chain-id, --ec emitter chain id to be used in the vaa + [number] + --emitter-address, --ea emitter address to be used in the vaa[string] + --nonce, --no nonce to be used in the vaa [number] + --sequence, --seq sequence number to be used in the vaa[string] + --consistency-level, --cl consistency level to be used in the vaa + [number] + --timestamp, --ts timestamp to be used in the vaa in unix + seconds [number] + -p, --payload payload in hex format [string] + --guardian-secret, --gs Guardian's secret key [string] + ``` +??? interface "EVM" ```bash - npx tsx script/transfer.ts + worm evm INSERT_COMMAND + +Commands: + worm evm address-from-secret Compute a 20 byte eth address from a 32 + byte private key + worm evm storage-update Update a storage slot on an EVM fork + during testing (anvil or hardhat) + worm evm chains Return all EVM chains + worm evm info Query info about the on-chain state of + the contract + worm evm hijack Override the guardian set of the core + bridge contract during testing (anvil + or hardhat) + worm evm start-validator Start a local EVM validator + +Options: + --help Show help [boolean] + --version Show version number [boolean] + --rpc RPC endpoint [string] + ``` + +??? interface "Generate" + ```bash + worm generate INSERT_COMMAND + +Commands: + worm generate registration Generate registration VAA + worm generate upgrade Generate contract upgrade VAA + worm generate attestation Generate a token attestation VAA + worm generate recover-chain-id Generate a recover chain ID VAA + worm generate Sets the default delivery provider + set-default-delivery-provider for the Wormhole Relayer contract + +Options: + --help Show help [boolean] + --version Show version number [boolean] + -g, --guardian-secret Guardians' secret keys (CSV) [string] [required] + ``` + +??? interface "Info" + ```bash + worm info INSERT_COMMAND + +Commands: + worm info chain-id Print the wormhole chain ID integer + associated with the specified chain + name + worm info contract Print contract address + + worm info emitter
Print address in emitter address + format + worm info origin
Print the origin chain and address + of the asset that corresponds to the + given chain and address. + worm info registrations Print chain registrations + + worm info rpc Print RPC address + worm info wrapped Print the wrapped address on the + target chain that corresponds with + the specified origin chain and + address. + +Options: + --help Show help [boolean] + --version Show version number [boolean]
+ ``` + +??? interface "NEAR" + ```bash + worm near INSERT_COMMAND + +Commands: + worm near contract-update Submit a contract update using our specific + APIs + worm near deploy Submit a contract update using near APIs + +Options: + --help Show help [boolean] + --version Show version number [boolean] + -m, --module Module to query [choices: "Core", "NFTBridge", "TokenBridge"] + -n, --network Network [required] [choices: "mainnet", "testnet", "devnet"] + --account Near deployment account [string] [required] + --attach Attach some near [string] + --target Near account to upgrade [string] + --mnemonic Near private keys [string] + --key Near private key [string] + -r, --rpc Override default rpc endpoint url [string] + ``` + +??? interface "Parse" + ```bash + worm parse INSERT_VAA + +Positionals: + vaa vaa [string] + +Options: + --help Show help [boolean] + --version Show version number [boolean] + ``` + +??? interface "Recover" + ```bash + worm recover INSERT_DIGEST INSERT_SIGNATURE + +Positionals: + digest digest [string] + signature signature [string] + +Options: + --help Show help [boolean] + --version Show version number [boolean] + ``` + +??? interface "Status" + ```bash + worm status INSERT_NETWORK, INSERT_CHAIN, INSERT_TXN_HASH + +Positionals: + network Network [choices: + 'mainnet', + 'testnet', + 'devnet'] + chain Source chain + [choices: + 'unset', + 'solana', + 'ethereum', + 'terra', + 'bsc', + 'polygon', + 'avalanche', + 'oasis', + 'algorand', + 'aurora', + 'fantom', + 'karura', + 'acala', + 'klaytn', + 'celo', + 'near', + 'moonbeam', + 'neon', + 'terra2', + 'injective', + 'osmosis', + 'sui', + 'aptos', + 'arbitrum', + 'optimism', + 'gnosis', + 'pythnet', + 'xpla', + 'btc', + 'base', + 'sei', + 'rootstock', + 'scroll', + 'mantle', + 'blast', + 'xlayer', + 'linea', + 'berachain', + 'seievm', + 'wormchain', + 'cosmoshub', + 'evmos', + 'kujira', + 'neutron', + 'celestia', + 'stargaze', + 'seda', + 'dymension', + 'provenance', + 'sepolia', + 'arbitrum_sepolia', + 'base_sepolia', + 'optimism_sepolia', + 'holesky', + 'polygon_sepolia'] + tx Source transaction hash [string] + +Options: + --help Show help [boolean] + --version Show version number [boolean] + ``` + +??? interface "Submit" + ```bash + worm submit INSERT_VAA + +Positionals: + vaa vaa [string] + +Options: + --help Show help [boolean] + --version Show version number [boolean] + -c, --chain chain name +[choices: 'unset', + 'solana', + 'ethereum', + 'terra', + 'bsc', + 'polygon', + 'avalanche', + 'oasis', + 'algorand', + 'aurora', + 'fantom', + 'karura', + 'acala', + 'klaytn', + 'celo', + 'near', + 'moonbeam', + 'neon', + 'terra2', + 'injective', + 'osmosis', + 'sui', + 'aptos', + 'arbitrum', + 'optimism', + 'gnosis', + 'pythnet', + 'xpla', + 'btc', + 'base', + 'sei', + 'rootstock', + 'scroll', + 'mantle', + 'blast', + 'xlayer', + 'linea', + 'berachain', + 'seievm', + 'wormchain', + 'cosmoshub', + 'evmos', + 'kujira', + 'neutron', + 'celestia', + 'stargaze', + 'seda', + 'dymension', + 'provenance', + 'sepolia', + 'arbitrum_sepolia', + 'base_sepolia', + 'optimism_sepolia', + 'holesky', + 'polygon_sepolia'] + -n, --network Network + [required] + [choices: + 'mainnet', + 'testnet', + 'devnet'] + -a, --contract-address Contract to submit VAA to (override config) [string] + --rpc RPC endpoint [string] + --all-chains, --ac Submit the VAA to all chains except for the origin + chain specified in the payload + [boolean] [default: false] + ``` + +??? interface "Sui" + ```bash + worm sui INSERT_COMMAND + +Commands: + worm sui build-coin Build wrapped coin and dump bytecode. + + Example: + worm sui build-coin -d 8 -v V__0_1_1 -n + testnet -r + "https://fullnode.testnet.sui.io:443" + worm sui deploy Deploy a Sui package + worm sui init-example-message-app Initialize example core message app + worm sui init-token-bridge Initialize token bridge contract + worm sui init-wormhole Initialize wormhole core contract + worm sui publish-example-message Publish message from example app via + core bridge + worm sui setup-devnet Setup devnet by deploying and + initializing core and token bridges and + submitting chain registrations. + worm sui objects Get owned objects by owner + worm sui package-id Get package ID from State object ID + worm sui tx Get transaction details + +Options: + --help Show help [boolean] + --version Show version number [boolean] + ``` + +??? interface "Transfer" + ```bash + worm transfer INSERT_SOURCE_CHAIN, INSERT_DESTINATION_CHAIN, INSERT_DESTINATION_ADDRESS, INSERT_AMOUNT, INSERT_NETWORK + +Options: + --help Show help [boolean] + --version Show version number [boolean] + --src-chain source chain [required] [choices: + 'solana', + 'ethereum', + 'terra', + 'bsc', + 'polygon', + 'avalanche', + 'oasis', + 'algorand', + 'aurora', + 'fantom', + 'karura', + 'acala', + 'klaytn', + 'celo', + 'near', + 'moonbeam', + 'neon', + 'terra2', + 'injective', + 'osmosis', + 'sui', + 'aptos', + 'arbitrum', + 'optimism', + 'gnosis', + 'pythnet', + 'xpla', + 'btc', + 'base', + 'sei', + 'rootstock', + 'scroll', + 'mantle', + 'blast', + 'xlayer', + 'linea', + 'berachain', + 'seievm', + 'wormchain', + 'cosmoshub', + 'evmos', + 'kujira', + 'neutron', + 'celestia', + 'stargaze', + 'seda', + 'dymension', + 'provenance', + 'sepolia', + 'arbitrum_sepolia', + 'base_sepolia', + 'optimism_sepolia', + 'holesky', + 'polygon_sepolia'] + --dst-chain destination chain + [required] [choices: + 'solana', + 'ethereum', + 'terra', + 'bsc', + 'polygon', + 'avalanche', + 'oasis', + 'algorand', + 'aurora', + 'fantom', + 'karura', + 'acala', + 'klaytn', + 'celo', + 'near', + 'moonbeam', + 'neon', + 'terra2', + 'injective', + 'osmosis', + 'sui', + 'aptos', + 'arbitrum', + 'optimism', + 'gnosis', + 'pythnet', + 'xpla', + 'btc', + 'base', + 'sei', + 'rootstock', + 'scroll', + 'mantle', + 'blast', + 'xlayer', + 'linea', + 'berachain', + 'seievm', + 'wormchain', + 'cosmoshub', + 'evmos', + 'kujira', + 'neutron', + 'celestia', + 'stargaze', + 'seda', + 'dymension', + 'provenance', + 'sepolia', + 'arbitrum_sepolia', + 'base_sepolia', + 'optimism_sepolia', + 'holesky', + 'polygon_sepolia'] + --dst-addr destination address [string] [required] + --token-addr token address [string] [default: native token] + --amount token amount [string] [required] + -n, --network Network [required] [choices: "mainnet", "testnet", "devnet"] + --rpc RPC endpoint [string] ``` -4. Follow the prompts in the terminal. This example uses Avalanche Fuji as the source chain, Celo Testnet as the target, [Avalanche Fuji testnet USDC](https://developers.circle.com/stablecoins/usdc-on-test-networks){target=\_blank}, and a developer wallet as the recipient address. You will see terminal output similar to the following: - -
-npx tsx script/transfer.ts -Initializing Wormhole SDK... -Enter the (ERC20) token contract address on Avalanche: 0x5425890298aed601595a70ab815c96711a31bc65 -Enter the recipient address on Celo: 0xCD8Bcd9A793a7381b3C66C763c3f463f70De4e12 -Initiating cross-chain transfer to 0xff97a7141833fbe829249d4e8952A8e73a4a2fbd on Celo... -Transfer transaction sent: 0x2d819aadf88309eb19f59a510aba1f2892b54487f9e287feadd150181a28f771 -✅ Transfer initiated successfully! - -
- -Congratulations! You've successfully created and deployed Wormhole Solidity SDK-based smart contracts and used them to send testnet USDC across blockchains. Consider the following options to build upon what you've accomplished. - -## Next Steps - -- [**Get Started with Messaging**](/docs/products/messaging/get-started/): Send a message across blockchains using the Wormhole TypeScript SDK to eliminate smart contract development and auditing overhead. ---- END CONTENT --- - -Doc-Content: https://wormhole.com/docs/tools/solidity-sdk/sdk-reference/ ---- BEGIN CONTENT --- ---- -title: Solidity SDK -description: How to use the Wormhole Solidity SDK for cross-chain messaging, token transfers, and integrating decentralized applications on EVM-compatible blockchains. -categories: Solidity-SDK ---- - -# Solidity SDK - -This page covers all you need to know about the functionality offered through the Wormhole Solidity SDK. - -
- -- :octicons-download-16:{ .lg .middle } **Installation** - - --- +??? interface "Verify VAA" + ```bash + worm verify-vaa INSERT_VAA, INSERT_NETWORK - Find installation instructions using Foundry and Forge to pull the necessary libraries into your project. +Options: + --help Show help [boolean] + --version Show version number [boolean] + -v, --vaa vaa in hex format [string] [required] + -n, --network Network [required] [choices: "mainnet", "testnet", "devnet"] + ``` - [:custom-arrow: Install the SDK](/docs/tools/solidity-sdk/get-started/#installation) +## Examples -- :octicons-download-16:{ .lg .middle } **Source Code** +### Generate a VAA - --- +Use `generate` to create VAAs for testing. For example, use the following command to create an NFT bridge registration VAA: - Want to go straight to the source? Check out the Solidity SDK GitHub repository. +```bash +worm generate registration --module NFTBridge \ + --chain bsc \ + --contract-address 0x706abc4E45D419950511e474C7B9Ed348A4a716c \ + --guardian-secret cfb12303a19cde580bb4dd771639b0d26bc68353645571a8cff516ab2ee113a0 +``` - [:custom-arrow: View GitHub Repository](https://github.com/wormhole-foundation/wormhole-solidity-sdk){target=\_blank} +The below example generates a token attestation VAA: -
+```bash +worm generate attestation --emitter-chain ethereum \ + --emitter-address 11111111111111111111111111111115 \ + --chain ethereum \ + --token-address 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 \ + --decimals 6 \ + --symbol USDC \ + --name USDC \ + --guardian-secret cfb12303a19cde580bb4dd771639b0d26bc68353645571a8cff516ab2ee113a0 +``` -## Key Considerations +### Parse a VAA -Before deploying applications using the Wormhole Solidity SDK, keep these considerations in mind: +Use `parse` to parse a VAA into JSON: - - **IERC-20 remapping** - the SDK provides a remapping mechanism to handle potential conflicts between different implementations of IERC20, ensuring seamless integration with other libraries - - **Testing** - given the cross-chain dependencies, testing all integrations is critical to avoid issues in production environments +```bash +worm parse $(worm-fetch-governance 13940208096455381020) +``` -## Concepts and Components +This example will fetch governance VAA `13940208096455381020` and print it as JSON: -The Wormhole Solidity SDK consists of key components that streamline cross-chain communication, allowing developers to securely and efficiently interact with Wormhole’s infrastructure. Below are the critical concepts and contracts you'll encounter when working with the SDK. +```bash +# ...signatures elided +timestamp: 1651416474, +nonce: 1570649151, +emitterChain: 1, +emitterAddress: '0000000000000000000000000000000000000000000000000000000000000004', +sequence: 13940208096455381020n, +consistencyLevel: 32, +payload: { + module: 'Core', + type: 'GuardianSetUpgrade', + chain: 0, + newGuardianSetIndex: 2, + newGuardianSetLength: 19, + newGuardianSet: [ + '58cc3ae5c097b213ce3c81979e1b9f9570746aa5', + 'ff6cb952589bde862c25ef4392132fb9d4a42157', + '114de8460193bdf3a2fcf81f86a09765f4762fd1', + '107a0086b32d7a0977926a205131d8731d39cbeb', + '8c82b2fd82faed2711d59af0f2499d16e726f6b2', + '11b39756c042441be6d8650b69b54ebe715e2343', + '54ce5b4d348fb74b958e8966e2ec3dbd4958a7cd', + '66b9590e1c41e0b226937bf9217d1d67fd4e91f5', + '74a3bf913953d695260d88bc1aa25a4eee363ef0', + '000ac0076727b35fbea2dac28fee5ccb0fea768e', + 'af45ced136b9d9e24903464ae889f5c8a723fc14', + 'f93124b7c738843cbb89e864c862c38cddcccf95', + 'd2cc37a4dc036a8d232b48f62cdd4731412f4890', + 'da798f6896a3331f64b48c12d1d57fd9cbe70811', + '71aa1be1d36cafe3867910f99c09e347899c19c3', + '8192b6e7387ccd768277c17dab1b7a5027c0b3cf', + '178e21ad2e77ae06711549cfbb1f9c7a9d8096e8', + '5e1487f35515d02a92753504a8d75471b9f49edb', + '6fbebc898f403e4773e95feb15e80c9a99c8348d' + ] +} +``` -### Cross-Chain Messaging with the Wormhole Relayer SDK +### Submit VAAs -The `WormholeRelayerSDK.sol` contract simplifies cross-chain messaging and asset transfers by integrating several necessary modules, including the Wormhole relayer. By automating message delivery between chains, the Wormhole relayer removes the need for developers to manage relayer infrastructure or handle gas on the target chain. Delivery providers handle the message payload, ensuring secure and efficient communication. +Use `submit` to submit a VAA to a chain. It first parses the VAA and determines the destination chain and module. For example, a contract upgrade contains both the target chain and module, so the only required argument is the network moniker (`mainnet` or `testnet`): -You can refer to the [Wormhole relayer documentation](/docs/products/messaging/guides/wormhole-relayers/){target=\_blank} for more details. +```bash +worm submit $(cat my-nft-registration.txt) --network mainnet +``` -Key modules in the SDK include: +The script will ask you to specify the target chain for VAAs that don't have a specific target chain (like registrations or Guardian set upgrades). For example, to submit a Guardian set upgrade on all chains, simply run: - - **`Base.sol`** - the core module for cross-chain messaging. It provides utility functions like `onlyWormholeRelayer()` and `setRegisteredSender()`, ensuring that only messages from trusted relayers are processed +```bash +worm-fetch-governance 13940208096455381020 > guardian-upgrade.txt +worm submit $(cat guardian-upgrade.txt) --network mainnet --chain oasis +worm submit $(cat guardian-upgrade.txt) --network mainnet --chain aurora +worm submit $(cat guardian-upgrade.txt) --network mainnet --chain fantom +worm submit $(cat guardian-upgrade.txt) --network mainnet --chain karura +worm submit $(cat guardian-upgrade.txt) --network mainnet --chain acala +worm submit $(cat guardian-upgrade.txt) --network mainnet --chain klaytn +worm submit $(cat guardian-upgrade.txt) --network mainnet --chain avalanche +worm submit $(cat guardian-upgrade.txt) --network mainnet --chain polygon +worm submit $(cat guardian-upgrade.txt) --network mainnet --chain bsc +worm submit $(cat guardian-upgrade.txt) --network mainnet --chain solana +worm submit $(cat guardian-upgrade.txt) --network mainnet --chain terra +worm submit $(cat guardian-upgrade.txt) --network mainnet --chain ethereum +worm submit $(cat guardian-upgrade.txt) --network mainnet --chain celo +``` - - **`TokenBase.sol`** - this module extends the base messaging functionality to support cross-chain token transfers. It includes utilities for securely sending and receiving tokens between EVM-compatible chains +The VAA payload type (Guardian set upgrade) specifies that this VAA should go to the core bridge, and the tool directs it there. - - **`CCTPBase.sol`** - designed for Circle’s Cross-Chain Transfer Protocol, this module manages asset transfers such as USDC between chains. It includes functionalities for both sending and receiving CCTP-based assets +### Fetch Contract Information - - **`CCTPAndTokenBase.sol`** - a combined module that supports token and CCTP-based asset transfers in a single implementation. This module simplifies development for applications needing to handle both types of transfers +To get info about a contract (only EVM supported at this time), use the following command: -The Wormhole Solidity SDK offers a unified framework for cross-chain communication. Developers can select specific modules based on their application’s requirements, whether for messaging, token transfers, or CCTP. Each module includes built-in security measures, ensuring that only authorized senders or relayers are accepted, thereby protecting the application from unauthorized interactions. +```bash +worm evm info -c bsc -n mainnet -m TokenBridge +``` -Please refer to the complete `WormholeRelayerSDK.sol` file below for further details. +Running this command generates the following output: -???- code "`WormholeRelayerSDK.sol`" - ```solidity - // SPDX-License-Identifier: Apache 2 -pragma solidity ^0.8.19; +```bash +{ + "address": "0xB6F6D86a8f9879A9c87f643768d9efc38c1Da6E7", + "wormhole": "0x98f3c9e6E3fAce36bAAd05FE09d375Ef1464288B", + "implementation": "0x621199f6beB2ba6fbD962E8A52A320EA4F6D4aA3", + "isInitialized": true, + "tokenImplementation": "0x7f8C5e730121657E17E452c5a1bA3fA1eF96f22a", + "chainId": 4, + "finality": 15, + "evmChainId": "56", + "isFork": false, + "governanceChainId": 1, + "governanceContract": "0x0000000000000000000000000000000000000000000000000000000000000004", + "WETH": "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", + "registrations": { + "Solana": "0xec7372995d5cc8732397fb0ad35c0121e0eaa90d26f828a534cab54391b3a4f5", + "Ethereum": "0x0000000000000000000000003ee18b2214aff97000d974cf647e7c347e8fa585", + "Terra": "0x0000000000000000000000007cf7b764e38a0a5e967972c1df77d432510564e2", + "Polygon": "0x0000000000000000000000005a58505a96d1dbf8df91cb21b54419fc36e93fde", + "Avalanche": "0x0000000000000000000000000e082f06ff657d94310cb8ce8b0d9a04541d8052", + "Oasis": "0x0000000000000000000000005848c791e09901b40a9ef749f2a6735b418d7564", + "Algorand": "0x67e93fa6c8ac5c819990aa7340c0c16b508abb1178be9b30d024b8ac25193d45", + "Aurora": "0x00000000000000000000000051b5123a7b0f9b2ba265f9c4c8de7d78d52f510f", + "Fantom": "0x0000000000000000000000007c9fc5741288cdfdd83ceb07f3ea7e22618d79d2", + "Karura": "0x000000000000000000000000ae9d7fe007b3327aa64a32824aaac52c42a6e624", + "Acala": "0x000000000000000000000000ae9d7fe007b3327aa64a32824aaac52c42a6e624", + "Klaytn": "0x0000000000000000000000005b08ac39eaed75c0439fc750d9fe7e1f9dd0193f", + "Celo": "0x000000000000000000000000796dff6d74f3e27060b71255fe517bfb23c93eed", + "Near": "0x148410499d3fcda4dcfd68a1ebfcdddda16ab28326448d4aae4d2f0465cdfcb7", + "Moonbeam": "0x000000000000000000000000b1731c586ca89a23809861c6103f0b96b3f57d92", + "Neon": "0x0000000000000000000000000000000000000000000000000000000000000000", + "Terra2": "0xa463ad028fb79679cfc8ce1efba35ac0e77b35080a1abe9bebe83461f176b0a3", + "Injective": "0x00000000000000000000000045dbea4617971d93188eda21530bc6503d153313", + "Osmosis": "0x0000000000000000000000000000000000000000000000000000000000000000", + "Sui": "0xccceeb29348f71bdd22ffef43a2a19c1f5b5e17c5cca5411529120182672ade5", + "Aptos": "0x0000000000000000000000000000000000000000000000000000000000000001", + "Arbitrum": "0x0000000000000000000000000b2402144bb366a632d14b83f244d2e0e21bd39c", + "Optimism": "0x0000000000000000000000001d68124e65fafc907325e3edbf8c4d84499daa8b", + "Gnosis": "0x0000000000000000000000000000000000000000000000000000000000000000", + "Pythnet": "0x0000000000000000000000000000000000000000000000000000000000000000", + "Xpla": "0x8f9cf727175353b17a5f574270e370776123d90fd74956ae4277962b4fdee24c", + "Btc": "0x0000000000000000000000000000000000000000000000000000000000000000", + "Base": "0x0000000000000000000000008d2de8d2f73f1f4cab472ac9a881c9b123c79627", + "Sei": "0x86c5fd957e2db8389553e1728f9c27964b22a8154091ccba54d75f4b10c61f5e", + "Rootstock": "0x0000000000000000000000000000000000000000000000000000000000000000", + "Scroll": "0x00000000000000000000000024850c6f61c438823f01b7a3bf2b89b72174fa9d", + "Mantle": "0x00000000000000000000000024850c6f61c438823f01b7a3bf2b89b72174fa9d", + "Blast": "0x00000000000000000000000024850c6f61c438823f01b7a3bf2b89b72174fa9d", + "Xlayer": "0x0000000000000000000000005537857664b0f9efe38c9f320f75fef23234d904", + "Linea": "0x0000000000000000000000000000000000000000000000000000000000000000", + "Berachain": "0x0000000000000000000000000000000000000000000000000000000000000000", + "Seievm": "0x0000000000000000000000000000000000000000000000000000000000000000", + "Snaxchain": "0x0000000000000000000000000000000000000000000000000000000000000000", + "Wormchain": "0xaeb534c45c3049d380b9d9b966f9895f53abd4301bfaff407fa09dea8ae7a924", + "Cosmoshub": "0x0000000000000000000000000000000000000000000000000000000000000000", + "Evmos": "0x0000000000000000000000000000000000000000000000000000000000000000", + "Kujira": "0x0000000000000000000000000000000000000000000000000000000000000000", + "Neutron": "0x0000000000000000000000000000000000000000000000000000000000000000", + "Celestia": "0x0000000000000000000000000000000000000000000000000000000000000000", + "Stargaze": "0x0000000000000000000000000000000000000000000000000000000000000000", + "Seda": "0x0000000000000000000000000000000000000000000000000000000000000000", + "Dymension": "0x0000000000000000000000000000000000000000000000000000000000000000", + "Provenance": "0x0000000000000000000000000000000000000000000000000000000000000000", + "Sepolia": "0x0000000000000000000000000000000000000000000000000000000000000000", + "ArbitrumSepolia": "0x0000000000000000000000000000000000000000000000000000000000000000", + "BaseSepolia": "0x0000000000000000000000000000000000000000000000000000000000000000", + "OptimismSepolia": "0x0000000000000000000000000000000000000000000000000000000000000000", + "Holesky": "0x0000000000000000000000000000000000000000000000000000000000000000", + "PolygonSepolia": "0x0000000000000000000000000000000000000000000000000000000000000000" + } +} +``` -import "wormhole-sdk/interfaces/IWormholeReceiver.sol"; -import "wormhole-sdk/interfaces/IWormholeRelayer.sol"; -import "wormhole-sdk/constants/Chains.sol"; -import "wormhole-sdk/Utils.sol"; +You can get the contract address for a module as follows: -import {Base} from "wormhole-sdk/WormholeRelayer/Base.sol"; -import {TokenBase, TokenReceiver, TokenSender} from "wormhole-sdk/WormholeRelayer/TokenBase.sol"; -import {CCTPBase, CCTPReceiver, CCTPSender} from "wormhole-sdk/WormholeRelayer/CCTPBase.sol"; -import {CCTPAndTokenBase, CCTPAndTokenReceiver, CCTPAndTokenSender} from "wormhole-sdk/WormholeRelayer/CCTPAndTokenBase.sol"; - ``` +```bash +worm info rpc INSERT_NETWORK INSERT_CHAIN INSERT_MODULE +``` -### Base Contract Overview +To get the contract address for `NFTBridge` on BSC Mainnet, for example, you can provide the following command: -The `Base.sol` contract is a core part of the Wormhole Solidity SDK, providing essential helper functions and modifiers for managing cross-chain messages securely via the Wormhole Relayer. It handles sender registration and message validation, ensuring only authorized senders from specific chains can send messages. +```bash +worm info contract mainnet bsc NFTBridge +``` - - **`onlyWormholeRelayer()`** - a modifier that ensures only authorized messages from the Wormhole relayer contract are processed, restricting access to certain functions +### Fetch Chain Information - ```solidity - require( - msg.sender == address(wormholeRelayer), - "Msg.sender is not Wormhole Relayer" - ); - _; - } - ``` +You can get the RPC address for a chain as follows: - - **`setRegisteredSender()`** - restricts message acceptance to a registered sender from a specific chain, ensuring messages are only processed from trusted sources +```bash +worm info rpc INSERT_NETWORK INSERT_CHAIN +``` - ```solidity - uint16 sourceChain, - bytes32 sourceAddress - ) public { - require( - msg.sender == registrationOwner, - "Not allowed to set registered sender" - ); - registeredSenders[sourceChain] = sourceAddress; - } - ``` +To get the RPC address for BSC Mainnet, for example, you can provide the following command: -These security measures ensure messages come from the correct source and are processed securely. Please refer to the complete `Base.sol` contract below for further details. +```bash +worm info rpc mainnet bsc +``` +--- END CONTENT --- -???- code "`Base.sol`" - ```solidity - // SPDX-License-Identifier: Apache 2 -pragma solidity ^0.8.19; +Doc-Content: https://wormhole.com/docs/tools/dev-env/ +--- BEGIN CONTENT --- +--- +title: Local Dev Environment +description: Learn how to configure a development environment to build with Wormhole, including using the CLI, local validators, testing on public test networks, and more. +categories: Solidity-SDK, Typescript-SDK +--- -import "wormhole-sdk/interfaces/IWormholeReceiver.sol"; -import "wormhole-sdk/interfaces/IWormholeRelayer.sol"; -import "wormhole-sdk/interfaces/IWormhole.sol"; -import "wormhole-sdk/Utils.sol"; +# Development Environment -abstract contract Base { - IWormholeRelayer public immutable wormholeRelayer; - IWormhole public immutable wormhole; +Developers building for smart contract integration will want to set up a development environment to allow testing the full integration, possibly including VAA generation and relaying. - address registrationOwner; - mapping(uint16 => bytes32) registeredSenders; +## Tooling Installation - constructor(address _wormholeRelayer, address _wormhole) { - wormholeRelayer = IWormholeRelayer(_wormholeRelayer); - wormhole = IWormhole(_wormhole); - registrationOwner = msg.sender; - } +The [Wormhole CLI Tool](/docs/tools/cli/get-started/){target=\_blank} should be installed regardless of the environments chosen. Each environment has its own set of recommended tools. To begin working with a specific environment, see the recommended tools on the respective [environment page](/docs/products/reference/supported-networks/){target=\_blank}. - modifier onlyWormholeRelayer() { - require( - msg.sender == address(wormholeRelayer), - "Msg.sender is not Wormhole Relayer" - ); - _; - } +## Development Stages - modifier isRegisteredSender(uint16 sourceChain, bytes32 sourceAddress) { - require( - registeredSenders[sourceChain] == sourceAddress, - "Not registered sender" - ); - _; - } +Different approaches to development and testing are recommended at various stages of application development. - /** - * Sets the registered address for 'sourceChain' to 'sourceAddress' - * So that for messages from 'sourceChain', only ones from 'sourceAddress' are valid - * - * Assumes only one sender per chain is valid - * Sender is the address that called 'send' on the Wormhole Relayer contract on the source chain) - */ - function setRegisteredSender( - uint16 sourceChain, - bytes32 sourceAddress - ) public { - require( - msg.sender == registrationOwner, - "Not allowed to set registered sender" - ); - registeredSenders[sourceChain] = sourceAddress; - } -} - ``` +### Initial Development -### Interface for Cross-Chain Messages +During the initial development of an on-chain application, the best option is to use the native tools available in the environment. You can visit the following resources for more information: -The Wormhole Solidity SDK interacts with the Wormhole relayer for sending and receiving messages across EVM-compatible chains. The [`IWormholeRelayer`](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/main/src/interfaces/IWormholeRelayer.sol){target=\_blank} includes several interfaces that are central to cross-chain communication, enabling secure and efficient message delivery. +- **[Environment](https://github.com/wormhole-foundation/wormhole){target=\_blank}** - select the folder for the desired network to learn about the recommended native toolset +- **[Mock Guardian](https://github.com/wormhole-foundation/wormhole/blob/main/sdk/js/src/mock/wormhole.ts){target=\_blank}** - it's recommended to set up a mock Guardian or Emitter to provide signed VAAsFor any program methods that require some message be sent or received. +- **[Wormhole Scaffolding repository](https://github.com/wormhole-foundation/wormhole-scaffolding/blob/main/evm/ts-test/01_hello_world.ts){target=\_blank}** - example mock Guardian test -For detailed information on how to implement these interfaces, refer to the [Wormhole Relayer Interfaces documentation](/docs/products/messaging/guides/wormhole-relayers/#wormhole-relayer-interfaces){target=\_blank}. This section covers: +Relying on native tools when possible allows for more rapid prototyping and iteration. - - **`IWormholeRelayer`** – methods for sending cross-chain messages, VAAs, and token transfers - - **`IWormholeReceiver`** – the required implementation for receiving cross-chain messages - - **`quoteEVMDeliveryPrice()`** – how to estimate gas and fees for cross-chain transactions +### Integration -These interfaces reduce the complexity of cross-chain dApp development by abstracting away the details of relayer infrastructure, ensuring that message delivery is handled efficiently. +For integration to Wormhole and with multiple chains, the simplest option is to use the chains' Testnets. In choosing which chains to use for integration testing, consider which chains in a given environment provide easy access to Testnet tokens and where block times are fast. Find links for Testnet faucets in the [blockchain details section](/docs/products/reference/supported-networks/){target=\_blank}. A developer may prefer standing up a set of local validators instead of using the Testnet. For this option, [Tilt](https://github.com/wormhole-foundation/wormhole/blob/main/DEVELOP.md){target=\_blank} is available to run local instances of all the chains Wormhole supports. -### Advanced Concepts +!!! note + Variation in host environments causes unique issues, and the computational intensity of multiple simultaneous local validators can make setting them up difficult or time-consuming. You may prefer Testnets for the simplest integration testing. -For developers interested in exploring additional advanced topics, the following sections provide insights into key aspects of the SDK’s functionality. +### Prepare for Deployment -???- note "Error Handling and Reverts" - The SDK defines several custom errors to help developers handle common issues like incorrect gas fees, invalid senders, and more. For example, `InvalidMsgValue` is thrown when the message value for a relayed message is erroneous. +Once you've finished the application's initial development and performed integration testing, you should set up a CI test environment. The best option for that is likely to be [Tilt](https://tilt.dev/){target=\_blank} since it allows you to spin up any chains supported by Wormhole in a consistent environment. - ```solidity - error InvalidMsgValue(uint256 msgValue, uint256 totalFee); - ``` +## Validator Setup with Tilt -## Usage +### Tilt +If you'd like to set up a local validator environment, follow the setup guide for Tilt. Tilt is a full-fledged Kubernetes deployment of every chain connected to Wormhole, along with a Guardian node. It usually takes 30 minutes to spin up fully, but it comes with all chains running out of the box. Refer to the [Tilt](https://github.com/wormhole-foundation/wormhole/blob/main/DEVELOP.md){target=\_blank} page for a complete guide to setting up and configuring Tilt. -This section covers cross-chain messaging and token transfers and shows how to use the Wormhole Solidity SDK in real-world scenarios. +## Deploying to Public Networks -### Send a Cross-Chain Message +### Testnet -To send a cross-chain message, inherit from the base contract provided by the SDK and use its helper methods to define your message and sender address. Here’s a basic example: +When doing integration testing on Testnets, remember that a single Guardian node is watching for transactions on various test networks. Because Testnets only have a single Guardian, there's a slight chance that your VAAs won't be processed. This rate doesn't indicate performance on Mainnet, where 19 Guardians are watching for transactions. The Testnet contract addresses are available on the page for each [environment](/docs/products/reference/supported-networks/){target=\_blank}. The [Wormholescan API](https://docs.wormholescan.io){target=\_blank} offers the following Guardian equivalent Testnet endpoint: -```solidity -pragma solidity ^0.8.19; +```text +https://api.testnet.wormholescan.io +``` -import "@wormhole-foundation/wormhole-solidity-sdk/src/WormholeRelayer/Base.sol"; +### Mainnet -contract CrossChainSender is Base { - constructor( - address _wormholeRelayer, - address _wormhole - ) Base(_wormholeRelayer, _wormhole) {} +The Mainnet contract addresses are available on the page for each [environment](/docs/products/reference/supported-networks/){target=\_blank}. The [Wormholescan API](https://docs.wormholescan.io){target=\_blank} offers the following Guardian equivalent Mainnet endpoint: - function sendMessage( - bytes memory message, - uint16 targetChain, - bytes32 targetAddress - ) external payable { - // Register sender and send message through WormholeRelayer - setRegisteredSender(targetChain, msg.sender); - onlyWormholeRelayer().sendPayloadToEvm( - targetChain, - address(targetAddress), - message, - 0, - 500_000 - ); - } -} +```text +https://api.wormholescan.io ``` +--- END CONTENT --- -This contract extends `Base.sol` and allows sending cross-chain messages securely using the `WormholeRelayer`. - -### Send Tokens Across Chains +Doc-Content: https://wormhole.com/docs/tools/faqs/ +--- BEGIN CONTENT --- +--- +title: Toolkit FAQs +description: FAQs on Wormhole Toolkit, covering Wormholescan, CLI, SDKs (TypeScript, Solidity), Tilt, error handling, transaction history, and manual VAA submission. +categories: Solidity-SDK, Typescript-SDK +--- -The SDK enables seamless token transfers between EVM-compatible chains in addition to sending messages. To facilitate cross-chain token transfers, you can extend the SDK's `TokenSender` and `TokenReceiver` base contracts. +# Toolkit FAQs -```solidity -pragma solidity ^0.8.19; +## Why does the `toNative` function in the TypeScript SDK return an error? -import "@wormhole-foundation/wormhole-solidity-sdk/src/WormholeRelayer/TokenBase.sol"; +The `toNative` function may return an error if the platform-specific module (such as Solana or EVM) is not correctly imported or passed into the Wormhole constructor. -contract CrossChainTokenSender is TokenSender { - constructor( - address _wormholeRelayer, - address _wormhole - ) TokenSender(_wormholeRelayer, _wormhole) {} +To fix this, ensure the relevant platform module is imported and included when initializing Wormhole. For example, if you're working with Solana, make sure to import the Solana module and pass it into the Wormhole constructor like this: - function sendToken( - address token, - uint256 amount, - uint16 targetChain, - bytes32 targetAddress - ) external payable { - // Send tokens across chains - transferTokenToTarget(token, amount, targetChain, targetAddress); - } -} +```typescript +import solana from '@wormhole-foundation/sdk/solana'; +const wh = await wormhole('Testnet', [solana]); ``` -In this example, `TokenSender` initiates a token transfer to another chain. The SDK’s built-in utilities securely handle token transfers, ensuring proper VAAs are generated and processed. +## How can I retrieve the history of previously bridged transactions? -### Receive Tokens Across Chains +To retrieve the history of previously bridged transactions, you can use the Wormholescan API. Use the following endpoint to query the transaction history for a specific address: -To receive tokens on the target chain, implement a contract that inherits from `TokenReceiver` and overrides the `receiveWormholeMessages` function. +```bash +https://api.wormholescan.io/api/v1/operations?address=INSERT_ADDRESS +``` -```solidity -pragma solidity ^0.8.19; +Simply replace `INSERT_ADDRESS_HERE` with the address you want to query. The API will return a list of operations, including details about previously bridged transactions. -import "@wormhole-foundation/wormhole-solidity-sdk/src/WormholeRelayer/TokenBase.sol"; +???- example "Fetch transaction history for a specific address" + ```bash + curl -X GET "https://api.wormholescan.io/api/v1/operations?address=0x05c009C4C1F1983d4B915C145F4E782de23d3A38" -H "accept: application/json" + ``` -contract CrossChainTokenReceiver is TokenReceiver { - constructor( - address _wormholeRelayer, - address _wormhole - ) TokenReceiver(_wormholeRelayer, _wormhole) {} +## How can I manually submit a VAA to a destination chain in the correct format? - // Function to handle received tokens from another chain - function receiveWormholeMessages( - bytes memory payload, - bytes[] memory additionalMessages, - bytes32 sourceAddress, - uint16 sourceChain, - bytes32 deliveryHash - ) external payable override { - // Process the received tokens here - receiveTokens(payload); - } -} -``` +To manually submit a VAA (Verifiable Action Approval) to a destination chain, follow these steps: -In this example, `TokenReceiver` allows the contract to handle tokens sent from the source chain. Once the cross-chain message is received, the `receiveWormholeMessages` function processes the incoming tokens. Always validate the message's authenticity and source. +1. **Obtain the VAA in Base64 format** - navigate to the **Advanced** tab in [Wormholescan](https://wormholescan.io/){target=\_blank} to find the VAA associated with the transaction you want to submit and copy the VAA in base64 format -!!! note - Always verify the source of incoming messages and tokens to prevent unauthorized access to your contract. Please refer to the [Emitter Verification](/docs/products/messaging/guides/core-contracts/#validating-the-emitter/){target=\_blank} section for more details. + ```bash + https://wormholescan.io/#/tx/INSERT_TX_HASH?view=advanced + ``` -## Testing Environment +2. **Convert the VAA to hex** - you must convert the base64 VAA into a hexadecimal (hex) format before submitting it to the destination chain. This can be done using various online tools or via command-line utilities like `xxd` or a script in a language like Python -The SDK includes built-in support for Forge-based testing, which allows you to test your cross-chain applications locally before deploying them to production. Testing with the same Solidity compiler version and configuration you plan to use in production is highly recommended to catch any potential issues early. +3. **Submit the VAA through Etherscan (for EVM chains)** - once the VAA is in hex format, go to the [Etherscan UI](https://etherscan.io/){target=\_blank} and submit it through the [`TokenBridge`](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/main/src/interfaces/ITokenBridge.sol){target=\_blank} contract’s method (such as the `CompleteTransfer` function or `CompleteTransferWithPayload`) -For a detailed example, check out the below repositories: + - The `TokenBridge` contract addresses for each chain are available in the [Wormhole contract addresses](/docs/products/reference/contract-addresses/){target=\_blank} section - - [Cross chain messaging](/docs/products/messaging/tutorials/cross-chain-contracts/){target=\_blank} - - [Cross chain token transfer](/docs/products/messaging/tutorials/cross-chain-token-contracts/){target=\_blank} + - Interact with the smart contract through the Etherscan UI by pasting the hex-encoded VAA into the appropriate field + +Following these steps, you can manually submit a VAA in the proper format to a destination chain. --- END CONTENT --- Doc-Content: https://wormhole.com/docs/tools/typescript-sdk/get-started/ diff --git a/llms.txt b/llms.txt index b96b1956f..3c2fa636c 100644 --- a/llms.txt +++ b/llms.txt @@ -87,11 +87,11 @@ - [VAAs](https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/protocol/infrastructure/vaas.md): Learn about Verified Action Approvals (VAAs) in Wormhole, their structure, validation, and role in cross-chain communication. - [Introduction to Wormhole](https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/protocol/introduction.md): Wormhole is a protocol for seamless communication between blockchains, enabling cross-chain applications and integrations. - [Security](https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/protocol/security.md): Explore Wormhole's security features, including the Guardian network, governance, monitoring, open-source development, and bug bounty programs. +- [Get Started with the Solidity SDK](https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/tools/.solidity-sdk/.get-started.md): Follow this guide to use the Wormhole Solidity SDK's interfaces and tools to help you quickly build on-chain integrations using smart contracts. +- [Solidity SDK](https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/tools/.solidity-sdk/.sdk-reference.md): How to use the Wormhole Solidity SDK for cross-chain messaging, token transfers, and integrating decentralized applications on EVM-compatible blockchains. - [Wormhole CLI](https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/tools/cli/get-started.md): Learn how to install and use the Wormhole CLI, including commands and examples for managing multichain deployments, generating VAAs, and querying contract info. - [Local Dev Environment](https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/tools/dev-env.md): Learn how to configure a development environment to build with Wormhole, including using the CLI, local validators, testing on public test networks, and more. - [Toolkit FAQs](https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/tools/faqs.md): FAQs on Wormhole Toolkit, covering Wormholescan, CLI, SDKs (TypeScript, Solidity), Tilt, error handling, transaction history, and manual VAA submission. -- [Get Started with the Solidity SDK](https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/tools/solidity-sdk/get-started.md): Follow this guide to use the Wormhole Solidity SDK's interfaces and tools to help you quickly build on-chain integrations using smart contracts. -- [Solidity SDK](https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/tools/solidity-sdk/sdk-reference.md): How to use the Wormhole Solidity SDK for cross-chain messaging, token transfers, and integrating decentralized applications on EVM-compatible blockchains. - [Get Started with the TypeScript SDK](https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/tools/typescript-sdk/get-started.md): Follow this guide to install the Wormhole TypeScript SDK, initialize a Wormhole instance, and add the platforms your integration supports. - [Building Protocols and Payloads](https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/tools/typescript-sdk/guides/protocols-payloads.md): Learn how to build, register, and integrate protocols and payloads in the Wormhole TypeScript SDK with type-safe layouts. - [Data Layouts](https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/tools/typescript-sdk/guides/sdk-layout.md): Learn how to efficiently define, serialize, and deserialize data structures using Wormhole SDK's layout system for cross-chain communication. From 7f820e27524250da8f176450dbd8b6664160d782 Mon Sep 17 00:00:00 2001 From: Ilaria Enache Date: Wed, 18 Jun 2025 13:25:32 +0200 Subject: [PATCH 3/6] remove also from ai resources --- ai-resources/ai-resources.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ai-resources/ai-resources.md b/ai-resources/ai-resources.md index 7cbb4a595..dc1783878 100644 --- a/ai-resources/ai-resources.md +++ b/ai-resources/ai-resources.md @@ -24,8 +24,11 @@ Each category file includes foundational content from the **Basics** and **Refer | Relayers | Guides and reference for using Wormhole’s Relayer module, building cross-chain messaging contracts, and running custom relayers | `llms-relayers.txt` | [:octicons-copy-16:](){ .llms action="copy" data-value="llms-relayers.txt" } [:octicons-download-16:](/docs/llms-files/llms-relayers.txt){ download="llms-relayers.txt" } | | MultiGov | Architecture, deployment steps, and upgrade instructions for multichain governance on EVM and Solana | `llms-multigov.txt` | [:octicons-copy-16:](){ .llms action="copy" data-value="llms-multigov.txt" } [:octicons-download-16:](/docs/llms-files/llms-multigov.txt){ download="llms-multigov.txt" } | | Queries | Guides for using the Wormhole Query SDK and Proxy to construct, test, and verify on-chain data queries across chains | `llms-queries.txt` | [:octicons-copy-16:](){ .llms action="copy" data-value="llms-queries.txt" } [:octicons-download-16:](/docs/llms-files/llms-queries.txt){ download="llms-queries.txt" } | -| Solidity SDK | SDK docs for cross-chain messaging, token transfers, relayer integration, and local testing in Solidity | `llms-solidity-sdk.txt` | [:octicons-copy-16:](){ .llms action="copy" data-value="llms-solidity-sdk.txt" } [:octicons-download-16:](/docs/llms-files/llms-solidity-sdk.txt){ download="llms-solidity-sdk.txt" } | | TypeScript SDK | Docs for working with VAAs, payloads, and cross-chain message structures using the TypeScript SDK | `llms-typescript-sdk.txt` | [:octicons-copy-16:](){ .llms action="copy" data-value="llms-typescript-sdk.txt" } [:octicons-download-16:](/docs/llms-files/llms-typescript-sdk.txt){ download="llms-typescript-sdk.txt" } | !!! note - The `llms-full.txt` file may exceed the input limits of some language models due to its size. If you encounter limitations, consider using the files by category. \ No newline at end of file + The `llms-full.txt` file may exceed the input limits of some language models due to its size. If you encounter limitations, consider using the files by category. + + \ No newline at end of file From 3ef56665b193ea451190bfc1da185a1c262aefe2 Mon Sep 17 00:00:00 2001 From: Ilaria Enache Date: Wed, 18 Jun 2025 13:25:44 +0200 Subject: [PATCH 4/6] llms check --- llms-full.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/llms-full.txt b/llms-full.txt index b7883efa3..b73642848 100644 --- a/llms-full.txt +++ b/llms-full.txt @@ -130,11 +130,14 @@ Each category file includes foundational content from the **Basics** and **Refer | Relayers | Guides and reference for using Wormhole’s Relayer module, building cross-chain messaging contracts, and running custom relayers | `llms-relayers.txt` | [:octicons-copy-16:](){ .llms action="copy" data-value="llms-relayers.txt" } [:octicons-download-16:](/docs/llms-files/llms-relayers.txt){ download="llms-relayers.txt" } | | MultiGov | Architecture, deployment steps, and upgrade instructions for multichain governance on EVM and Solana | `llms-multigov.txt` | [:octicons-copy-16:](){ .llms action="copy" data-value="llms-multigov.txt" } [:octicons-download-16:](/docs/llms-files/llms-multigov.txt){ download="llms-multigov.txt" } | | Queries | Guides for using the Wormhole Query SDK and Proxy to construct, test, and verify on-chain data queries across chains | `llms-queries.txt` | [:octicons-copy-16:](){ .llms action="copy" data-value="llms-queries.txt" } [:octicons-download-16:](/docs/llms-files/llms-queries.txt){ download="llms-queries.txt" } | -| Solidity SDK | SDK docs for cross-chain messaging, token transfers, relayer integration, and local testing in Solidity | `llms-solidity-sdk.txt` | [:octicons-copy-16:](){ .llms action="copy" data-value="llms-solidity-sdk.txt" } [:octicons-download-16:](/docs/llms-files/llms-solidity-sdk.txt){ download="llms-solidity-sdk.txt" } | | TypeScript SDK | Docs for working with VAAs, payloads, and cross-chain message structures using the TypeScript SDK | `llms-typescript-sdk.txt` | [:octicons-copy-16:](){ .llms action="copy" data-value="llms-typescript-sdk.txt" } [:octicons-download-16:](/docs/llms-files/llms-typescript-sdk.txt){ download="llms-typescript-sdk.txt" } | !!! note The `llms-full.txt` file may exceed the input limits of some language models due to its size. If you encounter limitations, consider using the files by category. + + --- END CONTENT --- Doc-Content: https://wormhole.com/docs/products/cctp-bridge/get-started/ From aaa21f183081a7e5a6e7c7b91edabacf06cf8d61 Mon Sep 17 00:00:00 2001 From: Ilaria Enache Date: Wed, 18 Jun 2025 13:32:12 +0200 Subject: [PATCH 5/6] comment solidity sdk links --- products/messaging/get-started.md | 3 ++- protocol/ecosystem.md | 2 +- protocol/introduction.md | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/products/messaging/get-started.md b/products/messaging/get-started.md index a6149e236..cdff5355f 100644 --- a/products/messaging/get-started.md +++ b/products/messaging/get-started.md @@ -97,4 +97,5 @@ Congratulations! You've published your first multichain message using Wormhole's ## Next Steps - [**Get Started with Token Bridge**](/docs/products/token-bridge/get-started/){target=\_blank}: Follow this guide to start working with multichain token transfers using Wormhole Token Bridge's lock and mint mechanism to send tokens across chains. -- [**Get Started with the Solidity SDK**](/docs/tools/solidity-sdk/get-started/){target=\_blank}: Smart contract developers can follow this on-chain integration guide to use Wormhole Solidity SDK-based sender and receiver contracts to send testnet USDC across chains. \ No newline at end of file + \ No newline at end of file diff --git a/protocol/ecosystem.md b/protocol/ecosystem.md index a1d62e7c6..b76ff378a 100644 --- a/protocol/ecosystem.md +++ b/protocol/ecosystem.md @@ -18,7 +18,7 @@ The diagram shows a high-level view of Wormhole’s modular stack, illustrating - **Application and user-facing products**: The top layer includes user-centric solutions such as [Connect](/docs/products/connect/overview/){target=\_blank} (a simple bridging interface) and the [NTT Launchpad](https://ntt.wormhole.com/){target=\_blank} (for streamlined native asset deployments). - **Asset and data transfer layer**: Below it sits the core bridging and data solutions—[NTT](/docs/products/native-token-transfers/overview/){target=\_blank}, [Token Bridge](/docs/products/token-bridge/overview/){target=\_blank}, [Queries](/docs/products/queries/overview/){target=\_blank}, [Settlement](/docs/products/settlement/overview/){target=\_blank}, and [MultiGov](/docs/products/multigov/overview/){target=\_blank}—that handle the movement of tokens, real-time data fetching, advanced cross-chain settlements, and cross-chain governance. -- **Integration layer**: The [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank}, [Solidity SDK](/docs/tools/solidity-sdk/get-started/){target=\_blank}, and [WormholeScan API](https://wormholescan.io/#/){target=\_blank} provide developer-friendly libraries and APIs to integrate cross-chain capabilities into applications. +- **Integration layer**: The [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank} and [WormholeScan API](https://wormholescan.io/#/){target=\_blank} provide developer-friendly libraries and APIs to integrate cross-chain capabilities into applications. - **Foundation layer**: At the base, the [Wormhole messaging](/docs/products/messaging/overview/){target=\_blank} system and the [core contracts](/docs/protocol/infrastructure/core-contracts/){target=\_blank} secure the entire network, providing essential verification and cross-chain message delivery. ![Wormhole ecosystem diagram](/docs/images/protocol/ecosystem/ecosystem-1.webp) diff --git a/protocol/introduction.md b/protocol/introduction.md index eb7385d05..35ebc3942 100644 --- a/protocol/introduction.md +++ b/protocol/introduction.md @@ -37,7 +37,7 @@ Wormhole provides a suite of tools and protocols that support a wide range of us - **Cross-chain messaging**: Securely transfer arbitrary data between blockchains, enabling the development of cross-chain decentralized applications. - **Asset transfers**: Facilitate the movement of tokens and NFTs across supported chains with ease, powered by protocols built on Wormhole like [Portal](https://portalbridge.com/){target=\_blank}. -- **Developer tools**: Leverage Wormhole’s [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank}, [Solidity SDK](/docs/tools/solidity-sdk/get-started/), [Wormholescan](https://wormholescan.io/){target=\_blank}, and the [Wormholescan API](https://wormholescan.io/#/developers/api-doc){target=\_blank} and documentation to build and deploy cross-chain applications quickly and efficiently. +- **Developer tools**: Leverage Wormhole’s [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank}, [Wormholescan](https://wormholescan.io/){target=\_blank}, and the [Wormholescan API](https://wormholescan.io/#/developers/api-doc){target=\_blank} and documentation to build and deploy cross-chain applications quickly and efficiently. ## What Isn't Wormhole? From 298269dd154aa1574a3f7c40e58485fc1c53e925 Mon Sep 17 00:00:00 2001 From: Ilaria Enache Date: Wed, 18 Jun 2025 13:32:40 +0200 Subject: [PATCH 6/6] llms check --- llms-files/llms-basics.txt | 7 ++++--- llms-files/llms-connect.txt | 7 ++++--- llms-files/llms-multigov.txt | 7 ++++--- llms-files/llms-ntt.txt | 7 ++++--- llms-files/llms-queries.txt | 7 ++++--- llms-files/llms-relayers.txt | 7 ++++--- llms-files/llms-settlement.txt | 7 ++++--- llms-files/llms-solidity-sdk.txt | 7 ++++--- llms-files/llms-token-bridge.txt | 7 ++++--- llms-files/llms-transfer.txt | 7 ++++--- llms-files/llms-typescript-sdk.txt | 10 ++++++---- llms-full.txt | 7 ++++--- 12 files changed, 50 insertions(+), 37 deletions(-) diff --git a/llms-files/llms-basics.txt b/llms-files/llms-basics.txt index c578ef157..0cd54d84b 100644 --- a/llms-files/llms-basics.txt +++ b/llms-files/llms-basics.txt @@ -328,7 +328,8 @@ Congratulations! You've published your first multichain message using Wormhole's ## Next Steps - [**Get Started with Token Bridge**](/docs/products/token-bridge/get-started/){target=\_blank}: Follow this guide to start working with multichain token transfers using Wormhole Token Bridge's lock and mint mechanism to send tokens across chains. -- [**Get Started with the Solidity SDK**](/docs/tools/solidity-sdk/get-started/){target=\_blank}: Smart contract developers can follow this on-chain integration guide to use Wormhole Solidity SDK-based sender and receiver contracts to send testnet USDC across chains. + --- END CONTENT --- Doc-Content: https://wormhole.com/docs/products/messaging/guides/core-contracts/ @@ -1216,7 +1217,7 @@ The diagram shows a high-level view of Wormhole’s modular stack, illustrating - **Application and user-facing products**: The top layer includes user-centric solutions such as [Connect](/docs/products/connect/overview/){target=\_blank} (a simple bridging interface) and the [NTT Launchpad](https://ntt.wormhole.com/){target=\_blank} (for streamlined native asset deployments). - **Asset and data transfer layer**: Below it sits the core bridging and data solutions—[NTT](/docs/products/native-token-transfers/overview/){target=\_blank}, [Token Bridge](/docs/products/token-bridge/overview/){target=\_blank}, [Queries](/docs/products/queries/overview/){target=\_blank}, [Settlement](/docs/products/settlement/overview/){target=\_blank}, and [MultiGov](/docs/products/multigov/overview/){target=\_blank}—that handle the movement of tokens, real-time data fetching, advanced cross-chain settlements, and cross-chain governance. -- **Integration layer**: The [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank}, [Solidity SDK](/docs/tools/solidity-sdk/get-started/){target=\_blank}, and [WormholeScan API](https://wormholescan.io/#/){target=\_blank} provide developer-friendly libraries and APIs to integrate cross-chain capabilities into applications. +- **Integration layer**: The [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank} and [WormholeScan API](https://wormholescan.io/#/){target=\_blank} provide developer-friendly libraries and APIs to integrate cross-chain capabilities into applications. - **Foundation layer**: At the base, the [Wormhole messaging](/docs/products/messaging/overview/){target=\_blank} system and the [core contracts](/docs/protocol/infrastructure/core-contracts/){target=\_blank} secure the entire network, providing essential verification and cross-chain message delivery. ![Wormhole ecosystem diagram](/docs/images/protocol/ecosystem/ecosystem-1.webp) @@ -1941,7 +1942,7 @@ Wormhole provides a suite of tools and protocols that support a wide range of us - **Cross-chain messaging**: Securely transfer arbitrary data between blockchains, enabling the development of cross-chain decentralized applications. - **Asset transfers**: Facilitate the movement of tokens and NFTs across supported chains with ease, powered by protocols built on Wormhole like [Portal](https://portalbridge.com/){target=\_blank}. -- **Developer tools**: Leverage Wormhole’s [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank}, [Solidity SDK](/docs/tools/solidity-sdk/get-started/), [Wormholescan](https://wormholescan.io/){target=\_blank}, and the [Wormholescan API](https://wormholescan.io/#/developers/api-doc){target=\_blank} and documentation to build and deploy cross-chain applications quickly and efficiently. +- **Developer tools**: Leverage Wormhole’s [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank}, [Wormholescan](https://wormholescan.io/){target=\_blank}, and the [Wormholescan API](https://wormholescan.io/#/developers/api-doc){target=\_blank} and documentation to build and deploy cross-chain applications quickly and efficiently. ## What Isn't Wormhole? diff --git a/llms-files/llms-connect.txt b/llms-files/llms-connect.txt index c46fe4da4..773ba8d64 100644 --- a/llms-files/llms-connect.txt +++ b/llms-files/llms-connect.txt @@ -2089,7 +2089,8 @@ Congratulations! You've published your first multichain message using Wormhole's ## Next Steps - [**Get Started with Token Bridge**](/docs/products/token-bridge/get-started/){target=\_blank}: Follow this guide to start working with multichain token transfers using Wormhole Token Bridge's lock and mint mechanism to send tokens across chains. -- [**Get Started with the Solidity SDK**](/docs/tools/solidity-sdk/get-started/){target=\_blank}: Smart contract developers can follow this on-chain integration guide to use Wormhole Solidity SDK-based sender and receiver contracts to send testnet USDC across chains. + --- END CONTENT --- Doc-Content: https://wormhole.com/docs/products/messaging/guides/core-contracts/ @@ -2977,7 +2978,7 @@ The diagram shows a high-level view of Wormhole’s modular stack, illustrating - **Application and user-facing products**: The top layer includes user-centric solutions such as [Connect](/docs/products/connect/overview/){target=\_blank} (a simple bridging interface) and the [NTT Launchpad](https://ntt.wormhole.com/){target=\_blank} (for streamlined native asset deployments). - **Asset and data transfer layer**: Below it sits the core bridging and data solutions—[NTT](/docs/products/native-token-transfers/overview/){target=\_blank}, [Token Bridge](/docs/products/token-bridge/overview/){target=\_blank}, [Queries](/docs/products/queries/overview/){target=\_blank}, [Settlement](/docs/products/settlement/overview/){target=\_blank}, and [MultiGov](/docs/products/multigov/overview/){target=\_blank}—that handle the movement of tokens, real-time data fetching, advanced cross-chain settlements, and cross-chain governance. -- **Integration layer**: The [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank}, [Solidity SDK](/docs/tools/solidity-sdk/get-started/){target=\_blank}, and [WormholeScan API](https://wormholescan.io/#/){target=\_blank} provide developer-friendly libraries and APIs to integrate cross-chain capabilities into applications. +- **Integration layer**: The [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank} and [WormholeScan API](https://wormholescan.io/#/){target=\_blank} provide developer-friendly libraries and APIs to integrate cross-chain capabilities into applications. - **Foundation layer**: At the base, the [Wormhole messaging](/docs/products/messaging/overview/){target=\_blank} system and the [core contracts](/docs/protocol/infrastructure/core-contracts/){target=\_blank} secure the entire network, providing essential verification and cross-chain message delivery. ![Wormhole ecosystem diagram](/docs/images/protocol/ecosystem/ecosystem-1.webp) @@ -3702,7 +3703,7 @@ Wormhole provides a suite of tools and protocols that support a wide range of us - **Cross-chain messaging**: Securely transfer arbitrary data between blockchains, enabling the development of cross-chain decentralized applications. - **Asset transfers**: Facilitate the movement of tokens and NFTs across supported chains with ease, powered by protocols built on Wormhole like [Portal](https://portalbridge.com/){target=\_blank}. -- **Developer tools**: Leverage Wormhole’s [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank}, [Solidity SDK](/docs/tools/solidity-sdk/get-started/), [Wormholescan](https://wormholescan.io/){target=\_blank}, and the [Wormholescan API](https://wormholescan.io/#/developers/api-doc){target=\_blank} and documentation to build and deploy cross-chain applications quickly and efficiently. +- **Developer tools**: Leverage Wormhole’s [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank}, [Wormholescan](https://wormholescan.io/){target=\_blank}, and the [Wormholescan API](https://wormholescan.io/#/developers/api-doc){target=\_blank} and documentation to build and deploy cross-chain applications quickly and efficiently. ## What Isn't Wormhole? diff --git a/llms-files/llms-multigov.txt b/llms-files/llms-multigov.txt index 40862e5f9..d9dd9d22e 100644 --- a/llms-files/llms-multigov.txt +++ b/llms-files/llms-multigov.txt @@ -1349,7 +1349,8 @@ Congratulations! You've published your first multichain message using Wormhole's ## Next Steps - [**Get Started with Token Bridge**](/docs/products/token-bridge/get-started/){target=\_blank}: Follow this guide to start working with multichain token transfers using Wormhole Token Bridge's lock and mint mechanism to send tokens across chains. -- [**Get Started with the Solidity SDK**](/docs/tools/solidity-sdk/get-started/){target=\_blank}: Smart contract developers can follow this on-chain integration guide to use Wormhole Solidity SDK-based sender and receiver contracts to send testnet USDC across chains. + --- END CONTENT --- Doc-Content: https://wormhole.com/docs/products/messaging/guides/core-contracts/ @@ -2237,7 +2238,7 @@ The diagram shows a high-level view of Wormhole’s modular stack, illustrating - **Application and user-facing products**: The top layer includes user-centric solutions such as [Connect](/docs/products/connect/overview/){target=\_blank} (a simple bridging interface) and the [NTT Launchpad](https://ntt.wormhole.com/){target=\_blank} (for streamlined native asset deployments). - **Asset and data transfer layer**: Below it sits the core bridging and data solutions—[NTT](/docs/products/native-token-transfers/overview/){target=\_blank}, [Token Bridge](/docs/products/token-bridge/overview/){target=\_blank}, [Queries](/docs/products/queries/overview/){target=\_blank}, [Settlement](/docs/products/settlement/overview/){target=\_blank}, and [MultiGov](/docs/products/multigov/overview/){target=\_blank}—that handle the movement of tokens, real-time data fetching, advanced cross-chain settlements, and cross-chain governance. -- **Integration layer**: The [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank}, [Solidity SDK](/docs/tools/solidity-sdk/get-started/){target=\_blank}, and [WormholeScan API](https://wormholescan.io/#/){target=\_blank} provide developer-friendly libraries and APIs to integrate cross-chain capabilities into applications. +- **Integration layer**: The [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank} and [WormholeScan API](https://wormholescan.io/#/){target=\_blank} provide developer-friendly libraries and APIs to integrate cross-chain capabilities into applications. - **Foundation layer**: At the base, the [Wormhole messaging](/docs/products/messaging/overview/){target=\_blank} system and the [core contracts](/docs/protocol/infrastructure/core-contracts/){target=\_blank} secure the entire network, providing essential verification and cross-chain message delivery. ![Wormhole ecosystem diagram](/docs/images/protocol/ecosystem/ecosystem-1.webp) @@ -2962,7 +2963,7 @@ Wormhole provides a suite of tools and protocols that support a wide range of us - **Cross-chain messaging**: Securely transfer arbitrary data between blockchains, enabling the development of cross-chain decentralized applications. - **Asset transfers**: Facilitate the movement of tokens and NFTs across supported chains with ease, powered by protocols built on Wormhole like [Portal](https://portalbridge.com/){target=\_blank}. -- **Developer tools**: Leverage Wormhole’s [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank}, [Solidity SDK](/docs/tools/solidity-sdk/get-started/), [Wormholescan](https://wormholescan.io/){target=\_blank}, and the [Wormholescan API](https://wormholescan.io/#/developers/api-doc){target=\_blank} and documentation to build and deploy cross-chain applications quickly and efficiently. +- **Developer tools**: Leverage Wormhole’s [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank}, [Wormholescan](https://wormholescan.io/){target=\_blank}, and the [Wormholescan API](https://wormholescan.io/#/developers/api-doc){target=\_blank} and documentation to build and deploy cross-chain applications quickly and efficiently. ## What Isn't Wormhole? diff --git a/llms-files/llms-ntt.txt b/llms-files/llms-ntt.txt index e00be022d..698ed21b9 100644 --- a/llms-files/llms-ntt.txt +++ b/llms-files/llms-ntt.txt @@ -2360,7 +2360,8 @@ Congratulations! You've published your first multichain message using Wormhole's ## Next Steps - [**Get Started with Token Bridge**](/docs/products/token-bridge/get-started/){target=\_blank}: Follow this guide to start working with multichain token transfers using Wormhole Token Bridge's lock and mint mechanism to send tokens across chains. -- [**Get Started with the Solidity SDK**](/docs/tools/solidity-sdk/get-started/){target=\_blank}: Smart contract developers can follow this on-chain integration guide to use Wormhole Solidity SDK-based sender and receiver contracts to send testnet USDC across chains. + --- END CONTENT --- Doc-Content: https://wormhole.com/docs/products/messaging/guides/core-contracts/ @@ -3248,7 +3249,7 @@ The diagram shows a high-level view of Wormhole’s modular stack, illustrating - **Application and user-facing products**: The top layer includes user-centric solutions such as [Connect](/docs/products/connect/overview/){target=\_blank} (a simple bridging interface) and the [NTT Launchpad](https://ntt.wormhole.com/){target=\_blank} (for streamlined native asset deployments). - **Asset and data transfer layer**: Below it sits the core bridging and data solutions—[NTT](/docs/products/native-token-transfers/overview/){target=\_blank}, [Token Bridge](/docs/products/token-bridge/overview/){target=\_blank}, [Queries](/docs/products/queries/overview/){target=\_blank}, [Settlement](/docs/products/settlement/overview/){target=\_blank}, and [MultiGov](/docs/products/multigov/overview/){target=\_blank}—that handle the movement of tokens, real-time data fetching, advanced cross-chain settlements, and cross-chain governance. -- **Integration layer**: The [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank}, [Solidity SDK](/docs/tools/solidity-sdk/get-started/){target=\_blank}, and [WormholeScan API](https://wormholescan.io/#/){target=\_blank} provide developer-friendly libraries and APIs to integrate cross-chain capabilities into applications. +- **Integration layer**: The [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank} and [WormholeScan API](https://wormholescan.io/#/){target=\_blank} provide developer-friendly libraries and APIs to integrate cross-chain capabilities into applications. - **Foundation layer**: At the base, the [Wormhole messaging](/docs/products/messaging/overview/){target=\_blank} system and the [core contracts](/docs/protocol/infrastructure/core-contracts/){target=\_blank} secure the entire network, providing essential verification and cross-chain message delivery. ![Wormhole ecosystem diagram](/docs/images/protocol/ecosystem/ecosystem-1.webp) @@ -3973,7 +3974,7 @@ Wormhole provides a suite of tools and protocols that support a wide range of us - **Cross-chain messaging**: Securely transfer arbitrary data between blockchains, enabling the development of cross-chain decentralized applications. - **Asset transfers**: Facilitate the movement of tokens and NFTs across supported chains with ease, powered by protocols built on Wormhole like [Portal](https://portalbridge.com/){target=\_blank}. -- **Developer tools**: Leverage Wormhole’s [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank}, [Solidity SDK](/docs/tools/solidity-sdk/get-started/), [Wormholescan](https://wormholescan.io/){target=\_blank}, and the [Wormholescan API](https://wormholescan.io/#/developers/api-doc){target=\_blank} and documentation to build and deploy cross-chain applications quickly and efficiently. +- **Developer tools**: Leverage Wormhole’s [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank}, [Wormholescan](https://wormholescan.io/){target=\_blank}, and the [Wormholescan API](https://wormholescan.io/#/developers/api-doc){target=\_blank} and documentation to build and deploy cross-chain applications quickly and efficiently. ## What Isn't Wormhole? diff --git a/llms-files/llms-queries.txt b/llms-files/llms-queries.txt index 41f39c79a..dc04e58ea 100644 --- a/llms-files/llms-queries.txt +++ b/llms-files/llms-queries.txt @@ -1115,7 +1115,8 @@ Congratulations! You've published your first multichain message using Wormhole's ## Next Steps - [**Get Started with Token Bridge**](/docs/products/token-bridge/get-started/){target=\_blank}: Follow this guide to start working with multichain token transfers using Wormhole Token Bridge's lock and mint mechanism to send tokens across chains. -- [**Get Started with the Solidity SDK**](/docs/tools/solidity-sdk/get-started/){target=\_blank}: Smart contract developers can follow this on-chain integration guide to use Wormhole Solidity SDK-based sender and receiver contracts to send testnet USDC across chains. + --- END CONTENT --- Doc-Content: https://wormhole.com/docs/products/messaging/guides/core-contracts/ @@ -2003,7 +2004,7 @@ The diagram shows a high-level view of Wormhole’s modular stack, illustrating - **Application and user-facing products**: The top layer includes user-centric solutions such as [Connect](/docs/products/connect/overview/){target=\_blank} (a simple bridging interface) and the [NTT Launchpad](https://ntt.wormhole.com/){target=\_blank} (for streamlined native asset deployments). - **Asset and data transfer layer**: Below it sits the core bridging and data solutions—[NTT](/docs/products/native-token-transfers/overview/){target=\_blank}, [Token Bridge](/docs/products/token-bridge/overview/){target=\_blank}, [Queries](/docs/products/queries/overview/){target=\_blank}, [Settlement](/docs/products/settlement/overview/){target=\_blank}, and [MultiGov](/docs/products/multigov/overview/){target=\_blank}—that handle the movement of tokens, real-time data fetching, advanced cross-chain settlements, and cross-chain governance. -- **Integration layer**: The [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank}, [Solidity SDK](/docs/tools/solidity-sdk/get-started/){target=\_blank}, and [WormholeScan API](https://wormholescan.io/#/){target=\_blank} provide developer-friendly libraries and APIs to integrate cross-chain capabilities into applications. +- **Integration layer**: The [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank} and [WormholeScan API](https://wormholescan.io/#/){target=\_blank} provide developer-friendly libraries and APIs to integrate cross-chain capabilities into applications. - **Foundation layer**: At the base, the [Wormhole messaging](/docs/products/messaging/overview/){target=\_blank} system and the [core contracts](/docs/protocol/infrastructure/core-contracts/){target=\_blank} secure the entire network, providing essential verification and cross-chain message delivery. ![Wormhole ecosystem diagram](/docs/images/protocol/ecosystem/ecosystem-1.webp) @@ -2728,7 +2729,7 @@ Wormhole provides a suite of tools and protocols that support a wide range of us - **Cross-chain messaging**: Securely transfer arbitrary data between blockchains, enabling the development of cross-chain decentralized applications. - **Asset transfers**: Facilitate the movement of tokens and NFTs across supported chains with ease, powered by protocols built on Wormhole like [Portal](https://portalbridge.com/){target=\_blank}. -- **Developer tools**: Leverage Wormhole’s [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank}, [Solidity SDK](/docs/tools/solidity-sdk/get-started/), [Wormholescan](https://wormholescan.io/){target=\_blank}, and the [Wormholescan API](https://wormholescan.io/#/developers/api-doc){target=\_blank} and documentation to build and deploy cross-chain applications quickly and efficiently. +- **Developer tools**: Leverage Wormhole’s [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank}, [Wormholescan](https://wormholescan.io/){target=\_blank}, and the [Wormholescan API](https://wormholescan.io/#/developers/api-doc){target=\_blank} and documentation to build and deploy cross-chain applications quickly and efficiently. ## What Isn't Wormhole? diff --git a/llms-files/llms-relayers.txt b/llms-files/llms-relayers.txt index 50115be7c..b175d1777 100644 --- a/llms-files/llms-relayers.txt +++ b/llms-files/llms-relayers.txt @@ -868,7 +868,8 @@ Congratulations! You've published your first multichain message using Wormhole's ## Next Steps - [**Get Started with Token Bridge**](/docs/products/token-bridge/get-started/){target=\_blank}: Follow this guide to start working with multichain token transfers using Wormhole Token Bridge's lock and mint mechanism to send tokens across chains. -- [**Get Started with the Solidity SDK**](/docs/tools/solidity-sdk/get-started/){target=\_blank}: Smart contract developers can follow this on-chain integration guide to use Wormhole Solidity SDK-based sender and receiver contracts to send testnet USDC across chains. + --- END CONTENT --- Doc-Content: https://wormhole.com/docs/products/messaging/guides/core-contracts/ @@ -1756,7 +1757,7 @@ The diagram shows a high-level view of Wormhole’s modular stack, illustrating - **Application and user-facing products**: The top layer includes user-centric solutions such as [Connect](/docs/products/connect/overview/){target=\_blank} (a simple bridging interface) and the [NTT Launchpad](https://ntt.wormhole.com/){target=\_blank} (for streamlined native asset deployments). - **Asset and data transfer layer**: Below it sits the core bridging and data solutions—[NTT](/docs/products/native-token-transfers/overview/){target=\_blank}, [Token Bridge](/docs/products/token-bridge/overview/){target=\_blank}, [Queries](/docs/products/queries/overview/){target=\_blank}, [Settlement](/docs/products/settlement/overview/){target=\_blank}, and [MultiGov](/docs/products/multigov/overview/){target=\_blank}—that handle the movement of tokens, real-time data fetching, advanced cross-chain settlements, and cross-chain governance. -- **Integration layer**: The [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank}, [Solidity SDK](/docs/tools/solidity-sdk/get-started/){target=\_blank}, and [WormholeScan API](https://wormholescan.io/#/){target=\_blank} provide developer-friendly libraries and APIs to integrate cross-chain capabilities into applications. +- **Integration layer**: The [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank} and [WormholeScan API](https://wormholescan.io/#/){target=\_blank} provide developer-friendly libraries and APIs to integrate cross-chain capabilities into applications. - **Foundation layer**: At the base, the [Wormhole messaging](/docs/products/messaging/overview/){target=\_blank} system and the [core contracts](/docs/protocol/infrastructure/core-contracts/){target=\_blank} secure the entire network, providing essential verification and cross-chain message delivery. ![Wormhole ecosystem diagram](/docs/images/protocol/ecosystem/ecosystem-1.webp) @@ -2481,7 +2482,7 @@ Wormhole provides a suite of tools and protocols that support a wide range of us - **Cross-chain messaging**: Securely transfer arbitrary data between blockchains, enabling the development of cross-chain decentralized applications. - **Asset transfers**: Facilitate the movement of tokens and NFTs across supported chains with ease, powered by protocols built on Wormhole like [Portal](https://portalbridge.com/){target=\_blank}. -- **Developer tools**: Leverage Wormhole’s [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank}, [Solidity SDK](/docs/tools/solidity-sdk/get-started/), [Wormholescan](https://wormholescan.io/){target=\_blank}, and the [Wormholescan API](https://wormholescan.io/#/developers/api-doc){target=\_blank} and documentation to build and deploy cross-chain applications quickly and efficiently. +- **Developer tools**: Leverage Wormhole’s [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank}, [Wormholescan](https://wormholescan.io/){target=\_blank}, and the [Wormholescan API](https://wormholescan.io/#/developers/api-doc){target=\_blank} and documentation to build and deploy cross-chain applications quickly and efficiently. ## What Isn't Wormhole? diff --git a/llms-files/llms-settlement.txt b/llms-files/llms-settlement.txt index a527fb19d..989e15212 100644 --- a/llms-files/llms-settlement.txt +++ b/llms-files/llms-settlement.txt @@ -821,7 +821,8 @@ Congratulations! You've published your first multichain message using Wormhole's ## Next Steps - [**Get Started with Token Bridge**](/docs/products/token-bridge/get-started/){target=\_blank}: Follow this guide to start working with multichain token transfers using Wormhole Token Bridge's lock and mint mechanism to send tokens across chains. -- [**Get Started with the Solidity SDK**](/docs/tools/solidity-sdk/get-started/){target=\_blank}: Smart contract developers can follow this on-chain integration guide to use Wormhole Solidity SDK-based sender and receiver contracts to send testnet USDC across chains. + --- END CONTENT --- Doc-Content: https://wormhole.com/docs/products/messaging/guides/core-contracts/ @@ -1709,7 +1710,7 @@ The diagram shows a high-level view of Wormhole’s modular stack, illustrating - **Application and user-facing products**: The top layer includes user-centric solutions such as [Connect](/docs/products/connect/overview/){target=\_blank} (a simple bridging interface) and the [NTT Launchpad](https://ntt.wormhole.com/){target=\_blank} (for streamlined native asset deployments). - **Asset and data transfer layer**: Below it sits the core bridging and data solutions—[NTT](/docs/products/native-token-transfers/overview/){target=\_blank}, [Token Bridge](/docs/products/token-bridge/overview/){target=\_blank}, [Queries](/docs/products/queries/overview/){target=\_blank}, [Settlement](/docs/products/settlement/overview/){target=\_blank}, and [MultiGov](/docs/products/multigov/overview/){target=\_blank}—that handle the movement of tokens, real-time data fetching, advanced cross-chain settlements, and cross-chain governance. -- **Integration layer**: The [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank}, [Solidity SDK](/docs/tools/solidity-sdk/get-started/){target=\_blank}, and [WormholeScan API](https://wormholescan.io/#/){target=\_blank} provide developer-friendly libraries and APIs to integrate cross-chain capabilities into applications. +- **Integration layer**: The [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank} and [WormholeScan API](https://wormholescan.io/#/){target=\_blank} provide developer-friendly libraries and APIs to integrate cross-chain capabilities into applications. - **Foundation layer**: At the base, the [Wormhole messaging](/docs/products/messaging/overview/){target=\_blank} system and the [core contracts](/docs/protocol/infrastructure/core-contracts/){target=\_blank} secure the entire network, providing essential verification and cross-chain message delivery. ![Wormhole ecosystem diagram](/docs/images/protocol/ecosystem/ecosystem-1.webp) @@ -2434,7 +2435,7 @@ Wormhole provides a suite of tools and protocols that support a wide range of us - **Cross-chain messaging**: Securely transfer arbitrary data between blockchains, enabling the development of cross-chain decentralized applications. - **Asset transfers**: Facilitate the movement of tokens and NFTs across supported chains with ease, powered by protocols built on Wormhole like [Portal](https://portalbridge.com/){target=\_blank}. -- **Developer tools**: Leverage Wormhole’s [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank}, [Solidity SDK](/docs/tools/solidity-sdk/get-started/), [Wormholescan](https://wormholescan.io/){target=\_blank}, and the [Wormholescan API](https://wormholescan.io/#/developers/api-doc){target=\_blank} and documentation to build and deploy cross-chain applications quickly and efficiently. +- **Developer tools**: Leverage Wormhole’s [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank}, [Wormholescan](https://wormholescan.io/){target=\_blank}, and the [Wormholescan API](https://wormholescan.io/#/developers/api-doc){target=\_blank} and documentation to build and deploy cross-chain applications quickly and efficiently. ## What Isn't Wormhole? diff --git a/llms-files/llms-solidity-sdk.txt b/llms-files/llms-solidity-sdk.txt index 897e2048a..8fe1ee666 100644 --- a/llms-files/llms-solidity-sdk.txt +++ b/llms-files/llms-solidity-sdk.txt @@ -1921,7 +1921,8 @@ Congratulations! You've published your first multichain message using Wormhole's ## Next Steps - [**Get Started with Token Bridge**](/docs/products/token-bridge/get-started/){target=\_blank}: Follow this guide to start working with multichain token transfers using Wormhole Token Bridge's lock and mint mechanism to send tokens across chains. -- [**Get Started with the Solidity SDK**](/docs/tools/solidity-sdk/get-started/){target=\_blank}: Smart contract developers can follow this on-chain integration guide to use Wormhole Solidity SDK-based sender and receiver contracts to send testnet USDC across chains. + --- END CONTENT --- Doc-Content: https://wormhole.com/docs/products/messaging/guides/core-contracts/ @@ -2809,7 +2810,7 @@ The diagram shows a high-level view of Wormhole’s modular stack, illustrating - **Application and user-facing products**: The top layer includes user-centric solutions such as [Connect](/docs/products/connect/overview/){target=\_blank} (a simple bridging interface) and the [NTT Launchpad](https://ntt.wormhole.com/){target=\_blank} (for streamlined native asset deployments). - **Asset and data transfer layer**: Below it sits the core bridging and data solutions—[NTT](/docs/products/native-token-transfers/overview/){target=\_blank}, [Token Bridge](/docs/products/token-bridge/overview/){target=\_blank}, [Queries](/docs/products/queries/overview/){target=\_blank}, [Settlement](/docs/products/settlement/overview/){target=\_blank}, and [MultiGov](/docs/products/multigov/overview/){target=\_blank}—that handle the movement of tokens, real-time data fetching, advanced cross-chain settlements, and cross-chain governance. -- **Integration layer**: The [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank}, [Solidity SDK](/docs/tools/solidity-sdk/get-started/){target=\_blank}, and [WormholeScan API](https://wormholescan.io/#/){target=\_blank} provide developer-friendly libraries and APIs to integrate cross-chain capabilities into applications. +- **Integration layer**: The [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank} and [WormholeScan API](https://wormholescan.io/#/){target=\_blank} provide developer-friendly libraries and APIs to integrate cross-chain capabilities into applications. - **Foundation layer**: At the base, the [Wormhole messaging](/docs/products/messaging/overview/){target=\_blank} system and the [core contracts](/docs/protocol/infrastructure/core-contracts/){target=\_blank} secure the entire network, providing essential verification and cross-chain message delivery. ![Wormhole ecosystem diagram](/docs/images/protocol/ecosystem/ecosystem-1.webp) @@ -3534,7 +3535,7 @@ Wormhole provides a suite of tools and protocols that support a wide range of us - **Cross-chain messaging**: Securely transfer arbitrary data between blockchains, enabling the development of cross-chain decentralized applications. - **Asset transfers**: Facilitate the movement of tokens and NFTs across supported chains with ease, powered by protocols built on Wormhole like [Portal](https://portalbridge.com/){target=\_blank}. -- **Developer tools**: Leverage Wormhole’s [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank}, [Solidity SDK](/docs/tools/solidity-sdk/get-started/), [Wormholescan](https://wormholescan.io/){target=\_blank}, and the [Wormholescan API](https://wormholescan.io/#/developers/api-doc){target=\_blank} and documentation to build and deploy cross-chain applications quickly and efficiently. +- **Developer tools**: Leverage Wormhole’s [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank}, [Wormholescan](https://wormholescan.io/){target=\_blank}, and the [Wormholescan API](https://wormholescan.io/#/developers/api-doc){target=\_blank} and documentation to build and deploy cross-chain applications quickly and efficiently. ## What Isn't Wormhole? diff --git a/llms-files/llms-token-bridge.txt b/llms-files/llms-token-bridge.txt index 3d09f9497..d26dc6cf1 100644 --- a/llms-files/llms-token-bridge.txt +++ b/llms-files/llms-token-bridge.txt @@ -1511,7 +1511,8 @@ Congratulations! You've published your first multichain message using Wormhole's ## Next Steps - [**Get Started with Token Bridge**](/docs/products/token-bridge/get-started/){target=\_blank}: Follow this guide to start working with multichain token transfers using Wormhole Token Bridge's lock and mint mechanism to send tokens across chains. -- [**Get Started with the Solidity SDK**](/docs/tools/solidity-sdk/get-started/){target=\_blank}: Smart contract developers can follow this on-chain integration guide to use Wormhole Solidity SDK-based sender and receiver contracts to send testnet USDC across chains. + --- END CONTENT --- Doc-Content: https://wormhole.com/docs/products/messaging/guides/core-contracts/ @@ -2399,7 +2400,7 @@ The diagram shows a high-level view of Wormhole’s modular stack, illustrating - **Application and user-facing products**: The top layer includes user-centric solutions such as [Connect](/docs/products/connect/overview/){target=\_blank} (a simple bridging interface) and the [NTT Launchpad](https://ntt.wormhole.com/){target=\_blank} (for streamlined native asset deployments). - **Asset and data transfer layer**: Below it sits the core bridging and data solutions—[NTT](/docs/products/native-token-transfers/overview/){target=\_blank}, [Token Bridge](/docs/products/token-bridge/overview/){target=\_blank}, [Queries](/docs/products/queries/overview/){target=\_blank}, [Settlement](/docs/products/settlement/overview/){target=\_blank}, and [MultiGov](/docs/products/multigov/overview/){target=\_blank}—that handle the movement of tokens, real-time data fetching, advanced cross-chain settlements, and cross-chain governance. -- **Integration layer**: The [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank}, [Solidity SDK](/docs/tools/solidity-sdk/get-started/){target=\_blank}, and [WormholeScan API](https://wormholescan.io/#/){target=\_blank} provide developer-friendly libraries and APIs to integrate cross-chain capabilities into applications. +- **Integration layer**: The [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank} and [WormholeScan API](https://wormholescan.io/#/){target=\_blank} provide developer-friendly libraries and APIs to integrate cross-chain capabilities into applications. - **Foundation layer**: At the base, the [Wormhole messaging](/docs/products/messaging/overview/){target=\_blank} system and the [core contracts](/docs/protocol/infrastructure/core-contracts/){target=\_blank} secure the entire network, providing essential verification and cross-chain message delivery. ![Wormhole ecosystem diagram](/docs/images/protocol/ecosystem/ecosystem-1.webp) @@ -3124,7 +3125,7 @@ Wormhole provides a suite of tools and protocols that support a wide range of us - **Cross-chain messaging**: Securely transfer arbitrary data between blockchains, enabling the development of cross-chain decentralized applications. - **Asset transfers**: Facilitate the movement of tokens and NFTs across supported chains with ease, powered by protocols built on Wormhole like [Portal](https://portalbridge.com/){target=\_blank}. -- **Developer tools**: Leverage Wormhole’s [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank}, [Solidity SDK](/docs/tools/solidity-sdk/get-started/), [Wormholescan](https://wormholescan.io/){target=\_blank}, and the [Wormholescan API](https://wormholescan.io/#/developers/api-doc){target=\_blank} and documentation to build and deploy cross-chain applications quickly and efficiently. +- **Developer tools**: Leverage Wormhole’s [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank}, [Wormholescan](https://wormholescan.io/){target=\_blank}, and the [Wormholescan API](https://wormholescan.io/#/developers/api-doc){target=\_blank} and documentation to build and deploy cross-chain applications quickly and efficiently. ## What Isn't Wormhole? diff --git a/llms-files/llms-transfer.txt b/llms-files/llms-transfer.txt index 779a7f57f..93c101ab3 100644 --- a/llms-files/llms-transfer.txt +++ b/llms-files/llms-transfer.txt @@ -8203,7 +8203,8 @@ Congratulations! You've published your first multichain message using Wormhole's ## Next Steps - [**Get Started with Token Bridge**](/docs/products/token-bridge/get-started/){target=\_blank}: Follow this guide to start working with multichain token transfers using Wormhole Token Bridge's lock and mint mechanism to send tokens across chains. -- [**Get Started with the Solidity SDK**](/docs/tools/solidity-sdk/get-started/){target=\_blank}: Smart contract developers can follow this on-chain integration guide to use Wormhole Solidity SDK-based sender and receiver contracts to send testnet USDC across chains. + --- END CONTENT --- Doc-Content: https://wormhole.com/docs/products/messaging/guides/core-contracts/ @@ -9091,7 +9092,7 @@ The diagram shows a high-level view of Wormhole’s modular stack, illustrating - **Application and user-facing products**: The top layer includes user-centric solutions such as [Connect](/docs/products/connect/overview/){target=\_blank} (a simple bridging interface) and the [NTT Launchpad](https://ntt.wormhole.com/){target=\_blank} (for streamlined native asset deployments). - **Asset and data transfer layer**: Below it sits the core bridging and data solutions—[NTT](/docs/products/native-token-transfers/overview/){target=\_blank}, [Token Bridge](/docs/products/token-bridge/overview/){target=\_blank}, [Queries](/docs/products/queries/overview/){target=\_blank}, [Settlement](/docs/products/settlement/overview/){target=\_blank}, and [MultiGov](/docs/products/multigov/overview/){target=\_blank}—that handle the movement of tokens, real-time data fetching, advanced cross-chain settlements, and cross-chain governance. -- **Integration layer**: The [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank}, [Solidity SDK](/docs/tools/solidity-sdk/get-started/){target=\_blank}, and [WormholeScan API](https://wormholescan.io/#/){target=\_blank} provide developer-friendly libraries and APIs to integrate cross-chain capabilities into applications. +- **Integration layer**: The [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank} and [WormholeScan API](https://wormholescan.io/#/){target=\_blank} provide developer-friendly libraries and APIs to integrate cross-chain capabilities into applications. - **Foundation layer**: At the base, the [Wormhole messaging](/docs/products/messaging/overview/){target=\_blank} system and the [core contracts](/docs/protocol/infrastructure/core-contracts/){target=\_blank} secure the entire network, providing essential verification and cross-chain message delivery. ![Wormhole ecosystem diagram](/docs/images/protocol/ecosystem/ecosystem-1.webp) @@ -9816,7 +9817,7 @@ Wormhole provides a suite of tools and protocols that support a wide range of us - **Cross-chain messaging**: Securely transfer arbitrary data between blockchains, enabling the development of cross-chain decentralized applications. - **Asset transfers**: Facilitate the movement of tokens and NFTs across supported chains with ease, powered by protocols built on Wormhole like [Portal](https://portalbridge.com/){target=\_blank}. -- **Developer tools**: Leverage Wormhole’s [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank}, [Solidity SDK](/docs/tools/solidity-sdk/get-started/), [Wormholescan](https://wormholescan.io/){target=\_blank}, and the [Wormholescan API](https://wormholescan.io/#/developers/api-doc){target=\_blank} and documentation to build and deploy cross-chain applications quickly and efficiently. +- **Developer tools**: Leverage Wormhole’s [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank}, [Wormholescan](https://wormholescan.io/){target=\_blank}, and the [Wormholescan API](https://wormholescan.io/#/developers/api-doc){target=\_blank} and documentation to build and deploy cross-chain applications quickly and efficiently. ## What Isn't Wormhole? diff --git a/llms-files/llms-typescript-sdk.txt b/llms-files/llms-typescript-sdk.txt index 7098e9900..a77915d1d 100644 --- a/llms-files/llms-typescript-sdk.txt +++ b/llms-files/llms-typescript-sdk.txt @@ -328,7 +328,8 @@ Congratulations! You've published your first multichain message using Wormhole's ## Next Steps - [**Get Started with Token Bridge**](/docs/products/token-bridge/get-started/){target=\_blank}: Follow this guide to start working with multichain token transfers using Wormhole Token Bridge's lock and mint mechanism to send tokens across chains. -- [**Get Started with the Solidity SDK**](/docs/tools/solidity-sdk/get-started/){target=\_blank}: Smart contract developers can follow this on-chain integration guide to use Wormhole Solidity SDK-based sender and receiver contracts to send testnet USDC across chains. + --- END CONTENT --- Doc-Content: https://wormhole.com/docs/tools/cli/get-started/ @@ -4162,7 +4163,8 @@ Congratulations! You've published your first multichain message using Wormhole's ## Next Steps - [**Get Started with Token Bridge**](/docs/products/token-bridge/get-started/){target=\_blank}: Follow this guide to start working with multichain token transfers using Wormhole Token Bridge's lock and mint mechanism to send tokens across chains. -- [**Get Started with the Solidity SDK**](/docs/tools/solidity-sdk/get-started/){target=\_blank}: Smart contract developers can follow this on-chain integration guide to use Wormhole Solidity SDK-based sender and receiver contracts to send testnet USDC across chains. + --- END CONTENT --- Doc-Content: https://wormhole.com/docs/products/messaging/guides/core-contracts/ @@ -5050,7 +5052,7 @@ The diagram shows a high-level view of Wormhole’s modular stack, illustrating - **Application and user-facing products**: The top layer includes user-centric solutions such as [Connect](/docs/products/connect/overview/){target=\_blank} (a simple bridging interface) and the [NTT Launchpad](https://ntt.wormhole.com/){target=\_blank} (for streamlined native asset deployments). - **Asset and data transfer layer**: Below it sits the core bridging and data solutions—[NTT](/docs/products/native-token-transfers/overview/){target=\_blank}, [Token Bridge](/docs/products/token-bridge/overview/){target=\_blank}, [Queries](/docs/products/queries/overview/){target=\_blank}, [Settlement](/docs/products/settlement/overview/){target=\_blank}, and [MultiGov](/docs/products/multigov/overview/){target=\_blank}—that handle the movement of tokens, real-time data fetching, advanced cross-chain settlements, and cross-chain governance. -- **Integration layer**: The [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank}, [Solidity SDK](/docs/tools/solidity-sdk/get-started/){target=\_blank}, and [WormholeScan API](https://wormholescan.io/#/){target=\_blank} provide developer-friendly libraries and APIs to integrate cross-chain capabilities into applications. +- **Integration layer**: The [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank} and [WormholeScan API](https://wormholescan.io/#/){target=\_blank} provide developer-friendly libraries and APIs to integrate cross-chain capabilities into applications. - **Foundation layer**: At the base, the [Wormhole messaging](/docs/products/messaging/overview/){target=\_blank} system and the [core contracts](/docs/protocol/infrastructure/core-contracts/){target=\_blank} secure the entire network, providing essential verification and cross-chain message delivery. ![Wormhole ecosystem diagram](/docs/images/protocol/ecosystem/ecosystem-1.webp) @@ -5775,7 +5777,7 @@ Wormhole provides a suite of tools and protocols that support a wide range of us - **Cross-chain messaging**: Securely transfer arbitrary data between blockchains, enabling the development of cross-chain decentralized applications. - **Asset transfers**: Facilitate the movement of tokens and NFTs across supported chains with ease, powered by protocols built on Wormhole like [Portal](https://portalbridge.com/){target=\_blank}. -- **Developer tools**: Leverage Wormhole’s [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank}, [Solidity SDK](/docs/tools/solidity-sdk/get-started/), [Wormholescan](https://wormholescan.io/){target=\_blank}, and the [Wormholescan API](https://wormholescan.io/#/developers/api-doc){target=\_blank} and documentation to build and deploy cross-chain applications quickly and efficiently. +- **Developer tools**: Leverage Wormhole’s [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank}, [Wormholescan](https://wormholescan.io/){target=\_blank}, and the [Wormholescan API](https://wormholescan.io/#/developers/api-doc){target=\_blank} and documentation to build and deploy cross-chain applications quickly and efficiently. ## What Isn't Wormhole? diff --git a/llms-full.txt b/llms-full.txt index b73642848..5f385fe86 100644 --- a/llms-full.txt +++ b/llms-full.txt @@ -6366,7 +6366,8 @@ Congratulations! You've published your first multichain message using Wormhole's ## Next Steps - [**Get Started with Token Bridge**](/docs/products/token-bridge/get-started/){target=\_blank}: Follow this guide to start working with multichain token transfers using Wormhole Token Bridge's lock and mint mechanism to send tokens across chains. -- [**Get Started with the Solidity SDK**](/docs/tools/solidity-sdk/get-started/){target=\_blank}: Smart contract developers can follow this on-chain integration guide to use Wormhole Solidity SDK-based sender and receiver contracts to send testnet USDC across chains. + --- END CONTENT --- Doc-Content: https://wormhole.com/docs/products/messaging/guides/core-contracts/ @@ -18164,7 +18165,7 @@ The diagram shows a high-level view of Wormhole’s modular stack, illustrating - **Application and user-facing products**: The top layer includes user-centric solutions such as [Connect](/docs/products/connect/overview/){target=\_blank} (a simple bridging interface) and the [NTT Launchpad](https://ntt.wormhole.com/){target=\_blank} (for streamlined native asset deployments). - **Asset and data transfer layer**: Below it sits the core bridging and data solutions—[NTT](/docs/products/native-token-transfers/overview/){target=\_blank}, [Token Bridge](/docs/products/token-bridge/overview/){target=\_blank}, [Queries](/docs/products/queries/overview/){target=\_blank}, [Settlement](/docs/products/settlement/overview/){target=\_blank}, and [MultiGov](/docs/products/multigov/overview/){target=\_blank}—that handle the movement of tokens, real-time data fetching, advanced cross-chain settlements, and cross-chain governance. -- **Integration layer**: The [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank}, [Solidity SDK](/docs/tools/solidity-sdk/get-started/){target=\_blank}, and [WormholeScan API](https://wormholescan.io/#/){target=\_blank} provide developer-friendly libraries and APIs to integrate cross-chain capabilities into applications. +- **Integration layer**: The [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank} and [WormholeScan API](https://wormholescan.io/#/){target=\_blank} provide developer-friendly libraries and APIs to integrate cross-chain capabilities into applications. - **Foundation layer**: At the base, the [Wormhole messaging](/docs/products/messaging/overview/){target=\_blank} system and the [core contracts](/docs/protocol/infrastructure/core-contracts/){target=\_blank} secure the entire network, providing essential verification and cross-chain message delivery. ![Wormhole ecosystem diagram](/docs/images/protocol/ecosystem/ecosystem-1.webp) @@ -19298,7 +19299,7 @@ Wormhole provides a suite of tools and protocols that support a wide range of us - **Cross-chain messaging**: Securely transfer arbitrary data between blockchains, enabling the development of cross-chain decentralized applications. - **Asset transfers**: Facilitate the movement of tokens and NFTs across supported chains with ease, powered by protocols built on Wormhole like [Portal](https://portalbridge.com/){target=\_blank}. -- **Developer tools**: Leverage Wormhole’s [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank}, [Solidity SDK](/docs/tools/solidity-sdk/get-started/), [Wormholescan](https://wormholescan.io/){target=\_blank}, and the [Wormholescan API](https://wormholescan.io/#/developers/api-doc){target=\_blank} and documentation to build and deploy cross-chain applications quickly and efficiently. +- **Developer tools**: Leverage Wormhole’s [TypeScript SDK](/docs/tools/typescript-sdk/get-started/){target=\_blank}, [Wormholescan](https://wormholescan.io/){target=\_blank}, and the [Wormholescan API](https://wormholescan.io/#/developers/api-doc){target=\_blank} and documentation to build and deploy cross-chain applications quickly and efficiently. ## What Isn't Wormhole?