Skip to content

Commit

Permalink
Merge branch 'master' into staging-ln
Browse files Browse the repository at this point in the history
  • Loading branch information
Beerosagos committed Nov 20, 2023
2 parents c437586 + b3f9687 commit eb72e1c
Show file tree
Hide file tree
Showing 517 changed files with 41,845 additions and 20,799 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
path: frontends/qt/build/linux/bitbox-*.rpm
name: BitBoxApp-linux-${{github.sha}}.rpm
macos:
runs-on: macos-11
runs-on: macos-12
steps:
- name: Clone the repo
uses: actions/checkout@v2
Expand Down
5 changes: 4 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ linters-settings:
line-length: 120
# allow long comments.
exclude: '//'
revive:
rules:
- name: exported
disabled: false

linters:
enable-all: true
Expand Down Expand Up @@ -133,7 +137,6 @@ linters:
- gocyclo
- nosnakecase
- interfacebloat
- revive
- musttag
- structcheck
- deadcode
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Changelog

## Unreleased
- Drop support for SAI token
- Ability to connect Ethereum (mainnet) wallets to dapps using WalletConnect
- Log Javascript console messages in the app log.txt
- Add amounts hiding feature to enhance privacy when using the app in public

## 4.39.0
- Bundle BitBox02 firmware version v9.15.0
- Display the wallet root fingerprint in the account info and device settings

## 4.38.0
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ buildweb:
node --version
npm --version
rm -rf ${WEBROOT}/build
cd ${WEBROOT} && npm ci --ignore-scripts
cd ${WEBROOT} && npm ci
cd ${WEBROOT} && npm run build
webdev:
cd ${WEBROOT} && $(MAKE) dev
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,3 +190,7 @@ Get Bitcoin Testnet coins here: https://coinfaucet.eu/en/btc-testnet/
Get Litecoin Testnet coins here: https://tltc.bitaps.com/

Get Ethereum Goerli coins here: https://goerlifaucet.com/

Get Ethereum Sepolia coins here: https://faucet.sepolia.dev/

