@socket.tech/dl-common 1.0.13 → 1.0.15
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/package.json +3 -3
- package/dist/constants/confirmations.d.ts +0 -5
- package/dist/constants/confirmations.js +0 -17
- package/dist/constants/enums.d.ts +0 -38
- package/dist/constants/enums.js +0 -45
- package/dist/constants/index.d.ts +0 -3
- package/dist/constants/index.js +0 -19
- package/dist/constants/types.d.ts +0 -126
- package/dist/constants/types.js +0 -45
- package/dist/constants/waitTime.d.ts +0 -8
- package/dist/constants/waitTime.js +0 -49
- package/dist/index.d.ts +0 -4
- package/dist/index.js +0 -36
- package/dist/models/attestSignature.d.ts +0 -35
- package/dist/models/attestSignature.js +0 -53
- package/dist/models/attestation.d.ts +0 -70
- package/dist/models/attestation.js +0 -86
- package/dist/models/index.d.ts +0 -6
- package/dist/models/index.js +0 -22
- package/dist/models/message.d.ts +0 -166
- package/dist/models/message.js +0 -183
- package/dist/models/packet.d.ts +0 -241
- package/dist/models/packet.js +0 -250
- package/dist/models/proposal.d.ts +0 -127
- package/dist/models/proposal.js +0 -141
- package/dist/models/switchboard.d.ts +0 -69
- package/dist/models/switchboard.js +0 -92
- package/dist/services/cacheService.d.ts +0 -14
- package/dist/services/cacheService.js +0 -77
- package/dist/services/eventBridgeService.d.ts +0 -8
- package/dist/services/eventBridgeService.js +0 -39
- package/dist/services/index.d.ts +0 -3
- package/dist/services/index.js +0 -20
- package/dist/services/queueService.d.ts +0 -10
- package/dist/services/queueService.js +0 -54
- package/dist/utils/address.d.ts +0 -2
- package/dist/utils/address.js +0 -8
- package/dist/utils/axios.d.ts +0 -2
- package/dist/utils/axios.js +0 -54
- package/dist/utils/dataStructHelper.d.ts +0 -2
- package/dist/utils/dataStructHelper.js +0 -10
- package/dist/utils/discord.d.ts +0 -2
- package/dist/utils/discord.js +0 -35
- package/dist/utils/ethersAwsKmsSigner.d.ts +0 -2
- package/dist/utils/ethersAwsKmsSigner.js +0 -26
- package/dist/utils/eventGetter.d.ts +0 -4
- package/dist/utils/eventGetter.js +0 -50
- package/dist/utils/extraUtils.d.ts +0 -32
- package/dist/utils/extraUtils.js +0 -103
- package/dist/utils/idUtils.d.ts +0 -14
- package/dist/utils/idUtils.js +0 -50
- package/dist/utils/index.d.ts +0 -13
- package/dist/utils/index.js +0 -29
- package/dist/utils/relaySigner.d.ts +0 -21
- package/dist/utils/relaySigner.js +0 -68
- package/dist/utils/s3Service.d.ts +0 -4
- package/dist/utils/s3Service.js +0 -41
- package/dist/utils/secretManagerService.d.ts +0 -2
- package/dist/utils/secretManagerService.js +0 -33
- package/dist/utils/signer/adapter.d.ts +0 -18
- package/dist/utils/signer/adapter.js +0 -71
- package/dist/utils/signer/address.d.ts +0 -10
- package/dist/utils/signer/address.js +0 -42
- package/dist/utils/signer/asn1-parser.d.ts +0 -11
- package/dist/utils/signer/asn1-parser.js +0 -80
- package/dist/utils/signer/crypto.d.ts +0 -6
- package/dist/utils/signer/crypto.js +0 -34
- package/dist/utils/signer/index.d.ts +0 -4
- package/dist/utils/signer/index.js +0 -20
- package/dist/utils/signer/kms-ethers-signer.d.ts +0 -19
- package/dist/utils/signer/kms-ethers-signer.js +0 -32
- package/dist/utils/signer/kms-signer.d.ts +0 -14
- package/dist/utils/signer/kms-signer.js +0 -46
- package/dist/utils/signer/signature.d.ts +0 -17
- package/dist/utils/signer/signature.js +0 -65
- package/dist/utils/signer/signer.d.ts +0 -7
- package/dist/utils/signer/signer.js +0 -2
- package/dist/utils/time.d.ts +0 -2
- package/dist/utils/time.js +0 -7
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@socket.tech/dl-common",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"main": "./dist/index.js",
|
|
5
|
-
"types": "./dist/index.d.ts",
|
|
3
|
+
"version": "1.0.15",
|
|
4
|
+
"main": "./dist/dl-common/index.js",
|
|
5
|
+
"types": "./dist/dl-common/index.d.ts",
|
|
6
6
|
"description": "common utilities for socket data layer.",
|
|
7
7
|
"author": "akash <akash.minato@gmail.com>",
|
|
8
8
|
"files": [
|
|
@@ -1,17 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
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
|
-
}
|
|
12
|
-
export declare enum MessageStatuses {
|
|
13
|
-
RECEIVED = "RECEIVED",
|
|
14
|
-
SEALED = "SEALED",
|
|
15
|
-
PROPOSED = "PROPOSED",
|
|
16
|
-
CONFIRMED = "CONFIRMED",
|
|
17
|
-
EXECUTION_SUCCESS = "EXECUTION_SUCCESS",
|
|
18
|
-
EXECUTION_FAILURE = "EXECUTION_FAILURE",
|
|
19
|
-
VERIFIED = "VERIFIED",
|
|
20
|
-
ATTESTED = "ATTESTED",
|
|
21
|
-
EXECUTING = "EXECUTING",
|
|
22
|
-
INBOUND_REVERTING = "INBOUND_REVERTING"
|
|
23
|
-
}
|
|
24
|
-
export declare enum MessageStatusStep {
|
|
25
|
-
RECEIVED = 0,
|
|
26
|
-
SEALED = 1,
|
|
27
|
-
PROPOSED = 2,
|
|
28
|
-
CONFIRMED = 3,
|
|
29
|
-
EXECUTION_SUCCESS = 4,
|
|
30
|
-
EXECUTION_FAILURE = 5
|
|
31
|
-
}
|
|
32
|
-
export declare enum StatusCodes {
|
|
33
|
-
SUCCESS = "SUCCESS",
|
|
34
|
-
NOT_FOUND = "NOT_FOUND",
|
|
35
|
-
BAD_REQUEST = "BAD_REQUEST",
|
|
36
|
-
UNAUTHORIZED = "UNAUTHORIZED",
|
|
37
|
-
INTERNAL_SERVER_ERROR = "INTERNAL_SERVER_ERROR"
|
|
38
|
-
}
|
package/dist/constants/enums.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
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 || (exports.tableNames = tableNames = {}));
|
|
16
|
-
var MessageStatuses;
|
|
17
|
-
(function (MessageStatuses) {
|
|
18
|
-
MessageStatuses["RECEIVED"] = "RECEIVED";
|
|
19
|
-
MessageStatuses["SEALED"] = "SEALED";
|
|
20
|
-
MessageStatuses["PROPOSED"] = "PROPOSED";
|
|
21
|
-
MessageStatuses["CONFIRMED"] = "CONFIRMED";
|
|
22
|
-
MessageStatuses["EXECUTION_SUCCESS"] = "EXECUTION_SUCCESS";
|
|
23
|
-
MessageStatuses["EXECUTION_FAILURE"] = "EXECUTION_FAILURE";
|
|
24
|
-
MessageStatuses["VERIFIED"] = "VERIFIED";
|
|
25
|
-
MessageStatuses["ATTESTED"] = "ATTESTED";
|
|
26
|
-
MessageStatuses["EXECUTING"] = "EXECUTING";
|
|
27
|
-
MessageStatuses["INBOUND_REVERTING"] = "INBOUND_REVERTING";
|
|
28
|
-
})(MessageStatuses || (exports.MessageStatuses = MessageStatuses = {}));
|
|
29
|
-
var MessageStatusStep;
|
|
30
|
-
(function (MessageStatusStep) {
|
|
31
|
-
MessageStatusStep[MessageStatusStep["RECEIVED"] = 0] = "RECEIVED";
|
|
32
|
-
MessageStatusStep[MessageStatusStep["SEALED"] = 1] = "SEALED";
|
|
33
|
-
MessageStatusStep[MessageStatusStep["PROPOSED"] = 2] = "PROPOSED";
|
|
34
|
-
MessageStatusStep[MessageStatusStep["CONFIRMED"] = 3] = "CONFIRMED";
|
|
35
|
-
MessageStatusStep[MessageStatusStep["EXECUTION_SUCCESS"] = 4] = "EXECUTION_SUCCESS";
|
|
36
|
-
MessageStatusStep[MessageStatusStep["EXECUTION_FAILURE"] = 5] = "EXECUTION_FAILURE";
|
|
37
|
-
})(MessageStatusStep || (exports.MessageStatusStep = MessageStatusStep = {}));
|
|
38
|
-
var StatusCodes;
|
|
39
|
-
(function (StatusCodes) {
|
|
40
|
-
StatusCodes["SUCCESS"] = "SUCCESS";
|
|
41
|
-
StatusCodes["NOT_FOUND"] = "NOT_FOUND";
|
|
42
|
-
StatusCodes["BAD_REQUEST"] = "BAD_REQUEST";
|
|
43
|
-
StatusCodes["UNAUTHORIZED"] = "UNAUTHORIZED";
|
|
44
|
-
StatusCodes["INTERNAL_SERVER_ERROR"] = "INTERNAL_SERVER_ERROR";
|
|
45
|
-
})(StatusCodes || (exports.StatusCodes = StatusCodes = {}));
|
package/dist/constants/index.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
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);
|
|
@@ -1,126 +0,0 @@
|
|
|
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
|
-
};
|
package/dist/constants/types.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
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;
|
|
@@ -1,8 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
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
|
-
};
|
package/dist/index.d.ts
DELETED
package/dist/index.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding =
|
|
3
|
-
(this && this.__createBinding) ||
|
|
4
|
-
(Object.create
|
|
5
|
-
? function (o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
-
if (
|
|
9
|
-
!desc ||
|
|
10
|
-
("get" in desc ? !m.__esModule : desc.writable || desc.configurable)
|
|
11
|
-
) {
|
|
12
|
-
desc = {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return m[k];
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
Object.defineProperty(o, k2, desc);
|
|
20
|
-
}
|
|
21
|
-
: function (o, m, k, k2) {
|
|
22
|
-
if (k2 === undefined) k2 = k;
|
|
23
|
-
o[k2] = m[k];
|
|
24
|
-
});
|
|
25
|
-
var __exportStar =
|
|
26
|
-
(this && this.__exportStar) ||
|
|
27
|
-
function (m, exports) {
|
|
28
|
-
for (var p in m)
|
|
29
|
-
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p))
|
|
30
|
-
__createBinding(exports, m, p);
|
|
31
|
-
};
|
|
32
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
-
__exportStar(require("./models"), exports);
|
|
34
|
-
__exportStar(require("./services"), exports);
|
|
35
|
-
__exportStar(require("./utils"), exports);
|
|
36
|
-
__exportStar(require("./constants"), exports);
|
|
@@ -1,35 +0,0 @@
|
|
|
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;
|
|
@@ -1,53 +0,0 @@
|
|
|
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;
|
|
@@ -1,70 +0,0 @@
|
|
|
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;
|
|
@@ -1,86 +0,0 @@
|
|
|
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
|
-
}
|