-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'fix-ogmios-connection' into 'dev'
update scanner packages See merge request ergo/rosen-bridge/watcher!285
- Loading branch information
Showing
11 changed files
with
551 additions
and
101 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@rosen-bridge/watcher': patch | ||
--- | ||
|
||
Stabalize ogmios connection by adding connection close handler |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
108 changes: 108 additions & 0 deletions
108
src/database/migrations/postgres/1722549850233-watcherMigration.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,108 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
|
||
export class WatcherMigration1722549850233 implements MigrationInterface { | ||
name = 'WatcherMigration1722549850233'; | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
` | ||
DELETE FROM "typeorm_metadata" | ||
WHERE "type" = $1 | ||
AND "name" = $2 | ||
AND "schema" = $3 | ||
`, | ||
['VIEW', 'revenue_view', 'public'] | ||
); | ||
await queryRunner.query(` | ||
DROP VIEW "revenue_view" | ||
`); | ||
await queryRunner.query( | ||
` | ||
DELETE FROM "typeorm_metadata" | ||
WHERE "type" = $1 | ||
AND "name" = $2 | ||
AND "schema" = $3 | ||
`, | ||
['VIEW', 'revenue_chart_data', 'public'] | ||
); | ||
await queryRunner.query(` | ||
DROP VIEW "revenue_chart_data" | ||
`); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(` | ||
CREATE VIEW "revenue_chart_data" AS | ||
SELECT "pe"."WID" AS "wid", | ||
"be"."year" AS "year", | ||
"be"."month" AS "month", | ||
"be"."day" AS "day", | ||
re."tokenId" AS "tokenId", | ||
re."amount" AS "amount", | ||
be."timestamp" AS "timestamp" | ||
FROM "revenue_entity" "re" | ||
INNER JOIN "permit_entity" "pe" ON re."permitId" = "pe"."id" | ||
INNER JOIN "block_entity" "be" ON "pe"."block" = "be"."hash" | ||
`); | ||
await queryRunner.query( | ||
` | ||
INSERT INTO "typeorm_metadata"( | ||
"database", | ||
"schema", | ||
"table", | ||
"type", | ||
"name", | ||
"value" | ||
) | ||
VALUES (DEFAULT, $1, DEFAULT, $2, $3, $4) | ||
`, | ||
[ | ||
'public', | ||
'VIEW', | ||
'revenue_chart_data', | ||
'SELECT "pe"."WID" AS "wid", "be"."year" AS "year", "be"."month" AS "month", "be"."day" AS "day", re."tokenId" AS "tokenId", re."amount" AS "amount", be."timestamp" AS "timestamp" FROM "revenue_entity" "re" INNER JOIN "permit_entity" "pe" ON re."permitId" = "pe"."id" INNER JOIN "block_entity" "be" ON "pe"."block" = "be"."hash"', | ||
] | ||
); | ||
await queryRunner.query(` | ||
CREATE VIEW "revenue_view" AS | ||
SELECT "pe"."id" AS "id", | ||
"pe"."WID" AS "wid", | ||
"ete"."sourceChainHeight" AS "lockHeight", | ||
"be"."height" AS "height", | ||
"be"."timestamp" AS "timestamp", | ||
pe."txId" AS "permitTxId", | ||
ete."eventId" AS "eventId", | ||
ete."fromChain" AS "fromChain", | ||
ete."toChain" AS "toChain", | ||
ete."fromAddress" AS "fromAddress", | ||
ete."toAddress" AS "toAddress", | ||
ete."amount" AS "amount", | ||
ete."bridgeFee" AS "bridgeFee", | ||
ete."networkFee" AS "networkFee", | ||
ete."sourceChainTokenId" AS "tokenId", | ||
ete."sourceTxId" AS "lockTxId" | ||
FROM "permit_entity" "pe" | ||
INNER JOIN "event_trigger_entity" "ete" ON pe."txId" = ete."spendTxId" | ||
LEFT JOIN "block_entity" "be" ON "pe"."block" = "be"."hash" | ||
`); | ||
await queryRunner.query( | ||
` | ||
INSERT INTO "typeorm_metadata"( | ||
"database", | ||
"schema", | ||
"table", | ||
"type", | ||
"name", | ||
"value" | ||
) | ||
VALUES (DEFAULT, $1, DEFAULT, $2, $3, $4) | ||
`, | ||
[ | ||
'public', | ||
'VIEW', | ||
'revenue_view', | ||
'SELECT "pe"."id" AS "id", "pe"."WID" AS "wid", "ete"."sourceChainHeight" AS "lockHeight", "be"."height" AS "height", "be"."timestamp" AS "timestamp", pe."txId" AS "permitTxId", ete."eventId" AS "eventId", ete."fromChain" AS "fromChain", ete."toChain" AS "toChain", ete."fromAddress" AS "fromAddress", ete."toAddress" AS "toAddress", ete."amount" AS "amount", ete."bridgeFee" AS "bridgeFee", ete."networkFee" AS "networkFee", ete."sourceChainTokenId" AS "tokenId", ete."sourceTxId" AS "lockTxId" FROM "permit_entity" "pe" INNER JOIN "event_trigger_entity" "ete" ON pe."txId" = ete."spendTxId" LEFT JOIN "block_entity" "be" ON "pe"."block" = "be"."hash"', | ||
] | ||
); | ||
} | ||
} |
108 changes: 108 additions & 0 deletions
108
src/database/migrations/postgres/1722867363628-watcherMigration.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,108 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
|
||
export class WatcherMigration1722867363628 implements MigrationInterface { | ||
name = 'WatcherMigration1722867363628'; | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(` | ||
CREATE VIEW "revenue_chart_data" AS | ||
SELECT "pe"."WID" AS "wid", | ||
"be"."year" AS "year", | ||
"be"."month" AS "month", | ||
"be"."day" AS "day", | ||
re."tokenId" AS "tokenId", | ||
re."amount" AS "amount", | ||
be."timestamp" AS "timestamp" | ||
FROM "revenue_entity" "re" | ||
INNER JOIN "permit_entity" "pe" ON re."permitId" = "pe"."id" | ||
INNER JOIN "block_entity" "be" ON "pe"."block" = "be"."hash" | ||
`); | ||
await queryRunner.query( | ||
` | ||
INSERT INTO "typeorm_metadata"( | ||
"database", | ||
"schema", | ||
"table", | ||
"type", | ||
"name", | ||
"value" | ||
) | ||
VALUES (DEFAULT, $1, DEFAULT, $2, $3, $4) | ||
`, | ||
[ | ||
'public', | ||
'VIEW', | ||
'revenue_chart_data', | ||
'SELECT "pe"."WID" AS "wid", "be"."year" AS "year", "be"."month" AS "month", "be"."day" AS "day", re."tokenId" AS "tokenId", re."amount" AS "amount", be."timestamp" AS "timestamp" FROM "revenue_entity" "re" INNER JOIN "permit_entity" "pe" ON re."permitId" = "pe"."id" INNER JOIN "block_entity" "be" ON "pe"."block" = "be"."hash"', | ||
] | ||
); | ||
await queryRunner.query(` | ||
CREATE VIEW "revenue_view" AS | ||
SELECT "pe"."id" AS "id", | ||
"pe"."WID" AS "wid", | ||
"ete"."sourceChainHeight" AS "lockHeight", | ||
"be"."height" AS "height", | ||
"be"."timestamp" AS "timestamp", | ||
pe."txId" AS "permitTxId", | ||
ete."eventId" AS "eventId", | ||
ete."fromChain" AS "fromChain", | ||
ete."toChain" AS "toChain", | ||
ete."fromAddress" AS "fromAddress", | ||
ete."toAddress" AS "toAddress", | ||
ete."amount" AS "amount", | ||
ete."bridgeFee" AS "bridgeFee", | ||
ete."networkFee" AS "networkFee", | ||
ete."sourceChainTokenId" AS "tokenId", | ||
ete."sourceTxId" AS "lockTxId" | ||
FROM "permit_entity" "pe" | ||
INNER JOIN "event_trigger_entity" "ete" ON pe."txId" = ete."spendTxId" | ||
LEFT JOIN "block_entity" "be" ON "pe"."block" = "be"."hash" | ||
`); | ||
await queryRunner.query( | ||
` | ||
INSERT INTO "typeorm_metadata"( | ||
"database", | ||
"schema", | ||
"table", | ||
"type", | ||
"name", | ||
"value" | ||
) | ||
VALUES (DEFAULT, $1, DEFAULT, $2, $3, $4) | ||
`, | ||
[ | ||
'public', | ||
'VIEW', | ||
'revenue_view', | ||
'SELECT "pe"."id" AS "id", "pe"."WID" AS "wid", "ete"."sourceChainHeight" AS "lockHeight", "be"."height" AS "height", "be"."timestamp" AS "timestamp", pe."txId" AS "permitTxId", ete."eventId" AS "eventId", ete."fromChain" AS "fromChain", ete."toChain" AS "toChain", ete."fromAddress" AS "fromAddress", ete."toAddress" AS "toAddress", ete."amount" AS "amount", ete."bridgeFee" AS "bridgeFee", ete."networkFee" AS "networkFee", ete."sourceChainTokenId" AS "tokenId", ete."sourceTxId" AS "lockTxId" FROM "permit_entity" "pe" INNER JOIN "event_trigger_entity" "ete" ON pe."txId" = ete."spendTxId" LEFT JOIN "block_entity" "be" ON "pe"."block" = "be"."hash"', | ||
] | ||
); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
` | ||
DELETE FROM "typeorm_metadata" | ||
WHERE "type" = $1 | ||
AND "name" = $2 | ||
AND "schema" = $3 | ||
`, | ||
['VIEW', 'revenue_view', 'public'] | ||
); | ||
await queryRunner.query(` | ||
DROP VIEW "revenue_view" | ||
`); | ||
await queryRunner.query( | ||
` | ||
DELETE FROM "typeorm_metadata" | ||
WHERE "type" = $1 | ||
AND "name" = $2 | ||
AND "schema" = $3 | ||
`, | ||
['VIEW', 'revenue_chart_data', 'public'] | ||
); | ||
await queryRunner.query(` | ||
DROP VIEW "revenue_chart_data" | ||
`); | ||
} | ||
} |
Oops, something went wrong.