Skip to content

Commit

Permalink
PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
hectorgomezv committed Jul 30, 2024
1 parent 8418eeb commit 121f316
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ export function counterfactualSafeBuilder(): IBuilder<CounterfactualSafe> {
.with('chain_id', faker.string.numeric({ length: 6 }))
.with('creator', getAddress(faker.finance.ethereumAddress()))
.with('fallback_handler', getAddress(faker.finance.ethereumAddress()))
.with('owners',
Array.from(
{ length: faker.number.int({ min: 1, max: 5 }) },
() => getAddress(faker.finance.ethereumAddress())
)
.with(
'owners',
Array.from({ length: faker.number.int({ min: 1, max: 5 }) }, () =>
getAddress(faker.finance.ethereumAddress()),
),
)
.with('predicted_address', getAddress(faker.finance.ethereumAddress()))
.with('salt_nonce', faker.string.hexadecimal())
.with('singleton_address', getAddress(faker.finance.ethereumAddress()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ describe('CounterfactualSafesController', () => {

await request(app.getHttpServer())
.get(
`/v1/accounts/${address}/storage/counterfactual-safes/${chain.chainId}/${counterfactualSafe.predicted_address}`,
`/v1/accounts/${address}/counterfactual-safes/${chain.chainId}/${counterfactualSafe.predicted_address}`,
)
.set('Cookie', [`access_token=${accessToken}`])
.expect(200)
Expand All @@ -145,7 +145,7 @@ describe('CounterfactualSafesController', () => {

await request(app.getHttpServer())
.get(
`/v1/accounts/${address}/storage/counterfactual-safes/${chain.chainId}/${counterfactualSafe.predicted_address}`,
`/v1/accounts/${address}/counterfactual-safes/${chain.chainId}/${counterfactualSafe.predicted_address}`,
)
.expect(403);

Expand All @@ -163,7 +163,7 @@ describe('CounterfactualSafesController', () => {

await request(app.getHttpServer())
.get(
`/v1/accounts/${address}/storage/counterfactual-safes/${chain.chainId}/${counterfactualSafe.predicted_address}`,
`/v1/accounts/${address}/counterfactual-safes/${chain.chainId}/${counterfactualSafe.predicted_address}`,
)
.set('Cookie', [`access_token=${accessToken}`])
.expect(403);
Expand All @@ -190,7 +190,7 @@ describe('CounterfactualSafesController', () => {

await request(app.getHttpServer())
.get(
`/v1/accounts/${address}/storage/counterfactual-safes/${chain.chainId}/${counterfactualSafe.predicted_address}`,
`/v1/accounts/${address}/counterfactual-safes/${chain.chainId}/${counterfactualSafe.predicted_address}`,
)
.set('Cookie', [`access_token=${accessToken}`])
.expect(403);
Expand Down Expand Up @@ -218,7 +218,7 @@ describe('CounterfactualSafesController', () => {
expect(() => jwtService.verify(accessToken)).toThrow('jwt expired');
await request(app.getHttpServer())
.get(
`/v1/accounts/${address}/storage/counterfactual-safes/${chain.chainId}/${counterfactualSafe.predicted_address}`,
`/v1/accounts/${address}/counterfactual-safes/${chain.chainId}/${counterfactualSafe.predicted_address}`,
)
.set('Cookie', [`access_token=${accessToken}`])
.expect(403);
Expand All @@ -241,7 +241,7 @@ describe('CounterfactualSafesController', () => {

await request(app.getHttpServer())
.get(
`/v1/accounts/${address}/storage/counterfactual-safes/${chain.chainId}/${counterfactualSafe.predicted_address}`,
`/v1/accounts/${address}/counterfactual-safes/${chain.chainId}/${counterfactualSafe.predicted_address}`,
)
.set('Cookie', [`access_token=${accessToken}`])
.expect(403);
Expand All @@ -264,7 +264,7 @@ describe('CounterfactualSafesController', () => {

await request(app.getHttpServer())
.get(
`/v1/accounts/${address}/storage/counterfactual-safes/${chainId}/${counterfactualSafe.predicted_address}`,
`/v1/accounts/${address}/counterfactual-safes/${chainId}/${counterfactualSafe.predicted_address}`,
)
.set('Cookie', [`access_token=${accessToken}`])
.expect(403);
Expand Down Expand Up @@ -306,7 +306,7 @@ describe('CounterfactualSafesController', () => {

await request(app.getHttpServer())
.get(
`/v1/accounts/${address}/storage/counterfactual-safes/${chain.chainId}/${counterfactualSafe.predicted_address}`,
`/v1/accounts/${address}/counterfactual-safes/${chain.chainId}/${counterfactualSafe.predicted_address}`,
)
.set('Cookie', [`access_token=${accessToken}`])
.expect(404);
Expand Down Expand Up @@ -346,7 +346,7 @@ describe('CounterfactualSafesController', () => {
createCounterfactualSafeDtoBuilder().build();

await request(app.getHttpServer())
.put(`/v1/accounts/${address}/storage/counterfactual-safes`)
.put(`/v1/accounts/${address}/counterfactual-safes`)
.set('Cookie', [`access_token=${accessToken}`])
.send(createCounterfactualSafeDto)
.expect(200)
Expand Down Expand Up @@ -408,7 +408,7 @@ describe('CounterfactualSafesController', () => {
createCounterfactualSafeDtoBuilder().build();

await request(app.getHttpServer())
.put(`/v1/accounts/${address}/storage/counterfactual-safes`)
.put(`/v1/accounts/${address}/counterfactual-safes`)
.set('Cookie', [`access_token=${accessToken}`])
.send(createCounterfactualSafeDto)
.expect(200)
Expand Down Expand Up @@ -437,7 +437,7 @@ describe('CounterfactualSafesController', () => {
createCounterfactualSafeDtoBuilder().build();

await request(app.getHttpServer())
.put(`/v1/accounts/${address}/storage/counterfactual-safes`)
.put(`/v1/accounts/${address}/counterfactual-safes`)
.send(createCounterfactualSafeDto)
.expect(403);

Expand All @@ -458,7 +458,7 @@ describe('CounterfactualSafesController', () => {

expect(() => jwtService.verify(accessToken)).toThrow('jwt malformed');
await request(app.getHttpServer())
.put(`/v1/accounts/${address}/storage/counterfactual-safes`)
.put(`/v1/accounts/${address}/counterfactual-safes`)
.set('Cookie', [`access_token=${accessToken}`])
.send(createCounterfactualSafeDto)
.expect(403);
Expand Down Expand Up @@ -488,7 +488,7 @@ describe('CounterfactualSafesController', () => {

expect(() => jwtService.verify(accessToken)).toThrow('jwt not active');
await request(app.getHttpServer())
.put(`/v1/accounts/${address}/storage/counterfactual-safes`)
.put(`/v1/accounts/${address}/counterfactual-safes`)
.set('Cookie', [`access_token=${accessToken}`])
.send(createCounterfactualSafeDto)
.expect(403);
Expand Down Expand Up @@ -518,7 +518,7 @@ describe('CounterfactualSafesController', () => {

expect(() => jwtService.verify(accessToken)).toThrow('jwt expired');
await request(app.getHttpServer())
.put(`/v1/accounts/${address}/storage/counterfactual-safes`)
.put(`/v1/accounts/${address}/counterfactual-safes`)
.set('Cookie', [`access_token=${accessToken}`])
.send(createCounterfactualSafeDto)
.expect(403);
Expand All @@ -544,7 +544,7 @@ describe('CounterfactualSafesController', () => {
const accessToken = jwtService.sign(authPayloadDto);

await request(app.getHttpServer())
.put(`/v1/accounts/${address}/storage/counterfactual-safes`)
.put(`/v1/accounts/${address}/counterfactual-safes`)
.set('Cookie', [`access_token=${accessToken}`])
.send(createCounterfactualSafeDto)
.expect(403);
Expand All @@ -570,7 +570,7 @@ describe('CounterfactualSafesController', () => {
const accessToken = jwtService.sign(authPayloadDto);

await request(app.getHttpServer())
.put(`/v1/accounts/${address}/storage/counterfactual-safes`)
.put(`/v1/accounts/${address}/counterfactual-safes`)
.set('Cookie', [`access_token=${accessToken}`])
.send(createCounterfactualSafeDto)
.expect(403);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { CounterfactualSafe } from '@/routes/accounts/counterfactual-safes/entit
import { Auth } from '@/routes/auth/decorators/auth.decorator';
import { AuthGuard } from '@/routes/auth/guards/auth.guard';
import { AddressSchema } from '@/validation/entities/schemas/address.schema';
import { NumericStringSchema } from '@/validation/entities/schemas/numeric-string.schema';
import { ValidationPipe } from '@/validation/pipes/validation.pipe';
import { Body, Controller, Get, Param, Put, UseGuards } from '@nestjs/common';
import { ApiOkResponse, ApiTags } from '@nestjs/swagger';
Expand All @@ -18,7 +19,7 @@ export class CounterfactualSafesController {
constructor(private readonly service: CounterfactualSafesService) {}

@ApiOkResponse({ type: CounterfactualSafe })
@Get(':address/storage/counterfactual-safes/:chainId/:predictedAddress')
@Get(':address/counterfactual-safes/:chainId/:predictedAddress')
@UseGuards(AuthGuard)
async getCounterfactualSafe(
@Auth() authPayload: AuthPayload,
Expand All @@ -36,7 +37,7 @@ export class CounterfactualSafesController {
}

@ApiOkResponse({ type: CounterfactualSafe })
@Put(':address/storage/counterfactual-safes')
@Put(':address/counterfactual-safes')
@UseGuards(AuthGuard)
async upsertCounterfactualSafe(
@Auth() authPayload: AuthPayload,
Expand Down

0 comments on commit 121f316

Please sign in to comment.