@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
|
@@ -13,6 +13,7 @@ var _TransactionError = require("@subwallet/extension-base/background/errors/Tra
|
|
|
13
13
|
var _helpers = require("@subwallet/extension-base/background/handlers/helpers");
|
|
14
14
|
var _subscriptions = require("@subwallet/extension-base/background/handlers/subscriptions");
|
|
15
15
|
var _KoniTypes = require("@subwallet/extension-base/background/KoniTypes");
|
|
16
|
+
var _RequestExtrinsicSign = _interopRequireDefault(require("@subwallet/extension-base/background/RequestExtrinsicSign"));
|
|
16
17
|
var _constants = require("@subwallet/extension-base/constants");
|
|
17
18
|
var _transfer = require("@subwallet/extension-base/core/logic-validation/transfer");
|
|
18
19
|
var _xcmParser = require("@subwallet/extension-base/core/substrate/xcm-parser");
|
|
@@ -39,6 +40,7 @@ var _tonTransfer = require("@subwallet/extension-base/services/balance-service/t
|
|
|
39
40
|
var _xcm = require("@subwallet/extension-base/services/balance-service/transfer/xcm");
|
|
40
41
|
var _acrossBridge = require("@subwallet/extension-base/services/balance-service/transfer/xcm/acrossBridge");
|
|
41
42
|
var _availBridge = require("@subwallet/extension-base/services/balance-service/transfer/xcm/availBridge");
|
|
43
|
+
var _nativeTokenBridge = require("@subwallet/extension-base/services/balance-service/transfer/xcm/bittensorBridge/nativeTokenBridge");
|
|
42
44
|
var _polygonBridge = require("@subwallet/extension-base/services/balance-service/transfer/xcm/polygonBridge");
|
|
43
45
|
var _posBridge = require("@subwallet/extension-base/services/balance-service/transfer/xcm/posBridge");
|
|
44
46
|
var _utils5 = require("@subwallet/extension-base/services/balance-service/transfer/xcm/utils");
|
|
@@ -1307,6 +1309,7 @@ class KoniExtension {
|
|
|
1307
1309
|
feeCustom,
|
|
1308
1310
|
feeOption,
|
|
1309
1311
|
from,
|
|
1312
|
+
metadata,
|
|
1310
1313
|
to,
|
|
1311
1314
|
tokenPayFeeSlug,
|
|
1312
1315
|
tokenSlug,
|
|
@@ -1447,7 +1450,8 @@ class KoniExtension {
|
|
|
1447
1450
|
networkKey: chain,
|
|
1448
1451
|
tokenInfo: transferTokenInfo,
|
|
1449
1452
|
to: to,
|
|
1450
|
-
substrateApi
|
|
1453
|
+
substrateApi,
|
|
1454
|
+
metadata
|
|
1451
1455
|
});
|
|
1452
1456
|
if (_constants._SUPPORT_TOKEN_PAY_FEE_GROUP.hydration.includes(chain)) {
|
|
1453
1457
|
var _this$koniState$chain, _substrateApi$api$que;
|
|
@@ -1574,11 +1578,18 @@ class KoniExtension {
|
|
|
1574
1578
|
const isPolygonBridgeTransfer = (0, _polygonBridge._isPolygonChainBridge)(originNetworkKey, destinationNetworkKey);
|
|
1575
1579
|
const isPosBridgeTransfer = (0, _posBridge._isPosChainBridge)(originNetworkKey, destinationNetworkKey);
|
|
1576
1580
|
const isAcrossBridgeTransfer = (0, _acrossBridge._isAcrossChainBridge)(originNetworkKey, destinationNetworkKey);
|
|
1581
|
+
const isBittensorBridgeTransfer = (0, _nativeTokenBridge._isBittensorToSubtensorBridge)(originNetworkKey, destinationNetworkKey);
|
|
1582
|
+
const isSubtensorEvmBridgeTransfer = (0, _nativeTokenBridge._isSubtensorToBittensorBridge)(originNetworkKey, destinationNetworkKey);
|
|
1577
1583
|
const extrinsicType = _KoniTypes.ExtrinsicType.TRANSFER_XCM;
|
|
1578
|
-
const
|
|
1584
|
+
const isSubstrateParaspellXcm = !(isAvailBridgeFromEvm || isAvailBridgeFromAvail || isSnowBridgeEvmTransfer || isPolygonBridgeTransfer || isPosBridgeTransfer || isAcrossBridgeTransfer || isBittensorBridgeTransfer || isSubtensorEvmBridgeTransfer);
|
|
1579
1585
|
const isTransferNative = this.#koniState.getNativeTokenInfo(originNetworkKey).slug === tokenSlug;
|
|
1580
1586
|
const isTransferLocalTokenAndPayThatTokenAsFee = !isTransferNative && tokenSlug === tokenPayFeeSlug;
|
|
1581
1587
|
let xcmFeeDryRun;
|
|
1588
|
+
const xcmDestinationFee = {
|
|
1589
|
+
symbol: (destinationTokenInfo === null || destinationTokenInfo === void 0 ? void 0 : destinationTokenInfo.symbol) || '',
|
|
1590
|
+
decimals: (destinationTokenInfo === null || destinationTokenInfo === void 0 ? void 0 : destinationTokenInfo.decimals) || 0,
|
|
1591
|
+
value: '0'
|
|
1592
|
+
};
|
|
1582
1593
|
let additionalValidator;
|
|
1583
1594
|
let eventsHandler;
|
|
1584
1595
|
if (fromKeyPair && destinationTokenInfo) {
|
|
@@ -1589,6 +1600,9 @@ class KoniExtension {
|
|
|
1589
1600
|
if (isPosBridgeTransfer || isPolygonBridgeTransfer) {
|
|
1590
1601
|
funcCreateExtrinsic = _xcm.createPolygonBridgeExtrinsic;
|
|
1591
1602
|
type = 'evm';
|
|
1603
|
+
} else if (isSubtensorEvmBridgeTransfer) {
|
|
1604
|
+
funcCreateExtrinsic = _xcm.createSubtensorEvmToBittensorExtrinsic;
|
|
1605
|
+
type = 'evm';
|
|
1592
1606
|
} else if (isAcrossBridgeTransfer) {
|
|
1593
1607
|
funcCreateExtrinsic = _xcm.createAcrossBridgeExtrinsic;
|
|
1594
1608
|
type = 'evm';
|
|
@@ -1598,6 +1612,9 @@ class KoniExtension {
|
|
|
1598
1612
|
} else if (isAvailBridgeFromEvm) {
|
|
1599
1613
|
funcCreateExtrinsic = _xcm.createAvailBridgeTxFromEth;
|
|
1600
1614
|
type = 'evm';
|
|
1615
|
+
} else if (isBittensorBridgeTransfer) {
|
|
1616
|
+
funcCreateExtrinsic = _xcm.createBittensorToSubtensorEvmExtrinsic;
|
|
1617
|
+
type = 'substrate';
|
|
1601
1618
|
} else if (isAvailBridgeFromAvail) {
|
|
1602
1619
|
funcCreateExtrinsic = _xcm.createAvailBridgeExtrinsicFromAvail;
|
|
1603
1620
|
type = 'substrate';
|
|
@@ -1618,10 +1635,11 @@ class KoniExtension {
|
|
|
1618
1635
|
evmApi,
|
|
1619
1636
|
feeCustom,
|
|
1620
1637
|
feeOption,
|
|
1621
|
-
feeInfo
|
|
1638
|
+
feeInfo,
|
|
1639
|
+
transferAll
|
|
1622
1640
|
};
|
|
1623
1641
|
extrinsic = await funcCreateExtrinsic(params);
|
|
1624
|
-
if (
|
|
1642
|
+
if (isSubstrateParaspellXcm) {
|
|
1625
1643
|
const xcmFeeInfo = await (0, _utils5.estimateXcmFee)({
|
|
1626
1644
|
fromChainInfo: params.originChain,
|
|
1627
1645
|
fromTokenInfo: params.originTokenInfo,
|
|
@@ -1630,7 +1648,11 @@ class KoniExtension {
|
|
|
1630
1648
|
sender: params.sender,
|
|
1631
1649
|
value: params.sendingValue
|
|
1632
1650
|
});
|
|
1651
|
+
|
|
1652
|
+
// todo: refactor name
|
|
1653
|
+
// todo: check to use full interface to has full AmountData, include symbol, decimal
|
|
1633
1654
|
xcmFeeDryRun = (xcmFeeInfo === null || xcmFeeInfo === void 0 ? void 0 : xcmFeeInfo.origin.fee) || '0';
|
|
1655
|
+
xcmDestinationFee.value = (xcmFeeInfo === null || xcmFeeInfo === void 0 ? void 0 : xcmFeeInfo.destination.fee) || '0';
|
|
1634
1656
|
}
|
|
1635
1657
|
if (isAcrossBridgeTransfer) {
|
|
1636
1658
|
const data = await (0, _acrossBridge.getAcrossQuote)(params);
|
|
@@ -1698,7 +1720,7 @@ class KoniExtension {
|
|
|
1698
1720
|
warning.length && inputTransaction.warnings.push(...warning);
|
|
1699
1721
|
error.length && inputTransaction.errors.push(...error);
|
|
1700
1722
|
}
|
|
1701
|
-
if (
|
|
1723
|
+
if (isSubstrateParaspellXcm) {
|
|
1702
1724
|
const isDryRunSuccess = await (0, _xcm.dryRunXcmExtrinsicV2)(params, false);
|
|
1703
1725
|
if (!isDryRunSuccess) {
|
|
1704
1726
|
inputTransaction.errors.push(new _TransactionError.TransactionError(_types5.BasicTxErrorType.UNABLE_TO_SEND, 'Unable to perform transaction. Select another token or destination chain and try again'));
|
|
@@ -1736,7 +1758,7 @@ class KoniExtension {
|
|
|
1736
1758
|
transaction: extrinsic,
|
|
1737
1759
|
data: inputData,
|
|
1738
1760
|
extrinsicType,
|
|
1739
|
-
chainType: !isSnowBridgeEvmTransfer && !isAvailBridgeFromEvm && !isPolygonBridgeTransfer && !isPosBridgeTransfer && !isAcrossBridgeTransfer ? _KoniTypes.ChainType.SUBSTRATE : _KoniTypes.ChainType.EVM,
|
|
1761
|
+
chainType: !isSnowBridgeEvmTransfer && !isAvailBridgeFromEvm && !isPolygonBridgeTransfer && !isPosBridgeTransfer && !isAcrossBridgeTransfer && !isSubtensorEvmBridgeTransfer ? _KoniTypes.ChainType.SUBSTRATE : _KoniTypes.ChainType.EVM,
|
|
1740
1762
|
transferNativeAmount: (0, _utils6._isNativeToken)(originTokenInfo) ? value : '0',
|
|
1741
1763
|
ignoreWarnings,
|
|
1742
1764
|
tokenPayFeeSlug,
|
|
@@ -1744,6 +1766,7 @@ class KoniExtension {
|
|
|
1744
1766
|
isTransferLocalTokenAndPayThatTokenAsFee,
|
|
1745
1767
|
isPassConfirmation,
|
|
1746
1768
|
xcmFeeDryRun,
|
|
1769
|
+
xcmDestinationFee,
|
|
1747
1770
|
errors,
|
|
1748
1771
|
additionalValidator: additionalValidator,
|
|
1749
1772
|
eventsHandler: eventsHandler
|
|
@@ -2215,6 +2238,7 @@ class KoniExtension {
|
|
|
2215
2238
|
destChain: _destChain,
|
|
2216
2239
|
feeCustom,
|
|
2217
2240
|
feeOption,
|
|
2241
|
+
metadata,
|
|
2218
2242
|
to,
|
|
2219
2243
|
token,
|
|
2220
2244
|
tokenPayFeeSlug,
|
|
@@ -2256,7 +2280,8 @@ class KoniExtension {
|
|
|
2256
2280
|
isTransferLocalTokenAndPayThatTokenAsFee,
|
|
2257
2281
|
isTransferNativeTokenAndPayLocalTokenAsFee,
|
|
2258
2282
|
nativeToken,
|
|
2259
|
-
transferAll
|
|
2283
|
+
transferAll,
|
|
2284
|
+
metadata
|
|
2260
2285
|
};
|
|
2261
2286
|
const subscription = (0, _rxjs.combineLatest)({
|
|
2262
2287
|
freeBalance: freeBalanceSubject,
|
|
@@ -3221,8 +3246,134 @@ class KoniExtension {
|
|
|
3221
3246
|
});
|
|
3222
3247
|
}
|
|
3223
3248
|
|
|
3249
|
+
// Helper for prepareMultisigSignRequest: reconstruct the original extrinsic from the payload's method & args
|
|
3250
|
+
async buildExtrinsicFromPayload(chain, payload) {
|
|
3251
|
+
const substrateApi = await this.#koniState.chainService.getSubstrateApi(chain).isReady;
|
|
3252
|
+
const call = substrateApi.api.createType('Call', payload.method);
|
|
3253
|
+
const {
|
|
3254
|
+
method,
|
|
3255
|
+
section
|
|
3256
|
+
} = substrateApi.api.registry.findMetaCall(call.callIndex);
|
|
3257
|
+
const extrinsic = substrateApi.api.tx[section][method](...call.args);
|
|
3258
|
+
return {
|
|
3259
|
+
substrateApi,
|
|
3260
|
+
extrinsic,
|
|
3261
|
+
call
|
|
3262
|
+
};
|
|
3263
|
+
}
|
|
3264
|
+
|
|
3265
|
+
/**
|
|
3266
|
+
* ─────────────────────────────────────────────────────────────
|
|
3267
|
+
* prepareMultisigSignRequest
|
|
3268
|
+
* ─────────────────────────────────────────────────────────────
|
|
3269
|
+
* Called when a dApp sends a signing request to a multisig account.
|
|
3270
|
+
* 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.
|
|
3271
|
+
*
|
|
3272
|
+
* Important:
|
|
3273
|
+
* - The original sign request is MUTATED in-place via updateSignRequest.
|
|
3274
|
+
* After this method returns, the UI will prompt the signer to sign
|
|
3275
|
+
* the wrapped multisig extrinsic, not the original one.
|
|
3276
|
+
* - Errors are collected (not thrown) and returned in the response
|
|
3277
|
+
* so the UI can display them without crashing.
|
|
3278
|
+
* - This method does NOT submit the transaction; it only prepares
|
|
3279
|
+
* the payload for signing.
|
|
3280
|
+
* ─────────────────────────────────────────────────────────────
|
|
3281
|
+
*/
|
|
3282
|
+
async prepareMultisigSignRequest(request) {
|
|
3283
|
+
const {
|
|
3284
|
+
id,
|
|
3285
|
+
signer
|
|
3286
|
+
} = request;
|
|
3287
|
+
|
|
3288
|
+
// ── Step 1: Retrieve the pending sign request from the queue ──
|
|
3289
|
+
const queued = this.#koniState.getSignRequest(id);
|
|
3290
|
+
(0, _util.assert)(queued, (0, _i18next.t)('bg.koni.handler.Extension.unableToProceed'));
|
|
3291
|
+
const errors = [];
|
|
3292
|
+
let submittedCallData = '';
|
|
3293
|
+
let callData = '';
|
|
3294
|
+
let depositAmount = '';
|
|
3295
|
+
let networkFee = '';
|
|
3296
|
+
const payload = queued.request.payload;
|
|
3297
|
+
|
|
3298
|
+
// ── Step 2: Validate payload format ──
|
|
3299
|
+
// Only JSON payloads (SignerPayloadJSON) contain the structured fields
|
|
3300
|
+
// (genesisHash, method, etc.) needed to reconstruct the extrinsic.
|
|
3301
|
+
// Raw (bytes) payloads cannot be wrapped into a multisig call.
|
|
3302
|
+
if (!isJsonPayload(payload)) {
|
|
3303
|
+
errors.push(new _TransactionError.TransactionError(_types5.BasicTxErrorType.INVALID_PARAMS, (0, _i18next.t)('bg.koni.handler.Extension.unableToProceed')));
|
|
3304
|
+
} else {
|
|
3305
|
+
var _chainInfo$substrateI;
|
|
3306
|
+
// ── Step 3: Resolve chain from genesisHash & check multisig support ──
|
|
3307
|
+
callData = payload.method;
|
|
3308
|
+
const [chain, chainInfo] = this.#koniState.findNetworkKeyByGenesisHash(payload.genesisHash);
|
|
3309
|
+
if (!chain || !(chainInfo !== null && chainInfo !== void 0 && (_chainInfo$substrateI = chainInfo.substrateInfo) !== null && _chainInfo$substrateI !== void 0 && _chainInfo$substrateI.supportMultisig)) {
|
|
3310
|
+
errors.push(new _TransactionError.TransactionError(_types5.BasicTxErrorType.UNSUPPORTED, (0, _i18next.t)('bg.koni.handler.Extension.unableToProceed')));
|
|
3311
|
+
} else {
|
|
3312
|
+
// ── Step 4: Look up multisig account configuration ──
|
|
3313
|
+
// queued.address is the multisig account address (the "from" in the original request).
|
|
3314
|
+
// We need its threshold and signers list to construct the asMulti call.
|
|
3315
|
+
const accountProxy = this.#koniState.keyringService.context.getMultisigAccountByAddress(queued.address);
|
|
3316
|
+
if (!accountProxy) {
|
|
3317
|
+
errors.push(new _TransactionError.TransactionError(_types5.BasicTxErrorType.INTERNAL_ERROR, (0, _i18next.t)('bg.koni.handler.Extension.unableToProceed')));
|
|
3318
|
+
} else {
|
|
3319
|
+
const threshold = accountProxy.accounts[0].threshold;
|
|
3320
|
+
const signers = accountProxy.accounts[0].signers;
|
|
3321
|
+
|
|
3322
|
+
// ── Step 5: Rebuild the original extrinsic from payload call data ──
|
|
3323
|
+
const {
|
|
3324
|
+
extrinsic: originExtrinsic,
|
|
3325
|
+
substrateApi
|
|
3326
|
+
} = await this.buildExtrinsicFromPayload(chain, payload);
|
|
3327
|
+
|
|
3328
|
+
// ── Step 6: Wrap into multisig initiation extrinsic ──
|
|
3329
|
+
const multisigExtrinsic = (0, _utils8.createInitMultisigExtrinsic)(substrateApi.api, threshold, signers, signer, originExtrinsic);
|
|
3330
|
+
|
|
3331
|
+
// ── Step 7: Estimate fee & calculate multisig deposit ──
|
|
3332
|
+
submittedCallData = multisigExtrinsic.method.toHex();
|
|
3333
|
+
networkFee = (await multisigExtrinsic.paymentInfo(signer)).partialFee.toString();
|
|
3334
|
+
const depositBase = substrateApi.api.consts.multisig.depositBase.toString();
|
|
3335
|
+
const depositFactor = substrateApi.api.consts.multisig.depositFactor.toString();
|
|
3336
|
+
depositAmount = (0, _utils8.calcDepositAmount)(depositBase, threshold, depositFactor);
|
|
3337
|
+
|
|
3338
|
+
// ── Step 8: Validate signer has sufficient balance ──
|
|
3339
|
+
const signerBalance = await this.getAddressTransferableBalance({
|
|
3340
|
+
address: signer,
|
|
3341
|
+
networkKey: chain,
|
|
3342
|
+
token: this.#koniState.chainService.getNativeTokenInfo(chain).slug,
|
|
3343
|
+
extrinsicType: _KoniTypes.ExtrinsicType.TRANSFER_TOKEN
|
|
3344
|
+
});
|
|
3345
|
+
const requiredBalance = new _bignumber.default(depositAmount).plus(networkFee);
|
|
3346
|
+
if (new _bignumber.default(signerBalance.value).lt(requiredBalance)) {
|
|
3347
|
+
errors.push(new _TransactionError.TransactionError(_types5.BasicTxErrorType.NOT_ENOUGH_BALANCE, (0, _i18next.t)('bg.koni.handler.Extension.notEnoughBalanceForMultisigDepositAndFee')));
|
|
3348
|
+
}
|
|
3349
|
+
|
|
3350
|
+
// ── Step 9: Replace the original sign request with the wrapped payload ──
|
|
3351
|
+
// After this, the signing UI will show the multisig extrinsic instead of
|
|
3352
|
+
// the original one. The signer's address and fresh nonce are used so
|
|
3353
|
+
// the transaction is submitted from the signer (not the multisig account).
|
|
3354
|
+
const nonce = await substrateApi.api.rpc.system.accountNextIndex(signer);
|
|
3355
|
+
const wrappedPayload = {
|
|
3356
|
+
...payload,
|
|
3357
|
+
address: signer,
|
|
3358
|
+
nonce: nonce.toHex(),
|
|
3359
|
+
method: multisigExtrinsic.method.toHex()
|
|
3360
|
+
};
|
|
3361
|
+
this.#koniState.requestService.updateSignRequest(id, new _RequestExtrinsicSign.default(wrappedPayload), signer);
|
|
3362
|
+
}
|
|
3363
|
+
}
|
|
3364
|
+
}
|
|
3365
|
+
return {
|
|
3366
|
+
submittedCallData: submittedCallData,
|
|
3367
|
+
callData: callData,
|
|
3368
|
+
depositAmount,
|
|
3369
|
+
networkFee,
|
|
3370
|
+
errors
|
|
3371
|
+
};
|
|
3372
|
+
}
|
|
3373
|
+
|
|
3224
3374
|
// Substrate Proxy Account
|
|
3225
3375
|
async handleSubstrateProxyWrappedTx(request) {
|
|
3376
|
+
var _originTransaction;
|
|
3226
3377
|
const {
|
|
3227
3378
|
chain,
|
|
3228
3379
|
proxyMetadata,
|
|
@@ -3239,8 +3390,8 @@ class KoniExtension {
|
|
|
3239
3390
|
* ─────────────────────────────
|
|
3240
3391
|
*/
|
|
3241
3392
|
const substrateApi = await this.#koniState.chainService.getSubstrateApi(chain).isReady;
|
|
3242
|
-
|
|
3243
|
-
const extrinsicOriginTransaction = originTransaction === null ||
|
|
3393
|
+
let originTransaction = this.#koniState.transactionService.getTransaction(transactionId);
|
|
3394
|
+
const extrinsicOriginTransaction = (_originTransaction = originTransaction) === null || _originTransaction === void 0 ? void 0 : _originTransaction.transaction;
|
|
3244
3395
|
const callData = extrinsicOriginTransaction.method.toHex();
|
|
3245
3396
|
const decodedCallData = (0, _utils8.decodeCallData)({
|
|
3246
3397
|
api: substrateApi.api,
|
|
@@ -3312,7 +3463,8 @@ class KoniExtension {
|
|
|
3312
3463
|
* update history transaction accordingly.
|
|
3313
3464
|
*/
|
|
3314
3465
|
const eventsHandler = eventEmitter => {
|
|
3315
|
-
|
|
3466
|
+
var _originTransaction2;
|
|
3467
|
+
if (!((_originTransaction2 = originTransaction) !== null && _originTransaction2 !== void 0 && _originTransaction2.emitterTransaction)) {
|
|
3316
3468
|
return;
|
|
3317
3469
|
}
|
|
3318
3470
|
const originEmitter = originTransaction.emitterTransaction;
|
|
@@ -3364,6 +3516,52 @@ class KoniExtension {
|
|
|
3364
3516
|
* ─────────────────────────────
|
|
3365
3517
|
*/
|
|
3366
3518
|
|
|
3519
|
+
const originTransferData = originTransaction.data;
|
|
3520
|
+
const isTransferAllBalance = originTransaction.extrinsicType === _KoniTypes.ExtrinsicType.TRANSFER_BALANCE && !!(originTransferData !== null && originTransferData !== void 0 && originTransferData.transferAll);
|
|
3521
|
+
const maxTransferableWithoutFee = originTransferData === null || originTransferData === void 0 ? void 0 : originTransferData.maxTransferableWithoutFee;
|
|
3522
|
+
const maxTransferable = originTransferData === null || originTransferData === void 0 ? void 0 : originTransferData.maxTransferable;
|
|
3523
|
+
if (isTransferAllBalance && !!maxTransferableWithoutFee && !!maxTransferable) {
|
|
3524
|
+
if (isSignerProxiedAccount) {
|
|
3525
|
+
this.#koniState.transactionService.updateTransaction(transactionId, {
|
|
3526
|
+
data: {
|
|
3527
|
+
...originTransferData,
|
|
3528
|
+
value: maxTransferable,
|
|
3529
|
+
transferNativeAmount: maxTransferable
|
|
3530
|
+
}
|
|
3531
|
+
});
|
|
3532
|
+
} else {
|
|
3533
|
+
this.#koniState.transactionService.updateTransaction(transactionId, {
|
|
3534
|
+
data: {
|
|
3535
|
+
...originTransferData,
|
|
3536
|
+
value: maxTransferableWithoutFee,
|
|
3537
|
+
transferNativeAmount: maxTransferableWithoutFee
|
|
3538
|
+
}
|
|
3539
|
+
});
|
|
3540
|
+
}
|
|
3541
|
+
|
|
3542
|
+
// Refresh originTransaction after update
|
|
3543
|
+
originTransaction = this.#koniState.transactionService.getTransaction(transactionId);
|
|
3544
|
+
}
|
|
3545
|
+
|
|
3546
|
+
// If signer is the proxied account itself, the original transaction will be signed and sent directly without proxy execution.
|
|
3547
|
+
if (isSignerProxiedAccount) {
|
|
3548
|
+
const restData = Object.fromEntries(Object.entries(originTransaction.data || {}).filter(_ref50 => {
|
|
3549
|
+
let [key] = _ref50;
|
|
3550
|
+
return key !== 'signer';
|
|
3551
|
+
}));
|
|
3552
|
+
this.#koniState.transactionService.updateTransaction(transactionId, {
|
|
3553
|
+
data: restData
|
|
3554
|
+
});
|
|
3555
|
+
} else {
|
|
3556
|
+
this.#koniState.transactionService.updateTransaction(transactionId, {
|
|
3557
|
+
data: {
|
|
3558
|
+
...originTransaction.data,
|
|
3559
|
+
signer
|
|
3560
|
+
}
|
|
3561
|
+
});
|
|
3562
|
+
}
|
|
3563
|
+
originTransaction = this.#koniState.transactionService.getTransaction(transactionId);
|
|
3564
|
+
|
|
3367
3565
|
// Case 1: signer === proxied address → handle original transaction
|
|
3368
3566
|
if (isSignerProxiedAccount) {
|
|
3369
3567
|
let callDataFinal = callData;
|
|
@@ -3411,6 +3609,8 @@ class KoniExtension {
|
|
|
3411
3609
|
decodedCallData,
|
|
3412
3610
|
submittedCallData: substrateProxyExtrinsic.toHex(),
|
|
3413
3611
|
callData,
|
|
3612
|
+
signer,
|
|
3613
|
+
signerAddress: signer,
|
|
3414
3614
|
networkFee
|
|
3415
3615
|
},
|
|
3416
3616
|
wrappingStatus: _types4.SubstrateTransactionWrappingStatus.WRAP_RESULT,
|
|
@@ -3420,12 +3620,12 @@ class KoniExtension {
|
|
|
3420
3620
|
}
|
|
3421
3621
|
|
|
3422
3622
|
// EVM Transaction
|
|
3423
|
-
async parseContractInput(
|
|
3623
|
+
async parseContractInput(_ref51) {
|
|
3424
3624
|
let {
|
|
3425
3625
|
chainId,
|
|
3426
3626
|
contract,
|
|
3427
3627
|
data
|
|
3428
|
-
} =
|
|
3628
|
+
} = _ref51;
|
|
3429
3629
|
const network = this.getNetworkJsonByChainId(chainId);
|
|
3430
3630
|
return await (0, _parseTransaction2.parseContractInput)(data, contract, network);
|
|
3431
3631
|
}
|
|
@@ -3525,10 +3725,10 @@ class KoniExtension {
|
|
|
3525
3725
|
|
|
3526
3726
|
// Unlock wallet
|
|
3527
3727
|
|
|
3528
|
-
keyringUnlock(
|
|
3728
|
+
keyringUnlock(_ref52) {
|
|
3529
3729
|
let {
|
|
3530
3730
|
password
|
|
3531
|
-
} =
|
|
3731
|
+
} = _ref52;
|
|
3532
3732
|
try {
|
|
3533
3733
|
_uiKeyring.keyring.unlockKeyring(password);
|
|
3534
3734
|
// this.#koniState.initMantaPay(password)
|
|
@@ -3559,11 +3759,11 @@ class KoniExtension {
|
|
|
3559
3759
|
|
|
3560
3760
|
// Export mnemonic
|
|
3561
3761
|
|
|
3562
|
-
keyringExportMnemonic(
|
|
3762
|
+
keyringExportMnemonic(_ref53) {
|
|
3563
3763
|
let {
|
|
3564
3764
|
address,
|
|
3565
3765
|
password
|
|
3566
|
-
} =
|
|
3766
|
+
} = _ref53;
|
|
3567
3767
|
const pair = _uiKeyring.keyring.getPair(address);
|
|
3568
3768
|
const result = pair.exportMnemonic(password);
|
|
3569
3769
|
return {
|
|
@@ -3573,10 +3773,10 @@ class KoniExtension {
|
|
|
3573
3773
|
|
|
3574
3774
|
// Reset wallet
|
|
3575
3775
|
|
|
3576
|
-
async resetWallet(
|
|
3776
|
+
async resetWallet(_ref54) {
|
|
3577
3777
|
let {
|
|
3578
3778
|
resetAll
|
|
3579
|
-
} =
|
|
3779
|
+
} = _ref54;
|
|
3580
3780
|
try {
|
|
3581
3781
|
await this.#koniState.resetWallet(resetAll);
|
|
3582
3782
|
return {
|
|
@@ -3592,10 +3792,10 @@ class KoniExtension {
|
|
|
3592
3792
|
}
|
|
3593
3793
|
|
|
3594
3794
|
// Signing substrate request
|
|
3595
|
-
async signingApprovePasswordV2(
|
|
3795
|
+
async signingApprovePasswordV2(_ref55) {
|
|
3596
3796
|
let {
|
|
3597
3797
|
id
|
|
3598
|
-
} =
|
|
3798
|
+
} = _ref55;
|
|
3599
3799
|
const queued = this.#koniState.getSignRequest(id);
|
|
3600
3800
|
(0, _util.assert)(queued, (0, _i18next.t)('bg.koni.handler.Extension.unableToProceed'));
|
|
3601
3801
|
const {
|
|
@@ -3603,7 +3803,8 @@ class KoniExtension {
|
|
|
3603
3803
|
request,
|
|
3604
3804
|
resolve
|
|
3605
3805
|
} = queued;
|
|
3606
|
-
const
|
|
3806
|
+
const signingAddress = queued.signerAddress || queued.address;
|
|
3807
|
+
const pair = _uiKeyring.keyring.getPair(signingAddress);
|
|
3607
3808
|
|
|
3608
3809
|
// unlike queued.account.address the following
|
|
3609
3810
|
// address is encoded with the default prefix
|
|
@@ -3633,10 +3834,26 @@ class KoniExtension {
|
|
|
3633
3834
|
}
|
|
3634
3835
|
}
|
|
3635
3836
|
const result = request.sign(registry, pair);
|
|
3837
|
+
let signedTransaction;
|
|
3838
|
+
if (queued.signerAddress && isJsonPayload(payload)) {
|
|
3839
|
+
try {
|
|
3840
|
+
const [chain] = this.#koniState.findNetworkKeyByGenesisHash(payload.genesisHash);
|
|
3841
|
+
if (chain) {
|
|
3842
|
+
const {
|
|
3843
|
+
extrinsic
|
|
3844
|
+
} = await this.buildExtrinsicFromPayload(chain, payload);
|
|
3845
|
+
extrinsic.addSignature(payload.address, result.signature, payload);
|
|
3846
|
+
signedTransaction = extrinsic.toHex();
|
|
3847
|
+
}
|
|
3848
|
+
} catch (e) {
|
|
3849
|
+
console.error('Failed to build signed transaction for wrapped multisig signing', e);
|
|
3850
|
+
}
|
|
3851
|
+
}
|
|
3636
3852
|
resolve({
|
|
3637
3853
|
id,
|
|
3638
3854
|
// In case evm chain, must be cut 2 character after 0x
|
|
3639
|
-
signature: result.signature
|
|
3855
|
+
signature: result.signature,
|
|
3856
|
+
signedTransaction
|
|
3640
3857
|
});
|
|
3641
3858
|
if (this.#alwaysLock) {
|
|
3642
3859
|
this.keyringLock();
|
|
@@ -3754,10 +3971,10 @@ class KoniExtension {
|
|
|
3754
3971
|
getSupportedSmartContractTypes() {
|
|
3755
3972
|
return this.#koniState.getSupportedSmartContractTypes();
|
|
3756
3973
|
}
|
|
3757
|
-
getTransaction(
|
|
3974
|
+
getTransaction(_ref56) {
|
|
3758
3975
|
let {
|
|
3759
3976
|
id
|
|
3760
|
-
} =
|
|
3977
|
+
} = _ref56;
|
|
3761
3978
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
3762
3979
|
const {
|
|
3763
3980
|
transaction,
|
|
@@ -3768,8 +3985,8 @@ class KoniExtension {
|
|
|
3768
3985
|
async subscribeTransactions(id, port) {
|
|
3769
3986
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
3770
3987
|
function convertRs(rs, processMap) {
|
|
3771
|
-
return Object.fromEntries(Object.entries(rs).map(
|
|
3772
|
-
let [key, value] =
|
|
3988
|
+
return Object.fromEntries(Object.entries(rs).map(_ref57 => {
|
|
3989
|
+
let [key, value] = _ref57;
|
|
3773
3990
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
3774
3991
|
const {
|
|
3775
3992
|
additionalValidator,
|
|
@@ -3795,11 +4012,11 @@ class KoniExtension {
|
|
|
3795
4012
|
const subscription = (0, _rxjs.combineLatest)({
|
|
3796
4013
|
transactions: transactionsObservable,
|
|
3797
4014
|
processMap: processTransactionObservable
|
|
3798
|
-
}).subscribe(
|
|
4015
|
+
}).subscribe(_ref58 => {
|
|
3799
4016
|
let {
|
|
3800
4017
|
processMap,
|
|
3801
4018
|
transactions
|
|
3802
|
-
} =
|
|
4019
|
+
} = _ref58;
|
|
3803
4020
|
cb(convertRs(transactions, processMap));
|
|
3804
4021
|
});
|
|
3805
4022
|
port.onDisconnect.addListener(() => {
|
|
@@ -3820,10 +4037,10 @@ class KoniExtension {
|
|
|
3820
4037
|
});
|
|
3821
4038
|
return notificationSubject.value;
|
|
3822
4039
|
}
|
|
3823
|
-
async reloadCron(
|
|
4040
|
+
async reloadCron(_ref59) {
|
|
3824
4041
|
let {
|
|
3825
4042
|
data
|
|
3826
|
-
} =
|
|
4043
|
+
} = _ref59;
|
|
3827
4044
|
if (data === 'nft') {
|
|
3828
4045
|
return await this.#koniState.reloadNft();
|
|
3829
4046
|
} else if (data === 'staking') {
|
|
@@ -3864,10 +4081,10 @@ class KoniExtension {
|
|
|
3864
4081
|
}
|
|
3865
4082
|
|
|
3866
4083
|
// Phishing detect
|
|
3867
|
-
async passPhishingPage(
|
|
4084
|
+
async passPhishingPage(_ref60) {
|
|
3868
4085
|
let {
|
|
3869
4086
|
url
|
|
3870
|
-
} =
|
|
4087
|
+
} = _ref60;
|
|
3871
4088
|
return await this.#koniState.approvePassPhishingPage(url);
|
|
3872
4089
|
}
|
|
3873
4090
|
|
|
@@ -3884,10 +4101,10 @@ class KoniExtension {
|
|
|
3884
4101
|
this.#koniState.saveEnvConfig('osConfig', request.osConfig);
|
|
3885
4102
|
return true;
|
|
3886
4103
|
}
|
|
3887
|
-
async saveSubscanApiKey(
|
|
4104
|
+
async saveSubscanApiKey(_ref61) {
|
|
3888
4105
|
let {
|
|
3889
4106
|
apiKey
|
|
3890
|
-
} =
|
|
4107
|
+
} = _ref61;
|
|
3891
4108
|
return await this.#koniState.saveSubscanApiKey(apiKey);
|
|
3892
4109
|
}
|
|
3893
4110
|
async getSubscanApiKey() {
|
|
@@ -3897,10 +4114,10 @@ class KoniExtension {
|
|
|
3897
4114
|
/// Wallet connect
|
|
3898
4115
|
|
|
3899
4116
|
// Connect
|
|
3900
|
-
async connectWalletConnect(
|
|
4117
|
+
async connectWalletConnect(_ref62) {
|
|
3901
4118
|
let {
|
|
3902
4119
|
uri
|
|
3903
|
-
} =
|
|
4120
|
+
} = _ref62;
|
|
3904
4121
|
await this.#koniState.walletConnectService.connect(uri);
|
|
3905
4122
|
return true;
|
|
3906
4123
|
}
|
|
@@ -3913,11 +4130,11 @@ class KoniExtension {
|
|
|
3913
4130
|
});
|
|
3914
4131
|
return this.#koniState.requestService.allConnectWCRequests;
|
|
3915
4132
|
}
|
|
3916
|
-
async approveWalletConnectSession(
|
|
4133
|
+
async approveWalletConnectSession(_ref63) {
|
|
3917
4134
|
let {
|
|
3918
4135
|
accounts: selectedAccounts,
|
|
3919
4136
|
id
|
|
3920
|
-
} =
|
|
4137
|
+
} = _ref63;
|
|
3921
4138
|
const request = this.#koniState.requestService.getConnectWCRequest(id);
|
|
3922
4139
|
if ((0, _helpers2.isProposalExpired)(request.request.params)) {
|
|
3923
4140
|
throw new Error('The proposal has been expired');
|
|
@@ -3929,8 +4146,8 @@ class KoniExtension {
|
|
|
3929
4146
|
const availableNamespaces = {};
|
|
3930
4147
|
const namespaces = {};
|
|
3931
4148
|
const chainInfoMap = this.#koniState.getChainInfoMap();
|
|
3932
|
-
Object.entries(requiredNamespaces).forEach(
|
|
3933
|
-
let [key, namespace] =
|
|
4149
|
+
Object.entries(requiredNamespaces).forEach(_ref64 => {
|
|
4150
|
+
let [key, namespace] = _ref64;
|
|
3934
4151
|
if ((0, _helpers2.isSupportWalletConnectNamespace)(key)) {
|
|
3935
4152
|
if (namespace.chains) {
|
|
3936
4153
|
const unSupportChains = namespace.chains.filter(chain => !(0, _helpers2.isSupportWalletConnectChain)(chain, chainInfoMap));
|
|
@@ -3943,8 +4160,8 @@ class KoniExtension {
|
|
|
3943
4160
|
throw new Error((0, _utils1.getSdkError)('UNSUPPORTED_NAMESPACE_KEY').message + ' ' + key);
|
|
3944
4161
|
}
|
|
3945
4162
|
});
|
|
3946
|
-
Object.entries(optionalNamespaces).forEach(
|
|
3947
|
-
let [key, namespace] =
|
|
4163
|
+
Object.entries(optionalNamespaces).forEach(_ref65 => {
|
|
4164
|
+
let [key, namespace] = _ref65;
|
|
3948
4165
|
if ((0, _helpers2.isSupportWalletConnectNamespace)(key)) {
|
|
3949
4166
|
if (namespace.chains) {
|
|
3950
4167
|
const supportChains = namespace.chains.filter(chain => (0, _helpers2.isSupportWalletConnectChain)(chain, chainInfoMap)) || [];
|
|
@@ -3968,8 +4185,8 @@ class KoniExtension {
|
|
|
3968
4185
|
}
|
|
3969
4186
|
}
|
|
3970
4187
|
});
|
|
3971
|
-
Object.entries(availableNamespaces).forEach(
|
|
3972
|
-
let [key, namespace] =
|
|
4188
|
+
Object.entries(availableNamespaces).forEach(_ref66 => {
|
|
4189
|
+
let [key, namespace] = _ref66;
|
|
3973
4190
|
if (namespace.chains) {
|
|
3974
4191
|
const accounts = selectedAccounts.filter(address => {
|
|
3975
4192
|
const [_namespace] = address.split(':');
|
|
@@ -3993,10 +4210,10 @@ class KoniExtension {
|
|
|
3993
4210
|
request.resolve();
|
|
3994
4211
|
return true;
|
|
3995
4212
|
}
|
|
3996
|
-
async rejectWalletConnectSession(
|
|
4213
|
+
async rejectWalletConnectSession(_ref67) {
|
|
3997
4214
|
let {
|
|
3998
4215
|
id
|
|
3999
|
-
} =
|
|
4216
|
+
} = _ref67;
|
|
4000
4217
|
const request = this.#koniState.requestService.getConnectWCRequest(id);
|
|
4001
4218
|
const wcId = request.request.id;
|
|
4002
4219
|
if ((0, _helpers2.isProposalExpired)(request.request.params)) {
|
|
@@ -4018,10 +4235,10 @@ class KoniExtension {
|
|
|
4018
4235
|
});
|
|
4019
4236
|
return this.#koniState.walletConnectService.sessions;
|
|
4020
4237
|
}
|
|
4021
|
-
async disconnectWalletConnectSession(
|
|
4238
|
+
async disconnectWalletConnectSession(_ref68) {
|
|
4022
4239
|
let {
|
|
4023
4240
|
topic
|
|
4024
|
-
} =
|
|
4241
|
+
} = _ref68;
|
|
4025
4242
|
await this.#koniState.walletConnectService.disconnect(topic);
|
|
4026
4243
|
return true;
|
|
4027
4244
|
}
|
|
@@ -4034,18 +4251,18 @@ class KoniExtension {
|
|
|
4034
4251
|
});
|
|
4035
4252
|
return this.#koniState.requestService.allNotSupportWCRequests;
|
|
4036
4253
|
}
|
|
4037
|
-
approveWalletConnectNotSupport(
|
|
4254
|
+
approveWalletConnectNotSupport(_ref69) {
|
|
4038
4255
|
let {
|
|
4039
4256
|
id
|
|
4040
|
-
} =
|
|
4257
|
+
} = _ref69;
|
|
4041
4258
|
const request = this.#koniState.requestService.getNotSupportWCRequest(id);
|
|
4042
4259
|
request.resolve();
|
|
4043
4260
|
return true;
|
|
4044
4261
|
}
|
|
4045
|
-
rejectWalletConnectNotSupport(
|
|
4262
|
+
rejectWalletConnectNotSupport(_ref70) {
|
|
4046
4263
|
let {
|
|
4047
4264
|
id
|
|
4048
|
-
} =
|
|
4265
|
+
} = _ref70;
|
|
4049
4266
|
const request = this.#koniState.requestService.getNotSupportWCRequest(id);
|
|
4050
4267
|
request.reject(new Error('USER_REJECTED'));
|
|
4051
4268
|
return true;
|
|
@@ -4053,11 +4270,11 @@ class KoniExtension {
|
|
|
4053
4270
|
|
|
4054
4271
|
/// Manta
|
|
4055
4272
|
|
|
4056
|
-
async enableMantaPay(
|
|
4273
|
+
async enableMantaPay(_ref71) {
|
|
4057
4274
|
let {
|
|
4058
4275
|
address,
|
|
4059
4276
|
password
|
|
4060
|
-
} =
|
|
4277
|
+
} = _ref71;
|
|
4061
4278
|
// always takes the current account
|
|
4062
4279
|
function timeout() {
|
|
4063
4280
|
return new Promise(resolve => setTimeout(resolve, 1500));
|
|
@@ -4147,11 +4364,11 @@ class KoniExtension {
|
|
|
4147
4364
|
async disableMantaPay(address) {
|
|
4148
4365
|
return this.#koniState.disableMantaPay(address);
|
|
4149
4366
|
}
|
|
4150
|
-
async isTonBounceableAddress(
|
|
4367
|
+
async isTonBounceableAddress(_ref72) {
|
|
4151
4368
|
let {
|
|
4152
4369
|
address,
|
|
4153
4370
|
chain
|
|
4154
|
-
} =
|
|
4371
|
+
} = _ref72;
|
|
4155
4372
|
try {
|
|
4156
4373
|
const tonApi = this.#koniState.getTonApi(chain);
|
|
4157
4374
|
const state = await tonApi.getAccountState(address);
|
|
@@ -4197,10 +4414,10 @@ class KoniExtension {
|
|
|
4197
4414
|
|
|
4198
4415
|
/* Metadata */
|
|
4199
4416
|
|
|
4200
|
-
async findRawMetadata(
|
|
4417
|
+
async findRawMetadata(_ref73) {
|
|
4201
4418
|
let {
|
|
4202
4419
|
genesisHash
|
|
4203
|
-
} =
|
|
4420
|
+
} = _ref73;
|
|
4204
4421
|
const {
|
|
4205
4422
|
metadata,
|
|
4206
4423
|
specVersion,
|
|
@@ -4214,20 +4431,20 @@ class KoniExtension {
|
|
|
4214
4431
|
userExtensions
|
|
4215
4432
|
};
|
|
4216
4433
|
}
|
|
4217
|
-
async calculateMetadataHash(
|
|
4434
|
+
async calculateMetadataHash(_ref74) {
|
|
4218
4435
|
let {
|
|
4219
4436
|
chain
|
|
4220
|
-
} =
|
|
4437
|
+
} = _ref74;
|
|
4221
4438
|
const hash = await this.#koniState.calculateMetadataHash(chain);
|
|
4222
4439
|
return {
|
|
4223
4440
|
metadataHash: hash || ''
|
|
4224
4441
|
};
|
|
4225
4442
|
}
|
|
4226
|
-
async shortenMetadata(
|
|
4443
|
+
async shortenMetadata(_ref75) {
|
|
4227
4444
|
let {
|
|
4228
4445
|
chain,
|
|
4229
4446
|
txBlob
|
|
4230
|
-
} =
|
|
4447
|
+
} = _ref75;
|
|
4231
4448
|
const shorten = await this.#koniState.shortenMetadata(chain, txBlob);
|
|
4232
4449
|
return {
|
|
4233
4450
|
txMetadata: shorten || ''
|
|
@@ -4418,7 +4635,8 @@ class KoniExtension {
|
|
|
4418
4635
|
errorOnTimeOut,
|
|
4419
4636
|
...this.createPassConfirmationParams(isPassConfirmation),
|
|
4420
4637
|
eventsHandler,
|
|
4421
|
-
step
|
|
4638
|
+
step,
|
|
4639
|
+
xcmFeeDryRun: extrinsicType === _KoniTypes.ExtrinsicType.TRANSFER_XCM ? submitData.xcmStepFee : undefined
|
|
4422
4640
|
});
|
|
4423
4641
|
}
|
|
4424
4642
|
async handleYieldLeave(params) {
|
|
@@ -4622,18 +4840,18 @@ class KoniExtension {
|
|
|
4622
4840
|
}
|
|
4623
4841
|
/* Campaign */
|
|
4624
4842
|
|
|
4625
|
-
unlockDotCheckCanMint(
|
|
4843
|
+
unlockDotCheckCanMint(_ref76) {
|
|
4626
4844
|
let {
|
|
4627
4845
|
address,
|
|
4628
4846
|
network,
|
|
4629
4847
|
slug
|
|
4630
|
-
} =
|
|
4848
|
+
} = _ref76;
|
|
4631
4849
|
return this.#koniState.mintCampaignService.unlockDotCampaign.canMint(address, slug, network);
|
|
4632
4850
|
}
|
|
4633
|
-
unlockDotSubscribeMintedData(id, port,
|
|
4851
|
+
unlockDotSubscribeMintedData(id, port, _ref77) {
|
|
4634
4852
|
let {
|
|
4635
4853
|
transactionId
|
|
4636
|
-
} =
|
|
4854
|
+
} = _ref77;
|
|
4637
4855
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
4638
4856
|
const subscription = this.#koniState.mintCampaignService.unlockDotCampaign.subscribeMintedNft(transactionId, cb);
|
|
4639
4857
|
this.createUnsubscriptionHandle(id, subscription.unsubscribe);
|
|
@@ -4665,10 +4883,10 @@ class KoniExtension {
|
|
|
4665
4883
|
});
|
|
4666
4884
|
return filterBanner(await this.#koniState.campaignService.getProcessingCampaign());
|
|
4667
4885
|
}
|
|
4668
|
-
async completeCampaignBanner(
|
|
4886
|
+
async completeCampaignBanner(_ref78) {
|
|
4669
4887
|
let {
|
|
4670
4888
|
slug
|
|
4671
|
-
} =
|
|
4889
|
+
} = _ref78;
|
|
4672
4890
|
const campaign = await this.#koniState.dbService.getCampaign(slug);
|
|
4673
4891
|
if (campaign) {
|
|
4674
4892
|
await this.#koniState.dbService.upsertCampaign({
|
|
@@ -5203,8 +5421,8 @@ class KoniExtension {
|
|
|
5203
5421
|
resolve();
|
|
5204
5422
|
}
|
|
5205
5423
|
};
|
|
5206
|
-
this.#koniState.balanceService.subscribeTransferableBalance(address, waitXcmData.chain, waitXcmData.token, waitXcmData.nextTxType, onRs).then(
|
|
5207
|
-
let [_unsub, rs] =
|
|
5424
|
+
this.#koniState.balanceService.subscribeTransferableBalance(address, waitXcmData.chain, waitXcmData.token, waitXcmData.nextTxType, onRs).then(_ref79 => {
|
|
5425
|
+
let [_unsub, rs] = _ref79;
|
|
5208
5426
|
unsub = _unsub;
|
|
5209
5427
|
onRs(rs);
|
|
5210
5428
|
}).catch(console.error);
|
|
@@ -5725,6 +5943,8 @@ class KoniExtension {
|
|
|
5725
5943
|
return await this.reconnectChain(request);
|
|
5726
5944
|
case 'pri(chainService.disableChain)':
|
|
5727
5945
|
return await this.disableChain(request);
|
|
5946
|
+
case 'pri(chainService.disableAllChains)':
|
|
5947
|
+
return await this.#koniState.disableAllChains();
|
|
5728
5948
|
case 'pri(chainService.removeChain)':
|
|
5729
5949
|
return this.removeCustomChain(request);
|
|
5730
5950
|
case 'pri(chainService.validateCustomChain)':
|
|
@@ -6104,6 +6324,8 @@ class KoniExtension {
|
|
|
6104
6324
|
return await this.cancelPendingTx(request);
|
|
6105
6325
|
case 'pri(multisig.initMultisigTx)':
|
|
6106
6326
|
return await this.initMultisigTx(request);
|
|
6327
|
+
case 'pri(multisig.prepareSignRequest)':
|
|
6328
|
+
return await this.prepareMultisigSignRequest(request);
|
|
6107
6329
|
case 'pri(multisig.getSignableAccountInfos)':
|
|
6108
6330
|
return this.#koniState.keyringService.context.getSignableAccountInfos(request);
|
|
6109
6331
|
/* Multisig Account */
|