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(api-kit): Support for SafeOperation confirmations endpoints #876

Open
wants to merge 15 commits into
base: development
Choose a base branch
from

Conversation

tmjssz
Copy link
Contributor

@tmjssz tmjssz commented Jun 20, 2024

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.

GET /v1/safe-operations/{safe_operation_hash}/confirmations/

confirmSafeOperation

Adds a confirmation for a SafeOperation.

POST /v1/safe-operations/{safe_operation_hash}/confirmations/

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`
@coveralls
Copy link

coveralls commented Jun 20, 2024

Pull Request Test Coverage Report for Build 9592708241

Details

  • 9 of 18 (50.0%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.5%) to 77.39%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/relay-kit/src/packs/safe-4337/SafeOperation.ts 1 2 50.0%
packages/relay-kit/src/packs/safe-4337/Safe4337Pack.ts 0 3 0.0%
packages/api-kit/src/SafeApiKit.ts 8 13 61.54%
Totals Coverage Status
Change from base Build 9485617547: -0.5%
Covered Lines: 792
Relevant Lines: 949

💛 - Coveralls

@tmjssz tmjssz linked an issue Jun 20, 2024 that may be closed by this pull request
@coveralls
Copy link

coveralls commented Jun 20, 2024

Pull Request Test Coverage Report for Build 9592817524

Details

  • 9 of 18 (50.0%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.5%) to 77.39%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/relay-kit/src/packs/safe-4337/SafeOperation.ts 1 2 50.0%
packages/relay-kit/src/packs/safe-4337/Safe4337Pack.ts 0 3 0.0%
packages/api-kit/src/SafeApiKit.ts 8 13 61.54%
Totals Coverage Status
Change from base Build 9485617547: -0.5%
Covered Lines: 792
Relevant Lines: 949

💛 - Coveralls

@@ -1,4 +1,4 @@
import SafeApiKit from '@safe-global/api-kit'
import SafeApiKit from '@safe-global/api-kit/index'
Copy link
Collaborator

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?

Copy link
Contributor Author

@tmjssz tmjssz Jun 20, 2024

Choose a reason for hiding this comment

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

Without it, I see this weird error:
Screenshot 2024-06-20 at 17 12 36

All the other files in the same folder are defining the same import path for the SafeApiKit. That's why I changed it accordingly here and it removed the error.

@coveralls
Copy link

coveralls commented Jun 20, 2024

Pull Request Test Coverage Report for Build 9599977083

Warning: 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

  • 9 of 18 (50.0%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.5%) to 77.39%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/relay-kit/src/packs/safe-4337/SafeOperation.ts 1 2 50.0%
packages/relay-kit/src/packs/safe-4337/Safe4337Pack.ts 0 3 0.0%
packages/api-kit/src/SafeApiKit.ts 8 13 61.54%
Totals Coverage Status
Change from base Build 9485617547: -0.5%
Covered Lines: 792
Relevant Lines: 949

💛 - Coveralls

@tmjssz
Copy link
Contributor Author

tmjssz commented Jun 20, 2024

Some tests related to SafeDelegates started to fail, but it seems unrelated to my changes because I'm getting the same errors on the development branch

Screenshot 2024-06-20 at 17 26 21

@dasanra
Copy link
Collaborator

dasanra commented Jun 21, 2024

Don't worry about the tests, they are not related with this PR. Already checked with the API team.

Related to this #879

@coveralls
Copy link

coveralls commented Jun 21, 2024

Pull Request Test Coverage Report for Build 9614186193

Details

  • 9 of 18 (50.0%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.5%) to 77.607%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/relay-kit/src/packs/safe-4337/SafeOperation.ts 1 2 50.0%
packages/relay-kit/src/packs/safe-4337/Safe4337Pack.ts 0 3 0.0%
packages/api-kit/src/SafeApiKit.ts 8 13 61.54%
Totals Coverage Status
Change from base Build 9614168250: -0.5%
Covered Lines: 787
Relevant Lines: 944

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jun 24, 2024

Pull Request Test Coverage Report for Build 9646217403

Warning: 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

  • 12 of 19 (63.16%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.3%) to 77.778%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/relay-kit/src/packs/safe-4337/Safe4337Pack.ts 2 3 66.67%
packages/relay-kit/src/packs/safe-4337/SafeOperation.ts 2 3 66.67%
packages/api-kit/src/SafeApiKit.ts 8 13 61.54%
Totals Coverage Status
Change from base Build 9614168250: -0.3%
Covered Lines: 790
Relevant Lines: 945

💛 - Coveralls

@@ -325,3 +286,12 @@ export type AddSafeOperationProps = {
validAfter?: number
}
}

export type GetSafeOperationConfirmationListProps = {
Copy link
Contributor

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

Copy link
Contributor Author

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

* @throws "Invalid SafeOperation hash"
* @throws "Invalid data"
*/
async getSafeOperationConfirmations({
Copy link
Contributor

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.

Copy link
Contributor Author

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 👍

@coveralls
Copy link

coveralls commented Jun 25, 2024

Pull Request Test Coverage Report for Build 9666618943

Warning: 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

  • 12 of 19 (63.16%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.7%) to 77.417%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/relay-kit/src/packs/safe-4337/Safe4337Pack.ts 2 3 66.67%
packages/relay-kit/src/packs/safe-4337/SafeOperation.ts 2 3 66.67%
packages/api-kit/src/SafeApiKit.ts 8 13 61.54%
Totals Coverage Status
Change from base Build 9614168250: -0.7%
Covered Lines: 774
Relevant Lines: 929

💛 - Coveralls

This changes the type for `limit` + `offset` from string to number for the functions:
* getSafeDelegates
* getMessages
* getSafeOperationsByAddress
@coveralls
Copy link

coveralls commented Jun 26, 2024

Pull Request Test Coverage Report for Build 9676087509

Warning: 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

  • 18 of 31 (58.06%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.7%) to 77.417%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/relay-kit/src/packs/safe-4337/Safe4337Pack.ts 2 3 66.67%
packages/relay-kit/src/packs/safe-4337/SafeOperation.ts 2 3 66.67%
packages/api-kit/src/SafeApiKit.ts 14 25 56.0%
Totals Coverage Status
Change from base Build 9614168250: -0.7%
Covered Lines: 774
Relevant Lines: 929

💛 - Coveralls

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.

[4337] Add signature method for api-kit
4 participants