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

Add GET /v1/safes overview endpoint #1129

Merged
merged 2 commits into from
Mar 22, 2024
Merged

Add GET /v1/safes overview endpoint #1129

merged 2 commits into from
Mar 22, 2024

Conversation

iamacook
Copy link
Member

@iamacook iamacook commented Feb 12, 2024

This adds a new GET /v1/safes endpoint for "overviews" of specified Safes, returning the following:

type AddressInfo = {
  value: string,
  name: string | null,
  logoUri: string | null
}

type Response = Array<{
  chainId: string;
  address: AddressInfo;
  owners: Array<AddressInfo>;
  threshold: number;
  fiatTotal: string; // e.g. "69.42"
  queued: number;
  awaitingConfirmation: number | null; // `null` if no `walletAddress` specified
}>

It requires the following search parameters: currency and safes. It also accepts wallet_address, exclude_spam and trusted search parameters:

currency

The desired fiat to return the balance of the Safe in, e.g. USD

safes

A CAIP-10 comma separated list of Safe addresses, without the EIP155 namespace, e.g. 1:0x123...,1:0x456...,137:0x789.

⚠️ Note: this is limited to a maximum of 7 but can be modified by setting the MAX_SAFE_OVERVIEWS env. var.

walletAddress

The owner which is checked for awaiting confirmations as a "standard" address, e.g. 0x123...

trusted (default: false)

Whether to return "trusted" transactions or not.

exclude_spam (default: true)

Whether to exclude "spam" tokens or not.

@iamacook iamacook self-assigned this Feb 12, 2024
@coveralls
Copy link

coveralls commented Feb 12, 2024

Pull Request Test Coverage Report for Build 8389550937

Details

  • 49 of 49 (100.0%) changed or added relevant lines in 4 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.008%) to 93.33%

Files with Coverage Reduction New Missed Lines %
src/routes/transactions/entities/tests/human-description.builder.ts 1 90.0%
Totals Coverage Status
Change from base Build 8388301253: 0.008%
Covered Lines: 6481
Relevant Lines: 6698

💛 - Coveralls

@iamacook iamacook marked this pull request as ready for review March 22, 2024 10:30
@iamacook iamacook requested a review from a team as a code owner March 22, 2024 10:30
@iamacook
Copy link
Member Author

iamacook commented Mar 22, 2024

Marking as a draft whilst I fix the tests.

@iamacook iamacook marked this pull request as draft March 22, 2024 11:08
Copy link
Member

@hectorgomezv hectorgomezv left a comment

Choose a reason for hiding this comment

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

Besides the incompatibilities with newer code changes in safes.controller.overview.spec.ts, it looks good to me!

@@ -10,6 +10,7 @@ export interface IBalancesRepository {
getBalances(args: {
chainId: string;
safeAddress: string;
fiatCode: string;
Copy link
Member

Choose a reason for hiding this comment

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

Good catch! 🙂

@iamacook iamacook marked this pull request as ready for review March 22, 2024 11:32
Copy link
Member

@hectorgomezv hectorgomezv left a comment

Choose a reason for hiding this comment

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

🚀

@iamacook iamacook merged commit 900dc99 into main Mar 22, 2024
16 checks passed
@iamacook iamacook deleted the safe-overview-endpoint branch March 22, 2024 12:45
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.

None yet

3 participants