Skip to content

Commit 6846176

Browse files
committed
Merge remote-tracking branch 'refs/remotes/origin/subwallet-dev' into webapp-dev
# Conflicts: # packages/extension-base/src/services/migration-service/scripts/index.ts # packages/webapp/package.json
2 parents d50a482 + e56182c commit 6846176

File tree

73 files changed

+740
-379
lines changed

Some content is hidden

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

73 files changed

+740
-379
lines changed

.123trigger

+3-1
Original file line numberDiff line numberDiff line change
@@ -129,4 +129,6 @@
129129
1.1.59
130130
1.1.60
131131
1.1.61
132-
1.1.62
132+
1.1.62
133+
1.1.63
134+
1.1.64

CHANGELOG.md

+23
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
11
# CHANGELOG
22

3+
## 1.1.64
4+
Build date: May 11, 2024.
5+
6+
Features & Update:
7+
- Update chain-list (#3020)
8+
- Add support for Curio Network
9+
- Add new blockchain explorer for InvArch
10+
- Add explorer for Mythos and Avail Turing
11+
- Update ED for Mythos
12+
- Update symbol for native token on Commune AI: C -> COMAI
13+
14+
Bugs fixed:
15+
- Fixed bug enable chains when detect balance (#2882)
16+
- Fixed bug Invalid recipient address when Dapp deploy smart contract (#2859)
17+
18+
19+
## 1.1.63
20+
Build date: May 09, 2024.
21+
22+
Bugs fixed:
23+
- Fixed cannot signing with dApp in case network is not publish (#3027)
24+
- Fixed bug Network's status show incorrect (#3037)
25+
326
## 1.1.62
427
Build date: May 08, 2024.
528

CONTRIBUTORS

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
2499 AnhMTV Release version 1.1.62
1+
2511 AnhMTV Release version 1.1.64
22
2352 Nam Phạm [Issue 2754] fix: fix eslint
3-
2022 S2kael [Issue 2993] Update chain list and handle case chain not have providers
4-
811 lw-cdm Set pool default value for Avail Turing
3+
2027 S2kael [Issue-3020] Update chain-list stable version
4+
813 lw-cdm
55
465 Jaco 0.42.5 (#969)
6-
394 nguyentiendung [Issue-3011] Update UI code for change symbol
6+
403 nguyentiendung [Issue-3011] Update UI code for change symbol
77
185 quangdo
8-
126 bluezdot [Issue-2998]: fix: update logic parse identity
8+
129 bluezdot [Issue-3020] Update ED for mythos
99
106 dominhquang [Issue-2649] Add send crash log feature
1010
104 khainh predefine metadata for Polkadot & Kusama chains
1111
101 lw-cdm
12-
93 Automation Bot [CI Skip] Auto increase webapp build number
12+
99 Automation Bot [CI Skip] Auto increase webapp build number
1313
83 Hieu Dao Update README.md
1414
82 Thibaut Sardan Add account filtering feature (#832)
1515
81 leewong Swap - Change idle time to 300s
16-
70 Thiendekaco [Issue 2867] [fix] [Currency] Extension - Handle logic flow when update version 2
16+
73 Thiendekaco [Issue 2859] [fix] Extension - deploy smart contract when use ledger
1717
63 Roman fix ui issues
1818
53 Dominhquangdev update Bridge code
1919
48 bluedot [Issue-2771] Update multichain asset logo for ASTR

package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"url": "https://github.com/Koniverse/Subwallet-V2.git"
1111
},
1212
"sideEffects": false,
13-
"version": "1.1.62",
13+
"version": "1.1.64",
1414
"workspaces": [
1515
"packages/*"
1616
],
@@ -79,6 +79,7 @@
7979
"sinon-chrome": "^3.0.1"
8080
},
8181
"resolutions": {
82+
"@subwallet/react-ui": "5.1.2-b77",
8283
"@ethereumjs/common": "^4.1.0",
8384
"@google/model-viewer": "3.1.1",
8485
"@ledgerhq/hw-app-eth": "6.33.4",
@@ -91,7 +92,7 @@
9192
"@polkadot/types-codec": "10.10.1",
9293
"@polkadot/util": "^12.6.2",
9394
"@polkadot/util-crypto": "^12.6.2",
94-
"@subwallet/chain-list": "0.2.59",
95+
"@subwallet/chain-list": "0.2.60",
9596
"@subwallet/keyring": "^0.1.5",
9697
"@subwallet/ui-keyring": "^0.1.5",
9798
"babel-core": "^7.0.0-bridge.0",

packages/extension-base/package.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"./detectPackage.cjs"
1818
],
1919
"type": "module",
20-
"version": "1.1.62-0",
20+
"version": "1.1.64-0",
2121
"main": "index.js",
2222
"dependencies": {
2323
"@acala-network/api": "^5.0.2",
@@ -50,11 +50,11 @@
5050
"@reduxjs/toolkit": "^1.9.1",
5151
"@sora-substrate/type-definitions": "^1.17.7",
5252
"@substrate/connect": "^0.8.9",
53-
"@subwallet/chain-list": "0.2.59",
54-
"@subwallet/extension-base": "^1.1.62-0",
55-
"@subwallet/extension-chains": "^1.1.62-0",
56-
"@subwallet/extension-dapp": "^1.1.62-0",
57-
"@subwallet/extension-inject": "^1.1.62-0",
53+
"@subwallet/chain-list": "0.2.60",
54+
"@subwallet/extension-base": "^1.1.64-0",
55+
"@subwallet/extension-chains": "^1.1.64-0",
56+
"@subwallet/extension-dapp": "^1.1.64-0",
57+
"@subwallet/extension-inject": "^1.1.64-0",
5858
"@subwallet/keyring": "^0.1.5",
5959
"@subwallet/ui-keyring": "^0.1.5",
6060
"@walletconnect/sign-client": "^2.8.4",
@@ -92,7 +92,7 @@
9292
"web3-utils": "^1.10.0"
9393
},
9494
"devDependencies": {
95-
"@subwallet/extension-mocks": "^1.1.62-0",
95+
"@subwallet/extension-mocks": "^1.1.64-0",
9696
"@types/uuid": "^9.0.1"
9797
}
9898
}

packages/extension-base/src/koni/background/handlers/Extension.ts

+26-7
Original file line numberDiff line numberDiff line change
@@ -3154,7 +3154,10 @@ export default class KoniExtension {
31543154
let isEvm = false;
31553155

31563156
if (isJsonPayload(payload)) {
3157-
// Get the metadata for the genesisHash
3157+
/**
3158+
* Get the metadata for the genesisHash
3159+
* @todo: need to handle case metadata store in db
3160+
*/
31583161
const currentMetadata = this.#koniState.knownMetadata.find((meta: MetadataDef) =>
31593162
meta.genesisHash === payload.genesisHash);
31603163

@@ -3167,14 +3170,30 @@ export default class KoniExtension {
31673170

31683171
const [, chainInfo] = this.#koniState.findNetworkKeyByGenesisHash(payload.genesisHash);
31693172

3170-
if (chainInfo && (_API_OPTIONS_CHAIN_GROUP.avail.includes(chainInfo.slug) || _API_OPTIONS_CHAIN_GROUP.goldberg.includes(chainInfo.slug))) {
3171-
const isChainActive = this.#koniState.getChainStateByKey(chainInfo.slug).active;
3173+
if (!currentMetadata) {
3174+
/*
3175+
* Some networks must have metadata to signing,
3176+
* so if the chain not active (cannot use metadata from api), it must be rejected
3177+
* */
3178+
if (
3179+
chainInfo &&
3180+
(_API_OPTIONS_CHAIN_GROUP.avail.includes(chainInfo.slug) || _API_OPTIONS_CHAIN_GROUP.goldberg.includes(chainInfo.slug)) // The special case for chains that need metadata to signing
3181+
) {
3182+
// For case the chain does not have any provider
3183+
if (!Object.keys(chainInfo.providers).length) {
3184+
reject(new Error('{{chain}} network does not have any provider to connect, please update metadata from dApp'.replaceAll('{{chain}}', chainInfo.name)));
3185+
3186+
return false;
3187+
}
31723188

3173-
if (!isChainActive) {
3174-
reject(new Error('Please activate {{chain}} network before signing'.replaceAll('{{chain}}', chainInfo.name)));
3189+
const isChainActive = this.#koniState.getChainStateByKey(chainInfo.slug).active;
3190+
3191+
if (!isChainActive) {
3192+
reject(new Error('Please activate {{chain}} network before signing'.replaceAll('{{chain}}', chainInfo.name)));
3193+
3194+
return false;
3195+
}
31753196

3176-
return false;
3177-
} else {
31783197
registry = this.#koniState.getSubstrateApi(chainInfo.slug).api.registry as unknown as TypeRegistry;
31793198
}
31803199
}

packages/extension-base/src/packageInfo.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33

44
// Do not edit, auto-generated by @polkadot/dev
55

6-
export const packageInfo = { name: '@subwallet/extension-base', path: 'auto', type: 'auto', version: '1.1.62-0' };
6+
export const packageInfo = { name: '@subwallet/extension-base', path: 'auto', type: 'auto', version: '1.1.64-0' };

packages/extension-base/src/services/chain-service/index.ts

+22-17
Original file line numberDiff line numberDiff line change
@@ -908,23 +908,28 @@ export class ChainService {
908908
this.lockChainInfoMap = true;
909909

910910
const initPromises = chainSlugs.map(async (chainSlug) => {
911-
const chainInfo = chainInfoMap[chainSlug];
912-
const currentState = chainStateMap[chainSlug]?.active;
913-
914-
if (!currentState) {
915-
this.dbService.updateChainStore({
916-
...chainInfo,
917-
active: true,
918-
currentProvider: chainStateMap[chainSlug].currentProvider,
919-
manualTurnOff: !!chainStateMap[chainSlug].manualTurnOff
920-
}).catch(console.error);
921-
922-
chainStateMap[chainSlug].active = true;
923-
await this.initApiForChain(chainInfo);
924-
925-
this.eventService.emit('chain.updateState', chainSlug);
926-
needUpdate = true;
927-
}
911+
// Add try catch to prevent one chain error stop the whole process
912+
try {
913+
const chainInfo = chainInfoMap[chainSlug];
914+
const currentState = chainStateMap[chainSlug]?.active;
915+
916+
if (!currentState) {
917+
// Enable chain success then update chain state
918+
await this.initApiForChain(chainInfo);
919+
920+
this.dbService.updateChainStore({
921+
...chainInfo,
922+
active: true,
923+
currentProvider: chainStateMap[chainSlug].currentProvider,
924+
manualTurnOff: !!chainStateMap[chainSlug].manualTurnOff
925+
}).catch(console.error);
926+
927+
chainStateMap[chainSlug].active = true;
928+
929+
this.eventService.emit('chain.updateState', chainSlug);
930+
needUpdate = true;
931+
}
932+
} catch (e) {}
928933
});
929934

930935
await Promise.all(initPromises);

packages/extension-base/src/services/chain-service/utils/index.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,9 @@ export function updateLatestChainInfo (currentDataMap: _DataMap, latestChainInfo
526526

527527
currentChainState.currentProvider = providerKey;
528528

529-
needUpdateChainApiList.push(currentChainInfo);
529+
if (currentChainState.active) {
530+
needUpdateChainApiList.push(currentChainInfo);
531+
}
530532
}
531533

532534
needUpdate = true;

packages/extension-base/src/services/migration-service/scripts/MigrateTransactionHistoryBySymbol.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ export default class MigrateTransactionHistoryBySymbol extends BaseMigrationJob
1010

1111
try {
1212
const changeSlugsMap: Record<string, string> = {
13-
'moonbeam-LOCAL-xcaUSD': 'moonbeam-LOCAL-xcaSEED',
14-
'calamari-LOCAL-AUSD': 'calamari-LOCAL-aSEED',
15-
'moonriver-LOCAL-xcaSeed': 'moonriver-LOCAL-xcaSEED',
16-
'bifrost-LOCAL-KUSD': 'bifrost-LOCAL-aSEED'
13+
'commune-NATIVE-C': 'commune-NATIVE-COMAI'
1714
};
1815

1916
const allTxs: ITransactionHistoryItem[] = [];

packages/extension-base/src/services/migration-service/scripts/databases/MigrateAssetSetting.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@ export default class MigrateAssetSetting extends BaseMigrationJob {
88
public override async run (): Promise<void> {
99
try {
1010
const changeSlugsMap: Record<string, string> = {
11-
'moonbeam-LOCAL-xcaUSD': 'moonbeam-LOCAL-xcaSEED',
12-
'calamari-LOCAL-AUSD': 'calamari-LOCAL-aSEED',
13-
'moonriver-LOCAL-xcaSeed': 'moonriver-LOCAL-xcaSEED',
14-
'bifrost-LOCAL-KUSD': 'bifrost-LOCAL-aSEED'
11+
'commune-NATIVE-C': 'commune-NATIVE-COMAI'
1512
};
1613

1714
const assetSetting = await this.state.chainService.getAssetSettings();

packages/extension-base/src/services/migration-service/scripts/index.ts

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
22
// SPDX-License-Identifier: Apache-2.0
33

4+
import EnableAvailTuringChain from '@subwallet/extension-base/services/migration-service/scripts/EnableAvailTuringChain';
5+
import MigrateTransactionHistoryBySymbol from '@subwallet/extension-base/services/migration-service/scripts/MigrateTransactionHistoryBySymbol';
6+
47
import BaseMigrationJob from '../Base';
5-
// import MigrateAssetSetting from './databases/MigrateAssetSetting';
68
import MigrateAssetSetting from './databases/MigrateAssetSetting';
7-
import MigrateTransactionHistoryBySymbol from '@subwallet/extension-base/services/migration-service/scripts/MigrateTransactionHistoryBySymbol';
8-
import EnableAvailTuringChain
9-
from "@subwallet/extension-base/services/migration-service/scripts/EnableAvailTuringChain";
109

1110
export const EVERYTIME = '__everytime__';
1211

@@ -34,7 +33,7 @@ export default <Record<string, typeof BaseMigrationJob>>{
3433
// '1.1.41-01': DeleteChainStaking
3534
// '1.1.41-02': MigrateAssetSetting
3635
// [`${EVERYTIME}-1`]: AutoEnableChainsTokens
37-
'1.1.53-01': MigrateAssetSetting,
38-
'1.1.53-02': MigrateTransactionHistoryBySymbol,
39-
'1.1.58-0___AVAIL': EnableAvailTuringChain
36+
'1.1.58-0___AVAIL': EnableAvailTuringChain,
37+
'1.1.62-01': MigrateAssetSetting,
38+
'1.1.62-02': MigrateTransactionHistoryBySymbol
4039
};

packages/extension-base/src/services/transaction-service/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,7 @@ export default class TransactionService {
909909
maxFeePerGas: addHexPrefix(anyNumberToBN(transaction.maxFeePerGas).toString(16)),
910910
maxPriorityFeePerGas: addHexPrefix(anyNumberToBN(transaction.maxPriorityFeePerGas).toString(16)),
911911
gasLimit: addHexPrefix(anyNumberToBN(transaction.gas).toString(16)),
912-
to: transaction.to !== undefined ? transaction.to : '',
912+
to: transaction.to,
913913
value: addHexPrefix(anyNumberToBN(transaction.value).toString(16)),
914914
data: transaction.data,
915915
chainId: _getEvmChainId(chainInfo),
@@ -920,7 +920,7 @@ export default class TransactionService {
920920
nonce: transaction.nonce ?? 0,
921921
gasPrice: addHexPrefix(anyNumberToBN(transaction.gasPrice).toString(16)),
922922
gasLimit: addHexPrefix(anyNumberToBN(transaction.gas).toString(16)),
923-
to: transaction.to !== undefined ? transaction.to : '',
923+
to: transaction.to,
924924
value: addHexPrefix(anyNumberToBN(transaction.value).toString(16)),
925925
data: transaction.data,
926926
chainId: _getEvmChainId(chainInfo),
@@ -1003,7 +1003,7 @@ export default class TransactionService {
10031003
maxFeePerGas: anyNumberToBN(payload.maxFeePerGas).toNumber(),
10041004
maxPriorityFeePerGas: anyNumberToBN(payload.maxPriorityFeePerGas).toNumber(),
10051005
gasLimit: anyNumberToBN(payload.gas).toNumber(),
1006-
to: payload.to !== undefined ? payload.to : '',
1006+
to: payload.to,
10071007
value: anyNumberToBN(payload.value).toNumber(),
10081008
data: payload.data,
10091009
chainId: payload.chainId

packages/extension-base/src/services/transaction-service/utils.ts

+8
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ function getBlockExplorerAccountRoute (explorerLink: string) {
3535
return 'account';
3636
}
3737

38+
if (explorerLink.includes('invarch.statescan.io')) {
39+
return '#/accounts';
40+
}
41+
3842
return 'address';
3943
}
4044

@@ -47,6 +51,10 @@ function getBlockExplorerTxRoute (chainInfo: _ChainInfo) {
4751
return 'transaction';
4852
}
4953

54+
if (['invarch'].includes(chainInfo.slug)) {
55+
return '#/extrinsics';
56+
}
57+
5058
return 'extrinsic';
5159
}
5260

packages/extension-base/src/signers/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export interface QrState {
1010
}
1111

1212
export interface Web3TransactionBase {
13-
to: string;
13+
to?: string;
1414
gasPrice: number;
1515
maxFeePerGas: number;
1616
maxPriorityFeePerGas: number;

packages/extension-base/src/utils/eth/parseTransaction/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ const parseResult = (type: string, input: NestedArray<any>, name: NestedArray<st
114114
};
115115

116116
export const isContractAddress = async (address: string, evmApi: _EvmApi): Promise<boolean> => {
117-
if (!evmApi) {
117+
if (!evmApi || !address) {
118118
return false;
119119
} else {
120120
const code = await evmApi.api.eth.getCode(address);

packages/extension-chains/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
"./detectPackage.cjs"
1818
],
1919
"type": "module",
20-
"version": "1.1.62-0",
20+
"version": "1.1.64-0",
2121
"main": "index.js",
2222
"dependencies": {
2323
"@babel/runtime": "^7.20.6",
2424
"@polkadot/networks": "^12.6.2",
2525
"@polkadot/util": "^12.6.2",
2626
"@polkadot/util-crypto": "^12.6.2",
27-
"@subwallet/extension-inject": "^1.1.62-0"
27+
"@subwallet/extension-inject": "^1.1.64-0"
2828
},
2929
"peerDependencies": {
3030
"@polkadot/api": "*",

packages/extension-chains/src/packageInfo.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33

44
// Do not edit, auto-generated by @polkadot/dev
55

6-
export const packageInfo = { name: '@subwallet/extension-chains', path: 'auto', type: 'auto', version: '1.1.62-0' };
6+
export const packageInfo = { name: '@subwallet/extension-chains', path: 'auto', type: 'auto', version: '1.1.64-0' };

packages/extension-compat-metamask/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
"./detectPackage.cjs"
1818
],
1919
"type": "module",
20-
"version": "1.1.62-0",
20+
"version": "1.1.64-0",
2121
"main": "index.js",
2222
"dependencies": {
2323
"@babel/runtime": "^7.20.6",
2424
"@metamask/detect-provider": "^1.2.0",
2525
"@polkadot/types": "^10.12.4",
2626
"@polkadot/util": "^12.6.2",
27-
"@subwallet/extension-inject": "^1.1.62-0",
27+
"@subwallet/extension-inject": "^1.1.64-0",
2828
"web3": "^1.10.0"
2929
},
3030
"peerDependencies": {

0 commit comments

Comments
 (0)