Skip to content
This repository has been archived by the owner on Jun 12, 2023. It is now read-only.

Commit

Permalink
fix: message approval UI (#146)
Browse files Browse the repository at this point in the history
* Fix #143 and #144

* Fix import of FilecoinNumber package

* Update snap manifest

Update aFIL denom

* update snap manifest

Co-authored-by: Bernard <[email protected]>
  • Loading branch information
Schwartz10 and BeroBurny authored Apr 15, 2022
1 parent 30ea3e9 commit 8e6ce28
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/snap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"@filecoin-shipyard/lotus-client-provider-nodejs": "^0.0.5",
"@filecoin-shipyard/lotus-client-rpc": "^0.0.11",
"@filecoin-shipyard/lotus-client-schema": "^0.0.14",
"@glif/filecoin-number": "1.1.0",
"@glif/filecoin-number": "^2.0.0-beta.0",
"@metamask/key-tree": "^3.0.1",
"@zondax/filecoin-signing-tools": "^0.18.3",
"bn.js": "^5.1.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/snap/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/Chainsafe/filsnap.git"
},
"source": {
"shasum": "EPeb4AxmyJ5Srkka/uIIvNbnIC5n6BnxLlEIl0ZEI+0=",
"shasum": "gQMFxZmLjNdKb9XqJRppGaDMXupB6DL2o9stVq5pX94=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
11 changes: 7 additions & 4 deletions packages/snap/src/rpc/signMessage.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {Message, SignedMessage, transactionSign, transactionSignRaw} from "@zondax/filecoin-signing-tools/js";
import {FilecoinNumber} from '@glif/filecoin-number/dist';
import {Wallet} from "../interfaces";
import {getKeyPair} from "../filecoin/account";
import {showConfirmationDialog} from "../util/confirmation";
Expand Down Expand Up @@ -48,12 +49,14 @@ export async function signMessage(
textAreaContent: messageCreator(
[
{message: 'to:', value: message.to},
{message: 'value:', value: message.value !== '0' && message.value},
{message: 'from:', value: message.from},
{message: 'value:', value: message.value !== '0'
&& `${new FilecoinNumber(message.value, 'attofil').toFil()} FIL`},
{message: 'method:', value: message.method},
{message: 'params:', value: message.params},
{message: 'gas limit:', value: message.gaslimit},
{message: 'gas fee cap:', value: message.gasfeecap},
{message: 'gas premium:', value: message.gaspremium},
{message: 'gas limit:', value: `${message.gaslimit} aFIL`},
{message: 'gas fee cap:', value: `${message.gasfeecap} aFIL`},
{message: 'gas premium:', value: `${message.gaspremium} aFIL`},
]
)
},
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2734,10 +2734,10 @@
resolved "https://registry.yarnpkg.com/@gar/promisify/-/promisify-1.1.2.tgz#30aa825f11d438671d585bd44e7fd564535fc210"
integrity sha512-82cpyJyKRoQoRi+14ibCeGPu0CwypgtBAdBhq1WfvagpCZNKqwXbKwXllYSMG91DhmG4jt9gN8eP6lGOtozuaw==

"@glif/filecoin-number@1.1.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@glif/filecoin-number/-/filecoin-number-1.1.0.tgz#6c07038b13426292e56073a0a7362c83278de1e2"
integrity sha512-jfe0H3oapa9iSwK1Od1v1rgTdZBQKGecTfxJM83Sfud78NSb21kcmnOzYy+tUfLLcg7DqRfGHPPRKokFZkmkDA==
"@glif/filecoin-number@^2.0.0-beta.0":
version "2.0.0-beta.0"
resolved "https://registry.yarnpkg.com/@glif/filecoin-number/-/filecoin-number-2.0.0-beta.0.tgz#06834e72673fd1e469e6f68222731710df428fcf"
integrity sha512-HUGBovLfbLzZKtbXNl6iV6xnSDeg1eAyDoFLmgFxPNJutzYbLWJFDEWl++tEb3rIO7sHlcRZhGA87f3J1dSSmw==
dependencies:
bent "7.3.12"
bignumber.js "9.0.1"
Expand Down

0 comments on commit 8e6ce28

Please sign in to comment.