Skip to content

Commit

Permalink
Upgrade fantomas to 4.4.0-beta-001
Browse files Browse the repository at this point in the history
NEW OBSERVATIONS:

this is still vanity alignment:

-        let amountInWei = UnitConversion.Convert.ToWei (amount.ValueToSend, UnitConversion.EthUnit.Ether)
+        let amountInWei =
+            UnitConversion.Convert.ToWei (
+                amount.ValueToSend,
+                UnitConversion.EthUnit.Ether
+            )

        let gasLimit = BigInteger (txMetadata.Fee.GasLimit)

        let data =
            (TokenManager.OfflineTokenServiceWrapper currency)
-                .ComposeInputDataForTransferTransaction(origin, destination, amountInWei, gasLimit)
+                .ComposeInputDataForTransferTransaction(origin,
+                                                        destination,
+                                                        amountInWei,
+                                                        gasLimit)

another vanalign prob (at inherit()):
-type public ElectrumServerReturningInternalErrorException (message: string,
-                                                           code: int,
-                                                           originalRequest: string,
-                                                           originalResponse: string) =
-    inherit ElectrumServerReturningErrorException(message, code, originalRequest, originalResponse)
+type public ElectrumServerReturningInternalErrorException
+    (
+        message: string,
+        code: int,
+        originalRequest: string,
+        originalResponse: string
+    ) =
+    inherit ElectrumServerReturningErrorException (message,
+                                                   code,
+                                                   originalRequest,
+                                                   originalResponse):

another vanalign prob (at new()):

-    new(message: string, cloudFlareError: CloudFlareError, innerException: Exception) =
-        { inherit CommunicationUnsuccessfulException(SPrintF2 "%s (CfErr: %s)" message (cloudFlareError.ToString ()),
-                                                     innerException) }
+    new (message: string,
+         webExStatusCode: WebExceptionStatus,
+         innerException: Exception) =
+        { inherit CommunicationUnsuccessfulException (SPrintF2
+                                                          "%s (WebErr: %s)"
+                                                          message
+                                                          (webExStatusCode.ToString
+                                                              ()),
+                                                      innerException) }

new case for parens removal:

                        ExtractPublicAddressFromConfigFileFunc =
                            (fun file -> file.Name)
and another one:

    let public SetupSentryHook () =
-        AppDomain.CurrentDomain.UnhandledException.AddHandler (UnhandledExceptionEventHandler (OnUnhandledException))
+        AppDomain.CurrentDomain.UnhandledException.AddHandler (
+            UnhandledExceptionEventHandler (OnUnhandledException)
+        )

no need to split the :: line:

-                    acc.Add (head.PublicAddress, head.Currency.ToString () :: existingCurrenciesForHeadAddress)
+                    acc.Add (
+                        head.PublicAddress,
+                        head.Currency.ToString ()
+                        :: existingCurrenciesForHeadAddress
+                    )

nit:
-            with ex when (FSharpUtil.FindException<ResourceUnavailabilityException> ex).IsSome -> return None
+            with ex when
+                (FSharpUtil.FindException<ResourceUnavailabilityException> ex)
+                    .IsSome -> return None
should be:
-            with ex when (FSharpUtil.FindException<ResourceUnavailabilityException> ex).IsSome -> return None
+            with ex when
+                (FSharpUtil.FindException<ResourceUnavailabilityException> ex).IsSome
+                -> return None

