Skip to content

Commit

Permalink
Merge branch 'stage' into FE-1028
Browse files Browse the repository at this point in the history
  • Loading branch information
yury-dubinin committed Aug 28, 2024
2 parents 1c1881c + caacfd4 commit fe13158
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 48 deletions.
12 changes: 9 additions & 3 deletions packages/bridge/src/ibc/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,10 @@ export class IbcBridgeProvider implements BridgeProvider {
try {
const assetListAsset = this.ctx.assetLists
.flatMap((list) => list.assets)
.find((a) => a.coinMinimalDenom === asset.address);
.find(
(a) =>
a.coinMinimalDenom.toLowerCase() === asset.address.toLowerCase()
);

const ibcTransferMethod = assetListAsset?.transferMethods.find(
({ type }) => type === "ibc"
Expand Down Expand Up @@ -224,7 +227,9 @@ export class IbcBridgeProvider implements BridgeProvider {
// try to get asset list fee asset first, or otherwise the chain fee currency
const assetListAsset = this.ctx.assetLists
.flatMap(({ assets }) => assets)
.find((asset) => asset.coinMinimalDenom.toLowerCase() === denom);
.find(
(asset) => asset.coinMinimalDenom.toLowerCase() === denom.toLowerCase()
);

if (assetListAsset) {
return {
Expand All @@ -238,7 +243,8 @@ export class IbcBridgeProvider implements BridgeProvider {
const chains = await this.getChains();
const chain = chains.find((c) => c.chain_id === fromChainId);
const feeCurrency = chain?.feeCurrencies.find(
({ chainSuggestionDenom }) => chainSuggestionDenom === denom
({ chainSuggestionDenom }) =>
chainSuggestionDenom.toLowerCase() === denom.toLowerCase()
);

if (feeCurrency) {
Expand Down
5 changes: 4 additions & 1 deletion packages/bridge/src/nitro/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,10 @@ export class NitroBridgeProvider implements BridgeProvider {
const setTokenParam = (asset: BridgeAsset, param: string) => {
if (asset.address.includes("alloyed")) {
const assets = this.ctx.assetLists.flatMap(({ assets }) => assets);
const alloy = assets.find((a) => a.coinMinimalDenom === asset.address);
const alloy = assets.find(
(a) =>
a.coinMinimalDenom.toLowerCase() === asset.address.toLowerCase()
);
const variant = assets.find(
(a) =>
a.variantGroupKey === alloy?.variantGroupKey &&
Expand Down
5 changes: 4 additions & 1 deletion packages/bridge/src/squid/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,10 @@ export class SquidBridgeProvider implements BridgeProvider {
// asset list counterparties
const assetListAsset = this.ctx.assetLists
.flatMap(({ assets }) => assets)
.find((a) => a.coinMinimalDenom === asset.address);
.find(
(a) =>
a.coinMinimalDenom.toLowerCase() === asset.address.toLowerCase()
);

for (const counterparty of assetListAsset?.counterparty ?? []) {
// check if supported by squid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ export function getPoolsFromSidecar({
minLiquidityUsd?: number;
withMarketIncentives?: boolean;
}): Promise<Pool[]> {
if (poolIds && !poolIds.length) return Promise.resolve([]);

return cachified({
cache: poolsCache,
key:
Expand Down
11 changes: 5 additions & 6 deletions packages/server/src/queries/complex/pools/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,13 @@ export async function getUserPools(params: {
.map(({ position: { pool_id } }) => pool_id)
.forEach((poolId) => userUniquePoolIds.add(poolId));

const eventualPools = await timeout(
() => getPools({ ...params, poolIds: Array.from(userUniquePoolIds) }),
10_000, // 10 seconds
"getPools"
)();
const pools = await getPools({
...params,
poolIds: Array.from(userUniquePoolIds),
});

return await Promise.all(
eventualPools.map(async (pool) => {
pools.map(async (pool) => {
const { id, reserveCoins, totalFiatValueLocked, type } = pool;
let userValue: PricePretty = new PricePretty(
DEFAULT_VS_CURRENCY,
Expand Down
37 changes: 0 additions & 37 deletions packages/web/pages/test-bridge.tsx

This file was deleted.

0 comments on commit fe13158

Please sign in to comment.