- 
                Notifications
    You must be signed in to change notification settings 
- Fork 26
feat: EIP-1271 propose, confirm and list endpoints #100
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
| ESLint Summary View Full Report
 
 
 Report generated by eslint-plus-action | 
| return callEndpoint( | ||
| baseUrl, | ||
| '/v1/chains/{chainId}/safes/{safe_address}/messages', | ||
| { path: { chainId, safe_address: address }, query: {} }, | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to pass an empty query?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sadly, yes. There are some strict typing issues involved. (This is the same for the functions that get transactions).
| get: | ||
| | operations['get_safe_messages'] | ||
| /** This is actually supposed to be POST but it breaks our type paradise */ | ||
| | operations['propose_safe_message'] | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I now regret I took the easy way out making them all get endpoints.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. I tried playing with function overloads but it wasn't having it. I'd like to explore cleaning these up in a later PR.
        
          
                src/types/safe-messages.ts
              
                Outdated
          
        
      | status: SafeMessageStatus | ||
| logoUri: string | null | ||
| name: string | null | ||
| message: string | Record<string, any> | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Record<string, any> – is it really any, or just atomic types? Can it have nested records?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a EIP712TypedData type.
| logoUri: string | null | ||
| name: string | null | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In other similar types we use logoUri?: string AFAIR, same for name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I confirmed with @fmrsabino that in this instance it will return string | null. There are other places where it is also the case but incorrectly typed iirc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure? I refactored this not so long ago, and I was cross-referencing the tx-service types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
null is returned if the Safe app is not found for (name or logoUri).
From the CGW side both of these fields should be serialised even with a nullable value. But I'm only referencing to this specific endpoint
What it solves
This integrates the endpoints to get all, propose or confirm
SafeMessages.How this PR fixes it
The endpoints and types are implemented according to the backend spec.