@injectivelabs/sdk-ts 1.0.52 → 1.0.53

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.
@@ -1,3 +1,4 @@
1
+ /// <reference types="node" />
1
2
  import { PublicKey } from './PublicKey';
2
3
  import { Address } from '../classes/Address';
3
4
  /**
@@ -50,16 +51,16 @@ export declare class PrivateKey {
50
51
  **/
51
52
  toBech32(): string;
52
53
  /**
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
54
+ * Sign the given message using the wallet's _signingKey function.
55
+ * @param {string} messageBytes: the message that will be hashed and signed, a Buffer made of bytes
56
+ * @returns {Uint8Array} a signature of this private key over the given message
56
57
  */
57
- signEcda(message: any): Promise<Uint8Array>;
58
+ sign(messageBytes: Buffer): Promise<Uint8Array>;
58
59
  /**
59
60
  * Sign the given message using the edcsa sign_deterministic function.
60
- * @param {any} message: the message that will be hashed and signed
61
- * @returns {string} a signature of this private key over the given message
61
+ * @param {Buffer} messageBytes: the message that will be hashed and signed, a Buffer made of bytes
62
+ * @returns {Uint8Array} a signature of this private key over the given message
62
63
  */
63
- sign(message: any): Promise<Uint8Array>;
64
+ signEcda(messageBytes: Buffer): Promise<Uint8Array>;
64
65
  }
65
66
  //# sourceMappingURL=PrivateKey.d.ts.map
@@ -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;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,CAA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,IAAI,MAAM;IAIlB;;;;OAIG;IACG,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAYrD;;;;OAIG;IACG,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;CAY1D"}
@@ -109,33 +109,34 @@ class PrivateKey {
109
109
  return Address_1.Address.fromHex(this.toHex()).toBech32();
110
110
  }
111
111
  /**
112
- * Sign the given message using the edcsa sign_deterministic function.
113
- * @param {any} message: the message that will be hashed and signed
114
- * @returns {string} a signature of this private key over the given message
112
+ * Sign the given message using the wallet's _signingKey function.
113
+ * @param {string} messageBytes: the message that will be hashed and signed, a Buffer made of bytes
114
+ * @returns {Uint8Array} a signature of this private key over the given message
115
115
  */
116
- signEcda(message) {
116
+ sign(messageBytes) {
117
117
  return __awaiter(this, void 0, void 0, function* () {
118
118
  const { wallet } = this;
119
- const msgHash = (0, keccak256_1.default)(Buffer.from(message));
120
- const privateKeyHex = wallet.privateKey.startsWith('0x')
121
- ? wallet.privateKey.slice(2)
122
- : wallet.privateKey;
123
- const privateKey = Uint8Array.from(Buffer.from(privateKeyHex, 'hex'));
124
- const { signature } = secp256k1_1.default.ecdsaSign(msgHash, privateKey);
125
- return signature;
119
+ const msgHash = (0, keccak256_1.default)(messageBytes);
120
+ const signature = yield wallet._signingKey().signDigest(msgHash);
121
+ const splitSignature = BytesUtils.splitSignature(signature);
122
+ return BytesUtils.arrayify(BytesUtils.concat([splitSignature.r, splitSignature.s]));
126
123
  });
127
124
  }
128
125
  /**
129
126
  * 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
127
+ * @param {Buffer} messageBytes: the message that will be hashed and signed, a Buffer made of bytes
128
+ * @returns {Uint8Array} a signature of this private key over the given message
132
129
  */
133
- sign(message) {
130
+ signEcda(messageBytes) {
134
131
  return __awaiter(this, void 0, void 0, function* () {
135
132
  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]));
133
+ const msgHash = (0, keccak256_1.default)(messageBytes);
134
+ const privateKeyHex = wallet.privateKey.startsWith('0x')
135
+ ? wallet.privateKey.slice(2)
136
+ : wallet.privateKey;
137
+ const privateKey = Uint8Array.from(Buffer.from(privateKeyHex, 'hex'));
138
+ const { signature } = secp256k1_1.default.ecdsaSign(msgHash, privateKey);
139
+ return signature;
139
140
  });
140
141
  }
141
142
  }
@@ -1 +1 @@
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,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EAAC,YAAY,CAAC,CAAA;YACvC,MAAM,aAAa,GAAG,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC;gBACtD,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;gBAC5B,CAAC,CAAC,MAAM,CAAC,UAAU,CAAA;YACrB,MAAM,UAAU,GAAG,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC,CAAA;YACrE,MAAM,EAAE,SAAS,EAAE,GAAG,mBAAS,CAAC,SAAS,CAAC,OAAO,EAAE,UAAU,CAAC,CAAA;YAE9D,OAAO,SAAS,CAAA;QAClB,CAAC;KAAA;CACF;AAjHD,gCAiHC"}
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.52",
4
+ "version": "1.0.53",
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": "ee9f169b4d24e886946357096fe99dc4443f71bb"
60
+ "gitHead": "c9d0dea3cd205251531ac1658dddffaeb2818388"
61
61
  }