Upgrade VeChain Kit from 1.x to 2.x
What's Changed in 2.0
Major Breaking Changes
Connex Removal:
useConnexis replaced withuseThorNew Contract Interaction Patterns: Introduction of
useCallClauseandexecuteMultipleClausesCallEnhanced Transaction Building: New
useBuildTransactionhook with improved type safetyImproved Type Safety: Better TypeScript support with stricter typing
useEvents()hook was refactored, more hereThe following hooks were also removed in order to improve permeances.
Deprecated Hooks
Utils Hooks
useRoundAppVotes
useSustainabilityActions
Galaxy Member Hooks
useGMbalance
useB3trToUpgrade
useB3trToUpgradeToLevel
useGetNodeIdAttached
useGetTokenIdAttachedToNode
useGMMaxLevel
useParticipatedInGovernance
useTokenIdByAccount
useNFTImage
useB3trDonated
useGMBaseUri
useSelectedTokenId
useIsGMClaimable
useSelectedGmNft
useLevelOfToken
useNFTMetadataUri
NodeManagement
useGetNodeManager
useIsNodeHolder
useUserXNodes
VeBetterPassport
useAccountLinking
usePassportChecks
useUserDelegation
useUserStatus
useAppSecurityLevel
useGetCumulativeScoreWithDecay
useGetDelegatee
useGetDelegator
useGetEntitiesLinkedToPassport
useGetPassportForEntity
useGetPendingDelegationsDelegateePOV
useGetPendingDelegationsDelegatorPOV
useGetPendingLinkings
useIsEntity
useIsPassportCheckEnabled
useIsPassport
useParticipationScoreThreshold
useSecurityMultiplier
useThresholdParticipationScore
useThresholdParticipationScoreAtTimepoint
useIsBlacklisted
useIsWhitelisted
useUserRoundScore
VBD VoterRewards:
useLevelMultiplier
X2Earn Apps:
useUserVotesInAllRounds
useUserTopVotedApps
useXNode
useAppAdmin
useAppExists
useAppsEligibleInNextRound
useGetX2EarnAppAvailableFunds
useXAppsMetadataBaseUri
useXNodeCheckCooldown
XAllocation Voting
useAllocationAmount
useXAppVotesQf
useCallClause is for reading data from smart contracts with automatic
caching and refetching
executeMultipleClausesCall is to execute multiple contract calls in a single batch
It might require to rm -rf node_modules yarn.lock && yarn
Migration Path
Preparation Steps
Create a git branch for migration
Identify all places where
useConnexis used (This is the main breaking change and easiest to find)Run
tsccompiler to see all broken referencesFix the compiler errors and migrate incrementally. The new methods provide type-safe returns that will guide you
Verify functionality as you fix each error
Ensure you have adequate test coverage before starting
Getting Help
Documentation: Refer to individual migration guide sections
GitHub Issues: Report issues
Next Steps
Start with the API Changes guide to update your core dependencies and imports
Review Contract Patterns to understand new interaction methods
Apply Best Practices for optimal performance
Consult Troubleshooting if you encounter issues
Last updated
Was this helpful?