@subwallet/extension-base 1.3.11-0 → 1.3.12-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/background/KoniTypes.d.ts +3 -0
  2. package/cjs/core/substrate/xcm-parser.js +16 -2
  3. package/cjs/koni/api/contract-handler/utils/index.js +29 -1
  4. package/cjs/koni/background/handlers/Extension.js +16 -4
  5. package/cjs/packageInfo.js +1 -1
  6. package/cjs/services/balance-service/transfer/smart-contract.js +2 -0
  7. package/cjs/services/balance-service/transfer/xcm/index.js +6 -6
  8. package/cjs/services/balance-service/transfer/xcm/polygonBridge.js +2 -2
  9. package/cjs/services/balance-service/transfer/xcm/posBridge.js +144 -0
  10. package/cjs/services/chain-service/utils/patch.js +1 -1
  11. package/cjs/services/earning-service/constants/chains.js +4 -2
  12. package/cjs/services/earning-service/handlers/liquid-staking/bifrost-manta.js +2 -1
  13. package/cjs/services/earning-service/handlers/liquid-staking/bifrost.js +2 -2
  14. package/cjs/services/inapp-notification-service/index.js +2 -0
  15. package/cjs/services/inapp-notification-service/utils/polygon.js +1 -1
  16. package/cjs/services/keyring-service/context/handlers/Ledger.js +3 -1
  17. package/cjs/services/transaction-service/utils.js +3 -0
  18. package/cjs/utils/number.js +7 -2
  19. package/constants/staking.d.ts +4 -0
  20. package/core/substrate/xcm-parser.d.ts +1 -0
  21. package/core/substrate/xcm-parser.js +15 -2
  22. package/koni/api/contract-handler/utils/index.d.ts +4 -0
  23. package/koni/api/contract-handler/utils/index.js +24 -0
  24. package/koni/api/contract-handler/utils/pos_bridge_abi.json +783 -0
  25. package/koni/api/contract-handler/utils/pos_bridge_l2_abi.json +793 -0
  26. package/koni/background/handlers/Extension.js +18 -6
  27. package/package.json +13 -6
  28. package/packageInfo.js +1 -1
  29. package/services/balance-service/transfer/smart-contract.js +2 -0
  30. package/services/balance-service/transfer/xcm/index.js +7 -7
  31. package/services/balance-service/transfer/xcm/polygonBridge.js +2 -2
  32. package/services/balance-service/transfer/xcm/posBridge.d.ts +14 -0
  33. package/services/balance-service/transfer/xcm/posBridge.js +131 -0
  34. package/services/chain-service/utils/patch.js +1 -1
  35. package/services/earning-service/constants/chains.d.ts +1 -0
  36. package/services/earning-service/constants/chains.js +2 -1
  37. package/services/earning-service/handlers/liquid-staking/bifrost-manta.js +2 -1
  38. package/services/earning-service/handlers/liquid-staking/bifrost.js +3 -3
  39. package/services/inapp-notification-service/index.js +2 -0
  40. package/services/inapp-notification-service/interfaces.d.ts +7 -6
  41. package/services/inapp-notification-service/utils/polygon.d.ts +6 -6
  42. package/services/inapp-notification-service/utils/polygon.js +1 -1
  43. package/services/keyring-service/context/handlers/Ledger.js +3 -1
  44. package/services/transaction-service/utils.js +3 -0
  45. package/types/account/info/keyring.d.ts +2 -0
  46. package/utils/number.d.ts +1 -0
  47. package/utils/number.js +4 -0
@@ -610,6 +610,7 @@ export interface CreateHardwareAccountItem {
610
610
  name: string;
611
611
  isEthereum: boolean;
612
612
  isGeneric: boolean;
613
+ isLedgerRecovery?: boolean;
613
614
  }
614
615
  export interface RequestAccountCreateHardwareV2 extends CreateHardwareAccountItem {
615
616
  isAllowed?: boolean;
@@ -972,6 +973,8 @@ export interface LedgerNetwork {
972
973
  isEthereum: boolean;
973
974
  /** Hide networks that are supported by the dot migration app */
974
975
  isHide?: boolean;
976
+ /** Recovery app */
977
+ isRecovery?: boolean;
975
978
  /** Slip44 in the derivation path */
976
979
  slip44: number;
977
980
  }
@@ -12,12 +12,14 @@ exports._getXcmUnstableWarning = _getXcmUnstableWarning;
12
12
  exports._isAvailBridgeXcm = _isAvailBridgeXcm;
13
13
  exports._isMythosFromHydrationToMythos = _isMythosFromHydrationToMythos;
14
14
  exports._isPolygonBridgeXcm = _isPolygonBridgeXcm;
15
+ exports._isPosBridgeXcm = _isPosBridgeXcm;
15
16
  exports._isSnowBridgeXcm = _isSnowBridgeXcm;
16
17
  exports._isXcmTransferUnstable = _isXcmTransferUnstable;
17
18
  exports._isXcmWithinSameConsensus = _isXcmWithinSameConsensus;
18
19
  var _chainList = require("@subwallet/chain-list");
19
20
  var _availBridge = require("@subwallet/extension-base/services/balance-service/transfer/xcm/availBridge");
20
21
  var _polygonBridge = require("@subwallet/extension-base/services/balance-service/transfer/xcm/polygonBridge");
22
+ var _posBridge = require("@subwallet/extension-base/services/balance-service/transfer/xcm/posBridge");
21
23
  var _utils = require("@subwallet/extension-base/services/chain-service/utils");
22
24
  var _utilCrypto = require("@polkadot/util-crypto");
23
25
  // Copyright 2019-2022 @subwallet/extension-base
@@ -66,7 +68,7 @@ function _getXcmMultiLocation(originChainInfo, destChainInfo, version, recipient
66
68
  };
67
69
  }
68
70
  function _isXcmTransferUnstable(originChainInfo, destChainInfo, assetSlug) {
69
- return !_isXcmWithinSameConsensus(originChainInfo, destChainInfo) || _isMythosFromHydrationToMythos(originChainInfo, destChainInfo, assetSlug) || _isPolygonBridgeXcm(originChainInfo, destChainInfo);
71
+ return !_isXcmWithinSameConsensus(originChainInfo, destChainInfo) || _isMythosFromHydrationToMythos(originChainInfo, destChainInfo, assetSlug) || _isPolygonBridgeXcm(originChainInfo, destChainInfo) || _isPosBridgeXcm(originChainInfo, destChainInfo);
70
72
  }
