Get Prepared
VeStation In-App Staking Integration Guide
This document provides guidance for integrating VeStation's B3TR staking functionality into third-party applications. Follow these instructions to allow your users to stake B3TR tokens, withdraw their staked tokens, and claim rewards directly within your application.
Prerequisites and Dependencies
Before you start integrating, make sure you have the following dependencies and configurations in place:
Required Dependencies
{
"dependencies": {
"@vechain/connex": "^2.0.0",
"@vechain/dapp-kit-react": "^1.0.0",
"lodash.find": "^4.6.0",
"bignumber.js": "^9.0.0"
}
}Note: For the latest versions and detailed documentation, refer to the VeChain Developer Documentation.
ABI Files
You need to obtain and include two essential ABI files:
ERC20.json - Standard ERC20 token interface
VeDelegateV2.json - VeDelegate contract interface with staking functions
DApp Kit Initialization
The VeStation integration relies on the VeChain DApp Kit for React. Set up your application following these steps:
1. WalletConnect Configuration (Optional)
If you want to support WalletConnect for improved wallet connectivity:
2. Setting up DAppKitProvider
For React applications, wrap your app with the DAppKitProvider:
3. Add Wallet Button to Your UI
For more detailed information on initializing and using the DApp Kit, refer to the official VeChain DApp Kit documentation.
Network Configuration
Access the VeChain network using the Connex instance obtained from the DApp Kit:
Important: Make sure to adjust the configuration based on your target environment (mainnet or testnet). The contract addresses provided in this document are for the mainnet environment.
Constants
Note: These addresses are for the production environment. Always verify the contract addresses before deployment to ensure they match the current environment.
React Integration
All examples in this document are for React environments. You'll need to use the connex instance from the useConnex() hook, and the user account address from the useWallet() hook:
Note: Ensure that your application has properly set up the VeChain dApp Kit. For initialization instructions, refer to the @vechain/dapp-kit-react documentation.
Last updated