@subwallet/extension-base 1.3.20-0 → 1.3.22-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 +8 -1
- package/cjs/defaults.js +1 -1
- package/cjs/koni/background/handlers/Extension.js +519 -90
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/chain-service/constants.js +8 -3
- package/cjs/services/chain-service/handler/EvmApi.js +1 -3
- package/cjs/services/chain-service/handler/SubstrateChainHandler.js +3 -2
- package/cjs/services/chain-service/index.js +9 -0
- package/cjs/services/chain-service/utils/patch.js +1 -1
- package/cjs/services/earning-service/constants/chains.js +2 -1
- package/cjs/services/earning-service/handlers/liquid-staking/stella-swap.js +19 -8
- package/cjs/services/earning-service/handlers/native-staking/mythos.js +337 -0
- package/cjs/services/earning-service/handlers/special.js +16 -10
- package/cjs/services/earning-service/service.js +4 -0
- package/cjs/services/earning-service/utils/index.js +2 -0
- package/cjs/services/history-service/helpers/recoverHistoryStatus.js +14 -5
- package/cjs/services/history-service/index.js +15 -3
- package/cjs/services/inapp-notification-service/index.js +78 -0
- package/cjs/services/inapp-notification-service/interfaces.js +2 -0
- package/cjs/services/keyring-service/context/state.js +2 -1
- package/cjs/services/migration-service/scripts/databases/ClearMetadataDatabase.js +3 -23
- package/cjs/services/migration-service/scripts/databases/ClearMetadataForChains.js +40 -0
- package/cjs/services/migration-service/scripts/databases/ClearMetadataForMythos.js +15 -0
- package/cjs/services/migration-service/scripts/index.js +6 -2
- package/cjs/services/request-service/handler/EvmRequestHandler.js +10 -0
- package/cjs/services/request-service/handler/SubstrateRequestHandler.js +4 -3
- package/cjs/services/request-service/index.js +2 -2
- package/cjs/services/setting-service/constants.js +5 -2
- package/cjs/services/storage-service/DatabaseService.js +101 -2
- package/cjs/services/storage-service/databases/index.js +3 -0
- package/cjs/services/storage-service/db-stores/Metadata.js +3 -0
- package/cjs/services/storage-service/db-stores/Migration.js +6 -1
- package/cjs/services/storage-service/db-stores/ProcessTransaction.js +47 -0
- package/cjs/services/storage-service/db-stores/Transaction.js +2 -0
- package/cjs/services/storage-service/db-stores/index.js +8 -1
- package/cjs/services/swap-service/handler/asset-hub/handler.js +30 -11
- package/cjs/services/swap-service/handler/hydradx-handler.js +18 -10
- package/cjs/services/swap-service/index.js +3 -0
- package/cjs/services/swap-service/utils.js +1 -0
- package/cjs/services/transaction-service/index.js +218 -9
- package/cjs/types/index.js +11 -0
- package/cjs/types/setting.js +1 -0
- package/cjs/types/swap/index.js +4 -1
- package/cjs/types/transaction/index.js +11 -0
- package/cjs/types/transaction/process.js +28 -0
- package/cjs/types/yield/actions/join/submit.js +16 -1
- package/defaults.d.ts +1 -1
- package/defaults.js +1 -1
- package/koni/background/handlers/Extension.d.ts +5 -0
- package/koni/background/handlers/Extension.js +437 -12
- package/package.json +52 -22
- package/packageInfo.js +1 -1
- package/services/chain-service/constants.js +8 -3
- package/services/chain-service/handler/EvmApi.js +1 -3
- package/services/chain-service/handler/SubstrateChainHandler.js +3 -2
- package/services/chain-service/index.d.ts +1 -0
- package/services/chain-service/index.js +9 -0
- package/services/chain-service/utils/patch.js +1 -1
- package/services/earning-service/constants/chains.d.ts +1 -0
- package/services/earning-service/constants/chains.js +2 -1
- package/services/earning-service/handlers/liquid-staking/stella-swap.js +19 -8
- package/services/earning-service/handlers/native-staking/mythos.d.ts +35 -0
- package/services/earning-service/handlers/native-staking/mythos.js +329 -0
- package/services/earning-service/handlers/special.js +18 -12
- package/services/earning-service/service.js +4 -0
- package/services/earning-service/utils/index.js +2 -0
- package/services/history-service/helpers/recoverHistoryStatus.js +14 -5
- package/services/history-service/index.d.ts +6 -5
- package/services/history-service/index.js +16 -5
- package/services/inapp-notification-service/index.d.ts +2 -0
- package/services/inapp-notification-service/index.js +79 -1
- package/services/inapp-notification-service/interfaces.d.ts +8 -1
- package/services/inapp-notification-service/interfaces.js +2 -0
- package/services/keyring-service/context/state.d.ts +1 -1
- package/services/keyring-service/context/state.js +3 -2
- package/services/migration-service/scripts/databases/ClearMetadataDatabase.d.ts +3 -3
- package/services/migration-service/scripts/databases/ClearMetadataDatabase.js +3 -23
- package/services/migration-service/scripts/databases/ClearMetadataForChains.d.ts +5 -0
- package/services/migration-service/scripts/databases/ClearMetadataForChains.js +32 -0
- package/services/migration-service/scripts/databases/ClearMetadataForMythos.d.ts +4 -0
- package/services/migration-service/scripts/databases/ClearMetadataForMythos.js +7 -0
- package/services/migration-service/scripts/index.d.ts +1 -0
- package/services/migration-service/scripts/index.js +4 -1
- package/services/request-service/handler/EvmRequestHandler.js +10 -0
- package/services/request-service/handler/SubstrateRequestHandler.d.ts +1 -1
- package/services/request-service/handler/SubstrateRequestHandler.js +4 -3
- package/services/request-service/index.d.ts +1 -1
- package/services/request-service/index.js +2 -2
- package/services/setting-service/constants.d.ts +1 -0
- package/services/setting-service/constants.js +3 -1
- package/services/storage-service/DatabaseService.d.ts +13 -3
- package/services/storage-service/DatabaseService.js +103 -4
- package/services/storage-service/databases/index.d.ts +2 -1
- package/services/storage-service/databases/index.js +3 -0
- package/services/storage-service/db-stores/Metadata.d.ts +1 -0
- package/services/storage-service/db-stores/Metadata.js +3 -0
- package/services/storage-service/db-stores/Migration.d.ts +1 -0
- package/services/storage-service/db-stores/Migration.js +6 -1
- package/services/storage-service/db-stores/ProcessTransaction.d.ts +14 -0
- package/services/storage-service/db-stores/ProcessTransaction.js +39 -0
- package/services/storage-service/db-stores/Transaction.js +2 -0
- package/services/storage-service/db-stores/index.d.ts +1 -0
- package/services/storage-service/db-stores/index.js +2 -1
- package/services/swap-service/handler/asset-hub/handler.js +30 -11
- package/services/swap-service/handler/hydradx-handler.js +18 -10
- package/services/swap-service/index.js +3 -0
- package/services/swap-service/utils.js +1 -0
- package/services/transaction-service/index.d.ts +19 -1
- package/services/transaction-service/index.js +220 -11
- package/services/transaction-service/types.d.ts +13 -4
- package/types/index.d.ts +1 -0
- package/types/index.js +1 -0
- package/types/setting.d.ts +3 -0
- package/types/setting.js +1 -0
- package/types/swap/index.d.ts +3 -2
- package/types/swap/index.js +4 -1
- package/types/transaction/index.d.ts +1 -0
- package/types/transaction/index.js +1 -0
- package/types/transaction/process.d.ts +84 -0
- package/types/transaction/process.js +20 -0
- package/types/transaction/request.d.ts +3 -1
- package/types/yield/actions/join/submit.d.ts +18 -3
- package/types/yield/actions/join/submit.js +11 -1
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"./cjs/detectPackage.js"
|
|
18
18
|
],
|
|
19
19
|
"type": "module",
|
|
20
|
-
"version": "1.3.
|
|
20
|
+
"version": "1.3.22-0",
|
|
21
21
|
"main": "./cjs/index.js",
|
|
22
22
|
"module": "./index.js",
|
|
23
23
|
"types": "./index.d.ts",
|
|
@@ -1041,6 +1041,11 @@
|
|
|
1041
1041
|
"require": "./cjs/services/earning-service/handlers/native-staking/base-para.js",
|
|
1042
1042
|
"default": "./services/earning-service/handlers/native-staking/base-para.js"
|
|
1043
1043
|
},
|
|
1044
|
+
"./services/earning-service/handlers/native-staking/mythos": {
|
|
1045
|
+
"types": "./services/earning-service/handlers/native-staking/mythos.d.ts",
|
|
1046
|
+
"require": "./cjs/services/earning-service/handlers/native-staking/mythos.js",
|
|
1047
|
+
"default": "./services/earning-service/handlers/native-staking/mythos.js"
|
|
1048
|
+
},
|
|
1044
1049
|
"./services/earning-service/handlers/native-staking/para-chain": {
|
|
1045
1050
|
"types": "./services/earning-service/handlers/native-staking/para-chain.d.ts",
|
|
1046
1051
|
"require": "./cjs/services/earning-service/handlers/native-staking/para-chain.js",
|
|
@@ -1296,6 +1301,16 @@
|
|
|
1296
1301
|
"require": "./cjs/services/migration-service/scripts/databases/ClearMetadataDatabase.js",
|
|
1297
1302
|
"default": "./services/migration-service/scripts/databases/ClearMetadataDatabase.js"
|
|
1298
1303
|
},
|
|
1304
|
+
"./services/migration-service/scripts/databases/ClearMetadataForChains": {
|
|
1305
|
+
"types": "./services/migration-service/scripts/databases/ClearMetadataForChains.d.ts",
|
|
1306
|
+
"require": "./cjs/services/migration-service/scripts/databases/ClearMetadataForChains.js",
|
|
1307
|
+
"default": "./services/migration-service/scripts/databases/ClearMetadataForChains.js"
|
|
1308
|
+
},
|
|
1309
|
+
"./services/migration-service/scripts/databases/ClearMetadataForMythos": {
|
|
1310
|
+
"types": "./services/migration-service/scripts/databases/ClearMetadataForMythos.d.ts",
|
|
1311
|
+
"require": "./cjs/services/migration-service/scripts/databases/ClearMetadataForMythos.js",
|
|
1312
|
+
"default": "./services/migration-service/scripts/databases/ClearMetadataForMythos.js"
|
|
1313
|
+
},
|
|
1299
1314
|
"./services/migration-service/scripts/databases/MigrateAssetSetting": {
|
|
1300
1315
|
"types": "./services/migration-service/scripts/databases/MigrateAssetSetting.d.ts",
|
|
1301
1316
|
"require": "./cjs/services/migration-service/scripts/databases/MigrateAssetSetting.js",
|
|
@@ -1721,6 +1736,11 @@
|
|
|
1721
1736
|
"require": "./cjs/services/storage-service/db-stores/Price.js",
|
|
1722
1737
|
"default": "./services/storage-service/db-stores/Price.js"
|
|
1723
1738
|
},
|
|
1739
|
+
"./services/storage-service/db-stores/ProcessTransaction": {
|
|
1740
|
+
"types": "./services/storage-service/db-stores/ProcessTransaction.d.ts",
|
|
1741
|
+
"require": "./cjs/services/storage-service/db-stores/ProcessTransaction.js",
|
|
1742
|
+
"default": "./services/storage-service/db-stores/ProcessTransaction.js"
|
|
1743
|
+
},
|
|
1724
1744
|
"./services/storage-service/db-stores/Staking": {
|
|
1725
1745
|
"types": "./services/storage-service/db-stores/Staking.d.ts",
|
|
1726
1746
|
"require": "./cjs/services/storage-service/db-stores/Staking.js",
|
|
@@ -2181,6 +2201,11 @@
|
|
|
2181
2201
|
"require": "./cjs/types/service-base.js",
|
|
2182
2202
|
"default": "./types/service-base.js"
|
|
2183
2203
|
},
|
|
2204
|
+
"./types/setting": {
|
|
2205
|
+
"types": "./types/setting.d.ts",
|
|
2206
|
+
"require": "./cjs/types/setting.js",
|
|
2207
|
+
"default": "./types/setting.js"
|
|
2208
|
+
},
|
|
2184
2209
|
"./types/swap": {
|
|
2185
2210
|
"types": "./types/swap/index.d.ts",
|
|
2186
2211
|
"require": "./cjs/types/swap/index.js",
|
|
@@ -2201,6 +2226,11 @@
|
|
|
2201
2226
|
"require": "./cjs/types/transaction/error.js",
|
|
2202
2227
|
"default": "./types/transaction/error.js"
|
|
2203
2228
|
},
|
|
2229
|
+
"./types/transaction/process": {
|
|
2230
|
+
"types": "./types/transaction/process.d.ts",
|
|
2231
|
+
"require": "./cjs/types/transaction/process.js",
|
|
2232
|
+
"default": "./types/transaction/process.js"
|
|
2233
|
+
},
|
|
2204
2234
|
"./types/transaction/request": {
|
|
2205
2235
|
"types": "./types/transaction/request.d.ts",
|
|
2206
2236
|
"require": "./cjs/types/transaction/request.js",
|
|
@@ -2544,30 +2574,30 @@
|
|
|
2544
2574
|
"@metaverse-network-sdk/type-definitions": "^0.0.1-13",
|
|
2545
2575
|
"@oak-foundation/types": "^0.0.23",
|
|
2546
2576
|
"@polkadot-api/merkleize-metadata": "^1.1.0",
|
|
2547
|
-
"@polkadot/api": "^15.
|
|
2548
|
-
"@polkadot/api-base": "^15.
|
|
2549
|
-
"@polkadot/api-contract": "^15.
|
|
2550
|
-
"@polkadot/api-derive": "^15.
|
|
2551
|
-
"@polkadot/apps-config": "^0.
|
|
2552
|
-
"@polkadot/hw-ledger": "^
|
|
2553
|
-
"@polkadot/networks": "^13.
|
|
2554
|
-
"@polkadot/phishing": "^0.
|
|
2555
|
-
"@polkadot/rpc-provider": "^15.
|
|
2556
|
-
"@polkadot/types": "^15.
|
|
2557
|
-
"@polkadot/types-augment": "^15.
|
|
2558
|
-
"@polkadot/types-known": "^15.
|
|
2559
|
-
"@polkadot/ui-settings": "^3.
|
|
2560
|
-
"@polkadot/util": "^13.
|
|
2561
|
-
"@polkadot/util-crypto": "^13.
|
|
2562
|
-
"@polkadot/x-global": "^
|
|
2577
|
+
"@polkadot/api": "^15.7.2",
|
|
2578
|
+
"@polkadot/api-base": "^15.7.2",
|
|
2579
|
+
"@polkadot/api-contract": "^15.7.2",
|
|
2580
|
+
"@polkadot/api-derive": "^15.7.2",
|
|
2581
|
+
"@polkadot/apps-config": "^0.150.2",
|
|
2582
|
+
"@polkadot/hw-ledger": "^13.4.3",
|
|
2583
|
+
"@polkadot/networks": "^13.4.3",
|
|
2584
|
+
"@polkadot/phishing": "^0.25.4",
|
|
2585
|
+
"@polkadot/rpc-provider": "^15.7.2",
|
|
2586
|
+
"@polkadot/types": "^15.7.2",
|
|
2587
|
+
"@polkadot/types-augment": "^15.7.2",
|
|
2588
|
+
"@polkadot/types-known": "^15.7.2",
|
|
2589
|
+
"@polkadot/ui-settings": "^3.12.2",
|
|
2590
|
+
"@polkadot/util": "^13.4.3",
|
|
2591
|
+
"@polkadot/util-crypto": "^13.4.3",
|
|
2592
|
+
"@polkadot/x-global": "^13.4.3",
|
|
2563
2593
|
"@reduxjs/toolkit": "^1.9.1",
|
|
2564
2594
|
"@sora-substrate/type-definitions": "^1.17.7",
|
|
2565
2595
|
"@substrate/connect": "^0.8.9",
|
|
2566
|
-
"@subwallet/chain-list": "0.2.99
|
|
2567
|
-
"@subwallet/extension-base": "^1.3.
|
|
2568
|
-
"@subwallet/extension-chains": "^1.3.
|
|
2569
|
-
"@subwallet/extension-dapp": "^1.3.
|
|
2570
|
-
"@subwallet/extension-inject": "^1.3.
|
|
2596
|
+
"@subwallet/chain-list": "0.2.99",
|
|
2597
|
+
"@subwallet/extension-base": "^1.3.22-0",
|
|
2598
|
+
"@subwallet/extension-chains": "^1.3.22-0",
|
|
2599
|
+
"@subwallet/extension-dapp": "^1.3.22-0",
|
|
2600
|
+
"@subwallet/extension-inject": "^1.3.22-0",
|
|
2571
2601
|
"@subwallet/keyring": "^0.1.8-beta.0",
|
|
2572
2602
|
"@subwallet/ui-keyring": "^0.1.8-beta.0",
|
|
2573
2603
|
"@ton/core": "^0.56.3",
|
package/packageInfo.js
CHANGED
|
@@ -7,5 +7,5 @@ export const packageInfo = {
|
|
|
7
7
|
name: '@subwallet/extension-base',
|
|
8
8
|
path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto',
|
|
9
9
|
type: 'esm',
|
|
10
|
-
version: '1.3.
|
|
10
|
+
version: '1.3.22-0'
|
|
11
11
|
};
|
|
@@ -102,7 +102,10 @@ export const _STAKING_ERA_LENGTH_MAP = {
|
|
|
102
102
|
polkadex: 24,
|
|
103
103
|
avail_mainnet: 24,
|
|
104
104
|
cere: 24,
|
|
105
|
-
analog_timechain: 12
|
|
105
|
+
analog_timechain: 12,
|
|
106
|
+
muse_testnet: 25 * 6 / 60 / 60,
|
|
107
|
+
// 25 blocks per session
|
|
108
|
+
mythos: 24
|
|
106
109
|
};
|
|
107
110
|
export const _EXPECTED_BLOCK_TIME = {
|
|
108
111
|
// in seconds
|
|
@@ -135,7 +138,9 @@ export const _EXPECTED_BLOCK_TIME = {
|
|
|
135
138
|
enjin_relaychain: 6,
|
|
136
139
|
availTuringTest: 20,
|
|
137
140
|
avail_mainnet: 20,
|
|
138
|
-
dentnet: 3
|
|
141
|
+
dentnet: 3,
|
|
142
|
+
muse_testnet: 6,
|
|
143
|
+
mythos: 6
|
|
139
144
|
};
|
|
140
145
|
export const _PARACHAIN_INFLATION_DISTRIBUTION = {
|
|
141
146
|
moonbeam: {
|
|
@@ -248,7 +253,7 @@ export const _TRANSFER_CHAIN_GROUP = {
|
|
|
248
253
|
genshiro: ['genshiro_testnet', 'genshiro', 'equilibrium_parachain'],
|
|
249
254
|
// crab: ['crab', 'pangolin'],
|
|
250
255
|
bitcountry: ['pioneer', 'bitcountry'],
|
|
251
|
-
statemine: ['statemint', 'statemine', 'darwinia2', 'astar', 'shiden', 'shibuya', 'parallel', 'liberland', 'liberlandTest', 'dentnet', 'dbcchain'],
|
|
256
|
+
statemine: ['statemint', 'statemine', 'darwinia2', 'astar', 'shiden', 'shibuya', 'parallel', 'liberland', 'liberlandTest', 'dentnet', 'dbcchain', 'westend_assethub'],
|
|
252
257
|
riochain: ['riochain'],
|
|
253
258
|
sora_substrate: ['sora_substrate'],
|
|
254
259
|
avail: ['kate', 'goldberg_testnet'],
|
|
@@ -118,12 +118,10 @@ export class EvmApi {
|
|
|
118
118
|
return this.disconnect();
|
|
119
119
|
}
|
|
120
120
|
onConnect() {
|
|
121
|
+
this.isReadyHandler.resolve(this);
|
|
121
122
|
if (!this.isApiConnected) {
|
|
122
123
|
console.log(`Connected to ${this.chainSlug} at ${this.apiUrl}`);
|
|
123
124
|
this.isApiReady = true;
|
|
124
|
-
if (this.isApiReadyOnce) {
|
|
125
|
-
this.isReadyHandler.resolve(this);
|
|
126
|
-
}
|
|
127
125
|
}
|
|
128
126
|
this.updateConnectionStatus(_ChainConnectionStatus.CONNECTED);
|
|
129
127
|
}
|
|
@@ -263,7 +263,7 @@ export class SubstrateChainHandler extends AbstractChainHandler {
|
|
|
263
263
|
onUpdateStatus,
|
|
264
264
|
providerName
|
|
265
265
|
} = {}) {
|
|
266
|
-
var _this$parent2;
|
|
266
|
+
var _this$parent2, _this$parent3;
|
|
267
267
|
const existed = this.substrateApiMap[chainSlug];
|
|
268
268
|
const updateMetadata = substrateApi => {
|
|
269
269
|
// Update metadata to database with async methods
|
|
@@ -281,7 +281,8 @@ export class SubstrateChainHandler extends AbstractChainHandler {
|
|
|
281
281
|
updateMetadata(existed);
|
|
282
282
|
return existed;
|
|
283
283
|
}
|
|
284
|
-
const
|
|
284
|
+
const useMetadata = await ((_this$parent2 = this.parent) === null || _this$parent2 === void 0 ? void 0 : _this$parent2.isUseMetadataToCreateApi(chainSlug));
|
|
285
|
+
const metadata = useMetadata === false ? undefined : await ((_this$parent3 = this.parent) === null || _this$parent3 === void 0 ? void 0 : _this$parent3.getMetadata(chainSlug));
|
|
285
286
|
const apiObject = new SubstrateApi(chainSlug, apiUrl, {
|
|
286
287
|
providerName,
|
|
287
288
|
metadata,
|
|
@@ -169,4 +169,5 @@ export declare class ChainService {
|
|
|
169
169
|
getSubscanChainMap(reverse?: boolean): Record<string, string>;
|
|
170
170
|
get detectBalanceChainSlugMap(): Record<string, string>;
|
|
171
171
|
getFeeTokensByChain(chainSlug: string): string[];
|
|
172
|
+
isUseMetadataToCreateApi(chain: string): Promise<boolean>;
|
|
172
173
|
}
|
|
@@ -11,6 +11,7 @@ import { TonChainHandler } from '@subwallet/extension-base/services/chain-servic
|
|
|
11
11
|
import { _CHAIN_VALIDATION_ERROR } from '@subwallet/extension-base/services/chain-service/handler/types';
|
|
12
12
|
import { _ChainConnectionStatus, _CUSTOM_PREFIX, _NFT_CONTRACT_STANDARDS, _SMART_CONTRACT_STANDARDS } from '@subwallet/extension-base/services/chain-service/types';
|
|
13
13
|
import { _isAssetAutoEnable, _isAssetCanPayTxFee, _isAssetFungibleToken, _isChainEnabled, _isCustomAsset, _isCustomChain, _isCustomProvider, _isEqualContractAddress, _isEqualSmartContractAsset, _isLocalToken, _isMantaZkAsset, _isPureEvmChain, _isPureSubstrateChain, _parseAssetRefKey, randomizeProvider, updateLatestChainInfo } from '@subwallet/extension-base/services/chain-service/utils';
|
|
14
|
+
import { MYTHOS_MIGRATION_KEY } from '@subwallet/extension-base/services/migration-service/scripts';
|
|
14
15
|
import AssetSettingStore from '@subwallet/extension-base/stores/AssetSetting';
|
|
15
16
|
import { addLazy, calculateMetadataHash, fetchStaticData, filterAssetsByChainAndType, getShortMetadata, MODULE_SUPPORT } from '@subwallet/extension-base/utils';
|
|
16
17
|
import { BehaviorSubject, Subject } from 'rxjs';
|
|
@@ -1827,4 +1828,12 @@ export class ChainService {
|
|
|
1827
1828
|
return chainAsset.originChain === chainSlug && (chainAsset.assetType === _AssetType.NATIVE || _isAssetCanPayTxFee(chainAsset));
|
|
1828
1829
|
}).map(chainAsset => chainAsset.slug);
|
|
1829
1830
|
}
|
|
1831
|
+
async isUseMetadataToCreateApi(chain) {
|
|
1832
|
+
const isMythos = ['mythos', 'muse_testnet'].includes(chain);
|
|
1833
|
+
if (isMythos) {
|
|
1834
|
+
return this.dbService.hasRunScript(MYTHOS_MIGRATION_KEY);
|
|
1835
|
+
} else {
|
|
1836
|
+
return true;
|
|
1837
|
+
}
|
|
1838
|
+
}
|
|
1830
1839
|
}
|
|
@@ -5,7 +5,7 @@ const PRODUCTION_BRANCHES = ['master', 'webapp', 'webapp-dev'];
|
|
|
5
5
|
const branchName = process.env.BRANCH_NAME || 'subwallet-dev';
|
|
6
6
|
const fetchDomain = PRODUCTION_BRANCHES.indexOf(branchName) > -1 ? 'https://chain-list-assets.subwallet.app' : 'https://dev.sw-chain-list-assets.pages.dev';
|
|
7
7
|
const fetchFile = PRODUCTION_BRANCHES.indexOf(branchName) > -1 ? 'list.json' : 'preview.json';
|
|
8
|
-
const ChainListVersion = '0.2.
|
|
8
|
+
const ChainListVersion = '0.2.99'; // update this when build chainlist
|
|
9
9
|
|
|
10
10
|
// todo: move this interface to chainlist
|
|
11
11
|
|
|
@@ -17,7 +17,8 @@ export const _STAKING_CHAIN_GROUP = {
|
|
|
17
17
|
lending: ['interlay'],
|
|
18
18
|
krest_network: ['krest_network'],
|
|
19
19
|
manta: ['manta_network'],
|
|
20
|
-
bittensor: ['bittensor', 'bittensor_devnet']
|
|
20
|
+
bittensor: ['bittensor', 'bittensor_devnet'],
|
|
21
|
+
mythos: ['mythos', 'muse_testnet']
|
|
21
22
|
};
|
|
22
23
|
export const TON_CHAINS = ['ton', 'ton_testnet'];
|
|
23
24
|
export const MaxEraRewardPointsEras = 14;
|
|
@@ -18,6 +18,7 @@ export const getStellaswapLiquidStakingContract = (networkKey, assetAddress, evm
|
|
|
18
18
|
};
|
|
19
19
|
const APR_STATS_URL = 'https://apr-api.stellaswap.com/api/v1/stdot';
|
|
20
20
|
const SUBWALLET_REFERRAL = '0x7e6815f45E624768548d085231f2d453f16FD7DD';
|
|
21
|
+
const TOP_HOLDER = '0x4300e09284e3bB4d9044DdAB31EfAF5f3301DABa';
|
|
21
22
|
export default class StellaSwapLiquidStakingPoolHandler extends BaseLiquidStakingPoolHandler {
|
|
22
23
|
inputAsset = 'moonbeam-LOCAL-xcDOT';
|
|
23
24
|
altInputAsset = '';
|
|
@@ -198,9 +199,15 @@ export default class StellaSwapLiquidStakingPoolHandler extends BaseLiquidStakin
|
|
|
198
199
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
|
|
199
200
|
await allowanceCall.call(), evmApi.api.eth.getGasPrice()]);
|
|
200
201
|
if (!allowance || parseInt(allowance) <= 0) {
|
|
202
|
+
const metadata = {
|
|
203
|
+
tokenApprove: inputTokenSlug,
|
|
204
|
+
contractAddress: _getContractAddressOfToken(inputTokenInfo),
|
|
205
|
+
spenderAddress: _getContractAddressOfToken(derivativeTokenInfo)
|
|
206
|
+
};
|
|
201
207
|
const step = {
|
|
202
208
|
name: 'Authorize token approval',
|
|
203
|
-
type: YieldStepType.TOKEN_APPROVAL
|
|
209
|
+
type: YieldStepType.TOKEN_APPROVAL,
|
|
210
|
+
metadata: metadata
|
|
204
211
|
};
|
|
205
212
|
|
|
206
213
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
|
|
@@ -223,13 +230,17 @@ export default class StellaSwapLiquidStakingPoolHandler extends BaseLiquidStakin
|
|
|
223
230
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment
|
|
224
231
|
const depositCall = stakingContract.methods.deposit(params.amount);
|
|
225
232
|
let estimatedDepositGas = 0;
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
+
const addressToTests = [params.address, TOP_HOLDER];
|
|
234
|
+
for (const address of addressToTests) {
|
|
235
|
+
try {
|
|
236
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
|
|
237
|
+
estimatedDepositGas = await depositCall.estimateGas({
|
|
238
|
+
from: address
|
|
239
|
+
});
|
|
240
|
+
break;
|
|
241
|
+
} catch (e) {
|
|
242
|
+
console.error(e);
|
|
243
|
+
}
|
|
233
244
|
}
|
|
234
245
|
const gasPrice = await evmApi.api.eth.getGasPrice();
|
|
235
246
|
return {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { _ChainInfo } from '@subwallet/chain-list/types';
|
|
2
|
+
import { ExtrinsicType, NominationInfo } from '@subwallet/extension-base/background/KoniTypes';
|
|
3
|
+
import { _SubstrateApi } from '@subwallet/extension-base/services/chain-service/types';
|
|
4
|
+
import BaseParaStakingPoolHandler from '@subwallet/extension-base/services/earning-service/handlers/native-staking/base-para';
|
|
5
|
+
import { EarningRewardItem, EarningStatus, SubmitJoinNativeStaking, TransactionData, UnstakingInfo, ValidatorInfo, YieldPoolInfo, YieldPoolMethodInfo, YieldPositionInfo, YieldTokenBaseInfo } from '@subwallet/extension-base/types';
|
|
6
|
+
import { SubmittableExtrinsic } from '@polkadot/api/types';
|
|
7
|
+
interface PalletCollatorStakingUserStakeInfo {
|
|
8
|
+
stake: string;
|
|
9
|
+
maybeLastUnstake: string[];
|
|
10
|
+
candidates: string[];
|
|
11
|
+
maybeLastRewardSession: string;
|
|
12
|
+
}
|
|
13
|
+
export default class MythosNativeStakingPoolHandler extends BaseParaStakingPoolHandler {
|
|
14
|
+
protected readonly availableMethod: YieldPoolMethodInfo;
|
|
15
|
+
subscribePoolInfo(callback: (data: YieldPoolInfo) => void): Promise<VoidFunction>;
|
|
16
|
+
subscribePoolPosition(useAddresses: string[], resultCallback: (rs: YieldPositionInfo) => void): Promise<VoidFunction>;
|
|
17
|
+
parseCollatorMetadata(chainInfo: _ChainInfo, stakerAddress: string, substrateApi: _SubstrateApi, userStake: PalletCollatorStakingUserStakeInfo): Promise<{
|
|
18
|
+
status: EarningStatus;
|
|
19
|
+
balanceToken: string;
|
|
20
|
+
totalStake: string;
|
|
21
|
+
activeStake: string;
|
|
22
|
+
unstakeBalance: string;
|
|
23
|
+
isBondedBefore: boolean;
|
|
24
|
+
nominations: NominationInfo[];
|
|
25
|
+
unstakings: UnstakingInfo[];
|
|
26
|
+
}>;
|
|
27
|
+
getPoolTargets(): Promise<ValidatorInfo[]>;
|
|
28
|
+
createJoinExtrinsic(data: SubmitJoinNativeStaking, positionInfo?: YieldPositionInfo): Promise<[TransactionData, YieldTokenBaseInfo]>;
|
|
29
|
+
handleYieldUnstake(amount: string, address: string, selectedTarget?: string): Promise<[ExtrinsicType, TransactionData]>;
|
|
30
|
+
getPoolReward(useAddresses: string[], callback: (rs: EarningRewardItem) => void): Promise<VoidFunction>;
|
|
31
|
+
handleYieldCancelUnstake(): Promise<never>;
|
|
32
|
+
handleYieldWithdraw(address: string, unstakingInfo: UnstakingInfo): Promise<SubmittableExtrinsic<"promise", import("@polkadot/types/types").ISubmittableResult>>;
|
|
33
|
+
handleYieldClaimReward(address: string, bondReward?: boolean): Promise<SubmittableExtrinsic<"promise", import("@polkadot/types/types").ISubmittableResult>>;
|
|
34
|
+
}
|
|
35
|
+
export {};
|