Skip to content

Commit c2260fb

Browse files
committed
Merge remote-tracking branch 'refs/remotes/upstream/webapp' into webapp-dev
# Conflicts: # .github/workflows/push-web-runner.yml # packages/extension-base/src/services/migration-service/scripts/index.ts # packages/webapp/package.json
2 parents fe936d3 + bd91109 commit c2260fb

File tree

95 files changed

+779
-362
lines changed

Some content is hidden

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

95 files changed

+779
-362
lines changed

.123trigger

+3-1
Original file line numberDiff line numberDiff line change
@@ -162,4 +162,6 @@
162162
1.2.25
163163
1.2.26
164164
1.2.27
165-
1.2.28
165+
1.2.28
166+
1.2.29
167+
1.2.30

.env.example

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
TRANSAK_API_KEY=4b767e2c-2e01-45c9-978e-d32c6f0c8900
22
COINBASE_PAY_ID=1dbd2a0b94
33
NFT_MINTING_HOST=http://...
4+
CHAINFLIP_BROKER_API=93c2bff017e243f29ffb14e42dccbec8
45
BRANCH_NAME=master

.github/workflows/push-koni-dev.yml

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ jobs:
4040
GH_PAT: ${{ secrets.GH_PAT }}
4141
TRANSAK_API_KEY: ${{ secrets.TRANSAK_API_KEY }}
4242
COINBASE_PAY_ID: ${{ secrets.COINBASE_PAY_ID }}
43+
CHAINFLIP_BROKER_API: ${{ secrets.CHAINFLIP_BROKER_API }}
4344
GH_RELEASE_FILES: master-build.zip,master-src.zip
4445
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
4546
REF_NAME: ${{ github.ref_name }}

.github/workflows/push-master.yml

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ jobs:
2424
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
2525
TRANSAK_API_KEY: ${{ secrets.TRANSAK_API_KEY }}
2626
COINBASE_PAY_ID: ${{ secrets.COINBASE_PAY_ID }}
27+
CHAINFLIP_BROKER_API: ${{ secrets.CHAINFLIP_BROKER_API }}
2728
BRANCH_NAME: ${{ github.ref_name }}
2829
run: |
2930
yarn install --immutable | grep -v 'YN0013'

.github/workflows/push-webapp.yml

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ jobs:
3030
TRANSAK_API_KEY: ${{ secrets.TRANSAK_API_KEY }}
3131
COINBASE_PAY_ID: ${{ secrets.COINBASE_PAY_ID }}
3232
NFT_MINTING_HOST: ${{ secrets.NFT_MINTING_HOST }}
33+
CHAINFLIP_BROKER_API: ${{ secrets.CHAINFLIP_BROKER_API }}
3334
BRANCH_NAME: ${{ github.ref_name }}
3435
run: |
3536
yarn install --immutable | grep -v 'YN0013'

CHANGELOG.md

+45
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,50 @@
11
# CHANGELOG
22

