@socket.tech/dl-common 1.0.3-test.35 → 1.0.3-test.36

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.
@@ -37,3 +37,7 @@ export declare enum StatusCodes {
37
37
  INTERNAL_SERVER_ERROR = "INTERNAL_SERVER_ERROR",
38
38
  RATE_LIMIT_EXCEEDED = "RATE_LIMIT_EXCEEDED"
39
39
  }
40
+ export declare enum Accounts {
41
+ dl = "dl",
42
+ ll = "ll"
43
+ }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StatusCodes = exports.MessageStatusStep = exports.MessageStatuses = exports.tableNames = void 0;
3
+ exports.Accounts = exports.StatusCodes = exports.MessageStatusStep = exports.MessageStatuses = exports.tableNames = void 0;
4
4
  var tableNames;
5
5
  (function (tableNames) {
6
6
  tableNames["packet"] = "packets";
@@ -44,3 +44,8 @@ var StatusCodes;
44
44
  StatusCodes["INTERNAL_SERVER_ERROR"] = "INTERNAL_SERVER_ERROR";
45
45
  StatusCodes["RATE_LIMIT_EXCEEDED"] = "RATE_LIMIT_EXCEEDED";
46
46
  })(StatusCodes || (exports.StatusCodes = StatusCodes = {}));
