@subwallet/extension-base 1.1.22-0 → 1.1.23-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 +10 -1
- package/cjs/koni/api/dotsama/balance.js +49 -0
- package/cjs/koni/api/dotsama/crowdloan.js +29 -3
- package/cjs/koni/api/dotsama/transfer.js +10 -3
- package/cjs/koni/api/staking/bonding/astar.js +9 -5
- package/cjs/koni/api/xcm/index.js +6 -1
- package/cjs/koni/api/xcm/polkadotXcm.js +1 -3
- package/cjs/koni/api/xcm/xTokens.js +1 -1
- package/cjs/koni/background/handlers/Extension.js +114 -96
- package/cjs/koni/background/handlers/State.js +12 -6
- package/cjs/koni/background/subscription.js +1 -1
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/chain-service/constants.js +5 -2
- package/cjs/services/chain-service/index.js +18 -0
- package/cjs/services/history-service/helpers/subscan-extrinsic-parser-helper.js +53 -0
- package/cjs/services/history-service/index.js +78 -21
- package/cjs/services/history-service/subscan-history.js +107 -0
- package/cjs/services/subscan-service/index.js +109 -4
- package/cjs/services/subscan-service/subscan-chain-map.js +82 -8
- package/cjs/utils/index.js +10 -1
- package/koni/api/dotsama/balance.js +49 -0
- package/koni/api/dotsama/crowdloan.d.ts +2 -2
- package/koni/api/dotsama/crowdloan.js +29 -2
- package/koni/api/dotsama/transfer.js +10 -3
- package/koni/api/staking/bonding/astar.js +9 -5
- package/koni/api/xcm/index.js +6 -1
- package/koni/api/xcm/polkadotXcm.js +2 -4
- package/koni/api/xcm/xTokens.js +1 -1
- package/koni/background/handlers/Extension.d.ts +1 -0
- package/koni/background/handlers/Extension.js +17 -0
- package/koni/background/handlers/State.d.ts +1 -0
- package/koni/background/handlers/State.js +13 -7
- package/koni/background/subscription.js +1 -1
- package/package.json +16 -6
- package/packageInfo.js +1 -1
- package/services/chain-service/constants.d.ts +2 -0
- package/services/chain-service/constants.js +5 -3
- package/services/chain-service/index.d.ts +1 -0
- package/services/chain-service/index.js +18 -0
- package/services/history-service/helpers/subscan-extrinsic-parser-helper.d.ts +6 -0
- package/services/history-service/helpers/subscan-extrinsic-parser-helper.js +44 -0
- package/services/history-service/index.d.ts +10 -6
- package/services/history-service/index.js +79 -22
- package/services/history-service/subscan-history.d.ts +5 -0
- package/services/history-service/subscan-history.js +100 -0
- package/services/subscan-service/index.d.ts +10 -2
- package/services/subscan-service/index.js +105 -4
- package/services/subscan-service/subscan-chain-map.d.ts +9 -3
- package/services/subscan-service/subscan-chain-map.js +78 -5
- package/services/subscan-service/types.d.ts +146 -0
- package/utils/index.d.ts +1 -0
- package/utils/index.js +7 -0
|
@@ -1492,6 +1492,22 @@ class KoniExtension {
|
|
|
1492
1492
|
// Re-filter
|
|
1493
1493
|
return historySubject.getValue().filter(item => addresses.some(address => (0, _utils2.isSameAddress)(item.address, address)));
|
|
1494
1494
|
}
|
|
1495
|
+
subscribeHistoryByChainAndAddress(_ref44, id, port) {
|
|
1496
|
+
let {
|
|
1497
|
+
address,
|
|
1498
|
+
chain
|
|
1499
|
+
} = _ref44;
|
|
1500
|
+
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
1501
|
+
const subscribeHistoriesResponse = this.#koniState.historyService.subscribeHistories(chain, address, cb);
|
|
1502
|
+
this.createUnsubscriptionHandle(id, subscribeHistoriesResponse.unsubscribe);
|
|
1503
|
+
port.onDisconnect.addListener(() => {
|
|
1504
|
+
this.cancelSubscription(id);
|
|
1505
|
+
});
|
|
1506
|
+
return {
|
|
1507
|
+
id,
|
|
1508
|
+
items: subscribeHistoriesResponse.value
|
|
1509
|
+
};
|
|
1510
|
+
}
|
|
1495
1511
|
|
|
1496
1512
|
// Save address to contact
|
|
1497
1513
|
// private addContact (to: string) {
|
|
@@ -1791,21 +1807,21 @@ class KoniExtension {
|
|
|
1791
1807
|
disableChain(networkKey) {
|
|
1792
1808
|
return this.#koniState.disableChain(networkKey);
|
|
1793
1809
|
}
|
|
1794
|
-
async enableChain(
|
|
1810
|
+
async enableChain(_ref45) {
|
|
1795
1811
|
let {
|
|
1796
1812
|
chainSlug,
|
|
1797
1813
|
enableTokens
|
|
1798
|
-
} =
|
|
1814
|
+
} = _ref45;
|
|
1799
1815
|
return await this.#koniState.enableChain(chainSlug, enableTokens);
|
|
1800
1816
|
}
|
|
1801
1817
|
async reconnectChain(chainSlug) {
|
|
1802
1818
|
return this.#koniState.chainService.reconnectChain(chainSlug);
|
|
1803
1819
|
}
|
|
1804
|
-
async validateNetwork(
|
|
1820
|
+
async validateNetwork(_ref46) {
|
|
1805
1821
|
let {
|
|
1806
1822
|
existedChainSlug,
|
|
1807
1823
|
provider
|
|
1808
|
-
} =
|
|
1824
|
+
} = _ref46;
|
|
1809
1825
|
return await this.#koniState.validateCustomChain(provider, existedChainSlug);
|
|
1810
1826
|
}
|
|
1811
1827
|
resetDefaultNetwork() {
|
|
@@ -1843,12 +1859,12 @@ class KoniExtension {
|
|
|
1843
1859
|
async validateCustomAsset(data) {
|
|
1844
1860
|
return await this.#koniState.validateCustomAsset(data);
|
|
1845
1861
|
}
|
|
1846
|
-
async getAddressFreeBalance(
|
|
1862
|
+
async getAddressFreeBalance(_ref47) {
|
|
1847
1863
|
let {
|
|
1848
1864
|
address,
|
|
1849
1865
|
networkKey,
|
|
1850
1866
|
token
|
|
1851
|
-
} =
|
|
1867
|
+
} = _ref47;
|
|
1852
1868
|
if (token && _constants2._MANTA_ZK_CHAIN_GROUP.includes(networkKey)) {
|
|
1853
1869
|
const tokenInfo = this.#koniState.chainService.getAssetBySlug(token);
|
|
1854
1870
|
if (tokenInfo.symbol.startsWith(_constants2._ZK_ASSET_PREFIX)) {
|
|
@@ -1857,14 +1873,14 @@ class KoniExtension {
|
|
|
1857
1873
|
}
|
|
1858
1874
|
return await this.#koniState.balanceService.getTokenFreeBalance(address, networkKey, token);
|
|
1859
1875
|
}
|
|
1860
|
-
async transferGetMaxTransferable(
|
|
1876
|
+
async transferGetMaxTransferable(_ref48) {
|
|
1861
1877
|
let {
|
|
1862
1878
|
address,
|
|
1863
1879
|
destChain,
|
|
1864
1880
|
isXcmTransfer,
|
|
1865
1881
|
networkKey,
|
|
1866
1882
|
token
|
|
1867
|
-
} =
|
|
1883
|
+
} = _ref48;
|
|
1868
1884
|
const freeBalance = await this.getAddressFreeBalance({
|
|
1869
1885
|
address,
|
|
1870
1886
|
networkKey,
|
|
@@ -1943,12 +1959,12 @@ class KoniExtension {
|
|
|
1943
1959
|
};
|
|
1944
1960
|
}
|
|
1945
1961
|
}
|
|
1946
|
-
async subscribeAddressFreeBalance(
|
|
1962
|
+
async subscribeAddressFreeBalance(_ref49, id, port) {
|
|
1947
1963
|
let {
|
|
1948
1964
|
address,
|
|
1949
1965
|
networkKey,
|
|
1950
1966
|
token
|
|
1951
|
-
} =
|
|
1967
|
+
} = _ref49;
|
|
1952
1968
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
1953
1969
|
const [unsub, currentFreeBalance] = await this.#koniState.balanceService.subscribeTokenFreeBalance(address, networkKey, token, cb);
|
|
1954
1970
|
this.createUnsubscriptionHandle(id, unsub);
|
|
@@ -1957,26 +1973,26 @@ class KoniExtension {
|
|
|
1957
1973
|
});
|
|
1958
1974
|
return currentFreeBalance;
|
|
1959
1975
|
}
|
|
1960
|
-
async transferCheckReferenceCount(
|
|
1976
|
+
async transferCheckReferenceCount(_ref50) {
|
|
1961
1977
|
let {
|
|
1962
1978
|
address,
|
|
1963
1979
|
networkKey
|
|
1964
|
-
} =
|
|
1980
|
+
} = _ref50;
|
|
1965
1981
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-return
|
|
1966
1982
|
return await (0, _transfer.checkReferenceCount)(networkKey, address, this.#koniState.getSubstrateApiMap(), this.#koniState.getChainInfo(networkKey));
|
|
1967
1983
|
}
|
|
1968
|
-
async transferCheckSupporting(
|
|
1984
|
+
async transferCheckSupporting(_ref51) {
|
|
1969
1985
|
let {
|
|
1970
1986
|
networkKey,
|
|
1971
1987
|
tokenSlug
|
|
1972
|
-
} =
|
|
1988
|
+
} = _ref51;
|
|
1973
1989
|
const tokenInfo = this.#koniState.getAssetBySlug(tokenSlug);
|
|
1974
1990
|
return await (0, _transfer.checkSupportTransfer)(networkKey, tokenInfo, this.#koniState.getSubstrateApiMap(), this.#koniState.getChainInfo(networkKey));
|
|
1975
1991
|
}
|
|
1976
|
-
transferGetExistentialDeposit(
|
|
1992
|
+
transferGetExistentialDeposit(_ref52) {
|
|
1977
1993
|
let {
|
|
1978
1994
|
tokenSlug
|
|
1979
|
-
} =
|
|
1995
|
+
} = _ref52;
|
|
1980
1996
|
const tokenInfo = this.#koniState.getAssetBySlug(tokenSlug);
|
|
1981
1997
|
return (0, _utils._getTokenMinAmount)(tokenInfo);
|
|
1982
1998
|
}
|
|
@@ -2012,11 +2028,11 @@ class KoniExtension {
|
|
|
2012
2028
|
isSendingSelf
|
|
2013
2029
|
};
|
|
2014
2030
|
}
|
|
2015
|
-
async enableChains(
|
|
2031
|
+
async enableChains(_ref53) {
|
|
2016
2032
|
let {
|
|
2017
2033
|
chainSlugs,
|
|
2018
2034
|
enableTokens
|
|
2019
|
-
} =
|
|
2035
|
+
} = _ref53;
|
|
2020
2036
|
try {
|
|
2021
2037
|
await Promise.all(chainSlugs.map(chainSlug => this.enableChain({
|
|
2022
2038
|
chainSlug,
|
|
@@ -2027,24 +2043,24 @@ class KoniExtension {
|
|
|
2027
2043
|
}
|
|
2028
2044
|
return true;
|
|
2029
2045
|
}
|
|
2030
|
-
getAccountMeta(
|
|
2046
|
+
getAccountMeta(_ref54) {
|
|
2031
2047
|
let {
|
|
2032
2048
|
address
|
|
2033
|
-
} =
|
|
2049
|
+
} = _ref54;
|
|
2034
2050
|
const pair = _uiKeyring.keyring.getPair(address);
|
|
2035
2051
|
(0, _util.assert)(pair, (0, _i18next.t)('Unable to find account'));
|
|
2036
2052
|
return {
|
|
2037
2053
|
meta: pair.meta
|
|
2038
2054
|
};
|
|
2039
2055
|
}
|
|
2040
|
-
accountsTie2(
|
|
2056
|
+
accountsTie2(_ref55) {
|
|
2041
2057
|
let {
|
|
2042
2058
|
address,
|
|
2043
2059
|
genesisHash
|
|
2044
|
-
} =
|
|
2060
|
+
} = _ref55;
|
|
2045
2061
|
return this.#koniState.setAccountTie(address, genesisHash);
|
|
2046
2062
|
}
|
|
2047
|
-
async accountsCreateExternalV2(
|
|
2063
|
+
async accountsCreateExternalV2(_ref56) {
|
|
2048
2064
|
let {
|
|
2049
2065
|
address,
|
|
2050
2066
|
genesisHash,
|
|
@@ -2052,7 +2068,7 @@ class KoniExtension {
|
|
|
2052
2068
|
isEthereum,
|
|
2053
2069
|
isReadOnly,
|
|
2054
2070
|
name
|
|
2055
|
-
} =
|
|
2071
|
+
} = _ref56;
|
|
2056
2072
|
try {
|
|
2057
2073
|
let result;
|
|
2058
2074
|
try {
|
|
@@ -2111,7 +2127,7 @@ class KoniExtension {
|
|
|
2111
2127
|
}];
|
|
2112
2128
|
}
|
|
2113
2129
|
}
|
|
2114
|
-
async accountsCreateHardwareV2(
|
|
2130
|
+
async accountsCreateHardwareV2(_ref57) {
|
|
2115
2131
|
let {
|
|
2116
2132
|
accountIndex,
|
|
2117
2133
|
address,
|
|
@@ -2120,7 +2136,7 @@ class KoniExtension {
|
|
|
2120
2136
|
hardwareType,
|
|
2121
2137
|
isAllowed,
|
|
2122
2138
|
name
|
|
2123
|
-
} =
|
|
2139
|
+
} = _ref57;
|
|
2124
2140
|
const key = _uiKeyring.keyring.addHardware(address, hardwareType, {
|
|
2125
2141
|
accountIndex,
|
|
2126
2142
|
addressOffset,
|
|
@@ -2143,10 +2159,10 @@ class KoniExtension {
|
|
|
2143
2159
|
});
|
|
2144
2160
|
return true;
|
|
2145
2161
|
}
|
|
2146
|
-
async accountsCreateHardwareMultiple(
|
|
2162
|
+
async accountsCreateHardwareMultiple(_ref58) {
|
|
2147
2163
|
let {
|
|
2148
2164
|
accounts
|
|
2149
|
-
} =
|
|
2165
|
+
} = _ref58;
|
|
2150
2166
|
const addresses = [];
|
|
2151
2167
|
if (!accounts.length) {
|
|
2152
2168
|
throw new Error((0, _i18next.t)("Can't find an account. Please try again"));
|
|
@@ -2224,14 +2240,14 @@ class KoniExtension {
|
|
|
2224
2240
|
}
|
|
2225
2241
|
return true;
|
|
2226
2242
|
}
|
|
2227
|
-
async accountsCreateWithSecret(
|
|
2243
|
+
async accountsCreateWithSecret(_ref59) {
|
|
2228
2244
|
let {
|
|
2229
2245
|
isAllow,
|
|
2230
2246
|
isEthereum,
|
|
2231
2247
|
name,
|
|
2232
2248
|
publicKey,
|
|
2233
2249
|
secretKey
|
|
2234
|
-
} =
|
|
2250
|
+
} = _ref59;
|
|
2235
2251
|
try {
|
|
2236
2252
|
let keyringPair = null;
|
|
2237
2253
|
if (isEthereum) {
|
|
@@ -2377,30 +2393,30 @@ class KoniExtension {
|
|
|
2377
2393
|
|
|
2378
2394
|
// Parse transaction
|
|
2379
2395
|
|
|
2380
|
-
parseSubstrateTransaction(
|
|
2396
|
+
parseSubstrateTransaction(_ref60) {
|
|
2381
2397
|
let {
|
|
2382
2398
|
data,
|
|
2383
2399
|
networkKey
|
|
2384
|
-
} =
|
|
2400
|
+
} = _ref60;
|
|
2385
2401
|
const apiProps = this.#koniState.getSubstrateApi(networkKey);
|
|
2386
2402
|
const apiPromise = apiProps.api;
|
|
2387
2403
|
return (0, _parseTransaction.parseSubstrateTransaction)(data, apiPromise);
|
|
2388
2404
|
}
|
|
2389
|
-
async parseEVMRLP(
|
|
2405
|
+
async parseEVMRLP(_ref61) {
|
|
2390
2406
|
let {
|
|
2391
2407
|
data
|
|
2392
|
-
} =
|
|
2408
|
+
} = _ref61;
|
|
2393
2409
|
return await (0, _parseTransaction2.parseEvmRlp)(data, this.#koniState.getChainInfoMap(), this.#koniState.getEvmApiMap());
|
|
2394
2410
|
}
|
|
2395
2411
|
|
|
2396
2412
|
// Sign
|
|
2397
2413
|
|
|
2398
|
-
qrSignSubstrate(
|
|
2414
|
+
qrSignSubstrate(_ref62) {
|
|
2399
2415
|
let {
|
|
2400
2416
|
address,
|
|
2401
2417
|
data,
|
|
2402
2418
|
networkKey
|
|
2403
|
-
} =
|
|
2419
|
+
} = _ref62;
|
|
2404
2420
|
const pair = _uiKeyring.keyring.getPair(address);
|
|
2405
2421
|
(0, _util.assert)(pair, (0, _i18next.t)('Unable to find account'));
|
|
2406
2422
|
if (pair.isLocked) {
|
|
@@ -2417,13 +2433,13 @@ class KoniExtension {
|
|
|
2417
2433
|
signature: signed
|
|
2418
2434
|
};
|
|
2419
2435
|
}
|
|
2420
|
-
async qrSignEVM(
|
|
2436
|
+
async qrSignEVM(_ref63) {
|
|
2421
2437
|
let {
|
|
2422
2438
|
address,
|
|
2423
2439
|
chainId,
|
|
2424
2440
|
message,
|
|
2425
2441
|
type
|
|
2426
|
-
} =
|
|
2442
|
+
} = _ref63;
|
|
2427
2443
|
let signed;
|
|
2428
2444
|
const network = this.getNetworkJsonByChainId(chainId);
|
|
2429
2445
|
if (!network) {
|
|
@@ -2504,11 +2520,11 @@ class KoniExtension {
|
|
|
2504
2520
|
});
|
|
2505
2521
|
return this.#koniState.getNominatorMetadata();
|
|
2506
2522
|
}
|
|
2507
|
-
async getBondingOptions(
|
|
2523
|
+
async getBondingOptions(_ref64) {
|
|
2508
2524
|
let {
|
|
2509
2525
|
chain,
|
|
2510
2526
|
type
|
|
2511
|
-
} =
|
|
2527
|
+
} = _ref64;
|
|
2512
2528
|
const apiProps = this.#koniState.getSubstrateApi(chain);
|
|
2513
2529
|
const chainInfo = this.#koniState.getChainInfo(chain);
|
|
2514
2530
|
const chainStakingMetadata = await this.#koniState.getStakingMetadataByChain(chain, type);
|
|
@@ -2697,12 +2713,12 @@ class KoniExtension {
|
|
|
2697
2713
|
}
|
|
2698
2714
|
|
|
2699
2715
|
// EVM Transaction
|
|
2700
|
-
async parseContractInput(
|
|
2716
|
+
async parseContractInput(_ref65) {
|
|
2701
2717
|
let {
|
|
2702
2718
|
chainId,
|
|
2703
2719
|
contract,
|
|
2704
2720
|
data
|
|
2705
|
-
} =
|
|
2721
|
+
} = _ref65;
|
|
2706
2722
|
const network = this.getNetworkJsonByChainId(chainId);
|
|
2707
2723
|
return await (0, _parseTransaction2.parseContractInput)(data, contract, network);
|
|
2708
2724
|
}
|
|
@@ -2773,12 +2789,12 @@ class KoniExtension {
|
|
|
2773
2789
|
|
|
2774
2790
|
// Change master password
|
|
2775
2791
|
|
|
2776
|
-
keyringChangeMasterPassword(
|
|
2792
|
+
keyringChangeMasterPassword(_ref66) {
|
|
2777
2793
|
let {
|
|
2778
2794
|
createNew,
|
|
2779
2795
|
newPassword,
|
|
2780
2796
|
oldPassword
|
|
2781
|
-
} =
|
|
2797
|
+
} = _ref66;
|
|
2782
2798
|
try {
|
|
2783
2799
|
// Remove isMasterPassword meta if createNew
|
|
2784
2800
|
if (createNew && !_uiKeyring.keyring.keyring.hasMasterPassword) {
|
|
@@ -2828,11 +2844,11 @@ class KoniExtension {
|
|
|
2828
2844
|
}
|
|
2829
2845
|
}
|
|
2830
2846
|
}
|
|
2831
|
-
keyringMigrateMasterPassword(
|
|
2847
|
+
keyringMigrateMasterPassword(_ref67) {
|
|
2832
2848
|
let {
|
|
2833
2849
|
address,
|
|
2834
2850
|
password
|
|
2835
|
-
} =
|
|
2851
|
+
} = _ref67;
|
|
2836
2852
|
try {
|
|
2837
2853
|
_uiKeyring.keyring.migrateWithMasterPassword(address, password);
|
|
2838
2854
|
this.checkLockAfterMigrate();
|
|
@@ -2851,10 +2867,10 @@ class KoniExtension {
|
|
|
2851
2867
|
|
|
2852
2868
|
// Unlock wallet
|
|
2853
2869
|
|
|
2854
|
-
keyringUnlock(
|
|
2870
|
+
keyringUnlock(_ref68) {
|
|
2855
2871
|
let {
|
|
2856
2872
|
password
|
|
2857
|
-
} =
|
|
2873
|
+
} = _ref68;
|
|
2858
2874
|
try {
|
|
2859
2875
|
_uiKeyring.keyring.unlockKeyring(password);
|
|
2860
2876
|
this.#koniState.initMantaPay(password).catch(console.error);
|
|
@@ -2880,11 +2896,11 @@ class KoniExtension {
|
|
|
2880
2896
|
|
|
2881
2897
|
// Export mnemonic
|
|
2882
2898
|
|
|
2883
|
-
keyringExportMnemonic(
|
|
2899
|
+
keyringExportMnemonic(_ref69) {
|
|
2884
2900
|
let {
|
|
2885
2901
|
address,
|
|
2886
2902
|
password
|
|
2887
|
-
} =
|
|
2903
|
+
} = _ref69;
|
|
2888
2904
|
const pair = _uiKeyring.keyring.getPair(address);
|
|
2889
2905
|
const result = pair.exportMnemonic(password);
|
|
2890
2906
|
return {
|
|
@@ -2894,10 +2910,10 @@ class KoniExtension {
|
|
|
2894
2910
|
|
|
2895
2911
|
// Reset wallet
|
|
2896
2912
|
|
|
2897
|
-
async resetWallet(
|
|
2913
|
+
async resetWallet(_ref70) {
|
|
2898
2914
|
let {
|
|
2899
2915
|
resetAll
|
|
2900
|
-
} =
|
|
2916
|
+
} = _ref70;
|
|
2901
2917
|
try {
|
|
2902
2918
|
await this.#koniState.resetWallet(resetAll);
|
|
2903
2919
|
return {
|
|
@@ -2913,10 +2929,10 @@ class KoniExtension {
|
|
|
2913
2929
|
}
|
|
2914
2930
|
|
|
2915
2931
|
/// Signing substrate request
|
|
2916
|
-
signingApprovePasswordV2(
|
|
2932
|
+
signingApprovePasswordV2(_ref71) {
|
|
2917
2933
|
let {
|
|
2918
2934
|
id
|
|
2919
|
-
} =
|
|
2935
|
+
} = _ref71;
|
|
2920
2936
|
const queued = this.#koniState.getSignRequest(id);
|
|
2921
2937
|
(0, _util.assert)(queued, (0, _i18next.t)('Unable to proceed. Please try again'));
|
|
2922
2938
|
const {
|
|
@@ -2981,22 +2997,22 @@ class KoniExtension {
|
|
|
2981
2997
|
|
|
2982
2998
|
/// Derive account
|
|
2983
2999
|
|
|
2984
|
-
derivationCreateMultiple(
|
|
3000
|
+
derivationCreateMultiple(_ref72) {
|
|
2985
3001
|
let {
|
|
2986
3002
|
isAllowed,
|
|
2987
3003
|
items,
|
|
2988
3004
|
parentAddress
|
|
2989
|
-
} =
|
|
3005
|
+
} = _ref72;
|
|
2990
3006
|
const parentPair = _uiKeyring.keyring.getPair(parentAddress);
|
|
2991
3007
|
const isEvm = parentPair.type === 'ethereum';
|
|
2992
3008
|
if (parentPair.isLocked) {
|
|
2993
3009
|
_uiKeyring.keyring.unlockPair(parentPair.address);
|
|
2994
3010
|
}
|
|
2995
|
-
const createChild =
|
|
3011
|
+
const createChild = _ref73 => {
|
|
2996
3012
|
let {
|
|
2997
3013
|
name,
|
|
2998
3014
|
suri
|
|
2999
|
-
} =
|
|
3015
|
+
} = _ref73;
|
|
3000
3016
|
const meta = {
|
|
3001
3017
|
name: name,
|
|
3002
3018
|
parentAddress
|
|
@@ -3042,10 +3058,10 @@ class KoniExtension {
|
|
|
3042
3058
|
}
|
|
3043
3059
|
return true;
|
|
3044
3060
|
}
|
|
3045
|
-
derivationCreateV3(
|
|
3061
|
+
derivationCreateV3(_ref74) {
|
|
3046
3062
|
let {
|
|
3047
3063
|
address: parentAddress
|
|
3048
|
-
} =
|
|
3064
|
+
} = _ref74;
|
|
3049
3065
|
const parentPair = _uiKeyring.keyring.getPair(parentAddress);
|
|
3050
3066
|
const isEvm = parentPair.type === 'ethereum';
|
|
3051
3067
|
if (parentPair.isLocked) {
|
|
@@ -3080,11 +3096,11 @@ class KoniExtension {
|
|
|
3080
3096
|
}
|
|
3081
3097
|
return true;
|
|
3082
3098
|
}
|
|
3083
|
-
validateDerivePath(
|
|
3099
|
+
validateDerivePath(_ref75) {
|
|
3084
3100
|
let {
|
|
3085
3101
|
parentAddress,
|
|
3086
3102
|
suri
|
|
3087
|
-
} =
|
|
3103
|
+
} = _ref75;
|
|
3088
3104
|
const parentPair = _uiKeyring.keyring.getPair(parentAddress);
|
|
3089
3105
|
const isEvm = parentPair.type === 'ethereum';
|
|
3090
3106
|
if (parentPair.isLocked) {
|
|
@@ -3117,12 +3133,12 @@ class KoniExtension {
|
|
|
3117
3133
|
suri: meta.suri
|
|
3118
3134
|
};
|
|
3119
3135
|
}
|
|
3120
|
-
getListDeriveAccounts(
|
|
3136
|
+
getListDeriveAccounts(_ref76) {
|
|
3121
3137
|
let {
|
|
3122
3138
|
limit,
|
|
3123
3139
|
page,
|
|
3124
3140
|
parentAddress
|
|
3125
|
-
} =
|
|
3141
|
+
} = _ref76;
|
|
3126
3142
|
const parentPair = _uiKeyring.keyring.getPair(parentAddress);
|
|
3127
3143
|
const isEvm = parentPair.type === 'ethereum';
|
|
3128
3144
|
if (parentPair.isLocked) {
|
|
@@ -3223,10 +3239,10 @@ class KoniExtension {
|
|
|
3223
3239
|
getSupportedSmartContractTypes() {
|
|
3224
3240
|
return this.#koniState.getSupportedSmartContractTypes();
|
|
3225
3241
|
}
|
|
3226
|
-
getTransaction(
|
|
3242
|
+
getTransaction(_ref77) {
|
|
3227
3243
|
let {
|
|
3228
3244
|
id
|
|
3229
|
-
} =
|
|
3245
|
+
} = _ref77;
|
|
3230
3246
|
const {
|
|
3231
3247
|
transaction,
|
|
3232
3248
|
...transactionResult
|
|
@@ -3236,8 +3252,8 @@ class KoniExtension {
|
|
|
3236
3252
|
subscribeTransactions(id, port) {
|
|
3237
3253
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
3238
3254
|
function convertRs(rs) {
|
|
3239
|
-
return Object.fromEntries(Object.entries(rs).map(
|
|
3240
|
-
let [key, value] =
|
|
3255
|
+
return Object.fromEntries(Object.entries(rs).map(_ref78 => {
|
|
3256
|
+
let [key, value] = _ref78;
|
|
3241
3257
|
const {
|
|
3242
3258
|
additionalValidator,
|
|
3243
3259
|
eventsHandler,
|
|
@@ -3269,10 +3285,10 @@ class KoniExtension {
|
|
|
3269
3285
|
});
|
|
3270
3286
|
return notificationSubject.value;
|
|
3271
3287
|
}
|
|
3272
|
-
async reloadCron(
|
|
3288
|
+
async reloadCron(_ref79) {
|
|
3273
3289
|
let {
|
|
3274
3290
|
data
|
|
3275
|
-
} =
|
|
3291
|
+
} = _ref79;
|
|
3276
3292
|
if (data === 'nft') {
|
|
3277
3293
|
return await this.#koniState.reloadNft();
|
|
3278
3294
|
} else if (data === 'staking') {
|
|
@@ -3290,20 +3306,20 @@ class KoniExtension {
|
|
|
3290
3306
|
|
|
3291
3307
|
// Phishing detect
|
|
3292
3308
|
|
|
3293
|
-
async passPhishingPage(
|
|
3309
|
+
async passPhishingPage(_ref80) {
|
|
3294
3310
|
let {
|
|
3295
3311
|
url
|
|
3296
|
-
} =
|
|
3312
|
+
} = _ref80;
|
|
3297
3313
|
return await this.#koniState.approvePassPhishingPage(url);
|
|
3298
3314
|
}
|
|
3299
3315
|
|
|
3300
3316
|
/// Wallet connect
|
|
3301
3317
|
|
|
3302
3318
|
// Connect
|
|
3303
|
-
async connectWalletConnect(
|
|
3319
|
+
async connectWalletConnect(_ref81) {
|
|
3304
3320
|
let {
|
|
3305
3321
|
uri
|
|
3306
|
-
} =
|
|
3322
|
+
} = _ref81;
|
|
3307
3323
|
await this.#koniState.walletConnectService.connect(uri);
|
|
3308
3324
|
return true;
|
|
3309
3325
|
}
|
|
@@ -3316,11 +3332,11 @@ class KoniExtension {
|
|
|
3316
3332
|
});
|
|
3317
3333
|
return this.#koniState.requestService.allConnectWCRequests;
|
|
3318
3334
|
}
|
|
3319
|
-
async approveWalletConnectSession(
|
|
3335
|
+
async approveWalletConnectSession(_ref82) {
|
|
3320
3336
|
let {
|
|
3321
3337
|
accounts: selectedAccounts,
|
|
3322
3338
|
id
|
|
3323
|
-
} =
|
|
3339
|
+
} = _ref82;
|
|
3324
3340
|
const request = this.#koniState.requestService.getConnectWCRequest(id);
|
|
3325
3341
|
if ((0, _helpers2.isProposalExpired)(request.request.params)) {
|
|
3326
3342
|
throw new Error('The proposal has been expired');
|
|
@@ -3332,8 +3348,8 @@ class KoniExtension {
|
|
|
3332
3348
|
const availableNamespaces = {};
|
|
3333
3349
|
const namespaces = {};
|
|
3334
3350
|
const chainInfoMap = this.#koniState.getChainInfoMap();
|
|
3335
|
-
Object.entries(requiredNamespaces).forEach(
|
|
3336
|
-
let [key, namespace] =
|
|
3351
|
+
Object.entries(requiredNamespaces).forEach(_ref83 => {
|
|
3352
|
+
let [key, namespace] = _ref83;
|
|
3337
3353
|
if ((0, _helpers2.isSupportWalletConnectNamespace)(key)) {
|
|
3338
3354
|
if (namespace.chains) {
|
|
3339
3355
|
const unSupportChains = namespace.chains.filter(chain => !(0, _helpers2.isSupportWalletConnectChain)(chain, chainInfoMap));
|
|
@@ -3346,8 +3362,8 @@ class KoniExtension {
|
|
|
3346
3362
|
throw new Error((0, _utils3.getSdkError)('UNSUPPORTED_NAMESPACE_KEY').message + ' ' + key);
|
|
3347
3363
|
}
|
|
3348
3364
|
});
|
|
3349
|
-
Object.entries(optionalNamespaces).forEach(
|
|
3350
|
-
let [key, namespace] =
|
|
3365
|
+
Object.entries(optionalNamespaces).forEach(_ref84 => {
|
|
3366
|
+
let [key, namespace] = _ref84;
|
|
3351
3367
|
if ((0, _helpers2.isSupportWalletConnectNamespace)(key)) {
|
|
3352
3368
|
if (namespace.chains) {
|
|
3353
3369
|
const supportChains = namespace.chains.filter(chain => (0, _helpers2.isSupportWalletConnectChain)(chain, chainInfoMap)) || [];
|
|
@@ -3371,8 +3387,8 @@ class KoniExtension {
|
|
|
3371
3387
|
}
|
|
3372
3388
|
}
|
|
3373
3389
|
});
|
|
3374
|
-
Object.entries(availableNamespaces).forEach(
|
|
3375
|
-
let [key, namespace] =
|
|
3390
|
+
Object.entries(availableNamespaces).forEach(_ref85 => {
|
|
3391
|
+
let [key, namespace] = _ref85;
|
|
3376
3392
|
if (namespace.chains) {
|
|
3377
3393
|
const accounts = [];
|
|
3378
3394
|
const chains = (0, _utils2.uniqueStringArray)(namespace.chains);
|
|
@@ -3396,10 +3412,10 @@ class KoniExtension {
|
|
|
3396
3412
|
request.resolve();
|
|
3397
3413
|
return true;
|
|
3398
3414
|
}
|
|
3399
|
-
async rejectWalletConnectSession(
|
|
3415
|
+
async rejectWalletConnectSession(_ref86) {
|
|
3400
3416
|
let {
|
|
3401
3417
|
id
|
|
3402
|
-
} =
|
|
3418
|
+
} = _ref86;
|
|
3403
3419
|
const request = this.#koniState.requestService.getConnectWCRequest(id);
|
|
3404
3420
|
const wcId = request.request.id;
|
|
3405
3421
|
if ((0, _helpers2.isProposalExpired)(request.request.params)) {
|
|
@@ -3421,10 +3437,10 @@ class KoniExtension {
|
|
|
3421
3437
|
});
|
|
3422
3438
|
return this.#koniState.walletConnectService.sessions;
|
|
3423
3439
|
}
|
|
3424
|
-
async disconnectWalletConnectSession(
|
|
3440
|
+
async disconnectWalletConnectSession(_ref87) {
|
|
3425
3441
|
let {
|
|
3426
3442
|
topic
|
|
3427
|
-
} =
|
|
3443
|
+
} = _ref87;
|
|
3428
3444
|
await this.#koniState.walletConnectService.disconnect(topic);
|
|
3429
3445
|
return true;
|
|
3430
3446
|
}
|
|
@@ -3437,18 +3453,18 @@ class KoniExtension {
|
|
|
3437
3453
|
});
|
|
3438
3454
|
return this.#koniState.requestService.allNotSupportWCRequests;
|
|
3439
3455
|
}
|
|
3440
|
-
approveWalletConnectNotSupport(
|
|
3456
|
+
approveWalletConnectNotSupport(_ref88) {
|
|
3441
3457
|
let {
|
|
3442
3458
|
id
|
|
3443
|
-
} =
|
|
3459
|
+
} = _ref88;
|
|
3444
3460
|
const request = this.#koniState.requestService.getNotSupportWCRequest(id);
|
|
3445
3461
|
request.resolve();
|
|
3446
3462
|
return true;
|
|
3447
3463
|
}
|
|
3448
|
-
rejectWalletConnectNotSupport(
|
|
3464
|
+
rejectWalletConnectNotSupport(_ref89) {
|
|
3449
3465
|
let {
|
|
3450
3466
|
id
|
|
3451
|
-
} =
|
|
3467
|
+
} = _ref89;
|
|
3452
3468
|
const request = this.#koniState.requestService.getNotSupportWCRequest(id);
|
|
3453
3469
|
request.reject(new Error('USER_REJECTED'));
|
|
3454
3470
|
return true;
|
|
@@ -3456,11 +3472,11 @@ class KoniExtension {
|
|
|
3456
3472
|
|
|
3457
3473
|
/// Manta
|
|
3458
3474
|
|
|
3459
|
-
async enableMantaPay(
|
|
3475
|
+
async enableMantaPay(_ref90) {
|
|
3460
3476
|
let {
|
|
3461
3477
|
address,
|
|
3462
3478
|
password
|
|
3463
|
-
} =
|
|
3479
|
+
} = _ref90;
|
|
3464
3480
|
// always takes the current account
|
|
3465
3481
|
function timeout() {
|
|
3466
3482
|
return new Promise(resolve => setTimeout(resolve, 1500));
|
|
@@ -3584,10 +3600,10 @@ class KoniExtension {
|
|
|
3584
3600
|
|
|
3585
3601
|
/// Metadata
|
|
3586
3602
|
|
|
3587
|
-
async findRawMetadata(
|
|
3603
|
+
async findRawMetadata(_ref91) {
|
|
3588
3604
|
let {
|
|
3589
3605
|
genesisHash
|
|
3590
|
-
} =
|
|
3606
|
+
} = _ref91;
|
|
3591
3607
|
const {
|
|
3592
3608
|
metadata,
|
|
3593
3609
|
specVersion
|
|
@@ -3641,10 +3657,10 @@ class KoniExtension {
|
|
|
3641
3657
|
});
|
|
3642
3658
|
return filterBanner(await this.#koniState.campaignService.getProcessingCampaign());
|
|
3643
3659
|
}
|
|
3644
|
-
async completeCampaignBanner(
|
|
3660
|
+
async completeCampaignBanner(_ref92) {
|
|
3645
3661
|
let {
|
|
3646
3662
|
slug
|
|
3647
|
-
} =
|
|
3663
|
+
} = _ref92;
|
|
3648
3664
|
const campaign = await this.#koniState.dbService.getCampaign(slug);
|
|
3649
3665
|
if (campaign) {
|
|
3650
3666
|
await this.#koniState.dbService.upsertCampaign({
|
|
@@ -3847,6 +3863,8 @@ class KoniExtension {
|
|
|
3847
3863
|
return this.subscribeStakingReward(id, port);
|
|
3848
3864
|
case 'pri(transaction.history.getSubscription)':
|
|
3849
3865
|
return await this.subscribeHistory(id, port);
|
|
3866
|
+
case 'pri(transaction.history.subscribe)':
|
|
3867
|
+
return this.subscribeHistoryByChainAndAddress(request, id, port);
|
|
3850
3868
|
|
|
3851
3869
|
/* Account management */
|
|
3852
3870
|
// Add account
|