Skip to content

Commit

Permalink
Fix/Common (#17)
Browse files Browse the repository at this point in the history
* replaced views

* added request method to provider

---------

Co-authored-by: Yehor Podporinov <yehor.podporinov@Yehors-MacBook-Pro.local>
  • Loading branch information
yehor-podporinov and Yehor Podporinov authored Feb 2, 2024
1 parent ecb043e commit 25ddee3
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 10 deletions.
2 changes: 0 additions & 2 deletions src/common/InfoBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@ withDefaults(
}
.info-bar--loading & {
width: toRem(80);
@include skeleton;
}
Expand Down
16 changes: 16 additions & 0 deletions src/composables/use-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ export interface IUseProvider {
switchChain: (chainId: ChainId) => Promise<void>
selectChain: (chainId: ChainId) => Promise<void>
selectProvider: (supportedProvider: SUPPORTED_PROVIDERS) => Promise<void>
request: (body: {
method: string
params?: unknown[] | object
}) => Promise<unknown>

// TODO: to discuss: chain as arg
getAddressUrl: (chain: Web3ProviderType.Chain, address: string) => string
Expand Down Expand Up @@ -171,6 +175,17 @@ export const useProvider = (): IUseProvider => {
await init(providerProxyConstructor)
}

const request: I['request'] = async body => {
// eslint-disable-next-line
// @ts-ignore
if (!_provider?.rawProvider?.request)
throw new errors.ProviderMethodNotFound()

// eslint-disable-next-line
// @ts-ignore
return _provider.rawProvider.request(body)
}

const getAddressUrl: I['getAddressUrl'] = (chain, address) => {
if (!_provider?.getAddressUrl) throw new errors.ProviderMethodNotFound()
return _provider.getAddressUrl(_parseChainToChainW3P(chain), address)
Expand Down Expand Up @@ -248,6 +263,7 @@ export const useProvider = (): IUseProvider => {
switchChain,
selectChain,
selectProvider,
request,

getAddressUrl,
getHashFromTxResponse,
Expand Down
8 changes: 4 additions & 4 deletions src/localization/resources/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"private-pool-view": {
"info-bar": {
"title--1": "Capital",
"subtitle--1": "Group 1",
"subtitle--1": "Group 2",
"description--1": "People who provide the intelligence to use the frontends, capital and compute."
},
"daily-reward-title": "Current daily reward",
Expand All @@ -53,7 +53,7 @@
"public-pool-view": {
"info-bar": {
"title--0": "Community",
"subtitle--0": "Group 2",
"subtitle--0": "Group 1",
"description--0": "The people who create interfaces and tools for the Morpheus ecosystem are also part of its community."
},
"total-deposits-title": "Total deposits",
Expand All @@ -77,8 +77,8 @@
"connection-msg": "Your personal deposits, withdrawals and rewards will be displayed here after connecting your MetaMask wallet"
},
"info-bar": {
"status--public": "Open",
"status--private": "Private"
"status--public": "Automated",
"status--private": "Non-Automated"
},
"invalid-network-modal": {
"title": "Invalid network",
Expand Down
8 changes: 4 additions & 4 deletions src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ const routes: Array<RouteRecordRaw> = [
{
path: 'capital',
name: ROUTE_NAMES.appCapital,
component: () => import('@/pages/HomePage/views/PrivatePoolView.vue'),
props: { poolId: 1 },
component: () => import('@/pages/HomePage/views/PublicPoolView.vue'),
props: { poolId: 0 },
},
...(!config.IS_MAINNET
? [
{
path: 'community',
name: ROUTE_NAMES.appCommunity,
component: () =>
import('@/pages/HomePage/views/PublicPoolView.vue'),
props: { poolId: 0 },
import('@/pages/HomePage/views/PrivatePoolView.vue'),
props: { poolId: 1 },
},
]
: []),
Expand Down

0 comments on commit 25ddee3

Please sign in to comment.