Skip to content

Commit

Permalink
Merge branch 'main' into test/add_e2e_maintenance_script
Browse files Browse the repository at this point in the history
  • Loading branch information
ljagiela committed Jan 3, 2025
2 parents 4b1a669 + 079d93d commit cbc806b
Show file tree
Hide file tree
Showing 45 changed files with 410 additions and 119 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ jobs:
" > environment.properties
- name: Publish allure report to S3
uses: andrcuns/allure-publish-action@v2.7.1
uses: andrcuns/allure-publish-action@v2.9.0
if: always()
env:
GITHUB_AUTH_TOKEN: ${{ secrets.GH_TOKEN }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/e2e-tests-linux-split.yml
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ jobs:
" > environment.properties
- name: Publish allure report to S3
uses: andrcuns/allure-publish-action@v2.7.1
uses: andrcuns/allure-publish-action@v2.9.0
env:
GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.E2E_AWS_ACCESS_KEY_ID }}
Expand All @@ -287,7 +287,7 @@ jobs:
echo "https://${{ secrets.E2E_REPORTS_USER }}:${{ secrets.E2E_REPORTS_PASSWORD }}@${{ secrets.E2E_REPORTS_URL }}/all/linux/${{ env.BROWSER }}/${{ env.RUN }}/index.html | browser: ${{ env.BROWSER }} | network: ${{ env.NETWORK }} | platform: linux | tags: ${{ needs.setup.outputs.tags }} | smoke only: ${{ needs.setup.outputs.smoke_only }}" >> $GITHUB_STEP_SUMMARY
- name: Slack Notification
uses: rtCamp/[email protected].0
uses: rtCamp/[email protected].2
env:
SLACK_COLOR: "${{ contains(needs.*.result, 'failure') && 'failure' || 'good' }}"
SLACK_ICON_EMOJI: ':lace:'
Expand Down
2 changes: 1 addition & 1 deletion apps/browser-extension-wallet/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "$WALLET_MANIFEST_NAME",
"description": "One fast, accessible, and secure platform for digital assets, DApps, NFTs, and DeFi.",
"version": "1.18.0",
"version": "1.18.1",
"manifest_version": 3,
"key": "$LACE_EXTENSION_KEY",
"icons": {
Expand Down
8 changes: 4 additions & 4 deletions apps/browser-extension-wallet/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lace/browser-extension-wallet",
"version": "1.18.0",
"version": "1.18.1",
"description": "A fully capable wallet packaged as browser extensions for Chrome, Firefox, and Edge",
"homepage": "https://github.com/input-output-hk/lace/blob/master/apps/browser-extension-wallet/README.md",
"bugs": {
Expand Down Expand Up @@ -41,15 +41,15 @@
},
"dependencies": {
"@ant-design/icons": "^4.7.0",
"@cardano-sdk/cardano-services-client": "0.23.2",
"@cardano-sdk/cardano-services-client": "0.23.3",
"@cardano-sdk/core": "0.42.1",
"@cardano-sdk/dapp-connector": "0.12.47",
"@cardano-sdk/input-selection": "0.13.31",
"@cardano-sdk/tx-construction": "0.23.0",
"@cardano-sdk/util": "0.15.5",
"@cardano-sdk/util-rxjs": "0.8.0",
"@cardano-sdk/wallet": "0.46.2",
"@cardano-sdk/web-extension": "0.36.1",
"@cardano-sdk/wallet": "0.46.3",
"@cardano-sdk/web-extension": "0.36.2",
"@emurgo/cip14-js": "~3.0.1",
"@input-output-hk/lace-ui-toolkit": "1.21.0",
"@lace/cardano": "0.1.0",
Expand Down
14 changes: 11 additions & 3 deletions apps/browser-extension-wallet/src/lib/scripts/background/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ export const getProviders = async (chainName: Wallet.ChainName): Promise<Wallet.
const baseCardanoServicesUrl = getBaseUrlForChain(chainName);
const magic = getMagicForChain(chainName);
const { customSubmitTxUrl, featureFlags } = await getBackgroundStorage();
const useWebSocket = !!(featureFlags?.[magic]?.[ExperimentName.WEBSOCKET_API] ?? false);
const useBlockfrostAssetProvider = !!(featureFlags?.[magic]?.[ExperimentName.BLOCKFROST_ASSET_PROVIDER] ?? false);
const isExperimentEnabled = (experimentName: ExperimentName) => !!(featureFlags?.[magic]?.[experimentName] ?? false);

return Wallet.createProviders({
axiosAdapter: axiosFetchAdapter,
Expand All @@ -58,7 +57,16 @@ export const getProviders = async (chainName: Wallet.ChainName): Promise<Wallet.
}
},
logger,
experiments: { useWebSocket, useBlockfrostAssetProvider }
experiments: {
useDrepProviderOverrideActiveStatus: isExperimentEnabled(ExperimentName.USE_DREP_PROVIDER_OVERRIDE),
useWebSocket: isExperimentEnabled(ExperimentName.WEBSOCKET_API),
useBlockfrostAssetProvider: isExperimentEnabled(ExperimentName.BLOCKFROST_ASSET_PROVIDER),
useBlockfrostChainHistoryProvider: isExperimentEnabled(ExperimentName.BLOCKFROST_CHAIN_HISTORY_PROVIDER),
useBlockfrostNetworkInfoProvider: isExperimentEnabled(ExperimentName.BLOCKFROST_NETWORK_INFO_PROVIDER),
useBlockfrostRewardsProvider: isExperimentEnabled(ExperimentName.BLOCKFROST_REWARDS_PROVIDER),
useBlockfrostTxSubmitProvider: isExperimentEnabled(ExperimentName.BLOCKFROST_TX_SUBMIT_PROVIDER),
useBlockfrostUtxoProvider: isExperimentEnabled(ExperimentName.BLOCKFROST_UTXO_PROVIDER)
}
});
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ export const getDefaultFeatureFlags = (): FallbackConfiguration => ({
[ExperimentName.SHARED_WALLETS]: false,
[ExperimentName.WEBSOCKET_API]: false,
[ExperimentName.BLOCKFROST_ASSET_PROVIDER]: false,
[ExperimentName.EXTENSION_STORAGE]: false
[ExperimentName.BLOCKFROST_CHAIN_HISTORY_PROVIDER]: false,
[ExperimentName.BLOCKFROST_NETWORK_INFO_PROVIDER]: false,
[ExperimentName.BLOCKFROST_REWARDS_PROVIDER]: false,
[ExperimentName.BLOCKFROST_TX_SUBMIT_PROVIDER]: false,
[ExperimentName.BLOCKFROST_UTXO_PROVIDER]: false,
[ExperimentName.EXTENSION_STORAGE]: false,
[ExperimentName.USE_DREP_PROVIDER_OVERRIDE]: false
});

