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

Implement AddressBookItem update #2149

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

hectorgomezv
Copy link
Member

@hectorgomezv hectorgomezv commented Nov 22, 2024

Summary

This PR adds the ability to update an AddressBookItem by adding the following endpoint to the service:

PUT /accounts/:address/address-books/:chainId/:addressBookItemId

The endpoint is behind the Accounts scope and requires authentication.

Changes

  • Adds UPDATE route for deleting an AddressBookItem.

@hectorgomezv hectorgomezv self-assigned this Nov 22, 2024
@hectorgomezv hectorgomezv marked this pull request as ready for review November 22, 2024 14:51
@hectorgomezv hectorgomezv requested a review from a team as a code owner November 22, 2024 14:51
@PooyaRaki PooyaRaki linked an issue Dec 19, 2024 that may be closed by this pull request
@PooyaRaki PooyaRaki marked this pull request as draft January 6, 2025 11:21
@jmealy jmealy marked this pull request as ready for review January 6, 2025 14:14
authPayload: args.authPayload,
address: args.address,
});
const addressBook = await this.datasource.getAddressBook({
Copy link
Contributor

Choose a reason for hiding this comment

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

Question: Does it happen that the account is not found? If so, we shouldn't try to fetch the address book and update.

Copy link
Contributor

Choose a reason for hiding this comment

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

it will throw here if there is no account so it won't try to fetch/update the addressbook

@@ -14,91 +13,6 @@ describe('CreateAddressBookItemDtoSchema', () => {
expect(result.success).toBe(true);
});

it('should not verify a CreateAddressBookItemDto with a shorter name', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are CreateAddressBookItemDto tests deleted?

Copy link
Contributor

Choose a reason for hiding this comment

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

From a comment in a previous PR: #2151 (comment)

@iamacook suggested to just keep the tests for address book names in the address book name schema, so as not to test the same cases multiple times. I didn't remove them in that PR so removing them here.

expect(result.success).toBe(true);
});

it('should not verify an UpdateAddressBookItemDto with a string id', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems to me that we are testing Zod validator, right?

]);
});

it('should not verify an UpdateAddressBookItemDto with a malformed address', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Here as well, it seems like we are testing the external validator library.

Copy link
Member

Choose a reason for hiding this comment

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

I would keep this as it's important to ensure addresses come in correct.

]);
});

it('should checksum the address of an UpdateAddressBookItemDto', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as the previous comment.

Copy link
Member

Choose a reason for hiding this comment

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

I would keep this as it's important to ensure addresses come in checksummed.

@@ -107,61 +107,6 @@ describe('AddressBookSchema', () => {
]);
});

it('should not verify an AddressBookItem with a shorter name', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Question: Why are these tests deleted?

Copy link
Contributor

Choose a reason for hiding this comment

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

same as #2149 (comment)

@jmealy jmealy enabled auto-merge (squash) January 13, 2025 09:22
@jmealy jmealy disabled auto-merge January 13, 2025 09:23
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.

[User Accounts] Address Book API
4 participants