@socket.tech/dl-common 1.0.10 → 1.0.11

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 (183) hide show
  1. package/dist/dl-common/constants/confirmations.d.ts +5 -0
  2. package/dist/dl-common/constants/confirmations.js +17 -0
  3. package/dist/dl-common/constants/enums.d.ts +44 -0
  4. package/dist/dl-common/constants/enums.js +52 -0
  5. package/dist/dl-common/constants/index.d.ts +3 -0
  6. package/dist/dl-common/constants/index.js +19 -0
  7. package/dist/dl-common/constants/types.d.ts +126 -0
  8. package/dist/dl-common/constants/types.js +45 -0
  9. package/dist/dl-common/constants/waitTime.d.ts +8 -0
  10. package/dist/dl-common/constants/waitTime.js +49 -0
  11. package/dist/dl-common/index.d.ts +4 -0
  12. package/dist/dl-common/index.js +20 -0
  13. package/dist/dl-common/models/attestSignature.d.ts +35 -0
  14. package/dist/dl-common/models/attestSignature.js +53 -0
  15. package/dist/dl-common/models/attestation.d.ts +70 -0
  16. package/dist/dl-common/models/attestation.js +86 -0
  17. package/dist/dl-common/models/index.d.ts +7 -0
  18. package/dist/dl-common/models/index.js +23 -0
  19. package/dist/dl-common/models/lastBlock.d.ts +28 -0
  20. package/dist/dl-common/models/lastBlock.js +27 -0
  21. package/dist/dl-common/models/message.d.ts +166 -0
  22. package/dist/dl-common/models/message.js +183 -0
  23. package/dist/dl-common/models/packet.d.ts +241 -0
  24. package/dist/dl-common/models/packet.js +250 -0
  25. package/dist/dl-common/models/proposal.d.ts +127 -0
  26. package/dist/dl-common/models/proposal.js +141 -0
  27. package/dist/dl-common/models/switchboard.d.ts +69 -0
  28. package/dist/dl-common/models/switchboard.js +92 -0
  29. package/dist/dl-common/models/transaction.d.ts +0 -0
  30. package/dist/dl-common/models/transaction.js +280 -0
  31. package/dist/dl-common/services/cacheService.d.ts +14 -0
  32. package/dist/dl-common/services/cacheService.js +77 -0
  33. package/dist/dl-common/services/eventBridgeService.d.ts +8 -0
  34. package/dist/dl-common/services/eventBridgeService.js +40 -0
  35. package/dist/dl-common/services/index.d.ts +3 -0
  36. package/dist/dl-common/services/index.js +20 -0
  37. package/dist/dl-common/services/queueService.d.ts +10 -0
  38. package/dist/dl-common/services/queueService.js +62 -0
  39. package/dist/dl-common/utils/address.d.ts +2 -0
  40. package/dist/dl-common/utils/address.js +8 -0
  41. package/dist/dl-common/utils/axios.d.ts +2 -0
  42. package/dist/dl-common/utils/axios.js +54 -0
  43. package/dist/dl-common/utils/dataStructHelper.d.ts +2 -0
  44. package/dist/dl-common/utils/dataStructHelper.js +10 -0
  45. package/dist/dl-common/utils/discord.d.ts +2 -0
  46. package/dist/dl-common/utils/discord.js +35 -0
  47. package/dist/dl-common/utils/ethersAwsKmsSigner.d.ts +2 -0
  48. package/dist/dl-common/utils/ethersAwsKmsSigner.js +26 -0
  49. package/dist/dl-common/utils/eventGetter.d.ts +4 -0
  50. package/dist/dl-common/utils/eventGetter.js +50 -0
  51. package/dist/dl-common/utils/extraUtils.d.ts +32 -0
  52. package/dist/dl-common/utils/extraUtils.js +103 -0
  53. package/dist/dl-common/utils/idUtils.d.ts +14 -0
  54. package/dist/dl-common/utils/idUtils.js +50 -0
  55. package/dist/dl-common/utils/index.d.ts +13 -0
  56. package/dist/dl-common/utils/index.js +29 -0
  57. package/dist/dl-common/utils/relaySigner.d.ts +21 -0
  58. package/dist/dl-common/utils/relaySigner.js +68 -0
  59. package/dist/dl-common/utils/s3Service.d.ts +5 -0
  60. package/dist/dl-common/utils/s3Service.js +45 -0
  61. package/dist/dl-common/utils/secretManagerService.d.ts +2 -0
  62. package/dist/dl-common/utils/secretManagerService.js +33 -0
  63. package/dist/dl-common/utils/signer/adapter.d.ts +18 -0
  64. package/dist/dl-common/utils/signer/adapter.js +71 -0
  65. package/dist/dl-common/utils/signer/address.d.ts +10 -0
  66. package/dist/dl-common/utils/signer/address.js +42 -0
  67. package/dist/dl-common/utils/signer/asn1-parser.d.ts +11 -0
  68. package/dist/dl-common/utils/signer/asn1-parser.js +80 -0
  69. package/dist/dl-common/utils/signer/crypto.d.ts +6 -0
  70. package/dist/dl-common/utils/signer/crypto.js +34 -0
  71. package/dist/dl-common/utils/signer/index.d.ts +4 -0
  72. package/dist/dl-common/utils/signer/index.js +20 -0
  73. package/dist/dl-common/utils/signer/kms-ethers-signer.d.ts +19 -0
  74. package/dist/dl-common/utils/signer/kms-ethers-signer.js +32 -0
  75. package/dist/dl-common/utils/signer/kms-signer.d.ts +14 -0
  76. package/dist/dl-common/utils/signer/kms-signer.js +46 -0
  77. package/dist/dl-common/utils/signer/signature.d.ts +17 -0
  78. package/dist/dl-common/utils/signer/signature.js +65 -0
  79. package/dist/dl-common/utils/signer/signer.d.ts +7 -0
  80. package/dist/dl-common/utils/signer/signer.js +2 -0
  81. package/dist/dl-common/utils/time.d.ts +2 -0
  82. package/dist/dl-common/utils/time.js +7 -0
  83. package/dist/src/constants/batcherModes.d.ts +7 -0
  84. package/dist/src/constants/batcherModes.js +56 -0
  85. package/dist/src/constants/config.d.ts +39 -0
  86. package/dist/src/constants/config.js +77 -0
  87. package/dist/src/constants/enums.d.ts +21 -0
  88. package/dist/src/constants/enums.js +27 -0
  89. package/dist/src/constants/gasEstimation.d.ts +8 -0
  90. package/dist/src/constants/gasEstimation.js +61 -0
  91. package/dist/src/constants/index.d.ts +11 -0
  92. package/dist/src/constants/index.js +28 -0
  93. package/dist/src/constants/limits.d.ts +21 -0
  94. package/dist/src/constants/limits.js +91 -0
  95. package/dist/src/constants/prometheus.config.d.ts +43 -0
  96. package/dist/src/constants/prometheus.config.js +316 -0
  97. package/dist/src/constants/relayer.d.ts +6 -0
  98. package/dist/src/constants/relayer.js +15 -0
  99. package/dist/src/constants/s3Config.d.ts +13 -0
  100. package/dist/src/constants/s3Config.js +61 -0
  101. package/dist/src/constants/stageConfig.d.ts +7 -0
  102. package/dist/src/constants/stageConfig.js +24 -0
  103. package/dist/src/constants/types.d.ts +45 -0
  104. package/dist/src/constants/types.js +2 -0
  105. package/dist/src/constants/watchers.d.ts +15 -0
  106. package/dist/src/constants/watchers.js +137 -0
  107. package/dist/src/controllers/index.d.ts +0 -0
  108. package/dist/src/controllers/index.js +3 -0
  109. package/dist/src/db/associations.d.ts +1 -0
  110. package/dist/src/db/associations.js +46 -0
  111. package/dist/src/db/connection.d.ts +4 -0
  112. package/dist/src/db/connection.js +73 -0
  113. package/dist/src/db/index.d.ts +2 -0
  114. package/dist/src/db/index.js +18 -0
  115. package/dist/src/db/init.d.ts +2 -0
  116. package/dist/src/db/init.js +27 -0
  117. package/dist/src/handlers/common.d.ts +2 -0
  118. package/dist/src/handlers/common.js +59 -0
  119. package/dist/src/handlers/cronHandler.d.ts +10 -0
  120. package/dist/src/handlers/cronHandler.js +268 -0
  121. package/dist/src/handlers/executeHandler.d.ts +3 -0
  122. package/dist/src/handlers/executeHandler.js +66 -0
  123. package/dist/src/handlers/handler.d.ts +2 -0
  124. package/dist/src/handlers/handler.js +29 -0
  125. package/dist/src/handlers/proposeHandler.d.ts +3 -0
  126. package/dist/src/handlers/proposeHandler.js +69 -0
  127. package/dist/src/handlers/routes.d.ts +2 -0
  128. package/dist/src/handlers/routes.js +26 -0
  129. package/dist/src/handlers/sealHandler.d.ts +4 -0
  130. package/dist/src/handlers/sealHandler.js +245 -0
  131. package/dist/src/handlers/statusHandler.d.ts +5 -0
  132. package/dist/src/handlers/statusHandler.js +116 -0
  133. package/dist/src/handlers/taskHandler.d.ts +2 -0
  134. package/dist/src/handlers/taskHandler.js +110 -0
  135. package/dist/src/handlers/testHandler.d.ts +4 -0
  136. package/dist/src/handlers/testHandler.js +99 -0
  137. package/dist/src/main.d.ts +0 -0
  138. package/dist/src/main.js +12 -0
  139. package/dist/src/relayers/common.d.ts +7 -0
  140. package/dist/src/relayers/common.js +55 -0
  141. package/dist/src/relayers/index.d.ts +2 -0
  142. package/dist/src/relayers/index.js +19 -0
  143. package/dist/src/relayers/proposeRelayer.d.ts +7 -0
  144. package/dist/src/relayers/proposeRelayer.js +587 -0
  145. package/dist/src/relayers/sealRelayer.d.ts +8 -0
  146. package/dist/src/relayers/sealRelayer.js +276 -0
  147. package/dist/src/services/attestService.d.ts +45 -0
  148. package/dist/src/services/attestService.js +269 -0
  149. package/dist/src/services/batcherService.d.ts +9 -0
  150. package/dist/src/services/batcherService.js +197 -0
  151. package/dist/src/services/executeService.d.ts +16 -0
  152. package/dist/src/services/executeService.js +209 -0
  153. package/dist/src/services/gasEstimationService.d.ts +3 -0
  154. package/dist/src/services/gasEstimationService.js +12 -0
  155. package/dist/src/services/index.d.ts +4 -0
  156. package/dist/src/services/index.js +23 -0
  157. package/dist/src/services/indexSealService.d.ts +15 -0
  158. package/dist/src/services/indexSealService.js +120 -0
  159. package/dist/src/services/proposalCheckService.d.ts +9 -0
  160. package/dist/src/services/proposalCheckService.js +119 -0
  161. package/dist/src/services/sealService.d.ts +27 -0
  162. package/dist/src/services/sealService.js +190 -0
  163. package/dist/src/statusTrackers/failedMessage.d.ts +8 -0
  164. package/dist/src/statusTrackers/failedMessage.js +72 -0
  165. package/dist/src/statusTrackers/failedPacket.d.ts +13 -0
  166. package/dist/src/statusTrackers/failedPacket.js +110 -0
  167. package/dist/src/statusTrackers/index.d.ts +3 -0
  168. package/dist/src/statusTrackers/index.js +26 -0
  169. package/dist/src/statusTrackers/message.d.ts +4 -0
  170. package/dist/src/statusTrackers/message.js +257 -0
  171. package/dist/src/statusTrackers/packet.d.ts +33 -0
  172. package/dist/src/statusTrackers/packet.js +477 -0
  173. package/dist/src/utils/chain-utils.d.ts +5 -0
  174. package/dist/src/utils/chain-utils.js +42 -0
  175. package/dist/src/utils/index.d.ts +2 -0
  176. package/dist/src/utils/index.js +18 -0
  177. package/dist/src/utils/logger.d.ts +9 -0
  178. package/dist/src/utils/logger.js +9 -0
  179. package/dist/utils/signer/socketSigner.d.ts +35 -0
  180. package/dist/utils/signer/socketSigner.js +146 -0
  181. package/package.json +1 -1
  182. package/dist/utils/test.d.ts +0 -1
  183. package/dist/utils/test.js +0 -10
