Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/shared/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ inputs:
LACE_EXTENSION_KEY:
description: 'Public extended manifest key'
required: true
CARDANO_SERVICES_URL_MAINNET:
description: 'Cardano Services Mainnet URL'
required: false
CARDANO_SERVICES_URL_PREPROD:
description: 'Cardano Services Preprod URL'
required: false
CARDANO_SERVICES_URL_PREVIEW:
description: 'Cardano Services Preview URL'
required: false
runs:
using: 'composite'
steps:
Expand All @@ -26,4 +35,7 @@ runs:
shell: bash
env:
LACE_EXTENSION_KEY: ${{ inputs.LACE_EXTENSION_KEY }}
CARDANO_SERVICES_URL_MAINNET: ${{ inputs.CARDANO_SERVICES_URL_MAINNET }}
CARDANO_SERVICES_URL_PREPROD: ${{ inputs.CARDANO_SERVICES_URL_PREPROD }}
CARDANO_SERVICES_URL_PREVIEW: ${{ inputs.CARDANO_SERVICES_URL_PREVIEW }}
run: yarn browser build
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
run: yarn lint
- name: Run unit tests, generate test coverage report
env:
AVAILABLE_CHAINS: 'Preprod,Preview,Mainnet'
AVAILABLE_CHAINS: 'Preprod,Preview,Mainnet,Sanchonet'
DEFAULT_CHAIN: 'Preprod'
run: yarn test:coverage --maxWorkers=2
- name: Upload build
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/e2e-tests-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ jobs:
uses: ./.github/shared/build
with:
LACE_EXTENSION_KEY: ${{ secrets.MANIFEST_PUBLIC_KEY }}
CARDANO_SERVICES_URL_MAINNET: ${{ secrets.CARDANO_SERVICES_URL_MAINNET }}
CARDANO_SERVICES_URL_PREPROD: ${{ secrets.CARDANO_SERVICES_URL_PREPROD }}
CARDANO_SERVICES_URL_PREVIEW: ${{ secrets.CARDANO_SERVICES_URL_PREVIEW }}
- name: Start XVFB
run: |
Xvfb :99 &
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/smoke-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ jobs:
uses: ./.github/shared/build
with:
LACE_EXTENSION_KEY: ${{ secrets.MANIFEST_PUBLIC_KEY }}
CARDANO_SERVICES_URL_MAINNET: ${{ secrets.CARDANO_SERVICES_URL_MAINNET }}
CARDANO_SERVICES_URL_PREPROD: ${{ secrets.CARDANO_SERVICES_URL_PREPROD }}
CARDANO_SERVICES_URL_PREVIEW: ${{ secrets.CARDANO_SERVICES_URL_PREVIEW }}
- name: Start XVFB
run: |
Xvfb :99 &
Expand Down
9 changes: 7 additions & 2 deletions apps/browser-extension-wallet/.env.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ DEFAULT_CHAIN=Mainnet
WALLET_SYNC_TIMEOUT_IN_SEC=60
WALLET_INTERVAL_IN_SEC=30
DROP_CONSOLE_IN_PRODUCTION=false
AVAILABLE_CHAINS=Preprod,Preview,Mainnet
AVAILABLE_CHAINS=Preprod,Preview,Mainnet,Sanchonet
ADA_PRICE_POLLING_IN_SEC=60
SAVED_PRICE_DURATION_IN_MINUTES=720

Expand Down Expand Up @@ -53,17 +53,22 @@ PRODUCTION_MODE_TRACKING=false
CARDANO_SERVICES_URL_MAINNET=https://backend.live-mainnet.eks.lw.iog.io
CARDANO_SERVICES_URL_PREPROD=https://backend.live-preprod.eks.lw.iog.io
CARDANO_SERVICES_URL_PREVIEW=https://backend.live-preview.eks.lw.iog.io
# TODO: update this with a valid sanchonet url
CARDANO_SERVICES_URL_SANCHONET=https://backend.live-preprod.eks.lw.iog.io

