From f17e8b77ad1db54c0a0f652c346a3fd8c3d171d3 Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Thu, 13 May 2021 23:05:14 +0200 Subject: [PATCH 1/7] Increase GasPrice.fromString test coverage and check characters early --- packages/launchpad/src/fee.spec.ts | 38 +++++++++++++++++++++++++----- packages/launchpad/src/fee.ts | 2 +- packages/stargate/src/fee.spec.ts | 38 +++++++++++++++++++++++++----- packages/stargate/src/fee.ts | 2 +- 4 files changed, 66 insertions(+), 14 deletions(-) diff --git a/packages/launchpad/src/fee.spec.ts b/packages/launchpad/src/fee.spec.ts index 7a94238ae5..4f5c0163cc 100644 --- a/packages/launchpad/src/fee.spec.ts +++ b/packages/launchpad/src/fee.spec.ts @@ -12,12 +12,38 @@ describe("GasPrice", () => { }); }); - it("can be constructed from a config string", () => { - const inputs = ["3.14", "3", "0.14"]; - inputs.forEach((input) => { - const gasPrice = GasPrice.fromString(`${input}utest`); - expect(gasPrice.amount.toString()).toEqual(input); - expect(gasPrice.denom).toEqual("utest"); + describe("fromString", () => { + it("works", () => { + const inputs = ["3.14", "3", "0.14"]; + inputs.forEach((input) => { + const gasPrice = GasPrice.fromString(`${input}utest`); + expect(gasPrice.amount.toString()).toEqual(input); + expect(gasPrice.denom).toEqual("utest"); + }); + }); + + it("errors for invalid gas price", () => { + // Checks basic format + expect(() => GasPrice.fromString("")).toThrowError(/Invalid gas price string/i); + expect(() => GasPrice.fromString("utkn")).toThrowError(/Invalid gas price string/i); + expect(() => GasPrice.fromString("@utkn")).toThrowError(/Invalid gas price string/i); + expect(() => GasPrice.fromString("234")).toThrowError(/Invalid gas price string/i); + expect(() => GasPrice.fromString("-234tkn")).toThrowError(/Invalid gas price string/i); + // Checks details of + expect(() => GasPrice.fromString("234t")).toThrowError( + /denomination must be between 3 and 127 characters/i, + ); + expect(() => GasPrice.fromString("234tt")).toThrowError( + /denomination must be between 3 and 127 characters/i, + ); + expect(() => + GasPrice.fromString( + "234tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt", + ), + ).toThrowError(/denomination must be between 3 and 127 characters/i); + // Checks details of + expect(() => GasPrice.fromString("3.utkn")).toThrowError(/Fractional part missing/i); + expect(() => GasPrice.fromString("..utkn")).toThrowError(/More than one separator found/i); }); }); }); diff --git a/packages/launchpad/src/fee.ts b/packages/launchpad/src/fee.ts index c76062ccb8..f1c4e8fc2c 100644 --- a/packages/launchpad/src/fee.ts +++ b/packages/launchpad/src/fee.ts @@ -13,7 +13,7 @@ export class GasPrice { } public static fromString(gasPrice: string): GasPrice { - const matchResult = gasPrice.match(/^(?.+?)(?[a-z]+)$/); + const matchResult = gasPrice.match(/^(?[0-9.]+?)(?[a-z]+)$/); if (!matchResult) { throw new Error("Invalid gas price string"); } diff --git a/packages/stargate/src/fee.spec.ts b/packages/stargate/src/fee.spec.ts index 7a94238ae5..4f5c0163cc 100644 --- a/packages/stargate/src/fee.spec.ts +++ b/packages/stargate/src/fee.spec.ts @@ -12,12 +12,38 @@ describe("GasPrice", () => { }); }); - it("can be constructed from a config string", () => { - const inputs = ["3.14", "3", "0.14"]; - inputs.forEach((input) => { - const gasPrice = GasPrice.fromString(`${input}utest`); - expect(gasPrice.amount.toString()).toEqual(input); - expect(gasPrice.denom).toEqual("utest"); + describe("fromString", () => { + it("works", () => { + const inputs = ["3.14", "3", "0.14"]; + inputs.forEach((input) => { + const gasPrice = GasPrice.fromString(`${input}utest`); + expect(gasPrice.amount.toString()).toEqual(input); + expect(gasPrice.denom).toEqual("utest"); + }); + }); + + it("errors for invalid gas price", () => { + // Checks basic format + expect(() => GasPrice.fromString("")).toThrowError(/Invalid gas price string/i); + expect(() => GasPrice.fromString("utkn")).toThrowError(/Invalid gas price string/i); + expect(() => GasPrice.fromString("@utkn")).toThrowError(/Invalid gas price string/i); + expect(() => GasPrice.fromString("234")).toThrowError(/Invalid gas price string/i); + expect(() => GasPrice.fromString("-234tkn")).toThrowError(/Invalid gas price string/i); + // Checks details of + expect(() => GasPrice.fromString("234t")).toThrowError( + /denomination must be between 3 and 127 characters/i, + ); + expect(() => GasPrice.fromString("234tt")).toThrowError( + /denomination must be between 3 and 127 characters/i, + ); + expect(() => + GasPrice.fromString( + "234tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt", + ), + ).toThrowError(/denomination must be between 3 and 127 characters/i); + // Checks details of + expect(() => GasPrice.fromString("3.utkn")).toThrowError(/Fractional part missing/i); + expect(() => GasPrice.fromString("..utkn")).toThrowError(/More than one separator found/i); }); }); }); diff --git a/packages/stargate/src/fee.ts b/packages/stargate/src/fee.ts index 628c0350ad..a41c7ce2df 100644 --- a/packages/stargate/src/fee.ts +++ b/packages/stargate/src/fee.ts @@ -20,7 +20,7 @@ export class GasPrice { } public static fromString(gasPrice: string): GasPrice { - const matchResult = gasPrice.match(/^(?.+?)(?[a-z]+)$/); + const matchResult = gasPrice.match(/^(?[0-9.]+?)(?[a-z]+)$/); if (!matchResult) { throw new Error("Invalid gas price string"); } From 0852f4f5f28b49d16618977339040a9b1074c34a Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Thu, 13 May 2021 23:12:58 +0200 Subject: [PATCH 2/7] Avoid the use of named capture groups --- packages/launchpad/src/fee.ts | 4 ++-- packages/stargate/src/fee.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/launchpad/src/fee.ts b/packages/launchpad/src/fee.ts index f1c4e8fc2c..7622d55126 100644 --- a/packages/launchpad/src/fee.ts +++ b/packages/launchpad/src/fee.ts @@ -13,11 +13,11 @@ export class GasPrice { } public static fromString(gasPrice: string): GasPrice { - const matchResult = gasPrice.match(/^(?[0-9.]+?)(?[a-z]+)$/); + const matchResult = gasPrice.match(/^([0-9.]+?)([a-z]+)$/); if (!matchResult) { throw new Error("Invalid gas price string"); } - const { amount, denom } = matchResult.groups as { readonly amount: string; readonly denom: string }; + const [_, amount, denom] = matchResult; if (denom.length < 3 || denom.length > 127) { throw new Error("Gas price denomination must be between 3 and 127 characters"); } diff --git a/packages/stargate/src/fee.ts b/packages/stargate/src/fee.ts index a41c7ce2df..ee4b0f6fcb 100644 --- a/packages/stargate/src/fee.ts +++ b/packages/stargate/src/fee.ts @@ -20,11 +20,11 @@ export class GasPrice { } public static fromString(gasPrice: string): GasPrice { - const matchResult = gasPrice.match(/^(?[0-9.]+?)(?[a-z]+)$/); + const matchResult = gasPrice.match(/^([0-9.]+?)([a-z]+)$/); if (!matchResult) { throw new Error("Invalid gas price string"); } - const { amount, denom } = matchResult.groups as { readonly amount: string; readonly denom: string }; + const [_, amount, denom] = matchResult; if (denom.length < 3 || denom.length > 127) { throw new Error("Gas price denomination must be between 3 and 127 characters"); } From 7e5924e5f2b55d870b4039da90aedb60a87bac20 Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Tue, 18 May 2021 13:19:58 +0200 Subject: [PATCH 3/7] Add CHANGELOG entry --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cbf741b1f8..d54eb493ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,8 +12,13 @@ and this project adheres to `CosmWasmClient.broadcastTx` and `StargateClient.broadcastTx` ([#800]). This bug was introduced with the switch from broadcast mode "commit" to "sync" in version 0.25.0. +- @cosmjs/launchpad, @cosmjs/stargate: Avoid the use of named capture groups in + `GasPrice.fromString` to restore ES2017 compatibility and make the library + work with Hermes ([#801]; thanks [@AlexBHarley]). [#800]: https://github.com/cosmos/cosmjs/issues/800 +[#801]: https://github.com/cosmos/cosmjs/issues/801 +[@alexbharley]: https://github.com/AlexBHarley ## [0.25.2] - 2021-05-11 From 2b626b6b607b7d1e72a305dc6a0b62288b856849 Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Fri, 14 May 2021 09:28:15 +0200 Subject: [PATCH 4/7] Improve GasPrice docs --- packages/launchpad/src/fee.ts | 7 +++++++ packages/stargate/src/fee.ts | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/packages/launchpad/src/fee.ts b/packages/launchpad/src/fee.ts index 7622d55126..b3949755d3 100644 --- a/packages/launchpad/src/fee.ts +++ b/packages/launchpad/src/fee.ts @@ -3,6 +3,10 @@ import { Decimal, Uint53 } from "@cosmjs/math"; export type FeeTable = Record; +/** + * A gas price, i.e. the price of a single gas. This is typically a fraction of + * the smallest fee token unit, such as 0.012utoken. + */ export class GasPrice { public readonly amount: Decimal; public readonly denom: string; @@ -12,6 +16,9 @@ export class GasPrice { this.denom = denom; } + /** + * Parses a gas price formatted as ``, e.g. `GasPrice.fromString("0.012utoken")`. + */ public static fromString(gasPrice: string): GasPrice { const matchResult = gasPrice.match(/^([0-9.]+?)([a-z]+)$/); if (!matchResult) { diff --git a/packages/stargate/src/fee.ts b/packages/stargate/src/fee.ts index ee4b0f6fcb..4ad98317d2 100644 --- a/packages/stargate/src/fee.ts +++ b/packages/stargate/src/fee.ts @@ -8,6 +8,9 @@ import { coins } from "@cosmjs/proto-signing"; export type FeeTable = Record; /** + * A gas price, i.e. the price of a single gas. This is typically a fraction of + * the smallest fee token unit, such as 0.012utoken. + * * This is the same as GasPrice from @cosmjs/launchpad but those might diverge in the future. */ export class GasPrice { @@ -19,6 +22,9 @@ export class GasPrice { this.denom = denom; } + /** + * Parses a gas price formatted as ``, e.g. `GasPrice.fromString("0.012utoken")`. + */ public static fromString(gasPrice: string): GasPrice { const matchResult = gasPrice.match(/^([0-9.]+?)([a-z]+)$/); if (!matchResult) { From b0b535ec952673f1b32f544aa52e5222a0d14308 Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Fri, 14 May 2021 10:05:44 +0200 Subject: [PATCH 5/7] Improve pattern matching for GasPrice.fromString in @cosmjs/launchpad --- CHANGELOG.md | 2 ++ packages/launchpad/src/fee.spec.ts | 36 +++++++++++++++++------------- packages/launchpad/src/fee.ts | 25 +++++++++++++++++---- 3 files changed, 44 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d54eb493ce..c2f9106da1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ and this project adheres to - @cosmjs/launchpad, @cosmjs/stargate: Avoid the use of named capture groups in `GasPrice.fromString` to restore ES2017 compatibility and make the library work with Hermes ([#801]; thanks [@AlexBHarley]). +- @cosmjs/launchpad: Adapt `GasPrice.fromString` denom pattern to Cosmos SDK + 0.39 rules: reduce denom length to 16 and allow digits in denom. [#800]: https://github.com/cosmos/cosmjs/issues/800 [#801]: https://github.com/cosmos/cosmjs/issues/801 diff --git a/packages/launchpad/src/fee.spec.ts b/packages/launchpad/src/fee.spec.ts index 4f5c0163cc..0185462435 100644 --- a/packages/launchpad/src/fee.spec.ts +++ b/packages/launchpad/src/fee.spec.ts @@ -14,12 +14,21 @@ describe("GasPrice", () => { describe("fromString", () => { it("works", () => { - const inputs = ["3.14", "3", "0.14"]; - inputs.forEach((input) => { - const gasPrice = GasPrice.fromString(`${input}utest`); - expect(gasPrice.amount.toString()).toEqual(input); - expect(gasPrice.denom).toEqual("utest"); - }); + const inputs: Record = { + // Test amounts + "3.14utest": { amount: "3.14", denom: "utest" }, + "3utest": { amount: "3", denom: "utest" }, + "0.14utest": { amount: "0.14", denom: "utest" }, + // Test denoms + "0.14sht": { amount: "0.14", denom: "sht" }, + "0.14testtesttesttest": { amount: "0.14", denom: "testtesttesttest" }, + "0.14ucoin2": { amount: "0.14", denom: "ucoin2" }, + }; + for (const [input, expected] of Object.entries(inputs)) { + const gasPrice = GasPrice.fromString(input); + expect(gasPrice.amount.toString()).withContext(`Input: ${input}`).toEqual(expected.amount); + expect(gasPrice.denom).withContext(`Input: ${input}`).toEqual(expected.denom); + } }); it("errors for invalid gas price", () => { @@ -30,17 +39,14 @@ describe("GasPrice", () => { expect(() => GasPrice.fromString("234")).toThrowError(/Invalid gas price string/i); expect(() => GasPrice.fromString("-234tkn")).toThrowError(/Invalid gas price string/i); // Checks details of - expect(() => GasPrice.fromString("234t")).toThrowError( - /denomination must be between 3 and 127 characters/i, + expect(() => GasPrice.fromString("234t")).toThrowError(/denom must be between 3 and 16 characters/i); + expect(() => GasPrice.fromString("234tt")).toThrowError(/denom must be between 3 and 16 characters/i); + expect(() => GasPrice.fromString("234ttttttttttttttttt")).toThrowError( + /denom must be between 3 and 16 characters/i, ); - expect(() => GasPrice.fromString("234tt")).toThrowError( - /denomination must be between 3 and 127 characters/i, + expect(() => GasPrice.fromString("234ATOM")).toThrowError( + /denom must only contain lower case letters a-z and digits 0-9/i, ); - expect(() => - GasPrice.fromString( - "234tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt", - ), - ).toThrowError(/denomination must be between 3 and 127 characters/i); // Checks details of expect(() => GasPrice.fromString("3.utkn")).toThrowError(/Fractional part missing/i); expect(() => GasPrice.fromString("..utkn")).toThrowError(/More than one separator found/i); diff --git a/packages/launchpad/src/fee.ts b/packages/launchpad/src/fee.ts index b3949755d3..4c638d195f 100644 --- a/packages/launchpad/src/fee.ts +++ b/packages/launchpad/src/fee.ts @@ -3,6 +3,21 @@ import { Decimal, Uint53 } from "@cosmjs/math"; export type FeeTable = Record; +/** + * Denom checker for the Cosmos SDK 0.39 denom pattern + * (https://github.com/cosmos/cosmos-sdk/blob/v0.39.3/types/coin.go#L597-L598). + * + * This is like a regexp but with helpful error messages. + */ +function checkDenom(denom: string): void { + if (denom.length < 3 || denom.length > 16) { + throw new Error("Denom must be between 3 and 16 characters"); + } + if (denom.match(/[^a-z0-9]/)) { + throw new Error("Denom must only contain lower case letters a-z and digits 0-9"); + } +} + /** * A gas price, i.e. the price of a single gas. This is typically a fraction of * the smallest fee token unit, such as 0.012utoken. @@ -18,16 +33,18 @@ export class GasPrice { /** * Parses a gas price formatted as ``, e.g. `GasPrice.fromString("0.012utoken")`. + * + * The denom must match the Cosmos SDK 0.39 pattern (https://github.com/cosmos/cosmos-sdk/blob/v0.39.3/types/coin.go#L597-L598). + * See `GasPrice` in @cosmjs/stargate for a more generic matcher. */ public static fromString(gasPrice: string): GasPrice { - const matchResult = gasPrice.match(/^([0-9.]+?)([a-z]+)$/); + // Use Decimal.fromUserInput and checkDenom for detailed checks and helpful error messages + const matchResult = gasPrice.match(/^([0-9.]+)([a-z][a-z0-9]*)$/i); if (!matchResult) { throw new Error("Invalid gas price string"); } const [_, amount, denom] = matchResult; - if (denom.length < 3 || denom.length > 127) { - throw new Error("Gas price denomination must be between 3 and 127 characters"); - } + checkDenom(denom); const fractionalDigits = 18; const decimalAmount = Decimal.fromUserInput(amount, fractionalDigits); return new GasPrice(decimalAmount, denom); From 8f3260e1acac4c5c997d42d6e6163007d52cf84d Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Fri, 14 May 2021 10:22:34 +0200 Subject: [PATCH 6/7] Adapt GasPrice.fromString in @cosmjs/stargate and increase testing --- CHANGELOG.md | 2 ++ packages/stargate/src/fee.spec.ts | 39 ++++++++++++++++++++----------- packages/stargate/src/fee.ts | 24 +++++++++++++++---- 3 files changed, 47 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c2f9106da1..da8aa94605 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,8 @@ and this project adheres to work with Hermes ([#801]; thanks [@AlexBHarley]). - @cosmjs/launchpad: Adapt `GasPrice.fromString` denom pattern to Cosmos SDK 0.39 rules: reduce denom length to 16 and allow digits in denom. +- @cosmjs/stargate: Adapt `GasPrice.fromString` denom pattern to Cosmos SDK 0.42 + rules: allow lengths up to 128, allow upper case letters and digits. [#800]: https://github.com/cosmos/cosmjs/issues/800 [#801]: https://github.com/cosmos/cosmjs/issues/801 diff --git a/packages/stargate/src/fee.spec.ts b/packages/stargate/src/fee.spec.ts index 4f5c0163cc..e92b5fa86b 100644 --- a/packages/stargate/src/fee.spec.ts +++ b/packages/stargate/src/fee.spec.ts @@ -14,12 +14,27 @@ describe("GasPrice", () => { describe("fromString", () => { it("works", () => { - const inputs = ["3.14", "3", "0.14"]; - inputs.forEach((input) => { - const gasPrice = GasPrice.fromString(`${input}utest`); - expect(gasPrice.amount.toString()).toEqual(input); - expect(gasPrice.denom).toEqual("utest"); - }); + const inputs: Record = { + // Test amounts + "3.14utest": { amount: "3.14", denom: "utest" }, + "3utest": { amount: "3", denom: "utest" }, + "0.14utest": { amount: "0.14", denom: "utest" }, + // Test denoms + "0.14sht": { amount: "0.14", denom: "sht" }, + "0.14testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest": { + amount: "0.14", + denom: + "testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest", + }, + "0.14ucoin2": { amount: "0.14", denom: "ucoin2" }, + // eslint-disable-next-line @typescript-eslint/naming-convention + "0.14FOOBAR": { amount: "0.14", denom: "FOOBAR" }, + }; + for (const [input, expected] of Object.entries(inputs)) { + const gasPrice = GasPrice.fromString(input); + expect(gasPrice.amount.toString()).withContext(`Input: ${input}`).toEqual(expected.amount); + expect(gasPrice.denom).withContext(`Input: ${input}`).toEqual(expected.denom); + } }); it("errors for invalid gas price", () => { @@ -30,17 +45,13 @@ describe("GasPrice", () => { expect(() => GasPrice.fromString("234")).toThrowError(/Invalid gas price string/i); expect(() => GasPrice.fromString("-234tkn")).toThrowError(/Invalid gas price string/i); // Checks details of - expect(() => GasPrice.fromString("234t")).toThrowError( - /denomination must be between 3 and 127 characters/i, - ); - expect(() => GasPrice.fromString("234tt")).toThrowError( - /denomination must be between 3 and 127 characters/i, - ); + expect(() => GasPrice.fromString("234t")).toThrowError(/denom must be between 3 and 128 characters/i); + expect(() => GasPrice.fromString("234tt")).toThrowError(/denom must be between 3 and 128 characters/i); expect(() => GasPrice.fromString( - "234tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt", + "234ttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt", ), - ).toThrowError(/denomination must be between 3 and 127 characters/i); + ).toThrowError(/denom must be between 3 and 128 characters/i); // Checks details of expect(() => GasPrice.fromString("3.utkn")).toThrowError(/Fractional part missing/i); expect(() => GasPrice.fromString("..utkn")).toThrowError(/More than one separator found/i); diff --git a/packages/stargate/src/fee.ts b/packages/stargate/src/fee.ts index 4ad98317d2..d00ae2f262 100644 --- a/packages/stargate/src/fee.ts +++ b/packages/stargate/src/fee.ts @@ -7,6 +7,18 @@ import { coins } from "@cosmjs/proto-signing"; */ export type FeeTable = Record; +/** + * Denom checker for the Cosmos SDK 0.42 denom pattern + * (https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/types/coin.go#L599-L601). + * + * This is like a regexp but with helpful error messages. + */ +function checkDenom(denom: string): void { + if (denom.length < 3 || denom.length > 128) { + throw new Error("Denom must be between 3 and 128 characters"); + } +} + /** * A gas price, i.e. the price of a single gas. This is typically a fraction of * the smallest fee token unit, such as 0.012utoken. @@ -24,16 +36,20 @@ export class GasPrice { /** * Parses a gas price formatted as ``, e.g. `GasPrice.fromString("0.012utoken")`. + * + * The denom must match the Cosmos SDK 0.42 pattern (https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/types/coin.go#L599-L601). + * See `GasPrice` in @cosmjs/stargate for a more generic matcher. + * + * Separators are not yet supported. */ public static fromString(gasPrice: string): GasPrice { - const matchResult = gasPrice.match(/^([0-9.]+?)([a-z]+)$/); + // Use Decimal.fromUserInput and checkDenom for detailed checks and helpful error messages + const matchResult = gasPrice.match(/^([0-9.]+)([a-z][a-z0-9]*)$/i); if (!matchResult) { throw new Error("Invalid gas price string"); } const [_, amount, denom] = matchResult; - if (denom.length < 3 || denom.length > 127) { - throw new Error("Gas price denomination must be between 3 and 127 characters"); - } + checkDenom(denom); const fractionalDigits = 18; const decimalAmount = Decimal.fromUserInput(amount, fractionalDigits); return new GasPrice(decimalAmount, denom); From 8782f162d37fcd4d72a948f1ffe17f2139c16043 Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Tue, 18 May 2021 13:21:20 +0200 Subject: [PATCH 7/7] Improve text "single unit of gas" --- packages/launchpad/src/fee.ts | 2 +- packages/stargate/src/fee.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/launchpad/src/fee.ts b/packages/launchpad/src/fee.ts index 4c638d195f..5f608af9fc 100644 --- a/packages/launchpad/src/fee.ts +++ b/packages/launchpad/src/fee.ts @@ -19,7 +19,7 @@ function checkDenom(denom: string): void { } /** - * A gas price, i.e. the price of a single gas. This is typically a fraction of + * A gas price, i.e. the price of a single unit of gas. This is typically a fraction of * the smallest fee token unit, such as 0.012utoken. */ export class GasPrice { diff --git a/packages/stargate/src/fee.ts b/packages/stargate/src/fee.ts index d00ae2f262..b8ecc6ea75 100644 --- a/packages/stargate/src/fee.ts +++ b/packages/stargate/src/fee.ts @@ -20,7 +20,7 @@ function checkDenom(denom: string): void { } /** - * A gas price, i.e. the price of a single gas. This is typically a fraction of + * A gas price, i.e. the price of a single unit of gas. This is typically a fraction of * the smallest fee token unit, such as 0.012utoken. * * This is the same as GasPrice from @cosmjs/launchpad but those might diverge in the future.