How to use the @zilliqa-js/core.composeMiddleware function in @zilliqa-js/core

To help you get started, we’ve selected a few @zilliqa-js/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zilpay / zil-pay / extension / content / browser / provider.js View on Github external
HTTPProvider.prototype.send = async function(method, ...params) {
  const [tReq, tRes] = this.getMiddleware(method);
  const reqMiddleware = composeMiddleware(...tReq);
  const resMiddleware = composeMiddleware(...tRes);

  const req = reqMiddleware(this.buildPayload(method, ...params));
  const response = await fetch(req.url, {
    method: 'POST',
    cache: 'no-cache',
    mode: 'cors',
    redirect: 'follow',
    body: JSON.stringify(req.payload),
    headers: {
      ...DEFAULT_HEADERS,
      ...((req.options && req.options.headers) || {}),
    }
  });
  const body = await response.json();
  const result = {
github zilpay / zil-pay / extension / content / browser / provider.js View on Github external
HTTPProvider.prototype.send = async function(method, ...params) {
  const [tReq, tRes] = this.getMiddleware(method);
  const reqMiddleware = composeMiddleware(...tReq);
  const resMiddleware = composeMiddleware(...tRes);

  const req = reqMiddleware(this.buildPayload(method, ...params));
  const response = await fetch(req.url, {
    method: 'POST',
    cache: 'no-cache',
    mode: 'cors',
    redirect: 'follow',
    body: JSON.stringify(req.payload),
    headers: {
      ...DEFAULT_HEADERS,
      ...((req.options && req.options.headers) || {}),
    }
  });
  const body = await response.json();
  const result = {
    ...body,