@subwallet/extension-base 1.0.13-1 → 1.1.1-dev.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/bundle-polkadot-extension-base.js +20 -0
- package/cjs/koni/api/staking/bonding/astar.js +2 -2
- package/cjs/koni/api/staking/bonding/relayChain.js +12 -2
- package/cjs/koni/api/staking/bonding/utils.js +2 -2
- package/cjs/koni/background/cron.js +2 -37
- package/cjs/koni/background/handlers/State.js +2 -1
- package/cjs/koni/background/subscription.js +6 -86
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/chain-service/helper/erc20_abi.json +224 -0
- package/cjs/services/chain-service/helper/erc721_abi.json +384 -0
- package/cjs/services/chain-service/helper/psp22_abi.json +1127 -0
- package/cjs/services/chain-service/helper/psp34_abi.json +3144 -0
- package/cjs/services/chain-service/helper/test_erc721_abi.json +393 -0
- package/koni/api/staking/bonding/astar.d.ts +1 -1
- package/koni/api/staking/bonding/astar.js +1 -1
- package/koni/api/staking/bonding/relayChain.js +12 -2
- package/koni/api/staking/bonding/utils.js +3 -3
- package/koni/background/cron.d.ts +0 -5
- package/koni/background/cron.js +4 -39
- package/koni/background/handlers/State.js +2 -1
- package/koni/background/subscription.d.ts +1 -4
- package/koni/background/subscription.js +8 -87
- package/package.json +6 -6
- package/packageInfo.js +1 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
(function (global, factory) {
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.polkadotExtensionBase = {}));
|
|
5
|
+
})(this, (function (exports) { 'use strict';
|
|
6
|
+
|
|
7
|
+
const global = window;
|
|
8
|
+
|
|
9
|
+
const packageInfo = {
|
|
10
|
+
name: '@subwallet/extension-base',
|
|
11
|
+
path: (({ url: (typeof document === 'undefined' && typeof location === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : typeof document === 'undefined' ? location.href : (document.currentScript && document.currentScript.src || new URL('bundle-polkadot-extension-base.js', document.baseURI).href)) }) && (typeof document === 'undefined' && typeof location === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : typeof document === 'undefined' ? location.href : (document.currentScript && document.currentScript.src || new URL('bundle-polkadot-extension-base.js', document.baseURI).href))) ? new URL((typeof document === 'undefined' && typeof location === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : typeof document === 'undefined' ? location.href : (document.currentScript && document.currentScript.src || new URL('bundle-polkadot-extension-base.js', document.baseURI).href))).pathname.substring(0, new URL((typeof document === 'undefined' && typeof location === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : typeof document === 'undefined' ? location.href : (document.currentScript && document.currentScript.src || new URL('bundle-polkadot-extension-base.js', document.baseURI).href))).pathname.lastIndexOf('/') + 1) : 'auto',
|
|
12
|
+
type: 'esm',
|
|
13
|
+
version: '1.1.1'
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
exports.packageInfo = packageInfo;
|
|
17
|
+
|
|
18
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
19
|
+
|
|
20
|
+
}));
|
|
@@ -10,8 +10,8 @@ exports.getAstarDappsInfo = getAstarDappsInfo;
|
|
|
10
10
|
exports.getAstarNominatorMetadata = getAstarNominatorMetadata;
|
|
11
11
|
exports.getAstarStakingMetadata = getAstarStakingMetadata;
|
|
12
12
|
exports.getAstarUnbondingExtrinsic = getAstarUnbondingExtrinsic;
|
|
13
|
-
exports.getAstarWithdrawable = getAstarWithdrawable;
|
|
14
13
|
exports.getAstarWithdrawalExtrinsic = getAstarWithdrawalExtrinsic;
|
|
14
|
+
exports.getCompoundWithdrawable = getCompoundWithdrawable;
|
|
15
15
|
exports.subscribeAstarNominatorMetadata = subscribeAstarNominatorMetadata;
|
|
16
16
|
exports.subscribeAstarStakingMetadata = subscribeAstarStakingMetadata;
|
|
17
17
|
var _KoniTypes = require("@subwallet/extension-base/background/KoniTypes");
|
|
@@ -367,7 +367,7 @@ async function getAstarClaimRewardExtrinsic(substrateApi, address) {
|
|
|
367
367
|
}
|
|
368
368
|
return apiPromise.api.tx.utility.batch(transactions);
|
|
369
369
|
}
|
|
370
|
-
function
|
|
370
|
+
function getCompoundWithdrawable(nominatorMetadata) {
|
|
371
371
|
const unstakingInfo = {
|
|
372
372
|
chain: nominatorMetadata.chain,
|
|
373
373
|
status: _KoniTypes.UnstakingStatus.CLAIMABLE,
|
|
@@ -615,17 +615,27 @@ async function getRelayBondingExtrinsic(substrateApi, amount, targetValidators,
|
|
|
615
615
|
const binaryAmount = new _util.BN(amount);
|
|
616
616
|
let bondTx;
|
|
617
617
|
let nominateTx;
|
|
618
|
+
const _params = chainApi.api.tx.staking.bond.toJSON();
|
|
619
|
+
const paramsCount = _params.args.length;
|
|
618
620
|
const validatorParamList = targetValidators.map(validator => {
|
|
619
621
|
return validator.address;
|
|
620
622
|
});
|
|
621
623
|
if (!nominatorMetadata) {
|
|
622
|
-
|
|
624
|
+
if (paramsCount === 2) {
|
|
625
|
+
bondTx = chainApi.api.tx.staking.bond(binaryAmount, bondDest);
|
|
626
|
+
} else {
|
|
627
|
+
bondTx = chainApi.api.tx.staking.bond(address, binaryAmount, bondDest);
|
|
628
|
+
}
|
|
623
629
|
nominateTx = chainApi.api.tx.staking.nominate(validatorParamList);
|
|
624
630
|
return chainApi.api.tx.utility.batchAll([bondTx, nominateTx]);
|
|
625
631
|
}
|
|
626
632
|
if (!nominatorMetadata.isBondedBefore) {
|
|
627
633
|
// first time
|
|
628
|
-
|
|
634
|
+
if (paramsCount === 2) {
|
|
635
|
+
bondTx = chainApi.api.tx.staking.bond(binaryAmount, bondDest);
|
|
636
|
+
} else {
|
|
637
|
+
bondTx = chainApi.api.tx.staking.bond(nominatorMetadata.address, binaryAmount, bondDest);
|
|
638
|
+
}
|
|
629
639
|
nominateTx = chainApi.api.tx.staking.nominate(validatorParamList);
|
|
630
640
|
return chainApi.api.tx.utility.batchAll([bondTx, nominateTx]);
|
|
631
641
|
} else {
|
|
@@ -247,8 +247,8 @@ function isActionFromValidator(stakingType, chain) {
|
|
|
247
247
|
function getWithdrawalInfo(nominatorMetadata) {
|
|
248
248
|
const unstakings = nominatorMetadata.unstakings;
|
|
249
249
|
let result;
|
|
250
|
-
if (_constants._STAKING_CHAIN_GROUP.astar.includes(nominatorMetadata.chain)) {
|
|
251
|
-
return (0, _astar.
|
|
250
|
+
if (_constants._STAKING_CHAIN_GROUP.astar.includes(nominatorMetadata.chain) || _constants._STAKING_CHAIN_GROUP.relay.includes(nominatorMetadata.chain)) {
|
|
251
|
+
return (0, _astar.getCompoundWithdrawable)(nominatorMetadata);
|
|
252
252
|
}
|
|
253
253
|
for (const unstaking of unstakings) {
|
|
254
254
|
if (unstaking.status === _KoniTypes.UnstakingStatus.CLAIMABLE) {
|
|
@@ -72,7 +72,6 @@ class KoniCron {
|
|
|
72
72
|
const serviceInfo = this.state.getServiceInfo();
|
|
73
73
|
const commonReload = eventTypes.some(eventType => commonReloadEvents.includes(eventType));
|
|
74
74
|
const chainUpdated = eventTypes.includes('chain.updateState');
|
|
75
|
-
const stakingSubmitted = eventTypes.includes('transaction.submitStaking');
|
|
76
75
|
const reloadMantaPay = eventTypes.includes('mantaPay.submitTransaction') || eventTypes.includes('mantaPay.enable');
|
|
77
76
|
const updatedChains = [];
|
|
78
77
|
if (chainUpdated) {
|
|
@@ -83,7 +82,7 @@ class KoniCron {
|
|
|
83
82
|
}
|
|
84
83
|
});
|
|
85
84
|
}
|
|
86
|
-
if (!commonReload && !chainUpdated && !
|
|
85
|
+
if (!commonReload && !chainUpdated && !reloadMantaPay) {
|
|
87
86
|
return;
|
|
88
87
|
}
|
|
89
88
|
const address = (_serviceInfo$currentA = serviceInfo.currentAccountInfo) === null || _serviceInfo$currentA === void 0 ? void 0 : _serviceInfo$currentA.address;
|
|
@@ -92,7 +91,6 @@ class KoniCron {
|
|
|
92
91
|
}
|
|
93
92
|
const chainInfoMap = serviceInfo.chainInfoMap;
|
|
94
93
|
const needUpdateNft = this.needUpdateNft(chainInfoMap, updatedChains);
|
|
95
|
-
const needUpdateStaking = this.needUpdateStaking(chainInfoMap, updatedChains);
|
|
96
94
|
|
|
97
95
|
// MantaPay
|
|
98
96
|
reloadMantaPay && this.removeCron('syncMantaPay');
|
|
@@ -101,19 +99,10 @@ class KoniCron {
|
|
|
101
99
|
(commonReload || needUpdateNft) && this.resetNft(address);
|
|
102
100
|
(commonReload || needUpdateNft) && this.removeCron('refreshNft');
|
|
103
101
|
|
|
104
|
-
// Staking
|
|
105
|
-
(commonReload || needUpdateStaking || stakingSubmitted) && this.resetStakingReward();
|
|
106
|
-
(commonReload || needUpdateStaking || stakingSubmitted) && this.removeCron('refreshStakingReward');
|
|
107
|
-
(commonReload || needUpdateStaking || stakingSubmitted) && this.removeCron('refreshPoolingStakingReward');
|
|
108
|
-
needUpdateStaking && this.removeCron('updateChainStakingMetadata');
|
|
109
|
-
|
|
110
102
|
// Chains
|
|
111
103
|
if (this.checkNetworkAvailable(serviceInfo)) {
|
|
112
104
|
// only add cron job if there's at least 1 active network
|
|
113
105
|
(commonReload || needUpdateNft) && this.addCron('refreshNft', this.refreshNft(address, serviceInfo.chainApiMap, this.state.getSmartContractNfts(), this.state.getActiveChainInfoMap()), _constants.CRON_REFRESH_NFT_INTERVAL);
|
|
114
|
-
(commonReload || needUpdateStaking || stakingSubmitted) && this.addCron('refreshStakingReward', this.refreshStakingReward(address), _constants.CRON_REFRESH_STAKING_REWARD_INTERVAL);
|
|
115
|
-
(commonReload || needUpdateStaking || stakingSubmitted) && this.addCron('refreshPoolingStakingReward', this.refreshStakingRewardFastInterval(address), _constants.CRON_REFRESH_STAKING_REWARD_FAST_INTERVAL);
|
|
116
|
-
needUpdateStaking && this.addCron('updateChainStakingMetadata', this.updateChainStakingMetadata(serviceInfo.chainInfoMap, serviceInfo.chainStateMap, serviceInfo.chainApiMap.substrate), _constants.CRON_REFRESH_CHAIN_STAKING_METADATA);
|
|
117
106
|
reloadMantaPay && this.addCron('syncMantaPay', this.syncMantaPay, _constants.CRON_SYNC_MANTA_PAY);
|
|
118
107
|
} else {
|
|
119
108
|
this.setStakingRewardReady();
|
|
@@ -128,7 +117,6 @@ class KoniCron {
|
|
|
128
117
|
this.addCron('refreshNft', this.refreshNft(currentAccountInfo.address, this.state.getApiMap(), this.state.getSmartContractNfts(), this.state.getActiveChainInfoMap()), _constants.CRON_REFRESH_NFT_INTERVAL);
|
|
129
118
|
this.addCron('refreshStakingReward', this.refreshStakingReward(currentAccountInfo.address), _constants.CRON_REFRESH_STAKING_REWARD_INTERVAL);
|
|
130
119
|
this.addCron('refreshPoolingStakingReward', this.refreshStakingRewardFastInterval(currentAccountInfo.address), _constants.CRON_REFRESH_STAKING_REWARD_FAST_INTERVAL);
|
|
131
|
-
this.addCron('updateChainStakingMetadata', this.updateChainStakingMetadata(this.state.getChainInfoMap(), this.state.getChainStateMap(), this.state.getSubstrateApiMap()), _constants.CRON_REFRESH_CHAIN_STAKING_METADATA);
|
|
132
120
|
this.addCron('syncMantaPay', this.syncMantaPay, _constants.CRON_SYNC_MANTA_PAY);
|
|
133
121
|
} else {
|
|
134
122
|
this.setStakingRewardReady();
|
|
@@ -166,9 +154,6 @@ class KoniCron {
|
|
|
166
154
|
resetNft = newAddress => {
|
|
167
155
|
this.state.resetNft(newAddress);
|
|
168
156
|
};
|
|
169
|
-
resetStakingReward = () => {
|
|
170
|
-
this.state.resetStakingReward();
|
|
171
|
-
};
|
|
172
157
|
refreshStakingReward = address => {
|
|
173
158
|
return () => {
|
|
174
159
|
this.subscriptions.subscribeStakingReward(address).catch(this.logger.error);
|
|
@@ -185,16 +170,6 @@ class KoniCron {
|
|
|
185
170
|
checkNetworkAvailable = serviceInfo => {
|
|
186
171
|
return Object.keys(serviceInfo.chainApiMap.substrate).length > 0 || Object.keys(serviceInfo.chainApiMap.evm).length > 0;
|
|
187
172
|
};
|
|
188
|
-
updateChainStakingMetadata = (chainInfoMap, chainStateMap, substrateApiMap) => {
|
|
189
|
-
return () => {
|
|
190
|
-
this.subscriptions.fetchChainStakingMetadata(chainInfoMap, chainStateMap, substrateApiMap).catch(this.logger.error);
|
|
191
|
-
};
|
|
192
|
-
};
|
|
193
|
-
updateNominatorMetadata = (address, chainInfoMap, chainStateMap, substrateApiMap) => {
|
|
194
|
-
return () => {
|
|
195
|
-
this.subscriptions.fetchNominatorMetadata(address, chainInfoMap, chainStateMap, substrateApiMap).catch(this.logger.error);
|
|
196
|
-
};
|
|
197
|
-
};
|
|
198
173
|
async reloadNft() {
|
|
199
174
|
const address = this.state.keyringService.currentAccount.address;
|
|
200
175
|
const serviceInfo = this.state.getServiceInfo();
|
|
@@ -206,11 +181,7 @@ class KoniCron {
|
|
|
206
181
|
}
|
|
207
182
|
async reloadStaking() {
|
|
208
183
|
const address = this.state.keyringService.currentAccount.address;
|
|
209
|
-
|
|
210
|
-
this.removeCron('refreshStakingReward');
|
|
211
|
-
this.removeCron('refreshPoolingStakingReward');
|
|
212
|
-
this.addCron('refreshStakingReward', this.refreshStakingReward(address), _constants.CRON_REFRESH_STAKING_REWARD_INTERVAL);
|
|
213
|
-
this.addCron('refreshPoolingStakingReward', this.refreshStakingRewardFastInterval(address), _constants.CRON_REFRESH_STAKING_REWARD_FAST_INTERVAL);
|
|
184
|
+
console.log('reload staking', address);
|
|
214
185
|
await (0, _utils2.waitTimeout)(1800);
|
|
215
186
|
return true;
|
|
216
187
|
}
|
|
@@ -223,11 +194,5 @@ class KoniCron {
|
|
|
223
194
|
}
|
|
224
195
|
return false;
|
|
225
196
|
}
|
|
226
|
-
needUpdateStaking(chainInfoMap, updatedChains) {
|
|
227
|
-
if (updatedChains && updatedChains.length > 0) {
|
|
228
|
-
return updatedChains.some(updatedChain => (0, _utils._isChainSupportSubstrateStaking)(chainInfoMap[updatedChain]));
|
|
229
|
-
}
|
|
230
|
-
return false;
|
|
231
|
-
}
|
|
232
197
|
}
|
|
233
198
|
exports.KoniCron = KoniCron;
|
|
@@ -1564,7 +1564,8 @@ class KoniState {
|
|
|
1564
1564
|
return await this.cron.reloadNft();
|
|
1565
1565
|
}
|
|
1566
1566
|
async reloadStaking() {
|
|
1567
|
-
|
|
1567
|
+
await this.subscription.reloadStaking();
|
|
1568
|
+
return true;
|
|
1568
1569
|
}
|
|
1569
1570
|
async approvePassPhishingPage(_url) {
|
|
1570
1571
|
return new Promise(resolve => {
|
|
@@ -1,24 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.KoniSubscription = void 0;
|
|
8
|
-
var _constants = require("@subwallet/extension-base/constants");
|
|
9
7
|
var _balance = require("@subwallet/extension-base/koni/api/dotsama/balance");
|
|
10
8
|
var _crowdloan = require("@subwallet/extension-base/koni/api/dotsama/crowdloan");
|
|
11
9
|
var _staking = require("@subwallet/extension-base/koni/api/staking");
|
|
12
10
|
var _bonding = require("@subwallet/extension-base/koni/api/staking/bonding");
|
|
13
|
-
var _relayChain = require("@subwallet/extension-base/koni/api/staking/bonding/relayChain");
|
|
14
11
|
var _paraChain = require("@subwallet/extension-base/koni/api/staking/paraChain");
|
|
15
12
|
var _handlers = require("@subwallet/extension-base/koni/background/handlers");
|
|
16
|
-
var _constants2 = require("@subwallet/extension-base/services/chain-service/constants");
|
|
17
13
|
var _utils = require("@subwallet/extension-base/services/chain-service/utils");
|
|
18
14
|
var _types = require("@subwallet/extension-base/services/event-service/types");
|
|
19
|
-
var
|
|
15
|
+
var _utils2 = require("@subwallet/extension-base/utils");
|
|
20
16
|
var _util = require("@polkadot/util");
|
|
21
|
-
var _utilCrypto = require("@polkadot/util-crypto");
|
|
22
17
|
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
23
18
|
// SPDX-License-Identifier: Apache-2.0
|
|
24
19
|
|
|
@@ -250,86 +245,11 @@ class KoniSubscription {
|
|
|
250
245
|
};
|
|
251
246
|
await Promise.all([(0, _staking.getPoolingStakingRewardData)(pooledAddresses, targetChainMap, this.state.getSubstrateApiMap(), updateState), (0, _paraChain.getAmplitudeUnclaimedStakingReward)(this.state.getSubstrateApiMap(), addresses, chainInfoMap, activeNetworks, updateState)]);
|
|
252
247
|
}
|
|
253
|
-
async
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
}
|
|
259
|
-
} catch (e) {
|
|
260
|
-
this.logger.error(e);
|
|
261
|
-
}
|
|
262
|
-
return {};
|
|
263
|
-
}
|
|
264
|
-
async fetchChainStakingMetadata(chainInfoMap, chainStateMap, substrateApiMap) {
|
|
265
|
-
const filteredChainInfoMap = {};
|
|
266
|
-
Object.values(chainInfoMap).forEach(chainInfo => {
|
|
267
|
-
const chainState = chainStateMap[chainInfo.slug];
|
|
268
|
-
if (chainState !== null && chainState !== void 0 && chainState.active && (0, _utils._isChainSupportSubstrateStaking)(chainInfo)) {
|
|
269
|
-
filteredChainInfoMap[chainInfo.slug] = chainInfo;
|
|
270
|
-
}
|
|
271
|
-
});
|
|
272
|
-
if (Object.values(filteredChainInfoMap).length === 0) {
|
|
273
|
-
return;
|
|
274
|
-
}
|
|
275
|
-
const timeout = new Promise(resolve => {
|
|
276
|
-
const id = setTimeout(() => {
|
|
277
|
-
clearTimeout(id);
|
|
278
|
-
resolve(null);
|
|
279
|
-
}, 3000);
|
|
280
|
-
});
|
|
281
|
-
|
|
282
|
-
// Fetch data from helper API
|
|
283
|
-
const _dataFromApi = await Promise.race([this.fetchingStakingFromApi(), timeout]);
|
|
284
|
-
const dataFromApi = _dataFromApi;
|
|
285
|
-
await Promise.all(Object.values(filteredChainInfoMap).map(async chainInfo => {
|
|
286
|
-
// Use fetch API data if available
|
|
287
|
-
if (dataFromApi && dataFromApi[chainInfo.slug]) {
|
|
288
|
-
this.state.updateChainStakingMetadata(dataFromApi[chainInfo.slug], {
|
|
289
|
-
expectedReturn: dataFromApi[chainInfo.slug].expectedReturn,
|
|
290
|
-
inflation: dataFromApi[chainInfo.slug].inflation,
|
|
291
|
-
nominatorCount: dataFromApi[chainInfo.slug].nominatorCount
|
|
292
|
-
});
|
|
293
|
-
} else {
|
|
294
|
-
const chainStakingMetadata = await (0, _bonding.getChainStakingMetadata)(chainInfo, substrateApiMap[chainInfo.slug]);
|
|
295
|
-
this.state.updateChainStakingMetadata(chainStakingMetadata, {
|
|
296
|
-
expectedReturn: chainStakingMetadata.expectedReturn,
|
|
297
|
-
inflation: chainStakingMetadata.inflation,
|
|
298
|
-
nominatorCount: chainStakingMetadata.nominatorCount
|
|
299
|
-
});
|
|
300
|
-
}
|
|
301
|
-
}));
|
|
302
|
-
}
|
|
303
|
-
async fetchNominatorMetadata(currentAddress, chainInfoMap, chainStateMap, substrateApiMap) {
|
|
304
|
-
const filteredChainInfoMap = {};
|
|
305
|
-
Object.values(chainInfoMap).forEach(chainInfo => {
|
|
306
|
-
const chainState = chainStateMap[chainInfo.slug];
|
|
307
|
-
if (chainState !== null && chainState !== void 0 && chainState.active && (0, _utils._isChainSupportSubstrateStaking)(chainInfo)) {
|
|
308
|
-
filteredChainInfoMap[chainInfo.slug] = chainInfo;
|
|
309
|
-
}
|
|
310
|
-
});
|
|
311
|
-
let addresses = [currentAddress];
|
|
312
|
-
if (currentAddress === _constants.ALL_ACCOUNT_KEY) {
|
|
313
|
-
addresses = await this.state.getStakingOwnersByChains(Object.keys(filteredChainInfoMap));
|
|
314
|
-
}
|
|
315
|
-
await Promise.all(addresses.map(async address => {
|
|
316
|
-
const isEvmAddress = (0, _utilCrypto.isEthereumAddress)(address);
|
|
317
|
-
await Promise.all(Object.values(filteredChainInfoMap).map(async chainInfo => {
|
|
318
|
-
if (isEvmAddress && !(0, _utils._isChainEvmCompatible)(chainInfo)) {
|
|
319
|
-
return;
|
|
320
|
-
}
|
|
321
|
-
if ((0, _utils._isSubstrateRelayChain)(chainInfo) && _constants2._STAKING_CHAIN_GROUP.nominationPool.includes(chainInfo.slug)) {
|
|
322
|
-
const poolMemberMetadata = await (0, _relayChain.getRelayChainPoolMemberMetadata)(chainInfo, address, substrateApiMap[chainInfo.slug]);
|
|
323
|
-
if (poolMemberMetadata) {
|
|
324
|
-
this.state.updateStakingNominatorMetadata(poolMemberMetadata);
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
const nominatorMetadata = await (0, _bonding.getNominatorMetadata)(chainInfo, address, substrateApiMap[chainInfo.slug]);
|
|
328
|
-
if (nominatorMetadata) {
|
|
329
|
-
this.state.updateStakingNominatorMetadata(nominatorMetadata);
|
|
330
|
-
}
|
|
331
|
-
}));
|
|
332
|
-
}));
|
|
248
|
+
async reloadStaking() {
|
|
249
|
+
var _this$state$keyringSe2;
|
|
250
|
+
const currentAddress = (_this$state$keyringSe2 = this.state.keyringService.currentAccount) === null || _this$state$keyringSe2 === void 0 ? void 0 : _this$state$keyringSe2.address;
|
|
251
|
+
this.subscribeStakingOnChain(currentAddress, this.state.getSubstrateApiMap());
|
|
252
|
+
await (0, _utils2.waitTimeout)(1800);
|
|
333
253
|
}
|
|
334
254
|
}
|
|
335
255
|
exports.KoniSubscription = KoniSubscription;
|
package/cjs/packageInfo.js
CHANGED
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"anonymous": false,
|
|
4
|
+
"inputs": [
|
|
5
|
+
{
|
|
6
|
+
"indexed": true,
|
|
7
|
+
"internalType": "address",
|
|
8
|
+
"name": "owner",
|
|
9
|
+
"type": "address"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"indexed": true,
|
|
13
|
+
"internalType": "address",
|
|
14
|
+
"name": "spender",
|
|
15
|
+
"type": "address"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"indexed": false,
|
|
19
|
+
"internalType": "uint256",
|
|
20
|
+
"name": "value",
|
|
21
|
+
"type": "uint256"
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"name": "Approval",
|
|
25
|
+
"type": "event"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"anonymous": false,
|
|
29
|
+
"inputs": [
|
|
30
|
+
{
|
|
31
|
+
"indexed": true,
|
|
32
|
+
"internalType": "address",
|
|
33
|
+
"name": "from",
|
|
34
|
+
"type": "address"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"indexed": true,
|
|
38
|
+
"internalType": "address",
|
|
39
|
+
"name": "to",
|
|
40
|
+
"type": "address"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"indexed": false,
|
|
44
|
+
"internalType": "uint256",
|
|
45
|
+
"name": "value",
|
|
46
|
+
"type": "uint256"
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
"name": "Transfer",
|
|
50
|
+
"type": "event"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"inputs": [
|
|
54
|
+
{
|
|
55
|
+
"internalType": "address",
|
|
56
|
+
"name": "owner",
|
|
57
|
+
"type": "address"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"internalType": "address",
|
|
61
|
+
"name": "spender",
|
|
62
|
+
"type": "address"
|
|
63
|
+
}
|
|
64
|
+
],
|
|
65
|
+
"name": "allowance",
|
|
66
|
+
"outputs": [
|
|
67
|
+
{
|
|
68
|
+
"internalType": "uint256",
|
|
69
|
+
"name": "",
|
|
70
|
+
"type": "uint256"
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
"stateMutability": "view",
|
|
74
|
+
"type": "function"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"inputs": [
|
|
78
|
+
{
|
|
79
|
+
"internalType": "address",
|
|
80
|
+
"name": "spender",
|
|
81
|
+
"type": "address"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"internalType": "uint256",
|
|
85
|
+
"name": "value",
|
|
86
|
+
"type": "uint256"
|
|
87
|
+
}
|
|
88
|
+
],
|
|
89
|
+
"name": "approve",
|
|
90
|
+
"outputs": [
|
|
91
|
+
{
|
|
92
|
+
"internalType": "bool",
|
|
93
|
+
"name": "",
|
|
94
|
+
"type": "bool"
|
|
95
|
+
}
|
|
96
|
+
],
|
|
97
|
+
"stateMutability": "nonpayable",
|
|
98
|
+
"type": "function"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"inputs": [
|
|
102
|
+
{
|
|
103
|
+
"internalType": "address",
|
|
104
|
+
"name": "who",
|
|
105
|
+
"type": "address"
|
|
106
|
+
}
|
|
107
|
+
],
|
|
108
|
+
"name": "balanceOf",
|
|
109
|
+
"outputs": [
|
|
110
|
+
{
|
|
111
|
+
"internalType": "uint256",
|
|
112
|
+
"name": "",
|
|
113
|
+
"type": "uint256"
|
|
114
|
+
}
|
|
115
|
+
],
|
|
116
|
+
"stateMutability": "view",
|
|
117
|
+
"type": "function"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"inputs": [],
|
|
121
|
+
"name": "decimals",
|
|
122
|
+
"outputs": [
|
|
123
|
+
{
|
|
124
|
+
"internalType": "uint8",
|
|
125
|
+
"name": "",
|
|
126
|
+
"type": "uint8"
|
|
127
|
+
}
|
|
128
|
+
],
|
|
129
|
+
"stateMutability": "view",
|
|
130
|
+
"type": "function"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"inputs": [],
|
|
134
|
+
"name": "name",
|
|
135
|
+
"outputs": [
|
|
136
|
+
{
|
|
137
|
+
"internalType": "string",
|
|
138
|
+
"name": "",
|
|
139
|
+
"type": "string"
|
|
140
|
+
}
|
|
141
|
+
],
|
|
142
|
+
"stateMutability": "view",
|
|
143
|
+
"type": "function"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"inputs": [],
|
|
147
|
+
"name": "symbol",
|
|
148
|
+
"outputs": [
|
|
149
|
+
{
|
|
150
|
+
"internalType": "string",
|
|
151
|
+
"name": "",
|
|
152
|
+
"type": "string"
|
|
153
|
+
}
|
|
154
|
+
],
|
|
155
|
+
"stateMutability": "view",
|
|
156
|
+
"type": "function"
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
"inputs": [],
|
|
160
|
+
"name": "totalSupply",
|
|
161
|
+
"outputs": [
|
|
162
|
+
{
|
|
163
|
+
"internalType": "uint256",
|
|
164
|
+
"name": "",
|
|
165
|
+
"type": "uint256"
|
|
166
|
+
}
|
|
167
|
+
],
|
|
168
|
+
"stateMutability": "view",
|
|
169
|
+
"type": "function"
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"inputs": [
|
|
173
|
+
{
|
|
174
|
+
"internalType": "address",
|
|
175
|
+
"name": "to",
|
|
176
|
+
"type": "address"
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"internalType": "uint256",
|
|
180
|
+
"name": "value",
|
|
181
|
+
"type": "uint256"
|
|
182
|
+
}
|
|
183
|
+
],
|
|
184
|
+
"name": "transfer",
|
|
185
|
+
"outputs": [
|
|
186
|
+
{
|
|
187
|
+
"internalType": "bool",
|
|
188
|
+
"name": "",
|
|
189
|
+
"type": "bool"
|
|
190
|
+
}
|
|
191
|
+
],
|
|
192
|
+
"stateMutability": "nonpayable",
|
|
193
|
+
"type": "function"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"inputs": [
|
|
197
|
+
{
|
|
198
|
+
"internalType": "address",
|
|
199
|
+
"name": "from",
|
|
200
|
+
"type": "address"
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
"internalType": "address",
|
|
204
|
+
"name": "to",
|
|
205
|
+
"type": "address"
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
"internalType": "uint256",
|
|
209
|
+
"name": "value",
|
|
210
|
+
"type": "uint256"
|
|
211
|
+
}
|
|
212
|
+
],
|
|
213
|
+
"name": "transferFrom",
|
|
214
|
+
"outputs": [
|
|
215
|
+
{
|
|
216
|
+
"internalType": "bool",
|
|
217
|
+
"name": "",
|
|
218
|
+
"type": "bool"
|
|
219
|
+
}
|
|
220
|
+
],
|
|
221
|
+
"stateMutability": "nonpayable",
|
|
222
|
+
"type": "function"
|
|
223
|
+
}
|
|
224
|
+
]
|