Welcome to the EpicChain WalletConnect SDK! This toolkit is your gateway to integrating the EpicChain blockchain with various wallet providers seamlessly. With WalletConnect, users can securely interact with your decentralized applications (dApps) using their mobile wallets, providing a simple, user-friendly experience while interacting with the EpicChain ecosystem.
The WalletConnect SDK is a powerful tool designed to allow seamless communication between decentralized apps (dApps) and mobile wallets in the EpicChain ecosystem. Whether you are building DeFi protocols, games, or NFT platforms, this SDK will enable users to sign transactions and messages securely from their preferred wallet, directly from their mobile device.
WalletConnect is an open-source protocol that connects wallets and dApps through a secure, peer-to-peer connection. By using the SDK, EpicChain developers can ensure that their users have a smooth, safe, and intuitive experience when interacting with their blockchain-based applications.
To get started with the WalletConnect SDK for EpicChain, follow these steps:
- Create an EpicChain Wallet: Ensure you have an EpicChain wallet, as this will be needed for user interactions.
- Install Dependencies: Before using this SDK, ensure your project has all the necessary dependencies installed.
- Integrate WalletConnect: Use the provided classes and methods to integrate WalletConnect into your dApp or platform.
To install the SDK into your project, follow the steps below:
You can install the SDK through npm or yarn:
npm install @epicchain/walletconnect-sdk
or
yarn add @epicchain/walletconnect-sdk
Once installed, import the SDK into your codebase:
import WalletConnect from '@epicchain/walletconnect-sdk';
After installation, you’ll need to configure the SDK to connect to the EpicChain network. This involves setting up the walletConnect
object with the necessary parameters.
const walletConnect = new WalletConnect({
bridge: "https://bridge.walletconnect.org", // WalletConnect Bridge URL
chainId: 1, // EpicChain Network ID
rpc: {
1: "https://rpc.epic-chain.org", // RPC URL for EpicChain
},
});
if (!walletConnect.connected) {
await walletConnect.connect();
}
In this example, we set the bridge URL and RPC provider for EpicChain. Be sure to update the rpc
field to the EpicChain RPC URL, which ensures the SDK communicates with the EpicChain blockchain.
Below are the key functions and properties available in the WalletConnect SDK for EpicChain:
Constructor to instantiate a new WalletConnect object.
const walletConnect = new WalletConnect({
bridge: "https://bridge.walletconnect.org",
chainId: 1,
rpc: {
1: "https://rpc.epic-chain.org",
},
});
Initiates a connection between the dApp and the wallet.
await walletConnect.connect();
Disconnects the user’s wallet from the dApp.
walletConnect.disconnect();
Used to send a transaction through the connected wallet.
const tx = {
to: "0xAddress",
data: "0xData",
gas: 21000,
gasPrice: "20000000000",
value: "1000000000000000000",
};
await walletConnect.sendTransaction(tx);
Signs a custom message with the user’s wallet.
const message = "Sign this message for authentication";
await walletConnect.signMessage(message);
Make sure to always use HTTPS endpoints to avoid man-in-the-middle attacks when connecting to wallets or APIs.
Never store or share private keys in your application. Always rely on the connected wallet for signing transactions and messages.
Ensure that WalletConnect sessions are properly secured with an appropriate session timeout and that users are notified when their session ends or becomes invalid.
The WalletConnect SDK for EpicChain is designed for a variety of use cases within the EpicChain ecosystem:
- DeFi: Integrate decentralized finance (DeFi) applications for users to interact with liquidity pools, staking, and yield farming.
- NFTs: Allow users to sign transactions when buying, selling, or minting non-fungible tokens (NFTs) on EpicChain.
- Games: Enable in-game wallet interactions such as signing in-game purchases, earning rewards, and connecting to decentralized gaming networks.
- dApps: Build decentralized applications that interact with the EpicChain blockchain and allow users to send transactions directly from their mobile wallets.
Here’s a simple example to show how you can integrate WalletConnect into your dApp:
import WalletConnect from '@epicchain/walletconnect-sdk';
// Create a WalletConnect instance
const walletConnect = new WalletConnect({
bridge: "https://bridge.walletconnect.org",
chainId: 1,
rpc: {
1: "https://rpc.epic-chain.org",
},
});
// Connect to wallet
if (!walletConnect.connected) {
await walletConnect.connect();
}
// Sign a transaction
const tx = {
to: "0xReceiverAddress",
data: "0xData",
value: "1000000000000000000",
};
await walletConnect.sendTransaction(tx);
This code snippet allows users to connect their EpicChain wallet and send a transaction directly to the blockchain, all through WalletConnect.
We welcome contributions from the community! Whether you’re fixing bugs, adding features, or improving documentation, your help is always appreciated.
- Fork the repository.
- Create a new branch.
- Make your changes.
- Submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
For any issues or suggestions, feel free to open an issue or reach out to us on social media.
👨💻 EpicChain Labs Team
Connecting the World with Blockchain