UNPKG

486 BPlain TextView Raw
1// Copyright 2017-2018 @polkadot/api-provider authors & contributors
2// This software may be modified and distributed under the terms
3// of the ISC license. See the LICENSE file for details.
4
5import { MockState } from './types';
6
7export default async function send ({ requests, db }: MockState, method: string, params: Array<any>): Promise<any> {
8 if (!requests[method]) {
9 throw new Error(`provider.send: Invalid method '${method}'`);
10 }
11
12 return requests[method](db, params);
13}