How to use the web3-core-helpers.formatters.outputBlockFormatter function in web3-core-helpers

To help you get started, we’ve selected a few web3-core-helpers 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 ninabreznik / voting-ethereum-contract / node_modules / web3-core-method / src / index.js View on Github external
outputFormatter: formatters.outputTransactionReceiptFormatter
        }),
        new Method({
            name: 'getCode',
            call: 'eth_getCode',
            params: 2,
            inputFormatter: [formatters.inputAddressFormatter, formatters.inputDefaultBlockNumberFormatter]
        }),
        new Subscriptions({
            name: 'subscribe',
            type: 'eth',
            subscriptions: {
                'newBlockHeaders': {
                    subscriptionName: 'newHeads', // replace subscription with this name
                    params: 0,
                    outputFormatter: formatters.outputBlockFormatter
                }
            }
        })
    ];
    // attach methods to this._ethereumCall
    var _ethereumCall = {};
    _.each(_ethereumCalls, function (mthd) {
        mthd.attachToObject(_ethereumCall);
        mthd.requestManager = method.requestManager; // assign rather than call setRequestManager()
    });


    // fire "receipt" and confirmation events and resolve after
    var checkConfirmation = function (existingReceipt, isPolling, err, blockHeader, sub) {
        if (!err) {
            // create fake unsubscribe
github citahub / cita-sdk-js / packages / cita-sdk / lib / base / rpc.js View on Github external
const blockCall = function (args) {
    return _.isString(args[0]) && args[0].indexOf('0x') === 0
        ? 'getBlockByHash'
        : 'getBlockByNumber';
};
exports.getBlock = {
    name: 'getBlock',
    call: blockCall,
    params: 2,
    inputFormatter: [
        formatters.inputBlockNumberFormatter,
        function (val) {
            return !!val;
        }
    ],
    outputFormatter: formatters.outputBlockFormatter
};
exports.getBlockByHash = {
    name: 'getBlockByHash',
    call: 'getBlockByHash',
    params: 2,
    inputFormatter: [
        formatters.inputBlockNumberFormatter,
        function (val) {
            return !!val;
        }
    ],
    outputFormatter: formatters.outputBlockFormatter
};
exports.getBlockByNumber = {
    name: 'getBlockByNumber',
    call: 'getBlockByNumber',
github citahub / cita-sdk-js / packages / cita-sdk / src / base / rpc.ts View on Github external
return !!val
    }
  ],
  outputFormatter: formatters.outputBlockFormatter
}
export const getBlockByHash = {
  name: 'getBlockByHash',
  call: 'getBlockByHash',
  params: 2,
  inputFormatter: [
    formatters.inputBlockNumberFormatter,
    function(val: any) {
      return !!val
    }
  ],
  outputFormatter: formatters.outputBlockFormatter
}
export const getBlockByNumber = {
  name: 'getBlockByNumber',
  call: 'getBlockByNumber',
  params: 2,
  inputFormatter: [
    formatters.inputBlockNumberFormatter,
    function(val: any) {
      return !!val
    }
  ],
  outputFormatter: formatters.outputBlockFormatter
}

export const getBlockNumber = {
  name: 'getBlockNumber',
github citahub / cita-sdk-js / packages / cita-sdk / src / base / rpc.ts View on Github external
return _.isString(args[0]) && args[0].indexOf('0x') === 0
    ? 'getBlockByHash'
    : 'getBlockByNumber'
}

export const getBlock = {
  name: 'getBlock',
  call: blockCall,
  params: 2,
  inputFormatter: [
    formatters.inputBlockNumberFormatter,
    function(val: any) {
      return !!val
    }
  ],
  outputFormatter: formatters.outputBlockFormatter
}
export const getBlockByHash = {
  name: 'getBlockByHash',
  call: 'getBlockByHash',
  params: 2,
  inputFormatter: [
    formatters.inputBlockNumberFormatter,
    function(val: any) {
      return !!val
    }
  ],
  outputFormatter: formatters.outputBlockFormatter
}
export const getBlockByNumber = {
  name: 'getBlockByNumber',
  call: 'getBlockByNumber',
github citahub / cita-sdk-js / packages / cita-sdk / lib / base / rpc.js View on Github external
return !!val;
        }
    ],
    outputFormatter: formatters.outputBlockFormatter
};
exports.getBlockByHash = {
    name: 'getBlockByHash',
    call: 'getBlockByHash',
    params: 2,
    inputFormatter: [
        formatters.inputBlockNumberFormatter,
        function (val) {
            return !!val;
        }
    ],
    outputFormatter: formatters.outputBlockFormatter
};
exports.getBlockByNumber = {
    name: 'getBlockByNumber',
    call: 'getBlockByNumber',
    params: 2,
    inputFormatter: [
        formatters.inputBlockNumberFormatter,
        function (val) {
            return !!val;
        }
    ],
    outputFormatter: formatters.outputBlockFormatter
};
exports.getBlockNumber = {
    name: 'getBlockNumber',
    call: 'blockNumber',