Skip to content

Commit 021704a

Browse files
authored
Merge pull request #3401 from superhero-com/release/v2.3.2
chore(release): 2.3.2
2 parents 12632e5 + fb530b9 commit 021704a

File tree

93 files changed

+1984
-1093
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+1984
-1093
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ jobs:
55
runs-on: ubuntu-latest
66
env:
77
APP_NAME: wallet
8+
ETHERSCAN_API_KEY: "${{ github.ref == 'refs/heads/master' && secrets.ETHERSCAN_API_KEY_PROD || secrets.ETHERSCAN_API_KEY_DEV }}"
89
WALLET_CONNECT_PROJECT_ID: ${{ secrets.WALLET_CONNECT_PROJECT_ID }}
910
TOKEN_SALES_URL_MAINNET: ${{ secrets.TOKEN_SALES_URL_MAINNET }}
1011
TOKEN_SALES_URL_TESTNET: ${{ secrets.TOKEN_SALES_URL_TESTNET }}

CHANGELOG.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,39 @@
22

33
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.
44

5+
### [2.3.2](https://github.com/Superhero-com/superhero-wallet/compare/v2.3.1...v2.3.2) (2024-11-22)
6+
7+
8+
### Features
9+
10+
* account selector improvements ([05b4f7d](https://github.com/Superhero-com/superhero-wallet/commit/05b4f7df03c8df0127bb6de54e14629e6bd5d03d))
11+
* connect modal layout update ([7a02d70](https://github.com/Superhero-com/superhero-wallet/commit/7a02d70feabbcb51f105d59d1b74c9b994d18a39))
12+
* permission manager form as modal ([b51b1d5](https://github.com/Superhero-com/superhero-wallet/commit/b51b1d54fdb7ebae1129c08f2d0c8cc2f22b162e))
13+
* show decoded call data on eth tx details ([79dcf90](https://github.com/Superhero-com/superhero-wallet/commit/79dcf90e6099c2a602f1017bfcb758a5f1a745b1))
14+
15+
16+
### Bug Fixes
17+
18+
* **aeternity:** show correct allowance transaction info ([b5ff9d5](https://github.com/Superhero-com/superhero-wallet/commit/b5ff9d5e4c252422c94a159397a3bb3f5a430384))
19+
* be able to import private key account on mobile app ([80dd57f](https://github.com/Superhero-com/superhero-wallet/commit/80dd57f2eb816d524af8c8f6f4174ca2b9f30d8d))
20+
* be able to receive ethereum related info ([7832b3a](https://github.com/Superhero-com/superhero-wallet/commit/7832b3a6ff2eebc34193b020f60faf0348b7ca3d))
21+
* change svg name ([e20264f](https://github.com/Superhero-com/superhero-wallet/commit/e20264f87ad39ffb691ab85b9aa5ac07c861471b))
22+
* get correct token address for token sale transaction ([e619c24](https://github.com/Superhero-com/superhero-wallet/commit/e619c246e1f9cb8e1a6752929814b02235c8191c))
23+
* missing warning message when focusing/unfocusing autocomplete input ([8f7578f](https://github.com/Superhero-com/superhero-wallet/commit/8f7578f24027df23096e15580258bd629ef0db43))
24+
* raw callData should not be deprecated ([8ea7faf](https://github.com/Superhero-com/superhero-wallet/commit/8ea7fafcd809b256052c59e5a33488d526c07914))
25+
* show assets for sell transactions correctly ([e90d260](https://github.com/Superhero-com/superhero-wallet/commit/e90d260b8e3562b40caf57159a4feb594b4bbc57))
26+
* show correct market cap coin info ([a9106bc](https://github.com/Superhero-com/superhero-wallet/commit/a9106bc4ee855bc6f176db88d1a09ed295748578))
27+
28+
29+
### Maintenance
30+
31+
* token allowance modification are not only for dex ([9667530](https://github.com/Superhero-com/superhero-wallet/commit/96675308834d7fb3191816f42607b010ce26ee54))
32+
33+
34+
### Performance
35+
36+
* **asset-selector:** do not render all assets at once ([3ab5296](https://github.com/Superhero-com/superhero-wallet/commit/3ab52962d5d2fbc2794826142b0f1e01f4c5b071))
37+
538
### [2.3.1](https://github.com/Superhero-com/superhero-wallet/compare/v2.3.0...v2.3.1) (2024-11-01)
639

740

android/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ android {
77
applicationId "com.superhero.cordova"
88
minSdkVersion rootProject.ext.minSdkVersion
99
targetSdkVersion rootProject.ext.targetSdkVersion
10-
versionCode 20301
11-
versionName "2.3.1"
10+
versionCode 20302
11+
versionName "2.3.2"
1212
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1313
aaptOptions {
1414
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.

ios/App/App.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@
365365
"$(inherited)",
366366
"@executable_path/Frameworks",
367367
);
368-
MARKETING_VERSION = 2.3.1;
368+
MARKETING_VERSION = 2.3.2;
369369
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
370370
PRODUCT_BUNDLE_IDENTIFIER = com.superhero.cordova;
371371
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -390,7 +390,7 @@
390390
"$(inherited)",
391391
"@executable_path/Frameworks",
392392
);
393-
MARKETING_VERSION = 2.3.1;
393+
MARKETING_VERSION = 2.3.2;
394394
PRODUCT_BUNDLE_IDENTIFIER = com.superhero.cordova;
395395
PRODUCT_NAME = "$(TARGET_NAME)";
396396
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "";

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "superhero-wallet",
3-
"version": "2.3.1",
3+
"version": "2.3.2",
44
"description": "Superhero wallet",
55
"author": "Superhero",
66
"license": "MIT",

src/background/bgPopupHandler.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,17 @@ const popups: Dictionary<IPopupConfigNoActions> = {};
3030

3131
const storageSession = (browser.storage as any)?.session;
3232

33-
export const getAeppUrl = (v: any) => new URL(v.connection.port.sender.url);
34-
3533
export const openPopup = async (
3634
popupType: PopupType,
37-
aepp: string | object,
35+
aepp: string | Record<string, any>, // TODO establish correct type for the object
3836
popupProps: Partial<IPopupProps> = {},
3937
) => {
4038
const id = uuid();
41-
const { href, protocol, host } = (typeof aepp === 'object') ? getAeppUrl(aepp) : new URL(aepp);
42-
const { name = host } = (typeof aepp === 'object') ? aepp : {} as any;
39+
const url = (typeof aepp === 'object') ? aepp.connection.port.sender.url : aepp;
40+
const { href, protocol, host } = new URL(url);
41+
42+
// TODO fix the name resolving issue happening in `onSubscription` of aeSdk
43+
const name = (typeof aepp === 'object') ? aepp.name : undefined;
4344

4445
const tabs = await browser.tabs.query({ active: true });
4546

src/background/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ import { updateDynamicRules } from './redirectRule';
3434
/**
3535
* @see https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/onMessage#sending_an_asynchronous_response_using_sendresponse
3636
*/
37-
function handleMessage(msg: IBackgroundMessageData, _: any, sendResponse: Function) {
37+
const handleMessage: browser.runtime.onMessageBool = (
38+
msg: IBackgroundMessageData,
39+
sender: browser.runtime.MessageSender,
40+
sendResponse: Function,
41+
) => {
3842
if (msg.target === 'background') {
3943
const {
4044
aepp,
@@ -73,7 +77,7 @@ function handleMessage(msg: IBackgroundMessageData, _: any, sendResponse: Functi
7377
target: 'offscreen',
7478
});
7579
return true;
76-
}
80+
};
7781

7882
browser.runtime.onMessage.addListener(handleMessage);
7983
browser.runtime.onInstalled.addListener(updateDynamicRules);

src/composables/accountSelector.ts

Lines changed: 214 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,214 @@
1+
import {
2+
computed,
3+
ref,
4+
watch,
5+
} from 'vue';
6+
7+
import type {
8+
IAccountSelectorEntry,
9+
ITransaction,
10+
} from '@/types';
11+
import {
12+
ACCOUNT_SELECT_TYPE_FILTER,
13+
AccountSelectTypeFilter,
14+
PROTOCOLS,
15+
TX_DIRECTION,
16+
} from '@/constants';
17+
import {
18+
createCustomScopedComposable,
19+
excludeFalsy,
20+
getDefaultAccountLabel,
21+
} from '@/utils';
22+
import {
23+
useAccounts,
24+
useAddressBook,
25+
useLatestTransactionList,
26+
} from '@/composables';
27+
28+
import { useAeNames } from '@/protocols/aeternity/composables/aeNames';
29+
import {
30+
getInnerTransaction,
31+
getOwnershipStatus,
32+
getTxDirection,
33+
getTxOwnerAddress,
34+
} from '@/protocols/aeternity/helpers';
35+
36+
import { tg } from '@/popup/plugins/i18n';
37+
import { AE_TRANSACTION_OWNERSHIP_STATUS } from '@/protocols/aeternity/config';
38+
import { Encoding, isAddressValid } from '@aeternity/aepp-sdk';
39+
40+
export const useAccountSelector = createCustomScopedComposable(() => {
41+
const { getName, ownedNames } = useAeNames();
42+
43+
const searchQuery = ref('');
44+
const {
45+
addressBookFiltered,
46+
addressBookFilteredByProtocol,
47+
protocolFilter,
48+
showBookmarked,
49+
getAddressBookEntryByAddress,
50+
setProtocolFilter,
51+
setShowBookmarked,
52+
clearFilters: addressBookClearFilters,
53+
} = useAddressBook();
54+
const {
55+
activeAccount,
56+
accounts,
57+
accountsGroupedByProtocol,
58+
getAccountByAddress,
59+
} = useAccounts();
60+
const { accountsTransactionsLatest } = useLatestTransactionList();
61+
const accountSelectType = ref<AccountSelectTypeFilter>(ACCOUNT_SELECT_TYPE_FILTER.addressBook);
62+
63+
const latestTransactions = computed(
64+
() => (accountsTransactionsLatest.value[activeAccount.value.address] || [])
65+
.map((transaction: ITransaction): IAccountSelectorEntry | null => {
66+
const outerTx = transaction.tx!;
67+
const innerTx = transaction.tx ? getInnerTransaction(transaction.tx) : null;
68+
const { recipientId } = outerTx?.payerId ? outerTx : innerTx;
69+
const direction = getTxDirection(
70+
outerTx?.payerId ? outerTx : innerTx,
71+
(
72+
getOwnershipStatus(activeAccount.value, accounts.value, innerTx)
73+
!== AE_TRANSACTION_OWNERSHIP_STATUS.current
74+
&& getTxOwnerAddress(innerTx)
75+
) || activeAccount.value.address,
76+
);
77+
if (direction !== TX_DIRECTION.sent || !recipientId) {
78+
return null;
79+
}
80+
81+
const addressBookRecord = getAddressBookEntryByAddress(recipientId);
82+
if (addressBookRecord) {
83+
return addressBookRecord;
84+
}
85+
86+
let name = tg('modals.send.recipientLabel');
87+
let localChainNameAddress: string | undefined;
88+
const isSentToChainName = isAddressValid(recipientId, Encoding.Name);
89+
90+
if (isSentToChainName) {
91+
const ownedName = ownedNames.value.find((entry) => entry.hash === recipientId);
92+
if (ownedName) {
93+
name = ownedName.name;
94+
localChainNameAddress = ownedName.pointers.accountPubkey;
95+
}
96+
} else {
97+
const account = getAccountByAddress(recipientId!);
98+
if (account) {
99+
name = getName(account.address).value || getDefaultAccountLabel(account);
100+
} else {
101+
name = getName(recipientId).value || name;
102+
}
103+
}
104+
105+
return {
106+
name,
107+
address: isSentToChainName ? localChainNameAddress : recipientId,
108+
nameAddress: (localChainNameAddress || !isSentToChainName) ? undefined : recipientId,
109+
isBookmarked: false,
110+
protocol: protocolFilter.value ?? PROTOCOLS.aeternity,
111+
};
112+
})
113+
.filter(excludeFalsy),
114+
);
115+
const ownAddresses = computed(
116+
() => (protocolFilter.value)
117+
? (accountsGroupedByProtocol.value[protocolFilter.value] ?? []).map((account) => (
118+
{
119+
name: getName(account.address).value || getDefaultAccountLabel(account),
120+
address: account.address,
121+
isBookmarked: false,
122+
protocol: protocolFilter.value ?? PROTOCOLS.aeternity,
123+
type: account.type,
124+
}
125+
))
126+
: [],
127+
);
128+
const accountsFilteredByType = computed(() => {
129+
switch (accountSelectType.value) {
130+
case ACCOUNT_SELECT_TYPE_FILTER.bookmarked:
131+
case ACCOUNT_SELECT_TYPE_FILTER.addressBook:
132+
return addressBookFiltered.value;
133+
case ACCOUNT_SELECT_TYPE_FILTER.recent:
134+
return latestTransactions.value;
135+
case ACCOUNT_SELECT_TYPE_FILTER.owned:
136+
return ownAddresses.value;
137+
case ACCOUNT_SELECT_TYPE_FILTER.all:
138+
return [...addressBookFiltered.value, ...ownAddresses.value];
139+
default:
140+
return [];
141+
}
142+
});
143+
const accountsFiltered = computed(() => {
144+
const entries: IAccountSelectorEntry[] = accountsFilteredByType.value ?? [];
145+
const searchQueryLower = searchQuery.value.toLowerCase();
146+
147+
return entries
148+
.filter( // Filter by searchQuery
149+
({ name, address }) => [name, address].some(
150+
(val) => val.toLowerCase().includes(searchQueryLower),
151+
),
152+
).filter( // Remove duplicates
153+
(entry, index, self) => self.findIndex(
154+
(e) => (
155+
(e.address !== undefined && e.address === entry.address)
156+
|| (e.address === undefined && e.nameAddress === entry.nameAddress)
157+
),
158+
) === index,
159+
).map( // Add flag for own addresses
160+
(entry) => ({
161+
...entry,
162+
isOwnAddress: ownAddresses.value.some(
163+
(account) => account.address === entry.address,
164+
),
165+
}),
166+
);
167+
});
168+
169+
function setAccountSelectType(type: AccountSelectTypeFilter, resetProtocolFilter = false) {
170+
accountSelectType.value = type;
171+
setShowBookmarked(type === ACCOUNT_SELECT_TYPE_FILTER.bookmarked, resetProtocolFilter);
172+
}
173+
function clearFilters(resetProtocolFilter = false) {
174+
accountSelectType.value = ACCOUNT_SELECT_TYPE_FILTER.addressBook;
175+
addressBookClearFilters(resetProtocolFilter);
176+
}
177+
178+
watch(
179+
protocolFilter,
180+
() => {
181+
if (protocolFilter.value) {
182+
setAccountSelectType(ACCOUNT_SELECT_TYPE_FILTER.addressBook);
183+
}
184+
},
185+
);
186+
187+
// Storing the previous type in order to revert to it when the input is cleared
188+
let savedPrevAccountSelectType = false;
189+
let prevAccountSelectType = accountSelectType.value;
190+
watch(searchQuery, (newSearch) => {
191+
if (newSearch !== '' && !savedPrevAccountSelectType) {
192+
savedPrevAccountSelectType = true;
193+
prevAccountSelectType = accountSelectType.value;
194+
accountSelectType.value = ACCOUNT_SELECT_TYPE_FILTER.all;
195+
} else if (newSearch === '') {
196+
savedPrevAccountSelectType = false;
197+
accountSelectType.value = prevAccountSelectType;
198+
}
199+
});
200+
201+
return {
202+
accountSelectType,
203+
accountsFiltered,
204+
addressBookFilteredByProtocol,
205+
protocolFilter,
206+
showBookmarked,
207+
searchQuery,
208+
209+
setAccountSelectType,
210+
setProtocolFilter,
211+
setShowBookmarked,
212+
clearFilters,
213+
};
214+
});

src/composables/addressBook.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const useAddressBook = createCustomScopedComposable(() => {
3434
const { openModal, openDefaultModal } = useModals();
3535

3636
const protocolFilter = ref<Protocol | null>(null);
37-
const searchQuery = ref<string>('');
37+
const searchQuery = ref('');
3838
const showBookmarked = ref(false);
3939

4040
function filterAddressBookByBookmarked(entries: IAddressBookEntry[]) {

0 commit comments

Comments
 (0)