Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the NFT history functionality by extracting the base64 to Bech32 address conversion logic into a shared utility function. The change centralizes address conversion logic that was previously duplicated across multiple asset history services.
- Adds a new
base64ToBech32utility function to handle address conversion - Replaces inline
base64ToBech32()method calls with the new utility function - Updates import statements to include the new utility function
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/utils/helpers.ts | Adds new base64ToBech32 utility function for address conversion |
| src/modules/asset-history/services/assets-history.nfts-swap-auction.service.ts | Replaces inline address conversion with utility function calls |
| src/modules/asset-history/services/assets-history.nft-events.service.ts | Replaces inline address conversion with utility function calls and reorders imports |
| src/modules/asset-history/services/assets-history.auction.service.ts | Replaces inline address conversion with utility function calls |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| }; | ||
|
|
||
| export function base64ToBech32(topic: string) { | ||
| if (topic) { |
There was a problem hiding this comment.
The truthy check for 'topic' may not be sufficient. An empty string would pass this check but would cause an error in the Buffer.from() call. Consider using a more specific check like 'if (topic && topic.length > 0)' or handle the empty string case explicitly.
| if (topic) { | |
| if (topic && topic.length > 0) { |
4150aef
No description provided.