In case any of the Ethereum faucets are not working, you can try others from here: https://faucetlink.to (some require account creation)
30 changes: 26 additions & 4 deletions backend/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ func sortAccounts(accounts []accounts.Interface) {
return 4, true
case params.GoerliChainConfig.ChainID.Uint64():
return 5, true
case params.SepoliaChainConfig.ChainID.Uint64():
return 6, true
}
}
return 0, false
Expand Down Expand Up @@ -161,7 +163,7 @@ func (backend *Backend) SupportedCoins(keystore keystore.Keystore) []coinpkg.Cod
allCoins := []coinpkg.Code{
coinpkg.CodeBTC, coinpkg.CodeTBTC, coinpkg.CodeRBTC,
coinpkg.CodeLTC, coinpkg.CodeTLTC,
coinpkg.CodeETH, coinpkg.CodeGOETH,
coinpkg.CodeETH, coinpkg.CodeGOETH, coinpkg.CodeSEPETH,
}
var availableCoins []coinpkg.Code
for _, coinCode := range allCoins {
Expand Down Expand Up @@ -269,7 +271,7 @@ func (backend *Backend) createAndPersistAccountConfig(
},
accountsConfig,
)
case coinpkg.CodeETH, coinpkg.CodeGOETH:
case coinpkg.CodeETH, coinpkg.CodeGOETH, coinpkg.CodeSEPETH:
bip44Coin := "1'"
if coinCode == coinpkg.CodeETH {
bip44Coin = "60'"
Expand Down Expand Up @@ -614,7 +616,7 @@ func (backend *Backend) persistBTCAccountConfig(
configs []scriptTypeWithKeypath,
accountsConfig *config.AccountsConfig,
) error {
log := backend.log.WithField("code", code).WithField("name", name)
log := backend.log.WithField("code", code)
var supportedConfigs []scriptTypeWithKeypath
for _, cfg := range configs {
if keystore.SupportsAccount(coin, cfg.scriptType) {
Expand Down Expand Up @@ -796,7 +798,7 @@ func (backend *Backend) persistDefaultAccountConfigs(keystore keystore.Keystore,
}
}
} else {
for _, coinCode := range []coinpkg.Code{coinpkg.CodeTBTC, coinpkg.CodeTLTC, coinpkg.CodeGOETH} {
for _, coinCode := range []coinpkg.Code{coinpkg.CodeTBTC, coinpkg.CodeTLTC, coinpkg.CodeGOETH, coinpkg.CodeSEPETH} {
if backend.config.AppConfig().Backend.DeprecatedCoinActive(coinCode) {
if _, err := backend.createAndPersistAccountConfig(
coinCode, 0, false, "", keystore, nil, accountsConfig); err != nil {
Expand Down Expand Up @@ -1099,3 +1101,23 @@ func (backend *Backend) checkAccountUsed(account accounts.Interface) {
backend.emitAccountsStatusChanged()
backend.maybeAddHiddenUnusedAccounts()
}

// LookupEthAccountCode takes an Ethereum address and returns the corresponding account code and account name
// Used for handling Wallet Connect requests from anywhere in the app
// Implemented only for pure ETH accounts (not ERC20s), as all Wallet Connect interactions are handled through the root ETH accounts.
func (backend *Backend) LookupEthAccountCode(address string) (accountsTypes.Code, string, error) {
for _, account := range backend.Accounts() {
ethAccount, ok := account.(*eth.Account)
if !ok {
continue
}
matches, err := ethAccount.MatchesAddress(address)
if err != nil {
return "", "", err
}
if matches && !eth.IsERC20(ethAccount) {
return ethAccount.Config().Config.Code, ethAccount.Config().Config.Name, nil
}
}
return "", "", errp.Newf("Account with address: %s not found", address)
}
5 changes: 4 additions & 1 deletion backend/accounts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ func TestSortAccounts(t *testing.T) {
{Code: "acct-btc-3", CoinCode: coinpkg.CodeBTC, SigningConfigurations: btcConfig("m/84'/0'/2'")},
{Code: "acct-btc-2", CoinCode: coinpkg.CodeBTC, SigningConfigurations: btcConfig("m/84'/0'/1'")},
{Code: "acct-goeth", CoinCode: coinpkg.CodeGOETH},
{Code: "acct-sepeth", CoinCode: coinpkg.CodeSEPETH},
{Code: "acct-ltc", CoinCode: coinpkg.CodeLTC},
{Code: "acct-tltc", CoinCode: coinpkg.CodeTLTC},
{Code: "acct-tbtc", CoinCode: coinpkg.CodeTBTC},
Expand All @@ -156,6 +157,7 @@ func TestSortAccounts(t *testing.T) {
"acct-eth-2-eth-erc20-bat",
"acct-eth-2-eth-erc20-usdt",
"acct-goeth",
"acct-sepeth",
}

for i, acct := range backend.Accounts() {
Expand Down Expand Up @@ -415,6 +417,7 @@ func newBackend(t *testing.T, testing, regtest bool) *Backend {
for _, code := range []coinpkg.Code{
coinpkg.CodeETH,
coinpkg.CodeGOETH,
coinpkg.CodeSEPETH,
} {
c, err := b.Coin(code)
require.NoError(t, err)
Expand Down Expand Up @@ -456,7 +459,7 @@ func TestSupportedCoins(t *testing.T) {
b := newBackend(t, testnetEnabled, regtestDisabled)
defer b.Close()
require.Equal(t,
[]coinpkg.Code{coinpkg.CodeTBTC, coinpkg.CodeTLTC, coinpkg.CodeGOETH},
[]coinpkg.Code{coinpkg.CodeTBTC, coinpkg.CodeTLTC, coinpkg.CodeGOETH, coinpkg.CodeSEPETH},
b.SupportedCoins(&keystoremock.KeystoreMock{
SupportsCoinFunc: func(coin coinpkg.Coin) bool {
return true
Expand Down
4 changes: 3 additions & 1 deletion backend/aopp.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ import (
"github.com/digitalbitbox/bitbox-wallet-app/backend/accounts"
accountsTypes "github.com/digitalbitbox/bitbox-wallet-app/backend/accounts/types"
coinpkg "github.com/digitalbitbox/bitbox-wallet-app/backend/coins/coin"
"github.com/digitalbitbox/bitbox-wallet-app/backend/keystore"
"github.com/digitalbitbox/bitbox-wallet-app/backend/signing"
"github.com/digitalbitbox/bitbox-wallet-app/util/errp"
"github.com/digitalbitbox/bitbox-wallet-app/util/observable"
"github.com/digitalbitbox/bitbox-wallet-app/util/observable/action"
"github.com/digitalbitbox/bitbox02-api-go/api/firmware"
Expand Down Expand Up @@ -346,7 +348,7 @@ func (backend *Backend) aoppChooseAccount(code accountsTypes.Code) {
addr.AbsoluteKeypath(),
)
if err != nil {
if firmware.IsErrorAbort(err) {
if errp.Cause(err) == keystore.ErrSigningAborted {
log.WithError(err).Error("user aborted msg signing")
backend.aoppSetError(errAOPPSigningAborted)
return
Expand Down
Loading

0 comments on commit eb72e1c

Please sign in to comment.