@subwallet/extension-base 1.3.80-0 → 1.3.81-0
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.
- package/cjs/core/substrate/xcm-parser.js +1 -1
- package/cjs/koni/api/contract-handler/utils/index.js +0 -3
- package/cjs/koni/background/handlers/Extension.js +9 -2
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/balance-service/transfer/xcm/index.js +1 -1
- package/cjs/services/balance-service/transfer/xcm/polygonBridge.js +1 -8
- package/cjs/services/chain-service/utils/patch.js +1 -1
- package/cjs/services/fee-service/utils/index.js +2 -4
- package/cjs/services/inapp-notification-service/utils/polygon.js +4 -1
- package/cjs/services/price-service/coingecko.js +1 -1
- package/core/substrate/xcm-parser.js +1 -1
- package/koni/api/contract-handler/utils/index.js +0 -3
- package/koni/background/handlers/Extension.js +9 -2
- package/package.json +6 -6
- package/packageInfo.js +1 -1
- package/services/balance-service/transfer/xcm/index.js +1 -1
- package/services/balance-service/transfer/xcm/polygonBridge.d.ts +0 -2
- package/services/balance-service/transfer/xcm/polygonBridge.js +1 -8
- package/services/chain-service/utils/patch.d.ts +1 -1
- package/services/chain-service/utils/patch.js +1 -1
- package/services/fee-service/utils/index.js +2 -4
- package/services/inapp-notification-service/utils/polygon.js +4 -1
- package/services/price-service/coingecko.js +1 -1
|
@@ -49,7 +49,7 @@ function getAvailBridgeWarning() {
|
|
|
49
49
|
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?';
|
|
50
50
|
}
|
|
51
51
|
function getPolygonBridgeWarning(originChainInfo) {
|
|
52
|
-
if (originChainInfo.slug === _chainList.COMMON_CHAIN_SLUGS.
|
|
52
|
+
if (originChainInfo.slug === _chainList.COMMON_CHAIN_SLUGS.ETHEREUM_SEPOLIA) {
|
|
53
53
|
return 'Cross-chain transfer of this token may take up to 40 minutes. Do you still want to continue?';
|
|
54
54
|
} else {
|
|
55
55
|
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?';
|
|
@@ -79,13 +79,10 @@ function getAvailBridgeGatewayContract(chain) {
|
|
|
79
79
|
function isAvailBridgeGatewayContract(contractAddress) {
|
|
80
80
|
return [AVAILBRIDGE_GATEWAY_ETHEREUM_CONTRACT_ADDRESS, AVAILBRIDGE_GATEWAY_SEPOLIA_CONTRACT_ADDRESS].includes(contractAddress);
|
|
81
81
|
}
|
|
82
|
-
const POLYGONBRIDGE_GATEWAY_ETHEREUM_CONTRACT_ADDRESS = '0x2a3DD3EB832aF982ec71669E178424b10Dca2EDe';
|
|
83
82
|
const POLYGONBRIDGE_GATEWAY_SEPOLIA_CONTRACT_ADDRESS = '0x528e26b25a34a4A5d0dbDa1d57D318153d2ED582';
|
|
84
83
|
function getPolygonBridgeContract(chain) {
|
|
85
84
|
if (chain === 'polygonzkEvm_cardona' || chain === _chainList.COMMON_CHAIN_SLUGS.ETHEREUM_SEPOLIA) {
|
|
86
85
|
return POLYGONBRIDGE_GATEWAY_SEPOLIA_CONTRACT_ADDRESS;
|
|
87
|
-
} else if (chain === 'polygonZkEvm' || chain === _chainList.COMMON_CHAIN_SLUGS.ETHEREUM) {
|
|
88
|
-
return POLYGONBRIDGE_GATEWAY_ETHEREUM_CONTRACT_ADDRESS;
|
|
89
86
|
}
|
|
90
87
|
throw new Error('Invalid chain');
|
|
91
88
|
}
|
|
@@ -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");
|
|
@@ -5261,6 +5262,9 @@ class KoniExtension {
|
|
|
5261
5262
|
});
|
|
5262
5263
|
}
|
|
5263
5264
|
async getIsClaimedPolygonBridge(data) {
|
|
5265
|
+
if (data.chainslug !== _chainList.COMMON_CHAIN_SLUGS.ETHEREUM_SEPOLIA) {
|
|
5266
|
+
throw new Error('Polygon zkEVM Mainnet Beta has sunset. Please use Polygon official Ethereum claim flow.');
|
|
5267
|
+
}
|
|
5264
5268
|
const evmApi = this.#koniState.getEvmApi(data.chainslug);
|
|
5265
5269
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
5266
5270
|
const isClaimed = await (0, _polygonBridge.isClaimedPolygonBridge)(data.chainslug, data.counter, data.sourceNetwork, evmApi);
|
|
@@ -5274,12 +5278,15 @@ class KoniExtension {
|
|
|
5274
5278
|
} = data;
|
|
5275
5279
|
const extrinsicType = _KoniTypes.ExtrinsicType.CLAIM_BRIDGE;
|
|
5276
5280
|
let transaction = null;
|
|
5277
|
-
const evmApi = this.#koniState.getEvmApi(chain);
|
|
5278
5281
|
const metadata = notification.metadata;
|
|
5282
|
+
if (metadata.bridgeType !== 'POS' && chain !== _chainList.COMMON_CHAIN_SLUGS.ETHEREUM_SEPOLIA) {
|
|
5283
|
+
throw new Error('Polygon zkEVM Mainnet Beta has sunset. Please use Polygon official Ethereum claim flow.');
|
|
5284
|
+
}
|
|
5285
|
+
const evmApi = this.#koniState.getEvmApi(chain);
|
|
5279
5286
|
const feeInfo = await this.#koniState.feeService.subscribeChainFee((0, _getId.getId)(), chain, 'evm');
|
|
5280
5287
|
if (metadata.bridgeType === 'POS') {
|
|
5281
5288
|
transaction = await (0, _posBridge.getClaimPosBridge)(chain, notification, evmApi, feeInfo);
|
|
5282
|
-
} else {
|
|
5289
|
+
} else if (chain === _chainList.COMMON_CHAIN_SLUGS.ETHEREUM_SEPOLIA) {
|
|
5283
5290
|
transaction = await (0, _polygonBridge.getClaimPolygonBridge)(chain, notification, evmApi, feeInfo);
|
|
5284
5291
|
}
|
|
5285
5292
|
const chainType = _KoniTypes.ChainType.EVM;
|
package/cjs/packageInfo.js
CHANGED
|
@@ -100,7 +100,7 @@ const createPolygonBridgeExtrinsic = async _ref4 => {
|
|
|
100
100
|
throw Error('Sender is required');
|
|
101
101
|
}
|
|
102
102
|
const sourceChain = originChain.slug;
|
|
103
|
-
const createExtrinsic = isPolygonBridgeXcm ? sourceChain === 'polygonzkEvm_cardona'
|
|
103
|
+
const createExtrinsic = isPolygonBridgeXcm ? sourceChain === 'polygonzkEvm_cardona' ? _polygonBridge._createPolygonBridgeL2toL1Extrinsic : _polygonBridge._createPolygonBridgeL1toL2Extrinsic : sourceChain === 'polygon_amoy' || sourceChain === 'polygon' ? _posBridge._createPosBridgeL2toL1Extrinsic : _posBridge._createPosBridgeL1toL2Extrinsic;
|
|
104
104
|
return createExtrinsic(originTokenInfo, originChain, sender, recipient, sendingValue, evmApi, feeInfo, feeCustom, feeOption);
|
|
105
105
|
};
|
|
106
106
|
exports.createPolygonBridgeExtrinsic = createPolygonBridgeExtrinsic;
|
|
@@ -18,12 +18,10 @@ var _utils3 = require("@subwallet/extension-base/utils");
|
|
|
18
18
|
// SPDX-License-Identifier: Apache-2.0
|
|
19
19
|
|
|
20
20
|
const POLYGON_PROOF_INDEXER = {
|
|
21
|
-
MAINNET: 'https://api-gateway.polygon.technology/api/v3/proof/mainnet/merkle-proof',
|
|
22
21
|
TESTNET: 'https://api-gateway.polygon.technology/api/v3/proof/testnet/merkle-proof'
|
|
23
22
|
};
|
|
24
23
|
exports.POLYGON_PROOF_INDEXER = POLYGON_PROOF_INDEXER;
|
|
25
24
|
const POLYGON_GAS_INDEXER = {
|
|
26
|
-
MAINNET: 'https://gasstation.polygon.technology/zkevm',
|
|
27
25
|
TESTNET: 'https://gasstation.polygon.technology/zkevm/cardona'
|
|
28
26
|
};
|
|
29
27
|
exports.POLYGON_GAS_INDEXER = POLYGON_GAS_INDEXER;
|
|
@@ -63,8 +61,7 @@ async function getClaimPolygonBridge(chainSlug, notification, evmApi, feeInfo) {
|
|
|
63
61
|
const polygonBridgeContractAddress = (0, _utils.getPolygonBridgeContract)(chainSlug);
|
|
64
62
|
const polygonBridgeContract = (0, _web.getWeb3Contract)(polygonBridgeContractAddress, evmApi, _utils._POLYGON_BRIDGE_ABI);
|
|
65
63
|
const metadata = notification.metadata;
|
|
66
|
-
const
|
|
67
|
-
const proofDomain = isTestnet ? POLYGON_PROOF_INDEXER.TESTNET : POLYGON_PROOF_INDEXER.MAINNET;
|
|
64
|
+
const proofDomain = POLYGON_PROOF_INDEXER.TESTNET;
|
|
68
65
|
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());
|
|
69
66
|
const proof = proofResponse.proof;
|
|
70
67
|
|
|
@@ -95,10 +92,6 @@ function _isPolygonChainBridge(srcChain, destChain) {
|
|
|
95
92
|
return true;
|
|
96
93
|
} else if (srcChain === _chainList.COMMON_CHAIN_SLUGS.ETHEREUM_SEPOLIA && destChain === 'polygonzkEvm_cardona') {
|
|
97
94
|
return true;
|
|
98
|
-
} else if (srcChain === 'polygonZkEvm' && destChain === _chainList.COMMON_CHAIN_SLUGS.ETHEREUM) {
|
|
99
|
-
return true;
|
|
100
|
-
} else if (srcChain === _chainList.COMMON_CHAIN_SLUGS.ETHEREUM && destChain === 'polygonZkEvm') {
|
|
101
|
-
return true;
|
|
102
95
|
}
|
|
103
96
|
return false;
|
|
104
97
|
}
|
|
@@ -12,7 +12,7 @@ const PRODUCTION_BRANCHES = ['master', 'webapp', 'webapp-dev'];
|
|
|
12
12
|
const branchName = process.env.BRANCH_NAME || 'subwallet-dev';
|
|
13
13
|
const fetchDomain = process.env.PATCH_CHAIN_LIST_URL || (PRODUCTION_BRANCHES.indexOf(branchName) > -1 ? 'https://chain-list-assets.subwallet.app' : 'https://dev.sw-chain-list-assets.pages.dev');
|
|
14
14
|
const fetchFile = PRODUCTION_BRANCHES.indexOf(branchName) > -1 ? 'list.json' : 'preview.json';
|
|
15
|
-
const ChainListVersion = '0.2.
|
|
15
|
+
const ChainListVersion = '0.2.128'; // update this when build chain-list
|
|
16
16
|
|
|
17
17
|
// todo: move this interface to chainlist
|
|
18
18
|
exports.ChainListVersion = ChainListVersion;
|
|
@@ -139,10 +139,8 @@ const calculateGasFeeParams = async function (web3, networkKey) {
|
|
|
139
139
|
} catch (e) {}
|
|
140
140
|
}
|
|
141
141
|
try {
|
|
142
|
-
if (networkKey === 'polygonzkEvm_cardona'
|
|
143
|
-
const
|
|
144
|
-
const gasDomain = isTestnet ? _polygonBridge.POLYGON_GAS_INDEXER.TESTNET : _polygonBridge.POLYGON_GAS_INDEXER.MAINNET;
|
|
145
|
-
const gasResponse = await fetch(`${gasDomain}`).then(res => res.json());
|
|
142
|
+
if (networkKey === 'polygonzkEvm_cardona') {
|
|
143
|
+
const gasResponse = await fetch(`${_polygonBridge.POLYGON_GAS_INDEXER.TESTNET}`).then(res => res.json());
|
|
146
144
|
const gasPriceInWei = gasResponse.standard * 1e9 + 200000;
|
|
147
145
|
return {
|
|
148
146
|
type: 'evm',
|
|
@@ -22,6 +22,9 @@ function getPolygonBridgeClaimDescription(amount, symbol) {
|
|
|
22
22
|
}
|
|
23
23
|
/* Description */
|
|
24
24
|
|
|
25
|
+
function getPolygonBridgeNetworkIds(isTestnet) {
|
|
26
|
+
return isTestnet ? [0, 1, -1] : [0, -1];
|
|
27
|
+
}
|
|
25
28
|
async function fetchPolygonBridgeTransactions(userAddress, isTestnet) {
|
|
26
29
|
let pageSize = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 500;
|
|
27
30
|
let page = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
@@ -30,7 +33,7 @@ async function fetchPolygonBridgeTransactions(userAddress, isTestnet) {
|
|
|
30
33
|
pageSize: pageSize.toString(),
|
|
31
34
|
page: page.toString()
|
|
32
35
|
});
|
|
33
|
-
const networkIds =
|
|
36
|
+
const networkIds = getPolygonBridgeNetworkIds(isTestnet);
|
|
34
37
|
networkIds.forEach(networkId => {
|
|
35
38
|
params.append('destinationNetworkIds', networkId.toString());
|
|
36
39
|
params.append('sourceNetworkIds', networkId.toString());
|
|
@@ -100,7 +100,7 @@ const getPriceMap = async function (priceIds) {
|
|
|
100
100
|
var _response4;
|
|
101
101
|
useBackupApi = true;
|
|
102
102
|
try {
|
|
103
|
-
response = await fetch(
|
|
103
|
+
response = await fetch(`${apiCacheDomain}/api/price/get?ids=${idStr}`);
|
|
104
104
|
} catch (e) {}
|
|
105
105
|
if (((_response4 = response) === null || _response4 === void 0 ? void 0 : _response4.status) !== 200) {
|
|
106
106
|
try {
|
|
@@ -31,7 +31,7 @@ function getAvailBridgeWarning() {
|
|
|
31
31
|
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?';
|
|
32
32
|
}
|
|
33
33
|
function getPolygonBridgeWarning(originChainInfo) {
|
|
34
|
-
if (originChainInfo.slug === COMMON_CHAIN_SLUGS.
|
|
34
|
+
if (originChainInfo.slug === COMMON_CHAIN_SLUGS.ETHEREUM_SEPOLIA) {
|
|
35
35
|
return 'Cross-chain transfer of this token may take up to 40 minutes. Do you still want to continue?';
|
|
36
36
|
} else {
|
|
37
37
|
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?';
|
|
@@ -52,13 +52,10 @@ export function getAvailBridgeGatewayContract(chain) {
|
|
|
52
52
|
export function isAvailBridgeGatewayContract(contractAddress) {
|
|
53
53
|
return [AVAILBRIDGE_GATEWAY_ETHEREUM_CONTRACT_ADDRESS, AVAILBRIDGE_GATEWAY_SEPOLIA_CONTRACT_ADDRESS].includes(contractAddress);
|
|
54
54
|
}
|
|
55
|
-
const POLYGONBRIDGE_GATEWAY_ETHEREUM_CONTRACT_ADDRESS = '0x2a3DD3EB832aF982ec71669E178424b10Dca2EDe';
|
|
56
55
|
const POLYGONBRIDGE_GATEWAY_SEPOLIA_CONTRACT_ADDRESS = '0x528e26b25a34a4A5d0dbDa1d57D318153d2ED582';
|
|
57
56
|
export function getPolygonBridgeContract(chain) {
|
|
58
57
|
if (chain === 'polygonzkEvm_cardona' || chain === COMMON_CHAIN_SLUGS.ETHEREUM_SEPOLIA) {
|
|
59
58
|
return POLYGONBRIDGE_GATEWAY_SEPOLIA_CONTRACT_ADDRESS;
|
|
60
|
-
} else if (chain === 'polygonZkEvm' || chain === COMMON_CHAIN_SLUGS.ETHEREUM) {
|
|
61
|
-
return POLYGONBRIDGE_GATEWAY_ETHEREUM_CONTRACT_ADDRESS;
|
|
62
59
|
}
|
|
63
60
|
throw new Error('Invalid chain');
|
|
64
61
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import { Common } from '@ethereumjs/common';
|
|
5
5
|
import { LegacyTransaction } from '@ethereumjs/tx';
|
|
6
|
+
import { COMMON_CHAIN_SLUGS } from '@subwallet/chain-list';
|
|
6
7
|
import { _AssetType } from '@subwallet/chain-list/types';
|
|
7
8
|
import { TransactionError } from '@subwallet/extension-base/background/errors/TransactionError';
|
|
8
9
|
import { withErrorLog } from '@subwallet/extension-base/background/handlers/helpers';
|
|
@@ -5162,6 +5163,9 @@ export default class KoniExtension {
|
|
|
5162
5163
|
});
|
|
5163
5164
|
}
|
|
5164
5165
|
async getIsClaimedPolygonBridge(data) {
|
|
5166
|
+
if (data.chainslug !== COMMON_CHAIN_SLUGS.ETHEREUM_SEPOLIA) {
|
|
5167
|
+
throw new Error('Polygon zkEVM Mainnet Beta has sunset. Please use Polygon official Ethereum claim flow.');
|
|
5168
|
+
}
|
|
5165
5169
|
const evmApi = this.#koniState.getEvmApi(data.chainslug);
|
|
5166
5170
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
5167
5171
|
const isClaimed = await isClaimedPolygonBridge(data.chainslug, data.counter, data.sourceNetwork, evmApi);
|
|
@@ -5175,12 +5179,15 @@ export default class KoniExtension {
|
|
|
5175
5179
|
} = data;
|
|
5176
5180
|
const extrinsicType = ExtrinsicType.CLAIM_BRIDGE;
|
|
5177
5181
|
let transaction = null;
|
|
5178
|
-
const evmApi = this.#koniState.getEvmApi(chain);
|
|
5179
5182
|
const metadata = notification.metadata;
|
|
5183
|
+
if (metadata.bridgeType !== 'POS' && chain !== COMMON_CHAIN_SLUGS.ETHEREUM_SEPOLIA) {
|
|
5184
|
+
throw new Error('Polygon zkEVM Mainnet Beta has sunset. Please use Polygon official Ethereum claim flow.');
|
|
5185
|
+
}
|
|
5186
|
+
const evmApi = this.#koniState.getEvmApi(chain);
|
|
5180
5187
|
const feeInfo = await this.#koniState.feeService.subscribeChainFee(getId(), chain, 'evm');
|
|
5181
5188
|
if (metadata.bridgeType === 'POS') {
|
|
5182
5189
|
transaction = await getClaimPosBridge(chain, notification, evmApi, feeInfo);
|
|
5183
|
-
} else {
|
|
5190
|
+
} else if (chain === COMMON_CHAIN_SLUGS.ETHEREUM_SEPOLIA) {
|
|
5184
5191
|
transaction = await getClaimPolygonBridge(chain, notification, evmApi, feeInfo);
|
|
5185
5192
|
}
|
|
5186
5193
|
const chainType = ChainType.EVM;
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"./cjs/detectPackage.js"
|
|
18
18
|
],
|
|
19
19
|
"type": "module",
|
|
20
|
-
"version": "1.3.
|
|
20
|
+
"version": "1.3.81-0",
|
|
21
21
|
"main": "./cjs/index.js",
|
|
22
22
|
"module": "./index.js",
|
|
23
23
|
"types": "./index.d.ts",
|
|
@@ -3048,11 +3048,11 @@
|
|
|
3048
3048
|
"@sora-substrate/type-definitions": "^1.17.7",
|
|
3049
3049
|
"@substrate/connect": "^0.8.9",
|
|
3050
3050
|
"@subwallet-monorepos/subwallet-services-sdk": "0.1.17-beta.2",
|
|
3051
|
-
"@subwallet/chain-list": "0.2.
|
|
3052
|
-
"@subwallet/extension-base": "^1.3.
|
|
3053
|
-
"@subwallet/extension-chains": "^1.3.
|
|
3054
|
-
"@subwallet/extension-dapp": "^1.3.
|
|
3055
|
-
"@subwallet/extension-inject": "^1.3.
|
|
3051
|
+
"@subwallet/chain-list": "0.2.128",
|
|
3052
|
+
"@subwallet/extension-base": "^1.3.81-0",
|
|
3053
|
+
"@subwallet/extension-chains": "^1.3.81-0",
|
|
3054
|
+
"@subwallet/extension-dapp": "^1.3.81-0",
|
|
3055
|
+
"@subwallet/extension-inject": "^1.3.81-0",
|
|
3056
3056
|
"@subwallet/keyring": "^0.1.14",
|
|
3057
3057
|
"@subwallet/ui-keyring": "^0.1.14",
|
|
3058
3058
|
"@ton/core": "^0.56.3",
|
package/packageInfo.js
CHANGED
|
@@ -7,5 +7,5 @@ export const packageInfo = {
|
|
|
7
7
|
name: '@subwallet/extension-base',
|
|
8
8
|
path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto',
|
|
9
9
|
type: 'esm',
|
|
10
|
-
version: '1.3.
|
|
10
|
+
version: '1.3.81-0'
|
|
11
11
|
};
|
|
@@ -86,7 +86,7 @@ export const createPolygonBridgeExtrinsic = async ({
|
|
|
86
86
|
throw Error('Sender is required');
|
|
87
87
|
}
|
|
88
88
|
const sourceChain = originChain.slug;
|
|
89
|
-
const createExtrinsic = isPolygonBridgeXcm ? sourceChain === 'polygonzkEvm_cardona'
|
|
89
|
+
const createExtrinsic = isPolygonBridgeXcm ? sourceChain === 'polygonzkEvm_cardona' ? _createPolygonBridgeL2toL1Extrinsic : _createPolygonBridgeL1toL2Extrinsic : sourceChain === 'polygon_amoy' || sourceChain === 'polygon' ? _createPosBridgeL2toL1Extrinsic : _createPosBridgeL1toL2Extrinsic;
|
|
90
90
|
return createExtrinsic(originTokenInfo, originChain, sender, recipient, sendingValue, evmApi, feeInfo, feeCustom, feeOption);
|
|
91
91
|
};
|
|
92
92
|
export const createXcmExtrinsicV2 = async request => {
|
|
@@ -9,11 +9,9 @@ export interface gasStation {
|
|
|
9
9
|
fastLow: number;
|
|
10
10
|
}
|
|
11
11
|
export declare const POLYGON_PROOF_INDEXER: {
|
|
12
|
-
MAINNET: string;
|
|
13
12
|
TESTNET: string;
|
|
14
13
|
};
|
|
15
14
|
export declare const POLYGON_GAS_INDEXER: {
|
|
16
|
-
MAINNET: string;
|
|
17
15
|
TESTNET: string;
|
|
18
16
|
};
|
|
19
17
|
export declare function _createPolygonBridgeL1toL2Extrinsic(tokenInfo: _ChainAsset, originChainInfo: _ChainInfo, sender: string, recipientAddress: string, value: string, evmApi: _EvmApi, feeInfo: FeeInfo, feeCustom?: FeeCustom, feeOption?: FeeOption): Promise<TransactionConfig>;
|
|
@@ -7,11 +7,9 @@ import { _POLYGON_BRIDGE_ABI, getPolygonBridgeContract } from '@subwallet/extens
|
|
|
7
7
|
import { _getContractAddressOfToken } from '@subwallet/extension-base/services/chain-service/utils';
|
|
8
8
|
import { combineEthFee } from '@subwallet/extension-base/utils';
|
|
9
9
|
export const POLYGON_PROOF_INDEXER = {
|
|
10
|
-
MAINNET: 'https://api-gateway.polygon.technology/api/v3/proof/mainnet/merkle-proof',
|
|
11
10
|
TESTNET: 'https://api-gateway.polygon.technology/api/v3/proof/testnet/merkle-proof'
|
|
12
11
|
};
|
|
13
12
|
export const POLYGON_GAS_INDEXER = {
|
|
14
|
-
MAINNET: 'https://gasstation.polygon.technology/zkevm',
|
|
15
13
|
TESTNET: 'https://gasstation.polygon.technology/zkevm/cardona'
|
|
16
14
|
};
|
|
17
15
|
async function createPolygonBridgeTransaction(tokenInfo, originChainInfo, sender, recipientAddress, value, destinationNetwork, evmApi, _feeInfo, feeCustom, feeOption) {
|
|
@@ -50,8 +48,7 @@ export async function getClaimPolygonBridge(chainSlug, notification, evmApi, fee
|
|
|
50
48
|
const polygonBridgeContractAddress = getPolygonBridgeContract(chainSlug);
|
|
51
49
|
const polygonBridgeContract = getWeb3Contract(polygonBridgeContractAddress, evmApi, _POLYGON_BRIDGE_ABI);
|
|
52
50
|
const metadata = notification.metadata;
|
|
53
|
-
const
|
|
54
|
-
const proofDomain = isTestnet ? POLYGON_PROOF_INDEXER.TESTNET : POLYGON_PROOF_INDEXER.MAINNET;
|
|
51
|
+
const proofDomain = POLYGON_PROOF_INDEXER.TESTNET;
|
|
55
52
|
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());
|
|
56
53
|
const proof = proofResponse.proof;
|
|
57
54
|
|
|
@@ -82,10 +79,6 @@ export function _isPolygonChainBridge(srcChain, destChain) {
|
|
|
82
79
|
return true;
|
|
83
80
|
} else if (srcChain === COMMON_CHAIN_SLUGS.ETHEREUM_SEPOLIA && destChain === 'polygonzkEvm_cardona') {
|
|
84
81
|
return true;
|
|
85
|
-
} else if (srcChain === 'polygonZkEvm' && destChain === COMMON_CHAIN_SLUGS.ETHEREUM) {
|
|
86
|
-
return true;
|
|
87
|
-
} else if (srcChain === COMMON_CHAIN_SLUGS.ETHEREUM && destChain === 'polygonZkEvm') {
|
|
88
|
-
return true;
|
|
89
82
|
}
|
|
90
83
|
return false;
|
|
91
84
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { _ChainAsset, _ChainInfo, _MultiChainAsset } from '@subwallet/chain-list/types';
|
|
2
|
-
export declare const ChainListVersion = "0.2.
|
|
2
|
+
export declare const ChainListVersion = "0.2.128";
|
|
3
3
|
export interface PatchInfo {
|
|
4
4
|
patchVersion: string;
|
|
5
5
|
appliedVersion: string;
|
|
@@ -5,7 +5,7 @@ const PRODUCTION_BRANCHES = ['master', 'webapp', 'webapp-dev'];
|
|
|
5
5
|
const branchName = process.env.BRANCH_NAME || 'subwallet-dev';
|
|
6
6
|
const fetchDomain = process.env.PATCH_CHAIN_LIST_URL || (PRODUCTION_BRANCHES.indexOf(branchName) > -1 ? 'https://chain-list-assets.subwallet.app' : 'https://dev.sw-chain-list-assets.pages.dev');
|
|
7
7
|
const fetchFile = PRODUCTION_BRANCHES.indexOf(branchName) > -1 ? 'list.json' : 'preview.json';
|
|
8
|
-
export const ChainListVersion = '0.2.
|
|
8
|
+
export const ChainListVersion = '0.2.128'; // update this when build chain-list
|
|
9
9
|
|
|
10
10
|
// todo: move this interface to chainlist
|
|
11
11
|
|
|
@@ -122,10 +122,8 @@ export const calculateGasFeeParams = async (web3, networkKey, useOnline = true,
|
|
|
122
122
|
} catch (e) {}
|
|
123
123
|
}
|
|
124
124
|
try {
|
|
125
|
-
if (networkKey === 'polygonzkEvm_cardona'
|
|
126
|
-
const
|
|
127
|
-
const gasDomain = isTestnet ? POLYGON_GAS_INDEXER.TESTNET : POLYGON_GAS_INDEXER.MAINNET;
|
|
128
|
-
const gasResponse = await fetch(`${gasDomain}`).then(res => res.json());
|
|
125
|
+
if (networkKey === 'polygonzkEvm_cardona') {
|
|
126
|
+
const gasResponse = await fetch(`${POLYGON_GAS_INDEXER.TESTNET}`).then(res => res.json());
|
|
129
127
|
const gasPriceInWei = gasResponse.standard * 1e9 + 200000;
|
|
130
128
|
return {
|
|
131
129
|
type: 'evm',
|
|
@@ -12,13 +12,16 @@ export function getPolygonBridgeClaimDescription(amount, symbol) {
|
|
|
12
12
|
}
|
|
13
13
|
/* Description */
|
|
14
14
|
|
|
15
|
+
function getPolygonBridgeNetworkIds(isTestnet) {
|
|
16
|
+
return isTestnet ? [0, 1, -1] : [0, -1];
|
|
17
|
+
}
|
|
15
18
|
export async function fetchPolygonBridgeTransactions(userAddress, isTestnet, pageSize = 500, page = 0) {
|
|
16
19
|
const params = new URLSearchParams({
|
|
17
20
|
userAddress,
|
|
18
21
|
pageSize: pageSize.toString(),
|
|
19
22
|
page: page.toString()
|
|
20
23
|
});
|
|
21
|
-
const networkIds =
|
|
24
|
+
const networkIds = getPolygonBridgeNetworkIds(isTestnet);
|
|
22
25
|
networkIds.forEach(networkId => {
|
|
23
26
|
params.append('destinationNetworkIds', networkId.toString());
|
|
24
27
|
params.append('sourceNetworkIds', networkId.toString());
|
|
@@ -90,7 +90,7 @@ export const getPriceMap = async (priceIds, currency = 'USD', skipDerivativePric
|
|
|
90
90
|
var _response4;
|
|
91
91
|
useBackupApi = true;
|
|
92
92
|
try {
|
|
93
|
-
response = await fetch(
|
|
93
|
+
response = await fetch(`${apiCacheDomain}/api/price/get?ids=${idStr}`);
|
|
94
94
|
} catch (e) {}
|
|
95
95
|
if (((_response4 = response) === null || _response4 === void 0 ? void 0 : _response4.status) !== 200) {
|
|
96
96
|
try {
|