@subwallet/extension-base 1.0.1 → 1.0.2-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.
- package/background/KoniTypes.d.ts +10 -3
- package/background/KoniTypes.js +6 -0
- package/cjs/background/KoniTypes.js +8 -1
- package/cjs/constants/index.js +6 -3
- package/cjs/koni/api/dotsama/balance.js +11 -0
- package/cjs/koni/api/staking/bonding/amplitude.js +6 -2
- package/cjs/koni/api/staking/bonding/astar.js +40 -243
- package/cjs/koni/api/staking/bonding/index.js +4 -4
- package/cjs/koni/api/staking/bonding/paraChain.js +16 -10
- package/cjs/koni/api/staking/bonding/relayChain.js +62 -7
- package/cjs/koni/api/staking/bonding/utils.js +29 -3
- package/cjs/koni/api/xcm/index.js +0 -111
- package/cjs/koni/api/xcm/polkadotXcm.js +1 -1
- package/cjs/koni/api/xcm/xTokens.js +2 -4
- package/cjs/koni/background/cron.js +61 -62
- package/cjs/koni/background/handlers/Extension.js +143 -149
- package/cjs/koni/background/handlers/State.js +129 -91
- package/cjs/koni/background/handlers/Tabs.js +40 -38
- package/cjs/koni/background/subscription.js +48 -43
- package/cjs/packageInfo.js +1 -1
- package/cjs/page/index.js +5 -0
- package/cjs/services/chain-service/constants.js +1 -11
- package/cjs/services/chain-service/index.js +39 -5
- package/cjs/services/chain-service/utils.js +4 -0
- package/cjs/services/event-service/index.js +71 -0
- package/cjs/services/event-service/types.js +1 -0
- package/cjs/services/history-service/index.js +36 -17
- package/cjs/services/history-service/subsquid-multi-chain-history.js +7 -2
- package/cjs/services/keyring-service/index.js +101 -0
- package/cjs/services/migration-service/index.js +13 -10
- package/cjs/{koni/migration/scripts/RemoveWrongCrowdloan.js → services/migration-service/scripts/AutoEnableChainsTokens.js} +11 -6
- package/cjs/services/migration-service/scripts/MigrateNetworkSettings.js +39 -19
- package/cjs/services/migration-service/scripts/MigrateSettings.js +31 -0
- package/cjs/services/migration-service/scripts/MigrateTransactionHistory.js +72 -0
- package/cjs/services/migration-service/scripts/index.js +13 -4
- package/cjs/services/price-service/coingecko.js +16 -3
- package/cjs/services/price-service/index.js +15 -17
- package/cjs/services/request-service/constants.js +8 -2
- package/cjs/services/request-service/handler/AuthRequestHandler.js +39 -12
- package/cjs/services/request-service/index.js +3 -0
- package/cjs/services/storage-service/DatabaseService.js +1 -1
- package/cjs/services/storage-service/databases/index.js +1 -1
- package/cjs/services/storage-service/db-stores/BaseStoreWithAddressAndChain.js +2 -8
- package/cjs/services/storage-service/db-stores/Nft.js +4 -1
- package/cjs/services/storage-service/db-stores/Transaction.js +10 -7
- package/cjs/services/subscan-service/index.js +107 -0
- package/cjs/services/subscan-service/subscan-chain-map.js +74 -0
- package/cjs/services/subscan-service/types.js +1 -0
- package/cjs/services/transaction-service/index.js +45 -10
- package/cjs/services/transaction-service/utils.js +4 -6
- package/cjs/utils/address.js +9 -1
- package/cjs/utils/index.js +24 -13
- package/constants/index.d.ts +1 -0
- package/constants/index.js +1 -0
- package/koni/api/dotsama/balance.js +11 -0
- package/koni/api/staking/bonding/amplitude.d.ts +1 -1
- package/koni/api/staking/bonding/amplitude.js +8 -4
- package/koni/api/staking/bonding/astar.d.ts +2 -11
- package/koni/api/staking/bonding/astar.js +35 -229
- package/koni/api/staking/bonding/index.d.ts +1 -1
- package/koni/api/staking/bonding/index.js +4 -4
- package/koni/api/staking/bonding/paraChain.d.ts +1 -1
- package/koni/api/staking/bonding/paraChain.js +17 -11
- package/koni/api/staking/bonding/relayChain.d.ts +1 -1
- package/koni/api/staking/bonding/relayChain.js +63 -8
- package/koni/api/staking/bonding/utils.d.ts +13 -1
- package/koni/api/staking/bonding/utils.js +27 -3
- package/koni/api/xcm/index.js +1 -112
- package/koni/api/xcm/polkadotXcm.js +1 -1
- package/koni/api/xcm/xTokens.js +3 -5
- package/koni/background/cron.js +60 -60
- package/koni/background/handlers/Extension.js +71 -76
- package/koni/background/handlers/State.d.ts +16 -14
- package/koni/background/handlers/State.js +126 -91
- package/koni/background/handlers/Tabs.js +22 -19
- package/koni/background/subscription.d.ts +1 -1
- package/koni/background/subscription.js +49 -44
- package/package.json +56 -16
- package/packageInfo.js +1 -1
- package/page/index.d.ts +2 -0
- package/page/index.js +4 -0
- package/services/chain-service/constants.d.ts +0 -1
- package/services/chain-service/constants.js +0 -9
- package/services/chain-service/index.d.ts +6 -4
- package/services/chain-service/index.js +39 -7
- package/services/chain-service/utils.d.ts +1 -0
- package/services/chain-service/utils.js +3 -0
- package/services/event-service/index.d.ts +22 -0
- package/services/event-service/index.js +59 -0
- package/services/event-service/types.d.ts +32 -0
- package/services/event-service/types.js +1 -0
- package/services/history-service/index.d.ts +5 -3
- package/services/history-service/index.js +36 -17
- package/services/history-service/subsquid-multi-chain-history.js +7 -2
- package/services/keyring-service/index.d.ts +19 -0
- package/services/keyring-service/index.js +93 -0
- package/services/migration-service/index.js +11 -9
- package/services/migration-service/scripts/AutoEnableChainsTokens.d.ts +4 -0
- package/services/migration-service/scripts/AutoEnableChainsTokens.js +13 -0
- package/services/migration-service/scripts/MigrateNetworkSettings.js +37 -18
- package/services/migration-service/scripts/MigrateSettings.d.ts +4 -0
- package/services/migration-service/scripts/MigrateSettings.js +23 -0
- package/services/migration-service/scripts/MigrateTransactionHistory.d.ts +4 -0
- package/services/migration-service/scripts/MigrateTransactionHistory.js +64 -0
- package/services/migration-service/scripts/index.d.ts +1 -0
- package/services/migration-service/scripts/index.js +10 -3
- package/services/price-service/coingecko.js +16 -3
- package/services/price-service/index.d.ts +5 -3
- package/services/price-service/index.js +15 -17
- package/services/request-service/constants.d.ts +1 -0
- package/services/request-service/constants.js +6 -1
- package/services/request-service/handler/AuthRequestHandler.d.ts +8 -1
- package/services/request-service/handler/AuthRequestHandler.js +40 -13
- package/services/request-service/index.d.ts +7 -1
- package/services/request-service/index.js +3 -0
- package/services/storage-service/DatabaseService.js +1 -1
- package/services/storage-service/databases/index.js +1 -1
- package/services/storage-service/db-stores/BaseStoreWithAddressAndChain.d.ts +1 -1
- package/services/storage-service/db-stores/BaseStoreWithAddressAndChain.js +2 -8
- package/services/storage-service/db-stores/Nft.d.ts +2 -1
- package/services/storage-service/db-stores/Nft.js +4 -1
- package/services/storage-service/db-stores/Transaction.js +10 -7
- package/services/subscan-service/index.d.ts +20 -0
- package/services/subscan-service/index.js +99 -0
- package/services/subscan-service/subscan-chain-map.d.ts +5 -0
- package/services/subscan-service/subscan-chain-map.js +63 -0
- package/services/subscan-service/types.d.ts +27 -0
- package/services/subscan-service/types.js +1 -0
- package/services/transaction-service/event-parser/index.d.ts +2 -2
- package/services/transaction-service/index.d.ts +4 -2
- package/services/transaction-service/index.js +45 -10
- package/services/transaction-service/utils.js +5 -6
- package/utils/address.d.ts +1 -0
- package/utils/address.js +9 -2
- package/utils/index.d.ts +1 -0
- package/utils/index.js +21 -12
- package/cjs/background/errors/EvmRpcError.js +0 -21
- package/cjs/background/errors/SubWalletProviderError.js +0 -17
- package/cjs/constants/ethereum.js +0 -19
- package/cjs/errors/SubWalletProviderError.js +0 -17
- package/cjs/koni/api/xcm/astar.js +0 -160
- package/cjs/koni/api/xcm/moonbeamXcm.js +0 -80
- package/cjs/koni/api/xcm/statemintXcm.js +0 -197
- package/cjs/koni/api/xcm/substrateXcm.js +0 -213
- package/cjs/koni/migration/Base.js +0 -20
- package/cjs/koni/migration/index.js +0 -45
- package/cjs/koni/migration/scripts/ChangeRouteToHome.js +0 -22
- package/cjs/koni/migration/scripts/ClearOldStorage.js +0 -24
- package/cjs/koni/migration/scripts/RemoveWrongTransactionHistoriesFromStore.js +0 -36
- package/cjs/koni/migration/scripts/ResetTransactionHistoryEventIdx.js +0 -21
- package/cjs/koni/migration/scripts/index.js +0 -22
- package/cjs/koni/page/index.js +0 -16
- package/cjs/services/asset-service/index.js +0 -91
- package/cjs/services/storage-service/db-stores/ExtraDelegationInfo.js +0 -17
- package/cjs/stores/Balance.js +0 -18
- package/cjs/stores/Crowdloan.js +0 -18
- package/cjs/stores/CustomEvmToken.js +0 -18
- package/cjs/stores/NetworkMap.js +0 -18
- package/cjs/stores/Nft.js +0 -18
- package/cjs/stores/NftCollection.js +0 -18
- package/cjs/stores/Price.js +0 -18
- package/cjs/stores/Staking.js +0 -18
- package/cjs/stores/StakingReward.js +0 -18
- package/cjs/utils/eth/parseTransactionData.js +0 -284
- package/koni/page/index.d.ts +0 -2
- package/koni/page/index.js +0 -9
- /package/cjs/{koni/page → page}/SubWalleEvmProvider.js +0 -0
- /package/{koni/page → page}/SubWalleEvmProvider.d.ts +0 -0
- /package/{koni/page → page}/SubWalleEvmProvider.js +0 -0
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.EVM_PROVIDER_RPC_ERRORS_MAP = void 0;
|
|
7
|
-
// Copyright 2019-2022 @subwallet/extension-base authors & contributors
|
|
8
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
9
|
-
|
|
10
|
-
const EVM_PROVIDER_RPC_ERRORS_MAP = {
|
|
11
|
-
USER_REJECTED_REQUEST: [4001, 'User Rejected Request'],
|
|
12
|
-
UNAUTHORIZED: [4100, 'Unauthorized'],
|
|
13
|
-
UNSUPPORTED_METHOD: [4200, 'Unsupported Method'],
|
|
14
|
-
DISCONNECTED: [4900, 'Disconnected'],
|
|
15
|
-
CHAIN_DISCONNECTED: [4901, 'Chain Disconnected'],
|
|
16
|
-
INVALID_PARAMS: [-32602, 'Invalid Params'],
|
|
17
|
-
INTERNAL_ERROR: [-32603, 'Internal Error']
|
|
18
|
-
};
|
|
19
|
-
exports.EVM_PROVIDER_RPC_ERRORS_MAP = EVM_PROVIDER_RPC_ERRORS_MAP;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.SubWalletProviderError = void 0;
|
|
7
|
-
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
8
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
9
|
-
|
|
10
|
-
class SubWalletProviderError extends Error {
|
|
11
|
-
constructor(message, code, data) {
|
|
12
|
-
super(message);
|
|
13
|
-
this.code = code;
|
|
14
|
-
this.data = data;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
exports.SubWalletProviderError = SubWalletProviderError;
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.astarEstimateCrossChainFee = astarEstimateCrossChainFee;
|
|
7
|
-
exports.astarGetXcmExtrinsic = astarGetXcmExtrinsic;
|
|
8
|
-
var _utils = require("@subwallet/extension-base/services/chain-service/utils");
|
|
9
|
-
var _utilCrypto = require("@polkadot/util-crypto");
|
|
10
|
-
// Copyright 2019-2022 @subwallet/extension-base
|
|
11
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
12
|
-
|
|
13
|
-
// const ASSET_TO_LOCATION_MAP: Record<string, Record<string, Record<string, any>>> = {
|
|
14
|
-
// astar: {
|
|
15
|
-
// '18446744073709551617': { // aUSD
|
|
16
|
-
// parents: 1, interior: { X2: [{ Parachain: 2000 }, { GeneralKey: '0x0001' }] }
|
|
17
|
-
// },
|
|
18
|
-
// '340282366920938463463374607431768211455': { // DOT
|
|
19
|
-
// parents: 1, interior: 'Here'
|
|
20
|
-
// }
|
|
21
|
-
// },
|
|
22
|
-
// shiden: {
|
|
23
|
-
// '18446744073709551616': { // aUSD
|
|
24
|
-
// parents: 1, interior: { X2: [{ Parachain: 2000 }, { GeneralKey: '0x0081' }] }
|
|
25
|
-
// },
|
|
26
|
-
// '340282366920938463463374607431768211455': {
|
|
27
|
-
// parents: 1, interior: 'Here'
|
|
28
|
-
// }
|
|
29
|
-
// }
|
|
30
|
-
// };
|
|
31
|
-
|
|
32
|
-
async function astarEstimateCrossChainFee(originNetworkKey, destinationNetworkKey, recipient, sender, sendingValue, substrateApiMap, originTokenInfo, chainInfoMap) {
|
|
33
|
-
const substrateApi = await substrateApiMap[originNetworkKey].isReady;
|
|
34
|
-
const destinationChainInfo = chainInfoMap[destinationNetworkKey];
|
|
35
|
-
|
|
36
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
37
|
-
const assetLocation = (0, _utils._getXcmAssetMultilocation)(originTokenInfo);
|
|
38
|
-
let receiverLocation = {
|
|
39
|
-
AccountId32: {
|
|
40
|
-
network: 'Any',
|
|
41
|
-
id: (0, _utilCrypto.decodeAddress)(recipient)
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
let destinationChainLocation = {
|
|
45
|
-
V1: {
|
|
46
|
-
// find the destination chain
|
|
47
|
-
parents: 1,
|
|
48
|
-
interior: {
|
|
49
|
-
X1: {
|
|
50
|
-
Parachain: (0, _utils._getSubstrateParaId)(destinationChainInfo)
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
if ((0, _utils._isChainEvmCompatible)(destinationChainInfo)) {
|
|
56
|
-
receiverLocation = {
|
|
57
|
-
AccountKey20: {
|
|
58
|
-
network: 'Any',
|
|
59
|
-
id: recipient
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
if ((0, _utils._isSubstrateRelayChain)(destinationChainInfo)) {
|
|
64
|
-
// check if sending to relaychain
|
|
65
|
-
destinationChainLocation = {
|
|
66
|
-
V1: {
|
|
67
|
-
// find the destination chain
|
|
68
|
-
parents: 1,
|
|
69
|
-
interior: 'Here'
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
const extrinsic = substrateApi.api.tx.polkadotXcm.reserveWithdrawAssets(destinationChainLocation, {
|
|
74
|
-
V1: {
|
|
75
|
-
// find the receiver
|
|
76
|
-
parents: 0,
|
|
77
|
-
// parents for beneficiary is always 0
|
|
78
|
-
interior: {
|
|
79
|
-
X1: receiverLocation
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}, {
|
|
83
|
-
V1: [
|
|
84
|
-
// find the asset
|
|
85
|
-
{
|
|
86
|
-
id: {
|
|
87
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
88
|
-
Concrete: assetLocation
|
|
89
|
-
},
|
|
90
|
-
fun: {
|
|
91
|
-
Fungible: sendingValue
|
|
92
|
-
}
|
|
93
|
-
}]
|
|
94
|
-
}, 0);
|
|
95
|
-
console.log('astar xcm tx here', extrinsic.toHex());
|
|
96
|
-
const paymentInfo = await extrinsic.paymentInfo(sender);
|
|
97
|
-
return paymentInfo.partialFee.toString();
|
|
98
|
-
}
|
|
99
|
-
function astarGetXcmExtrinsic(originNetworkKey, destinationNetworkKey, recipient, sendingValue, api, originTokenInfo, chainInfoMap) {
|
|
100
|
-
const destinationChainInfo = chainInfoMap[destinationNetworkKey];
|
|
101
|
-
|
|
102
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
103
|
-
const assetLocation = (0, _utils._getXcmAssetMultilocation)(originTokenInfo);
|
|
104
|
-
let receiverLocation = {
|
|
105
|
-
AccountId32: {
|
|
106
|
-
network: 'Any',
|
|
107
|
-
id: (0, _utilCrypto.decodeAddress)(recipient)
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
let destinationChainLocation = {
|
|
111
|
-
V1: {
|
|
112
|
-
// find the destination chain
|
|
113
|
-
parents: 1,
|
|
114
|
-
interior: {
|
|
115
|
-
X1: {
|
|
116
|
-
Parachain: (0, _utils._getSubstrateParaId)(destinationChainInfo)
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
if ((0, _utils._isChainEvmCompatible)(destinationChainInfo)) {
|
|
122
|
-
receiverLocation = {
|
|
123
|
-
AccountKey20: {
|
|
124
|
-
network: 'Any',
|
|
125
|
-
id: recipient
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
if ((0, _utils._isSubstrateRelayChain)(destinationChainInfo)) {
|
|
130
|
-
destinationChainLocation = {
|
|
131
|
-
V1: {
|
|
132
|
-
// find the destination chain
|
|
133
|
-
parents: 1,
|
|
134
|
-
interior: 'Here'
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
return api.tx.polkadotXcm.reserveWithdrawAssets(destinationChainLocation, {
|
|
139
|
-
V1: {
|
|
140
|
-
// find the receiver
|
|
141
|
-
parents: 0,
|
|
142
|
-
// parents for beneficiary is always 0
|
|
143
|
-
interior: {
|
|
144
|
-
X1: receiverLocation
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}, {
|
|
148
|
-
V1: [
|
|
149
|
-
// find the asset
|
|
150
|
-
{
|
|
151
|
-
id: {
|
|
152
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
153
|
-
Concrete: assetLocation
|
|
154
|
-
},
|
|
155
|
-
fun: {
|
|
156
|
-
Fungible: sendingValue
|
|
157
|
-
}
|
|
158
|
-
}]
|
|
159
|
-
}, 0);
|
|
160
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.moonbeamEstimateCrossChainFee = moonbeamEstimateCrossChainFee;
|
|
7
|
-
exports.moonbeamGetXcmExtrinsic = moonbeamGetXcmExtrinsic;
|
|
8
|
-
var _chainList = require("@subwallet/chain-list");
|
|
9
|
-
var _utils = require("@subwallet/extension-base/koni/api/xcm/utils");
|
|
10
|
-
var _utils2 = require("@subwallet/extension-base/services/chain-service/utils");
|
|
11
|
-
var _util = require("@polkadot/util");
|
|
12
|
-
// Copyright 2019-2022 @subwallet/extension-base
|
|
13
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
14
|
-
|
|
15
|
-
// enum MOON_ASSET_TYPES {
|
|
16
|
-
// ForeignAsset = 'ForeignAsset',
|
|
17
|
-
// SelfReserve = 'SelfReserve',
|
|
18
|
-
// LocalAssetReserve = 'LocalAssetReserve',
|
|
19
|
-
// }
|
|
20
|
-
|
|
21
|
-
// const TOKEN_TYPE_MAP: Record<string, Record<string, string>> = {
|
|
22
|
-
// moonbase: {
|
|
23
|
-
// xcKAR: MOON_ASSET_TYPES.ForeignAsset,
|
|
24
|
-
// xcUNIT: MOON_ASSET_TYPES.ForeignAsset,
|
|
25
|
-
// xcBSX: MOON_ASSET_TYPES.ForeignAsset,
|
|
26
|
-
// xcBNC: MOON_ASSET_TYPES.ForeignAsset,
|
|
27
|
-
// xcKMA: MOON_ASSET_TYPES.ForeignAsset,
|
|
28
|
-
// xcCSM: MOON_ASSET_TYPES.ForeignAsset,
|
|
29
|
-
// xckUSD: MOON_ASSET_TYPES.ForeignAsset,
|
|
30
|
-
// xcPHA: MOON_ASSET_TYPES.ForeignAsset,
|
|
31
|
-
// xcKINT: MOON_ASSET_TYPES.ForeignAsset,
|
|
32
|
-
// xckBTC: MOON_ASSET_TYPES.ForeignAsset,
|
|
33
|
-
// xcLIT: MOON_ASSET_TYPES.ForeignAsset,
|
|
34
|
-
// xcHKO: MOON_ASSET_TYPES.ForeignAsset,
|
|
35
|
-
// xcMRMRK: MOON_ASSET_TYPES.ForeignAsset
|
|
36
|
-
// },
|
|
37
|
-
// moonriver: {
|
|
38
|
-
// xcKSM: MOON_ASSET_TYPES.ForeignAsset,
|
|
39
|
-
// xcBNC: MOON_ASSET_TYPES.ForeignAsset,
|
|
40
|
-
// xcKMA: MOON_ASSET_TYPES.ForeignAsset,
|
|
41
|
-
// xcCSM: MOON_ASSET_TYPES.ForeignAsset,
|
|
42
|
-
// xcHKO: MOON_ASSET_TYPES.ForeignAsset,
|
|
43
|
-
// xcKAR: MOON_ASSET_TYPES.ForeignAsset,
|
|
44
|
-
// xcAUSD: MOON_ASSET_TYPES.ForeignAsset,
|
|
45
|
-
// xcPHA: MOON_ASSET_TYPES.ForeignAsset,
|
|
46
|
-
// xcKINT: MOON_ASSET_TYPES.ForeignAsset,
|
|
47
|
-
// xckBTC: MOON_ASSET_TYPES.ForeignAsset,
|
|
48
|
-
// xcRMRK: MOON_ASSET_TYPES.ForeignAsset,
|
|
49
|
-
// xcUSDT: MOON_ASSET_TYPES.ForeignAsset
|
|
50
|
-
// },
|
|
51
|
-
// moonbeam: {
|
|
52
|
-
// xcDOT: MOON_ASSET_TYPES.ForeignAsset,
|
|
53
|
-
// xcaUSD: MOON_ASSET_TYPES.ForeignAsset,
|
|
54
|
-
// xcACA: MOON_ASSET_TYPES.ForeignAsset,
|
|
55
|
-
// xcINTR: MOON_ASSET_TYPES.ForeignAsset,
|
|
56
|
-
// xciBTC: MOON_ASSET_TYPES.ForeignAsset
|
|
57
|
-
// }
|
|
58
|
-
// };
|
|
59
|
-
|
|
60
|
-
async function moonbeamEstimateCrossChainFee(originNetworkKey, destinationNetworkKey, recipient, sender, sendingValue, substrateApiMap, originTokenInfo, chainInfoMap) {
|
|
61
|
-
const substrateApi = await substrateApiMap[originNetworkKey].isReady;
|
|
62
|
-
const tokenType = (0, _utils2._getXcmAssetType)(originTokenInfo);
|
|
63
|
-
const assetId = (0, _utils2._getXcmAssetId)(originTokenInfo);
|
|
64
|
-
const weightParam = originNetworkKey === _chainList.COMMON_CHAIN_SLUGS.MOONRIVER ? _utils.POLKADOT_UNLIMITED_WEIGHT : _utils.FOUR_INSTRUCTIONS_WEIGHT;
|
|
65
|
-
const extrinsic = substrateApi.api.tx.xTokens.transfer({
|
|
66
|
-
[tokenType]: new _util.BN(assetId)
|
|
67
|
-
}, sendingValue, (0, _utils.getMultiLocationFromParachain)(originNetworkKey, destinationNetworkKey, chainInfoMap, recipient), weightParam);
|
|
68
|
-
console.log('moon xcm tx here', extrinsic.toHex());
|
|
69
|
-
const paymentInfo = await extrinsic.paymentInfo(sender);
|
|
70
|
-
const fee = paymentInfo.partialFee.toString();
|
|
71
|
-
return fee;
|
|
72
|
-
}
|
|
73
|
-
function moonbeamGetXcmExtrinsic(originNetworkKey, destinationNetworkKey, recipient, sendingValue, api, originTokenInfo, chainInfoMap) {
|
|
74
|
-
const tokenType = (0, _utils2._getXcmAssetType)(originTokenInfo);
|
|
75
|
-
const assetId = (0, _utils2._getXcmAssetId)(originTokenInfo);
|
|
76
|
-
const weightParam = originNetworkKey === 'moonriver' ? _utils.POLKADOT_UNLIMITED_WEIGHT : _utils.FOUR_INSTRUCTIONS_WEIGHT;
|
|
77
|
-
return api.tx.xTokens.transfer({
|
|
78
|
-
[tokenType]: new _util.BN(assetId)
|
|
79
|
-
}, sendingValue, (0, _utils.getMultiLocationFromParachain)(originNetworkKey, destinationNetworkKey, chainInfoMap, recipient), weightParam);
|
|
80
|
-
}
|
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.statemintEstimateCrossChainFee = statemintEstimateCrossChainFee;
|
|
7
|
-
exports.statemintGetXcmExtrinsic = statemintGetXcmExtrinsic;
|
|
8
|
-
var _utils = require("@subwallet/extension-base/koni/api/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
|
-
// const ASSET_TO_LOCATION_MAP: Record<string, Record<string, any>> = {
|
|
14
|
-
// statemint: {
|
|
15
|
-
// 1984: [ // USDt
|
|
16
|
-
// {
|
|
17
|
-
// PalletInstance: 50
|
|
18
|
-
// },
|
|
19
|
-
// {
|
|
20
|
-
// GeneralIndex: 1984
|
|
21
|
-
// }
|
|
22
|
-
// ]
|
|
23
|
-
// }
|
|
24
|
-
// };
|
|
25
|
-
|
|
26
|
-
async function statemintEstimateCrossChainFee(originNetworkKey, destinationNetworkKey, recipient, sender, sendingValue, substrateApiMap, originTokenInfo, chainInfoMap) {
|
|
27
|
-
const substrateApi = await substrateApiMap[originNetworkKey].isReady;
|
|
28
|
-
let fee = '0';
|
|
29
|
-
const destinationChainInfo = chainInfoMap[destinationNetworkKey];
|
|
30
|
-
const receiverLocation = (0, _utils.getReceiverLocation)(originNetworkKey, destinationNetworkKey, chainInfoMap, recipient);
|
|
31
|
-
try {
|
|
32
|
-
if ((0, _utils2._isSubstrateParaChain)(destinationChainInfo)) {
|
|
33
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
34
|
-
const assetMultilocation = (0, _utils2._getXcmAssetMultilocation)(originTokenInfo);
|
|
35
|
-
const destinationChainLocation = {
|
|
36
|
-
V1: {
|
|
37
|
-
// find the destination chain
|
|
38
|
-
parents: 1,
|
|
39
|
-
interior: {
|
|
40
|
-
X1: {
|
|
41
|
-
Parachain: (0, _utils2._getSubstrateParaId)(destinationChainInfo)
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
const extrinsic = substrateApi.api.tx.polkadotXcm.limitedReserveTransferAssets(destinationChainLocation,
|
|
47
|
-
// dest
|
|
48
|
-
{
|
|
49
|
-
V1: {
|
|
50
|
-
// beneficiary
|
|
51
|
-
parents: 0,
|
|
52
|
-
interior: {
|
|
53
|
-
X1: receiverLocation
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}, {
|
|
57
|
-
V1: [{
|
|
58
|
-
id: {
|
|
59
|
-
Concrete: {
|
|
60
|
-
parents: 0,
|
|
61
|
-
interior: {
|
|
62
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
63
|
-
X2: assetMultilocation
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
fun: {
|
|
68
|
-
Fungible: sendingValue
|
|
69
|
-
}
|
|
70
|
-
}]
|
|
71
|
-
}, 0,
|
|
72
|
-
// FeeAssetItem
|
|
73
|
-
_utils.POLKADOT_UNLIMITED_WEIGHT);
|
|
74
|
-
console.log('statemint xcm tx to p here', extrinsic.toHex());
|
|
75
|
-
const paymentInfo = await extrinsic.paymentInfo(sender);
|
|
76
|
-
fee = paymentInfo.partialFee.toString();
|
|
77
|
-
} else {
|
|
78
|
-
const extrinsic = substrateApi.api.tx.polkadotXcm.limitedTeleportAssets({
|
|
79
|
-
V1: {
|
|
80
|
-
parents: 1,
|
|
81
|
-
interior: 'Here'
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
// dest
|
|
85
|
-
{
|
|
86
|
-
V1: {
|
|
87
|
-
// beneficiary
|
|
88
|
-
parents: 0,
|
|
89
|
-
interior: {
|
|
90
|
-
X1: receiverLocation
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}, {
|
|
94
|
-
V1: [{
|
|
95
|
-
id: {
|
|
96
|
-
Concrete: {
|
|
97
|
-
parents: 1,
|
|
98
|
-
interior: 'Here' // Native token of relaychain
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
|
|
102
|
-
fun: {
|
|
103
|
-
Fungible: sendingValue
|
|
104
|
-
}
|
|
105
|
-
}]
|
|
106
|
-
}, 0,
|
|
107
|
-
// FeeAssetItem
|
|
108
|
-
_utils.POLKADOT_UNLIMITED_WEIGHT);
|
|
109
|
-
console.log('statemint xcm tx to r here', extrinsic.toHex());
|
|
110
|
-
const paymentInfo = await extrinsic.paymentInfo(sender);
|
|
111
|
-
fee = paymentInfo.partialFee.toString();
|
|
112
|
-
}
|
|
113
|
-
return fee;
|
|
114
|
-
} catch (e) {
|
|
115
|
-
console.error('error parsing xcm transaction', e);
|
|
116
|
-
return '0';
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
function statemintGetXcmExtrinsic(originNetworkKey, destinationNetworkKey, recipient, sendingValue, api, originTokenInfo, chainInfoMap) {
|
|
120
|
-
const destinationChainInfo = chainInfoMap[destinationNetworkKey];
|
|
121
|
-
const receiverLocation = (0, _utils.getReceiverLocation)(originNetworkKey, destinationNetworkKey, chainInfoMap, recipient);
|
|
122
|
-
if ((0, _utils2._isSubstrateParaChain)(destinationChainInfo)) {
|
|
123
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
124
|
-
const assetLocation = (0, _utils2._getXcmAssetMultilocation)(originTokenInfo);
|
|
125
|
-
const destinationChainLocation = {
|
|
126
|
-
V1: {
|
|
127
|
-
// find the destination chain
|
|
128
|
-
parents: 1,
|
|
129
|
-
interior: {
|
|
130
|
-
X1: {
|
|
131
|
-
Parachain: (0, _utils2._getSubstrateParaId)(destinationChainInfo)
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
return api.tx.polkadotXcm.limitedReserveTransferAssets(destinationChainLocation,
|
|
137
|
-
// dest
|
|
138
|
-
{
|
|
139
|
-
V1: {
|
|
140
|
-
// beneficiary
|
|
141
|
-
parents: 0,
|
|
142
|
-
interior: {
|
|
143
|
-
X1: receiverLocation
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}, {
|
|
147
|
-
V1: [{
|
|
148
|
-
id: {
|
|
149
|
-
Concrete: {
|
|
150
|
-
parents: 0,
|
|
151
|
-
interior: {
|
|
152
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
153
|
-
X2: assetLocation
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
},
|
|
157
|
-
fun: {
|
|
158
|
-
Fungible: sendingValue
|
|
159
|
-
}
|
|
160
|
-
}]
|
|
161
|
-
}, 0,
|
|
162
|
-
// FeeAssetItem
|
|
163
|
-
_utils.POLKADOT_UNLIMITED_WEIGHT);
|
|
164
|
-
} else {
|
|
165
|
-
return api.tx.polkadotXcm.limitedTeleportAssets({
|
|
166
|
-
V1: {
|
|
167
|
-
parents: 1,
|
|
168
|
-
interior: 'Here'
|
|
169
|
-
}
|
|
170
|
-
},
|
|
171
|
-
// dest
|
|
172
|
-
{
|
|
173
|
-
V1: {
|
|
174
|
-
// beneficiary
|
|
175
|
-
parents: 0,
|
|
176
|
-
interior: {
|
|
177
|
-
X1: receiverLocation
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}, {
|
|
181
|
-
V1: [{
|
|
182
|
-
id: {
|
|
183
|
-
Concrete: {
|
|
184
|
-
parents: 1,
|
|
185
|
-
interior: 'Here' // Native token of relaychain
|
|
186
|
-
}
|
|
187
|
-
},
|
|
188
|
-
|
|
189
|
-
fun: {
|
|
190
|
-
Fungible: sendingValue
|
|
191
|
-
}
|
|
192
|
-
}]
|
|
193
|
-
}, 0,
|
|
194
|
-
// FeeAssetItem
|
|
195
|
-
_utils.POLKADOT_UNLIMITED_WEIGHT);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.substrateEstimateCrossChainFee = substrateEstimateCrossChainFee;
|
|
7
|
-
exports.substrateGetXcmExtrinsic = substrateGetXcmExtrinsic;
|
|
8
|
-
var _utils = require("@subwallet/extension-base/koni/api/xcm/utils");
|
|
9
|
-
var _constants = require("@subwallet/extension-base/services/chain-service/constants");
|
|
10
|
-
var _utils2 = require("@subwallet/extension-base/services/chain-service/utils");
|
|
11
|
-
// Copyright 2019-2022 @subwallet/extension-base
|
|
12
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
13
|
-
|
|
14
|
-
const NETWORK_USE_UNLIMITED_WEIGHT = ['acala', 'karura', 'statemint'];
|
|
15
|
-
|
|
16
|
-
// function getTokenIdentity (originNetworkKey: string, tokenInfo: TokenInfo) {
|
|
17
|
-
// // TODO: find a better way to handle kUSD on karura
|
|
18
|
-
// const tokenSymbol = tokenInfo.symbol.toUpperCase() === 'AUSD' && originNetworkKey === 'karura' ? 'KUSD' : tokenInfo.symbol.toUpperCase();
|
|
19
|
-
//
|
|
20
|
-
// if (originNetworkKey === 'bifrost') {
|
|
21
|
-
// return tokenInfo.specialOption as Record<string, any>;
|
|
22
|
-
// } else if (originNetworkKey === 'pioneer' && tokenSymbol.toUpperCase() === 'NEER') {
|
|
23
|
-
// return {
|
|
24
|
-
// NativeToken: 0
|
|
25
|
-
// };
|
|
26
|
-
// } else if (originNetworkKey === 'karura' && tokenSymbol.toUpperCase() === 'NEER') { // TODO: modify later with different assets on Karura
|
|
27
|
-
// return tokenInfo.specialOption as Record<string, any>;
|
|
28
|
-
// } else if (originNetworkKey === 'acala' && tokenSymbol.toUpperCase() === 'GLMR') { // TODO: modify later with different assets on Acala
|
|
29
|
-
// return tokenInfo.specialOption as Record<string, any>;
|
|
30
|
-
// }
|
|
31
|
-
//
|
|
32
|
-
// return {
|
|
33
|
-
// Token: tokenSymbol
|
|
34
|
-
// };
|
|
35
|
-
// }
|
|
36
|
-
|
|
37
|
-
async function substrateEstimateCrossChainFee(originNetworkKey, destinationNetworkKey, recipient, sender, sendingValue, substrateApiMap, originTokenInfo, chainInfoMap) {
|
|
38
|
-
const substrateApi = await substrateApiMap[originNetworkKey].isReady;
|
|
39
|
-
const api = substrateApi.api;
|
|
40
|
-
let fee = '0';
|
|
41
|
-
const originChainInfo = chainInfoMap[originNetworkKey];
|
|
42
|
-
const destinationChainInfo = chainInfoMap[destinationNetworkKey];
|
|
43
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
44
|
-
const tokenIdentity = (0, _utils2._getXcmAssetMultilocation)(originTokenInfo);
|
|
45
|
-
const weightParam = _constants._XCM_CHAIN_USE_LIMITED_WEIGHT.includes(originNetworkKey) ? _utils.POLKADOT_UNLIMITED_WEIGHT : _utils.FOUR_INSTRUCTIONS_WEIGHT;
|
|
46
|
-
try {
|
|
47
|
-
if ((0, _utils2._isSubstrateParaChain)(originChainInfo)) {
|
|
48
|
-
// Case ParaChain -> ParaChain && ParaChain -> RelayChain
|
|
49
|
-
const extrinsic = api.tx.xTokens.transfer(tokenIdentity, sendingValue, (0, _utils.getMultiLocationFromParachain)(originNetworkKey, destinationNetworkKey, chainInfoMap, recipient), weightParam);
|
|
50
|
-
try {
|
|
51
|
-
const paymentInfo = await extrinsic.paymentInfo(sender.address);
|
|
52
|
-
fee = paymentInfo.partialFee.toString();
|
|
53
|
-
} catch (e) {
|
|
54
|
-
console.error(e);
|
|
55
|
-
}
|
|
56
|
-
console.log('substrate xcm tx p-p or p-r here', extrinsic.toHex());
|
|
57
|
-
} else {
|
|
58
|
-
// Case RelayChain -> ParaChain
|
|
59
|
-
const receiverLocation = (0, _utils.getReceiverLocation)(originNetworkKey, destinationNetworkKey, chainInfoMap, recipient);
|
|
60
|
-
if (_constants._XCM_CHAIN_GROUP.statemine.includes(destinationNetworkKey)) {
|
|
61
|
-
const extrinsic = api.tx.xcmPallet.limitedTeleportAssets({
|
|
62
|
-
V1: {
|
|
63
|
-
parents: 0,
|
|
64
|
-
interior: {
|
|
65
|
-
X1: {
|
|
66
|
-
Parachain: (0, _utils2._getSubstrateParaId)(destinationChainInfo)
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}, {
|
|
71
|
-
V1: {
|
|
72
|
-
parents: 0,
|
|
73
|
-
interior: {
|
|
74
|
-
X1: receiverLocation
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}, {
|
|
78
|
-
V1: [{
|
|
79
|
-
id: {
|
|
80
|
-
Concrete: {
|
|
81
|
-
parents: 0,
|
|
82
|
-
interior: 'Here'
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
fun: {
|
|
86
|
-
Fungible: sendingValue
|
|
87
|
-
}
|
|
88
|
-
}]
|
|
89
|
-
}, 0, _utils.POLKADOT_UNLIMITED_WEIGHT);
|
|
90
|
-
const paymentInfo = await extrinsic.paymentInfo(sender);
|
|
91
|
-
fee = paymentInfo.partialFee.toString();
|
|
92
|
-
console.log('substrate xcm teleport asset tx r-p here', extrinsic.toHex());
|
|
93
|
-
} else {
|
|
94
|
-
const extrinsic = api.tx.xcmPallet.reserveTransferAssets({
|
|
95
|
-
V1: {
|
|
96
|
-
// find the destination chain
|
|
97
|
-
parents: 0,
|
|
98
|
-
interior: {
|
|
99
|
-
X1: {
|
|
100
|
-
Parachain: (0, _utils2._getSubstrateParaId)(destinationChainInfo)
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}, {
|
|
105
|
-
V1: {
|
|
106
|
-
// find the receiver
|
|
107
|
-
parents: 0,
|
|
108
|
-
interior: {
|
|
109
|
-
X1: receiverLocation
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}, {
|
|
113
|
-
V1: [
|
|
114
|
-
// find the asset
|
|
115
|
-
{
|
|
116
|
-
id: {
|
|
117
|
-
Concrete: {
|
|
118
|
-
parents: 0,
|
|
119
|
-
interior: 'Here'
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
fun: {
|
|
123
|
-
Fungible: sendingValue
|
|
124
|
-
}
|
|
125
|
-
}]
|
|
126
|
-
}, 0);
|
|
127
|
-
const paymentInfo = await extrinsic.paymentInfo(sender);
|
|
128
|
-
fee = paymentInfo.partialFee.toString();
|
|
129
|
-
console.log('substrate xcm reserve transfer tx r-p here', extrinsic.toHex());
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
} catch (e) {
|
|
133
|
-
console.error('error parsing xcm transaction', e);
|
|
134
|
-
}
|
|
135
|
-
return fee;
|
|
136
|
-
}
|
|
137
|
-
function substrateGetXcmExtrinsic(originNetworkKey, destinationNetworkKey, recipient, sendingValue, api, originTokenInfo, chainInfoMap) {
|
|
138
|
-
// Case ParaChain -> RelayChain && Parachain -> Parachain
|
|
139
|
-
if ((0, _utils2._isSubstrateParaChain)(chainInfoMap[originNetworkKey])) {
|
|
140
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
141
|
-
const tokenIdentity = (0, _utils2._getXcmAssetMultilocation)(originTokenInfo);
|
|
142
|
-
const weightParam = NETWORK_USE_UNLIMITED_WEIGHT.includes(originNetworkKey) ? _utils.POLKADOT_UNLIMITED_WEIGHT : _utils.FOUR_INSTRUCTIONS_WEIGHT;
|
|
143
|
-
return api.tx.xTokens.transfer(tokenIdentity, sendingValue, (0, _utils.getMultiLocationFromParachain)(originNetworkKey, destinationNetworkKey, chainInfoMap, recipient), weightParam);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
// Case RelayChain -> Parachain
|
|
147
|
-
const destinationChainInfo = chainInfoMap[destinationNetworkKey];
|
|
148
|
-
const receiverLocation = (0, _utils.getReceiverLocation)(originNetworkKey, destinationNetworkKey, chainInfoMap, recipient);
|
|
149
|
-
if (_constants._XCM_CHAIN_GROUP.statemine.includes(destinationNetworkKey)) {
|
|
150
|
-
return api.tx.xcmPallet.limitedTeleportAssets({
|
|
151
|
-
V1: {
|
|
152
|
-
parents: 0,
|
|
153
|
-
interior: {
|
|
154
|
-
X1: {
|
|
155
|
-
Parachain: (0, _utils2._getSubstrateParaId)(destinationChainInfo)
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}, {
|
|
160
|
-
V1: {
|
|
161
|
-
parents: 0,
|
|
162
|
-
interior: {
|
|
163
|
-
X1: receiverLocation
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}, {
|
|
167
|
-
V1: [{
|
|
168
|
-
id: {
|
|
169
|
-
Concrete: {
|
|
170
|
-
parents: 0,
|
|
171
|
-
interior: 'Here'
|
|
172
|
-
}
|
|
173
|
-
},
|
|
174
|
-
fun: {
|
|
175
|
-
Fungible: sendingValue
|
|
176
|
-
}
|
|
177
|
-
}]
|
|
178
|
-
}, 0, _utils.POLKADOT_UNLIMITED_WEIGHT);
|
|
179
|
-
}
|
|
180
|
-
return api.tx.xcmPallet.reserveTransferAssets({
|
|
181
|
-
V1: {
|
|
182
|
-
// find the destination chain
|
|
183
|
-
parents: 0,
|
|
184
|
-
interior: {
|
|
185
|
-
X1: {
|
|
186
|
-
Parachain: (0, _utils2._getSubstrateParaId)(destinationChainInfo)
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}, {
|
|
191
|
-
V1: {
|
|
192
|
-
// find the receiver
|
|
193
|
-
parents: 0,
|
|
194
|
-
interior: {
|
|
195
|
-
X1: receiverLocation
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
}, {
|
|
199
|
-
V1: [
|
|
200
|
-
// find the asset
|
|
201
|
-
{
|
|
202
|
-
id: {
|
|
203
|
-
Concrete: {
|
|
204
|
-
parents: 0,
|
|
205
|
-
interior: 'Here'
|
|
206
|
-
}
|
|
207
|
-
},
|
|
208
|
-
fun: {
|
|
209
|
-
Fungible: sendingValue
|
|
210
|
-
}
|
|
211
|
-
}]
|
|
212
|
-
}, 0);
|
|
213
|
-
}
|