-
Notifications
You must be signed in to change notification settings - Fork 395
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Turkish crypto community is one of the largest in crypto. We felt the need to add Turkish as a language to Osmosis.
- Loading branch information
1 parent
f95cd19
commit 31bf8ad
Showing
248 changed files
with
14,085 additions
and
6,142 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ dist | |
prod | ||
build | ||
yarn-error.log | ||
.yarn | ||
|
||
src/styles/index.scss | ||
.vercel |
This file was deleted.
Oops, something went wrong.
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,20 @@ | ||
FROM node:14.19.1 as build | ||
|
||
WORKDIR /usr/src/app | ||
|
||
COPY . . | ||
|
||
RUN npm install -g npm@8.10.0 | ||
|
||
RUN yarn | ||
RUN yarn build | ||
|
||
FROM node:14.19.1-alpine | ||
|
||
WORKDIR /usr/src/app | ||
|
||
COPY --from=build /usr/src/app . | ||
|
||
EXPOSE 3000 | ||
|
||
CMD [ "yarn", "start" ] |
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,9 @@ | ||
version: '3.5' | ||
|
||
services: | ||
app: | ||
build: | ||
context: . | ||
dockerfile: ./Dockerfile | ||
ports: | ||
- '3000:3000' |
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,13 @@ | ||
import Axios from "axios"; | ||
import { ObservableQuery } from "@keplr-wallet/stores"; | ||
import { KVStore } from "@keplr-wallet/common"; | ||
export class ObservableQueryExternalBase< | ||
T = unknown, | ||
E = unknown | ||
> extends ObservableQuery<T, E> { | ||
constructor(kvStore: KVStore, baseURL: string, urlPath: string) { | ||
const instance = Axios.create({ baseURL }); | ||
|
||
super(kvStore, instance, urlPath); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,2 +1,8 @@ | ||
export * from "./pool-fees"; | ||
export * from "./pool-rewards"; | ||
export * from "./store"; | ||
|
||
export const IMPERATOR_HISTORICAL_DATA_BASEURL = | ||
"https://api-osmosis.imperator.co"; | ||
export const IMPERATOR_TX_REWARD_BASEURL = | ||
"https://api-osmosis-chain.imperator.co"; |
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
70 changes: 70 additions & 0 deletions
70
packages/stores/src/queries-external/pool-rewards/index.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,70 @@ | ||
import { makeObservable } from "mobx"; | ||
import { computedFn } from "mobx-utils"; | ||
import { KVStore } from "@keplr-wallet/common"; | ||
import { HasMapStore } from "@keplr-wallet/stores"; | ||
import { Dec, PricePretty } from "@keplr-wallet/unit"; | ||
import { IPriceStore } from "../../price"; | ||
import { ObservableQueryExternalBase } from "../base"; | ||
import { PoolsRewards, PoolRewards } from "./types"; | ||
|
||
/** Queries Imperator pool fee history data. */ | ||
export class ObservableQueryAccountPoolRewards extends ObservableQueryExternalBase<PoolsRewards> { | ||
constructor( | ||
kvStore: KVStore, | ||
baseURL: string, | ||
protected readonly priceStore: IPriceStore, | ||
protected readonly bech32Address: string | ||
) { | ||
super(kvStore, baseURL, `/lp/v1/rewards/estimation/${bech32Address}`); | ||
|
||
makeObservable(this); | ||
} | ||
|
||
protected canFetch(): boolean { | ||
return this.bech32Address !== ""; | ||
} | ||
|
||
readonly getUsdRewardsForPool = computedFn( | ||
(poolId: string): PoolRewards | undefined => { | ||
const fiat = this.priceStore.getFiatCurrency("usd"); | ||
|
||
if (!this.response || !fiat) return undefined; | ||
|
||
const poolRewards = this.response.data.pools[poolId] as | ||
| PoolsRewards["pools"][0] | ||
| undefined; | ||
|
||
if (!poolRewards) return undefined; | ||
|
||
return { | ||
day: new PricePretty(fiat, new Dec(poolRewards.day_usd)), | ||
month: new PricePretty(fiat, new Dec(poolRewards.month_usd)), | ||
year: new PricePretty(fiat, new Dec(poolRewards.year_usd)), | ||
}; | ||
} | ||
); | ||
} | ||
|
||
export class ObservableQueryAccountsPoolRewards extends HasMapStore<ObservableQueryAccountPoolRewards> { | ||
constructor( | ||
kvStore: KVStore, | ||
priceStore: IPriceStore, | ||
poolRewardsBaseUrl = "https://api-osmosis-chain.imperator.co" | ||
) { | ||
super( | ||
(bech32Address) => | ||
new ObservableQueryAccountPoolRewards( | ||
kvStore, | ||
poolRewardsBaseUrl, | ||
priceStore, | ||
bech32Address | ||
) | ||
); | ||
} | ||
|
||
get(bech32Address: string) { | ||
return super.get(bech32Address) as ObservableQueryAccountPoolRewards; | ||
} | ||
} | ||
|
||
export * from "./types"; |
20 changes: 20 additions & 0 deletions
20
packages/stores/src/queries-external/pool-rewards/types.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,20 @@ | ||
import { PricePretty } from "@keplr-wallet/unit"; | ||
|
||
export interface PoolsRewards { | ||
pools: { | ||
[id: string]: { | ||
day_usd: number; | ||
month_usd: number; | ||
year_usd: number; | ||
}; | ||
}; | ||
total_day_usd: number; | ||
total_month_usd: number; | ||
total_year_usd: number; | ||
} | ||
|
||
export interface PoolRewards { | ||
day: PricePretty; | ||
month: PricePretty; | ||
year: PricePretty; | ||
} |
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 |
---|---|---|
@@ -1,41 +1,32 @@ | ||
import { KVStore } from "@keplr-wallet/common"; | ||
import { HasMapStore, ObservableQuery } from "@keplr-wallet/stores"; | ||
import { DeepReadonly } from "utility-types"; | ||
import { IPriceStore } from "../price"; | ||
import { ObservableQueryPoolFeesMetrics } from "./pool-fees"; | ||
import Axios from "axios"; | ||
|
||
export class QueriesExternalStore extends HasMapStore<QueriesExternal> { | ||
constructor(protected readonly kvStore: KVStore, feeMetricsBaseURL?: string) { | ||
super(() => new QueriesExternal(this.kvStore, feeMetricsBaseURL)); | ||
} | ||
|
||
get(): QueriesExternal { | ||
return super.get("external"); | ||
} | ||
} | ||
import { ObservableQueryAccountsPoolRewards } from "./pool-rewards"; | ||
import { | ||
IMPERATOR_HISTORICAL_DATA_BASEURL, | ||
IMPERATOR_TX_REWARD_BASEURL, | ||
} from "."; | ||
|
||
/** Root store for queries external to any chain. */ | ||
export class QueriesExternal { | ||
export class QueriesExternalStore { | ||
public readonly queryGammPoolFeeMetrics: DeepReadonly<ObservableQueryPoolFeesMetrics>; | ||
public readonly queryAccountsPoolRewards: DeepReadonly<ObservableQueryAccountsPoolRewards>; | ||
|
||
constructor( | ||
kvStore: KVStore, | ||
feeMetricsBaseURL = "https://api-osmosis.imperator.co" | ||
priceStore: IPriceStore, | ||
feeMetricsBaseURL = IMPERATOR_HISTORICAL_DATA_BASEURL, | ||
poolRewardsBaseUrl = IMPERATOR_TX_REWARD_BASEURL | ||
) { | ||
this.queryGammPoolFeeMetrics = new ObservableQueryPoolFeesMetrics( | ||
kvStore, | ||
feeMetricsBaseURL | ||
); | ||
} | ||
} | ||
|
||
export class ObservableQueryExternal< | ||
T = unknown, | ||
E = unknown | ||
> extends ObservableQuery<T, E> { | ||
constructor(kvStore: KVStore, baseURL: string, urlPath: string) { | ||
const instance = Axios.create({ baseURL }); | ||
|
||
super(kvStore, instance, urlPath); | ||
this.queryAccountsPoolRewards = new ObservableQueryAccountsPoolRewards( | ||
kvStore, | ||
priceStore, | ||
poolRewardsBaseUrl | ||
); | ||
} | ||
} |
Oops, something went wrong.