@cosmjs/launchpad
Advanced tools
Comparing version 0.22.1 to 0.22.2
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.coins = exports.coin = void 0; | ||
exports.parseCoins = exports.coins = exports.coin = void 0; | ||
const math_1 = require("@cosmjs/math"); | ||
@@ -15,2 +15,21 @@ /** Creates a coin */ | ||
exports.coins = coins; | ||
/** | ||
* Takes a coins list like "819966000ucosm,700000000ustake" and parses it | ||
*/ | ||
function parseCoins(input) { | ||
return input | ||
.replace(/\s/g, "") | ||
.split(",") | ||
.filter(Boolean) | ||
.map((part) => { | ||
const match = part.match(/^([0-9]+)([a-zA-Z]+)/); | ||
if (!match) | ||
throw new Error("Got an invalid coin string"); | ||
return { | ||
amount: math_1.Uint64.fromString(match[1]).toString(), | ||
denom: match[2], | ||
}; | ||
}); | ||
} | ||
exports.parseCoins = parseCoins; | ||
//# sourceMappingURL=coins.js.map |
@@ -31,2 +31,3 @@ "use strict"; | ||
Object.defineProperty(exports, "coins", { enumerable: true, get: function () { return coins_1.coins; } }); | ||
Object.defineProperty(exports, "parseCoins", { enumerable: true, get: function () { return coins_1.parseCoins; } }); | ||
var cosmosclient_1 = require("./cosmosclient"); | ||
@@ -33,0 +34,0 @@ Object.defineProperty(exports, "assertIsPostTxSuccess", { enumerable: true, get: function () { return cosmosclient_1.assertIsPostTxSuccess; } }); |
{ | ||
"name": "@cosmjs/launchpad", | ||
"version": "0.22.1", | ||
"version": "0.22.2", | ||
"description": "A client library for the Cosmos SDK 0.37 (cosmoshub-3), 0.38 and 0.39 (Launchpad)", | ||
@@ -44,6 +44,6 @@ "contributors": [ | ||
"dependencies": { | ||
"@cosmjs/crypto": "^0.22.1", | ||
"@cosmjs/encoding": "^0.22.1", | ||
"@cosmjs/math": "^0.22.1", | ||
"@cosmjs/utils": "^0.22.1", | ||
"@cosmjs/crypto": "^0.22.2", | ||
"@cosmjs/encoding": "^0.22.2", | ||
"@cosmjs/math": "^0.22.2", | ||
"@cosmjs/utils": "^0.22.2", | ||
"axios": "^0.19.0" | ||
@@ -54,3 +54,3 @@ }, | ||
}, | ||
"gitHead": "04a086a6cbaa79e52bda62e13913c88d6500139a" | ||
"gitHead": "56d635fc6a0986972bb5e9a57625838627c10c7d" | ||
} |
@@ -9,1 +9,5 @@ export interface Coin { | ||
export declare function coins(amount: number, denom: string): Coin[]; | ||
/** | ||
* Takes a coins list like "819966000ucosm,700000000ustake" and parses it | ||
*/ | ||
export declare function parseCoins(input: string): Coin[]; |
import * as logs from "./logs"; | ||
export { logs }; | ||
export { pubkeyToAddress, rawSecp256k1PubkeyToAddress } from "./address"; | ||
export { Coin, coin, coins } from "./coins"; | ||
export { Coin, coin, coins, parseCoins } from "./coins"; | ||
export { | ||
@@ -6,0 +6,0 @@ Account, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
186964
3279
+ Addedbn.js@4.12.1(transitive)
+ Addedelliptic@6.6.1(transitive)
- Removedbn.js@4.12.0(transitive)
- Removedelliptic@6.6.0(transitive)
Updated@cosmjs/crypto@^0.22.2
Updated@cosmjs/encoding@^0.22.2
Updated@cosmjs/math@^0.22.2
Updated@cosmjs/utils@^0.22.2