@socket.tech/dl-common 1.0.1
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/LICENSE +21 -0
- package/README.md +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +20 -0
- package/dist/models/attestSignature.d.ts +34 -0
- package/dist/models/attestSignature.js +32 -0
- package/dist/models/attestations.d.ts +69 -0
- package/dist/models/attestations.js +59 -0
- package/dist/models/index.d.ts +3 -0
- package/dist/models/index.js +19 -0
- package/dist/models/message.d.ts +165 -0
- package/dist/models/message.js +135 -0
- package/dist/models/packet.d.ts +220 -0
- package/dist/models/packet.js +195 -0
- package/dist/models/proposal.d.ts +126 -0
- package/dist/models/proposal.js +114 -0
- package/dist/services/cacheService.d.ts +14 -0
- package/dist/services/cacheService.js +89 -0
- package/dist/services/index.d.ts +2 -0
- package/dist/services/index.js +19 -0
- package/dist/services/queueService.d.ts +10 -0
- package/dist/services/queueService.js +57 -0
- package/dist/types/codes.d.ts +22 -0
- package/dist/types/codes.js +28 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +18 -0
- package/dist/types/types.d.ts +86 -0
- package/dist/types/types.js +41 -0
- package/dist/utils/address.d.ts +2 -0
- package/dist/utils/address.js +8 -0
- package/dist/utils/axios.d.ts +2 -0
- package/dist/utils/axios.js +47 -0
- package/dist/utils/dataStructHelper.d.ts +2 -0
- package/dist/utils/dataStructHelper.js +10 -0
- package/dist/utils/discord.d.ts +1 -0
- package/dist/utils/discord.js +17 -0
- package/dist/utils/extraUtils.d.ts +22 -0
- package/dist/utils/extraUtils.js +85 -0
- package/dist/utils/idUtils.d.ts +13 -0
- package/dist/utils/idUtils.js +41 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/index.js +23 -0
- package/dist/utils/relaySigner.d.ts +21 -0
- package/dist/utils/relaySigner.js +69 -0
- package/package.json +80 -0
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { IntegrationTypes } from "@socket.tech/dl-core";
|
|
2
|
+
import { DataTypes, Model } from "sequelize";
|
|
3
|
+
export declare enum SealRelayStatus {
|
|
4
|
+
SEALED = "SEALED",
|
|
5
|
+
SEALING = "SEALING",
|
|
6
|
+
NO = "NO",
|
|
7
|
+
SEAL_FAILED = "SEAL_FAILED"
|
|
8
|
+
}
|
|
9
|
+
export declare enum PacketTripRelayStatus {
|
|
10
|
+
IS_TRIPPING = "IS_TRIPPING",
|
|
11
|
+
NO = "NO",
|
|
12
|
+
TRIPPING_FAILED = "TRIPPING_FAILED",
|
|
13
|
+
TRIPPED = "TRIPPED"
|
|
14
|
+
}
|
|
15
|
+
export declare enum ProposeRelayStatus {
|
|
16
|
+
PROPOSED = "PROPOSED",
|
|
17
|
+
PROPOSING = "PROPOSING",
|
|
18
|
+
CONFIRMING = "CONFIRMING",
|
|
19
|
+
NO = "NO",
|
|
20
|
+
PROPOSE_FAILED = "PROPOSE_FAILED",
|
|
21
|
+
CONFIRM_FAILED = "CONFIRM_FAILED"
|
|
22
|
+
}
|
|
23
|
+
export declare enum AttestRelayStatus {
|
|
24
|
+
ATTESTED = "ATTESTED",
|
|
25
|
+
ATTESTING = "ATTESTING",
|
|
26
|
+
NO = "NO",
|
|
27
|
+
ATTEST_FAILED = "ATTEST_FAILED"
|
|
28
|
+
}
|
|
29
|
+
export declare enum TripReason {
|
|
30
|
+
SWITCHBOARD_MISMATCHED = "SWITCHBOARD_MISMATCHED",
|
|
31
|
+
ROOT_MISMATCHED = "ROOT_MISMATCHED",
|
|
32
|
+
MISSING_SEAL = "MISSING_SEAL",
|
|
33
|
+
NO = "NO"
|
|
34
|
+
}
|
|
35
|
+
export declare class Packet extends Model {
|
|
36
|
+
id: number;
|
|
37
|
+
packetId: string;
|
|
38
|
+
srcChainSlug: number;
|
|
39
|
+
dstChainSlug: number;
|
|
40
|
+
srcCapacitor: string;
|
|
41
|
+
dstSwitchboard: string;
|
|
42
|
+
integrationType: IntegrationTypes;
|
|
43
|
+
capacitorPacketCount: string;
|
|
44
|
+
root: string;
|
|
45
|
+
rootSealed: string;
|
|
46
|
+
sealer: string;
|
|
47
|
+
sealTxHash: string;
|
|
48
|
+
sealTxId: string;
|
|
49
|
+
sealSignature: string;
|
|
50
|
+
sealTime: number;
|
|
51
|
+
sealRelayStatus: SealRelayStatus;
|
|
52
|
+
packetTripTime: number;
|
|
53
|
+
packetTripTxnHash: string;
|
|
54
|
+
packetTripErrorMessage: string;
|
|
55
|
+
isPacketTripped: boolean;
|
|
56
|
+
packetTripRelayStatus: PacketTripRelayStatus;
|
|
57
|
+
proposeTxId: string;
|
|
58
|
+
proposeTxHash: string;
|
|
59
|
+
proposeRelayStatus: ProposeRelayStatus;
|
|
60
|
+
selectedProposalCount: number;
|
|
61
|
+
attestTxId: string;
|
|
62
|
+
attestTxHash: string;
|
|
63
|
+
attestRelayStatus: AttestRelayStatus;
|
|
64
|
+
outboundTxHash: string;
|
|
65
|
+
outboundTime: number;
|
|
66
|
+
packetTripTxHash: string;
|
|
67
|
+
isFilled: boolean;
|
|
68
|
+
isSealed: boolean;
|
|
69
|
+
isProposed: boolean;
|
|
70
|
+
isAttested: boolean;
|
|
71
|
+
isVerified: boolean;
|
|
72
|
+
isFullyExecuted: boolean;
|
|
73
|
+
tripreason: TripReason;
|
|
74
|
+
}
|
|
75
|
+
export declare const PacketModel: {
|
|
76
|
+
id: {
|
|
77
|
+
type: DataTypes.IntegerDataTypeConstructor;
|
|
78
|
+
autoIncrement: boolean;
|
|
79
|
+
};
|
|
80
|
+
srcChainSlug: {
|
|
81
|
+
type: DataTypes.IntegerDataTypeConstructor;
|
|
82
|
+
};
|
|
83
|
+
dstChainSlug: {
|
|
84
|
+
type: DataTypes.IntegerDataTypeConstructor;
|
|
85
|
+
};
|
|
86
|
+
srcCapacitor: {
|
|
87
|
+
type: DataTypes.StringDataTypeConstructor;
|
|
88
|
+
};
|
|
89
|
+
dstSwitchboard: {
|
|
90
|
+
type: DataTypes.StringDataTypeConstructor;
|
|
91
|
+
};
|
|
92
|
+
integrationType: {
|
|
93
|
+
type: DataTypes.EnumDataTypeConstructor;
|
|
94
|
+
values: IntegrationTypes[];
|
|
95
|
+
defaultValue: IntegrationTypes;
|
|
96
|
+
};
|
|
97
|
+
packetId: {
|
|
98
|
+
type: DataTypes.StringDataTypeConstructor;
|
|
99
|
+
primaryKey: boolean;
|
|
100
|
+
};
|
|
101
|
+
capacitorPacketCount: {
|
|
102
|
+
type: DataTypes.StringDataTypeConstructor;
|
|
103
|
+
};
|
|
104
|
+
root: {
|
|
105
|
+
type: DataTypes.StringDataTypeConstructor;
|
|
106
|
+
};
|
|
107
|
+
rootSealed: {
|
|
108
|
+
type: DataTypes.StringDataTypeConstructor;
|
|
109
|
+
};
|
|
110
|
+
isFilled: {
|
|
111
|
+
type: DataTypes.AbstractDataTypeConstructor;
|
|
112
|
+
};
|
|
113
|
+
isSealed: {
|
|
114
|
+
type: DataTypes.AbstractDataTypeConstructor;
|
|
115
|
+
defaultValue: boolean;
|
|
116
|
+
};
|
|
117
|
+
isProposed: {
|
|
118
|
+
type: DataTypes.AbstractDataTypeConstructor;
|
|
119
|
+
defaultValue: boolean;
|
|
120
|
+
};
|
|
121
|
+
isAttested: {
|
|
122
|
+
type: DataTypes.AbstractDataTypeConstructor;
|
|
123
|
+
defaultValue: boolean;
|
|
124
|
+
};
|
|
125
|
+
isVerified: {
|
|
126
|
+
type: DataTypes.AbstractDataTypeConstructor;
|
|
127
|
+
defaultValue: boolean;
|
|
128
|
+
};
|
|
129
|
+
isFullyExecuted: {
|
|
130
|
+
type: DataTypes.AbstractDataTypeConstructor;
|
|
131
|
+
defaultValue: boolean;
|
|
132
|
+
};
|
|
133
|
+
sealer: {
|
|
134
|
+
type: DataTypes.StringDataTypeConstructor;
|
|
135
|
+
};
|
|
136
|
+
sealRelayStatus: {
|
|
137
|
+
type: DataTypes.EnumDataTypeConstructor;
|
|
138
|
+
values: SealRelayStatus[];
|
|
139
|
+
defaultValue: SealRelayStatus;
|
|
140
|
+
};
|
|
141
|
+
sealTxId: {
|
|
142
|
+
type: DataTypes.StringDataTypeConstructor;
|
|
143
|
+
defaultValue: string;
|
|
144
|
+
};
|
|
145
|
+
sealTxHash: {
|
|
146
|
+
type: DataTypes.StringDataTypeConstructor;
|
|
147
|
+
defaultValue: string;
|
|
148
|
+
};
|
|
149
|
+
outboundTxHash: {
|
|
150
|
+
type: DataTypes.StringDataTypeConstructor;
|
|
151
|
+
defaultValue: string;
|
|
152
|
+
};
|
|
153
|
+
outboundTime: {
|
|
154
|
+
type: DataTypes.IntegerDataTypeConstructor;
|
|
155
|
+
};
|
|
156
|
+
sealTime: {
|
|
157
|
+
type: DataTypes.IntegerDataTypeConstructor;
|
|
158
|
+
};
|
|
159
|
+
sealSignature: {
|
|
160
|
+
type: DataTypes.StringDataTypeConstructor;
|
|
161
|
+
};
|
|
162
|
+
packetTripRelayStatus: {
|
|
163
|
+
type: DataTypes.EnumDataTypeConstructor;
|
|
164
|
+
values: PacketTripRelayStatus[];
|
|
165
|
+
defaultValue: PacketTripRelayStatus;
|
|
166
|
+
};
|
|
167
|
+
packetTripTxId: {
|
|
168
|
+
type: DataTypes.StringDataTypeConstructor;
|
|
169
|
+
defaultValue: string;
|
|
170
|
+
};
|
|
171
|
+
packetTripTxHash: {
|
|
172
|
+
type: DataTypes.StringDataTypeConstructor;
|
|
173
|
+
defaultValue: string;
|
|
174
|
+
};
|
|
175
|
+
packetTripErrorMessage: {
|
|
176
|
+
type: DataTypes.StringDataTypeConstructor;
|
|
177
|
+
defaultValue: string;
|
|
178
|
+
};
|
|
179
|
+
packetTripTime: {
|
|
180
|
+
type: DataTypes.IntegerDataTypeConstructor;
|
|
181
|
+
};
|
|
182
|
+
isPacketTripped: {
|
|
183
|
+
type: DataTypes.AbstractDataTypeConstructor;
|
|
184
|
+
defaultValue: boolean;
|
|
185
|
+
};
|
|
186
|
+
proposeTxId: {
|
|
187
|
+
type: DataTypes.StringDataTypeConstructor;
|
|
188
|
+
defaultValue: string;
|
|
189
|
+
};
|
|
190
|
+
proposeTxHash: {
|
|
191
|
+
type: DataTypes.StringDataTypeConstructor;
|
|
192
|
+
defaultValue: string;
|
|
193
|
+
};
|
|
194
|
+
proposeRelayStatus: {
|
|
195
|
+
type: DataTypes.EnumDataTypeConstructor;
|
|
196
|
+
values: ProposeRelayStatus[];
|
|
197
|
+
defaultValue: ProposeRelayStatus;
|
|
198
|
+
};
|
|
199
|
+
selectedProposalCount: {
|
|
200
|
+
type: DataTypes.IntegerDataTypeConstructor;
|
|
201
|
+
};
|
|
202
|
+
attestTxId: {
|
|
203
|
+
type: DataTypes.StringDataTypeConstructor;
|
|
204
|
+
defaultValue: string;
|
|
205
|
+
};
|
|
206
|
+
attestTxHash: {
|
|
207
|
+
type: DataTypes.StringDataTypeConstructor;
|
|
208
|
+
defaultValue: string;
|
|
209
|
+
};
|
|
210
|
+
tripReason: {
|
|
211
|
+
type: DataTypes.EnumDataTypeConstructor;
|
|
212
|
+
values: TripReason[];
|
|
213
|
+
defaultValue: TripReason;
|
|
214
|
+
};
|
|
215
|
+
attestRelayStatus: {
|
|
216
|
+
type: DataTypes.EnumDataTypeConstructor;
|
|
217
|
+
values: AttestRelayStatus[];
|
|
218
|
+
defaultValue: AttestRelayStatus;
|
|
219
|
+
};
|
|
220
|
+
};
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
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
|
+
var SealRelayStatus;
|
|
7
|
+
(function (SealRelayStatus) {
|
|
8
|
+
SealRelayStatus["SEALED"] = "SEALED";
|
|
9
|
+
SealRelayStatus["SEALING"] = "SEALING";
|
|
10
|
+
SealRelayStatus["NO"] = "NO";
|
|
11
|
+
SealRelayStatus["SEAL_FAILED"] = "SEAL_FAILED";
|
|
12
|
+
})(SealRelayStatus || (exports.SealRelayStatus = SealRelayStatus = {}));
|
|
13
|
+
var PacketTripRelayStatus;
|
|
14
|
+
(function (PacketTripRelayStatus) {
|
|
15
|
+
PacketTripRelayStatus["IS_TRIPPING"] = "IS_TRIPPING";
|
|
16
|
+
PacketTripRelayStatus["NO"] = "NO";
|
|
17
|
+
PacketTripRelayStatus["TRIPPING_FAILED"] = "TRIPPING_FAILED";
|
|
18
|
+
PacketTripRelayStatus["TRIPPED"] = "TRIPPED";
|
|
19
|
+
})(PacketTripRelayStatus || (exports.PacketTripRelayStatus = PacketTripRelayStatus = {}));
|
|
20
|
+
var ProposeRelayStatus;
|
|
21
|
+
(function (ProposeRelayStatus) {
|
|
22
|
+
ProposeRelayStatus["PROPOSED"] = "PROPOSED";
|
|
23
|
+
ProposeRelayStatus["PROPOSING"] = "PROPOSING";
|
|
24
|
+
ProposeRelayStatus["CONFIRMING"] = "CONFIRMING";
|
|
25
|
+
ProposeRelayStatus["NO"] = "NO";
|
|
26
|
+
ProposeRelayStatus["PROPOSE_FAILED"] = "PROPOSE_FAILED";
|
|
27
|
+
ProposeRelayStatus["CONFIRM_FAILED"] = "CONFIRM_FAILED";
|
|
28
|
+
})(ProposeRelayStatus || (exports.ProposeRelayStatus = ProposeRelayStatus = {}));
|
|
29
|
+
var AttestRelayStatus;
|
|
30
|
+
(function (AttestRelayStatus) {
|
|
31
|
+
AttestRelayStatus["ATTESTED"] = "ATTESTED";
|
|
32
|
+
AttestRelayStatus["ATTESTING"] = "ATTESTING";
|
|
33
|
+
AttestRelayStatus["NO"] = "NO";
|
|
34
|
+
AttestRelayStatus["ATTEST_FAILED"] = "ATTEST_FAILED";
|
|
35
|
+
})(AttestRelayStatus || (exports.AttestRelayStatus = AttestRelayStatus = {}));
|
|
36
|
+
var TripReason;
|
|
37
|
+
(function (TripReason) {
|
|
38
|
+
TripReason["SWITCHBOARD_MISMATCHED"] = "SWITCHBOARD_MISMATCHED";
|
|
39
|
+
TripReason["ROOT_MISMATCHED"] = "ROOT_MISMATCHED";
|
|
40
|
+
TripReason["MISSING_SEAL"] = "MISSING_SEAL";
|
|
41
|
+
TripReason["NO"] = "NO";
|
|
42
|
+
})(TripReason || (exports.TripReason = TripReason = {}));
|
|
43
|
+
class Packet extends sequelize_1.Model {
|
|
44
|
+
}
|
|
45
|
+
exports.Packet = Packet;
|
|
46
|
+
exports.PacketModel = {
|
|
47
|
+
id: {
|
|
48
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
49
|
+
autoIncrement: true,
|
|
50
|
+
},
|
|
51
|
+
srcChainSlug: {
|
|
52
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
53
|
+
},
|
|
54
|
+
dstChainSlug: {
|
|
55
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
56
|
+
},
|
|
57
|
+
srcCapacitor: {
|
|
58
|
+
type: sequelize_1.DataTypes.STRING,
|
|
59
|
+
},
|
|
60
|
+
dstSwitchboard: {
|
|
61
|
+
type: sequelize_1.DataTypes.STRING,
|
|
62
|
+
},
|
|
63
|
+
integrationType: {
|
|
64
|
+
type: sequelize_1.DataTypes.ENUM,
|
|
65
|
+
values: [...Object.values(dl_core_1.IntegrationTypes)],
|
|
66
|
+
defaultValue: dl_core_1.IntegrationTypes.unknown,
|
|
67
|
+
},
|
|
68
|
+
packetId: {
|
|
69
|
+
type: sequelize_1.DataTypes.STRING,
|
|
70
|
+
primaryKey: true,
|
|
71
|
+
},
|
|
72
|
+
capacitorPacketCount: {
|
|
73
|
+
type: sequelize_1.DataTypes.STRING,
|
|
74
|
+
},
|
|
75
|
+
root: {
|
|
76
|
+
type: sequelize_1.DataTypes.STRING,
|
|
77
|
+
},
|
|
78
|
+
rootSealed: {
|
|
79
|
+
type: sequelize_1.DataTypes.STRING,
|
|
80
|
+
},
|
|
81
|
+
isFilled: {
|
|
82
|
+
type: sequelize_1.DataTypes.BOOLEAN,
|
|
83
|
+
},
|
|
84
|
+
isSealed: {
|
|
85
|
+
type: sequelize_1.DataTypes.BOOLEAN,
|
|
86
|
+
defaultValue: false,
|
|
87
|
+
},
|
|
88
|
+
isProposed: {
|
|
89
|
+
type: sequelize_1.DataTypes.BOOLEAN,
|
|
90
|
+
defaultValue: false,
|
|
91
|
+
},
|
|
92
|
+
isAttested: {
|
|
93
|
+
type: sequelize_1.DataTypes.BOOLEAN,
|
|
94
|
+
defaultValue: false,
|
|
95
|
+
},
|
|
96
|
+
isVerified: {
|
|
97
|
+
type: sequelize_1.DataTypes.BOOLEAN,
|
|
98
|
+
defaultValue: false,
|
|
99
|
+
},
|
|
100
|
+
isFullyExecuted: {
|
|
101
|
+
type: sequelize_1.DataTypes.BOOLEAN,
|
|
102
|
+
defaultValue: false,
|
|
103
|
+
},
|
|
104
|
+
sealer: {
|
|
105
|
+
type: sequelize_1.DataTypes.STRING,
|
|
106
|
+
},
|
|
107
|
+
sealRelayStatus: {
|
|
108
|
+
type: sequelize_1.DataTypes.ENUM,
|
|
109
|
+
values: [...Object.values(SealRelayStatus)],
|
|
110
|
+
defaultValue: SealRelayStatus.NO,
|
|
111
|
+
},
|
|
112
|
+
sealTxId: {
|
|
113
|
+
type: sequelize_1.DataTypes.STRING,
|
|
114
|
+
defaultValue: "",
|
|
115
|
+
},
|
|
116
|
+
sealTxHash: {
|
|
117
|
+
type: sequelize_1.DataTypes.STRING,
|
|
118
|
+
defaultValue: "",
|
|
119
|
+
},
|
|
120
|
+
outboundTxHash: {
|
|
121
|
+
type: sequelize_1.DataTypes.STRING,
|
|
122
|
+
defaultValue: "",
|
|
123
|
+
},
|
|
124
|
+
outboundTime: {
|
|
125
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
126
|
+
},
|
|
127
|
+
sealTime: {
|
|
128
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
129
|
+
},
|
|
130
|
+
sealSignature: {
|
|
131
|
+
type: sequelize_1.DataTypes.STRING,
|
|
132
|
+
},
|
|
133
|
+
packetTripRelayStatus: {
|
|
134
|
+
type: sequelize_1.DataTypes.ENUM,
|
|
135
|
+
values: [...Object.values(PacketTripRelayStatus)],
|
|
136
|
+
defaultValue: PacketTripRelayStatus.NO,
|
|
137
|
+
},
|
|
138
|
+
packetTripTxId: {
|
|
139
|
+
type: sequelize_1.DataTypes.STRING,
|
|
140
|
+
defaultValue: "",
|
|
141
|
+
},
|
|
142
|
+
packetTripTxHash: {
|
|
143
|
+
type: sequelize_1.DataTypes.STRING,
|
|
144
|
+
defaultValue: "",
|
|
145
|
+
},
|
|
146
|
+
packetTripErrorMessage: {
|
|
147
|
+
type: sequelize_1.DataTypes.STRING,
|
|
148
|
+
defaultValue: "",
|
|
149
|
+
},
|
|
150
|
+
packetTripTime: {
|
|
151
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
152
|
+
},
|
|
153
|
+
isPacketTripped: {
|
|
154
|
+
type: sequelize_1.DataTypes.BOOLEAN,
|
|
155
|
+
defaultValue: false,
|
|
156
|
+
},
|
|
157
|
+
proposeTxId: {
|
|
158
|
+
type: sequelize_1.DataTypes.STRING,
|
|
159
|
+
defaultValue: "",
|
|
160
|
+
},
|
|
161
|
+
proposeTxHash: {
|
|
162
|
+
type: sequelize_1.DataTypes.STRING,
|
|
163
|
+
defaultValue: "",
|
|
164
|
+
},
|
|
165
|
+
proposeRelayStatus: {
|
|
166
|
+
type: sequelize_1.DataTypes.ENUM,
|
|
167
|
+
values: [...Object.values(ProposeRelayStatus)],
|
|
168
|
+
defaultValue: ProposeRelayStatus.NO,
|
|
169
|
+
},
|
|
170
|
+
selectedProposalCount: {
|
|
171
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
172
|
+
},
|
|
173
|
+
attestTxId: {
|
|
174
|
+
type: sequelize_1.DataTypes.STRING,
|
|
175
|
+
defaultValue: "",
|
|
176
|
+
},
|
|
177
|
+
attestTxHash: {
|
|
178
|
+
type: sequelize_1.DataTypes.STRING,
|
|
179
|
+
defaultValue: "",
|
|
180
|
+
},
|
|
181
|
+
tripReason: {
|
|
182
|
+
type: sequelize_1.DataTypes.ENUM,
|
|
183
|
+
values: [...Object.values(TripReason)],
|
|
184
|
+
defaultValue: TripReason.NO,
|
|
185
|
+
},
|
|
186
|
+
// packetTripTxHash: {
|
|
187
|
+
// type: DataTypes.STRING,
|
|
188
|
+
// defaultValue: "",
|
|
189
|
+
// },
|
|
190
|
+
attestRelayStatus: {
|
|
191
|
+
type: sequelize_1.DataTypes.ENUM,
|
|
192
|
+
values: [...Object.values(AttestRelayStatus)],
|
|
193
|
+
defaultValue: AttestRelayStatus.NO,
|
|
194
|
+
},
|
|
195
|
+
};
|
|
@@ -0,0 +1,126 @@
|
|
|
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.IntegerDataTypeConstructor;
|
|
55
|
+
};
|
|
56
|
+
dstChainSlug: {
|
|
57
|
+
type: DataTypes.IntegerDataTypeConstructor;
|
|
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
|
+
};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProposalModel = exports.Proposal = exports.ProposalTripRelayStatus = exports.MatchState = exports.RootMatchState = exports.TripStatus = void 0;
|
|
4
|
+
const sequelize_1 = require("sequelize");
|
|
5
|
+
var TripStatus;
|
|
6
|
+
(function (TripStatus) {
|
|
7
|
+
TripStatus["TRIP_REQUIRED"] = "TRIP_REQUIRED";
|
|
8
|
+
TripStatus["TRIP_INITIATED"] = "TRIP_INITIATED";
|
|
9
|
+
TripStatus["TRIP_SUCCESSFUL"] = "TRIP_SUCCESSFUL";
|
|
10
|
+
TripStatus["TRIP_FAILED"] = "TRIP_FAILED";
|
|
11
|
+
TripStatus["NO"] = "NO";
|
|
12
|
+
})(TripStatus || (exports.TripStatus = TripStatus = {}));
|
|
13
|
+
var RootMatchState;
|
|
14
|
+
(function (RootMatchState) {
|
|
15
|
+
RootMatchState["ROOTS_MATCHED"] = "ROOTS_MATCHED";
|
|
16
|
+
RootMatchState["ROOTS_MISMATCHED"] = "ROOTS_MISMATCHED";
|
|
17
|
+
RootMatchState["NO"] = "NO";
|
|
18
|
+
})(RootMatchState || (exports.RootMatchState = RootMatchState = {}));
|
|
19
|
+
var MatchState;
|
|
20
|
+
(function (MatchState) {
|
|
21
|
+
MatchState["MATCHED"] = "MATCHED";
|
|
22
|
+
MatchState["MISMATCHED"] = "MISMATCHED";
|
|
23
|
+
MatchState["NO"] = "NO";
|
|
24
|
+
})(MatchState || (exports.MatchState = MatchState = {}));
|
|
25
|
+
var ProposalTripRelayStatus;
|
|
26
|
+
(function (ProposalTripRelayStatus) {
|
|
27
|
+
ProposalTripRelayStatus["IS_TRIPPING"] = "IS_TRIPPING";
|
|
28
|
+
ProposalTripRelayStatus["NO"] = "NO";
|
|
29
|
+
ProposalTripRelayStatus["TRIPPING_FAILED"] = "TRIPPING_FAILED";
|
|
30
|
+
ProposalTripRelayStatus["TRIPPED"] = "TRIPPED";
|
|
31
|
+
})(ProposalTripRelayStatus || (exports.ProposalTripRelayStatus = ProposalTripRelayStatus = {}));
|
|
32
|
+
class Proposal extends sequelize_1.Model {
|
|
33
|
+
}
|
|
34
|
+
exports.Proposal = Proposal;
|
|
35
|
+
exports.ProposalModel = {
|
|
36
|
+
id: {
|
|
37
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
38
|
+
autoIncrement: true,
|
|
39
|
+
primaryKey: true,
|
|
40
|
+
},
|
|
41
|
+
srcChainSlug: {
|
|
42
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
43
|
+
},
|
|
44
|
+
dstChainSlug: {
|
|
45
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
46
|
+
},
|
|
47
|
+
packetId: {
|
|
48
|
+
type: sequelize_1.DataTypes.STRING,
|
|
49
|
+
unique: "uniqueProposalPointer",
|
|
50
|
+
},
|
|
51
|
+
proposalCount: {
|
|
52
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
53
|
+
unique: "uniqueProposalPointer",
|
|
54
|
+
},
|
|
55
|
+
root: {
|
|
56
|
+
type: sequelize_1.DataTypes.STRING,
|
|
57
|
+
},
|
|
58
|
+
switchboard: {
|
|
59
|
+
type: sequelize_1.DataTypes.STRING,
|
|
60
|
+
unique: "uniqueProposalPointer",
|
|
61
|
+
},
|
|
62
|
+
proposer: {
|
|
63
|
+
type: sequelize_1.DataTypes.STRING,
|
|
64
|
+
},
|
|
65
|
+
proposeTxHash: {
|
|
66
|
+
type: sequelize_1.DataTypes.STRING,
|
|
67
|
+
defaultValue: "",
|
|
68
|
+
},
|
|
69
|
+
proposeTime: {
|
|
70
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
71
|
+
},
|
|
72
|
+
tripTxId: {
|
|
73
|
+
type: sequelize_1.DataTypes.STRING,
|
|
74
|
+
defaultValue: "",
|
|
75
|
+
},
|
|
76
|
+
tripTxHash: {
|
|
77
|
+
type: sequelize_1.DataTypes.STRING,
|
|
78
|
+
defaultValue: "",
|
|
79
|
+
},
|
|
80
|
+
tripTime: {
|
|
81
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
82
|
+
},
|
|
83
|
+
tripErrorMessage: {
|
|
84
|
+
type: sequelize_1.DataTypes.STRING,
|
|
85
|
+
defaultValue: "",
|
|
86
|
+
},
|
|
87
|
+
isTripped: {
|
|
88
|
+
type: sequelize_1.DataTypes.BOOLEAN,
|
|
89
|
+
defaultValue: false,
|
|
90
|
+
},
|
|
91
|
+
tripRelayStatus: {
|
|
92
|
+
type: sequelize_1.DataTypes.ENUM,
|
|
93
|
+
values: [...Object.values(ProposalTripRelayStatus)],
|
|
94
|
+
defaultValue: ProposalTripRelayStatus.NO,
|
|
95
|
+
},
|
|
96
|
+
totalAttestations: {
|
|
97
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
98
|
+
defaultValue: 0,
|
|
99
|
+
},
|
|
100
|
+
rootMatchState: {
|
|
101
|
+
type: sequelize_1.DataTypes.ENUM,
|
|
102
|
+
values: [...Object.values(RootMatchState)],
|
|
103
|
+
defaultValue: RootMatchState.NO,
|
|
104
|
+
},
|
|
105
|
+
switchboardMatchState: {
|
|
106
|
+
type: sequelize_1.DataTypes.ENUM,
|
|
107
|
+
values: [...Object.values(MatchState)],
|
|
108
|
+
defaultValue: MatchState.NO,
|
|
109
|
+
},
|
|
110
|
+
isTripRequired: {
|
|
111
|
+
type: sequelize_1.DataTypes.BOOLEAN,
|
|
112
|
+
defaultValue: false,
|
|
113
|
+
},
|
|
114
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare let client: any;
|
|
2
|
+
export declare const initCache: (host: string, port: number, password: string, stage: string) => void;
|
|
3
|
+
export declare const formatKey: (key: string) => string;
|
|
4
|
+
export declare const getKey: (key: string) => Promise<any>;
|
|
5
|
+
export declare const lock: (key: string, expire?: number) => Promise<boolean>;
|
|
6
|
+
export declare const deleteKey: (key: string) => Promise<void>;
|
|
7
|
+
export declare const unlock: (key: string) => Promise<void>;
|
|
8
|
+
export declare const setKey: (key: string, value: any, expire?: number, setIfNotExist?: boolean) => Promise<boolean>;
|
|
9
|
+
export declare const rpush: (key: string, values: any[]) => Promise<any>;
|
|
10
|
+
export declare const lpop: (key: string) => Promise<any>;
|
|
11
|
+
export declare const getListLength: (key: string) => Promise<any>;
|
|
12
|
+
export declare const increment: (key: string) => Promise<any>;
|
|
13
|
+
export declare const decrement: (key: string) => Promise<any>;
|
|
14
|
+
export declare const sendCommand: (command: string, params: any[]) => Promise<any>;
|