forked from polkadot-js/extension
-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/webapp-dev' into koni/dev/issue-…
…2086
- Loading branch information
Showing
29 changed files
with
159 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
44 changes: 44 additions & 0 deletions
44
packages/extension-base/src/koni/api/yield/stDOT-staking.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright 2019-2022 @subwallet/extension-base | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { _ChainInfo } from '@subwallet/chain-list/types'; | ||
import { YieldPoolInfo } from '@subwallet/extension-base/background/KoniTypes'; | ||
import { YIELD_POOL_STAT_REFRESH_INTERVAL } from '@subwallet/extension-base/koni/api/yield/helper/utils'; | ||
import { _SubstrateApi } from '@subwallet/extension-base/services/chain-service/types'; | ||
|
||
export function subscribestDOTLiquidStakingStats (chainApi: _SubstrateApi, chainInfoMap: Record<string, _ChainInfo>, poolInfo: YieldPoolInfo, callback: (rs: YieldPoolInfo) => void) { | ||
function getPoolStat () { | ||
// eslint-disable-next-line node/no-callback-literal | ||
callback({ | ||
...poolInfo, | ||
stats: { | ||
isAvailable: false, | ||
assetEarning: [ | ||
{ | ||
slug: poolInfo.rewardAssets[0], | ||
apr: -1, | ||
exchangeRate: -1 | ||
} | ||
], | ||
maxCandidatePerFarmer: 1, | ||
maxWithdrawalRequestPerFarmer: 1, | ||
minJoinPool: '50000000000', | ||
minWithdrawal: '0', | ||
totalApr: -1, | ||
tvl: '0' | ||
} | ||
}); | ||
} | ||
|
||
function getStatInterval () { | ||
getPoolStat(); | ||
} | ||
|
||
getStatInterval(); | ||
|
||
const interval = setInterval(getStatInterval, YIELD_POOL_STAT_REFRESH_INTERVAL); | ||
|
||
return () => { | ||
clearInterval(interval); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright 2019-2022 @subwallet/extension-base | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import axios from 'axios'; | ||
|
||
const PRODUCTION_BRANCHES = ['master', 'webapp', 'webapp-dev']; | ||
const branchName = process.env.BRANCH_NAME || 'koni-dev'; | ||
const fetchTarget = PRODUCTION_BRANCHES.indexOf(branchName) > -1 ? 'list.json' : 'preview.json'; | ||
|
||
export async function fetchStaticData<T> (slug: string, targetFile?: string) { | ||
const fetchFile = targetFile || fetchTarget; | ||
const rs = await axios.get(`https://static-data.subwallet.app/${slug}/${fetchFile}`); | ||
|
||
return rs.data as T; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.