@firmachain/firma-js 0.2.23 → 0.2.24
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/sdk/FirmaConfig.js +2 -2
- package/dist/sdk/FirmaUtil.d.ts +3 -1
- package/dist/sdk/FirmaUtil.js +11 -7
- package/package.json +5 -4
package/dist/sdk/FirmaConfig.js
CHANGED
package/dist/sdk/FirmaUtil.d.ts
CHANGED
|
@@ -17,7 +17,9 @@ export declare class FirmaUtil {
|
|
|
17
17
|
static getUFCTStringFromFCT(fctAmount: number): string;
|
|
18
18
|
static getFCTStringFromUFCT(uFctAmount: number): string;
|
|
19
19
|
static getFileHash(filePath: string): Promise<string>;
|
|
20
|
-
static getFileHashFromBuffer(buffer: Uint8Array):
|
|
20
|
+
static getFileHashFromBuffer(buffer: Uint8Array): string;
|
|
21
|
+
static getSha1HashFromString(text: string): string;
|
|
22
|
+
static getHashFromString(text: string): string;
|
|
21
23
|
static isValidAddress(address: string): boolean;
|
|
22
24
|
static getValOperAddressFromAccAddress(address: string): string;
|
|
23
25
|
static getAccAddressFromValOperAddress(address: string): string;
|
package/dist/sdk/FirmaUtil.js
CHANGED
|
@@ -43,6 +43,7 @@ var TendermintQueryClient_1 = require("./firmachain/common/TendermintQueryClient
|
|
|
43
43
|
var encoding_1 = require("@cosmjs/encoding");
|
|
44
44
|
var LedgerSigningStargateClient_1 = require("./firmachain/common/LedgerSigningStargateClient");
|
|
45
45
|
var CryptoJS = require("crypto-js");
|
|
46
|
+
var sha1 = require("crypto-js/sha1");
|
|
46
47
|
var sha256 = require("crypto-js/sha256");
|
|
47
48
|
var encHex = require("crypto-js/enc-hex");
|
|
48
49
|
var FirmaUtil = /** @class */ (function () {
|
|
@@ -115,13 +116,16 @@ var FirmaUtil = /** @class */ (function () {
|
|
|
115
116
|
});
|
|
116
117
|
};
|
|
117
118
|
FirmaUtil.getFileHashFromBuffer = function (buffer) {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
119
|
+
var data = CryptoJS.lib.WordArray.create(buffer);
|
|
120
|
+
return sha256(data).toString(encHex);
|
|
121
|
+
};
|
|
122
|
+
FirmaUtil.getSha1HashFromString = function (text) {
|
|
123
|
+
var data = CryptoJS.lib.WordArray.create(text);
|
|
124
|
+
return sha1(data).toString(encHex);
|
|
125
|
+
};
|
|
126
|
+
FirmaUtil.getHashFromString = function (text) {
|
|
127
|
+
var data = CryptoJS.lib.WordArray.create(text);
|
|
128
|
+
return sha256(data).toString(encHex);
|
|
125
129
|
};
|
|
126
130
|
FirmaUtil.isValidAddress = function (address) {
|
|
127
131
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firmachain/firma-js",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.24",
|
|
4
4
|
"description": "The Official FirmaChain Javascript SDK written in Typescript",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"dist"
|
|
9
9
|
],
|
|
10
10
|
"scripts": {
|
|
11
|
-
"test": "mocha test/**/*.test.ts -r ts-node/register --timeout
|
|
11
|
+
"test": "mocha test/**/*.test.ts -r ts-node/register --timeout 1200000",
|
|
12
12
|
"lint": "eslint src test --ext .ts,.tsx",
|
|
13
13
|
"nodemon": "nodemon",
|
|
14
14
|
"dev": "ts-node ./test/test_index.ts",
|
|
@@ -40,7 +40,8 @@
|
|
|
40
40
|
"cosmjs-types": "^0.2.0",
|
|
41
41
|
"crypto-js": "^4.1.1",
|
|
42
42
|
"ipfs-http-client": "^52.0.5",
|
|
43
|
-
"protobufjs": "^6.10.2"
|
|
43
|
+
"protobufjs": "^6.10.2",
|
|
44
|
+
"readline-sync": "^1.4.10"
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
46
47
|
"@types/chai": "^4.2.21",
|
|
@@ -52,4 +53,4 @@
|
|
|
52
53
|
"ts-node": "^10.2.1",
|
|
53
54
|
"typescript": "^4.3.5"
|
|
54
55
|
}
|
|
55
|
-
}
|
|
56
|
+
}
|