@subwallet/extension-base 1.1.9-0 → 1.1.10-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 +13 -1
- package/background/KoniTypes.js +5 -0
- package/background/errors/BalanceError.js +7 -5
- package/background/errors/EvmProviderError.js +10 -8
- package/background/errors/ProviderError.js +5 -4
- package/background/errors/TransactionError.js +22 -17
- package/background/handlers/Extension.js +18 -18
- package/background/handlers/State.js +5 -5
- package/background/handlers/Tabs.js +1 -1
- package/background/warnings/TransactionWarning.js +4 -2
- package/cjs/background/KoniTypes.js +7 -1
- package/cjs/background/errors/BalanceError.js +7 -5
- package/cjs/background/errors/EvmProviderError.js +10 -8
- package/cjs/background/errors/ProviderError.js +5 -4
- package/cjs/background/errors/TransactionError.js +22 -17
- package/cjs/background/handlers/Extension.js +18 -18
- package/cjs/background/handlers/State.js +5 -5
- package/cjs/background/handlers/Tabs.js +1 -1
- package/cjs/background/warnings/TransactionWarning.js +4 -2
- package/cjs/constants/i18n.js +4 -1
- package/cjs/constants/index.js +12 -0
- package/cjs/constants/storage.js +11 -0
- package/cjs/koni/api/dotsama/parseTransaction.js +2 -1
- package/cjs/koni/api/staking/bonding/paraChain.js +10 -6
- package/cjs/koni/api/staking/bonding/relayChain.js +16 -7
- package/cjs/koni/api/staking/bonding/utils.js +80 -7
- package/cjs/koni/background/handlers/Extension.js +206 -170
- package/cjs/koni/background/handlers/State.js +19 -14
- package/cjs/koni/background/handlers/Tabs.js +15 -14
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/balance-service/index.js +12 -3
- package/cjs/services/request-service/handler/AuthRequestHandler.js +4 -4
- package/cjs/services/request-service/handler/EvmRequestHandler.js +11 -10
- package/cjs/services/setting-service/SettingService.js +20 -7
- package/cjs/services/setting-service/constants.js +5 -1
- package/cjs/services/setting-service/i18n/Backend.js +42 -0
- package/cjs/services/setting-service/i18n/cache.js +12 -0
- package/cjs/services/setting-service/i18n/extend.js +16 -0
- package/cjs/services/setting-service/i18n/i18n.js +29 -0
- package/cjs/services/transaction-service/index.js +25 -16
- package/cjs/services/wallet-connect-service/handler/PolkadotRequestHandler.js +0 -1
- package/cjs/utils/eth/parseTransaction/base.js +1 -1
- package/cjs/utils/eth/parseTransaction/index.js +2 -1
- package/cjs/utils/index.js +2 -1
- package/constants/i18n.js +4 -1
- package/constants/index.d.ts +1 -0
- package/constants/index.js +2 -1
- package/constants/storage.d.ts +1 -0
- package/constants/storage.js +4 -0
- package/koni/api/dotsama/parseTransaction.js +2 -1
- package/koni/api/staking/bonding/paraChain.js +11 -7
- package/koni/api/staking/bonding/relayChain.js +17 -8
- package/koni/api/staking/bonding/utils.d.ts +4 -0
- package/koni/api/staking/bonding/utils.js +70 -2
- package/koni/background/handlers/Extension.d.ts +1 -0
- package/koni/background/handlers/Extension.js +85 -50
- package/koni/background/handlers/State.js +19 -14
- package/koni/background/handlers/Tabs.js +15 -14
- package/package.json +31 -11
- package/packageInfo.js +1 -1
- package/services/balance-service/index.js +12 -3
- package/services/request-service/handler/AuthRequestHandler.js +4 -4
- package/services/request-service/handler/EvmRequestHandler.js +11 -10
- package/services/setting-service/SettingService.d.ts +1 -0
- package/services/setting-service/SettingService.js +17 -5
- package/services/setting-service/constants.d.ts +2 -1
- package/services/setting-service/constants.js +4 -1
- package/services/setting-service/i18n/Backend.d.ts +9 -0
- package/services/setting-service/i18n/Backend.js +34 -0
- package/services/setting-service/i18n/cache.d.ts +2 -0
- package/services/setting-service/i18n/cache.js +5 -0
- package/services/setting-service/i18n/extend.d.ts +2 -0
- package/services/setting-service/i18n/extend.js +8 -0
- package/services/setting-service/i18n/i18n.d.ts +2 -0
- package/services/setting-service/i18n/i18n.js +21 -0
- package/services/transaction-service/index.js +25 -16
- package/services/wallet-connect-service/handler/PolkadotRequestHandler.js +0 -1
- package/utils/eth/parseTransaction/base.js +1 -1
- package/utils/eth/parseTransaction/index.js +2 -1
- package/utils/index.js +2 -1
- package/cjs/utils/keyring.js +0 -57
- package/utils/keyring.d.ts +0 -4
- package/utils/keyring.js +0 -49
|
@@ -42,6 +42,7 @@ var _uiKeyring = require("@subwallet/ui-keyring");
|
|
|
42
42
|
var _utils3 = require("@walletconnect/utils");
|
|
43
43
|
var _bignumber = _interopRequireDefault(require("bignumber.js"));
|
|
44
44
|
var _ethereumjsTx = require("ethereumjs-tx");
|
|
45
|
+
var _i18next = require("i18next");
|
|
45
46
|
var _types3 = require("@polkadot/types");
|
|
46
47
|
var _util = require("@polkadot/util");
|
|
47
48
|
var _utilCrypto = require("@polkadot/util-crypto");
|
|
@@ -144,14 +145,14 @@ class KoniExtension {
|
|
|
144
145
|
oldPass
|
|
145
146
|
} = _ref5;
|
|
146
147
|
const pair = _uiKeyring.keyring.getPair(address);
|
|
147
|
-
(0, _util.assert)(pair, 'Unable to find
|
|
148
|
+
(0, _util.assert)(pair, (0, _i18next.t)('Unable to find account'));
|
|
148
149
|
try {
|
|
149
150
|
if (!pair.isLocked) {
|
|
150
151
|
pair.lock();
|
|
151
152
|
}
|
|
152
153
|
pair.decodePkcs8(oldPass);
|
|
153
154
|
} catch (error) {
|
|
154
|
-
throw new Error('
|
|
155
|
+
throw new Error((0, _i18next.t)('Wrong password'));
|
|
155
156
|
}
|
|
156
157
|
_uiKeyring.keyring.encryptAccount(pair, newPass);
|
|
157
158
|
return true;
|
|
@@ -162,7 +163,7 @@ class KoniExtension {
|
|
|
162
163
|
name
|
|
163
164
|
} = _ref6;
|
|
164
165
|
const pair = _uiKeyring.keyring.getPair(address);
|
|
165
|
-
(0, _util.assert)(pair, 'Unable to find
|
|
166
|
+
(0, _util.assert)(pair, (0, _i18next.t)('Unable to find account'));
|
|
166
167
|
_uiKeyring.keyring.saveAccountMeta(pair, {
|
|
167
168
|
...pair.meta,
|
|
168
169
|
name
|
|
@@ -184,7 +185,7 @@ class KoniExtension {
|
|
|
184
185
|
isShowing
|
|
185
186
|
} = _ref8;
|
|
186
187
|
const pair = _uiKeyring.keyring.getPair(address);
|
|
187
|
-
(0, _util.assert)(pair, 'Unable to find
|
|
188
|
+
(0, _util.assert)(pair, (0, _i18next.t)('Unable to find account'));
|
|
188
189
|
_uiKeyring.keyring.saveAccountMeta(pair, {
|
|
189
190
|
...pair.meta,
|
|
190
191
|
isHidden: !isShowing
|
|
@@ -220,7 +221,7 @@ class KoniExtension {
|
|
|
220
221
|
id
|
|
221
222
|
} = _ref10;
|
|
222
223
|
const queued = this.#koniState.getMetaRequest(id);
|
|
223
|
-
(0, _util.assert)(queued, 'Unable to
|
|
224
|
+
(0, _util.assert)(queued, (0, _i18next.t)('Unable to proceed. Please try again'));
|
|
224
225
|
const {
|
|
225
226
|
request,
|
|
226
227
|
resolve
|
|
@@ -240,7 +241,7 @@ class KoniExtension {
|
|
|
240
241
|
id
|
|
241
242
|
} = _ref11;
|
|
242
243
|
const queued = this.#koniState.getMetaRequest(id);
|
|
243
|
-
(0, _util.assert)(queued, 'Unable to
|
|
244
|
+
(0, _util.assert)(queued, (0, _i18next.t)('Unable to proceed. Please try again'));
|
|
244
245
|
const {
|
|
245
246
|
reject
|
|
246
247
|
} = queued;
|
|
@@ -320,11 +321,15 @@ class KoniExtension {
|
|
|
320
321
|
phrase
|
|
321
322
|
} = (0, _utilCrypto.keyExtractSuri)(suri);
|
|
322
323
|
if ((0, _util.isHex)(phrase)) {
|
|
323
|
-
(0, _util.assert)((0, _util.isHex)(phrase, 256), '
|
|
324
|
+
(0, _util.assert)((0, _util.isHex)(phrase, 256), (0, _i18next.t)('Invalid seed phrase. Please try again.'));
|
|
324
325
|
} else {
|
|
325
326
|
// sadly isHex detects as string, so we need a cast here
|
|
326
|
-
(0, _util.assert)(_Extension.SEED_LENGTHS.includes(phrase.split(' ').length),
|
|
327
|
-
|
|
327
|
+
(0, _util.assert)(_Extension.SEED_LENGTHS.includes(phrase.split(' ').length), (0, _i18next.t)('Seed phrase needs to contain {{x}} words', {
|
|
328
|
+
replace: {
|
|
329
|
+
x: _Extension.SEED_LENGTHS.join(', ')
|
|
330
|
+
}
|
|
331
|
+
}));
|
|
332
|
+
(0, _util.assert)((0, _utilCrypto.mnemonicValidate)(phrase), (0, _i18next.t)('Invalid seed phrase. Please try again.'));
|
|
328
333
|
}
|
|
329
334
|
return {
|
|
330
335
|
address: _uiKeyring.keyring.createFromUri(getSuri(suri, type), {}, type).address,
|
|
@@ -339,7 +344,7 @@ class KoniExtension {
|
|
|
339
344
|
signature
|
|
340
345
|
} = _ref16;
|
|
341
346
|
const queued = this.#koniState.getSignRequest(id);
|
|
342
|
-
(0, _util.assert)(queued, 'Unable to
|
|
347
|
+
(0, _util.assert)(queued, (0, _i18next.t)('Unable to proceed. Please try again'));
|
|
343
348
|
const {
|
|
344
349
|
resolve
|
|
345
350
|
} = queued;
|
|
@@ -356,7 +361,7 @@ class KoniExtension {
|
|
|
356
361
|
id
|
|
357
362
|
} = _ref17;
|
|
358
363
|
const queued = this.#koniState.getSignRequest(id);
|
|
359
|
-
(0, _util.assert)(queued, 'Unable to
|
|
364
|
+
(0, _util.assert)(queued, (0, _i18next.t)('Unable to proceed. Please try again'));
|
|
360
365
|
const {
|
|
361
366
|
reject
|
|
362
367
|
} = queued;
|
|
@@ -406,12 +411,16 @@ class KoniExtension {
|
|
|
406
411
|
try {
|
|
407
412
|
parentPair.decodePkcs8(password);
|
|
408
413
|
} catch (e) {
|
|
409
|
-
throw new Error('
|
|
414
|
+
throw new Error((0, _i18next.t)('Wrong password'));
|
|
410
415
|
}
|
|
411
416
|
try {
|
|
412
417
|
return parentPair.derive(suri, metadata);
|
|
413
418
|
} catch (err) {
|
|
414
|
-
throw new Error(
|
|
419
|
+
throw new Error((0, _i18next.t)('"{{suri}}" is not a valid derivation path', {
|
|
420
|
+
replace: {
|
|
421
|
+
suri
|
|
422
|
+
}
|
|
423
|
+
}));
|
|
415
424
|
}
|
|
416
425
|
}
|
|
417
426
|
derivationValidate(_ref19) {
|
|
@@ -549,7 +558,7 @@ class KoniExtension {
|
|
|
549
558
|
publicKey: (0, _utilCrypto.decodeAddress)(address)
|
|
550
559
|
};
|
|
551
560
|
} else {
|
|
552
|
-
throw Error('
|
|
561
|
+
throw Error((0, _i18next.t)('This is not an address'));
|
|
553
562
|
}
|
|
554
563
|
}
|
|
555
564
|
editContactAccount(_ref23) {
|
|
@@ -562,7 +571,7 @@ class KoniExtension {
|
|
|
562
571
|
_uiKeyring.keyring.saveAddress(_address, meta);
|
|
563
572
|
return true;
|
|
564
573
|
} else {
|
|
565
|
-
throw Error('
|
|
574
|
+
throw Error((0, _i18next.t)('This is not an address'));
|
|
566
575
|
}
|
|
567
576
|
}
|
|
568
577
|
deleteContactAccount(_ref24) {
|
|
@@ -574,7 +583,7 @@ class KoniExtension {
|
|
|
574
583
|
_uiKeyring.keyring.forgetAddress(_address);
|
|
575
584
|
return true;
|
|
576
585
|
} else {
|
|
577
|
-
throw Error('
|
|
586
|
+
throw Error((0, _i18next.t)('This is not an address'));
|
|
578
587
|
}
|
|
579
588
|
}
|
|
580
589
|
_getAuthListV2() {
|
|
@@ -623,7 +632,7 @@ class KoniExtension {
|
|
|
623
632
|
id
|
|
624
633
|
} = _ref25;
|
|
625
634
|
const queued = this.#koniState.getAuthRequestV2(id);
|
|
626
|
-
(0, _util.assert)(queued, 'Unable to
|
|
635
|
+
(0, _util.assert)(queued, (0, _i18next.t)('Unable to proceed. Please try again'));
|
|
627
636
|
const {
|
|
628
637
|
resolve
|
|
629
638
|
} = queued;
|
|
@@ -638,7 +647,7 @@ class KoniExtension {
|
|
|
638
647
|
id
|
|
639
648
|
} = _ref26;
|
|
640
649
|
const queued = this.#koniState.getAuthRequestV2(id);
|
|
641
|
-
(0, _util.assert)(queued, 'Unable to
|
|
650
|
+
(0, _util.assert)(queued, (0, _i18next.t)('Unable to proceed. Please try again'));
|
|
642
651
|
const {
|
|
643
652
|
reject
|
|
644
653
|
} = queued;
|
|
@@ -650,7 +659,7 @@ class KoniExtension {
|
|
|
650
659
|
id
|
|
651
660
|
} = _ref27;
|
|
652
661
|
const queued = this.#koniState.getAuthRequestV2(id);
|
|
653
|
-
(0, _util.assert)(queued, 'Unable to
|
|
662
|
+
(0, _util.assert)(queued, (0, _i18next.t)('Unable to proceed. Please try again'));
|
|
654
663
|
const {
|
|
655
664
|
reject
|
|
656
665
|
} = queued;
|
|
@@ -887,6 +896,13 @@ class KoniExtension {
|
|
|
887
896
|
this.#koniState.updateSetting('timeAutoLock', autoLockTime);
|
|
888
897
|
return true;
|
|
889
898
|
}
|
|
899
|
+
setUnlockType(_ref30) {
|
|
900
|
+
let {
|
|
901
|
+
unlockType
|
|
902
|
+
} = _ref30;
|
|
903
|
+
this.#koniState.updateSetting('unlockType', unlockType);
|
|
904
|
+
return true;
|
|
905
|
+
}
|
|
890
906
|
async subscribeSettings(id, port) {
|
|
891
907
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
892
908
|
const balancesVisibilitySubscription = this.#koniState.subscribeSettingsSubject().subscribe({
|
|
@@ -900,31 +916,31 @@ class KoniExtension {
|
|
|
900
916
|
});
|
|
901
917
|
return await this.getSettings();
|
|
902
918
|
}
|
|
903
|
-
setEnableChainPatrol(
|
|
919
|
+
setEnableChainPatrol(_ref31) {
|
|
904
920
|
let {
|
|
905
921
|
enable
|
|
906
|
-
} =
|
|
922
|
+
} = _ref31;
|
|
907
923
|
this.#koniState.updateSetting('enableChainPatrol', enable);
|
|
908
924
|
return true;
|
|
909
925
|
}
|
|
910
|
-
setShowZeroBalance(
|
|
926
|
+
setShowZeroBalance(_ref32) {
|
|
911
927
|
let {
|
|
912
928
|
show
|
|
913
|
-
} =
|
|
929
|
+
} = _ref32;
|
|
914
930
|
this.#koniState.updateSetting('isShowZeroBalance', show);
|
|
915
931
|
return true;
|
|
916
932
|
}
|
|
917
|
-
setLanguage(
|
|
933
|
+
setLanguage(_ref33) {
|
|
918
934
|
let {
|
|
919
935
|
language
|
|
920
|
-
} =
|
|
936
|
+
} = _ref33;
|
|
921
937
|
this.#koniState.updateSetting('language', language);
|
|
922
938
|
return true;
|
|
923
939
|
}
|
|
924
|
-
setShowBalance(
|
|
940
|
+
setShowBalance(_ref34) {
|
|
925
941
|
let {
|
|
926
942
|
enable
|
|
927
|
-
} =
|
|
943
|
+
} = _ref34;
|
|
928
944
|
this.#koniState.updateSetting('isShowBalance', enable);
|
|
929
945
|
return true;
|
|
930
946
|
}
|
|
@@ -1100,7 +1116,7 @@ class KoniExtension {
|
|
|
1100
1116
|
}
|
|
1101
1117
|
});
|
|
1102
1118
|
}
|
|
1103
|
-
async accountsCreateSuriV2(
|
|
1119
|
+
async accountsCreateSuriV2(_ref35) {
|
|
1104
1120
|
let {
|
|
1105
1121
|
genesisHash,
|
|
1106
1122
|
isAllowed,
|
|
@@ -1108,13 +1124,13 @@ class KoniExtension {
|
|
|
1108
1124
|
password,
|
|
1109
1125
|
suri: _suri,
|
|
1110
1126
|
types
|
|
1111
|
-
} =
|
|
1127
|
+
} = _ref35;
|
|
1112
1128
|
const addressDict = {};
|
|
1113
1129
|
let changedAccount = false;
|
|
1114
1130
|
const hasMasterPassword = _uiKeyring.keyring.keyring.hasMasterPassword;
|
|
1115
1131
|
if (!hasMasterPassword) {
|
|
1116
1132
|
if (!password) {
|
|
1117
|
-
throw Error('
|
|
1133
|
+
throw Error((0, _i18next.t)('The password of each account is needed to set up master password'));
|
|
1118
1134
|
} else {
|
|
1119
1135
|
_uiKeyring.keyring.changeMasterPassword(password);
|
|
1120
1136
|
this.#koniState.updateKeyringState();
|
|
@@ -1156,10 +1172,10 @@ class KoniExtension {
|
|
|
1156
1172
|
});
|
|
1157
1173
|
return addressDict;
|
|
1158
1174
|
}
|
|
1159
|
-
async accountsForgetOverride(
|
|
1175
|
+
async accountsForgetOverride(_ref36) {
|
|
1160
1176
|
let {
|
|
1161
1177
|
address
|
|
1162
|
-
} =
|
|
1178
|
+
} = _ref36;
|
|
1163
1179
|
_uiKeyring.keyring.forgetAccount(address);
|
|
1164
1180
|
await new Promise(resolve => {
|
|
1165
1181
|
this.#koniState.removeAccountRef(address, () => {
|
|
@@ -1192,12 +1208,12 @@ class KoniExtension {
|
|
|
1192
1208
|
await this.#koniState.disableMantaPay(address);
|
|
1193
1209
|
return true;
|
|
1194
1210
|
}
|
|
1195
|
-
seedCreateV2(
|
|
1211
|
+
seedCreateV2(_ref37) {
|
|
1196
1212
|
let {
|
|
1197
1213
|
length = _Extension.SEED_DEFAULT_LENGTH,
|
|
1198
1214
|
seed: _seed,
|
|
1199
1215
|
types
|
|
1200
|
-
} =
|
|
1216
|
+
} = _ref37;
|
|
1201
1217
|
const seed = _seed || (0, _utilCrypto.mnemonicGenerate)(length);
|
|
1202
1218
|
const rs = {
|
|
1203
1219
|
seed: seed,
|
|
@@ -1208,20 +1224,24 @@ class KoniExtension {
|
|
|
1208
1224
|
});
|
|
1209
1225
|
return rs;
|
|
1210
1226
|
}
|
|
1211
|
-
seedValidateV2(
|
|
1227
|
+
seedValidateV2(_ref38) {
|
|
1212
1228
|
let {
|
|
1213
1229
|
suri,
|
|
1214
1230
|
types
|
|
1215
|
-
} =
|
|
1231
|
+
} = _ref38;
|
|
1216
1232
|
const {
|
|
1217
1233
|
phrase
|
|
1218
1234
|
} = (0, _utilCrypto.keyExtractSuri)(suri);
|
|
1219
1235
|
if ((0, _util.isHex)(phrase)) {
|
|
1220
|
-
(0, _util.assert)((0, _util.isHex)(phrase, 256), '
|
|
1236
|
+
(0, _util.assert)((0, _util.isHex)(phrase, 256), (0, _i18next.t)('Invalid seed phrase. Please try again.'));
|
|
1221
1237
|
} else {
|
|
1222
1238
|
// sadly isHex detects as string, so we need a cast here
|
|
1223
|
-
(0, _util.assert)(_Extension.SEED_LENGTHS.includes(phrase.split(' ').length),
|
|
1224
|
-
|
|
1239
|
+
(0, _util.assert)(_Extension.SEED_LENGTHS.includes(phrase.split(' ').length), (0, _i18next.t)('Seed phrase needs to contain {{x}} words', {
|
|
1240
|
+
replace: {
|
|
1241
|
+
x: _Extension.SEED_LENGTHS.join(', ')
|
|
1242
|
+
}
|
|
1243
|
+
}));
|
|
1244
|
+
(0, _util.assert)((0, _utilCrypto.mnemonicValidate)(phrase), (0, _i18next.t)('Invalid seed phrase. Please try again.'));
|
|
1225
1245
|
}
|
|
1226
1246
|
const rs = {
|
|
1227
1247
|
seed: suri,
|
|
@@ -1232,11 +1252,11 @@ class KoniExtension {
|
|
|
1232
1252
|
});
|
|
1233
1253
|
return rs;
|
|
1234
1254
|
}
|
|
1235
|
-
_checkValidatePrivateKey(
|
|
1255
|
+
_checkValidatePrivateKey(_ref39) {
|
|
1236
1256
|
let {
|
|
1237
1257
|
suri,
|
|
1238
1258
|
types
|
|
1239
|
-
} =
|
|
1259
|
+
} = _ref39;
|
|
1240
1260
|
let autoAddPrefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1241
1261
|
const {
|
|
1242
1262
|
phrase
|
|
@@ -1255,15 +1275,15 @@ class KoniExtension {
|
|
|
1255
1275
|
});
|
|
1256
1276
|
} else {
|
|
1257
1277
|
rs.autoAddPrefix = false;
|
|
1258
|
-
(0, _util.assert)(false, '
|
|
1278
|
+
(0, _util.assert)(false, (0, _i18next.t)('Invalid private key. Please try again.'));
|
|
1259
1279
|
}
|
|
1260
1280
|
return rs;
|
|
1261
1281
|
}
|
|
1262
|
-
metamaskPrivateKeyValidateV2(
|
|
1282
|
+
metamaskPrivateKeyValidateV2(_ref40) {
|
|
1263
1283
|
let {
|
|
1264
1284
|
suri,
|
|
1265
1285
|
types
|
|
1266
|
-
} =
|
|
1286
|
+
} = _ref40;
|
|
1267
1287
|
const isValidSuri = suri.startsWith('0x');
|
|
1268
1288
|
if (isValidSuri) {
|
|
1269
1289
|
return this._checkValidatePrivateKey({
|
|
@@ -1285,17 +1305,21 @@ class KoniExtension {
|
|
|
1285
1305
|
try {
|
|
1286
1306
|
return parentPair.derive(suri, metadata);
|
|
1287
1307
|
} catch (err) {
|
|
1288
|
-
throw new Error(
|
|
1308
|
+
throw new Error((0, _i18next.t)('"{{suri}}" is not a valid derivation path', {
|
|
1309
|
+
replace: {
|
|
1310
|
+
suri
|
|
1311
|
+
}
|
|
1312
|
+
}));
|
|
1289
1313
|
}
|
|
1290
1314
|
}
|
|
1291
|
-
derivationCreateV2(
|
|
1315
|
+
derivationCreateV2(_ref41) {
|
|
1292
1316
|
let {
|
|
1293
1317
|
genesisHash,
|
|
1294
1318
|
isAllowed,
|
|
1295
1319
|
name,
|
|
1296
1320
|
parentAddress,
|
|
1297
1321
|
suri
|
|
1298
|
-
} =
|
|
1322
|
+
} = _ref41;
|
|
1299
1323
|
const childPair = this.deriveV2(parentAddress, suri, {
|
|
1300
1324
|
genesisHash,
|
|
1301
1325
|
name,
|
|
@@ -1309,14 +1333,14 @@ class KoniExtension {
|
|
|
1309
1333
|
});
|
|
1310
1334
|
return true;
|
|
1311
1335
|
}
|
|
1312
|
-
jsonRestoreV2(
|
|
1336
|
+
jsonRestoreV2(_ref42) {
|
|
1313
1337
|
let {
|
|
1314
1338
|
address,
|
|
1315
1339
|
file,
|
|
1316
1340
|
isAllowed,
|
|
1317
1341
|
password,
|
|
1318
1342
|
withMasterPassword
|
|
1319
|
-
} =
|
|
1343
|
+
} = _ref42;
|
|
1320
1344
|
const isPasswordValidated = this.validatePassword(file, password);
|
|
1321
1345
|
if (isPasswordValidated) {
|
|
1322
1346
|
try {
|
|
@@ -1328,16 +1352,16 @@ class KoniExtension {
|
|
|
1328
1352
|
throw new Error(error.message);
|
|
1329
1353
|
}
|
|
1330
1354
|
} else {
|
|
1331
|
-
throw new Error('
|
|
1355
|
+
throw new Error((0, _i18next.t)('Wrong password'));
|
|
1332
1356
|
}
|
|
1333
1357
|
}
|
|
1334
|
-
batchRestoreV2(
|
|
1358
|
+
batchRestoreV2(_ref43) {
|
|
1335
1359
|
let {
|
|
1336
1360
|
accountsInfo,
|
|
1337
1361
|
file,
|
|
1338
1362
|
isAllowed,
|
|
1339
1363
|
password
|
|
1340
|
-
} =
|
|
1364
|
+
} = _ref43;
|
|
1341
1365
|
const addressList = accountsInfo.map(acc => acc.address);
|
|
1342
1366
|
const isPasswordValidated = this.validatedAccountsPassword(file, password);
|
|
1343
1367
|
if (isPasswordValidated) {
|
|
@@ -1350,7 +1374,7 @@ class KoniExtension {
|
|
|
1350
1374
|
throw new Error(error.message);
|
|
1351
1375
|
}
|
|
1352
1376
|
} else {
|
|
1353
|
-
throw new Error('
|
|
1377
|
+
throw new Error((0, _i18next.t)('Wrong password'));
|
|
1354
1378
|
}
|
|
1355
1379
|
}
|
|
1356
1380
|
getNftCollection() {
|
|
@@ -1457,7 +1481,7 @@ class KoniExtension {
|
|
|
1457
1481
|
let transferValue;
|
|
1458
1482
|
if (!transferAll) {
|
|
1459
1483
|
if (value === undefined) {
|
|
1460
|
-
errors.push(new _TransactionError.TransactionError(_KoniTypes.BasicTxErrorType.INVALID_PARAMS, '
|
|
1484
|
+
errors.push(new _TransactionError.TransactionError(_KoniTypes.BasicTxErrorType.INVALID_PARAMS, (0, _i18next.t)('Transfer amount is required')));
|
|
1461
1485
|
}
|
|
1462
1486
|
if (value) {
|
|
1463
1487
|
transferValue = new _util.BN(value);
|
|
@@ -1465,10 +1489,10 @@ class KoniExtension {
|
|
|
1465
1489
|
}
|
|
1466
1490
|
const tokenInfo = this.#koniState.getAssetBySlug(tokenSlug);
|
|
1467
1491
|
if (!tokenInfo) {
|
|
1468
|
-
errors.push(new _TransactionError.TransactionError(_KoniTypes.BasicTxErrorType.INVALID_PARAMS, 'Not found token from registry'));
|
|
1492
|
+
errors.push(new _TransactionError.TransactionError(_KoniTypes.BasicTxErrorType.INVALID_PARAMS, (0, _i18next.t)('Not found token from registry')));
|
|
1469
1493
|
}
|
|
1470
1494
|
if ((0, _utilCrypto.isEthereumAddress)(from) && (0, _utilCrypto.isEthereumAddress)(to) && (0, _utils._isTokenEvmSmartContract)(tokenInfo) && (0, _utils._getContractAddressOfToken)(tokenInfo).length === 0) {
|
|
1471
|
-
errors.push(new _TransactionError.TransactionError(_KoniTypes.BasicTxErrorType.INVALID_PARAMS, 'Not found ERC20 address for this token'));
|
|
1495
|
+
errors.push(new _TransactionError.TransactionError(_KoniTypes.BasicTxErrorType.INVALID_PARAMS, (0, _i18next.t)('Not found ERC20 address for this token')));
|
|
1472
1496
|
}
|
|
1473
1497
|
return [errors, keypair, transferValue, tokenInfo];
|
|
1474
1498
|
}
|
|
@@ -1536,7 +1560,7 @@ class KoniExtension {
|
|
|
1536
1560
|
} catch (e) {
|
|
1537
1561
|
const error = e;
|
|
1538
1562
|
if (error.message.includes('transfer amount exceeds balance')) {
|
|
1539
|
-
error.message = '
|
|
1563
|
+
error.message = (0, _i18next.t)('Insufficient balance');
|
|
1540
1564
|
}
|
|
1541
1565
|
throw error;
|
|
1542
1566
|
}
|
|
@@ -1557,7 +1581,7 @@ class KoniExtension {
|
|
|
1557
1581
|
token: tokenSlug
|
|
1558
1582
|
});
|
|
1559
1583
|
if (new _bignumber.default(balance).minus(transferAmount.value).lt(minAmount)) {
|
|
1560
|
-
inputTransaction.warnings.push(new _TransactionWarning.TransactionWarning(_KoniTypes.BasicTxWarningCode.NOT_ENOUGH_EXISTENTIAL_DEPOSIT
|
|
1584
|
+
inputTransaction.warnings.push(new _TransactionWarning.TransactionWarning(_KoniTypes.BasicTxWarningCode.NOT_ENOUGH_EXISTENTIAL_DEPOSIT));
|
|
1561
1585
|
}
|
|
1562
1586
|
}
|
|
1563
1587
|
const {
|
|
@@ -1572,7 +1596,12 @@ class KoniExtension {
|
|
|
1572
1596
|
if (new _bignumber.default(receiverBalance).plus(transferAmount.value).lt(minAmount)) {
|
|
1573
1597
|
const atLeast = new _bignumber.default(minAmount).minus(receiverBalance).plus((tokenInfo.decimals || 0) === 0 ? 0 : 1);
|
|
1574
1598
|
const atLeastStr = (0, _number.formatNumber)(atLeast, tokenInfo.decimals || 0, _number.balanceFormatter);
|
|
1575
|
-
inputTransaction.errors.push(new _TransactionError.TransactionError(_KoniTypes.TransferTxErrorType.RECEIVER_NOT_ENOUGH_EXISTENTIAL_DEPOSIT,
|
|
1599
|
+
inputTransaction.errors.push(new _TransactionError.TransactionError(_KoniTypes.TransferTxErrorType.RECEIVER_NOT_ENOUGH_EXISTENTIAL_DEPOSIT, (0, _i18next.t)('You must transfer at least {{amount}}{{symbol}} to keep the destination account alive', {
|
|
1600
|
+
replace: {
|
|
1601
|
+
amount: atLeastStr,
|
|
1602
|
+
symbol: tokenInfo.symbol
|
|
1603
|
+
}
|
|
1604
|
+
})));
|
|
1576
1605
|
}
|
|
1577
1606
|
};
|
|
1578
1607
|
return this.#koniState.transactionService.handleTransaction({
|
|
@@ -1598,7 +1627,7 @@ class KoniExtension {
|
|
|
1598
1627
|
const originTokenInfo = this.#koniState.getAssetBySlug(sendingTokenSlug);
|
|
1599
1628
|
const destinationTokenInfo = this.#koniState.getXcmEqualAssetByChain(destinationNetworkKey, sendingTokenSlug);
|
|
1600
1629
|
if (!destinationTokenInfo) {
|
|
1601
|
-
errors.push(new _TransactionError.TransactionError(_KoniTypes.TransferTxErrorType.INVALID_TOKEN, 'Not found token from registry'));
|
|
1630
|
+
errors.push(new _TransactionError.TransactionError(_KoniTypes.TransferTxErrorType.INVALID_TOKEN, (0, _i18next.t)('Not found token from registry')));
|
|
1602
1631
|
}
|
|
1603
1632
|
return [errors, keypair, transferValue, originTokenInfo, destinationTokenInfo];
|
|
1604
1633
|
}
|
|
@@ -1636,7 +1665,12 @@ class KoniExtension {
|
|
|
1636
1665
|
// Check ed for receiver
|
|
1637
1666
|
if (new _bignumber.default(value).lt(atLeast)) {
|
|
1638
1667
|
const atLeastStr = (0, _number.formatNumber)(atLeast, destinationTokenInfo.decimals || 0, _number.balanceFormatter);
|
|
1639
|
-
inputTransaction.errors.push(new _TransactionError.TransactionError(_KoniTypes.TransferTxErrorType.RECEIVER_NOT_ENOUGH_EXISTENTIAL_DEPOSIT,
|
|
1668
|
+
inputTransaction.errors.push(new _TransactionError.TransactionError(_KoniTypes.TransferTxErrorType.RECEIVER_NOT_ENOUGH_EXISTENTIAL_DEPOSIT, (0, _i18next.t)('You must transfer at least {{amount}}{{symbol}} to keep the destination account alive', {
|
|
1669
|
+
replace: {
|
|
1670
|
+
amount: atLeastStr,
|
|
1671
|
+
symbol: originTokenInfo.symbol
|
|
1672
|
+
}
|
|
1673
|
+
})));
|
|
1640
1674
|
}
|
|
1641
1675
|
const srcMinAmount = originTokenInfo.minAmount || '0';
|
|
1642
1676
|
const isTransferNativeToken = originTokenInfo.assetType === _types._AssetType.NATIVE;
|
|
@@ -1651,7 +1685,7 @@ class KoniExtension {
|
|
|
1651
1685
|
token: originTokenInfo.slug
|
|
1652
1686
|
});
|
|
1653
1687
|
if (new _bignumber.default(balance).minus(value).lt(srcMinAmount)) {
|
|
1654
|
-
inputTransaction.warnings.push(new _TransactionWarning.TransactionWarning(_KoniTypes.BasicTxWarningCode.NOT_ENOUGH_EXISTENTIAL_DEPOSIT
|
|
1688
|
+
inputTransaction.warnings.push(new _TransactionWarning.TransactionWarning(_KoniTypes.BasicTxWarningCode.NOT_ENOUGH_EXISTENTIAL_DEPOSIT));
|
|
1655
1689
|
}
|
|
1656
1690
|
}
|
|
1657
1691
|
};
|
|
@@ -1728,21 +1762,21 @@ class KoniExtension {
|
|
|
1728
1762
|
disableChain(networkKey) {
|
|
1729
1763
|
return this.#koniState.disableChain(networkKey);
|
|
1730
1764
|
}
|
|
1731
|
-
async enableChain(
|
|
1765
|
+
async enableChain(_ref44) {
|
|
1732
1766
|
let {
|
|
1733
1767
|
chainSlug,
|
|
1734
1768
|
enableTokens
|
|
1735
|
-
} =
|
|
1769
|
+
} = _ref44;
|
|
1736
1770
|
return await this.#koniState.enableChain(chainSlug, enableTokens);
|
|
1737
1771
|
}
|
|
1738
1772
|
async reconnectChain(chainSlug) {
|
|
1739
1773
|
return this.#koniState.chainService.reconnectChain(chainSlug);
|
|
1740
1774
|
}
|
|
1741
|
-
async validateNetwork(
|
|
1775
|
+
async validateNetwork(_ref45) {
|
|
1742
1776
|
let {
|
|
1743
1777
|
existedChainSlug,
|
|
1744
1778
|
provider
|
|
1745
|
-
} =
|
|
1779
|
+
} = _ref45;
|
|
1746
1780
|
return await this.#koniState.validateCustomChain(provider, existedChainSlug);
|
|
1747
1781
|
}
|
|
1748
1782
|
resetDefaultNetwork() {
|
|
@@ -1780,12 +1814,12 @@ class KoniExtension {
|
|
|
1780
1814
|
async validateCustomAsset(data) {
|
|
1781
1815
|
return await this.#koniState.validateCustomAsset(data);
|
|
1782
1816
|
}
|
|
1783
|
-
async getAddressFreeBalance(
|
|
1817
|
+
async getAddressFreeBalance(_ref46) {
|
|
1784
1818
|
let {
|
|
1785
1819
|
address,
|
|
1786
1820
|
networkKey,
|
|
1787
1821
|
token
|
|
1788
|
-
} =
|
|
1822
|
+
} = _ref46;
|
|
1789
1823
|
if (token && _constants2._MANTA_ZK_CHAIN_GROUP.includes(networkKey)) {
|
|
1790
1824
|
const tokenInfo = this.#koniState.chainService.getAssetBySlug(token);
|
|
1791
1825
|
if (tokenInfo.symbol.startsWith(_constants2._ZK_ASSET_PREFIX)) {
|
|
@@ -1794,14 +1828,14 @@ class KoniExtension {
|
|
|
1794
1828
|
}
|
|
1795
1829
|
return await this.#koniState.balanceService.getTokenFreeBalance(address, networkKey, token);
|
|
1796
1830
|
}
|
|
1797
|
-
async transferGetMaxTransferable(
|
|
1831
|
+
async transferGetMaxTransferable(_ref47) {
|
|
1798
1832
|
let {
|
|
1799
1833
|
address,
|
|
1800
1834
|
destChain,
|
|
1801
1835
|
isXcmTransfer,
|
|
1802
1836
|
networkKey,
|
|
1803
1837
|
token
|
|
1804
|
-
} =
|
|
1838
|
+
} = _ref47;
|
|
1805
1839
|
const freeBalance = await this.getAddressFreeBalance({
|
|
1806
1840
|
address,
|
|
1807
1841
|
networkKey,
|
|
@@ -1867,7 +1901,7 @@ class KoniExtension {
|
|
|
1867
1901
|
}
|
|
1868
1902
|
} catch (e) {
|
|
1869
1903
|
estimatedFee = '0';
|
|
1870
|
-
console.warn('
|
|
1904
|
+
console.warn('Unable to estimate fee', e);
|
|
1871
1905
|
}
|
|
1872
1906
|
maxTransferable = maxTransferable.sub(new _util.BN(estimatedFee));
|
|
1873
1907
|
return {
|
|
@@ -1876,12 +1910,12 @@ class KoniExtension {
|
|
|
1876
1910
|
};
|
|
1877
1911
|
}
|
|
1878
1912
|
}
|
|
1879
|
-
async subscribeAddressFreeBalance(
|
|
1913
|
+
async subscribeAddressFreeBalance(_ref48, id, port) {
|
|
1880
1914
|
let {
|
|
1881
1915
|
address,
|
|
1882
1916
|
networkKey,
|
|
1883
1917
|
token
|
|
1884
|
-
} =
|
|
1918
|
+
} = _ref48;
|
|
1885
1919
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
1886
1920
|
const [unsub, currentFreeBalance] = await this.#koniState.balanceService.subscribeTokenFreeBalance(address, networkKey, token, cb);
|
|
1887
1921
|
this.createUnsubscriptionHandle(id, unsub);
|
|
@@ -1890,26 +1924,26 @@ class KoniExtension {
|
|
|
1890
1924
|
});
|
|
1891
1925
|
return currentFreeBalance;
|
|
1892
1926
|
}
|
|
1893
|
-
async transferCheckReferenceCount(
|
|
1927
|
+
async transferCheckReferenceCount(_ref49) {
|
|
1894
1928
|
let {
|
|
1895
1929
|
address,
|
|
1896
1930
|
networkKey
|
|
1897
|
-
} =
|
|
1931
|
+
} = _ref49;
|
|
1898
1932
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-return
|
|
1899
1933
|
return await (0, _transfer.checkReferenceCount)(networkKey, address, this.#koniState.getSubstrateApiMap(), this.#koniState.getChainInfo(networkKey));
|
|
1900
1934
|
}
|
|
1901
|
-
async transferCheckSupporting(
|
|
1935
|
+
async transferCheckSupporting(_ref50) {
|
|
1902
1936
|
let {
|
|
1903
1937
|
networkKey,
|
|
1904
1938
|
tokenSlug
|
|
1905
|
-
} =
|
|
1939
|
+
} = _ref50;
|
|
1906
1940
|
const tokenInfo = this.#koniState.getAssetBySlug(tokenSlug);
|
|
1907
1941
|
return await (0, _transfer.checkSupportTransfer)(networkKey, tokenInfo, this.#koniState.getSubstrateApiMap(), this.#koniState.getChainInfo(networkKey));
|
|
1908
1942
|
}
|
|
1909
|
-
transferGetExistentialDeposit(
|
|
1943
|
+
transferGetExistentialDeposit(_ref51) {
|
|
1910
1944
|
let {
|
|
1911
1945
|
tokenSlug
|
|
1912
|
-
} =
|
|
1946
|
+
} = _ref51;
|
|
1913
1947
|
const tokenInfo = this.#koniState.getAssetBySlug(tokenSlug);
|
|
1914
1948
|
return (0, _utils._getTokenMinAmount)(tokenInfo);
|
|
1915
1949
|
}
|
|
@@ -1945,11 +1979,11 @@ class KoniExtension {
|
|
|
1945
1979
|
isSendingSelf
|
|
1946
1980
|
};
|
|
1947
1981
|
}
|
|
1948
|
-
async enableChains(
|
|
1982
|
+
async enableChains(_ref52) {
|
|
1949
1983
|
let {
|
|
1950
1984
|
chainSlugs,
|
|
1951
1985
|
enableTokens
|
|
1952
|
-
} =
|
|
1986
|
+
} = _ref52;
|
|
1953
1987
|
try {
|
|
1954
1988
|
await Promise.all(chainSlugs.map(chainSlug => this.enableChain({
|
|
1955
1989
|
chainSlug,
|
|
@@ -1960,24 +1994,24 @@ class KoniExtension {
|
|
|
1960
1994
|
}
|
|
1961
1995
|
return true;
|
|
1962
1996
|
}
|
|
1963
|
-
getAccountMeta(
|
|
1997
|
+
getAccountMeta(_ref53) {
|
|
1964
1998
|
let {
|
|
1965
1999
|
address
|
|
1966
|
-
} =
|
|
2000
|
+
} = _ref53;
|
|
1967
2001
|
const pair = _uiKeyring.keyring.getPair(address);
|
|
1968
|
-
(0, _util.assert)(pair, 'Unable to find
|
|
2002
|
+
(0, _util.assert)(pair, (0, _i18next.t)('Unable to find account'));
|
|
1969
2003
|
return {
|
|
1970
2004
|
meta: pair.meta
|
|
1971
2005
|
};
|
|
1972
2006
|
}
|
|
1973
|
-
accountsTie2(
|
|
2007
|
+
accountsTie2(_ref54) {
|
|
1974
2008
|
let {
|
|
1975
2009
|
address,
|
|
1976
2010
|
genesisHash
|
|
1977
|
-
} =
|
|
2011
|
+
} = _ref54;
|
|
1978
2012
|
return this.#koniState.setAccountTie(address, genesisHash);
|
|
1979
2013
|
}
|
|
1980
|
-
async accountsCreateExternalV2(
|
|
2014
|
+
async accountsCreateExternalV2(_ref55) {
|
|
1981
2015
|
let {
|
|
1982
2016
|
address,
|
|
1983
2017
|
genesisHash,
|
|
@@ -1985,7 +2019,7 @@ class KoniExtension {
|
|
|
1985
2019
|
isEthereum,
|
|
1986
2020
|
isReadOnly,
|
|
1987
2021
|
name
|
|
1988
|
-
} =
|
|
2022
|
+
} = _ref55;
|
|
1989
2023
|
try {
|
|
1990
2024
|
let result;
|
|
1991
2025
|
try {
|
|
@@ -1994,7 +2028,7 @@ class KoniExtension {
|
|
|
1994
2028
|
if (exists.type === (isEthereum ? 'ethereum' : 'sr25519')) {
|
|
1995
2029
|
return [{
|
|
1996
2030
|
code: _KoniTypes.AccountExternalErrorCode.INVALID_ADDRESS,
|
|
1997
|
-
message: 'Account exists'
|
|
2031
|
+
message: (0, _i18next.t)('Account exists')
|
|
1998
2032
|
}];
|
|
1999
2033
|
}
|
|
2000
2034
|
}
|
|
@@ -2044,7 +2078,7 @@ class KoniExtension {
|
|
|
2044
2078
|
}];
|
|
2045
2079
|
}
|
|
2046
2080
|
}
|
|
2047
|
-
async accountsCreateHardwareV2(
|
|
2081
|
+
async accountsCreateHardwareV2(_ref56) {
|
|
2048
2082
|
let {
|
|
2049
2083
|
accountIndex,
|
|
2050
2084
|
address,
|
|
@@ -2053,7 +2087,7 @@ class KoniExtension {
|
|
|
2053
2087
|
hardwareType,
|
|
2054
2088
|
isAllowed,
|
|
2055
2089
|
name
|
|
2056
|
-
} =
|
|
2090
|
+
} = _ref56;
|
|
2057
2091
|
const key = _uiKeyring.keyring.addHardware(address, hardwareType, {
|
|
2058
2092
|
accountIndex,
|
|
2059
2093
|
addressOffset,
|
|
@@ -2076,13 +2110,13 @@ class KoniExtension {
|
|
|
2076
2110
|
});
|
|
2077
2111
|
return true;
|
|
2078
2112
|
}
|
|
2079
|
-
async accountsCreateHardwareMultiple(
|
|
2113
|
+
async accountsCreateHardwareMultiple(_ref57) {
|
|
2080
2114
|
let {
|
|
2081
2115
|
accounts
|
|
2082
|
-
} =
|
|
2116
|
+
} = _ref57;
|
|
2083
2117
|
const addresses = [];
|
|
2084
2118
|
if (!accounts.length) {
|
|
2085
|
-
throw new Error('
|
|
2119
|
+
throw new Error((0, _i18next.t)("Can't find an account. Please try again"));
|
|
2086
2120
|
}
|
|
2087
2121
|
const slugMap = {};
|
|
2088
2122
|
for (const account of accounts) {
|
|
@@ -2157,14 +2191,14 @@ class KoniExtension {
|
|
|
2157
2191
|
}
|
|
2158
2192
|
return true;
|
|
2159
2193
|
}
|
|
2160
|
-
async accountsCreateWithSecret(
|
|
2194
|
+
async accountsCreateWithSecret(_ref58) {
|
|
2161
2195
|
let {
|
|
2162
2196
|
isAllow,
|
|
2163
2197
|
isEthereum,
|
|
2164
2198
|
name,
|
|
2165
2199
|
publicKey,
|
|
2166
2200
|
secretKey
|
|
2167
|
-
} =
|
|
2201
|
+
} = _ref58;
|
|
2168
2202
|
try {
|
|
2169
2203
|
let keyringPair = null;
|
|
2170
2204
|
if (isEthereum) {
|
|
@@ -2195,7 +2229,7 @@ class KoniExtension {
|
|
|
2195
2229
|
success: false,
|
|
2196
2230
|
errors: [{
|
|
2197
2231
|
code: _KoniTypes.AccountExternalErrorCode.KEYRING_ERROR,
|
|
2198
|
-
message: '
|
|
2232
|
+
message: (0, _i18next.t)('Cannot create account')
|
|
2199
2233
|
}]
|
|
2200
2234
|
};
|
|
2201
2235
|
}
|
|
@@ -2307,32 +2341,32 @@ class KoniExtension {
|
|
|
2307
2341
|
|
|
2308
2342
|
// Parse transaction
|
|
2309
2343
|
|
|
2310
|
-
parseSubstrateTransaction(
|
|
2344
|
+
parseSubstrateTransaction(_ref59) {
|
|
2311
2345
|
let {
|
|
2312
2346
|
data,
|
|
2313
2347
|
networkKey
|
|
2314
|
-
} =
|
|
2348
|
+
} = _ref59;
|
|
2315
2349
|
const apiProps = this.#koniState.getSubstrateApi(networkKey);
|
|
2316
2350
|
const apiPromise = apiProps.api;
|
|
2317
2351
|
return (0, _parseTransaction.parseSubstrateTransaction)(data, apiPromise);
|
|
2318
2352
|
}
|
|
2319
|
-
async parseEVMRLP(
|
|
2353
|
+
async parseEVMRLP(_ref60) {
|
|
2320
2354
|
let {
|
|
2321
2355
|
data
|
|
2322
|
-
} =
|
|
2356
|
+
} = _ref60;
|
|
2323
2357
|
return await (0, _parseTransaction2.parseEvmRlp)(data, this.#koniState.getChainInfoMap(), this.#koniState.getEvmApiMap());
|
|
2324
2358
|
}
|
|
2325
2359
|
|
|
2326
2360
|
// Sign
|
|
2327
2361
|
|
|
2328
|
-
qrSignSubstrate(
|
|
2362
|
+
qrSignSubstrate(_ref61) {
|
|
2329
2363
|
let {
|
|
2330
2364
|
address,
|
|
2331
2365
|
data,
|
|
2332
2366
|
networkKey
|
|
2333
|
-
} =
|
|
2367
|
+
} = _ref61;
|
|
2334
2368
|
const pair = _uiKeyring.keyring.getPair(address);
|
|
2335
|
-
(0, _util.assert)(pair, 'Unable to find
|
|
2369
|
+
(0, _util.assert)(pair, (0, _i18next.t)('Unable to find account'));
|
|
2336
2370
|
if (pair.isLocked) {
|
|
2337
2371
|
_uiKeyring.keyring.unlockPair(pair.address);
|
|
2338
2372
|
}
|
|
@@ -2347,21 +2381,21 @@ class KoniExtension {
|
|
|
2347
2381
|
signature: signed
|
|
2348
2382
|
};
|
|
2349
2383
|
}
|
|
2350
|
-
async qrSignEVM(
|
|
2384
|
+
async qrSignEVM(_ref62) {
|
|
2351
2385
|
let {
|
|
2352
2386
|
address,
|
|
2353
2387
|
chainId,
|
|
2354
2388
|
message,
|
|
2355
2389
|
type
|
|
2356
|
-
} =
|
|
2390
|
+
} = _ref62;
|
|
2357
2391
|
let signed;
|
|
2358
2392
|
const network = this.getNetworkJsonByChainId(chainId);
|
|
2359
2393
|
if (!network) {
|
|
2360
|
-
throw new Error('Cannot find network');
|
|
2394
|
+
throw new Error((0, _i18next.t)('Cannot find network'));
|
|
2361
2395
|
}
|
|
2362
2396
|
const pair = _uiKeyring.keyring.getPair(address);
|
|
2363
2397
|
if (!pair) {
|
|
2364
|
-
throw Error('Unable to find
|
|
2398
|
+
throw Error((0, _i18next.t)('Unable to find account'));
|
|
2365
2399
|
}
|
|
2366
2400
|
if (pair.isLocked) {
|
|
2367
2401
|
_uiKeyring.keyring.unlockPair(pair.address);
|
|
@@ -2377,7 +2411,7 @@ class KoniExtension {
|
|
|
2377
2411
|
} else {
|
|
2378
2412
|
const tx = (0, _eth.createTransactionFromRLP)(message);
|
|
2379
2413
|
if (!tx) {
|
|
2380
|
-
throw new Error(
|
|
2414
|
+
throw new Error((0, _i18next.t)('Failed to decode data. Please use a valid QR code'));
|
|
2381
2415
|
}
|
|
2382
2416
|
const txObject = {
|
|
2383
2417
|
gasPrice: new _bignumber.default(tx.gasPrice).toNumber(),
|
|
@@ -2434,11 +2468,11 @@ class KoniExtension {
|
|
|
2434
2468
|
});
|
|
2435
2469
|
return this.#koniState.getNominatorMetadata();
|
|
2436
2470
|
}
|
|
2437
|
-
async getBondingOptions(
|
|
2471
|
+
async getBondingOptions(_ref63) {
|
|
2438
2472
|
let {
|
|
2439
2473
|
chain,
|
|
2440
2474
|
type
|
|
2441
|
-
} =
|
|
2475
|
+
} = _ref63;
|
|
2442
2476
|
const apiProps = this.#koniState.getSubstrateApi(chain);
|
|
2443
2477
|
const chainInfo = this.#koniState.getChainInfo(chain);
|
|
2444
2478
|
const chainStakingMetadata = await this.#koniState.getStakingMetadataByChain(chain, type);
|
|
@@ -2627,12 +2661,12 @@ class KoniExtension {
|
|
|
2627
2661
|
}
|
|
2628
2662
|
|
|
2629
2663
|
// EVM Transaction
|
|
2630
|
-
async parseContractInput(
|
|
2664
|
+
async parseContractInput(_ref64) {
|
|
2631
2665
|
let {
|
|
2632
2666
|
chainId,
|
|
2633
2667
|
contract,
|
|
2634
2668
|
data
|
|
2635
|
-
} =
|
|
2669
|
+
} = _ref64;
|
|
2636
2670
|
const network = this.getNetworkJsonByChainId(chainId);
|
|
2637
2671
|
return await (0, _parseTransaction2.parseContractInput)(data, contract, network);
|
|
2638
2672
|
}
|
|
@@ -2703,12 +2737,12 @@ class KoniExtension {
|
|
|
2703
2737
|
|
|
2704
2738
|
// Change master password
|
|
2705
2739
|
|
|
2706
|
-
keyringChangeMasterPassword(
|
|
2740
|
+
keyringChangeMasterPassword(_ref65) {
|
|
2707
2741
|
let {
|
|
2708
2742
|
createNew,
|
|
2709
2743
|
newPassword,
|
|
2710
2744
|
oldPassword
|
|
2711
|
-
} =
|
|
2745
|
+
} = _ref65;
|
|
2712
2746
|
try {
|
|
2713
2747
|
// Remove isMasterPassword meta if createNew
|
|
2714
2748
|
if (createNew) {
|
|
@@ -2729,7 +2763,7 @@ class KoniExtension {
|
|
|
2729
2763
|
} catch (e) {
|
|
2730
2764
|
console.error(e);
|
|
2731
2765
|
return {
|
|
2732
|
-
errors: [e.message],
|
|
2766
|
+
errors: [(0, _i18next.t)(e.message)],
|
|
2733
2767
|
status: false
|
|
2734
2768
|
};
|
|
2735
2769
|
}
|
|
@@ -2742,11 +2776,11 @@ class KoniExtension {
|
|
|
2742
2776
|
|
|
2743
2777
|
// Migrate password
|
|
2744
2778
|
|
|
2745
|
-
keyringMigrateMasterPassword(
|
|
2779
|
+
keyringMigrateMasterPassword(_ref66) {
|
|
2746
2780
|
let {
|
|
2747
2781
|
address,
|
|
2748
2782
|
password
|
|
2749
|
-
} =
|
|
2783
|
+
} = _ref66;
|
|
2750
2784
|
try {
|
|
2751
2785
|
_uiKeyring.keyring.migrateWithMasterPassword(address, password);
|
|
2752
2786
|
} catch (e) {
|
|
@@ -2764,10 +2798,10 @@ class KoniExtension {
|
|
|
2764
2798
|
|
|
2765
2799
|
// Unlock wallet
|
|
2766
2800
|
|
|
2767
|
-
keyringUnlock(
|
|
2801
|
+
keyringUnlock(_ref67) {
|
|
2768
2802
|
let {
|
|
2769
2803
|
password
|
|
2770
|
-
} =
|
|
2804
|
+
} = _ref67;
|
|
2771
2805
|
try {
|
|
2772
2806
|
_uiKeyring.keyring.unlockKeyring(password);
|
|
2773
2807
|
this.#koniState.initMantaPay(password).catch(console.error);
|
|
@@ -2794,11 +2828,11 @@ class KoniExtension {
|
|
|
2794
2828
|
|
|
2795
2829
|
// Export mnemonic
|
|
2796
2830
|
|
|
2797
|
-
keyringExportMnemonic(
|
|
2831
|
+
keyringExportMnemonic(_ref68) {
|
|
2798
2832
|
let {
|
|
2799
2833
|
address,
|
|
2800
2834
|
password
|
|
2801
|
-
} =
|
|
2835
|
+
} = _ref68;
|
|
2802
2836
|
const pair = _uiKeyring.keyring.getPair(address);
|
|
2803
2837
|
const result = pair.exportMnemonic(password);
|
|
2804
2838
|
return {
|
|
@@ -2808,10 +2842,10 @@ class KoniExtension {
|
|
|
2808
2842
|
|
|
2809
2843
|
// Reset wallet
|
|
2810
2844
|
|
|
2811
|
-
async resetWallet(
|
|
2845
|
+
async resetWallet(_ref69) {
|
|
2812
2846
|
let {
|
|
2813
2847
|
resetAll
|
|
2814
|
-
} =
|
|
2848
|
+
} = _ref69;
|
|
2815
2849
|
try {
|
|
2816
2850
|
await this.#koniState.resetWallet(resetAll);
|
|
2817
2851
|
return {
|
|
@@ -2827,12 +2861,12 @@ class KoniExtension {
|
|
|
2827
2861
|
}
|
|
2828
2862
|
|
|
2829
2863
|
/// Signing external request
|
|
2830
|
-
signingApprovePasswordV2(
|
|
2864
|
+
signingApprovePasswordV2(_ref70) {
|
|
2831
2865
|
let {
|
|
2832
2866
|
id
|
|
2833
|
-
} =
|
|
2867
|
+
} = _ref70;
|
|
2834
2868
|
const queued = this.#koniState.getSignRequest(id);
|
|
2835
|
-
(0, _util.assert)(queued, 'Unable to
|
|
2869
|
+
(0, _util.assert)(queued, (0, _i18next.t)('Unable to proceed. Please try again'));
|
|
2836
2870
|
const {
|
|
2837
2871
|
reject,
|
|
2838
2872
|
request,
|
|
@@ -2847,7 +2881,7 @@ class KoniExtension {
|
|
|
2847
2881
|
address
|
|
2848
2882
|
} = pair;
|
|
2849
2883
|
if (!pair) {
|
|
2850
|
-
reject(new Error('Unable to find
|
|
2884
|
+
reject(new Error((0, _i18next.t)('Unable to find account')));
|
|
2851
2885
|
return false;
|
|
2852
2886
|
}
|
|
2853
2887
|
if (pair.isLocked) {
|
|
@@ -2892,22 +2926,22 @@ class KoniExtension {
|
|
|
2892
2926
|
|
|
2893
2927
|
/// Derive account
|
|
2894
2928
|
|
|
2895
|
-
derivationCreateMultiple(
|
|
2929
|
+
derivationCreateMultiple(_ref71) {
|
|
2896
2930
|
let {
|
|
2897
2931
|
isAllowed,
|
|
2898
2932
|
items,
|
|
2899
2933
|
parentAddress
|
|
2900
|
-
} =
|
|
2934
|
+
} = _ref71;
|
|
2901
2935
|
const parentPair = _uiKeyring.keyring.getPair(parentAddress);
|
|
2902
2936
|
const isEvm = parentPair.type === 'ethereum';
|
|
2903
2937
|
if (parentPair.isLocked) {
|
|
2904
2938
|
_uiKeyring.keyring.unlockPair(parentPair.address);
|
|
2905
2939
|
}
|
|
2906
|
-
const createChild =
|
|
2940
|
+
const createChild = _ref72 => {
|
|
2907
2941
|
let {
|
|
2908
2942
|
name,
|
|
2909
2943
|
suri
|
|
2910
|
-
} =
|
|
2944
|
+
} = _ref72;
|
|
2911
2945
|
const meta = {
|
|
2912
2946
|
name: name,
|
|
2913
2947
|
parentAddress
|
|
@@ -2922,7 +2956,7 @@ class KoniExtension {
|
|
|
2922
2956
|
}
|
|
2923
2957
|
} catch (e) {}
|
|
2924
2958
|
if (!index) {
|
|
2925
|
-
throw Error('Invalid derive path');
|
|
2959
|
+
throw Error((0, _i18next.t)('Invalid derive path'));
|
|
2926
2960
|
}
|
|
2927
2961
|
meta.suri = `//${index}`;
|
|
2928
2962
|
return parentPair.deriveEvm(index, meta);
|
|
@@ -2953,10 +2987,10 @@ class KoniExtension {
|
|
|
2953
2987
|
}
|
|
2954
2988
|
return true;
|
|
2955
2989
|
}
|
|
2956
|
-
derivationCreateV3(
|
|
2990
|
+
derivationCreateV3(_ref73) {
|
|
2957
2991
|
let {
|
|
2958
2992
|
address: parentAddress
|
|
2959
|
-
} =
|
|
2993
|
+
} = _ref73;
|
|
2960
2994
|
const parentPair = _uiKeyring.keyring.getPair(parentAddress);
|
|
2961
2995
|
const isEvm = parentPair.type === 'ethereum';
|
|
2962
2996
|
if (parentPair.isLocked) {
|
|
@@ -2988,11 +3022,11 @@ class KoniExtension {
|
|
|
2988
3022
|
});
|
|
2989
3023
|
return true;
|
|
2990
3024
|
}
|
|
2991
|
-
validateDerivePath(
|
|
3025
|
+
validateDerivePath(_ref74) {
|
|
2992
3026
|
let {
|
|
2993
3027
|
parentAddress,
|
|
2994
3028
|
suri
|
|
2995
|
-
} =
|
|
3029
|
+
} = _ref74;
|
|
2996
3030
|
const parentPair = _uiKeyring.keyring.getPair(parentAddress);
|
|
2997
3031
|
const isEvm = parentPair.type === 'ethereum';
|
|
2998
3032
|
if (parentPair.isLocked) {
|
|
@@ -3012,7 +3046,7 @@ class KoniExtension {
|
|
|
3012
3046
|
}
|
|
3013
3047
|
} catch (e) {}
|
|
3014
3048
|
if (!index) {
|
|
3015
|
-
throw Error('Invalid derive path');
|
|
3049
|
+
throw Error((0, _i18next.t)('Invalid derive path'));
|
|
3016
3050
|
}
|
|
3017
3051
|
meta.suri = `//${index}`;
|
|
3018
3052
|
childPair = parentPair.deriveEvm(index, meta);
|
|
@@ -3025,12 +3059,12 @@ class KoniExtension {
|
|
|
3025
3059
|
suri: meta.suri
|
|
3026
3060
|
};
|
|
3027
3061
|
}
|
|
3028
|
-
getListDeriveAccounts(
|
|
3062
|
+
getListDeriveAccounts(_ref75) {
|
|
3029
3063
|
let {
|
|
3030
3064
|
limit,
|
|
3031
3065
|
page,
|
|
3032
3066
|
parentAddress
|
|
3033
|
-
} =
|
|
3067
|
+
} = _ref75;
|
|
3034
3068
|
const parentPair = _uiKeyring.keyring.getPair(parentAddress);
|
|
3035
3069
|
const isEvm = parentPair.type === 'ethereum';
|
|
3036
3070
|
if (parentPair.isLocked) {
|
|
@@ -3121,10 +3155,10 @@ class KoniExtension {
|
|
|
3121
3155
|
getSupportedSmartContractTypes() {
|
|
3122
3156
|
return this.#koniState.getSupportedSmartContractTypes();
|
|
3123
3157
|
}
|
|
3124
|
-
getTransaction(
|
|
3158
|
+
getTransaction(_ref76) {
|
|
3125
3159
|
let {
|
|
3126
3160
|
id
|
|
3127
|
-
} =
|
|
3161
|
+
} = _ref76;
|
|
3128
3162
|
const {
|
|
3129
3163
|
transaction,
|
|
3130
3164
|
...transactionResult
|
|
@@ -3134,8 +3168,8 @@ class KoniExtension {
|
|
|
3134
3168
|
subscribeTransactions(id, port) {
|
|
3135
3169
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
3136
3170
|
function convertRs(rs) {
|
|
3137
|
-
return Object.fromEntries(Object.entries(rs).map(
|
|
3138
|
-
let [key, value] =
|
|
3171
|
+
return Object.fromEntries(Object.entries(rs).map(_ref77 => {
|
|
3172
|
+
let [key, value] = _ref77;
|
|
3139
3173
|
const {
|
|
3140
3174
|
additionalValidator,
|
|
3141
3175
|
eventsHandler,
|
|
@@ -3167,10 +3201,10 @@ class KoniExtension {
|
|
|
3167
3201
|
});
|
|
3168
3202
|
return notificationSubject.value;
|
|
3169
3203
|
}
|
|
3170
|
-
async reloadCron(
|
|
3204
|
+
async reloadCron(_ref78) {
|
|
3171
3205
|
let {
|
|
3172
3206
|
data
|
|
3173
|
-
} =
|
|
3207
|
+
} = _ref78;
|
|
3174
3208
|
if (data === 'nft') {
|
|
3175
3209
|
return await this.#koniState.reloadNft();
|
|
3176
3210
|
} else if (data === 'staking') {
|
|
@@ -3188,20 +3222,20 @@ class KoniExtension {
|
|
|
3188
3222
|
|
|
3189
3223
|
// Phishing detect
|
|
3190
3224
|
|
|
3191
|
-
async passPhishingPage(
|
|
3225
|
+
async passPhishingPage(_ref79) {
|
|
3192
3226
|
let {
|
|
3193
3227
|
url
|
|
3194
|
-
} =
|
|
3228
|
+
} = _ref79;
|
|
3195
3229
|
return await this.#koniState.approvePassPhishingPage(url);
|
|
3196
3230
|
}
|
|
3197
3231
|
|
|
3198
3232
|
/// Wallet connect
|
|
3199
3233
|
|
|
3200
3234
|
// Connect
|
|
3201
|
-
async connectWalletConnect(
|
|
3235
|
+
async connectWalletConnect(_ref80) {
|
|
3202
3236
|
let {
|
|
3203
3237
|
uri
|
|
3204
|
-
} =
|
|
3238
|
+
} = _ref80;
|
|
3205
3239
|
await this.#koniState.walletConnectService.connect(uri);
|
|
3206
3240
|
return true;
|
|
3207
3241
|
}
|
|
@@ -3214,11 +3248,11 @@ class KoniExtension {
|
|
|
3214
3248
|
});
|
|
3215
3249
|
return this.#koniState.requestService.allConnectWCRequests;
|
|
3216
3250
|
}
|
|
3217
|
-
async approveWalletConnectSession(
|
|
3251
|
+
async approveWalletConnectSession(_ref81) {
|
|
3218
3252
|
let {
|
|
3219
3253
|
accounts: selectedAccounts,
|
|
3220
3254
|
id
|
|
3221
|
-
} =
|
|
3255
|
+
} = _ref81;
|
|
3222
3256
|
const request = this.#koniState.requestService.getConnectWCRequest(id);
|
|
3223
3257
|
if ((0, _helpers2.isProposalExpired)(request.request.params)) {
|
|
3224
3258
|
throw new Error('The proposal has been expired');
|
|
@@ -3230,8 +3264,8 @@ class KoniExtension {
|
|
|
3230
3264
|
const availableNamespaces = {};
|
|
3231
3265
|
const namespaces = {};
|
|
3232
3266
|
const chainInfoMap = this.#koniState.getChainInfoMap();
|
|
3233
|
-
Object.entries(requiredNamespaces).forEach(
|
|
3234
|
-
let [key, namespace] =
|
|
3267
|
+
Object.entries(requiredNamespaces).forEach(_ref82 => {
|
|
3268
|
+
let [key, namespace] = _ref82;
|
|
3235
3269
|
if ((0, _helpers2.isSupportWalletConnectNamespace)(key)) {
|
|
3236
3270
|
if (namespace.chains) {
|
|
3237
3271
|
const unSupportChains = namespace.chains.filter(chain => !(0, _helpers2.isSupportWalletConnectChain)(chain, chainInfoMap));
|
|
@@ -3244,8 +3278,8 @@ class KoniExtension {
|
|
|
3244
3278
|
throw new Error((0, _utils3.getSdkError)('UNSUPPORTED_NAMESPACE_KEY').message + ' ' + key);
|
|
3245
3279
|
}
|
|
3246
3280
|
});
|
|
3247
|
-
Object.entries(optionalNamespaces).forEach(
|
|
3248
|
-
let [key, namespace] =
|
|
3281
|
+
Object.entries(optionalNamespaces).forEach(_ref83 => {
|
|
3282
|
+
let [key, namespace] = _ref83;
|
|
3249
3283
|
if ((0, _helpers2.isSupportWalletConnectNamespace)(key)) {
|
|
3250
3284
|
if (namespace.chains) {
|
|
3251
3285
|
const supportChains = namespace.chains.filter(chain => (0, _helpers2.isSupportWalletConnectChain)(chain, chainInfoMap)) || [];
|
|
@@ -3269,8 +3303,8 @@ class KoniExtension {
|
|
|
3269
3303
|
}
|
|
3270
3304
|
}
|
|
3271
3305
|
});
|
|
3272
|
-
Object.entries(availableNamespaces).forEach(
|
|
3273
|
-
let [key, namespace] =
|
|
3306
|
+
Object.entries(availableNamespaces).forEach(_ref84 => {
|
|
3307
|
+
let [key, namespace] = _ref84;
|
|
3274
3308
|
if (namespace.chains) {
|
|
3275
3309
|
const accounts = [];
|
|
3276
3310
|
const chains = (0, _utils2.uniqueStringArray)(namespace.chains);
|
|
@@ -3294,10 +3328,10 @@ class KoniExtension {
|
|
|
3294
3328
|
request.resolve();
|
|
3295
3329
|
return true;
|
|
3296
3330
|
}
|
|
3297
|
-
async rejectWalletConnectSession(
|
|
3331
|
+
async rejectWalletConnectSession(_ref85) {
|
|
3298
3332
|
let {
|
|
3299
3333
|
id
|
|
3300
|
-
} =
|
|
3334
|
+
} = _ref85;
|
|
3301
3335
|
const request = this.#koniState.requestService.getConnectWCRequest(id);
|
|
3302
3336
|
const wcId = request.request.id;
|
|
3303
3337
|
if ((0, _helpers2.isProposalExpired)(request.request.params)) {
|
|
@@ -3319,10 +3353,10 @@ class KoniExtension {
|
|
|
3319
3353
|
});
|
|
3320
3354
|
return this.#koniState.walletConnectService.sessions;
|
|
3321
3355
|
}
|
|
3322
|
-
async disconnectWalletConnectSession(
|
|
3356
|
+
async disconnectWalletConnectSession(_ref86) {
|
|
3323
3357
|
let {
|
|
3324
3358
|
topic
|
|
3325
|
-
} =
|
|
3359
|
+
} = _ref86;
|
|
3326
3360
|
await this.#koniState.walletConnectService.disconnect(topic);
|
|
3327
3361
|
return true;
|
|
3328
3362
|
}
|
|
@@ -3335,18 +3369,18 @@ class KoniExtension {
|
|
|
3335
3369
|
});
|
|
3336
3370
|
return this.#koniState.requestService.allNotSupportWCRequests;
|
|
3337
3371
|
}
|
|
3338
|
-
approveWalletConnectNotSupport(
|
|
3372
|
+
approveWalletConnectNotSupport(_ref87) {
|
|
3339
3373
|
let {
|
|
3340
3374
|
id
|
|
3341
|
-
} =
|
|
3375
|
+
} = _ref87;
|
|
3342
3376
|
const request = this.#koniState.requestService.getNotSupportWCRequest(id);
|
|
3343
3377
|
request.resolve();
|
|
3344
3378
|
return true;
|
|
3345
3379
|
}
|
|
3346
|
-
rejectWalletConnectNotSupport(
|
|
3380
|
+
rejectWalletConnectNotSupport(_ref88) {
|
|
3347
3381
|
let {
|
|
3348
3382
|
id
|
|
3349
|
-
} =
|
|
3383
|
+
} = _ref88;
|
|
3350
3384
|
const request = this.#koniState.requestService.getNotSupportWCRequest(id);
|
|
3351
3385
|
request.reject(new Error('USER_REJECTED'));
|
|
3352
3386
|
return true;
|
|
@@ -3354,11 +3388,11 @@ class KoniExtension {
|
|
|
3354
3388
|
|
|
3355
3389
|
/// Manta
|
|
3356
3390
|
|
|
3357
|
-
async enableMantaPay(
|
|
3391
|
+
async enableMantaPay(_ref89) {
|
|
3358
3392
|
let {
|
|
3359
3393
|
address,
|
|
3360
3394
|
password
|
|
3361
|
-
} =
|
|
3395
|
+
} = _ref89;
|
|
3362
3396
|
// always takes the current account
|
|
3363
3397
|
function timeout() {
|
|
3364
3398
|
return new Promise(resolve => setTimeout(resolve, 1500));
|
|
@@ -3482,10 +3516,10 @@ class KoniExtension {
|
|
|
3482
3516
|
|
|
3483
3517
|
/// Metadata
|
|
3484
3518
|
|
|
3485
|
-
async findRawMetadata(
|
|
3519
|
+
async findRawMetadata(_ref90) {
|
|
3486
3520
|
let {
|
|
3487
3521
|
genesisHash
|
|
3488
|
-
} =
|
|
3522
|
+
} = _ref90;
|
|
3489
3523
|
const {
|
|
3490
3524
|
metadata,
|
|
3491
3525
|
specVersion
|
|
@@ -3607,6 +3641,8 @@ class KoniExtension {
|
|
|
3607
3641
|
return this.saveBrowserConfirmationType(request);
|
|
3608
3642
|
case 'pri(settings.saveAutoLockTime)':
|
|
3609
3643
|
return this.setAutoLockTime(request);
|
|
3644
|
+
case 'pri(settings.saveUnlockType)':
|
|
3645
|
+
return this.setUnlockType(request);
|
|
3610
3646
|
case 'pri(settings.saveEnableChainPatrol)':
|
|
3611
3647
|
return this.setEnableChainPatrol(request);
|
|
3612
3648
|
case 'pri(settings.saveShowZeroBalance)':
|