@subwallet/extension-base 1.0.1 → 1.0.2-1b
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 +25 -36
- package/background/KoniTypes.js +12 -7
- package/background/errors/TransactionError.js +21 -1
- package/cjs/background/KoniTypes.js +14 -8
- package/cjs/background/errors/TransactionError.js +20 -0
- package/cjs/constants/index.js +13 -28
- package/cjs/koni/api/dotsama/balance.js +60 -224
- package/cjs/koni/api/dotsama/transfer.js +30 -29
- package/cjs/koni/api/nft/acala_nft/index.js +4 -1
- package/cjs/koni/api/nft/bit.country/index.js +4 -1
- package/cjs/koni/api/nft/evm_nft/index.js +7 -3
- package/cjs/koni/api/nft/index.js +3 -6
- package/cjs/koni/api/nft/karura_nft/index.js +4 -1
- package/cjs/koni/api/nft/rmrk_nft/index.js +8 -1
- package/cjs/koni/api/nft/statemine_nft/index.js +4 -1
- package/cjs/koni/api/nft/unique_nft/index.js +6 -1
- package/cjs/koni/api/nft/wasm_nft/index.js +169 -111
- package/cjs/koni/api/nft/wasm_nft/utils.js +11 -7
- package/cjs/koni/api/staking/bonding/amplitude.js +18 -10
- package/cjs/koni/api/staking/bonding/astar.js +37 -238
- package/cjs/koni/api/staking/bonding/index.js +26 -14
- package/cjs/koni/api/staking/bonding/paraChain.js +100 -11
- package/cjs/koni/api/staking/bonding/relayChain.js +174 -16
- package/cjs/koni/api/staking/bonding/utils.js +55 -10
- package/cjs/koni/api/tokens/wasm/index.js +5 -4
- package/cjs/koni/api/tokens/wasm/utils.js +63 -0
- package/cjs/koni/api/xcm/index.js +0 -111
- package/cjs/koni/api/xcm/polkadotXcm.js +2 -2
- package/cjs/koni/api/xcm/utils.js +18 -13
- package/cjs/koni/api/xcm/xTokens.js +3 -5
- package/cjs/koni/api/xcm/xcmPallet.js +9 -6
- package/cjs/koni/background/cron.js +179 -77
- package/cjs/koni/background/handlers/Extension.js +231 -195
- package/cjs/koni/background/handlers/State.js +147 -111
- package/cjs/koni/background/handlers/Tabs.js +48 -39
- package/cjs/koni/background/subscription.js +64 -56
- package/cjs/packageInfo.js +1 -1
- package/cjs/page/index.js +5 -0
- package/cjs/services/chain-service/constants.js +1 -11
- package/cjs/services/chain-service/handler/SubstrateChainHandler.js +13 -8
- package/cjs/services/chain-service/handler/light-client/index.js +2 -0
- package/cjs/services/chain-service/index.js +39 -6
- package/cjs/services/chain-service/utils.js +4 -0
- package/cjs/services/event-service/index.js +75 -0
- package/cjs/services/event-service/types.js +11 -0
- package/cjs/services/history-service/index.js +46 -21
- package/cjs/services/history-service/subsquid-multi-chain-history.js +19 -11
- package/cjs/services/keyring-service/index.js +101 -0
- package/cjs/services/migration-service/index.js +13 -10
- package/cjs/{koni/migration/scripts/RemoveWrongCrowdloan.js → services/migration-service/scripts/AutoEnableChainsTokens.js} +11 -6
- package/cjs/services/migration-service/scripts/MigrateNetworkSettings.js +39 -19
- package/cjs/services/migration-service/scripts/MigrateSettings.js +31 -0
- package/cjs/services/migration-service/scripts/MigrateTransactionHistory.js +72 -0
- package/cjs/services/migration-service/scripts/index.js +13 -4
- package/cjs/services/price-service/coingecko.js +15 -3
- package/cjs/services/price-service/index.js +15 -18
- package/cjs/services/request-service/constants.js +8 -2
- package/cjs/services/request-service/handler/AuthRequestHandler.js +43 -12
- package/cjs/services/request-service/index.js +3 -0
- package/cjs/services/storage-service/DatabaseService.js +53 -34
- package/cjs/services/storage-service/databases/index.js +1 -1
- package/cjs/services/storage-service/db-stores/BaseStoreWithAddressAndChain.js +2 -8
- package/cjs/services/storage-service/db-stores/Nft.js +8 -18
- package/cjs/services/storage-service/db-stores/Transaction.js +10 -7
- package/cjs/services/subscan-service/index.js +107 -0
- package/cjs/services/subscan-service/subscan-chain-map.js +74 -0
- package/cjs/services/subscan-service/types.js +1 -0
- package/cjs/services/transaction-service/event-parser/index.js +20 -48
- package/cjs/services/transaction-service/index.js +66 -22
- package/cjs/services/transaction-service/utils.js +4 -6
- package/cjs/utils/address.js +9 -1
- package/cjs/utils/index.js +30 -26
- package/constants/index.d.ts +8 -13
- package/constants/index.js +8 -13
- package/koni/api/dotsama/balance.d.ts +0 -1
- package/koni/api/dotsama/balance.js +33 -197
- package/koni/api/dotsama/transfer.js +5 -4
- package/koni/api/nft/acala_nft/index.js +3 -1
- package/koni/api/nft/bit.country/index.js +3 -1
- package/koni/api/nft/evm_nft/index.js +6 -3
- package/koni/api/nft/index.d.ts +1 -2
- package/koni/api/nft/index.js +3 -6
- package/koni/api/nft/karura_nft/index.js +3 -1
- package/koni/api/nft/nft.d.ts +1 -0
- package/koni/api/nft/rmrk_nft/index.js +8 -1
- package/koni/api/nft/statemine_nft/index.js +3 -1
- package/koni/api/nft/unique_nft/index.js +5 -1
- package/koni/api/nft/wasm_nft/index.d.ts +0 -2
- package/koni/api/nft/wasm_nft/index.js +167 -109
- package/koni/api/nft/wasm_nft/utils.d.ts +7 -5
- package/koni/api/nft/wasm_nft/utils.js +7 -5
- package/koni/api/staking/bonding/amplitude.d.ts +1 -2
- package/koni/api/staking/bonding/amplitude.js +22 -13
- package/koni/api/staking/bonding/astar.d.ts +2 -11
- package/koni/api/staking/bonding/astar.js +39 -231
- package/koni/api/staking/bonding/index.d.ts +5 -2
- package/koni/api/staking/bonding/index.js +27 -17
- package/koni/api/staking/bonding/paraChain.d.ts +4 -1
- package/koni/api/staking/bonding/paraChain.js +101 -14
- package/koni/api/staking/bonding/relayChain.d.ts +6 -2
- package/koni/api/staking/bonding/relayChain.js +172 -17
- package/koni/api/staking/bonding/utils.d.ts +15 -2
- package/koni/api/staking/bonding/utils.js +53 -11
- package/koni/api/tokens/wasm/index.js +5 -4
- package/koni/api/tokens/wasm/utils.d.ts +6 -0
- package/koni/api/tokens/wasm/utils.js +54 -0
- package/koni/api/xcm/index.js +1 -112
- package/koni/api/xcm/polkadotXcm.js +3 -3
- package/koni/api/xcm/utils.d.ts +5 -6
- package/koni/api/xcm/utils.js +15 -10
- package/koni/api/xcm/xTokens.js +5 -7
- package/koni/api/xcm/xcmPallet.js +10 -9
- package/koni/background/cron.d.ts +6 -1
- package/koni/background/cron.js +179 -76
- package/koni/background/handlers/Extension.d.ts +2 -2
- package/koni/background/handlers/Extension.js +161 -125
- package/koni/background/handlers/State.d.ts +21 -20
- package/koni/background/handlers/State.js +144 -111
- package/koni/background/handlers/Tabs.js +30 -20
- package/koni/background/subscription.d.ts +1 -1
- package/koni/background/subscription.js +64 -58
- package/package.json +63 -18
- package/packageInfo.js +1 -1
- package/page/index.d.ts +2 -0
- package/page/index.js +4 -0
- package/services/chain-service/constants.d.ts +0 -1
- package/services/chain-service/constants.js +0 -9
- package/services/chain-service/handler/SubstrateChainHandler.js +14 -9
- package/services/chain-service/handler/light-client/index.d.ts +17 -1
- package/services/chain-service/handler/light-client/index.js +1 -1
- package/services/chain-service/helper/psp22_abi.json +1041 -881
- package/services/chain-service/helper/psp34_abi.json +2963 -1807
- package/services/chain-service/index.d.ts +6 -4
- package/services/chain-service/index.js +40 -9
- package/services/chain-service/utils.d.ts +1 -0
- package/services/chain-service/utils.js +3 -0
- package/services/event-service/index.d.ts +22 -0
- package/services/event-service/index.js +63 -0
- package/services/event-service/types.d.ts +28 -0
- package/services/event-service/types.js +4 -0
- package/services/history-service/index.d.ts +5 -3
- package/services/history-service/index.js +46 -21
- package/services/history-service/subsquid-multi-chain-history.js +22 -13
- package/services/keyring-service/index.d.ts +19 -0
- package/services/keyring-service/index.js +93 -0
- package/services/migration-service/index.js +11 -9
- package/services/migration-service/scripts/AutoEnableChainsTokens.d.ts +4 -0
- package/services/migration-service/scripts/AutoEnableChainsTokens.js +13 -0
- package/services/migration-service/scripts/MigrateNetworkSettings.js +37 -18
- package/services/migration-service/scripts/MigrateSettings.d.ts +4 -0
- package/services/migration-service/scripts/MigrateSettings.js +23 -0
- package/services/migration-service/scripts/MigrateTransactionHistory.d.ts +4 -0
- package/services/migration-service/scripts/MigrateTransactionHistory.js +64 -0
- package/services/migration-service/scripts/index.d.ts +1 -0
- package/services/migration-service/scripts/index.js +10 -3
- package/services/price-service/coingecko.js +15 -3
- package/services/price-service/index.d.ts +5 -3
- package/services/price-service/index.js +15 -18
- package/services/request-service/constants.d.ts +1 -0
- package/services/request-service/constants.js +6 -1
- package/services/request-service/handler/AuthRequestHandler.d.ts +8 -1
- package/services/request-service/handler/AuthRequestHandler.js +44 -13
- package/services/request-service/index.d.ts +7 -1
- package/services/request-service/index.js +3 -0
- package/services/storage-service/DatabaseService.d.ts +1 -0
- package/services/storage-service/DatabaseService.js +53 -34
- package/services/storage-service/databases/index.js +1 -1
- package/services/storage-service/db-stores/BaseStoreWithAddressAndChain.d.ts +1 -1
- package/services/storage-service/db-stores/BaseStoreWithAddressAndChain.js +2 -8
- package/services/storage-service/db-stores/Nft.d.ts +3 -3
- package/services/storage-service/db-stores/Nft.js +8 -17
- package/services/storage-service/db-stores/Transaction.js +10 -7
- package/services/subscan-service/index.d.ts +20 -0
- package/services/subscan-service/index.js +99 -0
- package/services/subscan-service/subscan-chain-map.d.ts +5 -0
- package/services/subscan-service/subscan-chain-map.js +63 -0
- package/services/subscan-service/types.d.ts +27 -0
- package/services/subscan-service/types.js +1 -0
- package/services/transaction-service/event-parser/index.d.ts +2 -2
- package/services/transaction-service/event-parser/index.js +21 -49
- package/services/transaction-service/index.d.ts +4 -2
- package/services/transaction-service/index.js +66 -22
- package/services/transaction-service/utils.js +5 -6
- package/utils/address.d.ts +1 -0
- package/utils/address.js +9 -2
- package/utils/index.d.ts +2 -1
- package/utils/index.js +26 -23
- package/cjs/background/errors/EvmRpcError.js +0 -21
- package/cjs/background/errors/SubWalletProviderError.js +0 -17
- package/cjs/constants/ethereum.js +0 -19
- package/cjs/errors/SubWalletProviderError.js +0 -17
- package/cjs/koni/api/xcm/astar.js +0 -160
- package/cjs/koni/api/xcm/moonbeamXcm.js +0 -80
- package/cjs/koni/api/xcm/statemintXcm.js +0 -197
- package/cjs/koni/api/xcm/substrateXcm.js +0 -213
- package/cjs/koni/migration/Base.js +0 -20
- package/cjs/koni/migration/index.js +0 -45
- package/cjs/koni/migration/scripts/ChangeRouteToHome.js +0 -22
- package/cjs/koni/migration/scripts/ClearOldStorage.js +0 -24
- package/cjs/koni/migration/scripts/RemoveWrongTransactionHistoriesFromStore.js +0 -36
- package/cjs/koni/migration/scripts/ResetTransactionHistoryEventIdx.js +0 -21
- package/cjs/koni/migration/scripts/index.js +0 -22
- package/cjs/koni/page/index.js +0 -16
- package/cjs/services/asset-service/index.js +0 -91
- package/cjs/services/storage-service/db-stores/ExtraDelegationInfo.js +0 -17
- package/cjs/stores/Balance.js +0 -18
- package/cjs/stores/Crowdloan.js +0 -18
- package/cjs/stores/CustomEvmToken.js +0 -18
- package/cjs/stores/NetworkMap.js +0 -18
- package/cjs/stores/Nft.js +0 -18
- package/cjs/stores/NftCollection.js +0 -18
- package/cjs/stores/Price.js +0 -18
- package/cjs/stores/Staking.js +0 -18
- package/cjs/stores/StakingReward.js +0 -18
- package/cjs/utils/eth/parseTransactionData.js +0 -284
- package/koni/page/index.d.ts +0 -2
- package/koni/page/index.js +0 -9
- /package/cjs/{koni/page → page}/SubWalleEvmProvider.js +0 -0
- /package/{koni/page → page}/SubWalleEvmProvider.d.ts +0 -0
- /package/{koni/page → page}/SubWalleEvmProvider.js +0 -0
|
@@ -62,6 +62,7 @@ const ACCOUNT_ALL_JSON = {
|
|
|
62
62
|
name: 'All'
|
|
63
63
|
};
|
|
64
64
|
class KoniExtension {
|
|
65
|
+
#lockTimeOut = undefined;
|
|
65
66
|
#koniState;
|
|
66
67
|
constructor(state) {
|
|
67
68
|
this.#koniState = state;
|
|
@@ -429,36 +430,38 @@ class KoniExtension {
|
|
|
429
430
|
}
|
|
430
431
|
async accountsGetAllWithCurrentAddress(id, port) {
|
|
431
432
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
this.cancelSubscription(id);
|
|
460
|
-
});
|
|
433
|
+
const keyringService = this.#koniState.keyringService;
|
|
434
|
+
await this.#koniState.eventService.waitAccountReady;
|
|
435
|
+
const currentAccount = keyringService.currentAccount;
|
|
436
|
+
const accountsSubject = _uiKeyring.keyring.accounts.subject;
|
|
437
|
+
const transformedAccounts = transformAccounts(accountsSubject.value);
|
|
438
|
+
const responseData = {
|
|
439
|
+
accounts: transformedAccounts !== null && transformedAccounts !== void 0 && transformedAccounts.length ? [{
|
|
440
|
+
...ACCOUNT_ALL_JSON
|
|
441
|
+
}, ...transformedAccounts] : [],
|
|
442
|
+
currentAddress: currentAccount === null || currentAccount === void 0 ? void 0 : currentAccount.address,
|
|
443
|
+
currentGenesisHash: currentAccount === null || currentAccount === void 0 ? void 0 : currentAccount.currentGenesisHash
|
|
444
|
+
};
|
|
445
|
+
const subscriptionAccounts = accountsSubject.subscribe(storedAccounts => {
|
|
446
|
+
const transformedAccounts = transformAccounts(storedAccounts);
|
|
447
|
+
responseData.accounts = transformedAccounts !== null && transformedAccounts !== void 0 && transformedAccounts.length ? [{
|
|
448
|
+
...ACCOUNT_ALL_JSON
|
|
449
|
+
}, ...transformedAccounts] : [];
|
|
450
|
+
cb(responseData);
|
|
451
|
+
});
|
|
452
|
+
const subscriptionCurrentAccount = keyringService.currentAccountSubject.subscribe(currentAccountData => {
|
|
453
|
+
responseData.currentAddress = currentAccountData.address;
|
|
454
|
+
responseData.currentGenesisHash = currentAccountData.currentGenesisHash;
|
|
455
|
+
cb(responseData);
|
|
456
|
+
});
|
|
457
|
+
this.createUnsubscriptionHandle(id, () => {
|
|
458
|
+
subscriptionAccounts.unsubscribe();
|
|
459
|
+
subscriptionCurrentAccount.unsubscribe();
|
|
461
460
|
});
|
|
461
|
+
port.onDisconnect.addListener(() => {
|
|
462
|
+
this.cancelSubscription(id);
|
|
463
|
+
});
|
|
464
|
+
return responseData;
|
|
462
465
|
}
|
|
463
466
|
accountsGetAll(id, port) {
|
|
464
467
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
@@ -480,11 +483,15 @@ class KoniExtension {
|
|
|
480
483
|
} = _ref21;
|
|
481
484
|
return _uiKeyring.keyring.saveRecent(accountId);
|
|
482
485
|
}
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
486
|
+
|
|
487
|
+
// private triggerAccountsSubscription (): boolean {
|
|
488
|
+
// const accountsSubject = accountsObservable.subject;
|
|
489
|
+
//
|
|
490
|
+
// accountsSubject.next(accountsSubject.getValue());
|
|
491
|
+
//
|
|
492
|
+
// return true;
|
|
493
|
+
// }
|
|
494
|
+
|
|
488
495
|
_getAuthListV2() {
|
|
489
496
|
return new Promise((resolve, reject) => {
|
|
490
497
|
this.#koniState.getAuthorize(rs => {
|
|
@@ -830,40 +837,40 @@ class KoniExtension {
|
|
|
830
837
|
return await this.#koniState.getAuthList();
|
|
831
838
|
}
|
|
832
839
|
_saveCurrentAccountAddress(address, callback) {
|
|
833
|
-
this.#koniState.
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
840
|
+
let accountInfo = this.#koniState.keyringService.currentAccount;
|
|
841
|
+
if (!accountInfo) {
|
|
842
|
+
accountInfo = {
|
|
843
|
+
address,
|
|
844
|
+
currentGenesisHash: _constants.ALL_GENESIS_HASH,
|
|
845
|
+
allGenesisHash: _constants.ALL_GENESIS_HASH || undefined
|
|
846
|
+
};
|
|
847
|
+
} else {
|
|
848
|
+
accountInfo.address = address;
|
|
849
|
+
if (address !== _constants.ALL_ACCOUNT_KEY) {
|
|
850
|
+
try {
|
|
851
|
+
const currentKeyPair = _uiKeyring.keyring.getPair(address);
|
|
844
852
|
accountInfo.currentGenesisHash = (currentKeyPair === null || currentKeyPair === void 0 ? void 0 : currentKeyPair.meta.genesisHash) || _constants.ALL_GENESIS_HASH;
|
|
845
|
-
}
|
|
846
|
-
accountInfo.currentGenesisHash =
|
|
853
|
+
} catch {
|
|
854
|
+
accountInfo.currentGenesisHash = _constants.ALL_GENESIS_HASH;
|
|
847
855
|
}
|
|
856
|
+
} else {
|
|
857
|
+
accountInfo.currentGenesisHash = accountInfo.allGenesisHash || _constants.ALL_GENESIS_HASH;
|
|
848
858
|
}
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
859
|
+
}
|
|
860
|
+
this.#koniState.setCurrentAccount(accountInfo, () => {
|
|
861
|
+
callback && callback(accountInfo);
|
|
852
862
|
});
|
|
853
863
|
}
|
|
854
864
|
updateCurrentAccountAddress(address) {
|
|
855
|
-
this._saveCurrentAccountAddress(address
|
|
856
|
-
this.triggerAccountsSubscription();
|
|
857
|
-
});
|
|
865
|
+
this._saveCurrentAccountAddress(address);
|
|
858
866
|
return true;
|
|
859
867
|
}
|
|
860
|
-
saveCurrentAccountAddress(data
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
868
|
+
async saveCurrentAccountAddress(data) {
|
|
869
|
+
return new Promise(resolve => {
|
|
870
|
+
this._saveCurrentAccountAddress(data.address, currentInfo => {
|
|
871
|
+
resolve(currentInfo);
|
|
872
|
+
});
|
|
865
873
|
});
|
|
866
|
-
return true;
|
|
867
874
|
}
|
|
868
875
|
async getAssetSetting() {
|
|
869
876
|
return this.#koniState.chainService.getAssetSettings();
|
|
@@ -880,6 +887,7 @@ class KoniExtension {
|
|
|
880
887
|
async updateAssetSetting(params) {
|
|
881
888
|
try {
|
|
882
889
|
await this.#koniState.chainService.updateAssetSetting(params.tokenSlug, params.assetSetting);
|
|
890
|
+
this.#koniState.eventService.emit('asset.updateState', params.tokenSlug);
|
|
883
891
|
return true;
|
|
884
892
|
} catch (e) {
|
|
885
893
|
console.error('Error updating asset setting', e);
|
|
@@ -1004,16 +1012,10 @@ class KoniExtension {
|
|
|
1004
1012
|
throw Error('Require password to set up master password');
|
|
1005
1013
|
} else {
|
|
1006
1014
|
_uiKeyring.keyring.changeMasterPassword(password);
|
|
1007
|
-
this.#koniState.
|
|
1008
|
-
hasMasterPassword: true,
|
|
1009
|
-
isLocked: false,
|
|
1010
|
-
isReady: true
|
|
1011
|
-
});
|
|
1015
|
+
this.#koniState.updateKeyringState();
|
|
1012
1016
|
}
|
|
1013
1017
|
}
|
|
1014
|
-
const currentAccount =
|
|
1015
|
-
this.#koniState.getCurrentAccount(resolve);
|
|
1016
|
-
});
|
|
1018
|
+
const currentAccount = this.#koniState.keyringService.currentAccount;
|
|
1017
1019
|
const allGenesisHash = (currentAccount === null || currentAccount === void 0 ? void 0 : currentAccount.allGenesisHash) || undefined;
|
|
1018
1020
|
types === null || types === void 0 ? void 0 : types.forEach(type => {
|
|
1019
1021
|
const suri = getSuri(_suri, type);
|
|
@@ -1074,29 +1076,22 @@ class KoniExtension {
|
|
|
1074
1076
|
});
|
|
1075
1077
|
});
|
|
1076
1078
|
|
|
1077
|
-
// Remove history
|
|
1078
|
-
await this.#koniState.historyService.removeHistoryByAddress(address);
|
|
1079
|
-
|
|
1080
1079
|
// Set current account to all account
|
|
1081
1080
|
await new Promise(resolve => {
|
|
1082
|
-
this.#koniState.
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
currentGenesisHash: allGenesisHash || null,
|
|
1088
|
-
address: _constants.ALL_ACCOUNT_KEY
|
|
1089
|
-
}, resolve);
|
|
1090
|
-
});
|
|
1081
|
+
const currentAccountInfo = this.#koniState.keyringService.currentAccount;
|
|
1082
|
+
this.#koniState.setCurrentAccount({
|
|
1083
|
+
currentGenesisHash: (currentAccountInfo === null || currentAccountInfo === void 0 ? void 0 : currentAccountInfo.allGenesisHash) || null,
|
|
1084
|
+
address: _constants.ALL_ACCOUNT_KEY
|
|
1085
|
+
}, resolve);
|
|
1091
1086
|
});
|
|
1092
1087
|
return true;
|
|
1093
1088
|
}
|
|
1094
|
-
seedCreateV2(
|
|
1089
|
+
seedCreateV2(_ref28) {
|
|
1095
1090
|
let {
|
|
1096
1091
|
length = _Extension.SEED_DEFAULT_LENGTH,
|
|
1097
1092
|
seed: _seed,
|
|
1098
1093
|
types
|
|
1099
|
-
} =
|
|
1094
|
+
} = _ref28;
|
|
1100
1095
|
const seed = _seed || (0, _utilCrypto.mnemonicGenerate)(length);
|
|
1101
1096
|
const rs = {
|
|
1102
1097
|
seed: seed,
|
|
@@ -1107,11 +1102,11 @@ class KoniExtension {
|
|
|
1107
1102
|
});
|
|
1108
1103
|
return rs;
|
|
1109
1104
|
}
|
|
1110
|
-
seedValidateV2(
|
|
1105
|
+
seedValidateV2(_ref29) {
|
|
1111
1106
|
let {
|
|
1112
1107
|
suri,
|
|
1113
1108
|
types
|
|
1114
|
-
} =
|
|
1109
|
+
} = _ref29;
|
|
1115
1110
|
const {
|
|
1116
1111
|
phrase
|
|
1117
1112
|
} = (0, _utilCrypto.keyExtractSuri)(suri);
|
|
@@ -1131,11 +1126,11 @@ class KoniExtension {
|
|
|
1131
1126
|
});
|
|
1132
1127
|
return rs;
|
|
1133
1128
|
}
|
|
1134
|
-
_checkValidatePrivateKey(
|
|
1129
|
+
_checkValidatePrivateKey(_ref30) {
|
|
1135
1130
|
let {
|
|
1136
1131
|
suri,
|
|
1137
1132
|
types
|
|
1138
|
-
} =
|
|
1133
|
+
} = _ref30;
|
|
1139
1134
|
let autoAddPrefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1140
1135
|
const {
|
|
1141
1136
|
phrase
|
|
@@ -1158,11 +1153,11 @@ class KoniExtension {
|
|
|
1158
1153
|
}
|
|
1159
1154
|
return rs;
|
|
1160
1155
|
}
|
|
1161
|
-
metamaskPrivateKeyValidateV2(
|
|
1156
|
+
metamaskPrivateKeyValidateV2(_ref31) {
|
|
1162
1157
|
let {
|
|
1163
1158
|
suri,
|
|
1164
1159
|
types
|
|
1165
|
-
} =
|
|
1160
|
+
} = _ref31;
|
|
1166
1161
|
const isValidSuri = suri.startsWith('0x');
|
|
1167
1162
|
if (isValidSuri) {
|
|
1168
1163
|
return this._checkValidatePrivateKey({
|
|
@@ -1187,14 +1182,14 @@ class KoniExtension {
|
|
|
1187
1182
|
throw new Error(`"${suri}" is not a valid derivation path`);
|
|
1188
1183
|
}
|
|
1189
1184
|
}
|
|
1190
|
-
derivationCreateV2(
|
|
1185
|
+
derivationCreateV2(_ref32) {
|
|
1191
1186
|
let {
|
|
1192
1187
|
genesisHash,
|
|
1193
1188
|
isAllowed,
|
|
1194
1189
|
name,
|
|
1195
1190
|
parentAddress,
|
|
1196
1191
|
suri
|
|
1197
|
-
} =
|
|
1192
|
+
} = _ref32;
|
|
1198
1193
|
const childPair = this.deriveV2(parentAddress, suri, {
|
|
1199
1194
|
genesisHash,
|
|
1200
1195
|
name,
|
|
@@ -1208,14 +1203,14 @@ class KoniExtension {
|
|
|
1208
1203
|
});
|
|
1209
1204
|
return true;
|
|
1210
1205
|
}
|
|
1211
|
-
jsonRestoreV2(
|
|
1206
|
+
jsonRestoreV2(_ref33) {
|
|
1212
1207
|
let {
|
|
1213
1208
|
address,
|
|
1214
1209
|
file,
|
|
1215
1210
|
isAllowed,
|
|
1216
1211
|
password,
|
|
1217
1212
|
withMasterPassword
|
|
1218
|
-
} =
|
|
1213
|
+
} = _ref33;
|
|
1219
1214
|
const isPasswordValidated = this.validatePassword(file, password);
|
|
1220
1215
|
if (isPasswordValidated) {
|
|
1221
1216
|
try {
|
|
@@ -1230,13 +1225,13 @@ class KoniExtension {
|
|
|
1230
1225
|
throw new Error('Unable to decode using the supplied passphrase');
|
|
1231
1226
|
}
|
|
1232
1227
|
}
|
|
1233
|
-
batchRestoreV2(
|
|
1228
|
+
batchRestoreV2(_ref34) {
|
|
1234
1229
|
let {
|
|
1235
1230
|
accountsInfo,
|
|
1236
1231
|
file,
|
|
1237
1232
|
isAllowed,
|
|
1238
1233
|
password
|
|
1239
|
-
} =
|
|
1234
|
+
} = _ref34;
|
|
1240
1235
|
const addressList = accountsInfo.map(acc => acc.address);
|
|
1241
1236
|
const isPasswordValidated = this.validatedAccountsPassword(file, password);
|
|
1242
1237
|
if (isPasswordValidated) {
|
|
@@ -1346,7 +1341,7 @@ class KoniExtension {
|
|
|
1346
1341
|
if (!tokenInfo) {
|
|
1347
1342
|
errors.push(new _TransactionError.TransactionError(_KoniTypes.BasicTxErrorType.INVALID_PARAMS, 'Not found token from registry'));
|
|
1348
1343
|
}
|
|
1349
|
-
if ((0, _utilCrypto.isEthereumAddress)(from) && (0, _utilCrypto.isEthereumAddress)(to) &&
|
|
1344
|
+
if ((0, _utilCrypto.isEthereumAddress)(from) && (0, _utilCrypto.isEthereumAddress)(to) && (0, _utils._isTokenEvmSmartContract)(tokenInfo) && (0, _utils._getContractAddressOfToken)(tokenInfo).length === 0) {
|
|
1350
1345
|
errors.push(new _TransactionError.TransactionError(_KoniTypes.BasicTxErrorType.INVALID_PARAMS, 'Not found ERC20 address for this token'));
|
|
1351
1346
|
}
|
|
1352
1347
|
return [errors, keypair, transferValue, tokenInfo];
|
|
@@ -1380,17 +1375,15 @@ class KoniExtension {
|
|
|
1380
1375
|
|
|
1381
1376
|
// Get native token amount
|
|
1382
1377
|
const freeBalance = await this.#koniState.balanceService.getTokenFreeBalance(from, networkKey, tokenSlug);
|
|
1383
|
-
let edAsWarning = false;
|
|
1384
1378
|
if ((0, _utilCrypto.isEthereumAddress)(from) && (0, _utilCrypto.isEthereumAddress)(to)) {
|
|
1385
1379
|
chainType = _KoniTypes.ChainType.EVM;
|
|
1386
1380
|
const txVal = transferAll ? freeBalance.value : value || '0';
|
|
1387
1381
|
|
|
1388
1382
|
// Estimate with EVM API
|
|
1389
|
-
if ((0, _utils._isTokenEvmSmartContract)(tokenInfo)) {
|
|
1383
|
+
if ((0, _utils._isTokenEvmSmartContract)(tokenInfo) || (0, _utils._isLocalToken)(tokenInfo)) {
|
|
1390
1384
|
[transaction, transferAmount.value] = await (0, _transfer3.getERC20TransactionObject)((0, _utils._getContractAddressOfToken)(tokenInfo), chainInfo, from, to, txVal, !!transferAll, evmApiMap);
|
|
1391
1385
|
} else {
|
|
1392
1386
|
[transaction, transferAmount.value] = await (0, _transfer3.getEVMTransactionObject)(chainInfo, to, txVal, !!transferAll, evmApiMap);
|
|
1393
|
-
edAsWarning = true;
|
|
1394
1387
|
}
|
|
1395
1388
|
} else {
|
|
1396
1389
|
const substrateApi = this.#koniState.getSubstrateApi(networkKey);
|
|
@@ -1403,7 +1396,6 @@ class KoniExtension {
|
|
|
1403
1396
|
to: to,
|
|
1404
1397
|
substrateApi
|
|
1405
1398
|
});
|
|
1406
|
-
edAsWarning = true;
|
|
1407
1399
|
}
|
|
1408
1400
|
const transferNativeAmount = isTransferNativeToken ? transferAmount.value : '0';
|
|
1409
1401
|
return this.#koniState.transactionService.handleTransaction({
|
|
@@ -1418,7 +1410,7 @@ class KoniExtension {
|
|
|
1418
1410
|
extrinsicType: isTransferNativeToken ? _KoniTypes.ExtrinsicType.TRANSFER_BALANCE : _KoniTypes.ExtrinsicType.TRANSFER_TOKEN,
|
|
1419
1411
|
ignoreWarnings: transferAll,
|
|
1420
1412
|
isTransferAll: transferAll,
|
|
1421
|
-
edAsWarning:
|
|
1413
|
+
edAsWarning: isTransferNativeToken
|
|
1422
1414
|
});
|
|
1423
1415
|
}
|
|
1424
1416
|
validateCrossChainTransfer(destinationNetworkKey, sendingTokenSlug, sender, sendingValue) {
|
|
@@ -1507,11 +1499,11 @@ class KoniExtension {
|
|
|
1507
1499
|
async enableChain(networkKey) {
|
|
1508
1500
|
return await this.#koniState.enableChain(networkKey);
|
|
1509
1501
|
}
|
|
1510
|
-
async validateNetwork(
|
|
1502
|
+
async validateNetwork(_ref35) {
|
|
1511
1503
|
let {
|
|
1512
1504
|
existedChainSlug,
|
|
1513
1505
|
provider
|
|
1514
|
-
} =
|
|
1506
|
+
} = _ref35;
|
|
1515
1507
|
return await this.#koniState.validateCustomChain(provider, existedChainSlug);
|
|
1516
1508
|
}
|
|
1517
1509
|
resetDefaultNetwork() {
|
|
@@ -1549,20 +1541,20 @@ class KoniExtension {
|
|
|
1549
1541
|
async validateCustomAsset(data) {
|
|
1550
1542
|
return await this.#koniState.validateCustomAsset(data);
|
|
1551
1543
|
}
|
|
1552
|
-
async getAddressFreeBalance(
|
|
1544
|
+
async getAddressFreeBalance(_ref36) {
|
|
1553
1545
|
let {
|
|
1554
1546
|
address,
|
|
1555
1547
|
networkKey,
|
|
1556
1548
|
token
|
|
1557
|
-
} =
|
|
1549
|
+
} = _ref36;
|
|
1558
1550
|
return await this.#koniState.balanceService.getTokenFreeBalance(address, networkKey, token);
|
|
1559
1551
|
}
|
|
1560
|
-
async subscribeAddressFreeBalance(
|
|
1552
|
+
async subscribeAddressFreeBalance(_ref37, id, port) {
|
|
1561
1553
|
let {
|
|
1562
1554
|
address,
|
|
1563
1555
|
networkKey,
|
|
1564
1556
|
token
|
|
1565
|
-
} =
|
|
1557
|
+
} = _ref37;
|
|
1566
1558
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
1567
1559
|
const [unsub, currentFreeBalance] = await this.#koniState.balanceService.subscribeTokenFreeBalance(address, networkKey, token, cb);
|
|
1568
1560
|
this.createUnsubscriptionHandle(id, unsub);
|
|
@@ -1571,26 +1563,26 @@ class KoniExtension {
|
|
|
1571
1563
|
});
|
|
1572
1564
|
return currentFreeBalance;
|
|
1573
1565
|
}
|
|
1574
|
-
async transferCheckReferenceCount(
|
|
1566
|
+
async transferCheckReferenceCount(_ref38) {
|
|
1575
1567
|
let {
|
|
1576
1568
|
address,
|
|
1577
1569
|
networkKey
|
|
1578
|
-
} =
|
|
1570
|
+
} = _ref38;
|
|
1579
1571
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-return
|
|
1580
1572
|
return await (0, _transfer.checkReferenceCount)(networkKey, address, this.#koniState.getSubstrateApiMap(), this.#koniState.getChainInfo(networkKey));
|
|
1581
1573
|
}
|
|
1582
|
-
async transferCheckSupporting(
|
|
1574
|
+
async transferCheckSupporting(_ref39) {
|
|
1583
1575
|
let {
|
|
1584
1576
|
networkKey,
|
|
1585
1577
|
tokenSlug
|
|
1586
|
-
} =
|
|
1578
|
+
} = _ref39;
|
|
1587
1579
|
const tokenInfo = this.#koniState.getAssetBySlug(tokenSlug);
|
|
1588
1580
|
return await (0, _transfer.checkSupportTransfer)(networkKey, tokenInfo, this.#koniState.getSubstrateApiMap(), this.#koniState.getChainInfo(networkKey));
|
|
1589
1581
|
}
|
|
1590
|
-
transferGetExistentialDeposit(
|
|
1582
|
+
transferGetExistentialDeposit(_ref40) {
|
|
1591
1583
|
let {
|
|
1592
1584
|
tokenSlug
|
|
1593
|
-
} =
|
|
1585
|
+
} = _ref40;
|
|
1594
1586
|
const tokenInfo = this.#koniState.getAssetBySlug(tokenSlug);
|
|
1595
1587
|
return (0, _utils._getTokenMinAmount)(tokenInfo);
|
|
1596
1588
|
}
|
|
@@ -1631,10 +1623,10 @@ class KoniExtension {
|
|
|
1631
1623
|
}
|
|
1632
1624
|
return true;
|
|
1633
1625
|
}
|
|
1634
|
-
getAccountMeta(
|
|
1626
|
+
getAccountMeta(_ref41) {
|
|
1635
1627
|
let {
|
|
1636
1628
|
address
|
|
1637
|
-
} =
|
|
1629
|
+
} = _ref41;
|
|
1638
1630
|
const pair = _uiKeyring.keyring.getPair(address);
|
|
1639
1631
|
(0, _util.assert)(pair, 'Unable to find pair');
|
|
1640
1632
|
return {
|
|
@@ -1658,14 +1650,14 @@ class KoniExtension {
|
|
|
1658
1650
|
// });
|
|
1659
1651
|
// }
|
|
1660
1652
|
|
|
1661
|
-
accountsTie2(
|
|
1653
|
+
accountsTie2(_ref42) {
|
|
1662
1654
|
let {
|
|
1663
1655
|
address,
|
|
1664
1656
|
genesisHash
|
|
1665
|
-
} =
|
|
1657
|
+
} = _ref42;
|
|
1666
1658
|
return this.#koniState.setAccountTie(address, genesisHash);
|
|
1667
1659
|
}
|
|
1668
|
-
async accountsCreateExternalV2(
|
|
1660
|
+
async accountsCreateExternalV2(_ref43) {
|
|
1669
1661
|
let {
|
|
1670
1662
|
address,
|
|
1671
1663
|
genesisHash,
|
|
@@ -1673,7 +1665,7 @@ class KoniExtension {
|
|
|
1673
1665
|
isEthereum,
|
|
1674
1666
|
isReadOnly,
|
|
1675
1667
|
name
|
|
1676
|
-
} =
|
|
1668
|
+
} = _ref43;
|
|
1677
1669
|
try {
|
|
1678
1670
|
let result;
|
|
1679
1671
|
try {
|
|
@@ -1732,7 +1724,7 @@ class KoniExtension {
|
|
|
1732
1724
|
}];
|
|
1733
1725
|
}
|
|
1734
1726
|
}
|
|
1735
|
-
async accountsCreateHardwareV2(
|
|
1727
|
+
async accountsCreateHardwareV2(_ref44) {
|
|
1736
1728
|
let {
|
|
1737
1729
|
accountIndex,
|
|
1738
1730
|
address,
|
|
@@ -1741,7 +1733,7 @@ class KoniExtension {
|
|
|
1741
1733
|
hardwareType,
|
|
1742
1734
|
isAllowed,
|
|
1743
1735
|
name
|
|
1744
|
-
} =
|
|
1736
|
+
} = _ref44;
|
|
1745
1737
|
const key = _uiKeyring.keyring.addHardware(address, hardwareType, {
|
|
1746
1738
|
accountIndex,
|
|
1747
1739
|
addressOffset,
|
|
@@ -1764,10 +1756,10 @@ class KoniExtension {
|
|
|
1764
1756
|
});
|
|
1765
1757
|
return true;
|
|
1766
1758
|
}
|
|
1767
|
-
async accountsCreateHardwareMultiple(
|
|
1759
|
+
async accountsCreateHardwareMultiple(_ref45) {
|
|
1768
1760
|
let {
|
|
1769
1761
|
accounts
|
|
1770
|
-
} =
|
|
1762
|
+
} = _ref45;
|
|
1771
1763
|
const addresses = [];
|
|
1772
1764
|
if (!accounts.length) {
|
|
1773
1765
|
throw new Error('No accounts to import');
|
|
@@ -1796,9 +1788,7 @@ class KoniExtension {
|
|
|
1796
1788
|
resolve();
|
|
1797
1789
|
});
|
|
1798
1790
|
}
|
|
1799
|
-
const currentAccount =
|
|
1800
|
-
this.#koniState.getCurrentAccount(resolve);
|
|
1801
|
-
});
|
|
1791
|
+
const currentAccount = this.#koniState.keyringService.currentAccount;
|
|
1802
1792
|
const allGenesisHash = (currentAccount === null || currentAccount === void 0 ? void 0 : currentAccount.allGenesisHash) || undefined;
|
|
1803
1793
|
if (addresses.length <= 1) {
|
|
1804
1794
|
this.#koniState.setCurrentAccount({
|
|
@@ -1820,14 +1810,14 @@ class KoniExtension {
|
|
|
1820
1810
|
});
|
|
1821
1811
|
return true;
|
|
1822
1812
|
}
|
|
1823
|
-
async accountsCreateWithSecret(
|
|
1813
|
+
async accountsCreateWithSecret(_ref46) {
|
|
1824
1814
|
let {
|
|
1825
1815
|
isAllow,
|
|
1826
1816
|
isEthereum,
|
|
1827
1817
|
name,
|
|
1828
1818
|
publicKey,
|
|
1829
1819
|
secretKey
|
|
1830
|
-
} =
|
|
1820
|
+
} = _ref46;
|
|
1831
1821
|
try {
|
|
1832
1822
|
let keyringPair = null;
|
|
1833
1823
|
if (isEthereum) {
|
|
@@ -1970,30 +1960,30 @@ class KoniExtension {
|
|
|
1970
1960
|
|
|
1971
1961
|
// Parse transaction
|
|
1972
1962
|
|
|
1973
|
-
parseSubstrateTransaction(
|
|
1963
|
+
parseSubstrateTransaction(_ref47) {
|
|
1974
1964
|
let {
|
|
1975
1965
|
data,
|
|
1976
1966
|
networkKey
|
|
1977
|
-
} =
|
|
1967
|
+
} = _ref47;
|
|
1978
1968
|
const apiProps = this.#koniState.getSubstrateApi(networkKey);
|
|
1979
1969
|
const apiPromise = apiProps.api;
|
|
1980
1970
|
return (0, _parseTransaction.parseSubstrateTransaction)(data, apiPromise);
|
|
1981
1971
|
}
|
|
1982
|
-
async parseEVMRLP(
|
|
1972
|
+
async parseEVMRLP(_ref48) {
|
|
1983
1973
|
let {
|
|
1984
1974
|
data
|
|
1985
|
-
} =
|
|
1975
|
+
} = _ref48;
|
|
1986
1976
|
return await (0, _parseTransaction2.parseEvmRlp)(data, this.#koniState.getChainInfoMap(), this.#koniState.getEvmApiMap());
|
|
1987
1977
|
}
|
|
1988
1978
|
|
|
1989
1979
|
// Sign
|
|
1990
1980
|
|
|
1991
|
-
qrSignSubstrate(
|
|
1981
|
+
qrSignSubstrate(_ref49) {
|
|
1992
1982
|
let {
|
|
1993
1983
|
address,
|
|
1994
1984
|
data,
|
|
1995
1985
|
networkKey
|
|
1996
|
-
} =
|
|
1986
|
+
} = _ref49;
|
|
1997
1987
|
const pair = _uiKeyring.keyring.getPair(address);
|
|
1998
1988
|
(0, _util.assert)(pair, 'Unable to find pair');
|
|
1999
1989
|
if (pair.isLocked) {
|
|
@@ -2010,13 +2000,13 @@ class KoniExtension {
|
|
|
2010
2000
|
signature: signed
|
|
2011
2001
|
};
|
|
2012
2002
|
}
|
|
2013
|
-
async qrSignEVM(
|
|
2003
|
+
async qrSignEVM(_ref50) {
|
|
2014
2004
|
let {
|
|
2015
2005
|
address,
|
|
2016
2006
|
chainId,
|
|
2017
2007
|
message,
|
|
2018
2008
|
type
|
|
2019
|
-
} =
|
|
2009
|
+
} = _ref50;
|
|
2020
2010
|
let signed;
|
|
2021
2011
|
const network = this.getNetworkJsonByChainId(chainId);
|
|
2022
2012
|
if (!network) {
|
|
@@ -2097,11 +2087,11 @@ class KoniExtension {
|
|
|
2097
2087
|
});
|
|
2098
2088
|
return this.#koniState.getNominatorMetadata();
|
|
2099
2089
|
}
|
|
2100
|
-
async getBondingOptions(
|
|
2090
|
+
async getBondingOptions(_ref51) {
|
|
2101
2091
|
let {
|
|
2102
2092
|
chain,
|
|
2103
2093
|
type
|
|
2104
|
-
} =
|
|
2094
|
+
} = _ref51;
|
|
2105
2095
|
const apiProps = this.#koniState.getSubstrateApi(chain);
|
|
2106
2096
|
const chainInfo = this.#koniState.getChainInfo(chain);
|
|
2107
2097
|
const chainStakingMetadata = await this.#koniState.getStakingMetadataByChain(chain, type);
|
|
@@ -2115,31 +2105,38 @@ class KoniExtension {
|
|
|
2115
2105
|
}
|
|
2116
2106
|
async getNominationPoolOptions(chain) {
|
|
2117
2107
|
const substrateApi = this.#koniState.getSubstrateApi(chain);
|
|
2108
|
+
console.log('chain', chain);
|
|
2118
2109
|
return await (0, _bonding.getNominationPoolsInfo)(chain, substrateApi);
|
|
2119
2110
|
}
|
|
2120
2111
|
async submitBonding(inputData) {
|
|
2121
2112
|
const {
|
|
2113
|
+
address,
|
|
2122
2114
|
amount,
|
|
2123
2115
|
chain,
|
|
2124
2116
|
nominatorMetadata,
|
|
2125
2117
|
selectedValidators
|
|
2126
2118
|
} = inputData;
|
|
2127
|
-
if (!amount || !nominatorMetadata || !selectedValidators) {
|
|
2128
|
-
// Todo: Check and return error here
|
|
2129
|
-
|
|
2130
|
-
return this.#koniState.transactionService.generateBeforeHandleResponseErrors([new _TransactionError.TransactionError(_KoniTypes.BasicTxErrorType.INVALID_PARAMS)]);
|
|
2131
|
-
}
|
|
2132
2119
|
const chainInfo = this.#koniState.getChainInfo(chain);
|
|
2120
|
+
const chainStakingMetadata = await this.#koniState.getStakingMetadataByChain(chain, _KoniTypes.StakingType.NOMINATED);
|
|
2121
|
+
if (!chainStakingMetadata) {
|
|
2122
|
+
return this.#koniState.transactionService.generateBeforeHandleResponseErrors([new _TransactionError.TransactionError(_KoniTypes.BasicTxErrorType.INTERNAL_ERROR)]);
|
|
2123
|
+
}
|
|
2124
|
+
const bondingValidation = (0, _bonding.validateBondingCondition)(chainInfo, amount, selectedValidators, address, chainStakingMetadata, nominatorMetadata);
|
|
2125
|
+
if (!amount || !selectedValidators || bondingValidation.length > 0) {
|
|
2126
|
+
return this.#koniState.transactionService.generateBeforeHandleResponseErrors(bondingValidation);
|
|
2127
|
+
}
|
|
2133
2128
|
const substrateApi = this.#koniState.getSubstrateApi(chain);
|
|
2134
|
-
const extrinsic = await (0, _bonding.getBondingExtrinsic)(chainInfo, amount,
|
|
2129
|
+
const extrinsic = await (0, _bonding.getBondingExtrinsic)(chainInfo, amount, selectedValidators, substrateApi, address, nominatorMetadata);
|
|
2130
|
+
console.log('Bonding extrinsic: ', chain, extrinsic.toHex());
|
|
2135
2131
|
return await this.#koniState.transactionService.handleTransaction({
|
|
2136
|
-
address
|
|
2132
|
+
address,
|
|
2137
2133
|
chain: chain,
|
|
2138
2134
|
chainType: _KoniTypes.ChainType.SUBSTRATE,
|
|
2139
2135
|
data: inputData,
|
|
2140
2136
|
extrinsicType: _KoniTypes.ExtrinsicType.STAKING_BOND,
|
|
2141
2137
|
transaction: extrinsic,
|
|
2142
|
-
url: _constants2.EXTENSION_REQUEST_URL
|
|
2138
|
+
url: _constants2.EXTENSION_REQUEST_URL,
|
|
2139
|
+
transferNativeAmount: amount
|
|
2143
2140
|
});
|
|
2144
2141
|
}
|
|
2145
2142
|
async submitUnbonding(inputData) {
|
|
@@ -2149,11 +2146,17 @@ class KoniExtension {
|
|
|
2149
2146
|
nominatorMetadata,
|
|
2150
2147
|
validatorAddress
|
|
2151
2148
|
} = inputData;
|
|
2152
|
-
|
|
2153
|
-
|
|
2149
|
+
const chainStakingMetadata = await this.#koniState.getStakingMetadataByChain(chain, _KoniTypes.StakingType.NOMINATED);
|
|
2150
|
+
if (!chainStakingMetadata || !nominatorMetadata) {
|
|
2151
|
+
return this.#koniState.transactionService.generateBeforeHandleResponseErrors([new _TransactionError.TransactionError(_KoniTypes.BasicTxErrorType.INTERNAL_ERROR)]);
|
|
2152
|
+
}
|
|
2153
|
+
const unbondingValidation = (0, _bonding.validateUnbondingCondition)(nominatorMetadata, amount, chain, chainStakingMetadata, validatorAddress);
|
|
2154
|
+
if (!amount || unbondingValidation.length > 0) {
|
|
2155
|
+
return this.#koniState.transactionService.generateBeforeHandleResponseErrors(unbondingValidation);
|
|
2154
2156
|
}
|
|
2155
2157
|
const substrateApi = this.#koniState.getSubstrateApi(chain);
|
|
2156
2158
|
const extrinsic = await (0, _bonding.getUnbondingExtrinsic)(nominatorMetadata, amount, chain, substrateApi, validatorAddress);
|
|
2159
|
+
console.log('Unbonding extrinsic: ', extrinsic.toHex());
|
|
2157
2160
|
return await this.#koniState.transactionService.handleTransaction({
|
|
2158
2161
|
address: nominatorMetadata.address,
|
|
2159
2162
|
chain: chain,
|
|
@@ -2174,6 +2177,7 @@ class KoniExtension {
|
|
|
2174
2177
|
}
|
|
2175
2178
|
const dotSamaApi = this.#koniState.getSubstrateApi(chain);
|
|
2176
2179
|
const extrinsic = await (0, _bonding.getWithdrawalExtrinsic)(dotSamaApi, chain, nominatorMetadata, validatorAddress);
|
|
2180
|
+
console.log('Stake withdrawal extrinsic: ', extrinsic.toHex());
|
|
2177
2181
|
return await this.#koniState.transactionService.handleTransaction({
|
|
2178
2182
|
address: nominatorMetadata.address,
|
|
2179
2183
|
chain: chain,
|
|
@@ -2195,6 +2199,7 @@ class KoniExtension {
|
|
|
2195
2199
|
}
|
|
2196
2200
|
const substrateApi = this.#koniState.getSubstrateApi(chain);
|
|
2197
2201
|
const extrinsic = await (0, _bonding.getClaimRewardExtrinsic)(substrateApi, chain, address, stakingType, bondReward);
|
|
2202
|
+
console.log('Staking claim reward extrinsic: ', extrinsic.toHex());
|
|
2198
2203
|
return await this.#koniState.transactionService.handleTransaction({
|
|
2199
2204
|
address,
|
|
2200
2205
|
chain: chain,
|
|
@@ -2215,6 +2220,7 @@ class KoniExtension {
|
|
|
2215
2220
|
}
|
|
2216
2221
|
const substrateApi = this.#koniState.getSubstrateApi(chain);
|
|
2217
2222
|
const extrinsic = await (0, _bonding.getCancelWithdrawalExtrinsic)(substrateApi, chain, selectedUnstaking);
|
|
2223
|
+
console.log('Cancel stake withdrawal extrinsic', extrinsic.toHex());
|
|
2218
2224
|
return await this.#koniState.transactionService.handleTransaction({
|
|
2219
2225
|
address,
|
|
2220
2226
|
chain,
|
|
@@ -2224,7 +2230,7 @@ class KoniExtension {
|
|
|
2224
2230
|
chainType: _KoniTypes.ChainType.SUBSTRATE
|
|
2225
2231
|
});
|
|
2226
2232
|
}
|
|
2227
|
-
async
|
|
2233
|
+
async submitPoolBonding(inputData) {
|
|
2228
2234
|
const {
|
|
2229
2235
|
address,
|
|
2230
2236
|
amount,
|
|
@@ -2232,8 +2238,18 @@ class KoniExtension {
|
|
|
2232
2238
|
nominatorMetadata,
|
|
2233
2239
|
selectedPool
|
|
2234
2240
|
} = inputData;
|
|
2241
|
+
const chainInfo = this.#koniState.getChainInfo(chain);
|
|
2242
|
+
const chainStakingMetadata = await this.#koniState.getStakingMetadataByChain(chain, _KoniTypes.StakingType.NOMINATED);
|
|
2243
|
+
if (!chainStakingMetadata) {
|
|
2244
|
+
return this.#koniState.transactionService.generateBeforeHandleResponseErrors([new _TransactionError.TransactionError(_KoniTypes.BasicTxErrorType.INTERNAL_ERROR)]);
|
|
2245
|
+
}
|
|
2246
|
+
const bondingValidation = (0, _relayChain.validatePoolBondingCondition)(chainInfo, amount, selectedPool, address, chainStakingMetadata, nominatorMetadata);
|
|
2247
|
+
if (!amount || bondingValidation.length > 0) {
|
|
2248
|
+
return this.#koniState.transactionService.generateBeforeHandleResponseErrors(bondingValidation);
|
|
2249
|
+
}
|
|
2235
2250
|
const substrateApi = this.#koniState.getSubstrateApi(chain);
|
|
2236
2251
|
const extrinsic = await (0, _relayChain.getPoolingBondingExtrinsic)(substrateApi, amount, selectedPool.id, nominatorMetadata);
|
|
2252
|
+
console.log('Join nomination pool extrinsic', extrinsic.toHex());
|
|
2237
2253
|
return await this.#koniState.transactionService.handleTransaction({
|
|
2238
2254
|
address,
|
|
2239
2255
|
chain,
|
|
@@ -2249,8 +2265,17 @@ class KoniExtension {
|
|
|
2249
2265
|
chain,
|
|
2250
2266
|
nominatorMetadata
|
|
2251
2267
|
} = inputData;
|
|
2268
|
+
const chainStakingMetadata = await this.#koniState.getStakingMetadataByChain(chain, _KoniTypes.StakingType.NOMINATED);
|
|
2269
|
+
if (!chainStakingMetadata || !nominatorMetadata) {
|
|
2270
|
+
return this.#koniState.transactionService.generateBeforeHandleResponseErrors([new _TransactionError.TransactionError(_KoniTypes.BasicTxErrorType.INTERNAL_ERROR)]);
|
|
2271
|
+
}
|
|
2272
|
+
const unbondingValidation = (0, _relayChain.validateRelayUnbondingCondition)(amount, chainStakingMetadata, nominatorMetadata);
|
|
2273
|
+
if (!amount || unbondingValidation.length > 0) {
|
|
2274
|
+
return this.#koniState.transactionService.generateBeforeHandleResponseErrors(unbondingValidation);
|
|
2275
|
+
}
|
|
2252
2276
|
const substrateApi = this.#koniState.getSubstrateApi(chain);
|
|
2253
2277
|
const extrinsic = await (0, _relayChain.getPoolingUnbondingExtrinsic)(substrateApi, amount, nominatorMetadata);
|
|
2278
|
+
console.log('Nomination pool unbond extrinsic', extrinsic.toHex());
|
|
2254
2279
|
return await this.#koniState.transactionService.handleTransaction({
|
|
2255
2280
|
address: nominatorMetadata.address,
|
|
2256
2281
|
chain,
|
|
@@ -2262,12 +2287,12 @@ class KoniExtension {
|
|
|
2262
2287
|
}
|
|
2263
2288
|
|
|
2264
2289
|
// EVM Transaction
|
|
2265
|
-
async parseContractInput(
|
|
2290
|
+
async parseContractInput(_ref52) {
|
|
2266
2291
|
let {
|
|
2267
2292
|
chainId,
|
|
2268
2293
|
contract,
|
|
2269
2294
|
data
|
|
2270
|
-
} =
|
|
2295
|
+
} = _ref52;
|
|
2271
2296
|
const network = this.getNetworkJsonByChainId(chainId);
|
|
2272
2297
|
return await (0, _parseTransaction2.parseContractInput)(data, contract, network);
|
|
2273
2298
|
}
|
|
@@ -2322,19 +2347,20 @@ class KoniExtension {
|
|
|
2322
2347
|
}
|
|
2323
2348
|
keyringStateSubscribe(id, port) {
|
|
2324
2349
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
2325
|
-
const
|
|
2350
|
+
const keyringStateSubject = this.#koniState.keyringService.keyringStateSubject;
|
|
2351
|
+
const subscription = keyringStateSubject.subscribe(value => cb(value));
|
|
2326
2352
|
this.createUnsubscriptionHandle(id, subscription.unsubscribe);
|
|
2327
2353
|
port.onDisconnect.addListener(() => {
|
|
2328
2354
|
this.cancelSubscription(id);
|
|
2329
2355
|
});
|
|
2330
|
-
return this.#koniState.
|
|
2356
|
+
return this.#koniState.keyringService.keyringState;
|
|
2331
2357
|
}
|
|
2332
|
-
keyringChangeMasterPassword(
|
|
2358
|
+
keyringChangeMasterPassword(_ref53) {
|
|
2333
2359
|
let {
|
|
2334
2360
|
createNew,
|
|
2335
2361
|
newPassword,
|
|
2336
2362
|
oldPassword
|
|
2337
|
-
} =
|
|
2363
|
+
} = _ref53;
|
|
2338
2364
|
try {
|
|
2339
2365
|
// Remove isMasterPassword meta if createNew
|
|
2340
2366
|
if (createNew) {
|
|
@@ -2359,21 +2385,17 @@ class KoniExtension {
|
|
|
2359
2385
|
status: false
|
|
2360
2386
|
};
|
|
2361
2387
|
}
|
|
2362
|
-
this.#koniState.
|
|
2363
|
-
hasMasterPassword: true,
|
|
2364
|
-
isLocked: false,
|
|
2365
|
-
isReady: true
|
|
2366
|
-
});
|
|
2388
|
+
this.#koniState.updateKeyringState();
|
|
2367
2389
|
return {
|
|
2368
2390
|
status: true,
|
|
2369
2391
|
errors: []
|
|
2370
2392
|
};
|
|
2371
2393
|
}
|
|
2372
|
-
keyringMigrateMasterPassword(
|
|
2394
|
+
keyringMigrateMasterPassword(_ref54) {
|
|
2373
2395
|
let {
|
|
2374
2396
|
address,
|
|
2375
2397
|
password
|
|
2376
|
-
} =
|
|
2398
|
+
} = _ref54;
|
|
2377
2399
|
try {
|
|
2378
2400
|
_uiKeyring.keyring.migrateWithMasterPassword(address, password);
|
|
2379
2401
|
} catch (e) {
|
|
@@ -2388,10 +2410,10 @@ class KoniExtension {
|
|
|
2388
2410
|
errors: []
|
|
2389
2411
|
};
|
|
2390
2412
|
}
|
|
2391
|
-
keyringUnlock(
|
|
2413
|
+
keyringUnlock(_ref55) {
|
|
2392
2414
|
let {
|
|
2393
2415
|
password
|
|
2394
|
-
} =
|
|
2416
|
+
} = _ref55;
|
|
2395
2417
|
try {
|
|
2396
2418
|
_uiKeyring.keyring.unlockKeyring(password);
|
|
2397
2419
|
} catch (e) {
|
|
@@ -2400,11 +2422,7 @@ class KoniExtension {
|
|
|
2400
2422
|
status: false
|
|
2401
2423
|
};
|
|
2402
2424
|
}
|
|
2403
|
-
this.#koniState.
|
|
2404
|
-
isReady: true,
|
|
2405
|
-
hasMasterPassword: true,
|
|
2406
|
-
isLocked: false
|
|
2407
|
-
});
|
|
2425
|
+
this.#koniState.updateKeyringState();
|
|
2408
2426
|
return {
|
|
2409
2427
|
status: true,
|
|
2410
2428
|
errors: []
|
|
@@ -2412,17 +2430,14 @@ class KoniExtension {
|
|
|
2412
2430
|
}
|
|
2413
2431
|
keyringLock() {
|
|
2414
2432
|
_uiKeyring.keyring.lockAll();
|
|
2415
|
-
this.#koniState.
|
|
2416
|
-
|
|
2417
|
-
hasMasterPassword: true,
|
|
2418
|
-
isLocked: true
|
|
2419
|
-
});
|
|
2433
|
+
this.#koniState.updateKeyringState();
|
|
2434
|
+
clearTimeout(this.#lockTimeOut);
|
|
2420
2435
|
}
|
|
2421
|
-
keyringExportMnemonic(
|
|
2436
|
+
keyringExportMnemonic(_ref56) {
|
|
2422
2437
|
let {
|
|
2423
2438
|
address,
|
|
2424
2439
|
password
|
|
2425
|
-
} =
|
|
2440
|
+
} = _ref56;
|
|
2426
2441
|
const pair = _uiKeyring.keyring.getPair(address);
|
|
2427
2442
|
const result = pair.exportMnemonic(password);
|
|
2428
2443
|
return {
|
|
@@ -2431,10 +2446,10 @@ class KoniExtension {
|
|
|
2431
2446
|
}
|
|
2432
2447
|
|
|
2433
2448
|
/// Signing external request
|
|
2434
|
-
signingApprovePasswordV2(
|
|
2449
|
+
signingApprovePasswordV2(_ref57) {
|
|
2435
2450
|
let {
|
|
2436
2451
|
id
|
|
2437
|
-
} =
|
|
2452
|
+
} = _ref57;
|
|
2438
2453
|
const queued = this.#koniState.getSignRequest(id);
|
|
2439
2454
|
(0, _util.assert)(queued, 'Unable to find request');
|
|
2440
2455
|
const {
|
|
@@ -2461,6 +2476,7 @@ class KoniExtension {
|
|
|
2461
2476
|
payload
|
|
2462
2477
|
} = request;
|
|
2463
2478
|
const registry = new _types.TypeRegistry();
|
|
2479
|
+
let isEvm = false;
|
|
2464
2480
|
if ((0, _Extension.isJsonPayload)(payload)) {
|
|
2465
2481
|
// Get the metadata for the genesisHash
|
|
2466
2482
|
const currentMetadata = this.#koniState.knownMetadata.find(meta => meta.genesisHash === payload.genesisHash);
|
|
@@ -2470,33 +2486,38 @@ class KoniExtension {
|
|
|
2470
2486
|
if (currentMetadata) {
|
|
2471
2487
|
registry.register(currentMetadata === null || currentMetadata === void 0 ? void 0 : currentMetadata.types);
|
|
2472
2488
|
}
|
|
2489
|
+
const [, chainInfo] = this.#koniState.findNetworkKeyByGenesisHash(payload.genesisHash);
|
|
2490
|
+
if (chainInfo) {
|
|
2491
|
+
isEvm = (0, _utils._isChainEvmCompatible)(chainInfo);
|
|
2492
|
+
}
|
|
2473
2493
|
}
|
|
2474
2494
|
const result = request.sign(registry, pair);
|
|
2475
2495
|
resolve({
|
|
2476
2496
|
id,
|
|
2477
|
-
|
|
2497
|
+
// In case evm chain, must be cut 2 character after 0x
|
|
2498
|
+
signature: isEvm ? `0x${result.signature.slice(4)}` : result.signature
|
|
2478
2499
|
});
|
|
2479
2500
|
return true;
|
|
2480
2501
|
}
|
|
2481
2502
|
|
|
2482
2503
|
/// Derive account
|
|
2483
2504
|
|
|
2484
|
-
derivationCreateMultiple(
|
|
2505
|
+
derivationCreateMultiple(_ref58) {
|
|
2485
2506
|
let {
|
|
2486
2507
|
isAllowed,
|
|
2487
2508
|
items,
|
|
2488
2509
|
parentAddress
|
|
2489
|
-
} =
|
|
2510
|
+
} = _ref58;
|
|
2490
2511
|
const parentPair = _uiKeyring.keyring.getPair(parentAddress);
|
|
2491
2512
|
const isEvm = parentPair.type === 'ethereum';
|
|
2492
2513
|
if (parentPair.isLocked) {
|
|
2493
2514
|
_uiKeyring.keyring.unlockPair(parentPair.address);
|
|
2494
2515
|
}
|
|
2495
|
-
const createChild =
|
|
2516
|
+
const createChild = _ref59 => {
|
|
2496
2517
|
let {
|
|
2497
2518
|
name,
|
|
2498
2519
|
suri
|
|
2499
|
-
} =
|
|
2520
|
+
} = _ref59;
|
|
2500
2521
|
const meta = {
|
|
2501
2522
|
name: name,
|
|
2502
2523
|
parentAddress
|
|
@@ -2542,10 +2563,10 @@ class KoniExtension {
|
|
|
2542
2563
|
}
|
|
2543
2564
|
return true;
|
|
2544
2565
|
}
|
|
2545
|
-
derivationCreateV3(
|
|
2566
|
+
derivationCreateV3(_ref60) {
|
|
2546
2567
|
let {
|
|
2547
2568
|
address: parentAddress
|
|
2548
|
-
} =
|
|
2569
|
+
} = _ref60;
|
|
2549
2570
|
const parentPair = _uiKeyring.keyring.getPair(parentAddress);
|
|
2550
2571
|
const isEvm = parentPair.type === 'ethereum';
|
|
2551
2572
|
if (parentPair.isLocked) {
|
|
@@ -2577,11 +2598,11 @@ class KoniExtension {
|
|
|
2577
2598
|
});
|
|
2578
2599
|
return true;
|
|
2579
2600
|
}
|
|
2580
|
-
validateDerivePath(
|
|
2601
|
+
validateDerivePath(_ref61) {
|
|
2581
2602
|
let {
|
|
2582
2603
|
parentAddress,
|
|
2583
2604
|
suri
|
|
2584
|
-
} =
|
|
2605
|
+
} = _ref61;
|
|
2585
2606
|
const parentPair = _uiKeyring.keyring.getPair(parentAddress);
|
|
2586
2607
|
const isEvm = parentPair.type === 'ethereum';
|
|
2587
2608
|
if (parentPair.isLocked) {
|
|
@@ -2614,12 +2635,12 @@ class KoniExtension {
|
|
|
2614
2635
|
suri: meta.suri
|
|
2615
2636
|
};
|
|
2616
2637
|
}
|
|
2617
|
-
getListDeriveAccounts(
|
|
2638
|
+
getListDeriveAccounts(_ref62) {
|
|
2618
2639
|
let {
|
|
2619
2640
|
limit,
|
|
2620
2641
|
page,
|
|
2621
2642
|
parentAddress
|
|
2622
|
-
} =
|
|
2643
|
+
} = _ref62;
|
|
2623
2644
|
const parentPair = _uiKeyring.keyring.getPair(parentAddress);
|
|
2624
2645
|
const isEvm = parentPair.type === 'ethereum';
|
|
2625
2646
|
if (parentPair.isLocked) {
|
|
@@ -2710,10 +2731,10 @@ class KoniExtension {
|
|
|
2710
2731
|
getSupportedSmartContractTypes() {
|
|
2711
2732
|
return this.#koniState.getSupportedSmartContractTypes();
|
|
2712
2733
|
}
|
|
2713
|
-
getTransaction(
|
|
2734
|
+
getTransaction(_ref63) {
|
|
2714
2735
|
let {
|
|
2715
2736
|
id
|
|
2716
|
-
} =
|
|
2737
|
+
} = _ref63;
|
|
2717
2738
|
const {
|
|
2718
2739
|
transaction,
|
|
2719
2740
|
...transactionResult
|
|
@@ -2723,8 +2744,8 @@ class KoniExtension {
|
|
|
2723
2744
|
subscribeTransactions(id, port) {
|
|
2724
2745
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
2725
2746
|
function convertRs(rs) {
|
|
2726
|
-
return Object.fromEntries(Object.entries(rs).map(
|
|
2727
|
-
let [key, value] =
|
|
2747
|
+
return Object.fromEntries(Object.entries(rs).map(_ref64 => {
|
|
2748
|
+
let [key, value] = _ref64;
|
|
2728
2749
|
const {
|
|
2729
2750
|
transaction,
|
|
2730
2751
|
...transactionResult
|
|
@@ -2754,10 +2775,25 @@ class KoniExtension {
|
|
|
2754
2775
|
});
|
|
2755
2776
|
return notificationSubject.value;
|
|
2756
2777
|
}
|
|
2778
|
+
async reloadCron(_ref65) {
|
|
2779
|
+
let {
|
|
2780
|
+
data
|
|
2781
|
+
} = _ref65;
|
|
2782
|
+
if (data === 'nft') {
|
|
2783
|
+
return await this.#koniState.reloadNft();
|
|
2784
|
+
} else if (data === 'staking') {
|
|
2785
|
+
return await this.#koniState.reloadStaking();
|
|
2786
|
+
}
|
|
2787
|
+
return Promise.resolve(false);
|
|
2788
|
+
}
|
|
2757
2789
|
|
|
2758
2790
|
// --------------------------------------------------------------
|
|
2759
2791
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
2760
2792
|
async handle(id, type, request, port) {
|
|
2793
|
+
clearTimeout(this.#lockTimeOut);
|
|
2794
|
+
this.#lockTimeOut = setTimeout(() => {
|
|
2795
|
+
this.keyringLock();
|
|
2796
|
+
}, _constants.DEFAULT_TIME_AUTO_LOCK);
|
|
2761
2797
|
switch (type) {
|
|
2762
2798
|
/// Clone from PolkadotJs
|
|
2763
2799
|
case 'pri(accounts.create.external)':
|
|
@@ -2866,10 +2902,8 @@ class KoniExtension {
|
|
|
2866
2902
|
return this.accountsGetAll(id, port);
|
|
2867
2903
|
case 'pri(accounts.saveRecent)':
|
|
2868
2904
|
return this.saveRecentAccountId(request);
|
|
2869
|
-
case 'pri(accounts.triggerSubscription)':
|
|
2870
|
-
return this.triggerAccountsSubscription();
|
|
2871
2905
|
case 'pri(currentAccount.saveAddress)':
|
|
2872
|
-
return this.saveCurrentAccountAddress(request
|
|
2906
|
+
return await this.saveCurrentAccountAddress(request);
|
|
2873
2907
|
case 'pri(accounts.updateCurrentAddress)':
|
|
2874
2908
|
return this.updateCurrentAccountAddress(request);
|
|
2875
2909
|
case 'pri(settings.changeBalancesVisibility)':
|
|
@@ -3033,7 +3067,7 @@ class KoniExtension {
|
|
|
3033
3067
|
case 'pri(staking.submitTuringCancelCompound)':
|
|
3034
3068
|
return await this.submitTuringCancelStakeCompound(request);
|
|
3035
3069
|
case 'pri(bonding.nominationPool.submitBonding)':
|
|
3036
|
-
return await this.
|
|
3070
|
+
return await this.submitPoolBonding(request);
|
|
3037
3071
|
case 'pri(bonding.nominationPool.submitUnbonding)':
|
|
3038
3072
|
return await this.submitPoolingUnbonding(request);
|
|
3039
3073
|
|
|
@@ -3082,6 +3116,8 @@ class KoniExtension {
|
|
|
3082
3116
|
// Notification
|
|
3083
3117
|
case 'pri(notifications.subscribe)':
|
|
3084
3118
|
return this.subscribeNotifications(id, port);
|
|
3119
|
+
case 'pri(cron.reload)':
|
|
3120
|
+
return await this.reloadCron(request);
|
|
3085
3121
|
|
|
3086
3122
|
// Default
|
|
3087
3123
|
default:
|