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: support message types #3016

Draft
wants to merge 20 commits into
base: master
Choose a base branch
from

Conversation

Torres-ssf
Copy link
Contributor

@Torres-ssf Torres-ssf commented Aug 22, 2024

Summary

This PR corrects the JSON ABI property name by renaming messagesTypes.message_id to messagesTypes.messageId, which is the correct name within a generated JSO ABI. The exhaustive-example contract has also been updated to include a method that generates entries for the messagesTypes array within its JSON ABI. A new test case has also been added to validate that the property is generated correctly.

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)

@Torres-ssf Torres-ssf added bug Issue is a bug feat Issue is a feature labels Aug 22, 2024
@Torres-ssf Torres-ssf self-assigned this Aug 22, 2024
({ type }) => ReceiptType.MessageOut === type
) as ReceiptMessageOut;

expect(messageOutReceipt.recipient).toBe(recipient.address.toB256());
Copy link
Contributor

@nedsalk nedsalk Aug 23, 2024

Choose a reason for hiding this comment

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

I suppose that the data field of the MessageOut receipt is tied to its respective entry in the messageTypes array of the abi. It seems to me that part of supporting them, as the linked issue #2347 requires, would be to have this data decoded in these receipts.

expect(messageOutReceipt.data).toStrictEqual(msg_data);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@nedsalk The approach that I am using to decode the message data has worked for both boolean and u8 Sway types. However, it does not work for the Bytes type. What I am missing? This is the contract and its JSON ABI

Copy link

vercel bot commented Aug 28, 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 6, 2024 1:42pm
fuels-ts ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 6, 2024 1:42pm
ts-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 6, 2024 1:42pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
create-fuels-counter-example ⬜️ Ignored (Inspect) Sep 6, 2024 1:42pm

@Torres-ssf Torres-ssf marked this pull request as draft August 28, 2024 13:34
Co-authored-by: Nedim Salkić <[email protected]>
@Torres-ssf Torres-ssf changed the title fix: rename abi MessageType.messageId property feat: support message types Aug 28, 2024
@Torres-ssf Torres-ssf added the feat Issue is a feature label Aug 28, 2024
Copy link
Contributor

github-actions bot commented Sep 6, 2024

Coverage Report:

Lines Branches Functions Statements
79.23%(-0.14%) 72.04%(-0.11%) 77.6%(-0.13%) 79.3%(-0.13%)
Changed Files:
Ok File (✨=New File) Lines Branches Functions Statements
🔴 packages/abi-coder/src/Interface.ts 59.37%
(-16.63%)
53.84%
(-9.79%)
64.28%
(-10.72%)
60%
(-15%)
🔴 packages/account/src/providers/transaction-response/transaction-response.ts 71.57%
(-5.7%)
63.15%
(-2.3%)
88.23%
(-5.52%)
71.57%
(-5.7%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is a bug feat Issue is a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support messagesTypes for the ABI
3 participants