removed unused formatOutputHash, renamed formatXXXString to formatXXXBytes

This commit is contained in:
Marek Kotewicz 2015-04-22 09:01:14 +02:00
parent 888a970ac5
commit f767a9a68a
8 changed files with 34 additions and 71 deletions

28
dist/web3-light.js vendored
View File

@ -435,8 +435,8 @@ var coder = new SolidityCoder([
name: 'bytes',
match: 'prefix',
mode: 'bytes',
inputFormatter: f.formatInputString,
outputFormatter: f.formatOutputString
inputFormatter: f.formatInputBytes,
outputFormatter: f.formatOutputBytes
}),
new SolidityType({
name: 'real',
@ -505,11 +505,11 @@ var formatInputInt = function (value) {
/**
* Formats input value to byte representation of string
*
* @method formatInputString
* @method formatInputBytes
* @param {String}
* @returns {SolidityParam}
*/
var formatInputString = function (value) {
var formatInputBytes = function (value) {
var result = utils.fromAscii(value, c.ETH_PADDING).substr(2);
return new SolidityParam('', formatInputInt(value.length).value, result);
};
@ -601,17 +601,6 @@ var formatOutputUReal = function (param) {
return formatOutputUInt(param).dividedBy(new BigNumber(2).pow(128));
};
/**
* Should be used to format output hash
*
* @method formatOutputHash
* @param {SolidityParam}
* @returns {String} right-aligned output bytes formatted to hex
*/
var formatOutputHash = function (param) {
return "0x" + param.value;
};
/**
* Should be used to format output bool
*
@ -626,11 +615,11 @@ var formatOutputBool = function (param) {
/**
* Should be used to format output string
*
* @method formatOutputString
* @method formatOutputBytes
* @param {SolidityParam} left-aligned hex representation of string
* @returns {String} ascii string
*/
var formatOutputString = function (param) {
var formatOutputBytes = function (param) {
// length might also be important!
return utils.toAscii(param.suffix);
};
@ -649,16 +638,15 @@ var formatOutputAddress = function (param) {
module.exports = {
formatInputInt: formatInputInt,
formatInputString: formatInputString,
formatInputBytes: formatInputBytes,
formatInputBool: formatInputBool,
formatInputReal: formatInputReal,
formatOutputInt: formatOutputInt,
formatOutputUInt: formatOutputUInt,
formatOutputReal: formatOutputReal,
formatOutputUReal: formatOutputUReal,
formatOutputHash: formatOutputHash,
formatOutputBool: formatOutputBool,
formatOutputString: formatOutputString,
formatOutputBytes: formatOutputBytes,
formatOutputAddress: formatOutputAddress
};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

28
dist/web3.js vendored
View File

@ -435,8 +435,8 @@ var coder = new SolidityCoder([
name: 'bytes',
match: 'prefix',
mode: 'bytes',
inputFormatter: f.formatInputString,
outputFormatter: f.formatOutputString
inputFormatter: f.formatInputBytes,
outputFormatter: f.formatOutputBytes
}),
new SolidityType({
name: 'real',
@ -505,11 +505,11 @@ var formatInputInt = function (value) {
/**
* Formats input value to byte representation of string
*
* @method formatInputString
* @method formatInputBytes
* @param {String}
* @returns {SolidityParam}
*/
var formatInputString = function (value) {
var formatInputBytes = function (value) {
var result = utils.fromAscii(value, c.ETH_PADDING).substr(2);
return new SolidityParam('', formatInputInt(value.length).value, result);
};
@ -601,17 +601,6 @@ var formatOutputUReal = function (param) {
return formatOutputUInt(param).dividedBy(new BigNumber(2).pow(128));
};
/**
* Should be used to format output hash
*
* @method formatOutputHash
* @param {SolidityParam}
* @returns {String} right-aligned output bytes formatted to hex
*/
var formatOutputHash = function (param) {
return "0x" + param.value;
};
/**
* Should be used to format output bool
*
@ -626,11 +615,11 @@ var formatOutputBool = function (param) {
/**
* Should be used to format output string
*
* @method formatOutputString
* @method formatOutputBytes
* @param {SolidityParam} left-aligned hex representation of string
* @returns {String} ascii string
*/
var formatOutputString = function (param) {
var formatOutputBytes = function (param) {
// length might also be important!
return utils.toAscii(param.suffix);
};
@ -649,16 +638,15 @@ var formatOutputAddress = function (param) {
module.exports = {
formatInputInt: formatInputInt,
formatInputString: formatInputString,
formatInputBytes: formatInputBytes,
formatInputBool: formatInputBool,
formatInputReal: formatInputReal,
formatOutputInt: formatOutputInt,
formatOutputUInt: formatOutputUInt,
formatOutputReal: formatOutputReal,
formatOutputUReal: formatOutputUReal,
formatOutputHash: formatOutputHash,
formatOutputBool: formatOutputBool,
formatOutputString: formatOutputString,
formatOutputBytes: formatOutputBytes,
formatOutputAddress: formatOutputAddress
};

6
dist/web3.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/web3.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -299,8 +299,8 @@ var coder = new SolidityCoder([
name: 'bytes',
match: 'prefix',
mode: 'bytes',
inputFormatter: f.formatInputString,
outputFormatter: f.formatOutputString
inputFormatter: f.formatInputBytes,
outputFormatter: f.formatOutputBytes
}),
new SolidityType({
name: 'real',

View File

@ -45,11 +45,11 @@ var formatInputInt = function (value) {
/**
* Formats input value to byte representation of string
*
* @method formatInputString
* @method formatInputBytes
* @param {String}
* @returns {SolidityParam}
*/
var formatInputString = function (value) {
var formatInputBytes = function (value) {
var result = utils.fromAscii(value, c.ETH_PADDING).substr(2);
return new SolidityParam('', formatInputInt(value.length).value, result);
};
@ -141,17 +141,6 @@ var formatOutputUReal = function (param) {
return formatOutputUInt(param).dividedBy(new BigNumber(2).pow(128));
};
/**
* Should be used to format output hash
*
* @method formatOutputHash
* @param {SolidityParam}
* @returns {String} right-aligned output bytes formatted to hex
*/
var formatOutputHash = function (param) {
return "0x" + param.value;
};
/**
* Should be used to format output bool
*
@ -166,11 +155,11 @@ var formatOutputBool = function (param) {
/**
* Should be used to format output string
*
* @method formatOutputString
* @method formatOutputBytes
* @param {SolidityParam} left-aligned hex representation of string
* @returns {String} ascii string
*/
var formatOutputString = function (param) {
var formatOutputBytes = function (param) {
// length might also be important!
return utils.toAscii(param.suffix);
};
@ -189,16 +178,15 @@ var formatOutputAddress = function (param) {
module.exports = {
formatInputInt: formatInputInt,
formatInputString: formatInputString,
formatInputBytes: formatInputBytes,
formatInputBool: formatInputBool,
formatInputReal: formatInputReal,
formatOutputInt: formatOutputInt,
formatOutputUInt: formatOutputUInt,
formatOutputReal: formatOutputReal,
formatOutputUReal: formatOutputUReal,
formatOutputHash: formatOutputHash,
formatOutputBool: formatOutputBool,
formatOutputString: formatOutputString,
formatOutputBytes: formatOutputBytes,
formatOutputAddress: formatOutputAddress
};