cosmos-wallet
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -0,1 +1,3 @@ | ||
import { Coin } from '@cosmjs/amino'; | ||
import { AccountData } from '@cosmjs/proto-signing'; | ||
export declare function getCosmosAddressPrefix(chainId?: string): string; | ||
@@ -5,2 +7,11 @@ export declare function getCosmosAddress(publicKey: Uint8Array, chainId?: string): string; | ||
export declare function getPublicKey(privkey: Uint8Array): Promise<Uint8Array>; | ||
export declare function stringifySignDocValues(signDoc: any): any; | ||
export declare function parseSignDocValues(signDoc: any): any; | ||
export declare function formatDirectSignDoc(fee: Coin[], pubkey: string, gasLimit: number, accountNumber: number, sequence: number, bodyBytes: string, chainId: string): import("@cosmjs/proto-signing/build/codec/cosmos/tx/v1beta1/tx").SignDoc; | ||
export declare function stringifyAccountDataValues(account: AccountData): { | ||
pubkey: string; | ||
address: string; | ||
algo: import("@cosmjs/proto-signing").Algo; | ||
}; | ||
export declare function parseAccountDataValues(account: any): any; | ||
//# sourceMappingURL=utils.d.ts.map |
@@ -11,6 +11,11 @@ "use strict"; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const long_1 = __importDefault(require("long")); | ||
const crypto_1 = require("@cosmjs/crypto"); | ||
const amino_1 = require("@cosmjs/amino"); | ||
const encoding_1 = require("@cosmjs/encoding"); | ||
const amino_1 = require("@cosmjs/amino"); | ||
const proto_signing_1 = require("@cosmjs/proto-signing"); | ||
const constants_1 = require("../constants"); | ||
@@ -41,6 +46,3 @@ function getCosmosAddressPrefix(chainId) { | ||
function getAddressFromPublicKey(publicKey, prefix = 'cosmos') { | ||
const pubKey = { | ||
type: amino_1.pubkeyType.secp256k1, | ||
value: encoding_1.toBase64(publicKey), | ||
}; | ||
const pubKey = { type: amino_1.pubkeyType.secp256k1, value: encoding_1.toBase64(publicKey) }; | ||
return amino_1.pubkeyToAddress(pubKey, prefix); | ||
@@ -56,2 +58,24 @@ } | ||
exports.getPublicKey = getPublicKey; | ||
function stringifySignDocValues(signDoc) { | ||
return Object.assign(Object.assign({}, signDoc), { bodyBytes: encoding_1.toHex(signDoc.bodyBytes), authInfoBytes: encoding_1.toHex(signDoc.authInfoBytes), accountNumber: signDoc.accountNumber.toString(16) }); | ||
} | ||
exports.stringifySignDocValues = stringifySignDocValues; | ||
function parseSignDocValues(signDoc) { | ||
return Object.assign(Object.assign({}, signDoc), { bodyBytes: encoding_1.fromHex(signDoc.bodyBytes), authInfoBytes: encoding_1.fromHex(signDoc.authInfoBytes), accountNumber: new long_1.default(signDoc.accountNumber) }); | ||
} | ||
exports.parseSignDocValues = parseSignDocValues; | ||
function formatDirectSignDoc(fee, pubkey, gasLimit, accountNumber, sequence, bodyBytes, chainId) { | ||
const authInfoBytes = proto_signing_1.makeAuthInfoBytes([pubkey], fee, gasLimit, sequence); | ||
const signDoc = proto_signing_1.makeSignDoc(encoding_1.fromHex(bodyBytes), authInfoBytes, chainId, accountNumber); | ||
return signDoc; | ||
} | ||
exports.formatDirectSignDoc = formatDirectSignDoc; | ||
function stringifyAccountDataValues(account) { | ||
return Object.assign(Object.assign({}, account), { pubkey: encoding_1.toHex(account.pubkey) }); | ||
} | ||
exports.stringifyAccountDataValues = stringifyAccountDataValues; | ||
function parseAccountDataValues(account) { | ||
return Object.assign(Object.assign({}, account), { pubkey: encoding_1.fromHex(account.pubkey) }); | ||
} | ||
exports.parseAccountDataValues = parseAccountDataValues; | ||
//# sourceMappingURL=utils.js.map |
{ | ||
"name": "cosmos-wallet", | ||
"description": "Cosmos Wallet with Direct and Amino signing", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"author": "Pedro Gomes <github.com/pedrouid>", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
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
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
1613023
2632
0