This repository shows you how you can easily integrate MXNB into your web app using the Portal Web SDK. It covers the following features.
- Generate a Wallet
- Fetch and display balances.
- Fund wallet with
MXNBon Arbitrum Sepolia. - Transfer tokens to a given recipient address.
- Clone the repo
- Go to your Portal Dashboard Settings page and create a Test Client API Key.
- Run this example app with
yarn && yarn dev(runs on localhost:3000) - Input the Client API Key in the input field
- Click
Initialize Wallet
This app demonstrates how to integrate the Portal SDK in a Next.js application to create a simple web3 wallet experience. Here's how it works:
src/pages/index.tsx- Main application page and component structuresrc/hooks/usePortalWallet.ts- Custom hook that manages all Portal SDK interactionssrc/components/- UI components for the wallet interfacesrc/config/index.ts- Application configuration including Arbitrum network settingssrc/types/index.d.ts- TypeScript definitions for Portal SDK responses
- ApiKeyInput - Allows users to enter their Portal Client API Key and initialize the wallet
- WalletAddress - Displays the user's EVM address with copy functionality and funding options
- TokenBalances - Shows all tokens in the user's wallet with balances
- SendTokensForm - Form for sending tokens to another address
- User enters their Portal Client API Key
- The app initializes the Portal SDK with the key and connects to the Arbitrum Sepolia network
- The SDK creates a new wallet or retrieves an existing one
- The app displays the wallet address and token balances
The app fetches and displays the user's token balances using the Portal SDK's getAssets method. Users can:
- View their
MXNBand other token balances - Fund their wallet with testnet
MXNB - Refresh balances to see updated amounts
- User selects a token to send
- User enters a recipient address and amount
- The app uses Portal SDK's
sendAssetmethod to create and send the transaction - A confirmation displays with a link to view the transaction on the Arbitrum Sepolia explorer
You can get more MXNB tokens for testing with the below faucet.
- Juno Faucet - Get testnet
MXNBtokens
To adapt this example for your own application:
- Replace the Client API Key with your own from the Portal Dashboard
- Modify the UI components to match your application's design
- Add additional features like NFT display or transaction history using Portal APIs
- Configure for mainnet by updating the chainId in
src/config/index.ts
Portal's SDKs have several pieces of core functionality.
- Generating a Wallet: This function creates MPC key shares on your local device's browser and the Portal servers. These key shares support all EVM chains, Solana, Tron, Stellar, and Bitcoin.
- Send Tokens: This function allows you to easily send tokens from your Portal wallet to another address, supporting EVM, Solana, Tron, Stellar, and Bitcoin chains.
- Signing a Transaction: This function signs a provided transaction, and can broadcast that transaction to a chain when an RPC gateway URL is provided.
Portal supplies several APIs for simplifying your development.
- Get Assets: This endpoint returns a list of fungible asset (native, ERC-20, and SPL tokens) associated with your client for a given chain.
- Get NFTs: This endpoint returns a list of the NFTs associated with your client for a given chain.
- Get Transactions: This endpoint returns a list of the historic transactions associated with your client for a given chain.
- Build a Transaction: This endpoint builds a formatted transaction to send a fungible asset (native, ERC-20, and SPL tokens) for a given chain.
- And more.
- Juno Docs - Official Juno website
We welcome contributions to improve this example app! To contribute:
- Fork the repository
- Create a new branch for your feature
- Add your changes
- Submit a pull request
Need help or want to request a feature? Reach out to us on the official Portal Community Slack.