# Explorer URLs
CEXPLORER_URL_MAINNET=https://cexplorer.io
CEXPLORER_URL_PREVIEW=https://preview.cexplorer.io
CEXPLORER_URL_PREPROD=https://preprod.cexplorer.io
CEXPLORER_URL_TESTNET=https://testnet.cexplorer.io
# TODO: update this with a valid sanchonet cexplorer
CEXPLORER_URL_SANCHONET=https://preprod.cexplorer.io

# ADA Handle URLs
ADA_HANDLE_URL_MAINNET=https://api.handle.me
ADA_HANDLE_URL_PREVIEW=https://preview.api.handle.me
ADA_HANDLE_URL_PREPROD=https://preprod.api.handle.me
# TODO: update this with a valid sanchonet url
ADA_HANDLE_URL_SANCHONET=https://preprod.api.handle.me

# Manifest.json
LACE_EXTENSION_KEY=gafhhkghbfjjkeiendhlofajokpaflmk
Expand Down
9 changes: 7 additions & 2 deletions apps/browser-extension-wallet/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ DEFAULT_CHAIN=Mainnet
WALLET_SYNC_TIMEOUT_IN_SEC=60
WALLET_INTERVAL_IN_SEC=30
DROP_CONSOLE_IN_PRODUCTION=false
AVAILABLE_CHAINS=Preprod,Preview,Mainnet
AVAILABLE_CHAINS=Preprod,Preview,Mainnet,Sanchonet
ADA_PRICE_POLLING_IN_SEC=60
SAVED_PRICE_DURATION_IN_MINUTES=720

Expand Down Expand Up @@ -53,17 +53,22 @@ POSTHOG_EXCLUDED_EVENTS=
CARDANO_SERVICES_URL_MAINNET=https://backend.live-mainnet.eks.lw.iog.io
CARDANO_SERVICES_URL_PREPROD=https://backend.live-preprod.eks.lw.iog.io
CARDANO_SERVICES_URL_PREVIEW=https://backend.live-preview.eks.lw.iog.io
# TODO: update this with a valid sanchonet url
CARDANO_SERVICES_URL_SANCHONET=https://backend.live-preprod.eks.lw.iog.io

# Explorer URLs
CEXPLORER_URL_MAINNET=https://cexplorer.io
CEXPLORER_URL_PREVIEW=https://preview.cexplorer.io
CEXPLORER_URL_PREPROD=https://preprod.cexplorer.io
CEXPLORER_URL_TESTNET=https://testnet.cexplorer.io
# TODO: update this with a valid sanchonet cexplorer
CEXPLORER_URL_SANCHONET=https://preprod.cexplorer.io

# ADA Handle URLs
ADA_HANDLE_URL_MAINNET=https://api.handle.me
ADA_HANDLE_URL_PREVIEW=https://preview.api.handle.me
ADA_HANDLE_URL_PREPROD=https://preprod.api.handle.me
# TODO: update this with a valid sanchonet url
ADA_HANDLE_URL_SANCHONET=https://preprod.api.handle.me