REVIEW MERGED commit messages from prev history:

    New bugs:
    fsprojects/fantomas#1223
    fsprojects/fantomas#1222

    Things to report:

    - this should make it end with |> Some:
             let consistencyConfig =
                 if mode = ServerSelectionMode.Fast then
    -                Some (OneServerConsistentWithCertainValueOrTwoServers cacheOrInitialBalanceMatchFunc)
    +                Some
    +                    (OneServerConsistentWithCertainValueOrTwoServers
    +                        cacheOrInitialBalanceMatchFunc)

    - are we sure it cannot be in a single line?:
             member __.GetLastCachedData (): CachedNetworkData =
                 lock
                     cacheFiles.CachedNetworkData
    -                (fun _ -> sessionCachedNetworkData)
    +                (fun _ -> sessionCachedNetworkData
    +                )

    - are we sure it cannot be in a single line?:
                raise
                    (TlsNotSupportedYetInGWalletException ("TLS not yet supported"))
                raise (
                    TlsNotSupportedYetInGWalletException ("TLS not yet supported")
                )
  • Loading branch information
knocte committed Jan 25, 2021
1 parent cce5221 commit 2d865f8
Show file tree
Hide file tree
Showing 33 changed files with 3,696 additions and 1,523 deletions.
593 changes: 420 additions & 173 deletions src/GWallet.Backend/Account.fs

Large diffs are not rendered by default.

42 changes: 27 additions & 15 deletions src/GWallet.Backend/AccountTypes.fs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,12 @@ type IAccount =
abstract PublicAddress: string

[<AbstractClass>]
type BaseAccount (currency: Currency,
accountFile: FileRepresentation,
fromAccountFileToPublicAddress: FileRepresentation -> string) =
type BaseAccount
(
currency: Currency,
accountFile: FileRepresentation,
fromAccountFileToPublicAddress: FileRepresentation -> string
) =
member val AccountFile = accountFile

abstract Kind: AccountKind
Expand All @@ -56,27 +59,36 @@ type BaseAccount (currency: Currency,
member val PublicAddress = fromAccountFileToPublicAddress accountFile


type NormalAccount (currency: Currency,
accountFile: FileRepresentation,
fromAccountFileToPublicAddress: FileRepresentation -> string) =
inherit BaseAccount(currency, accountFile, fromAccountFileToPublicAddress)
type NormalAccount
(
currency: Currency,
accountFile: FileRepresentation,
fromAccountFileToPublicAddress: FileRepresentation -> string
) =
inherit BaseAccount (currency, accountFile, fromAccountFileToPublicAddress)

member internal __.GetEncryptedPrivateKey () =
accountFile.Content ()

override __.Kind = AccountKind.Normal

type ReadOnlyAccount (currency: Currency,
accountFile: FileRepresentation,
fromAccountFileToPublicAddress: FileRepresentation -> string) =
inherit BaseAccount(currency, accountFile, fromAccountFileToPublicAddress)
type ReadOnlyAccount
(
currency: Currency,
accountFile: FileRepresentation,
fromAccountFileToPublicAddress: FileRepresentation -> string
) =
inherit BaseAccount (currency, accountFile, fromAccountFileToPublicAddress)

override __.Kind = AccountKind.ReadOnly

type ArchivedAccount (currency: Currency,
accountFile: FileRepresentation,
fromAccountFileToPublicAddress: FileRepresentation -> string) =
inherit BaseAccount(currency, accountFile, fromAccountFileToPublicAddress)
type ArchivedAccount
(
currency: Currency,
accountFile: FileRepresentation,
fromAccountFileToPublicAddress: FileRepresentation -> string
) =
inherit BaseAccount (currency, accountFile, fromAccountFileToPublicAddress)

member internal __.GetUnencryptedPrivateKey () =
accountFile.Content ()
Expand Down
4 changes: 3 additions & 1 deletion src/GWallet.Backend/BlockExplorer.fs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ module BlockExplorer =
"https://gastracker.io/addr/"
| Currency.SAI
| Currency.DAI ->
SPrintF1 "https://etherscan.io/token/%s?a=" (TokenManager.GetTokenContractAddress account.Currency)
SPrintF1
"https://etherscan.io/token/%s?a="
(TokenManager.GetTokenContractAddress account.Currency)

Uri (baseUrl + account.PublicAddress)

Expand Down
Loading

0 comments on commit 2d865f8

Please sign in to comment.