@socket.tech/dl-common 1.0.6 → 1.0.7
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/dist/dl-common/constants/confirmations.d.ts +5 -0
- package/dist/dl-common/constants/confirmations.js +17 -0
- package/dist/dl-common/constants/enums.d.ts +44 -0
- package/dist/dl-common/constants/enums.js +52 -0
- package/dist/dl-common/constants/index.d.ts +3 -0
- package/dist/dl-common/constants/index.js +19 -0
- package/dist/dl-common/constants/types.d.ts +126 -0
- package/dist/dl-common/constants/types.js +45 -0
- package/dist/dl-common/constants/waitTime.d.ts +8 -0
- package/dist/dl-common/constants/waitTime.js +49 -0
- package/dist/dl-common/index.d.ts +4 -0
- package/dist/dl-common/index.js +20 -0
- package/dist/dl-common/models/attestSignature.d.ts +35 -0
- package/dist/dl-common/models/attestSignature.js +53 -0
- package/dist/dl-common/models/attestation.d.ts +70 -0
- package/dist/dl-common/models/attestation.js +86 -0
- package/dist/dl-common/models/index.d.ts +7 -0
- package/dist/dl-common/models/index.js +23 -0
- package/dist/dl-common/models/lastBlock.d.ts +28 -0
- package/dist/dl-common/models/lastBlock.js +27 -0
- package/dist/dl-common/models/message.d.ts +166 -0
- package/dist/dl-common/models/message.js +183 -0
- package/dist/dl-common/models/packet.d.ts +241 -0
- package/dist/dl-common/models/packet.js +250 -0
- package/dist/dl-common/models/proposal.d.ts +127 -0
- package/dist/dl-common/models/proposal.js +141 -0
- package/dist/dl-common/models/switchboard.d.ts +69 -0
- package/dist/dl-common/models/switchboard.js +92 -0
- package/dist/dl-common/models/transaction.d.ts +0 -0
- package/dist/dl-common/models/transaction.js +280 -0
- package/dist/dl-common/services/cacheService.d.ts +14 -0
- package/dist/dl-common/services/cacheService.js +77 -0
- package/dist/dl-common/services/eventBridgeService.d.ts +8 -0
- package/dist/dl-common/services/eventBridgeService.js +40 -0
- package/dist/dl-common/services/index.d.ts +3 -0
- package/dist/dl-common/services/index.js +20 -0
- package/dist/dl-common/services/queueService.d.ts +10 -0
- package/dist/dl-common/services/queueService.js +62 -0
- package/dist/dl-common/utils/address.d.ts +2 -0
- package/dist/dl-common/utils/address.js +8 -0
- package/dist/dl-common/utils/axios.d.ts +2 -0
- package/dist/dl-common/utils/axios.js +54 -0
- package/dist/dl-common/utils/dataStructHelper.d.ts +2 -0
- package/dist/dl-common/utils/dataStructHelper.js +10 -0
- package/dist/dl-common/utils/discord.d.ts +2 -0
- package/dist/dl-common/utils/discord.js +35 -0
- package/dist/dl-common/utils/ethersAwsKmsSigner.d.ts +2 -0
- package/dist/dl-common/utils/ethersAwsKmsSigner.js +26 -0
- package/dist/dl-common/utils/eventGetter.d.ts +4 -0
- package/dist/dl-common/utils/eventGetter.js +50 -0
- package/dist/dl-common/utils/extraUtils.d.ts +32 -0
- package/dist/dl-common/utils/extraUtils.js +103 -0
- package/dist/dl-common/utils/idUtils.d.ts +14 -0
- package/dist/dl-common/utils/idUtils.js +50 -0
- package/dist/dl-common/utils/index.d.ts +13 -0
- package/dist/dl-common/utils/index.js +29 -0
- package/dist/dl-common/utils/relaySigner.d.ts +21 -0
- package/dist/dl-common/utils/relaySigner.js +68 -0
- package/dist/dl-common/utils/s3Service.d.ts +5 -0
- package/dist/dl-common/utils/s3Service.js +45 -0
- package/dist/dl-common/utils/secretManagerService.d.ts +2 -0
- package/dist/dl-common/utils/secretManagerService.js +33 -0
- package/dist/dl-common/utils/signer/adapter.d.ts +18 -0
- package/dist/dl-common/utils/signer/adapter.js +71 -0
- package/dist/dl-common/utils/signer/address.d.ts +10 -0
- package/dist/dl-common/utils/signer/address.js +42 -0
- package/dist/dl-common/utils/signer/asn1-parser.d.ts +11 -0
- package/dist/dl-common/utils/signer/asn1-parser.js +80 -0
- package/dist/dl-common/utils/signer/crypto.d.ts +6 -0
- package/dist/dl-common/utils/signer/crypto.js +34 -0
- package/dist/dl-common/utils/signer/index.d.ts +4 -0
- package/dist/dl-common/utils/signer/index.js +20 -0
- package/dist/dl-common/utils/signer/kms-ethers-signer.d.ts +19 -0
- package/dist/dl-common/utils/signer/kms-ethers-signer.js +32 -0
- package/dist/dl-common/utils/signer/kms-signer.d.ts +14 -0
- package/dist/dl-common/utils/signer/kms-signer.js +46 -0
- package/dist/dl-common/utils/signer/signature.d.ts +17 -0
- package/dist/dl-common/utils/signer/signature.js +65 -0
- package/dist/dl-common/utils/signer/signer.d.ts +7 -0
- package/dist/dl-common/utils/signer/signer.js +2 -0
- package/dist/dl-common/utils/time.d.ts +2 -0
- package/dist/dl-common/utils/time.js +7 -0
- package/dist/index.js +30 -14
- package/dist/src/constants/batcherModes.d.ts +7 -0
- package/dist/src/constants/batcherModes.js +56 -0
- package/dist/src/constants/config.d.ts +39 -0
- package/dist/src/constants/config.js +77 -0
- package/dist/src/constants/enums.d.ts +21 -0
- package/dist/src/constants/enums.js +27 -0
- package/dist/src/constants/gasEstimation.d.ts +8 -0
- package/dist/src/constants/gasEstimation.js +61 -0
- package/dist/src/constants/index.d.ts +11 -0
- package/dist/src/constants/index.js +28 -0
- package/dist/src/constants/limits.d.ts +21 -0
- package/dist/src/constants/limits.js +91 -0
- package/dist/src/constants/prometheus.config.d.ts +43 -0
- package/dist/src/constants/prometheus.config.js +316 -0
- package/dist/src/constants/relayer.d.ts +6 -0
- package/dist/src/constants/relayer.js +15 -0
- package/dist/src/constants/s3Config.d.ts +13 -0
- package/dist/src/constants/s3Config.js +61 -0
- package/dist/src/constants/stageConfig.d.ts +7 -0
- package/dist/src/constants/stageConfig.js +24 -0
- package/dist/src/constants/types.d.ts +45 -0
- package/dist/src/constants/types.js +2 -0
- package/dist/src/constants/watchers.d.ts +15 -0
- package/dist/src/constants/watchers.js +137 -0
- package/dist/src/controllers/index.d.ts +0 -0
- package/dist/src/controllers/index.js +3 -0
- package/dist/src/db/associations.d.ts +1 -0
- package/dist/src/db/associations.js +46 -0
- package/dist/src/db/connection.d.ts +4 -0
- package/dist/src/db/connection.js +73 -0
- package/dist/src/db/index.d.ts +2 -0
- package/dist/src/db/index.js +18 -0
- package/dist/src/db/init.d.ts +2 -0
- package/dist/src/db/init.js +27 -0
- package/dist/src/handlers/common.d.ts +2 -0
- package/dist/src/handlers/common.js +59 -0
- package/dist/src/handlers/cronHandler.d.ts +10 -0
- package/dist/src/handlers/cronHandler.js +268 -0
- package/dist/src/handlers/executeHandler.d.ts +3 -0
- package/dist/src/handlers/executeHandler.js +66 -0
- package/dist/src/handlers/handler.d.ts +2 -0
- package/dist/src/handlers/handler.js +29 -0
- package/dist/src/handlers/proposeHandler.d.ts +3 -0
- package/dist/src/handlers/proposeHandler.js +69 -0
- package/dist/src/handlers/routes.d.ts +2 -0
- package/dist/src/handlers/routes.js +26 -0
- package/dist/src/handlers/sealHandler.d.ts +4 -0
- package/dist/src/handlers/sealHandler.js +245 -0
- package/dist/src/handlers/statusHandler.d.ts +5 -0
- package/dist/src/handlers/statusHandler.js +116 -0
- package/dist/src/handlers/taskHandler.d.ts +2 -0
- package/dist/src/handlers/taskHandler.js +110 -0
- package/dist/src/handlers/testHandler.d.ts +4 -0
- package/dist/src/handlers/testHandler.js +99 -0
- package/dist/src/main.d.ts +0 -0
- package/dist/src/main.js +12 -0
- package/dist/src/relayers/common.d.ts +7 -0
- package/dist/src/relayers/common.js +55 -0
- package/dist/src/relayers/index.d.ts +2 -0
- package/dist/src/relayers/index.js +19 -0
- package/dist/src/relayers/proposeRelayer.d.ts +7 -0
- package/dist/src/relayers/proposeRelayer.js +587 -0
- package/dist/src/relayers/sealRelayer.d.ts +8 -0
- package/dist/src/relayers/sealRelayer.js +276 -0
- package/dist/src/services/attestService.d.ts +45 -0
- package/dist/src/services/attestService.js +269 -0
- package/dist/src/services/batcherService.d.ts +9 -0
- package/dist/src/services/batcherService.js +197 -0
- package/dist/src/services/executeService.d.ts +16 -0
- package/dist/src/services/executeService.js +209 -0
- package/dist/src/services/gasEstimationService.d.ts +3 -0
- package/dist/src/services/gasEstimationService.js +12 -0
- package/dist/src/services/index.d.ts +4 -0
- package/dist/src/services/index.js +23 -0
- package/dist/src/services/indexSealService.d.ts +15 -0
- package/dist/src/services/indexSealService.js +120 -0
- package/dist/src/services/proposalCheckService.d.ts +9 -0
- package/dist/src/services/proposalCheckService.js +119 -0
- package/dist/src/services/sealService.d.ts +27 -0
- package/dist/src/services/sealService.js +190 -0
- package/dist/src/statusTrackers/failedMessage.d.ts +8 -0
- package/dist/src/statusTrackers/failedMessage.js +72 -0
- package/dist/src/statusTrackers/failedPacket.d.ts +13 -0
- package/dist/src/statusTrackers/failedPacket.js +110 -0
- package/dist/src/statusTrackers/index.d.ts +3 -0
- package/dist/src/statusTrackers/index.js +26 -0
- package/dist/src/statusTrackers/message.d.ts +4 -0
- package/dist/src/statusTrackers/message.js +257 -0
- package/dist/src/statusTrackers/packet.d.ts +33 -0
- package/dist/src/statusTrackers/packet.js +477 -0
- package/dist/src/utils/chain-utils.d.ts +5 -0
- package/dist/src/utils/chain-utils.js +42 -0
- package/dist/src/utils/index.d.ts +2 -0
- package/dist/src/utils/index.js +18 -0
- package/dist/src/utils/logger.d.ts +9 -0
- package/dist/src/utils/logger.js +9 -0
- package/dist/utils/s3Service.js +1 -1
- package/dist/utils/signer/socketSigner.d.ts +32 -0
- package/dist/utils/signer/socketSigner.js +121 -0
- package/package.json +1 -1
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addPacketHooks = exports.PacketModel = exports.Packet = exports.TripReason = exports.AttestRelayStatus = exports.ProposeRelayStatus = exports.PacketTripRelayStatus = exports.SealRelayStatus = void 0;
|
|
4
|
+
const dl_core_1 = require("@socket.tech/dl-core");
|
|
5
|
+
const sequelize_1 = require("sequelize");
|
|
6
|
+
const utils_1 = require("../utils");
|
|
7
|
+
var SealRelayStatus;
|
|
8
|
+
(function (SealRelayStatus) {
|
|
9
|
+
SealRelayStatus["SEALED"] = "SEALED";
|
|
10
|
+
SealRelayStatus["SEALING"] = "SEALING";
|
|
11
|
+
SealRelayStatus["NO"] = "NO";
|
|
12
|
+
SealRelayStatus["SEAL_FAILED"] = "SEAL_FAILED";
|
|
13
|
+
})(SealRelayStatus || (exports.SealRelayStatus = SealRelayStatus = {}));
|
|
14
|
+
var PacketTripRelayStatus;
|
|
15
|
+
(function (PacketTripRelayStatus) {
|
|
16
|
+
PacketTripRelayStatus["IS_TRIPPING"] = "IS_TRIPPING";
|
|
17
|
+
PacketTripRelayStatus["NO"] = "NO";
|
|
18
|
+
PacketTripRelayStatus["TRIPPING_FAILED"] = "TRIPPING_FAILED";
|
|
19
|
+
PacketTripRelayStatus["TRIPPED"] = "TRIPPED";
|
|
20
|
+
})(PacketTripRelayStatus || (exports.PacketTripRelayStatus = PacketTripRelayStatus = {}));
|
|
21
|
+
var ProposeRelayStatus;
|
|
22
|
+
(function (ProposeRelayStatus) {
|
|
23
|
+
ProposeRelayStatus["PROPOSED"] = "PROPOSED";
|
|
24
|
+
ProposeRelayStatus["PROPOSING"] = "PROPOSING";
|
|
25
|
+
ProposeRelayStatus["CONFIRMING"] = "CONFIRMING";
|
|
26
|
+
ProposeRelayStatus["NO"] = "NO";
|
|
27
|
+
ProposeRelayStatus["PROPOSE_FAILED"] = "PROPOSE_FAILED";
|
|
28
|
+
ProposeRelayStatus["CONFIRM_FAILED"] = "CONFIRM_FAILED";
|
|
29
|
+
})(ProposeRelayStatus || (exports.ProposeRelayStatus = ProposeRelayStatus = {}));
|
|
30
|
+
var AttestRelayStatus;
|
|
31
|
+
(function (AttestRelayStatus) {
|
|
32
|
+
AttestRelayStatus["ATTESTED"] = "ATTESTED";
|
|
33
|
+
AttestRelayStatus["ATTESTING"] = "ATTESTING";
|
|
34
|
+
AttestRelayStatus["NO"] = "NO";
|
|
35
|
+
AttestRelayStatus["ATTEST_FAILED"] = "ATTEST_FAILED";
|
|
36
|
+
})(AttestRelayStatus || (exports.AttestRelayStatus = AttestRelayStatus = {}));
|
|
37
|
+
var TripReason;
|
|
38
|
+
(function (TripReason) {
|
|
39
|
+
TripReason["SWITCHBOARD_MISMATCHED"] = "SWITCHBOARD_MISMATCHED";
|
|
40
|
+
TripReason["ROOT_MISMATCHED"] = "ROOT_MISMATCHED";
|
|
41
|
+
TripReason["MISSING_SEAL"] = "MISSING_SEAL";
|
|
42
|
+
TripReason["NO"] = "NO";
|
|
43
|
+
})(TripReason || (exports.TripReason = TripReason = {}));
|
|
44
|
+
class Packet extends sequelize_1.Model {
|
|
45
|
+
}
|
|
46
|
+
exports.Packet = Packet;
|
|
47
|
+
exports.PacketModel = {
|
|
48
|
+
id: {
|
|
49
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
50
|
+
autoIncrement: true,
|
|
51
|
+
},
|
|
52
|
+
srcChainSlug: {
|
|
53
|
+
type: sequelize_1.DataTypes.BIGINT,
|
|
54
|
+
},
|
|
55
|
+
dstChainSlug: {
|
|
56
|
+
type: sequelize_1.DataTypes.BIGINT,
|
|
57
|
+
},
|
|
58
|
+
srcCapacitor: {
|
|
59
|
+
type: sequelize_1.DataTypes.STRING,
|
|
60
|
+
},
|
|
61
|
+
dstSwitchboard: {
|
|
62
|
+
type: sequelize_1.DataTypes.STRING,
|
|
63
|
+
},
|
|
64
|
+
switchboardId: {
|
|
65
|
+
type: sequelize_1.DataTypes.STRING,
|
|
66
|
+
},
|
|
67
|
+
integrationType: {
|
|
68
|
+
type: sequelize_1.DataTypes.ENUM,
|
|
69
|
+
values: [...Object.values(dl_core_1.IntegrationTypes)],
|
|
70
|
+
defaultValue: dl_core_1.IntegrationTypes.unknown,
|
|
71
|
+
},
|
|
72
|
+
packetId: {
|
|
73
|
+
type: sequelize_1.DataTypes.STRING,
|
|
74
|
+
primaryKey: true,
|
|
75
|
+
},
|
|
76
|
+
capacitorPacketCount: {
|
|
77
|
+
type: sequelize_1.DataTypes.STRING,
|
|
78
|
+
},
|
|
79
|
+
root: {
|
|
80
|
+
type: sequelize_1.DataTypes.STRING,
|
|
81
|
+
},
|
|
82
|
+
rootSealed: {
|
|
83
|
+
type: sequelize_1.DataTypes.STRING,
|
|
84
|
+
},
|
|
85
|
+
isFilled: {
|
|
86
|
+
type: sequelize_1.DataTypes.BOOLEAN,
|
|
87
|
+
},
|
|
88
|
+
isSealed: {
|
|
89
|
+
type: sequelize_1.DataTypes.BOOLEAN,
|
|
90
|
+
defaultValue: false,
|
|
91
|
+
},
|
|
92
|
+
isProposed: {
|
|
93
|
+
type: sequelize_1.DataTypes.BOOLEAN,
|
|
94
|
+
defaultValue: false,
|
|
95
|
+
},
|
|
96
|
+
isAttested: {
|
|
97
|
+
type: sequelize_1.DataTypes.BOOLEAN,
|
|
98
|
+
defaultValue: false,
|
|
99
|
+
},
|
|
100
|
+
isVerified: {
|
|
101
|
+
type: sequelize_1.DataTypes.BOOLEAN,
|
|
102
|
+
defaultValue: false,
|
|
103
|
+
},
|
|
104
|
+
isFullyExecuted: {
|
|
105
|
+
type: sequelize_1.DataTypes.BOOLEAN,
|
|
106
|
+
defaultValue: false,
|
|
107
|
+
},
|
|
108
|
+
sealer: {
|
|
109
|
+
type: sequelize_1.DataTypes.STRING,
|
|
110
|
+
},
|
|
111
|
+
sealRelayStatus: {
|
|
112
|
+
type: sequelize_1.DataTypes.ENUM,
|
|
113
|
+
values: [...Object.values(SealRelayStatus)],
|
|
114
|
+
defaultValue: SealRelayStatus.NO,
|
|
115
|
+
},
|
|
116
|
+
sealTxId: {
|
|
117
|
+
type: sequelize_1.DataTypes.STRING,
|
|
118
|
+
defaultValue: "",
|
|
119
|
+
},
|
|
120
|
+
sealTxHash: {
|
|
121
|
+
type: sequelize_1.DataTypes.STRING,
|
|
122
|
+
defaultValue: "",
|
|
123
|
+
},
|
|
124
|
+
outboundTxHash: {
|
|
125
|
+
type: sequelize_1.DataTypes.STRING,
|
|
126
|
+
defaultValue: "",
|
|
127
|
+
},
|
|
128
|
+
outboundTime: {
|
|
129
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
130
|
+
},
|
|
131
|
+
proposeTime: {
|
|
132
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
133
|
+
},
|
|
134
|
+
attestTime: {
|
|
135
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
136
|
+
},
|
|
137
|
+
sealTime: {
|
|
138
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
139
|
+
},
|
|
140
|
+
sealIndexTime: {
|
|
141
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
142
|
+
},
|
|
143
|
+
sealSignature: {
|
|
144
|
+
type: sequelize_1.DataTypes.STRING,
|
|
145
|
+
},
|
|
146
|
+
packetTripRelayStatus: {
|
|
147
|
+
type: sequelize_1.DataTypes.ENUM,
|
|
148
|
+
values: [...Object.values(PacketTripRelayStatus)],
|
|
149
|
+
defaultValue: PacketTripRelayStatus.NO,
|
|
150
|
+
},
|
|
151
|
+
packetTripTxId: {
|
|
152
|
+
type: sequelize_1.DataTypes.STRING,
|
|
153
|
+
defaultValue: "",
|
|
154
|
+
},
|
|
155
|
+
packetTripTxHash: {
|
|
156
|
+
type: sequelize_1.DataTypes.STRING,
|
|
157
|
+
defaultValue: "",
|
|
158
|
+
},
|
|
159
|
+
packetTripErrorMessage: {
|
|
160
|
+
type: sequelize_1.DataTypes.STRING,
|
|
161
|
+
defaultValue: "",
|
|
162
|
+
},
|
|
163
|
+
packetTripTime: {
|
|
164
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
165
|
+
},
|
|
166
|
+
isPacketTripped: {
|
|
167
|
+
type: sequelize_1.DataTypes.BOOLEAN,
|
|
168
|
+
defaultValue: false,
|
|
169
|
+
},
|
|
170
|
+
proposeTxId: {
|
|
171
|
+
type: sequelize_1.DataTypes.STRING,
|
|
172
|
+
defaultValue: "",
|
|
173
|
+
},
|
|
174
|
+
proposeTxHash: {
|
|
175
|
+
type: sequelize_1.DataTypes.STRING,
|
|
176
|
+
defaultValue: "",
|
|
177
|
+
},
|
|
178
|
+
proposeRelayStatus: {
|
|
179
|
+
type: sequelize_1.DataTypes.ENUM,
|
|
180
|
+
values: [...Object.values(ProposeRelayStatus)],
|
|
181
|
+
defaultValue: ProposeRelayStatus.NO,
|
|
182
|
+
},
|
|
183
|
+
selectedProposalCount: {
|
|
184
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
185
|
+
},
|
|
186
|
+
executionWaitTime: {
|
|
187
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
188
|
+
},
|
|
189
|
+
attestTxId: {
|
|
190
|
+
type: sequelize_1.DataTypes.STRING,
|
|
191
|
+
defaultValue: "",
|
|
192
|
+
},
|
|
193
|
+
attestTxHash: {
|
|
194
|
+
type: sequelize_1.DataTypes.STRING,
|
|
195
|
+
defaultValue: "",
|
|
196
|
+
},
|
|
197
|
+
tripReason: {
|
|
198
|
+
type: sequelize_1.DataTypes.ENUM,
|
|
199
|
+
values: [...Object.values(TripReason)],
|
|
200
|
+
defaultValue: TripReason.NO,
|
|
201
|
+
},
|
|
202
|
+
// packetTripTxHash: {
|
|
203
|
+
// type: DataTypes.STRING,
|
|
204
|
+
// defaultValue: "",
|
|
205
|
+
// },
|
|
206
|
+
attestRelayStatus: {
|
|
207
|
+
type: sequelize_1.DataTypes.ENUM,
|
|
208
|
+
values: [...Object.values(AttestRelayStatus)],
|
|
209
|
+
defaultValue: AttestRelayStatus.NO,
|
|
210
|
+
},
|
|
211
|
+
};
|
|
212
|
+
function processStrings(packet) {
|
|
213
|
+
if (packet.packetId)
|
|
214
|
+
packet.packetId = (0, utils_1.toLowerCase)(packet.packetId);
|
|
215
|
+
if (packet.root)
|
|
216
|
+
packet.root = (0, utils_1.toLowerCase)(packet.root);
|
|
217
|
+
if (packet.rootSealed)
|
|
218
|
+
packet.rootSealed = (0, utils_1.toLowerCase)(packet.rootSealed);
|
|
219
|
+
if (packet.sealer)
|
|
220
|
+
packet.sealer = (0, utils_1.toLowerCase)(packet.sealer);
|
|
221
|
+
if (packet.outboundTxHash) {
|
|
222
|
+
packet.outboundTxHash = (0, utils_1.toLowerCase)(packet.outboundTxHash);
|
|
223
|
+
}
|
|
224
|
+
if (packet.sealTxHash)
|
|
225
|
+
packet.sealTxHash = (0, utils_1.toLowerCase)(packet.sealTxHash);
|
|
226
|
+
if (packet.sealSignature) {
|
|
227
|
+
packet.sealSignature = (0, utils_1.toLowerCase)(packet.sealSignature);
|
|
228
|
+
}
|
|
229
|
+
if (packet.dstSwitchboard) {
|
|
230
|
+
packet.dstSwitchboard = (0, utils_1.toLowerCase)(packet.dstSwitchboard);
|
|
231
|
+
}
|
|
232
|
+
if (packet.switchboardId) {
|
|
233
|
+
packet.switchboardId = (0, utils_1.toLowerCase)(packet.switchboardId);
|
|
234
|
+
}
|
|
235
|
+
if (packet.packetTripTxHash) {
|
|
236
|
+
packet.packetTripTxHash = (0, utils_1.toLowerCase)(packet.packetTripTxHash);
|
|
237
|
+
}
|
|
238
|
+
return packet;
|
|
239
|
+
}
|
|
240
|
+
const addPacketHooks = () => {
|
|
241
|
+
Packet.beforeBulkCreate((packet, options) => {
|
|
242
|
+
for (let index = 0; index < packet.length; index++) {
|
|
243
|
+
packet[index] = processStrings(packet[index]);
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
Packet.beforeSave((packet, options) => {
|
|
247
|
+
packet = processStrings(packet);
|
|
248
|
+
});
|
|
249
|
+
};
|
|
250
|
+
exports.addPacketHooks = addPacketHooks;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { DataTypes, Model } from "sequelize";
|
|
2
|
+
export declare enum TripStatus {
|
|
3
|
+
TRIP_REQUIRED = "TRIP_REQUIRED",
|
|
4
|
+
TRIP_INITIATED = "TRIP_INITIATED",
|
|
5
|
+
TRIP_SUCCESSFUL = "TRIP_SUCCESSFUL",
|
|
6
|
+
TRIP_FAILED = "TRIP_FAILED",
|
|
7
|
+
NO = "NO"
|
|
8
|
+
}
|
|
9
|
+
export declare enum RootMatchState {
|
|
10
|
+
ROOTS_MATCHED = "ROOTS_MATCHED",
|
|
11
|
+
ROOTS_MISMATCHED = "ROOTS_MISMATCHED",
|
|
12
|
+
NO = "NO"
|
|
13
|
+
}
|
|
14
|
+
export declare enum MatchState {
|
|
15
|
+
MATCHED = "MATCHED",
|
|
16
|
+
MISMATCHED = "MISMATCHED",
|
|
17
|
+
NO = "NO"
|
|
18
|
+
}
|
|
19
|
+
export declare enum ProposalTripRelayStatus {
|
|
20
|
+
IS_TRIPPING = "IS_TRIPPING",
|
|
21
|
+
NO = "NO",
|
|
22
|
+
TRIPPING_FAILED = "TRIPPING_FAILED",
|
|
23
|
+
TRIPPED = "TRIPPED"
|
|
24
|
+
}
|
|
25
|
+
export declare class Proposal extends Model {
|
|
26
|
+
id: number;
|
|
27
|
+
srcChainSlug: number;
|
|
28
|
+
dstChainSlug: number;
|
|
29
|
+
packetId: string;
|
|
30
|
+
root: string;
|
|
31
|
+
proposalCount: number;
|
|
32
|
+
switchboard: string;
|
|
33
|
+
proposer: string;
|
|
34
|
+
proposeTxHash: string;
|
|
35
|
+
proposeTime: number;
|
|
36
|
+
rootMatchState: RootMatchState;
|
|
37
|
+
switchboardMatchState: MatchState;
|
|
38
|
+
tripTime: number;
|
|
39
|
+
tripTxHash: string;
|
|
40
|
+
tripTxId: string;
|
|
41
|
+
tripErrorMessage: string;
|
|
42
|
+
tripRelayStatus: ProposalTripRelayStatus;
|
|
43
|
+
isTripped: boolean;
|
|
44
|
+
totalAttestations: number;
|
|
45
|
+
isTripRequired: boolean;
|
|
46
|
+
}
|
|
47
|
+
export declare const ProposalModel: {
|
|
48
|
+
id: {
|
|
49
|
+
type: DataTypes.IntegerDataTypeConstructor;
|
|
50
|
+
autoIncrement: boolean;
|
|
51
|
+
primaryKey: boolean;
|
|
52
|
+
};
|
|
53
|
+
srcChainSlug: {
|
|
54
|
+
type: DataTypes.BigIntDataTypeConstructor;
|
|
55
|
+
};
|
|
56
|
+
dstChainSlug: {
|
|
57
|
+
type: DataTypes.BigIntDataTypeConstructor;
|
|
58
|
+
};
|
|
59
|
+
packetId: {
|
|
60
|
+
type: DataTypes.StringDataTypeConstructor;
|
|
61
|
+
unique: string;
|
|
62
|
+
};
|
|
63
|
+
proposalCount: {
|
|
64
|
+
type: DataTypes.IntegerDataTypeConstructor;
|
|
65
|
+
unique: string;
|
|
66
|
+
};
|
|
67
|
+
root: {
|
|
68
|
+
type: DataTypes.StringDataTypeConstructor;
|
|
69
|
+
};
|
|
70
|
+
switchboard: {
|
|
71
|
+
type: DataTypes.StringDataTypeConstructor;
|
|
72
|
+
unique: string;
|
|
73
|
+
};
|
|
74
|
+
proposer: {
|
|
75
|
+
type: DataTypes.StringDataTypeConstructor;
|
|
76
|
+
};
|
|
77
|
+
proposeTxHash: {
|
|
78
|
+
type: DataTypes.StringDataTypeConstructor;
|
|
79
|
+
defaultValue: string;
|
|
80
|
+
};
|
|
81
|
+
proposeTime: {
|
|
82
|
+
type: DataTypes.IntegerDataTypeConstructor;
|
|
83
|
+
};
|
|
84
|
+
tripTxId: {
|
|
85
|
+
type: DataTypes.StringDataTypeConstructor;
|
|
86
|
+
defaultValue: string;
|
|
87
|
+
};
|
|
88
|
+
tripTxHash: {
|
|
89
|
+
type: DataTypes.StringDataTypeConstructor;
|
|
90
|
+
defaultValue: string;
|
|
91
|
+
};
|
|
92
|
+
tripTime: {
|
|
93
|
+
type: DataTypes.IntegerDataTypeConstructor;
|
|
94
|
+
};
|
|
95
|
+
tripErrorMessage: {
|
|
96
|
+
type: DataTypes.StringDataTypeConstructor;
|
|
97
|
+
defaultValue: string;
|
|
98
|
+
};
|
|
99
|
+
isTripped: {
|
|
100
|
+
type: DataTypes.AbstractDataTypeConstructor;
|
|
101
|
+
defaultValue: boolean;
|
|
102
|
+
};
|
|
103
|
+
tripRelayStatus: {
|
|
104
|
+
type: DataTypes.EnumDataTypeConstructor;
|
|
105
|
+
values: ProposalTripRelayStatus[];
|
|
106
|
+
defaultValue: ProposalTripRelayStatus;
|
|
107
|
+
};
|
|
108
|
+
totalAttestations: {
|
|
109
|
+
type: DataTypes.IntegerDataTypeConstructor;
|
|
110
|
+
defaultValue: number;
|
|
111
|
+
};
|
|
112
|
+
rootMatchState: {
|
|
113
|
+
type: DataTypes.EnumDataTypeConstructor;
|
|
114
|
+
values: RootMatchState[];
|
|
115
|
+
defaultValue: RootMatchState;
|
|
116
|
+
};
|
|
117
|
+
switchboardMatchState: {
|
|
118
|
+
type: DataTypes.EnumDataTypeConstructor;
|
|
119
|
+
values: MatchState[];
|
|
120
|
+
defaultValue: MatchState;
|
|
121
|
+
};
|
|
122
|
+
isTripRequired: {
|
|
123
|
+
type: DataTypes.AbstractDataTypeConstructor;
|
|
124
|
+
defaultValue: boolean;
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
export declare const addProposalHooks: () => void;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addProposalHooks = exports.ProposalModel = exports.Proposal = exports.ProposalTripRelayStatus = exports.MatchState = exports.RootMatchState = exports.TripStatus = void 0;
|
|
4
|
+
const sequelize_1 = require("sequelize");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
var TripStatus;
|
|
7
|
+
(function (TripStatus) {
|
|
8
|
+
TripStatus["TRIP_REQUIRED"] = "TRIP_REQUIRED";
|
|
9
|
+
TripStatus["TRIP_INITIATED"] = "TRIP_INITIATED";
|
|
10
|
+
TripStatus["TRIP_SUCCESSFUL"] = "TRIP_SUCCESSFUL";
|
|
11
|
+
TripStatus["TRIP_FAILED"] = "TRIP_FAILED";
|
|
12
|
+
TripStatus["NO"] = "NO";
|
|
13
|
+
})(TripStatus || (exports.TripStatus = TripStatus = {}));
|
|
14
|
+
var RootMatchState;
|
|
15
|
+
(function (RootMatchState) {
|
|
16
|
+
RootMatchState["ROOTS_MATCHED"] = "ROOTS_MATCHED";
|
|
17
|
+
RootMatchState["ROOTS_MISMATCHED"] = "ROOTS_MISMATCHED";
|
|
18
|
+
RootMatchState["NO"] = "NO";
|
|
19
|
+
})(RootMatchState || (exports.RootMatchState = RootMatchState = {}));
|
|
20
|
+
var MatchState;
|
|
21
|
+
(function (MatchState) {
|
|
22
|
+
MatchState["MATCHED"] = "MATCHED";
|
|
23
|
+
MatchState["MISMATCHED"] = "MISMATCHED";
|
|
24
|
+
MatchState["NO"] = "NO";
|
|
25
|
+
})(MatchState || (exports.MatchState = MatchState = {}));
|
|
26
|
+
var ProposalTripRelayStatus;
|
|
27
|
+
(function (ProposalTripRelayStatus) {
|
|
28
|
+
ProposalTripRelayStatus["IS_TRIPPING"] = "IS_TRIPPING";
|
|
29
|
+
ProposalTripRelayStatus["NO"] = "NO";
|
|
30
|
+
ProposalTripRelayStatus["TRIPPING_FAILED"] = "TRIPPING_FAILED";
|
|
31
|
+
ProposalTripRelayStatus["TRIPPED"] = "TRIPPED";
|
|
32
|
+
})(ProposalTripRelayStatus || (exports.ProposalTripRelayStatus = ProposalTripRelayStatus = {}));
|
|
33
|
+
class Proposal extends sequelize_1.Model {
|
|
34
|
+
}
|
|
35
|
+
exports.Proposal = Proposal;
|
|
36
|
+
exports.ProposalModel = {
|
|
37
|
+
id: {
|
|
38
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
39
|
+
autoIncrement: true,
|
|
40
|
+
primaryKey: true,
|
|
41
|
+
},
|
|
42
|
+
srcChainSlug: {
|
|
43
|
+
type: sequelize_1.DataTypes.BIGINT,
|
|
44
|
+
},
|
|
45
|
+
dstChainSlug: {
|
|
46
|
+
type: sequelize_1.DataTypes.BIGINT,
|
|
47
|
+
},
|
|
48
|
+
packetId: {
|
|
49
|
+
type: sequelize_1.DataTypes.STRING,
|
|
50
|
+
unique: "uniqueProposalPointer",
|
|
51
|
+
},
|
|
52
|
+
proposalCount: {
|
|
53
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
54
|
+
unique: "uniqueProposalPointer",
|
|
55
|
+
},
|
|
56
|
+
root: {
|
|
57
|
+
type: sequelize_1.DataTypes.STRING,
|
|
58
|
+
},
|
|
59
|
+
switchboard: {
|
|
60
|
+
type: sequelize_1.DataTypes.STRING,
|
|
61
|
+
unique: "uniqueProposalPointer",
|
|
62
|
+
},
|
|
63
|
+
proposer: {
|
|
64
|
+
type: sequelize_1.DataTypes.STRING,
|
|
65
|
+
},
|
|
66
|
+
proposeTxHash: {
|
|
67
|
+
type: sequelize_1.DataTypes.STRING,
|
|
68
|
+
defaultValue: "",
|
|
69
|
+
},
|
|
70
|
+
proposeTime: {
|
|
71
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
72
|
+
},
|
|
73
|
+
tripTxId: {
|
|
74
|
+
type: sequelize_1.DataTypes.STRING,
|
|
75
|
+
defaultValue: "",
|
|
76
|
+
},
|
|
77
|
+
tripTxHash: {
|
|
78
|
+
type: sequelize_1.DataTypes.STRING,
|
|
79
|
+
defaultValue: "",
|
|
80
|
+
},
|
|
81
|
+
tripTime: {
|
|
82
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
83
|
+
},
|
|
84
|
+
tripErrorMessage: {
|
|
85
|
+
type: sequelize_1.DataTypes.STRING,
|
|
86
|
+
defaultValue: "",
|
|
87
|
+
},
|
|
88
|
+
isTripped: {
|
|
89
|
+
type: sequelize_1.DataTypes.BOOLEAN,
|
|
90
|
+
defaultValue: false,
|
|
91
|
+
},
|
|
92
|
+
tripRelayStatus: {
|
|
93
|
+
type: sequelize_1.DataTypes.ENUM,
|
|
94
|
+
values: [...Object.values(ProposalTripRelayStatus)],
|
|
95
|
+
defaultValue: ProposalTripRelayStatus.NO,
|
|
96
|
+
},
|
|
97
|
+
totalAttestations: {
|
|
98
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
99
|
+
defaultValue: 0,
|
|
100
|
+
},
|
|
101
|
+
rootMatchState: {
|
|
102
|
+
type: sequelize_1.DataTypes.ENUM,
|
|
103
|
+
values: [...Object.values(RootMatchState)],
|
|
104
|
+
defaultValue: RootMatchState.NO,
|
|
105
|
+
},
|
|
106
|
+
switchboardMatchState: {
|
|
107
|
+
type: sequelize_1.DataTypes.ENUM,
|
|
108
|
+
values: [...Object.values(MatchState)],
|
|
109
|
+
defaultValue: MatchState.NO,
|
|
110
|
+
},
|
|
111
|
+
isTripRequired: {
|
|
112
|
+
type: sequelize_1.DataTypes.BOOLEAN,
|
|
113
|
+
defaultValue: false,
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
function processStrings(proposal) {
|
|
117
|
+
if (proposal.packetId)
|
|
118
|
+
proposal.packetId = (0, utils_1.toLowerCase)(proposal.packetId);
|
|
119
|
+
if (proposal.root)
|
|
120
|
+
proposal.root = (0, utils_1.toLowerCase)(proposal.root);
|
|
121
|
+
if (proposal.switchboard)
|
|
122
|
+
proposal.switchboard = (0, utils_1.toLowerCase)(proposal.switchboard);
|
|
123
|
+
if (proposal.proposer)
|
|
124
|
+
proposal.proposer = (0, utils_1.toLowerCase)(proposal.proposer);
|
|
125
|
+
if (proposal.proposeTxHash)
|
|
126
|
+
proposal.proposeTxHash = (0, utils_1.toLowerCase)(proposal.proposeTxHash);
|
|
127
|
+
if (proposal.tripTxHash)
|
|
128
|
+
proposal.tripTxHash = (0, utils_1.toLowerCase)(proposal.tripTxHash);
|
|
129
|
+
return proposal;
|
|
130
|
+
}
|
|
131
|
+
const addProposalHooks = () => {
|
|
132
|
+
Proposal.beforeBulkCreate((proposal, options) => {
|
|
133
|
+
for (let index = 0; index < proposal.length; index++) {
|
|
134
|
+
proposal[index] = processStrings(proposal[index]);
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
Proposal.beforeSave((proposal, options) => {
|
|
138
|
+
proposal = processStrings(proposal);
|
|
139
|
+
});
|
|
140
|
+
};
|
|
141
|
+
exports.addProposalHooks = addProposalHooks;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { IntegrationTypes } from "@socket.tech/dl-core";
|
|
2
|
+
import { DataTypes, Model } from "sequelize";
|
|
3
|
+
export declare enum CapacitorType {
|
|
4
|
+
singleCapacitor = "1",
|
|
5
|
+
hashChainCapacitor = "2"
|
|
6
|
+
}
|
|
7
|
+
export declare class Switchboard extends Model {
|
|
8
|
+
id: number;
|
|
9
|
+
switchboardId: string;
|
|
10
|
+
srcChainSlug: number;
|
|
11
|
+
dstChainSlug: number;
|
|
12
|
+
maxPacketLength: number;
|
|
13
|
+
srcSwitchboard: string;
|
|
14
|
+
dstSwitchboard: string;
|
|
15
|
+
srcCapacitor: string;
|
|
16
|
+
srcDecapacitor: string;
|
|
17
|
+
capacitorType: CapacitorType;
|
|
18
|
+
isEnabled: boolean;
|
|
19
|
+
integrationType: IntegrationTypes;
|
|
20
|
+
}
|
|
21
|
+
export declare const SwitchboardModel: {
|
|
22
|
+
id: {
|
|
23
|
+
type: DataTypes.IntegerDataTypeConstructor;
|
|
24
|
+
autoIncrement: boolean;
|
|
25
|
+
primaryKey: boolean;
|
|
26
|
+
};
|
|
27
|
+
switchboardId: {
|
|
28
|
+
type: DataTypes.StringDataTypeConstructor;
|
|
29
|
+
};
|
|
30
|
+
srcChainSlug: {
|
|
31
|
+
type: DataTypes.BigIntDataTypeConstructor;
|
|
32
|
+
unique: string;
|
|
33
|
+
};
|
|
34
|
+
dstChainSlug: {
|
|
35
|
+
type: DataTypes.BigIntDataTypeConstructor;
|
|
36
|
+
unique: string;
|
|
37
|
+
};
|
|
38
|
+
maxPacketLength: {
|
|
39
|
+
type: DataTypes.IntegerDataTypeConstructor;
|
|
40
|
+
};
|
|
41
|
+
srcSwitchboard: {
|
|
42
|
+
type: DataTypes.StringDataTypeConstructor;
|
|
43
|
+
unique: string;
|
|
44
|
+
};
|
|
45
|
+
dstSwitchboard: {
|
|
46
|
+
type: DataTypes.StringDataTypeConstructor;
|
|
47
|
+
};
|
|
48
|
+
srcCapacitor: {
|
|
49
|
+
type: DataTypes.StringDataTypeConstructor;
|
|
50
|
+
};
|
|
51
|
+
srcDecapacitor: {
|
|
52
|
+
type: DataTypes.StringDataTypeConstructor;
|
|
53
|
+
};
|
|
54
|
+
capacitorType: {
|
|
55
|
+
type: DataTypes.EnumDataTypeConstructor;
|
|
56
|
+
values: CapacitorType[];
|
|
57
|
+
defaultValue: CapacitorType;
|
|
58
|
+
};
|
|
59
|
+
isEnabled: {
|
|
60
|
+
type: DataTypes.AbstractDataTypeConstructor;
|
|
61
|
+
defaultValue: boolean;
|
|
62
|
+
};
|
|
63
|
+
integrationType: {
|
|
64
|
+
type: DataTypes.EnumDataTypeConstructor;
|
|
65
|
+
values: IntegrationTypes[];
|
|
66
|
+
defaultValue: IntegrationTypes;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
export declare const addSwitchboardHooks: () => Promise<void>;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addSwitchboardHooks = exports.SwitchboardModel = exports.Switchboard = exports.CapacitorType = void 0;
|
|
4
|
+
const dl_core_1 = require("@socket.tech/dl-core");
|
|
5
|
+
const sequelize_1 = require("sequelize");
|
|
6
|
+
const __1 = require("..");
|
|
7
|
+
var CapacitorType;
|
|
8
|
+
(function (CapacitorType) {
|
|
9
|
+
CapacitorType["singleCapacitor"] = "1";
|
|
10
|
+
CapacitorType["hashChainCapacitor"] = "2";
|
|
11
|
+
})(CapacitorType || (exports.CapacitorType = CapacitorType = {}));
|
|
12
|
+
class Switchboard extends sequelize_1.Model {
|
|
13
|
+
}
|
|
14
|
+
exports.Switchboard = Switchboard;
|
|
15
|
+
exports.SwitchboardModel = {
|
|
16
|
+
id: {
|
|
17
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
18
|
+
autoIncrement: true,
|
|
19
|
+
primaryKey: true,
|
|
20
|
+
},
|
|
21
|
+
switchboardId: {
|
|
22
|
+
type: sequelize_1.DataTypes.STRING,
|
|
23
|
+
},
|
|
24
|
+
srcChainSlug: {
|
|
25
|
+
type: sequelize_1.DataTypes.BIGINT,
|
|
26
|
+
unique: "uniqueSwitchboardPointer",
|
|
27
|
+
},
|
|
28
|
+
dstChainSlug: {
|
|
29
|
+
type: sequelize_1.DataTypes.BIGINT,
|
|
30
|
+
unique: "uniqueSwitchboardPointer",
|
|
31
|
+
},
|
|
32
|
+
maxPacketLength: {
|
|
33
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
34
|
+
},
|
|
35
|
+
srcSwitchboard: {
|
|
36
|
+
type: sequelize_1.DataTypes.STRING,
|
|
37
|
+
unique: "uniqueSwitchboardPointer",
|
|
38
|
+
},
|
|
39
|
+
dstSwitchboard: {
|
|
40
|
+
type: sequelize_1.DataTypes.STRING,
|
|
41
|
+
},
|
|
42
|
+
srcCapacitor: {
|
|
43
|
+
type: sequelize_1.DataTypes.STRING,
|
|
44
|
+
},
|
|
45
|
+
srcDecapacitor: {
|
|
46
|
+
type: sequelize_1.DataTypes.STRING,
|
|
47
|
+
},
|
|
48
|
+
capacitorType: {
|
|
49
|
+
type: sequelize_1.DataTypes.ENUM,
|
|
50
|
+
values: [...Object.values(CapacitorType)],
|
|
51
|
+
defaultValue: CapacitorType.singleCapacitor,
|
|
52
|
+
},
|
|
53
|
+
isEnabled: {
|
|
54
|
+
type: sequelize_1.DataTypes.BOOLEAN,
|
|
55
|
+
defaultValue: false,
|
|
56
|
+
},
|
|
57
|
+
integrationType: {
|
|
58
|
+
type: sequelize_1.DataTypes.ENUM,
|
|
59
|
+
values: [...Object.values(dl_core_1.IntegrationTypes)],
|
|
60
|
+
defaultValue: dl_core_1.IntegrationTypes.unknown,
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
const addSwitchboardHooks = async () => {
|
|
64
|
+
Switchboard.beforeBulkCreate((switchboards, options) => {
|
|
65
|
+
for (let index = 0; index < switchboards.length; index++) {
|
|
66
|
+
switchboards[index] = processStrings(switchboards[index]);
|
|
67
|
+
switchboards[index] = createSwitchboardId(switchboards[index]);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
Switchboard.beforeSave((switchboard, options) => {
|
|
71
|
+
switchboard = processStrings(switchboard);
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
exports.addSwitchboardHooks = addSwitchboardHooks;
|
|
75
|
+
function processStrings(switchboard) {
|
|
76
|
+
if (switchboard.srcSwitchboard)
|
|
77
|
+
switchboard.srcSwitchboard = (0, __1.toLowerCase)(switchboard.srcSwitchboard);
|
|
78
|
+
if (switchboard.dstSwitchboard)
|
|
79
|
+
switchboard.dstSwitchboard = (0, __1.toLowerCase)(switchboard.dstSwitchboard);
|
|
80
|
+
if (switchboard.srcCapacitor)
|
|
81
|
+
switchboard.srcCapacitor = (0, __1.toLowerCase)(switchboard.srcCapacitor);
|
|
82
|
+
if (switchboard.srcDecapacitor)
|
|
83
|
+
switchboard.srcDecapacitor = (0, __1.toLowerCase)(switchboard.srcDecapacitor);
|
|
84
|
+
return switchboard;
|
|
85
|
+
}
|
|
86
|
+
function createSwitchboardId(switchboard) {
|
|
87
|
+
if (switchboard.srcSwitchboard &&
|
|
88
|
+
switchboard.srcChainSlug &&
|
|
89
|
+
switchboard.dstChainSlug)
|
|
90
|
+
switchboard.switchboardId = `${switchboard.srcChainSlug}-${switchboard.dstChainSlug}-${switchboard.srcSwitchboard.toLowerCase()}`;
|
|
91
|
+
return switchboard;
|
|
92
|
+
}
|
|
File without changes
|