@subwallet/extension-base 1.3.66-0 → 1.3.68-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 +12 -1
- package/cjs/constants/environment.js +1 -3
- package/cjs/constants/index.js +4 -1
- package/cjs/core/substrate/system-pallet.js +4 -0
- package/cjs/core/substrate/xcm-parser.js +0 -176
- package/cjs/koni/api/nft/rari/index.js +1 -1
- package/cjs/koni/background/cron.js +16 -0
- package/cjs/koni/background/handlers/Extension.js +166 -90
- package/cjs/koni/background/handlers/State.js +25 -0
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/balance-service/helpers/group.js +31 -2
- package/cjs/services/balance-service/helpers/subscribe/substrate/index.js +51 -13
- package/cjs/services/balance-service/helpers/subscribe/substrate/utils.js +69 -0
- package/cjs/services/balance-service/index.js +36 -11
- package/cjs/services/balance-service/transfer/smart-contract.js +56 -23
- package/cjs/services/balance-service/transfer/xcm/index.js +30 -44
- package/cjs/services/balance-service/transfer/xcm/utils.js +53 -18
- package/cjs/services/chain-service/constants.js +8 -46
- package/cjs/services/chain-service/handler/EvmChainHandler.js +6 -3
- package/cjs/services/earning-service/handlers/base.js +7 -1
- package/cjs/services/nft-service/index.js +173 -0
- package/cjs/services/swap-service/handler/base-handler.js +18 -21
- package/cjs/services/transaction-service/index.js +1 -1
- package/cjs/types/balance/index.js +26 -1
- package/cjs/utils/fee/transfer.js +5 -2
- package/cjs/utils/index.js +25 -2
- package/cjs/utils/setup-api-sdk.js +0 -5
- package/constants/environment.d.ts +0 -1
- package/constants/environment.js +0 -1
- package/constants/index.d.ts +1 -0
- package/constants/index.js +1 -0
- package/core/substrate/system-pallet.d.ts +1 -0
- package/core/substrate/system-pallet.js +3 -0
- package/core/substrate/types.d.ts +14 -0
- package/core/substrate/xcm-parser.d.ts +1 -49
- package/core/substrate/xcm-parser.js +1 -173
- package/koni/api/nft/rari/index.js +1 -1
- package/koni/background/cron.d.ts +1 -0
- package/koni/background/cron.js +17 -1
- package/koni/background/handlers/Extension.d.ts +3 -0
- package/koni/background/handlers/Extension.js +88 -14
- package/koni/background/handlers/State.d.ts +4 -0
- package/koni/background/handlers/State.js +25 -0
- package/package.json +16 -21
- package/packageInfo.js +1 -1
- package/services/balance-service/helpers/group.js +31 -2
- package/services/balance-service/helpers/subscribe/substrate/index.js +51 -13
- package/services/balance-service/helpers/subscribe/substrate/utils.d.ts +7 -0
- package/services/balance-service/helpers/subscribe/substrate/utils.js +58 -0
- package/services/balance-service/index.d.ts +4 -2
- package/services/balance-service/index.js +26 -6
- package/services/balance-service/transfer/smart-contract.d.ts +4 -0
- package/services/balance-service/transfer/smart-contract.js +54 -23
- package/services/balance-service/transfer/xcm/index.d.ts +2 -2
- package/services/balance-service/transfer/xcm/index.js +18 -32
- package/services/balance-service/transfer/xcm/utils.d.ts +1 -2
- package/services/balance-service/transfer/xcm/utils.js +51 -15
- package/services/chain-service/constants.d.ts +5 -24
- package/services/chain-service/constants.js +6 -35
- package/services/chain-service/handler/EvmChainHandler.js +6 -3
- package/services/earning-service/handlers/base.js +7 -1
- package/services/nft-service/index.d.ts +9 -0
- package/services/nft-service/index.js +165 -0
- package/services/swap-service/handler/base-handler.d.ts +0 -1
- package/services/swap-service/handler/base-handler.js +19 -22
- package/services/transaction-service/index.js +1 -1
- package/services/transaction-service/types.d.ts +2 -1
- package/types/balance/index.d.ts +14 -0
- package/types/balance/index.js +21 -1
- package/utils/fee/transfer.js +6 -3
- package/utils/index.js +25 -2
- package/utils/setup-api-sdk.js +1 -6
- package/cjs/services/balance-service/transfer/xcm/polkadotXcm.js +0 -30
- package/cjs/services/balance-service/transfer/xcm/xTokens.js +0 -32
- package/cjs/services/balance-service/transfer/xcm/xcmPallet.js +0 -23
- package/services/balance-service/transfer/xcm/polkadotXcm.d.ts +0 -3
- package/services/balance-service/transfer/xcm/polkadotXcm.js +0 -24
- package/services/balance-service/transfer/xcm/xTokens.d.ts +0 -3
- package/services/balance-service/transfer/xcm/xTokens.js +0 -26
- package/services/balance-service/transfer/xcm/xcmPallet.d.ts +0 -3
- package/services/balance-service/transfer/xcm/xcmPallet.js +0 -17
|
@@ -1193,6 +1193,9 @@ class KoniExtension {
|
|
|
1193
1193
|
});
|
|
1194
1194
|
return this.getNft();
|
|
1195
1195
|
}
|
|
1196
|
+
async handleGetNftFullList(request) {
|
|
1197
|
+
return this.#koniState.nftDetectionService.getFullNftInstancesByCollection(request);
|
|
1198
|
+
}
|
|
1196
1199
|
getStakingReward() {
|
|
1197
1200
|
return new Promise((resolve, reject) => {
|
|
1198
1201
|
this.#koniState.getStakingReward(rs => {
|
|
@@ -1694,7 +1697,7 @@ class KoniExtension {
|
|
|
1694
1697
|
error.length && inputTransaction.errors.push(...error);
|
|
1695
1698
|
}
|
|
1696
1699
|
if (isSubstrateXcm) {
|
|
1697
|
-
const isDryRunSuccess = await (0, _xcm.dryRunXcmExtrinsicV2)(params);
|
|
1700
|
+
const isDryRunSuccess = await (0, _xcm.dryRunXcmExtrinsicV2)(params, false);
|
|
1698
1701
|
if (!isDryRunSuccess) {
|
|
1699
1702
|
inputTransaction.errors.push(new _TransactionError.TransactionError(_types4.BasicTxErrorType.UNABLE_TO_SEND, 'Unable to perform transaction. Select another token or destination chain and try again'));
|
|
1700
1703
|
}
|
|
@@ -2088,20 +2091,40 @@ class KoniExtension {
|
|
|
2088
2091
|
var _data$metadata;
|
|
2089
2092
|
const evmApi = this.#koniState.getEvmApi(data.originChain);
|
|
2090
2093
|
const contractAddress = (_data$metadata = data.metadata) === null || _data$metadata === void 0 ? void 0 : _data$metadata.contractAddress;
|
|
2091
|
-
|
|
2092
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
2093
2094
|
const tokenContract = new evmApi.api.eth.Contract(_utils2._ERC721_ABI, contractAddress);
|
|
2094
2095
|
try {
|
|
2095
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
2096
|
-
await tokenContract.methods.
|
|
2097
|
-
|
|
2098
|
-
} catch (err) {
|
|
2099
|
-
const error = err;
|
|
2100
|
-
if (error.message.includes('index out of bounds')) {
|
|
2101
|
-
return true;
|
|
2102
|
-
} else {
|
|
2096
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
|
|
2097
|
+
const supports1155 = await tokenContract.methods.supportsInterface('0xd9b67a26').call().catch(() => false);
|
|
2098
|
+
if (supports1155) {
|
|
2103
2099
|
return false;
|
|
2104
2100
|
}
|
|
2101
|
+
|
|
2102
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment
|
|
2103
|
+
const supports721 = await tokenContract.methods.supportsInterface('0x80ac58cd').call().catch(() => false);
|
|
2104
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment
|
|
2105
|
+
const supportsMetadata = await tokenContract.methods.supportsInterface('0x5b5e139f').call().catch(() => false);
|
|
2106
|
+
if (supports721 || supportsMetadata) {
|
|
2107
|
+
return true;
|
|
2108
|
+
}
|
|
2109
|
+
|
|
2110
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
2111
|
+
if (tokenContract.methods.ownerOf) {
|
|
2112
|
+
try {
|
|
2113
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
|
|
2114
|
+
await tokenContract.methods.ownerOf(1).call();
|
|
2115
|
+
return true;
|
|
2116
|
+
} catch (err) {
|
|
2117
|
+
var _err$message, _err$message2;
|
|
2118
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
|
|
2119
|
+
if ((_err$message = err.message) !== null && _err$message !== void 0 && _err$message.includes('nonexistent token') || (_err$message2 = err.message) !== null && _err$message2 !== void 0 && _err$message2.includes('invalid token ID')) {
|
|
2120
|
+
return true;
|
|
2121
|
+
}
|
|
2122
|
+
}
|
|
2123
|
+
}
|
|
2124
|
+
return false;
|
|
2125
|
+
} catch (err) {
|
|
2126
|
+
const error = err;
|
|
2127
|
+
return error.message.includes('index out of bounds');
|
|
2105
2128
|
}
|
|
2106
2129
|
}
|
|
2107
2130
|
async upsertCustomToken(data) {
|
|
@@ -2158,13 +2181,29 @@ class KoniExtension {
|
|
|
2158
2181
|
}
|
|
2159
2182
|
return await this.#koniState.balanceService.getTransferableBalance(address, networkKey, token, extrinsicType);
|
|
2160
2183
|
}
|
|
2161
|
-
async
|
|
2184
|
+
async getAddressAvailableBalanceByType(_ref39) {
|
|
2162
2185
|
let {
|
|
2163
2186
|
address,
|
|
2187
|
+
balanceType,
|
|
2164
2188
|
extrinsicType,
|
|
2165
2189
|
networkKey,
|
|
2166
2190
|
token
|
|
2167
2191
|
} = _ref39;
|
|
2192
|
+
if (token && _constants2._MANTA_ZK_CHAIN_GROUP.includes(networkKey)) {
|
|
2193
|
+
const tokenInfo = this.#koniState.chainService.getAssetBySlug(token);
|
|
2194
|
+
if (tokenInfo.symbol.startsWith(_constants2._ZK_ASSET_PREFIX)) {
|
|
2195
|
+
return await this.#koniState.getMantaPayZkBalance(address, tokenInfo);
|
|
2196
|
+
}
|
|
2197
|
+
}
|
|
2198
|
+
return await this.#koniState.balanceService.getBalanceByType(address, networkKey, token, balanceType, extrinsicType);
|
|
2199
|
+
}
|
|
2200
|
+
async getAddressTotalBalance(_ref40) {
|
|
2201
|
+
let {
|
|
2202
|
+
address,
|
|
2203
|
+
extrinsicType,
|
|
2204
|
+
networkKey,
|
|
2205
|
+
token
|
|
2206
|
+
} = _ref40;
|
|
2168
2207
|
return await this.#koniState.balanceService.getTotalBalance(address, networkKey, token, extrinsicType);
|
|
2169
2208
|
}
|
|
2170
2209
|
async subscribeMaxTransferable(request, id, port) {
|
|
@@ -2221,17 +2260,17 @@ class KoniExtension {
|
|
|
2221
2260
|
freeBalance: freeBalanceSubject,
|
|
2222
2261
|
fee: feeSubject
|
|
2223
2262
|
}).subscribe({
|
|
2224
|
-
next:
|
|
2263
|
+
next: _ref41 => {
|
|
2225
2264
|
let {
|
|
2226
2265
|
fee,
|
|
2227
2266
|
freeBalance
|
|
2228
|
-
} =
|
|
2267
|
+
} = _ref41;
|
|
2229
2268
|
(0, _utils8.calculateMaxTransferable)(id, _request, freeBalance, fee).then(cb).catch(console.error);
|
|
2230
2269
|
}
|
|
2231
2270
|
});
|
|
2232
2271
|
const [unsubBalance, freeBalance] = await (async () => {
|
|
2233
2272
|
try {
|
|
2234
|
-
return await this.#koniState.balanceService.subscribeBalance(address, chain, token,
|
|
2273
|
+
return await this.#koniState.balanceService.subscribeBalance(address, chain, token, _types4.BalanceType.TRANSFERABLE, extrinsicType, data => {
|
|
2235
2274
|
freeBalanceSubject.next(data); // Must be called after subscription
|
|
2236
2275
|
});
|
|
2237
2276
|
} catch (e) {
|
|
@@ -2259,7 +2298,7 @@ class KoniExtension {
|
|
|
2259
2298
|
});
|
|
2260
2299
|
return (0, _utils8.calculateMaxTransferable)(id, _request, freeBalance, fee);
|
|
2261
2300
|
}
|
|
2262
|
-
async subscribeTransferableWhenConfirmation(
|
|
2301
|
+
async subscribeTransferableWhenConfirmation(_ref42, id, port) {
|
|
2263
2302
|
let {
|
|
2264
2303
|
address,
|
|
2265
2304
|
chain,
|
|
@@ -2268,7 +2307,7 @@ class KoniExtension {
|
|
|
2268
2307
|
to,
|
|
2269
2308
|
token,
|
|
2270
2309
|
value
|
|
2271
|
-
} =
|
|
2310
|
+
} = _ref42;
|
|
2272
2311
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
2273
2312
|
const freeBalanceSubject = new _rxjs.Subject();
|
|
2274
2313
|
const feeSubject = new _rxjs.Subject();
|
|
@@ -2363,15 +2402,15 @@ class KoniExtension {
|
|
|
2363
2402
|
freeBalance: freeBalanceSubject,
|
|
2364
2403
|
fee: feeSubject
|
|
2365
2404
|
}).subscribe({
|
|
2366
|
-
next:
|
|
2405
|
+
next: _ref43 => {
|
|
2367
2406
|
let {
|
|
2368
2407
|
fee,
|
|
2369
2408
|
freeBalance
|
|
2370
|
-
} =
|
|
2409
|
+
} = _ref43;
|
|
2371
2410
|
convertData(freeBalance, fee, _feeOptions, feeCustom).then(cb).catch(console.error);
|
|
2372
2411
|
}
|
|
2373
2412
|
});
|
|
2374
|
-
const [unsubBalance, freeBalance] = await this.#koniState.balanceService.subscribeBalance(address, chain, token,
|
|
2413
|
+
const [unsubBalance, freeBalance] = await this.#koniState.balanceService.subscribeBalance(address, chain, token, _types4.BalanceType.TRANSFERABLE, _KoniTypes.ExtrinsicType.TRANSFER_BALANCE, data => {
|
|
2375
2414
|
freeBalanceSubject.next(data); // Must be called after subscription
|
|
2376
2415
|
});
|
|
2377
2416
|
|
|
@@ -2390,13 +2429,13 @@ class KoniExtension {
|
|
|
2390
2429
|
});
|
|
2391
2430
|
return convertData(freeBalance, fee, _feeOptions, feeCustom);
|
|
2392
2431
|
}
|
|
2393
|
-
async subscribeAddressTransferableBalance(
|
|
2432
|
+
async subscribeAddressTransferableBalance(_ref44, id, port) {
|
|
2394
2433
|
let {
|
|
2395
2434
|
address,
|
|
2396
2435
|
extrinsicType,
|
|
2397
2436
|
networkKey,
|
|
2398
2437
|
token
|
|
2399
|
-
} =
|
|
2438
|
+
} = _ref44;
|
|
2400
2439
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
2401
2440
|
const convertData = data => {
|
|
2402
2441
|
return {
|
|
@@ -2415,6 +2454,32 @@ class KoniExtension {
|
|
|
2415
2454
|
});
|
|
2416
2455
|
return convertData(currentFreeBalance);
|
|
2417
2456
|
}
|
|
2457
|
+
async subscribeAddressAvailableBalanceByType(_ref45, id, port) {
|
|
2458
|
+
let {
|
|
2459
|
+
address,
|
|
2460
|
+
balanceType,
|
|
2461
|
+
extrinsicType,
|
|
2462
|
+
networkKey,
|
|
2463
|
+
token
|
|
2464
|
+
} = _ref45;
|
|
2465
|
+
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
2466
|
+
const convertData = data => {
|
|
2467
|
+
return {
|
|
2468
|
+
...data,
|
|
2469
|
+
id
|
|
2470
|
+
};
|
|
2471
|
+
};
|
|
2472
|
+
const _cb = data => {
|
|
2473
|
+
// eslint-disable-next-line node/no-callback-literal
|
|
2474
|
+
cb(convertData(data));
|
|
2475
|
+
};
|
|
2476
|
+
const [unsub, currentFreeBalance] = await this.#koniState.balanceService.subscribeBalanceByType(address, networkKey, token, balanceType, extrinsicType, _cb);
|
|
2477
|
+
this.createUnsubscriptionHandle(id, unsub);
|
|
2478
|
+
port.onDisconnect.addListener(() => {
|
|
2479
|
+
this.cancelSubscription(id);
|
|
2480
|
+
});
|
|
2481
|
+
return convertData(currentFreeBalance);
|
|
2482
|
+
}
|
|
2418
2483
|
async substrateNftSubmitTransaction(inputData) {
|
|
2419
2484
|
const {
|
|
2420
2485
|
params,
|
|
@@ -2447,11 +2512,11 @@ class KoniExtension {
|
|
|
2447
2512
|
isSendingSelf
|
|
2448
2513
|
};
|
|
2449
2514
|
}
|
|
2450
|
-
async enableChains(
|
|
2515
|
+
async enableChains(_ref46) {
|
|
2451
2516
|
let {
|
|
2452
2517
|
chainSlugs,
|
|
2453
2518
|
enableTokens
|
|
2454
|
-
} =
|
|
2519
|
+
} = _ref46;
|
|
2455
2520
|
try {
|
|
2456
2521
|
await Promise.all(chainSlugs.map(chainSlug => this.enableChain({
|
|
2457
2522
|
chainSlug,
|
|
@@ -2595,30 +2660,30 @@ class KoniExtension {
|
|
|
2595
2660
|
|
|
2596
2661
|
// Parse transaction
|
|
2597
2662
|
|
|
2598
|
-
parseSubstrateTransaction(
|
|
2663
|
+
parseSubstrateTransaction(_ref47) {
|
|
2599
2664
|
let {
|
|
2600
2665
|
data,
|
|
2601
2666
|
networkKey
|
|
2602
|
-
} =
|
|
2667
|
+
} = _ref47;
|
|
2603
2668
|
const apiProps = this.#koniState.getSubstrateApi(networkKey);
|
|
2604
2669
|
const apiPromise = apiProps.api;
|
|
2605
2670
|
return (0, _parseTransaction.parseSubstrateTransaction)(data, apiPromise);
|
|
2606
2671
|
}
|
|
2607
|
-
async parseEVMRLP(
|
|
2672
|
+
async parseEVMRLP(_ref48) {
|
|
2608
2673
|
let {
|
|
2609
2674
|
data
|
|
2610
|
-
} =
|
|
2675
|
+
} = _ref48;
|
|
2611
2676
|
return await (0, _parseTransaction2.parseEvmRlp)(data, this.#koniState.getChainInfoMap(), this.#koniState.getEvmApiMap());
|
|
2612
2677
|
}
|
|
2613
2678
|
|
|
2614
2679
|
// Sign
|
|
2615
2680
|
|
|
2616
|
-
qrSignSubstrate(
|
|
2681
|
+
qrSignSubstrate(_ref49) {
|
|
2617
2682
|
let {
|
|
2618
2683
|
address,
|
|
2619
2684
|
data,
|
|
2620
2685
|
networkKey
|
|
2621
|
-
} =
|
|
2686
|
+
} = _ref49;
|
|
2622
2687
|
const pair = _uiKeyring.keyring.getPair(address);
|
|
2623
2688
|
(0, _util.assert)(pair, (0, _i18next.t)('bg.koni.handler.Extension.unableToFindAccount'));
|
|
2624
2689
|
if (pair.isLocked) {
|
|
@@ -2635,13 +2700,13 @@ class KoniExtension {
|
|
|
2635
2700
|
signature: signed
|
|
2636
2701
|
};
|
|
2637
2702
|
}
|
|
2638
|
-
async qrSignEVM(
|
|
2703
|
+
async qrSignEVM(_ref50) {
|
|
2639
2704
|
let {
|
|
2640
2705
|
address,
|
|
2641
2706
|
chainId,
|
|
2642
2707
|
message,
|
|
2643
2708
|
type
|
|
2644
|
-
} =
|
|
2709
|
+
} = _ref50;
|
|
2645
2710
|
let signed;
|
|
2646
2711
|
const network = this.getNetworkJsonByChainId(chainId);
|
|
2647
2712
|
if (!network) {
|
|
@@ -2725,11 +2790,11 @@ class KoniExtension {
|
|
|
2725
2790
|
});
|
|
2726
2791
|
return this.#koniState.getNominatorMetadata();
|
|
2727
2792
|
}
|
|
2728
|
-
async getBondingOptions(
|
|
2793
|
+
async getBondingOptions(_ref51) {
|
|
2729
2794
|
let {
|
|
2730
2795
|
chain,
|
|
2731
2796
|
type
|
|
2732
|
-
} =
|
|
2797
|
+
} = _ref51;
|
|
2733
2798
|
const apiProps = this.#koniState.getSubstrateApi(chain);
|
|
2734
2799
|
const chainInfo = this.#koniState.getChainInfo(chain);
|
|
2735
2800
|
const chainStakingMetadata = await this.#koniState.getStakingMetadataByChain(chain, type);
|
|
@@ -2919,12 +2984,12 @@ class KoniExtension {
|
|
|
2919
2984
|
}
|
|
2920
2985
|
|
|
2921
2986
|
// EVM Transaction
|
|
2922
|
-
async parseContractInput(
|
|
2987
|
+
async parseContractInput(_ref52) {
|
|
2923
2988
|
let {
|
|
2924
2989
|
chainId,
|
|
2925
2990
|
contract,
|
|
2926
2991
|
data
|
|
2927
|
-
} =
|
|
2992
|
+
} = _ref52;
|
|
2928
2993
|
const network = this.getNetworkJsonByChainId(chainId);
|
|
2929
2994
|
return await (0, _parseTransaction2.parseContractInput)(data, contract, network);
|
|
2930
2995
|
}
|
|
@@ -3024,10 +3089,10 @@ class KoniExtension {
|
|
|
3024
3089
|
|
|
3025
3090
|
// Unlock wallet
|
|
3026
3091
|
|
|
3027
|
-
keyringUnlock(
|
|
3092
|
+
keyringUnlock(_ref53) {
|
|
3028
3093
|
let {
|
|
3029
3094
|
password
|
|
3030
|
-
} =
|
|
3095
|
+
} = _ref53;
|
|
3031
3096
|
try {
|
|
3032
3097
|
_uiKeyring.keyring.unlockKeyring(password);
|
|
3033
3098
|
// this.#koniState.initMantaPay(password)
|
|
@@ -3058,11 +3123,11 @@ class KoniExtension {
|
|
|
3058
3123
|
|
|
3059
3124
|
// Export mnemonic
|
|
3060
3125
|
|
|
3061
|
-
keyringExportMnemonic(
|
|
3126
|
+
keyringExportMnemonic(_ref54) {
|
|
3062
3127
|
let {
|
|
3063
3128
|
address,
|
|
3064
3129
|
password
|
|
3065
|
-
} =
|
|
3130
|
+
} = _ref54;
|
|
3066
3131
|
const pair = _uiKeyring.keyring.getPair(address);
|
|
3067
3132
|
const result = pair.exportMnemonic(password);
|
|
3068
3133
|
return {
|
|
@@ -3072,10 +3137,10 @@ class KoniExtension {
|
|
|
3072
3137
|
|
|
3073
3138
|
// Reset wallet
|
|
3074
3139
|
|
|
3075
|
-
async resetWallet(
|
|
3140
|
+
async resetWallet(_ref55) {
|
|
3076
3141
|
let {
|
|
3077
3142
|
resetAll
|
|
3078
|
-
} =
|
|
3143
|
+
} = _ref55;
|
|
3079
3144
|
try {
|
|
3080
3145
|
await this.#koniState.resetWallet(resetAll);
|
|
3081
3146
|
return {
|
|
@@ -3091,10 +3156,10 @@ class KoniExtension {
|
|
|
3091
3156
|
}
|
|
3092
3157
|
|
|
3093
3158
|
// Signing substrate request
|
|
3094
|
-
async signingApprovePasswordV2(
|
|
3159
|
+
async signingApprovePasswordV2(_ref56) {
|
|
3095
3160
|
let {
|
|
3096
3161
|
id
|
|
3097
|
-
} =
|
|
3162
|
+
} = _ref56;
|
|
3098
3163
|
const queued = this.#koniState.getSignRequest(id);
|
|
3099
3164
|
(0, _util.assert)(queued, (0, _i18next.t)('bg.koni.handler.Extension.unableToProceed'));
|
|
3100
3165
|
const {
|
|
@@ -3253,10 +3318,10 @@ class KoniExtension {
|
|
|
3253
3318
|
getSupportedSmartContractTypes() {
|
|
3254
3319
|
return this.#koniState.getSupportedSmartContractTypes();
|
|
3255
3320
|
}
|
|
3256
|
-
getTransaction(
|
|
3321
|
+
getTransaction(_ref57) {
|
|
3257
3322
|
let {
|
|
3258
3323
|
id
|
|
3259
|
-
} =
|
|
3324
|
+
} = _ref57;
|
|
3260
3325
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
3261
3326
|
const {
|
|
3262
3327
|
transaction,
|
|
@@ -3267,8 +3332,8 @@ class KoniExtension {
|
|
|
3267
3332
|
async subscribeTransactions(id, port) {
|
|
3268
3333
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
3269
3334
|
function convertRs(rs, processMap) {
|
|
3270
|
-
return Object.fromEntries(Object.entries(rs).map(
|
|
3271
|
-
let [key, value] =
|
|
3335
|
+
return Object.fromEntries(Object.entries(rs).map(_ref58 => {
|
|
3336
|
+
let [key, value] = _ref58;
|
|
3272
3337
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
3273
3338
|
const {
|
|
3274
3339
|
additionalValidator,
|
|
@@ -3294,11 +3359,11 @@ class KoniExtension {
|
|
|
3294
3359
|
const subscription = (0, _rxjs.combineLatest)({
|
|
3295
3360
|
transactions: transactionsObservable,
|
|
3296
3361
|
processMap: processTransactionObservable
|
|
3297
|
-
}).subscribe(
|
|
3362
|
+
}).subscribe(_ref59 => {
|
|
3298
3363
|
let {
|
|
3299
3364
|
processMap,
|
|
3300
3365
|
transactions
|
|
3301
|
-
} =
|
|
3366
|
+
} = _ref59;
|
|
3302
3367
|
cb(convertRs(transactions, processMap));
|
|
3303
3368
|
});
|
|
3304
3369
|
port.onDisconnect.addListener(() => {
|
|
@@ -3319,10 +3384,10 @@ class KoniExtension {
|
|
|
3319
3384
|
});
|
|
3320
3385
|
return notificationSubject.value;
|
|
3321
3386
|
}
|
|
3322
|
-
async reloadCron(
|
|
3387
|
+
async reloadCron(_ref60) {
|
|
3323
3388
|
let {
|
|
3324
3389
|
data
|
|
3325
|
-
} =
|
|
3390
|
+
} = _ref60;
|
|
3326
3391
|
if (data === 'nft') {
|
|
3327
3392
|
return await this.#koniState.reloadNft();
|
|
3328
3393
|
} else if (data === 'staking') {
|
|
@@ -3365,10 +3430,10 @@ class KoniExtension {
|
|
|
3365
3430
|
}
|
|
3366
3431
|
|
|
3367
3432
|
// Phishing detect
|
|
3368
|
-
async passPhishingPage(
|
|
3433
|
+
async passPhishingPage(_ref61) {
|
|
3369
3434
|
let {
|
|
3370
3435
|
url
|
|
3371
|
-
} =
|
|
3436
|
+
} = _ref61;
|
|
3372
3437
|
return await this.#koniState.approvePassPhishingPage(url);
|
|
3373
3438
|
}
|
|
3374
3439
|
|
|
@@ -3389,10 +3454,10 @@ class KoniExtension {
|
|
|
3389
3454
|
/// Wallet connect
|
|
3390
3455
|
|
|
3391
3456
|
// Connect
|
|
3392
|
-
async connectWalletConnect(
|
|
3457
|
+
async connectWalletConnect(_ref62) {
|
|
3393
3458
|
let {
|
|
3394
3459
|
uri
|
|
3395
|
-
} =
|
|
3460
|
+
} = _ref62;
|
|
3396
3461
|
await this.#koniState.walletConnectService.connect(uri);
|
|
3397
3462
|
return true;
|
|
3398
3463
|
}
|
|
@@ -3405,11 +3470,11 @@ class KoniExtension {
|
|
|
3405
3470
|
});
|
|
3406
3471
|
return this.#koniState.requestService.allConnectWCRequests;
|
|
3407
3472
|
}
|
|
3408
|
-
async approveWalletConnectSession(
|
|
3473
|
+
async approveWalletConnectSession(_ref63) {
|
|
3409
3474
|
let {
|
|
3410
3475
|
accounts: selectedAccounts,
|
|
3411
3476
|
id
|
|
3412
|
-
} =
|
|
3477
|
+
} = _ref63;
|
|
3413
3478
|
const request = this.#koniState.requestService.getConnectWCRequest(id);
|
|
3414
3479
|
if ((0, _helpers2.isProposalExpired)(request.request.params)) {
|
|
3415
3480
|
throw new Error('The proposal has been expired');
|
|
@@ -3421,8 +3486,8 @@ class KoniExtension {
|
|
|
3421
3486
|
const availableNamespaces = {};
|
|
3422
3487
|
const namespaces = {};
|
|
3423
3488
|
const chainInfoMap = this.#koniState.getChainInfoMap();
|
|
3424
|
-
Object.entries(requiredNamespaces).forEach(
|
|
3425
|
-
let [key, namespace] =
|
|
3489
|
+
Object.entries(requiredNamespaces).forEach(_ref64 => {
|
|
3490
|
+
let [key, namespace] = _ref64;
|
|
3426
3491
|
if ((0, _helpers2.isSupportWalletConnectNamespace)(key)) {
|
|
3427
3492
|
if (namespace.chains) {
|
|
3428
3493
|
const unSupportChains = namespace.chains.filter(chain => !(0, _helpers2.isSupportWalletConnectChain)(chain, chainInfoMap));
|
|
@@ -3435,8 +3500,8 @@ class KoniExtension {
|
|
|
3435
3500
|
throw new Error((0, _utils10.getSdkError)('UNSUPPORTED_NAMESPACE_KEY').message + ' ' + key);
|
|
3436
3501
|
}
|
|
3437
3502
|
});
|
|
3438
|
-
Object.entries(optionalNamespaces).forEach(
|
|
3439
|
-
let [key, namespace] =
|
|
3503
|
+
Object.entries(optionalNamespaces).forEach(_ref65 => {
|
|
3504
|
+
let [key, namespace] = _ref65;
|
|
3440
3505
|
if ((0, _helpers2.isSupportWalletConnectNamespace)(key)) {
|
|
3441
3506
|
if (namespace.chains) {
|
|
3442
3507
|
const supportChains = namespace.chains.filter(chain => (0, _helpers2.isSupportWalletConnectChain)(chain, chainInfoMap)) || [];
|
|
@@ -3460,8 +3525,8 @@ class KoniExtension {
|
|
|
3460
3525
|
}
|
|
3461
3526
|
}
|
|
3462
3527
|
});
|
|
3463
|
-
Object.entries(availableNamespaces).forEach(
|
|
3464
|
-
let [key, namespace] =
|
|
3528
|
+
Object.entries(availableNamespaces).forEach(_ref66 => {
|
|
3529
|
+
let [key, namespace] = _ref66;
|
|
3465
3530
|
if (namespace.chains) {
|
|
3466
3531
|
const accounts = selectedAccounts.filter(address => {
|
|
3467
3532
|
const [_namespace] = address.split(':');
|
|
@@ -3485,10 +3550,10 @@ class KoniExtension {
|
|
|
3485
3550
|
request.resolve();
|
|
3486
3551
|
return true;
|
|
3487
3552
|
}
|
|
3488
|
-
async rejectWalletConnectSession(
|
|
3553
|
+
async rejectWalletConnectSession(_ref67) {
|
|
3489
3554
|
let {
|
|
3490
3555
|
id
|
|
3491
|
-
} =
|
|
3556
|
+
} = _ref67;
|
|
3492
3557
|
const request = this.#koniState.requestService.getConnectWCRequest(id);
|
|
3493
3558
|
const wcId = request.request.id;
|
|
3494
3559
|
if ((0, _helpers2.isProposalExpired)(request.request.params)) {
|
|
@@ -3510,10 +3575,10 @@ class KoniExtension {
|
|
|
3510
3575
|
});
|
|
3511
3576
|
return this.#koniState.walletConnectService.sessions;
|
|
3512
3577
|
}
|
|
3513
|
-
async disconnectWalletConnectSession(
|
|
3578
|
+
async disconnectWalletConnectSession(_ref68) {
|
|
3514
3579
|
let {
|
|
3515
3580
|
topic
|
|
3516
|
-
} =
|
|
3581
|
+
} = _ref68;
|
|
3517
3582
|
await this.#koniState.walletConnectService.disconnect(topic);
|
|
3518
3583
|
return true;
|
|
3519
3584
|
}
|
|
@@ -3526,18 +3591,18 @@ class KoniExtension {
|
|
|
3526
3591
|
});
|
|
3527
3592
|
return this.#koniState.requestService.allNotSupportWCRequests;
|
|
3528
3593
|
}
|
|
3529
|
-
approveWalletConnectNotSupport(
|
|
3594
|
+
approveWalletConnectNotSupport(_ref69) {
|
|
3530
3595
|
let {
|
|
3531
3596
|
id
|
|
3532
|
-
} =
|
|
3597
|
+
} = _ref69;
|
|
3533
3598
|
const request = this.#koniState.requestService.getNotSupportWCRequest(id);
|
|
3534
3599
|
request.resolve();
|
|
3535
3600
|
return true;
|
|
3536
3601
|
}
|
|
3537
|
-
rejectWalletConnectNotSupport(
|
|
3602
|
+
rejectWalletConnectNotSupport(_ref70) {
|
|
3538
3603
|
let {
|
|
3539
3604
|
id
|
|
3540
|
-
} =
|
|
3605
|
+
} = _ref70;
|
|
3541
3606
|
const request = this.#koniState.requestService.getNotSupportWCRequest(id);
|
|
3542
3607
|
request.reject(new Error('USER_REJECTED'));
|
|
3543
3608
|
return true;
|
|
@@ -3545,11 +3610,11 @@ class KoniExtension {
|
|
|
3545
3610
|
|
|
3546
3611
|
/// Manta
|
|
3547
3612
|
|
|
3548
|
-
async enableMantaPay(
|
|
3613
|
+
async enableMantaPay(_ref71) {
|
|
3549
3614
|
let {
|
|
3550
3615
|
address,
|
|
3551
3616
|
password
|
|
3552
|
-
} =
|
|
3617
|
+
} = _ref71;
|
|
3553
3618
|
// always takes the current account
|
|
3554
3619
|
function timeout() {
|
|
3555
3620
|
return new Promise(resolve => setTimeout(resolve, 1500));
|
|
@@ -3639,11 +3704,11 @@ class KoniExtension {
|
|
|
3639
3704
|
async disableMantaPay(address) {
|
|
3640
3705
|
return this.#koniState.disableMantaPay(address);
|
|
3641
3706
|
}
|
|
3642
|
-
async isTonBounceableAddress(
|
|
3707
|
+
async isTonBounceableAddress(_ref72) {
|
|
3643
3708
|
let {
|
|
3644
3709
|
address,
|
|
3645
3710
|
chain
|
|
3646
|
-
} =
|
|
3711
|
+
} = _ref72;
|
|
3647
3712
|
try {
|
|
3648
3713
|
const tonApi = this.#koniState.getTonApi(chain);
|
|
3649
3714
|
const state = await tonApi.getAccountState(address);
|
|
@@ -3689,10 +3754,10 @@ class KoniExtension {
|
|
|
3689
3754
|
|
|
3690
3755
|
/* Metadata */
|
|
3691
3756
|
|
|
3692
|
-
async findRawMetadata(
|
|
3757
|
+
async findRawMetadata(_ref73) {
|
|
3693
3758
|
let {
|
|
3694
3759
|
genesisHash
|
|
3695
|
-
} =
|
|
3760
|
+
} = _ref73;
|
|
3696
3761
|
const {
|
|
3697
3762
|
metadata,
|
|
3698
3763
|
specVersion,
|
|
@@ -3706,20 +3771,20 @@ class KoniExtension {
|
|
|
3706
3771
|
userExtensions
|
|
3707
3772
|
};
|
|
3708
3773
|
}
|
|
3709
|
-
async calculateMetadataHash(
|
|
3774
|
+
async calculateMetadataHash(_ref74) {
|
|
3710
3775
|
let {
|
|
3711
3776
|
chain
|
|
3712
|
-
} =
|
|
3777
|
+
} = _ref74;
|
|
3713
3778
|
const hash = await this.#koniState.calculateMetadataHash(chain);
|
|
3714
3779
|
return {
|
|
3715
3780
|
metadataHash: hash || ''
|
|
3716
3781
|
};
|
|
3717
3782
|
}
|
|
3718
|
-
async shortenMetadata(
|
|
3783
|
+
async shortenMetadata(_ref75) {
|
|
3719
3784
|
let {
|
|
3720
3785
|
chain,
|
|
3721
3786
|
txBlob
|
|
3722
|
-
} =
|
|
3787
|
+
} = _ref75;
|
|
3723
3788
|
const shorten = await this.#koniState.shortenMetadata(chain, txBlob);
|
|
3724
3789
|
return {
|
|
3725
3790
|
txMetadata: shorten || ''
|
|
@@ -3890,6 +3955,10 @@ class KoniExtension {
|
|
|
3890
3955
|
});
|
|
3891
3956
|
}
|
|
3892
3957
|
}
|
|
3958
|
+
let balanceTypeForPool = _types4.BalanceType.TRANSFERABLE;
|
|
3959
|
+
if (!!poolHandler && [_types4.YieldPoolType.NATIVE_STAKING, _types4.YieldPoolType.NOMINATION_POOL].includes(poolHandler.type)) {
|
|
3960
|
+
balanceTypeForPool = _types4.BalanceType.TOTAL_MINUS_RESERVED;
|
|
3961
|
+
}
|
|
3893
3962
|
return await this.#koniState.transactionService.handleTransaction({
|
|
3894
3963
|
address,
|
|
3895
3964
|
chain: txChain,
|
|
@@ -3901,6 +3970,7 @@ class KoniExtension {
|
|
|
3901
3970
|
chainType,
|
|
3902
3971
|
resolveOnDone: !isLastStep,
|
|
3903
3972
|
transferNativeAmount,
|
|
3973
|
+
balanceType: balanceTypeForPool,
|
|
3904
3974
|
skipFeeValidation: isMintingStep && isPoolSupportAlternativeFee,
|
|
3905
3975
|
errorOnTimeOut,
|
|
3906
3976
|
...this.createPassConfirmationParams(isPassConfirmation),
|
|
@@ -4091,18 +4161,18 @@ class KoniExtension {
|
|
|
4091
4161
|
|
|
4092
4162
|
/* Campaign */
|
|
4093
4163
|
|
|
4094
|
-
unlockDotCheckCanMint(
|
|
4164
|
+
unlockDotCheckCanMint(_ref76) {
|
|
4095
4165
|
let {
|
|
4096
4166
|
address,
|
|
4097
4167
|
network,
|
|
4098
4168
|
slug
|
|
4099
|
-
} =
|
|
4169
|
+
} = _ref76;
|
|
4100
4170
|
return this.#koniState.mintCampaignService.unlockDotCampaign.canMint(address, slug, network);
|
|
4101
4171
|
}
|
|
4102
|
-
unlockDotSubscribeMintedData(id, port,
|
|
4172
|
+
unlockDotSubscribeMintedData(id, port, _ref77) {
|
|
4103
4173
|
let {
|
|
4104
4174
|
transactionId
|
|
4105
|
-
} =
|
|
4175
|
+
} = _ref77;
|
|
4106
4176
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
4107
4177
|
const subscription = this.#koniState.mintCampaignService.unlockDotCampaign.subscribeMintedNft(transactionId, cb);
|
|
4108
4178
|
this.createUnsubscriptionHandle(id, subscription.unsubscribe);
|
|
@@ -4134,10 +4204,10 @@ class KoniExtension {
|
|
|
4134
4204
|
});
|
|
4135
4205
|
return filterBanner(await this.#koniState.campaignService.getProcessingCampaign());
|
|
4136
4206
|
}
|
|
4137
|
-
async completeCampaignBanner(
|
|
4207
|
+
async completeCampaignBanner(_ref78) {
|
|
4138
4208
|
let {
|
|
4139
4209
|
slug
|
|
4140
|
-
} =
|
|
4210
|
+
} = _ref78;
|
|
4141
4211
|
const campaign = await this.#koniState.dbService.getCampaign(slug);
|
|
4142
4212
|
if (campaign) {
|
|
4143
4213
|
await this.#koniState.dbService.upsertCampaign({
|
|
@@ -4672,8 +4742,8 @@ class KoniExtension {
|
|
|
4672
4742
|
resolve();
|
|
4673
4743
|
}
|
|
4674
4744
|
};
|
|
4675
|
-
this.#koniState.balanceService.subscribeTransferableBalance(address, waitXcmData.chain, waitXcmData.token, waitXcmData.nextTxType, onRs).then(
|
|
4676
|
-
let [_unsub, rs] =
|
|
4745
|
+
this.#koniState.balanceService.subscribeTransferableBalance(address, waitXcmData.chain, waitXcmData.token, waitXcmData.nextTxType, onRs).then(_ref79 => {
|
|
4746
|
+
let [_unsub, rs] = _ref79;
|
|
4677
4747
|
unsub = _unsub;
|
|
4678
4748
|
onRs(rs);
|
|
4679
4749
|
}).catch(console.error);
|
|
@@ -4903,6 +4973,8 @@ class KoniExtension {
|
|
|
4903
4973
|
return await this.getNftCollection();
|
|
4904
4974
|
case 'pri(nftCollection.getSubscription)':
|
|
4905
4975
|
return await this.subscribeNftCollection(id, port);
|
|
4976
|
+
case 'pri(nft.getFullList)':
|
|
4977
|
+
return await this.handleGetNftFullList(request);
|
|
4906
4978
|
case 'pri(staking.getStaking)':
|
|
4907
4979
|
return this.getStaking();
|
|
4908
4980
|
case 'pri(staking.getSubscription)':
|
|
@@ -5111,6 +5183,10 @@ class KoniExtension {
|
|
|
5111
5183
|
return this.getAddressTransferableBalance(request);
|
|
5112
5184
|
case 'pri(freeBalance.subscribe)':
|
|
5113
5185
|
return this.subscribeAddressTransferableBalance(request, id, port);
|
|
5186
|
+
case 'pri(availableBalance.getBalanceByType)':
|
|
5187
|
+
return this.getAddressAvailableBalanceByType(request);
|
|
5188
|
+
case 'pri(availableBalance.subscribeBalanceByType)':
|
|
5189
|
+
return this.subscribeAddressAvailableBalanceByType(request, id, port);
|
|
5114
5190
|
case 'pri(subscription.cancel)':
|
|
5115
5191
|
return this.cancelSubscription(request);
|
|
5116
5192
|
case 'pri(chainService.recoverSubstrateApi)':
|