-
Notifications
You must be signed in to change notification settings - Fork 9
fix: update contract-types #577
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughThis PR updates the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🚀 Preview environment deployed!Preview URL: https://preview.vechainkit.vechain.org/fixupdate-contract-types |
|
Size Change: +2.45 kB (+0.04%) Total Size: 5.76 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR updates the @vechain/vechain-contract-types package from version 1.5.0 to 1.6.0-rc, which includes changes to contract factory naming conventions. The update removes the intermediate contracts.ts barrel export file and migrates all imports to directly reference the external package.
- Migrated from custom
ERC20__factoryto standardIERC20__factoryfrom the contract types package - Updated
IReverseRegistrar__factoryreferences toVetDomainsReverseRegistrar__factory - Consolidated imports by removing the intermediate barrel export file
Reviewed changes
Copilot reviewed 27 out of 28 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/vechain-kit/package.json | Updated dependency version to 1.6.0-rc |
| packages/vechain-kit/src/hooks/contracts.ts | Removed barrel export file (file deleted) |
| packages/vechain-kit/src/utils/swap/veTrade.tsx | Updated ERC20 factory import |
| packages/vechain-kit/src/utils/swap/uniswapV2Aggregator.ts | Updated ERC20 and Router factory imports with code formatting |
| packages/vechain-kit/src/utils/swap/simulateSwap.ts | Replaced ERC20 factory with SDK's ERC20_ABI constant |
| packages/vechain-kit/src/utils/swap/extractSwapAmounts.ts | Updated ERC20 factory import and improved null safety |
| packages/vechain-kit/src/hooks/thor/transactions/useTransferERC20.ts | Updated ERC20 factory import |
| packages/vechain-kit/src/hooks/thor/smartAccounts/*.ts | Updated smart account factory imports (7 files) |
| packages/vechain-kit/src/hooks/generic-delegator/useGenericDelegator.ts | Updated ERC20 factory import |
| packages/vechain-kit/src/hooks/api/wallet/*.ts | Updated contract factory imports (5 files) |
| packages/vechain-kit/src/hooks/api/vetDomains/*.ts | Updated domain registrar factory imports (5 files) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const transferEventAbi = ERC20Interface.getEvent('Transfer'); | ||
| const transferEventTopicHash = transferEventAbi.topicHash.toLowerCase(); | ||
|
|
||
| const transferEventTopicHash = transferEventAbi?.topicHash.toLowerCase(); |
Copilot
AI
Dec 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The optional chaining operator added here could lead to transferEventTopicHash being undefined, which would cause the filter on line 62 to fail silently. The original code without optional chaining was safer - if getEvent('Transfer') returns null/undefined, the code should fail explicitly rather than continuing with undefined. Consider adding an explicit null check and throwing an error if the event ABI is not found.
| const transferEventTopicHash = transferEventAbi?.topicHash.toLowerCase(); | |
| if (!transferEventAbi) { | |
| throw new Error('Transfer event ABI not found on IERC20 interface'); | |
| } | |
| const transferEventTopicHash = transferEventAbi.topicHash.toLowerCase(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (3)
packages/vechain-kit/src/utils/swap/simulateSwap.ts (1)
228-230: Minor formatting improvements.The multiline formatting of
Object.entries()calls improves readability without changing logic.Also applies to: 255-260
packages/vechain-kit/src/utils/swap/extractSwapAmounts.ts (1)
126-159: Consider simplifying the repeated type assertions.The type guards and explicit casting are good for safety, but the pattern
(decoded.args as { from: ...; to: ...; value: ... })is repeated five times. Consider extracting this once to reduce verbosity.🔎 Proposed simplification
// Type guard for Transfer event args if ( !decoded.args || !('from' in decoded.args) || !('to' in decoded.args) || !('value' in decoded.args) ) { continue; } - const from = ( - decoded.args as { - from: `0x${string}`; - to: `0x${string}`; - value: bigint; - } - ).from - ?.toString() - .toLowerCase(); - const to = ( - decoded.args as { - from: `0x${string}`; - to: `0x${string}`; - value: bigint; - } - ).to - ?.toString() - .toLowerCase(); - const value = ( - decoded.args as { - from: `0x${string}`; - to: `0x${string}`; - value: bigint; - } - ).value as bigint; + const transferArgs = decoded.args as { + from: `0x${string}`; + to: `0x${string}`; + value: bigint; + }; + const from = transferArgs.from?.toString().toLowerCase(); + const to = transferArgs.to?.toString().toLowerCase(); + const value = transferArgs.value;packages/vechain-kit/src/utils/swap/uniswapV2Aggregator.ts (1)
196-199: Redundant validation can be removed.This check is redundant since lines 184-191 already validate that
quote.minimumOutputAmountis neither missing nor zero, andamountOutMinis assigned directly from it on line 193.🔎 Proposed fix
const amountOutMin = quote.minimumOutputAmount; const amountIn = BigInt(params.amountIn); - // Additional validation: amountOutMin should be positive - if (amountOutMin === 0n) { - throw new Error('Invalid quote: minimumOutputAmount is zero'); - } - const isFromVET = isVET(params.fromTokenAddress);
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (27)
packages/vechain-kit/package.jsonpackages/vechain-kit/src/hooks/api/vetDomains/useClaimVeWorldSubdomain.tspackages/vechain-kit/src/hooks/api/vetDomains/useClaimVetDomain.tspackages/vechain-kit/src/hooks/api/vetDomains/useEnsRecordExists.tspackages/vechain-kit/src/hooks/api/vetDomains/useIsDomainProtected.tspackages/vechain-kit/src/hooks/api/vetDomains/useUnsetDomain.tspackages/vechain-kit/src/hooks/api/wallet/useCurrentAllocationsRoundId.tspackages/vechain-kit/src/hooks/api/wallet/useGetTokenUsdPrice.tspackages/vechain-kit/src/hooks/api/wallet/useRoundXApps.tspackages/vechain-kit/src/hooks/api/wallet/useXAppMetadata.tsxpackages/vechain-kit/src/hooks/api/wallet/useXAppShares.tspackages/vechain-kit/src/hooks/contracts.tspackages/vechain-kit/src/hooks/generic-delegator/useGenericDelegator.tspackages/vechain-kit/src/hooks/thor/smartAccounts/useAccountImplementationAddress.tspackages/vechain-kit/src/hooks/thor/smartAccounts/useCurrentAccountImplementationVersion.tspackages/vechain-kit/src/hooks/thor/smartAccounts/useGetAccountAddress.tspackages/vechain-kit/src/hooks/thor/smartAccounts/useGetAccountVersion.tspackages/vechain-kit/src/hooks/thor/smartAccounts/useHasV1SmartAccount.tspackages/vechain-kit/src/hooks/thor/smartAccounts/useSmartAccount.tspackages/vechain-kit/src/hooks/thor/smartAccounts/useUpgradeRequired.tspackages/vechain-kit/src/hooks/thor/smartAccounts/useUpgradeRequiredForAccount.tspackages/vechain-kit/src/hooks/thor/smartAccounts/useUpgradeSmartAccount.tspackages/vechain-kit/src/hooks/thor/transactions/useTransferERC20.tspackages/vechain-kit/src/utils/swap/extractSwapAmounts.tspackages/vechain-kit/src/utils/swap/simulateSwap.tspackages/vechain-kit/src/utils/swap/uniswapV2Aggregator.tspackages/vechain-kit/src/utils/swap/veTrade.tsx
💤 Files with no reviewable changes (1)
- packages/vechain-kit/src/hooks/contracts.ts
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/migration-guide-to-v2.mdc)
**/*.{ts,tsx}: In VeChain Kit Version 2, useuseThorinstead ofuseConnexfor contract interactions
For single contract read operations, use theuseCallClausehook with the pattern: import dependencies, define ABI and method as const, create query key function usinggetCallClauseQueryKeyWithArgs, and wrap with useCallClause including data transformation in the select option
For multiple parallel contract calls, use theexecuteMultipleClausesCallutility wrapped in auseQueryhook with the pattern: define query key function, useexecuteMultipleClausesCallin queryFn mapping items to clause objects, and transform results
For transaction building and sending, use theuseBuildTransactionhook with a clauseBuilder function that returns an array of clauses with optional comment fields describing the transaction action
Always provide an arguments array for contract calls, even when no parameters are required - use an empty array for parameter-less functions to enable TypeScript type checking
Always conditionally enable queries using theenabledproperty to prevent unnecessary contract calls, checking for all required parameters:enabled: !!requiredParam && !!otherRequiredParam
Use theselectoption in useCallClause or transform data in queryFn to handle data transformation, particularly for converting BigInt values to strings and normalizing contract return data
Maintain consistent query key patterns: usegetCallClauseQueryKeyWithArgsfor contract calls with arguments andgetCallClauseQueryKeyfor calls without arguments to ensure proper caching and invalidation
Use TypeScriptas constassertions for method names andas0x${string}`` assertions for Ethereum addresses to ensure type safety in contract interactions
Files:
packages/vechain-kit/src/hooks/api/wallet/useCurrentAllocationsRoundId.tspackages/vechain-kit/src/utils/swap/veTrade.tsxpackages/vechain-kit/src/hooks/thor/smartAccounts/useAccountImplementationAddress.tspackages/vechain-kit/src/hooks/api/vetDomains/useIsDomainProtected.tspackages/vechain-kit/src/hooks/thor/smartAccounts/useSmartAccount.tspackages/vechain-kit/src/hooks/api/wallet/useGetTokenUsdPrice.tspackages/vechain-kit/src/hooks/api/vetDomains/useEnsRecordExists.tspackages/vechain-kit/src/hooks/thor/smartAccounts/useGetAccountVersion.tspackages/vechain-kit/src/hooks/api/wallet/useXAppShares.tspackages/vechain-kit/src/hooks/thor/smartAccounts/useGetAccountAddress.tspackages/vechain-kit/src/hooks/thor/smartAccounts/useUpgradeRequiredForAccount.tspackages/vechain-kit/src/hooks/thor/smartAccounts/useUpgradeRequired.tspackages/vechain-kit/src/hooks/generic-delegator/useGenericDelegator.tspackages/vechain-kit/src/hooks/api/wallet/useRoundXApps.tspackages/vechain-kit/src/utils/swap/extractSwapAmounts.tspackages/vechain-kit/src/hooks/thor/smartAccounts/useUpgradeSmartAccount.tspackages/vechain-kit/src/utils/swap/simulateSwap.tspackages/vechain-kit/src/hooks/api/vetDomains/useClaimVeWorldSubdomain.tspackages/vechain-kit/src/hooks/thor/smartAccounts/useCurrentAccountImplementationVersion.tspackages/vechain-kit/src/hooks/thor/transactions/useTransferERC20.tspackages/vechain-kit/src/hooks/thor/smartAccounts/useHasV1SmartAccount.tspackages/vechain-kit/src/hooks/api/vetDomains/useUnsetDomain.tspackages/vechain-kit/src/hooks/api/wallet/useXAppMetadata.tsxpackages/vechain-kit/src/hooks/api/vetDomains/useClaimVetDomain.tspackages/vechain-kit/src/utils/swap/uniswapV2Aggregator.ts
🧠 Learnings (6)
📓 Common learnings
Learnt from: CR
Repo: vechain/vechain-kit PR: 0
File: .cursor/rules/migration-guide-to-v2.mdc:0-0
Timestamp: 2025-12-01T13:01:33.771Z
Learning: Applies to **/*.{ts,tsx} : In VeChain Kit Version 2, use `useThor` instead of `useConnex` for contract interactions
📚 Learning: 2025-12-01T13:01:33.771Z
Learnt from: CR
Repo: vechain/vechain-kit PR: 0
File: .cursor/rules/migration-guide-to-v2.mdc:0-0
Timestamp: 2025-12-01T13:01:33.771Z
Learning: Applies to **/*.{ts,tsx} : In VeChain Kit Version 2, use `useThor` instead of `useConnex` for contract interactions
Applied to files:
packages/vechain-kit/src/hooks/api/wallet/useCurrentAllocationsRoundId.tspackages/vechain-kit/src/utils/swap/veTrade.tsxpackages/vechain-kit/src/hooks/thor/smartAccounts/useAccountImplementationAddress.tspackages/vechain-kit/src/hooks/api/vetDomains/useIsDomainProtected.tspackages/vechain-kit/src/hooks/thor/smartAccounts/useSmartAccount.tspackages/vechain-kit/src/hooks/api/wallet/useGetTokenUsdPrice.tspackages/vechain-kit/src/hooks/api/vetDomains/useEnsRecordExists.tspackages/vechain-kit/src/hooks/thor/smartAccounts/useGetAccountVersion.tspackages/vechain-kit/src/hooks/api/wallet/useXAppShares.tspackages/vechain-kit/src/hooks/thor/smartAccounts/useGetAccountAddress.tspackages/vechain-kit/src/hooks/thor/smartAccounts/useUpgradeRequiredForAccount.tspackages/vechain-kit/src/hooks/thor/smartAccounts/useUpgradeRequired.tspackages/vechain-kit/src/hooks/generic-delegator/useGenericDelegator.tspackages/vechain-kit/src/hooks/api/wallet/useRoundXApps.tspackages/vechain-kit/src/utils/swap/extractSwapAmounts.tspackages/vechain-kit/src/hooks/thor/smartAccounts/useUpgradeSmartAccount.tspackages/vechain-kit/src/utils/swap/simulateSwap.tspackages/vechain-kit/src/hooks/api/vetDomains/useClaimVeWorldSubdomain.tspackages/vechain-kit/src/hooks/thor/smartAccounts/useCurrentAccountImplementationVersion.tspackages/vechain-kit/package.jsonpackages/vechain-kit/src/hooks/thor/transactions/useTransferERC20.tspackages/vechain-kit/src/hooks/thor/smartAccounts/useHasV1SmartAccount.tspackages/vechain-kit/src/hooks/api/vetDomains/useUnsetDomain.tspackages/vechain-kit/src/hooks/api/wallet/useXAppMetadata.tsxpackages/vechain-kit/src/hooks/api/vetDomains/useClaimVetDomain.ts
📚 Learning: 2025-12-01T13:01:33.771Z
Learnt from: CR
Repo: vechain/vechain-kit PR: 0
File: .cursor/rules/migration-guide-to-v2.mdc:0-0
Timestamp: 2025-12-01T13:01:33.771Z
Learning: Applies to **/*.{ts,tsx} : For single contract read operations, use the `useCallClause` hook with the pattern: import dependencies, define ABI and method as const, create query key function using `getCallClauseQueryKeyWithArgs`, and wrap with useCallClause including data transformation in the select option
Applied to files:
packages/vechain-kit/src/hooks/api/wallet/useCurrentAllocationsRoundId.tspackages/vechain-kit/src/utils/swap/veTrade.tsxpackages/vechain-kit/src/hooks/api/wallet/useGetTokenUsdPrice.tspackages/vechain-kit/src/hooks/api/wallet/useXAppShares.tspackages/vechain-kit/src/hooks/generic-delegator/useGenericDelegator.tspackages/vechain-kit/src/hooks/api/wallet/useRoundXApps.tspackages/vechain-kit/src/hooks/thor/smartAccounts/useUpgradeSmartAccount.tspackages/vechain-kit/src/utils/swap/simulateSwap.tspackages/vechain-kit/src/hooks/api/vetDomains/useClaimVeWorldSubdomain.tspackages/vechain-kit/src/utils/swap/uniswapV2Aggregator.ts
📚 Learning: 2025-12-01T13:01:33.771Z
Learnt from: CR
Repo: vechain/vechain-kit PR: 0
File: .cursor/rules/migration-guide-to-v2.mdc:0-0
Timestamp: 2025-12-01T13:01:33.771Z
Learning: Applies to **/*.{ts,tsx} : For multiple parallel contract calls, use the `executeMultipleClausesCall` utility wrapped in a `useQuery` hook with the pattern: define query key function, use `executeMultipleClausesCall` in queryFn mapping items to clause objects, and transform results
Applied to files:
packages/vechain-kit/src/hooks/api/wallet/useCurrentAllocationsRoundId.tspackages/vechain-kit/src/hooks/api/wallet/useGetTokenUsdPrice.tspackages/vechain-kit/src/hooks/api/wallet/useXAppShares.tspackages/vechain-kit/src/hooks/api/wallet/useRoundXApps.ts
📚 Learning: 2025-12-01T13:01:33.771Z
Learnt from: CR
Repo: vechain/vechain-kit PR: 0
File: .cursor/rules/migration-guide-to-v2.mdc:0-0
Timestamp: 2025-12-01T13:01:33.771Z
Learning: Applies to **/*.{ts,tsx} : Use TypeScript `as const` assertions for method names and `as `0x${string}`` assertions for Ethereum addresses to ensure type safety in contract interactions
Applied to files:
packages/vechain-kit/src/utils/swap/extractSwapAmounts.tspackages/vechain-kit/src/hooks/thor/transactions/useTransferERC20.ts
📚 Learning: 2025-12-01T13:01:33.771Z
Learnt from: CR
Repo: vechain/vechain-kit PR: 0
File: .cursor/rules/migration-guide-to-v2.mdc:0-0
Timestamp: 2025-12-01T13:01:33.771Z
Learning: Applies to **/*.{ts,tsx} : For transaction building and sending, use the `useBuildTransaction` hook with a clauseBuilder function that returns an array of clauses with optional comment fields describing the transaction action
Applied to files:
packages/vechain-kit/src/hooks/thor/smartAccounts/useUpgradeSmartAccount.tspackages/vechain-kit/src/utils/swap/simulateSwap.tspackages/vechain-kit/src/hooks/thor/transactions/useTransferERC20.tspackages/vechain-kit/src/hooks/api/vetDomains/useUnsetDomain.tspackages/vechain-kit/src/utils/swap/uniswapV2Aggregator.ts
🔇 Additional comments (28)
packages/vechain-kit/src/hooks/api/wallet/useXAppShares.ts (1)
2-2: LGTM: Import source updated.The import source has been correctly updated to use the direct package import from
@vechain/vechain-contract-types, eliminating the intermediate re-export layer.packages/vechain-kit/src/hooks/api/wallet/useCurrentAllocationsRoundId.ts (1)
2-2: LGTM: Import source updated.The import source has been correctly updated to use the direct package import from
@vechain/vechain-contract-types.packages/vechain-kit/src/hooks/thor/smartAccounts/useHasV1SmartAccount.ts (1)
2-2: LGTM: Import source updated.The import source has been correctly updated to use the direct package import from
@vechain/vechain-contract-types.packages/vechain-kit/src/hooks/thor/smartAccounts/useUpgradeRequiredForAccount.ts (1)
2-2: LGTM: Import source updated.The import source has been correctly updated to use the direct package import from
@vechain/vechain-contract-types.packages/vechain-kit/src/hooks/api/wallet/useXAppMetadata.tsx (1)
2-2: LGTM: Import source updated.The import source has been correctly updated to use the direct package import from
@vechain/vechain-contract-types.packages/vechain-kit/src/hooks/thor/smartAccounts/useAccountImplementationAddress.ts (1)
4-4: LGTM: Import source updated.The import source has been correctly updated to use the direct package import from
@vechain/vechain-contract-types.packages/vechain-kit/src/hooks/thor/smartAccounts/useCurrentAccountImplementationVersion.ts (1)
4-4: LGTM: Import source updated.The import source has been correctly updated to use the direct package import from
@vechain/vechain-contract-types.packages/vechain-kit/src/utils/swap/veTrade.tsx (1)
8-8: No action required—IERC20__factory is ABI-compatible and includes the approve method.The factory change is safe. IERC20 from @vechain/vechain-contract-types is signature-compatible with the standard OpenZeppelin IERC20 interface and contains the
approve(address spender, uint256 amount)function with the correct signature. This pattern is already used consistently throughout the codebase in multiple files.packages/vechain-kit/src/hooks/api/wallet/useGetTokenUsdPrice.ts (1)
3-3: LGTM: Import migration is clean.The import path change from
@hooks/contractsto@vechain/vechain-contract-typesis straightforward and aligns with the PR's objective to eliminate the intermediate re-export layer.packages/vechain-kit/src/hooks/api/vetDomains/useIsDomainProtected.ts (1)
2-2: LGTM: Import migration is clean.The import path change is consistent with the broader refactoring to use direct imports from
@vechain/vechain-contract-types.packages/vechain-kit/src/hooks/api/vetDomains/useEnsRecordExists.ts (1)
3-3: LGTM: Import migration is clean.The import path change maintains consistency with the PR's refactoring objectives.
packages/vechain-kit/src/hooks/thor/smartAccounts/useUpgradeSmartAccount.ts (1)
3-3: LGTM: Import migration is clean.The import path change is consistent with the broader refactoring. The factory's
createInterface()method usage remains unchanged.packages/vechain-kit/src/hooks/thor/smartAccounts/useGetAccountVersion.ts (1)
1-1: LGTM: Import migration is clean.The import path change is straightforward and consistent with the PR's refactoring objectives.
packages/vechain-kit/src/hooks/thor/smartAccounts/useUpgradeRequired.ts (1)
2-2: LGTM: Import migration is clean.The import path change maintains consistency with the broader refactoring effort.
packages/vechain-kit/src/hooks/api/vetDomains/useClaimVetDomain.ts (1)
8-8: Factory rename toVetDomainsReverseRegistrar__factoryis correct and maintains ABI compatibility.The factory import change from
IReverseRegistrar__factorytoVetDomainsReverseRegistrar__factoryis a straightforward class rename reflecting the updated package version. The interface creation pattern (createInterface()) and all method calls (encodeFunctionData('setName'),getFunction('setName')) remain compatible and functional. Usage is consistent across all vetDomains hooks (useUnsetDomain.ts, useClaimVeWorldSubdomain.ts, useClaimVetDomain.ts).packages/vechain-kit/src/hooks/thor/smartAccounts/useGetAccountAddress.ts (1)
2-2: LGTM! Clean import migration.The import source change for
SocialLoginSmartAccountFactory__factoryis correct and aligns with the broader migration to@vechain/vechain-contract-types. The factory usage (.abiaccess at line 20) remains unchanged.packages/vechain-kit/src/hooks/thor/smartAccounts/useSmartAccount.ts (1)
7-7: LGTM! Consistent migration pattern.The import source change is correct and consistent with other smart account hooks in this PR.
packages/vechain-kit/src/utils/swap/simulateSwap.ts (1)
1-1: LGTM! Cleaner ABI usage pattern.The change from
ERC20__factory.abitoERC20_ABI(imported directly from@vechain/sdk-core) is a good simplification. This removes the dependency on the factory when only the ABI is needed for event decoding.Also applies to: 42-42
packages/vechain-kit/src/hooks/api/wallet/useRoundXApps.ts (1)
3-3: LGTM! Standard import migration.The import source change for
XAllocationVoting__factoryis correct and follows the established migration pattern.packages/vechain-kit/src/hooks/thor/transactions/useTransferERC20.ts (1)
6-6: LGTM! Consistent IERC20__factory migration.The migration from
ERC20__factorytoIERC20__factoryis applied correctly here. The interface creation and usage patterns (lines 39, 44) remain unchanged. This follows the same pattern as inuseGenericDelegator.ts.Note: Verification of
IERC20__factoryAPI compatibility is requested in theuseGenericDelegator.tsreview.Also applies to: 28-28
packages/vechain-kit/src/utils/swap/extractSwapAmounts.ts (2)
2-2: LGTM! Defensive improvements.The migration to
IERC20__factoryis correct. The addition of optional chaining on line 59 (transferEventAbi?.topicHash) is a good defensive programming practice that prevents potential null reference errors.Also applies to: 57-59
119-122: Good type safety improvement.The explicit type assertion for the topics array ensures proper typing for
decodeEventLog. This is a good type safety enhancement.packages/vechain-kit/src/hooks/api/vetDomains/useClaimVeWorldSubdomain.ts (1)
9-9: LGTM! Improved factory naming.The migration from
IReverseRegistrar__factorytoVetDomainsReverseRegistrar__factoryis correct. The new naming is more descriptive and follows a consistent pattern (removing the generic "I" interface prefix in favor of the specific domain-prefixed name). All usage sites (lines 49, 55, 63, 67, 115, 124) remain functionally unchanged.Also applies to: 36-36
packages/vechain-kit/src/hooks/generic-delegator/useGenericDelegator.ts (1)
9-9: Version 1.6.0-rc is published on npm, but release notes unavailable for verification.The
@vechain/[email protected]package exists in the npm registry. The code uses the standard TypeChain factory methodcreateInterface()fromIERC20__factory(line 123), which aligns with expected API patterns. However, official release notes and breaking changes documentation for this RC version could not be located, so API surface compatibility and stability guarantees cannot be definitively confirmed.packages/vechain-kit/src/hooks/api/vetDomains/useUnsetDomain.ts (1)
7-7: LGTM!The migration from the local re-export to direct import from
@vechain/vechain-contract-typesis correct. The factory rename fromIReverseRegistrar__factorytoVetDomainsReverseRegistrar__factoryaligns with the package update to version 1.6.0-rc and matches the pattern used in related files (useClaimVeWorldSubdomain.ts,useClaimVetDomain.ts).Also applies to: 26-26
packages/vechain-kit/src/utils/swap/uniswapV2Aggregator.ts (3)
7-10: LGTM!The import migration to
@vechain/vechain-contract-typesis correct. The aliasUniswapV2Router02__factory as UniswapV2Router__factorymaintains backward compatibility with existing code references while adopting the updated package.
140-154: Defensive error handling returns zeroed quote.The approach of returning a zeroed quote on error allows multi-aggregator comparisons to continue when one fails. Ensure consumers filter out quotes with
outputAmount === 0nbefore presenting them to users or using them in transactions.
228-244: LGTM!The use of
IERC20__factory.abifor token approval is correct and aligns with the contract-types migration. The approval clause is properly constructed.
| "@vechain/dapp-kit-react": "2.1.0-rc.5", | ||
| "@vechain/picasso": "^2.1.1", | ||
| "@vechain/vechain-contract-types": "1.5.0", | ||
| "@vechain/vechain-contract-types": "1.6.0-rc", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
@vechain/vechain-contract-types 1.6.0-rc breaking changes changelog
💡 Result:
I couldn't find a public changelog or release notes for @vechain/vechain-contract-types v1.6.0-rc. I searched npm, GitHub, VeChain docs, and VeKit resources and found no release entry or changelog for that specific pre-release version. [1][2]
Would you like me to:
- search the vechain GitHub repos/tags more deeply (I can scan tags and release pages), or
- search your project repo/lockfile for where that exact version is referenced so I can inspect its source?
Sources:
- VeChain GitHub repositories listing (no package release found). [github.com/vechain]. [3]
- VeKit docs mentioning @vechain/vechain-contract-types as a standalone package. [vechainkit.vechain.org]. [4]
🏁 Script executed:
# Find all imports of vechain-contract-types in the codebase
rg "from\s+['\"]@vechain/vechain-contract-types" -A 2 -B 2Repository: vechain/vechain-kit
Length of output: 16896
🏁 Script executed:
# Also check if there are any factory-related imports
rg "vechain-contract-types" --type json,ts,js | head -30Repository: vechain/vechain-kit
Length of output: 97
🏁 Script executed:
# Check the full package.json to see version context
cat packages/vechain-kit/package.json | grep -A 5 -B 5 "vechain-contract-types"Repository: vechain/vechain-kit
Length of output: 520
🏁 Script executed:
# Check if there's a lock file that might have version info
fd -e lock.json -e lock.yaml -e lock.yml | head -5Repository: vechain/vechain-kit
Length of output: 45
🏁 Script executed:
# Search for any mention of 1.6.0-rc in commit messages or files
rg "1\.6\.0-rc" -iRepository: vechain/vechain-kit
Length of output: 374
🌐 Web query:
@vechain/vechain-contract-types npm registry v1.6.0-rc package published
💡 Result:
No — there is no published @vechain/vechain-contract-types version 1.6.0-rc on the npm registry. The package releases are in the 1.0.x series (latest listed ~1.0.3 / 1.0.0 in registry listings). [1][2]
Sources:
- npm package listing / search results for @vechain/vechain-contract-types. [1]
- Socket / package index showing current 1.0.x releases. [2]
🏁 Script executed:
# Check full package.json structure for workspaces, resolutions, etc
cat packages/vechain-kit/package.json | head -100Repository: vechain/vechain-kit
Length of output: 3243
🏁 Script executed:
# Look for @vechain/vechain-contract-types as a local package in the repo
fd -t d vechain-contract-typesRepository: vechain/vechain-kit
Length of output: 45
🏁 Script executed:
# Check the yarn.lock file for the actual resolution URL/source
rg -A 10 '"@vechain/vechain-contract-types@npm:1.6.0-rc"' yarn.lockRepository: vechain/vechain-kit
Length of output: 573
🏁 Script executed:
# Check root package.json for workspace configuration
cat package.json | grep -A 20 -B 5 "workspaces"Repository: vechain/vechain-kit
Length of output: 718
RC version 1.6.0-rc does not appear to exist on the public npm registry, which will cause installation failures.
The specified RC version cannot be resolved from the public npm registry (latest available is 1.0.x series). Although yarn.lock shows a cached resolution, fresh installations and CI/CD environments will fail to fetch this dependency. Given the extensive usage of factories from this package throughout the codebase—including critical smart account operations, ERC20 token transfers, and domain management—this version must either:
- Be published to npm registry, or
- Be replaced with an available stable version (1.0.x series) or an alternative RC version that is publicly available
Without access to the actual 1.6.0-rc release, factory API compatibility and breaking changes cannot be verified.
🤖 Prompt for AI Agents
In packages/vechain-kit/package.json around line 69 the dependency
"@vechain/vechain-contract-types": "1.6.0-rc" references a non-existent RC on
the public npm registry causing installs to fail; either change this entry to a
published version (e.g. a compatible 1.0.x stable release) or publish 1.6.0-rc
to the registry, then update package.json accordingly, regenerate the lockfile
(yarn install / yarn.lock), run CI/local install to verify resolution, and run
the test/typecheck suite to confirm API compatibility and make any necessary
import or factory adjustments if the chosen version has breaking changes.
| @@ -1,8 +1,7 @@ | |||
| import { TransactionClause } from '@vechain/sdk-core'; | |||
| import { ERC20_ABI, TransactionClause } from '@vechain/sdk-core'; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be better to use from contract-types? so it's consistent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah but when we're using it, something is different it is exported like IERC20 and it causes some TS issues 🤔
maybe i am getting the wrong one?
Summary by CodeRabbit
New Features
Bug Fixes
Dependencies
✏️ Tip: You can customize this high-level summary in your review settings.