MyCrypto/common/libs/nodes/web3/requests.ts

30 lines
642 B
TypeScript
Raw Normal View History

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'
};
}
}