{connectors.map((c) => {
return (
- void }) => {
return ;
};
-export const ConnectionOption = ({
+export const OnboardConnectionOption = ({
id,
name,
description,
diff --git a/apps/trading/lib/vega-wallet.ts b/apps/trading/lib/vega-wallet.ts
index 50d059731..f411ba669 100644
--- a/apps/trading/lib/vega-wallet.ts
+++ b/apps/trading/lib/vega-wallet.ts
@@ -16,6 +16,7 @@ const jsonRpc = new JsonRpcConnector({
});
const snap = new SnapConnector({
+ // TODO: unhardcode node url
node: 'https://api.n08.testnet.vega.rocks',
snapId: 'npm:@vegaprotocol/snap',
version: '0.3.1',
@@ -30,6 +31,7 @@ export const config = createConfig({
injected,
jsonRpc,
snap,
+ // TODO: fix types
// @ts-ignore getChainId only throws
readOnly,
],
diff --git a/libs/i18n/src/locales/en/governance.json b/libs/i18n/src/locales/en/governance.json
index e540cefaf..714172d17 100644
--- a/libs/i18n/src/locales/en/governance.json
+++ b/libs/i18n/src/locales/en/governance.json
@@ -158,6 +158,7 @@
"Continue": "Continue",
"ContinueSharingData": "Continue sharing data",
"copied!": "Copied!",
+ "Copy": "Copy",
"copyToClipboard": "Copy to clipboard",
"copyId": "Copy ID to clipboard",
"CouldNotInstantiateMarket": "Could not instantiate market",
@@ -193,6 +194,7 @@
"disclaimer4": "The Vega Governance App is provided “as is”. The developers of the Vega Governance App make no representations or warranties of any kind, whether express or implied, statutory or otherwise regarding the Vega Governance App. They disclaim all warranties of merchantability, quality, fitness for purpose. They disclaim all warranties that the Vega Governance App is free of harmful components or errors.",
"disclaimer5": "No developer of the Vega Governance App accepts any responsibility for, or liability to users in connection with their use of the Vega Governance App.",
"disconnect": "Disconnect",
+ "Disconnect all keys": "Disconnect all keys",
"disconnectedNotice": "You have been disconnected. Connect your ETH wallet to the {{correctNetwork}} network to use this app.",
"Dissociate VEGA tokens": "Disassociate $VEGA tokens",
"Dissociating {{amount}} VEGA tokens from Vega key {{vegaKey}}": "Disassociating {{amount}} $VEGA tokens from Vega key {{vegaKey}}",
@@ -632,6 +634,7 @@
"Score": "Score",
"seeHowRewardsAreCalculated": "See how rewards are calculated",
"seeRejectedProposals": "See rejected proposals",
+ "Select": "Select",
"Select country": "Select country/region of residence",
"Select your country or region of current residence": "Select your country or region of current residence",
"SelectAMarketToChange": "Select a market to change",
@@ -881,7 +884,6 @@
"View on Etherscan (opens in a new tab)": "View on Etherscan (opens in a new tab)",
"View transaction on Etherscan": "View transaction on Etherscan",
"viewAllTranches": "View all tranches",
- "viewAsParty": "View as party",
"viewDetails": "View details",
"viewKeys": "View keys",
"viewMarketJson": "View market JSON",
diff --git a/libs/i18n/src/locales/en/wallet-react.json b/libs/i18n/src/locales/en/wallet-react.json
index fdaeb4fe1..4de236de0 100644
--- a/libs/i18n/src/locales/en/wallet-react.json
+++ b/libs/i18n/src/locales/en/wallet-react.json
@@ -19,10 +19,8 @@
"Connect with Vega Wallet extension for {{browserName}} to access all features including key management and detailed transaction views from your browser.": "Connect with Vega Wallet extension for {{browserName}} to access all features including key management and detailed transaction views from your browser.",
"Connecting...": "Connecting...",
"Connection in progress": "Connection in progress",
- "Copy": "Copy",
"Could not connect to Vega MetaMask Snap": "Could not connect to Vega MetaMask Snap",
"Custom wallet location": "Custom wallet location",
- "Disconnect all keys": "Disconnect all keys",
"Enter a custom wallet location": "Enter a custom wallet location",
"Get a Vega wallet": "Get a Vega wallet",
"Get the Vega Wallet": "Get the Vega Wallet",
@@ -40,7 +38,6 @@
"Pubkey must be be valid hex": "Pubkey must be be valid hex",
"Read the docs to troubleshoot": "Read the docs to troubleshoot",
"Required": "Required",
- "Select": "Select",
"SELECT A VEGA KEY": "SELECT A VEGA KEY",
"Snap failed": "Snap failed",
"Something went wrong": "Something went wrong",
diff --git a/libs/wallet-react/src/hooks/use-simple-transaction.ts b/libs/wallet-react/src/hooks/use-simple-transaction.ts
index e49c6e488..299571cb5 100644
--- a/libs/wallet-react/src/hooks/use-simple-transaction.ts
+++ b/libs/wallet-react/src/hooks/use-simple-transaction.ts
@@ -1,6 +1,11 @@
import { useState } from 'react';
import { useVegaWallet } from './use-vega-wallet';
-import { determineId, type Transaction } from '@vegaprotocol/wallet';
+import {
+ ConnectorError,
+ ConnectorErrors,
+ determineId,
+ type Transaction,
+} from '@vegaprotocol/wallet';
import {
useSimpleTransactionSubscription,
type SimpleTransactionFieldsFragment,
@@ -43,10 +48,6 @@ export const useSimpleTransaction = (opts?: Options) => {
try {
const res = await sendTx(pubKey, tx);
- if (!res || 'error' in res) {
- throw new Error(t('Transaction could not be sent'));
- }
-
setStatus('pending');
setResult({
txHash: res?.transactionHash.toLowerCase(),
@@ -54,8 +55,8 @@ export const useSimpleTransaction = (opts?: Options) => {
id: determineId(res.signature),
});
} catch (err) {
- if (err instanceof Error) {
- if (err.message.includes('user rejected')) {
+ if (err instanceof ConnectorError) {
+ if (err.code === ConnectorErrors.userRejected.code) {
setStatus('idle');
} else {
setError(err.message);
diff --git a/libs/wallet/project.json b/libs/wallet/project.json
index 72797361b..273238344 100644
--- a/libs/wallet/project.json
+++ b/libs/wallet/project.json
@@ -17,9 +17,7 @@
"react",
"react-dom",
"react/jsx-runtime",
- "@vegaprotocol/i18n",
"@vegaprotocol/types",
- "@vegaprotocol/ui-toolkit",
"@vegaprotocol/utils"
],
"rollupConfig": "@nx/react/plugins/bundle-rollup",
diff --git a/libs/wallet/src/connectors/snap-connector.ts b/libs/wallet/src/connectors/snap-connector.ts
index 9d104d9f3..207b29d5e 100644
--- a/libs/wallet/src/connectors/snap-connector.ts
+++ b/libs/wallet/src/connectors/snap-connector.ts
@@ -27,6 +27,9 @@ export class SnapConnector implements Connector {
version: string;
snapId: string;
+ // Note: we may not be able to set `node` in the constructor
+ // as the trading app won't know the current node until
+ // the app runs
constructor(config: SnapConfig) {
this.node = config.node;
this.version = config.version;
@@ -126,6 +129,12 @@ export class SnapConnector implements Connector {
// Snap methods
////////////////////////////////////
+ /**
+ * Requests permission for a website to communicate with the specified snaps
+ * and attempts to install them if they're not already installed.
+ * If the installation of any snap fails, returns the error that caused the failure.
+ * More informations here: https://docs.metamask.io/snaps/reference/rpc-api/#wallet_requestsnaps
+ */
async requestSnap() {
await this.request(EthereumMethod.RequestSnaps, {
[this.snapId]: {
diff --git a/libs/wallet/src/types.ts b/libs/wallet/src/types.ts
index c9506e293..53a58ef97 100644
--- a/libs/wallet/src/types.ts
+++ b/libs/wallet/src/types.ts
@@ -80,9 +80,7 @@ export type Wallet = {
connect: (id: ConnectorType) => Promise<{ status: Status }>;
disconnect: () => Promise<{ status: Status }>;
refreshKeys: () => Promise;
- sendTransaction: (
- params: TransactionParams
- ) => Promise;
+ sendTransaction: (params: TransactionParams) => Promise;
reset: () => void;
};
diff --git a/libs/wallet/src/utils.ts b/libs/wallet/src/utils.ts
index 60d30243b..326a6de12 100644
--- a/libs/wallet/src/utils.ts
+++ b/libs/wallet/src/utils.ts
@@ -83,7 +83,6 @@ export const normalizeTransfer = >(
// @ts-ignore not sure why but window.vega not defined despite it being globally declared
export const isBrowserWalletInstalled = () => Boolean(window.vega);
-// TODO: we might be able to use wallets type narrowing
export const isMarginModeUpdateTransaction = (
transaction: Transaction
): transaction is UpdateMarginModeBody => 'updateMarginMode' in transaction;
diff --git a/libs/web3/src/lib/use-vega-transaction-toasts.tsx b/libs/web3/src/lib/use-vega-transaction-toasts.tsx
index f03a1de0e..488a623b2 100644
--- a/libs/web3/src/lib/use-vega-transaction-toasts.tsx
+++ b/libs/web3/src/lib/use-vega-transaction-toasts.tsx
@@ -4,8 +4,6 @@ import compact from 'lodash/compact';
import {
isTransferTransaction,
isBatchMarketInstructionsTransaction,
- // ClientErrors,
- // WalletError,
isOrderAmendmentTransaction,
isOrderCancellationTransaction,
isOrderSubmissionTransaction,
diff --git a/recovery.txt b/recovery.txt
deleted file mode 100644
index f3ec7481d..000000000
--- a/recovery.txt
+++ /dev/null
@@ -1 +0,0 @@
-ozone access unlock valid olympic save include omit supply green clown session
diff --git a/vegacapsule/testnet/wallet/config/wallet-service/networks/DV.toml b/vegacapsule/testnet/wallet/config/wallet-service/networks/DV.toml
deleted file mode 100644
index 62322426d..000000000
--- a/vegacapsule/testnet/wallet/config/wallet-service/networks/DV.toml
+++ /dev/null
@@ -1,12 +0,0 @@
-FileVersion = 2
-
-[API]
- [API.GRPC]
- Hosts = ["127.0.0.1:3002", "127.0.0.1:3012", "127.0.0.1:3022", "127.0.0.1:3032"]
- [API.REST]
- [API.GraphQL]
-
-[Apps]
- Console = ""
- Governance = ""
- Explorer = ""