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

@cosmjs/proto-signing

Package Overview
Dependencies
Maintainers
2
Versions
92
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cosmjs/proto-signing - npm Package Compare versions

Comparing version 0.25.0-alpha.2 to 0.25.0-alpha.3

9

build/codec/cosmos_proto/cosmos.js
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.protobufPackage = void 0;
/* eslint-disable */
const long_1 = __importDefault(require("long"));
const minimal_1 = __importDefault(require("protobufjs/minimal"));
exports.protobufPackage = "cosmos_proto";
if (minimal_1.default.util.Long !== long_1.default) {
minimal_1.default.util.Long = long_1.default;
minimal_1.default.configure();
}
//# sourceMappingURL=cosmos.js.map

2

build/codec/cosmos/bank/v1beta1/bank.d.ts

@@ -1,4 +0,4 @@

import { Coin } from "../../../cosmos/base/v1beta1/coin";
import Long from "long";
import _m0 from "protobufjs/minimal";
import { Coin } from "../../../cosmos/base/v1beta1/coin";
export declare const protobufPackage = "cosmos.bank.v1beta1";

@@ -5,0 +5,0 @@ /** Params defines the parameters for the bank module. */

@@ -8,4 +8,5 @@ "use strict";

/* eslint-disable */
const long_1 = __importDefault(require("long"));
const minimal_1 = __importDefault(require("protobufjs/minimal"));
const coin_1 = require("../../../cosmos/base/v1beta1/coin");
const minimal_1 = __importDefault(require("protobufjs/minimal"));
exports.protobufPackage = "cosmos.bank.v1beta1";

@@ -24,3 +25,3 @@ const baseParams = { defaultSendEnabled: false };

