mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-01-09 10:41:56 +00:00
Add comments
This commit is contained in:
parent
570b3c42b9
commit
e9f04369e3
@ -7,6 +7,13 @@ import {
|
|||||||
import { createClientRpcHandler } from './client-utils';
|
import { createClientRpcHandler } from './client-utils';
|
||||||
import EventEmitter from 'events';
|
import EventEmitter from 'events';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is what the web facing side would use as a package to interact with the enclave
|
||||||
|
* It contains logic to differentiate between electron and browser / node enviroments
|
||||||
|
* And then its functions communicate with the "server" to perform RPC calls
|
||||||
|
* This file is the equivalent to a Provider for shepherd / INode implementation
|
||||||
|
*/
|
||||||
|
|
||||||
const eventEmitter = new EventEmitter();
|
const eventEmitter = new EventEmitter();
|
||||||
function isElectronEnv() {
|
function isElectronEnv() {
|
||||||
return process.env.BUILD_ELECTRON;
|
return process.env.BUILD_ELECTRON;
|
||||||
|
@ -2,6 +2,13 @@ import { ipcRenderer } from 'electron';
|
|||||||
import { EnclaveEvents, SignRawTransactionParams, SignRawTransaction } from './types';
|
import { EnclaveEvents, SignRawTransactionParams, SignRawTransaction } from './types';
|
||||||
import { createClientRpcHandler } from './client-utils';
|
import { createClientRpcHandler } from './client-utils';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contains scripts to inject handlers into the web at runtime via preload
|
||||||
|
* which "client" then can use to communicate with ipcMain process
|
||||||
|
* to call methods on the enclave.
|
||||||
|
* This package would be in the preload section of electron
|
||||||
|
*/
|
||||||
|
|
||||||
const createElectronRpcHandler = <T = any, R = any>(channel: EnclaveEvents) =>
|
const createElectronRpcHandler = <T = any, R = any>(channel: EnclaveEvents) =>
|
||||||
createClientRpcHandler<T, R>(ipcRenderer, channel, ipcRenderer.send, ipcRenderer.once);
|
createClientRpcHandler<T, R>(ipcRenderer, channel, ipcRenderer.send, ipcRenderer.once);
|
||||||
|
|
||||||
|
@ -10,6 +10,12 @@ import {
|
|||||||
import { ipcMain } from 'electron';
|
import { ipcMain } from 'electron';
|
||||||
import { createServerRpcHandler } from './server-utils';
|
import { createServerRpcHandler } from './server-utils';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contains the "server" implementation, currently only for electron
|
||||||
|
* this should be run in ipcMain process to have access to node-hid
|
||||||
|
* to perform signing actions for hardware wallets
|
||||||
|
*/
|
||||||
|
|
||||||
// mock
|
// mock
|
||||||
// this hard codes electron specific sending atm (ev.sender.send)
|
// this hard codes electron specific sending atm (ev.sender.send)
|
||||||
export const signRawTransactionRequest: RpcEventHandler<
|
export const signRawTransactionRequest: RpcEventHandler<
|
||||||
|
Loading…
x
Reference in New Issue
Block a user