47
+ var Accounts;
48
+ (function (Accounts) {
49
+ Accounts["dl"] = "dl";
50
+ Accounts["ll"] = "ll";
51
+ })(Accounts || (exports.Accounts = Accounts = {}));
File without changes
@@ -0,0 +1,280 @@
1
+ "use strict";
2
+ // import { IntegrationTypes } from "@socket.tech/dl-core";
3
+ // import { DataTypes, Model } from "sequelize";
4
+ // import { toLowerCase } from "../utils";
5
+ // import {Project} from "@socket.tech/socket-plugs";
6
+ // export enum SealRelayStatus {
7
+ // SEALED = "SEALED",
8
+ // SEALING = "SEALING",
9
+ // NO = "NO",
10
+ // SEAL_FAILED = "SEAL_FAILED",
11
+ // }
12
+ // export enum PacketTripRelayStatus {
13
+ // IS_TRIPPING = "IS_TRIPPING",
14
+ // NO = "NO",
15
+ // TRIPPING_FAILED = "TRIPPING_FAILED",
16
+ // TRIPPED = "TRIPPED",
17
+ // }
18
+ // export enum ProposeRelayStatus {
19
+ // PROPOSED = "PROPOSED",
20
+ // PROPOSING = "PROPOSING",
21
+ // CONFIRMING = "CONFIRMING",
22
+ // NO = "NO",
23
+ // PROPOSE_FAILED = "PROPOSE_FAILED",
24
+ // CONFIRM_FAILED = "CONFIRM_FAILED",
25
+ // }
26
+ // export enum TxType {
27
+ // SUPERBRIDGE = "SUPERBRIDGE",
28
+ // SUPERTOKEN = "SUPERTOKEN"
29
+ // }
30
+ // export class Transaction extends Model {
31
+ // declare id: number;
32
+ // srcChainSlug: number;
33
+ // dstChainSlug: number;
34
+ // from: string;
35
+ // to:string;
36
+ // amount:number;
37
+ // token: string;
38
+ // tokenAddress: string;
39
+ // srcPlug: string;
40
+ // dstPlug: string;
41
+ // usdAmount: number;
42
+ // type: TxType;
43
+ // project: Project;
44
+ // srcTxHash: string;
45
+ // txTime: string;
46
+ // root: string;
47
+ // rootSealed: string;
48
+ // sealer: string;
49
+ // sealTxHash: string;
50
+ // sealTxId: string;
51
+ // sealSignature: string;
52
+ // sealTime: number;
53
+ // sealRelayStatus: SealRelayStatus;
54
+ // packetTripTime: number;
55
+ // packetTripTxnHash: string;
56
+ // packetTripErrorMessage: string;
57
+ // isPacketTripped: boolean;
58
+ // packetTripRelayStatus: PacketTripRelayStatus;
59
+ // // proposeTxId, proposeTxHash refers to the proposal sent by us. For details of other proposals, see Proposal table.
60
+ // proposeTxId: string;
61
+ // proposeTxHash: string;
62
+ // proposeRelayStatus: ProposeRelayStatus;
63
+ // selectedProposalCount: number;
64
+ // // attestTxId, attestTxHash refers to the attestation sent by us. For details of other attestations, see Attestation table.
65
+ // attestTxId: string;
66
+ // attestTxHash: string;
67
+ // attestRelayStatus: AttestRelayStatus;
68
+ // outboundTxHash: string;
69
+ // outboundTime: number;
70
+ // sealIndexTime: number;
71
+ // proposeTime: number;
72
+ // attestTime: number;
73
+ // packetTripTxHash: string;
74
+ // isFilled: boolean;
75
+ // isSealed: boolean;
76
+ // isProposed: boolean;
77
+ // isAttested: boolean;
78
+ // isVerified: boolean;
79
+ // isFullyExecuted: boolean;
80
+ // tripreason: TripReason;
81
+ // executionWaitTime: number;
82
+ // }
83
+ // export const PacketModel = {
84
+ // id: {
85
+ // type: DataTypes.INTEGER,
86
+ // autoIncrement: true,
87
+ // },
88
+ // srcChainSlug: {
89
+ // type: DataTypes.BIGINT,
90
+ // },
91
+ // dstChainSlug: {
92
+ // type: DataTypes.BIGINT,
93
+ // },
94
+ // srcCapacitor: {
95
+ // type: DataTypes.STRING,
96
+ // },
97
+ // dstSwitchboard: {
98
+ // type: DataTypes.STRING,
99
+ // },
100
+ // switchboardId: {
101
+ // type: DataTypes.STRING,
102
+ // },
103
+ // integrationType: {
104
+ // type: DataTypes.ENUM,
105
+ // values: [...Object.values(IntegrationTypes)],
106
+ // defaultValue: IntegrationTypes.unknown,
107
+ // },
108
+ // packetId: {
109
+ // type: DataTypes.STRING,
110
+ // primaryKey: true,
111
+ // },
112
+ // capacitorPacketCount: {
113
+ // type: DataTypes.STRING,
114
+ // },
115
+ // root: {
116
+ // type: DataTypes.STRING,
117
+ // },
118
+ // rootSealed: {
119
+ // type: DataTypes.STRING,
120
+ // },
121
+ // isFilled: {
122
+ // type: DataTypes.BOOLEAN,
123
+ // },
124
+ // isSealed: {
125
+ // type: DataTypes.BOOLEAN,
126
+ // defaultValue: false,
127
+ // },
128
+ // isProposed: {
129
+ // type: DataTypes.BOOLEAN,
130
+ // defaultValue: false,
131
+ // },
132
+ // isAttested: {
133
+ // type: DataTypes.BOOLEAN,
134
+ // defaultValue: false,
135
+ // },
136
+ // isVerified: {
137
+ // type: DataTypes.BOOLEAN,
138
+ // defaultValue: false,
139
+ // },
140
+ // isFullyExecuted: {
141
+ // type: DataTypes.BOOLEAN,
142
+ // defaultValue: false,
143
+ // },
144
+ // sealer: {
145
+ // type: DataTypes.STRING,
146
+ // },
147
+ // sealRelayStatus: {
148
+ // type: DataTypes.ENUM,
149
+ // values: [...Object.values(SealRelayStatus)],
150
+ // defaultValue: SealRelayStatus.NO,
151
+ // },
152
+ // sealTxId: {
153
+ // type: DataTypes.STRING,
154
+ // defaultValue: "",
155
+ // },
156
+ // sealTxHash: {
157
+ // type: DataTypes.STRING,
158
+ // defaultValue: "",
159
+ // },
160
+ // outboundTxHash: {
161
+ // type: DataTypes.STRING,
162
+ // defaultValue: "",
163
+ // },
164
+ // outboundTime: {
165
+ // type: DataTypes.INTEGER,
166
+ // },
167
+ // proposeTime: {
168
+ // type: DataTypes.INTEGER,
169
+ // },
170
+ // attestTime: {
171
+ // type: DataTypes.INTEGER,
172
+ // },
173
+ // sealTime: {
174
+ // type: DataTypes.INTEGER,
175
+ // },
176
+ // sealIndexTime: {
177
+ // type: DataTypes.INTEGER,
178
+ // },
179
+ // sealSignature: {
180
+ // type: DataTypes.STRING,
181
+ // },
182
+ // packetTripRelayStatus: {
183
+ // type: DataTypes.ENUM,
184
+ // values: [...Object.values(PacketTripRelayStatus)],
185
+ // defaultValue: PacketTripRelayStatus.NO,
186
+ // },
187
+ // packetTripTxId: {
188
+ // type: DataTypes.STRING,
189
+ // defaultValue: "",
190
+ // },
191
+ // packetTripTxHash: {
192
+ // type: DataTypes.STRING,
193
+ // defaultValue: "",
194
+ // },
195
+ // packetTripErrorMessage: {
196
+ // type: DataTypes.STRING,
197
+ // defaultValue: "",
198
+ // },
199
+ // packetTripTime: {
200
+ // type: DataTypes.INTEGER,
201
+ // },
202
+ // isPacketTripped: {
203
+ // type: DataTypes.BOOLEAN,
204
+ // defaultValue: false,
205
+ // },
206
+ // proposeTxId: {
207
+ // type: DataTypes.STRING,
208
+ // defaultValue: "",
209
+ // },
210
+ // proposeTxHash: {
211
+ // type: DataTypes.STRING,
212
+ // defaultValue: "",
213
+ // },
214
+ // proposeRelayStatus: {
215
+ // type: DataTypes.ENUM,
216
+ // values: [...Object.values(ProposeRelayStatus)],
217
+ // defaultValue: ProposeRelayStatus.NO,
218
+ // },
219
+ // selectedProposalCount: {
220
+ // type: DataTypes.INTEGER,
221
+ // },
222
+ // executionWaitTime: {
223
+ // type: DataTypes.INTEGER,
224
+ // },
225
+ // attestTxId: {
226
+ // type: DataTypes.STRING,
227
+ // defaultValue: "",
228
+ // },
229
+ // attestTxHash: {
230
+ // type: DataTypes.STRING,
231
+ // defaultValue: "",
232
+ // },
233
+ // tripReason: {
234
+ // type: DataTypes.ENUM,
235
+ // values: [...Object.values(TripReason)],
236
+ // defaultValue: TripReason.NO,
237
+ // },
238
+ // // packetTripTxHash: {
239
+ // // type: DataTypes.STRING,
240
+ // // defaultValue: "",
241
+ // // },
242
+ // attestRelayStatus: {
243
+ // type: DataTypes.ENUM,
244
+ // values: [...Object.values(AttestRelayStatus)],
245
+ // defaultValue: AttestRelayStatus.NO,
246
+ // },
247
+ // };
248
+ // function processStrings(packet: Packet): Packet {
249
+ // if (packet.packetId) packet.packetId = toLowerCase(packet.packetId);
250
+ // if (packet.root) packet.root = toLowerCase(packet.root);
251
+ // if (packet.rootSealed) packet.rootSealed = toLowerCase(packet.rootSealed);
252
+ // if (packet.sealer) packet.sealer = toLowerCase(packet.sealer);
253
+ // if (packet.outboundTxHash) {
254
+ // packet.outboundTxHash = toLowerCase(packet.outboundTxHash);
255
+ // }
256
+ // if (packet.sealTxHash) packet.sealTxHash = toLowerCase(packet.sealTxHash);
257
+ // if (packet.sealSignature) {
258
+ // packet.sealSignature = toLowerCase(packet.sealSignature);
259
+ // }
260
+ // if (packet.dstSwitchboard) {
261
+ // packet.dstSwitchboard = toLowerCase(packet.dstSwitchboard);
262
+ // }
263
+ // if (packet.switchboardId) {
264
+ // packet.switchboardId = toLowerCase(packet.switchboardId);
265
+ // }
266
+ // if (packet.packetTripTxHash) {
267
+ // packet.packetTripTxHash = toLowerCase(packet.packetTripTxHash);
268
+ // }
269
+ // return packet;
270
+ // }
271
+ // export const addPacketHooks = () => {
272
+ // Packet.beforeBulkCreate((packet, options) => {
273
+ // for (let index = 0; index < packet.length; index++) {
274
+ // packet[index] = processStrings(packet[index]);
275
+ // }
276
+ // });
277
+ // Packet.beforeSave((packet, options) => {
278
+ // packet = processStrings(packet);
279
+ // });
280
+ // };
@@ -1,4 +1,5 @@
1
- import { type DeploymentMode } from "@socket.tech/dl-core";
1
+ import { DeploymentMode } from "@socket.tech/dl-core";
2
+ import { Accounts } from "..";
2
3
  export declare const initS3Client: (region: string) => Promise<void>;
