@ercworldio/blockchain-shared 1.0.3-dev.7 → 1.0.5-dev.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 (97) hide show
  1. package/build/chains/networks_dev.json +17 -17
  2. package/build/chains/networks_prod-dz.json +0 -35
  3. package/build/chains/networks_prod-sh.json +40 -4
  4. package/build/chains/networks_prod-yb.json +40 -4
  5. package/build/contracts/Escrow.d.ts +16 -6
  6. package/build/contracts/Escrow.d.ts.map +1 -1
  7. package/build/contracts/Escrow.js +112 -4
  8. package/build/contracts/EscrowErrors.d.ts +110 -1
  9. package/build/contracts/EscrowErrors.d.ts.map +1 -1
  10. package/build/contracts/EscrowErrors.js +71 -14
  11. package/build/contracts/artifacts/Escrow.json +244 -14
  12. package/build/contracts/contract-events/AccessControlEvents.d.ts +12 -2
  13. package/build/contracts/contract-events/AccessControlEvents.d.ts.map +1 -1
  14. package/build/contracts/contract-events/AccessControlEvents.js +29 -5
  15. package/build/contracts/contract-events/EscrowEvents.d.ts +134 -2
  16. package/build/contracts/contract-events/EscrowEvents.d.ts.map +1 -1
  17. package/build/contracts/contract-events/EscrowEvents.js +67 -17
  18. package/build/contracts/contract-events/types/events.d.ts +35 -1
  19. package/build/contracts/contract-events/types/events.d.ts.map +1 -1
  20. package/build/contracts/typechain-types/contracts/escrow/Escrow.d.ts +76 -15
  21. package/build/contracts/typechain-types/contracts/escrow/Escrow.d.ts.map +1 -1
  22. package/build/contracts/typechain-types/contracts/lib/Events.d.ts +2 -8
  23. package/build/contracts/typechain-types/contracts/lib/Events.d.ts.map +1 -1
  24. package/build/contracts/typechain-types/factories/contracts/escrow/EscrowAccessControl__factory.d.ts +69 -1
  25. package/build/contracts/typechain-types/factories/contracts/escrow/EscrowAccessControl__factory.d.ts.map +1 -1
  26. package/build/contracts/typechain-types/factories/contracts/escrow/EscrowAccessControl__factory.js +91 -1
  27. package/build/contracts/typechain-types/factories/contracts/escrow/EscrowErrors__factory.d.ts +69 -1
  28. package/build/contracts/typechain-types/factories/contracts/escrow/EscrowErrors__factory.d.ts.map +1 -1
  29. package/build/contracts/typechain-types/factories/contracts/escrow/EscrowErrors__factory.js +91 -1
  30. package/build/contracts/typechain-types/factories/contracts/escrow/EscrowSignature__factory.d.ts +1 -1
  31. package/build/contracts/typechain-types/factories/contracts/escrow/EscrowSignature__factory.js +1 -1
  32. package/build/contracts/typechain-types/factories/contracts/escrow/Escrow__factory.d.ts +188 -13
  33. package/build/contracts/typechain-types/factories/contracts/escrow/Escrow__factory.d.ts.map +1 -1
  34. package/build/contracts/typechain-types/factories/contracts/escrow/Escrow__factory.js +245 -15
  35. package/build/contracts/typechain-types/factories/contracts/lib/Events__factory.d.ts +1 -11
  36. package/build/contracts/typechain-types/factories/contracts/lib/Events__factory.d.ts.map +1 -1
  37. package/build/contracts/typechain-types/factories/contracts/lib/Events__factory.js +1 -13
  38. package/build/contracts/typechain-types/factories/contracts/lib/MultisigLib__factory.d.ts +45 -1
  39. package/build/contracts/typechain-types/factories/contracts/lib/MultisigLib__factory.d.ts.map +1 -1
  40. package/build/contracts/typechain-types/factories/contracts/lib/MultisigLib__factory.js +59 -1
  41. package/build/contracts/types/escrow.d.ts +16 -2
  42. package/build/contracts/types/escrow.d.ts.map +1 -1
  43. package/build/contracts/types/escrow.js +4 -0
  44. package/build/entities/AdminOperationThresholds.d.ts +0 -1
  45. package/build/entities/AdminOperationThresholds.d.ts.map +1 -1
  46. package/build/entities/AdminOperationThresholds.js +1 -5
  47. package/build/entities/ClaimJob.d.ts +1 -0
  48. package/build/entities/ClaimJob.d.ts.map +1 -1
  49. package/build/entities/ClaimJob.js +4 -0
  50. package/build/entities/EscrowRoles.js +1 -1
  51. package/build/entities/GlobalTimelock.d.ts +0 -1
  52. package/build/entities/GlobalTimelock.d.ts.map +1 -1
  53. package/build/entities/GlobalTimelock.js +1 -5
  54. package/build/entities/RoleHash.js +1 -1
  55. package/build/entities/TokenExecutionThresholds.d.ts +0 -1
  56. package/build/entities/TokenExecutionThresholds.d.ts.map +1 -1
  57. package/build/entities/TokenExecutionThresholds.js +1 -5
  58. package/build/errors/errors.d.ts +33 -0
  59. package/build/errors/errors.d.ts.map +1 -1
  60. package/build/errors/errors.js +70 -2
  61. package/build/index.d.ts +6 -9
  62. package/build/index.d.ts.map +1 -1
  63. package/build/index.js +22 -11
  64. package/build/interfaces.d.ts +2 -2
  65. package/build/interfaces.d.ts.map +1 -1
  66. package/build/services/AlchemyService.d.ts +2 -1
  67. package/build/services/AlchemyService.d.ts.map +1 -1
  68. package/build/services/AlchemyService.js +8 -2
  69. package/build/services/AlchemyWebhooks.d.ts.map +1 -1
  70. package/build/services/AlchemyWebhooks.js +34 -29
  71. package/build/services/AzureEventHubHandler.d.ts.map +1 -1
  72. package/build/services/AzureEventHubHandler.js +17 -5
  73. package/build/services/ClaimJobService.d.ts +6 -2
  74. package/build/services/ClaimJobService.d.ts.map +1 -1
  75. package/build/services/ClaimJobService.js +155 -24
  76. package/build/services/db/roles/ContractRoles.d.ts +2 -2
  77. package/build/services/db/roles/ContractRoles.d.ts.map +1 -1
  78. package/build/services/db/roles/ContractRoles.js +18 -12
  79. package/build/services/types/azure_event_hub_handler.d.ts +9 -1
  80. package/build/services/types/azure_event_hub_handler.d.ts.map +1 -1
  81. package/build/services/types/azure_event_hub_handler.js +8 -0
  82. package/build/services/types/claim.d.ts +17 -1
  83. package/build/services/types/claim.d.ts.map +1 -1
  84. package/build/services/types/claim_job_service.d.ts +9 -1
  85. package/build/services/types/claim_job_service.d.ts.map +1 -1
  86. package/build/services/types/index.d.ts +1 -0
  87. package/build/services/types/index.d.ts.map +1 -1
  88. package/build/services/types/index.js +1 -0
  89. package/build/services/utils/alchemy.d.ts.map +1 -1
  90. package/build/services/utils/alchemy.js +6 -1
  91. package/build/utils/AsyncTTLCache.d.ts +2 -0
  92. package/build/utils/AsyncTTLCache.d.ts.map +1 -1
  93. package/build/utils/AsyncTTLCache.js +10 -2
  94. package/build/utils/custodial.d.ts +9 -0
  95. package/build/utils/custodial.d.ts.map +1 -1
  96. package/build/utils/custodial.js +32 -4
  97. package/package.json +6 -3
