Skip to content

Conversation

@iamacook
Copy link
Contributor

@iamacook iamacook commented Nov 24, 2022

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.

@iamacook iamacook self-assigned this Nov 24, 2022
@github-actions
Copy link

github-actions bot commented Nov 24, 2022

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 0 0
Ignored 0 N/A
  • Result: ✅ success
  • Annotations: 0 total

Report generated by eslint-plus-action

@iamacook iamacook changed the title WIP: feat: EIP-1271 propose, confirm and list endpoints feat: EIP-1271 propose, confirm and list endpoints Nov 24, 2022
@iamacook iamacook requested a review from katspaugh November 24, 2022 11:56
@iamacook iamacook marked this pull request as ready for review November 24, 2022 11:56
return callEndpoint(
baseUrl,
'/v1/chains/{chainId}/safes/{safe_address}/messages',
{ path: { chainId, safe_address: address }, query: {} },
Copy link
Member

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?

Copy link
Contributor Author

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).

Comment on lines +199 to +202
get:
| operations['get_safe_messages']
/** This is actually supposed to be POST but it breaks our type paradise */
| operations['propose_safe_message']
Copy link
Member

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.

Copy link
Contributor Author

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.

status: SafeMessageStatus
logoUri: string | null
name: string | null
message: string | Record<string, any>
Copy link
Member

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?

Copy link
Contributor Author

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.

Comment on lines +22 to +23
logoUri: string | null
name: string | null
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

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.

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

@iamacook iamacook requested a review from katspaugh November 24, 2022 13:44
@iamacook iamacook merged commit 2a5134b into main Nov 24, 2022
@iamacook iamacook deleted the eip-1271-endpoints branch November 24, 2022 14:06
@iamacook iamacook linked an issue Nov 24, 2022 that may be closed by this pull request
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.

[EIP-1271] Add endpoints

4 participants