@subwallet/extension-base 1.3.65-0 → 1.3.67-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 +0 -176
- package/cjs/koni/background/handlers/Extension.js +1 -1
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/balance-service/transfer/smart-contract.js +54 -23
- package/cjs/services/balance-service/transfer/xcm/index.js +30 -44
- package/cjs/services/balance-service/transfer/xcm/utils.js +53 -18
- package/cjs/services/chain-service/utils/patch.js +1 -1
- package/cjs/services/migration-service/scripts/MigrateTransactionHistoryBySymbol20251107.js +51 -0
- package/cjs/services/migration-service/scripts/databases/MigrateAssetSetting20251107.js +37 -0
- package/cjs/services/migration-service/scripts/index.js +13 -9
- package/cjs/services/request-service/handler/EvmRequestHandler.js +1 -1
- package/cjs/services/swap-service/handler/base-handler.js +18 -21
- package/cjs/services/transaction-service/index.js +1 -1
- package/cjs/utils/eth.js +2 -1
- package/cjs/utils/fee/transfer.js +5 -2
- package/core/substrate/xcm-parser.d.ts +1 -49
- package/core/substrate/xcm-parser.js +1 -173
- package/koni/background/handlers/Extension.js +1 -1
- package/package.json +17 -22
- package/packageInfo.js +1 -1
- package/services/balance-service/transfer/smart-contract.d.ts +4 -0
- package/services/balance-service/transfer/smart-contract.js +52 -23
- package/services/balance-service/transfer/xcm/index.d.ts +2 -2
- package/services/balance-service/transfer/xcm/index.js +18 -32
- package/services/balance-service/transfer/xcm/utils.d.ts +1 -2
- package/services/balance-service/transfer/xcm/utils.js +51 -15
- package/services/chain-service/utils/patch.d.ts +1 -1
- package/services/chain-service/utils/patch.js +1 -1
- package/services/migration-service/scripts/MigrateTransactionHistoryBySymbol20251107.d.ts +4 -0
- package/services/migration-service/scripts/MigrateTransactionHistoryBySymbol20251107.js +42 -0
- package/services/migration-service/scripts/databases/MigrateAssetSetting20251107.d.ts +4 -0
- package/services/migration-service/scripts/databases/MigrateAssetSetting20251107.js +29 -0
- package/services/migration-service/scripts/index.js +5 -1
- package/services/request-service/handler/EvmRequestHandler.js +1 -1
- package/services/swap-service/handler/base-handler.d.ts +0 -1
- package/services/swap-service/handler/base-handler.js +19 -22
- package/services/transaction-service/index.js +1 -1
- package/types/transaction/data.d.ts +1 -1
- package/utils/eth.js +2 -1
- package/utils/fee/transfer.js +6 -3
- package/cjs/services/balance-service/transfer/xcm/polkadotXcm.js +0 -30
- package/cjs/services/balance-service/transfer/xcm/xTokens.js +0 -32
- package/cjs/services/balance-service/transfer/xcm/xcmPallet.js +0 -23
- package/services/balance-service/transfer/xcm/polkadotXcm.d.ts +0 -3
- package/services/balance-service/transfer/xcm/polkadotXcm.js +0 -24
- package/services/balance-service/transfer/xcm/xTokens.d.ts +0 -3
- package/services/balance-service/transfer/xcm/xTokens.js +0 -26
- package/services/balance-service/transfer/xcm/xcmPallet.d.ts +0 -3
- package/services/balance-service/transfer/xcm/xcmPallet.js +0 -17
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getExtrinsicByXtokensPallet = getExtrinsicByXtokensPallet;
|
|
7
|
-
var _xcmParser = require("@subwallet/extension-base/core/substrate/xcm-parser");
|
|
8
|
-
var _utils = require("@subwallet/extension-base/services/balance-service/transfer/xcm/utils");
|
|
9
|
-
var _utils2 = require("@subwallet/extension-base/services/chain-service/utils");
|
|
10
|
-
// Copyright 2019-2022 @subwallet/extension-base
|
|
11
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
12
|
-
|
|
13
|
-
function getCurrencyId(tokenInfo) {
|
|
14
|
-
if (['moonbeam', 'moonbase', 'moonriver'].includes(tokenInfo.originChain)) {
|
|
15
|
-
const tokenType = (0, _utils2._getXcmAssetType)(tokenInfo);
|
|
16
|
-
const assetId = (0, _utils2._getXcmAssetId)(tokenInfo);
|
|
17
|
-
return {
|
|
18
|
-
[tokenType]: assetId
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
return (0, _utils2._getTokenOnChainInfo)(tokenInfo) || (0, _utils2._getTokenOnChainAssetId)(tokenInfo);
|
|
22
|
-
}
|
|
23
|
-
function getExtrinsicByXtokensPallet(tokenInfo, originChainInfo, destinationChainInfo, recipientAddress, value, api) {
|
|
24
|
-
const version = _utils.STABLE_XCM_VERSION;
|
|
25
|
-
const destination = (0, _xcmParser._getXcmMultiLocation)(originChainInfo, destinationChainInfo, version, recipientAddress);
|
|
26
|
-
if (!(0, _utils2._getXcmAssetMultilocation)(tokenInfo)) {
|
|
27
|
-
const tokenCurrencyId = getCurrencyId(tokenInfo);
|
|
28
|
-
return api.tx.xTokens.transfer(tokenCurrencyId, value, destination, (0, _xcmParser._getXcmDestWeight)(originChainInfo));
|
|
29
|
-
}
|
|
30
|
-
const tokenMultiAsset = (0, _xcmParser._getXcmMultiAssets)(tokenInfo, value, version);
|
|
31
|
-
return api.tx.xTokens.transferMultiassets(tokenMultiAsset, 0, destination, (0, _xcmParser._getXcmDestWeight)(originChainInfo));
|
|
32
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getExtrinsicByXcmPalletPallet = getExtrinsicByXcmPalletPallet;
|
|
7
|
-
var _xcmParser = require("@subwallet/extension-base/core/substrate/xcm-parser");
|
|
8
|
-
var _utils = require("@subwallet/extension-base/services/balance-service/transfer/xcm/utils");
|
|
9
|
-
// Copyright 2019-2022 @subwallet/extension-base
|
|
10
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
11
|
-
|
|
12
|
-
// this pallet is only used by Relaychains
|
|
13
|
-
function getExtrinsicByXcmPalletPallet(tokenInfo, originChainInfo, destinationChainInfo, recipientAddress, value, api) {
|
|
14
|
-
const weightParam = (0, _xcmParser._getXcmDestWeight)(originChainInfo);
|
|
15
|
-
const destination = (0, _xcmParser._getXcmMultiLocation)(originChainInfo, destinationChainInfo, _utils.STABLE_XCM_VERSION);
|
|
16
|
-
const beneficiary = (0, _xcmParser._getXcmBeneficiary)(destinationChainInfo, recipientAddress, _utils.STABLE_XCM_VERSION);
|
|
17
|
-
const tokenLocation = (0, _xcmParser._getXcmMultiAssets)(tokenInfo, value, _utils.STABLE_XCM_VERSION);
|
|
18
|
-
let method = 'limitedReserveTransferAssets';
|
|
19
|
-
if ((0, _utils.isUseTeleportProtocol)(originChainInfo, destinationChainInfo)) {
|
|
20
|
-
method = 'limitedTeleportAssets';
|
|
21
|
-
}
|
|
22
|
-
return api.tx.xcmPallet[method](destination, beneficiary, tokenLocation, 0, weightParam);
|
|
23
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { _ChainAsset, _ChainInfo } from '@subwallet/chain-list/types';
|
|
2
|
-
import { ApiPromise } from '@polkadot/api';
|
|
3
|
-
export declare function getExtrinsicByPolkadotXcmPallet(tokenInfo: _ChainAsset, originChainInfo: _ChainInfo, destinationChainInfo: _ChainInfo, recipientAddress: string, value: string, api: ApiPromise): import("@polkadot/api-base/types").SubmittableExtrinsic<"promise", import("@polkadot/types/types").ISubmittableResult>;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// Copyright 2019-2022 @subwallet/extension-base
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import { _getXcmBeneficiary, _getXcmDestWeight, _getXcmMultiAssets, _getXcmMultiLocation, _isXcmWithinSameConsensus } from '@subwallet/extension-base/core/substrate/xcm-parser';
|
|
5
|
-
import { isUseTeleportProtocol, STABLE_XCM_VERSION } from '@subwallet/extension-base/services/balance-service/transfer/xcm/utils';
|
|
6
|
-
import { _isBridgedToken } from '@subwallet/extension-base/services/chain-service/utils';
|
|
7
|
-
export function getExtrinsicByPolkadotXcmPallet(tokenInfo, originChainInfo, destinationChainInfo, recipientAddress, value, api) {
|
|
8
|
-
let version = STABLE_XCM_VERSION;
|
|
9
|
-
let method = 'limitedReserveTransferAssets';
|
|
10
|
-
if (_isBridgedToken(tokenInfo) && !_isXcmWithinSameConsensus(originChainInfo, destinationChainInfo)) {
|
|
11
|
-
version = 4;
|
|
12
|
-
method = 'transferAssets';
|
|
13
|
-
}
|
|
14
|
-
if (isUseTeleportProtocol(originChainInfo, destinationChainInfo, tokenInfo.slug)) {
|
|
15
|
-
method = 'limitedTeleportAssets';
|
|
16
|
-
}
|
|
17
|
-
const weightParam = _getXcmDestWeight(originChainInfo);
|
|
18
|
-
const destination = _getXcmMultiLocation(originChainInfo, destinationChainInfo, version);
|
|
19
|
-
const beneficiary = _getXcmBeneficiary(destinationChainInfo, recipientAddress, version);
|
|
20
|
-
const tokenLocation = _getXcmMultiAssets(tokenInfo, value, version);
|
|
21
|
-
return api.tx.polkadotXcm[method](destination, beneficiary, tokenLocation, 0,
|
|
22
|
-
// FeeAssetItem
|
|
23
|
-
weightParam);
|
|
24
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { _ChainAsset, _ChainInfo } from '@subwallet/chain-list/types';
|
|
2
|
-
import { ApiPromise } from '@polkadot/api';
|
|
3
|
-
export declare function getExtrinsicByXtokensPallet(tokenInfo: _ChainAsset, originChainInfo: _ChainInfo, destinationChainInfo: _ChainInfo, recipientAddress: string, value: string, api: ApiPromise): import("@polkadot/api-base/types").SubmittableExtrinsic<"promise", import("@polkadot/types/types").ISubmittableResult>;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// Copyright 2019-2022 @subwallet/extension-base
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import { _getXcmDestWeight, _getXcmMultiAssets, _getXcmMultiLocation } from '@subwallet/extension-base/core/substrate/xcm-parser';
|
|
5
|
-
import { STABLE_XCM_VERSION } from '@subwallet/extension-base/services/balance-service/transfer/xcm/utils';
|
|
6
|
-
import { _getTokenOnChainAssetId, _getTokenOnChainInfo, _getXcmAssetId, _getXcmAssetMultilocation, _getXcmAssetType } from '@subwallet/extension-base/services/chain-service/utils';
|
|
7
|
-
function getCurrencyId(tokenInfo) {
|
|
8
|
-
if (['moonbeam', 'moonbase', 'moonriver'].includes(tokenInfo.originChain)) {
|
|
9
|
-
const tokenType = _getXcmAssetType(tokenInfo);
|
|
10
|
-
const assetId = _getXcmAssetId(tokenInfo);
|
|
11
|
-
return {
|
|
12
|
-
[tokenType]: assetId
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
return _getTokenOnChainInfo(tokenInfo) || _getTokenOnChainAssetId(tokenInfo);
|
|
16
|
-
}
|
|
17
|
-
export function getExtrinsicByXtokensPallet(tokenInfo, originChainInfo, destinationChainInfo, recipientAddress, value, api) {
|
|
18
|
-
const version = STABLE_XCM_VERSION;
|
|
19
|
-
const destination = _getXcmMultiLocation(originChainInfo, destinationChainInfo, version, recipientAddress);
|
|
20
|
-
if (!_getXcmAssetMultilocation(tokenInfo)) {
|
|
21
|
-
const tokenCurrencyId = getCurrencyId(tokenInfo);
|
|
22
|
-
return api.tx.xTokens.transfer(tokenCurrencyId, value, destination, _getXcmDestWeight(originChainInfo));
|
|
23
|
-
}
|
|
24
|
-
const tokenMultiAsset = _getXcmMultiAssets(tokenInfo, value, version);
|
|
25
|
-
return api.tx.xTokens.transferMultiassets(tokenMultiAsset, 0, destination, _getXcmDestWeight(originChainInfo));
|
|
26
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { _ChainAsset, _ChainInfo } from '@subwallet/chain-list/types';
|
|
2
|
-
import { ApiPromise } from '@polkadot/api';
|
|
3
|
-
export declare function getExtrinsicByXcmPalletPallet(tokenInfo: _ChainAsset, originChainInfo: _ChainInfo, destinationChainInfo: _ChainInfo, recipientAddress: string, value: string, api: ApiPromise): import("@polkadot/api-base/types").SubmittableExtrinsic<"promise", import("@polkadot/types/types").ISubmittableResult>;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// Copyright 2019-2022 @subwallet/extension-base
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import { _getXcmBeneficiary, _getXcmDestWeight, _getXcmMultiAssets, _getXcmMultiLocation } from '@subwallet/extension-base/core/substrate/xcm-parser';
|
|
5
|
-
import { isUseTeleportProtocol, STABLE_XCM_VERSION } from '@subwallet/extension-base/services/balance-service/transfer/xcm/utils';
|
|
6
|
-
// this pallet is only used by Relaychains
|
|
7
|
-
export function getExtrinsicByXcmPalletPallet(tokenInfo, originChainInfo, destinationChainInfo, recipientAddress, value, api) {
|
|
8
|
-
const weightParam = _getXcmDestWeight(originChainInfo);
|
|
9
|
-
const destination = _getXcmMultiLocation(originChainInfo, destinationChainInfo, STABLE_XCM_VERSION);
|
|
10
|
-
const beneficiary = _getXcmBeneficiary(destinationChainInfo, recipientAddress, STABLE_XCM_VERSION);
|
|
11
|
-
const tokenLocation = _getXcmMultiAssets(tokenInfo, value, STABLE_XCM_VERSION);
|
|
12
|
-
let method = 'limitedReserveTransferAssets';
|
|
13
|
-
if (isUseTeleportProtocol(originChainInfo, destinationChainInfo)) {
|
|
14
|
-
method = 'limitedTeleportAssets';
|
|
15
|
-
}
|
|
16
|
-
return api.tx.xcmPallet[method](destination, beneficiary, tokenLocation, 0, weightParam);
|
|
17
|
-
}
|