mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-01-11 11:34:26 +00:00
c340246ca0
* Progress commit * Update more types * Fix more types * Fix abi function types * Fix lib types * Fix rest of types * Address wbobeirne changes * Change origin and destination check
18 lines
547 B
TypeScript
18 lines
547 B
TypeScript
import { select, apply, call } from 'redux-saga/effects';
|
|
import { INode } from 'libs/nodes/INode';
|
|
import { getNodeLib } from 'selectors/config';
|
|
import { SagaIterator } from 'redux-saga';
|
|
|
|
interface Params {
|
|
to: any;
|
|
data: any;
|
|
decoder: any;
|
|
}
|
|
|
|
export function* makeEthCallAndDecode({ to, data, decoder }: Params): SagaIterator {
|
|
const node: INode = yield select(getNodeLib);
|
|
const result: string = yield apply(node, node.sendCallRequest, [{ data, to }]);
|
|
const decodedResult = yield call(decoder, result);
|
|
return decodedResult;
|
|
}
|