decode(input, length) {
const reader = input instanceof Uint8Array ? new minimal_1.default.Reader(input) : input;
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;

@@ -101,3 +102,3 @@ const message = Object.assign({}, baseParams);

decode(input, length) {
const reader = input instanceof Uint8Array ? new minimal_1.default.Reader(input) : input;
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;

@@ -172,3 +173,3 @@ const message = Object.assign({}, baseSendEnabled);

decode(input, length) {
const reader = input instanceof Uint8Array ? new minimal_1.default.Reader(input) : input;
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;

@@ -249,3 +250,3 @@ const message = Object.assign({}, baseInput);

decode(input, length) {
const reader = input instanceof Uint8Array ? new minimal_1.default.Reader(input) : input;
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;

@@ -323,3 +324,3 @@ const message = Object.assign({}, baseOutput);

decode(input, length) {
const reader = input instanceof Uint8Array ? new minimal_1.default.Reader(input) : input;
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;

@@ -387,3 +388,3 @@ const message = Object.assign({}, baseSupply);

decode(input, length) {
const reader = input instanceof Uint8Array ? new minimal_1.default.Reader(input) : input;
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;

@@ -486,3 +487,3 @@ const message = Object.assign({}, baseDenomUnit);

decode(input, length) {
const reader = input instanceof Uint8Array ? new minimal_1.default.Reader(input) : input;
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;

@@ -583,2 +584,6 @@ const message = Object.assign({}, baseMetadata);

};
if (minimal_1.default.util.Long !== long_1.default) {
minimal_1.default.util.Long = long_1.default;
minimal_1.default.configure();
}
//# sourceMappingURL=bank.js.map

@@ -0,5 +1,5 @@

import Long from "long";
import _m0 from "protobufjs/minimal";
import { Coin } from "../../../cosmos/base/v1beta1/coin";
import { Input, Output } from "../../../cosmos/bank/v1beta1/bank";
import _m0 from "protobufjs/minimal";
import Long from "long";
export declare const protobufPackage = "cosmos.bank.v1beta1";

@@ -6,0 +6,0 @@ /** MsgSend represents a message to send coins from one account to another. */

@@ -8,5 +8,6 @@ "use strict";

/* eslint-disable */
const long_1 = __importDefault(require("long"));
const minimal_1 = __importDefault(require("protobufjs/minimal"));
const coin_1 = require("../../../cosmos/base/v1beta1/coin");
const bank_1 = require("../../../cosmos/bank/v1beta1/bank");
const minimal_1 = __importDefault(require("protobufjs/minimal"));
exports.protobufPackage = "cosmos.bank.v1beta1";

@@ -28,3 +29,3 @@ const baseMsgSend = { fromAddress: "", toAddress: "" };

decode(input, length) {
const reader = input instanceof Uint8Array ? new minimal_1.default.Reader(input) : input;
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;

@@ -115,3 +116,3 @@ const message = Object.assign({}, baseMsgSend);

decode(input, length) {
const reader = input instanceof Uint8Array ? new minimal_1.default.Reader(input) : input;
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;

@@ -154,3 +155,3 @@ const message = Object.assign({}, baseMsgSendResponse);

decode(input, length) {
const reader = input instanceof Uint8Array ? new minimal_1.default.Reader(input) : input;
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;

@@ -231,3 +232,3 @@ const message = Object.assign({}, baseMsgMultiSend);

decode(input, length) {
const reader = input instanceof Uint8Array ? new minimal_1.default.Reader(input) : input;
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;

@@ -274,2 +275,6 @@ const message = Object.assign({}, baseMsgMultiSendResponse);

exports.MsgClientImpl = MsgClientImpl;
if (minimal_1.default.util.Long !== long_1.default) {
minimal_1.default.util.Long = long_1.default;
minimal_1.default.configure();
}
//# sourceMappingURL=tx.js.map

@@ -7,2 +7,4 @@ "use strict";

exports.DecProto = exports.IntProto = exports.DecCoin = exports.Coin = exports.protobufPackage = void 0;
/* eslint-disable */
const long_1 = __importDefault(require("long"));
const minimal_1 = __importDefault(require("protobufjs/minimal"));

@@ -22,3 +24,3 @@ exports.protobufPackage = "cosmos.base.v1beta1";

decode(input, length) {
const reader = input instanceof Uint8Array ? new minimal_1.default.Reader(input) : input;
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;

@@ -93,3 +95,3 @@ const message = Object.assign({}, baseCoin);

decode(input, length) {
const reader = input instanceof Uint8Array ? new minimal_1.default.Reader(input) : input;
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;

@@ -161,3 +163,3 @@ const message = Object.assign({}, baseDecCoin);

decode(input, length) {
const reader = input instanceof Uint8Array ? new minimal_1.default.Reader(input) : input;
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;

@@ -213,3 +215,3 @@ const message = Object.assign({}, baseIntProto);

decode(input, length) {
const reader = input instanceof Uint8Array ? new minimal_1.default.Reader(input) : input;
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;

@@ -256,2 +258,6 @@ const message = Object.assign({}, baseDecProto);

};
if (minimal_1.default.util.Long !== long_1.default) {
minimal_1.default.util.Long = long_1.default;
minimal_1.default.configure();
}
//# sourceMappingURL=coin.js.map

@@ -1,4 +0,4 @@

import { Any } from "../../../google/protobuf/any";
import Long from "long";
import _m0 from "protobufjs/minimal";
import { Any } from "../../../google/protobuf/any";
export declare const protobufPackage = "cosmos.crypto.multisig";

@@ -5,0 +5,0 @@ /**

@@ -8,4 +8,5 @@ "use strict";

/* eslint-disable */
const long_1 = __importDefault(require("long"));
const minimal_1 = __importDefault(require("protobufjs/minimal"));
const any_1 = require("../../../google/protobuf/any");
const minimal_1 = __importDefault(require("protobufjs/minimal"));
exports.protobufPackage = "cosmos.crypto.multisig";

@@ -24,3 +25,3 @@ const baseLegacyAminoPubKey = { threshold: 0 };

decode(input, length) {
const reader = input instanceof Uint8Array ? new minimal_1.default.Reader(input) : input;
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;

@@ -89,2 +90,6 @@ const message = Object.assign({}, baseLegacyAminoPubKey);

};
if (minimal_1.default.util.Long !== long_1.default) {
minimal_1.default.util.Long = long_1.default;
minimal_1.default.configure();
}
//# sourceMappingURL=keys.js.map

@@ -7,2 +7,4 @@ "use strict";

exports.CompactBitArray = exports.MultiSignature = exports.protobufPackage = void 0;
/* eslint-disable */
const long_1 = __importDefault(require("long"));
const minimal_1 = __importDefault(require("protobufjs/minimal"));

@@ -19,3 +21,3 @@ exports.protobufPackage = "cosmos.crypto.multisig.v1beta1";

decode(input, length) {
const reader = input instanceof Uint8Array ? new minimal_1.default.Reader(input) : input;
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;

@@ -80,5 +82,6 @@ const message = Object.assign({}, baseMultiSignature);

decode(input, length) {
const reader = input instanceof Uint8Array ? new minimal_1.default.Reader(input) : input;
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = Object.assign({}, baseCompactBitArray);
message.elems = new Uint8Array();
while (reader.pos < end) {

@@ -102,2 +105,3 @@ const tag = reader.uint32();

const message = Object.assign({}, baseCompactBitArray);
message.elems = new Uint8Array();
if (object.extraBitsStored !== undefined && object.extraBitsStored !== null) {

@@ -166,2 +170,6 @@ message.extraBitsStored = Number(object.extraBitsStored);

}
if (minimal_1.default.util.Long !== long_1.default) {
minimal_1.default.util.Long = long_1.default;
minimal_1.default.configure();
}
//# sourceMappingURL=multisig.js.map

@@ -7,2 +7,4 @@ "use strict";

exports.PrivKey = exports.PubKey = exports.protobufPackage = void 0;
/* eslint-disable */
const long_1 = __importDefault(require("long"));
const minimal_1 = __importDefault(require("protobufjs/minimal"));

@@ -19,5 +21,6 @@ exports.protobufPackage = "cosmos.crypto.secp256k1";

decode(input, length) {
const reader = input instanceof Uint8Array ? new minimal_1.default.Reader(input) : input;
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = Object.assign({}, basePubKey);
message.key = new Uint8Array();
while (reader.pos < end) {

@@ -38,2 +41,3 @@ const tag = reader.uint32();

const message = Object.assign({}, basePubKey);
message.key = new Uint8Array();
if (object.key !== undefined && object.key !== null) {

@@ -70,5 +74,6 @@ message.key = bytesFromBase64(object.key);

decode(input, length) {
const reader = input instanceof Uint8Array ? new minimal_1.default.Reader(input) : input;
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = Object.assign({}, basePrivKey);
message.key = new Uint8Array();
while (reader.pos < end) {

@@ -89,2 +94,3 @@ const tag = reader.uint32();

const message = Object.assign({}, basePrivKey);
message.key = new Uint8Array();
if (object.key !== undefined && object.key !== null) {

@@ -140,2 +146,6 @@ message.key = bytesFromBase64(object.key);

}
if (minimal_1.default.util.Long !== long_1.default) {
minimal_1.default.util.Long = long_1.default;
minimal_1.default.configure();
}
//# sourceMappingURL=keys.js.map

@@ -0,5 +1,5 @@

import Long from "long";
import _m0 from "protobufjs/minimal";
import { Any } from "../../../../google/protobuf/any";
import Long from "long";
import { CompactBitArray } from "../../../../cosmos/crypto/multisig/v1beta1/multisig";
import _m0 from "protobufjs/minimal";
export declare const protobufPackage = "cosmos.tx.signing.v1beta1";

@@ -6,0 +6,0 @@ /** SignMode represents a signing mode with its own security guarantees. */

@@ -8,6 +8,6 @@ "use strict";

/* eslint-disable */
const long_1 = __importDefault(require("long"));
const minimal_1 = __importDefault(require("protobufjs/minimal"));
const any_1 = require("../../../../google/protobuf/any");
const long_1 = __importDefault(require("long"));
const multisig_1 = require("../../../../cosmos/crypto/multisig/v1beta1/multisig");
const minimal_1 = __importDefault(require("protobufjs/minimal"));
exports.protobufPackage = "cosmos.tx.signing.v1beta1";

@@ -85,3 +85,3 @@ /** SignMode represents a signing mode with its own security guarantees. */

decode(input, length) {
const reader = input instanceof Uint8Array ? new minimal_1.default.Reader(input) : input;
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;

@@ -149,3 +149,3 @@ const message = Object.assign({}, baseSignatureDescriptors);

decode(input, length) {
const reader = input instanceof Uint8Array ? new minimal_1.default.Reader(input) : input;
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;

@@ -238,3 +238,3 @@ const message = Object.assign({}, baseSignatureDescriptor);

decode(input, length) {
const reader = input instanceof Uint8Array ? new minimal_1.default.Reader(input) : input;
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;

@@ -311,5 +311,6 @@ const message = Object.assign({}, baseSignatureDescriptor_Data);

decode(input, length) {
const reader = input instanceof Uint8Array ? new minimal_1.default.Reader(input) : input;
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = Object.assign({}, baseSignatureDescriptor_Data_Single);
message.signature = new Uint8Array();
while (reader.pos < end) {

@@ -333,2 +334,3 @@ const tag = reader.uint32();

const message = Object.assign({}, baseSignatureDescriptor_Data_Single);
message.signature = new Uint8Array();
if (object.mode !== undefined && object.mode !== null) {

@@ -381,3 +383,3 @@ message.mode = signModeFromJSON(object.mode);

decode(input, length) {
const reader = input instanceof Uint8Array ? new minimal_1.default.Reader(input) : input;
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;

@@ -475,2 +477,6 @@ const message = Object.assign({}, baseSignatureDescriptor_Data_Multi);

}
if (minimal_1.default.util.Long !== long_1.default) {
minimal_1.default.util.Long = long_1.default;
minimal_1.default.configure();
}
//# sourceMappingURL=signing.js.map
import Long from "long";
import _m0 from "protobufjs/minimal";
import { Any } from "../../../google/protobuf/any";

@@ -6,3 +7,2 @@ import { SignMode } from "../../../cosmos/tx/signing/v1beta1/signing";

import { Coin } from "../../../cosmos/base/v1beta1/coin";
import _m0 from "protobufjs/minimal";
export declare const protobufPackage = "cosmos.tx.v1beta1";

@@ -9,0 +9,0 @@ /** Tx is the standard type used for broadcasting transactions. */

@@ -9,2 +9,3 @@ "use strict";

const long_1 = __importDefault(require("long"));
const minimal_1 = __importDefault(require("protobufjs/minimal"));
const any_1 = require("../../../google/protobuf/any");

@@ -14,3 +15,2 @@ const signing_1 = require("../../../cosmos/tx/signing/v1beta1/signing");

const coin_1 = require("../../../cosmos/base/v1beta1/coin");
const minimal_1 = __importDefault(require("protobufjs/minimal"));
exports.protobufPackage = "cosmos.tx.v1beta1";

@@ -32,3 +32,3 @@ const baseTx = {};

decode(input, length) {
const reader = input instanceof Uint8Array ? new minimal_1.default.Reader(input) : input;
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;

@@ -129,6 +129,8 @@ const message = Object.assign({}, baseTx);

decode(input, length) {
const reader = input instanceof Uint8Array ? new minimal_1.default.Reader(input) : input;
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = Object.assign({}, baseTxRaw);
message.signatures = [];
message.bodyBytes = new Uint8Array();
message.authInfoBytes = new Uint8Array();
while (reader.pos < end) {

@@ -156,2 +158,4 @@ const tag = reader.uint32();

message.signatures = [];
message.bodyBytes = new Uint8Array();
message.authInfoBytes = new Uint8Array();
if (object.bodyBytes !== undefined && object.bodyBytes !== null) {

@@ -225,5 +229,7 @@ message.bodyBytes = bytesFromBase64(object.bodyBytes);

decode(input, length) {
const reader = input instanceof Uint8Array ? new minimal_1.default.Reader(input) : input;
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = Object.assign({}, baseSignDoc);
message.bodyBytes = new Uint8Array();
message.authInfoBytes = new Uint8Array();
while (reader.pos < end) {

@@ -253,2 +259,4 @@ const tag = reader.uint32();

const message = Object.assign({}, baseSignDoc);
message.bodyBytes = new Uint8Array();
message.authInfoBytes = new Uint8Array();
if (object.bodyBytes !== undefined && object.bodyBytes !== null) {

@@ -335,3 +343,3 @@ message.bodyBytes = bytesFromBase64(object.bodyBytes);

decode(input, length) {
const reader = input instanceof Uint8Array ? new minimal_1.default.Reader(input) : input;
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;

@@ -473,3 +481,3 @@ const message = Object.assign({}, baseTxBody);

decode(input, length) {
const reader = input instanceof Uint8Array ? new minimal_1.default.Reader(input) : input;
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;

@@ -553,3 +561,3 @@ const message = Object.assign({}, baseAuthInfo);

decode(input, length) {
const reader = input instanceof Uint8Array ? new minimal_1.default.Reader(input) : input;
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;

@@ -642,3 +650,3 @@ const message = Object.assign({}, baseSignerInfo);

decode(input, length) {
const reader = input instanceof Uint8Array ? new minimal_1.default.Reader(input) : input;
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;

@@ -712,3 +720,3 @@ const message = Object.assign({}, baseModeInfo);

decode(input, length) {
const reader = input instanceof Uint8Array ? new minimal_1.default.Reader(input) : input;
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;

@@ -767,3 +775,3 @@ const message = Object.assign({}, baseModeInfo_Single);

decode(input, length) {
const reader = input instanceof Uint8Array ? new minimal_1.default.Reader(input) : input;
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;

@@ -851,3 +859,3 @@ const message = Object.assign({}, baseModeInfo_Multi);

decode(input, length) {
const reader = input instanceof Uint8Array ? new minimal_1.default.Reader(input) : input;
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;

@@ -976,2 +984,6 @@ const message = Object.assign({}, baseFee);

}
if (minimal_1.default.util.Long !== long_1.default) {
minimal_1.default.util.Long = long_1.default;
minimal_1.default.configure();
}
//# sourceMappingURL=tx.js.map
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.protobufPackage = void 0;
/* eslint-disable */
const long_1 = __importDefault(require("long"));
const minimal_1 = __importDefault(require("protobufjs/minimal"));
exports.protobufPackage = "gogoproto";
if (minimal_1.default.util.Long !== long_1.default) {
minimal_1.default.util.Long = long_1.default;
minimal_1.default.configure();
}
//# sourceMappingURL=gogo.js.map

@@ -7,2 +7,4 @@ "use strict";

exports.Any = exports.protobufPackage = void 0;
/* eslint-disable */
const long_1 = __importDefault(require("long"));
const minimal_1 = __importDefault(require("protobufjs/minimal"));

@@ -22,5 +24,6 @@ exports.protobufPackage = "google.protobuf";

decode(input, length) {
const reader = input instanceof Uint8Array ? new minimal_1.default.Reader(input) : input;
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = Object.assign({}, baseAny);
message.value = new Uint8Array();
while (reader.pos < end) {

@@ -44,2 +47,3 @@ const tag = reader.uint32();

const message = Object.assign({}, baseAny);
message.value = new Uint8Array();
if (object.typeUrl !== undefined && object.typeUrl !== null) {

@@ -108,2 +112,6 @@ message.typeUrl = String(object.typeUrl);

}
if (minimal_1.default.util.Long !== long_1.default) {
minimal_1.default.util.Long = long_1.default;
minimal_1.default.configure();
}
//# sourceMappingURL=any.js.map

@@ -7,2 +7,4 @@ "use strict";

exports.PublicKey = exports.protobufPackage = void 0;
/* eslint-disable */
const long_1 = __importDefault(require("long"));
const minimal_1 = __importDefault(require("protobufjs/minimal"));

@@ -22,3 +24,3 @@ exports.protobufPackage = "tendermint.crypto";

decode(input, length) {
const reader = input instanceof Uint8Array ? new minimal_1.default.Reader(input) : input;
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;

@@ -105,2 +107,6 @@ const message = Object.assign({}, basePublicKey);

}
if (minimal_1.default.util.Long !== long_1.default) {
minimal_1.default.util.Long = long_1.default;
minimal_1.default.configure();
}
//# sourceMappingURL=keys.js.map
import { EnglishMnemonic, HdPath } from "@cosmjs/crypto";
import { SignDoc } from "./codec/cosmos/tx/v1beta1/tx";
import { AccountData, DirectSignResponse, OfflineDirectSigner } from "./signer";
export interface DirectSecp256k1HdWalletOptions {
/** The password to use when deriving a BIP39 seed from a mnemonic. */
readonly bip39Password: string;
/** The BIP-32/SLIP-10 derivation paths. Defaults to the Cosmos Hub/ATOM path `m/44'/118'/0'/0/0`. */
readonly hdPaths: readonly HdPath[];
/** The bech32 address prefix (human readable part). Defaults to "cosmos". */
readonly prefix: string;
}
interface DirectSecp256k1HdWalletConstructorOptions extends Partial<DirectSecp256k1HdWalletOptions> {
readonly seed: Uint8Array;
}
/** A wallet for protobuf based signing using SIGN_MODE_DIRECT */

@@ -10,6 +21,5 @@ export declare class DirectSecp256k1HdWallet implements OfflineDirectSigner {

* @param mnemonic Any valid English mnemonic.
* @param hdPath The BIP-32/SLIP-10 derivation path. Defaults to the Cosmos Hub/ATOM path `m/44'/118'/0'/0/0`.
* @param prefix The bech32 address prefix (human readable part). Defaults to "cosmos".
* @param options An optional `DirectSecp256k1HdWalletOptions` object optionally containing a bip39Password, hdPaths, and prefix.
*/
static fromMnemonic(mnemonic: string, hdPath?: HdPath, prefix?: string): Promise<DirectSecp256k1HdWallet>;
static fromMnemonic(mnemonic: string, options?: Partial<DirectSecp256k1HdWalletOptions>): Promise<DirectSecp256k1HdWallet>;
/**

@@ -19,18 +29,18 @@ * Generates a new wallet with a BIP39 mnemonic of the given length.

* @param length The number of words in the mnemonic (12, 15, 18, 21 or 24).
* @param hdPath The BIP-32/SLIP-10 derivation path. Defaults to the Cosmos Hub/ATOM path `m/44'/118'/0'/0/0`.
* @param prefix The bech32 address prefix (human readable part). Defaults to "cosmos".
* @param options An optional `DirectSecp256k1HdWalletOptions` object optionally containing a bip39Password, hdPaths, and prefix.
*/
static generate(length?: 12 | 15 | 18 | 21 | 24, hdPath?: HdPath, prefix?: string): Promise<DirectSecp256k1HdWallet>;
static generate(length?: 12 | 15 | 18 | 21 | 24, options?: Partial<DirectSecp256k1HdWalletOptions>): Promise<DirectSecp256k1HdWallet>;
/** Base secret */
private readonly secret;
/** Derivation instruction */
/** BIP39 seed */
private readonly seed;
/** Derivation instructions */
private readonly accounts;
/** Derived data */
private readonly pubkey;
private readonly privkey;
protected constructor(mnemonic: EnglishMnemonic, hdPath: HdPath, privkey: Uint8Array, pubkey: Uint8Array, prefix: string);
protected constructor(mnemonic: EnglishMnemonic, options: DirectSecp256k1HdWalletConstructorOptions);
get mnemonic(): string;
private get address();
getAccounts(): Promise<readonly AccountData[]>;
signDirect(address: string, signDoc: SignDoc): Promise<DirectSignResponse>;
signDirect(signerAddress: string, signDoc: SignDoc): Promise<DirectSignResponse>;
private getKeyPair;
private getAccountsWithPrivkeys;
}
export {};

@@ -8,14 +8,17 @@ "use strict";

const signing_1 = require("./signing");
const defaultOptions = {
bip39Password: "",
hdPaths: [amino_1.makeCosmoshubPath(0)],
prefix: "cosmos",
};
/** A wallet for protobuf based signing using SIGN_MODE_DIRECT */
class DirectSecp256k1HdWallet {
constructor(mnemonic, hdPath, privkey, pubkey, prefix) {
constructor(mnemonic, options) {
const { seed, hdPaths, prefix } = Object.assign(Object.assign({}, defaultOptions), options);
this.secret = mnemonic;
this.accounts = [
{
hdPath: hdPath,
prefix: prefix,
},
];
this.privkey = privkey;
this.pubkey = pubkey;
this.seed = seed;
this.accounts = hdPaths.map((hdPath) => ({
hdPath: hdPath,
prefix: prefix,
}));
}

@@ -26,11 +29,8 @@ /**

* @param mnemonic Any valid English mnemonic.
* @param hdPath The BIP-32/SLIP-10 derivation path. Defaults to the Cosmos Hub/ATOM path `m/44'/118'/0'/0/0`.
* @param prefix The bech32 address prefix (human readable part). Defaults to "cosmos".
* @param options An optional `DirectSecp256k1HdWalletOptions` object optionally containing a bip39Password, hdPaths, and prefix.
*/
static async fromMnemonic(mnemonic, hdPath = amino_1.makeCosmoshubPath(0), prefix = "cosmos") {
static async fromMnemonic(mnemonic, options = {}) {
const mnemonicChecked = new crypto_1.EnglishMnemonic(mnemonic);
const seed = await crypto_1.Bip39.mnemonicToSeed(mnemonicChecked);
const { privkey } = crypto_1.Slip10.derivePath(crypto_1.Slip10Curve.Secp256k1, seed, hdPath);
const uncompressed = (await crypto_1.Secp256k1.makeKeypair(privkey)).pubkey;
return new DirectSecp256k1HdWallet(mnemonicChecked, hdPath, privkey, crypto_1.Secp256k1.compressPubkey(uncompressed), prefix);
const seed = await crypto_1.Bip39.mnemonicToSeed(mnemonicChecked, options.bip39Password);
return new DirectSecp256k1HdWallet(mnemonicChecked, Object.assign(Object.assign({}, options), { seed: seed }));
}

@@ -41,10 +41,9 @@ /**

* @param length The number of words in the mnemonic (12, 15, 18, 21 or 24).
* @param hdPath The BIP-32/SLIP-10 derivation path. Defaults to the Cosmos Hub/ATOM path `m/44'/118'/0'/0/0`.
* @param prefix The bech32 address prefix (human readable part). Defaults to "cosmos".
* @param options An optional `DirectSecp256k1HdWalletOptions` object optionally containing a bip39Password, hdPaths, and prefix.
*/
static async generate(length = 12, hdPath = amino_1.makeCosmoshubPath(0), prefix = "cosmos") {
static async generate(length = 12, options = {}) {
const entropyLength = 4 * Math.floor((11 * length) / 33);
const entropy = crypto_1.Random.getBytes(entropyLength);
const mnemonic = crypto_1.Bip39.encode(entropy);
return DirectSecp256k1HdWallet.fromMnemonic(mnemonic.toString(), hdPath, prefix);
return DirectSecp256k1HdWallet.fromMnemonic(mnemonic.toString(), options);
}

@@ -54,23 +53,22 @@ get mnemonic() {

}
get address() {
return encoding_1.Bech32.encode(this.accounts[0].prefix, amino_1.rawSecp256k1PubkeyToRawAddress(this.pubkey));
}
async getAccounts() {
return [
{
algo: "secp256k1",
address: this.address,
pubkey: this.pubkey,
},
];
const accountsWithPrivkeys = await this.getAccountsWithPrivkeys();
return accountsWithPrivkeys.map(({ algo, pubkey, address }) => ({
algo: algo,
pubkey: pubkey,
address: address,
}));
}
async signDirect(address, signDoc) {
async signDirect(signerAddress, signDoc) {
const accounts = await this.getAccountsWithPrivkeys();
const account = accounts.find(({ address }) => address === signerAddress);
if (account === undefined) {
throw new Error(`Address ${signerAddress} not found in wallet`);
}
const { privkey, pubkey } = account;
const signBytes = signing_1.makeSignBytes(signDoc);
if (address !== this.address) {
throw new Error(`Address ${address} not found in wallet`);
}
const hashedMessage = crypto_1.sha256(signBytes);
const signature = await crypto_1.Secp256k1.createSignature(hashedMessage, this.privkey);
const signature = await crypto_1.Secp256k1.createSignature(hashedMessage, privkey);
const signatureBytes = new Uint8Array([...signature.r(32), ...signature.s(32)]);
const stdSignature = amino_1.encodeSecp256k1Signature(this.pubkey, signatureBytes);
const stdSignature = amino_1.encodeSecp256k1Signature(pubkey, signatureBytes);
return {

@@ -81,4 +79,24 @@ signed: signDoc,

}
async getKeyPair(hdPath) {
const { privkey } = crypto_1.Slip10.derivePath(crypto_1.Slip10Curve.Secp256k1, this.seed, hdPath);
const { pubkey } = await crypto_1.Secp256k1.makeKeypair(privkey);
return {
privkey: privkey,
pubkey: crypto_1.Secp256k1.compressPubkey(pubkey),
};
}
async getAccountsWithPrivkeys() {
return Promise.all(this.accounts.map(async ({ hdPath, prefix }) => {
const { privkey, pubkey } = await this.getKeyPair(hdPath);
const address = encoding_1.Bech32.encode(prefix, amino_1.rawSecp256k1PubkeyToRawAddress(pubkey));
return {
algo: "secp256k1",
privkey: privkey,
pubkey: pubkey,
address: address,
};
}));
}
}
exports.DirectSecp256k1HdWallet = DirectSecp256k1HdWallet;
//# sourceMappingURL=directsecp256k1hdwallet.js.map

@@ -21,2 +21,13 @@ "use strict";

});
it("works with options", async () => {
const wallet = await directsecp256k1hdwallet_1.DirectSecp256k1HdWallet.fromMnemonic(defaultMnemonic, {
bip39Password: "password123",
hdPaths: [amino_1.makeCosmoshubPath(123)],
prefix: "yolo",
});
expect(wallet.mnemonic).toEqual(defaultMnemonic);
const [{ pubkey, address }] = await wallet.getAccounts();
expect(pubkey).not.toEqual(defaultPubkey);
expect(address.slice(0, 4)).toEqual("yolo");
});
});

@@ -23,0 +34,0 @@ describe("generate", () => {

export { Coin, coin, coins, parseCoins } from "@cosmjs/amino";
export { isPbjsGeneratedType, isTsProtoGeneratedType, EncodeObject, GeneratedType, Registry, TsProtoGeneratedType, PbjsGeneratedType, } from "./registry";
export { DirectSecp256k1HdWallet } from "./directsecp256k1hdwallet";
export { DecodeObject, EncodeObject, GeneratedType, isTxBodyEncodeObject, isPbjsGeneratedType, isTsProtoGeneratedType, PbjsGeneratedType, Registry, TsProtoGeneratedType, TxBodyEncodeObject, } from "./registry";
export { DirectSecp256k1HdWallet, DirectSecp256k1HdWalletOptions } from "./directsecp256k1hdwallet";
export { DirectSecp256k1Wallet } from "./directsecp256k1wallet";

@@ -5,0 +5,0 @@ export { decodePubkey, encodePubkey } from "./pubkey";

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeSignDoc = exports.makeSignBytes = exports.makeAuthInfoBytes = exports.isOfflineDirectSigner = exports.encodePubkey = exports.decodePubkey = exports.DirectSecp256k1Wallet = exports.DirectSecp256k1HdWallet = exports.Registry = exports.isTsProtoGeneratedType = exports.isPbjsGeneratedType = exports.parseCoins = exports.coins = exports.coin = void 0;
exports.makeSignDoc = exports.makeSignBytes = exports.makeAuthInfoBytes = exports.isOfflineDirectSigner = exports.encodePubkey = exports.decodePubkey = exports.DirectSecp256k1Wallet = exports.DirectSecp256k1HdWallet = exports.Registry = exports.isTsProtoGeneratedType = exports.isPbjsGeneratedType = exports.isTxBodyEncodeObject = exports.parseCoins = exports.coins = exports.coin = void 0;
// This type happens to be shared between Amino and Direct sign modes

@@ -10,2 +10,3 @@ var amino_1 = require("@cosmjs/amino");

var registry_1 = require("./registry");
Object.defineProperty(exports, "isTxBodyEncodeObject", { enumerable: true, get: function () { return registry_1.isTxBodyEncodeObject; } });
Object.defineProperty(exports, "isPbjsGeneratedType", { enumerable: true, get: function () { return registry_1.isPbjsGeneratedType; } });

@@ -12,0 +13,0 @@ Object.defineProperty(exports, "isTsProtoGeneratedType", { enumerable: true, get: function () { return registry_1.isTsProtoGeneratedType; } });

@@ -41,2 +41,6 @@ import Long from "long";

export declare function isPbjsGeneratedType(type: GeneratedType): type is PbjsGeneratedType;
export interface DecodeObject {
readonly typeUrl: string;
readonly value: Uint8Array;
}
export interface EncodeObject {

@@ -46,7 +50,3 @@ readonly typeUrl: string;

}
export interface DecodeObject {
readonly typeUrl: string;
readonly value: Uint8Array;
}
export interface TxBodyValue {
interface TxBodyValue {
readonly messages: readonly EncodeObject[];

@@ -58,2 +58,7 @@ readonly memo?: string;

}
export interface TxBodyEncodeObject extends EncodeObject {
readonly typeUrl: "/cosmos.tx.v1beta1.TxBody";
readonly value: TxBodyValue;
}
export declare function isTxBodyEncodeObject(encodeObject: EncodeObject): encodeObject is TxBodyEncodeObject;
export declare class Registry {

@@ -81,3 +86,3 @@ private readonly types;

private lookupTypeWithError;
encode({ typeUrl, value }: EncodeObject): Uint8Array;
encode(encodeObject: EncodeObject): Uint8Array;
encodeTxBody(txBodyFields: TxBodyValue): Uint8Array;

@@ -87,1 +92,2 @@ decode({ typeUrl, value }: DecodeObject): any;

}
export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Registry = exports.isPbjsGeneratedType = exports.isTsProtoGeneratedType = void 0;
exports.Registry = exports.isTxBodyEncodeObject = exports.isPbjsGeneratedType = exports.isTsProtoGeneratedType = void 0;
const tx_1 = require("./codec/cosmos/bank/v1beta1/tx");

@@ -22,2 +22,6 @@ const coin_1 = require("./codec/cosmos/base/v1beta1/coin");

};
function isTxBodyEncodeObject(encodeObject) {
return encodeObject.typeUrl === "/cosmos.tx.v1beta1.TxBody";
}
exports.isTxBodyEncodeObject = isTxBodyEncodeObject;
class Registry {

@@ -61,4 +65,5 @@ constructor(customTypes = []) {

}
encode({ typeUrl, value }) {
if (typeUrl === defaultTypeUrls.cosmosTxBody) {
encode(encodeObject) {
const { value, typeUrl } = encodeObject;
if (isTxBodyEncodeObject(encodeObject)) {
return this.encodeTxBody(value);

@@ -68,3 +73,3 @@ }

const instance = isTsProtoGeneratedType(type) ? type.fromPartial(value) : type.create(value);
return Uint8Array.from(type.encode(instance).finish());
return type.encode(instance).finish();
}

@@ -80,3 +85,3 @@ encodeTxBody(txBodyFields) {

const txBody = tx_2.TxBody.fromPartial(Object.assign(Object.assign({}, txBodyFields), { messages: wrappedMessages }));
return Uint8Array.from(tx_2.TxBody.encode(txBody).finish());
return tx_2.TxBody.encode(txBody).finish();
}

@@ -83,0 +88,0 @@ decode({ typeUrl, value }) {

{
"name": "@cosmjs/proto-signing",
"version": "0.25.0-alpha.2",
"version": "0.25.0-alpha.3",
"description": "Utilities for protobuf based signing (Cosmos SDK 0.40+)",

@@ -46,3 +46,3 @@ "contributors": [

"dependencies": {
"@cosmjs/amino": "^0.25.0-alpha.2",
"@cosmjs/amino": "^0.25.0-alpha.3",
"long": "^4.0.0",

@@ -52,6 +52,6 @@ "protobufjs": "~6.10.2"

"devDependencies": {
"@cosmjs/encoding": "^0.25.0-alpha.2",
"@cosmjs/utils": "^0.25.0-alpha.2"
"@cosmjs/encoding": "^0.25.0-alpha.3",
"@cosmjs/utils": "^0.25.0-alpha.3"
},
"gitHead": "76f107db0f0995f09e728f07ac67a02aaa673c6a"
"gitHead": "1471bf018fd89c162dd334d92a6c79a270975e70"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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