export const experiments: ExperimentsConfig = {
Expand Down Expand Up @@ -35,8 +41,32 @@ export const experiments: ExperimentsConfig = {
value: false,
default: false
},
[ExperimentName.BLOCKFROST_CHAIN_HISTORY_PROVIDER]: {
value: false,
default: false
},
[ExperimentName.BLOCKFROST_NETWORK_INFO_PROVIDER]: {
value: false,
default: false
},
[ExperimentName.BLOCKFROST_REWARDS_PROVIDER]: {
value: false,
default: false
},
[ExperimentName.BLOCKFROST_TX_SUBMIT_PROVIDER]: {
value: false,
default: false
},
[ExperimentName.BLOCKFROST_UTXO_PROVIDER]: {
value: false,
default: false
},
[ExperimentName.EXTENSION_STORAGE]: {
value: false,
default: false
},
[ExperimentName.USE_DREP_PROVIDER_OVERRIDE]: {
value: false,
default: false
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ export enum ExperimentName {
SHARED_WALLETS = 'shared-wallets',
WEBSOCKET_API = 'websocket-api',
BLOCKFROST_ASSET_PROVIDER = 'blockfrost-asset-provider',
EXTENSION_STORAGE = 'extension-storage'
BLOCKFROST_CHAIN_HISTORY_PROVIDER = 'blockfrost-chain-history-provider',
BLOCKFROST_NETWORK_INFO_PROVIDER = 'blockfrost-network-info-provider',
BLOCKFROST_REWARDS_PROVIDER = 'blockfrost-rewards-provider',
BLOCKFROST_TX_SUBMIT_PROVIDER = 'blockfrost-tx-submit-provider',
BLOCKFROST_UTXO_PROVIDER = 'blockfrost-utxo-provider',
EXTENSION_STORAGE = 'extension-storage',
USE_DREP_PROVIDER_OVERRIDE = 'use-drep-provider-override'
}

interface FeatureFlag {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@ type FeatureFlag =
| 'use-switch-to-nami-mode'
| 'websocket-api'
| ExperimentName.BLOCKFROST_ASSET_PROVIDER
| ExperimentName.EXTENSION_STORAGE;
| ExperimentName.BLOCKFROST_CHAIN_HISTORY_PROVIDER
| ExperimentName.BLOCKFROST_NETWORK_INFO_PROVIDER
| ExperimentName.BLOCKFROST_REWARDS_PROVIDER
| ExperimentName.BLOCKFROST_TX_SUBMIT_PROVIDER
| ExperimentName.BLOCKFROST_UTXO_PROVIDER
| ExperimentName.EXTENSION_STORAGE
| ExperimentName.USE_DREP_PROVIDER_OVERRIDE;

type FeatureFlags = {
[key in FeatureFlag]: boolean;
Expand Down
8 changes: 4 additions & 4 deletions packages/cardano/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@
"watch": "yarn build --watch"
},
"dependencies": {
"@cardano-sdk/cardano-services-client": "0.23.2",
"@cardano-sdk/cardano-services-client": "0.23.3",
"@cardano-sdk/core": "0.42.1",
"@cardano-sdk/crypto": "0.1.32",
"@cardano-sdk/hardware-ledger": "0.12.16",
"@cardano-sdk/hardware-trezor": "0.6.15",
"@cardano-sdk/key-management": "0.24.13",
"@cardano-sdk/tx-construction": "0.23.0",
"@cardano-sdk/util": "0.15.5",
"@cardano-sdk/wallet": "0.46.2",
"@cardano-sdk/web-extension": "0.36.1",
"@cardano-sdk/wallet": "0.46.3",
"@cardano-sdk/web-extension": "0.36.2",
"@lace/common": "0.1.0",
"@ledgerhq/devices": "^8.4.4",
"@stablelib/chacha20poly1305": "1.0.1",
Expand All @@ -73,7 +73,7 @@
},
"devDependencies": {
"@blockfrost/blockfrost-js": "^5.5.0",
"@cardano-sdk/util-dev": "0.24.1",
"@cardano-sdk/util-dev": "0.24.2",
"@emurgo/cardano-message-signing-browser": "1.0.1",
"@types/webextension-polyfill": "0.10.0",
"axios": "^1.7.4",
Expand Down
82 changes: 72 additions & 10 deletions packages/cardano/src/wallet/lib/providers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable no-new */
/* eslint-disable no-new, complexity, sonarjs/cognitive-complexity */
import { WalletProvidersDependencies } from '@src/wallet';
import { AxiosAdapter } from 'axios';
import { Logger } from 'ts-log';
Expand All @@ -15,6 +15,7 @@ import {
TxSubmitProvider,
UtxoProvider
} from '@cardano-sdk/core';
import type { DRepInfo } from '@cardano-sdk/core';

import {
CardanoWsClient,
Expand All @@ -31,7 +32,12 @@ import {
RateLimiter,
BlockfrostClient,
BlockfrostAssetProvider,
BlockfrostDRepProvider
BlockfrostChainHistoryProvider,
BlockfrostDRepProvider,
BlockfrostUtxoProvider,
BlockfrostRewardsProvider,
BlockfrostTxSubmitProvider,
BlockfrostNetworkInfoProvider
} from '@cardano-sdk/cardano-services-client';
import { RemoteApiProperties, RemoteApiPropertyType } from '@cardano-sdk/web-extension';

Expand Down Expand Up @@ -81,6 +87,12 @@ export interface ProvidersConfig {
experiments: {
useWebSocket?: boolean;
useBlockfrostAssetProvider?: boolean;
useDrepProviderOverrideActiveStatus?: boolean;
useBlockfrostChainHistoryProvider?: boolean;
useBlockfrostNetworkInfoProvider?: boolean;
useBlockfrostRewardsProvider?: boolean;
useBlockfrostTxSubmitProvider?: boolean;
useBlockfrostUtxoProvider?: boolean;
};
}

Expand All @@ -94,7 +106,16 @@ export const createProviders = ({
axiosAdapter,
env: { baseCardanoServicesUrl: baseUrl, customSubmitTxUrl, blockfrostConfig },
logger,
experiments: { useBlockfrostAssetProvider, useWebSocket }
experiments: {
useBlockfrostAssetProvider,
useBlockfrostChainHistoryProvider,
useBlockfrostNetworkInfoProvider,
useBlockfrostRewardsProvider,
useBlockfrostTxSubmitProvider,
useBlockfrostUtxoProvider,
useDrepProviderOverrideActiveStatus,
useWebSocket
}
}: ProvidersConfig): WalletProvidersDependencies => {
if (!logger) logger = console;

Expand All @@ -106,12 +127,49 @@ export const createProviders = ({
const assetProvider = useBlockfrostAssetProvider
? new BlockfrostAssetProvider(blockfrostClient, logger)
: assetInfoHttpProvider(httpProviderConfig);
const chainHistoryProvider = chainHistoryHttpProvider(httpProviderConfig);
const rewardsProvider = rewardsHttpProvider(httpProviderConfig);
const networkInfoProvider = useBlockfrostNetworkInfoProvider
? new BlockfrostNetworkInfoProvider(blockfrostClient, logger)
: networkInfoHttpProvider(httpProviderConfig);
const chainHistoryProvider = useBlockfrostChainHistoryProvider
? new BlockfrostChainHistoryProvider(blockfrostClient, networkInfoProvider, logger)
: chainHistoryHttpProvider(httpProviderConfig);
const rewardsProvider = useBlockfrostRewardsProvider
? new BlockfrostRewardsProvider(blockfrostClient, logger)
: rewardsHttpProvider(httpProviderConfig);
const stakePoolProvider = stakePoolHttpProvider(httpProviderConfig);
const txSubmitProvider = createTxSubmitProvider(httpProviderConfig, customSubmitTxUrl);
const txSubmitProvider = useBlockfrostTxSubmitProvider
? new BlockfrostTxSubmitProvider(blockfrostClient, logger)
: createTxSubmitProvider(httpProviderConfig, customSubmitTxUrl);
const drepProvider = new BlockfrostDRepProvider(blockfrostClient, logger);

// Temporary proxy for drepProvider to overwrite the 'active' property to always be true
const drepProviderOverrideActiveStatus = new Proxy(drepProvider, {
get(target, property, receiver) {
const original = Reflect.get(target, property, receiver);
if (property === 'getDRepInfo') {
return async function (...args: any[]) {
const response: DRepInfo = await original.apply(target, args);
return {
...response,
active: true
};
};
}

if (property === 'getDRepsInfo') {
return async function (...args: any[]) {
const response: DRepInfo[] = await original.apply(target, args);
return response.map((drepInfo) => ({
...drepInfo,
active: true
}));
};
}

return original;
}
});

if (useWebSocket) {
const url = new URL(baseUrl);

Expand All @@ -133,19 +191,23 @@ export const createProviders = ({
chainHistoryProvider: wsProvider.chainHistoryProvider,
rewardsProvider,
wsProvider,
drepProvider
drepProvider: useDrepProviderOverrideActiveStatus ? drepProviderOverrideActiveStatus : drepProvider
};
}

const utxoProvider = useBlockfrostUtxoProvider
? new BlockfrostUtxoProvider(blockfrostClient, logger)
: utxoHttpProvider(httpProviderConfig);

return {
assetProvider,
networkInfoProvider: networkInfoHttpProvider(httpProviderConfig),
networkInfoProvider,
txSubmitProvider,
stakePoolProvider,
utxoProvider: utxoHttpProvider(httpProviderConfig),
utxoProvider,
chainHistoryProvider,
rewardsProvider,
drepProvider
drepProvider: useDrepProviderOverrideActiveStatus ? drepProviderOverrideActiveStatus : drepProvider
};
};

Expand Down
4 changes: 2 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
},
"dependencies": {
"@ant-design/icons": "^4.7.0",
"@cardano-sdk/wallet": "0.46.2",
"@cardano-sdk/web-extension": "0.36.1",
"@cardano-sdk/wallet": "0.46.3",
"@cardano-sdk/web-extension": "0.36.2",
"@input-output-hk/lace-ui-toolkit": "1.19.0",
"@lace/cardano": "0.1.0",
"@lace/common": "0.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ class AddressFormAssert {
};

async assertSeeIconForInvalidAdaHandle(shouldBeDisplayed: boolean) {
await AddressForm.searchLoader.waitForClickable({ reverse: true, timeout: 5000 });
await AddressForm.searchLoader.waitForClickable({ reverse: true, timeout: 10_000 });
await AddressForm.adaHandleIconInvalid.waitForClickable({ reverse: !shouldBeDisplayed });
}

async assertSeeIconForValidAdaHandle(shouldBeDisplayed: boolean) {
await AddressForm.searchLoader.waitForClickable({ reverse: true, timeout: 5000 });
await AddressForm.searchLoader.waitForClickable({ reverse: true, timeout: 10_000 });
await AddressForm.adaHandleIconValid.waitForClickable({ reverse: !shouldBeDisplayed });
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import DelegateYourVotingPowerBanner from '../../elements/multidelegation/DelegateYourVotingPowerBanner';
import { expect } from 'chai';
import { t } from '../../utils/translationService';

class DelegateYourVotingPowerBannerAssert {
assertSeeDelegateYourVotingPowerBanner = async (shouldBeDisplayed: boolean) => {
await DelegateYourVotingPowerBanner.container.waitForDisplayed({ reverse: !shouldBeDisplayed });
if (shouldBeDisplayed) {
await DelegateYourVotingPowerBanner.title.waitForDisplayed();
expect(await DelegateYourVotingPowerBanner.title.getText()).to.equal(
await t('browserView.staking.stakingInfo.RegisterAsDRepBanner.title')
);
await DelegateYourVotingPowerBanner.description.waitForDisplayed();
const expectedDescription = (await t('browserView.staking.stakingInfo.RegisterAsDRepBanner.description'))
.replace('<a>', '')
.replace('</a>', '');
expect(await DelegateYourVotingPowerBanner.description.getText()).to.equal(expectedDescription);
await DelegateYourVotingPowerBanner.knowMoreLink.waitForDisplayed();
await DelegateYourVotingPowerBanner.registerButton.waitForEnabled();
expect(await DelegateYourVotingPowerBanner.registerButton.getText()).to.equal(
await t('browserView.staking.stakingInfo.RegisterAsDRepBanner.cta')
);
}
};
}

export default new DelegateYourVotingPowerBannerAssert();
Loading

0 comments on commit cbc806b

Please sign in to comment.