Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
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',
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',
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',
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',