@socket.tech/dl-common 1.0.3-test.24 → 1.0.3-test.26
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/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFileFromS3 = exports.initS3Client = void 0;
|
|
4
|
+
const client_s3_1 = require("@aws-sdk/client-s3");
|
|
5
|
+
// Set your AWS credentials and region
|
|
6
|
+
let s3Client;
|
|
7
|
+
const initS3Client = async (region) => {
|
|
8
|
+
s3Client = new client_s3_1.S3Client({
|
|
9
|
+
region,
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
exports.initS3Client = initS3Client;
|
|
13
|
+
const getFileFromS3 = async (bucket, filePath) => {
|
|
14
|
+
var _a;
|
|
15
|
+
try {
|
|
16
|
+
// Create an S3 GET operation command
|
|
17
|
+
const getObjectCommand = new client_s3_1.GetObjectCommand({
|
|
18
|
+
Bucket: bucket,
|
|
19
|
+
Key: filePath,
|
|
20
|
+
});
|
|
21
|
+
// Execute the command and get the response
|
|
22
|
+
const s3Response = await s3Client.send(getObjectCommand);
|
|
23
|
+
let jsonStr = await ((_a = s3Response.Body) === null || _a === void 0 ? void 0 : _a.transformToString());
|
|
24
|
+
let response;
|
|
25
|
+
if (jsonStr)
|
|
26
|
+
response = JSON.parse(jsonStr);
|
|
27
|
+
return response;
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
console.error("Error downloading file from S3:", error);
|
|
31
|
+
throw error;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
exports.getFileFromS3 = getFileFromS3;
|
|
@@ -24,7 +24,7 @@ class Adapter extends abstract_signer_1.Signer {
|
|
|
24
24
|
async signMessage(message) {
|
|
25
25
|
const digest = (0, hash_1.hashMessage)(message);
|
|
26
26
|
const signature = await this.signer.sign(Buffer.from(digest.slice(2), "hex"));
|
|
27
|
-
return signature.toString();
|
|
27
|
+
return "0x" + signature.toString();
|
|
28
28
|
}
|
|
29
29
|
async signTransaction(deferrableTransaction) {
|
|
30
30
|
const transaction = await (0, properties_1.resolveProperties)(deferrableTransaction);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@socket.tech/dl-common",
|
|
3
|
-
"version": "1.0.3-test.
|
|
3
|
+
"version": "1.0.3-test.26",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"description": "common utilities for socket data layer.",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@aws-sdk/client-sqs": "^3.421.0",
|
|
45
45
|
"@aws-sdk/smithy-client": "^3.329.0",
|
|
46
46
|
"@ethersproject/providers": "^5.7.2",
|
|
47
|
-
"@socket.tech/dl-core": "2.4.
|
|
47
|
+
"@socket.tech/dl-core": "2.4.1-3.test-0",
|
|
48
48
|
"@socket.tech/ll-common": "^0.0.19",
|
|
49
49
|
"async-redis": "^2.0.0",
|
|
50
50
|
"aws-kms-ethers-signer": "^0.1.3",
|
|
@@ -59,6 +59,7 @@
|
|
|
59
59
|
"sequelize": "^6.21.6"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
+
"@aws-sdk/client-s3": "^3.456.0",
|
|
62
63
|
"@babel/core": "^7.23.3",
|
|
63
64
|
"@babel/preset-env": "^7.23.3",
|
|
64
65
|
"@babel/preset-typescript": "^7.23.3",
|