Integrating Wormhole Connect
Alright, youβve got a basic React App up and running. Now itβs time to sprinkle in some Wormhole Connect SDK magic to kickstart your token bridging journey. πβ¨
π Initializing Wormhole Connect SDK π
First things first, letβs initialize the Wormhole Connect SDK within our Bridge app directory.
In your appβs root directory, go ahead and install the Wormhole Connect SDK with the following command:
npm iΒ @wormhole-foundation/wormhole-connect
π οΈ Crafting the Bridge π οΈ
Now, navigate to your src/App.tsx
file and clear out its contents.
π¦ Importing the SDK π¦
Start by importing the Wormhole Connect SDK into your React App. Simply add this line at the top of your file:
import WormholeBridge from "@wormhole-foundation/wormhole-connect";
π¨ Building the App Function π¨
Once the SDK is imported, letβs create a function that renders the bridge element we just imported. Add the following code snippet:
function App() {
return (
<WormholeBridge />
);
}
This should go right below your import statements.
π The Final Lap: Exporting the Function π
To render the App
function on your webpage, youβll need to export it. Add this line at the end of your code:
export default App;
If youβve been following along, your code should look something like this:
import WormholeBridge from '@wormhole-foundation/wormhole-connect';
function App() {
return (
<WormholeBridge />
);
}
export default App;
Save your changes, and your local server at http://localhost:3000/ should display something like this:
π Woohoo! Youβve successfully built your very own token bridge, all thanks to the power of Wormhole. Feel free to bridge tokens and acquire wrapped assets on your network of choice.
For those interested, the code is also available on GitHub right here. π