Skip to content

Conversation

@zlayine
Copy link
Contributor

@zlayine zlayine commented Mar 21, 2025

PR Type

  • Bug fix
  • Enhancement

Description

  • Added session retrieval in connection store if provider exists.

  • Fixed metadataHash handling in transaction signing.

  • Upgraded multiple dependency versions in package.json.


Changes walkthrough 📝

Relevant files
Enhancement
App.vue
Add session retrieval based on connection provider             

resources/js/components/App.vue

  • Inserted conditional call to getSession when provider exists.
+4/-0     
package.json
Upgrade project dependency versions                                           

package.json

  • Upgraded dependency versions for polkadot libs and others.
  • Updated UI component and wallet connection packages.
  • +13/-13 
    Bug fix
    transaction.ts
    Update metadataHash logic for transactions                             

    resources/js/store/transaction.ts

  • Introduced computed metadataHash based on signingPayloadJson.
  • Updated payload to use computed metadataHash.
  • +5/-1     

    Need help?
  • Type /help how to ... in the comments thread for any questions about PR-Agent usage.
  • Check out the documentation for more information.
  • @github-actions
    Copy link

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Code Redundancy

    The newly added session retrieval code calls useConnectionStore() twice. Consider storing the connection store in a variable to prevent potential duplicate evaluations or side effects.

    if (useConnectionStore().provider) {
        useConnectionStore().getSession();
    }
    Conditional Logic

    The conditional handling for metadataHash uses a hardcoded check against '00'. Verify that this logic correctly covers all edge cases and aligns with transactional expectations.

    const metadataHash =
        transaction.signingPayloadJson.metadataHash === '00'
            ? '0x0000000000000000000000000000000000000000000000000000000000000000'
            : transaction.signingPayloadJson.metadataHash;

    @github-actions
    Copy link

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Impact
    General
    Reuse store instance

    Assign the connection store to a variable to prevent redundant calls and ensure
    consistency.

    resources/js/components/App.vue [48-50]

    -if (useConnectionStore().provider) {
    -    useConnectionStore().getSession();
    +const connectionStore = useConnectionStore();
    +if (connectionStore.provider) {
    +    connectionStore.getSession();
     }
    Suggestion importance[1-10]: 5

    __

    Why: The suggestion minimizes redundant calls by storing the connection store in a variable, improving consistency, though it is a minor refactor.

    Low
    Optimize metadata access

    Extract transaction.signingPayloadJson into a variable to streamline access and
    avoid redundancy.

    resources/js/store/transaction.ts [48-51]

    -const metadataHash =
    -    transaction.signingPayloadJson.metadataHash === '00'
    -        ? '0x0000000000000000000000000000000000000000000000000000000000000000'
    -        : transaction.signingPayloadJson.metadataHash;
    +const { metadataHash: rawMetadataHash } = transaction.signingPayloadJson;
    +const metadataHash = rawMetadataHash === '00'
    +    ? '0x0000000000000000000000000000000000000000000000000000000000000000'
    +    : rawMetadataHash;
    Suggestion importance[1-10]: 5

    __

    Why: Extracting transaction.signingPayloadJson into a variable improves readability and reduces code repetition, but the change is largely stylistic with minimal functional impact.

    Low

    @zlayine zlayine merged commit 014eb2c into master Mar 21, 2025
    4 checks passed
    @zlayine zlayine deleted the bugfix/PLA-2222/update-dependecies branch March 21, 2025 13:13
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Development

    Successfully merging this pull request may close these issues.

    2 participants