@socket.tech/dl-common 1.0.3-test.4 → 1.0.3-test.6
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.
|
@@ -15,7 +15,11 @@ export declare enum MessageStatuses {
|
|
|
15
15
|
PROPOSED = "PROPOSED",
|
|
16
16
|
CONFIRMED = "CONFIRMED",
|
|
17
17
|
EXECUTION_SUCCESS = "EXECUTION_SUCCESS",
|
|
18
|
-
EXECUTION_FAILURE = "EXECUTION_FAILURE"
|
|
18
|
+
EXECUTION_FAILURE = "EXECUTION_FAILURE",
|
|
19
|
+
VERIFIED = "VERIFIED",
|
|
20
|
+
ATTESTED = "ATTESTED",
|
|
21
|
+
EXECUTING = "EXECUTING",
|
|
22
|
+
INBOUND_REVERTING = "INBOUND_REVERTING"
|
|
19
23
|
}
|
|
20
24
|
export declare enum MessageStatusStep {
|
|
21
25
|
RECEIVED = 0,
|
package/dist/constants/enums.js
CHANGED
|
@@ -21,6 +21,10 @@ var MessageStatuses;
|
|
|
21
21
|
MessageStatuses["CONFIRMED"] = "CONFIRMED";
|
|
22
22
|
MessageStatuses["EXECUTION_SUCCESS"] = "EXECUTION_SUCCESS";
|
|
23
23
|
MessageStatuses["EXECUTION_FAILURE"] = "EXECUTION_FAILURE";
|
|
24
|
+
MessageStatuses["VERIFIED"] = "VERIFIED";
|
|
25
|
+
MessageStatuses["ATTESTED"] = "ATTESTED";
|
|
26
|
+
MessageStatuses["EXECUTING"] = "EXECUTING";
|
|
27
|
+
MessageStatuses["INBOUND_REVERTING"] = "INBOUND_REVERTING";
|
|
24
28
|
})(MessageStatuses || (exports.MessageStatuses = MessageStatuses = {}));
|
|
25
29
|
var MessageStatusStep;
|
|
26
30
|
(function (MessageStatusStep) {
|
|
@@ -0,0 +1,61 @@
|
|
|
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
|
+
srcChainSlug: number;
|
|
10
|
+
dstChainSlug: number;
|
|
11
|
+
maxPacketLength: number;
|
|
12
|
+
srcSwitchboard: string;
|
|
13
|
+
dstSwitchboard: string;
|
|
14
|
+
srcCapacitor: string;
|
|
15
|
+
capacitorType: CapacitorType;
|
|
16
|
+
isEnabled: boolean;
|
|
17
|
+
integrationType: IntegrationTypes;
|
|
18
|
+
}
|
|
19
|
+
export declare const SwitchboardModel: {
|
|
20
|
+
id: {
|
|
21
|
+
type: DataTypes.IntegerDataTypeConstructor;
|
|
22
|
+
autoIncrement: boolean;
|
|
23
|
+
primaryKey: boolean;
|
|
24
|
+
};
|
|
25
|
+
srcChainSlug: {
|
|
26
|
+
type: DataTypes.IntegerDataTypeConstructor;
|
|
27
|
+
unique: string;
|
|
28
|
+
};
|
|
29
|
+
dstChainSlug: {
|
|
30
|
+
type: DataTypes.IntegerDataTypeConstructor;
|
|
31
|
+
unique: string;
|
|
32
|
+
};
|
|
33
|
+
maxPacketLength: {
|
|
34
|
+
type: DataTypes.IntegerDataTypeConstructor;
|
|
35
|
+
};
|
|
36
|
+
srcSwitchboard: {
|
|
37
|
+
type: DataTypes.StringDataTypeConstructor;
|
|
38
|
+
unique: string;
|
|
39
|
+
};
|
|
40
|
+
dstSwitchboard: {
|
|
41
|
+
type: DataTypes.StringDataTypeConstructor;
|
|
42
|
+
};
|
|
43
|
+
srcCapacitor: {
|
|
44
|
+
type: DataTypes.StringDataTypeConstructor;
|
|
45
|
+
};
|
|
46
|
+
capacitorType: {
|
|
47
|
+
type: DataTypes.EnumDataTypeConstructor;
|
|
48
|
+
values: CapacitorType[];
|
|
49
|
+
defaultValue: CapacitorType;
|
|
50
|
+
};
|
|
51
|
+
isEnabled: {
|
|
52
|
+
type: DataTypes.AbstractDataTypeConstructor;
|
|
53
|
+
defaultValue: boolean;
|
|
54
|
+
};
|
|
55
|
+
integrationType: {
|
|
56
|
+
type: DataTypes.EnumDataTypeConstructor;
|
|
57
|
+
values: IntegrationTypes[];
|
|
58
|
+
defaultValue: IntegrationTypes;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
export declare const addSwitchboardHooks: () => Promise<void>;
|
|
@@ -0,0 +1,75 @@
|
|
|
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
|
+
var CapacitorType;
|
|
7
|
+
(function (CapacitorType) {
|
|
8
|
+
CapacitorType["singleCapacitor"] = "1";
|
|
9
|
+
CapacitorType["hashChainCapacitor"] = "2";
|
|
10
|
+
})(CapacitorType || (exports.CapacitorType = CapacitorType = {}));
|
|
11
|
+
class Switchboard extends sequelize_1.Model {
|
|
12
|
+
}
|
|
13
|
+
exports.Switchboard = Switchboard;
|
|
14
|
+
exports.SwitchboardModel = {
|
|
15
|
+
id: {
|
|
16
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
17
|
+
autoIncrement: true,
|
|
18
|
+
primaryKey: true,
|
|
19
|
+
},
|
|
20
|
+
srcChainSlug: {
|
|
21
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
22
|
+
unique: "uniqueSwitchboardPointer",
|
|
23
|
+
},
|
|
24
|
+
dstChainSlug: {
|
|
25
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
26
|
+
unique: "uniqueSwitchboardPointer",
|
|
27
|
+
},
|
|
28
|
+
maxPacketLength: {
|
|
29
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
30
|
+
},
|
|
31
|
+
srcSwitchboard: {
|
|
32
|
+
type: sequelize_1.DataTypes.STRING,
|
|
33
|
+
unique: "uniqueSwitchboardPointer",
|
|
34
|
+
},
|
|
35
|
+
dstSwitchboard: {
|
|
36
|
+
type: sequelize_1.DataTypes.STRING,
|
|
37
|
+
},
|
|
38
|
+
srcCapacitor: {
|
|
39
|
+
type: sequelize_1.DataTypes.STRING,
|
|
40
|
+
},
|
|
41
|
+
capacitorType: {
|
|
42
|
+
type: sequelize_1.DataTypes.ENUM,
|
|
43
|
+
values: [...Object.values(CapacitorType)],
|
|
44
|
+
defaultValue: CapacitorType.singleCapacitor,
|
|
45
|
+
},
|
|
46
|
+
isEnabled: {
|
|
47
|
+
type: sequelize_1.DataTypes.BOOLEAN,
|
|
48
|
+
defaultValue: false,
|
|
49
|
+
},
|
|
50
|
+
integrationType: {
|
|
51
|
+
type: sequelize_1.DataTypes.ENUM,
|
|
52
|
+
values: [...Object.values(dl_core_1.IntegrationTypes)],
|
|
53
|
+
defaultValue: dl_core_1.IntegrationTypes.unknown,
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
const addSwitchboardHooks = async () => {
|
|
57
|
+
Switchboard.beforeBulkCreate((switchboards, options) => {
|
|
58
|
+
for (let index = 0; index < switchboards.length; index++) {
|
|
59
|
+
switchboards[index] = processStrings(switchboards[index]);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
Switchboard.beforeSave((switchboard, options) => {
|
|
63
|
+
switchboard = processStrings(switchboard);
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
exports.addSwitchboardHooks = addSwitchboardHooks;
|
|
67
|
+
function processStrings(switchboard) {
|
|
68
|
+
if (switchboard.srcSwitchboard)
|
|
69
|
+
switchboard.srcSwitchboard = switchboard.srcSwitchboard.toLowerCase();
|
|
70
|
+
if (switchboard.dstSwitchboard)
|
|
71
|
+
switchboard.dstSwitchboard = switchboard.dstSwitchboard.toLowerCase();
|
|
72
|
+
if (switchboard.srcCapacitor)
|
|
73
|
+
switchboard.srcCapacitor = switchboard.srcCapacitor.toLowerCase();
|
|
74
|
+
return switchboard;
|
|
75
|
+
}
|