3
4
  export declare const getFileFromS3: (bucket: string, filePath: string) => Promise<any>;
4
- export declare const getS3Config: (deploymentMode: DeploymentMode, region?: string) => Promise<any>;
5
+ export declare const getS3Config: (deploymentMode: DeploymentMode, region?: string, account?: Accounts.dl | Accounts.ll) => Promise<any>;
@@ -2,6 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getS3Config = exports.getFileFromS3 = exports.initS3Client = void 0;
4
4
  const client_s3_1 = require("@aws-sdk/client-s3");
5
+ const dl_core_1 = require("@socket.tech/dl-core");
6
+ const __1 = require("..");
5
7
  // Set your AWS credentials and region
6
8
  let s3Client;
7
9
  const initS3Client = async (region) => {
@@ -32,8 +34,10 @@ const getFileFromS3 = async (bucket, filePath) => {
32
34
  }
33
35
  };
34
36
  exports.getFileFromS3 = getFileFromS3;
35
- const getS3Config = async (deploymentMode, region = "us-east-1") => {
36
- const S3_BUCKET_NAME = "socket-dl-" + deploymentMode;
37
+ const getS3Config = async (deploymentMode, region = "us-east-1", account = __1.Accounts.dl) => {
38
+ const S3_BUCKET_NAME = deploymentMode == dl_core_1.DeploymentMode.PROD
39
+ ? `socket-${account}-` + deploymentMode
40
+ : `socket-dl-` + deploymentMode;
37
41
  const S3_RPC_CONFIG_FILE_PATH = deploymentMode + "RpcConfig.json";
38
42
  (0, exports.initS3Client)(region);
39
43
  return await (0, exports.getFileFromS3)(S3_BUCKET_NAME, S3_RPC_CONFIG_FILE_PATH);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@socket.tech/dl-common",
3
- "version": "1.0.3-test.35",
3
+ "version": "1.0.3-test.36",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "description": "common utilities for socket data layer.",
@@ -45,7 +45,7 @@
45
45
  "@aws-sdk/client-sqs": "^3.421.0",
46
46
  "@aws-sdk/smithy-client": "^3.329.0",
47
47
  "@ethersproject/providers": "^5.7.2",
48
- "@socket.tech/dl-core": "2.4.20",
48
+ "@socket.tech/dl-core": "2.4.37-test.2",
49
49
  "@socket.tech/ll-common": "^0.0.19",
50
50
  "async-redis": "^2.0.0",
51
51
  "aws-kms-ethers-signer": "^0.1.3",
@@ -83,7 +83,7 @@
83
83
  "eslint-config-prettier": "8.3.0",
84
84
  "eslint-config-standard-with-typescript": "^39.1.0",
85
85
  "eslint-plugin-import": "^2.25.2",
86
- "eslint-plugin-jsdoc": "36.0.8",
86
+ "eslint-plugin-jsdoc": "^48.2.3",
87
87
  "eslint-plugin-n": "^15.0.0 || ^16.0.0 ",
88
88
  "eslint-plugin-node": "^11.1.0",
89
89
  "eslint-plugin-promise": "^6.0.0",