@rosen-bridge/tx-pot 1.1.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +8 -8
  3. package/dist/db/entities/{TransactionEntity.d.ts → transactionEntity.d.ts} +1 -1
  4. package/dist/db/entities/{TransactionEntity.d.ts.map → transactionEntity.d.ts.map} +1 -1
  5. package/dist/db/entities/{TransactionEntity.js → transactionEntity.js} +1 -1
  6. package/dist/db/migrations/postgres/1706350644686-migration.d.ts.map +1 -1
  7. package/dist/db/migrations/postgres/1706350644686-migration.js +1 -1
  8. package/dist/db/migrations/sqlite/1706007154531-migration.d.ts.map +1 -1
  9. package/dist/db/migrations/sqlite/1706007154531-migration.js +1 -1
  10. package/dist/index.d.ts +3 -3
  11. package/dist/index.js +4 -4
  12. package/dist/network/{AbstractPotChainManager.d.ts → abstractPotChainManager.d.ts} +1 -1
  13. package/dist/network/{AbstractPotChainManager.d.ts.map → abstractPotChainManager.d.ts.map} +1 -1
  14. package/dist/network/{AbstractPotChainManager.js → abstractPotChainManager.js} +1 -1
  15. package/dist/transaction/{TxPot.d.ts → txPot.d.ts} +3 -3
  16. package/dist/transaction/{TxPot.d.ts.map → txPot.d.ts.map} +1 -1
  17. package/dist/transaction/{TxPot.js → txPot.js} +2 -2
  18. package/dist/transaction/types.d.ts +1 -1
  19. package/dist/transaction/types.d.ts.map +1 -1
  20. package/dist/transaction/types.js +1 -1
  21. package/package.json +22 -13
  22. package/.eslintignore +0 -1
  23. package/lib/db/entities/TransactionEntity.ts +0 -44
  24. package/lib/db/migrations/index.ts +0 -7
  25. package/lib/db/migrations/postgres/1706350644686-migration.ts +0 -31
  26. package/lib/db/migrations/sqlite/1706007154531-migration.ts +0 -31
  27. package/lib/index.ts +0 -5
  28. package/lib/network/AbstractPotChainManager.ts +0 -44
  29. package/lib/transaction/TxPot.ts +0 -728
  30. package/lib/transaction/types.ts +0 -46
  31. package/lib/transaction/utils.ts +0 -59
  32. package/tests/.gitkeep +0 -0
  33. package/tests/db/dataSource.mock.ts +0 -18
  34. package/tests/network/TestPotChainManager.ts +0 -23
  35. package/tests/transaction/TestTxPot.ts +0 -32
  36. package/tests/transaction/TxPot.spec.ts +0 -1881
  37. package/tests/transaction/testData.ts +0 -84
  38. package/tsconfig.build.json +0 -9
  39. package/tsconfig.build.tsbuildinfo +0 -1
  40. package/tsconfig.json +0 -9
  41. package/vitest.config.ts +0 -18
