MyCrypto/common/libs/nodes/web3/requests.ts
skubakdj c54453729c Web3 Future Proof, Refactor, Bugfixes (#481)
* correct web3 hide/show logic

* refactor web3 node lib

* refactor web3 wallet to use new web3 node

* update web3 node init to use new lib

* update web3 wallet saga to use new lib, address unlock flow bug

* remove comments

* add validators for web3 methods

* update web3 node to use latest standards

* remove legacy function

* update lib call, add account unlock check

* add & use new flavor of unsetWeb3Node

* address PR feedback

* add test, update tests, update snapshot
2017-12-01 10:32:29 -06:00

30 lines
642 B
TypeScript

import RPCRequests from '../rpc/requests';
import {
SendTransactionRequest,
SignMessageRequest,
GetAccountsRequest,
Web3Transaction
} from './types';
export default class Web3Requests extends RPCRequests {
public sendTransaction(web3Tx: Web3Transaction): SendTransactionRequest {
return {
method: 'eth_sendTransaction',
params: [web3Tx]
};
}
public signMessage(msgHex: string, fromAddr: string): SignMessageRequest {
return {
method: 'personal_sign',
params: [msgHex, fromAddr]
};
}
public getAccounts(): GetAccountsRequest {
return {
method: 'eth_accounts'
};
}
}