quantumcoin 7.0.5 → 7.0.6
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/examples/package-lock.json +1 -1
- package/package.json +1 -1
- package/src/wallet/wallet.js +13 -2
package/package.json
CHANGED
package/src/wallet/wallet.js
CHANGED
|
@@ -387,8 +387,19 @@ class Wallet extends BaseWallet {
|
|
|
387
387
|
const pubBytes = typeof publicKey === "string" ? hexToBytes(publicKey) : arrayify(publicKey);
|
|
388
388
|
assertArgument(privBytes.length > 0, "privateKey must not be empty", "privateKey", privateKey);
|
|
389
389
|
assertArgument(pubBytes.length > 0, "publicKey must not be empty", "publicKey", publicKey);
|
|
390
|
-
|
|
391
|
-
|
|
390
|
+
|
|
391
|
+
const privArr = _bytesToNumberArray(privBytes);
|
|
392
|
+
const pubArr = _bytesToNumberArray(pubBytes);
|
|
393
|
+
const addr = qcsdk.addressFromPublicKey(pubArr);
|
|
394
|
+
if (typeof addr !== "string") throw makeError("addressFromPublicKey failed", "UNKNOWN_ERROR", {});
|
|
395
|
+
|
|
396
|
+
const qcWallet = new qcsdk.Wallet(addr, privArr, pubArr);
|
|
397
|
+
const verified = qcsdk.verifyWallet(qcWallet);
|
|
398
|
+
if (verified !== true) {
|
|
399
|
+
throw makeError("verifyWallet failed: the provided key pair is invalid", "INVALID_ARGUMENT", { verified });
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
return Wallet._fromQcWallet(qcWallet, provider || null);
|
|
392
403
|
}
|
|
393
404
|
|
|
394
405
|
/**
|