@subwallet/extension-base 1.1.58-0 → 1.1.60-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 +18 -1
- package/cjs/constants/staking.js +2 -1
- package/cjs/constants/storage.js +4 -2
- package/cjs/koni/api/coingecko.js +58 -15
- package/cjs/koni/api/nft/config.js +27 -21
- package/cjs/koni/api/staking/bonding/utils.js +7 -3
- package/cjs/koni/background/handlers/Extension.js +130 -122
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/balance-service/helpers/subscribe/substrate/index.js +7 -1
- package/cjs/services/chain-service/constants.js +4 -2
- package/cjs/services/chain-service/index.js +6 -1
- package/cjs/services/chain-service/utils/index.js +34 -14
- package/cjs/services/earning-service/constants/chains.js +2 -2
- package/cjs/services/earning-service/handlers/native-staking/relay-chain.js +4 -4
- package/cjs/services/earning-service/handlers/nomination-pool/index.js +2 -2
- package/cjs/services/price-service/coingecko.js +54 -35
- package/cjs/services/price-service/index.js +83 -12
- package/cjs/services/setting-service/constants.js +4 -1
- package/cjs/services/storage-service/DatabaseService.js +2 -3
- package/cjs/utils/number.js +84 -1
- package/cjs/utils/staticData/index.js +6 -1
- package/constants/staking.js +2 -1
- package/constants/storage.d.ts +1 -0
- package/constants/storage.js +2 -1
- package/koni/api/coingecko.d.ts +2 -2
- package/koni/api/coingecko.js +58 -15
- package/koni/api/nft/config.js +28 -20
- package/koni/api/staking/bonding/utils.d.ts +1 -1
- package/koni/api/staking/bonding/utils.js +7 -3
- package/koni/background/handlers/Extension.d.ts +1 -0
- package/koni/background/handlers/Extension.js +7 -0
- package/package.json +7 -6
- package/packageInfo.js +1 -1
- package/services/balance-service/helpers/subscribe/substrate/index.js +8 -2
- package/services/chain-service/constants.js +4 -2
- package/services/chain-service/index.js +6 -1
- package/services/chain-service/utils/index.d.ts +13 -0
- package/services/chain-service/utils/index.js +32 -14
- package/services/earning-service/constants/chains.js +2 -2
- package/services/earning-service/handlers/native-staking/relay-chain.js +4 -4
- package/services/earning-service/handlers/nomination-pool/index.js +2 -2
- package/services/price-service/coingecko.d.ts +3 -2
- package/services/price-service/coingecko.js +50 -32
- package/services/price-service/index.d.ts +7 -2
- package/services/price-service/index.js +85 -15
- package/services/setting-service/constants.d.ts +1 -0
- package/services/setting-service/constants.js +2 -0
- package/services/storage-service/DatabaseService.d.ts +1 -1
- package/services/storage-service/DatabaseService.js +2 -3
- package/utils/number.d.ts +1 -0
- package/utils/number.js +82 -0
- package/utils/staticData/currencySymbol.json +11 -0
- package/utils/staticData/index.d.ts +3 -0
- package/utils/staticData/index.js +4 -0
|
@@ -1067,6 +1067,12 @@ class KoniExtension {
|
|
|
1067
1067
|
async getPrice() {
|
|
1068
1068
|
return this.#koniState.priceService.getPrice();
|
|
1069
1069
|
}
|
|
1070
|
+
async setPriceCurrency(_ref35) {
|
|
1071
|
+
let {
|
|
1072
|
+
currency
|
|
1073
|
+
} = _ref35;
|
|
1074
|
+
return await this.#koniState.priceService.setPriceCurrency(currency);
|
|
1075
|
+
}
|
|
1070
1076
|
subscribePrice(id, port) {
|
|
1071
1077
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
1072
1078
|
const priceSubscription = this.#koniState.priceService.getPriceSubject().subscribe(rs => {
|
|
@@ -1171,7 +1177,7 @@ class KoniExtension {
|
|
|
1171
1177
|
}
|
|
1172
1178
|
});
|
|
1173
1179
|
}
|
|
1174
|
-
async accountsCreateSuriV2(
|
|
1180
|
+
async accountsCreateSuriV2(_ref36) {
|
|
1175
1181
|
let {
|
|
1176
1182
|
genesisHash,
|
|
1177
1183
|
isAllowed,
|
|
@@ -1179,7 +1185,7 @@ class KoniExtension {
|
|
|
1179
1185
|
password,
|
|
1180
1186
|
suri: _suri,
|
|
1181
1187
|
types
|
|
1182
|
-
} =
|
|
1188
|
+
} = _ref36;
|
|
1183
1189
|
const addressDict = {};
|
|
1184
1190
|
let changedAccount = false;
|
|
1185
1191
|
const hasMasterPassword = _uiKeyring.keyring.keyring.hasMasterPassword;
|
|
@@ -1230,11 +1236,11 @@ class KoniExtension {
|
|
|
1230
1236
|
}
|
|
1231
1237
|
return addressDict;
|
|
1232
1238
|
}
|
|
1233
|
-
async accountsForgetOverride(
|
|
1239
|
+
async accountsForgetOverride(_ref37) {
|
|
1234
1240
|
let {
|
|
1235
1241
|
address,
|
|
1236
1242
|
lockAfter
|
|
1237
|
-
} =
|
|
1243
|
+
} = _ref37;
|
|
1238
1244
|
_uiKeyring.keyring.forgetAccount(address);
|
|
1239
1245
|
await new Promise(resolve => {
|
|
1240
1246
|
this.#koniState.removeAccountRef(address, () => {
|
|
@@ -1270,12 +1276,12 @@ class KoniExtension {
|
|
|
1270
1276
|
}
|
|
1271
1277
|
return true;
|
|
1272
1278
|
}
|
|
1273
|
-
seedCreateV2(
|
|
1279
|
+
seedCreateV2(_ref38) {
|
|
1274
1280
|
let {
|
|
1275
1281
|
length = _Extension.SEED_DEFAULT_LENGTH,
|
|
1276
1282
|
seed: _seed,
|
|
1277
1283
|
types
|
|
1278
|
-
} =
|
|
1284
|
+
} = _ref38;
|
|
1279
1285
|
const seed = _seed || (0, _utilCrypto.mnemonicGenerate)(length);
|
|
1280
1286
|
const rs = {
|
|
1281
1287
|
seed: seed,
|
|
@@ -1286,11 +1292,11 @@ class KoniExtension {
|
|
|
1286
1292
|
});
|
|
1287
1293
|
return rs;
|
|
1288
1294
|
}
|
|
1289
|
-
seedValidateV2(
|
|
1295
|
+
seedValidateV2(_ref39) {
|
|
1290
1296
|
let {
|
|
1291
1297
|
suri,
|
|
1292
1298
|
types
|
|
1293
|
-
} =
|
|
1299
|
+
} = _ref39;
|
|
1294
1300
|
const {
|
|
1295
1301
|
phrase
|
|
1296
1302
|
} = (0, _utilCrypto.keyExtractSuri)(suri);
|
|
@@ -1314,11 +1320,11 @@ class KoniExtension {
|
|
|
1314
1320
|
});
|
|
1315
1321
|
return rs;
|
|
1316
1322
|
}
|
|
1317
|
-
_checkValidatePrivateKey(
|
|
1323
|
+
_checkValidatePrivateKey(_ref40) {
|
|
1318
1324
|
let {
|
|
1319
1325
|
suri,
|
|
1320
1326
|
types
|
|
1321
|
-
} =
|
|
1327
|
+
} = _ref40;
|
|
1322
1328
|
let autoAddPrefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1323
1329
|
const {
|
|
1324
1330
|
phrase
|
|
@@ -1341,11 +1347,11 @@ class KoniExtension {
|
|
|
1341
1347
|
}
|
|
1342
1348
|
return rs;
|
|
1343
1349
|
}
|
|
1344
|
-
metamaskPrivateKeyValidateV2(
|
|
1350
|
+
metamaskPrivateKeyValidateV2(_ref41) {
|
|
1345
1351
|
let {
|
|
1346
1352
|
suri,
|
|
1347
1353
|
types
|
|
1348
|
-
} =
|
|
1354
|
+
} = _ref41;
|
|
1349
1355
|
const isValidSuri = suri.startsWith('0x');
|
|
1350
1356
|
if (isValidSuri) {
|
|
1351
1357
|
return this._checkValidatePrivateKey({
|
|
@@ -1374,14 +1380,14 @@ class KoniExtension {
|
|
|
1374
1380
|
}));
|
|
1375
1381
|
}
|
|
1376
1382
|
}
|
|
1377
|
-
derivationCreateV2(
|
|
1383
|
+
derivationCreateV2(_ref42) {
|
|
1378
1384
|
let {
|
|
1379
1385
|
genesisHash,
|
|
1380
1386
|
isAllowed,
|
|
1381
1387
|
name,
|
|
1382
1388
|
parentAddress,
|
|
1383
1389
|
suri
|
|
1384
|
-
} =
|
|
1390
|
+
} = _ref42;
|
|
1385
1391
|
const childPair = this.deriveV2(parentAddress, suri, {
|
|
1386
1392
|
genesisHash,
|
|
1387
1393
|
name,
|
|
@@ -1395,14 +1401,14 @@ class KoniExtension {
|
|
|
1395
1401
|
});
|
|
1396
1402
|
return true;
|
|
1397
1403
|
}
|
|
1398
|
-
jsonRestoreV2(
|
|
1404
|
+
jsonRestoreV2(_ref43) {
|
|
1399
1405
|
let {
|
|
1400
1406
|
address,
|
|
1401
1407
|
file,
|
|
1402
1408
|
isAllowed,
|
|
1403
1409
|
password,
|
|
1404
1410
|
withMasterPassword
|
|
1405
|
-
} =
|
|
1411
|
+
} = _ref43;
|
|
1406
1412
|
const isPasswordValidated = this.validatePassword(file, password);
|
|
1407
1413
|
if (isPasswordValidated) {
|
|
1408
1414
|
try {
|
|
@@ -1420,13 +1426,13 @@ class KoniExtension {
|
|
|
1420
1426
|
throw new Error((0, _i18next.t)('Wrong password'));
|
|
1421
1427
|
}
|
|
1422
1428
|
}
|
|
1423
|
-
batchRestoreV2(
|
|
1429
|
+
batchRestoreV2(_ref44) {
|
|
1424
1430
|
let {
|
|
1425
1431
|
accountsInfo,
|
|
1426
1432
|
file,
|
|
1427
1433
|
isAllowed,
|
|
1428
1434
|
password
|
|
1429
|
-
} =
|
|
1435
|
+
} = _ref44;
|
|
1430
1436
|
const addressList = accountsInfo.map(acc => acc.address);
|
|
1431
1437
|
const isPasswordValidated = this.validatedAccountsPassword(file, password);
|
|
1432
1438
|
if (isPasswordValidated) {
|
|
@@ -1446,11 +1452,11 @@ class KoniExtension {
|
|
|
1446
1452
|
throw new Error((0, _i18next.t)('Wrong password'));
|
|
1447
1453
|
}
|
|
1448
1454
|
}
|
|
1449
|
-
async batchExportV2(
|
|
1455
|
+
async batchExportV2(_ref45) {
|
|
1450
1456
|
let {
|
|
1451
1457
|
addresses,
|
|
1452
1458
|
password
|
|
1453
|
-
} =
|
|
1459
|
+
} = _ref45;
|
|
1454
1460
|
try {
|
|
1455
1461
|
if (addresses && !addresses.length) {
|
|
1456
1462
|
throw new Error((0, _i18next.t)('No accounts found to export'));
|
|
@@ -1553,11 +1559,11 @@ class KoniExtension {
|
|
|
1553
1559
|
// Re-filter
|
|
1554
1560
|
return historySubject.getValue().filter(item => addresses.some(address => (0, _utils4.isSameAddress)(item.address, address)));
|
|
1555
1561
|
}
|
|
1556
|
-
subscribeHistoryByChainAndAddress(
|
|
1562
|
+
subscribeHistoryByChainAndAddress(_ref46, id, port) {
|
|
1557
1563
|
let {
|
|
1558
1564
|
address,
|
|
1559
1565
|
chain
|
|
1560
|
-
} =
|
|
1566
|
+
} = _ref46;
|
|
1561
1567
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
1562
1568
|
const subscribeHistoriesResponse = this.#koniState.historyService.subscribeHistories(chain, address, cb);
|
|
1563
1569
|
this.createUnsubscriptionHandle(id, subscribeHistoriesResponse.unsubscribe);
|
|
@@ -1873,21 +1879,21 @@ class KoniExtension {
|
|
|
1873
1879
|
disableChain(networkKey) {
|
|
1874
1880
|
return this.#koniState.disableChain(networkKey);
|
|
1875
1881
|
}
|
|
1876
|
-
async enableChain(
|
|
1882
|
+
async enableChain(_ref47) {
|
|
1877
1883
|
let {
|
|
1878
1884
|
chainSlug,
|
|
1879
1885
|
enableTokens
|
|
1880
|
-
} =
|
|
1886
|
+
} = _ref47;
|
|
1881
1887
|
return await this.#koniState.enableChain(chainSlug, enableTokens);
|
|
1882
1888
|
}
|
|
1883
1889
|
async reconnectChain(chainSlug) {
|
|
1884
1890
|
return this.#koniState.chainService.reconnectChain(chainSlug);
|
|
1885
1891
|
}
|
|
1886
|
-
async validateNetwork(
|
|
1892
|
+
async validateNetwork(_ref48) {
|
|
1887
1893
|
let {
|
|
1888
1894
|
existedChainSlug,
|
|
1889
1895
|
provider
|
|
1890
|
-
} =
|
|
1896
|
+
} = _ref48;
|
|
1891
1897
|
return await this.#koniState.validateCustomChain(provider, existedChainSlug);
|
|
1892
1898
|
}
|
|
1893
1899
|
resetDefaultNetwork() {
|
|
@@ -1925,12 +1931,12 @@ class KoniExtension {
|
|
|
1925
1931
|
async validateCustomAsset(data) {
|
|
1926
1932
|
return await this.#koniState.validateCustomAsset(data);
|
|
1927
1933
|
}
|
|
1928
|
-
async getAddressFreeBalance(
|
|
1934
|
+
async getAddressFreeBalance(_ref49) {
|
|
1929
1935
|
let {
|
|
1930
1936
|
address,
|
|
1931
1937
|
networkKey,
|
|
1932
1938
|
token
|
|
1933
|
-
} =
|
|
1939
|
+
} = _ref49;
|
|
1934
1940
|
if (token && _constants2._MANTA_ZK_CHAIN_GROUP.includes(networkKey)) {
|
|
1935
1941
|
const tokenInfo = this.#koniState.chainService.getAssetBySlug(token);
|
|
1936
1942
|
if (tokenInfo.symbol.startsWith(_constants2._ZK_ASSET_PREFIX)) {
|
|
@@ -1939,14 +1945,14 @@ class KoniExtension {
|
|
|
1939
1945
|
}
|
|
1940
1946
|
return await this.#koniState.balanceService.getTokenFreeBalance(address, networkKey, token);
|
|
1941
1947
|
}
|
|
1942
|
-
async transferGetMaxTransferable(
|
|
1948
|
+
async transferGetMaxTransferable(_ref50) {
|
|
1943
1949
|
let {
|
|
1944
1950
|
address,
|
|
1945
1951
|
destChain,
|
|
1946
1952
|
isXcmTransfer,
|
|
1947
1953
|
networkKey,
|
|
1948
1954
|
token
|
|
1949
|
-
} =
|
|
1955
|
+
} = _ref50;
|
|
1950
1956
|
const freeBalance = await this.getAddressFreeBalance({
|
|
1951
1957
|
address,
|
|
1952
1958
|
networkKey,
|
|
@@ -2030,12 +2036,12 @@ class KoniExtension {
|
|
|
2030
2036
|
};
|
|
2031
2037
|
}
|
|
2032
2038
|
}
|
|
2033
|
-
async subscribeAddressFreeBalance(
|
|
2039
|
+
async subscribeAddressFreeBalance(_ref51, id, port) {
|
|
2034
2040
|
let {
|
|
2035
2041
|
address,
|
|
2036
2042
|
networkKey,
|
|
2037
2043
|
token
|
|
2038
|
-
} =
|
|
2044
|
+
} = _ref51;
|
|
2039
2045
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
2040
2046
|
const convertData = data => {
|
|
2041
2047
|
return {
|
|
@@ -2054,26 +2060,26 @@ class KoniExtension {
|
|
|
2054
2060
|
});
|
|
2055
2061
|
return convertData(currentFreeBalance);
|
|
2056
2062
|
}
|
|
2057
|
-
async transferCheckReferenceCount(
|
|
2063
|
+
async transferCheckReferenceCount(_ref52) {
|
|
2058
2064
|
let {
|
|
2059
2065
|
address,
|
|
2060
2066
|
networkKey
|
|
2061
|
-
} =
|
|
2067
|
+
} = _ref52;
|
|
2062
2068
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-return
|
|
2063
2069
|
return await (0, _transfer.checkReferenceCount)(networkKey, address, this.#koniState.getSubstrateApiMap(), this.#koniState.getChainInfo(networkKey));
|
|
2064
2070
|
}
|
|
2065
|
-
async transferCheckSupporting(
|
|
2071
|
+
async transferCheckSupporting(_ref53) {
|
|
2066
2072
|
let {
|
|
2067
2073
|
networkKey,
|
|
2068
2074
|
tokenSlug
|
|
2069
|
-
} =
|
|
2075
|
+
} = _ref53;
|
|
2070
2076
|
const tokenInfo = this.#koniState.getAssetBySlug(tokenSlug);
|
|
2071
2077
|
return await (0, _transfer.checkSupportTransfer)(networkKey, tokenInfo, this.#koniState.getSubstrateApiMap(), this.#koniState.getChainInfo(networkKey));
|
|
2072
2078
|
}
|
|
2073
|
-
transferGetExistentialDeposit(
|
|
2079
|
+
transferGetExistentialDeposit(_ref54) {
|
|
2074
2080
|
let {
|
|
2075
2081
|
tokenSlug
|
|
2076
|
-
} =
|
|
2082
|
+
} = _ref54;
|
|
2077
2083
|
const tokenInfo = this.#koniState.getAssetBySlug(tokenSlug);
|
|
2078
2084
|
return (0, _utils2._getTokenMinAmount)(tokenInfo);
|
|
2079
2085
|
}
|
|
@@ -2109,11 +2115,11 @@ class KoniExtension {
|
|
|
2109
2115
|
isSendingSelf
|
|
2110
2116
|
};
|
|
2111
2117
|
}
|
|
2112
|
-
async enableChains(
|
|
2118
|
+
async enableChains(_ref55) {
|
|
2113
2119
|
let {
|
|
2114
2120
|
chainSlugs,
|
|
2115
2121
|
enableTokens
|
|
2116
|
-
} =
|
|
2122
|
+
} = _ref55;
|
|
2117
2123
|
try {
|
|
2118
2124
|
await Promise.all(chainSlugs.map(chainSlug => this.enableChain({
|
|
2119
2125
|
chainSlug,
|
|
@@ -2124,24 +2130,24 @@ class KoniExtension {
|
|
|
2124
2130
|
}
|
|
2125
2131
|
return true;
|
|
2126
2132
|
}
|
|
2127
|
-
getAccountMeta(
|
|
2133
|
+
getAccountMeta(_ref56) {
|
|
2128
2134
|
let {
|
|
2129
2135
|
address
|
|
2130
|
-
} =
|
|
2136
|
+
} = _ref56;
|
|
2131
2137
|
const pair = _uiKeyring.keyring.getPair(address);
|
|
2132
2138
|
(0, _util.assert)(pair, (0, _i18next.t)('Unable to find account'));
|
|
2133
2139
|
return {
|
|
2134
2140
|
meta: pair.meta
|
|
2135
2141
|
};
|
|
2136
2142
|
}
|
|
2137
|
-
accountsTie2(
|
|
2143
|
+
accountsTie2(_ref57) {
|
|
2138
2144
|
let {
|
|
2139
2145
|
address,
|
|
2140
2146
|
genesisHash
|
|
2141
|
-
} =
|
|
2147
|
+
} = _ref57;
|
|
2142
2148
|
return this.#koniState.setAccountTie(address, genesisHash);
|
|
2143
2149
|
}
|
|
2144
|
-
async accountsCreateExternalV2(
|
|
2150
|
+
async accountsCreateExternalV2(_ref58) {
|
|
2145
2151
|
let {
|
|
2146
2152
|
address,
|
|
2147
2153
|
genesisHash,
|
|
@@ -2149,7 +2155,7 @@ class KoniExtension {
|
|
|
2149
2155
|
isEthereum,
|
|
2150
2156
|
isReadOnly,
|
|
2151
2157
|
name
|
|
2152
|
-
} =
|
|
2158
|
+
} = _ref58;
|
|
2153
2159
|
try {
|
|
2154
2160
|
let result;
|
|
2155
2161
|
try {
|
|
@@ -2208,7 +2214,7 @@ class KoniExtension {
|
|
|
2208
2214
|
}];
|
|
2209
2215
|
}
|
|
2210
2216
|
}
|
|
2211
|
-
async accountsCreateHardwareV2(
|
|
2217
|
+
async accountsCreateHardwareV2(_ref59) {
|
|
2212
2218
|
let {
|
|
2213
2219
|
accountIndex,
|
|
2214
2220
|
address,
|
|
@@ -2217,7 +2223,7 @@ class KoniExtension {
|
|
|
2217
2223
|
hardwareType,
|
|
2218
2224
|
isAllowed,
|
|
2219
2225
|
name
|
|
2220
|
-
} =
|
|
2226
|
+
} = _ref59;
|
|
2221
2227
|
const key = _uiKeyring.keyring.addHardware(address, hardwareType, {
|
|
2222
2228
|
accountIndex,
|
|
2223
2229
|
addressOffset,
|
|
@@ -2240,10 +2246,10 @@ class KoniExtension {
|
|
|
2240
2246
|
});
|
|
2241
2247
|
return true;
|
|
2242
2248
|
}
|
|
2243
|
-
async accountsCreateHardwareMultiple(
|
|
2249
|
+
async accountsCreateHardwareMultiple(_ref60) {
|
|
2244
2250
|
let {
|
|
2245
2251
|
accounts
|
|
2246
|
-
} =
|
|
2252
|
+
} = _ref60;
|
|
2247
2253
|
const addresses = [];
|
|
2248
2254
|
if (!accounts.length) {
|
|
2249
2255
|
throw new Error((0, _i18next.t)("Can't find an account. Please try again"));
|
|
@@ -2321,14 +2327,14 @@ class KoniExtension {
|
|
|
2321
2327
|
}
|
|
2322
2328
|
return true;
|
|
2323
2329
|
}
|
|
2324
|
-
async accountsCreateWithSecret(
|
|
2330
|
+
async accountsCreateWithSecret(_ref61) {
|
|
2325
2331
|
let {
|
|
2326
2332
|
isAllow,
|
|
2327
2333
|
isEthereum,
|
|
2328
2334
|
name,
|
|
2329
2335
|
publicKey,
|
|
2330
2336
|
secretKey
|
|
2331
|
-
} =
|
|
2337
|
+
} = _ref61;
|
|
2332
2338
|
try {
|
|
2333
2339
|
let keyringPair = null;
|
|
2334
2340
|
if (isEthereum) {
|
|
@@ -2474,30 +2480,30 @@ class KoniExtension {
|
|
|
2474
2480
|
|
|
2475
2481
|
// Parse transaction
|
|
2476
2482
|
|
|
2477
|
-
parseSubstrateTransaction(
|
|
2483
|
+
parseSubstrateTransaction(_ref62) {
|
|
2478
2484
|
let {
|
|
2479
2485
|
data,
|
|
2480
2486
|
networkKey
|
|
2481
|
-
} =
|
|
2487
|
+
} = _ref62;
|
|
2482
2488
|
const apiProps = this.#koniState.getSubstrateApi(networkKey);
|
|
2483
2489
|
const apiPromise = apiProps.api;
|
|
2484
2490
|
return (0, _parseTransaction.parseSubstrateTransaction)(data, apiPromise);
|
|
2485
2491
|
}
|
|
2486
|
-
async parseEVMRLP(
|
|
2492
|
+
async parseEVMRLP(_ref63) {
|
|
2487
2493
|
let {
|
|
2488
2494
|
data
|
|
2489
|
-
} =
|
|
2495
|
+
} = _ref63;
|
|
2490
2496
|
return await (0, _parseTransaction2.parseEvmRlp)(data, this.#koniState.getChainInfoMap(), this.#koniState.getEvmApiMap());
|
|
2491
2497
|
}
|
|
2492
2498
|
|
|
2493
2499
|
// Sign
|
|
2494
2500
|
|
|
2495
|
-
qrSignSubstrate(
|
|
2501
|
+
qrSignSubstrate(_ref64) {
|
|
2496
2502
|
let {
|
|
2497
2503
|
address,
|
|
2498
2504
|
data,
|
|
2499
2505
|
networkKey
|
|
2500
|
-
} =
|
|
2506
|
+
} = _ref64;
|
|
2501
2507
|
const pair = _uiKeyring.keyring.getPair(address);
|
|
2502
2508
|
(0, _util.assert)(pair, (0, _i18next.t)('Unable to find account'));
|
|
2503
2509
|
if (pair.isLocked) {
|
|
@@ -2514,13 +2520,13 @@ class KoniExtension {
|
|
|
2514
2520
|
signature: signed
|
|
2515
2521
|
};
|
|
2516
2522
|
}
|
|
2517
|
-
async qrSignEVM(
|
|
2523
|
+
async qrSignEVM(_ref65) {
|
|
2518
2524
|
let {
|
|
2519
2525
|
address,
|
|
2520
2526
|
chainId,
|
|
2521
2527
|
message,
|
|
2522
2528
|
type
|
|
2523
|
-
} =
|
|
2529
|
+
} = _ref65;
|
|
2524
2530
|
let signed;
|
|
2525
2531
|
const network = this.getNetworkJsonByChainId(chainId);
|
|
2526
2532
|
if (!network) {
|
|
@@ -2604,11 +2610,11 @@ class KoniExtension {
|
|
|
2604
2610
|
});
|
|
2605
2611
|
return this.#koniState.getNominatorMetadata();
|
|
2606
2612
|
}
|
|
2607
|
-
async getBondingOptions(
|
|
2613
|
+
async getBondingOptions(_ref66) {
|
|
2608
2614
|
let {
|
|
2609
2615
|
chain,
|
|
2610
2616
|
type
|
|
2611
|
-
} =
|
|
2617
|
+
} = _ref66;
|
|
2612
2618
|
const apiProps = this.#koniState.getSubstrateApi(chain);
|
|
2613
2619
|
const chainInfo = this.#koniState.getChainInfo(chain);
|
|
2614
2620
|
const chainStakingMetadata = await this.#koniState.getStakingMetadataByChain(chain, type);
|
|
@@ -2798,12 +2804,12 @@ class KoniExtension {
|
|
|
2798
2804
|
}
|
|
2799
2805
|
|
|
2800
2806
|
// EVM Transaction
|
|
2801
|
-
async parseContractInput(
|
|
2807
|
+
async parseContractInput(_ref67) {
|
|
2802
2808
|
let {
|
|
2803
2809
|
chainId,
|
|
2804
2810
|
contract,
|
|
2805
2811
|
data
|
|
2806
|
-
} =
|
|
2812
|
+
} = _ref67;
|
|
2807
2813
|
const network = this.getNetworkJsonByChainId(chainId);
|
|
2808
2814
|
return await (0, _parseTransaction2.parseContractInput)(data, contract, network);
|
|
2809
2815
|
}
|
|
@@ -2874,12 +2880,12 @@ class KoniExtension {
|
|
|
2874
2880
|
|
|
2875
2881
|
// Change master password
|
|
2876
2882
|
|
|
2877
|
-
keyringChangeMasterPassword(
|
|
2883
|
+
keyringChangeMasterPassword(_ref68) {
|
|
2878
2884
|
let {
|
|
2879
2885
|
createNew,
|
|
2880
2886
|
newPassword,
|
|
2881
2887
|
oldPassword
|
|
2882
|
-
} =
|
|
2888
|
+
} = _ref68;
|
|
2883
2889
|
try {
|
|
2884
2890
|
// Remove isMasterPassword meta if createNew
|
|
2885
2891
|
if (createNew && !_uiKeyring.keyring.keyring.hasMasterPassword) {
|
|
@@ -2929,11 +2935,11 @@ class KoniExtension {
|
|
|
2929
2935
|
}
|
|
2930
2936
|
}
|
|
2931
2937
|
}
|
|
2932
|
-
keyringMigrateMasterPassword(
|
|
2938
|
+
keyringMigrateMasterPassword(_ref69) {
|
|
2933
2939
|
let {
|
|
2934
2940
|
address,
|
|
2935
2941
|
password
|
|
2936
|
-
} =
|
|
2942
|
+
} = _ref69;
|
|
2937
2943
|
try {
|
|
2938
2944
|
_uiKeyring.keyring.migrateWithMasterPassword(address, password);
|
|
2939
2945
|
this.checkLockAfterMigrate();
|
|
@@ -2952,10 +2958,10 @@ class KoniExtension {
|
|
|
2952
2958
|
|
|
2953
2959
|
// Unlock wallet
|
|
2954
2960
|
|
|
2955
|
-
keyringUnlock(
|
|
2961
|
+
keyringUnlock(_ref70) {
|
|
2956
2962
|
let {
|
|
2957
2963
|
password
|
|
2958
|
-
} =
|
|
2964
|
+
} = _ref70;
|
|
2959
2965
|
try {
|
|
2960
2966
|
_uiKeyring.keyring.unlockKeyring(password);
|
|
2961
2967
|
this.#koniState.initMantaPay(password).catch(console.error);
|
|
@@ -2981,11 +2987,11 @@ class KoniExtension {
|
|
|
2981
2987
|
|
|
2982
2988
|
// Export mnemonic
|
|
2983
2989
|
|
|
2984
|
-
keyringExportMnemonic(
|
|
2990
|
+
keyringExportMnemonic(_ref71) {
|
|
2985
2991
|
let {
|
|
2986
2992
|
address,
|
|
2987
2993
|
password
|
|
2988
|
-
} =
|
|
2994
|
+
} = _ref71;
|
|
2989
2995
|
const pair = _uiKeyring.keyring.getPair(address);
|
|
2990
2996
|
const result = pair.exportMnemonic(password);
|
|
2991
2997
|
return {
|
|
@@ -2995,10 +3001,10 @@ class KoniExtension {
|
|
|
2995
3001
|
|
|
2996
3002
|
// Reset wallet
|
|
2997
3003
|
|
|
2998
|
-
async resetWallet(
|
|
3004
|
+
async resetWallet(_ref72) {
|
|
2999
3005
|
let {
|
|
3000
3006
|
resetAll
|
|
3001
|
-
} =
|
|
3007
|
+
} = _ref72;
|
|
3002
3008
|
try {
|
|
3003
3009
|
await this.#koniState.resetWallet(resetAll);
|
|
3004
3010
|
return {
|
|
@@ -3014,10 +3020,10 @@ class KoniExtension {
|
|
|
3014
3020
|
}
|
|
3015
3021
|
|
|
3016
3022
|
/// Signing substrate request
|
|
3017
|
-
signingApprovePasswordV2(
|
|
3023
|
+
signingApprovePasswordV2(_ref73) {
|
|
3018
3024
|
let {
|
|
3019
3025
|
id
|
|
3020
|
-
} =
|
|
3026
|
+
} = _ref73;
|
|
3021
3027
|
const queued = this.#koniState.getSignRequest(id);
|
|
3022
3028
|
(0, _util.assert)(queued, (0, _i18next.t)('Unable to proceed. Please try again'));
|
|
3023
3029
|
const {
|
|
@@ -3082,22 +3088,22 @@ class KoniExtension {
|
|
|
3082
3088
|
|
|
3083
3089
|
/// Derive account
|
|
3084
3090
|
|
|
3085
|
-
derivationCreateMultiple(
|
|
3091
|
+
derivationCreateMultiple(_ref74) {
|
|
3086
3092
|
let {
|
|
3087
3093
|
isAllowed,
|
|
3088
3094
|
items,
|
|
3089
3095
|
parentAddress
|
|
3090
|
-
} =
|
|
3096
|
+
} = _ref74;
|
|
3091
3097
|
const parentPair = _uiKeyring.keyring.getPair(parentAddress);
|
|
3092
3098
|
const isEvm = parentPair.type === 'ethereum';
|
|
3093
3099
|
if (parentPair.isLocked) {
|
|
3094
3100
|
_uiKeyring.keyring.unlockPair(parentPair.address);
|
|
3095
3101
|
}
|
|
3096
|
-
const createChild =
|
|
3102
|
+
const createChild = _ref75 => {
|
|
3097
3103
|
let {
|
|
3098
3104
|
name,
|
|
3099
3105
|
suri
|
|
3100
|
-
} =
|
|
3106
|
+
} = _ref75;
|
|
3101
3107
|
const meta = {
|
|
3102
3108
|
name: name,
|
|
3103
3109
|
parentAddress
|
|
@@ -3143,10 +3149,10 @@ class KoniExtension {
|
|
|
3143
3149
|
}
|
|
3144
3150
|
return true;
|
|
3145
3151
|
}
|
|
3146
|
-
derivationCreateV3(
|
|
3152
|
+
derivationCreateV3(_ref76) {
|
|
3147
3153
|
let {
|
|
3148
3154
|
address: parentAddress
|
|
3149
|
-
} =
|
|
3155
|
+
} = _ref76;
|
|
3150
3156
|
const parentPair = _uiKeyring.keyring.getPair(parentAddress);
|
|
3151
3157
|
const isEvm = parentPair.type === 'ethereum';
|
|
3152
3158
|
if (parentPair.isLocked) {
|
|
@@ -3181,11 +3187,11 @@ class KoniExtension {
|
|
|
3181
3187
|
}
|
|
3182
3188
|
return true;
|
|
3183
3189
|
}
|
|
3184
|
-
validateDerivePath(
|
|
3190
|
+
validateDerivePath(_ref77) {
|
|
3185
3191
|
let {
|
|
3186
3192
|
parentAddress,
|
|
3187
3193
|
suri
|
|
3188
|
-
} =
|
|
3194
|
+
} = _ref77;
|
|
3189
3195
|
const parentPair = _uiKeyring.keyring.getPair(parentAddress);
|
|
3190
3196
|
const isEvm = parentPair.type === 'ethereum';
|
|
3191
3197
|
if (parentPair.isLocked) {
|
|
@@ -3218,12 +3224,12 @@ class KoniExtension {
|
|
|
3218
3224
|
suri: meta.suri
|
|
3219
3225
|
};
|
|
3220
3226
|
}
|
|
3221
|
-
getListDeriveAccounts(
|
|
3227
|
+
getListDeriveAccounts(_ref78) {
|
|
3222
3228
|
let {
|
|
3223
3229
|
limit,
|
|
3224
3230
|
page,
|
|
3225
3231
|
parentAddress
|
|
3226
|
-
} =
|
|
3232
|
+
} = _ref78;
|
|
3227
3233
|
const parentPair = _uiKeyring.keyring.getPair(parentAddress);
|
|
3228
3234
|
const isEvm = parentPair.type === 'ethereum';
|
|
3229
3235
|
if (parentPair.isLocked) {
|
|
@@ -3333,10 +3339,10 @@ class KoniExtension {
|
|
|
3333
3339
|
getSupportedSmartContractTypes() {
|
|
3334
3340
|
return this.#koniState.getSupportedSmartContractTypes();
|
|
3335
3341
|
}
|
|
3336
|
-
getTransaction(
|
|
3342
|
+
getTransaction(_ref79) {
|
|
3337
3343
|
let {
|
|
3338
3344
|
id
|
|
3339
|
-
} =
|
|
3345
|
+
} = _ref79;
|
|
3340
3346
|
const {
|
|
3341
3347
|
transaction,
|
|
3342
3348
|
...transactionResult
|
|
@@ -3346,8 +3352,8 @@ class KoniExtension {
|
|
|
3346
3352
|
subscribeTransactions(id, port) {
|
|
3347
3353
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
3348
3354
|
function convertRs(rs) {
|
|
3349
|
-
return Object.fromEntries(Object.entries(rs).map(
|
|
3350
|
-
let [key, value] =
|
|
3355
|
+
return Object.fromEntries(Object.entries(rs).map(_ref80 => {
|
|
3356
|
+
let [key, value] = _ref80;
|
|
3351
3357
|
const {
|
|
3352
3358
|
additionalValidator,
|
|
3353
3359
|
eventsHandler,
|
|
@@ -3379,10 +3385,10 @@ class KoniExtension {
|
|
|
3379
3385
|
});
|
|
3380
3386
|
return notificationSubject.value;
|
|
3381
3387
|
}
|
|
3382
|
-
async reloadCron(
|
|
3388
|
+
async reloadCron(_ref81) {
|
|
3383
3389
|
let {
|
|
3384
3390
|
data
|
|
3385
|
-
} =
|
|
3391
|
+
} = _ref81;
|
|
3386
3392
|
if (data === 'nft') {
|
|
3387
3393
|
return await this.#koniState.reloadNft();
|
|
3388
3394
|
} else if (data === 'staking') {
|
|
@@ -3426,20 +3432,20 @@ class KoniExtension {
|
|
|
3426
3432
|
|
|
3427
3433
|
// Phishing detect
|
|
3428
3434
|
|
|
3429
|
-
async passPhishingPage(
|
|
3435
|
+
async passPhishingPage(_ref82) {
|
|
3430
3436
|
let {
|
|
3431
3437
|
url
|
|
3432
|
-
} =
|
|
3438
|
+
} = _ref82;
|
|
3433
3439
|
return await this.#koniState.approvePassPhishingPage(url);
|
|
3434
3440
|
}
|
|
3435
3441
|
|
|
3436
3442
|
/// Wallet connect
|
|
3437
3443
|
|
|
3438
3444
|
// Connect
|
|
3439
|
-
async connectWalletConnect(
|
|
3445
|
+
async connectWalletConnect(_ref83) {
|
|
3440
3446
|
let {
|
|
3441
3447
|
uri
|
|
3442
|
-
} =
|
|
3448
|
+
} = _ref83;
|
|
3443
3449
|
await this.#koniState.walletConnectService.connect(uri);
|
|
3444
3450
|
return true;
|
|
3445
3451
|
}
|
|
@@ -3452,11 +3458,11 @@ class KoniExtension {
|
|
|
3452
3458
|
});
|
|
3453
3459
|
return this.#koniState.requestService.allConnectWCRequests;
|
|
3454
3460
|
}
|
|
3455
|
-
async approveWalletConnectSession(
|
|
3461
|
+
async approveWalletConnectSession(_ref84) {
|
|
3456
3462
|
let {
|
|
3457
3463
|
accounts: selectedAccounts,
|
|
3458
3464
|
id
|
|
3459
|
-
} =
|
|
3465
|
+
} = _ref84;
|
|
3460
3466
|
const request = this.#koniState.requestService.getConnectWCRequest(id);
|
|
3461
3467
|
if ((0, _helpers2.isProposalExpired)(request.request.params)) {
|
|
3462
3468
|
throw new Error('The proposal has been expired');
|
|
@@ -3468,8 +3474,8 @@ class KoniExtension {
|
|
|
3468
3474
|
const availableNamespaces = {};
|
|
3469
3475
|
const namespaces = {};
|
|
3470
3476
|
const chainInfoMap = this.#koniState.getChainInfoMap();
|
|
3471
|
-
Object.entries(requiredNamespaces).forEach(
|
|
3472
|
-
let [key, namespace] =
|
|
3477
|
+
Object.entries(requiredNamespaces).forEach(_ref85 => {
|
|
3478
|
+
let [key, namespace] = _ref85;
|
|
3473
3479
|
if ((0, _helpers2.isSupportWalletConnectNamespace)(key)) {
|
|
3474
3480
|
if (namespace.chains) {
|
|
3475
3481
|
const unSupportChains = namespace.chains.filter(chain => !(0, _helpers2.isSupportWalletConnectChain)(chain, chainInfoMap));
|
|
@@ -3482,8 +3488,8 @@ class KoniExtension {
|
|
|
3482
3488
|
throw new Error((0, _utils5.getSdkError)('UNSUPPORTED_NAMESPACE_KEY').message + ' ' + key);
|
|
3483
3489
|
}
|
|
3484
3490
|
});
|
|
3485
|
-
Object.entries(optionalNamespaces).forEach(
|
|
3486
|
-
let [key, namespace] =
|
|
3491
|
+
Object.entries(optionalNamespaces).forEach(_ref86 => {
|
|
3492
|
+
let [key, namespace] = _ref86;
|
|
3487
3493
|
if ((0, _helpers2.isSupportWalletConnectNamespace)(key)) {
|
|
3488
3494
|
if (namespace.chains) {
|
|
3489
3495
|
const supportChains = namespace.chains.filter(chain => (0, _helpers2.isSupportWalletConnectChain)(chain, chainInfoMap)) || [];
|
|
@@ -3507,8 +3513,8 @@ class KoniExtension {
|
|
|
3507
3513
|
}
|
|
3508
3514
|
}
|
|
3509
3515
|
});
|
|
3510
|
-
Object.entries(availableNamespaces).forEach(
|
|
3511
|
-
let [key, namespace] =
|
|
3516
|
+
Object.entries(availableNamespaces).forEach(_ref87 => {
|
|
3517
|
+
let [key, namespace] = _ref87;
|
|
3512
3518
|
if (namespace.chains) {
|
|
3513
3519
|
const accounts = [];
|
|
3514
3520
|
const chains = (0, _utils4.uniqueStringArray)(namespace.chains);
|
|
@@ -3532,10 +3538,10 @@ class KoniExtension {
|
|
|
3532
3538
|
request.resolve();
|
|
3533
3539
|
return true;
|
|
3534
3540
|
}
|
|
3535
|
-
async rejectWalletConnectSession(
|
|
3541
|
+
async rejectWalletConnectSession(_ref88) {
|
|
3536
3542
|
let {
|
|
3537
3543
|
id
|
|
3538
|
-
} =
|
|
3544
|
+
} = _ref88;
|
|
3539
3545
|
const request = this.#koniState.requestService.getConnectWCRequest(id);
|
|
3540
3546
|
const wcId = request.request.id;
|
|
3541
3547
|
if ((0, _helpers2.isProposalExpired)(request.request.params)) {
|
|
@@ -3557,10 +3563,10 @@ class KoniExtension {
|
|
|
3557
3563
|
});
|
|
3558
3564
|
return this.#koniState.walletConnectService.sessions;
|
|
3559
3565
|
}
|
|
3560
|
-
async disconnectWalletConnectSession(
|
|
3566
|
+
async disconnectWalletConnectSession(_ref89) {
|
|
3561
3567
|
let {
|
|
3562
3568
|
topic
|
|
3563
|
-
} =
|
|
3569
|
+
} = _ref89;
|
|
3564
3570
|
await this.#koniState.walletConnectService.disconnect(topic);
|
|
3565
3571
|
return true;
|
|
3566
3572
|
}
|
|
@@ -3573,18 +3579,18 @@ class KoniExtension {
|
|
|
3573
3579
|
});
|
|
3574
3580
|
return this.#koniState.requestService.allNotSupportWCRequests;
|
|
3575
3581
|
}
|
|
3576
|
-
approveWalletConnectNotSupport(
|
|
3582
|
+
approveWalletConnectNotSupport(_ref90) {
|
|
3577
3583
|
let {
|
|
3578
3584
|
id
|
|
3579
|
-
} =
|
|
3585
|
+
} = _ref90;
|
|
3580
3586
|
const request = this.#koniState.requestService.getNotSupportWCRequest(id);
|
|
3581
3587
|
request.resolve();
|
|
3582
3588
|
return true;
|
|
3583
3589
|
}
|
|
3584
|
-
rejectWalletConnectNotSupport(
|
|
3590
|
+
rejectWalletConnectNotSupport(_ref91) {
|
|
3585
3591
|
let {
|
|
3586
3592
|
id
|
|
3587
|
-
} =
|
|
3593
|
+
} = _ref91;
|
|
3588
3594
|
const request = this.#koniState.requestService.getNotSupportWCRequest(id);
|
|
3589
3595
|
request.reject(new Error('USER_REJECTED'));
|
|
3590
3596
|
return true;
|
|
@@ -3592,11 +3598,11 @@ class KoniExtension {
|
|
|
3592
3598
|
|
|
3593
3599
|
/// Manta
|
|
3594
3600
|
|
|
3595
|
-
async enableMantaPay(
|
|
3601
|
+
async enableMantaPay(_ref92) {
|
|
3596
3602
|
let {
|
|
3597
3603
|
address,
|
|
3598
3604
|
password
|
|
3599
|
-
} =
|
|
3605
|
+
} = _ref92;
|
|
3600
3606
|
// always takes the current account
|
|
3601
3607
|
function timeout() {
|
|
3602
3608
|
return new Promise(resolve => setTimeout(resolve, 1500));
|
|
@@ -3720,10 +3726,10 @@ class KoniExtension {
|
|
|
3720
3726
|
|
|
3721
3727
|
/// Metadata
|
|
3722
3728
|
|
|
3723
|
-
async findRawMetadata(
|
|
3729
|
+
async findRawMetadata(_ref93) {
|
|
3724
3730
|
let {
|
|
3725
3731
|
genesisHash
|
|
3726
|
-
} =
|
|
3732
|
+
} = _ref93;
|
|
3727
3733
|
const {
|
|
3728
3734
|
metadata,
|
|
3729
3735
|
specVersion
|
|
@@ -3970,18 +3976,18 @@ class KoniExtension {
|
|
|
3970
3976
|
|
|
3971
3977
|
/* Campaign */
|
|
3972
3978
|
|
|
3973
|
-
unlockDotCheckCanMint(
|
|
3979
|
+
unlockDotCheckCanMint(_ref94) {
|
|
3974
3980
|
let {
|
|
3975
3981
|
address,
|
|
3976
3982
|
network,
|
|
3977
3983
|
slug
|
|
3978
|
-
} =
|
|
3984
|
+
} = _ref94;
|
|
3979
3985
|
return this.#koniState.mintCampaignService.unlockDotCampaign.canMint(address, slug, network);
|
|
3980
3986
|
}
|
|
3981
|
-
unlockDotSubscribeMintedData(id, port,
|
|
3987
|
+
unlockDotSubscribeMintedData(id, port, _ref95) {
|
|
3982
3988
|
let {
|
|
3983
3989
|
transactionId
|
|
3984
|
-
} =
|
|
3990
|
+
} = _ref95;
|
|
3985
3991
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
3986
3992
|
const subscription = this.#koniState.mintCampaignService.unlockDotCampaign.subscribeMintedNft(transactionId, cb);
|
|
3987
3993
|
this.createUnsubscriptionHandle(id, subscription.unsubscribe);
|
|
@@ -4013,10 +4019,10 @@ class KoniExtension {
|
|
|
4013
4019
|
});
|
|
4014
4020
|
return filterBanner(await this.#koniState.campaignService.getProcessingCampaign());
|
|
4015
4021
|
}
|
|
4016
|
-
async completeCampaignBanner(
|
|
4022
|
+
async completeCampaignBanner(_ref96) {
|
|
4017
4023
|
let {
|
|
4018
4024
|
slug
|
|
4019
|
-
} =
|
|
4025
|
+
} = _ref96;
|
|
4020
4026
|
const campaign = await this.#koniState.dbService.getCampaign(slug);
|
|
4021
4027
|
if (campaign) {
|
|
4022
4028
|
await this.#koniState.dbService.upsertCampaign({
|
|
@@ -4263,6 +4269,8 @@ class KoniExtension {
|
|
|
4263
4269
|
return await this.getPrice();
|
|
4264
4270
|
case 'pri(price.getSubscription)':
|
|
4265
4271
|
return await this.subscribePrice(id, port);
|
|
4272
|
+
case 'pri(settings.savePriceCurrency)':
|
|
4273
|
+
return await this.setPriceCurrency(request);
|
|
4266
4274
|
case 'pri(balance.getBalance)':
|
|
4267
4275
|
return await this.getBalance();
|
|
4268
4276
|
case 'pri(balance.getSubscription)':
|