throw an exception on invalid address

This commit is contained in:
debris 2015-08-08 21:22:01 +02:00
parent 7cf4e78cf4
commit 283b658656
13 changed files with 318 additions and 85 deletions

62
dist/web3-light.js vendored
View File

@ -3156,7 +3156,7 @@ var getBalance = new Method({
name: 'getBalance', name: 'getBalance',
call: 'eth_getBalance', call: 'eth_getBalance',
params: 2, params: 2,
inputFormatter: [utils.toAddress, formatters.inputDefaultBlockNumberFormatter], inputFormatter: [formatters.inputAddressFormatter, formatters.inputDefaultBlockNumberFormatter],
outputFormatter: formatters.outputBigNumberFormatter outputFormatter: formatters.outputBigNumberFormatter
}); });
@ -3171,7 +3171,7 @@ var getCode = new Method({
name: 'getCode', name: 'getCode',
call: 'eth_getCode', call: 'eth_getCode',
params: 2, params: 2,
inputFormatter: [utils.toAddress, formatters.inputDefaultBlockNumberFormatter] inputFormatter: [formatters.inputAddressFormatter, formatters.inputDefaultBlockNumberFormatter]
}); });
var getBlock = new Method({ var getBlock = new Method({
@ -3261,14 +3261,14 @@ var call = new Method({
name: 'call', name: 'call',
call: 'eth_call', call: 'eth_call',
params: 2, params: 2,
inputFormatter: [formatters.inputTransactionFormatter, formatters.inputDefaultBlockNumberFormatter] inputFormatter: [formatters.inputCallFormatter, formatters.inputDefaultBlockNumberFormatter]
}); });
var estimateGas = new Method({ var estimateGas = new Method({
name: 'estimateGas', name: 'estimateGas',
call: 'eth_estimateGas', call: 'eth_estimateGas',
params: 1, params: 1,
inputFormatter: [formatters.inputTransactionFormatter], inputFormatter: [formatters.inputCallFormatter],
outputFormatter: utils.toDecimal outputFormatter: utils.toDecimal
}); });
@ -3813,6 +3813,7 @@ module.exports = Filter;
var utils = require('../utils/utils'); var utils = require('../utils/utils');
var config = require('../utils/config'); var config = require('../utils/config');
var Iban = require('./iban');
/** /**
* Should the format output to a big number * Should the format output to a big number
@ -3845,6 +3846,34 @@ var inputBlockNumberFormatter = function (blockNumber) {
return utils.toHex(blockNumber); return utils.toHex(blockNumber);
}; };
/**
* Formats the input of a transaction and converts all values to HEX
*
* @method inputCallFormatter
* @param {Object} transaction options
* @returns object
*/
var inputCallFormatter = function (options){
options.from = options.from || config.defaultAccount;
if (options.from) {
options.from = inputAddressFormatter(options.from);
}
if (options.to) { // it might be contract creation
options.to = inputAddressFormatter(options.to);
}
['gasPrice', 'gas', 'value', 'nonce'].filter(function (key) {
return options[key] !== undefined;
}).forEach(function(key){
options[key] = utils.fromDecimal(options[key]);
});
return options;
};
/** /**
* Formats the input of a transaction and converts all values to HEX * Formats the input of a transaction and converts all values to HEX
* *
@ -3855,11 +3884,10 @@ var inputBlockNumberFormatter = function (blockNumber) {
var inputTransactionFormatter = function (options){ var inputTransactionFormatter = function (options){
options.from = options.from || config.defaultAccount; options.from = options.from || config.defaultAccount;
options.from = inputAddressFormatter(options.from);
// make code -> data if (options.to) { // it might be contract creation
if (options.code) { options.to = inputAddressFormatter(options.to);
options.data = options.code;
delete options.code;
} }
['gasPrice', 'gas', 'value', 'nonce'].filter(function (key) { ['gasPrice', 'gas', 'value', 'nonce'].filter(function (key) {
@ -4020,10 +4048,24 @@ var outputPostFormatter = function(post){
return post; return post;
}; };
var inputAddressFormatter = function (address) {
var iban = new Iban(address);
if (iban.isValid() && iban.isDirect()) {
return '0x' + iban.address();
} else if (utils.isStrictAddress(address)) {
return address;
} else if (utils.isAddress(address)) {
return '0x' + address;
}
throw 'invalid address';
};
module.exports = { module.exports = {
inputDefaultBlockNumberFormatter: inputDefaultBlockNumberFormatter, inputDefaultBlockNumberFormatter: inputDefaultBlockNumberFormatter,
inputBlockNumberFormatter: inputBlockNumberFormatter, inputBlockNumberFormatter: inputBlockNumberFormatter,
inputCallFormatter: inputTransactionFormatter,
inputTransactionFormatter: inputTransactionFormatter, inputTransactionFormatter: inputTransactionFormatter,
inputAddressFormatter: inputAddressFormatter,
inputPostFormatter: inputPostFormatter, inputPostFormatter: inputPostFormatter,
outputBigNumberFormatter: outputBigNumberFormatter, outputBigNumberFormatter: outputBigNumberFormatter,
outputTransactionFormatter: outputTransactionFormatter, outputTransactionFormatter: outputTransactionFormatter,
@ -4034,7 +4076,7 @@ module.exports = {
}; };
},{"../utils/config":17,"../utils/utils":19}],31:[function(require,module,exports){ },{"../utils/config":17,"../utils/utils":19,"./iban":33}],31:[function(require,module,exports){
/* /*
This file is part of ethereum.js. This file is part of ethereum.js.
@ -4546,7 +4588,7 @@ Iban.prototype.isValid = function () {
* @returns {Boolean} true if it is, otherwise false * @returns {Boolean} true if it is, otherwise false
*/ */
Iban.prototype.isDirect = function () { Iban.prototype.isDirect = function () {
return this._iban.length === 34; return this._iban.length === 34 || this._iban.length === 35;
}; };
/** /**

File diff suppressed because one or more lines are too long

62
dist/web3.js vendored
View File

@ -3156,7 +3156,7 @@ var getBalance = new Method({
name: 'getBalance', name: 'getBalance',
call: 'eth_getBalance', call: 'eth_getBalance',
params: 2, params: 2,
inputFormatter: [utils.toAddress, formatters.inputDefaultBlockNumberFormatter], inputFormatter: [formatters.inputAddressFormatter, formatters.inputDefaultBlockNumberFormatter],
outputFormatter: formatters.outputBigNumberFormatter outputFormatter: formatters.outputBigNumberFormatter
}); });
@ -3171,7 +3171,7 @@ var getCode = new Method({
name: 'getCode', name: 'getCode',
call: 'eth_getCode', call: 'eth_getCode',
params: 2, params: 2,
inputFormatter: [utils.toAddress, formatters.inputDefaultBlockNumberFormatter] inputFormatter: [formatters.inputAddressFormatter, formatters.inputDefaultBlockNumberFormatter]
}); });
var getBlock = new Method({ var getBlock = new Method({
@ -3261,14 +3261,14 @@ var call = new Method({
name: 'call', name: 'call',
call: 'eth_call', call: 'eth_call',
params: 2, params: 2,
inputFormatter: [formatters.inputTransactionFormatter, formatters.inputDefaultBlockNumberFormatter] inputFormatter: [formatters.inputCallFormatter, formatters.inputDefaultBlockNumberFormatter]
}); });
var estimateGas = new Method({ var estimateGas = new Method({
name: 'estimateGas', name: 'estimateGas',
call: 'eth_estimateGas', call: 'eth_estimateGas',
params: 1, params: 1,
inputFormatter: [formatters.inputTransactionFormatter], inputFormatter: [formatters.inputCallFormatter],
outputFormatter: utils.toDecimal outputFormatter: utils.toDecimal
}); });
@ -3813,6 +3813,7 @@ module.exports = Filter;
var utils = require('../utils/utils'); var utils = require('../utils/utils');
var config = require('../utils/config'); var config = require('../utils/config');
var Iban = require('./iban');
/** /**
* Should the format output to a big number * Should the format output to a big number
@ -3845,6 +3846,34 @@ var inputBlockNumberFormatter = function (blockNumber) {
return utils.toHex(blockNumber); return utils.toHex(blockNumber);
}; };
/**
* Formats the input of a transaction and converts all values to HEX
*
* @method inputCallFormatter
* @param {Object} transaction options
* @returns object
*/
var inputCallFormatter = function (options){
options.from = options.from || config.defaultAccount;
if (options.from) {
options.from = inputAddressFormatter(options.from);
}
if (options.to) { // it might be contract creation
options.to = inputAddressFormatter(options.to);
}
['gasPrice', 'gas', 'value', 'nonce'].filter(function (key) {
return options[key] !== undefined;
}).forEach(function(key){
options[key] = utils.fromDecimal(options[key]);
});
return options;
};
/** /**
* Formats the input of a transaction and converts all values to HEX * Formats the input of a transaction and converts all values to HEX
* *
@ -3855,11 +3884,10 @@ var inputBlockNumberFormatter = function (blockNumber) {
var inputTransactionFormatter = function (options){ var inputTransactionFormatter = function (options){
options.from = options.from || config.defaultAccount; options.from = options.from || config.defaultAccount;
options.from = inputAddressFormatter(options.from);
// make code -> data if (options.to) { // it might be contract creation
if (options.code) { options.to = inputAddressFormatter(options.to);
options.data = options.code;
delete options.code;
} }
['gasPrice', 'gas', 'value', 'nonce'].filter(function (key) { ['gasPrice', 'gas', 'value', 'nonce'].filter(function (key) {
@ -4020,10 +4048,24 @@ var outputPostFormatter = function(post){
return post; return post;
}; };
var inputAddressFormatter = function (address) {
var iban = new Iban(address);
if (iban.isValid() && iban.isDirect()) {
return '0x' + iban.address();
} else if (utils.isStrictAddress(address)) {
return address;
} else if (utils.isAddress(address)) {
return '0x' + address;
}
throw 'invalid address';
};
module.exports = { module.exports = {
inputDefaultBlockNumberFormatter: inputDefaultBlockNumberFormatter, inputDefaultBlockNumberFormatter: inputDefaultBlockNumberFormatter,
inputBlockNumberFormatter: inputBlockNumberFormatter, inputBlockNumberFormatter: inputBlockNumberFormatter,
inputCallFormatter: inputTransactionFormatter,
inputTransactionFormatter: inputTransactionFormatter, inputTransactionFormatter: inputTransactionFormatter,
inputAddressFormatter: inputAddressFormatter,
inputPostFormatter: inputPostFormatter, inputPostFormatter: inputPostFormatter,
outputBigNumberFormatter: outputBigNumberFormatter, outputBigNumberFormatter: outputBigNumberFormatter,
outputTransactionFormatter: outputTransactionFormatter, outputTransactionFormatter: outputTransactionFormatter,
@ -4034,7 +4076,7 @@ module.exports = {
}; };
},{"../utils/config":17,"../utils/utils":19}],31:[function(require,module,exports){ },{"../utils/config":17,"../utils/utils":19,"./iban":33}],31:[function(require,module,exports){
/* /*
This file is part of ethereum.js. This file is part of ethereum.js.
@ -4546,7 +4588,7 @@ Iban.prototype.isValid = function () {
* @returns {Boolean} true if it is, otherwise false * @returns {Boolean} true if it is, otherwise false
*/ */
Iban.prototype.isDirect = function () { Iban.prototype.isDirect = function () {
return this._iban.length === 34; return this._iban.length === 34 || this._iban.length === 35;
}; };
/** /**

111
dist/web3.js.map vendored Normal file

File diff suppressed because one or more lines are too long

8
dist/web3.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -80,7 +80,7 @@ var getBalance = new Method({
name: 'getBalance', name: 'getBalance',
call: 'eth_getBalance', call: 'eth_getBalance',
params: 2, params: 2,
inputFormatter: [utils.toAddress, formatters.inputDefaultBlockNumberFormatter], inputFormatter: [formatters.inputAddressFormatter, formatters.inputDefaultBlockNumberFormatter],
outputFormatter: formatters.outputBigNumberFormatter outputFormatter: formatters.outputBigNumberFormatter
}); });
@ -95,7 +95,7 @@ var getCode = new Method({
name: 'getCode', name: 'getCode',
call: 'eth_getCode', call: 'eth_getCode',
params: 2, params: 2,
inputFormatter: [utils.toAddress, formatters.inputDefaultBlockNumberFormatter] inputFormatter: [formatters.inputAddressFormatter, formatters.inputDefaultBlockNumberFormatter]
}); });
var getBlock = new Method({ var getBlock = new Method({
@ -185,14 +185,14 @@ var call = new Method({
name: 'call', name: 'call',
call: 'eth_call', call: 'eth_call',
params: 2, params: 2,
inputFormatter: [formatters.inputTransactionFormatter, formatters.inputDefaultBlockNumberFormatter] inputFormatter: [formatters.inputCallFormatter, formatters.inputDefaultBlockNumberFormatter]
}); });
var estimateGas = new Method({ var estimateGas = new Method({
name: 'estimateGas', name: 'estimateGas',
call: 'eth_estimateGas', call: 'eth_estimateGas',
params: 1, params: 1,
inputFormatter: [formatters.inputTransactionFormatter], inputFormatter: [formatters.inputCallFormatter],
outputFormatter: utils.toDecimal outputFormatter: utils.toDecimal
}); });

View File

@ -56,6 +56,34 @@ var inputBlockNumberFormatter = function (blockNumber) {
return utils.toHex(blockNumber); return utils.toHex(blockNumber);
}; };
/**
* Formats the input of a transaction and converts all values to HEX
*
* @method inputCallFormatter
* @param {Object} transaction options
* @returns object
*/
var inputCallFormatter = function (options){
options.from = options.from || config.defaultAccount;
if (options.from) {
options.from = inputAddressFormatter(options.from);
}
if (options.to) { // it might be contract creation
options.to = inputAddressFormatter(options.to);
}
['gasPrice', 'gas', 'value', 'nonce'].filter(function (key) {
return options[key] !== undefined;
}).forEach(function(key){
options[key] = utils.fromDecimal(options[key]);
});
return options;
};
/** /**
* Formats the input of a transaction and converts all values to HEX * Formats the input of a transaction and converts all values to HEX
* *
@ -66,11 +94,10 @@ var inputBlockNumberFormatter = function (blockNumber) {
var inputTransactionFormatter = function (options){ var inputTransactionFormatter = function (options){
options.from = options.from || config.defaultAccount; options.from = options.from || config.defaultAccount;
options.from = inputAddressFormatter(options.from);
// make code -> data if (options.to) { // it might be contract creation
if (options.code) { options.to = inputAddressFormatter(options.to);
options.data = options.code;
delete options.code;
} }
['gasPrice', 'gas', 'value', 'nonce'].filter(function (key) { ['gasPrice', 'gas', 'value', 'nonce'].filter(function (key) {
@ -246,6 +273,7 @@ var inputAddressFormatter = function (address) {
module.exports = { module.exports = {
inputDefaultBlockNumberFormatter: inputDefaultBlockNumberFormatter, inputDefaultBlockNumberFormatter: inputDefaultBlockNumberFormatter,
inputBlockNumberFormatter: inputBlockNumberFormatter, inputBlockNumberFormatter: inputBlockNumberFormatter,
inputCallFormatter: inputCallFormatter,
inputTransactionFormatter: inputTransactionFormatter, inputTransactionFormatter: inputTransactionFormatter,
inputAddressFormatter: inputAddressFormatter, inputAddressFormatter: inputAddressFormatter,
inputPostFormatter: inputPostFormatter, inputPostFormatter: inputPostFormatter,

View File

@ -7,6 +7,14 @@ var FakeHttpProvider = require('./helpers/FakeHttpProvider');
var method = 'sendTransaction'; var method = 'sendTransaction';
var tests = [{ var tests = [{
input: {
'from': 'XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS',
'to': 'XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS'
},
formattedInput: {
'from': '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
'to': '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8'
},
result: '0xb', result: '0xb',
formattedResult: '0xb', formattedResult: '0xb',
call: 'eth_'+ method call: 'eth_'+ method
@ -23,11 +31,11 @@ describe('async', function () {
provider.injectValidation(function (payload) { provider.injectValidation(function (payload) {
assert.equal(payload.jsonrpc, '2.0'); assert.equal(payload.jsonrpc, '2.0');
assert.equal(payload.method, test.call); assert.equal(payload.method, test.call);
assert.deepEqual(payload.params, [{}]); assert.deepEqual(payload.params, [test.formattedInput]);
}); });
// when // when
web3.eth[method]({}, function(error, result){ web3.eth[method](test.input, function(error, result){
// then // then
assert.isNull(error); assert.isNull(error);
@ -50,11 +58,11 @@ describe('async', function () {
provider.injectValidation(function (payload) { provider.injectValidation(function (payload) {
assert.equal(payload.jsonrpc, '2.0'); assert.equal(payload.jsonrpc, '2.0');
assert.equal(payload.method, test.call); assert.equal(payload.method, test.call);
assert.deepEqual(payload.params, [{}]); assert.deepEqual(payload.params, [test.formattedInput]);
}); });
// when // when
web3.eth[method]({}, function(error, result){ web3.eth[method](test.input, function(error, result){
// then // then
assert.isUndefined(result); assert.isUndefined(result);

View File

@ -55,7 +55,7 @@ var desc = [{
var address = '0x1234567890123456789012345678901234567890'; var address = '0x1234567890123456789012345678901234567890';
describe('web3.eth.contract', function () { describe('contract', function () {
describe('event', function () { describe('event', function () {
it('should create event filter', function (done) { it('should create event filter', function (done) {
var provider = new FakeHttpProvider(); var provider = new FakeHttpProvider();
@ -318,13 +318,14 @@ describe('web3.eth.contract', function () {
data: '0x' + sha3(signature).slice(0, 8) + data: '0x' + sha3(signature).slice(0, 8) +
'0000000000000000000000001234567890123456789012345678901234567890' + '0000000000000000000000001234567890123456789012345678901234567890' +
'0000000000000000000000000000000000000000000000000000000000000011' , '0000000000000000000000000000000000000000000000000000000000000011' ,
from: address,
to: address to: address
}]); }]);
}); });
var contract = web3.eth.contract(desc).at(address); var contract = web3.eth.contract(desc).at(address);
contract.send(address, 17); contract.send(address, 17, {from: address});
}); });
it('should make a call with optional params', function () { it('should make a call with optional params', function () {

View File

@ -7,8 +7,8 @@ var tests = [{
input: { input: {
data: '0x34234bf23bf4234', data: '0x34234bf23bf4234',
value: new BigNumber(100), value: new BigNumber(100),
from: '0x00000', from: '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
to: '0x00000', to: '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
nonce: 1000, nonce: 1000,
gas: 1000, gas: 1000,
gasPrice: new BigNumber(1000) gasPrice: new BigNumber(1000)
@ -16,8 +16,8 @@ var tests = [{
result: { result: {
data: '0x34234bf23bf4234', data: '0x34234bf23bf4234',
value: '0x64', value: '0x64',
from: '0x00000', from: '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
to: '0x00000', to: '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
nonce: '0x3e8', nonce: '0x3e8',
gas: '0x3e8', gas: '0x3e8',
gasPrice: '0x3e8' gasPrice: '0x3e8'
@ -26,46 +26,29 @@ var tests = [{
input: { input: {
data: '0x34234bf23bf4234', data: '0x34234bf23bf4234',
value: new BigNumber(100), value: new BigNumber(100),
from: '0x00000', from: '00c5496aee77c1ba1f0854206a26dda82a81d6d8',
to: '0x00000', to: '00c5496aee77c1ba1f0854206a26dda82a81d6d8',
}, },
result: { result: {
data: '0x34234bf23bf4234', data: '0x34234bf23bf4234',
value: '0x64', value: '0x64',
from: '0x00000', from: '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
to: '0x00000', to: '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
} }
},{ },{
input: { input: {
data: '0x34234bf23bf4234', data: '0x34234bf23bf4234',
value: new BigNumber(100), value: new BigNumber(100),
from: '0x00000', from: '00c5496aee77c1ba1f0854206a26dda82a81d6d8',
to: '0x00000', to: '00c5496aee77c1ba1f0854206a26dda82a81d6d8',
gas: '1000', gas: '1000',
gasPrice: new BigNumber(1000) gasPrice: new BigNumber(1000)
}, },
result: { result: {
data: '0x34234bf23bf4234', data: '0x34234bf23bf4234',
value: '0x64', value: '0x64',
from: '0x00000', from: '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
to: '0x00000', to: '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
gas: '0x3e8',
gasPrice: '0x3e8'
},
},{
input: {
data: '0x34234bf23bf4234',
value: new BigNumber(100),
from: '0xXE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS',
to: '0xXE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS',
gas: '1000',
gasPrice: new BigNumber(1000)
},
result: {
data: '0x34234bf23bf4234',
value: '0x64',
from: '0xXE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS',
to: '0xXE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS',
gas: '0x3e8', gas: '0x3e8',
gasPrice: '0x3e8' gasPrice: '0x3e8'
}, },
@ -81,11 +64,26 @@ var tests = [{
result: { result: {
data: '0x34234bf23bf4234', data: '0x34234bf23bf4234',
value: '0x64', value: '0x64',
from: 'XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS', from: '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
to: 'XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS', to: '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
gas: '0x3e8', gas: '0x3e8',
gasPrice: '0x3e8' gasPrice: '0x3e8'
}, },
}, {
input: {
data: '0x34234bf23bf4234',
value: new BigNumber(100),
from: 'XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS',
gas: '1000',
gasPrice: new BigNumber(1000)
},
result: {
data: '0x34234bf23bf4234',
value: '0x64',
from: '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
gas: '0x3e8',
gasPrice: '0x3e8'
}
}]; }];
describe('formatters', function () { describe('formatters', function () {

View File

@ -237,7 +237,7 @@ describe('web3.eth.contract', function() {
} }
}); });
contract(description).new(2, {data: code}, function(e, myCon){ contract(description).new(2, {from: address, data: code}, function(e, myCon){
}); });
}); });

View File

@ -5,25 +5,25 @@ var testMethod = require('./helpers/test.method.js');
var method = 'getBalance'; var method = 'getBalance';
var tests = [{ var tests = [{
args: [301, 2], args: ['0x000000000000000000000000000000000000012d', 2],
formattedArgs: ['0x000000000000000000000000000000000000012d', '0x2'], formattedArgs: ['0x000000000000000000000000000000000000012d', '0x2'],
result: '0x31981', result: '0x31981',
formattedResult: new BigNumber('0x31981', 16), formattedResult: new BigNumber('0x31981', 16),
call: 'eth_'+ method call: 'eth_'+ method
},{ },{
args: ['0x12d', '0x1'], args: ['0x000000000000000000000000000000000000012d', '0x1'],
formattedArgs: ['0x000000000000000000000000000000000000012d', '0x1'], formattedArgs: ['0x000000000000000000000000000000000000012d', '0x1'],
result: '0x31981', result: '0x31981',
formattedResult: new BigNumber('0x31981', 16), formattedResult: new BigNumber('0x31981', 16),
call: 'eth_'+ method call: 'eth_'+ method
}, { }, {
args: [0x12d, 0x1], args: ['0x000000000000000000000000000000000000012d', 0x1],
formattedArgs: ['0x000000000000000000000000000000000000012d', '0x1'], formattedArgs: ['0x000000000000000000000000000000000000012d', '0x1'],
result: '0x31981', result: '0x31981',
formattedResult: new BigNumber('0x31981', 16), formattedResult: new BigNumber('0x31981', 16),
call: 'eth_'+ method call: 'eth_'+ method
}, { }, {
args: [0x12d], args: ['0x000000000000000000000000000000000000012d'],
formattedArgs: ['0x000000000000000000000000000000000000012d', web3.eth.defaultBlock], formattedArgs: ['0x000000000000000000000000000000000000012d', web3.eth.defaultBlock],
result: '0x31981', result: '0x31981',
formattedResult: new BigNumber('0x31981', 16), formattedResult: new BigNumber('0x31981', 16),
@ -41,20 +41,26 @@ var tests = [{
formattedResult: new BigNumber('0x31981', 16), formattedResult: new BigNumber('0x31981', 16),
call: 'eth_'+ method call: 'eth_'+ method
}, { }, {
args: ['1255171934823351805979544608257289442498956485798', 0x1], args: ['0x000000000000000000000000000000000000012d', 0x1],
formattedArgs: ['0xdbdbdb2cbd23b783741e8d7fcf51e459b497e4a6', '0x1'], formattedArgs: ['0x000000000000000000000000000000000000012d', '0x1'],
result: '0x31981', result: '0x31981',
formattedResult: new BigNumber('0x31981', 16), formattedResult: new BigNumber('0x31981', 16),
call: 'eth_'+ method call: 'eth_'+ method
}, { }, {
args: ['1255171934823351805979544608257289442498956485798'], args: ['0x000000000000000000000000000000000000012d'],
formattedArgs: ['0xdbdbdb2cbd23b783741e8d7fcf51e459b497e4a6', 'latest'], formattedArgs: ['0x000000000000000000000000000000000000012d', 'latest'],
result: '0x31981', result: '0x31981',
formattedResult: new BigNumber('0x31981', 16), formattedResult: new BigNumber('0x31981', 16),
call: 'eth_'+ method call: 'eth_'+ method
}, { }, {
args: ['0x00000000000000000000aaaaaaaaaaaaaaaaaaa'], args: ['000000000000000000000000000000000000012d'],
formattedArgs: ['0x000000000000000000000aaaaaaaaaaaaaaaaaaa', 'latest'], formattedArgs: ['0x000000000000000000000000000000000000012d', 'latest'],
result: '0x31981',
formattedResult: new BigNumber('0x31981', 16),
call: 'eth_'+ method
}, {
args: ['XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS'],
formattedArgs: ['0x00c5496aee77c1ba1f0854206a26dda82a81d6d8', 'latest'],
result: '0x31981', result: '0x31981',
formattedResult: new BigNumber('0x31981', 16), formattedResult: new BigNumber('0x31981', 16),
call: 'eth_'+ method call: 'eth_'+ method

View File

@ -7,7 +7,7 @@ describe('web3.eth.sendIBANTransaction', function () {
it('should send transaction', function () { it('should send transaction', function () {
var iban = 'XE81ETHXREGGAVOFYORK'; var iban = 'XE81ETHXREGGAVOFYORK';
var address = '0x1234567890123456789012345678901234500000'; var address = '0x1234567890123456789012345678901234500000';
var exAddress = '0x1234567890123456789012345678901234567890' var exAddress = '0x1234567890123456789012345678901234567890'
var provider = new FakeHttpProvider2(); var provider = new FakeHttpProvider2();