Skip to content

feat: contracts-sdk cleaning #780

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

Conversation

FedericoAmura
Copy link
Contributor

@FedericoAmura FedericoAmura commented Jan 28, 2025

Description

This PR removes the old ABIs we had at contracts-sdk and the litContracts.<CONTRACT>.<write|read>.<contractFunction> pattern. As now definitions come dynamically from NETWORK_CONTEXT_BY_NETWORK in @lit-protocol/constants

In replacement of those functions, two new are added LitContracts.resolveLitContract and LitContracts.callLitContract which provide contract data resolution from the context and calls to its contract in a type safe way

Using resolveLitContract provides a specific contract data in one network (accepts index in case of multiple deployed contracts)
That contract data has the address and abi, which when passed to callLitContract derives types and checks the function name and the param types. It also types the return value
Screenshot from 2025-01-28 21-02-36

Wrong function name param (also provides autocomplete)
Screenshot from 2025-01-28 20-57-06

Wrong param types
Screenshot from 2025-01-28 20-57-27

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Unit and integration test should not be modified
  • Manually with consumer code

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented 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
  • Any dependent changes have been merged and published in downstream modules

@FedericoAmura FedericoAmura self-assigned this Jan 28, 2025
@FedericoAmura FedericoAmura marked this pull request as ready for review January 28, 2025 20:12
Copy link
Collaborator

@Ansonhkg Ansonhkg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AWESOME!

@Ansonhkg Ansonhkg merged commit ff13645 into feature/lit-4143-js-sdk-sdk-compatibility-against-httpsgithubcomlit Jan 29, 2025
3 of 4 checks passed
@Ansonhkg Ansonhkg deleted the feature/lit-4147-js-sdk-clean-up-contracts-sdk-abis branch January 29, 2025 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants