-
Notifications
You must be signed in to change notification settings - Fork 177
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(api-kit): Support for SafeOperation confirmations endpoints #876
base: development
Are you sure you want to change the base?
Conversation
Calls the transaction-service's `POST /v1/safe-operations/{safe_operation_hash}/confirmations/` endpoint.
Calls the transaction-service's `GET /v1/safe-operations/{safe_operation_hash}/confirmations/` endpoint.
Fix endpoint test for `confirmTransaction`
Pull Request Test Coverage Report for Build 9592708241Details
💛 - Coveralls |
Pull Request Test Coverage Report for Build 9592817524Details
💛 - Coveralls |
@@ -1,4 +1,4 @@ | |||
import SafeApiKit from '@safe-global/api-kit' | |||
import SafeApiKit from '@safe-global/api-kit/index' |
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.
Is it mandatory to add the index
?
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.
Pull Request Test Coverage Report for Build 9599977083Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
Don't worry about the tests, they are not related with this PR. Already checked with the API team. Related to this #879 |
Pull Request Test Coverage Report for Build 9614186193Details
💛 - Coveralls |
Pull Request Test Coverage Report for Build 9646217403Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
@@ -325,3 +286,12 @@ export type AddSafeOperationProps = { | |||
validAfter?: number | |||
} | |||
} | |||
|
|||
export type GetSafeOperationConfirmationListProps = { |
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.
It is a little bit weird to use limit
and offset
as a string since they are associated with record count in a database. I imagine that the interface will be something like apiKit.getSafeOperationConfirmations({ safeOperationHash, limit: '10' })
.
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.
Yes good point. Changed the type to number
packages/api-kit/src/SafeApiKit.ts
Outdated
* @throws "Invalid SafeOperation hash" | ||
* @throws "Invalid data" | ||
*/ | ||
async getSafeOperationConfirmations({ |
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.
Please double check how we do this. This kind of looks like a getSafeOperationConfirmationsByHash with a different name as the hash itself is a part of a "perma-link". In this case, it would be common to separate the interface as getSafeOperationConfirmations(hash, { limit, offset })
since that would be somehow associated with a domain model.
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.
Updated the function signature accordingly 👍
Pull Request Test Coverage Report for Build 9666618943Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
This changes the type for `limit` + `offset` from string to number for the functions: * getSafeDelegates * getMessages * getSafeOperationsByAddress
Pull Request Test Coverage Report for Build 9676087509Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
What it solves
Resolves #856
How this PR fixes it
Extend the
api-kit
by two functions using the following endpoints of the transaction-service.getSafeOperationConfirmations
Returns the list of confirmations for a given a SafeOperation.
confirmSafeOperation
Adds a confirmation for a SafeOperation.