Skip to content

Commit

Permalink
Publish Stage (osmosis-labs#3198)
Browse files Browse the repository at this point in the history
* remove log

* Add automated e2e tests workflow (osmosis-labs#3104)

* Add and upload junit and html reports
* Add .github/workflows/frontend-e2e-tests.yml
* added env with private key
* run just 2 tests with 0 retry
* timeout to 60 and better connectWallet
* run only on master/stage

* Split E2E workflow per stage/master branch (osmosis-labs#3197)

* Split E2E workflow per stage/master branch

* upload just html report for stage

* Add transactions link (osmosis-labs#3194)

* Mattupham/fe 346 fix table overflow behavior on mobile (osmosis-labs#3189)

* Cleanup

* clean up rows

* add padding

* Style updaetes

* Clean up transaction columns

* Add comment

* Fix simulate on edge runtime (osmosis-labs#3195)

uses the node Request/Response API

* optional logoURIs (osmosis-labs#3200)

* log top gainers category (osmosis-labs#3202)

* Run E2E tests on Production and Preview deployments (osmosis-labs#3201)

* Run tests based on environment name

* Swap Amplitude event: use valid number in swap event (osmosis-labs#3204)

* use valid number in swap event

* log

* Update ibc-overrides.ts (osmosis-labs#3203)

* Update rows, swap numbers, update sidebar, add notes (osmosis-labs#3199)

* Update rows, swap numbers, update sidebar, add notes

* Clean up mobile

* Fix logoURIs issue

* Logo URIs optional

* Cleanup

* Add dollar sign

* Update onload

* Clean up

* Add font classes

* add currency symbol

* Flip details slideover

* Add en translations

* Add translations=

* Clean up utils

* update text

* Translations

* Add check for amount and usd

* Clean up

* Clean up

* Add note

* use anchor for balances moved banner (osmosis-labs#3192)

* QA updates - i18n, pools table header fixes (osmosis-labs#3205)

* Updates

* Clean up classes

* Table header fixes

* Fix asset list build: get chain name from first counterparty (IBC) (osmosis-labs#3207)

* get chain name from first counterparty (IBC)

* check for native

* fix asset list

* throw clearer error

* Added USDT and USDT.axl tests (osmosis-labs#3206)

* Added USDT and USDT.axl tests

* Added information about workflow to the readme

* skip Sidecar — ASTRO <> OSMO test

* fix: 🐛 fix circulating supply formatting (osmosis-labs#3210)

* feat: add token chart queries by denom (osmosis-labs#3211)

* feat: ✨ add token chart queries by denom

* chore: 📝 update comment format

* Add 1h, 7d price change to assets table (osmosis-labs#3212)

* chore: remove repetitive words (osmosis-labs#3208)

Signed-off-by: ianlv <[email protected]>

* Fix layout (osmosis-labs#3213)

* fix z index

* fix nav bar

* fix z index for mobile nav menu (osmosis-labs#3216)

* Assets page: update amplitude events (osmosis-labs#3217)

* rename file for easier discoverability

* add highlights amplitude events

* 24h

* logs

* Assets page: implement watchlist (osmosis-labs#3214)

* rename to watchlist

* update turbo

* remove custom sort function

* add default sort

* unify wach list icon in old table

* fix pools show more button

* style (osmosis-labs#3218)

* fix: 🐛 fix twitter search (osmosis-labs#3224)

* fix button disabled (osmosis-labs#3222)

---------

Signed-off-by: ianlv <[email protected]>
Co-authored-by: yakuramori <[email protected]>
Co-authored-by: Matt Upham <[email protected]>
Co-authored-by: JeremyParish69 <[email protected]>
Co-authored-by: Davide Segullo <[email protected]>
Co-authored-by: ianlv <[email protected]>
  • Loading branch information
6 people authored May 7, 2024
1 parent a98818a commit cb3aa89
Show file tree
Hide file tree
Showing 72 changed files with 1,111 additions and 572 deletions.
85 changes: 85 additions & 0 deletions .github/workflows/frontend-e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Frontend E2E tests Workflow

on:
deployment_status:

jobs:
master-e2e-tests:
if: github.event_name == 'deployment_status' && github.event.deployment_status.state == 'success' && github.event.deployment_status.environment == 'Production – osmosis-frontend'
runs-on: macos-latest
environment:
name: prod_swap_test
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Cache dependencies
uses: actions/cache@v4
with:
path: "**/node_modules"
key: ${{ runner.OS }}-20.x-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.OS }}-20.x-
- name: Install Playwright
run: |
yarn --cwd packages/web install --frozen-lockfile && npx playwright install --with-deps chromium
- name: Run Select Swap Pair tests on Master
env:
BASE_URL: "https://app.osmosis.zone"
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
run: |
cd packages/web
npx playwright test -g "Test Swap feature"
- name: upload test results
if: always()
id: e2e-test-results
uses: actions/upload-artifact@v4
with:
name: main-e2e-test-results
path: packages/web/playwright-report
- name: upload junit test results
id: e2e-junit-results
uses: actions/upload-artifact@v4
with:
name: main-e2e-junit-results
path: packages/web/test-results/test-results.xml

preview-e2e-tests:
if: github.event_name == 'deployment_status' && github.event.deployment_status.state == 'success' && github.event.deployment_status.environment == 'Preview – osmosis-frontend'
runs-on: macos-latest
environment:
name: prod_swap_test
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Cache dependencies
uses: actions/cache@v4
with:
path: "**/node_modules"
key: ${{ runner.OS }}-20.x-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.OS }}-20.x-
- name: Install Playwright
run: |
yarn --cwd packages/web install --frozen-lockfile && npx playwright install --with-deps chromium
- name: Run Select Swap Pair tests on Stage
env:
BASE_URL: ${{ github.event.deployment_status.environment_url }}
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
run: |
cd packages/web
npx playwright test -g "Test Swap feature"
- name: upload test results
if: always()
id: e2e-test-results
uses: actions/upload-artifact@v4
with:
name: preview-e2e-test-results
path: packages/web/playwright-report
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"pre-commit": "^1.2.2",
"prettier": "^2.8.8",
"ts-jest": "^29.1.2",
"turbo": "^1.13.0",
"turbo": "^1.13.3",
"typescript": "5.4.3"
},
"packageManager": "[email protected]",
Expand Down
4 changes: 2 additions & 2 deletions packages/math/src/pool/concentrated/math.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export function calcAmount0Delta(
// the case where we want to round up to favor the pool.
// Examples include:
// - calculating amountIn during swap
// - adding liquidity (request user to provide more tokens in in favor of the pool)
// - adding liquidity (request user to provide more tokens in favor of the pool)
// The denominator is truncated to get a higher final amount.
const denom = sqrtPriceA.mulTruncate(sqrtPriceB);
return liquidity.mul(diff).quo(denom).roundUpDec();
Expand Down Expand Up @@ -95,7 +95,7 @@ export function calcAmount1Delta(
// the case where we want to round up to favor the pool.
// Examples include:
// - calculating amountIn during swap
// - adding liquidity (request user to provide more tokens in in favor of the pool)
// - adding liquidity (request user to provide more tokens in favor of the pool)
const _liquidity = liquidity;
const _diff = diff;
return _liquidity.mul(_diff).roundUpDec();
Expand Down
2 changes: 1 addition & 1 deletion packages/server/src/queries/complex/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ With this, once a value is cached and the function is called again, the followin

- The `ttl` is checked against the current time. If it's still live, it's returned.
- If the current time has exceeded the `ttl` BUT NOT the `staleWhileRevalidate` time, the "stale" value is returned immediately, and a new value is created in the background for use in future requests. This ensures that the user does not experience a delay while the cache is being updated.
- If for whatever reason (often failed/slow query, a bug, etc.) the current time has exceeded `staleWhileRevalidate`, the cache is updated synchronously and the new value is returned. The user must wait for a new value to be created. This is often the case when the the underlying function is failing and the error is propagated to the user.
- If for whatever reason (often failed/slow query, a bug, etc.) the current time has exceeded `staleWhileRevalidate`, the cache is updated synchronously, and the new value is returned. The user must wait for a new value to be created. This is often the case when the underlying function is failing and the error is propagated to the user.

Example:

Expand Down
12 changes: 12 additions & 0 deletions packages/server/src/queries/complex/assets/market.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ import { DEFAULT_VS_CURRENCY } from "./config";
export type AssetMarketInfo = Partial<{
marketCap: PricePretty;
currentPrice: PricePretty;
priceChange1h: RatePretty;
priceChange24h: RatePretty;
priceChange7d: RatePretty;
volume24h: PricePretty;
}>;

Expand Down Expand Up @@ -48,7 +50,9 @@ export async function getMarketAsset<TAsset extends Asset>({
marketCap: marketCap
? new PricePretty(DEFAULT_VS_CURRENCY, marketCap)
: undefined,
priceChange1h: assetMarketActivity?.price1hChange,
priceChange24h: assetMarketActivity?.price24hChange,
priceChange7d: assetMarketActivity?.price7dChange,
volume24h: assetMarketActivity?.volume24h,
};
},
Expand Down Expand Up @@ -151,10 +155,18 @@ function makeMarketActivityFromTokenData(tokenData: TokenData) {
? new RatePretty(new Dec(tokenData.volume_24h_change).quo(new Dec(100)))
: undefined,
name: tokenData.name,
price1hChange:
tokenData.price_1h_change !== null
? new RatePretty(new Dec(tokenData.price_1h_change).quo(new Dec(100)))
: undefined,
price24hChange:
tokenData.price_24h_change !== null
? new RatePretty(new Dec(tokenData.price_24h_change).quo(new Dec(100)))
: undefined,
price7dChange:
tokenData.price_7d_change !== null
? new RatePretty(new Dec(tokenData.price_7d_change).quo(new Dec(100)))
: undefined,
exponent: tokenData.exponent,
display: tokenData.display,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ export function getAssetHistoricalPrice({
timeFrame,
numRecentFrames,
}: {
/** Major (symbol) denom to fetch historical price data for. */
/**
* Major (symbol) denom to fetch historical price data for.
*
* Note: this can be both a symbol or a denom (coinMinimalDenom)
* */
coinDenom: string;
/** Number of minutes per bar. So 60 refers to price every hour. */
timeFrame: TimeFrame | CommonPriceChartTimeFrame;
Expand Down
123 changes: 73 additions & 50 deletions packages/server/src/queries/complex/transactions/transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,56 +42,75 @@ export interface FormattedTransaction {

const transactionsCache = new LRUCache<string, CacheEntry>(DEFAULT_LRU_OPTIONS);

// TODO - try / catch the getAssets - for v1 omit a specific trx if getAsset fails
// TODO - try / catch in the map
// TODO - v2 try / catch the getAssets when there's more data
// for v1 omit a specific trx if getAsset fails
function mapMetadata(
metadataArray: Metadata[],
assetLists: AssetList[]
): FormattedMetadata[] {
return metadataArray.map((metadata) => ({
...metadata,
value: metadata.value.map((valueItem) => ({
...valueItem,
txFee: valueItem.txFee.map((fee) => ({
token: new CoinPretty(
getAsset({
assetLists,
anyDenom: fee.denom,
}),
fee.amount
),
usd: new PricePretty(DEFAULT_VS_CURRENCY, fee.usd),
})),
txInfo: {
tokenIn: {
token: new CoinPretty(
getAsset({
assetLists,
anyDenom: valueItem.txInfo.tokenIn.denom,
}),
valueItem.txInfo.tokenIn.amount
),
usd: new PricePretty(
DEFAULT_VS_CURRENCY,
valueItem.txInfo.tokenIn.usd
),
},
tokenOut: {
token: new CoinPretty(
getAsset({
assetLists,
anyDenom: valueItem.txInfo.tokenOut.denom,
}),
valueItem.txInfo.tokenOut.amount
),
usd: new PricePretty(
DEFAULT_VS_CURRENCY,
valueItem.txInfo.tokenOut.usd
),
},
},
})),
}));
return (
metadataArray
.map((metadata) => {
try {
return {
...metadata,
value: metadata.value.map((valueItem) => ({
...valueItem,
txFee: valueItem.txFee.map((fee) => {
try {
return {
token: new CoinPretty(
getAsset({
assetLists,
anyDenom: fee?.denom,
}),
fee?.amount
),
usd: new PricePretty(DEFAULT_VS_CURRENCY, fee?.usd),
};
} catch (error) {
// TODO - clean up in v2
throw new Error("Error mapping txFee");
}
}),
txInfo: {
tokenIn: {
token: new CoinPretty(
getAsset({
assetLists,
anyDenom: valueItem.txInfo.tokenIn?.denom,
}),
valueItem.txInfo.tokenIn?.amount
),
usd: new PricePretty(
DEFAULT_VS_CURRENCY,
valueItem.txInfo.tokenIn?.usd
),
},
tokenOut: {
token: new CoinPretty(
getAsset({
assetLists,
anyDenom: valueItem.txInfo.tokenOut?.denom,
}),
valueItem.txInfo.tokenOut?.amount
),
usd: new PricePretty(
DEFAULT_VS_CURRENCY,
valueItem.txInfo.tokenOut?.usd
),
},
},
})),
};
} catch (error) {
// TODO - v2 add potential handler for error, v1 omit row
return null;
}
})
// filter out any null values or values with empty arrays, indicating an error with getAsset
.filter((metadata) => metadata !== null) as FormattedMetadata[]
);
}

export interface GetTransactionsResponse {
Expand Down Expand Up @@ -142,17 +161,21 @@ export async function getTransactions({

// TODO - wrap getAsset with captureIfError

const mappedSwapTransactions = filteredSwapTransactions.map(
(transaction) => {
const mappedSwapTransactions = filteredSwapTransactions
.map((transaction) => {
return {
id: transaction._id,
hash: transaction.hash,
blockTimestamp: transaction.blockTimestamp,
code: transaction.code,
metadata: mapMetadata(transaction.metadata, assetLists),
};
}
);
})
// filter out transactions with no metadata / empty metadata
.filter(
(transaction) =>
transaction.metadata && transaction.metadata.length > 0
);

return {
transactions: mappedSwapTransactions,
Expand Down
2 changes: 2 additions & 0 deletions packages/server/src/queries/data-services/token-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ export interface TokenData {
volume_24h: number;
volume_24h_change: number | null;
name: string;
price_1h_change: number | null;
price_24h_change: number | null;
price_7d_change: number | null;
exponent: number;
display: string;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,20 @@ export async function queryTokenHistoricalChart({
coinDenom,
timeFrameMinutes,
}: {
/** Major (symbol) denom to fetch historical price data for. */
/**
* Major (symbol) denom to fetch historical price data for.
*
* Note: this can be both a symbol or a denom (coinMinimalDenom)
* */
coinDenom: string;
/** Number of minutes per bar. So 60 refers to price every 60 minutes. */
timeFrameMinutes: TimeFrame;
}): Promise<TokenHistoricalPrice[]> {
// collect params
const url = new URL(
`/tokens/v2/historical/${coinDenom}/chart?tf=${timeFrameMinutes}`,
`/tokens/v2/historical/${encodeURIComponent(
coinDenom
)}/chart?tf=${timeFrameMinutes}`,
TIMESERIES_DATA_URL
);
try {
Expand Down
Loading

0 comments on commit cb3aa89

Please sign in to comment.