3+
## 1.2.30
4+
Build date: Sep 20, 2024.
5+
6+
Features & Update:
7+
- Add Chainflip broker (#3483)
8+
- Re-calculate max transferable for XCM native token (#3617)
9+
- Update chain-list (#3637)
10+
- Add support for Tether's XAUt token
11+
- Add support for BUNS token for PAH, Hydration
12+
- Add support for Ternoa zkEVM + Testnet
13+
- Update information for some chains (https://github.com/Koniverse/SubWallet-ChainList/issues/302)
14+
- DOT <-> CFG
15+
- CFG <-> USDT
16+
- DOT <-> BNC
17+
- BNC <-> USDT
18+
- BNC <-> HDX
19+
- Add support for new swap pairs on Hydration
20+
- Hidden XCM on Pioneer
21+
22+
Bugs fixed:
23+
- Fix bug not showing balance of VFT tokens (#3612)
24+
- Fix bug do not show balance (#3653)
25+
26+
## 1.2.29
27+
Build date: Sep 13, 2024.
28+
29+
Features & Update:
30+
- Support XCM for Ledger Polkadot generic app (#3458)
31+
- Adjust showing/validating address on Earning actions (#2703)
32+
- Update chain-list (#3558)
33+
- Add support for Creditcoin CC3 Mainnet
34+
- Add support for vASTR on Hydration
35+
- Add support for Cypress tokens on Hydration, PAH
36+
- Update some network and token information
37+
- Add support for new swap pairs on Hydration
38+
- Support XCM channels (#3453)
39+
- MYTH: Hydration --> Mythos
40+
- MYTH: PAH --> Mythos
41+
42+
Bugs fixed:
43+
- Fixed bug Do not show token when standing on All accounts mode in case token does not get balance (#2352)
44+
- Fix bug do not show lock balance in case account have Kusama nomination pool (#3579)
45+
- Fix bug XCM for channel: DOT: KAH -> PAH (#3561)
46+
- Fix bug display wrong APY for Polkadot staking option (#3601)
47+
348
## 1.2.28
449
Build date: Sep 04, 2024.
550

CONTRIBUTORS

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
2813 AnhMTV Release version 1.2.28
1+
2831 AnhMTV Release version 1.2.30
22
2533 Nam Phạm [Issue 3467] fix: refactor staking pallet handling logic
3-
2184 S2kael [Issue-3518] Update stable version for chain-list
3+
2186 S2kael [Issue-3637] Update stable version for chain-list
44
848 lw-cdm [Issue-3407] WebApp - Support Avail Ledger app
5-
563 nguyentiendung [Issue-2845] Fix UI bugs export accounts
5+
565 nguyentiendung [Issue-2845] Fix UI bugs export accounts
66
465 Jaco 0.42.5 (#969)
7-
277 bluezdot [Issue-3467] add todo
8-
228 Thiendekaco [Issue 3363] Extension - Update standard content #2
7+
314 bluezdot [Issue-3635] fix: fix do not show balance
8+
232 Thiendekaco [Issue 3458] [fix] Extension - Support XCM for Ledger Polkadot generic app #3
99
185 quangdo
1010
160 Automation Bot [CI Skip] Auto increase webapp build number
1111
146 dominhquang [Issue-3468] Improve condition for Marketing campaign
@@ -14,12 +14,12 @@
1414
83 Hieu Dao Update README.md
1515
82 Thibaut Sardan Add account filtering feature (#832)
1616
81 leewong Swap - Change idle time to 300s
17-
67 bluedot [Issue-2965] fix: Handle earning status for request redeem
17+
70 bluedot [Issue-3579] fix: update check fully migrate
18+
66 Frenkie Nguyen [Issue 2352] fix eslint
1819
63 Roman fix ui issues
1920
53 Dominhquangdev update Bridge code
20-
49 Frenkie Nguyen [Issue-3477] fix condition show popup
2121
24 S2kael
22-
17 Thanh [Issue-3518] Update chainlist
22+
24 Thanh [Issue-3637] Update chainlist
2323
10 Trang Trịnh api get karura and acala nfts
2424
9 Minh Le
2525
9 minhld1029 [#115] [ForgetAccount] catch exception refList undefined

package.json

+2-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.2.28",
13+
"version": "1.2.30",
1414
"workspaces": [
1515
"packages/*"
1616
],
@@ -104,7 +104,7 @@
104104
"@polkadot/types-support": "^12.0.2",
105105
"@polkadot/util": "^12.6.2",
106106
"@polkadot/util-crypto": "^12.6.2",
107-
"@subwallet/chain-list": "0.2.84",
107+
"@subwallet/chain-list": "0.2.87",
108108
"@subwallet/keyring": "^0.1.6",
109109
"@subwallet/react-ui": "5.1.2-b79",
110110
"@subwallet/ui-keyring": "^0.1.6",

packages/extension-base/package.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
"./detectPackage.cjs"
1818
],
1919
"type": "module",
20-
"version": "1.2.28-0",
20+
"version": "1.2.30-0",
2121
"main": "index.js",
2222
"dependencies": {
2323
"@acala-network/api": "^5.0.2",
2424
"@apollo/client": "^3.7.14",
2525
"@azns/resolver-core": "^1.4.0",
26-
"@chainflip/sdk": "^1.3.0",
26+
"@chainflip/sdk": "^1.5.2",
2727
"@equilab/api": "~1.14.25",
2828
"@ethereumjs/common": "^4.1.0",
2929
"@ethereumjs/tx": "^5.1.0",
@@ -55,11 +55,11 @@
5555
"@reduxjs/toolkit": "^1.9.1",
5656
"@sora-substrate/type-definitions": "^1.17.7",
5757
"@substrate/connect": "^0.8.9",
58-
"@subwallet/chain-list": "0.2.84",
59-
"@subwallet/extension-base": "^1.2.28-0",
60-
"@subwallet/extension-chains": "^1.2.28-0",
61-
"@subwallet/extension-dapp": "^1.2.28-0",
62-
"@subwallet/extension-inject": "^1.2.28-0",
58+
"@subwallet/chain-list": "0.2.87",
59+
"@subwallet/extension-base": "^1.2.30-0",
60+
"@subwallet/extension-chains": "^1.2.30-0",
61+
"@subwallet/extension-dapp": "^1.2.30-0",
62+
"@subwallet/extension-inject": "^1.2.30-0",
6363
"@subwallet/keyring": "^0.1.6",
6464
"@subwallet/ui-keyring": "^0.1.6",
6565
"@walletconnect/keyvaluestorage": "^1.1.1",
@@ -100,7 +100,7 @@
100100
"web3-utils": "^1.10.0"
101101
},
102102
"devDependencies": {
103-
"@subwallet/extension-mocks": "^1.2.28-0",
103+
"@subwallet/extension-mocks": "^1.2.30-0",
104104
"@types/uuid": "^9.0.1"
105105
}
106106
}

packages/extension-base/src/core/substrate/xcm-parser.ts

+16-6
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ export function _getXcmMultiLocation (originChainInfo: _ChainInfo, destChainInfo
6060
};
6161
}
6262

63-
export function _isXcmTransferUnstable (originChainInfo: _ChainInfo, destChainInfo: _ChainInfo): boolean {
64-
return !_isXcmWithinSameConsensus(originChainInfo, destChainInfo);
63+
export function _isXcmTransferUnstable (originChainInfo: _ChainInfo, destChainInfo: _ChainInfo, assetSlug: string): boolean {
64+
return !_isXcmWithinSameConsensus(originChainInfo, destChainInfo) || _isMythosFromHydrationToMythos(originChainInfo, destChainInfo, assetSlug);
6565
}
6666

6767
function getAssetHubBridgeUnstableWarning (originChainInfo: _ChainInfo): string {
@@ -78,17 +78,23 @@ function getAssetHubBridgeUnstableWarning (originChainInfo: _ChainInfo): string
7878
function getSnowBridgeUnstableWarning (originChainInfo: _ChainInfo): string {
7979
switch (originChainInfo.slug) {
8080
case COMMON_CHAIN_SLUGS.POLKADOT_ASSET_HUB:
81-
return 'Cross-chain transfer of this token is not recommended as it is in beta, incurs a fee of 70$ and takes up to 1 hour to complete. Continue at your own risk';
81+
return 'Cross-chain transfer of this token is not recommended as it is in beta, incurs a fee of $70 and takes up to 1 hour to complete. Continue at your own risk';
8282
case COMMON_CHAIN_SLUGS.ETHEREUM:
83-
return 'Cross-chain transfer of this token is not recommended as it is in beta, incurs a fee of 5$ and takes up to 1 hour to complete. Continue at your own risk';
83+
return 'Cross-chain transfer of this token is not recommended as it is in beta, incurs a fee of $5 and takes up to 1 hour to complete. Continue at your own risk';
8484
default:
8585
return 'Cross-chain transfer of this token is not recommended as it is in beta, incurs a high fee and takes up to 1 hour to complete. Continue at your own risk';
8686
}
8787
}
8888

89-
export function _getXcmUnstableWarning (originChainInfo: _ChainInfo, destChainInfo: _ChainInfo): string {
89+
function getMythosFromHydrationToMythosWarning (): string {
90+
return 'Cross-chain transfer of this token requires a high transaction fee. Do you want to continue?';
91+
}
92+
93+
export function _getXcmUnstableWarning (originChainInfo: _ChainInfo, destChainInfo: _ChainInfo, assetSlug: string): string {
9094
if (_isSnowBridgeXcm(originChainInfo, destChainInfo)) {
9195
return getSnowBridgeUnstableWarning(originChainInfo);
96+
} else if (_isMythosFromHydrationToMythos(originChainInfo, destChainInfo, assetSlug)) {
97+
return getMythosFromHydrationToMythosWarning();
9298
} else {
9399
return getAssetHubBridgeUnstableWarning(originChainInfo);
94100
}
@@ -102,6 +108,10 @@ export function _isSnowBridgeXcm (originChainInfo: _ChainInfo, destChainInfo: _C
102108
return !_isXcmWithinSameConsensus(originChainInfo, destChainInfo) && (_isPureEvmChain(originChainInfo) || _isPureEvmChain(destChainInfo));
103109
}
104110

111+
export function _isMythosFromHydrationToMythos (originChainInfo: _ChainInfo, destChainInfo: _ChainInfo, assetSlug: string): boolean {
112+
return originChainInfo.slug === 'hydradx_main' && destChainInfo.slug === 'mythos' && assetSlug === 'hydradx_main-LOCAL-MYTH';
113+
}
114+
105115
// ---------------------------------------------------------------------------------------------------------------------
106116

107117
function _getMultiLocationParent (originChainInfo: _ChainInfo, isWithinSameConsensus: boolean): number {
@@ -215,7 +225,7 @@ function _getAssetIdentifier (tokenInfo: _ChainAsset, version: number) {
215225
throw new Error('Asset must have multilocation');
216226
}
217227

218-
const assetIdentifier = ['statemint-LOCAL-KSM'].includes(tokenInfo.slug) // todo: hotfix for ksm statemint recheck all chain
228+
const assetIdentifier = ['statemint-LOCAL-KSM', 'statemine-LOCAL-DOT'].includes(tokenInfo.slug) // todo: hotfix for ksm statemint recheck all chain
219229
? _assetIdentifier
220230
: _adaptX1Interior(structuredClone(_assetIdentifier), version);
221231

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

+6-5
Original file line numberDiff line numberDiff line change
@@ -1854,13 +1854,13 @@ export default class KoniExtension {
18541854
}
18551855

18561856
const chainInfoMap = this.#koniState.getChainInfoMap();
1857-
const isFromSnowBridgeXcm = _isPureEvmChain(chainInfoMap[originNetworkKey]) && _isSnowBridgeXcm(chainInfoMap[originNetworkKey], chainInfoMap[destinationNetworkKey]);
1857+
const isSnowBridgeEvmTransfer = _isPureEvmChain(chainInfoMap[originNetworkKey]) && _isSnowBridgeXcm(chainInfoMap[originNetworkKey], chainInfoMap[destinationNetworkKey]);
18581858

18591859
let additionalValidator: undefined | ((inputTransaction: SWTransactionResponse) => Promise<void>);
18601860
let eventsHandler: undefined | ((eventEmitter: TransactionEmitter) => void);
18611861

18621862
if (fromKeyPair && destinationTokenInfo) {
1863-
if (isFromSnowBridgeXcm) {
1863+
if (isSnowBridgeEvmTransfer) {
18641864
const evmApi = this.#koniState.getEvmApi(originNetworkKey);
18651865

18661866
extrinsic = await createSnowBridgeExtrinsic({
@@ -1927,7 +1927,7 @@ export default class KoniExtension {
19271927
transaction: extrinsic,
19281928
data: inputData,
19291929
extrinsicType: ExtrinsicType.TRANSFER_XCM,
1930-
chainType: !isFromSnowBridgeXcm ? ChainType.SUBSTRATE : ChainType.EVM,
1930+
chainType: !isSnowBridgeEvmTransfer ? ChainType.SUBSTRATE : ChainType.EVM,
19311931
transferNativeAmount: _isNativeToken(originTokenInfo) ? value : '0',
19321932
ignoreWarnings: inputData.transferAll,
19331933
isTransferAll: inputData.transferAll,
@@ -2090,15 +2090,16 @@ export default class KoniExtension {
20902090
const substrateApi = this.#koniState.chainService.getSubstrateApi(originTokenInfo.originChain);
20912091
const chainInfoMap = this.#koniState.chainService.getChainInfoMap();
20922092
const destinationTokenInfo = this.#koniState.getXcmEqualAssetByChain(destChain, originTokenInfo.slug);
2093+
const existentialDeposit = originTokenInfo.minAmount || '0';
20932094

20942095
if (destinationTokenInfo) {
2095-
const [bnMockFee, { value }] = await Promise.all([
2096+
const [bnMockExecutionFee, { value }] = await Promise.all([
20962097
getXcmMockTxFee(substrateApi, chainInfoMap, originTokenInfo, destinationTokenInfo),
20972098
this.getAddressTransferableBalance({ extrinsicType: ExtrinsicType.TRANSFER_XCM, address, networkKey: originTokenInfo.originChain, token: originTokenInfo.slug })
20982099
]);
20992100

21002101
const bnMaxTransferable = new BigN(value);
2101-
const estimatedFee = bnMockFee.multipliedBy(XCM_FEE_RATIO); // multiply by weight to account for destination chain fee
2102+
const estimatedFee = bnMockExecutionFee.multipliedBy(XCM_FEE_RATIO).plus(new BigN(existentialDeposit));
21022103

21032104
return bnMaxTransferable.minus(estimatedFee);
21042105
}

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.2.28-0' };
6+
export const packageInfo = { name: '@subwallet/extension-base', path: 'auto', type: 'auto', version: '1.2.30-0' };

packages/extension-base/src/services/balance-service/helpers/subscribe/index.ts

+49-16
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,38 @@ const filterAddress = (addresses: string[], chainInfo: _ChainInfo): [string[], s
8282
}
8383
};
8484

85+
const handleUnsupportedOrPendingAddresses = (
86+
addresses: string[],
87+
chainSlug: string,
88+
chainAssetMap: Record<string, _ChainAsset>,
89+
state: APIItemState,
90+
callback: (rs: BalanceItem[]) => void
91+
) => {
92+
const tokens = filterAssetsByChainAndType(chainAssetMap, chainSlug, [
93+
_AssetType.NATIVE,
94+
_AssetType.ERC20,
95+
_AssetType.PSP22,
96+
_AssetType.LOCAL,
97+
_AssetType.GRC20,
98+
_AssetType.VFT
99+
]);
100+
101+
const now = new Date().getTime();
102+
103+
Object.values(tokens).forEach((token) => {
104+
const items: BalanceItem[] = addresses.map((address): BalanceItem => ({
105+
address,
106+
tokenSlug: token.slug,
107+
free: '0',
108+
locked: '0',
109+
state,
110+
timestamp: now
111+
}));
112+
113+
callback(items);
114+
});
115+
};
116+
85117
// main subscription, use for multiple chains, multiple addresses and multiple tokens
86118
export function subscribeBalance (
87119
addresses: string[],
@@ -104,22 +136,13 @@ export function subscribeBalance (
104136
const [useAddresses, notSupportAddresses] = filterAddress(addresses, chainInfo);
105137

106138
if (notSupportAddresses.length) {
107-
const tokens = filterAssetsByChainAndType(chainAssetMap, chainSlug, [_AssetType.NATIVE, _AssetType.ERC20, _AssetType.PSP22, _AssetType.LOCAL, _AssetType.GRC20, _AssetType.VFT]);
108-
109-
const now = new Date().getTime();
110-
111-
Object.values(tokens).forEach((token) => {
112-
const items: BalanceItem[] = notSupportAddresses.map((address): BalanceItem => ({
113-
address,
114-
tokenSlug: token.slug,
115-
free: '0',
116-
locked: '0',
117-
state: APIItemState.NOT_SUPPORT,
118-
timestamp: now
119-
}));
120-
121-
callback(items);
122-
});
139+
handleUnsupportedOrPendingAddresses(
140+
notSupportAddresses,
141+
chainSlug,
142+
chainAssetMap,
143+
APIItemState.NOT_SUPPORT,
144+
callback
145+
);
123146
}
124147

125148
const evmApi = evmApiMap[chainSlug];
@@ -136,6 +159,16 @@ export function subscribeBalance (
136159

137160
const substrateApi = await substrateApiMap[chainSlug].isReady;
138161

162+
if (!substrateApi.isApiReady) {
163+
handleUnsupportedOrPendingAddresses(
164+
useAddresses,
165+
chainSlug,
166+
chainAssetMap,
167+
APIItemState.PENDING,
168+
callback
169+
);
170+
}
171+
139172
return subscribeSubstrateBalance(useAddresses, chainInfo, chainAssetMap, substrateApi, evmApi, callback, extrinsicType);
140173
});
141174

0 commit comments

Comments
 (0)