71
73
  function getAssetHubBridgeUnstableWarning(originChainInfo) {
72
74
  switch (originChainInfo.slug) {
@@ -101,8 +103,17 @@ function getPolygonBridgeWarning(originChainInfo) {
101
103
  return 'Cross-chain transfer of this token may take up to 3 hours, and you’ll need to manually claim the funds on the destination network to complete the transfer. Do you still want to continue?';
102
104
  }
103
105
  }
106
+ function getPosBridgeWarning(originChainInfo) {
107
+ if (originChainInfo.slug === _chainList.COMMON_CHAIN_SLUGS.ETHEREUM || originChainInfo.slug === _chainList.COMMON_CHAIN_SLUGS.ETHEREUM_SEPOLIA) {
108
+ return 'Cross-chain transfer of this token may take up to 22 minutes. Do you still want to continue?';
109
+ } else {
110
+ 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?';
111
+ }
112
+ }
104
113
  function _getXcmUnstableWarning(originChainInfo, destChainInfo, assetSlug) {
105
- if (_isPolygonBridgeXcm(originChainInfo, destChainInfo)) {
114
+ if (_isPosBridgeXcm(originChainInfo, destChainInfo)) {
115
+ return getPosBridgeWarning(originChainInfo);
116
+ } else if (_isPolygonBridgeXcm(originChainInfo, destChainInfo)) {
106
117
  return getPolygonBridgeWarning(originChainInfo);
107
118
  } else if (_isAvailBridgeXcm(originChainInfo, destChainInfo)) {
108
119
  return getAvailBridgeWarning();
@@ -131,6 +142,9 @@ function _isMythosFromHydrationToMythos(originChainInfo, destChainInfo, assetSlu
131
142
  function _isPolygonBridgeXcm(originChainInfo, destChainInfo) {
132
143
  return (0, _polygonBridge._isPolygonChainBridge)(originChainInfo.slug, destChainInfo.slug);
133
144
  }
145
+ function _isPosBridgeXcm(originChainInfo, destChainInfo) {
146
+ return (0, _posBridge._isPosChainBridge)(originChainInfo.slug, destChainInfo.slug);
147
+ }
134
148
 
135
149
  // ---------------------------------------------------------------------------------------------------------------------
136
150
 
@@ -3,9 +3,11 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports._TEST_ERC721_ABI = exports._SNOWBRIDGE_GATEWAY_ABI = exports._PSP34_ABI = exports._PSP22_ABI = exports._POLYGON_BRIDGE_ABI = exports._PINK_PSP34_ABI = exports._NEUROGUNS_PSP34_ABI = exports._ERC721_ABI = exports._ERC20_ABI = exports._AZERO_DOMAIN_REGISTRY_ABI = exports._AVAIL_TEST_BRIDGE_GATEWAY_ABI = exports._AVAIL_BRIDGE_GATEWAY_ABI = void 0;
6
+ exports._TEST_ERC721_ABI = exports._SNOWBRIDGE_GATEWAY_ABI = exports._PSP34_ABI = exports._PSP22_ABI = exports._POS_BRIDGE_L2_ABI = exports._POS_BRIDGE_ABI = exports._POLYGON_BRIDGE_ABI = exports._PINK_PSP34_ABI = exports._NEUROGUNS_PSP34_ABI = exports._ERC721_ABI = exports._ERC20_ABI = exports._AZERO_DOMAIN_REGISTRY_ABI = exports._AVAIL_TEST_BRIDGE_GATEWAY_ABI = exports._AVAIL_BRIDGE_GATEWAY_ABI = void 0;
7
7
  exports.getAvailBridgeGatewayContract = getAvailBridgeGatewayContract;
8
8
  exports.getPolygonBridgeContract = getPolygonBridgeContract;
9
+ exports.getPosL1BridgeContract = getPosL1BridgeContract;
10
+ exports.getPosL2BridgeContract = getPosL2BridgeContract;
9
11
  exports.getSnowBridgeGatewayContract = getSnowBridgeGatewayContract;
10
12
  exports.isAvailBridgeGatewayContract = isAvailBridgeGatewayContract;
11
13
  exports.isSnowBridgeGatewayContract = isSnowBridgeGatewayContract;
@@ -48,7 +50,13 @@ const _AVAIL_TEST_BRIDGE_GATEWAY_ABI = require('./avail_test_bridge_abi.json');
48
50
  // eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-unsafe-assignment
49
51
  exports._AVAIL_TEST_BRIDGE_GATEWAY_ABI = _AVAIL_TEST_BRIDGE_GATEWAY_ABI;
50
52
  const _POLYGON_BRIDGE_ABI = require('./polygon_bridge_abi.json');
53
+ // eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-unsafe-assignment
51
54
  exports._POLYGON_BRIDGE_ABI = _POLYGON_BRIDGE_ABI;
55
+ const _POS_BRIDGE_ABI = require('./pos_bridge_abi.json');
56
+ // eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-unsafe-assignment
57
+ exports._POS_BRIDGE_ABI = _POS_BRIDGE_ABI;
58
+ const _POS_BRIDGE_L2_ABI = require('./pos_bridge_l2_abi.json');
59
+ exports._POS_BRIDGE_L2_ABI = _POS_BRIDGE_L2_ABI;
52
60
  const SNOWBRIDGE_GATEWAY_ETHEREUM_CONTRACT_ADDRESS = '0x27ca963C279c93801941e1eB8799c23f407d68e7';
53
61
  const SNOWBRIDGE_GATEWAY_SEPOLIA_CONTRACT_ADDRESS = '0x5B4909cE6Ca82d2CE23BD46738953c7959E710Cd';
54
62
  function getSnowBridgeGatewayContract(chain) {
@@ -80,4 +88,24 @@ function getPolygonBridgeContract(chain) {
80
88
  return POLYGONBRIDGE_GATEWAY_ETHEREUM_CONTRACT_ADDRESS;
81
89
  }
82
90
  throw new Error('Invalid chain');
91
+ }
92
+ const POSBRIDGE_GATEWAY_AMOY_CONTRACT_ADDRESS = '0x52eF3d68BaB452a294342DC3e5f464d7f610f72E';
93
+ const POSBRIDGE_GATEWAY_SEPOLIA_CONTRACT_ADDRESS = '0x34F5A25B627f50Bb3f5cAb72807c4D4F405a9232';
94
+ const POSBRIDGE_GATEWAY_CONTRACT_ADDRESS = '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619';
95
+ const POSBRIDGE_GATEWAY_ETHEREUM_CONTRACT_ADDRESS = '0xA0c68C638235ee32657e8f720a23ceC1bFc77C77';
96
+ function getPosL2BridgeContract(chain) {
97
+ if (chain === 'polygon_amoy' || chain === _chainList.COMMON_CHAIN_SLUGS.ETHEREUM_SEPOLIA) {
98
+ return POSBRIDGE_GATEWAY_AMOY_CONTRACT_ADDRESS;
99
+ } else if (chain === 'polygon' || chain === _chainList.COMMON_CHAIN_SLUGS.ETHEREUM) {
100
+ return POSBRIDGE_GATEWAY_CONTRACT_ADDRESS;
101
+ }
102
+ throw new Error('Invalid chain');
103
+ }
104
+ function getPosL1BridgeContract(chain) {
105
+ if (chain === _chainList.COMMON_CHAIN_SLUGS.ETHEREUM_SEPOLIA) {
106
+ return POSBRIDGE_GATEWAY_SEPOLIA_CONTRACT_ADDRESS;
107
+ } else if (chain === _chainList.COMMON_CHAIN_SLUGS.ETHEREUM) {
108
+ return POSBRIDGE_GATEWAY_ETHEREUM_CONTRACT_ADDRESS;
109
+ }
110
+ throw new Error('Invalid chain');
83
111
  }
@@ -8,6 +8,7 @@ exports.default = void 0;
8
8
  exports.isJsonPayload = isJsonPayload;
9
9
  var _common = require("@ethereumjs/common");
10
10
  var _tx = require("@ethereumjs/tx");
11
+ var _chainList = require("@subwallet/chain-list");
11
12
  var _types = require("@subwallet/chain-list/types");
12
13
  var _TransactionError = require("@subwallet/extension-base/background/errors/TransactionError");
13
14
  var _helpers = require("@subwallet/extension-base/background/handlers/helpers");
@@ -34,6 +35,7 @@ var _tonTransfer = require("@subwallet/extension-base/services/balance-service/t
34
35
  var _xcm = require("@subwallet/extension-base/services/balance-service/transfer/xcm");
35
36
  var _availBridge = require("@subwallet/extension-base/services/balance-service/transfer/xcm/availBridge");
36
37
  var _polygonBridge = require("@subwallet/extension-base/services/balance-service/transfer/xcm/polygonBridge");
38
+ var _posBridge = require("@subwallet/extension-base/services/balance-service/transfer/xcm/posBridge");
37
39
  var _constants2 = require("@subwallet/extension-base/services/chain-service/constants");
38
40
  var _types2 = require("@subwallet/extension-base/services/chain-service/types");
39
41
  var _utils4 = require("@subwallet/extension-base/services/chain-service/utils");
@@ -1302,6 +1304,7 @@ class KoniExtension {
1302
1304
  const isAvailBridgeFromAvail = (0, _availBridge.isAvailChainBridge)(originNetworkKey) && (0, _utils4._isPureEvmChain)(chainInfoMap[destinationNetworkKey]);
1303
1305
  const isSnowBridgeEvmTransfer = (0, _utils4._isPureEvmChain)(chainInfoMap[originNetworkKey]) && (0, _xcmParser._isSnowBridgeXcm)(chainInfoMap[originNetworkKey], chainInfoMap[destinationNetworkKey]) && !isAvailBridgeFromEvm;
1304
1306
  const isPolygonBridgeTransfer = (0, _polygonBridge._isPolygonChainBridge)(originNetworkKey, destinationNetworkKey);
1307
+ const isPosBridgeTransfer = (0, _posBridge._isPosChainBridge)(originNetworkKey, destinationNetworkKey);
1305
1308
  let additionalValidator;
1306
1309
  let eventsHandler;
1307
1310
  if (fromKeyPair && destinationTokenInfo) {
@@ -1318,7 +1321,7 @@ class KoniExtension {
1318
1321
  evmApi
1319
1322
  };
1320
1323
  let funcCreateExtrinsic;
1321
- if (isPolygonBridgeTransfer) {
1324
+ if (isPosBridgeTransfer || isPolygonBridgeTransfer) {
1322
1325
  funcCreateExtrinsic = _xcm.createPolygonBridgeExtrinsic;
1323
1326
  } else if (isSnowBridgeEvmTransfer) {
1324
1327
  funcCreateExtrinsic = _xcm.createSnowBridgeExtrinsic;
@@ -1385,7 +1388,7 @@ class KoniExtension {
1385
1388
  transaction: extrinsic,
1386
1389
  data: inputData,
1387
1390
  extrinsicType: _KoniTypes.ExtrinsicType.TRANSFER_XCM,
1388
- chainType: !isSnowBridgeEvmTransfer && !isAvailBridgeFromEvm && !isPolygonBridgeTransfer ? _KoniTypes.ChainType.SUBSTRATE : _KoniTypes.ChainType.EVM,
1391
+ chainType: !isSnowBridgeEvmTransfer && !isAvailBridgeFromEvm && !isPolygonBridgeTransfer && !isPosBridgeTransfer ? _KoniTypes.ChainType.SUBSTRATE : _KoniTypes.ChainType.EVM,
1389
1392
  transferNativeAmount: (0, _utils4._isNativeToken)(originTokenInfo) ? value : '0',
1390
1393
  ignoreWarnings,
1391
1394
  isTransferAll: transferAll,
@@ -1607,6 +1610,10 @@ class KoniExtension {
1607
1610
  const chainInfoMap = this.#koniState.chainService.getChainInfoMap();
1608
1611
  const destinationTokenInfo = this.#koniState.getXcmEqualAssetByChain(destChain, originTokenInfo.slug);
1609
1612
  const existentialDeposit = originTokenInfo.minAmount || '0';
1613
+
1614
+ // todo: improve this case. Currently set 1 AVAIL for covering fee as default.
1615
+ const isSpecialBridgeFromAvail = originTokenInfo.slug === 'avail_mainnet-NATIVE-AVAIL' && destChain === _chainList.COMMON_CHAIN_SLUGS.ETHEREUM;
1616
+ const specialBridgeFromAvailFee = new _bignumber.default((0, _utils5.toBNString)(1, (0, _utils4._getAssetDecimals)(originTokenInfo))).minus(new _bignumber.default((0, _utils4._getTokenMinAmount)(originTokenInfo)));
1610
1617
  if (destinationTokenInfo) {
1611
1618
  const [bnMockExecutionFee, {
1612
1619
  value
@@ -1617,7 +1624,7 @@ class KoniExtension {
1617
1624
  token: originTokenInfo.slug
1618
1625
  })]);
1619
1626
  const bnMaxTransferable = new _bignumber.default(value);
1620
- const estimatedFee = bnMockExecutionFee.multipliedBy(_constants.XCM_FEE_RATIO).plus(new _bignumber.default(existentialDeposit));
1627
+ const estimatedFee = isSpecialBridgeFromAvail ? specialBridgeFromAvailFee : bnMockExecutionFee.multipliedBy(_constants.XCM_FEE_RATIO).plus(new _bignumber.default(existentialDeposit));
1621
1628
  return bnMaxTransferable.minus(estimatedFee);
1622
1629
  }
1623
1630
  return new _bignumber.default(0);
@@ -3525,7 +3532,12 @@ class KoniExtension {
3525
3532
  const extrinsicType = _KoniTypes.ExtrinsicType.CLAIM_BRIDGE;
3526
3533
  let transaction = null;
3527
3534
  const evmApi = this.#koniState.getEvmApi(chain);
3528
- transaction = await (0, _polygonBridge.getClaimPolygonBridge)(chain, notification, evmApi);
3535
+ const metadata = notification.metadata;
3536
+ if (metadata.bridgeType === 'POS') {
3537
+ transaction = await (0, _posBridge.getClaimPosBridge)(chain, notification, evmApi);
3538
+ } else {
3539
+ transaction = await (0, _polygonBridge.getClaimPolygonBridge)(chain, notification, evmApi);
3540
+ }
3529
3541
  const chainType = _KoniTypes.ChainType.EVM;
3530
3542
  return await this.#koniState.transactionService.handleTransaction({
3531
3543
  address,
@@ -13,6 +13,6 @@ const packageInfo = {
13
13
  name: '@subwallet/extension-base',
14
14
  path: typeof __dirname === 'string' ? __dirname : 'auto',
15
15
  type: 'cjs',
16
- version: '1.3.11-0'
16
+ version: '1.3.12-1'
17
17
  };
18
18
  exports.packageInfo = packageInfo;
@@ -68,6 +68,8 @@ async function getERC20TransactionObject(assetAddress, chainInfo, from, to, valu
68
68
  // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
69
69
  erc20Contract.methods.transfer(to, transferValue).estimateGas({
70
70
  from
71
+ }).catch(() => {
72
+ throw Error('Unable to estimate fee for this transaction. Try again or contact support at agent@subwallet.app');
71
73
  }), (0, _utils3.calculateGasFeeParams)(evmApi, networkKey)]);
72
74
  const transactionObject = {
73
75
  gas: gasLimit,
@@ -17,6 +17,7 @@ var _utils = require("@subwallet/extension-base/services/chain-service/utils");
17
17
  var _bignumber = _interopRequireDefault(require("bignumber.js"));
18
18
  var _util = require("@polkadot/util");
19
19
  var _utilCrypto = require("@polkadot/util-crypto");
20
+ var _posBridge = require("./posBridge");
20
21
  // Copyright 2019-2022 @subwallet/extension-base
21
22
  // SPDX-License-Identifier: Apache-2.0
22
23
 
@@ -113,7 +114,9 @@ const createPolygonBridgeExtrinsic = async _ref5 => {
113
114
  } = _ref5;
114
115
  const originChainInfo = chainInfoMap[originTokenInfo.originChain];
115
116
  const destinationChainInfo = chainInfoMap[destinationTokenInfo.originChain];
116
- if (!(0, _xcmParser._isPolygonBridgeXcm)(originChainInfo, destinationChainInfo)) {
117
+ const isPolygonBridgeXcm = (0, _xcmParser._isPolygonBridgeXcm)(originChainInfo, destinationChainInfo);
118
+ const isValidBridge = isPolygonBridgeXcm || (0, _xcmParser._isPosBridgeXcm)(originChainInfo, destinationChainInfo);
119
+ if (!isValidBridge) {
117
120
  throw new Error('This is not a valid PolygonBridge transfer');
118
121
  }
119
122
  if (!evmApi) {
@@ -123,11 +126,8 @@ const createPolygonBridgeExtrinsic = async _ref5 => {
123
126
  throw Error('Sender is required');
124
127
  }
125
128
  const sourceChain = originChainInfo.slug;
126
- if (sourceChain === 'polygonzkEvm_cardona' || sourceChain === 'polygonZkEvm') {
127
- return (0, _polygonBridge._createPolygonBridgeL2toL1Extrinsic)(originTokenInfo, originChainInfo, sender, recipient, sendingValue, evmApi);
128
- } else {
129
- return (0, _polygonBridge._createPolygonBridgeL1toL2Extrinsic)(originTokenInfo, originChainInfo, sender, recipient, sendingValue, evmApi);
130
- }
129
+ const createExtrinsic = isPolygonBridgeXcm ? sourceChain === 'polygonzkEvm_cardona' || sourceChain === 'polygonZkEvm' ? _polygonBridge._createPolygonBridgeL2toL1Extrinsic : _polygonBridge._createPolygonBridgeL1toL2Extrinsic : sourceChain === 'polygon_amoy' || sourceChain === 'polygon' ? _posBridge._createPosBridgeL2toL1Extrinsic : _posBridge._createPosBridgeL1toL2Extrinsic;
130
+ return createExtrinsic(originTokenInfo, originChainInfo, sender, recipient, sendingValue, evmApi);
131
131
  };
132
132
  exports.createPolygonBridgeExtrinsic = createPolygonBridgeExtrinsic;
133
133
  const getXcmMockTxFee = async (substrateApi, chainInfoMap, originTokenInfo, destinationTokenInfo) => {
@@ -61,13 +61,13 @@ async function _createPolygonBridgeL2toL1Extrinsic(tokenInfo, originChainInfo, s
61
61
  return createPolygonBridgeTransaction(tokenInfo, originChainInfo, sender, recipientAddress, value, 0, evmApi);
62
62
  }
63
63
  async function getClaimPolygonBridge(chainSlug, notification, evmApi) {
64
- var _priority$maxFeePerGa2, _priority$maxPriority2;
64
+ var _metadata$sourceNetwo, _metadata$counter, _priority$maxFeePerGa2, _priority$maxPriority2;
65
65
  const polygonBridgeContractAddress = (0, _utils.getPolygonBridgeContract)(chainSlug);
66
66
  const polygonBridgeContract = (0, _web.getWeb3Contract)(polygonBridgeContractAddress, evmApi, _utils._POLYGON_BRIDGE_ABI);
67
67
  const metadata = notification.metadata;
68
68
  const isTestnet = chainSlug === _chainList.COMMON_CHAIN_SLUGS.ETHEREUM_SEPOLIA;
69
69
  const proofDomain = isTestnet ? POLYGON_PROOF_INDEXER.TESTNET : POLYGON_PROOF_INDEXER.MAINNET;
70
- const proofResponse = await fetch(`${proofDomain}?networkId=${metadata.sourceNetwork}&depositCount=${metadata.counter}`).then(res => res.json());
70
+ const proofResponse = await fetch(`${proofDomain}?networkId=${(_metadata$sourceNetwo = metadata.sourceNetwork) !== null && _metadata$sourceNetwo !== void 0 ? _metadata$sourceNetwo : ''}&depositCount=${(_metadata$counter = metadata.counter) !== null && _metadata$counter !== void 0 ? _metadata$counter : ''}`).then(res => res.json());
71
71
  const proof = proofResponse.proof;
72
72
 
73
73
  // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment
@@ -0,0 +1,144 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.POS_EXIT_PAYLOAD_INDEXER = void 0;
7
+ exports._createPosBridgeL1toL2Extrinsic = _createPosBridgeL1toL2Extrinsic;
8
+ exports._createPosBridgeL2toL1Extrinsic = _createPosBridgeL2toL1Extrinsic;
9
+ exports._isPosChainBridge = _isPosChainBridge;
10
+ exports._isPosChainL2Bridge = _isPosChainL2Bridge;
11
+ exports.getClaimPosBridge = getClaimPosBridge;
12
+ exports.isClaimedPosBridge = isClaimedPosBridge;
13
+ var _chainList = require("@subwallet/chain-list");
14
+ var _web = require("@subwallet/extension-base/koni/api/contract-handler/evm/web3");
15
+ var _utils = require("@subwallet/extension-base/koni/api/contract-handler/utils");
16
+ var _utils2 = require("@subwallet/extension-base/services/fee-service/utils");
17
+ var _utils3 = require("@subwallet/extension-base/services/inapp-notification-service/utils");
18
+ var _types = require("@subwallet/extension-base/types");
19
+ // Copyright 2019-2022 @subwallet/extension-base
20
+ // SPDX-License-Identifier: Apache-2.0
21
+
22
+ const POS_EXIT_PAYLOAD_INDEXER = {
23
+ MAINNET: 'https://proof-generator.polygon.technology/api/v1/matic/exit-payload',
24
+ TESTNET: 'https://proof-generator.polygon.technology/api/v1/amoy/exit-payload'
25
+ };
26
+ exports.POS_EXIT_PAYLOAD_INDEXER = POS_EXIT_PAYLOAD_INDEXER;
27
+ async function _createPosBridgeL1toL2Extrinsic(tokenInfo, originChainInfo, sender, recipientAddress, value, evmApi) {
28
+ var _priority$maxFeePerGa, _priority$maxPriority;
29
+ const posBridgeContractAddress = (0, _utils.getPosL1BridgeContract)(originChainInfo.slug);
30
+ const posBridgeContract = (0, _web.getWeb3Contract)(posBridgeContractAddress, evmApi, _utils._POS_BRIDGE_ABI);
31
+
32
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment
33
+ const transferCall = posBridgeContract.methods.depositEtherFor(recipientAddress);
34
+ const transferEncodedCall = transferCall.encodeABI();
35
+ const priority = await (0, _utils2.calculateGasFeeParams)(evmApi, evmApi.chainSlug);
36
+ const transactionConfig = {
37
+ from: sender,
38
+ to: posBridgeContractAddress,
39
+ value: value,
40
+ data: transferEncodedCall,
41
+ gasPrice: priority.gasPrice,
42
+ maxFeePerGas: priority === null || priority === void 0 ? void 0 : (_priority$maxFeePerGa = priority.maxFeePerGas) === null || _priority$maxFeePerGa === void 0 ? void 0 : _priority$maxFeePerGa.toString(),
43
+ maxPriorityFeePerGas: priority === null || priority === void 0 ? void 0 : (_priority$maxPriority = priority.maxPriorityFeePerGas) === null || _priority$maxPriority === void 0 ? void 0 : _priority$maxPriority.toString()
44
+ };
45
+ const gasLimit = await evmApi.api.eth.estimateGas(transactionConfig).catch(() => 200000);
46
+ transactionConfig.gas = gasLimit.toString();
47
+ return transactionConfig;
48
+ }
49
+ async function _createPosBridgeL2toL1Extrinsic(tokenInfo, originChainInfo, sender, recipientAddress, value, evmApi) {
50
+ var _priority$maxFeePerGa2, _priority$maxPriority2;
51
+ const posBridgeContractAddress = (0, _utils.getPosL2BridgeContract)(originChainInfo.slug);
52
+ const posBridgeContract = (0, _web.getWeb3Contract)(posBridgeContractAddress, evmApi, _utils._POS_BRIDGE_L2_ABI);
53
+
54
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment
55
+ const transferCall = posBridgeContract.methods.withdraw(value);
56
+ const transferEncodedCall = transferCall.encodeABI();
57
+ const priority = await (0, _utils2.calculateGasFeeParams)(evmApi, evmApi.chainSlug);
58
+ const transactionConfig = {
59
+ from: sender,
60
+ to: posBridgeContractAddress,
61
+ value: undefined,
62
+ data: transferEncodedCall,
63
+ gasPrice: priority.gasPrice,
64
+ maxFeePerGas: priority === null || priority === void 0 ? void 0 : (_priority$maxFeePerGa2 = priority.maxFeePerGas) === null || _priority$maxFeePerGa2 === void 0 ? void 0 : _priority$maxFeePerGa2.toString(),
65
+ maxPriorityFeePerGas: priority === null || priority === void 0 ? void 0 : (_priority$maxPriority2 = priority.maxPriorityFeePerGas) === null || _priority$maxPriority2 === void 0 ? void 0 : _priority$maxPriority2.toString()
66
+ };
67
+ const gasLimit = await evmApi.api.eth.estimateGas(transactionConfig).catch(() => 200000);
68
+ transactionConfig.gas = gasLimit.toString();
69
+ return transactionConfig;
70
+ }
71
+ async function getClaimPosBridge(chainSlug, notification, evmApi) {
72
+ var _event$arguments, _event$arguments$, _event$arguments$$top, _priority$maxFeePerGa3, _priority$maxPriority3;
73
+ const posBridgeContractAddress = (0, _utils.getPosL2BridgeContract)(chainSlug);
74
+ const posBridgeContract = (0, _web.getWeb3Contract)(posBridgeContractAddress, evmApi, _utils._POS_BRIDGE_L2_ABI);
75
+ const metadata = notification.metadata;
76
+
77
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment
78
+ const event = posBridgeContract.events.Transfer(metadata.userAddress, metadata.userAddress, metadata.amounts[0]);
79
+ const isTestnet = chainSlug === _chainList.COMMON_CHAIN_SLUGS.ETHEREUM_SEPOLIA;
80
+ const domain = isTestnet ? POS_EXIT_PAYLOAD_INDEXER.TESTNET : POS_EXIT_PAYLOAD_INDEXER.MAINNET;
81
+ const eventSignature = event === null || event === void 0 ? void 0 : (_event$arguments = event.arguments) === null || _event$arguments === void 0 ? void 0 : (_event$arguments$ = _event$arguments[0]) === null || _event$arguments$ === void 0 ? void 0 : (_event$arguments$$top = _event$arguments$.topics) === null || _event$arguments$$top === void 0 ? void 0 : _event$arguments$$top[0];
82
+ let inputData;
83
+ try {
84
+ const res = await fetch(`${domain}/${metadata.transactionHash}?eventSignature=${eventSignature}`);
85
+ inputData = await res.json();
86
+ if (inputData.error && inputData.message.includes('not been checkpointed yet')) {
87
+ throw new Error(`${inputData.message}. Please try again later.`);
88
+ }
89
+ } catch (err) {
90
+ console.error('Error:', err);
91
+ throw new Error(_types.BasicTxErrorType.INTERNAL_ERROR);
92
+ }
93
+ const posClaimContractAddress = (0, _utils.getPosL1BridgeContract)(chainSlug);
94
+ const posClaimContract = (0, _web.getWeb3Contract)(posClaimContractAddress, evmApi, _utils._POS_BRIDGE_ABI);
95
+
96
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment
97
+ const transferCall = posClaimContract.methods.exit(inputData.result);
98
+ const transferEncodedCall = transferCall.encodeABI();
99
+ const priority = await (0, _utils2.calculateGasFeeParams)(evmApi, evmApi.chainSlug);
100
+ const transactionConfig = {
101
+ from: metadata.userAddress,
102
+ to: posClaimContractAddress,
103
+ value: '0',
104
+ data: transferEncodedCall,
105
+ gasPrice: priority.gasPrice,
106
+ maxFeePerGas: (_priority$maxFeePerGa3 = priority.maxFeePerGas) === null || _priority$maxFeePerGa3 === void 0 ? void 0 : _priority$maxFeePerGa3.toString(),
107
+ maxPriorityFeePerGas: (_priority$maxPriority3 = priority.maxPriorityFeePerGas) === null || _priority$maxPriority3 === void 0 ? void 0 : _priority$maxPriority3.toString()
108
+ };
109
+ const gasLimit = await evmApi.api.eth.estimateGas(transactionConfig).catch(() => 200000);
110
+ transactionConfig.gas = gasLimit.toString();
111
+ return transactionConfig;
112
+ }
113
+ async function isClaimedPosBridge(id, address, isTestnet) {
114
+ try {
115
+ const isClaimableBridge = await (0, _utils3.fetchPolygonBridgeTransactions)(address, isTestnet);
116
+ if (isClaimableBridge && isClaimableBridge.success) {
117
+ const isIdClaimable = isClaimableBridge.result.some(transaction => transaction._id === id);
118
+ return !isIdClaimable;
119
+ }
120
+ } catch (err) {
121
+ console.error('Error:', err);
122
+ }
123
+ return false;
124
+ }
125
+ function _isPosChainBridge(srcChain, destChain) {
126
+ if (srcChain === 'polygon_amoy' && destChain === _chainList.COMMON_CHAIN_SLUGS.ETHEREUM_SEPOLIA) {
127
+ return true;
128
+ } else if (srcChain === _chainList.COMMON_CHAIN_SLUGS.ETHEREUM_SEPOLIA && destChain === 'polygon_amoy') {
129
+ return true;
130
+ } else if (srcChain === 'polygon' && destChain === _chainList.COMMON_CHAIN_SLUGS.ETHEREUM) {
131
+ return true;
132
+ } else if (srcChain === _chainList.COMMON_CHAIN_SLUGS.ETHEREUM && destChain === 'polygon') {
133
+ return true;
134
+ }
135
+ return false;
136
+ }
137
+ function _isPosChainL2Bridge(srcChain, destChain) {
138
+ if (srcChain === 'polygon_amoy' && destChain === _chainList.COMMON_CHAIN_SLUGS.ETHEREUM_SEPOLIA) {
139
+ return true;
140
+ } else if (srcChain === 'polygon' && destChain === _chainList.COMMON_CHAIN_SLUGS.ETHEREUM) {
141
+ return true;
142
+ }
143
+ return false;
144
+ }
@@ -11,7 +11,7 @@ const PRODUCTION_BRANCHES = ['master', 'webapp', 'webapp-dev'];
11
11
  const branchName = process.env.BRANCH_NAME || 'subwallet-dev';
12
12
  const fetchDomain = PRODUCTION_BRANCHES.indexOf(branchName) > -1 ? 'https://chain-list-assets.subwallet.app' : 'https://dev.sw-chain-list-assets.pages.dev';
13
13
  const fetchFile = PRODUCTION_BRANCHES.indexOf(branchName) > -1 ? 'list.json' : 'preview.json';
14
- const ChainListVersion = '0.2.96'; // update this when build chainlist
14
+ const ChainListVersion = '0.2.97'; // update this when build chainlist
15
15
 
16
16
  // todo: move this interface to chainlist
17
17
 
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports._STAKING_CHAIN_GROUP = exports.TON_CHAINS = exports.ST_LIQUID_TOKEN_ABI = exports.MaxEraRewardPointsEras = exports.MANTA_VALIDATOR_POINTS_PER_BLOCK = exports.MANTA_MIN_DELEGATION = void 0;
6
+ exports._STAKING_CHAIN_GROUP = exports.TON_CHAINS = exports.ST_LIQUID_TOKEN_ABI = exports.MaxEraRewardPointsEras = exports.MANTA_VALIDATOR_POINTS_PER_BLOCK = exports.MANTA_MIN_DELEGATION = exports.CHANNEL_ID = void 0;
7
7
  // Copyright 2019-2022 @subwallet/extension-base
8
8
  // SPDX-License-Identifier: Apache-2.0
9
9
 
@@ -37,4 +37,6 @@ exports.ST_LIQUID_TOKEN_ABI = ST_LIQUID_TOKEN_ABI;
37
37
  const MANTA_VALIDATOR_POINTS_PER_BLOCK = 20;
38
38
  exports.MANTA_VALIDATOR_POINTS_PER_BLOCK = MANTA_VALIDATOR_POINTS_PER_BLOCK;
39
39
  const MANTA_MIN_DELEGATION = 500;
40
- exports.MANTA_MIN_DELEGATION = MANTA_MIN_DELEGATION;
40
+ exports.MANTA_MIN_DELEGATION = MANTA_MIN_DELEGATION;
41
+ const CHANNEL_ID = 7;
42
+ exports.CHANNEL_ID = CHANNEL_ID;
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = void 0;
8
8
  var _KoniTypes = require("@subwallet/extension-base/background/KoniTypes");
9
9
  var _utils = require("@subwallet/extension-base/services/chain-service/utils");
10
+ var _constants = require("@subwallet/extension-base/services/earning-service/constants");
10
11
  var _types = require("@subwallet/extension-base/types");
11
12
  var _bifrost = _interopRequireDefault(require("./bifrost"));
12
13
  // Copyright 2019-2022 @subwallet/extension-base
@@ -105,7 +106,7 @@ class BifrostMantaLiquidStakingPoolHandler extends _bifrost.default {
105
106
  const substrateApi = await this.substrateApi.isReady;
106
107
  const inputTokenSlug = this.inputAsset;
107
108
  const inputTokenInfo = this.state.getAssetBySlug(inputTokenSlug);
108
- const extrinsic = substrateApi.api.tx.vtokenMinting.mint((0, _utils._getTokenOnChainInfo)(inputTokenInfo), data.amount, undefined, undefined);
109
+ const extrinsic = substrateApi.api.tx.vtokenMinting.mint((0, _utils._getTokenOnChainInfo)(inputTokenInfo), data.amount, undefined, _constants.CHANNEL_ID);
109
110
  return {
110
111
  txChain: this.chain,
111
112
  extrinsicType: _KoniTypes.ExtrinsicType.MINT_VMANTA,
@@ -254,7 +254,7 @@ class BifrostLiquidStakingPoolHandler extends _base.default {
254
254
  const inputTokenInfo = this.state.getAssetBySlug(inputTokenSlug);
255
255
  const defaultFeeTokenSlug = this.feeAssets[0];
256
256
  if (new _util.BN(params.amount).gt(_util.BN_ZERO)) {
257
- const _mintFeeInfo = await poolOriginSubstrateApi.api.tx.vtokenMinting.mint((0, _utils._getTokenOnChainInfo)(inputTokenInfo), params.amount, undefined, undefined).paymentInfo(_constants2.fakeAddress);
257
+ const _mintFeeInfo = await poolOriginSubstrateApi.api.tx.vtokenMinting.mint((0, _utils._getTokenOnChainInfo)(inputTokenInfo), params.amount, undefined, _constants2.CHANNEL_ID).paymentInfo(_constants2.fakeAddress);
258
258
  const mintFeeInfo = _mintFeeInfo.toPrimitive();
259
259
  return {
260
260
  amount: mintFeeInfo.partialFee.toString(),
@@ -271,7 +271,7 @@ class BifrostLiquidStakingPoolHandler extends _base.default {
271
271
  const substrateApi = await this.substrateApi.isReady;
272
272
  const inputTokenSlug = this.inputAsset;
273
273
  const inputTokenInfo = this.state.getAssetBySlug(inputTokenSlug);
274
- const extrinsic = substrateApi.api.tx.vtokenMinting.mint((0, _utils._getTokenOnChainInfo)(inputTokenInfo), data.amount, undefined, undefined);
274
+ const extrinsic = substrateApi.api.tx.vtokenMinting.mint((0, _utils._getTokenOnChainInfo)(inputTokenInfo), data.amount, undefined, _constants2.CHANNEL_ID);
275
275
  return {
276
276
  txChain: this.chain,
277
277
  extrinsicType: _KoniTypes.ExtrinsicType.MINT_VDOT,
@@ -283,6 +283,7 @@ class InappNotificationService {
283
283
  const {
284
284
  _id,
285
285
  amounts,
286
+ bridgeType,
286
287
  counter,
287
288
  destinationNetwork,
288
289
  originTokenAddress,
@@ -299,6 +300,7 @@ class InappNotificationService {
299
300
  tokenSlug: token.slug,
300
301
  _id,
301
302
  amounts,
303
+ bridgeType,
302
304
  counter,
303
305
  destinationNetwork,
304
306
  originTokenAddress,
@@ -30,7 +30,7 @@ async function fetchPolygonBridgeTransactions(userAddress, isTestnet) {
30
30
  pageSize: pageSize.toString(),
31
31
  page: page.toString()
32
32
  });
33
- const networkIds = [0, 1];
33
+ const networkIds = [0, 1, -1];
34
34
  networkIds.forEach(networkId => {
35
35
  params.append('destinationNetworkIds', networkId.toString());
36
36
  params.append('sourceNetworkIds', networkId.toString());
@@ -100,6 +100,7 @@ class AccountLedgerHandler extends _Base.AccountBaseHandler {
100
100
  hardwareType,
101
101
  isEthereum,
102
102
  isGeneric,
103
+ isLedgerRecovery,
103
104
  name,
104
105
  originGenesisHash
105
106
  } = account;
@@ -110,7 +111,8 @@ class AccountLedgerHandler extends _Base.AccountBaseHandler {
110
111
  addressOffset,
111
112
  genesisHash,
112
113
  originGenesisHash,
113
- isGeneric
114
+ isGeneric,
115
+ isLedgerRecovery
114
116
  };
115
117
  const type = isEthereum ? 'ethereum' : 'sr25519';
116
118
  const pair = _uiKeyring.keyring.keyring.createFromAddress(address, {
@@ -40,6 +40,9 @@ function getBlockExplorerAccountRoute(explorerLink) {
40
40
  if (explorerLink.includes('tangle.statescan.io')) {
41
41
  return '#/accounts';
42
42
  }
43
+ if (explorerLink.includes('laos.statescan.io')) {
44
+ return '#/accounts';
45
+ }
43
46
  if (explorerLink.includes('explorer.zkverify.io')) {
44
47
  return 'account';
45
48
  }
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.formatNumber = exports.balanceNoPrefixFormater = exports.balanceFormatter = exports.PREDEFINED_FORMATTER = exports.BN_ZERO = exports.BN_WEI = exports.BN_TEN = exports.BN_ONE = void 0;
7
+ exports.toBNString = exports.formatNumber = exports.balanceNoPrefixFormater = exports.balanceFormatter = exports.PREDEFINED_FORMATTER = exports.BN_ZERO = exports.BN_WEI = exports.BN_TEN = exports.BN_ONE = void 0;
8
8
  var _bignumber = _interopRequireDefault(require("bignumber.js"));
9
9
  // Copyright 2019-2022 @subwallet/extension-koni authors & contributors
10
10
  // SPDX-License-Identifier: Apache-2.0
@@ -195,6 +195,11 @@ exports.balanceNoPrefixFormater = balanceNoPrefixFormater;
195
195
  const PREDEFINED_FORMATTER = {
196
196
  balance: balanceFormatter
197
197
  };
198
+ exports.PREDEFINED_FORMATTER = PREDEFINED_FORMATTER;
199
+ const toBNString = (input, decimal) => {
200
+ const raw = new _bignumber.default(input);
201
+ return raw.multipliedBy(BN_TEN.pow(decimal)).toFixed();
202
+ };
198
203
 
199
204
  /** @function formatNumber
200
205
  * Convert number to a formatted string by dividing by 10^decimal
@@ -205,7 +210,7 @@ const PREDEFINED_FORMATTER = {
205
210
  * with number < 1, show decimal with 6 (default) number
206
211
  * @param {Record<string, number>} [metadata] - Metadata for formatter
207
212
  */
208
- exports.PREDEFINED_FORMATTER = PREDEFINED_FORMATTER;
213
+ exports.toBNString = toBNString;
209
214
  const formatNumber = function (input, decimal) {
210
215
  let formatter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : balanceFormatter;
211
216
  let metadata = arguments.length > 3 ? arguments[3] : undefined;
@@ -1,3 +1,7 @@
1
1
  export declare const PREDEFINED_STAKING_POOL: Record<string, number>;
2
2
  export declare const MAX_NOMINATIONS = "16";
3
3
  export declare const PREDEFINED_EARNING_POOL_PROMISE: Promise<Record<string, number[]>>;
4
+ export declare type ChainRecommendValidator = {
5
+ maxCount: number;
6
+ preSelectValidators: string;
7
+ };
@@ -54,4 +54,5 @@ export declare function _isSnowBridgeXcm(originChainInfo: _ChainInfo, destChainI
54
54
  export declare function _isAvailBridgeXcm(originChainInfo: _ChainInfo, destChainInfo: _ChainInfo): boolean;
55
55
  export declare function _isMythosFromHydrationToMythos(originChainInfo: _ChainInfo, destChainInfo: _ChainInfo, assetSlug: string): boolean;
56
56
  export declare function _isPolygonBridgeXcm(originChainInfo: _ChainInfo, destChainInfo: _ChainInfo): boolean;
57
+ export declare function _isPosBridgeXcm(originChainInfo: _ChainInfo, destChainInfo: _ChainInfo): boolean;
57
58
  export declare function _adaptX1Interior(_assetIdentifier: Record<string, any>, version: number): Record<string, any>;
@@ -4,6 +4,7 @@
4
4
  import { COMMON_CHAIN_SLUGS } from '@subwallet/chain-list';
5
5
  import { isAvailChainBridge } from '@subwallet/extension-base/services/balance-service/transfer/xcm/availBridge';
6
6
  import { _isPolygonChainBridge } from '@subwallet/extension-base/services/balance-service/transfer/xcm/polygonBridge';
7
+ import { _isPosChainBridge } from '@subwallet/extension-base/services/balance-service/transfer/xcm/posBridge';
7
8
  import { _getChainSubstrateAddressPrefix, _getEvmChainId, _getSubstrateParaId, _getSubstrateRelayParent, _getXcmAssetMultilocation, _isChainEvmCompatible, _isPureEvmChain, _isSubstrateParaChain } from '@subwallet/extension-base/services/chain-service/utils';
8
9
  import { decodeAddress, evmToAddress } from '@polkadot/util-crypto';
9
10
  const FOUR_INSTRUCTIONS_WEIGHT = 5000000000;
@@ -49,7 +50,7 @@ export function _getXcmMultiLocation(originChainInfo, destChainInfo, version, re
49
50
  };
50
51
  }
51
52
  export function _isXcmTransferUnstable(originChainInfo, destChainInfo, assetSlug) {
52
- return !_isXcmWithinSameConsensus(originChainInfo, destChainInfo) || _isMythosFromHydrationToMythos(originChainInfo, destChainInfo, assetSlug) || _isPolygonBridgeXcm(originChainInfo, destChainInfo);
53
+ return !_isXcmWithinSameConsensus(originChainInfo, destChainInfo) || _isMythosFromHydrationToMythos(originChainInfo, destChainInfo, assetSlug) || _isPolygonBridgeXcm(originChainInfo, destChainInfo) || _isPosBridgeXcm(originChainInfo, destChainInfo);
53
54
  }
54
55
  function getAssetHubBridgeUnstableWarning(originChainInfo) {
55
56
  switch (originChainInfo.slug) {
@@ -84,8 +85,17 @@ function getPolygonBridgeWarning(originChainInfo) {
84
85
  return 'Cross-chain transfer of this token may take up to 3 hours, and you’ll need to manually claim the funds on the destination network to complete the transfer. Do you still want to continue?';
85
86
  }
86
87
  }
88
+ function getPosBridgeWarning(originChainInfo) {
89
+ if (originChainInfo.slug === COMMON_CHAIN_SLUGS.ETHEREUM || originChainInfo.slug === COMMON_CHAIN_SLUGS.ETHEREUM_SEPOLIA) {
90
+ return 'Cross-chain transfer of this token may take up to 22 minutes. Do you still want to continue?';
91
+ } else {
92
+ 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?';
93
+ }
94
+ }
87
95
  export function _getXcmUnstableWarning(originChainInfo, destChainInfo, assetSlug) {
88
- if (_isPolygonBridgeXcm(originChainInfo, destChainInfo)) {
96
+ if (_isPosBridgeXcm(originChainInfo, destChainInfo)) {
97
+ return getPosBridgeWarning(originChainInfo);
98
+ } else if (_isPolygonBridgeXcm(originChainInfo, destChainInfo)) {
89
99
  return getPolygonBridgeWarning(originChainInfo);
90
100
  } else if (_isAvailBridgeXcm(originChainInfo, destChainInfo)) {
91
101
  return getAvailBridgeWarning();
@@ -114,6 +124,9 @@ export function _isMythosFromHydrationToMythos(originChainInfo, destChainInfo, a
114
124
  export function _isPolygonBridgeXcm(originChainInfo, destChainInfo) {
115
125
  return _isPolygonChainBridge(originChainInfo.slug, destChainInfo.slug);
116
126
  }
127
+ export function _isPosBridgeXcm(originChainInfo, destChainInfo) {
128
+ return _isPosChainBridge(originChainInfo.slug, destChainInfo.slug);
129
+ }
117
130
 
118
131
  // ---------------------------------------------------------------------------------------------------------------------
119
132