Skip to content
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

refactor(ContractCallResult): Added errorMessage, plain value and success flag #1440

Merged
merged 11 commits into from
Oct 30, 2024

Conversation

freemanzMrojo
Copy link
Member

@freemanzMrojo freemanzMrojo commented Oct 25, 2024

Description

Refactor of the ContractCallResult type so includes an error message. This way the executeCall methods return a single type rather than 2.

plain value vs array value applies mainly to structs, so for the following contract method, the result would be:

    // Custom struct type
    struct ExampleStruct {
        uint id;
        string name;
    }

    function structData(ExampleStruct memory _structData) public pure returns (ExampleStruct memory) {
        return _structData;
    }
  • plain: { id: 10n, name: 'test' }
  • array: [[10n, 'test']] (structs are represented as nested arrays of values, tuple types would be a flattened array of values)

Closes #1438

Type of change

  • Refactor of existing code

How Has This Been Tested?

Using the existing SDK codebase

Test Configuration:

  • Node.js Version: 20.17.0
  • Yarn Version: 1.22.19

Checklist:

  • My code follows the coding standards of this project
  • I have performed a self-review of my code
  • I have commented on my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • New and existing integration tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have not added any vulnerable dependencies to my code

Copy link

github-actions bot commented Oct 25, 2024

Test Coverage

Summary

Lines Statements Branches Functions
Coverage: 99%
99.06% (4350/4391) 97.71% (1413/1446) 99.11% (896/904)
Title Tests Skipped Failures Errors Time
core 808 0 💤 0 ❌ 0 🔥 2m 13s ⏱️
network 734 0 💤 0 ❌ 0 🔥 4m 52s ⏱️
errors 42 0 💤 0 ❌ 0 🔥 16.379s ⏱️

@freemanzMrojo freemanzMrojo changed the title [DRAFT] refactor(ContractCallResult): Added errorMessage, plain value and success flag refactor(ContractCallResult): Added errorMessage, plain value and success flag Oct 25, 2024
@freemanzMrojo freemanzMrojo marked this pull request as ready for review October 25, 2024 13:53
@freemanzMrojo freemanzMrojo requested a review from a team as a code owner October 25, 2024 13:53
@fabiorigam fabiorigam merged commit 2993e32 into main Oct 30, 2024
14 checks passed
@fabiorigam fabiorigam deleted the refactor/1438-contactcallresult branch October 30, 2024 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants