@subwallet/extension-base 1.3.76-0 → 1.3.78-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/background/KoniTypes.d.ts +4 -1
- package/cjs/core/logic-validation/index.js +1 -1
- package/cjs/core/substrate/xcm-parser.js +17 -11
- package/cjs/koni/background/handlers/Extension.js +293 -71
- package/cjs/koni/background/handlers/State.js +20 -0
- package/cjs/koni/background/handlers/Tabs.js +2 -3
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/balance-service/helpers/subscribe/evm.js +85 -6
- package/cjs/services/balance-service/helpers/subscribe/index.js +2 -1
- package/cjs/services/balance-service/index.js +6 -2
- package/cjs/services/balance-service/transfer/token.js +15 -0
- package/cjs/services/balance-service/transfer/xcm/bittensorBridge/index.js +27 -0
- package/cjs/services/balance-service/transfer/xcm/bittensorBridge/nativeTokenBridge.js +58 -0
- package/cjs/services/balance-service/transfer/xcm/bittensorBridge/utils.js +36 -0
- package/cjs/services/balance-service/transfer/xcm/index.js +61 -2
- package/cjs/services/balance-service/transfer/xcm/utils.js +94 -6
- package/cjs/services/chain-service/constants.js +4 -2
- package/cjs/services/chain-service/utils/patch.js +1 -1
- package/cjs/services/earning-service/constants/chains.js +7 -2
- package/cjs/services/earning-service/handlers/liquid-staking/stella-swap.js +8 -5
- package/cjs/services/earning-service/handlers/special.js +82 -65
- package/cjs/services/earning-service/service.js +19 -2
- package/cjs/services/multisig-service/index.js +1 -1
- package/cjs/services/request-service/handler/SubstrateRequestHandler.js +12 -0
- package/cjs/services/request-service/index.js +3 -0
- package/cjs/services/setting-service/constants.js +2 -1
- package/cjs/services/storage-service/db-stores/InappNotification.js +1 -1
- package/cjs/services/swap-service/handler/bittensor-handler.js +197 -0
- package/cjs/services/swap-service/index.js +7 -0
- package/cjs/services/transaction-service/index.js +10 -0
- package/cjs/types/balance/index.js +1 -0
- package/cjs/types/swap/index.js +3 -1
- package/cjs/utils/fee/transfer.js +20 -5
- package/core/logic-validation/index.js +1 -1
- package/core/substrate/xcm-parser.d.ts +3 -0
- package/core/substrate/xcm-parser.js +14 -11
- package/koni/background/handlers/Extension.d.ts +19 -0
- package/koni/background/handlers/Extension.js +233 -14
- package/koni/background/handlers/State.d.ts +1 -0
- package/koni/background/handlers/State.js +20 -0
- package/koni/background/handlers/Tabs.js +2 -3
- package/package.json +26 -6
- package/packageInfo.js +1 -1
- package/services/balance-service/helpers/subscribe/evm.d.ts +1 -0
- package/services/balance-service/helpers/subscribe/evm.js +76 -1
- package/services/balance-service/helpers/subscribe/index.js +2 -1
- package/services/balance-service/index.js +6 -2
- package/services/balance-service/transfer/token.d.ts +2 -1
- package/services/balance-service/transfer/token.js +15 -0
- package/services/balance-service/transfer/xcm/bittensorBridge/index.d.ts +2 -0
- package/services/balance-service/transfer/xcm/bittensorBridge/index.js +5 -0
- package/services/balance-service/transfer/xcm/bittensorBridge/nativeTokenBridge.d.ts +6 -0
- package/services/balance-service/transfer/xcm/bittensorBridge/nativeTokenBridge.js +50 -0
- package/services/balance-service/transfer/xcm/bittensorBridge/utils.d.ts +8 -0
- package/services/balance-service/transfer/xcm/bittensorBridge/utils.js +29 -0
- package/services/balance-service/transfer/xcm/index.d.ts +5 -0
- package/services/balance-service/transfer/xcm/index.js +57 -2
- package/services/balance-service/transfer/xcm/utils.d.ts +3 -2
- package/services/balance-service/transfer/xcm/utils.js +87 -1
- package/services/chain-service/constants.d.ts +2 -0
- package/services/chain-service/constants.js +4 -2
- package/services/chain-service/utils/patch.d.ts +1 -1
- package/services/chain-service/utils/patch.js +1 -1
- package/services/earning-service/constants/chains.d.ts +2 -0
- package/services/earning-service/constants/chains.js +4 -1
- package/services/earning-service/handlers/liquid-staking/stella-swap.d.ts +1 -0
- package/services/earning-service/handlers/liquid-staking/stella-swap.js +6 -4
- package/services/earning-service/handlers/special.d.ts +1 -1
- package/services/earning-service/handlers/special.js +85 -68
- package/services/earning-service/service.js +21 -4
- package/services/inapp-notification-service/interfaces.d.ts +1 -0
- package/services/multisig-service/index.js +1 -1
- package/services/request-service/handler/SubstrateRequestHandler.d.ts +1 -0
- package/services/request-service/handler/SubstrateRequestHandler.js +12 -0
- package/services/request-service/index.d.ts +1 -0
- package/services/request-service/index.js +3 -0
- package/services/request-service/types.d.ts +1 -0
- package/services/setting-service/constants.js +2 -1
- package/services/storage-service/db-stores/InappNotification.js +1 -1
- package/services/swap-service/handler/bittensor-handler.d.ts +21 -0
- package/services/swap-service/handler/bittensor-handler.js +189 -0
- package/services/swap-service/index.js +7 -0
- package/services/transaction-service/index.d.ts +1 -1
- package/services/transaction-service/index.js +10 -0
- package/services/transaction-service/types.d.ts +4 -3
- package/types/balance/index.d.ts +3 -1
- package/types/balance/index.js +1 -0
- package/types/balance/transfer.d.ts +9 -0
- package/types/fee/base.d.ts +1 -0
- package/types/multisig/index.d.ts +12 -0
- package/types/swap/index.d.ts +3 -1
- package/types/swap/index.js +3 -1
- package/types/yield/actions/join/step.d.ts +6 -0
- package/types/yield/actions/join/submit.d.ts +1 -0
- package/utils/fee/transfer.d.ts +1 -0
- package/utils/fee/transfer.js +21 -6
|
@@ -24,6 +24,7 @@ var _subwalletServicesSdk = _interopRequireDefault(require("@subwallet-monorepos
|
|
|
24
24
|
var _bignumber = _interopRequireDefault(require("bignumber.js"));
|
|
25
25
|
var _i18next = require("i18next");
|
|
26
26
|
var _rxjs = require("rxjs");
|
|
27
|
+
var _bittensorHandler = require("./handler/bittensor-handler");
|
|
27
28
|
var _kyberHandler = require("./handler/kyber-handler");
|
|
28
29
|
var _simpleswapHandler = require("./handler/simpleswap-handler");
|
|
29
30
|
var _uniswapHandler = require("./handler/uniswap-handler");
|
|
@@ -296,6 +297,12 @@ class SwapService {
|
|
|
296
297
|
case _swap.SwapProviderId.OPTIMEX_TESTNET:
|
|
297
298
|
this.handlers[providerId] = new _optimexHandler.OptimexHandler(this.chainService, this.state.balanceService, this.state.feeService, true);
|
|
298
299
|
break;
|
|
300
|
+
case _swap.SwapProviderId.BITTENSOR:
|
|
301
|
+
this.handlers[providerId] = new _bittensorHandler.BittensorSwapHandler(this.chainService, this.state.balanceService, this.state.feeService, false);
|
|
302
|
+
break;
|
|
303
|
+
case _swap.SwapProviderId.BITTENSOR_TESTNET:
|
|
304
|
+
this.handlers[providerId] = new _bittensorHandler.BittensorSwapHandler(this.chainService, this.state.balanceService, this.state.feeService, true);
|
|
305
|
+
break;
|
|
299
306
|
default:
|
|
300
307
|
throw new Error('Unsupported provider');
|
|
301
308
|
}
|
|
@@ -937,6 +937,7 @@ class TransactionService {
|
|
|
937
937
|
nonce: nonce !== null && nonce !== void 0 ? nonce : 0,
|
|
938
938
|
startBlock: startBlock || 0,
|
|
939
939
|
processId: (_transaction$step3 = transaction.step) === null || _transaction$step3 === void 0 ? void 0 : _transaction$step3.processId,
|
|
940
|
+
crossChainFeeInfo: transaction === null || transaction === void 0 ? void 0 : transaction.xcmDestinationFee,
|
|
940
941
|
substrateProxyAddresses: []
|
|
941
942
|
};
|
|
942
943
|
const substrateProxyHistories = [];
|
|
@@ -1378,6 +1379,15 @@ class TransactionService {
|
|
|
1378
1379
|
case _KoniTypes.ExtrinsicType.UNKNOWN:
|
|
1379
1380
|
break;
|
|
1380
1381
|
}
|
|
1382
|
+
const txData = transaction.data;
|
|
1383
|
+
const signer = txData === null || txData === void 0 ? void 0 : txData.signer;
|
|
1384
|
+
if (signer) {
|
|
1385
|
+
const currentAdditionalInfo = historyItem.additionalInfo ? historyItem.additionalInfo : {};
|
|
1386
|
+
historyItem.additionalInfo = {
|
|
1387
|
+
...currentAdditionalInfo,
|
|
1388
|
+
signer
|
|
1389
|
+
};
|
|
1390
|
+
}
|
|
1381
1391
|
try {
|
|
1382
1392
|
// Return one more history record if transaction send to account in the wallets
|
|
1383
1393
|
const toAccount = (historyItem === null || historyItem === void 0 ? void 0 : historyItem.to) && _uiKeyring.default.getPair(historyItem.to);
|
|
@@ -23,6 +23,7 @@ exports.BalanceType = BalanceType;
|
|
|
23
23
|
BalanceType["TOTAL"] = "total";
|
|
24
24
|
BalanceType["TOTAL_MINUS_RESERVED"] = "totalMinusReserved";
|
|
25
25
|
BalanceType["KEEP_ALIVE"] = "keepAlive";
|
|
26
|
+
BalanceType["STAKING"] = "staking";
|
|
26
27
|
})(BalanceType || (exports.BalanceType = BalanceType = {}));
|
|
27
28
|
/** Balance info of all tokens on an address */
|
|
28
29
|
// Key is tokenSlug
|
package/cjs/types/swap/index.js
CHANGED
|
@@ -45,8 +45,10 @@ exports.SwapProviderId = SwapProviderId;
|
|
|
45
45
|
SwapProviderId["KYBER"] = "KYBER";
|
|
46
46
|
SwapProviderId["OPTIMEX"] = "OPTIMEX";
|
|
47
47
|
SwapProviderId["OPTIMEX_TESTNET"] = "OPTIMEX_TESTNET";
|
|
48
|
+
SwapProviderId["BITTENSOR"] = "BITTENSOR";
|
|
49
|
+
SwapProviderId["BITTENSOR_TESTNET"] = "BITTENSOR_TESTNET";
|
|
48
50
|
})(SwapProviderId || (exports.SwapProviderId = SwapProviderId = {}));
|
|
49
|
-
const _SUPPORTED_SWAP_PROVIDERS = [SwapProviderId.CHAIN_FLIP_TESTNET, SwapProviderId.CHAIN_FLIP_MAINNET, SwapProviderId.HYDRADX_MAINNET, SwapProviderId.POLKADOT_ASSET_HUB, SwapProviderId.KUSAMA_ASSET_HUB, SwapProviderId.SIMPLE_SWAP, SwapProviderId.UNISWAP, SwapProviderId.KYBER, SwapProviderId.OPTIMEX, SwapProviderId.OPTIMEX_TESTNET];
|
|
51
|
+
const _SUPPORTED_SWAP_PROVIDERS = [SwapProviderId.CHAIN_FLIP_TESTNET, SwapProviderId.CHAIN_FLIP_MAINNET, SwapProviderId.HYDRADX_MAINNET, SwapProviderId.POLKADOT_ASSET_HUB, SwapProviderId.KUSAMA_ASSET_HUB, SwapProviderId.SIMPLE_SWAP, SwapProviderId.UNISWAP, SwapProviderId.KYBER, SwapProviderId.OPTIMEX, SwapProviderId.OPTIMEX_TESTNET, SwapProviderId.BITTENSOR, SwapProviderId.BITTENSOR_TESTNET];
|
|
50
52
|
exports._SUPPORTED_SWAP_PROVIDERS = _SUPPORTED_SWAP_PROVIDERS;
|
|
51
53
|
// process handling
|
|
52
54
|
let SwapFeeType;
|
|
@@ -16,6 +16,7 @@ var _tonTransfer = require("@subwallet/extension-base/services/balance-service/t
|
|
|
16
16
|
var _xcm = require("@subwallet/extension-base/services/balance-service/transfer/xcm");
|
|
17
17
|
var _acrossBridge = require("@subwallet/extension-base/services/balance-service/transfer/xcm/acrossBridge");
|
|
18
18
|
var _availBridge = require("@subwallet/extension-base/services/balance-service/transfer/xcm/availBridge");
|
|
19
|
+
var _nativeTokenBridge = require("@subwallet/extension-base/services/balance-service/transfer/xcm/bittensorBridge/nativeTokenBridge");
|
|
19
20
|
var _polygonBridge = require("@subwallet/extension-base/services/balance-service/transfer/xcm/polygonBridge");
|
|
20
21
|
var _posBridge = require("@subwallet/extension-base/services/balance-service/transfer/xcm/posBridge");
|
|
21
22
|
var _utils = require("@subwallet/extension-base/services/balance-service/transfer/xcm/utils");
|
|
@@ -92,6 +93,7 @@ const calculateTransferMaxTransferable = async (id, request, freeBalance, fee) =
|
|
|
92
93
|
feeOption,
|
|
93
94
|
isTransferLocalTokenAndPayThatTokenAsFee,
|
|
94
95
|
isTransferNativeTokenAndPayLocalTokenAsFee,
|
|
96
|
+
metadata,
|
|
95
97
|
nativeToken,
|
|
96
98
|
srcChain,
|
|
97
99
|
srcToken,
|
|
@@ -194,7 +196,8 @@ const calculateTransferMaxTransferable = async (id, request, freeBalance, fee) =
|
|
|
194
196
|
networkKey: srcChain.slug,
|
|
195
197
|
tokenInfo: srcToken,
|
|
196
198
|
to: recipient,
|
|
197
|
-
substrateApi
|
|
199
|
+
substrateApi,
|
|
200
|
+
metadata
|
|
198
201
|
});
|
|
199
202
|
}
|
|
200
203
|
if (feeChainType === 'evm') {
|
|
@@ -348,10 +351,12 @@ const calculateXcmMaxTransferable = async (id, request, freeBalance, fee) => {
|
|
|
348
351
|
srcChain,
|
|
349
352
|
srcToken,
|
|
350
353
|
substrateApi,
|
|
354
|
+
transferAll,
|
|
351
355
|
value
|
|
352
356
|
} = request;
|
|
353
357
|
const feeChainType = fee.type;
|
|
354
358
|
let estimatedFee = '0';
|
|
359
|
+
let crossChainFee = '0';
|
|
355
360
|
let feeOptions;
|
|
356
361
|
let maxTransferable;
|
|
357
362
|
let error;
|
|
@@ -361,7 +366,9 @@ const calculateXcmMaxTransferable = async (id, request, freeBalance, fee) => {
|
|
|
361
366
|
const isPolygonBridgeTransfer = (0, _polygonBridge._isPolygonChainBridge)(srcChain.slug, destChain.slug);
|
|
362
367
|
const isPosBridgeTransfer = (0, _posBridge._isPosChainBridge)(srcChain.slug, destChain.slug);
|
|
363
368
|
const isAcrossBridgeTransfer = (0, _acrossBridge._isAcrossChainBridge)(srcChain.slug, destChain.slug);
|
|
364
|
-
const
|
|
369
|
+
const isBittensorBridgeTransfer = (0, _nativeTokenBridge._isBittensorToSubtensorBridge)(srcChain.slug, destChain.slug);
|
|
370
|
+
const isSubtensorEvmBridgeTransfer = (0, _nativeTokenBridge._isSubtensorToBittensorBridge)(srcChain.slug, destChain.slug);
|
|
371
|
+
const isSubstrateParaspellXcm = !(isAvailBridgeFromEvm || isAvailBridgeFromAvail || isSnowBridgeEvmTransfer || isPolygonBridgeTransfer || isPosBridgeTransfer || isAcrossBridgeTransfer || isBittensorBridgeTransfer || isSubtensorEvmBridgeTransfer);
|
|
365
372
|
const fakeAddress = '5DRewsYzhJqZXU3SRaWy1FSt5iDr875ao91aw5fjrJmDG4Ap'; // todo: move this
|
|
366
373
|
const substrateAddress = fakeAddress; // todo: move this
|
|
367
374
|
const evmAddress = (0, _util.u8aToHex)((0, _utilCrypto.addressToEvm)(fakeAddress)); // todo: move this
|
|
@@ -384,7 +391,8 @@ const calculateXcmMaxTransferable = async (id, request, freeBalance, fee) => {
|
|
|
384
391
|
evmApi,
|
|
385
392
|
feeCustom,
|
|
386
393
|
feeOption,
|
|
387
|
-
feeInfo: fee
|
|
394
|
+
feeInfo: fee,
|
|
395
|
+
transferAll
|
|
388
396
|
};
|
|
389
397
|
let funcCreateExtrinsic;
|
|
390
398
|
if (isPosBridgeTransfer || isPolygonBridgeTransfer) {
|
|
@@ -392,6 +400,10 @@ const calculateXcmMaxTransferable = async (id, request, freeBalance, fee) => {
|
|
|
392
400
|
} else if (isAcrossBridgeTransfer) {
|
|
393
401
|
funcCreateExtrinsic = _xcm.createAcrossBridgeExtrinsic;
|
|
394
402
|
params.sendingValue = await (0, _acrossBridge.getAcrossSendingValue)(srcChain, srcToken, destChain, (0, _acrossBridge._isAcrossTestnetBridge)(srcChain.slug));
|
|
403
|
+
} else if (isBittensorBridgeTransfer) {
|
|
404
|
+
funcCreateExtrinsic = _xcm.createBittensorToSubtensorEvmExtrinsic;
|
|
405
|
+
} else if (isSubtensorEvmBridgeTransfer) {
|
|
406
|
+
funcCreateExtrinsic = _xcm.createSubtensorEvmToBittensorExtrinsic;
|
|
395
407
|
} else if (isSnowBridgeEvmTransfer) {
|
|
396
408
|
funcCreateExtrinsic = _xcm.createSnowBridgeExtrinsic;
|
|
397
409
|
} else if (isAvailBridgeFromEvm) {
|
|
@@ -423,7 +435,8 @@ const calculateXcmMaxTransferable = async (id, request, freeBalance, fee) => {
|
|
|
423
435
|
};
|
|
424
436
|
} else if (feeChainType === 'substrate') {
|
|
425
437
|
// Calculate fee for substrate transaction
|
|
426
|
-
if (
|
|
438
|
+
if (isSubstrateParaspellXcm) {
|
|
439
|
+
var _xcmFeeInfo$destinati;
|
|
427
440
|
const xcmFeeInfo = await (0, _utils.estimateXcmFee)({
|
|
428
441
|
fromChainInfo: params.originChain,
|
|
429
442
|
fromTokenInfo: params.originTokenInfo,
|
|
@@ -433,6 +446,7 @@ const calculateXcmMaxTransferable = async (id, request, freeBalance, fee) => {
|
|
|
433
446
|
value: params.sendingValue
|
|
434
447
|
});
|
|
435
448
|
estimatedFee = (xcmFeeInfo === null || xcmFeeInfo === void 0 ? void 0 : xcmFeeInfo.origin.fee) || '0';
|
|
449
|
+
crossChainFee = (xcmFeeInfo === null || xcmFeeInfo === void 0 ? void 0 : (_xcmFeeInfo$destinati = xcmFeeInfo.destination) === null || _xcmFeeInfo$destinati === void 0 ? void 0 : _xcmFeeInfo$destinati.fee) || '0';
|
|
436
450
|
} else {
|
|
437
451
|
try {
|
|
438
452
|
var _paymentInfo$partialF2;
|
|
@@ -447,7 +461,8 @@ const calculateXcmMaxTransferable = async (id, request, freeBalance, fee) => {
|
|
|
447
461
|
estimatedFee = new _bignumber.default(estimatedFee).plus(tip).toFixed(0);
|
|
448
462
|
feeOptions = {
|
|
449
463
|
...fee,
|
|
450
|
-
estimatedFee
|
|
464
|
+
estimatedFee,
|
|
465
|
+
crossChainFee
|
|
451
466
|
};
|
|
452
467
|
} else if (feeChainType === 'bitcoin') {
|
|
453
468
|
feeOptions = {
|
|
@@ -21,7 +21,7 @@ export function validateSpendingAndFeePayment(spendingToken, feeToken, bnSpendin
|
|
|
21
21
|
}))];
|
|
22
22
|
}
|
|
23
23
|
} else {
|
|
24
|
-
if (bnFromTokenBalance.
|
|
24
|
+
if (bnFromTokenBalance.lt(bnSpendingAmount.plus(_isNativeToken(spendingToken) ? '0' : _getTokenMinAmount(spendingToken)))) {
|
|
25
25
|
return [new TransactionError(BasicTxErrorType.NOT_ENOUGH_BALANCE, t('bg.core.validation.insufficientSpendingTokenBalance', {
|
|
26
26
|
replace: {
|
|
27
27
|
spendingTokenSymbol: spendingToken.symbol
|
|
@@ -8,4 +8,7 @@ export declare function _isMythosFromHydrationToMythos(originChainInfo: _ChainIn
|
|
|
8
8
|
export declare function _isPolygonBridgeXcm(originChainInfo: _ChainInfo, destChainInfo: _ChainInfo): boolean;
|
|
9
9
|
export declare function _isPosBridgeXcm(originChainInfo: _ChainInfo, destChainInfo: _ChainInfo): boolean;
|
|
10
10
|
export declare function _isAcrossBridgeXcm(originChainInfo: _ChainInfo, destChainInfo: _ChainInfo): boolean;
|
|
11
|
+
export declare function _isBittensorToSubtensorEvmBridge(originChainInfo: _ChainInfo, destChainInfo: _ChainInfo): boolean;
|
|
12
|
+
export declare function _isSubtensorEvmtoBittensorBridge(originChainInfo: _ChainInfo, destChainInfo: _ChainInfo): boolean;
|
|
13
|
+
export declare function _isAssetHubBridgeXcm(originChainInfo: _ChainInfo, destChainInfo: _ChainInfo): boolean;
|
|
11
14
|
export declare function _adaptX1Interior(_assetIdentifier: Record<string, any>, version: number): Record<string, any>;
|
|
@@ -4,21 +4,15 @@
|
|
|
4
4
|
import { COMMON_CHAIN_SLUGS } from '@subwallet/chain-list';
|
|
5
5
|
import { _isAcrossChainBridge } from '@subwallet/extension-base/services/balance-service/transfer/xcm/acrossBridge';
|
|
6
6
|
import { isAvailChainBridge } from '@subwallet/extension-base/services/balance-service/transfer/xcm/availBridge';
|
|
7
|
+
import { _isBittensorToSubtensorBridge, _isSubtensorToBittensorBridge } from '@subwallet/extension-base/services/balance-service/transfer/xcm/bittensorBridge/nativeTokenBridge';
|
|
7
8
|
import { _isPolygonChainBridge } from '@subwallet/extension-base/services/balance-service/transfer/xcm/polygonBridge';
|
|
8
9
|
import { _isPosChainBridge } from '@subwallet/extension-base/services/balance-service/transfer/xcm/posBridge';
|
|
9
10
|
import { _getSubstrateRelayParent, _isPureEvmChain } from '@subwallet/extension-base/services/chain-service/utils';
|
|
10
11
|
export function _isXcmTransferUnstable(originChainInfo, destChainInfo, assetSlug) {
|
|
11
|
-
return !_isXcmWithinSameConsensus(originChainInfo, destChainInfo) || _isMythosFromHydrationToMythos(originChainInfo, destChainInfo, assetSlug) || _isPolygonBridgeXcm(originChainInfo, destChainInfo) || _isPosBridgeXcm(originChainInfo, destChainInfo);
|
|
12
|
+
return !_isBittensorToSubtensorEvmBridge(originChainInfo, destChainInfo) && !_isSubtensorEvmtoBittensorBridge(originChainInfo, destChainInfo) && !_isXcmWithinSameConsensus(originChainInfo, destChainInfo) && !_isAssetHubBridgeXcm(originChainInfo, destChainInfo) || _isMythosFromHydrationToMythos(originChainInfo, destChainInfo, assetSlug) || _isPolygonBridgeXcm(originChainInfo, destChainInfo) || _isPosBridgeXcm(originChainInfo, destChainInfo);
|
|
12
13
|
}
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
case COMMON_CHAIN_SLUGS.POLKADOT_ASSET_HUB:
|
|
16
|
-
return 'Cross-chain transfer of this token is not recommended as it is in beta and incurs a transaction fee of 2 DOT. Continue at your own risk';
|
|
17
|
-
case COMMON_CHAIN_SLUGS.KUSAMA_ASSET_HUB:
|
|
18
|
-
return 'Cross-chain transfer of this token is not recommended as it is in beta and incurs a transaction fee of 0.4 KSM. Continue at your own risk';
|
|
19
|
-
default:
|
|
20
|
-
return 'Cross-chain transfer of this token is not recommended as it is in beta and incurs a large transaction fee. Continue at your own risk';
|
|
21
|
-
}
|
|
14
|
+
function getDefaultUnstableWarning() {
|
|
15
|
+
return 'Cross-chain transfer of this token is not recommended as it is in beta and incurs a large transaction fee. Continue at your own risk';
|
|
22
16
|
}
|
|
23
17
|
function getSnowBridgeUnstableWarning(originChainInfo) {
|
|
24
18
|
switch (originChainInfo.slug) {
|
|
@@ -62,7 +56,7 @@ export function _getXcmUnstableWarning(originChainInfo, destChainInfo, assetSlug
|
|
|
62
56
|
} else if (_isMythosFromHydrationToMythos(originChainInfo, destChainInfo, assetSlug)) {
|
|
63
57
|
return getMythosFromHydrationToMythosWarning();
|
|
64
58
|
} else {
|
|
65
|
-
return
|
|
59
|
+
return getDefaultUnstableWarning();
|
|
66
60
|
}
|
|
67
61
|
}
|
|
68
62
|
export function _isXcmWithinSameConsensus(originChainInfo, destChainInfo) {
|
|
@@ -88,6 +82,15 @@ export function _isPosBridgeXcm(originChainInfo, destChainInfo) {
|
|
|
88
82
|
export function _isAcrossBridgeXcm(originChainInfo, destChainInfo) {
|
|
89
83
|
return _isAcrossChainBridge(originChainInfo.slug, destChainInfo.slug);
|
|
90
84
|
}
|
|
85
|
+
export function _isBittensorToSubtensorEvmBridge(originChainInfo, destChainInfo) {
|
|
86
|
+
return _isBittensorToSubtensorBridge(originChainInfo.slug, destChainInfo.slug);
|
|
87
|
+
}
|
|
88
|
+
export function _isSubtensorEvmtoBittensorBridge(originChainInfo, destChainInfo) {
|
|
89
|
+
return _isSubtensorToBittensorBridge(originChainInfo.slug, destChainInfo.slug);
|
|
90
|
+
}
|
|
91
|
+
export function _isAssetHubBridgeXcm(originChainInfo, destChainInfo) {
|
|
92
|
+
return originChainInfo.slug === 'statemint' && destChainInfo.slug === 'statemine' || originChainInfo.slug === 'statemine' && destChainInfo.slug === 'statemint';
|
|
93
|
+
}
|
|
91
94
|
// ---------------------------------------------------------------------------------------------------------------------
|
|
92
95
|
|
|
93
96
|
export function _adaptX1Interior(_assetIdentifier, version) {
|
|
@@ -188,6 +188,25 @@ export default class KoniExtension {
|
|
|
188
188
|
private executePendingTx;
|
|
189
189
|
private cancelPendingTx;
|
|
190
190
|
private initMultisigTx;
|
|
191
|
+
private buildExtrinsicFromPayload;
|
|
192
|
+
/**
|
|
193
|
+
* ─────────────────────────────────────────────────────────────
|
|
194
|
+
* prepareMultisigSignRequest
|
|
195
|
+
* ─────────────────────────────────────────────────────────────
|
|
196
|
+
* Called when a dApp sends a signing request to a multisig account.
|
|
197
|
+
* This method wraps the original extrinsic into a multisig.asMulti call so that it can be submitted by one of the signers on behalf of the multisig account.
|
|
198
|
+
*
|
|
199
|
+
* Important:
|
|
200
|
+
* - The original sign request is MUTATED in-place via updateSignRequest.
|
|
201
|
+
* After this method returns, the UI will prompt the signer to sign
|
|
202
|
+
* the wrapped multisig extrinsic, not the original one.
|
|
203
|
+
* - Errors are collected (not thrown) and returned in the response
|
|
204
|
+
* so the UI can display them without crashing.
|
|
205
|
+
* - This method does NOT submit the transaction; it only prepares
|
|
206
|
+
* the payload for signing.
|
|
207
|
+
* ─────────────────────────────────────────────────────────────
|
|
208
|
+
*/
|
|
209
|
+
private prepareMultisigSignRequest;
|
|
191
210
|
private handleSubstrateProxyWrappedTx;
|
|
192
211
|
private parseContractInput;
|
|
193
212
|
private submitTuringStakeCompounding;
|