@subwallet/extension-base 1.2.24-0 → 1.2.24-2
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/assets-pallet.js +35 -0
- package/cjs/core/substrate/foreign-asset-pallet.js +13 -3
- package/cjs/core/substrate/nominationpools-pallet.js +4 -6
- package/cjs/core/substrate/ormlTokens-pallet.js +24 -0
- package/cjs/core/substrate/system-pallet.js +18 -18
- package/cjs/core/substrate/tokens-pallet.js +24 -0
- package/cjs/core/substrate/types.js +19 -0
- package/cjs/core/substrate/xcm-parser.js +16 -2
- package/cjs/core/utils.js +25 -0
- package/cjs/koni/background/handlers/Extension.js +1 -1
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/balance-service/helpers/subscribe/substrate/equilibrium.js +2 -2
- package/cjs/services/balance-service/helpers/subscribe/substrate/index.js +120 -133
- package/cjs/services/balance-service/transfer/xcm/index.js +2 -1
- package/cjs/services/balance-service/transfer/xcm/polkadotXcm.js +1 -1
- package/cjs/services/balance-service/transfer/xcm/utils.js +3 -2
- package/cjs/services/chain-service/constants.js +1 -1
- package/cjs/services/chain-service/handler/SubstrateApi.js +128 -34
- package/cjs/services/chain-service/handler/SubstrateChainHandler.js +26 -9
- package/cjs/services/chain-service/utils/index.js +5 -0
- package/core/substrate/assets-pallet.d.ts +4 -0
- package/core/substrate/assets-pallet.js +28 -0
- package/core/substrate/foreign-asset-pallet.d.ts +4 -8
- package/core/substrate/foreign-asset-pallet.js +13 -3
- package/core/substrate/nominationpools-pallet.d.ts +4 -10
- package/core/substrate/nominationpools-pallet.js +4 -5
- package/core/substrate/ormlTokens-pallet.d.ts +4 -0
- package/core/substrate/ormlTokens-pallet.js +17 -0
- package/core/substrate/system-pallet.d.ts +4 -24
- package/core/substrate/system-pallet.js +18 -21
- package/core/substrate/tokens-pallet.d.ts +5 -0
- package/core/substrate/tokens-pallet.js +16 -0
- package/core/substrate/types.d.ts +43 -0
- package/core/substrate/types.js +12 -0
- package/core/substrate/xcm-parser.d.ts +1 -0
- package/core/substrate/xcm-parser.js +15 -2
- package/core/utils.d.ts +4 -0
- package/core/utils.js +17 -0
- package/koni/api/staking/bonding/relayChain.d.ts +1 -1
- package/koni/background/handlers/Extension.js +1 -1
- package/koni/background/handlers/State.d.ts +2 -2
- package/package.json +31 -6
- package/packageInfo.js +1 -1
- package/services/balance-service/helpers/subscribe/substrate/equilibrium.js +2 -2
- package/services/balance-service/helpers/subscribe/substrate/index.js +109 -121
- package/services/balance-service/transfer/xcm/index.d.ts +1 -1
- package/services/balance-service/transfer/xcm/index.js +2 -1
- package/services/balance-service/transfer/xcm/polkadotXcm.js +1 -1
- package/services/balance-service/transfer/xcm/utils.d.ts +1 -1
- package/services/balance-service/transfer/xcm/utils.js +3 -2
- package/services/chain-service/constants.js +1 -1
- package/services/chain-service/handler/SubstrateApi.d.ts +5 -7
- package/services/chain-service/handler/SubstrateApi.js +128 -35
- package/services/chain-service/handler/SubstrateChainHandler.d.ts +5 -6
- package/services/chain-service/handler/SubstrateChainHandler.js +26 -9
- package/services/chain-service/index.d.ts +3 -3
- package/services/chain-service/types.d.ts +22 -5
- package/services/chain-service/utils/index.d.ts +1 -0
- package/services/chain-service/utils/index.js +3 -0
- package/services/earning-service/handlers/nomination-pool/index.d.ts +1 -1
- package/types/balance/index.d.ts +2 -3
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports._getAssetsPalletLockedBalance = _getAssetsPalletLockedBalance;
|
|
7
|
+
exports._getAssetsPalletTransferable = _getAssetsPalletTransferable;
|
|
8
|
+
var _types = require("@subwallet/extension-base/core/substrate/types");
|
|
9
|
+
var _utils = require("@subwallet/extension-base/core/utils");
|
|
10
|
+
// Copyright 2019-2022 @subwallet/extension-base
|
|
11
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
12
|
+
|
|
13
|
+
function _getAssetsPalletTransferable(accountInfo, existentialDeposit, extrinsicType) {
|
|
14
|
+
const strictMode = (0, _utils.getStrictMode)(_types.BalanceAccountType.PalletAssetsAssetAccount, extrinsicType);
|
|
15
|
+
const bnAppliedExistentialDeposit = (0, _utils._getAppliedExistentialDeposit)(existentialDeposit, strictMode);
|
|
16
|
+
let bnTransferable = BigInt(0);
|
|
17
|
+
if (!accountInfo) {
|
|
18
|
+
return BigInt(0);
|
|
19
|
+
}
|
|
20
|
+
if (['Liquid'].includes(accountInfo.status)) {
|
|
21
|
+
bnTransferable = BigInt(accountInfo.balance) - bnAppliedExistentialDeposit;
|
|
22
|
+
}
|
|
23
|
+
return bnTransferable;
|
|
24
|
+
}
|
|
25
|
+
function _getAssetsPalletLockedBalance(accountInfo) {
|
|
26
|
+
let bnLocked = BigInt(0);
|
|
27
|
+
if (!accountInfo) {
|
|
28
|
+
return bnLocked;
|
|
29
|
+
}
|
|
30
|
+
if (!['Liquid'].includes(accountInfo.status)) {
|
|
31
|
+
// todo: check case accountInfo has isFrozen?
|
|
32
|
+
bnLocked = BigInt(accountInfo.balance);
|
|
33
|
+
}
|
|
34
|
+
return bnLocked;
|
|
35
|
+
}
|
|
@@ -5,12 +5,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports._getForeignAssetPalletLockedBalance = _getForeignAssetPalletLockedBalance;
|
|
7
7
|
exports._getForeignAssetPalletTransferable = _getForeignAssetPalletTransferable;
|
|
8
|
+
var _types = require("@subwallet/extension-base/core/substrate/types");
|
|
9
|
+
var _utils = require("@subwallet/extension-base/core/utils");
|
|
8
10
|
// Copyright 2019-2022 @subwallet/extension-base
|
|
9
11
|
// SPDX-License-Identifier: Apache-2.0
|
|
10
12
|
|
|
11
|
-
function _getForeignAssetPalletTransferable(accountInfo) {
|
|
12
|
-
|
|
13
|
+
function _getForeignAssetPalletTransferable(accountInfo, existentialDeposit, extrinsicType) {
|
|
14
|
+
const strictMode = (0, _utils.getStrictMode)(_types.BalanceAccountType.PalletAssetsAssetAccount, extrinsicType);
|
|
15
|
+
if (!accountInfo || accountInfo.status !== 'Liquid') {
|
|
16
|
+
return BigInt(0);
|
|
17
|
+
}
|
|
18
|
+
const bnAppliedExistentialDeposit = (0, _utils._getAppliedExistentialDeposit)(existentialDeposit, strictMode);
|
|
19
|
+
return BigInt(accountInfo.balance) - bnAppliedExistentialDeposit;
|
|
13
20
|
}
|
|
14
21
|
function _getForeignAssetPalletLockedBalance(accountInfo) {
|
|
15
|
-
|
|
22
|
+
if (!accountInfo || accountInfo.status === 'Liquid') {
|
|
23
|
+
return BigInt(0);
|
|
24
|
+
}
|
|
25
|
+
return BigInt(accountInfo.balance);
|
|
16
26
|
}
|
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports._getActiveStakeInNominationPool = _getActiveStakeInNominationPool;
|
|
8
7
|
exports._getTotalStakeInNominationPool = _getTotalStakeInNominationPool;
|
|
9
8
|
exports._getUnbondingStakeInNominationPool = _getUnbondingStakeInNominationPool;
|
|
10
|
-
var _bignumber = _interopRequireDefault(require("bignumber.js"));
|
|
11
9
|
// Copyright 2019-2022 @subwallet/extension-base
|
|
12
10
|
// SPDX-License-Identifier: Apache-2.0
|
|
13
11
|
|
|
14
12
|
function _getActiveStakeInNominationPool(memberInfo) {
|
|
15
|
-
return
|
|
13
|
+
return BigInt(memberInfo.points);
|
|
16
14
|
}
|
|
17
15
|
function _getUnbondingStakeInNominationPool(memberInfo) {
|
|
18
|
-
const unbondingValues = Object.values(memberInfo.unbondingEras).map(unbonding =>
|
|
19
|
-
return
|
|
16
|
+
const unbondingValues = Object.values(memberInfo.unbondingEras).map(unbonding => BigInt(unbonding));
|
|
17
|
+
return unbondingValues.reduce((a, b) => a + b, BigInt(0));
|
|
20
18
|
}
|
|
21
19
|
function _getTotalStakeInNominationPool(memberInfo) {
|
|
22
|
-
return _getActiveStakeInNominationPool(memberInfo)
|
|
20
|
+
return _getActiveStakeInNominationPool(memberInfo) + _getUnbondingStakeInNominationPool(memberInfo);
|
|
23
21
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports._getOrmlTokensPalletLockedBalance = _getOrmlTokensPalletLockedBalance;
|
|
7
|
+
exports._getOrmlTokensPalletTransferable = _getOrmlTokensPalletTransferable;
|
|
8
|
+
var _types = require("@subwallet/extension-base/core/substrate/types");
|
|
9
|
+
var _utils = require("@subwallet/extension-base/core/utils");
|
|
10
|
+
// Copyright 2019-2022 @subwallet/extension-base
|
|
11
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
12
|
+
|
|
13
|
+
function _getOrmlTokensPalletTransferable(accountInfo, existentialDeposit, extrinsicType) {
|
|
14
|
+
const strictMode = (0, _utils.getStrictMode)(_types.BalanceAccountType.OrmlTokensAccountData, extrinsicType);
|
|
15
|
+
const bnAppliedExistentialDeposit = (0, _utils._getAppliedExistentialDeposit)(existentialDeposit, strictMode);
|
|
16
|
+
const bnFrozen = BigInt(accountInfo.frozen);
|
|
17
|
+
const bnFree = BigInt(accountInfo.free);
|
|
18
|
+
return bnFree - (0, _utils.getMaxBigInt)(bnFrozen, bnAppliedExistentialDeposit);
|
|
19
|
+
}
|
|
20
|
+
function _getOrmlTokensPalletLockedBalance(accountInfo) {
|
|
21
|
+
const bnFrozen = BigInt(accountInfo.frozen);
|
|
22
|
+
const bnReserved = BigInt(accountInfo.reserved);
|
|
23
|
+
return bnReserved + bnFrozen;
|
|
24
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -9,8 +8,8 @@ exports._getAppliedExistentialDepositWithExtrinsicType = _getAppliedExistentialD
|
|
|
9
8
|
exports._getSystemPalletTotalBalance = _getSystemPalletTotalBalance;
|
|
10
9
|
exports._getSystemPalletTransferable = _getSystemPalletTransferable;
|
|
11
10
|
exports._isAccountActive = _isAccountActive;
|
|
12
|
-
var
|
|
13
|
-
var
|
|
11
|
+
var _types = require("@subwallet/extension-base/core/substrate/types");
|
|
12
|
+
var _utils = require("@subwallet/extension-base/core/utils");
|
|
14
13
|
// Copyright 2019-2022 @subwallet/extension-base
|
|
15
14
|
// SPDX-License-Identifier: Apache-2.0
|
|
16
15
|
|
|
@@ -18,7 +17,7 @@ function isV1(accountInfo) {
|
|
|
18
17
|
return accountInfo.data.miscFrozen !== undefined && accountInfo.data.feeFrozen !== undefined;
|
|
19
18
|
}
|
|
20
19
|
function _getSystemPalletTransferable(accountInfo, existentialDeposit, extrinsicType) {
|
|
21
|
-
const strictMode =
|
|
20
|
+
const strictMode = (0, _utils.getStrictMode)(_types.BalanceAccountType.FrameSystemAccountInfo, extrinsicType); // always apply strict mode to keep account alive unless explicitly specified otherwise
|
|
22
21
|
|
|
23
22
|
if (isV1(accountInfo)) {
|
|
24
23
|
return _getSystemPalletTransferableV1(accountInfo, existentialDeposit, strictMode);
|
|
@@ -41,7 +40,7 @@ function _getSystemPalletTotalBalance(accountInfo) {
|
|
|
41
40
|
}
|
|
42
41
|
}
|
|
43
42
|
function _getAppliedExistentialDepositWithExtrinsicType(accountInfo, existentialDeposit, extrinsicType) {
|
|
44
|
-
const strictMode =
|
|
43
|
+
const strictMode = (0, _utils.getStrictMode)(_types.BalanceAccountType.FrameSystemAccountInfo, extrinsicType); // always apply strict mode to keep account alive unless explicitly specified otherwise
|
|
45
44
|
|
|
46
45
|
return _getAppliedExistentialDeposit(accountInfo, existentialDeposit, strictMode);
|
|
47
46
|
}
|
|
@@ -49,29 +48,30 @@ function _getAppliedExistentialDepositWithExtrinsicType(accountInfo, existential
|
|
|
49
48
|
// ----------------------------------------------------------------------
|
|
50
49
|
|
|
51
50
|
function _getAppliedExistentialDeposit(accountInfo, existentialDeposit, strictMode) {
|
|
51
|
+
const bnExistentialDeposit = BigInt(existentialDeposit);
|
|
52
|
+
|
|
52
53
|
// strict mode will always apply existential deposit to keep account alive
|
|
53
54
|
if (strictMode) {
|
|
54
|
-
return
|
|
55
|
+
return bnExistentialDeposit;
|
|
55
56
|
}
|
|
56
|
-
return _canAccountBeReaped(accountInfo) ?
|
|
57
|
+
return _canAccountBeReaped(accountInfo) ? BigInt(0) : bnExistentialDeposit; // account for ED here will go better with max transfer logic
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
function _getSystemPalletTransferableV2(accountInfo, existentialDeposit, strictMode) {
|
|
60
|
-
const
|
|
61
|
-
const
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
return _bignumber.default.max(bnTransferableBalance, 0).toFixed();
|
|
61
|
+
const bnLocked = BigInt(accountInfo.data.frozen) - BigInt(accountInfo.data.reserved); // locked can go below 0 but this shouldn't matter
|
|
62
|
+
const bnAppliedExistentialDeposit = _getAppliedExistentialDeposit(accountInfo, existentialDeposit, strictMode);
|
|
63
|
+
const bnTransferable = BigInt(accountInfo.data.free) - (0, _utils.getMaxBigInt)(bnLocked, bnAppliedExistentialDeposit);
|
|
64
|
+
return (0, _utils.getMaxBigInt)(bnTransferable, BigInt(0));
|
|
65
65
|
}
|
|
66
66
|
function _getSystemPalletTotalBalanceV2(accountInfo) {
|
|
67
|
-
return
|
|
67
|
+
return BigInt(accountInfo.data.free) + BigInt(accountInfo.data.reserved);
|
|
68
68
|
}
|
|
69
69
|
function _getSystemPalletTransferableV1(accountInfo, existentialDeposit, strictMode) {
|
|
70
|
-
const bnAppliedExistentialDeposit =
|
|
71
|
-
const bnAppliedFrozen =
|
|
72
|
-
const
|
|
73
|
-
return
|
|
70
|
+
const bnAppliedExistentialDeposit = BigInt(_getAppliedExistentialDeposit(accountInfo, existentialDeposit, strictMode));
|
|
71
|
+
const bnAppliedFrozen = (0, _utils.getMaxBigInt)(BigInt(accountInfo.data.feeFrozen), BigInt(accountInfo.data.miscFrozen));
|
|
72
|
+
const bnTransferable = BigInt(accountInfo.data.free) - (0, _utils.getMaxBigInt)(bnAppliedFrozen, bnAppliedExistentialDeposit);
|
|
73
|
+
return (0, _utils.getMaxBigInt)(bnTransferable, BigInt(0));
|
|
74
74
|
}
|
|
75
75
|
function _getSystemPalletTotalBalanceV1(accountInfo) {
|
|
76
|
-
return
|
|
76
|
+
return BigInt(accountInfo.data.free) + BigInt(accountInfo.data.reserved);
|
|
77
77
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports._getTokensPalletLocked = _getTokensPalletLocked;
|
|
7
|
+
exports._getTokensPalletTotalBalance = _getTokensPalletTotalBalance;
|
|
8
|
+
exports._getTokensPalletTransferable = _getTokensPalletTransferable;
|
|
9
|
+
var _types = require("@subwallet/extension-base/core/substrate/types");
|
|
10
|
+
var _utils = require("@subwallet/extension-base/core/utils");
|
|
11
|
+
// Copyright 2019-2022 @subwallet/extension-base
|
|
12
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
13
|
+
|
|
14
|
+
function _getTokensPalletTransferable(accountInfo, existentialDeposit, extrinsicType) {
|
|
15
|
+
const strictMode = (0, _utils.getStrictMode)(_types.BalanceAccountType.OrmlTokensAccountData, extrinsicType);
|
|
16
|
+
const bnAppliedExistentialDeposit = (0, _utils._getAppliedExistentialDeposit)(existentialDeposit, strictMode);
|
|
17
|
+
return BigInt(accountInfo.free) - (0, _utils.getMaxBigInt)(BigInt(accountInfo.frozen), bnAppliedExistentialDeposit);
|
|
18
|
+
}
|
|
19
|
+
function _getTokensPalletLocked(accountInfo) {
|
|
20
|
+
return BigInt(accountInfo.reserved) + BigInt(accountInfo.frozen);
|
|
21
|
+
}
|
|
22
|
+
function _getTokensPalletTotalBalance(accountInfo) {
|
|
23
|
+
return BigInt(accountInfo.free) + BigInt(accountInfo.reserved);
|
|
24
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.BalanceAccountType = void 0;
|
|
7
|
+
// Copyright 2019-2022 @subwallet/extension-base
|
|
8
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
9
|
+
|
|
10
|
+
// https://crates.parity.io/frame_system/struct.AccountInfo.html
|
|
11
|
+
// https://wiki.polkadot.network/docs/learn-account-balances
|
|
12
|
+
|
|
13
|
+
// export type BalanceAccountType = 'FrameSystemAccountInfo' | 'OrmlTokensAccountData' | 'PalletAssetsAssetAccount' | 'PalletNominationPoolsPoolMember';
|
|
14
|
+
const BalanceAccountType = {
|
|
15
|
+
FrameSystemAccountInfo: 'FrameSystemAccountInfo',
|
|
16
|
+
OrmlTokensAccountData: 'OrmlTokensAccountData',
|
|
17
|
+
PalletAssetsAssetAccount: 'PalletAssetsAssetAccount'
|
|
18
|
+
};
|
|
19
|
+
exports.BalanceAccountType = BalanceAccountType;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports._adaptX1Interior = _adaptX1Interior;
|
|
6
7
|
exports._getXcmBeneficiary = _getXcmBeneficiary;
|
|
7
8
|
exports._getXcmDestWeight = _getXcmDestWeight;
|
|
8
9
|
exports._getXcmMultiAssets = _getXcmMultiAssets;
|
|
@@ -204,15 +205,28 @@ function _getRecipientLocation(destChainInfo, recipient, version) {
|
|
|
204
205
|
};
|
|
205
206
|
}
|
|
206
207
|
function _getAssetIdentifier(tokenInfo, version) {
|
|
207
|
-
const
|
|
208
|
-
if (!
|
|
208
|
+
const _assetIdentifier = (0, _utils._getXcmAssetMultilocation)(tokenInfo);
|
|
209
|
+
if (!_assetIdentifier) {
|
|
209
210
|
throw new Error('Asset must have multilocation');
|
|
210
211
|
}
|
|
212
|
+
const assetIdentifier = _adaptX1Interior(structuredClone(_assetIdentifier), version);
|
|
211
213
|
return version >= 4 // from V4, Concrete is removed
|
|
212
214
|
? assetIdentifier : {
|
|
213
215
|
Concrete: assetIdentifier
|
|
214
216
|
};
|
|
215
217
|
}
|
|
218
|
+
function _adaptX1Interior(assetIdentifier, version) {
|
|
219
|
+
const interior = assetIdentifier.interior;
|
|
220
|
+
const isInteriorObj = typeof interior === 'object' && interior !== null;
|
|
221
|
+
const isX1 = isInteriorObj && 'X1' in interior;
|
|
222
|
+
const needModifyX1 = version <= 4 && Array.isArray(interior.X1);
|
|
223
|
+
if (isInteriorObj && isX1 && needModifyX1) {
|
|
224
|
+
// X1 is an object for version < 4. From V4, it's an array
|
|
225
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access
|
|
226
|
+
interior.X1 = interior.X1[0];
|
|
227
|
+
}
|
|
228
|
+
return assetIdentifier;
|
|
229
|
+
}
|
|
216
230
|
function _getNetworkByVersion(version) {
|
|
217
231
|
switch (version) {
|
|
218
232
|
case 1:
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports._getAppliedExistentialDeposit = _getAppliedExistentialDeposit;
|
|
7
|
+
exports.getMaxBigInt = getMaxBigInt;
|
|
8
|
+
exports.getStrictMode = getStrictMode;
|
|
9
|
+
var _KoniTypes = require("@subwallet/extension-base/background/KoniTypes");
|
|
10
|
+
var _types = require("@subwallet/extension-base/core/substrate/types");
|
|
11
|
+
// Copyright 2019-2022 @subwallet/extension-base
|
|
12
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
13
|
+
|
|
14
|
+
function getStrictMode(type, extrinsicType) {
|
|
15
|
+
if (type === _types.BalanceAccountType.FrameSystemAccountInfo) {
|
|
16
|
+
return !extrinsicType || ![_KoniTypes.ExtrinsicType.TRANSFER_BALANCE].includes(extrinsicType);
|
|
17
|
+
}
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
function _getAppliedExistentialDeposit(existentialDeposit, strictMode) {
|
|
21
|
+
return strictMode ? BigInt(existentialDeposit) : BigInt(0);
|
|
22
|
+
}
|
|
23
|
+
function getMaxBigInt(a, b) {
|
|
24
|
+
return a > b ? a : b;
|
|
25
|
+
}
|
|
@@ -2001,7 +2001,7 @@ class KoniExtension {
|
|
|
2001
2001
|
if (destinationTokenInfo) {
|
|
2002
2002
|
const [bnMockFee, {
|
|
2003
2003
|
value
|
|
2004
|
-
}] = await Promise.all([(0, _xcm.getXcmMockTxFee)(substrateApi, chainInfoMap,
|
|
2004
|
+
}] = await Promise.all([(0, _xcm.getXcmMockTxFee)(substrateApi, chainInfoMap, originTokenInfo, destinationTokenInfo), this.getAddressTransferableBalance({
|
|
2005
2005
|
extrinsicType: _KoniTypes.ExtrinsicType.TRANSFER_XCM,
|
|
2006
2006
|
address,
|
|
2007
2007
|
networkKey: originTokenInfo.originChain,
|
package/cjs/packageInfo.js
CHANGED
|
@@ -27,7 +27,7 @@ const subscribeEquilibriumTokenBalance = async _ref => {
|
|
|
27
27
|
const tokenTypes = includeNativeToken ? [_types._AssetType.NATIVE, _types._AssetType.LOCAL] : [_types._AssetType.LOCAL];
|
|
28
28
|
const tokenMap = (0, _utils2.filterAssetsByChainAndType)(assetMap, chain, tokenTypes);
|
|
29
29
|
try {
|
|
30
|
-
const unsub = await substrateApi.query.system.account.multi(addresses, balances => {
|
|
30
|
+
const unsub = await substrateApi.api.query.system.account.multi(addresses, balances => {
|
|
31
31
|
// Equilibrium customizes the SystemAccount pallet
|
|
32
32
|
Object.values(tokenMap).forEach(tokenInfo => {
|
|
33
33
|
const assetId = (0, _utils._getTokenOnChainAssetId)(tokenInfo);
|
|
@@ -91,7 +91,7 @@ const subscribeEqBalanceAccountPallet = async _ref2 => {
|
|
|
91
91
|
const unsubList = Object.values(tokenMap).map(async tokenInfo => {
|
|
92
92
|
try {
|
|
93
93
|
const assetId = (0, _utils._getTokenOnChainAssetId)(tokenInfo);
|
|
94
|
-
const unsub = await substrateApi.query.eqBalances.account.multi(addresses.map(address => [address, [assetId]]), balances => {
|
|
94
|
+
const unsub = await substrateApi.api.query.eqBalances.account.multi(addresses.map(address => [address, [assetId]]), balances => {
|
|
95
95
|
const items = balances.map((balance, index) => {
|
|
96
96
|
return {
|
|
97
97
|
address: addresses[index],
|