@subwallet/extension-base 1.3.36-0 → 1.3.38-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 +7 -0
- package/background/types.d.ts +2 -1
- package/cjs/core/logic-validation/request.js +62 -13
- package/cjs/koni/background/handlers/Extension.js +168 -108
- package/cjs/koni/background/handlers/State.js +18 -17
- package/cjs/koni/background/handlers/Tabs.js +38 -5
- package/cjs/packageInfo.js +1 -1
- package/cjs/page/cardano/cips/cip30.js +21 -1
- package/cjs/page/cardano/index.js +5 -5
- package/cjs/services/request-service/handler/AuthRequestHandler.js +4 -1
- package/cjs/services/request-service/handler/CardanoRequestHandler.js +4 -3
- package/cjs/services/request-service/helper/index.js +19 -17
- package/cjs/services/swap-service/handler/base-handler.js +4 -2
- package/cjs/services/swap-service/handler/uniswap-handler.js +122 -57
- package/cjs/services/swap-service/index.js +1 -1
- package/cjs/utils/cardano.js +10 -2
- package/core/logic-validation/request.d.ts +1 -0
- package/core/logic-validation/request.js +63 -15
- package/koni/background/handlers/Extension.d.ts +1 -0
- package/koni/background/handlers/Extension.js +61 -2
- package/koni/background/handlers/State.js +20 -19
- package/koni/background/handlers/Tabs.d.ts +1 -0
- package/koni/background/handlers/Tabs.js +38 -5
- package/package.json +11 -11
- package/packageInfo.js +1 -1
- package/page/cardano/cips/cip30.d.ts +31 -17
- package/page/cardano/cips/cip30.js +17 -1
- package/page/cardano/index.d.ts +20 -4
- package/page/cardano/index.js +5 -5
- package/services/chain-service/types.d.ts +1 -1
- package/services/request-service/handler/AuthRequestHandler.js +4 -1
- package/services/request-service/handler/CardanoRequestHandler.js +4 -3
- package/services/request-service/helper/index.js +19 -17
- package/services/swap-service/handler/base-handler.js +4 -2
- package/services/swap-service/handler/uniswap-handler.d.ts +1 -1
- package/services/swap-service/handler/uniswap-handler.js +99 -34
- package/services/swap-service/index.js +1 -1
- package/types/service-base.d.ts +1 -0
- package/utils/cardano.d.ts +2 -0
- package/utils/cardano.js +7 -0
|
@@ -682,6 +682,64 @@ class KoniExtension {
|
|
|
682
682
|
});
|
|
683
683
|
});
|
|
684
684
|
}
|
|
685
|
+
async switchCurrentNetworkAuthorization(_ref19) {
|
|
686
|
+
let {
|
|
687
|
+
authSwitchNetworkType,
|
|
688
|
+
networkKey,
|
|
689
|
+
url
|
|
690
|
+
} = _ref19;
|
|
691
|
+
const authUrls = await this.#koniState.getAuthList();
|
|
692
|
+
const chainInfo = this.#koniState.chainService.getChainInfoByKey(networkKey);
|
|
693
|
+
const chainState = this.#koniState.getChainStateByKey(networkKey);
|
|
694
|
+
const {
|
|
695
|
+
promise,
|
|
696
|
+
resolve
|
|
697
|
+
} = (0, _utils7.createPromiseHandler)();
|
|
698
|
+
const typeInfoMap = {
|
|
699
|
+
substrate: 'substrateInfo',
|
|
700
|
+
evm: 'evmInfo',
|
|
701
|
+
cardano: 'cardanoInfo',
|
|
702
|
+
ton: 'tonInfo'
|
|
703
|
+
};
|
|
704
|
+
const typeInfoKey = typeInfoMap[authSwitchNetworkType];
|
|
705
|
+
if (!typeInfoKey || !chainInfo[typeInfoKey]) {
|
|
706
|
+
throw new Error((0, _i18next.t)('Network {{networkKey}} is not {{authSwitchNetworkType}}', {
|
|
707
|
+
replace: {
|
|
708
|
+
networkKey,
|
|
709
|
+
authSwitchNetworkType
|
|
710
|
+
}
|
|
711
|
+
}));
|
|
712
|
+
}
|
|
713
|
+
const authUrl = authUrls[url];
|
|
714
|
+
if (!authUrl) {
|
|
715
|
+
throw new Error((0, _i18next.t)('Not found {{url}} in auth list', {
|
|
716
|
+
replace: {
|
|
717
|
+
url
|
|
718
|
+
}
|
|
719
|
+
}));
|
|
720
|
+
}
|
|
721
|
+
if (chainInfo && !(0, _utils5._isChainEnabled)(chainState)) {
|
|
722
|
+
await this.enableChainWithPriorityAssets({
|
|
723
|
+
chainSlug: networkKey,
|
|
724
|
+
enableTokens: true
|
|
725
|
+
});
|
|
726
|
+
}
|
|
727
|
+
if (!authUrl.accountAuthTypes.includes(authSwitchNetworkType)) {
|
|
728
|
+
throw new Error((0, _i18next.t)('Network {{networkKey}} is not supported by {{authSwitchNetworkType}}', {
|
|
729
|
+
replace: {
|
|
730
|
+
networkKey,
|
|
731
|
+
authSwitchNetworkType
|
|
732
|
+
}
|
|
733
|
+
}));
|
|
734
|
+
}
|
|
735
|
+
authUrl.currentNetworkMap[authSwitchNetworkType] = networkKey;
|
|
736
|
+
this.#koniState.setAuthorize(authUrls, () => {
|
|
737
|
+
resolve({
|
|
738
|
+
list: authUrls
|
|
739
|
+
});
|
|
740
|
+
});
|
|
741
|
+
return promise;
|
|
742
|
+
}
|
|
685
743
|
changeAuthorization(data, id, port) {
|
|
686
744
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
687
745
|
this._changeAuthorization(data.url, data.connectValue, items => {
|
|
@@ -778,10 +836,10 @@ class KoniExtension {
|
|
|
778
836
|
this.#koniState.updateSetting('theme', data);
|
|
779
837
|
return true;
|
|
780
838
|
}
|
|
781
|
-
setCamera(
|
|
839
|
+
setCamera(_ref20) {
|
|
782
840
|
let {
|
|
783
841
|
camera
|
|
784
|
-
} =
|
|
842
|
+
} = _ref20;
|
|
785
843
|
this.#koniState.updateSetting('camera', camera);
|
|
786
844
|
return true;
|
|
787
845
|
}
|
|
@@ -789,17 +847,17 @@ class KoniExtension {
|
|
|
789
847
|
this.#koniState.updateSetting('browserConfirmationType', data);
|
|
790
848
|
return true;
|
|
791
849
|
}
|
|
792
|
-
setAutoLockTime(
|
|
850
|
+
setAutoLockTime(_ref21) {
|
|
793
851
|
let {
|
|
794
852
|
autoLockTime
|
|
795
|
-
} =
|
|
853
|
+
} = _ref21;
|
|
796
854
|
this.#koniState.updateSetting('timeAutoLock', autoLockTime);
|
|
797
855
|
return true;
|
|
798
856
|
}
|
|
799
|
-
setUnlockType(
|
|
857
|
+
setUnlockType(_ref22) {
|
|
800
858
|
let {
|
|
801
859
|
unlockType
|
|
802
|
-
} =
|
|
860
|
+
} = _ref22;
|
|
803
861
|
this.#koniState.updateSetting('unlockType', unlockType);
|
|
804
862
|
return true;
|
|
805
863
|
}
|
|
@@ -816,10 +874,10 @@ class KoniExtension {
|
|
|
816
874
|
});
|
|
817
875
|
return await this.getSettings();
|
|
818
876
|
}
|
|
819
|
-
setEnableChainPatrol(
|
|
877
|
+
setEnableChainPatrol(_ref23) {
|
|
820
878
|
let {
|
|
821
879
|
enable
|
|
822
|
-
} =
|
|
880
|
+
} = _ref23;
|
|
823
881
|
this.#koniState.updateSetting('enableChainPatrol', enable);
|
|
824
882
|
return true;
|
|
825
883
|
}
|
|
@@ -827,17 +885,17 @@ class KoniExtension {
|
|
|
827
885
|
this.#koniState.updateSetting('notificationSetup', request);
|
|
828
886
|
return true;
|
|
829
887
|
}
|
|
830
|
-
saveMigrationAcknowledgedStatus(
|
|
888
|
+
saveMigrationAcknowledgedStatus(_ref24) {
|
|
831
889
|
let {
|
|
832
890
|
isAcknowledgedUnifiedAccountMigration
|
|
833
|
-
} =
|
|
891
|
+
} = _ref24;
|
|
834
892
|
this.#koniState.updateSetting('isAcknowledgedUnifiedAccountMigration', isAcknowledgedUnifiedAccountMigration);
|
|
835
893
|
return true;
|
|
836
894
|
}
|
|
837
|
-
saveUnifiedAccountMigrationInProgress(
|
|
895
|
+
saveUnifiedAccountMigrationInProgress(_ref25) {
|
|
838
896
|
let {
|
|
839
897
|
isUnifiedAccountMigrationInProgress
|
|
840
|
-
} =
|
|
898
|
+
} = _ref25;
|
|
841
899
|
this.#koniState.updateSetting('isUnifiedAccountMigrationInProgress', isUnifiedAccountMigrationInProgress);
|
|
842
900
|
return true;
|
|
843
901
|
}
|
|
@@ -845,31 +903,31 @@ class KoniExtension {
|
|
|
845
903
|
this.#koniState.updateSetting('isUnifiedAccountMigrationInProgress', false);
|
|
846
904
|
return true;
|
|
847
905
|
}
|
|
848
|
-
setShowZeroBalance(
|
|
906
|
+
setShowZeroBalance(_ref26) {
|
|
849
907
|
let {
|
|
850
908
|
show
|
|
851
|
-
} =
|
|
909
|
+
} = _ref26;
|
|
852
910
|
this.#koniState.updateSetting('isShowZeroBalance', show);
|
|
853
911
|
return true;
|
|
854
912
|
}
|
|
855
|
-
setLanguage(
|
|
913
|
+
setLanguage(_ref27) {
|
|
856
914
|
let {
|
|
857
915
|
language
|
|
858
|
-
} =
|
|
916
|
+
} = _ref27;
|
|
859
917
|
this.#koniState.updateSetting('language', language);
|
|
860
918
|
return true;
|
|
861
919
|
}
|
|
862
|
-
setShowBalance(
|
|
920
|
+
setShowBalance(_ref28) {
|
|
863
921
|
let {
|
|
864
922
|
enable
|
|
865
|
-
} =
|
|
923
|
+
} = _ref28;
|
|
866
924
|
this.#koniState.updateSetting('isShowBalance', enable);
|
|
867
925
|
return true;
|
|
868
926
|
}
|
|
869
|
-
setAllowOneSign(
|
|
927
|
+
setAllowOneSign(_ref29) {
|
|
870
928
|
let {
|
|
871
929
|
allowOneSign
|
|
872
|
-
} =
|
|
930
|
+
} = _ref29;
|
|
873
931
|
this.#koniState.updateSetting('allowOneSign', allowOneSign);
|
|
874
932
|
return true;
|
|
875
933
|
}
|
|
@@ -918,11 +976,11 @@ class KoniExtension {
|
|
|
918
976
|
async getPrice() {
|
|
919
977
|
return this.#koniState.priceService.getPrice();
|
|
920
978
|
}
|
|
921
|
-
async getHistoryTokenPrice(
|
|
979
|
+
async getHistoryTokenPrice(_ref30) {
|
|
922
980
|
let {
|
|
923
981
|
priceId,
|
|
924
982
|
timeframe
|
|
925
|
-
} =
|
|
983
|
+
} = _ref30;
|
|
926
984
|
return this.#koniState.priceService.getHistoryTokenPriceData(priceId, timeframe);
|
|
927
985
|
}
|
|
928
986
|
checkCoinGeckoPriceSupport(priceId) {
|
|
@@ -943,10 +1001,10 @@ class KoniExtension {
|
|
|
943
1001
|
price: currentPrice
|
|
944
1002
|
};
|
|
945
1003
|
}
|
|
946
|
-
async setPriceCurrency(
|
|
1004
|
+
async setPriceCurrency(_ref31) {
|
|
947
1005
|
let {
|
|
948
1006
|
currency
|
|
949
|
-
} =
|
|
1007
|
+
} = _ref31;
|
|
950
1008
|
return await this.#koniState.priceService.setPriceCurrency(currency);
|
|
951
1009
|
}
|
|
952
1010
|
subscribePrice(id, port) {
|
|
@@ -1154,11 +1212,11 @@ class KoniExtension {
|
|
|
1154
1212
|
// Re-filter
|
|
1155
1213
|
return historySubject.getValue().filter(item => addresses.some(address => (0, _utils7.isSameAddress)(item.address, address)));
|
|
1156
1214
|
}
|
|
1157
|
-
subscribeHistoryByChainAndAddress(
|
|
1215
|
+
subscribeHistoryByChainAndAddress(_ref32, id, port) {
|
|
1158
1216
|
let {
|
|
1159
1217
|
address,
|
|
1160
1218
|
chain
|
|
1161
|
-
} =
|
|
1219
|
+
} = _ref32;
|
|
1162
1220
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
1163
1221
|
const subscribeHistoriesResponse = this.#koniState.historyService.subscribeHistories(chain, address, cb);
|
|
1164
1222
|
this.createUnsubscriptionHandle(id, subscribeHistoriesResponse.unsubscribe);
|
|
@@ -1726,28 +1784,28 @@ class KoniExtension {
|
|
|
1726
1784
|
disableChain(networkKey) {
|
|
1727
1785
|
return this.#koniState.disableChain(networkKey);
|
|
1728
1786
|
}
|
|
1729
|
-
async enableChain(
|
|
1787
|
+
async enableChain(_ref33) {
|
|
1730
1788
|
let {
|
|
1731
1789
|
chainSlug,
|
|
1732
1790
|
enableTokens
|
|
1733
|
-
} =
|
|
1791
|
+
} = _ref33;
|
|
1734
1792
|
return await this.#koniState.enableChain(chainSlug, enableTokens);
|
|
1735
1793
|
}
|
|
1736
|
-
async enableChainWithPriorityAssets(
|
|
1794
|
+
async enableChainWithPriorityAssets(_ref34) {
|
|
1737
1795
|
let {
|
|
1738
1796
|
chainSlug,
|
|
1739
1797
|
enableTokens
|
|
1740
|
-
} =
|
|
1798
|
+
} = _ref34;
|
|
1741
1799
|
return await this.#koniState.enableChainWithPriorityAssets(chainSlug, enableTokens);
|
|
1742
1800
|
}
|
|
1743
1801
|
async reconnectChain(chainSlug) {
|
|
1744
1802
|
return this.#koniState.chainService.reconnectChain(chainSlug);
|
|
1745
1803
|
}
|
|
1746
|
-
async validateNetwork(
|
|
1804
|
+
async validateNetwork(_ref35) {
|
|
1747
1805
|
let {
|
|
1748
1806
|
existedChainSlug,
|
|
1749
1807
|
provider
|
|
1750
|
-
} =
|
|
1808
|
+
} = _ref35;
|
|
1751
1809
|
return await this.#koniState.validateCustomChain(provider, existedChainSlug);
|
|
1752
1810
|
}
|
|
1753
1811
|
resetDefaultNetwork() {
|
|
@@ -1819,13 +1877,13 @@ class KoniExtension {
|
|
|
1819
1877
|
async validateCustomAsset(data) {
|
|
1820
1878
|
return await this.#koniState.validateCustomAsset(data);
|
|
1821
1879
|
}
|
|
1822
|
-
async getAddressTransferableBalance(
|
|
1880
|
+
async getAddressTransferableBalance(_ref36) {
|
|
1823
1881
|
let {
|
|
1824
1882
|
address,
|
|
1825
1883
|
extrinsicType,
|
|
1826
1884
|
networkKey,
|
|
1827
1885
|
token
|
|
1828
|
-
} =
|
|
1886
|
+
} = _ref36;
|
|
1829
1887
|
if (token && _constants2._MANTA_ZK_CHAIN_GROUP.includes(networkKey)) {
|
|
1830
1888
|
const tokenInfo = this.#koniState.chainService.getAssetBySlug(token);
|
|
1831
1889
|
if (tokenInfo.symbol.startsWith(_constants2._ZK_ASSET_PREFIX)) {
|
|
@@ -1834,13 +1892,13 @@ class KoniExtension {
|
|
|
1834
1892
|
}
|
|
1835
1893
|
return await this.#koniState.balanceService.getTransferableBalance(address, networkKey, token, extrinsicType);
|
|
1836
1894
|
}
|
|
1837
|
-
async getAddressTotalBalance(
|
|
1895
|
+
async getAddressTotalBalance(_ref37) {
|
|
1838
1896
|
let {
|
|
1839
1897
|
address,
|
|
1840
1898
|
extrinsicType,
|
|
1841
1899
|
networkKey,
|
|
1842
1900
|
token
|
|
1843
|
-
} =
|
|
1901
|
+
} = _ref37;
|
|
1844
1902
|
return await this.#koniState.balanceService.getTotalBalance(address, networkKey, token, extrinsicType);
|
|
1845
1903
|
}
|
|
1846
1904
|
async subscribeMaxTransferable(request, id, port) {
|
|
@@ -1892,11 +1950,11 @@ class KoniExtension {
|
|
|
1892
1950
|
freeBalance: freeBalanceSubject,
|
|
1893
1951
|
fee: feeSubject
|
|
1894
1952
|
}).subscribe({
|
|
1895
|
-
next:
|
|
1953
|
+
next: _ref38 => {
|
|
1896
1954
|
let {
|
|
1897
1955
|
fee,
|
|
1898
1956
|
freeBalance
|
|
1899
|
-
} =
|
|
1957
|
+
} = _ref38;
|
|
1900
1958
|
(0, _utils7.calculateMaxTransferable)(id, _request, freeBalance, fee).then(cb).catch(console.error);
|
|
1901
1959
|
}
|
|
1902
1960
|
});
|
|
@@ -1930,13 +1988,13 @@ class KoniExtension {
|
|
|
1930
1988
|
});
|
|
1931
1989
|
return (0, _utils7.calculateMaxTransferable)(id, _request, freeBalance, fee);
|
|
1932
1990
|
}
|
|
1933
|
-
async subscribeAddressTransferableBalance(
|
|
1991
|
+
async subscribeAddressTransferableBalance(_ref39, id, port) {
|
|
1934
1992
|
let {
|
|
1935
1993
|
address,
|
|
1936
1994
|
extrinsicType,
|
|
1937
1995
|
networkKey,
|
|
1938
1996
|
token
|
|
1939
|
-
} =
|
|
1997
|
+
} = _ref39;
|
|
1940
1998
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
1941
1999
|
const convertData = data => {
|
|
1942
2000
|
return {
|
|
@@ -1987,11 +2045,11 @@ class KoniExtension {
|
|
|
1987
2045
|
isSendingSelf
|
|
1988
2046
|
};
|
|
1989
2047
|
}
|
|
1990
|
-
async enableChains(
|
|
2048
|
+
async enableChains(_ref40) {
|
|
1991
2049
|
let {
|
|
1992
2050
|
chainSlugs,
|
|
1993
2051
|
enableTokens
|
|
1994
|
-
} =
|
|
2052
|
+
} = _ref40;
|
|
1995
2053
|
try {
|
|
1996
2054
|
await Promise.all(chainSlugs.map(chainSlug => this.enableChain({
|
|
1997
2055
|
chainSlug,
|
|
@@ -2124,30 +2182,30 @@ class KoniExtension {
|
|
|
2124
2182
|
|
|
2125
2183
|
// Parse transaction
|
|
2126
2184
|
|
|
2127
|
-
parseSubstrateTransaction(
|
|
2185
|
+
parseSubstrateTransaction(_ref41) {
|
|
2128
2186
|
let {
|
|
2129
2187
|
data,
|
|
2130
2188
|
networkKey
|
|
2131
|
-
} =
|
|
2189
|
+
} = _ref41;
|
|
2132
2190
|
const apiProps = this.#koniState.getSubstrateApi(networkKey);
|
|
2133
2191
|
const apiPromise = apiProps.api;
|
|
2134
2192
|
return (0, _parseTransaction.parseSubstrateTransaction)(data, apiPromise);
|
|
2135
2193
|
}
|
|
2136
|
-
async parseEVMRLP(
|
|
2194
|
+
async parseEVMRLP(_ref42) {
|
|
2137
2195
|
let {
|
|
2138
2196
|
data
|
|
2139
|
-
} =
|
|
2197
|
+
} = _ref42;
|
|
2140
2198
|
return await (0, _parseTransaction2.parseEvmRlp)(data, this.#koniState.getChainInfoMap(), this.#koniState.getEvmApiMap());
|
|
2141
2199
|
}
|
|
2142
2200
|
|
|
2143
2201
|
// Sign
|
|
2144
2202
|
|
|
2145
|
-
qrSignSubstrate(
|
|
2203
|
+
qrSignSubstrate(_ref43) {
|
|
2146
2204
|
let {
|
|
2147
2205
|
address,
|
|
2148
2206
|
data,
|
|
2149
2207
|
networkKey
|
|
2150
|
-
} =
|
|
2208
|
+
} = _ref43;
|
|
2151
2209
|
const pair = _uiKeyring.keyring.getPair(address);
|
|
2152
2210
|
(0, _util.assert)(pair, (0, _i18next.t)('Unable to find account'));
|
|
2153
2211
|
if (pair.isLocked) {
|
|
@@ -2164,13 +2222,13 @@ class KoniExtension {
|
|
|
2164
2222
|
signature: signed
|
|
2165
2223
|
};
|
|
2166
2224
|
}
|
|
2167
|
-
async qrSignEVM(
|
|
2225
|
+
async qrSignEVM(_ref44) {
|
|
2168
2226
|
let {
|
|
2169
2227
|
address,
|
|
2170
2228
|
chainId,
|
|
2171
2229
|
message,
|
|
2172
2230
|
type
|
|
2173
|
-
} =
|
|
2231
|
+
} = _ref44;
|
|
2174
2232
|
let signed;
|
|
2175
2233
|
const network = this.getNetworkJsonByChainId(chainId);
|
|
2176
2234
|
if (!network) {
|
|
@@ -2254,11 +2312,11 @@ class KoniExtension {
|
|
|
2254
2312
|
});
|
|
2255
2313
|
return this.#koniState.getNominatorMetadata();
|
|
2256
2314
|
}
|
|
2257
|
-
async getBondingOptions(
|
|
2315
|
+
async getBondingOptions(_ref45) {
|
|
2258
2316
|
let {
|
|
2259
2317
|
chain,
|
|
2260
2318
|
type
|
|
2261
|
-
} =
|
|
2319
|
+
} = _ref45;
|
|
2262
2320
|
const apiProps = this.#koniState.getSubstrateApi(chain);
|
|
2263
2321
|
const chainInfo = this.#koniState.getChainInfo(chain);
|
|
2264
2322
|
const chainStakingMetadata = await this.#koniState.getStakingMetadataByChain(chain, type);
|
|
@@ -2448,12 +2506,12 @@ class KoniExtension {
|
|
|
2448
2506
|
}
|
|
2449
2507
|
|
|
2450
2508
|
// EVM Transaction
|
|
2451
|
-
async parseContractInput(
|
|
2509
|
+
async parseContractInput(_ref46) {
|
|
2452
2510
|
let {
|
|
2453
2511
|
chainId,
|
|
2454
2512
|
contract,
|
|
2455
2513
|
data
|
|
2456
|
-
} =
|
|
2514
|
+
} = _ref46;
|
|
2457
2515
|
const network = this.getNetworkJsonByChainId(chainId);
|
|
2458
2516
|
return await (0, _parseTransaction2.parseContractInput)(data, contract, network);
|
|
2459
2517
|
}
|
|
@@ -2553,10 +2611,10 @@ class KoniExtension {
|
|
|
2553
2611
|
|
|
2554
2612
|
// Unlock wallet
|
|
2555
2613
|
|
|
2556
|
-
keyringUnlock(
|
|
2614
|
+
keyringUnlock(_ref47) {
|
|
2557
2615
|
let {
|
|
2558
2616
|
password
|
|
2559
|
-
} =
|
|
2617
|
+
} = _ref47;
|
|
2560
2618
|
try {
|
|
2561
2619
|
_uiKeyring.keyring.unlockKeyring(password);
|
|
2562
2620
|
// this.#koniState.initMantaPay(password)
|
|
@@ -2587,11 +2645,11 @@ class KoniExtension {
|
|
|
2587
2645
|
|
|
2588
2646
|
// Export mnemonic
|
|
2589
2647
|
|
|
2590
|
-
keyringExportMnemonic(
|
|
2648
|
+
keyringExportMnemonic(_ref48) {
|
|
2591
2649
|
let {
|
|
2592
2650
|
address,
|
|
2593
2651
|
password
|
|
2594
|
-
} =
|
|
2652
|
+
} = _ref48;
|
|
2595
2653
|
const pair = _uiKeyring.keyring.getPair(address);
|
|
2596
2654
|
const result = pair.exportMnemonic(password);
|
|
2597
2655
|
return {
|
|
@@ -2601,10 +2659,10 @@ class KoniExtension {
|
|
|
2601
2659
|
|
|
2602
2660
|
// Reset wallet
|
|
2603
2661
|
|
|
2604
|
-
async resetWallet(
|
|
2662
|
+
async resetWallet(_ref49) {
|
|
2605
2663
|
let {
|
|
2606
2664
|
resetAll
|
|
2607
|
-
} =
|
|
2665
|
+
} = _ref49;
|
|
2608
2666
|
try {
|
|
2609
2667
|
await this.#koniState.resetWallet(resetAll);
|
|
2610
2668
|
return {
|
|
@@ -2620,10 +2678,10 @@ class KoniExtension {
|
|
|
2620
2678
|
}
|
|
2621
2679
|
|
|
2622
2680
|
// Signing substrate request
|
|
2623
|
-
async signingApprovePasswordV2(
|
|
2681
|
+
async signingApprovePasswordV2(_ref50) {
|
|
2624
2682
|
let {
|
|
2625
2683
|
id
|
|
2626
|
-
} =
|
|
2684
|
+
} = _ref50;
|
|
2627
2685
|
const queued = this.#koniState.getSignRequest(id);
|
|
2628
2686
|
(0, _util.assert)(queued, (0, _i18next.t)('Unable to proceed. Please try again'));
|
|
2629
2687
|
const {
|
|
@@ -2782,10 +2840,10 @@ class KoniExtension {
|
|
|
2782
2840
|
getSupportedSmartContractTypes() {
|
|
2783
2841
|
return this.#koniState.getSupportedSmartContractTypes();
|
|
2784
2842
|
}
|
|
2785
|
-
getTransaction(
|
|
2843
|
+
getTransaction(_ref51) {
|
|
2786
2844
|
let {
|
|
2787
2845
|
id
|
|
2788
|
-
} =
|
|
2846
|
+
} = _ref51;
|
|
2789
2847
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
2790
2848
|
const {
|
|
2791
2849
|
transaction,
|
|
@@ -2796,8 +2854,8 @@ class KoniExtension {
|
|
|
2796
2854
|
async subscribeTransactions(id, port) {
|
|
2797
2855
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
2798
2856
|
function convertRs(rs, processMap) {
|
|
2799
|
-
return Object.fromEntries(Object.entries(rs).map(
|
|
2800
|
-
let [key, value] =
|
|
2857
|
+
return Object.fromEntries(Object.entries(rs).map(_ref52 => {
|
|
2858
|
+
let [key, value] = _ref52;
|
|
2801
2859
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
2802
2860
|
const {
|
|
2803
2861
|
additionalValidator,
|
|
@@ -2822,11 +2880,11 @@ class KoniExtension {
|
|
|
2822
2880
|
const subscription = (0, _rxjs.combineLatest)({
|
|
2823
2881
|
transactions: transactionsObservable,
|
|
2824
2882
|
processMap: processTransactionObservable
|
|
2825
|
-
}).subscribe(
|
|
2883
|
+
}).subscribe(_ref53 => {
|
|
2826
2884
|
let {
|
|
2827
2885
|
processMap,
|
|
2828
2886
|
transactions
|
|
2829
|
-
} =
|
|
2887
|
+
} = _ref53;
|
|
2830
2888
|
cb(convertRs(transactions, processMap));
|
|
2831
2889
|
});
|
|
2832
2890
|
port.onDisconnect.addListener(() => {
|
|
@@ -2847,10 +2905,10 @@ class KoniExtension {
|
|
|
2847
2905
|
});
|
|
2848
2906
|
return notificationSubject.value;
|
|
2849
2907
|
}
|
|
2850
|
-
async reloadCron(
|
|
2908
|
+
async reloadCron(_ref54) {
|
|
2851
2909
|
let {
|
|
2852
2910
|
data
|
|
2853
|
-
} =
|
|
2911
|
+
} = _ref54;
|
|
2854
2912
|
if (data === 'nft') {
|
|
2855
2913
|
return await this.#koniState.reloadNft();
|
|
2856
2914
|
} else if (data === 'staking') {
|
|
@@ -2893,10 +2951,10 @@ class KoniExtension {
|
|
|
2893
2951
|
}
|
|
2894
2952
|
|
|
2895
2953
|
// Phishing detect
|
|
2896
|
-
async passPhishingPage(
|
|
2954
|
+
async passPhishingPage(_ref55) {
|
|
2897
2955
|
let {
|
|
2898
2956
|
url
|
|
2899
|
-
} =
|
|
2957
|
+
} = _ref55;
|
|
2900
2958
|
return await this.#koniState.approvePassPhishingPage(url);
|
|
2901
2959
|
}
|
|
2902
2960
|
|
|
@@ -2917,10 +2975,10 @@ class KoniExtension {
|
|
|
2917
2975
|
/// Wallet connect
|
|
2918
2976
|
|
|
2919
2977
|
// Connect
|
|
2920
|
-
async connectWalletConnect(
|
|
2978
|
+
async connectWalletConnect(_ref56) {
|
|
2921
2979
|
let {
|
|
2922
2980
|
uri
|
|
2923
|
-
} =
|
|
2981
|
+
} = _ref56;
|
|
2924
2982
|
await this.#koniState.walletConnectService.connect(uri);
|
|
2925
2983
|
return true;
|
|
2926
2984
|
}
|
|
@@ -2933,11 +2991,11 @@ class KoniExtension {
|
|
|
2933
2991
|
});
|
|
2934
2992
|
return this.#koniState.requestService.allConnectWCRequests;
|
|
2935
2993
|
}
|
|
2936
|
-
async approveWalletConnectSession(
|
|
2994
|
+
async approveWalletConnectSession(_ref57) {
|
|
2937
2995
|
let {
|
|
2938
2996
|
accounts: selectedAccounts,
|
|
2939
2997
|
id
|
|
2940
|
-
} =
|
|
2998
|
+
} = _ref57;
|
|
2941
2999
|
const request = this.#koniState.requestService.getConnectWCRequest(id);
|
|
2942
3000
|
if ((0, _helpers2.isProposalExpired)(request.request.params)) {
|
|
2943
3001
|
throw new Error('The proposal has been expired');
|
|
@@ -2949,8 +3007,8 @@ class KoniExtension {
|
|
|
2949
3007
|
const availableNamespaces = {};
|
|
2950
3008
|
const namespaces = {};
|
|
2951
3009
|
const chainInfoMap = this.#koniState.getChainInfoMap();
|
|
2952
|
-
Object.entries(requiredNamespaces).forEach(
|
|
2953
|
-
let [key, namespace] =
|
|
3010
|
+
Object.entries(requiredNamespaces).forEach(_ref58 => {
|
|
3011
|
+
let [key, namespace] = _ref58;
|
|
2954
3012
|
if ((0, _helpers2.isSupportWalletConnectNamespace)(key)) {
|
|
2955
3013
|
if (namespace.chains) {
|
|
2956
3014
|
const unSupportChains = namespace.chains.filter(chain => !(0, _helpers2.isSupportWalletConnectChain)(chain, chainInfoMap));
|
|
@@ -2963,8 +3021,8 @@ class KoniExtension {
|
|
|
2963
3021
|
throw new Error((0, _utils8.getSdkError)('UNSUPPORTED_NAMESPACE_KEY').message + ' ' + key);
|
|
2964
3022
|
}
|
|
2965
3023
|
});
|
|
2966
|
-
Object.entries(optionalNamespaces).forEach(
|
|
2967
|
-
let [key, namespace] =
|
|
3024
|
+
Object.entries(optionalNamespaces).forEach(_ref59 => {
|
|
3025
|
+
let [key, namespace] = _ref59;
|
|
2968
3026
|
if ((0, _helpers2.isSupportWalletConnectNamespace)(key)) {
|
|
2969
3027
|
if (namespace.chains) {
|
|
2970
3028
|
const supportChains = namespace.chains.filter(chain => (0, _helpers2.isSupportWalletConnectChain)(chain, chainInfoMap)) || [];
|
|
@@ -2988,8 +3046,8 @@ class KoniExtension {
|
|
|
2988
3046
|
}
|
|
2989
3047
|
}
|
|
2990
3048
|
});
|
|
2991
|
-
Object.entries(availableNamespaces).forEach(
|
|
2992
|
-
let [key, namespace] =
|
|
3049
|
+
Object.entries(availableNamespaces).forEach(_ref60 => {
|
|
3050
|
+
let [key, namespace] = _ref60;
|
|
2993
3051
|
if (namespace.chains) {
|
|
2994
3052
|
const accounts = selectedAccounts.filter(address => {
|
|
2995
3053
|
const [_namespace] = address.split(':');
|
|
@@ -3013,10 +3071,10 @@ class KoniExtension {
|
|
|
3013
3071
|
request.resolve();
|
|
3014
3072
|
return true;
|
|
3015
3073
|
}
|
|
3016
|
-
async rejectWalletConnectSession(
|
|
3074
|
+
async rejectWalletConnectSession(_ref61) {
|
|
3017
3075
|
let {
|
|
3018
3076
|
id
|
|
3019
|
-
} =
|
|
3077
|
+
} = _ref61;
|
|
3020
3078
|
const request = this.#koniState.requestService.getConnectWCRequest(id);
|
|
3021
3079
|
const wcId = request.request.id;
|
|
3022
3080
|
if ((0, _helpers2.isProposalExpired)(request.request.params)) {
|
|
@@ -3038,10 +3096,10 @@ class KoniExtension {
|
|
|
3038
3096
|
});
|
|
3039
3097
|
return this.#koniState.walletConnectService.sessions;
|
|
3040
3098
|
}
|
|
3041
|
-
async disconnectWalletConnectSession(
|
|
3099
|
+
async disconnectWalletConnectSession(_ref62) {
|
|
3042
3100
|
let {
|
|
3043
3101
|
topic
|
|
3044
|
-
} =
|
|
3102
|
+
} = _ref62;
|
|
3045
3103
|
await this.#koniState.walletConnectService.disconnect(topic);
|
|
3046
3104
|
return true;
|
|
3047
3105
|
}
|
|
@@ -3054,18 +3112,18 @@ class KoniExtension {
|
|
|
3054
3112
|
});
|
|
3055
3113
|
return this.#koniState.requestService.allNotSupportWCRequests;
|
|
3056
3114
|
}
|
|
3057
|
-
approveWalletConnectNotSupport(
|
|
3115
|
+
approveWalletConnectNotSupport(_ref63) {
|
|
3058
3116
|
let {
|
|
3059
3117
|
id
|
|
3060
|
-
} =
|
|
3118
|
+
} = _ref63;
|
|
3061
3119
|
const request = this.#koniState.requestService.getNotSupportWCRequest(id);
|
|
3062
3120
|
request.resolve();
|
|
3063
3121
|
return true;
|
|
3064
3122
|
}
|
|
3065
|
-
rejectWalletConnectNotSupport(
|
|
3123
|
+
rejectWalletConnectNotSupport(_ref64) {
|
|
3066
3124
|
let {
|
|
3067
3125
|
id
|
|
3068
|
-
} =
|
|
3126
|
+
} = _ref64;
|
|
3069
3127
|
const request = this.#koniState.requestService.getNotSupportWCRequest(id);
|
|
3070
3128
|
request.reject(new Error('USER_REJECTED'));
|
|
3071
3129
|
return true;
|
|
@@ -3073,11 +3131,11 @@ class KoniExtension {
|
|
|
3073
3131
|
|
|
3074
3132
|
/// Manta
|
|
3075
3133
|
|
|
3076
|
-
async enableMantaPay(
|
|
3134
|
+
async enableMantaPay(_ref65) {
|
|
3077
3135
|
let {
|
|
3078
3136
|
address,
|
|
3079
3137
|
password
|
|
3080
|
-
} =
|
|
3138
|
+
} = _ref65;
|
|
3081
3139
|
// always takes the current account
|
|
3082
3140
|
function timeout() {
|
|
3083
3141
|
return new Promise(resolve => setTimeout(resolve, 1500));
|
|
@@ -3167,11 +3225,11 @@ class KoniExtension {
|
|
|
3167
3225
|
async disableMantaPay(address) {
|
|
3168
3226
|
return this.#koniState.disableMantaPay(address);
|
|
3169
3227
|
}
|
|
3170
|
-
async isTonBounceableAddress(
|
|
3228
|
+
async isTonBounceableAddress(_ref66) {
|
|
3171
3229
|
let {
|
|
3172
3230
|
address,
|
|
3173
3231
|
chain
|
|
3174
|
-
} =
|
|
3232
|
+
} = _ref66;
|
|
3175
3233
|
try {
|
|
3176
3234
|
const tonApi = this.#koniState.getTonApi(chain);
|
|
3177
3235
|
const state = await tonApi.getAccountState(address);
|
|
@@ -3217,10 +3275,10 @@ class KoniExtension {
|
|
|
3217
3275
|
|
|
3218
3276
|
/* Metadata */
|
|
3219
3277
|
|
|
3220
|
-
async findRawMetadata(
|
|
3278
|
+
async findRawMetadata(_ref67) {
|
|
3221
3279
|
let {
|
|
3222
3280
|
genesisHash
|
|
3223
|
-
} =
|
|
3281
|
+
} = _ref67;
|
|
3224
3282
|
const {
|
|
3225
3283
|
metadata,
|
|
3226
3284
|
specVersion,
|
|
@@ -3234,20 +3292,20 @@ class KoniExtension {
|
|
|
3234
3292
|
userExtensions
|
|
3235
3293
|
};
|
|
3236
3294
|
}
|
|
3237
|
-
async calculateMetadataHash(
|
|
3295
|
+
async calculateMetadataHash(_ref68) {
|
|
3238
3296
|
let {
|
|
3239
3297
|
chain
|
|
3240
|
-
} =
|
|
3298
|
+
} = _ref68;
|
|
3241
3299
|
const hash = await this.#koniState.calculateMetadataHash(chain);
|
|
3242
3300
|
return {
|
|
3243
3301
|
metadataHash: hash || ''
|
|
3244
3302
|
};
|
|
3245
3303
|
}
|
|
3246
|
-
async shortenMetadata(
|
|
3304
|
+
async shortenMetadata(_ref69) {
|
|
3247
3305
|
let {
|
|
3248
3306
|
chain,
|
|
3249
3307
|
txBlob
|
|
3250
|
-
} =
|
|
3308
|
+
} = _ref69;
|
|
3251
3309
|
const shorten = await this.#koniState.shortenMetadata(chain, txBlob);
|
|
3252
3310
|
return {
|
|
3253
3311
|
txMetadata: shorten || ''
|
|
@@ -3600,18 +3658,18 @@ class KoniExtension {
|
|
|
3600
3658
|
|
|
3601
3659
|
/* Campaign */
|
|
3602
3660
|
|
|
3603
|
-
unlockDotCheckCanMint(
|
|
3661
|
+
unlockDotCheckCanMint(_ref70) {
|
|
3604
3662
|
let {
|
|
3605
3663
|
address,
|
|
3606
3664
|
network,
|
|
3607
3665
|
slug
|
|
3608
|
-
} =
|
|
3666
|
+
} = _ref70;
|
|
3609
3667
|
return this.#koniState.mintCampaignService.unlockDotCampaign.canMint(address, slug, network);
|
|
3610
3668
|
}
|
|
3611
|
-
unlockDotSubscribeMintedData(id, port,
|
|
3669
|
+
unlockDotSubscribeMintedData(id, port, _ref71) {
|
|
3612
3670
|
let {
|
|
3613
3671
|
transactionId
|
|
3614
|
-
} =
|
|
3672
|
+
} = _ref71;
|
|
3615
3673
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
3616
3674
|
const subscription = this.#koniState.mintCampaignService.unlockDotCampaign.subscribeMintedNft(transactionId, cb);
|
|
3617
3675
|
this.createUnsubscriptionHandle(id, subscription.unsubscribe);
|
|
@@ -3643,10 +3701,10 @@ class KoniExtension {
|
|
|
3643
3701
|
});
|
|
3644
3702
|
return filterBanner(await this.#koniState.campaignService.getProcessingCampaign());
|
|
3645
3703
|
}
|
|
3646
|
-
async completeCampaignBanner(
|
|
3704
|
+
async completeCampaignBanner(_ref72) {
|
|
3647
3705
|
let {
|
|
3648
3706
|
slug
|
|
3649
|
-
} =
|
|
3707
|
+
} = _ref72;
|
|
3650
3708
|
const campaign = await this.#koniState.dbService.getCampaign(slug);
|
|
3651
3709
|
if (campaign) {
|
|
3652
3710
|
await this.#koniState.dbService.upsertCampaign({
|
|
@@ -4181,8 +4239,8 @@ class KoniExtension {
|
|
|
4181
4239
|
resolve();
|
|
4182
4240
|
}
|
|
4183
4241
|
};
|
|
4184
|
-
this.#koniState.balanceService.subscribeTransferableBalance(address, waitXcmData.chain, waitXcmData.token, waitXcmData.nextTxType, onRs).then(
|
|
4185
|
-
let [_unsub, rs] =
|
|
4242
|
+
this.#koniState.balanceService.subscribeTransferableBalance(address, waitXcmData.chain, waitXcmData.token, waitXcmData.nextTxType, onRs).then(_ref73 => {
|
|
4243
|
+
let [_unsub, rs] = _ref73;
|
|
4186
4244
|
unsub = _unsub;
|
|
4187
4245
|
onRs(rs);
|
|
4188
4246
|
}).catch(console.error);
|
|
@@ -4344,6 +4402,8 @@ class KoniExtension {
|
|
|
4344
4402
|
return this.getAuthListV2();
|
|
4345
4403
|
case 'pri(authorize.toggle)':
|
|
4346
4404
|
return this.toggleAuthorization2(request);
|
|
4405
|
+
case 'pri(authorize.switchCurrentNetwork)':
|
|
4406
|
+
return this.switchCurrentNetworkAuthorization(request);
|
|
4347
4407
|
case 'pri(settings.changeBalancesVisibility)':
|
|
4348
4408
|
return await this.toggleBalancesVisibility();
|
|
4349
4409
|
|