-
Notifications
You must be signed in to change notification settings - Fork 148
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
fix: asset contractId use inconsistencies #5427
Conversation
WalkthroughThe changes encompass a comprehensive update aimed at improving code clarity and consistency. Key enhancements include function renaming for better understanding, introduction of new utility functions for contract and asset management, and adjustments to property references in various components and hooks. Additionally, the version of Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
@@ -76,3 +77,80 @@ export function getSafeImageCanonicalUri(imageCanonicalUri: string, name: string | |||
? imageCanonicalUri | |||
: ''; | |||
} | |||
|
|||
/** |
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.
These should all be relocated soon with the @leather-wallet/stacks
work, but wanted to move them with other stacks specific utils for now. Let me know if that seems incorrect, but I'm not sure why they would be in the ui
lib?
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, ui lib doesn't seems as correct place for them
may be refactor it to fn declarations while here?
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.
I'll do this!
contractAssetName: assetName, | ||
contractId, | ||
contractName, | ||
contractId: key, |
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.
This was my mistake/bug here, I believed the contractId was the principal, which is incorrect. It is now set to the entire asset identifier string (fully qualified name) so it can be used in parts where needed.
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: 0
Outside diff range and nitpick comments (1)
src/app/common/stacks-utils.ts (1)
96-96
: Good practice of logging warnings when expected patterns are not met in utility functions.Also applies to: 112-112, 136-136
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!pnpm-lock.yaml
Files selected for processing (15)
- package.json (1 hunks)
- src/app/common/stacks-utils.ts (2 hunks)
- src/app/common/transactions/stacks/transaction.utils.ts (2 hunks)
- src/app/common/utils.ts (1 hunks)
- src/app/features/activity-list/components/transaction-list/stacks-transaction/ft-transfer-item.tsx (2 hunks)
- src/app/features/asset-list/stacks/sip10-token-asset-list/sip10-token-asset-item.tsx (1 hunks)
- src/app/features/asset-list/stacks/sip10-token-asset-list/sip10-token-asset-list-unsupported.tsx (1 hunks)
- src/app/features/asset-list/stacks/sip10-token-asset-list/sip10-token-asset-list.tsx (2 hunks)
- src/app/pages/send/send-crypto-asset-form/form/sip10/use-sip10-send-form.tsx (2 hunks)
- src/app/query/common/alex-sdk/alex-sdk.hooks.ts (3 hunks)
- src/app/query/stacks/sip10/sip10-tokens.utils.ts (2 hunks)
- src/app/query/stacks/token-metadata/fungible-tokens/fungible-token-metadata.query.ts (3 hunks)
- src/app/query/stacks/token-metadata/non-fungible-tokens/non-fungible-token-metadata.query.ts (2 hunks)
- src/app/store/transactions/token-transfer.hooks.ts (2 hunks)
- src/app/ui/utils/README.md (1 hunks)
Files skipped from review due to trivial changes (4)
- package.json
- src/app/features/asset-list/stacks/sip10-token-asset-list/sip10-token-asset-item.tsx
- src/app/pages/send/send-crypto-asset-form/form/sip10/use-sip10-send-form.tsx
- src/app/ui/utils/README.md
Additional comments not posted (18)
src/app/features/asset-list/stacks/sip10-token-asset-list/sip10-token-asset-list.tsx (2)
3-3
: Import and usage ofgetPrincipalFromContractId
are correctly implemented.
28-28
: Change ofkey
property fromtokenName
toname
enhances clarity and consistency in list rendering.src/app/features/asset-list/stacks/sip10-token-asset-list/sip10-token-asset-list-unsupported.tsx (1)
41-41
: Update ofkey
property fromtokenName
toname
correctly aligns with PR objectives and improves list key management.src/app/query/stacks/sip10/sip10-tokens.utils.ts (3)
6-7
: Import and usage ofgetStacksContractIdStringParts
andgetPrincipalFromContractId
are correctly implemented.
18-28
: Use ofgetStacksContractIdStringParts
increateSip10CryptoAssetInfo
function is appropriate and aligns with PR objectives.
43-48
: Changes infilterSip10Tokens
function enhance clarity and correctness by usinggetPrincipalFromContractId
.src/app/query/stacks/token-metadata/non-fungible-tokens/non-fungible-token-metadata.query.ts (1)
4-4
: Import and usage ofgetPrincipalFromContractId
are correctly implemented in the query hook.src/app/features/activity-list/components/transaction-list/stacks-transaction/ft-transfer-item.tsx (1)
14-14
: Import and usage ofgetPrincipalFromContractId
are correctly implemented in theFtTransferItem
component.src/app/query/stacks/token-metadata/fungible-tokens/fungible-token-metadata.query.ts (2)
8-9
: Import and usage ofgetStacksContractIdStringParts
andgetPrincipalFromContractId
are correctly implemented in the query hooks.
Line range hint
61-98
: Changes inuseGetFungibleTokensBalanceMetadataQuery
anduseGetFungibleTokensMetadataQuery
enhance clarity and correctness by usinggetPrincipalFromContractId
andgetStacksContractIdStringParts
.src/app/query/common/alex-sdk/alex-sdk.hooks.ts (2)
13-13
: Updated import to usegetPrincipalFromContractId
aligns with PR objectives to standardizecontractId
usage.
44-44
: Correct usage ofgetPrincipalFromContractId
ensures accurate principal derivation from contract addresses.Also applies to: 71-71
src/app/common/transactions/stacks/transaction.utils.ts (2)
21-21
: Updated import to usegetStacksContractName
aligns with PR objectives for clearer function naming.
76-76
: Correct usage ofgetStacksContractName
ingetTxTitle
enhances clarity in displaying contract names.src/app/common/stacks-utils.ts (2)
6-6
: Import oflogger
is appropriate for logging potential issues in utility functions.
81-156
: Addition of utility functions for parsing Stacks contract identifiers enhances clarity and consistency in handling contract data.src/app/store/transactions/token-transfer.hooks.ts (1)
24-24
: Updated import and usage ofgetStacksContractIdStringParts
correctly handles contract ID parts in token transfer scenarios.Also applies to: 86-88
src/app/common/utils.ts (1)
259-259
: Addition ofgetPrincipalFromContractId
function aligns with PR objectives to standardizecontractId
usage.
8ff1c44
to
f752f34
Compare
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: 0
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!pnpm-lock.yaml
Files selected for processing (15)
- package.json (1 hunks)
- src/app/common/stacks-utils.ts (2 hunks)
- src/app/common/transactions/stacks/transaction.utils.ts (2 hunks)
- src/app/common/utils.ts (1 hunks)
- src/app/features/activity-list/components/transaction-list/stacks-transaction/ft-transfer-item.tsx (2 hunks)
- src/app/features/asset-list/stacks/sip10-token-asset-list/sip10-token-asset-item.tsx (1 hunks)
- src/app/features/asset-list/stacks/sip10-token-asset-list/sip10-token-asset-list-unsupported.tsx (1 hunks)
- src/app/features/asset-list/stacks/sip10-token-asset-list/sip10-token-asset-list.tsx (2 hunks)
- src/app/pages/send/send-crypto-asset-form/form/sip10/use-sip10-send-form.tsx (2 hunks)
- src/app/query/common/alex-sdk/alex-sdk.hooks.ts (3 hunks)
- src/app/query/stacks/sip10/sip10-tokens.utils.ts (2 hunks)
- src/app/query/stacks/token-metadata/fungible-tokens/fungible-token-metadata.query.ts (3 hunks)
- src/app/query/stacks/token-metadata/non-fungible-tokens/non-fungible-token-metadata.query.ts (2 hunks)
- src/app/store/transactions/token-transfer.hooks.ts (2 hunks)
- src/app/ui/utils/README.md (1 hunks)
Files skipped from review as they are similar to previous changes (15)
- package.json
- src/app/common/stacks-utils.ts
- src/app/common/transactions/stacks/transaction.utils.ts
- src/app/common/utils.ts
- src/app/features/activity-list/components/transaction-list/stacks-transaction/ft-transfer-item.tsx
- src/app/features/asset-list/stacks/sip10-token-asset-list/sip10-token-asset-item.tsx
- src/app/features/asset-list/stacks/sip10-token-asset-list/sip10-token-asset-list-unsupported.tsx
- src/app/features/asset-list/stacks/sip10-token-asset-list/sip10-token-asset-list.tsx
- src/app/pages/send/send-crypto-asset-form/form/sip10/use-sip10-send-form.tsx
- src/app/query/common/alex-sdk/alex-sdk.hooks.ts
- src/app/query/stacks/sip10/sip10-tokens.utils.ts
- src/app/query/stacks/token-metadata/fungible-tokens/fungible-token-metadata.query.ts
- src/app/query/stacks/token-metadata/non-fungible-tokens/non-fungible-token-metadata.query.ts
- src/app/store/transactions/token-transfer.hooks.ts
- src/app/ui/utils/README.md
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.
tested with different sip10 tokens and all worked ok for me
src/app/query/stacks/token-metadata/fungible-tokens/fungible-token-metadata.query.ts
Outdated
Show resolved
Hide resolved
@@ -76,3 +77,80 @@ export function getSafeImageCanonicalUri(imageCanonicalUri: string, name: string | |||
? imageCanonicalUri | |||
: ''; | |||
} | |||
|
|||
/** |
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, ui lib doesn't seems as correct place for them
may be refactor it to fn declarations while here?
@314159265359879 could you please test sip10 tokens send transfer in this pr as well |
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.
Tested sending SIP10 tokens with hardware and software extension with this build. LGTM
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.
Great work! As soon as this PR gets merged, #5343 queries PR can get updated and merged too
f752f34
to
ae495cd
Compare
ae495cd
to
fcf8ada
Compare
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: 0
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!pnpm-lock.yaml
Files selected for processing (15)
- package.json (1 hunks)
- src/app/common/stacks-utils.ts (2 hunks)
- src/app/common/transactions/stacks/transaction.utils.ts (2 hunks)
- src/app/common/utils.ts (1 hunks)
- src/app/features/activity-list/components/transaction-list/stacks-transaction/ft-transfer-item.tsx (2 hunks)
- src/app/features/asset-list/stacks/sip10-token-asset-list/sip10-token-asset-item.tsx (1 hunks)
- src/app/features/asset-list/stacks/sip10-token-asset-list/sip10-token-asset-list-unsupported.tsx (1 hunks)
- src/app/features/asset-list/stacks/sip10-token-asset-list/sip10-token-asset-list.tsx (2 hunks)
- src/app/pages/send/send-crypto-asset-form/form/sip10/use-sip10-send-form.tsx (2 hunks)
- src/app/query/common/alex-sdk/alex-sdk.hooks.ts (3 hunks)
- src/app/query/stacks/sip10/sip10-tokens.utils.ts (2 hunks)
- src/app/query/stacks/token-metadata/fungible-tokens/fungible-token-metadata.query.ts (3 hunks)
- src/app/query/stacks/token-metadata/non-fungible-tokens/non-fungible-token-metadata.query.ts (2 hunks)
- src/app/store/transactions/token-transfer.hooks.ts (2 hunks)
- src/app/ui/utils/README.md (1 hunks)
Files skipped from review as they are similar to previous changes (15)
- package.json
- src/app/common/stacks-utils.ts
- src/app/common/transactions/stacks/transaction.utils.ts
- src/app/common/utils.ts
- src/app/features/activity-list/components/transaction-list/stacks-transaction/ft-transfer-item.tsx
- src/app/features/asset-list/stacks/sip10-token-asset-list/sip10-token-asset-item.tsx
- src/app/features/asset-list/stacks/sip10-token-asset-list/sip10-token-asset-list-unsupported.tsx
- src/app/features/asset-list/stacks/sip10-token-asset-list/sip10-token-asset-list.tsx
- src/app/pages/send/send-crypto-asset-form/form/sip10/use-sip10-send-form.tsx
- src/app/query/common/alex-sdk/alex-sdk.hooks.ts
- src/app/query/stacks/sip10/sip10-tokens.utils.ts
- src/app/query/stacks/token-metadata/fungible-tokens/fungible-token-metadata.query.ts
- src/app/query/stacks/token-metadata/non-fungible-tokens/non-fungible-token-metadata.query.ts
- src/app/store/transactions/token-transfer.hooks.ts
- src/app/ui/utils/README.md
This PR coordinates using just the
contractId
in our asset model. I relocated some stacks specific utils tostacks-utils
for now, I'm not sure why they were living in theui
directory. I have renamed them all to coordinate our use bc it was sometimes unclear what part(s) were in the code.Anyway, I think this is better and cleans things up a bit.
*No issue to link, follow up work to: #5414
Summary by CodeRabbit
Summary by CodeRabbit
New Features
Bug Fixes
Refactor
Chores
@leather-wallet/models
version from "0.6.3" to "0.6.4".