Skip to content

Commit

Permalink
Fix/prevent gas price scientific notation (#541)
Browse files Browse the repository at this point in the history
  • Loading branch information
codingki authored Dec 5, 2024
1 parent 94573e0 commit b67ca86
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 6 deletions.
6 changes: 6 additions & 0 deletions .changeset/famous-ladybugs-rule.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@skip-go/client': patch
'@skip-go/widget': patch
---

prevent gas price scientific notation
4 changes: 2 additions & 2 deletions packages/client/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1420,7 +1420,7 @@ export class SkipClient {
price = feeInfo.gasPrice.low;
}

return new GasPrice(Decimal.fromUserInput(price, 18), feeInfo.denom);
return new GasPrice(Decimal.fromUserInput(BigNumber(price).toFixed(), 18), feeInfo.denom);
}

async getFeeInfoForChain(
Expand Down Expand Up @@ -1729,7 +1729,7 @@ export class SkipClient {
if (price === '') {
price = asset.gasPrice.low;
}
return new GasPrice(Decimal.fromUserInput(price, 18), asset.denom);
return new GasPrice(Decimal.fromUserInput(BigNumber(price).toFixed(), 18), asset.denom);
})();
if (!gasPrice) {
return null;
Expand Down
1 change: 1 addition & 0 deletions packages/widget/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"eslint": "^9.9.0",
"eslint-plugin-react-hooks": "^4.6.2",
"node-polyfill-webpack-plugin": "^4.0.0",
"pino-pretty": "^13.0.0",
"postcss-loader": "^8.1.1",
"process": "^0.11.10",
"raw-loader": "^4.0.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/widget/src/hooks/useCosmosFeeAssetValidation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const useCosmosFeeAssetsBalanceValidation = (chainId?: string) => {
if (!a.gasPrice) return undefined;
const price =
a.gasPrice.average || a.gasPrice.high || a.gasPrice.low;
return new GasPrice(Decimal.fromUserInput(price, 18), a.denom);
return new GasPrice(Decimal.fromUserInput(BigNumber(price).toFixed(), 18), a.denom);
})();
if (!gasPrice) return undefined;
const isSwapChain = swapVenues?.map(venue => venue.chainID).includes(chainId);
Expand Down
83 changes: 80 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7688,6 +7688,7 @@ __metadata:
lodash.debounce: ^4.0.8
match-sorter: ^6.3.4
node-polyfill-webpack-plugin: ^4.0.0
pino-pretty: ^13.0.0
pluralize: ^8.0.0
postcss-loader: ^8.1.1
process: ^0.11.10
Expand Down Expand Up @@ -13377,7 +13378,7 @@ __metadata:
languageName: node
linkType: hard

"colorette@npm:^2.0.14":
"colorette@npm:^2.0.14, colorette@npm:^2.0.7":
version: 2.0.20
resolution: "colorette@npm:2.0.20"
checksum: 0c016fea2b91b733eb9f4bcdb580018f52c0bc0979443dad930e5037a968237ac53d9beb98e218d2e9235834f8eebce7f8e080422d6194e957454255bde71d3d
Expand Down Expand Up @@ -14215,6 +14216,13 @@ __metadata:
languageName: node
linkType: hard

"dateformat@npm:^4.6.3":
version: 4.6.3
resolution: "dateformat@npm:4.6.3"
checksum: c3aa0617c0a5b30595122bc8d1bee6276a9221e4d392087b41cbbdf175d9662ae0e50d0d6dcdf45caeac5153c4b5b0844265f8cd2b2245451e3da19e39e3b65d
languageName: node
linkType: hard

"db0@npm:^0.1.4":
version: 0.1.4
resolution: "db0@npm:0.1.4"
Expand Down Expand Up @@ -16283,6 +16291,13 @@ __metadata:
languageName: node
linkType: hard

"fast-copy@npm:^3.0.2":
version: 3.0.2
resolution: "fast-copy@npm:3.0.2"
checksum: 47f584bcede08ab3198559d3e0e093a547d567715b86be2198da6e3366c3c73eed550d97b86f9fb90dae179982b89c15d68187def960f522cdce14bacdfc6184
languageName: node
linkType: hard

"fast-deep-equal@npm:^3.1.1, fast-deep-equal@npm:^3.1.3":
version: 3.1.3
resolution: "fast-deep-equal@npm:3.1.3"
Expand Down Expand Up @@ -16352,7 +16367,7 @@ __metadata:
languageName: node
linkType: hard

"fast-safe-stringify@npm:^2.0.6":
"fast-safe-stringify@npm:^2.0.6, fast-safe-stringify@npm:^2.1.1":
version: 2.1.1
resolution: "fast-safe-stringify@npm:2.1.1"
checksum: a851cbddc451745662f8f00ddb622d6766f9bd97642dabfd9a405fb0d646d69fc0b9a1243cbf67f5f18a39f40f6fa821737651ff1bceeba06c9992ca2dc5bd3d
Expand Down Expand Up @@ -17327,6 +17342,13 @@ __metadata:
languageName: node
linkType: hard

