Usage
Using the VeChain dApp kit
1. Optional: Wallet Connect Options
2. Initialise the DAppKit
instance
DAppKit
instanceFor more information on using connex, please refer to the Connex documentation.
Wallet Manager
The wallet manager is the layer provided on top of connex
. It can be created following the usage above.
Set the wallet source
Set the current wallet source. This step is necessary if
useFirstDetectedSource
was not provided as true.
Connect
Connect to the selected wallet. The purpose of this is to improve the UX. For example, connecting a wallet via Wallet Connect involves switching applications multiple times. This will reduce the friction and create a better experience for the user.
This will connect to the user's wallet and return its address.
For certificate-based wallets, (eg. Sync2), this involves signing a signature
For other wallets, such as those using Wallet Connect, it will fetch the address without signing a certificate
The response will contain
verified
equal to true if the user signed a certificate
State
The wallet manager will have some fields in state for ease of use.
address
will be whatever address was retrieved when connecting, signing a certificate, or sending a transaction.
WalletManagerState:
account
- the address of the connected wallet. Null if not connectedaccountDomain
- the .vet domain account (VeChain domains) if presentisAccountDomainLoading
- whether the account domain is loadingsource
- the source of the currently selected wallet. Null if not selectedconnectionCertificate
- certificate signed during connectionavailableWallets
- A list of available wallet sources
Subscribe to State
You can subscribe to state changes:
Subscribe to a single value in the state
You can also subscribe to a single value in the state:
Last updated