Skip to content

Commit

Permalink
Use camelCase syntax on CreateCounterfactualSafeDto
Browse files Browse the repository at this point in the history
  • Loading branch information
hectorgomezv committed Jul 19, 2024
1 parent f2ca4c0 commit 485ece5
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ describe('CounterfactualSafesDatasource tests', () => {
expect(actual).toStrictEqual(
expect.objectContaining({
id: expect.any(Number),
chain_id: createCounterfactualSafeDto.chain_id,
chain_id: createCounterfactualSafeDto.chainId,
creator: account.address,
fallback_handler: createCounterfactualSafeDto.fallback_handler,
fallback_handler: createCounterfactualSafeDto.fallbackHandler,
owners: createCounterfactualSafeDto.owners,
predicted_address: createCounterfactualSafeDto.predicted_address,
salt_nonce: createCounterfactualSafeDto.salt_nonce,
singleton_address: createCounterfactualSafeDto.singleton_address,
predicted_address: createCounterfactualSafeDto.predictedAddress,
salt_nonce: createCounterfactualSafeDto.saltNonce,
singleton_address: createCounterfactualSafeDto.singletonAddress,
threshold: createCounterfactualSafeDto.threshold,
account_id: account.id,
}),
Expand Down Expand Up @@ -229,11 +229,11 @@ describe('CounterfactualSafesDatasource tests', () => {
const counterfactualSafes = await Promise.all([
target.createCounterfactualSafe(
account,
createCounterfactualSafeDtoBuilder().with('chain_id', '1').build(),
createCounterfactualSafeDtoBuilder().with('chainId', '1').build(),
),
target.createCounterfactualSafe(
account,
createCounterfactualSafeDtoBuilder().with('chain_id', '2').build(),
createCounterfactualSafeDtoBuilder().with('chainId', '2').build(),
),
]);

Expand All @@ -249,11 +249,11 @@ describe('CounterfactualSafesDatasource tests', () => {
const counterfactualSafes = await Promise.all([
target.createCounterfactualSafe(
account,
createCounterfactualSafeDtoBuilder().with('chain_id', '1').build(),
createCounterfactualSafeDtoBuilder().with('chainId', '1').build(),
),
target.createCounterfactualSafe(
account,
createCounterfactualSafeDtoBuilder().with('chain_id', '2').build(),
createCounterfactualSafeDtoBuilder().with('chainId', '2').build(),
),
]);

Expand Down Expand Up @@ -361,11 +361,11 @@ describe('CounterfactualSafesDatasource tests', () => {
const counterfactualSafes = await Promise.all([
target.createCounterfactualSafe(
account,
createCounterfactualSafeDtoBuilder().with('chain_id', '1').build(),
createCounterfactualSafeDtoBuilder().with('chainId', '1').build(),
),
target.createCounterfactualSafe(
account,
createCounterfactualSafeDtoBuilder().with('chain_id', '2').build(),
createCounterfactualSafeDtoBuilder().with('chainId', '2').build(),
),
]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,13 @@ export class CounterfactualSafesDatasource
): Partial<CounterfactualSafe> {
return {
account_id: account.id,
chain_id: createCounterfactualSafeDto.chain_id,
chain_id: createCounterfactualSafeDto.chainId,
creator: account.address,
fallback_handler: createCounterfactualSafeDto.fallback_handler,
fallback_handler: createCounterfactualSafeDto.fallbackHandler,
owners: createCounterfactualSafeDto.owners,
predicted_address: createCounterfactualSafeDto.predicted_address,
salt_nonce: createCounterfactualSafeDto.salt_nonce,
singleton_address: createCounterfactualSafeDto.singleton_address,
predicted_address: createCounterfactualSafeDto.predictedAddress,
salt_nonce: createCounterfactualSafeDto.saltNonce,
singleton_address: createCounterfactualSafeDto.singletonAddress,
threshold: createCounterfactualSafeDto.threshold,
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import { getAddress } from 'viem';

export function createCounterfactualSafeDtoBuilder(): IBuilder<CreateCounterfactualSafeDto> {
return new Builder<CreateCounterfactualSafeDto>()
.with('chain_id', faker.string.numeric())
.with('fallback_handler', getAddress(faker.finance.ethereumAddress()))
.with('chainId', faker.string.numeric())
.with('fallbackHandler', getAddress(faker.finance.ethereumAddress()))
.with('owners', [
getAddress(faker.finance.ethereumAddress()),
getAddress(faker.finance.ethereumAddress()),
])
.with('predicted_address', getAddress(faker.finance.ethereumAddress()))
.with('salt_nonce', faker.string.hexadecimal())
.with('singleton_address', getAddress(faker.finance.ethereumAddress()))
.with('predictedAddress', getAddress(faker.finance.ethereumAddress()))
.with('saltNonce', faker.string.hexadecimal())
.with('singletonAddress', getAddress(faker.finance.ethereumAddress()))
.with('threshold', faker.number.int({ min: 1, max: 10 }));
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,31 @@ import { z } from 'zod';
export class CreateCounterfactualSafeDto
implements z.infer<typeof CreateCounterfactualSafeDtoSchema>
{
chain_id: string;
fallback_handler: `0x${string}`;
chainId: string;
fallbackHandler: `0x${string}`;
owners: `0x${string}`[];
predicted_address: `0x${string}`;
salt_nonce: string;
singleton_address: `0x${string}`;
predictedAddress: `0x${string}`;
saltNonce: string;
singletonAddress: `0x${string}`;
threshold: number;

constructor(props: CreateCounterfactualSafeDto) {
this.chain_id = props.chain_id;
this.fallback_handler = props.fallback_handler;
this.chainId = props.chainId;
this.fallbackHandler = props.fallbackHandler;
this.owners = props.owners;
this.predicted_address = props.predicted_address;
this.salt_nonce = props.salt_nonce;
this.singleton_address = props.singleton_address;
this.predictedAddress = props.predictedAddress;
this.saltNonce = props.saltNonce;
this.singletonAddress = props.singletonAddress;
this.threshold = props.threshold;
}
}

export const CreateCounterfactualSafeDtoSchema = z.object({
chain_id: z.string(),
fallback_handler: AddressSchema,
chainId: z.string(),
fallbackHandler: AddressSchema,
owners: z.array(AddressSchema).min(1),
predicted_address: AddressSchema,
salt_nonce: z.string(),
singleton_address: AddressSchema,
predictedAddress: AddressSchema,
saltNonce: z.string(),
singletonAddress: AddressSchema,
threshold: z.number().int().gte(1),
});

0 comments on commit 485ece5

Please sign in to comment.