-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Optimize input and output storage
1. Storage others' cells tx and locks into tx-lock for search others' addresses. 2. Get transaction detail by rpc.
- Loading branch information
Showing
14 changed files
with
376 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
packages/neuron-wallet/src/database/chain/entities/tx-lock.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { BaseEntity, Entity, PrimaryColumn } from 'typeorm' | ||
|
||
@Entity() | ||
export default class TxLock extends BaseEntity { | ||
@PrimaryColumn({ | ||
type: 'varchar' | ||
}) | ||
transactionHash!: string | ||
|
||
@PrimaryColumn({ | ||
type: 'varchar', | ||
}) | ||
lockHash!: string | ||
|
||
static fromObject(obj: { | ||
txHash: string | ||
lockHash: string | ||
}) { | ||
const res = new TxLock() | ||
res.transactionHash = obj.txHash | ||
res.lockHash = obj.lockHash | ||
return res | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
packages/neuron-wallet/src/database/chain/migrations/1684488676083-TxLock.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import {MigrationInterface, QueryRunner, TableIndex} from "typeorm"; | ||
|
||
export class TxLock1684488676083 implements MigrationInterface { | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`CREATE TABLE "tx_lock" ("lockHash" varchar NOT NULL, "transactionHash" varchar NOT NULL, PRIMARY KEY ("transactionHash", "lockHash"))`) | ||
await queryRunner.createIndex("tx_lock", new TableIndex({ columnNames: ['lockHash'] })) | ||
await queryRunner.createIndex("tx_lock", new TableIndex({ columnNames: ['transactionHash'] })) | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`DROP TABLE "tx_lock"`) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.