How to use the web3-core-helpers.errors.InvalidNumberOfParams 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 ethereum / web3.js / packages / web3-eth-contract / src / index.js View on Github external
txObject.call = this.parent._executeMethod.bind(txObject, 'call');
        txObject.call.request = this.parent._executeMethod.bind(txObject, 'call', true); // to make batch requests

    }

    txObject.send = this.parent._executeMethod.bind(txObject, 'send');
    txObject.send.request = this.parent._executeMethod.bind(txObject, 'send', true); // to make batch requests
    txObject.encodeABI = this.parent._encodeMethodABI.bind(txObject);
    txObject.estimateGas = this.parent._executeMethod.bind(txObject, 'estimate');

    if (args && this.method.inputs && args.length !== this.method.inputs.length) {
        if (this.nextMethod) {
            return this.nextMethod.apply(null, args);
        }
        throw errors.InvalidNumberOfParams(args.length, this.method.inputs.length, this.method.name);
    }

    txObject.arguments = args || [];
    txObject._method = this.method;
    txObject._parent = this.parent;
    txObject._ethAccounts = this.parent.constructor._ethAccounts || this._ethAccounts;

    if(this.deployData) {
        txObject._deployData = this.deployData;
    }

    return txObject;
};
github ninabreznik / voting-ethereum-contract / node_modules / web3-core-subscriptions / src / subscription.js View on Github external
Subscription.prototype._validateArgs = function (args) {
    var subscription = this.options.subscription;

    if(!subscription)
        subscription = {};

    if(!subscription.params)
        subscription.params = 0;

    if (args.length !== subscription.params) {
        throw errors.InvalidNumberOfParams(args.length, subscription.params + 1, args[0]);
    }
};
github ubiq / shokku / src / helpers / web3.shokku.js View on Github external
validateArgs(args = []) {
    if (!_.isArray(args)) {
      throw errors.InvalidNumberOfParams(args.length, this.params, this.name)
    }

    if (args.length !== this.params) {
      throw errors.InvalidNumberOfParams(args.length, this.params, this.name)
    }

    const result = this.validate(args)
    if (!result) {
      throw errors.InvalidNumberOfParams(args.length, this.params, this.name)
    }
  }
github ethereum / web3.js / packages / web3-core-subscriptions / src / subscription.js View on Github external
Subscription.prototype._validateArgs = function (args) {
    var subscription = this.options.subscription;

    if(!subscription)
        subscription = {};

    if(!subscription.params)
        subscription.params = 0;

    if (args.length !== subscription.params) {
        throw errors.InvalidNumberOfParams(args.length, subscription.params + 1, args[0]);
    }
};
github citahub / cita-sdk-js / packages / cita-sdk / src / subscriptions / subscription.ts View on Github external
_validateArgs = (...args: any[]) => {
    var subscription = this.options.subscription

    if (!subscription) subscription = {}

    if (!subscription.params) subscription.params = 0

    if (args.length !== subscription.params) {
      throw errors.InvalidNumberOfParams(
        args.length,
        subscription.params + 1,
        args[0]
      )
    }
  }
github ninabreznik / voting-ethereum-contract / node_modules / web3-core-method / src / index.js View on Github external
Method.prototype.validateArgs = function (args) {
    if (args.length !== this.params) {
        throw errors.InvalidNumberOfParams(args.length, this.params, this.name);
    }
};