@@ -1,44 +0,0 @@
1
- import { Column, Entity, PrimaryColumn } from 'typeorm';
2
-
3
- @Entity()
4
- export class TransactionEntity {
5
- @PrimaryColumn('varchar')
6
- txId: string;
7
-
8
- @PrimaryColumn('varchar')
9
- chain: string;
10
-
11
- @Column('varchar')
12
- txType: string;
13
-
14
- @Column('varchar')
15
- status: string;
16
-
17
- @Column('integer')
18
- requiredSign: number;
19
-
20
- @Column('integer')
21
- lastCheck: number;
22
-
23
- @Column('varchar')
24
- lastStatusUpdate: string;
25
-
26
- @Column('boolean')
27
- failedInSign: boolean;
28
-
29
- @Column('integer')
30
- signFailedCount: number;
31
-
32
- @Column('varchar')
33
- serializedTx: string;
34
-
35
- @Column('varchar', {
36
- nullable: true,
37
- })
38
- extra?: string | null;
39
-
40
- @Column('varchar', {
41
- nullable: true,
42
- })
43
- extra2?: string | null;
44
- }
@@ -1,7 +0,0 @@
1
- import { Migration1706350644686 } from './postgres/1706350644686-migration';
2
- import { Migration1706007154531 } from './sqlite/1706007154531-migration';
3
-
4
- export const migrations = {
5
- sqlite: [Migration1706007154531],
6
- postgres: [Migration1706350644686],
7
- };
@@ -1,31 +0,0 @@
1
- import { MigrationInterface, QueryRunner } from 'typeorm';
2
-
3
- export class Migration1706350644686 implements MigrationInterface {
4
- name = 'Migration1706350644686';
5
-
6
- public async up(queryRunner: QueryRunner): Promise<void> {
7
- await queryRunner.query(`
8
- CREATE TABLE "transaction_entity" (
9
- "txId" character varying NOT NULL,
10
- "chain" character varying NOT NULL,
11
- "txType" character varying NOT NULL,
12
- "status" character varying NOT NULL,
13
- "requiredSign" integer NOT NULL,
14
- "lastCheck" integer NOT NULL,
15
- "lastStatusUpdate" character varying NOT NULL,
16
- "failedInSign" boolean NOT NULL,
17
- "signFailedCount" integer NOT NULL,
18
- "serializedTx" character varying NOT NULL,
19
- "extra" character varying,
20
- "extra2" character varying,
21
- CONSTRAINT "PK_cafcc9d8e76fef57bc0cf385caa" PRIMARY KEY ("txId", "chain")
22
- )
23
- `);
24
- }
25
-
26
- public async down(queryRunner: QueryRunner): Promise<void> {
27
- await queryRunner.query(`
28
- DROP TABLE "transaction_entity"
29
- `);
30
- }
31
- }
@@ -1,31 +0,0 @@
1
- import { MigrationInterface, QueryRunner } from 'typeorm';
2
-
3
- export class Migration1706007154531 implements MigrationInterface {
4
- name = 'Migration1706007154531';
5
-
6
- public async up(queryRunner: QueryRunner): Promise<void> {
7
- await queryRunner.query(`
8
- CREATE TABLE "transaction_entity" (
9
- "txId" varchar NOT NULL,
10
- "chain" varchar NOT NULL,
11
- "txType" varchar NOT NULL,
12
- "status" varchar NOT NULL,
13
- "requiredSign" integer NOT NULL,
14
- "lastCheck" integer NOT NULL,
15
- "lastStatusUpdate" varchar NOT NULL,
16
- "failedInSign" boolean NOT NULL,
17
- "signFailedCount" integer NOT NULL,
18
- "serializedTx" varchar NOT NULL,
19
- "extra" varchar,
20
- "extra2" varchar,
21
- PRIMARY KEY ("txId", "chain")
22
- )
23
- `);
24
- }
25
-
26
- public async down(queryRunner: QueryRunner): Promise<void> {
27
- await queryRunner.query(`
28
- DROP TABLE "transaction_entity"
29
- `);
30
- }
31
- }
package/lib/index.ts DELETED
@@ -1,5 +0,0 @@
1
- export { AbstractPotChainManager } from './network/AbstractPotChainManager';
2
- export { TxPot } from './transaction/TxPot';
3
- export * from './transaction/types';
4
- export { TransactionEntity } from './db/entities/TransactionEntity';
5
- export { migrations } from './db/migrations/index';
@@ -1,44 +0,0 @@
1
- import { SigningStatus } from '../transaction/types';
2
-
3
- export abstract class AbstractPotChainManager {
4
- /**
5
- * gets the blockchain current height
6
- */
7
- abstract getHeight: () => Promise<number>;
8
-
9
- /**
10
- * returns required number of confirmation
11
- * @param txType
12
- */
13
- abstract getTxRequiredConfirmation: (txType: string) => number;
14
-
15
- /**
16
- * gets number of confirmation for a tx
17
- * returns -1 if tx is not in the blockchain
18
- * @param txId
19
- */
20
- abstract getTxConfirmation: (txId: string) => Promise<number>;
21
-
22
- /**
23
- * checks if a tx is still valid and can be sent to the network
24
- * @param serializedTx
25
- * @param signingStatus
26
- */
27
- abstract isTxValid: (
28
- serializedTx: string,
29
- signingStatus: SigningStatus
30
- ) => Promise<boolean>;
31
-
32
- /**
33
- * submits a tx to the blockchain
34
- * @param serializedTx
35
- */
36
- abstract submitTransaction: (serializedTx: string) => Promise<void>;
37
-
38
- /**
39
- * checks if a tx is in mempool
40
- * returns false if the chain has no mempool
41
- * @param txId
42
- */
43
- abstract isTxInMempool: (txId: string) => Promise<boolean>;
44
- }