mirror of
https://github.com/status-im/web3.js.git
synced 2025-02-24 12:08:22 +00:00
* Remove extraneous whitespace. * Fix dynamicOffset calculation when encoding params. Dynamic types should contribute only one word, not their staticPartLength. * Fix staticPartLength calculation for multidimensional arrays. Previously it was accounting for only one of the dimensions. * Define default behavior for SolidityType.staticPartLength. The default behavior was defined redundantly for every type.
30 lines
690 B
JavaScript
30 lines
690 B
JavaScript
var f = require('./formatters');
|
|
var SolidityType = require('./type');
|
|
|
|
/**
|
|
* SolidityTypeBytes is a prototype that represents the bytes type.
|
|
* It matches:
|
|
* bytes
|
|
* bytes[]
|
|
* bytes[4]
|
|
* bytes[][]
|
|
* bytes[3][]
|
|
* bytes[][6][], ...
|
|
* bytes32
|
|
* bytes8[4]
|
|
* bytes[3][]
|
|
*/
|
|
var SolidityTypeBytes = function () {
|
|
this._inputFormatter = f.formatInputBytes;
|
|
this._outputFormatter = f.formatOutputBytes;
|
|
};
|
|
|
|
SolidityTypeBytes.prototype = new SolidityType({});
|
|
SolidityTypeBytes.prototype.constructor = SolidityTypeBytes;
|
|
|
|
SolidityTypeBytes.prototype.isType = function (name) {
|
|
return !!name.match(/^bytes([0-9]{1,})(\[([0-9]*)\])*$/);
|
|
};
|
|
|
|
module.exports = SolidityTypeBytes;
|