cosmos-client
Advanced tools
Comparing version 0.8.0 to 0.8.1
{ | ||
"name": "cosmos-client", | ||
"description": "REST API Client for Cosmos SDK Blockchain", | ||
"version": "0.8.0", | ||
"version": "0.8.1", | ||
"author": "LCNEM, Inc.", | ||
@@ -6,0 +6,0 @@ "bugs": { |
@@ -14,3 +14,3 @@ # cosmos-client-ts | ||
```typescript | ||
import { CosmosSDK, AccAddress, PrivKeyEd25519 } from "cosmos-client"; | ||
import { CosmosSDK, AccAddress, PrivKeySecp256k1 } from "cosmos-client"; | ||
import { auth } from "cosmos-client/x/auth"; | ||
@@ -23,3 +23,3 @@ import { bank } from "cosmos-client/x/bank"; | ||
const privKeyBuffer = await sdk.generatePrivKeyFromMnemonic(mnemonic); | ||
const privKey = new PrivKeyEd25519(privKeyBuffer); | ||
const privKey = new PrivKeySecp256k1(privKeyBuffer); | ||
const fromAddress = AccAddress.fromPublicKey(privKey.getPubKey()); | ||
@@ -26,0 +26,0 @@ const account = await auth |
@@ -11,10 +11,11 @@ "use strict"; | ||
var crypto = __importStar(require("crypto")); | ||
var ed25519_1 = require("./ed25519"); | ||
test("address", function () { | ||
var types_1 = require("../../types"); | ||
var secp256k1_1 = require("./secp256k1"); | ||
test("crypto", function () { | ||
var bytes = crypto.randomBytes(32); | ||
var data = crypto.randomBytes(16); | ||
var key = new ed25519_1.PrivKeyEd25519(bytes); | ||
var signature = key.sign(data); | ||
var verify = key.getPubKey().verify(signature); | ||
expect(verify).toBeTruthy(); | ||
var key = new secp256k1_1.PrivKeySecp256k1(bytes); | ||
var address = types_1.AccAddress.fromPublicKey(key.getPubKey()); | ||
var str = address.toBech32(); | ||
console.log(bytes.toString("hex")); | ||
console.log(str); | ||
}); |
@@ -10,2 +10,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var crypto = __importStar(require("crypto")); | ||
var nacl = __importStar(require("tweetnacl")); | ||
@@ -80,3 +81,4 @@ /** | ||
PubKeyEd25519.prototype.getAddress = function () { | ||
return this.pubKey.subarray(0, 20); | ||
var hash = crypto.createHash("sha256").update(this.pubKey).digest(); | ||
return hash.subarray(0, 20); | ||
}; | ||
@@ -83,0 +85,0 @@ /** |
@@ -10,2 +10,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var crypto = __importStar(require("crypto")); | ||
var nacl = __importStar(require("tweetnacl")); | ||
@@ -80,3 +81,4 @@ /** | ||
PubKeySr25519.prototype.getAddress = function () { | ||
return this.pubKey.subarray(0, 20); | ||
var hash = crypto.createHash("sha256").update(this.pubKey).digest(); | ||
return hash.subarray(0, 20); | ||
}; | ||
@@ -83,0 +85,0 @@ /** |
@@ -16,3 +16,3 @@ "use strict"; | ||
var bytes = crypto.randomBytes(32); | ||
var key = new tendermint_1.PrivKeyEd25519(bytes); | ||
var key = new tendermint_1.PrivKeySecp256k1(bytes); | ||
var address = acc_address_1.AccAddress.fromPublicKey(key.getPubKey()); | ||
@@ -19,0 +19,0 @@ var str = address.toBech32(); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
779931
183
18535