diff --git a/README.md b/README.md
index eef16773f..906f21243 100644
--- a/README.md
+++ b/README.md
@@ -88,12 +88,12 @@ Run `nx test my-app` to execute the unit tests with [Jest](https://jestjs.io), o
### Using wallet
-To run tests locally using your own wallets you can add the following environment variables to `cypress.json`
+To run tests locally using your own wallets make sure you have generated at least two public keys and update the following environment variables in `cypress.config.js` to match your wallet. You should also use [vegawallet-dummy](https://github.com/vegaprotocol/vegawallet-dummy) to avoid being prompted in CLI during test execution.
-1. Change `TRADING_TEST_VEGA_WALLET_NAME` to your Vega wallet name
-2. Add `TRADING_TEST_VEGA_WALLET_PASSPHRASE` as your wallet passphrase
-3. Add `ETH_WALLET_MNEMONIC` as your Ethereum wallet mnemonic
-4. Use [vegawallet-dummy](https://github.com/vegaprotocol/vegawallet-dummy) to avoid being prompted in CLI during test execution.
+1. Set `VEGA_PUBLIC_KEY` and `TRUNCATED_VEGA_PUBLIC_KEY` to your first public key.
+2. Set `VEGA_PUBLIC_KEY2` and `TRUNCATED_VEGA_PUBLIC_KEY2` to your second public key.
+3. Set `TRADING_TEST_VEGA_WALLET_PASSPHRASE` as your wallet passphrase
+4. Add `ETH_WALLET_MNEMONIC` as your Ethereum wallet mnemonic
### Formatting
diff --git a/apps/console-lite-e2e/cypress.config.js b/apps/console-lite-e2e/cypress.config.js
index 93994c5b5..4c265f78a 100644
--- a/apps/console-lite-e2e/cypress.config.js
+++ b/apps/console-lite-e2e/cypress.config.js
@@ -23,7 +23,6 @@ module.exports = defineConfig({
viewportHeight: 900,
},
env: {
- TRADING_TEST_VEGA_WALLET_NAME: 'UI_Trading_Test',
ETHEREUM_PROVIDER_URL:
'https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8',
VEGA_PUBLIC_KEY:
diff --git a/apps/token-e2e/src/integration/flow/governance-flow.cy.js b/apps/token-e2e/src/integration/flow/governance-flow.cy.js
index b86d4b04d..c857246b3 100644
--- a/apps/token-e2e/src/integration/flow/governance-flow.cy.js
+++ b/apps/token-e2e/src/integration/flow/governance-flow.cy.js
@@ -6,8 +6,6 @@ const vegaWalletStakedBalances =
const vegaWalletAssociatedBalance = '[data-testid="currency-value"]';
const vegaWalletNameElement = '[data-testid="wallet-name"]';
const vegaWallet = '[data-testid="vega-wallet"]';
-const vegaWalletName = Cypress.env('vegaWalletName');
-const vegaWalletPassphrase = Cypress.env('vegaWalletPassphrase');
const connectToVegaWalletButton = '[data-testid="connect-to-vega-wallet-btn"]';
const newProposalSubmitButton = '[data-testid="proposal-submit"]';
const dialogCloseButton = '[data-testid="dialog-close"]';
@@ -33,7 +31,6 @@ const voteTwoMinExtraNote = '[data-testid="voting-2-mins-extra"]';
const voteStatus = '[data-testid="vote-status"]';
const rejectProposalsLink = '[href="/governance/rejected"]';
const feedbackError = '[data-testid="Error"]';
-const restConnectorForm = '[data-testid="rest-connector-form"]';
const noOpenProposals = '[data-testid="no-open-proposals"]';
const noClosedProposals = '[data-testid="no-closed-proposals"]';
const txTimeout = Cypress.env('txTimeout');
@@ -794,12 +791,7 @@ context(
.should('be.visible')
.and('have.text', 'Connect Vega wallet')
.click();
- cy.getByTestId('connector-gui').click();
- cy.get(restConnectorForm).within(() => {
- cy.get('#wallet').click().type(vegaWalletName);
- cy.get('#passphrase').click().type(vegaWalletPassphrase);
- cy.get('button').contains('Connect').click();
- });
+ cy.getByTestId('connector-jsonRpc').click();
cy.get(vegaWalletNameElement).should('be.visible');
cy.get(connectToVegaWalletButton).should('not.exist');
// 3001-VOTE-100
diff --git a/apps/token-e2e/src/integration/view/wallet-vega.cy.js b/apps/token-e2e/src/integration/view/wallet-vega.cy.js
index 8b11c92a7..27457bdfa 100644
--- a/apps/token-e2e/src/integration/view/wallet-vega.cy.js
+++ b/apps/token-e2e/src/integration/view/wallet-vega.cy.js
@@ -89,14 +89,11 @@ context(
});
});
- it('should have gui, cli and hosted connection options visible on list', function () {
+ it('should have jsonRpc and hosted connection options visible on list', function () {
cy.get(connectorsList).within(() => {
- cy.getByTestId('connector-gui')
+ cy.getByTestId('connector-jsonRpc')
.should('be.visible')
- .and('have.text', 'Desktop wallet app');
- cy.getByTestId('connector-cli')
- .should('be.visible')
- .and('have.text', 'Command line wallet app');
+ .and('have.text', 'Connect Vega wallet');
cy.getByTestId('connector-hosted')
.should('be.visible')
.and('have.text', 'Hosted Fairground wallet');
@@ -113,9 +110,9 @@ context(
describe('when rest connector form opened', function () {
// Note using desktop wallet app link temporarily whilst its still on v1,
// tests will need to be updated to handle v2
- before('click desktop wallet app link', function () {
+ before('click hosted wallet app button', function () {
cy.get(connectorsList).within(() => {
- cy.getByTestId('connector-gui').click();
+ cy.getByTestId('connector-hosted').click();
});
});
diff --git a/apps/token-e2e/src/support/wallet-vega.functions.js b/apps/token-e2e/src/support/wallet-vega.functions.js
index 99a3304f5..a6d61c64a 100644
--- a/apps/token-e2e/src/support/wallet-vega.functions.js
+++ b/apps/token-e2e/src/support/wallet-vega.functions.js
@@ -10,9 +10,7 @@ Cypress.Commands.add('vega_wallet_connect', () => {
.and('be.visible')
.click({ force: true });
});
- // Connect with gui as its the v1 service and tests should still pass. This will need
- // to be update to use v2
- cy.getByTestId('connector-cli').click();
+ cy.getByTestId('connector-jsonRpc').click();
cy.get(vegaWalletNameElement).should('be.visible');
});
diff --git a/apps/trading-e2e/cypress.config.js b/apps/trading-e2e/cypress.config.js
index 39137b6dd..3253aa08e 100644
--- a/apps/trading-e2e/cypress.config.js
+++ b/apps/trading-e2e/cypress.config.js
@@ -37,7 +37,6 @@ module.exports = defineConfig({
requestTimeout: 20000,
},
env: {
- TRADING_TEST_VEGA_WALLET_NAME: 'UI_Trading_Test',
ETHEREUM_PROVIDER_URL:
'https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8',
VEGA_PUBLIC_KEY:
diff --git a/apps/trading-e2e/src/integration/global.cy.ts b/apps/trading-e2e/src/integration/global.cy.ts
index 3bfef59f0..074e7865e 100644
--- a/apps/trading-e2e/src/integration/global.cy.ts
+++ b/apps/trading-e2e/src/integration/global.cy.ts
@@ -6,8 +6,6 @@ const connectVegaBtn = 'connect-vega-wallet';
const manageVegaBtn = 'manage-vega-wallet';
const form = 'rest-connector-form';
const dialogContent = 'dialog-content';
-const walletName = Cypress.env('TRADING_TEST_VEGA_WALLET_NAME');
-const walletPassphrase = Cypress.env('TRADING_TEST_VEGA_WALLET_PASSPHRASE');
describe('vega wallet v1', { tags: '@smoke' }, () => {
beforeEach(() => {
@@ -20,23 +18,19 @@ describe('vega wallet v1', { tags: '@smoke' }, () => {
it('can connect', () => {
cy.getByTestId(connectVegaBtn).click();
- cy.contains('Desktop wallet app');
- cy.contains('Command line wallet app');
+ cy.contains('Connect Vega wallet');
cy.contains('Hosted Fairground wallet');
cy.getByTestId('connectors-list')
- .find('[data-testid="connector-gui"]')
+ .find('[data-testid="connector-jsonRpc"]')
.click();
- cy.getByTestId(form).find('#wallet').click().type(walletName);
- cy.getByTestId(form).find('#passphrase').click().type(walletPassphrase);
- cy.getByTestId('rest-connector-form').find('button[type=submit]').click();
cy.getByTestId(manageVegaBtn).should('exist');
});
it('doesnt connect with invalid credentials', () => {
cy.getByTestId(connectVegaBtn).click();
cy.getByTestId('connectors-list')
- .find('[data-testid="connector-gui"]')
+ .find('[data-testid="connector-hosted"]')
.click();
cy.getByTestId(form).find('#wallet').click().type('invalid name');
cy.getByTestId(form).find('#passphrase').click().type('invalid password');
@@ -47,7 +41,7 @@ describe('vega wallet v1', { tags: '@smoke' }, () => {
it('doesnt connect with invalid fields', () => {
cy.getByTestId(connectVegaBtn).click();
cy.getByTestId('connectors-list')
- .find('[data-testid="connector-gui"]')
+ .find('[data-testid="connector-hosted"]')
.click();
cy.getByTestId('rest-connector-form').find('button[type=submit]').click();
@@ -74,7 +68,7 @@ describe('vega wallet v2', { tags: '@smoke' }, () => {
it('can connect', () => {
cy.getByTestId(connectVegaBtn).click();
cy.getByTestId('connectors-list')
- .find('[data-testid="connector-cli"]')
+ .find('[data-testid="connector-jsonRpc"]')
.click();
cy.getByTestId(dialogContent).should('not.exist');
cy.getByTestId(manageVegaBtn).should('exist');
diff --git a/apps/trading-e2e/src/integration/trading-deal-ticket.cy.ts b/apps/trading-e2e/src/integration/trading-deal-ticket.cy.ts
index 199ebd897..8c7df8ceb 100644
--- a/apps/trading-e2e/src/integration/trading-deal-ticket.cy.ts
+++ b/apps/trading-e2e/src/integration/trading-deal-ticket.cy.ts
@@ -1,4 +1,8 @@
-import { Schema } from '@vegaprotocol/types';
+import {
+ OrderTimeInForceCode,
+ OrderTimeInForceMapping,
+ Schema,
+} from '@vegaprotocol/types';
import { generateEstimateOrder } from '../support/mocks/generate-fees';
import { aliasQuery } from '@vegaprotocol/cypress';
import { testOrder } from '../support/deal-ticket-transaction';
@@ -14,38 +18,13 @@ const toggleLimit = 'order-type-TYPE_LIMIT';
const toggleMarket = 'order-type-TYPE_MARKET';
const errorMessage = 'dealticket-error-message';
-const TIFlist = [
- {
- code: 'GTT',
- value: 'TIME_IN_FORCE_GTT',
- text: `Good 'til Time (GTT)`,
- },
- {
- code: 'GTC',
- value: 'TIME_IN_FORCE_GTC',
- text: `Good 'til Cancelled (GTC)`,
- },
- {
- code: 'IOC',
- value: 'TIME_IN_FORCE_IOC',
- text: `Immediate or Cancel (IOC)`,
- },
- {
- code: 'FOK',
- value: 'TIME_IN_FORCE_FOK',
- text: `Fill or Kill (FOK)`,
- },
- {
- code: 'GFN',
- value: 'TIME_IN_FORCE_GFN',
- text: `Good for Normal (GFN)`,
- },
- {
- code: 'GFA',
- value: 'TIME_IN_FORCE_GFA',
- text: `Good for Auction (GFA)`,
- },
-];
+const TIFlist = Object.values(Schema.OrderTimeInForce).map((value) => {
+ return {
+ code: OrderTimeInForceCode[value],
+ value,
+ text: OrderTimeInForceMapping[value],
+ };
+});
const displayTomorrow = () => {
const tomorrow = new Date();
@@ -419,14 +398,8 @@ describe('deal ticket validation', { tags: '@smoke' }, () => {
cy.getByTestId('order-connect-wallet').click();
cy.getByTestId('dialog-content').should('be.visible');
cy.getByTestId('connectors-list')
- .find('[data-testid="connector-gui"]')
+ .find('[data-testid="connector-jsonRpc"]')
.click();
- const form = 'rest-connector-form';
- const walletName = Cypress.env('TRADING_TEST_VEGA_WALLET_NAME');
- const walletPassphrase = Cypress.env('TRADING_TEST_VEGA_WALLET_PASSPHRASE');
- cy.getByTestId(form).find('#wallet').click().type(walletName);
- cy.getByTestId(form).find('#passphrase').click().type(walletPassphrase);
- cy.getByTestId(form).find('button[type=submit]').click();
cy.getByTestId(placeOrderBtn).should('be.visible');
cy.getByTestId(toggleLimit).children('input').should('be.checked');
cy.getByTestId(orderPriceField).should('have.value', '101');
diff --git a/apps/trading-e2e/src/support/mocks/generate-chain-id.ts b/apps/trading-e2e/src/support/mocks/generate-chain-id.ts
index 5ed5794d6..146c452f1 100644
--- a/apps/trading-e2e/src/support/mocks/generate-chain-id.ts
+++ b/apps/trading-e2e/src/support/mocks/generate-chain-id.ts
@@ -8,7 +8,8 @@ export const generateChainId = (
const defaultResult = {
statistics: {
__typename: 'Statistics',
- chainId: 'test-chain-id',
+ // this needs to match the network set up for vegawallet-dummy in .github/actions/setup-vegawallet/action.yml
+ chainId: 'stagnet3',
},
};
diff --git a/apps/trading-e2e/src/support/mocks/generate-statistics.ts b/apps/trading-e2e/src/support/mocks/generate-statistics.ts
index 4b762e4db..752331be9 100644
--- a/apps/trading-e2e/src/support/mocks/generate-statistics.ts
+++ b/apps/trading-e2e/src/support/mocks/generate-statistics.ts
@@ -8,7 +8,8 @@ export const generateStatistics = (
const defaultResult = {
statistics: {
__typename: 'Statistics',
- chainId: 'test-chain-id',
+ // this needs to match the network set up for vegawallet-dummy in .github/actions/setup-vegawallet/action.yml
+ chainId: 'stagnet3',
blockHeight: '11',
},
};
diff --git a/libs/cypress/src/lib/commands/vega-wallet-connect.ts b/libs/cypress/src/lib/commands/vega-wallet-connect.ts
index e833638ae..a6517360d 100644
--- a/libs/cypress/src/lib/commands/vega-wallet-connect.ts
+++ b/libs/cypress/src/lib/commands/vega-wallet-connect.ts
@@ -14,7 +14,7 @@ export function addVegaWalletConnect() {
cy.highlight(`Connecting Vega Wallet`);
cy.get('[data-testid=connect-vega-wallet]').click();
cy.get('[data-testid=connectors-list]')
- .find('[data-testid="connector-cli"]')
+ .find('[data-testid="connector-jsonRpc"]')
.click();
cy.get('[data-testid=dialog-content]').should(
'contain.text',
diff --git a/libs/types/src/global-types-mappings.ts b/libs/types/src/global-types-mappings.ts
index eb34c2acd..505bd8413 100644
--- a/libs/types/src/global-types-mappings.ts
+++ b/libs/types/src/global-types-mappings.ts
@@ -223,9 +223,10 @@ export const OrderStatusMapping: {
/**
* Valid order types, these determine what happens when an order is added to the book
*/
-export const OrderTimeInForceMapping: {
+type OrderTimeInForceMap = {
[T in OrderTimeInForce]: string;
-} = {
+};
+export const OrderTimeInForceMapping: OrderTimeInForceMap = {
TIME_IN_FORCE_FOK: 'Fill or Kill (FOK)',
TIME_IN_FORCE_GFA: 'Good for Auction (GFA)',
TIME_IN_FORCE_GFN: 'Good for Normal (GFN)',
@@ -234,6 +235,15 @@ export const OrderTimeInForceMapping: {
TIME_IN_FORCE_IOC: 'Immediate or Cancel (IOC)',
};
+export const OrderTimeInForceCode: OrderTimeInForceMap = {
+ TIME_IN_FORCE_FOK: 'FOK',
+ TIME_IN_FORCE_GFA: 'GFA',
+ TIME_IN_FORCE_GFN: 'GFN',
+ TIME_IN_FORCE_GTC: 'GTC',
+ TIME_IN_FORCE_GTT: 'GTT',
+ TIME_IN_FORCE_IOC: 'IOC',
+};
+
export const OrderTypeMapping: {
[T in OrderType]: string;
} = {
diff --git a/libs/wallet/src/connect-dialog/connect-dialog.spec.tsx b/libs/wallet/src/connect-dialog/connect-dialog.spec.tsx
index 6dddcd75c..6c034aead 100644
--- a/libs/wallet/src/connect-dialog/connect-dialog.spec.tsx
+++ b/libs/wallet/src/connect-dialog/connect-dialog.spec.tsx
@@ -89,12 +89,9 @@ describe('VegaConnectDialog', () => {
rerender(generateJSX());
const list = await screen.findByTestId('connectors-list');
expect(list).toBeInTheDocument();
- expect(list.children).toHaveLength(3);
- expect(screen.getByTestId('connector-gui')).toHaveTextContent(
- 'Desktop wallet app'
- );
- expect(screen.getByTestId('connector-cli')).toHaveTextContent(
- 'Command line wallet app'
+ expect(list.children).toHaveLength(2);
+ expect(screen.getByTestId('connector-jsonRpc')).toHaveTextContent(
+ 'Connect Vega wallet'
);
expect(screen.getByTestId('connector-hosted')).toHaveTextContent(
'Hosted Fairground wallet'
@@ -379,7 +376,7 @@ describe('VegaConnectDialog', () => {
async function selectJsonRpc() {
expect(await screen.findByRole('dialog')).toBeInTheDocument();
- fireEvent.click(await screen.findByTestId('connector-cli'));
+ fireEvent.click(await screen.findByTestId('connector-jsonRpc'));
}
});
});
diff --git a/libs/wallet/src/connect-dialog/connect-dialog.tsx b/libs/wallet/src/connect-dialog/connect-dialog.tsx
index 0c9f75ee1..b8e187f4f 100644
--- a/libs/wallet/src/connect-dialog/connect-dialog.tsx
+++ b/libs/wallet/src/connect-dialog/connect-dialog.tsx
@@ -25,7 +25,7 @@ import { useJsonRpcConnect } from '../use-json-rpc-connect';
export const CLOSE_DELAY = 1700;
type Connectors = { [key: string]: VegaConnector };
-type WalletType = 'gui' | 'cli' | 'hosted';
+type WalletType = 'jsonRpc' | 'hosted';
export interface VegaConnectDialogProps {
connectors: Connectors;
@@ -146,16 +146,23 @@ const ConnectDialogContainer = ({
const { connect, ...jsonRpcState } = useJsonRpcConnect(delayedOnConnect);
- const handleSelect = (type: WalletType) => {
- // Only cli is currently uses JsonRpc, this will need to be updated
- // when gui does too
- const connector =
- type === 'cli' ? connectors['jsonRpc'] : connectors['rest'];
+ const handleSelect = (type: WalletType, isHosted = false) => {
+ let connector;
+
+ if (isHosted) {
+ // If the user has selected hosted wallet ensure that we are connecting to https://vega-hosted-wallet.on.fleek.co/
+ // otherwise use the default walletUrl or what has been put in the input
+ connector = connectors['rest'];
+ connector.url = HOSTED_WALLET_URL || walletUrl;
+ } else {
+ connector = connectors[type];
+ connector.url = walletUrl;
+ }
+
+ if (!connector) {
+ throw new Error(`Connector type: ${type} not configured`);
+ }
- // If the user has selected hosted wallet ensure that we are connecting to https://vega-hosted-wallet.on.fleek.co/
- // otherwise use the default walletUrl or what has been put in the input
- connector.url =
- type === 'hosted' && HOSTED_WALLET_URL ? HOSTED_WALLET_URL : walletUrl;
setSelectedConnector(connector);
setWalletType(type);
@@ -191,7 +198,7 @@ const ConnectorList = ({
setWalletUrl,
isMainnet,
}: {
- onSelect: (type: WalletType) => void;
+ onSelect: (type: WalletType, isHosted?: boolean) => void;
walletUrl: string;
setWalletUrl: (value: string) => void;
isMainnet: boolean;
@@ -202,18 +209,11 @@ const ConnectorList = ({