Skip to content

Commit

Permalink
Merge pull request #379 from ergolabs/dev
Browse files Browse the repository at this point in the history
v.1.1.6
  • Loading branch information
yasha-black authored Feb 5, 2022
2 parents 6adfe95 + 6ffc6fd commit 6972246
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/network/ergo/balance/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { AssetInfo } from '@ergolabs/ergo-sdk/build/main/entities/assetInfo';
import {
combineLatest,
debounceTime,
defaultIfEmpty,
from,
map,
Observable,
Expand Down Expand Up @@ -34,7 +35,7 @@ export const availableTokensData$: Observable<[bigint, AssetInfo][]> = utxos$
}),
),
),
),
).pipe(defaultIfEmpty([])),
),
map((availableTokensData) =>
availableTokensData.filter(([, assetInfo]) => !!assetInfo),
Expand Down
5 changes: 3 additions & 2 deletions src/pages/Swap/Swap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
combineLatest,
debounceTime,
distinctUntilChanged,
first,
filter,
map,
Observable,
of,
Expand Down Expand Up @@ -61,7 +61,6 @@ const getSelectedPool = (
xId && yId
? getAmmPoolsByAssetPair(xId, yId).pipe(
map((pools) => maxBy(pools, (p) => p.lp.amount)),
first(),
)
: of(undefined);

Expand Down Expand Up @@ -150,9 +149,11 @@ export const Swap = (): JSX.Element => {
useSubscription(
combineLatest([
form.controls.fromAsset.valueChangesWithSilent$.pipe(
filter(Boolean),
distinctUntilChanged(),
),
form.controls.toAsset.valueChangesWithSilent$.pipe(
filter(Boolean),
distinctUntilChanged(),
),
]).pipe(
Expand Down
5 changes: 3 additions & 2 deletions src/services/new/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { AssetInfo } from '@ergolabs/ergo-sdk/build/main/entities/assetInfo';
import {
combineLatest,
distinctUntilChanged,
exhaustMap,
filter,
from,
interval,
Expand Down Expand Up @@ -85,15 +86,15 @@ export const appTick$ = walletState$.pipe(
);

export const utxos$ = appTick$.pipe(
switchMap(() => from(ergo.get_utxos())),
exhaustMap(() => from(ergo.get_utxos())),
map((bs) => bs?.map((b) => ergoBoxFromProxy(b))),
map((data) => data ?? []),
publishReplay(1),
refCount(),
);

export const nativeTokenBalance$ = appTick$.pipe(
switchMap(() => from(ergo.get_balance(ERG_TOKEN_NAME))),
exhaustMap(() => from(ergo.get_balance(ERG_TOKEN_NAME))),
map((balance) => renderFractions(balance, ERG_DECIMALS)),
publishReplay(1),
refCount(),
Expand Down

0 comments on commit 6972246

Please sign in to comment.