Skip to content

Commit

Permalink
Merge branch 'refs/heads/koni/dev/issue-3601' into web-runner-cron
Browse files Browse the repository at this point in the history
  • Loading branch information
bluezdot committed Sep 13, 2024
2 parents b6f8f2a + 14fd65d commit 18d231c
Show file tree
Hide file tree
Showing 68 changed files with 388 additions and 240 deletions.
3 changes: 2 additions & 1 deletion .123trigger
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,5 @@
1.2.24
1.2.25
1.2.26
1.2.27
1.2.27
1.2.28
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# CHANGELOG

## 1.2.28
Build date: Sep 04, 2024.

Features & Update:
- Format error when connecting to dApp (#3445)
- Update connector version (#3363)
- Update substrate dApp connect interface to allow dApp connect with EVM account (#3401)
- Improve Amount input field (#1905)
- Improve fetching era stakers (#3467)
- Add warning in case user earn for both nomination pool and direct (#3477)
- Add Notice of need to unstake for users who are simultaneously staking for both Direct and Nomination Pool (#3484)
- Improve condition for Marketing campaign (#3468)
- Update chain-list (#3518)
- Add support for Polygon zkEVM
- Add support for Immutable zkEVM
- Add support for Story Public Testnet
- Add support for Soneium Testnet
- Update logo for some chains, tokens

Bugs fixed:
- Fix UI bug on the Transfer screen (#3452)
- Fix bug XCM (#3519)


## 1.2.27
Build date: Aug 22, 2024.

Expand Down
18 changes: 9 additions & 9 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
2800 AnhMTV Release version 1.2.27
2532 Nam Phạm [Issue 3450] fix: get era stakers overview
2181 S2kael [Issue-3478] Update stable version for chain-list
2813 AnhMTV Release version 1.2.28
2533 Nam Phạm [Issue 3467] fix: refactor staking pallet handling logic
2184 S2kael [Issue-3518] Update stable version for chain-list
848 lw-cdm [Issue-3407] WebApp - Support Avail Ledger app
561 nguyentiendung [Issue-2845] Fix UI bugs export accounts
563 nguyentiendung [Issue-2845] Fix UI bugs export accounts
465 Jaco 0.42.5 (#969)
268 bluezdot [Issue-3478] Update chainlist
209 Thiendekaco [Issue 2501] [update] Extension - Update message error has been standardized #2
277 bluezdot [Issue-3467] add todo
228 Thiendekaco [Issue 3363] Extension - Update standard content #2
185 quangdo
160 Automation Bot [CI Skip] Auto increase webapp build number
145 dominhquang [Issue-3414] Fix bug re-open popup
146 dominhquang [Issue-3468] Improve condition for Marketing campaign
118 lw-cdm
104 khainh predefine metadata for Polkadot & Kusama chains
83 Hieu Dao Update README.md
Expand All @@ -17,12 +17,12 @@
67 bluedot [Issue-2965] fix: Handle earning status for request redeem
63 Roman fix ui issues
53 Dominhquangdev update Bridge code
32 Frenkie Nguyen [Issue 3413] WebApp - Do not show earning position for Bifrost liquid staking
49 Frenkie Nguyen [Issue-3477] fix condition show popup
24 S2kael
17 Thanh [Issue-3518] Update chainlist
10 Trang Trịnh api get karura and acala nfts
9 Minh Le
9 minhld1029 [#115] [ForgetAccount] catch exception refList undefined
9 Thanh
7 Ivan Rukhavets Mention derivation in FAQ (#334)
6 unknown refactor code
5 anhnhu [issue-2231]: add condition branch_name webapp-dev auto increase run scripts change build number
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"url": "https://github.com/Koniverse/Subwallet-V2.git"
},
"sideEffects": false,
"version": "1.2.27",
"version": "1.2.28",
"workspaces": [
"packages/*"
],
Expand All @@ -35,7 +35,7 @@
"build:zip": "yarn build:zip:dst && yarn build:zip:dst-ff && yarn build:zip:src",
"build:zip:dst": "rm -rf ./master-build.zip && cd packages/extension-koni/build && zip -r -FS ../../../master-build.zip .",
"build:zip:dst-ff": "rm -rf ./master-build-firefox.zip && cd packages/extension-koni/build-firefox && zip -r -FS ../../../master-build-firefox.zip .",
"build:zip:src": "rm -rf ./master-src.zip && zip -r -x '*build/*' -x '*node_modules*' -FS ./master-src.zip packages .editorconfig .eslintignore .eslintrc.js babel.config.cjs CHANGELOG.md CONTRIBUTING.md i18next-scanner.config.js jest.config.cjs LICENSE package.json README.md tsconfig.json yarn.lock",
"build:zip:src": "rm -rf ./master-src.zip && zip -r -x '*build/*' -x '*build-firefox/*' -x '*node_modules*' -FS ./master-src.zip packages .editorconfig .eslintignore .eslintrc.js babel.config.cjs CHANGELOG.md CONTRIBUTING.md i18next-scanner.config.js jest.config.cjs LICENSE package.json README.md tsconfig.json yarn.lock",
"clean": "polkadot-dev-clean-build && rm -rf packages/extension-koni/build-firefox",
"dev": "yarn watch-dev",
"dev:firefox": "cd packages/extension-koni && yarn polkadot-exec-webpack --config webpack.config-firefox.cjs --mode development --watch -d inline-source-map",
Expand Down Expand Up @@ -104,7 +104,7 @@
"@polkadot/types-support": "^12.0.2",
"@polkadot/util": "^12.6.2",
"@polkadot/util-crypto": "^12.6.2",
"@subwallet/chain-list": "0.2.83",
"@subwallet/chain-list": "0.2.84",
"@subwallet/keyring": "^0.1.6",
"@subwallet/react-ui": "5.1.2-b79",
"@subwallet/ui-keyring": "^0.1.6",
Expand Down
14 changes: 7 additions & 7 deletions packages/extension-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "1.2.27-0",
"version": "1.2.28-0",
"main": "index.js",
"dependencies": {
"@acala-network/api": "^5.0.2",
Expand Down Expand Up @@ -55,11 +55,11 @@
"@reduxjs/toolkit": "^1.9.1",
"@sora-substrate/type-definitions": "^1.17.7",
"@substrate/connect": "^0.8.9",
"@subwallet/chain-list": "0.2.83",
"@subwallet/extension-base": "^1.2.27-0",
"@subwallet/extension-chains": "^1.2.27-0",
"@subwallet/extension-dapp": "^1.2.27-0",
"@subwallet/extension-inject": "^1.2.27-0",
"@subwallet/chain-list": "0.2.84",
"@subwallet/extension-base": "^1.2.28-0",
"@subwallet/extension-chains": "^1.2.28-0",
"@subwallet/extension-dapp": "^1.2.28-0",
"@subwallet/extension-inject": "^1.2.28-0",
"@subwallet/keyring": "^0.1.6",
"@subwallet/ui-keyring": "^0.1.6",
"@walletconnect/keyvaluestorage": "^1.1.1",
Expand Down Expand Up @@ -100,7 +100,7 @@
"web3-utils": "^1.10.0"
},
"devDependencies": {
"@subwallet/extension-mocks": "^1.2.27-0",
"@subwallet/extension-mocks": "^1.2.28-0",
"@types/uuid": "^9.0.1"
}
}
2 changes: 1 addition & 1 deletion packages/extension-base/src/packageInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

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

export const packageInfo = { name: '@subwallet/extension-base', path: 'auto', type: 'auto', version: '1.2.27-0' };
export const packageInfo = { name: '@subwallet/extension-base', path: 'auto', type: 'auto', version: '1.2.28-0' };
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,38 @@ const filterAddress = (addresses: string[], chainInfo: _ChainInfo): [string[], s
}
};

const handleUnsupportedOrPendingAddresses = (
addresses: string[],
chainSlug: string,
chainAssetMap: Record<string, _ChainAsset>,
state: APIItemState,
callback: (rs: BalanceItem[]) => void
) => {
const tokens = filterAssetsByChainAndType(chainAssetMap, chainSlug, [
_AssetType.NATIVE,
_AssetType.ERC20,
_AssetType.PSP22,
_AssetType.LOCAL,
_AssetType.GRC20,
_AssetType.VFT
]);

const now = new Date().getTime();

Object.values(tokens).forEach((token) => {
const items: BalanceItem[] = addresses.map((address): BalanceItem => ({
address,
tokenSlug: token.slug,
free: '0',
locked: '0',
state,
timestamp: now
}));

callback(items);
});
};

// main subscription, use for multiple chains, multiple addresses and multiple tokens
export function subscribeBalance (
addresses: string[],
Expand All @@ -104,22 +136,13 @@ export function subscribeBalance (
const [useAddresses, notSupportAddresses] = filterAddress(addresses, chainInfo);

if (notSupportAddresses.length) {
const tokens = filterAssetsByChainAndType(chainAssetMap, chainSlug, [_AssetType.NATIVE, _AssetType.ERC20, _AssetType.PSP22, _AssetType.LOCAL, _AssetType.GRC20, _AssetType.VFT]);

const now = new Date().getTime();

Object.values(tokens).forEach((token) => {
const items: BalanceItem[] = notSupportAddresses.map((address): BalanceItem => ({
address,
tokenSlug: token.slug,
free: '0',
locked: '0',
state: APIItemState.NOT_SUPPORT,
timestamp: now
}));

callback(items);
});
handleUnsupportedOrPendingAddresses(
notSupportAddresses,
chainSlug,
chainAssetMap,
APIItemState.NOT_SUPPORT,
callback
);
}

const evmApi = evmApiMap[chainSlug];
Expand All @@ -134,6 +157,16 @@ export function subscribeBalance (
});
}

if (!substrateApiMap[chainSlug].isApiReady) {
handleUnsupportedOrPendingAddresses(
useAddresses,
chainSlug,
chainAssetMap,
APIItemState.PENDING,
callback
);
}

const substrateApi = await substrateApiMap[chainSlug].isReady;

return subscribeSubstrateBalance(useAddresses, chainInfo, chainAssetMap, substrateApi, evmApi, callback, extrinsicType);
Expand Down
3 changes: 2 additions & 1 deletion packages/extension-base/src/services/chain-service/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ const ignoredList = [
'satoshivm',
'satoshivm_testnet',
'ton',
'ton_testnet'
'ton_testnet',
'storyPartner_testnet'
];

const filterAssetInfoMap = (chainInfo: Record<string, _ChainInfo>, assets: Record<string, _ChainAsset>): Record<string, _ChainAsset> => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ export default class InterlayLendingPoolHandler extends BaseLendingPoolHandler {
assetEarning: [
{
slug: this.rewardAssets[0],
apr: 1.29,
exchangeRate: exchangeRate / decimals
}
],
Expand All @@ -83,7 +82,6 @@ export default class InterlayLendingPoolHandler extends BaseLendingPoolHandler {
defaultUnstake: '0',
fastUnstake: '0'
},
totalApr: 1.29,
tvl: '291890000000000'
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ import { BN, BN_TEN, BN_ZERO } from '@polkadot/util';

import BaseLiquidStakingPoolHandler from './base';

interface BlockHeader {
number: number
}

export default class ParallelLiquidStakingPoolHandler extends BaseLiquidStakingPoolHandler {
public slug: string;
protected readonly name: string;
Expand Down Expand Up @@ -56,10 +52,8 @@ export default class ParallelLiquidStakingPoolHandler extends BaseLiquidStakingP
async getPoolStat (): Promise<LiquidYieldPoolInfo> {
const substrateApi = await this.substrateApi.isReady;

const [_exchangeRate, _currentBlockHeader, _currentTimestamp, _stakingLedgers] = await Promise.all([
const [_exchangeRate, _stakingLedgers] = await Promise.all([
substrateApi.api.query.liquidStaking.exchangeRate(),
substrateApi.api.rpc.chain.getHeader(),
substrateApi.api.query.timestamp.now(),
substrateApi.api.query.liquidStaking.stakingLedgers.entries()
]);

Expand All @@ -73,24 +67,9 @@ export default class ParallelLiquidStakingPoolHandler extends BaseLiquidStakingP
}

const exchangeRate = _exchangeRate.toPrimitive() as number;
const currentBlockHeader = _currentBlockHeader.toPrimitive() as unknown as BlockHeader;
const currentTimestamp = _currentTimestamp.toPrimitive() as number;

const beginBlock = currentBlockHeader.number - ((24 * 60 * 60) / 6) * 14;
const _beginBlockHash = await substrateApi.api.rpc.chain.getBlockHash(beginBlock);
const beginBlockHash = _beginBlockHash.toString();

const [_beginTimestamp, _beginExchangeRate] = await Promise.all([
substrateApi.api.query.timestamp.now.at(beginBlockHash),
substrateApi.api.query.liquidStaking.exchangeRate.at(beginBlockHash)
]);

const beginTimestamp = _beginTimestamp.toPrimitive() as number;
const beginExchangeRate = _beginExchangeRate.toPrimitive() as number;
const decimals = 10 ** this.rateDecimals;

const apy = (exchangeRate / beginExchangeRate) ** (365 * 24 * 60 * 60000 / (currentTimestamp - beginTimestamp)) - 1;

const minStake = substrateApi.api.consts.liquidStaking.minStake.toString();
const minUnstake = substrateApi.api.consts.liquidStaking.minUnstake.toString();

Expand All @@ -107,7 +86,6 @@ export default class ParallelLiquidStakingPoolHandler extends BaseLiquidStakingP
assetEarning: [
{
slug: this.rewardAssets[0],
apy: apy * 100,
exchangeRate: exchangeRate / decimals
}
],
Expand All @@ -119,7 +97,6 @@ export default class ParallelLiquidStakingPoolHandler extends BaseLiquidStakingP
defaultUnstake: minUnstake,
fastUnstake: '0'
},
totalApy: apy * 100,
tvl: tvl.toString()
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default class EarningService implements StoppableServiceInterface, Persis

private dbService: DatabaseService;
private eventService: EventService;
private useOnlineCacheOnly = true;
private useOnlineCacheOnly = false;

constructor (state: KoniState) {
this.state = state;
Expand Down
4 changes: 2 additions & 2 deletions packages/extension-chains/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "1.2.27-0",
"version": "1.2.28-0",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.20.6",
"@polkadot/networks": "^12.6.2",
"@polkadot/util": "^12.6.2",
"@polkadot/util-crypto": "^12.6.2",
"@subwallet/extension-inject": "^1.2.27-0"
"@subwallet/extension-inject": "^1.2.28-0"
},
"peerDependencies": {
"@polkadot/api": "*",
Expand Down
2 changes: 1 addition & 1 deletion packages/extension-chains/src/packageInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

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

export const packageInfo = { name: '@subwallet/extension-chains', path: 'auto', type: 'auto', version: '1.2.27-0' };
export const packageInfo = { name: '@subwallet/extension-chains', path: 'auto', type: 'auto', version: '1.2.28-0' };
4 changes: 2 additions & 2 deletions packages/extension-compat-metamask/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "1.2.27-0",
"version": "1.2.28-0",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.20.6",
"@metamask/detect-provider": "^1.2.0",
"@polkadot/types": "^11.0.3",
"@polkadot/util": "^12.6.2",
"@subwallet/extension-inject": "^1.2.27-0",
"@subwallet/extension-inject": "^1.2.28-0",
"web3": "^1.10.0"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/extension-compat-metamask/src/packageInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

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

export const packageInfo = { name: '@subwallet/extension-compat-metamask', path: 'auto', type: 'auto', version: '1.2.27-0' };
export const packageInfo = { name: '@subwallet/extension-compat-metamask', path: 'auto', type: 'auto', version: '1.2.28-0' };
4 changes: 2 additions & 2 deletions packages/extension-dapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "1.2.27-0",
"version": "1.2.28-0",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.20.6",
"@polkadot/util": "^12.6.2",
"@polkadot/util-crypto": "^12.6.2",
"@subwallet/extension-inject": "^1.2.27-0"
"@subwallet/extension-inject": "^1.2.28-0"
},
"peerDependencies": {
"@polkadot/api": "*",
Expand Down
2 changes: 1 addition & 1 deletion packages/extension-dapp/src/packageInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

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

export const packageInfo = { name: '@subwallet/extension-dapp', path: 'auto', type: 'auto', version: '1.2.27-0' };
export const packageInfo = { name: '@subwallet/extension-dapp', path: 'auto', type: 'auto', version: '1.2.28-0' };
Loading

0 comments on commit 18d231c

Please sign in to comment.