Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selected network per origin #17986

Merged
merged 15 commits into from
Apr 20, 2023
Merged

Selected network per origin #17986

merged 15 commits into from
Apr 20, 2023

Commits on Apr 19, 2023

  1. Muli-chain refactoring for tx components

    All of the tx related components now requires `chain_id` parameter when
    calling its API. This is to insure we can track txs among multiple chain id for
    a coin type and also use the correct network url when sending out
    requests. Since we no longer depends on getting selected chain id from
    JsonRPCSevice, TxStateManager now doesn't need to depend on it.
    darkdh committed Apr 19, 2023
    Configuration menu
    Copy the full SHA
    57dcf67 View commit details
    Browse the repository at this point in the history
  2. Support selected network per origin

    We use different pref(kBraveWalletSelectedNetworksPerOrigin) to store that info,
    the original kBraveWalletSelectedNetworks will be a fallback pref when
    origin is not available when setting/getting selected networks.
    Previously cached `chain_ids_` and `network_urls_` are
    removed because `JsonPrefStore` already has a layer of memory cache so we won't
    directly read from disk.
    darkdh committed Apr 19, 2023
    Configuration menu
    Copy the full SHA
    1f4d9b4 View commit details
    Browse the repository at this point in the history
  3. Propagate origin for ChainChangedEvent

    It's used to filter out unwanted origin events, ex. dapp on origin A
    should not be notified when network changed on origin B.
    darkdh committed Apr 19, 2023
    Configuration menu
    Copy the full SHA
    9d3b4fb View commit details
    Browse the repository at this point in the history
  4. Update desktop UI

    darkdh committed Apr 19, 2023
    Configuration menu
    Copy the full SHA
    658aae3 View commit details
    Browse the repository at this point in the history
  5. Optional chain_id for UpdatePendingTransactions & CheckIfBlockTracker…

    …ShouldRun
    
    We should be able to update all the pending txs without specifying
    chain_id especially for cases like wallet unlock. When specifying
    chain_id, we won't need to pull out all the pending txs, ex. approve tx.
    darkdh committed Apr 19, 2023
    Configuration menu
    Copy the full SHA
    e3d792d View commit details
    Browse the repository at this point in the history
  6. Update unit tests

    darkdh committed Apr 19, 2023
    Configuration menu
    Copy the full SHA
    e9101b8 View commit details
    Browse the repository at this point in the history
  7. Update browser tests

    darkdh committed Apr 19, 2023
    Configuration menu
    Copy the full SHA
    42fbb9f View commit details
    Browse the repository at this point in the history
  8. Change active network to default network

    Since now we will consider origin when determining active network,
    brave://settings/wallet/networks will be used to manage default network
    when per origin network is not set yet.
    darkdh committed Apr 19, 2023
    Configuration menu
    Copy the full SHA
    cfd775f View commit details
    Browse the repository at this point in the history
  9. Fix Android build

    This only preseves backward compatibility with what current Android
    behavior is to comply with new interfaces. It doesn't update Android with
    new core network per origin capacity nor some new interfaces with
    fine-grained chain id option.
    darkdh committed Apr 19, 2023
    Configuration menu
    Copy the full SHA
    c05fc3e View commit details
    Browse the repository at this point in the history
  10. fix: remove getNetworkFromTXDataUnion

    josheleonard authored and darkdh committed Apr 19, 2023
    Configuration menu
    Copy the full SHA
    e19615b View commit details
    Browse the repository at this point in the history
  11. Add chain_id to SignMessageRequest, SignTransactionRequest and

    SignAllTransactionsRequest
    
    To simplify front end displaying correct chain_id initiated from the
    dapp rather than the current selected network.
    darkdh committed Apr 19, 2023
    Configuration menu
    Copy the full SHA
    defb633 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    d080694 View commit details
    Browse the repository at this point in the history
  13. CheckIfBlockTrackerShouldRun refactor

    We now have cached pending_chain_ids and new pending_chain_ids as input.
    When the function is called, it will stop out dated chain_id tracker and start
    tracker for new chain_id. If wallet is locked, all trackers will be
    stopped.
    darkdh committed Apr 19, 2023
    Configuration menu
    Copy the full SHA
    5c308f4 View commit details
    Browse the repository at this point in the history
  14. EthLogTracker should be started with chain_id determined from origin.

    It should also be stopped when chain_id changed.
    darkdh committed Apr 19, 2023
    Configuration menu
    Copy the full SHA
    6f41ae7 View commit details
    Browse the repository at this point in the history
  15. Split JsonRpcService.GetChainId into GetDefaultChainId and GetChainId…

    …ForOrigin
    
    Both of them call non mojo GetChainIdSync
    darkdh committed Apr 19, 2023
    Configuration menu
    Copy the full SHA
    0fcaa64 View commit details
    Browse the repository at this point in the history