Skip to content

Commit

Permalink
fix: fix to and contractAddress null
Browse files Browse the repository at this point in the history
  • Loading branch information
petarTxFusion committed Dec 10, 2024
1 parent 84aadd6 commit d3d191b
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 15 deletions.
2 changes: 1 addition & 1 deletion packages/api/src/transaction/dtos/transaction.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class TransactionDto {
description: "The address this transaction is to",
example: "0xc7e0220d02d549c4846A6EC31D89C3B670Ebe35C",
})
public readonly to?: string;
public readonly to: string;

@ApiProperty({
type: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ export class AddressTransaction extends BaseEntity {
@Column({ type: "bytea", transformer: hexTransformer })
public readonly transactionHash: string;

@Column({ type: "bytea", transformer: normalizeAddressTransformer, nullable: true })
public readonly address?: string;
@Column({ type: "bytea", transformer: normalizeAddressTransformer })
public readonly address: string;

@Index()
@Column({ type: "bigint", transformer: bigIntNumberTransformer })
Expand All @@ -31,7 +31,4 @@ export class AddressTransaction extends BaseEntity {

@Column({ type: "int" })
public readonly transactionIndex: number;

@Column({ type: "boolean", nullable: true })
public readonly isEvmLike?: boolean;
}
6 changes: 3 additions & 3 deletions packages/api/src/transaction/entities/transaction.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ export class Transaction extends BaseEntity {
@Column({ generated: true, type: "bigint" })
public number: number;

@Column({ type: "bytea", transformer: normalizeAddressTransformer, nullable: true })
public readonly to?: string;
@Column({ type: "bytea", transformer: normalizeAddressTransformer })
public readonly to: string;

@Index()
@Column({ type: "bytea", transformer: normalizeAddressTransformer })
Expand Down Expand Up @@ -110,7 +110,7 @@ export class Transaction extends BaseEntity {
@Column({ type: "boolean", nullable: true })
public readonly isEvmLike?: boolean;

@Column({ type: "bytea", transformer: hexTransformer, nullable: true })
@Column({ type: "bytea", transformer: normalizeAddressTransformer, nullable: true })
public readonly contractAddress?: string;

public get status(): TransactionStatus {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export class TransactionService {
const toAddress = isEvmLike ? "0x" : transactionInfo.to;
const contractAddress = isEvmLike
? getCreateAddress({ from: transactionInfo.from, nonce: transactionInfo.nonce })
: "";
: "0x";

const updatedTransactionInfo = {
...transactionInfo,
Expand Down
3 changes: 0 additions & 3 deletions packages/worker/src/entities/addressTransaction.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,4 @@ export class AddressTransaction extends BaseEntity {

@Column({ type: "int" })
public readonly transactionIndex: number;

@Column({ type: "boolean", nullable: true })
public readonly isEvmLike?: boolean;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ export class AddIsEvmLikeField1732834401560 implements MigrationInterface {

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "transactions" ADD "isEvmLike" boolean`);
await queryRunner.query(`ALTER TABLE "addressTransactions" ADD "isEvmLike" boolean`);
await queryRunner.query(`ALTER TABLE "transactionReceipts" ADD "isEvmLike" boolean`);
await queryRunner.query(`ALTER TABLE "addresses" ADD "isEvmLike" boolean`);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "transactionReceipts" DROP COLUMN "isEvmLike"`);
await queryRunner.query(`ALTER TABLE "addressTransactions" DROP COLUMN "isEvmLike"`);
await queryRunner.query(`ALTER TABLE "transactions" DROP COLUMN "isEvmLike"`);
await queryRunner.query(`ALTER TABLE "addresses" DROP COLUMN "isEvmLike"`);
}
Expand Down

0 comments on commit d3d191b

Please sign in to comment.