@subwallet/extension-base 1.3.26-0 → 1.3.27-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 +4 -3
- package/background/warnings/TransactionWarning.d.ts +2 -0
- package/background/warnings/TransactionWarning.js +16 -1
- package/cjs/background/warnings/TransactionWarning.js +15 -0
- package/cjs/core/logic-validation/index.js +32 -1
- package/cjs/core/utils.js +25 -3
- package/cjs/koni/background/handlers/Extension.js +86 -94
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/chain-service/utils/patch.js +1 -1
- package/cjs/services/swap-service/handler/asset-hub/handler.js +182 -40
- package/cjs/services/swap-service/handler/asset-hub/utils.js +3 -0
- package/cjs/services/swap-service/handler/base-handler.js +326 -12
- package/cjs/services/swap-service/handler/chainflip-handler.js +80 -16
- package/cjs/services/swap-service/handler/hydradx-handler.js +174 -30
- package/cjs/services/swap-service/handler/simpleswap-handler.js +50 -1
- package/cjs/services/swap-service/handler/uniswap-handler.js +47 -1
- package/cjs/services/swap-service/index.js +191 -27
- package/cjs/services/swap-service/interface.js +14 -0
- package/cjs/services/swap-service/utils.js +81 -5
- package/cjs/services/transaction-service/utils.js +4 -1
- package/core/logic-validation/index.d.ts +4 -0
- package/core/logic-validation/index.js +22 -1
- package/core/utils.d.ts +3 -0
- package/core/utils.js +22 -2
- package/koni/background/handlers/Extension.d.ts +2 -2
- package/koni/background/handlers/Extension.js +20 -28
- package/package.json +12 -7
- package/packageInfo.js +1 -1
- package/services/balance-service/helpers/process.d.ts +3 -3
- package/services/balance-service/index.d.ts +2 -3
- package/services/chain-service/utils/patch.js +1 -1
- package/services/swap-service/handler/asset-hub/handler.d.ts +6 -3
- package/services/swap-service/handler/asset-hub/handler.js +170 -28
- package/services/swap-service/handler/asset-hub/utils.js +3 -0
- package/services/swap-service/handler/base-handler.d.ts +12 -3
- package/services/swap-service/handler/base-handler.js +329 -15
- package/services/swap-service/handler/chainflip-handler.d.ts +4 -3
- package/services/swap-service/handler/chainflip-handler.js +74 -10
- package/services/swap-service/handler/hydradx-handler.d.ts +8 -3
- package/services/swap-service/handler/hydradx-handler.js +176 -32
- package/services/swap-service/handler/simpleswap-handler.d.ts +4 -2
- package/services/swap-service/handler/simpleswap-handler.js +50 -1
- package/services/swap-service/handler/uniswap-handler.d.ts +4 -2
- package/services/swap-service/handler/uniswap-handler.js +47 -1
- package/services/swap-service/index.d.ts +15 -5
- package/services/swap-service/index.js +182 -18
- package/services/swap-service/interface.d.ts +9 -0
- package/services/swap-service/interface.js +8 -0
- package/services/swap-service/utils.d.ts +9 -1
- package/services/swap-service/utils.js +74 -4
- package/services/transaction-service/utils.js +4 -1
- package/types/service-base.d.ts +6 -2
- package/types/swap/index.d.ts +34 -6
- package/types/transaction/process.d.ts +0 -6
|
@@ -16,9 +16,10 @@ var _KoniTypes = require("@subwallet/extension-base/background/KoniTypes");
|
|
|
16
16
|
var _constants = require("@subwallet/extension-base/constants");
|
|
17
17
|
var _transfer = require("@subwallet/extension-base/core/logic-validation/transfer");
|
|
18
18
|
var _xcmParser = require("@subwallet/extension-base/core/substrate/xcm-parser");
|
|
19
|
+
var _utils = require("@subwallet/extension-base/core/utils");
|
|
19
20
|
var _defaults = require("@subwallet/extension-base/defaults");
|
|
20
21
|
var _web = require("@subwallet/extension-base/koni/api/contract-handler/evm/web3");
|
|
21
|
-
var
|
|
22
|
+
var _utils2 = require("@subwallet/extension-base/koni/api/contract-handler/utils");
|
|
22
23
|
var _domain = require("@subwallet/extension-base/koni/api/dotsama/domain");
|
|
23
24
|
var _parseTransaction = require("@subwallet/extension-base/koni/api/dotsama/parseTransaction");
|
|
24
25
|
var _config = require("@subwallet/extension-base/koni/api/nft/config");
|
|
@@ -26,9 +27,9 @@ var _transfer2 = require("@subwallet/extension-base/koni/api/nft/transfer");
|
|
|
26
27
|
var _bonding = require("@subwallet/extension-base/koni/api/staking/bonding");
|
|
27
28
|
var _paraChain = require("@subwallet/extension-base/koni/api/staking/bonding/paraChain");
|
|
28
29
|
var _relayChain = require("@subwallet/extension-base/koni/api/staking/bonding/relayChain");
|
|
29
|
-
var
|
|
30
|
+
var _utils3 = require("@subwallet/extension-base/koni/api/yield/helper/utils");
|
|
30
31
|
var _consts = require("@subwallet/extension-base/services/balance-service/helpers/subscribe/cardano/consts");
|
|
31
|
-
var
|
|
32
|
+
var _utils4 = require("@subwallet/extension-base/services/balance-service/helpers/subscribe/ton/utils");
|
|
32
33
|
var _cardanoTransfer = require("@subwallet/extension-base/services/balance-service/transfer/cardano-transfer");
|
|
33
34
|
var _smartContract = require("@subwallet/extension-base/services/balance-service/transfer/smart-contract");
|
|
34
35
|
var _token = require("@subwallet/extension-base/services/balance-service/transfer/token");
|
|
@@ -39,8 +40,8 @@ var _polygonBridge = require("@subwallet/extension-base/services/balance-service
|
|
|
39
40
|
var _posBridge = require("@subwallet/extension-base/services/balance-service/transfer/xcm/posBridge");
|
|
40
41
|
var _constants2 = require("@subwallet/extension-base/services/chain-service/constants");
|
|
41
42
|
var _types2 = require("@subwallet/extension-base/services/chain-service/types");
|
|
42
|
-
var
|
|
43
|
-
var
|
|
43
|
+
var _utils5 = require("@subwallet/extension-base/services/chain-service/utils");
|
|
44
|
+
var _utils6 = require("@subwallet/extension-base/services/fee-service/utils");
|
|
44
45
|
var _tokenPayFee = require("@subwallet/extension-base/services/fee-service/utils/tokenPayFee");
|
|
45
46
|
var _constants3 = require("@subwallet/extension-base/services/request-service/constants");
|
|
46
47
|
var _constants4 = require("@subwallet/extension-base/services/setting-service/constants");
|
|
@@ -48,20 +49,20 @@ var _helpers2 = require("@subwallet/extension-base/services/wallet-connect-servi
|
|
|
48
49
|
var _storage = require("@subwallet/extension-base/storage");
|
|
49
50
|
var _stores = require("@subwallet/extension-base/stores");
|
|
50
51
|
var _types3 = require("@subwallet/extension-base/types");
|
|
51
|
-
var
|
|
52
|
+
var _utils7 = require("@subwallet/extension-base/utils");
|
|
52
53
|
var _parseTransaction2 = require("@subwallet/extension-base/utils/eth/parseTransaction");
|
|
53
54
|
var _getId = require("@subwallet/extension-base/utils/getId");
|
|
54
55
|
var _keyring = require("@subwallet/keyring");
|
|
55
56
|
var _types4 = require("@subwallet/keyring/types");
|
|
56
57
|
var _uiKeyring = require("@subwallet/ui-keyring");
|
|
57
|
-
var
|
|
58
|
+
var _utils8 = require("@walletconnect/utils");
|
|
58
59
|
var _bignumber = _interopRequireDefault(require("bignumber.js"));
|
|
59
60
|
var _i18next = require("i18next");
|
|
60
61
|
var _rxjs = require("rxjs");
|
|
61
62
|
var _types5 = require("@polkadot/types");
|
|
62
63
|
var _util = require("@polkadot/util");
|
|
63
64
|
var _utilCrypto = require("@polkadot/util-crypto");
|
|
64
|
-
var
|
|
65
|
+
var _utils9 = require("../utils");
|
|
65
66
|
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
66
67
|
// SPDX-License-Identifier: Apache-2.0
|
|
67
68
|
|
|
@@ -276,7 +277,7 @@ class KoniExtension {
|
|
|
276
277
|
const accounts = keyringService.context.accounts;
|
|
277
278
|
const transformedAccounts = Object.values(accounts);
|
|
278
279
|
const responseData = {
|
|
279
|
-
accounts: transformedAccounts !== null && transformedAccounts !== void 0 && transformedAccounts.length ? [(0,
|
|
280
|
+
accounts: transformedAccounts !== null && transformedAccounts !== void 0 && transformedAccounts.length ? [(0, _utils7.combineAllAccountProxy)(transformedAccounts), ...transformedAccounts] : [],
|
|
280
281
|
currentAccountProxy: currentAccount === null || currentAccount === void 0 ? void 0 : currentAccount.proxyId
|
|
281
282
|
};
|
|
282
283
|
const accountProxyMapObservable = keyringService.context.observable.accounts;
|
|
@@ -290,7 +291,7 @@ class KoniExtension {
|
|
|
290
291
|
currentAccount
|
|
291
292
|
} = _ref7;
|
|
292
293
|
const transformedAccounts = Object.values(accountProxies);
|
|
293
|
-
responseData.accounts = transformedAccounts !== null && transformedAccounts !== void 0 && transformedAccounts.length ? [(0,
|
|
294
|
+
responseData.accounts = transformedAccounts !== null && transformedAccounts !== void 0 && transformedAccounts.length ? [(0, _utils7.combineAllAccountProxy)(transformedAccounts), ...transformedAccounts] : [];
|
|
294
295
|
responseData.currentAccountProxy = currentAccount === null || currentAccount === void 0 ? void 0 : currentAccount.proxyId;
|
|
295
296
|
console.debug('subscriptionAccountGroups', responseData);
|
|
296
297
|
cb(responseData);
|
|
@@ -311,10 +312,10 @@ class KoniExtension {
|
|
|
311
312
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
312
313
|
const combineFunction = async (chainInfoMap, accountProxyMap, _contacts) => {
|
|
313
314
|
const accountProxies = Object.values(accountProxyMap);
|
|
314
|
-
const contacts = (0,
|
|
315
|
+
const contacts = (0, _utils7.transformAddresses)(_contacts);
|
|
315
316
|
const chainInfo = chainInfoMap[chain];
|
|
316
317
|
const substrateApi = this.#koniState.chainService.getSubstrateApi(chain);
|
|
317
|
-
const rs = await (0,
|
|
318
|
+
const rs = await (0, _utils7._analyzeAddress)(data, accountProxies, contacts, chainInfo, substrateApi);
|
|
318
319
|
return {
|
|
319
320
|
id,
|
|
320
321
|
...rs
|
|
@@ -354,7 +355,7 @@ class KoniExtension {
|
|
|
354
355
|
const _cb = (0, _subscriptions.createSubscription)(id, port);
|
|
355
356
|
let old = '';
|
|
356
357
|
const subscription = this.#koniState.keyringService.context.observable.contacts.subscribe(subjectInfo => {
|
|
357
|
-
const addresses = (0,
|
|
358
|
+
const addresses = (0, _utils7.transformAddresses)(subjectInfo);
|
|
358
359
|
const _new = JSON.stringify(addresses);
|
|
359
360
|
if (old !== _new) {
|
|
360
361
|
_cb({
|
|
@@ -371,7 +372,7 @@ class KoniExtension {
|
|
|
371
372
|
});
|
|
372
373
|
const subjectInfo = this.#koniState.keyringService.context.contacts;
|
|
373
374
|
return {
|
|
374
|
-
addresses: (0,
|
|
375
|
+
addresses: (0, _utils7.transformAccounts)(subjectInfo)
|
|
375
376
|
};
|
|
376
377
|
}
|
|
377
378
|
|
|
@@ -384,7 +385,7 @@ class KoniExtension {
|
|
|
384
385
|
chain
|
|
385
386
|
} = _ref9;
|
|
386
387
|
if ((0, _keyring.isAddress)(accountId)) {
|
|
387
|
-
const address = (0,
|
|
388
|
+
const address = (0, _utils7.reformatAddress)(accountId);
|
|
388
389
|
const account = _uiKeyring.keyring.getAccount(address);
|
|
389
390
|
const contact = _uiKeyring.keyring.getAddress(address, 'address');
|
|
390
391
|
if (account) {
|
|
@@ -430,7 +431,7 @@ class KoniExtension {
|
|
|
430
431
|
meta
|
|
431
432
|
} = _ref10;
|
|
432
433
|
if ((0, _keyring.isAddress)(address)) {
|
|
433
|
-
const _address = (0,
|
|
434
|
+
const _address = (0, _utils7.reformatAddress)(address);
|
|
434
435
|
_uiKeyring.keyring.saveAddress(_address, meta);
|
|
435
436
|
return true;
|
|
436
437
|
} else {
|
|
@@ -446,7 +447,7 @@ class KoniExtension {
|
|
|
446
447
|
address
|
|
447
448
|
} = _ref11;
|
|
448
449
|
if ((0, _keyring.isAddress)(address)) {
|
|
449
|
-
const _address = (0,
|
|
450
|
+
const _address = (0, _utils7.reformatAddress)(address);
|
|
450
451
|
_uiKeyring.keyring.forgetAddress(_address);
|
|
451
452
|
return true;
|
|
452
453
|
} else {
|
|
@@ -575,7 +576,7 @@ class KoniExtension {
|
|
|
575
576
|
}
|
|
576
577
|
getPairs() {
|
|
577
578
|
const storedAccounts = this.#koniState.keyringService.context.pairs;
|
|
578
|
-
return (0,
|
|
579
|
+
return (0, _utils7.transformAccounts)(storedAccounts);
|
|
579
580
|
}
|
|
580
581
|
isAddressValidWithAuthType(address, accountAuthTypes) {
|
|
581
582
|
const type = (0, _keyring.getKeypairTypeByAddress)(address);
|
|
@@ -1109,7 +1110,7 @@ class KoniExtension {
|
|
|
1109
1110
|
const addresses = _uiKeyring.keyring.getAccounts().map(a => a.address);
|
|
1110
1111
|
|
|
1111
1112
|
// Re-filter
|
|
1112
|
-
cb(histories.filter(item => addresses.some(address => (0,
|
|
1113
|
+
cb(histories.filter(item => addresses.some(address => (0, _utils7.isSameAddress)(item.address, address))));
|
|
1113
1114
|
});
|
|
1114
1115
|
this.createUnsubscriptionHandle(id, subscription.unsubscribe);
|
|
1115
1116
|
port.onDisconnect.addListener(() => {
|
|
@@ -1118,7 +1119,7 @@ class KoniExtension {
|
|
|
1118
1119
|
const addresses = _uiKeyring.keyring.getAccounts().map(a => a.address);
|
|
1119
1120
|
|
|
1120
1121
|
// Re-filter
|
|
1121
|
-
return historySubject.getValue().filter(item => addresses.some(address => (0,
|
|
1122
|
+
return historySubject.getValue().filter(item => addresses.some(address => (0, _utils7.isSameAddress)(item.address, address)));
|
|
1122
1123
|
}
|
|
1123
1124
|
subscribeHistoryByChainAndAddress(_ref29, id, port) {
|
|
1124
1125
|
let {
|
|
@@ -1147,7 +1148,7 @@ class KoniExtension {
|
|
|
1147
1148
|
owner,
|
|
1148
1149
|
spenderAddress
|
|
1149
1150
|
} = params;
|
|
1150
|
-
if (!(0,
|
|
1151
|
+
if (!(0, _utils2.isSnowBridgeGatewayContract)(spenderAddress) && !(0, _utils2.isAvailBridgeGatewayContract)(spenderAddress)) {
|
|
1151
1152
|
throw new Error('Only SnowBridge and AvailBridge is supported'); // todo: support all ERC20 spending approval
|
|
1152
1153
|
}
|
|
1153
1154
|
|
|
@@ -1189,14 +1190,14 @@ class KoniExtension {
|
|
|
1189
1190
|
const nativeTokenSlug = nativeTokenInfo.slug;
|
|
1190
1191
|
const isTransferNativeToken = nativeTokenSlug === tokenSlug;
|
|
1191
1192
|
const isTransferLocalTokenAndPayThatTokenAsFee = !isTransferNativeToken && tokenPayFeeSlug === tokenSlug;
|
|
1192
|
-
const isCustomTokenPayFeeAssetHub = tokenPayFeeSlug && !(0,
|
|
1193
|
-
const isCustomTokenPayFeeHydration = tokenPayFeeSlug && !(0,
|
|
1193
|
+
const isCustomTokenPayFeeAssetHub = tokenPayFeeSlug && !(0, _utils5._isNativeTokenBySlug)(tokenPayFeeSlug) && _constants._SUPPORT_TOKEN_PAY_FEE_GROUP.assetHub.includes(chain);
|
|
1194
|
+
const isCustomTokenPayFeeHydration = tokenPayFeeSlug && !(0, _utils5._isNativeTokenBySlug)(tokenPayFeeSlug) && _constants._SUPPORT_TOKEN_PAY_FEE_GROUP.hydration.includes(chain);
|
|
1194
1195
|
const extrinsicType = isTransferNativeToken ? _KoniTypes.ExtrinsicType.TRANSFER_BALANCE : _KoniTypes.ExtrinsicType.TRANSFER_TOKEN;
|
|
1195
1196
|
let chainType = _KoniTypes.ChainType.SUBSTRATE;
|
|
1196
1197
|
const transferAmount = {
|
|
1197
1198
|
value: '0',
|
|
1198
|
-
symbol: (0,
|
|
1199
|
-
decimals: (0,
|
|
1199
|
+
symbol: (0, _utils5._getAssetSymbol)(transferTokenInfo),
|
|
1200
|
+
decimals: (0, _utils5._getAssetDecimals)(transferTokenInfo)
|
|
1200
1201
|
};
|
|
1201
1202
|
let transaction;
|
|
1202
1203
|
const transferTokenAvailable = await this.getAddressTransferableBalance({
|
|
@@ -1206,7 +1207,7 @@ class KoniExtension {
|
|
|
1206
1207
|
extrinsicType
|
|
1207
1208
|
});
|
|
1208
1209
|
try {
|
|
1209
|
-
if ((0, _utilCrypto.isEthereumAddress)(from) && (0, _utilCrypto.isEthereumAddress)(to) && (0,
|
|
1210
|
+
if ((0, _utilCrypto.isEthereumAddress)(from) && (0, _utilCrypto.isEthereumAddress)(to) && (0, _utils5._isTokenTransferredByEvm)(transferTokenInfo)) {
|
|
1210
1211
|
chainType = _KoniTypes.ChainType.EVM;
|
|
1211
1212
|
const txVal = transferAll ? transferTokenAvailable.value : value || '0';
|
|
1212
1213
|
const evmApi = this.#koniState.getEvmApi(chain);
|
|
@@ -1214,9 +1215,9 @@ class KoniExtension {
|
|
|
1214
1215
|
|
|
1215
1216
|
// todo: refactor: merge getERC20TransactionObject & getEVMTransactionObject
|
|
1216
1217
|
// Estimate with EVM API
|
|
1217
|
-
if ((0,
|
|
1218
|
+
if ((0, _utils5._isTokenEvmSmartContract)(transferTokenInfo) || (0, _utils5._isLocalToken)(transferTokenInfo)) {
|
|
1218
1219
|
[transaction, transferAmount.value] = await (0, _smartContract.getERC20TransactionObject)({
|
|
1219
|
-
assetAddress: (0,
|
|
1220
|
+
assetAddress: (0, _utils5._getContractAddressOfToken)(transferTokenInfo),
|
|
1220
1221
|
chain,
|
|
1221
1222
|
evmApi,
|
|
1222
1223
|
feeCustom,
|
|
@@ -1240,10 +1241,10 @@ class KoniExtension {
|
|
|
1240
1241
|
value: txVal
|
|
1241
1242
|
});
|
|
1242
1243
|
}
|
|
1243
|
-
} else if ((0,
|
|
1244
|
+
} else if ((0, _utils5._isMantaZkAsset)(transferTokenInfo)) {
|
|
1244
1245
|
transaction = undefined;
|
|
1245
1246
|
transferAmount.value = '0';
|
|
1246
|
-
} else if ((0, _keyring.isTonAddress)(from) && (0, _keyring.isTonAddress)(to) && (0,
|
|
1247
|
+
} else if ((0, _keyring.isTonAddress)(from) && (0, _keyring.isTonAddress)(to) && (0, _utils5._isTokenTransferredByTon)(transferTokenInfo)) {
|
|
1247
1248
|
chainType = _KoniTypes.ChainType.TON;
|
|
1248
1249
|
const tonApi = this.#koniState.getTonApi(chain);
|
|
1249
1250
|
[transaction, transferAmount.value] = await (0, _tonTransfer.createTonTransaction)({
|
|
@@ -1256,7 +1257,7 @@ class KoniExtension {
|
|
|
1256
1257
|
// currently not used
|
|
1257
1258
|
tonApi
|
|
1258
1259
|
});
|
|
1259
|
-
} else if ((0, _keyring.isCardanoAddress)(from) && (0, _keyring.isCardanoAddress)(to) && (0,
|
|
1260
|
+
} else if ((0, _keyring.isCardanoAddress)(from) && (0, _keyring.isCardanoAddress)(to) && (0, _utils5._isTokenTransferredByCardano)(transferTokenInfo)) {
|
|
1260
1261
|
chainType = _KoniTypes.ChainType.CARDANO;
|
|
1261
1262
|
const cardanoApi = this.#koniState.getCardanoApi(chain);
|
|
1262
1263
|
[transaction, transferAmount.value] = await (0, _cardanoTransfer.createCardanoTransaction)({
|
|
@@ -1300,7 +1301,7 @@ class KoniExtension {
|
|
|
1300
1301
|
const additionalValidator = async inputTransaction => {
|
|
1301
1302
|
let senderSendingTokenTransferable;
|
|
1302
1303
|
let receiverSystemAccountInfo;
|
|
1303
|
-
if (!(0,
|
|
1304
|
+
if (!(0, _utils5._isChainSubstrateCompatible)(chainInfo)) {
|
|
1304
1305
|
return undefined;
|
|
1305
1306
|
}
|
|
1306
1307
|
|
|
@@ -1308,7 +1309,7 @@ class KoniExtension {
|
|
|
1308
1309
|
if (isCustomTokenPayFeeAssetHub || isCustomTokenPayFeeHydration) {
|
|
1309
1310
|
var _inputTransaction$est, _nonNativeTokenPayFee;
|
|
1310
1311
|
const nonNativeFee = BigInt(((_inputTransaction$est = inputTransaction.estimateFee) === null || _inputTransaction$est === void 0 ? void 0 : _inputTransaction$est.value) || '0'); // todo: estimateFee should be must-have, need to refactor interface
|
|
1311
|
-
const nonNativeTokenPayFeeInfo = await this.#koniState.balanceService.getTokensHasBalance((0,
|
|
1312
|
+
const nonNativeTokenPayFeeInfo = await this.#koniState.balanceService.getTokensHasBalance((0, _utils7.reformatAddress)(from), chain, tokenPayFeeSlug);
|
|
1312
1313
|
const nonNativeTokenPayFeeBalance = BigInt(((_nonNativeTokenPayFee = nonNativeTokenPayFeeInfo[tokenPayFeeSlug]) === null || _nonNativeTokenPayFee === void 0 ? void 0 : _nonNativeTokenPayFee.free) || '0');
|
|
1313
1314
|
if (nonNativeFee > nonNativeTokenPayFeeBalance) {
|
|
1314
1315
|
inputTransaction.errors.push(new _TransactionError.TransactionError(_types3.BasicTxErrorType.NOT_ENOUGH_BALANCE));
|
|
@@ -1342,7 +1343,7 @@ class KoniExtension {
|
|
|
1342
1343
|
const receiverSendingTokenKeepAliveBalance = BigInt(_receiverSendingTokenKeepAliveBalance);
|
|
1343
1344
|
const amount = BigInt(transferAmount.value);
|
|
1344
1345
|
const substrateApi = this.#koniState.getSubstrateApi(chain);
|
|
1345
|
-
const isSendingTokenSufficient = await
|
|
1346
|
+
const isSendingTokenSufficient = await (0, _utils._isSufficientToken)(transferTokenInfo, substrateApi);
|
|
1346
1347
|
const [warnings, errors] = (0, _transfer.additionalValidateTransferForRecipient)(transferTokenInfo, nativeTokenInfo, extrinsicType, receiverSendingTokenKeepAliveBalance, amount, senderSendingTokenTransferable, receiverSystemAccountInfo, isSendingTokenSufficient);
|
|
1347
1348
|
warnings.length && inputTransaction.warnings.push(...warnings);
|
|
1348
1349
|
errors.length && inputTransaction.errors.push(...errors);
|
|
@@ -1397,9 +1398,9 @@ class KoniExtension {
|
|
|
1397
1398
|
return this.#koniState.transactionService.generateBeforeHandleResponseErrors(errors);
|
|
1398
1399
|
}
|
|
1399
1400
|
const chainInfoMap = this.#koniState.getChainInfoMap();
|
|
1400
|
-
const isAvailBridgeFromEvm = (0,
|
|
1401
|
-
const isAvailBridgeFromAvail = (0, _availBridge.isAvailChainBridge)(originNetworkKey) && (0,
|
|
1402
|
-
const isSnowBridgeEvmTransfer = (0,
|
|
1401
|
+
const isAvailBridgeFromEvm = (0, _utils5._isPureEvmChain)(chainInfoMap[originNetworkKey]) && (0, _availBridge.isAvailChainBridge)(destinationNetworkKey);
|
|
1402
|
+
const isAvailBridgeFromAvail = (0, _availBridge.isAvailChainBridge)(originNetworkKey) && (0, _utils5._isPureEvmChain)(chainInfoMap[destinationNetworkKey]);
|
|
1403
|
+
const isSnowBridgeEvmTransfer = (0, _utils5._isPureEvmChain)(chainInfoMap[originNetworkKey]) && (0, _xcmParser._isSnowBridgeXcm)(chainInfoMap[originNetworkKey], chainInfoMap[destinationNetworkKey]) && !isAvailBridgeFromEvm;
|
|
1403
1404
|
const isPolygonBridgeTransfer = (0, _polygonBridge._isPolygonChainBridge)(originNetworkKey, destinationNetworkKey);
|
|
1404
1405
|
const isPosBridgeTransfer = (0, _posBridge._isPosChainBridge)(originNetworkKey, destinationNetworkKey);
|
|
1405
1406
|
const isTransferNative = this.#koniState.getNativeTokenInfo(originNetworkKey).slug === tokenSlug;
|
|
@@ -1507,7 +1508,7 @@ class KoniExtension {
|
|
|
1507
1508
|
data: inputData,
|
|
1508
1509
|
extrinsicType: _KoniTypes.ExtrinsicType.TRANSFER_XCM,
|
|
1509
1510
|
chainType: !isSnowBridgeEvmTransfer && !isAvailBridgeFromEvm && !isPolygonBridgeTransfer && !isPosBridgeTransfer ? _KoniTypes.ChainType.SUBSTRATE : _KoniTypes.ChainType.EVM,
|
|
1510
|
-
transferNativeAmount: (0,
|
|
1511
|
+
transferNativeAmount: (0, _utils5._isNativeToken)(originTokenInfo) ? value : '0',
|
|
1511
1512
|
ignoreWarnings,
|
|
1512
1513
|
tokenPayFeeSlug,
|
|
1513
1514
|
isTransferAll: transferAll,
|
|
@@ -1527,7 +1528,7 @@ class KoniExtension {
|
|
|
1527
1528
|
} = request;
|
|
1528
1529
|
const chainService = this.#koniState.chainService;
|
|
1529
1530
|
const substrateApi = this.#koniState.getSubstrateApi(chain);
|
|
1530
|
-
const address = (0,
|
|
1531
|
+
const address = (0, _utils7.reformatAddress)(_address);
|
|
1531
1532
|
const tokensHasBalanceInfoMap = await this.#koniState.balanceService.getTokensHasBalance(address, chain);
|
|
1532
1533
|
const nativeTokenInfo = chainService.getNativeTokenInfo(chain);
|
|
1533
1534
|
const nativeBalanceInfo = {
|
|
@@ -1586,7 +1587,7 @@ class KoniExtension {
|
|
|
1586
1587
|
const nativeTokenInfo = this.#koniState.chainService.getAssetBySlug(nativeTokenSlug);
|
|
1587
1588
|
const toTokenInfo = this.#koniState.chainService.getAssetBySlug(toTokenSlug);
|
|
1588
1589
|
const substrateApi = this.#koniState.chainService.getSubstrateApi(nativeTokenInfo.originChain);
|
|
1589
|
-
return await (0,
|
|
1590
|
+
return await (0, _utils6.calculateToAmountByReservePool)(substrateApi.api, nativeTokenInfo, toTokenInfo, nativeTokenFeeAmount);
|
|
1590
1591
|
}
|
|
1591
1592
|
async evmNftSubmitTransaction(inputData) {
|
|
1592
1593
|
const {
|
|
@@ -1670,7 +1671,7 @@ class KoniExtension {
|
|
|
1670
1671
|
const evmApi = this.#koniState.getEvmApi(data.originChain);
|
|
1671
1672
|
|
|
1672
1673
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
1673
|
-
const tokenContract = new evmApi.api.eth.Contract(
|
|
1674
|
+
const tokenContract = new evmApi.api.eth.Contract(_utils2._ERC721_ABI, (_data$metadata = data.metadata) === null || _data$metadata === void 0 ? void 0 : _data$metadata.contractAddress);
|
|
1674
1675
|
try {
|
|
1675
1676
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
|
|
1676
1677
|
await tokenContract.methods.tokenOfOwnerByIndex('0xB7fdD27a8Df011816205a6e3cAA097DC4D8C2C5d', 1).call();
|
|
@@ -1708,31 +1709,12 @@ class KoniExtension {
|
|
|
1708
1709
|
};
|
|
1709
1710
|
}
|
|
1710
1711
|
}
|
|
1711
|
-
async isSufficientToken(tokenInfo, substrateApi) {
|
|
1712
|
-
let metadata;
|
|
1713
|
-
if (_constants2.SUFFICIENT_CHAIN.includes(tokenInfo.originChain) && tokenInfo.assetType !== _types._AssetType.NATIVE) {
|
|
1714
|
-
const assetId = (0, _utils4._isBridgedToken)(tokenInfo) ? (0, _utils4._getXcmAssetMultilocation)(tokenInfo) : (0, _utils4._getTokenOnChainAssetId)(tokenInfo);
|
|
1715
|
-
const queryParams = {
|
|
1716
|
-
section: 'query',
|
|
1717
|
-
module: 'foreignAssets',
|
|
1718
|
-
method: 'asset',
|
|
1719
|
-
args: [assetId]
|
|
1720
|
-
};
|
|
1721
|
-
if (!(0, _utils4._isBridgedToken)(tokenInfo)) {
|
|
1722
|
-
queryParams.module = 'assets';
|
|
1723
|
-
}
|
|
1724
|
-
metadata = await substrateApi.makeRpcQuery(queryParams);
|
|
1725
|
-
} else {
|
|
1726
|
-
return false;
|
|
1727
|
-
}
|
|
1728
|
-
return metadata.isSufficient;
|
|
1729
|
-
}
|
|
1730
1712
|
async deleteCustomAsset(assetSlug) {
|
|
1731
1713
|
const assetInfo = this.#koniState.getAssetBySlug(assetSlug);
|
|
1732
|
-
if (assetInfo && (0,
|
|
1733
|
-
if ((0,
|
|
1714
|
+
if (assetInfo && (0, _utils5._isCustomAsset)(assetSlug)) {
|
|
1715
|
+
if ((0, _utils5._isAssetSmartContractNft)(assetInfo)) {
|
|
1734
1716
|
// check if deleting a smart contract NFT
|
|
1735
|
-
await this.#koniState.deleteNftCollection(assetInfo.originChain, (0,
|
|
1717
|
+
await this.#koniState.deleteNftCollection(assetInfo.originChain, (0, _utils5._getContractAddressOfToken)(assetInfo));
|
|
1736
1718
|
}
|
|
1737
1719
|
this.#koniState.deleteCustomAssets([assetSlug]);
|
|
1738
1720
|
return true;
|
|
@@ -1778,8 +1760,8 @@ class KoniExtension {
|
|
|
1778
1760
|
} = request;
|
|
1779
1761
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
1780
1762
|
const transferTokenInfo = this.#koniState.chainService.getAssetBySlug(token);
|
|
1781
|
-
const isTransferLocalTokenAndPayThatTokenAsFee = !(0,
|
|
1782
|
-
const isTransferNativeTokenAndPayLocalTokenAsFee = (0,
|
|
1763
|
+
const isTransferLocalTokenAndPayThatTokenAsFee = !(0, _utils5._isNativeToken)(transferTokenInfo) && !!tokenPayFeeSlug && tokenPayFeeSlug === token;
|
|
1764
|
+
const isTransferNativeTokenAndPayLocalTokenAsFee = (0, _utils5._isNativeToken)(transferTokenInfo) && !!tokenPayFeeSlug && !(0, _utils5._isNativeTokenBySlug)(tokenPayFeeSlug);
|
|
1783
1765
|
const srcToken = token ? this.#koniState.chainService.getAssetBySlug(token) : this.#koniState.chainService.getNativeTokenInfo(chain);
|
|
1784
1766
|
const destToken = _destChain !== chain ? this.#koniState.getXcmEqualAssetByChain(_destChain, srcToken.slug) : srcToken;
|
|
1785
1767
|
const srcChain = this.#koniState.chainService.getChainInfoByKey(chain);
|
|
@@ -1788,7 +1770,7 @@ class KoniExtension {
|
|
|
1788
1770
|
const extrinsicType = srcChain.slug !== destChain.slug ? _KoniTypes.ExtrinsicType.TRANSFER_XCM : _KoniTypes.ExtrinsicType.TRANSFER_BALANCE;
|
|
1789
1771
|
const freeBalanceSubject = new _rxjs.Subject();
|
|
1790
1772
|
const feeSubject = new _rxjs.Subject();
|
|
1791
|
-
const feeChainType = (0,
|
|
1773
|
+
const feeChainType = (0, _utils7.detectTransferTxType)(srcToken, srcChain, destChain);
|
|
1792
1774
|
if (!destToken) {
|
|
1793
1775
|
throw new Error('Destination token not found');
|
|
1794
1776
|
}
|
|
@@ -1817,7 +1799,7 @@ class KoniExtension {
|
|
|
1817
1799
|
fee,
|
|
1818
1800
|
freeBalance
|
|
1819
1801
|
} = _ref34;
|
|
1820
|
-
(0,
|
|
1802
|
+
(0, _utils7.calculateMaxTransferable)(id, _request, freeBalance, fee).then(cb).catch(console.error);
|
|
1821
1803
|
}
|
|
1822
1804
|
});
|
|
1823
1805
|
const [unsubBalance, freeBalance] = await (async () => {
|
|
@@ -1848,7 +1830,7 @@ class KoniExtension {
|
|
|
1848
1830
|
port.onDisconnect.addListener(() => {
|
|
1849
1831
|
this.cancelSubscription(id);
|
|
1850
1832
|
});
|
|
1851
|
-
return (0,
|
|
1833
|
+
return (0, _utils7.calculateMaxTransferable)(id, _request, freeBalance, fee);
|
|
1852
1834
|
}
|
|
1853
1835
|
async subscribeAddressTransferableBalance(_ref35, id, port) {
|
|
1854
1836
|
let {
|
|
@@ -2024,7 +2006,7 @@ class KoniExtension {
|
|
|
2024
2006
|
continue;
|
|
2025
2007
|
}
|
|
2026
2008
|
const networkInfo = chainInfoMap[n];
|
|
2027
|
-
if ((0,
|
|
2009
|
+
if ((0, _utils5._isChainEvmCompatible)(networkInfo)) {
|
|
2028
2010
|
return networkInfo;
|
|
2029
2011
|
}
|
|
2030
2012
|
}
|
|
@@ -2035,7 +2017,7 @@ class KoniExtension {
|
|
|
2035
2017
|
continue;
|
|
2036
2018
|
}
|
|
2037
2019
|
const networkInfo = chainInfoMap[n];
|
|
2038
|
-
if ((0,
|
|
2020
|
+
if ((0, _utils5._getEvmChainId)(networkInfo) === chainId) {
|
|
2039
2021
|
return networkInfo;
|
|
2040
2022
|
}
|
|
2041
2023
|
}
|
|
@@ -2077,7 +2059,7 @@ class KoniExtension {
|
|
|
2077
2059
|
withType: true
|
|
2078
2060
|
})));
|
|
2079
2061
|
const network = this.#koniState.getChainInfo(networkKey);
|
|
2080
|
-
if ((0,
|
|
2062
|
+
if ((0, _utils5._isChainEvmCompatible)(network)) {
|
|
2081
2063
|
signed = signed.substring(2);
|
|
2082
2064
|
}
|
|
2083
2065
|
return {
|
|
@@ -2113,7 +2095,7 @@ class KoniExtension {
|
|
|
2113
2095
|
signed = await pair.evm.signMessage(data, 'personal_sign');
|
|
2114
2096
|
} else {
|
|
2115
2097
|
var _signedTranaction$r, _signedTranaction$s, _signedTranaction$v;
|
|
2116
|
-
const tx = (0,
|
|
2098
|
+
const tx = (0, _utils7.createTransactionFromRLP)(message);
|
|
2117
2099
|
if (!tx) {
|
|
2118
2100
|
throw new Error((0, _i18next.t)('Failed to decode data. Please use a valid QR code'));
|
|
2119
2101
|
}
|
|
@@ -2127,8 +2109,8 @@ class KoniExtension {
|
|
|
2127
2109
|
};
|
|
2128
2110
|
const common = _common.Common.custom({
|
|
2129
2111
|
name: network.name,
|
|
2130
|
-
networkId: (0,
|
|
2131
|
-
chainId: (0,
|
|
2112
|
+
networkId: (0, _utils5._getEvmChainId)(network),
|
|
2113
|
+
chainId: (0, _utils5._getEvmChainId)(network)
|
|
2132
2114
|
}, {
|
|
2133
2115
|
hardfork: 'petersburg'
|
|
2134
2116
|
});
|
|
@@ -2138,7 +2120,7 @@ class KoniExtension {
|
|
|
2138
2120
|
common
|
|
2139
2121
|
});
|
|
2140
2122
|
const signedTranaction = _tx.LegacyTransaction.fromSerializedTx((0, _util.hexToU8a)(pair.evm.signTransaction(transaction)));
|
|
2141
|
-
signed = (0,
|
|
2123
|
+
signed = (0, _utils7.signatureToHex)({
|
|
2142
2124
|
r: ((_signedTranaction$r = signedTranaction.r) === null || _signedTranaction$r === void 0 ? void 0 : _signedTranaction$r.toString(16)) || '',
|
|
2143
2125
|
s: ((_signedTranaction$s = signedTranaction.s) === null || _signedTranaction$s === void 0 ? void 0 : _signedTranaction$s.toString(16)) || '',
|
|
2144
2126
|
v: ((_signedTranaction$v = signedTranaction.v) === null || _signedTranaction$v === void 0 ? void 0 : _signedTranaction$v.toString(16)) || ''
|
|
@@ -2187,7 +2169,7 @@ class KoniExtension {
|
|
|
2187
2169
|
}
|
|
2188
2170
|
const {
|
|
2189
2171
|
decimals
|
|
2190
|
-
} = (0,
|
|
2172
|
+
} = (0, _utils5._getChainNativeTokenBasicInfo)(chainInfo);
|
|
2191
2173
|
return await (0, _bonding.getValidatorsInfo)(chain, apiProps, decimals, chainStakingMetadata);
|
|
2192
2174
|
}
|
|
2193
2175
|
async getNominationPoolOptions(chain) {
|
|
@@ -2392,7 +2374,7 @@ class KoniExtension {
|
|
|
2392
2374
|
const chainInfo = this.#koniState.getChainInfo(networkKey);
|
|
2393
2375
|
const {
|
|
2394
2376
|
decimals
|
|
2395
|
-
} = (0,
|
|
2377
|
+
} = (0, _utils5._getChainNativeTokenBasicInfo)(chainInfo);
|
|
2396
2378
|
const parsedAccountMinimum = parseFloat(accountMinimum) * 10 ** decimals;
|
|
2397
2379
|
const extrinsic = await (0, _paraChain.getTuringCompoundExtrinsic)(dotSamaApi, address, collatorAddress, parsedAccountMinimum.toString(), bondedAmount);
|
|
2398
2380
|
return await this.#koniState.transactionService.handleTransaction({
|
|
@@ -2572,11 +2554,11 @@ class KoniExtension {
|
|
|
2572
2554
|
let registry = new _types5.TypeRegistry();
|
|
2573
2555
|
if (isJsonPayload(payload)) {
|
|
2574
2556
|
const [, chainInfo] = this.#koniState.findNetworkKeyByGenesisHash(payload.genesisHash);
|
|
2575
|
-
const allRegistry = [(0,
|
|
2557
|
+
const allRegistry = [(0, _utils9.setupApiRegistry)(chainInfo, this.#koniState), (0, _utils9.setupDatabaseRegistry)(await this.#koniState.chainService.getMetadataByHash(payload.genesisHash), chainInfo, payload), (0, _utils9.setupDappRegistry)(this.#koniState.knownMetadata.find(meta => meta.genesisHash === payload.genesisHash), payload)].filter(item => item !== null && item.registry !== undefined);
|
|
2576
2558
|
if (allRegistry.length === 0) {
|
|
2577
2559
|
registry.setSignedExtensions(payload.signedExtensions);
|
|
2578
2560
|
} else {
|
|
2579
|
-
registry = (0,
|
|
2561
|
+
registry = (0, _utils9.getSuitableRegistry)(allRegistry, payload);
|
|
2580
2562
|
}
|
|
2581
2563
|
}
|
|
2582
2564
|
const result = request.sign(registry, pair);
|
|
@@ -2872,12 +2854,12 @@ class KoniExtension {
|
|
|
2872
2854
|
if (namespace.chains) {
|
|
2873
2855
|
const unSupportChains = namespace.chains.filter(chain => !(0, _helpers2.isSupportWalletConnectChain)(chain, chainInfoMap));
|
|
2874
2856
|
if (unSupportChains.length) {
|
|
2875
|
-
throw new Error((0,
|
|
2857
|
+
throw new Error((0, _utils8.getSdkError)('UNSUPPORTED_CHAINS').message + ' ' + unSupportChains.toString());
|
|
2876
2858
|
}
|
|
2877
2859
|
availableNamespaces[key] = namespace;
|
|
2878
2860
|
}
|
|
2879
2861
|
} else {
|
|
2880
|
-
throw new Error((0,
|
|
2862
|
+
throw new Error((0, _utils8.getSdkError)('UNSUPPORTED_NAMESPACE_KEY').message + ' ' + key);
|
|
2881
2863
|
}
|
|
2882
2864
|
});
|
|
2883
2865
|
Object.entries(optionalNamespaces).forEach(_ref55 => {
|
|
@@ -2912,7 +2894,7 @@ class KoniExtension {
|
|
|
2912
2894
|
const [_namespace] = address.split(':');
|
|
2913
2895
|
return _namespace === key;
|
|
2914
2896
|
});
|
|
2915
|
-
const chains = (0,
|
|
2897
|
+
const chains = (0, _utils7.uniqueStringArray)(namespace.chains);
|
|
2916
2898
|
namespaces[key] = {
|
|
2917
2899
|
accounts,
|
|
2918
2900
|
methods: namespace.methods,
|
|
@@ -3051,7 +3033,7 @@ class KoniExtension {
|
|
|
3051
3033
|
}
|
|
3052
3034
|
async initSyncMantaPay(address) {
|
|
3053
3035
|
var _this$koniState$chain5, _this$koniState$chain6, _this$koniState$chain7, _this$koniState$chain8;
|
|
3054
|
-
if ((_this$koniState$chain5 = this.#koniState.chainService) !== null && _this$koniState$chain5 !== void 0 && (_this$koniState$chain6 = _this$koniState$chain5.mantaPay) !== null && _this$koniState$chain6 !== void 0 && _this$koniState$chain6.getSyncState().isSyncing || !
|
|
3036
|
+
if ((_this$koniState$chain5 = this.#koniState.chainService) !== null && _this$koniState$chain5 !== void 0 && (_this$koniState$chain6 = _this$koniState$chain5.mantaPay) !== null && _this$koniState$chain6 !== void 0 && _this$koniState$chain6.getSyncState().isSyncing || !_utils7.MODULE_SUPPORT.MANTA_ZK) {
|
|
3055
3037
|
return;
|
|
3056
3038
|
}
|
|
3057
3039
|
this.#skipAutoLock = true;
|
|
@@ -3093,7 +3075,7 @@ class KoniExtension {
|
|
|
3093
3075
|
const tonApi = this.#koniState.getTonApi(chain);
|
|
3094
3076
|
const state = await tonApi.getAccountState(address);
|
|
3095
3077
|
const isActive = state === 'active';
|
|
3096
|
-
const isBounceable = (0,
|
|
3078
|
+
const isBounceable = (0, _utils4.isBounceableAddress)(address);
|
|
3097
3079
|
return !isActive && isBounceable;
|
|
3098
3080
|
} catch (error) {
|
|
3099
3081
|
console.error(`Failed to validate address ${address} on chain ${chain}:`, error);
|
|
@@ -3276,7 +3258,7 @@ class KoniExtension {
|
|
|
3276
3258
|
} = submitData;
|
|
3277
3259
|
const isPoolSupportAlternativeFee = this.#koniState.earningService.isPoolSupportAlternativeFee(inputData.data.slug);
|
|
3278
3260
|
const poolHandler = this.#koniState.earningService.getPoolHandler(data.slug);
|
|
3279
|
-
const isMintingStep =
|
|
3261
|
+
const isMintingStep = _utils3.YIELD_EXTRINSIC_TYPES.includes(extrinsicType);
|
|
3280
3262
|
const eventsHandler = eventEmitter => {
|
|
3281
3263
|
if (onSend) {
|
|
3282
3264
|
eventEmitter.on('send', onSend);
|
|
@@ -3310,7 +3292,7 @@ class KoniExtension {
|
|
|
3310
3292
|
};
|
|
3311
3293
|
await this.#koniState.transactionService.createProcessIfNeed({
|
|
3312
3294
|
id: processId,
|
|
3313
|
-
address: (0,
|
|
3295
|
+
address: (0, _utils7.reformatAddress)(address),
|
|
3314
3296
|
type: _types3.ProcessType.EARNING,
|
|
3315
3297
|
combineInfo,
|
|
3316
3298
|
currentStepId: step.stepId,
|
|
@@ -3685,14 +3667,20 @@ class KoniExtension {
|
|
|
3685
3667
|
ready = true;
|
|
3686
3668
|
return this.#koniState.swapService.getSwapPairs();
|
|
3687
3669
|
}
|
|
3688
|
-
async
|
|
3689
|
-
return this.#koniState.swapService.
|
|
3670
|
+
async getOptimalSwapProcessOnSelectQuote(request) {
|
|
3671
|
+
return this.#koniState.swapService.generateOptimalProcessWithoutPath(request);
|
|
3690
3672
|
}
|
|
3691
3673
|
async handleSwapRequest(request) {
|
|
3692
3674
|
return this.#koniState.swapService.handleSwapRequest(request);
|
|
3693
3675
|
}
|
|
3676
|
+
async handleSwapRequestV2(request) {
|
|
3677
|
+
return this.#koniState.swapService.handleSwapRequestV2(request);
|
|
3678
|
+
}
|
|
3694
3679
|
async getLatestSwapQuote(swapRequest) {
|
|
3695
|
-
|
|
3680
|
+
const {
|
|
3681
|
+
swapQuoteResponse
|
|
3682
|
+
} = await this.#koniState.swapService.getLatestQuoteFromSwapRequest(swapRequest);
|
|
3683
|
+
return swapQuoteResponse;
|
|
3696
3684
|
}
|
|
3697
3685
|
async validateSwapProcess(params) {
|
|
3698
3686
|
return this.#koniState.swapService.validateSwapProcess(params);
|
|
@@ -3729,7 +3717,8 @@ class KoniExtension {
|
|
|
3729
3717
|
address,
|
|
3730
3718
|
process,
|
|
3731
3719
|
selectedQuote: quote,
|
|
3732
|
-
recipient
|
|
3720
|
+
recipient,
|
|
3721
|
+
currentStep: inputData.currentStep
|
|
3733
3722
|
});
|
|
3734
3723
|
if (swapValidations.length > 0) {
|
|
3735
3724
|
if (step) {
|
|
@@ -3750,6 +3739,7 @@ class KoniExtension {
|
|
|
3750
3739
|
}
|
|
3751
3740
|
throw e;
|
|
3752
3741
|
}
|
|
3742
|
+
console.log('swap data', submitData);
|
|
3753
3743
|
|
|
3754
3744
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
3755
3745
|
const {
|
|
@@ -3783,7 +3773,7 @@ class KoniExtension {
|
|
|
3783
3773
|
};
|
|
3784
3774
|
await this.#koniState.transactionService.createProcessIfNeed({
|
|
3785
3775
|
id: processId,
|
|
3786
|
-
address: (0,
|
|
3776
|
+
address: (0, _utils7.reformatAddress)(address),
|
|
3787
3777
|
type: _types3.ProcessType.SWAP,
|
|
3788
3778
|
currentStepId: step.stepId,
|
|
3789
3779
|
combineInfo,
|
|
@@ -4018,7 +4008,7 @@ class KoniExtension {
|
|
|
4018
4008
|
if (!pair) {
|
|
4019
4009
|
throw new Error('Pair not found');
|
|
4020
4010
|
}
|
|
4021
|
-
const signMode = (0,
|
|
4011
|
+
const signMode = (0, _utils7.getAccountSignMode)(address, pair.meta);
|
|
4022
4012
|
if (signMode !== _types3.AccountSignMode.PASSWORD) {
|
|
4023
4013
|
throw new Error('Account can not use this feature');
|
|
4024
4014
|
}
|
|
@@ -4800,10 +4790,12 @@ class KoniExtension {
|
|
|
4800
4790
|
/* Swap service */
|
|
4801
4791
|
case 'pri(swapService.subscribePairs)':
|
|
4802
4792
|
return this.subscribeSwapPairs(id, port);
|
|
4803
|
-
case 'pri(swapService.
|
|
4804
|
-
return this.
|
|
4793
|
+
case 'pri(swapService.getOptimalProcessOnSelectQuote)':
|
|
4794
|
+
return this.getOptimalSwapProcessOnSelectQuote(request);
|
|
4805
4795
|
case 'pri(swapService.handleSwapRequest)':
|
|
4806
4796
|
return this.handleSwapRequest(request);
|
|
4797
|
+
case 'pri(swapService.handleSwapRequestV2)':
|
|
4798
|
+
return this.handleSwapRequestV2(request);
|
|
4807
4799
|
case 'pri(swapService.getLatestQuote)':
|
|
4808
4800
|
return this.getLatestSwapQuote(request);
|
|
4809
4801
|
case 'pri(swapService.validateSwapProcess)':
|
package/cjs/packageInfo.js
CHANGED
|
@@ -11,7 +11,7 @@ const PRODUCTION_BRANCHES = ['master', 'webapp', 'webapp-dev'];
|
|
|
11
11
|
const branchName = process.env.BRANCH_NAME || 'subwallet-dev';
|
|
12
12
|
const fetchDomain = PRODUCTION_BRANCHES.indexOf(branchName) > -1 ? 'https://chain-list-assets.subwallet.app' : 'https://dev.sw-chain-list-assets.pages.dev';
|
|
13
13
|
const fetchFile = PRODUCTION_BRANCHES.indexOf(branchName) > -1 ? 'list.json' : 'preview.json';
|
|
14
|
-
const ChainListVersion = '0.2.
|
|
14
|
+
const ChainListVersion = '0.2.102'; // update this when build chainlist
|
|
15
15
|
|
|
16
16
|
// todo: move this interface to chainlist
|
|
17
17
|
|