koilib 3.1.0 → 3.1.1
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/README.md +1 -1
- package/dist/koinos.js +11 -2
- package/dist/koinos.min.js +1 -1
- package/lib/Signer.d.ts +8 -2
- package/lib/Signer.js +11 -2
- package/lib/Signer.js.map +1 -1
- package/lib/browser/Signer.d.ts +8 -2
- package/lib/browser/Signer.js +11 -2
- package/lib/browser/Signer.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -168,7 +168,7 @@ You can also upload a contract in a new address. It is not required that this ne
|
|
|
168
168
|
|
|
169
169
|
// create contract. Set newAccount as signer
|
|
170
170
|
const contract = new Contract({
|
|
171
|
-
signer: newAccount
|
|
171
|
+
signer: newAccount,
|
|
172
172
|
provider,
|
|
173
173
|
bytecode,
|
|
174
174
|
});
|
package/dist/koinos.js
CHANGED
|
@@ -10813,7 +10813,7 @@ class Signer {
|
|
|
10813
10813
|
* ```
|
|
10814
10814
|
* @returns Signer object
|
|
10815
10815
|
*/
|
|
10816
|
-
static fromWif(wif, compressed) {
|
|
10816
|
+
static fromWif(wif, compressed = true) {
|
|
10817
10817
|
const comp = compressed === undefined ? wif[0] !== "5" : compressed;
|
|
10818
10818
|
const privateKey = (0, utils_1.bitcoinDecode)(wif);
|
|
10819
10819
|
return new Signer({
|
|
@@ -10833,7 +10833,7 @@ class Signer {
|
|
|
10833
10833
|
* ```
|
|
10834
10834
|
* @returns Signer object
|
|
10835
10835
|
*/
|
|
10836
|
-
static fromSeed(seed, compressed) {
|
|
10836
|
+
static fromSeed(seed, compressed = true) {
|
|
10837
10837
|
const privateKey = (0, sha256_1.sha256)(seed);
|
|
10838
10838
|
return new Signer({ privateKey, compressed });
|
|
10839
10839
|
}
|
|
@@ -10906,6 +10906,12 @@ class Signer {
|
|
|
10906
10906
|
compactSignature.set(compSignature, 1);
|
|
10907
10907
|
return compactSignature;
|
|
10908
10908
|
}
|
|
10909
|
+
/**
|
|
10910
|
+
* Function to sign a message, which could be a string or a Uint8Array
|
|
10911
|
+
*/
|
|
10912
|
+
async signMessage(message) {
|
|
10913
|
+
return this.signHash((0, sha256_1.sha256)(message));
|
|
10914
|
+
}
|
|
10909
10915
|
/**
|
|
10910
10916
|
* Function to sign a transaction. It's important to remark that
|
|
10911
10917
|
* the transaction parameter is modified inside this function.
|
|
@@ -10987,6 +10993,9 @@ class Signer {
|
|
|
10987
10993
|
return secp.Point.fromHex(publicKey).toHex(true);
|
|
10988
10994
|
}
|
|
10989
10995
|
}
|
|
10996
|
+
static recoverAddress(hash, signature, compressed = true) {
|
|
10997
|
+
return (0, utils_1.bitcoinAddress)((0, utils_1.toUint8Array)(Signer.recoverPublicKey(hash, signature, compressed)));
|
|
10998
|
+
}
|
|
10990
10999
|
/**
|
|
10991
11000
|
* Function to recover the publics keys from a signed
|
|
10992
11001
|
* transaction or block.
|