"help-me@npm:^5.0.0":
version: 5.0.0
resolution: "help-me@npm:5.0.0"
checksum: 474436627b6c7d2f406a2768453895889eb2712c8ded4c47658d5c6dd46c2ff3f742be4e4e8dedd57b7f1ac6b28803896a2e026a32a977f507222c16f23ab2e1
languageName: node
linkType: hard

"hey-listen@npm:^1.0.8":
version: 1.0.8
resolution: "hey-listen@npm:1.0.8"
Expand Down Expand Up @@ -19036,7 +19058,7 @@ __metadata:
languageName: node
linkType: hard

"joycon@npm:^3.0.1":
"joycon@npm:^3.0.1, joycon@npm:^3.1.1":
version: 3.1.1
resolution: "joycon@npm:3.1.1"
checksum: 8003c9c3fc79c5c7602b1c7e9f7a2df2e9916f046b0dbad862aa589be78c15734d11beb9fe846f5e06138df22cb2ad29961b6a986ba81c4920ce2b15a7f11067
Expand Down Expand Up @@ -21320,6 +21342,13 @@ __metadata:
languageName: node
linkType: hard

"on-exit-leak-free@npm:^2.1.0":
version: 2.1.2
resolution: "on-exit-leak-free@npm:2.1.2"
checksum: 6ce7acdc7b9ceb51cf029b5239cbf41937ee4c8dcd9d4e475e1777b41702564d46caa1150a744e00da0ac6d923ab83471646a39a4470f97481cf6e2d8d253c3f
languageName: node
linkType: hard

"on-finished@npm:2.4.1, on-finished@npm:^2.3.0":
version: 2.4.1
resolution: "on-finished@npm:2.4.1"
Expand Down Expand Up @@ -21896,6 +21925,15 @@ __metadata:
languageName: node
linkType: hard

"pino-abstract-transport@npm:^2.0.0":
version: 2.0.0
resolution: "pino-abstract-transport@npm:2.0.0"
dependencies:
split2: ^4.0.0
checksum: 4db0cd8a1a7b6d13e76dbb58e6adc057c39e4591c70f601f4a427c030d57dff748ab53954e1ecd3aa6e21c1a22dd38de96432606c6d906a7b9f610543bf1d6e2
languageName: node
linkType: hard

"pino-abstract-transport@npm:v0.5.0":
version: 0.5.0
resolution: "pino-abstract-transport@npm:0.5.0"
Expand All @@ -21906,6 +21944,29 @@ __metadata:
languageName: node
linkType: hard

"pino-pretty@npm:^13.0.0":
version: 13.0.0
resolution: "pino-pretty@npm:13.0.0"
dependencies:
colorette: ^2.0.7
dateformat: ^4.6.3
fast-copy: ^3.0.2
fast-safe-stringify: ^2.1.1
help-me: ^5.0.0
joycon: ^3.1.1
minimist: ^1.2.6
on-exit-leak-free: ^2.1.0
pino-abstract-transport: ^2.0.0
pump: ^3.0.0
secure-json-parse: ^2.4.0
sonic-boom: ^4.0.1
strip-json-comments: ^3.1.1
bin:
pino-pretty: bin.js
checksum: a529219b3ccc99ed6a3e2de00ae6a8d4003344614bce39f836352317c962db8c3f4e9ee45843edc218cb9be618a7318b06fa6fab366d4314b9297d0130bc06f5
languageName: node
linkType: hard

"pino-std-serializers@npm:^4.0.0":
version: 4.0.0
resolution: "pino-std-serializers@npm:4.0.0"
Expand Down Expand Up @@ -24363,6 +24424,13 @@ __metadata:
languageName: node
linkType: hard

"secure-json-parse@npm:^2.4.0":
version: 2.7.0
resolution: "secure-json-parse@npm:2.7.0"
checksum: d9d7d5a01fc6db6115744ba23cf9e67ecfe8c524d771537c062ee05ad5c11b64c730bc58c7f33f60bd6877f96b86f0ceb9ea29644e4040cb757f6912d4dd6737
languageName: node
linkType: hard

"semver@npm:^6.0.0, semver@npm:^6.1.1, semver@npm:^6.1.2, semver@npm:^6.3.0, semver@npm:^6.3.1":
version: 6.3.1
resolution: "semver@npm:6.3.1"
Expand Down Expand Up @@ -24933,6 +25001,15 @@ __metadata:
languageName: node
linkType: hard

"sonic-boom@npm:^4.0.1":
version: 4.2.0
resolution: "sonic-boom@npm:4.2.0"
dependencies:
atomic-sleep: ^1.0.0
checksum: e5e1ffdd3bcb0dee3bf6f7b2ff50dd3ffa2df864dc9d53463f33e225021a28601e91d0ec7e932739824bafd6f4ff3b7090939ac3e34ab1022e01692b41f7e8a3
languageName: node
linkType: hard

"source-map-js@npm:^1.0.1, source-map-js@npm:^1.2.1":
version: 1.2.1
resolution: "source-map-js@npm:1.2.1"
Expand Down

0 comments on commit b67ca86

Please sign in to comment.