# Manifest.json
LACE_EXTENSION_KEY=gafhhkghbfjjkeiendhlofajokpaflmk
16 changes: 8 additions & 8 deletions apps/browser-extension-wallet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@
},
"dependencies": {
"@ant-design/icons": "^4.7.0",
"@cardano-sdk/cardano-services-client": "0.12.2",
"@cardano-sdk/core": "0.19.1",
"@cardano-sdk/dapp-connector": "0.9.15",
"@cardano-sdk/input-selection": "0.11.9",
"@cardano-sdk/tx-construction": "0.11.2",
"@cardano-sdk/util": "0.14.0",
"@cardano-sdk/wallet": "0.21.1",
"@cardano-sdk/web-extension": "0.14.6",
"@cardano-sdk/cardano-services-client": "0.14.2",
"@cardano-sdk/core": "0.21.0",
"@cardano-sdk/dapp-connector": "0.11.1",
"@cardano-sdk/input-selection": "0.12.2",
"@cardano-sdk/tx-construction": "0.14.0",
"@cardano-sdk/util": "0.14.2",
"@cardano-sdk/wallet": "0.24.0",
"@cardano-sdk/web-extension": "0.16.1",
"@emurgo/cip14-js": "~3.0.1",
"@koralabs/handles-public-api-interfaces": "^1.6.6",
"@lace/cardano": "0.1.0",
Expand Down
13 changes: 8 additions & 5 deletions apps/browser-extension-wallet/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ type CardanoServiceUrls = {
Mainnet: string;
Preprod: string;
Preview: string;
Sanchonet: string;
};

type CExplorerUrlPaths = {
Expand Down Expand Up @@ -33,7 +34,8 @@ const envChecks = (chosenChain: Wallet.ChainName): void => {
if (
!process.env.CARDANO_SERVICES_URL_MAINNET ||
!process.env.CARDANO_SERVICES_URL_PREPROD ||
!process.env.CARDANO_SERVICES_URL_PREVIEW
!process.env.CARDANO_SERVICES_URL_PREVIEW ||
!process.env.CARDANO_SERVICES_URL_SANCHONET
) {
throw new Error('env vars not complete');
}
Expand All @@ -42,7 +44,7 @@ const envChecks = (chosenChain: Wallet.ChainName): void => {
!process.env.CEXPLORER_URL_MAINNET ||
!process.env.CEXPLORER_URL_PREVIEW ||
!process.env.CEXPLORER_URL_PREPROD ||
!process.env.CEXPLORER_URL_TESTNET
!process.env.CEXPLORER_URL_SANCHONET
) {
throw new Error('explorer vars not complete');
}
Expand Down Expand Up @@ -81,13 +83,14 @@ export const config = (): Config => {
CARDANO_SERVICES_URLS: {
Mainnet: process.env.CARDANO_SERVICES_URL_MAINNET,
Preprod: process.env.CARDANO_SERVICES_URL_PREPROD,
Preview: process.env.CARDANO_SERVICES_URL_PREVIEW
Preview: process.env.CARDANO_SERVICES_URL_PREVIEW,
Sanchonet: process.env.CARDANO_SERVICES_URL_SANCHONET
},
CEXPLORER_BASE_URL: {
Mainnet: `${process.env.CEXPLORER_URL_MAINNET}`,
LegacyTestnet: `${process.env.CEXPLORER_URL_TESTNET}`,
Preprod: `${process.env.CEXPLORER_URL_PREPROD}`,
Preview: `${process.env.CEXPLORER_URL_PREVIEW}`
Preview: `${process.env.CEXPLORER_URL_PREVIEW}`,
Sanchonet: `${process.env.CEXPLORER_URL_SANCHONET}`
},
CEXPLORER_URL_PATHS: {
Tx: 'tx',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ export const HANDLE_SERVER_URLS: Record<Cardano.NetworkMagics, string> = {
[Cardano.NetworkMagics.Mainnet]: 'https://api.handle.me',
[Cardano.NetworkMagics.Preprod]: 'https://preprod.api.handle.me',
[Cardano.NetworkMagics.Preview]: 'https://preview.api.handle.me',
[Cardano.NetworkMagics.Testnet]: ''
// TODO: update once there's a valid sanchonet version available
[Cardano.NetworkMagics.Sanchonet]: 'https://sanchonet.api.handle.me'
};
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const cardanoNetworkMap = {
Mainnet: Wallet.Cardano.NetworkMagics.Mainnet,
Preprod: Wallet.Cardano.NetworkMagics.Preprod,
Preview: Wallet.Cardano.NetworkMagics.Preview,
LegacyTestnet: Wallet.Cardano.NetworkMagics.Testnet
Sanchonet: Wallet.Cardano.NetworkMagics.Sanchonet
};

const handleRecordValidation = (list: AddressBookSchema[], record: AddressRecordParams) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,6 @@ describe('Connect Component: ', () => {
});
rerender(<WrappedConnectComponent />);
await waitFor(assert);

mockUseWalletStore.mockReturnValueOnce({
environmentName: 'LegacyTestnet'
});
rerender(<WrappedConnectComponent />);
await waitFor(assert);
});

test('should render default warning modal for any other than Mainnet env and https protocol', async () => {
Expand All @@ -125,12 +119,6 @@ describe('Connect Component: ', () => {
});
rerender(<WrappedConnectComponent />);
await waitFor(assert);

mockUseWalletStore.mockReturnValueOnce({
environmentName: 'LegacyTestnet'
});
rerender(<WrappedConnectComponent />);
await waitFor(assert);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const signedTx = {
cbor: '' as TxCBOR,
tx: { id: 'txId' } as Cardano.Tx,
context: {
handleResolutions: [],
handles: [] as HandleResolution[]
}
} as SignedTx;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jest.mock('../../stores', () => ({
}));

describe('Testing useBuildDelegation hook', () => {
process.env.AVAILABLE_CHAINS = process.env.AVAILABLE_CHAINS || 'Mainnet,Preprod,Preview';
process.env.AVAILABLE_CHAINS = process.env.AVAILABLE_CHAINS || 'Mainnet,Preprod,Preview,Sanchonet';
process.env.DEFAULT_CHAIN = process.env.DEFAULT_CHAIN || 'Preprod';

test('should return use delegation details function', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ describe('Testing useWalletManager hook', () => {
wallet,
name: 'name'
} as any;
const chainName = 'LegacyTestnet';
const chainName = 'Preprod';
const mnemonicVerificationFrequency = 'mnemonicVerificationFrequency';

jest.spyOn(stores, 'useWalletStore').mockImplementation(() => ({
Expand Down Expand Up @@ -621,7 +621,7 @@ describe('Testing useWalletManager hook', () => {
keyAgentsByChain,
...cardanoWallet
} as any;
const chainName = 'LegacyTestnet';
const chainName = 'Preprod';

const saveValueInLocalStorage = jest.fn();
jest.spyOn(localStorage, 'saveValueInLocalStorage').mockImplementation(saveValueInLocalStorage);
Expand Down Expand Up @@ -853,18 +853,6 @@ describe('Testing useWalletManager hook', () => {
expect(switchNetwork).toBeDefined();
await expect(switchNetwork(chainId)).rejects.toThrow(new Error('Chain not supported'));
});
test('shoud throw in case the chain is not available', async () => {
const chainId = 'LegacyTestnet' as any;
const {
result: {
current: { switchNetwork }
}
} = renderHook(() => useWalletManager(), {
wrapper: getWrapper({})
});
expect(switchNetwork).toBeDefined();
await expect(switchNetwork(chainId)).rejects.toThrow(new Error('Chain not supported'));
});
test('shoud throw in case the wallet data for chosen chain not found', async () => {
const chainId = 'Preprod' as any;
const keyAgentsByChain = {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,7 @@ export const getProviders = (chainName: Wallet.ChainName): Wallet.WalletProvider

return Wallet.createProviders({
axiosAdapter: axiosFetchAdapter,
httpProviders: {
assetProvider: `${baseCardanoServicesUrl}/asset`,
chainHistoryProvider: `${baseCardanoServicesUrl}/chain-history`,
networkInfoProvider: `${baseCardanoServicesUrl}/network-info`,
rewardsProvider: `${baseCardanoServicesUrl}/rewards`,
stakePoolProvider: `${baseCardanoServicesUrl}/stake-pool`,
txSubmitProvider: `${baseCardanoServicesUrl}/tx-submit`,
utxoProvider: `${baseCardanoServicesUrl}/utxo`
}
baseUrl: baseCardanoServicesUrl
});
};
export const ownOrigin = globalThis.location.origin;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BackgroundStorage } from '@lib/scripts/types';
import { mockKeyAgentsByChain } from '@src/utils/mocks/test-helpers';
import { SESSION_LENGTH, USER_ID_BYTE_SIZE, UserIdService } from '.';
import { SESSION_LENGTH, USER_ID_BYTE_SIZE, UserIdService } from './userIdService';
import * as utils from '../util';
import { UserTrackingType } from '@providers/AnalyticsProvider/analyticsTracker';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,6 @@ export const v0_6_0: Migration = {

// Generate keyAgentsDataByChain and save it in background storage
newKeyAgentsByChain = {
LegacyTestnet:
keyAgentStoredChainName === 'LegacyTestnet'
? { keyAgentData: newKeyAgentData }
: {
keyAgentData: {
...newKeyAgentData,
chainId: Wallet.Cardano.ChainIds.LegacyTestnet,
knownAddresses: []
}
},
Preprod:
keyAgentStoredChainName === 'Preprod'
? { keyAgentData: newKeyAgentData }
Expand All @@ -104,6 +94,12 @@ export const v0_6_0: Migration = {
? { keyAgentData: newKeyAgentData }
: {
keyAgentData: { ...newKeyAgentData, chainId: Wallet.Cardano.ChainIds.Mainnet, knownAddresses: [] }
},
Sanchonet:
keyAgentStoredChainName === 'Sanchonet'
? { keyAgentData: newKeyAgentData }
: {
keyAgentData: { ...newKeyAgentData, chainId: Wallet.Cardano.ChainIds.Sanchonet, knownAddresses: [] }
}
};

Expand Down
2 changes: 1 addition & 1 deletion apps/browser-extension-wallet/src/lib/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
"mainnet": "Mainnet",
"preprod": "Preprod",
"preview": "Preview",
"legacyTestnet": "Legacy Testnet",
"sanchonet": "Sanchonet",
"custom": "Custom",
"offline": "Offline",
"error": "Your internet connection is not working. You can still navigate the wallet based on the latest connection you had.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ export enum PostHogAction {
SettingsNetworkPreviewClick = 'settings | network | preview | click',
SettingsNetworkPreprodClick = 'settings | network | preprod | click',
SettingsNetworkMainnetClick = 'settings | network | mainnet | click',
SettingsNetworkSanchonetClick = 'settings | network | sanchonet | click',
SettingsNetworkXClick = 'settings | network | x | click',
SettingsAuthorizedDappsClick = 'settings | authorized dapps | click',
SettingsAuthorizedDappsTrashBinIconClick = 'settings | authorized dapps | trash bin icon | click',
Expand Down Expand Up @@ -179,6 +180,7 @@ export enum PostHogAction {
UserWalletProfileNetworkPreviewClick = 'user/wallet profile | network | preview | click',
UserWalletProfileNetworkPreprodClick = 'user/wallet profile | network | preprod | click',
UserWalletProfileNetworkMainnetClick = 'user/wallet profile | network | mainnet | click',
UserWalletProfileNetworkSanchonetClick = 'user/wallet profile | network | sanchonet | click',
UserWalletProfileLockWalletClick = 'user/wallet profile | lock wallet | click',
// Lace Logo
WalletLaceClick = 'wallet | lace | click',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ describe('Testing wallet info slice', () => {

describe('environment names set correctly', () => {
let useWalletInfoHook: UseStore<WalletInfoSlice>;
process.env.AVAILABLE_CHAINS = process.env.AVAILABLE_CHAINS || 'Mainnet,Preprod,Preview';
process.env.AVAILABLE_CHAINS = process.env.AVAILABLE_CHAINS || 'Mainnet,Preprod,Preview,Sanchonet';

beforeEach(() => {
useWalletInfoHook = create(mockWalletInfoStore);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,7 @@ export const getProviderByChain: BlockchainProviderFactory = (chain = CHAIN) =>
const baseCardanoServicesUrl = getBaseUrlForChain(chain);
const providers = Wallet.createProviders({
axiosAdapter: axiosFetchAdapter,
httpProviders: {
assetProvider: `${baseCardanoServicesUrl}/asset`,
chainHistoryProvider: `${baseCardanoServicesUrl}/chain-history`,
networkInfoProvider: `${baseCardanoServicesUrl}/network-info`,
rewardsProvider: `${baseCardanoServicesUrl}/rewards`,
stakePoolProvider: `${baseCardanoServicesUrl}/stake-pool`,
txSubmitProvider: `${baseCardanoServicesUrl}/tx-submit`,
utxoProvider: `${baseCardanoServicesUrl}/utxo`
}
baseUrl: baseCardanoServicesUrl
});

return IBlockchainProvider.fromWalletProviders(providers);
Expand Down
Loading