171babc2c9
* feat/1010: Show proposal rejected reason in transaction dialog * feat/1010: Show wallet rejection details in transaction dialog * Feat/1010: Updated wallet types * Feat/1010: Ensuring rejected proposals get the correct transaction dialog title * Feat/1010: Fixing linting warning * Feat/1010: Skipping node switcher tests for now
43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
import type { VegaKey } from './wallet-types';
|
|
import { createContext } from 'react';
|
|
import type { VegaConnector } from './connectors';
|
|
import type {
|
|
TransactionSubmission,
|
|
TransactionResponse,
|
|
} from './wallet-types';
|
|
|
|
export interface VegaKeyExtended extends VegaKey {
|
|
name: string;
|
|
}
|
|
|
|
export interface VegaWalletContextShape {
|
|
/** The current select public key */
|
|
keypair: VegaKeyExtended | null;
|
|
|
|
/** Public keys stored in users wallet */
|
|
keypairs: VegaKeyExtended[] | null;
|
|
|
|
/** Calls connect on the supplied connector, storing the returned keys */
|
|
connect: (connector: VegaConnector) => Promise<VegaKey[] | null>;
|
|
|
|
/** Disconnects from the connector and clears public key state */
|
|
disconnect: () => Promise<boolean>;
|
|
|
|
/** Sets the current selected public key */
|
|
selectPublicKey: (publicKey: string) => void;
|
|
|
|
/** Reference to the connector */
|
|
connector: VegaConnector | null;
|
|
|
|
/** Send a transaction to the network, only order submissions for now */
|
|
sendTx: (
|
|
tx: TransactionSubmission
|
|
) => Promise<
|
|
TransactionResponse | { error: string; details?: string[] }
|
|
> | null;
|
|
}
|
|
|
|
export const VegaWalletContext = createContext<
|
|
VegaWalletContextShape | undefined
|
|
>(undefined);
|