@injectivelabs/sdk-ts 1.0.51 → 1.0.52
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.
|
@@ -49,6 +49,12 @@ export declare class PrivateKey {
|
|
|
49
49
|
* @returns {string}
|
|
50
50
|
**/
|
|
51
51
|
toBech32(): string;
|
|
52
|
+
/**
|
|
53
|
+
* Sign the given message using the edcsa sign_deterministic function.
|
|
54
|
+
* @param {any} message: the message that will be hashed and signed
|
|
55
|
+
* @returns {string} a signature of this private key over the given message
|
|
56
|
+
*/
|
|
57
|
+
signEcda(message: any): Promise<Uint8Array>;
|
|
52
58
|
/**
|
|
53
59
|
* Sign the given message using the edcsa sign_deterministic function.
|
|
54
60
|
* @param {any} message: the message that will be hashed and signed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrivateKey.d.ts","sourceRoot":"","sources":["../../src/local/PrivateKey.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"PrivateKey.d.ts","sourceRoot":"","sources":["../../src/local/PrivateKey.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAG5C;;GAEG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAQ;IAEtB,OAAO;IAIP;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI;QAAE,UAAU,EAAE,UAAU,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE;IAU/D;;;;;;OAMG;IACH,MAAM,CAAC,YAAY,CACjB,KAAK,EAAE,MAAM,EACb,IAAI,GAAE,MAAM,GAAG,SAAmC,GACjD,UAAU;IAIb;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU;IAIrD;;;OAGG;IACH,KAAK,IAAI,MAAM;IAMf;;;QAGI;IACJ,WAAW,IAAI,SAAS;IAIxB;;;QAGI;IACJ,SAAS,IAAI,OAAO;IAIpB;;;QAGI;IACJ,QAAQ,IAAI,MAAM;IAIlB;;;;OAIG;IACG,QAAQ,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC;IAajD;;;;OAIG;IACG,IAAI,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC;CAU9C"}
|
package/dist/local/PrivateKey.js
CHANGED
|
@@ -1,4 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
2
21
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
22
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
23
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -20,6 +39,7 @@ const keccak256_1 = __importDefault(require("keccak256"));
|
|
|
20
39
|
const constants_1 = require("../utils/constants");
|
|
21
40
|
const PublicKey_1 = require("./PublicKey");
|
|
22
41
|
const Address_1 = require("../classes/Address");
|
|
42
|
+
const BytesUtils = __importStar(require("@ethersproject/bytes"));
|
|
23
43
|
/**
|
|
24
44
|
* Class for wrapping SigningKey that is used for signature creation and public key derivation.
|
|
25
45
|
*/
|
|
@@ -93,7 +113,7 @@ class PrivateKey {
|
|
|
93
113
|
* @param {any} message: the message that will be hashed and signed
|
|
94
114
|
* @returns {string} a signature of this private key over the given message
|
|
95
115
|
*/
|
|
96
|
-
|
|
116
|
+
signEcda(message) {
|
|
97
117
|
return __awaiter(this, void 0, void 0, function* () {
|
|
98
118
|
const { wallet } = this;
|
|
99
119
|
const msgHash = (0, keccak256_1.default)(Buffer.from(message));
|
|
@@ -105,6 +125,19 @@ class PrivateKey {
|
|
|
105
125
|
return signature;
|
|
106
126
|
});
|
|
107
127
|
}
|
|
128
|
+
/**
|
|
129
|
+
* Sign the given message using the edcsa sign_deterministic function.
|
|
130
|
+
* @param {any} message: the message that will be hashed and signed
|
|
131
|
+
* @returns {string} a signature of this private key over the given message
|
|
132
|
+
*/
|
|
133
|
+
sign(message) {
|
|
134
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
135
|
+
const { wallet } = this;
|
|
136
|
+
const signature = yield wallet._signingKey().signDigest((0, keccak256_1.default)(message));
|
|
137
|
+
const splitSignature = BytesUtils.splitSignature(signature);
|
|
138
|
+
return BytesUtils.arrayify(BytesUtils.concat([splitSignature.r, splitSignature.s]));
|
|
139
|
+
});
|
|
140
|
+
}
|
|
108
141
|
}
|
|
109
142
|
exports.PrivateKey = PrivateKey;
|
|
110
143
|
//# sourceMappingURL=PrivateKey.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrivateKey.js","sourceRoot":"","sources":["../../src/local/PrivateKey.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PrivateKey.js","sourceRoot":"","sources":["../../src/local/PrivateKey.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAAyB;AACzB,mCAA+B;AAC/B,0DAAiC;AACjC,0DAAiC;AACjC,kDAA4D;AAC5D,2CAAuC;AACvC,gDAA4C;AAC5C,iEAAkD;AAElD;;GAEG;AACH,MAAa,UAAU;IAGrB,YAAoB,MAAc;QAChC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,QAAQ;QACb,MAAM,QAAQ,GAAG,eAAK,CAAC,gBAAgB,EAAE,CAAA;QACzC,MAAM,UAAU,GAAG,UAAU,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAA;QAEpD,OAAO;YACL,UAAU;YACV,QAAQ;SACT,CAAA;IACH,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,YAAY,CACjB,KAAa,EACb,OAA2B,mCAAuB;QAElD,OAAO,IAAI,UAAU,CAAC,eAAM,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAA;IACzD,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CAAC,UAAkB;QACtC,OAAO,IAAI,UAAU,CAAC,IAAI,eAAM,CAAC,UAAU,CAAC,CAAC,CAAA;IAC/C,CAAC;IAED;;;OAGG;IACH,KAAK;QACH,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC;YACzC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO;YACrB,CAAC,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAA;IAChC,CAAC;IAED;;;QAGI;IACJ,WAAW;QACT,OAAO,qBAAS,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;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AC,CAAC,CAAC,CAAC,CACxD,CAAA;QACH,CAAC;KAAA;CACF;AAhHD,gCAgHC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@injectivelabs/sdk-ts",
|
|
3
3
|
"description": "SDK in TypeScript for building Injective applications in a Node environment.",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.52",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Bojan Angjelkoski",
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"shx": "^0.3.2",
|
|
58
58
|
"snakecase-keys": "^5.4.1"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "ee9f169b4d24e886946357096fe99dc4443f71bb"
|
|
61
61
|
}
|