@@ -1 +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,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9D,MAAM,WAAW,aAAa;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,iBAAiB;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,cAAM,oBAAoB;IAEtB;;;;OAIG;WACU,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAU3D;;;;;OAKG;WACU,uBAAuB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAW1E;;;;OAIG;WACU,wBAAwB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAahG,6HAA6H;WAChH,oBAAoB,CAC7B,IAAI,EAAE,IAAI,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C,cAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;CAc/C;AAED,eAAe,oBAAoB,CAAC"}
@@ -26,7 +26,7 @@ class ContractRolesService {
26
26
  `);
27
27
  if (!result)
28
28
  throw new Error(`DB FN error: multisig.fn_get_roles()`);
29
- return result.rows;
29
+ return result.rows[0].fn_get_roles;
30
30
  });
31
31
  }
32
32
  /**
@@ -40,7 +40,9 @@ class ContractRolesService {
40
40
  const result = yield pool.query(`
41
41
  SELECT multisig.fn_get_all_operation_types()
42
42
  `);
43
- return result.rows;
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;
44
46
  });
45
47
  }
46
48
  /**
@@ -53,27 +55,31 @@ class ContractRolesService {
53
55
  const result = yield pool.query(`
54
56
  SELECT multisig.fn_get_role_operation_types($1::bigint)
55
57
  `, [role_id]);
56
- if (!result)
58
+ if (!result || !result.rows)
57
59
  throw new Error(`DB FN error: multisig.gn_get_role_operation_types()`);
58
- return result.rows;
60
+ return result.rows[0].fn_get_role_operation_types;
59
61
  });
60
62
  }
61
63
  /** Records an on-chain role grant for a wallet on an escrow contract. `confirmed` indicates whether the tx was finalised. */
62
- static fn_grant_escrow_role(pool, blockchain, chain_id, contract_address, wallet_address, role_hash, confirmed, p_caller, p_sender, p_tx_hash, p_timestamp, p_block_number, gas_used) {
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) {
63
65
  return __awaiter(this, void 0, void 0, function* () {
64
66
  const result = yield pool.query(`
65
- SELECT multisig.fn_grant_escrow_role($1::text,$2::text,$3::text,$4::text,$5::text,$6::boolean,$7::text,$8::text,$9::text,$10::bigint,$11::bigint,$12::numeric)
66
- `, [blockchain, chain_id, contract_address, wallet_address, role_hash, confirmed, p_caller, p_sender, p_tx_hash, p_timestamp, p_block_number, gas_used]);
67
- return result.rows;
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;
68
72
  });
69
73
  }
70
74
  /** Records an on-chain role revocation for a wallet on an escrow contract. `confirmed` indicates whether the tx was finalised. */
71
- static fn_revoke_escrow_role(pool, blockchain, chain_id, contract_address, wallet_address, role_hash, confirmed, p_caller, p_sender, p_tx_hash, p_timestamp, p_block_number, gas_used) {
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) {
72
76
  return __awaiter(this, void 0, void 0, function* () {
73
77
  const result = yield pool.query(`
74
- SELECT multisig.fn_revoke_escrow_role($1::text,$2::text,$3::text,$4::text,$5::text,$6::boolean,$7::text,$8::text,$9::text,$10::bigint,$11::bigint,$12::numeric)
75
- `, [blockchain, chain_id, contract_address, wallet_address, role_hash, confirmed, p_caller, p_sender, p_tx_hash, p_timestamp, p_block_number, gas_used]);
76
- return result.rows;
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;
77
83
  });
78
84
  }
79
85
  }
@@ -7,7 +7,15 @@ export declare enum EventHubEventNames {
7
7
  ROLEREVOKED = "RoleRevoked",
8
8
  LOWRESERVES = "LowReserves",
9
9
  COVERAGEINFO = "CoverageInfo",
10
- TRANSFERLOGSRAW = "TransferLogsRaw"
10
+ TRANSFERLOGSRAW = "TransferLogsRaw",
11
+ SET_TOKEN_TIMELOCK = "SetTokenTimelock",
12
+ SET_TIMELOCK_GRANULAR = "SetTimelockGranular",
13
+ CONFIGURE_TOKEN_MULTISIG = "ConfigureTokenMultisig",
14
+ CONFIGURE_ADMIN_MULTISIG = "ConfigureAdminMultisig",
15
+ WITHDRAWAL_SCHEDUELED = "WithdrawalScheduled",
16
+ WITHDRAWAL_EXECUTED = "WithdrawalExecuted",
17
+ WITHDRAWAL_CANCELLED = "WithdrawalCancelled",
18
+ ADMIN_WITHDRAW = "AdminWithdraw"
11
19
  }
12
20
  export declare enum AzureEventHubNames {
13
21
  DEPOSIT = "deposits",
@@ -1 +1 @@
1
- {"version":3,"file":"azure_event_hub_handler.d.ts","sourceRoot":"","sources":["../../../src/services/types/azure_event_hub_handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,MAAM,CAAC,kBAAkB,EAAE,GAAG,CAAC,EAAE,kBAAkB,CAAC,CAAA;AACxF,oBAAY,kBAAkB;IAC1B,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,WAAW,gBAAgB;IAC3B,WAAW,gBAAgB;IAC3B,WAAW,gBAAgB;IAC3B,YAAY,iBAAiB;IAC7B,eAAe,oBAAoB;CACtC;AAED,oBAAY,kBAAkB;IAC1B,OAAO,aAAa;IACpB,UAAU,gBAAgB;IAC1B,YAAY,iBAAiB;IAC7B,eAAe,oBAAoB;CACtC"}
1
+ {"version":3,"file":"azure_event_hub_handler.d.ts","sourceRoot":"","sources":["../../../src/services/types/azure_event_hub_handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,MAAM,CAAC,kBAAkB,EAAE,GAAG,CAAC,EAAE,kBAAkB,CAAC,CAAA;AACxF,oBAAY,kBAAkB;IAC1B,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,WAAW,gBAAgB;IAC3B,WAAW,gBAAgB;IAC3B,WAAW,gBAAgB;IAC3B,YAAY,iBAAiB;IAC7B,eAAe,oBAAoB;IACnC,kBAAkB,qBAAqB;IACvC,qBAAqB,wBAAwB;IAC7C,wBAAwB,2BAA2B;IACnD,wBAAwB,2BAA2B;IACnD,qBAAqB,wBAAwB;IAC7C,mBAAmB,uBAAuB;IAC1C,oBAAoB,wBAAwB;IAC5C,cAAc,kBAAkB;CACnC;AAED,oBAAY,kBAAkB;IAC1B,OAAO,aAAa;IACpB,UAAU,gBAAgB;IAC1B,YAAY,iBAAiB;IAC7B,eAAe,oBAAoB;CACtC"}
@@ -10,6 +10,14 @@ var EventHubEventNames;
10
10
  EventHubEventNames["LOWRESERVES"] = "LowReserves";
11
11
  EventHubEventNames["COVERAGEINFO"] = "CoverageInfo";
12
12
  EventHubEventNames["TRANSFERLOGSRAW"] = "TransferLogsRaw";
13
+ EventHubEventNames["SET_TOKEN_TIMELOCK"] = "SetTokenTimelock";
14
+ EventHubEventNames["SET_TIMELOCK_GRANULAR"] = "SetTimelockGranular";
15
+ EventHubEventNames["CONFIGURE_TOKEN_MULTISIG"] = "ConfigureTokenMultisig";
16
+ EventHubEventNames["CONFIGURE_ADMIN_MULTISIG"] = "ConfigureAdminMultisig";
17
+ EventHubEventNames["WITHDRAWAL_SCHEDUELED"] = "WithdrawalScheduled";
18
+ EventHubEventNames["WITHDRAWAL_EXECUTED"] = "WithdrawalExecuted";
19
+ EventHubEventNames["WITHDRAWAL_CANCELLED"] = "WithdrawalCancelled";
20
+ EventHubEventNames["ADMIN_WITHDRAW"] = "AdminWithdraw";
13
21
  })(EventHubEventNames || (exports.EventHubEventNames = EventHubEventNames = {}));
14
22
  var AzureEventHubNames;
15
23
  (function (AzureEventHubNames) {
@@ -19,9 +19,25 @@ export interface WithdrawRequestDetails {
19
19
  blockchain: BlockchainType;
20
20
  receiver: string;
21
21
  paymentType: PaymentType;
22
- destinationBlockchain?: BLOCKCHAINS.EVM | BLOCKCHAINS.SOLANA;
22
+ destinationBlockchain?: BLOCKCHAINS.EVM | BLOCKCHAINS.SOLANA | BLOCKCHAINS.TRON;
23
23
  destinationChainId?: number;
24
24
  destinationToken?: string;
25
+ sigsExecutiveRequired?: number;
26
+ sigsManagerRequired?: number;
27
+ multisigSignatures: MultisigSignatureEntry[];
28
+ receiverAddress: string;
29
+ timeLockSeconds: number;
30
+ }
31
+ export interface MultisigSignatureEntry {
32
+ name: string;
33
+ signerAddress: string;
34
+ contractAddress: string;
35
+ createdAt: string;
36
+ updatedAt: string;
37
+ operationType: number;
38
+ v?: number;
39
+ r?: string;
40
+ s?: string;
25
41
  }
26
42
  export interface ClaimJobSuccessResult extends ClaimJobs {
27
43
  tx_hash: string;
@@ -1 +1 @@
1
- {"version":3,"file":"claim.d.ts","sourceRoot":"","sources":["../../../src/services/types/claim.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEhD,MAAM,WAAW,mBAAmB;IAChC,UAAU,EAAE,cAAc,CAAC;IAC3B,YAAY,EAAE,WAAW,CAAC;CAC7B;AACD,MAAM,MAAM,aAAa,GACnB,SAAS,GACT,YAAY,GACZ,UAAU,GACV,UAAU,GACV,UAAU,GACV,MAAM,GACN,aAAa,CAAC;AAEpB,MAAM,MAAM,SAAS,GACf,QAA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AC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,qBAAsB,SAAQ,SAAS;IACpD,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,6BAA6B,EAAE,MAAM,CAAC;IACtC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,0BAA0B,EAAE,MAAM,CAAC;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,IAAI,CAAC;CACrB"}
@@ -1,5 +1,6 @@
1
+ import { ClaimJobs } from "../../entities";
1
2
  import { BlockchainType, ChainId } from "../../interfaces";
2
- import { JobStatus, PaymentType } from "./claim";
3
+ import { JobStatus, MultisigSignatureEntry, PaymentType } from "./claim";
3
4
  export interface MarkCompletePayload {
4
5
  request_id: number;
5
6
  from: string;
@@ -18,6 +19,7 @@ export interface CreateClaimJobsPayload {
18
19
  amount: bigint;
19
20
  token: string;
20
21
  decimals: number;
22
+ has_timelock: boolean;
21
23
  }
22
24
  export interface BatchUpdateStatusPayload {
23
25
  request_id: number;
@@ -51,4 +53,10 @@ export interface ClaimJobLockMetadata {
51
53
  lock_owner: string;
52
54
  lock_reason: string;
53
55
  }
56
+ export interface ClaimJobResult extends ClaimJobs {
57
+ multisig_signatures: MultisigSignatureEntry[];
58
+ commitment_hash: string;
59
+ execute_at: Date;
60
+ }
61
+ export type ClaimJobWithDetails = ClaimJobResult;
54
62
  //# sourceMappingURL=claim_job_service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"claim_job_service.d.ts","sourceRoot":"","sources":["../../../src/services/types/claim_job_service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEjD,MAAM,WAAW,mBAAmB;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,sBAAsB;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,cAAc,CAAC;IAC3B,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,WAAW,CAAC;IAC1B,qBAAqB,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;IAClD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,wBAAwB;IACrC,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,SAAS,CAAC,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,CAAC,CAAC;CACZ;AAED,MAAM,WAAW,kBAAkB;IAC/B,UAAU,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB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EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,IAAI,CAAC;CAEpB;AAED,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC"}
@@ -14,4 +14,5 @@ export * from "./balance_service";
14
14
  export * from "./chain_manager";
15
15
  export * from './quicknode';
16
16
  export * from "./bo_withdrawal";
17
+ export * from "./db/index";
17
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,WAAW,CAAC;AAC1B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,SAAS,CAAC;AACxB,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,WAAW,CAAC;AAC1B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,SAAS,CAAC;AACxB,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC"}
@@ -30,3 +30,4 @@ __exportStar(require("./balance_service"), exports);
30
30
  __exportStar(require("./chain_manager"), exports);
31
31
  __exportStar(require("./quicknode"), exports);
32
32
  __exportStar(require("./bo_withdrawal"), exports);
33
+ __exportStar(require("./db/index"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"alchemy.d.ts","sourceRoot":"","sources":["../../../src/services/utils/alchemy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAGzD,eAAO,MAAM,mBAAmB,GAAI,cAAc,qBAAqB,0CA0CtE,CAAA;AAKD,eAAO,MAAM,sBAAsB,GAAI,OAAO,OAAO,EAAE,aAAY,OAAc,KAAG,qBAoEnF,CAAA;AAGD,eAAO,MAAM,oBAAoB,GAAI,SAAS,qBAAqB,KAAG,OAsDrE,CAAA"}
1
+ {"version":3,"file":"alchemy.d.ts","sourceRoot":"","sources":["../../../src/services/utils/alchemy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAGzD,eAAO,MAAM,mBAAmB,GAAI,cAAc,qBAAqB,0CAgDtE,CAAA;AAKD,eAAO,MAAM,sBAAsB,GAAI,OAAO,OAAO,EAAE,aAAY,OAAc,KAAG,qBAoEnF,CAAA;AAGD,eAAO,MAAM,oBAAoB,GAAI,SAAS,qBAAqB,KAAG,OAsDrE,CAAA"}
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.get_alchemy_chain_id = exports.get_alchemy_chain_name = exports.get_blockchain_type = void 0;
4
4
  // CONFIG Configuration: New alchemy network
5
5
  const get_blockchain_type = (network_name) => {
6
+ console.log(`Getting blockchain type for ${network_name}`);
6
7
  const evm_networks = [
7
8
  "ETH_MAINNET",
8
9
  "MATIC_MAINNET",
@@ -27,16 +28,20 @@ const get_blockchain_type = (network_name) => {
27
28
  ];
28
29
  let evm_match = evm_networks.some(network => network_name.includes(network));
29
30
  if (evm_match) {
31
+ console.log(`match evm`);
30
32
  return "evm";
31
33
  }
32
34
  let solana_match = solana_networks.some(network => network_name.includes(network));
33
35
  if (solana_match) {
36
+ console.log(`match solana`);
34
37
  return "solana";
35
38
  }
36
- let tron_match = solana_networks.some(network => network_name.includes(network));
39
+ let tron_match = tron_networks.some(network => network_name.includes(network));
37
40
  if (tron_match) {
41
+ console.log(`match tron`);
38
42
  return "tron";
39
43
  }
44
+ console.log(`no match`);
40
45
  //
41
46
  // TODO: ADD btc here
42
47
  };
@@ -7,6 +7,8 @@ declare class AsyncTTLCache {
7
7
  static getInstance(): AsyncTTLCache;
8
8
  static create(stale_time_in_ms: number): AsyncTTLCache;
9
9
  private resolve_inflight;
10
+ invalidate(key: string): void;
11
+ invalidate_all(): void;
10
12
  get_value<K, V>(key: string, data: K, fetch_task: (data: K) => Promise<V>): Promise<any>;
11
13
  }
12
14
  export default AsyncTTLCache;
@@ -1 +1 @@
1
- {"version":3,"file":"AsyncTTLCache.d.ts","sourceRoot":"","sources":["../../src/utils/AsyncTTLCache.ts"],"names":[],"mappings":"AAOA,cAAM,aAAa;IACf,MAAM,CAAC,QAAQ,EAAE,aAAa,CAAC;IAC/B,OAAO,CAAC,QAAQ,CAAwC;IAEjD,aAAa,EAAE,MAAM,CAAC;IAE7B,OAAO,CAAC,KAAK,CAAmB;IAEhC,OAAO;IAKP,MAAM,CAAC,WAAW;IAQlB,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE,MAAM,GAAG,aAAa;YAQxC,gBAAgB;IAUjB,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC;CAiCzF;AAED,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"AsyncTTLCache.d.ts","sourceRoot":"","sources":["../../src/utils/AsyncTTLCache.ts"],"names":[],"mappings":"AAOA,cAAM,aAAa;IACf,MAAM,CAAC,QAAQ,EAAE,aAAa,CAAC;IAC/B,OAAO,CAAC,QAAQ,CAAwC;IAEjD,aAAa,EAAE,MAAM,CAAC;IAE7B,OAAO,CAAC,KAAK,CAAmB;IAEhC,OAAO;IAKP,MAAM,CAAC,WAAW;IAQlB,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE,MAAM,GAAG,aAAa;YAQxC,gBAAgB;IAUvB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAK7B,cAAc,IAAI,IAAI;IAKhB,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC;CAiCzF;AAED,eAAe,aAAa,CAAC"}
@@ -39,13 +39,21 @@ class AsyncTTLCache {
39
39
  return resolved;
40
40
  });
41
41
  }
42
+ invalidate(key) {
43
+ this.cache.delete(key);
44
+ this.inflight.delete(key);
45
+ }
46
+ invalidate_all() {
47
+ this.cache.clear();
48
+ this.inflight.clear();
49
+ }
42
50
  get_value(key, data, fetch_task) {
43
51
  return __awaiter(this, void 0, void 0, function* () {
44
52
  let existing_entry = this.cache.get(key);
45
53
  let now = new Date().getTime();
46
54
  // Return cached value
47
55
  if (existing_entry && now - existing_entry.last_update <= this.stale_time_ms) {
48
- console.log(`AsyncTTLCache: Hitting cache... Value:`, existing_entry.value);
56
+ console.log(`AsyncTTLCache: Hitting cache... KEY: ${key}, Value:`, existing_entry);
49
57
  return existing_entry.value;
50
58
  }
51
59
  if (!existing_entry || now - existing_entry.last_update > this.stale_time_ms) {
@@ -64,7 +72,7 @@ class AsyncTTLCache {
64
72
  this.inflight.delete(key);
65
73
  }
66
74
  }
67
- console.log(`AsyncTTLCache: Hitting cache... Value:`, existing_entry.value);
75
+ console.log(`AsyncTTLCache: Hitting cache... Value:`, existing_entry);
68
76
  return existing_entry.value;
69
77
  });
70
78
  }
@@ -14,6 +14,14 @@ export interface EstimateEscrowBatchWithdrawPayload {
14
14
  receiver: string;
15
15
  requestId: number;
16
16
  }
17
+ export interface EstimateEscrowExecuteWithdrawalPayload {
18
+ committedAmount: bigint;
19
+ netAmount: bigint;
20
+ requestId: number;
21
+ tokenAddress: string;
22
+ receiverAddress: string;
23
+ executeAt: number;
24
+ }
17
25
  export declare const needs_approval_and_funding: (blockchain: BlockchainType, chainId: ChainId, token: string, parentIndex: number, childIndex: number, spender: string, dbPool: IDatabasePool, config: IConfig) => Promise<{
18
26
  status: boolean;
19
27
  needs_approval: boolean;
@@ -27,6 +35,7 @@ export declare const getWalletBalance: (blockchain: BlockchainType, chainId: Cha
27
35
  balance: bigint;
28
36
  decimals: bigint;
29
37
  }>;
38
+ export declare const estimate_execute_withdrawal: (chain_id: ChainId, payload: EstimateEscrowExecuteWithdrawalPayload, caller: string, config: IConfig) => Promise<bigint>;
30
39
  export declare const estimate_escrow_method_call_cost: (chain_id: ChainId, payloads: EstimateEscrowBatchWithdrawPayload[], dbPool: IDatabasePool, config: IConfig) => Promise<bigint>;
31
40
  export declare const estimateGas: (provider: ethers.Provider, tokenAddress: string, spenderAddress: string | null, amount: bigint, fromAddress: string, chainId: number, transactionType: TransactionType, isMockTransfer?: boolean) => Promise<bigint>;
32
41
  //# sourceMappingURL=custodial.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"custodial.d.ts","sourceRoot":"","sources":["../../src/utils/custodial.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyC,MAAM,EAAwC,MAAM,QAAQ,CAAC;AAC7G,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAYnF,OAAO,EAA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Aa,MAAM,EAAE,YAAY,MAAM,EAAE,SAAS,MAAM,EAAE,OAAO,MAAM,EAAE,QAAQ,aAAa,EAAE,QAAQ,OAAO;;;EAkC1M,CAAA;AAGD,eAAO,MAAM,gBAAgB,GAAU,YAAY,cAAc,EAAE,SAAS,OAAO,EAAE,SAAS,MAAM,EAAE,OAAO,MAAM,EAAE,QAAQ,aAAa,EAAE,QAAQ,OAAO;;;EAkG1J,CAAA;AAGD,eAAO,MAAM,2BAA2B,GAAU,UAAU,OAAO,EAAE,SAAS,sCAAsC,EAAE,QAAQ,MAAM,EAAE,QAAQ,OAAO,oBAwBpJ,CAAA;AAED,eAAO,MAAM,gCAAgC,GAAU,UAAU,OAAO,EAAE,UAAU,kCAAkC,EAAE,EAAE,QAAQ,aAAa,EAAE,QAAQ,OAAO,oBA6C/J,CAAA;AAED,eAAO,MAAM,WAAW,GACpB,UAAU,MAAM,CAAC,QAAQ,EACzB,cAAc,MAAM,EACpB,gBAAgB,MAAM,GAAG,IAAI,EAC7B,QAAQ,MAAM,EACd,aAAa,MAAM,EACnB,SAAS,MAAM,EACf,iBAAiB,eAAe,EAChC,wBAAsB,oBAgEzB,CAAA"}
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.estimateGas = exports.estimate_escrow_method_call_cost = exports.getWalletBalance = exports.approve_if_not_approved = exports.needs_approval_and_funding = void 0;
15
+ exports.estimateGas = exports.estimate_escrow_method_call_cost = exports.estimate_execute_withdrawal = exports.getWalletBalance = exports.approve_if_not_approved = exports.needs_approval_and_funding = void 0;
16
16
  const ethers_1 = require("ethers");
17
17
  const ERC20Mock_json_1 = __importDefault(require("../contracts/artifacts/ERC20Mock.json"));
18
18
  const Escrow_json_1 = __importDefault(require("../contracts/artifacts/Escrow.json"));
@@ -179,6 +179,30 @@ const getWalletBalance = (blockchain, chainId, address, token, dbPool, config) =
179
179
  }
180
180
  });
181
181
  exports.getWalletBalance = getWalletBalance;
182
+ /// Estimate gas for withdrawing scheduled transaction (withdraw with timelock)
183
+ const estimate_execute_withdrawal = (chain_id, payload, caller, config) => __awaiter(void 0, void 0, void 0, function* () {
184
+ const chain_manager = ChainManager_1.default.getInstance(config);
185
+ const escrow_config = chain_manager.getEscrowContractForChain(parseInt(chain_id));
186
+ const provider = ProviderManager_1.default.getInstance(config).getNewProvider(chain_id).provider;
187
+ const Escrow = new ethers_1.ethers.Contract(escrow_config.addresses[0], Escrow_json_1.default, provider);
188
+ const data = Escrow.interface.encodeFunctionData('executeWithdrawal', [
189
+ payload.committedAmount, payload.netAmount, payload.requestId, payload.tokenAddress, payload.receiverAddress, payload.executeAt
190
+ ]);
191
+ const txDetails = {
192
+ to: Escrow.target,
193
+ data: data,
194
+ from: caller
195
+ };
196
+ const [gasUnits, gasPrice] = yield Promise.all([
197
+ (0, Utility_1.retryWithExponentialBackoff)(() => __awaiter(void 0, void 0, void 0, function* () { return yield provider.estimateGas(txDetails); })),
198
+ (0, Utility_1.retryWithExponentialBackoff)(() => __awaiter(void 0, void 0, void 0, function* () { return yield provider.getFeeData(); }))
199
+ ]);
200
+ const totalFee = gasPrice.gasPrice
201
+ ? gasPrice.gasPrice * gasUnits
202
+ : (gasPrice.maxFeePerGas || BigInt(0)) * gasUnits;
203
+ return totalFee;
204
+ });
205
+ exports.estimate_execute_withdrawal = estimate_execute_withdrawal;
182
206
  const estimate_escrow_method_call_cost = (chain_id, payloads, dbPool, config) => __awaiter(void 0, void 0, void 0, function* () {
183
207
  const errors = new TransactionsErrors_1.default();
184
208
  if (payloads.length === 0)
@@ -207,14 +231,16 @@ const estimate_escrow_method_call_cost = (chain_id, payloads, dbPool, config) =>
207
231
  chainId: chain_id.toString(),
208
232
  value: 0
209
233
  };
210
- console.log(`BATCh WITHDRAW DAT: `, { batch_payloads, data, txDetails });
211
234
  // Estimate gas units and get current gas price
212
235
  const [gasUnits, gasPrice] = yield Promise.all([
213
236
  (0, Utility_1.retryWithExponentialBackoff)(() => __awaiter(void 0, void 0, void 0, function* () { return yield provider.estimateGas(txDetails); })),
214
237
  (0, Utility_1.retryWithExponentialBackoff)(() => __awaiter(void 0, void 0, void 0, function* () { return yield provider.getFeeData(); }))
215
238
  ]);
216
239
  // Calculate total gas cost in native token
217
- const totalFee = gasPrice.maxFeePerGas ? gasUnits * gasPrice.maxFeePerGas : gasUnits * (gasPrice.gasPrice || BigInt(0));
240
+ // const totalFee = gasPrice.maxFeePerGas ? gasUnits * gasPrice.maxFeePerGas : gasUnits * (gasPrice.gasPrice || BigInt(0));
241
+ const totalFee = gasPrice.gasPrice
242
+ ? gasPrice.gasPrice * gasUnits
243
+ : (gasPrice.maxFeePerGas || BigInt(0)) * gasUnits;
218
244
  return totalFee;
219
245
  });
220
246
  exports.estimate_escrow_method_call_cost = estimate_escrow_method_call_cost;
@@ -273,7 +299,9 @@ const estimateGas = (provider_1, tokenAddress_1, spenderAddress_1, amount_1, fro
273
299
  (0, Utility_1.retryWithExponentialBackoff)(() => __awaiter(void 0, void 0, void 0, function* () { return yield provider.getFeeData(); }))
274
300
  ]);
275
301
  // Calculate total gas cost in native token
276
- const totalFee = gasPrice.maxFeePerGas ? gasUnits * gasPrice.maxFeePerGas : gasUnits * (gasPrice.gasPrice || BigInt(0));
302
+ const totalFee = gasPrice.gasPrice
303
+ ? gasPrice.gasPrice * gasUnits
304
+ : (gasPrice.maxFeePerGas || BigInt(0)) * gasUnits;
277
305
  return totalFee;
278
306
  });
279
307
  exports.estimateGas = estimateGas;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ercworldio/blockchain-shared",
3
- "version": "1.0.3-dev.7",
3
+ "version": "1.0.5-dev.0",
4
4
  "description": "Shared library for blockchain projects",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -71,7 +71,7 @@
71
71
  "@solana/buffer-layout-utils": "^0.2.0",
72
72
  "@solana/spl-token": "^0.4.13",
73
73
  "@solana/web3.js": "^1.98.2",
74
- "axios": "^1.4.0",
74
+ "axios": "^1.16.1",
75
75
  "bech32": "^2.0.0",
76
76
  "bip39": "^3.1.0",
77
77
  "borsh": "^2.0.0",
@@ -84,7 +84,7 @@
84
84
  "redis": "^5.8.2",
85
85
  "reflect-metadata": "^0.2.2",
86
86
  "secp256k1": "^5.0.1",
87
- "tronweb": "^6.1.1",
87
+ "tronweb": "^6.3.0",
88
88
  "tweetnacl": "^1.0.3",
89
89
  "typeorm": "^0.3.24",
90
90
  "uuid": "^8.0.0"
@@ -92,6 +92,9 @@
92
92
  "peerDependencies": {
93
93
  "pg": "^8.16.0"
94
94
  },
95
+ "overrides": {
96
+ "axios": "^1.16.1"
97
+ },
95
98
  "devDependencies": {
96
99
  "@types/bech32": "^1.1.2",
97
100
  "@types/bn.js": "^5.2.0",