@ercworldio/blockchain-shared 1.0.2-dev-PROJ-1265.0 → 1.0.2-dev-PROJ-1265.1.fix
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.
- package/build/chains/networks_dev copy.json +793 -0
- package/build/chains/networks_prod-ab120.json +644 -0
- package/build/chains/networks_prod-dz-v1.json +727 -0
- package/build/chains/networks_prod-sh.json +645 -0
- package/build/chains/networks_prod-yb.json +645 -0
- package/build/chains/networks_stg-ab120-mainnet.json +681 -0
- package/build/chains/networks_stg-ab120.json +597 -0
- package/build/chains/networks_stg-bu-v1.json +635 -0
- package/build/chains/networks_stg-yb-v1.json +574 -0
- package/build/contracts/artifacts/Escrow.json +16 -0
- package/build/contracts/typechain-types/contracts/lib/Events.d.ts +394 -0
- package/build/contracts/typechain-types/contracts/lib/Events.d.ts.map +1 -0
- package/build/contracts/typechain-types/contracts/lib/Events.js +2 -0
- package/build/contracts/typechain-types/contracts/lib/MultisigLib.d.ts +21 -0
- package/build/contracts/typechain-types/contracts/lib/MultisigLib.d.ts.map +1 -0
- package/build/contracts/typechain-types/contracts/lib/MultisigLib.js +2 -0
- package/build/contracts/typechain-types/contracts/lib/index.d.ts +3 -0
- package/build/contracts/typechain-types/contracts/lib/index.d.ts.map +1 -0
- package/build/contracts/typechain-types/contracts/lib/index.js +2 -0
- package/build/contracts/typechain-types/contracts/mock/ReentrantReceiver.d.ts +54 -0
- package/build/contracts/typechain-types/contracts/mock/ReentrantReceiver.d.ts.map +1 -0
- package/build/contracts/typechain-types/contracts/mock/ReentrantReceiver.js +2 -0
- package/build/contracts/typechain-types/contracts/mock/SelfDestructForcer.d.ts +26 -0
- package/build/contracts/typechain-types/contracts/mock/SelfDestructForcer.d.ts.map +1 -0
- package/build/contracts/typechain-types/contracts/mock/SelfDestructForcer.js +2 -0
- package/build/contracts/typechain-types/contracts/test/DelegatecallProbe.d.ts +30 -0
- package/build/contracts/typechain-types/contracts/test/DelegatecallProbe.d.ts.map +1 -0
- package/build/contracts/typechain-types/contracts/test/DelegatecallProbe.js +2 -0
- package/build/contracts/typechain-types/contracts/test/index.d.ts +2 -0
- package/build/contracts/typechain-types/contracts/test/index.d.ts.map +1 -0
- package/build/contracts/typechain-types/contracts/test/index.js +2 -0
- package/build/contracts/typechain-types/factories/contracts/lib/Events__factory.d.ts +373 -0
- package/build/contracts/typechain-types/factories/contracts/lib/Events__factory.d.ts.map +1 -0
- package/build/contracts/typechain-types/factories/contracts/lib/Events__factory.js +474 -0
- package/build/contracts/typechain-types/factories/contracts/lib/MultisigLib__factory.d.ts +99 -0
- package/build/contracts/typechain-types/factories/contracts/lib/MultisigLib__factory.d.ts.map +1 -0
- package/build/contracts/typechain-types/factories/contracts/lib/MultisigLib__factory.js +140 -0
- package/build/contracts/typechain-types/factories/contracts/lib/index.d.ts +3 -0
- package/build/contracts/typechain-types/factories/contracts/lib/index.d.ts.map +1 -0
- package/build/contracts/typechain-types/factories/contracts/lib/index.js +10 -0
- package/build/contracts/typechain-types/factories/contracts/mock/ReentrantReceiver__factory.d.ts +112 -0
- package/build/contracts/typechain-types/factories/contracts/mock/ReentrantReceiver__factory.d.ts.map +1 -0
- package/build/contracts/typechain-types/factories/contracts/mock/ReentrantReceiver__factory.js +156 -0
- package/build/contracts/typechain-types/factories/contracts/mock/SelfDestructForcer__factory.d.ts +37 -0
- package/build/contracts/typechain-types/factories/contracts/mock/SelfDestructForcer__factory.d.ts.map +1 -0
- package/build/contracts/typechain-types/factories/contracts/mock/SelfDestructForcer__factory.js +57 -0
- package/build/contracts/typechain-types/factories/contracts/test/DelegatecallProbe__factory.d.ts +55 -0
- package/build/contracts/typechain-types/factories/contracts/test/DelegatecallProbe__factory.d.ts.map +1 -0
- package/build/contracts/typechain-types/factories/contracts/test/DelegatecallProbe__factory.js +81 -0
- package/build/contracts/typechain-types/factories/contracts/test/index.d.ts +2 -0
- package/build/contracts/typechain-types/factories/contracts/test/index.d.ts.map +1 -0
- package/build/contracts/typechain-types/factories/contracts/test/index.js +8 -0
- package/build/entities/AdminOperationThresholds.d.ts +11 -0
- package/build/entities/AdminOperationThresholds.d.ts.map +1 -0
- package/build/entities/AdminOperationThresholds.js +52 -0
- package/build/entities/AdminWithdrawal.d.ts +20 -0
- package/build/entities/AdminWithdrawal.d.ts.map +1 -0
- package/build/entities/AdminWithdrawal.js +88 -0
- package/build/entities/CryptoOperationType.d.ts +18 -0
- package/build/entities/CryptoOperationType.d.ts.map +1 -0
- package/build/entities/CryptoOperationType.js +50 -0
- package/build/entities/EscrowRoles.d.ts +12 -0
- package/build/entities/EscrowRoles.d.ts.map +1 -0
- package/build/entities/EscrowRoles.js +57 -0
- package/build/entities/GlobalTimelock.d.ts +13 -0
- package/build/entities/GlobalTimelock.d.ts.map +1 -0
- package/build/entities/GlobalTimelock.js +60 -0
- package/build/entities/GranularTimelock .d.ts +12 -0
- package/build/entities/GranularTimelock .d.ts.map +1 -0
- package/build/entities/GranularTimelock .js +56 -0
- package/build/entities/GranularTimelock.d.ts +11 -0
- package/build/entities/GranularTimelock.d.ts.map +1 -0
- package/build/entities/GranularTimelock.js +52 -0
- package/build/entities/OperationType.d.ts +18 -0
- package/build/entities/OperationType.d.ts.map +1 -0
- package/build/entities/OperationType.js +50 -0
- package/build/entities/RoleHash.d.ts +11 -0
- package/build/entities/RoleHash.d.ts.map +1 -0
- package/build/entities/RoleHash.js +52 -0
- package/build/entities/ScheduleTransactionJob.d.ts +23 -0
- package/build/entities/ScheduleTransactionJob.d.ts.map +1 -0
- package/build/entities/ScheduleTransactionJob.js +89 -0
- package/build/entities/ScheduleTransactionJobHistory.d.ts +17 -0
- package/build/entities/ScheduleTransactionJobHistory.d.ts.map +1 -0
- package/build/entities/ScheduleTransactionJobHistory.js +66 -0
- package/build/entities/Signatures.d.ts +16 -0
- package/build/entities/Signatures.d.ts.map +1 -0
- package/build/entities/Signatures.js +72 -0
- package/build/entities/TokenExecutionThresholds.d.ts +15 -0
- package/build/entities/TokenExecutionThresholds.d.ts.map +1 -0
- package/build/entities/TokenExecutionThresholds.js +68 -0
- package/build/entities/WithdrawalCommitment.d.ts +15 -0
- package/build/entities/WithdrawalCommitment.d.ts.map +1 -0
- package/build/entities/WithdrawalCommitment.js +64 -0
- package/build/entities/index.d.ts +22 -0
- package/build/entities/index.d.ts.map +1 -0
- package/build/entities/index.js +37 -0
- package/build/services/AccountingService.d.ts +2 -0
- package/build/services/AccountingService.d.ts.map +1 -1
- package/build/services/AccountingService.js +35 -6
- package/build/services/AccountingServiceStatic.d.ts +14 -0
- package/build/services/AccountingServiceStatic.d.ts.map +1 -0
- package/build/services/AccountingServiceStatic.js +38 -0
- package/build/services/ClaimJobServiceStatic.d.ts +9 -0
- package/build/services/ClaimJobServiceStatic.d.ts.map +1 -0
- package/build/services/ClaimJobServiceStatic.js +54 -0
- package/build/services/WithdrawalService.d.ts +10 -0
- package/build/services/WithdrawalService.d.ts.map +1 -0
- package/build/services/WithdrawalService.js +38 -0
- package/build/services/db/multisig/MultisigService.d.ts +31 -0
- package/build/services/db/multisig/MultisigService.d.ts.map +1 -0
- package/build/services/db/multisig/MultisigService.js +134 -0
- package/build/services/db/roles/ContractRoles.d.ts +54 -0
- package/build/services/db/roles/ContractRoles.d.ts.map +1 -0
- package/build/services/db/roles/ContractRoles.js +87 -0
- package/build/services/db/timelock/ScheduleTransactionJobHistoryService.d.ts +14 -0
- package/build/services/db/timelock/ScheduleTransactionJobHistoryService.d.ts.map +1 -0
- package/build/services/db/timelock/ScheduleTransactionJobHistoryService.js +63 -0
- package/build/services/db/timelock/ScheduleTransactionService.d.ts +46 -0
- package/build/services/db/timelock/ScheduleTransactionService.d.ts.map +1 -0
- package/build/services/db/timelock/ScheduleTransactionService.js +476 -0
- package/build/services/rpc/RPC.d.ts +20 -0
- package/build/services/rpc/RPC.d.ts.map +1 -0
- package/build/services/rpc/RPC.js +49 -0
- package/build/services/solana/escrow/services/TreasuryWithdrawalSignature.d.ts +58 -0
- package/build/services/solana/escrow/services/TreasuryWithdrawalSignature.d.ts.map +1 -0
- package/build/services/solana/escrow/services/TreasuryWithdrawalSignature.js +109 -0
- package/build/services/types/db/index.d.ts +3 -0
- package/build/services/types/db/index.d.ts.map +1 -0
- package/build/services/types/db/index.js +18 -0
- package/build/services/types/db/multisig_service.d.ts +154 -0
- package/build/services/types/db/multisig_service.d.ts.map +1 -0
- package/build/services/types/db/multisig_service.js +2 -0
- package/build/services/types/db/timelock.d.ts +84 -0
- package/build/services/types/db/timelock.d.ts.map +1 -0
- package/build/services/types/db/timelock.js +2 -0
- package/build/services/types/db/withdrawal_service.d.ts +16 -0
- package/build/services/types/db/withdrawal_service.d.ts.map +1 -0
- package/build/services/types/db/withdrawal_service.js +2 -0
- package/build/services/types/watchdog.d.ts +9 -0
- package/build/services/types/watchdog.d.ts.map +1 -0
- package/build/services/types/watchdog.js +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Pool } from "pg";
|
|
2
|
+
import { BlockchainType, ChainId } from "../../../interfaces";
|
|
3
|
+
export interface OperationType {
|
|
4
|
+
id: number;
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
createdAt: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ContractRole {
|
|
10
|
+
id: number;
|
|
11
|
+
roleName: string;
|
|
12
|
+
roleAlias: string;
|
|
13
|
+
roleHash: string;
|
|
14
|
+
createdAt: string;
|
|
15
|
+
updatedAt: string;
|
|
16
|
+
}
|
|
17
|
+
export interface RoleOperationType {
|
|
18
|
+
id: number;
|
|
19
|
+
roleId: number;
|
|
20
|
+
operationTypeId: number;
|
|
21
|
+
operationName: string;
|
|
22
|
+
description: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Adapter class for interfacing the DB functions
|
|
26
|
+
* related to escrow contract roles
|
|
27
|
+
*/
|
|
28
|
+
declare class ContractRolesService {
|
|
29
|
+
/**
|
|
30
|
+
* Get the available roles and the associated role hash
|
|
31
|
+
* name and alias name
|
|
32
|
+
* @returns ContractRole[]
|
|
33
|
+
*/
|
|
34
|
+
static get_roles(pool: Pool): Promise<ContractRole[]>;
|
|
35
|
+
/**
|
|
36
|
+
* Gets the possible operation types for all available
|
|
37
|
+
* roles.
|
|
38
|
+
* @param pool The PG connection pool for the SQL execution
|
|
39
|
+
* @returns OperationType[]
|
|
40
|
+
*/
|
|
41
|
+
static get_all_operation_types(pool: Pool): Promise<OperationType[]>;
|
|
42
|
+
/**
|
|
43
|
+
*
|
|
44
|
+
* @param pool The PG connection pool for the SQL execution
|
|
45
|
+
* @param role_id id of the role to get the optypes for
|
|
46
|
+
*/
|
|
47
|
+
static get_role_operation_types(pool: Pool, role_id: number): Promise<RoleOperationType[]>;
|
|
48
|
+
/** Records an on-chain role grant for a wallet on an escrow contract. `confirmed` indicates whether the tx was finalised. */
|
|
49
|
+
static fn_grant_escrow_role(pool: Pool, blockchain: BlockchainType, chain_id: ChainId, contract_address: string, wallet_address: string, role_hash: string, p_user_id: number, confirmed: boolean, p_caller: string, p_sender: string, p_tx_hash: string, p_timestamp: number, p_block_number: number, gas_used: number): Promise<any>;
|
|
50
|
+
/** Records an on-chain role revocation for a wallet on an escrow contract. `confirmed` indicates whether the tx was finalised. */
|
|
51
|
+
static fn_revoke_escrow_role(pool: Pool, blockchain: BlockchainType, chain_id: ChainId, contract_address: string, wallet_address: string, role_hash: string, p_user_id: number, confirmed: boolean, p_caller: string, p_sender: string, p_tx_hash: string, p_timestamp: number, p_block_number: number, gas_used: number): Promise<any>;
|
|
52
|
+
}
|
|
53
|
+
export default ContractRolesService;
|
|
54
|
+
//# sourceMappingURL=ContractRoles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContractRoles.d.ts","sourceRoot":"","sources":["../../../../src/services/db/roles/ContractRoles.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1B,OAAO,EAAE,cAAc,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AM,EACtC,cAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAa5C,kIAAkI;WACrH,qBAAqB,CAC9B,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,cAAc,EACtC,QAAQ,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAC3C,cAAc,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EACzC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EACrC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAClC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EACtC,cAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;CAc/C;AAED,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
/**
|
|
13
|
+
* Adapter class for interfacing the DB functions
|
|
14
|
+
* related to escrow contract roles
|
|
15
|
+
*/
|
|
16
|
+
class ContractRolesService {
|
|
17
|
+
/**
|
|
18
|
+
* Get the available roles and the associated role hash
|
|
19
|
+
* name and alias name
|
|
20
|
+
* @returns ContractRole[]
|
|
21
|
+
*/
|
|
22
|
+
static get_roles(pool) {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
const result = yield pool.query(`
|
|
25
|
+
SELECT multisig.fn_get_roles()
|
|
26
|
+
`);
|
|
27
|
+
if (!result)
|
|
28
|
+
throw new Error(`DB FN error: multisig.fn_get_roles()`);
|
|
29
|
+
return result.rows[0].fn_get_roles;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Gets the possible operation types for all available
|
|
34
|
+
* roles.
|
|
35
|
+
* @param pool The PG connection pool for the SQL execution
|
|
36
|
+
* @returns OperationType[]
|
|
37
|
+
*/
|
|
38
|
+
static get_all_operation_types(pool) {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
const result = yield pool.query(`
|
|
41
|
+
SELECT multisig.fn_get_all_operation_types()
|
|
42
|
+
`);
|
|
43
|
+
if (!result.rows)
|
|
44
|
+
throw new Error(`DB FN Error: multisig.fn_get_all_operation_types`);
|
|
45
|
+
return result.rows[0].fn_get_all_operation_types;
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
*
|
|
50
|
+
* @param pool The PG connection pool for the SQL execution
|
|
51
|
+
* @param role_id id of the role to get the optypes for
|
|
52
|
+
*/
|
|
53
|
+
static get_role_operation_types(pool, role_id) {
|
|
54
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
const result = yield pool.query(`
|
|
56
|
+
SELECT multisig.fn_get_role_operation_types($1::bigint)
|
|
57
|
+
`, [role_id]);
|
|
58
|
+
if (!result || !result.rows)
|
|
59
|
+
throw new Error(`DB FN error: multisig.gn_get_role_operation_types()`);
|
|
60
|
+
return result.rows[0].fn_get_role_operation_types;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/** Records an on-chain role grant for a wallet on an escrow contract. `confirmed` indicates whether the tx was finalised. */
|
|
64
|
+
static fn_grant_escrow_role(pool, blockchain, chain_id, contract_address, wallet_address, role_hash, p_user_id, confirmed, p_caller, p_sender, p_tx_hash, p_timestamp, p_block_number, gas_used) {
|
|
65
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
const result = yield pool.query(`
|
|
67
|
+
SELECT multisig.fn_grant_escrow_role($1::text,$2::text,$3::text,$4::text,$5::text,$6::bigint,$7::boolean,$8::text,$9::text,$10::text,$11::bigint,$12::bigint,$13::numeric)
|
|
68
|
+
`, [blockchain, chain_id, contract_address, wallet_address, role_hash, p_user_id, confirmed, p_caller, p_sender, p_tx_hash, p_timestamp, p_block_number, gas_used]);
|
|
69
|
+
if (!result || !result.rows)
|
|
70
|
+
throw new Error(`DB FN Error: multisig.fn_grant_escrow_role`);
|
|
71
|
+
return result.rows[0].fn_grant_escrow_role;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
/** Records an on-chain role revocation for a wallet on an escrow contract. `confirmed` indicates whether the tx was finalised. */
|
|
75
|
+
static fn_revoke_escrow_role(pool, blockchain, chain_id, contract_address, wallet_address, role_hash, p_user_id, confirmed, p_caller, p_sender, p_tx_hash, p_timestamp, p_block_number, gas_used) {
|
|
76
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
+
const result = yield pool.query(`
|
|
78
|
+
SELECT multisig.fn_revoke_escrow_role($1::text,$2::text,$3::text,$4::text,$5::text,$6::bigint,$7::boolean,$8::text,$9::text,$10::text,$11::bigint,$12::bigint,$13::numeric)
|
|
79
|
+
`, [blockchain, chain_id, contract_address, wallet_address, role_hash, p_user_id, confirmed, p_caller, p_sender, p_tx_hash, p_timestamp, p_block_number, gas_used]);
|
|
80
|
+
if (!result || !result.rows)
|
|
81
|
+
throw new Error(`DB FN Error: multisig.fn_revoke_escrow_role`);
|
|
82
|
+
return result.rows[0].fn_revoke_escrow_role;
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
exports.default = ContractRolesService;
|
|
87
|
+
const fn_get_role_op_types = [{ "id": 1, "roleId": 1, "operationTypeId": 5, "operationName": "CONFIG_TIMELOCK", "description": "Configure timelock operation" }];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Pool } from "pg";
|
|
2
|
+
import { OperationType } from "../../../contracts/types/escrow";
|
|
3
|
+
import { ScheduleTransactionJob } from "../../../entities/ScheduleTransactionJob";
|
|
4
|
+
import { ScheduleTransactionJobHistory } from "../../../entities/ScheduleTransactionJobHistory";
|
|
5
|
+
declare class ScheduleTransactionJobHistoryService {
|
|
6
|
+
/** Inserts a history snapshot for each job in the batch. */
|
|
7
|
+
static batch_insert: (pool: Pool, jobs: ScheduleTransactionJob[]) => Promise<void>;
|
|
8
|
+
/** Returns the full transition history for a job. */
|
|
9
|
+
static get_by_job_id: (pool: Pool, job_id: number) => Promise<ScheduleTransactionJobHistory[]>;
|
|
10
|
+
/** Returns the full transition history for a specific request and operation type. */
|
|
11
|
+
static get_by_request: (pool: Pool, request_id: number, operation_type: OperationType) => Promise<ScheduleTransactionJobHistory[]>;
|
|
12
|
+
}
|
|
13
|
+
export default ScheduleTransactionJobHistoryService;
|
|
14
|
+
//# sourceMappingURL=ScheduleTransactionJobHistoryService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScheduleTransactionJobHistoryService.d.ts","sourceRoot":"","sources":["../../../../src/services/db/timelock/ScheduleTransactionJobHistoryService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAClF,OAAO,EAAE,6BAA6B,EAAE,MAAM,iDAAiD,CAAC;AAEhG,cAAM,oCAAoC;IAEtC,4DAA4D;IAC5D,MAAM,CAAC,YAAY,GAAU,MAAM,IAAI,EAAE,MAAM,sBAAsB,EAAE,KAAG,OAAO,CAAC,IAAI,CAAC,CA2BrF;IAEF,qDAAqD;IACrD,MAAM,CAAC,aAAa,GAAU,MAAM,IAAI,EAAE,QAAQ,MAAM,KAAG,OAAO,CAAC,6BAA6B,EAAE,CAAC,CAQjG;IAEF,qFAAqF;IACrF,MAAM,CAAC,cAAc,GAAU,MAAM,IAAI,EAAE,YAAY,MAAM,EAAE,gBAAgB,aAAa,KAAG,OAAO,CAAC,6BAA6B,EAAE,CAAC,CASrI;CAEL;AAED,eAAe,oCAAoC,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var _a;
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
class ScheduleTransactionJobHistoryService {
|
|
14
|
+
}
|
|
15
|
+
_a = ScheduleTransactionJobHistoryService;
|
|
16
|
+
/** Inserts a history snapshot for each job in the batch. */
|
|
17
|
+
ScheduleTransactionJobHistoryService.batch_insert = (pool, jobs) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
+
if (jobs.length === 0)
|
|
19
|
+
return;
|
|
20
|
+
const jobIds = jobs.map(j => j.id);
|
|
21
|
+
const requestIds = jobs.map(j => j.request_id);
|
|
22
|
+
const opTypes = jobs.map(j => j.operation_type);
|
|
23
|
+
const blockchains = jobs.map(j => j.blockchain);
|
|
24
|
+
const chainIds = jobs.map(j => j.chain_id);
|
|
25
|
+
const statuses = jobs.map(j => j.status);
|
|
26
|
+
const txHashes = jobs.map(j => { var _b; return (_b = j.tx_hash) !== null && _b !== void 0 ? _b : null; });
|
|
27
|
+
const retryCounts = jobs.map(j => j.retry_count);
|
|
28
|
+
const errorMessages = jobs.map(j => { var _b; return (_b = j.error_message) !== null && _b !== void 0 ? _b : null; });
|
|
29
|
+
yield pool.query(`
|
|
30
|
+
INSERT INTO multisig.schedule_transaction_jobs_history
|
|
31
|
+
(job_id, request_id, operation_type, blockchain, chain_id, status, tx_hash, retry_count, error_message)
|
|
32
|
+
SELECT
|
|
33
|
+
UNNEST($1::bigint[]),
|
|
34
|
+
UNNEST($2::int[]),
|
|
35
|
+
UNNEST($3::int[]),
|
|
36
|
+
UNNEST($4::text[]),
|
|
37
|
+
UNNEST($5::text[]),
|
|
38
|
+
UNNEST($6::text[]),
|
|
39
|
+
UNNEST($7::text[]),
|
|
40
|
+
UNNEST($8::int[]),
|
|
41
|
+
UNNEST($9::text[])
|
|
42
|
+
`, [jobIds, requestIds, opTypes, blockchains, chainIds, statuses, txHashes, retryCounts, errorMessages]);
|
|
43
|
+
});
|
|
44
|
+
/** Returns the full transition history for a job. */
|
|
45
|
+
ScheduleTransactionJobHistoryService.get_by_job_id = (pool, job_id) => __awaiter(void 0, void 0, void 0, function* () {
|
|
46
|
+
const res = yield pool.query(`
|
|
47
|
+
SELECT * FROM multisig.schedule_transaction_jobs_history
|
|
48
|
+
WHERE job_id = $1
|
|
49
|
+
ORDER BY created_at ASC
|
|
50
|
+
`, [job_id]);
|
|
51
|
+
return res.rows;
|
|
52
|
+
});
|
|
53
|
+
/** Returns the full transition history for a specific request and operation type. */
|
|
54
|
+
ScheduleTransactionJobHistoryService.get_by_request = (pool, request_id, operation_type) => __awaiter(void 0, void 0, void 0, function* () {
|
|
55
|
+
const res = yield pool.query(`
|
|
56
|
+
SELECT * FROM multisig.schedule_transaction_jobs_history
|
|
57
|
+
WHERE request_id = $1
|
|
58
|
+
AND operation_type = $2
|
|
59
|
+
ORDER BY created_at ASC
|
|
60
|
+
`, [request_id, operation_type]);
|
|
61
|
+
return res.rows;
|
|
62
|
+
});
|
|
63
|
+
exports.default = ScheduleTransactionJobHistoryService;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ScheduleJobStatus, ScheduleTransactionJob } from "../../../entities/ScheduleTransactionJob";
|
|
2
|
+
import { ClaimJobLockMetadata } from "../../types";
|
|
3
|
+
import { Pool } from "pg";
|
|
4
|
+
import { OperationType } from "../../../contracts/types/escrow";
|
|
5
|
+
import { MarkCompleteScheduleJob, ScheduleTransactionJobWithDetails, ScheduleJobFilters, ScheduleJobListItem, ScheduleJobHistoryFilters, ScheduleJobHistoryItem } from "../../types/db";
|
|
6
|
+
import { Paginated } from "../../types/claim_job_service";
|
|
7
|
+
import { RequeueJobConfiguration } from "../../types/watchdog";
|
|
8
|
+
declare class ScheduleTransactionService {
|
|
9
|
+
static get_and_lock_available_jobs: (pool: Pool, limit?: number, job_ttl_s?: number, lock_metadata?: ClaimJobLockMetadata) => Promise<ScheduleTransactionJob[]>;
|
|
10
|
+
/** Locks and returns available jobs with full withdrawal details via inline SQL (bypasses DB function). */
|
|
11
|
+
static get_and_lock_available_jobs_with_details: (pool: Pool, limit?: number, job_ttl_s?: number, lock_metadata?: ClaimJobLockMetadata) => Promise<ScheduleTransactionJobWithDetails[]>;
|
|
12
|
+
/** Locks and returns available jobs with full withdrawal details via DB function. */
|
|
13
|
+
static get_and_lock_available_jobs_with_details_depr: (pool: Pool, limit?: number, job_ttl_s?: number, lock_metadata?: ClaimJobLockMetadata) => Promise<ScheduleTransactionJobWithDetails[]>;
|
|
14
|
+
/**
|
|
15
|
+
* Requeues all jobs in the given status to "queued"
|
|
16
|
+
*/
|
|
17
|
+
static requeue_expired_jobs: (pool: Pool, data: RequeueJobConfiguration<ScheduleJobStatus>) => Promise<ScheduleTransactionJob[]>;
|
|
18
|
+
static batch_update_status: (pool: Pool, operation_type: OperationType, request_ids: number[], new_status: ScheduleJobStatus) => Promise<void>;
|
|
19
|
+
static batch_update_failed_jobs: (pool: Pool, operation_type: OperationType, request_ids: number[], new_status: ScheduleJobStatus, error_message?: string, retryable?: boolean) => Promise<void>;
|
|
20
|
+
static batch_update_failed_jobs_custom_error: (pool: Pool, operation_type: OperationType, jobs: {
|
|
21
|
+
request_id: number;
|
|
22
|
+
new_status: ScheduleJobStatus;
|
|
23
|
+
error_message: string;
|
|
24
|
+
retryable: boolean;
|
|
25
|
+
}[]) => Promise<void>;
|
|
26
|
+
static batch_update_executed_jobs: (pool: Pool, data: {
|
|
27
|
+
operation_type: OperationType;
|
|
28
|
+
request_id: number;
|
|
29
|
+
tx_hash: string;
|
|
30
|
+
sent_at: Date;
|
|
31
|
+
}[]) => Promise<void>;
|
|
32
|
+
static mark_complete: (pool: Pool, payloads: MarkCompleteScheduleJob[]) => Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Paginated list of current schedule-transaction jobs, newest first, with the
|
|
35
|
+
* status resolved to text and (for withdrawal operation types) the receiver/token/
|
|
36
|
+
* amount joined in. All filters are optional and combine with AND.
|
|
37
|
+
*/
|
|
38
|
+
static list_jobs_paginated: (pool: Pool, page: number, page_size?: number, filters?: ScheduleJobFilters) => Promise<Paginated<ScheduleJobListItem[]>>;
|
|
39
|
+
/**
|
|
40
|
+
* Paginated schedule-transaction job history (append-only status transitions),
|
|
41
|
+
* newest first. All filters are optional and combine with AND.
|
|
42
|
+
*/
|
|
43
|
+
static list_history_paginated: (pool: Pool, page: number, page_size?: number, filters?: ScheduleJobHistoryFilters) => Promise<Paginated<ScheduleJobHistoryItem[]>>;
|
|
44
|
+
}
|
|
45
|
+
export default ScheduleTransactionService;
|
|
46
|
+
//# sourceMappingURL=ScheduleTransactionService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScheduleTransactionService.d.ts","sourceRoot":"","sources":["../../../../src/services/db/timelock/ScheduleTransactionService.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,sBAAsB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