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

feat: sway type matchers #3137

Merged
merged 17 commits into from
Sep 12, 2024
Merged

Conversation

nedsalk
Copy link
Contributor

@nedsalk nedsalk commented Sep 10, 2024

Part of TS-597

Relates to:

Summary

This PR gives a proof-of-concept to how we'd go from a sway type to a corresponding coder or typer.

A coder example would be:

const matcher = createMatcher<Coder>({
  string: StringCoder,
  empty: EmptyCoder,
  enum: EnumCoder,
  result: EnumCoder,
  ...
});

const resultCoder = matcher({ swayType: 'enum std::result::Result' });

The same approach would be for typers:

const matcher = createMatcher<Typer>({
  string: StringTyper,
  empty: EmptyTyper,
  enum: EnumTyper,
  result: ResultTyper,
  ...
});

const resultTyper = matcher({ swayType: 'enum std::result::Result' });

Checklist

  • All changes are covered by tests (or not applicable)
  • All changes are documented (or not applicable)
  • I reviewed the entire PR myself (preferably, on GH UI)
  • I described all Breaking Changes (or there's none)

@nedsalk nedsalk added the feat Issue is a feature label Sep 10, 2024
Copy link

vercel bot commented Sep 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
create-fuels-template ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 12, 2024 7:43am
ts-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 12, 2024 7:43am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
create-fuels-counter-example ⬜️ Ignored (Inspect) Sep 12, 2024 7:43am

@nedsalk nedsalk changed the base branch from master to np/feat/abi-refactor September 10, 2024 07:30
Co-authored-by: Anderson Arboleya <anderson@arboleya.me>
Copy link
Contributor

@Dhaiwat10 Dhaiwat10 left a comment

Choose a reason for hiding this comment

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

Neat work

@petertonysmith94 petertonysmith94 merged commit 882a0a2 into np/feat/abi-refactor Sep 12, 2024
25 checks passed
@petertonysmith94 petertonysmith94 deleted the ns/feat/abi-matchers branch September 12, 2024 14:01
@petertonysmith94 petertonysmith94 mentioned this pull request Sep 16, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat Issue is a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants