Skip to content

Commit

Permalink
Merge pull request #3368 from superhero-com/release/v2.3.1
Browse files Browse the repository at this point in the history
Release v2.3.1
  • Loading branch information
CedrikNikita authored Nov 1, 2024
2 parents 39b9483 + ffeabfe commit 12632e5
Show file tree
Hide file tree
Showing 67 changed files with 1,394 additions and 553 deletions.
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
UNFINISHED_FEATURES=true
ETHERSCAN_API_KEY=
WALLET_CONNECT_PROJECT_ID=
TOKEN_SALES_URL_MAINNET=
TOKEN_SALES_URL_TESTNET=
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ jobs:
env:
APP_NAME: wallet
WALLET_CONNECT_PROJECT_ID: ${{ secrets.WALLET_CONNECT_PROJECT_ID }}
TOKEN_SALES_URL_MAINNET: ${{ secrets.TOKEN_SALES_URL_MAINNET }}
TOKEN_SALES_URL_TESTNET: ${{ secrets.TOKEN_SALES_URL_TESTNET }}
steps:
- uses: actions/checkout@v4
with:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ jobs:
runs-on: ubuntu-latest
env:
APP_NAME: wallet
TOKEN_SALES_URL_MAINNET: ${{ secrets.TOKEN_SALES_URL_MAINNET }}
TOKEN_SALES_URL_TESTNET: ${{ secrets.TOKEN_SALES_URL_TESTNET }}
steps:
- uses: actions/checkout@v4
with:
Expand Down
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,37 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [2.3.1](https://github.com/Superhero-com/superhero-wallet/compare/v2.3.0...v2.3.1) (2024-11-01)


### Features

* add additional info in token details ([7d442c8](https://github.com/Superhero-com/superhero-wallet/commit/7d442c8d0e931f28a39ca2ec410e65fcd569d442))
* add token balance to accounts total ([3853a6b](https://github.com/Superhero-com/superhero-wallet/commit/3853a6b533a5dface18ea2de0403393f96e1570e))
* **aeternity:** show fiat value for tokens with price ([60aa5e2](https://github.com/Superhero-com/superhero-wallet/commit/60aa5e21ca8446725a38873cad060f8c7c6815e6))
* allow copy private key when password skipped ([4998613](https://github.com/Superhero-com/superhero-wallet/commit/4998613d3954c093c3596fd6a487f11c41b4a89b))
* choose protocol when creating new wallet ([765dc53](https://github.com/Superhero-com/superhero-wallet/commit/765dc5375ee8a5959915b53d9fccdb23bf9e4815))
* enrich token swap transactions ([fb62884](https://github.com/Superhero-com/superhero-wallet/commit/fb6288498a6ea5ef3d037d32684c7e7846f94efd))
* preserve tokenSales info in case fetching failed ([c4cf011](https://github.com/Superhero-com/superhero-wallet/commit/c4cf011661325771308309c8ff99cd70e83f805f))
* reusable component for selecting account from a dropdown while typing ([1ae39b9](https://github.com/Superhero-com/superhero-wallet/commit/1ae39b92569a5a9e2abdb412485af2fc6a45e04e))
* show price for tokens ([cfbc24b](https://github.com/Superhero-com/superhero-wallet/commit/cfbc24b4baeb14042e39147f28257b9c5163cd43))
* skip password protection for web ([435d3d0](https://github.com/Superhero-com/superhero-wallet/commit/435d3d0967b33516856969610e55edd6715d5ba8))
* use usd currency name instead of dollar sign ([e1fde63](https://github.com/Superhero-com/superhero-wallet/commit/e1fde63c028fc7c3e36d854ccd834f824d30c7be))


### Bug Fixes

* **aeternity:** show fiat value for transaction that have coin spent ([8966088](https://github.com/Superhero-com/superhero-wallet/commit/896608841b21fdd1c4ad9171f4ec787f4680d5e3))
* **deep-link:** be able to return networkId ([e590832](https://github.com/Superhero-com/superhero-wallet/commit/e590832470cfdb4ff763edee4c726151ef57d2ca))
* show token sale label only for token sale transactions ([c2c3572](https://github.com/Superhero-com/superhero-wallet/commit/c2c3572e13f5c06ae78b288b8377f436677e1196))


### Maintenance

* address book items use panel items ([0572fa5](https://github.com/Superhero-com/superhero-wallet/commit/0572fa56ab438356874d3efa5c429394f00703ce))
* adjust asset details page ([1d609a4](https://github.com/Superhero-com/superhero-wallet/commit/1d609a4e5cdd9bdb4095f802dd8b938c9c01a639))
* rename tokenSwaps to tokenSales ([4a7d815](https://github.com/Superhero-com/superhero-wallet/commit/4a7d8158520a47e70b0b429009108835d6fdd7c5))

## [2.3.0](https://github.com/Superhero-com/superhero-wallet/compare/v2.2.11...v2.3.0) (2024-10-16)


Expand Down
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "com.superhero.cordova"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 20300
versionName "2.3.0"
versionCode 20301
versionName "2.3.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
Expand Down
4 changes: 2 additions & 2 deletions ios/App/App.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 2.3.0;
MARKETING_VERSION = 2.3.1;
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
PRODUCT_BUNDLE_IDENTIFIER = com.superhero.cordova;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -390,7 +390,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 2.3.0;
MARKETING_VERSION = 2.3.1;
PRODUCT_BUNDLE_IDENTIFIER = com.superhero.cordova;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "";
Expand Down
30 changes: 23 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "superhero-wallet",
"version": "2.3.0",
"version": "2.3.1",
"description": "Superhero wallet",
"author": "Superhero",
"license": "MIT",
Expand Down Expand Up @@ -32,7 +32,7 @@
"release": "standard-version"
},
"dependencies": {
"@aeternity/aepp-calldata": "^1.7.0",
"@aeternity/aepp-calldata": "^1.8.0",
"@aeternity/aepp-sdk": "13.3.2",
"@aeternity/bip39": "^0.1.0",
"@aeternity/json-bigint": "^0.3.1",
Expand Down
22 changes: 19 additions & 3 deletions src/composables/accounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ import type {
ProtocolRecord,
} from '@/types';
import {
PROTOCOLS,
ACCOUNT_TYPES,
ACCOUNT_TYPES_LIST,
MODAL_PROTOCOL_SELECT,
PROTOCOL_LIST,
PROTOCOLS,
STORAGE_KEYS,
ACCOUNT_TYPES_LIST,
ACCOUNT_TYPES,
} from '@/constants';
import {
createCallbackRegistry,
Expand All @@ -25,12 +26,14 @@ import {
prepareAccountSelectOptions,
watchUntilTruthy,
} from '@/utils';
import { tg } from '@/popup/plugins/i18n';
import migrateAccountsVuexToComposable from '@/migrations/001-accounts-vuex-to-composable';

import { ProtocolAdapterFactory } from '@/lib/ProtocolAdapterFactory';

import { useStorageRef } from './storageRef';
import { useAuth } from './auth';
import { useModals } from './modals';

const {
addCallback: onAccountChange,
Expand All @@ -50,6 +53,8 @@ export const useAccounts = createCustomScopedComposable(() => {
encryptionKey,
} = useAuth();

const { openModal } = useModals();

const areAccountsRestored = ref(false);
const arePrivateKeysAccountsDecrypted = ref(false);
const arePrivateKeysAccountsEncryptedRestored = ref(false);
Expand Down Expand Up @@ -293,6 +298,17 @@ export const useAccounts = createCustomScopedComposable(() => {
addRawAccount({ isRestored: true, protocol, type: ACCOUNT_TYPES.hdWallet });
}
});

// If no accounts was discovered user is asked to choose default protocol account.
if (!accountsAddressList.value.length) {
try {
const protocol = await openModal<Protocol>(MODAL_PROTOCOL_SELECT, {
title: tg('modals.createAccount.title'),
subtitle: tg('modals.createAccount.generateOrImport'),
});
addRawAccount({ isRestored: true, protocol, type: ACCOUNT_TYPES.hdWallet });
} catch (error) { /* NOOP */ }
}
}

function resetAccounts() {
Expand Down
33 changes: 19 additions & 14 deletions src/composables/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import {
IS_IOS,
IS_MOBILE_APP,
IS_OFFSCREEN_TAB,
RUNNING_IN_TESTS,
STORAGE_KEYS,
UNFINISHED_FEATURES,
} from '@/constants';
import { STUB_ACCOUNT } from '@/constants/stubs';
import {
Expand Down Expand Up @@ -292,8 +292,22 @@ export const useAuth = createCustomScopedComposable(() => {
isAuthenticated.value = true;
}
} else if (isMnemonicEncrypted.value) {
// Check if extension can be restored without requiring password
if (!encryptionKey.value && IS_EXTENSION && !IS_OFFSCREEN_TAB) {
// Environments that will always ask user about password
const autoLoginDisabledEnv = IS_OFFSCREEN_TAB || RUNNING_IN_TESTS;

// Attempt to log in with the default password that is set when a user skips
// password protection. This check needs to go first as we need to know
// if default password was used.
if (!encryptionKey.value && !autoLoginDisabledEnv) {
try {
await authenticateWithPassword(STUB_ACCOUNT.password);
isUsingDefaultPassword.value = true;
} catch (error) { /* NOOP */ }
}

// If default password auth failed, check if extension can be restored
// by using data stored in the background process.
if (!encryptionKey.value && !autoLoginDisabledEnv && IS_EXTENSION) {
setLoaderVisible(true);
const sessionEncryptionKey = await getSessionEncryptionKey();
if (sessionEncryptionKey) {
Expand All @@ -304,17 +318,7 @@ export const useAuth = createCustomScopedComposable(() => {
setLoaderVisible(false);
}

// If restoring from background failed try to use the dev mode password set
// when using "Skip" when setting password.
if (!encryptionKey.value && UNFINISHED_FEATURES && !IS_OFFSCREEN_TAB) {
await authenticateWithPassword(STUB_ACCOUNT.password)
.then(() => {
isUsingDefaultPassword.value = true;
})
.catch(() => openPasswordLoginModal());
}

// Finally if other attempts failed ask user for the password
// Finally if other attempts failed, ask user for the password.
if (!encryptionKey.value) {
await openPasswordLoginModal();
}
Expand Down Expand Up @@ -434,6 +438,7 @@ export const useAuth = createCustomScopedComposable(() => {
lockWallet,
logout,
setMnemonicAndInitializeAuthentication,
setPassword,
updatePassword,
};
});
10 changes: 4 additions & 6 deletions src/composables/balances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ export function useBalances() {

const balance = computed(() => balances.value[activeAccount.value.address] || new BigNumber(0));

const accountsTotalBalance = computed(() => {
const result = accounts.value.reduce(
const accountsTotalBalance = computed(
() => accounts.value.reduce(
(total, account) => {
const accountBalance = balances.value?.[account.address];
if (!accountBalance) {
Expand All @@ -52,10 +52,8 @@ export function useBalances() {
return total + (getCurrentCurrencyRate(account.protocol) * accountBalance.toNumber());
},
0,
);

return result.toFixed(2);
});
).toFixed(2),
);

function getAccountBalance(address: string) {
return balances.value[address] || new BigNumber(0);
Expand Down
2 changes: 1 addition & 1 deletion src/composables/currencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export function useCurrencies({
function formatCurrency(value: number): string {
return new Intl.NumberFormat(
DEFAULT_LOCALE,
{ style: 'currency', currencyDisplay: 'narrowSymbol', currency: currentCurrencyCode.value },
{ style: 'currency', currencyDisplay: 'code', currency: currentCurrencyCode.value },
).format(value);
}

Expand Down
29 changes: 28 additions & 1 deletion src/composables/fungibleTokens.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
/* eslint-disable no-param-reassign */

import { computed, watch } from 'vue';
import { uniqBy, isEmpty } from 'lodash-es';
import BigNumber from 'bignumber.js';
import { Encoding, Tag } from '@aeternity/aepp-sdk';

import { isAssetCoin, toShiftedBigNumber } from '@/utils';
import type {
AccountAddress,
Expand All @@ -24,7 +26,7 @@ import FungibleTokenFullInterfaceACI from '@/protocols/aeternity/aci/FungibleTok
import { AE_COIN_PRECISION } from '@/protocols/aeternity/config';
import { aettosToAe, categorizeContractCallTxObject } from '@/protocols/aeternity/helpers';

import { uniqBy } from 'lodash-es';
import { useCurrencies } from './currencies';
import { useAccounts } from './accounts';
import { useAeSdk } from './aeSdk';
import { useTippingContracts } from './tippingContracts';
Expand Down Expand Up @@ -63,6 +65,7 @@ const tokensAvailable = computed((): ProtocolRecord<AssetList> => {
protocol: tokenBalance.protocol,
name: tokenBalance?.name!,
symbol: tokenBalance?.symbol!,
price: tokenBalance.price,
}));

const customTokensAvailable = uniqueTokens.reduce((customTokens, token) => {
Expand Down Expand Up @@ -106,11 +109,34 @@ export function useFungibleTokens() {
protocolsInUse,
getLastActiveProtocolAccount,
} = useAccounts();
const { getCurrentCurrencyRate } = useCurrencies();

function getAccountTokenBalances(address: AccountAddress): ITokenBalance[] {
return tokenBalances.value.filter((token) => token.address === address) || [];
}

const accountsTotalTokenBalance = computed(
() => accounts.value.reduce(
(total, account) => {
const accountTokenBalance = getAccountTokenBalances(account.address);
if (isEmpty(accountTokenBalance)) {
return total;
}
let accountTotal = 0;
accountTokenBalance
.filter((token) => token.price && token.convertedBalance)
.forEach((token) => {
if (token.convertedBalance && token.price) {
accountTotal += new BigNumber(token.convertedBalance)
.multipliedBy(token.price).toNumber();
}
});
return total + (getCurrentCurrencyRate(account.protocol) * accountTotal);
},
0,
).toFixed(2),
);

function getAccountTokenBalance(
address: AccountAddress,
contractId: string,
Expand Down Expand Up @@ -321,6 +347,7 @@ export function useFungibleTokens() {
}

return {
accountsTotalTokenBalance,
tokenBalances,
tokensAvailable,
createOrChangeAllowance,
Expand Down
Loading

0 comments on commit 12632e5

Please sign in to comment.