Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cosmos-client

Package Overview
Dependencies
Maintainers
1
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cosmos-client - npm Package Compare versions

Comparing version 0.8.2 to 0.8.3

tendermint/types/ed25519.spec.d.ts

6

package.json
{
"name": "cosmos-client",
"description": "REST API Client for Cosmos SDK Blockchain",
"version": "0.8.2",
"version": "0.8.3",
"author": "LCNEM, Inc.",

@@ -39,5 +39,5 @@ "bugs": {

"test": "jest",
"build": "tsc --build --clean && tsc",
"build": "tsc --build --clean && tsc && cargo install wasm-pack && wasm-pack build --scope lcnem ./src/tendermint/sr25519",
"publish": "node bundle && cd dist && npm publish"
}
}
}

@@ -70,1 +70,25 @@ # cosmos-client-ts

```
## Create WASM and Javascript interface with Rust
```shell
cd src/tendermint/sr25519
cargo install wasm-pack
cargo build --target=wasm32-unknown-unknown --release
wasm-pack build --scope lcnem
```
You can see generated ./pkg included these files.
./pkg
```
-rw-rw-r-- 1 nao nao 1 6月 19 20:28 .gitignore
-rw-r--r-- 1 nao nao 102 6月 19 20:28 README.md
-rw-rw-r-- 1 nao nao 2.3K 6月 19 20:28 crypto.d.ts
-rw-rw-r-- 1 nao nao 73 6月 19 20:28 crypto.js
-rw-rw-r-- 1 nao nao 768 6月 19 20:28 crypto_bg.d.ts
-rw-rw-r-- 1 nao nao 5.4K 6月 19 20:28 crypto_bg.js
-rw-rw-r-- 1 nao nao 204K 6月 19 20:28 crypto_bg.wasm
-rw-rw-r-- 1 nao nao 284 6月 19 20:28 package.json
```

@@ -51,6 +51,7 @@ /// <reference types="node" />

/**
* message is not needed
*
* @param message
* @param signature
*/
verify(signature: Buffer): boolean;
verify(signature: Buffer, message: Buffer): boolean;
/**

@@ -57,0 +58,0 @@ *

@@ -11,3 +11,3 @@ "use strict";

var crypto = __importStar(require("crypto"));
var nacl = __importStar(require("tweetnacl"));
var sr25519 = __importStar(require("../sr25519/src"));
/**

@@ -22,4 +22,4 @@ * sr25519

function PrivKeySr25519(privKey) {
var keypair = nacl.sign.keyPair.fromSeed(new Uint8Array(privKey));
this.pubKey = new PubKeySr25519(Buffer.from(keypair.publicKey));
var keypair = sr25519.keypairFromSeed(new Uint8Array(privKey));
this.pubKey = new PubKeySr25519(Buffer.from(keypair.slice(64, 96)));
this.privKey = privKey;

@@ -38,4 +38,5 @@ }

PrivKeySr25519.prototype.sign = function (message) {
var keypair = nacl.sign.keyPair.fromSeed(new Uint8Array(this.privKey));
return Buffer.from(nacl.sign(new Uint8Array(message), new Uint8Array(keypair.secretKey)));
var keypair = sr25519.keypairFromSeed(new Uint8Array(this.privKey));
var privKey = keypair.slice(0, 64);
return Buffer.from(sr25519.sign(this.pubKey.toBuffer(), privKey, message));
};

@@ -87,8 +88,8 @@ /**

/**
* message is not needed
*
* @param message
* @param signature
*/
PubKeySr25519.prototype.verify = function (signature) {
return (nacl.sign.open(new Uint8Array(signature), new Uint8Array(this.pubKey)) !==
null);
PubKeySr25519.prototype.verify = function (signature, message) {
return sr25519.verify(new Uint8Array(signature), new Uint8Array(message), new Uint8Array(this.pubKey));
};

@@ -95,0 +96,0 @@ /**

@@ -48,3 +48,3 @@ "use strict";

case 0:
sdk = new __1.CosmosSDK("http://172.105.205.26", "test");
sdk = new __1.CosmosSDK("", "test");
privKeyBuffer = Buffer.from("36d1043c6e23eb15c928da41043bfd183b6ce13f9e592c9a45ac431c4a08b924", "hex");

@@ -64,3 +64,3 @@ privKey = new tendermint_1.PrivKeySecp256k1(privKeyBuffer);

memo: "Hello, world!",
chain_id: "test",
chain_id: sdk.chainID,
account_number: account.account_number.toString(),

@@ -67,0 +67,0 @@ sequence: account.sequence.toString(),

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc