Skip to content

Commit

Permalink
Merge branch 'refs/heads/main' into e2e-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
oldGreg5 committed May 13, 2024
2 parents 6003d46 + 38e0c41 commit 57a0440
Show file tree
Hide file tree
Showing 21 changed files with 250 additions and 308 deletions.
14 changes: 7 additions & 7 deletions apps/browser-extension-wallet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@
},
"dependencies": {
"@ant-design/icons": "^4.7.0",
"@cardano-sdk/cardano-services-client": "0.19.2",
"@cardano-sdk/core": "0.30.2",
"@cardano-sdk/dapp-connector": "0.12.16",
"@cardano-sdk/input-selection": "0.12.29",
"@cardano-sdk/tx-construction": "0.18.5",
"@cardano-sdk/cardano-services-client": "0.19.3",
"@cardano-sdk/core": "0.31.0",
"@cardano-sdk/dapp-connector": "0.12.17",
"@cardano-sdk/input-selection": "0.12.30",
"@cardano-sdk/tx-construction": "0.18.6",
"@cardano-sdk/util": "0.15.1",
"@cardano-sdk/wallet": "0.37.3",
"@cardano-sdk/web-extension": "0.27.3",
"@cardano-sdk/wallet": "0.37.4",
"@cardano-sdk/web-extension": "0.27.4",
"@emurgo/cip14-js": "~3.0.1",
"@lace/cardano": "0.1.0",
"@lace/common": "0.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,41 @@ import { BlockchainProviderSlice, SliceCreator, StakePoolSearchSlice, StateStatu

const defaultFetchLimit = 100;

export const getQueryStakePoolsFilters = ({
searchString,
skip = 0,
limit = defaultFetchLimit,
sort
}: Parameters<StakePoolSearchSlice['fetchStakePools']>[0]): Wallet.QueryStakePoolsArgs => {
let filtersValues: Wallet.QueryStakePoolsArgs['filters'] = {};
try {
const poolId: Wallet.Cardano.PoolId = Wallet.Cardano.PoolId(searchString);
filtersValues = {
identifier: {
values: [{ id: poolId }]
}
};
} catch {
filtersValues = { text: searchString };
}
return {
filters: {
...filtersValues,
pledgeMet: true,
status: [
Wallet.Cardano.StakePoolStatus.Active,
Wallet.Cardano.StakePoolStatus.Activating,
Wallet.Cardano.StakePoolStatus.Retiring
]
},
pagination: {
startAt: skip,
limit: limit - skip + 1
},
...(sort && { sort })
};
};

const fetchStakePools =
({
set,
Expand All @@ -18,34 +53,8 @@ const fetchStakePools =
} = get().stakePoolSearchResults || {};
set({ stakePoolSearchResultsStatus: StateStatus.LOADING });

let filtersValues = [];
try {
const poolId: Wallet.Cardano.PoolId = Wallet.Cardano.PoolId(searchString);
filtersValues = [{ id: poolId }];
} catch {
filtersValues = [{ name: searchString }, { ticker: searchString }];
}
const filters: Wallet.QueryStakePoolsArgs = {
filters: {
...(searchString && {
identifier: {
_condition: 'or',
values: filtersValues
}
}),
pledgeMet: true,
status: [
Wallet.Cardano.StakePoolStatus.Active,
Wallet.Cardano.StakePoolStatus.Activating,
Wallet.Cardano.StakePoolStatus.Retiring
]
},
pagination: {
startAt: skip,
limit: limit - skip + 1
},
sort
};
const filters = getQueryStakePoolsFilters({ searchString, skip, limit, sort });

const { totalResultCount, pageResults } = await get().blockchainProvider.stakePoolProvider.queryStakePools(filters);

const paginating = isEqual(prevSort, sort) && prevTotalCount === totalResultCount;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ $container-width: 840px;
max-height: 584px;
width: 100%;
height: 100%;
min-width: 650px;
overflow: auto;
}
:global(.ant-modal-body) {
padding: 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Wallet } from '@lace/cardano';
import { getQueryStakePoolsFilters } from '@src/stores/slices';

export const fetchPoolsInfo = async ({
searchString = '',
Expand All @@ -7,26 +8,8 @@ export const fetchPoolsInfo = async ({
searchString: string;
stakePoolProvider: Wallet.StakePoolProvider;
}): Promise<Wallet.StakePoolSearchResults['pageResults']> => {
const filters: Wallet.QueryStakePoolsArgs = {
filters: {
...(searchString && {
identifier: {
_condition: 'or',
values: [{ name: searchString }, { ticker: searchString }, { id: Wallet.Cardano.PoolId(searchString) }]
}
}),
pledgeMet: true,
status: [
Wallet.Cardano.StakePoolStatus.Active,
Wallet.Cardano.StakePoolStatus.Activating,
Wallet.Cardano.StakePoolStatus.Retiring
]
},
pagination: {
startAt: 0,
limit: 100
}
};
const filters = getQueryStakePoolsFilters({ searchString });

const { pageResults: pools } = await stakePoolProvider.queryStakePools(filters);

return pools;
Expand Down
16 changes: 8 additions & 8 deletions packages/cardano/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@
"watch": "yarn build --watch"
},
"dependencies": {
"@cardano-sdk/cardano-services-client": "0.19.2",
"@cardano-sdk/core": "0.30.2",
"@cardano-sdk/cardano-services-client": "0.19.3",
"@cardano-sdk/core": "0.31.0",
"@cardano-sdk/crypto": "0.1.23",
"@cardano-sdk/hardware-ledger": "0.9.3",
"@cardano-sdk/hardware-trezor": "0.4.23",
"@cardano-sdk/key-management": "0.20.3",
"@cardano-sdk/hardware-ledger": "0.9.4",
"@cardano-sdk/hardware-trezor": "0.4.24",
"@cardano-sdk/key-management": "0.20.4",
"@cardano-sdk/util": "0.15.1",
"@cardano-sdk/wallet": "0.37.3",
"@cardano-sdk/web-extension": "0.27.3",
"@cardano-sdk/wallet": "0.37.4",
"@cardano-sdk/web-extension": "0.27.4",
"@lace/common": "0.1.0",
"@ledgerhq/devices": "^8.2.1",
"@stablelib/chacha20poly1305": "1.0.1",
Expand All @@ -68,7 +68,7 @@
"webextension-polyfill": "0.8.0"
},
"devDependencies": {
"@cardano-sdk/util-dev": "0.20.2",
"@cardano-sdk/util-dev": "0.20.3",
"@emurgo/cardano-message-signing-browser": "1.0.1",
"rollup-plugin-polyfill-node": "^0.8.0",
"typescript": "^4.9.5"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
width: 204px;
border-right: 1px solid var(--light-mode-light-grey-plus, var(--dark-mode-mid-grey));
margin: size_unit(5) 0;
min-width: 200px;

.activeText {
@include text-bodySmall-semi-bold;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ class MultidelegationPageAssert {
expect(poolsCounter).to.equal(poolsCount);
};

assertSeeSearchResultsCountExact = async (items: number) => {
await browser.waitUntil(async () => (await MultidelegationPage.displayedPools.length) === items, {
assertSeeSearchResultsCountGreaterOrEqual = async (expectedPoolsCount: number) => {
await browser.waitUntil(async () => (await MultidelegationPage.displayedPools.length) >= expectedPoolsCount, {
timeout: 20_000,
timeoutMsg: `Search result does not match exact items count expected: ${items}`
timeoutMsg: `There should be ${expectedPoolsCount} or more stake pools returned`
});
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ class MultidelegationPage {
});
for (const ticker of poolsToMark) {
await this.fillSearch(ticker);
await MultidelegationPageAssert.assertSeeSearchResultsCountExact(1);
await MultidelegationPageAssert.assertSeeSearchResultsCountGreaterOrEqual(1);
await this.markStakePoolWithTicker(ticker);
await this.stakingPageSearchInput.click();
await clearInputFieldValue(await this.stakingPageSearchInput);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Feature: Staking Page - Extended View
And I switch to list view on "Browse pools" tab
Then I see the stake pool search control with appropriate content

# TODO: update to match LW-10410 when ready
@LW-8448 @Testnet
Scenario Outline: Extended View - Stake pool search for "<stake_pool_search_term>" returns the expected number of results <number_of_results> with appropriate content
When I navigate to Staking extended page
Expand All @@ -37,14 +38,14 @@ Feature: Staking Page - Extended View
And (if applicable) first stake pool search result has "<stake_pool_ticker>" ticker
Examples:
| stake_pool_search_term | number_of_results | stake_pool_ticker |
| a Ocean | 1 | OCEAN |
| a ocean | 1 | OCEAN |
| NED# | 0 | |
| PAN | 1 | PANL |
| a Ocean | 3 | OCEAN |
| a ocean | 3 | OCEAN |
| ABC# | 0 | |
| HUA | 1 | HUADA |
| 123456 | 0 | |
| WO | 2 | WOOF |
| ZZZ | 2 | ZZZZX |
| £££ | 0 | |
| Amso | 0 | |
| Abcde | 0 | |

@LW-8448 @Mainnet
Scenario Outline: Extended View - Stake pool search for "<stake_pool_search_term>" returns the expected number of results <number_of_results> with appropriate content
Expand Down
18 changes: 9 additions & 9 deletions packages/staking/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@
},
"devDependencies": {
"@babel/core": "^7.21.0",
"@cardano-sdk/core": "0.30.2",
"@cardano-sdk/input-selection": "0.12.29",
"@cardano-sdk/tx-construction": "0.18.5",
"@cardano-sdk/core": "0.31.0",
"@cardano-sdk/input-selection": "0.12.30",
"@cardano-sdk/tx-construction": "0.18.6",
"@cardano-sdk/util": "0.15.1",
"@cardano-sdk/wallet": "0.37.3",
"@cardano-sdk/web-extension": "0.27.3",
"@cardano-sdk/wallet": "0.37.4",
"@cardano-sdk/web-extension": "0.27.4",
"@storybook/addon-actions": "^7.6.7",
"@storybook/addon-essentials": "^7.6.7",
"@storybook/addon-interactions": "^7.6.7",
Expand Down Expand Up @@ -123,11 +123,11 @@
"wait-on": "^7.0.1"
},
"peerDependencies": {
"@cardano-sdk/input-selection": "0.12.29",
"@cardano-sdk/tx-construction": "0.18.5",
"@cardano-sdk/input-selection": "0.12.30",
"@cardano-sdk/tx-construction": "0.18.6",
"@cardano-sdk/util": "0.15.1",
"@cardano-sdk/wallet": "0.37.3",
"@cardano-sdk/web-extension": "0.27.3",
"@cardano-sdk/wallet": "0.37.4",
"@cardano-sdk/web-extension": "0.27.4",
"@lace/cardano": "^0.1.0",
"@lace/common": "^0.1.0",
"@lace/core": "0.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/staking/src/features/BrowsePools/BrowsePools.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const BrowsePools = () => {
showSkeleton={fetching}
loadMoreData={paginatePools}
scrollableTargetId={LACE_APP_ID}
sortField={sort.field}
sortField={sort?.field}
/>
) : (
<StakePoolsList
Expand Down
Loading

0 comments on commit 57a0440

Please sign in to comment.