Skip to content

Commit

Permalink
Merge branch 'subwallet-dev' into koni/dev/issue-3745
Browse files Browse the repository at this point in the history
  • Loading branch information
tunghp2002 authored Jan 10, 2025
2 parents c705900 + caf62c0 commit a1232c6
Show file tree
Hide file tree
Showing 66 changed files with 2,623 additions and 308 deletions.
3 changes: 2 additions & 1 deletion .123trigger
Original file line number Diff line number Diff line change
Expand Up @@ -176,4 +176,5 @@
1.3.8
1.3.9
1.3.10
1.3.11
1.3.11
1.3.12
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# CHANGELOG

## 1.3.12
Build date: Jan 06, 2025.

Features & Update:
- Add referral code for Bifrost Liquid Staking (vDOT, vMANTA)
- Support bridge ETH <-> POS (#3893)
- Support Avail Recovery app (#3915)
- Set up SubWallet validators (#2533)
- Update chain-list (#3897)

Bug fixed:
- Fix max transferable for Avail Bridge (#3911)


## 1.3.11
Build date: Dec 23, 2024.

Expand All @@ -10,6 +24,7 @@ Features & Update:
Bug fixed:
- Fix errors when making transactions on Tangle mainnet (#3861)


## 1.3.10
Build date: Dec 12, 2024.

Expand Down
10 changes: 5 additions & 5 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
2914 AnhMTV Release version 1.3.11
2922 AnhMTV Release version 1.3.12
2552 Nam Phạm [Issue 3855] test: add log
2380 S2kael [Issue-3855] Remove log
2387 S2kael
869 lw-cdm [MasterAccount] Update logic to reorder account on select account modal
568 nguyentiendung [Issue-3553] [Issue-3553] Refactor code and add recipient to swap history.
490 bluezdot [Issue-3888] build: update version @galacticcouncil/sdk to 5.1.0
492 bluezdot
465 Jaco 0.42.5 (#969)
354 Thiendekaco [Issue-3707] [fix] Unified account - fix dApp ui bug #4
186 dominhquang [Issue-3507] Fix UI bug for Notification
Expand All @@ -12,12 +12,12 @@
170 lw-cdm
160 Automation Bot [CI Skip] Auto increase webapp build number
104 khainh predefine metadata for Polkadot & Kusama chains
99 PDTnhah [Issue-3897] Update chainlist
96 lw
91 PDTnhah [Issue-3861] Fix: Update link navigate to explorer
94 tunghp2002 [Update] Refactor code
83 Hieu Dao Update README.md
83 leewong
82 Thibaut Sardan Add account filtering feature (#832)
77 tunghp2002 [update] Reformat sender address
74 bluedot [Issue-3888] build: upgrade version polkadot api
63 Roman fix ui issues
53 Dominhquangdev update Bridge code
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.3.11",
"version": "1.3.12",
"workspaces": [
"packages/*"
],
Expand Down Expand Up @@ -105,12 +105,12 @@
"@polkadot/types-support": "^15.0.1",
"@polkadot/util": "^13.2.3",
"@polkadot/util-crypto": "^13.2.3",
"@subwallet/chain-list": "0.2.96",
"@subwallet/chain-list": "0.2.97",
"@subwallet/keyring": "^0.1.8-beta.0",
"@subwallet/react-ui": "5.1.2-b79",
"@subwallet/ui-keyring": "0.1.8-beta.0",
"@types/bn.js": "^5.1.6",
"@zondax/ledger-substrate": "0.44.2",
"@zondax/ledger-substrate": "1.0.1",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^29.3.1",
"browserify-sign": "^4.2.2",
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.3.11-0",
"version": "1.3.12-1",
"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.96",
"@subwallet/extension-base": "^1.3.11-0",
"@subwallet/extension-chains": "^1.3.11-0",
"@subwallet/extension-dapp": "^1.3.11-0",
"@subwallet/extension-inject": "^1.3.11-0",
"@subwallet/chain-list": "0.2.97",
"@subwallet/extension-base": "^1.3.12-1",
"@subwallet/extension-chains": "^1.3.12-1",
"@subwallet/extension-dapp": "^1.3.12-1",
"@subwallet/extension-inject": "^1.3.12-1",
"@subwallet/keyring": "^0.1.8-beta.0",
"@subwallet/ui-keyring": "^0.1.8-beta.0",
"@ton/core": "^0.56.3",
Expand Down Expand Up @@ -105,7 +105,7 @@
"web3-utils": "^1.10.0"
},
"devDependencies": {
"@subwallet/extension-mocks": "^1.3.11-0",
"@subwallet/extension-mocks": "^1.3.12-1",
"@types/uuid": "^9.0.1"
}
}
14 changes: 14 additions & 0 deletions packages/extension-base/src/background/KoniTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,17 @@ export interface MetadataItem {
types: Record<string, Record<string, string> | string>;
userExtensions?: ExtDef;
hexV15?: HexString;
tokenInfo?: {
ss58Format: number;
tokenDecimals: number;
tokenSymbol: string;
};
}

export interface MetadataV15Item {
genesisHash: string;
specVersion: string;
hexV15?: HexString;
}

export interface CrowdloanItem {
Expand Down Expand Up @@ -792,6 +803,7 @@ export interface CreateHardwareAccountItem {
name: string;
isEthereum: boolean;
isGeneric: boolean;
isLedgerRecovery?: boolean;
}

export interface RequestAccountCreateHardwareV2 extends CreateHardwareAccountItem {
Expand Down Expand Up @@ -1264,6 +1276,8 @@ export interface LedgerNetwork {
isEthereum: boolean;
/** Hide networks that are supported by the dot migration app */
isHide?: boolean;
/** Recovery app */
isRecovery?: boolean;
/** Slip44 in the derivation path */
slip44: number;
}
Expand Down
5 changes: 5 additions & 0 deletions packages/extension-base/src/constants/staking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,8 @@ export const PREDEFINED_STAKING_POOL: Record<string, number> = {
export const MAX_NOMINATIONS = '16';

export const PREDEFINED_EARNING_POOL_PROMISE = fetchStaticData<Record<string, number[]>>('nomination-pool-recommendation');

export type ChainRecommendValidator = {
maxCount: number;
preSelectValidators: string;
};
19 changes: 17 additions & 2 deletions packages/extension-base/src/core/substrate/xcm-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { _ChainAsset, _ChainInfo } from '@subwallet/chain-list/types';
import { _Address } from '@subwallet/extension-base/background/KoniTypes';
import { isAvailChainBridge } from '@subwallet/extension-base/services/balance-service/transfer/xcm/availBridge';
import { _isPolygonChainBridge } from '@subwallet/extension-base/services/balance-service/transfer/xcm/polygonBridge';
import { _isPosChainBridge } from '@subwallet/extension-base/services/balance-service/transfer/xcm/posBridge';
import { _getChainSubstrateAddressPrefix, _getEvmChainId, _getSubstrateParaId, _getSubstrateRelayParent, _getXcmAssetMultilocation, _isChainEvmCompatible, _isPureEvmChain, _isSubstrateParaChain } from '@subwallet/extension-base/services/chain-service/utils';

import { decodeAddress, evmToAddress } from '@polkadot/util-crypto';
Expand Down Expand Up @@ -63,7 +64,7 @@ export function _getXcmMultiLocation (originChainInfo: _ChainInfo, destChainInfo
}

export function _isXcmTransferUnstable (originChainInfo: _ChainInfo, destChainInfo: _ChainInfo, assetSlug: string): boolean {
return !_isXcmWithinSameConsensus(originChainInfo, destChainInfo) || _isMythosFromHydrationToMythos(originChainInfo, destChainInfo, assetSlug) || _isPolygonBridgeXcm(originChainInfo, destChainInfo);
return !_isXcmWithinSameConsensus(originChainInfo, destChainInfo) || _isMythosFromHydrationToMythos(originChainInfo, destChainInfo, assetSlug) || _isPolygonBridgeXcm(originChainInfo, destChainInfo) || _isPosBridgeXcm(originChainInfo, destChainInfo);
}

function getAssetHubBridgeUnstableWarning (originChainInfo: _ChainInfo): string {
Expand Down Expand Up @@ -104,8 +105,18 @@ function getPolygonBridgeWarning (originChainInfo: _ChainInfo): string {
}
}

function getPosBridgeWarning (originChainInfo: _ChainInfo): string {
if (originChainInfo.slug === COMMON_CHAIN_SLUGS.ETHEREUM || originChainInfo.slug === COMMON_CHAIN_SLUGS.ETHEREUM_SEPOLIA) {
return 'Cross-chain transfer of this token may take up to 22 minutes. Do you still want to continue?';
} else {
return 'Cross-chain transfer of this token may take up to 90 minutes, and you’ll need to manually claim the funds on the destination network to complete the transfer. Do you still want to continue?';
}
}

export function _getXcmUnstableWarning (originChainInfo: _ChainInfo, destChainInfo: _ChainInfo, assetSlug: string): string {
if (_isPolygonBridgeXcm(originChainInfo, destChainInfo)) {
if (_isPosBridgeXcm(originChainInfo, destChainInfo)) {
return getPosBridgeWarning(originChainInfo);
} else if (_isPolygonBridgeXcm(originChainInfo, destChainInfo)) {
return getPolygonBridgeWarning(originChainInfo);
} else if (_isAvailBridgeXcm(originChainInfo, destChainInfo)) {
return getAvailBridgeWarning();
Expand Down Expand Up @@ -141,6 +152,10 @@ export function _isPolygonBridgeXcm (originChainInfo: _ChainInfo, destChainInfo:
return _isPolygonChainBridge(originChainInfo.slug, destChainInfo.slug);
}

export function _isPosBridgeXcm (originChainInfo: _ChainInfo, destChainInfo: _ChainInfo): boolean {
return _isPosChainBridge(originChainInfo.slug, destChainInfo.slug);
}

// ---------------------------------------------------------------------------------------------------------------------

function _getMultiLocationParent (originChainInfo: _ChainInfo, isWithinSameConsensus: boolean): number {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ export const _AVAIL_BRIDGE_GATEWAY_ABI: Record<string, any> = require('./avail_b
export const _AVAIL_TEST_BRIDGE_GATEWAY_ABI: Record<string, any> = require('./avail_test_bridge_abi.json');
// eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-unsafe-assignment
export const _POLYGON_BRIDGE_ABI: Record<string, any> = require('./polygon_bridge_abi.json');
// eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-unsafe-assignment
export const _POS_BRIDGE_ABI: Record<string, any> = require('./pos_bridge_abi.json');
// eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-unsafe-assignment
export const _POS_BRIDGE_L2_ABI: Record<string, any> = require('./pos_bridge_l2_abi.json');

const SNOWBRIDGE_GATEWAY_ETHEREUM_CONTRACT_ADDRESS = '0x27ca963C279c93801941e1eB8799c23f407d68e7';
const SNOWBRIDGE_GATEWAY_SEPOLIA_CONTRACT_ADDRESS = '0x5B4909cE6Ca82d2CE23BD46738953c7959E710Cd';
Expand Down Expand Up @@ -72,3 +76,29 @@ export function getPolygonBridgeContract (chain: string): string {

throw new Error('Invalid chain');
}

const POSBRIDGE_GATEWAY_AMOY_CONTRACT_ADDRESS = '0x52eF3d68BaB452a294342DC3e5f464d7f610f72E';
const POSBRIDGE_GATEWAY_SEPOLIA_CONTRACT_ADDRESS = '0x34F5A25B627f50Bb3f5cAb72807c4D4F405a9232';

const POSBRIDGE_GATEWAY_CONTRACT_ADDRESS = '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619';
const POSBRIDGE_GATEWAY_ETHEREUM_CONTRACT_ADDRESS = '0xA0c68C638235ee32657e8f720a23ceC1bFc77C77';

export function getPosL2BridgeContract (chain: string): string {
if (chain === 'polygon_amoy' || chain === COMMON_CHAIN_SLUGS.ETHEREUM_SEPOLIA) {
return POSBRIDGE_GATEWAY_AMOY_CONTRACT_ADDRESS;
} else if (chain === 'polygon' || chain === COMMON_CHAIN_SLUGS.ETHEREUM) {
return POSBRIDGE_GATEWAY_CONTRACT_ADDRESS;
}

throw new Error('Invalid chain');
}

export function getPosL1BridgeContract (chain: string): string {
if (chain === COMMON_CHAIN_SLUGS.ETHEREUM_SEPOLIA) {
return POSBRIDGE_GATEWAY_SEPOLIA_CONTRACT_ADDRESS;
} else if (chain === COMMON_CHAIN_SLUGS.ETHEREUM) {
return POSBRIDGE_GATEWAY_ETHEREUM_CONTRACT_ADDRESS;
}

throw new Error('Invalid chain');
}
Loading

0 comments on commit a1232c6

Please sign in to comment.