@@ -0,0 +1,5 @@
1
+ import { ChainSlug } from "@socket.tech/dl-core";
2
+ export declare const getConfirmations: (chainSlug: ChainSlug) => number;
3
+ export declare const Confirmations: {
4
+ [chain: number]: number;
5
+ };
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Confirmations = exports.getConfirmations = void 0;
4
+ const dl_core_1 = require("@socket.tech/dl-core");
5
+ const getConfirmations = (chainSlug) => {
6
+ if (dl_core_1.TestnetIds.includes(chainSlug)) {
7
+ return 1;
8
+ }
9
+ return exports.Confirmations[chainSlug];
10
+ };
11
+ exports.getConfirmations = getConfirmations;
12
+ exports.Confirmations = {
13
+ [dl_core_1.ChainSlug.MAINNET]: 12,
14
+ [dl_core_1.ChainSlug.ARBITRUM]: 1,
15
+ [dl_core_1.ChainSlug.OPTIMISM]: 18,
16
+ [dl_core_1.ChainSlug.AEVO]: 18,
17
+ };
@@ -0,0 +1,44 @@
1
+ export declare enum tableNames {
2
+ packet = "packets",
3
+ signature = "signatures",
4
+ attestation = "attestations",
5
+ message = "messages",
6
+ nativePacket = "native_packets",
7
+ proposal = "proposals",
8
+ switchboard = "switchboards",
9
+ tripState = "trip_states",
10
+ attestSignatures = "attest_signatures",
11
+ lastBlock = "last_blocks"
12
+ }
13
+ export declare enum MessageStatuses {
14
+ RECEIVED = "RECEIVED",
15
+ SEALED = "SEALED",
16
+ PROPOSED = "PROPOSED",
17
+ CONFIRMED = "CONFIRMED",
18
+ EXECUTION_SUCCESS = "EXECUTION_SUCCESS",
19
+ EXECUTION_FAILURE = "EXECUTION_FAILURE",
20
+ VERIFIED = "VERIFIED",
21
+ ATTESTED = "ATTESTED",
22
+ EXECUTING = "EXECUTING",
23
+ INBOUND_REVERTING = "INBOUND_REVERTING"
24
+ }
25
+ export declare enum MessageStatusStep {
26
+ RECEIVED = 0,
27
+ SEALED = 1,
28
+ PROPOSED = 2,
29
+ CONFIRMED = 3,
30
+ EXECUTION_SUCCESS = 4,
31
+ EXECUTION_FAILURE = 5
32
+ }
33
+ export declare enum StatusCodes {
34
+ SUCCESS = "SUCCESS",
35
+ NOT_FOUND = "NOT_FOUND",
36
+ BAD_REQUEST = "BAD_REQUEST",
37
+ UNAUTHORIZED = "UNAUTHORIZED",
38
+ INTERNAL_SERVER_ERROR = "INTERNAL_SERVER_ERROR",
39
+ RATE_LIMIT_EXCEEDED = "RATE_LIMIT_EXCEEDED"
40
+ }
41
+ export declare enum Accounts {
42
+ dl = "dl",
43
+ ll = "ll"
44
+ }
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Accounts = exports.StatusCodes = exports.MessageStatusStep = exports.MessageStatuses = exports.tableNames = void 0;
4
+ var tableNames;
5
+ (function (tableNames) {
6
+ tableNames["packet"] = "packets";
7
+ tableNames["signature"] = "signatures";
8
+ tableNames["attestation"] = "attestations";
9
+ tableNames["message"] = "messages";
10
+ tableNames["nativePacket"] = "native_packets";
11
+ tableNames["proposal"] = "proposals";
12
+ tableNames["switchboard"] = "switchboards";
13
+ tableNames["tripState"] = "trip_states";
14
+ tableNames["attestSignatures"] = "attest_signatures";
15
+ tableNames["lastBlock"] = "last_blocks";
16
+ })(tableNames || (exports.tableNames = tableNames = {}));
17
+ var MessageStatuses;
18
+ (function (MessageStatuses) {
19
+ MessageStatuses["RECEIVED"] = "RECEIVED";
20
+ MessageStatuses["SEALED"] = "SEALED";
21
+ MessageStatuses["PROPOSED"] = "PROPOSED";
22
+ MessageStatuses["CONFIRMED"] = "CONFIRMED";
23
+ MessageStatuses["EXECUTION_SUCCESS"] = "EXECUTION_SUCCESS";
24
+ MessageStatuses["EXECUTION_FAILURE"] = "EXECUTION_FAILURE";
25
+ MessageStatuses["VERIFIED"] = "VERIFIED";
26
+ MessageStatuses["ATTESTED"] = "ATTESTED";
27
+ MessageStatuses["EXECUTING"] = "EXECUTING";
28
+ MessageStatuses["INBOUND_REVERTING"] = "INBOUND_REVERTING";
29
+ })(MessageStatuses || (exports.MessageStatuses = MessageStatuses = {}));
30
+ var MessageStatusStep;
31
+ (function (MessageStatusStep) {
32
+ MessageStatusStep[MessageStatusStep["RECEIVED"] = 0] = "RECEIVED";
33
+ MessageStatusStep[MessageStatusStep["SEALED"] = 1] = "SEALED";
34
+ MessageStatusStep[MessageStatusStep["PROPOSED"] = 2] = "PROPOSED";
35
+ MessageStatusStep[MessageStatusStep["CONFIRMED"] = 3] = "CONFIRMED";
36
+ MessageStatusStep[MessageStatusStep["EXECUTION_SUCCESS"] = 4] = "EXECUTION_SUCCESS";
37
+ MessageStatusStep[MessageStatusStep["EXECUTION_FAILURE"] = 5] = "EXECUTION_FAILURE";
38
+ })(MessageStatusStep || (exports.MessageStatusStep = MessageStatusStep = {}));
39
+ var StatusCodes;
40
+ (function (StatusCodes) {
41
+ StatusCodes["SUCCESS"] = "SUCCESS";
42
+ StatusCodes["NOT_FOUND"] = "NOT_FOUND";
43
+ StatusCodes["BAD_REQUEST"] = "BAD_REQUEST";
44
+ StatusCodes["UNAUTHORIZED"] = "UNAUTHORIZED";
45
+ StatusCodes["INTERNAL_SERVER_ERROR"] = "INTERNAL_SERVER_ERROR";
46
+ StatusCodes["RATE_LIMIT_EXCEEDED"] = "RATE_LIMIT_EXCEEDED";
47
+ })(StatusCodes || (exports.StatusCodes = StatusCodes = {}));
48
+ var Accounts;
49
+ (function (Accounts) {
50
+ Accounts["dl"] = "dl";
51
+ Accounts["ll"] = "ll";
52
+ })(Accounts || (exports.Accounts = Accounts = {}));
@@ -0,0 +1,3 @@
1
+ export * from "./waitTime";
2
+ export * from "./enums";
3
+ export * from "./types";
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./waitTime"), exports);
18
+ __exportStar(require("./enums"), exports);
19
+ __exportStar(require("./types"), exports);
@@ -0,0 +1,126 @@
1
+ import { TripReason } from "../models";
2
+ import { StatusCodes } from "./enums";
3
+ import { IntegrationTypes } from "@socket.tech/dl-core";
4
+ export type Speed = "safeLow" | "average" | "fast" | "fastest";
5
+ export declare enum InboundStatus {
6
+ NOT_TRIED = "NOT_TRIED",
7
+ REVERTING = "REVERTING",
8
+ EXECUTING = "EXECUTING",
9
+ SUCCESS = "SUCCESS"
10
+ }
11
+ export interface FeeEstimate {
12
+ transmissionFees: string;
13
+ verificationFees: string;
14
+ executionFees: string;
15
+ totalFees: string;
16
+ }
17
+ export declare enum RelayerAPIStatus {
18
+ FAILED = "FAILED",
19
+ SIMULATION_FAILED = "SIMULATION_FAILED",
20
+ COMPLETED = "COMPLETED",
21
+ DUPLICATE_NONCE_TX = "DUPLICATE_NONCE_TX"
22
+ }
23
+ export declare const ErrorReasons: {
24
+ ZERO_AMOUNT: string;
25
+ PRE_EXEC_VALIDATION_ERROR: string;
26
+ WRONG_PLUG_CONNECTION: string;
27
+ INBOUND_FAILURE: string;
28
+ LOW_GAS_LIMIT: string;
29
+ };
30
+ export declare class ServerError {
31
+ code: Omit<StatusCodes, StatusCodes.SUCCESS>;
32
+ message?: string;
33
+ constructor(code: Omit<StatusCodes, StatusCodes.SUCCESS>, message?: string);
34
+ toString(): string;
35
+ }
36
+ export declare const BadRequestError: (message?: string) => ServerError;
37
+ export declare const InternalServerError: (message?: string) => ServerError;
38
+ export interface EthersError {
39
+ reason?: string;
40
+ code?: string;
41
+ argument?: string;
42
+ value?: string;
43
+ }
44
+ export type SealParams = {
45
+ srcChainSlug: number;
46
+ dstChainSlug: number;
47
+ dstSwitchboard: string;
48
+ srcSwitchboard: string;
49
+ integrationType: IntegrationTypes;
50
+ message: {
51
+ messageId: string;
52
+ srcPlug: string;
53
+ destPlug: string;
54
+ minMsgGasLimit: string;
55
+ executionParams: string;
56
+ transmissionParams: string;
57
+ executionFee: string;
58
+ transmissionFees: string;
59
+ switchboardFees: string;
60
+ fees: string;
61
+ decapacitorProof: string;
62
+ payload: string;
63
+ packedMessage: string;
64
+ outboundTxHash: string;
65
+ outboundTime: number;
66
+ capacitorMsgCount: string;
67
+ };
68
+ packet: {
69
+ capacitorPacketCount: string;
70
+ packetId: string;
71
+ srcCapacitor: string;
72
+ root: string;
73
+ sealSignature: string;
74
+ };
75
+ };
76
+ export type SealIndexedParams = {
77
+ srcChainSlug: number;
78
+ sealer: string;
79
+ sealTime: number;
80
+ sealTxHash: string;
81
+ rootSealed: string;
82
+ dstSwitchboard: string;
83
+ sealSignature: string;
84
+ packetId: string;
85
+ };
86
+ export interface ExecuteSigResponse {
87
+ messageId: string;
88
+ retry: boolean;
89
+ inboundSuccess: boolean;
90
+ inboundRevertString: string;
91
+ executeSignature: string;
92
+ executeMsgGasLimit: string;
93
+ }
94
+ export interface AttestRequest {
95
+ switchboardAddress: string;
96
+ dstChainSlug: number;
97
+ packetId: string;
98
+ root: string;
99
+ proposalCount: number;
100
+ }
101
+ export interface AttestSuccess {
102
+ proposalValid: true;
103
+ packetId: string;
104
+ proposalCount: number;
105
+ signature: string;
106
+ digest: string;
107
+ signerAddress: string;
108
+ }
109
+ export interface AttestFailure {
110
+ proposalValid: false;
111
+ packetId: string;
112
+ proposalCount: number;
113
+ reason: TripReason;
114
+ }
115
+ export type AttestResponse = AttestSuccess | AttestFailure;
116
+ export type MessageData = {
117
+ messageId: string;
118
+ destPlug: string;
119
+ srcPlug: string;
120
+ dstChainSlug: number;
121
+ srcChainSlug: number;
122
+ payload: string;
123
+ minMsgGasLimit: string;
124
+ executionParams: string;
125
+ packedMessage: string;
126
+ };
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InternalServerError = exports.BadRequestError = exports.ServerError = exports.ErrorReasons = exports.RelayerAPIStatus = exports.InboundStatus = void 0;
4
+ const enums_1 = require("./enums");
5
+ var InboundStatus;
6
+ (function (InboundStatus) {
7
+ InboundStatus["NOT_TRIED"] = "NOT_TRIED";
8
+ InboundStatus["REVERTING"] = "REVERTING";
9
+ InboundStatus["EXECUTING"] = "EXECUTING";
10
+ InboundStatus["SUCCESS"] = "SUCCESS";
11
+ })(InboundStatus || (exports.InboundStatus = InboundStatus = {}));
12
+ var RelayerAPIStatus;
13
+ (function (RelayerAPIStatus) {
14
+ RelayerAPIStatus["FAILED"] = "FAILED";
15
+ RelayerAPIStatus["SIMULATION_FAILED"] = "SIMULATION_FAILED";
16
+ RelayerAPIStatus["COMPLETED"] = "COMPLETED";
17
+ RelayerAPIStatus["DUPLICATE_NONCE_TX"] = "DUPLICATE_NONCE_TX";
18
+ })(RelayerAPIStatus || (exports.RelayerAPIStatus = RelayerAPIStatus = {}));
19
+ exports.ErrorReasons = {
20
+ ZERO_AMOUNT: "ZERO_AMOUNT",
21
+ PRE_EXEC_VALIDATION_ERROR: "PRE_EXEC_VALIDATION_ERROR",
22
+ WRONG_PLUG_CONNECTION: "WRONG_PLUG_CONNECTION",
23
+ INBOUND_FAILURE: "INBOUND_FAILURE",
24
+ LOW_GAS_LIMIT: "LOW_GAS_LIMIT",
25
+ };
26
+ class ServerError {
27
+ constructor(code, message) {
28
+ this.code = code;
29
+ if (message) {
30
+ this.message = message;
31
+ }
32
+ }
33
+ toString() {
34
+ return `code: ${this.code}, message: ${this.message}`;
35
+ }
36
+ }
37
+ exports.ServerError = ServerError;
38
+ const BadRequestError = (message) => {
39
+ return new ServerError(enums_1.StatusCodes.BAD_REQUEST, message);
40
+ };
41
+ exports.BadRequestError = BadRequestError;
42
+ const InternalServerError = (message) => {
43
+ return new ServerError(enums_1.StatusCodes.INTERNAL_SERVER_ERROR, message);
44
+ };
45
+ exports.InternalServerError = InternalServerError;
@@ -0,0 +1,8 @@
1
+ import { ChainSlug, IntegrationTypes } from "@socket.tech/dl-core";
2
+ export declare const getWaitTime: (integrationType: IntegrationTypes, srcChainSlug: ChainSlug, dstChainSlug: ChainSlug) => number;
3
+ export declare const getNativeWaitTime: (srcChainSlug: ChainSlug, dstChainSlug: ChainSlug) => number;
4
+ export declare const NativeWaitTime: {
5
+ [srcChain in ChainSlug]?: {
6
+ [dstChain in ChainSlug]?: number;
7
+ };
8
+ };
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NativeWaitTime = exports.getNativeWaitTime = exports.getWaitTime = void 0;
4
+ const dl_core_1 = require("@socket.tech/dl-core");
5
+ const getWaitTime = (integrationType, srcChainSlug, dstChainSlug) => {
6
+ switch (integrationType) {
7
+ case dl_core_1.IntegrationTypes.fast:
8
+ return 0;
9
+ case dl_core_1.IntegrationTypes.fast2:
10
+ return 0;
11
+ case dl_core_1.IntegrationTypes.optimistic:
12
+ return 2 * 3600;
13
+ case dl_core_1.IntegrationTypes.native:
14
+ return (0, exports.getNativeWaitTime)(srcChainSlug, dstChainSlug);
15
+ default:
16
+ return 0;
17
+ }
18
+ };
19
+ exports.getWaitTime = getWaitTime;
20
+ const getNativeWaitTime = (srcChainSlug, dstChainSlug) => {
21
+ var _a, _b;
22
+ return (_b = (_a = exports.NativeWaitTime[srcChainSlug]) === null || _a === void 0 ? void 0 : _a[dstChainSlug]) !== null && _b !== void 0 ? _b : 0;
23
+ };
24
+ exports.getNativeWaitTime = getNativeWaitTime;
25
+ exports.NativeWaitTime = {
26
+ [dl_core_1.ChainSlug.OPTIMISM_GOERLI]: {
27
+ [dl_core_1.ChainSlug.GOERLI]: 5 * 60,
28
+ },
29
+ [dl_core_1.ChainSlug.ARBITRUM_GOERLI]: {
30
+ [dl_core_1.ChainSlug.GOERLI]: 5 * 60,
31
+ },
32
+ [dl_core_1.ChainSlug.POLYGON_MUMBAI]: {
33
+ [dl_core_1.ChainSlug.GOERLI]: 10 * 60,
34
+ },
35
+ [dl_core_1.ChainSlug.GOERLI]: {
36
+ [dl_core_1.ChainSlug.POLYGON_MUMBAI]: 5 * 60,
37
+ [dl_core_1.ChainSlug.ARBITRUM_GOERLI]: 5 * 60,
38
+ [dl_core_1.ChainSlug.OPTIMISM_GOERLI]: 5 * 60,
39
+ },
40
+ [dl_core_1.ChainSlug.ARBITRUM]: {
41
+ [dl_core_1.ChainSlug.MAINNET]: 7 * 24 * 3600,
42
+ },
43
+ [dl_core_1.ChainSlug.OPTIMISM]: {
44
+ [dl_core_1.ChainSlug.MAINNET]: 7 * 24 * 3600,
45
+ },
46
+ [dl_core_1.ChainSlug.POLYGON_MAINNET]: {
47
+ [dl_core_1.ChainSlug.MAINNET]: 4 * 3600,
48
+ },
49
+ };
@@ -0,0 +1,4 @@
1
+ export * from "./models";
2
+ export * from "./services";
3
+ export * from "./utils";
4
+ export * from "./constants";
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./models"), exports);
18
+ __exportStar(require("./services"), exports);
19
+ __exportStar(require("./utils"), exports);
20
+ __exportStar(require("./constants"), exports);
@@ -0,0 +1,35 @@
1
+ import { DataTypes, Model } from "sequelize";
2
+ export declare class AttestSignature extends Model {
3
+ id: number;
4
+ packetId: string;
5
+ proposalCount: number;
6
+ root: string;
7
+ signature: string;
8
+ watcherId: string;
9
+ }
10
+ export declare const AttestSignatureModel: {
11
+ id: {
12
+ type: DataTypes.IntegerDataTypeConstructor;
13
+ autoIncrement: boolean;
14
+ primaryKey: boolean;
15
+ };
16
+ packetId: {
17
+ type: DataTypes.StringDataTypeConstructor;
18
+ unique: string;
19
+ };
20
+ proposalCount: {
21
+ type: DataTypes.IntegerDataTypeConstructor;
22
+ unique: string;
23
+ };
24
+ watcherId: {
25
+ type: DataTypes.StringDataTypeConstructor;
26
+ unique: string;
27
+ };
28
+ root: {
29
+ type: DataTypes.StringDataTypeConstructor;
30
+ };
31
+ signature: {
32
+ type: DataTypes.StringDataTypeConstructor;
33
+ };
34
+ };
35
+ export declare const addSignatureHooks: () => void;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addSignatureHooks = exports.AttestSignatureModel = exports.AttestSignature = void 0;
4
+ const sequelize_1 = require("sequelize");
5
+ const utils_1 = require("../utils");
6
+ class AttestSignature extends sequelize_1.Model {
7
+ }
8
+ exports.AttestSignature = AttestSignature;
9
+ exports.AttestSignatureModel = {
10
+ id: {
11
+ type: sequelize_1.DataTypes.INTEGER,
12
+ autoIncrement: true,
13
+ primaryKey: true,
14
+ },
15
+ packetId: {
16
+ type: sequelize_1.DataTypes.STRING,
17
+ unique: "uniqueAttestSignPointer",
18
+ },
19
+ proposalCount: {
20
+ type: sequelize_1.DataTypes.INTEGER,
21
+ unique: "uniqueAttestSignPointer",
22
+ },
23
+ watcherId: {
24
+ type: sequelize_1.DataTypes.STRING,
25
+ unique: "uniqueAttestSignPointer",
26
+ },
27
+ root: {
28
+ type: sequelize_1.DataTypes.STRING,
29
+ },
30
+ signature: {
31
+ type: sequelize_1.DataTypes.STRING,
32
+ },
33
+ };
34
+ function processStrings(attestSignature) {
35
+ if (attestSignature.packetId) {
36
+ attestSignature.packetId = (0, utils_1.toLowerCase)(attestSignature.packetId);
37
+ }
38
+ if (attestSignature.signature) {
39
+ attestSignature.signature = (0, utils_1.toLowerCase)(attestSignature.signature);
40
+ }
41
+ return attestSignature;
42
+ }
43
+ const addSignatureHooks = () => {
44
+ AttestSignature.beforeBulkCreate((attestSignature, options) => {
45
+ for (let index = 0; index < attestSignature.length; index++) {
46
+ attestSignature[index] = processStrings(attestSignature[index]);
47
+ }
48
+ });
49
+ AttestSignature.beforeSave((attestSignature, options) => {
50
+ attestSignature = processStrings(attestSignature);
51
+ });
52
+ };
53
+ exports.addSignatureHooks = addSignatureHooks;
@@ -0,0 +1,70 @@
1
+ import { IntegrationTypes } from "@socket.tech/dl-core";
2
+ import { DataTypes, Model } from "sequelize";
3
+ export declare class Attestation extends Model {
4
+ id: number;
5
+ packetId: string;
6
+ proposalCount: number;
7
+ root: string;
8
+ switchboard: string;
9
+ integrationType: IntegrationTypes;
10
+ srcChainSlug: number;
11
+ dstChainSlug: number;
12
+ attester: string;
13
+ attestTxId: string;
14
+ attestTxHash: string;
15
+ attestTime: number;
16
+ numberOfAttestations: number;
17
+ }
18
+ export declare const AttestationModel: {
19
+ id: {
20
+ type: DataTypes.IntegerDataTypeConstructor;
21
+ autoIncrement: boolean;
22
+ primaryKey: boolean;
23
+ };
24
+ packetId: {
25
+ type: DataTypes.StringDataTypeConstructor;
26
+ unique: string;
27
+ };
28
+ proposalCount: {
29
+ type: DataTypes.IntegerDataTypeConstructor;
30
+ unique: string;
31
+ };
32
+ switchboard: {
33
+ type: DataTypes.StringDataTypeConstructor;
34
+ };
35
+ srcChainSlug: {
36
+ type: DataTypes.BigIntDataTypeConstructor;
37
+ };
38
+ dstChainSlug: {
39
+ type: DataTypes.BigIntDataTypeConstructor;
40
+ };
41
+ integrationType: {
42
+ type: DataTypes.StringDataTypeConstructor;
43
+ };
44
+ root: {
45
+ type: DataTypes.StringDataTypeConstructor;
46
+ unique: string;
47
+ };
48
+ attester: {
49
+ type: DataTypes.StringDataTypeConstructor;
50
+ defaultValue: string;
51
+ unique: string;
52
+ };
53
+ attestTxId: {
54
+ type: DataTypes.StringDataTypeConstructor;
55
+ defaultValue: string;
56
+ };
57
+ attestTxHash: {
58
+ type: DataTypes.StringDataTypeConstructor;
59
+ defaultValue: string;
60
+ };
61
+ attestTime: {
62
+ type: DataTypes.IntegerDataTypeConstructor;
63
+ defaultValue: number;
64
+ };
65
+ numberOfAttestations: {
66
+ type: DataTypes.IntegerDataTypeConstructor;
67
+ defaultValue: number;
68
+ };
69
+ };
70
+ export declare const addAttestationHooks: () => void;
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addAttestationHooks = exports.AttestationModel = exports.Attestation = void 0;
4
+ const sequelize_1 = require("sequelize");
5
+ const utils_1 = require("../utils");
6
+ class Attestation extends sequelize_1.Model {
7
+ }
8
+ exports.Attestation = Attestation;
9
+ exports.AttestationModel = {
10
+ id: {
11
+ type: sequelize_1.DataTypes.INTEGER,
12
+ autoIncrement: true,
13
+ primaryKey: true,
14
+ },
15
+ packetId: {
16
+ type: sequelize_1.DataTypes.STRING,
17
+ unique: "uniqueAttestationPointer",
18
+ },
19
+ proposalCount: {
20
+ type: sequelize_1.DataTypes.INTEGER,
21
+ unique: "uniqueAttestationPointer",
22
+ },
23
+ switchboard: {
24
+ type: sequelize_1.DataTypes.STRING,
25
+ },
26
+ srcChainSlug: {
27
+ type: sequelize_1.DataTypes.BIGINT,
28
+ },
29
+ dstChainSlug: {
30
+ type: sequelize_1.DataTypes.BIGINT,
31
+ },
32
+ integrationType: {
33
+ type: sequelize_1.DataTypes.STRING,
34
+ },
35
+ root: {
36
+ type: sequelize_1.DataTypes.STRING,
37
+ unique: "uniqueAttestationPointer",
38
+ },
39
+ attester: {
40
+ type: sequelize_1.DataTypes.STRING,
41
+ defaultValue: "",
42
+ unique: "uniqueAttestationPointer",
43
+ },
44
+ attestTxId: {
45
+ type: sequelize_1.DataTypes.STRING,
46
+ defaultValue: "",
47
+ },
48
+ attestTxHash: {
49
+ type: sequelize_1.DataTypes.STRING,
50
+ defaultValue: "",
51
+ },
52
+ attestTime: {
53
+ type: sequelize_1.DataTypes.INTEGER,
54
+ defaultValue: 0,
55
+ },
56
+ numberOfAttestations: {
57
+ type: sequelize_1.DataTypes.INTEGER,
58
+ defaultValue: 0,
59
+ },
60
+ };
61
+ const addAttestationHooks = () => {
62
+ Attestation.beforeBulkCreate((packet, options) => {
63
+ for (let index = 0; index < packet.length; index++) {
64
+ packet[index] = processStrings(packet[index]);
65
+ }
66
+ });
67
+ Attestation.beforeSave((packet, options) => {
68
+ packet = processStrings(packet);
69
+ });
70
+ };
71
+ exports.addAttestationHooks = addAttestationHooks;
72
+ function processStrings(packet) {
73
+ if (packet.packetId)
74
+ packet.packetId = (0, utils_1.toLowerCase)(packet.packetId);
75
+ if (packet.root)
76
+ packet.root = (0, utils_1.toLowerCase)(packet.root);
77
+ if (packet.switchboard)
78
+ packet.switchboard = (0, utils_1.toLowerCase)(packet.switchboard);
79
+ if (packet.attester)
80
+ packet.attester = (0, utils_1.toLowerCase)(packet.attester);
81
+ if (packet.attestTxId)
82
+ packet.attestTxId = (0, utils_1.toLowerCase)(packet.attestTxId);
83
+ if (packet.attestTxHash)
84
+ packet.attestTxHash = (0, utils_1.toLowerCase)(packet.attestTxHash);
85
+ return packet;
86
+ }
@@ -0,0 +1,7 @@
1
+ export * from "./packet";
2
+ export * from "./message";
3
+ export * from "./attestSignature";
4
+ export * from "./attestation";
5
+ export * from "./proposal";
6
+ export * from "./switchboard";
7
+ export * from "./lastBlock";