mirror of https://github.com/status-im/web3.js.git
throw an exception on invalid address
This commit is contained in:
parent
7cf4e78cf4
commit
283b658656
|
@ -3156,7 +3156,7 @@ var getBalance = new Method({
|
|||
name: 'getBalance',
|
||||
call: 'eth_getBalance',
|
||||
params: 2,
|
||||
inputFormatter: [utils.toAddress, formatters.inputDefaultBlockNumberFormatter],
|
||||
inputFormatter: [formatters.inputAddressFormatter, formatters.inputDefaultBlockNumberFormatter],
|
||||
outputFormatter: formatters.outputBigNumberFormatter
|
||||
});
|
||||
|
||||
|
@ -3171,7 +3171,7 @@ var getCode = new Method({
|
|||
name: 'getCode',
|
||||
call: 'eth_getCode',
|
||||
params: 2,
|
||||
inputFormatter: [utils.toAddress, formatters.inputDefaultBlockNumberFormatter]
|
||||
inputFormatter: [formatters.inputAddressFormatter, formatters.inputDefaultBlockNumberFormatter]
|
||||
});
|
||||
|
||||
var getBlock = new Method({
|
||||
|
@ -3261,14 +3261,14 @@ var call = new Method({
|
|||
name: 'call',
|
||||
call: 'eth_call',
|
||||
params: 2,
|
||||
inputFormatter: [formatters.inputTransactionFormatter, formatters.inputDefaultBlockNumberFormatter]
|
||||
inputFormatter: [formatters.inputCallFormatter, formatters.inputDefaultBlockNumberFormatter]
|
||||
});
|
||||
|
||||
var estimateGas = new Method({
|
||||
name: 'estimateGas',
|
||||
call: 'eth_estimateGas',
|
||||
params: 1,
|
||||
inputFormatter: [formatters.inputTransactionFormatter],
|
||||
inputFormatter: [formatters.inputCallFormatter],
|
||||
outputFormatter: utils.toDecimal
|
||||
});
|
||||
|
||||
|
@ -3813,6 +3813,7 @@ module.exports = Filter;
|
|||
|
||||
var utils = require('../utils/utils');
|
||||
var config = require('../utils/config');
|
||||
var Iban = require('./iban');
|
||||
|
||||
/**
|
||||
* Should the format output to a big number
|
||||
|
@ -3845,6 +3846,34 @@ var inputBlockNumberFormatter = function (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
|
||||
*
|
||||
|
@ -3855,11 +3884,10 @@ var inputBlockNumberFormatter = function (blockNumber) {
|
|||
var inputTransactionFormatter = function (options){
|
||||
|
||||
options.from = options.from || config.defaultAccount;
|
||||
options.from = inputAddressFormatter(options.from);
|
||||
|
||||
// make code -> data
|
||||
if (options.code) {
|
||||
options.data = options.code;
|
||||
delete options.code;
|
||||
if (options.to) { // it might be contract creation
|
||||
options.to = inputAddressFormatter(options.to);
|
||||
}
|
||||
|
||||
['gasPrice', 'gas', 'value', 'nonce'].filter(function (key) {
|
||||
|
@ -4020,10 +4048,24 @@ var outputPostFormatter = function(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 = {
|
||||
inputDefaultBlockNumberFormatter: inputDefaultBlockNumberFormatter,
|
||||
inputBlockNumberFormatter: inputBlockNumberFormatter,
|
||||
inputCallFormatter: inputTransactionFormatter,
|
||||
inputTransactionFormatter: inputTransactionFormatter,
|
||||
inputAddressFormatter: inputAddressFormatter,
|
||||
inputPostFormatter: inputPostFormatter,
|
||||
outputBigNumberFormatter: outputBigNumberFormatter,
|
||||
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.
|
||||
|
||||
|
@ -4546,7 +4588,7 @@ Iban.prototype.isValid = function () {
|
|||
* @returns {Boolean} true if it is, otherwise false
|
||||
*/
|
||||
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
|
@ -3156,7 +3156,7 @@ var getBalance = new Method({
|
|||
name: 'getBalance',
|
||||
call: 'eth_getBalance',
|
||||
params: 2,
|
||||
inputFormatter: [utils.toAddress, formatters.inputDefaultBlockNumberFormatter],
|
||||
inputFormatter: [formatters.inputAddressFormatter, formatters.inputDefaultBlockNumberFormatter],
|
||||
outputFormatter: formatters.outputBigNumberFormatter
|
||||
});
|
||||
|
||||
|
@ -3171,7 +3171,7 @@ var getCode = new Method({
|
|||
name: 'getCode',
|
||||
call: 'eth_getCode',
|
||||
params: 2,
|
||||
inputFormatter: [utils.toAddress, formatters.inputDefaultBlockNumberFormatter]
|
||||
inputFormatter: [formatters.inputAddressFormatter, formatters.inputDefaultBlockNumberFormatter]
|
||||
});
|
||||
|
||||
var getBlock = new Method({
|
||||
|
@ -3261,14 +3261,14 @@ var call = new Method({
|
|||
name: 'call',
|
||||
call: 'eth_call',
|
||||
params: 2,
|
||||
inputFormatter: [formatters.inputTransactionFormatter, formatters.inputDefaultBlockNumberFormatter]
|
||||
inputFormatter: [formatters.inputCallFormatter, formatters.inputDefaultBlockNumberFormatter]
|
||||
});
|
||||
|
||||
var estimateGas = new Method({
|
||||
name: 'estimateGas',
|
||||
call: 'eth_estimateGas',
|
||||
params: 1,
|
||||
inputFormatter: [formatters.inputTransactionFormatter],
|
||||
inputFormatter: [formatters.inputCallFormatter],
|
||||
outputFormatter: utils.toDecimal
|
||||
});
|
||||
|
||||
|
@ -3813,6 +3813,7 @@ module.exports = Filter;
|
|||
|
||||
var utils = require('../utils/utils');
|
||||
var config = require('../utils/config');
|
||||
var Iban = require('./iban');
|
||||
|
||||
/**
|
||||
* Should the format output to a big number
|
||||
|
@ -3845,6 +3846,34 @@ var inputBlockNumberFormatter = function (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
|
||||
*
|
||||
|
@ -3855,11 +3884,10 @@ var inputBlockNumberFormatter = function (blockNumber) {
|
|||
var inputTransactionFormatter = function (options){
|
||||
|
||||
options.from = options.from || config.defaultAccount;
|
||||
options.from = inputAddressFormatter(options.from);
|
||||
|
||||
// make code -> data
|
||||
if (options.code) {
|
||||
options.data = options.code;
|
||||
delete options.code;
|
||||
if (options.to) { // it might be contract creation
|
||||
options.to = inputAddressFormatter(options.to);
|
||||
}
|
||||
|
||||
['gasPrice', 'gas', 'value', 'nonce'].filter(function (key) {
|
||||
|
@ -4020,10 +4048,24 @@ var outputPostFormatter = function(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 = {
|
||||
inputDefaultBlockNumberFormatter: inputDefaultBlockNumberFormatter,
|
||||
inputBlockNumberFormatter: inputBlockNumberFormatter,
|
||||
inputCallFormatter: inputTransactionFormatter,
|
||||
inputTransactionFormatter: inputTransactionFormatter,
|
||||
inputAddressFormatter: inputAddressFormatter,
|
||||
inputPostFormatter: inputPostFormatter,
|
||||
outputBigNumberFormatter: outputBigNumberFormatter,
|
||||
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.
|
||||
|
||||
|
@ -4546,7 +4588,7 @@ Iban.prototype.isValid = function () {
|
|||
* @returns {Boolean} true if it is, otherwise false
|
||||
*/
|
||||
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
File diff suppressed because one or more lines are too long
|
@ -80,7 +80,7 @@ var getBalance = new Method({
|
|||
name: 'getBalance',
|
||||
call: 'eth_getBalance',
|
||||
params: 2,
|
||||
inputFormatter: [utils.toAddress, formatters.inputDefaultBlockNumberFormatter],
|
||||
inputFormatter: [formatters.inputAddressFormatter, formatters.inputDefaultBlockNumberFormatter],
|
||||
outputFormatter: formatters.outputBigNumberFormatter
|
||||
});
|
||||
|
||||
|
@ -95,7 +95,7 @@ var getCode = new Method({
|
|||
name: 'getCode',
|
||||
call: 'eth_getCode',
|
||||
params: 2,
|
||||
inputFormatter: [utils.toAddress, formatters.inputDefaultBlockNumberFormatter]
|
||||
inputFormatter: [formatters.inputAddressFormatter, formatters.inputDefaultBlockNumberFormatter]
|
||||
});
|
||||
|
||||
var getBlock = new Method({
|
||||
|
@ -185,14 +185,14 @@ var call = new Method({
|
|||
name: 'call',
|
||||
call: 'eth_call',
|
||||
params: 2,
|
||||
inputFormatter: [formatters.inputTransactionFormatter, formatters.inputDefaultBlockNumberFormatter]
|
||||
inputFormatter: [formatters.inputCallFormatter, formatters.inputDefaultBlockNumberFormatter]
|
||||
});
|
||||
|
||||
var estimateGas = new Method({
|
||||
name: 'estimateGas',
|
||||
call: 'eth_estimateGas',
|
||||
params: 1,
|
||||
inputFormatter: [formatters.inputTransactionFormatter],
|
||||
inputFormatter: [formatters.inputCallFormatter],
|
||||
outputFormatter: utils.toDecimal
|
||||
});
|
||||
|
||||
|
|
|
@ -56,6 +56,34 @@ var inputBlockNumberFormatter = function (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
|
||||
*
|
||||
|
@ -66,11 +94,10 @@ var inputBlockNumberFormatter = function (blockNumber) {
|
|||
var inputTransactionFormatter = function (options){
|
||||
|
||||
options.from = options.from || config.defaultAccount;
|
||||
options.from = inputAddressFormatter(options.from);
|
||||
|
||||
// make code -> data
|
||||
if (options.code) {
|
||||
options.data = options.code;
|
||||
delete options.code;
|
||||
if (options.to) { // it might be contract creation
|
||||
options.to = inputAddressFormatter(options.to);
|
||||
}
|
||||
|
||||
['gasPrice', 'gas', 'value', 'nonce'].filter(function (key) {
|
||||
|
@ -246,6 +273,7 @@ var inputAddressFormatter = function (address) {
|
|||
module.exports = {
|
||||
inputDefaultBlockNumberFormatter: inputDefaultBlockNumberFormatter,
|
||||
inputBlockNumberFormatter: inputBlockNumberFormatter,
|
||||
inputCallFormatter: inputCallFormatter,
|
||||
inputTransactionFormatter: inputTransactionFormatter,
|
||||
inputAddressFormatter: inputAddressFormatter,
|
||||
inputPostFormatter: inputPostFormatter,
|
||||
|
|
|
@ -7,6 +7,14 @@ var FakeHttpProvider = require('./helpers/FakeHttpProvider');
|
|||
var method = 'sendTransaction';
|
||||
|
||||
var tests = [{
|
||||
input: {
|
||||
'from': 'XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS',
|
||||
'to': 'XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS'
|
||||
},
|
||||
formattedInput: {
|
||||
'from': '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
|
||||
'to': '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8'
|
||||
},
|
||||
result: '0xb',
|
||||
formattedResult: '0xb',
|
||||
call: 'eth_'+ method
|
||||
|
@ -23,11 +31,11 @@ describe('async', function () {
|
|||
provider.injectValidation(function (payload) {
|
||||
assert.equal(payload.jsonrpc, '2.0');
|
||||
assert.equal(payload.method, test.call);
|
||||
assert.deepEqual(payload.params, [{}]);
|
||||
assert.deepEqual(payload.params, [test.formattedInput]);
|
||||
});
|
||||
|
||||
// when
|
||||
web3.eth[method]({}, function(error, result){
|
||||
web3.eth[method](test.input, function(error, result){
|
||||
|
||||
// then
|
||||
assert.isNull(error);
|
||||
|
@ -50,11 +58,11 @@ describe('async', function () {
|
|||
provider.injectValidation(function (payload) {
|
||||
assert.equal(payload.jsonrpc, '2.0');
|
||||
assert.equal(payload.method, test.call);
|
||||
assert.deepEqual(payload.params, [{}]);
|
||||
assert.deepEqual(payload.params, [test.formattedInput]);
|
||||
});
|
||||
|
||||
// when
|
||||
web3.eth[method]({}, function(error, result){
|
||||
web3.eth[method](test.input, function(error, result){
|
||||
|
||||
// then
|
||||
assert.isUndefined(result);
|
||||
|
|
|
@ -55,7 +55,7 @@ var desc = [{
|
|||
|
||||
var address = '0x1234567890123456789012345678901234567890';
|
||||
|
||||
describe('web3.eth.contract', function () {
|
||||
describe('contract', function () {
|
||||
describe('event', function () {
|
||||
it('should create event filter', function (done) {
|
||||
var provider = new FakeHttpProvider();
|
||||
|
@ -318,13 +318,14 @@ describe('web3.eth.contract', function () {
|
|||
data: '0x' + sha3(signature).slice(0, 8) +
|
||||
'0000000000000000000000001234567890123456789012345678901234567890' +
|
||||
'0000000000000000000000000000000000000000000000000000000000000011' ,
|
||||
from: address,
|
||||
to: 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 () {
|
||||
|
|
|
@ -7,8 +7,8 @@ var tests = [{
|
|||
input: {
|
||||
data: '0x34234bf23bf4234',
|
||||
value: new BigNumber(100),
|
||||
from: '0x00000',
|
||||
to: '0x00000',
|
||||
from: '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
|
||||
to: '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
|
||||
nonce: 1000,
|
||||
gas: 1000,
|
||||
gasPrice: new BigNumber(1000)
|
||||
|
@ -16,8 +16,8 @@ var tests = [{
|
|||
result: {
|
||||
data: '0x34234bf23bf4234',
|
||||
value: '0x64',
|
||||
from: '0x00000',
|
||||
to: '0x00000',
|
||||
from: '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
|
||||
to: '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
|
||||
nonce: '0x3e8',
|
||||
gas: '0x3e8',
|
||||
gasPrice: '0x3e8'
|
||||
|
@ -26,46 +26,29 @@ var tests = [{
|
|||
input: {
|
||||
data: '0x34234bf23bf4234',
|
||||
value: new BigNumber(100),
|
||||
from: '0x00000',
|
||||
to: '0x00000',
|
||||
from: '00c5496aee77c1ba1f0854206a26dda82a81d6d8',
|
||||
to: '00c5496aee77c1ba1f0854206a26dda82a81d6d8',
|
||||
},
|
||||
result: {
|
||||
data: '0x34234bf23bf4234',
|
||||
value: '0x64',
|
||||
from: '0x00000',
|
||||
to: '0x00000',
|
||||
from: '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
|
||||
to: '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
|
||||
}
|
||||
},{
|
||||
input: {
|
||||
data: '0x34234bf23bf4234',
|
||||
value: new BigNumber(100),
|
||||
from: '0x00000',
|
||||
to: '0x00000',
|
||||
from: '00c5496aee77c1ba1f0854206a26dda82a81d6d8',
|
||||
to: '00c5496aee77c1ba1f0854206a26dda82a81d6d8',
|
||||
gas: '1000',
|
||||
gasPrice: new BigNumber(1000)
|
||||
},
|
||||
result: {
|
||||
data: '0x34234bf23bf4234',
|
||||
value: '0x64',
|
||||
from: '0x00000',
|
||||
to: '0x00000',
|
||||
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',
|
||||
from: '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
|
||||
to: '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
|
||||
gas: '0x3e8',
|
||||
gasPrice: '0x3e8'
|
||||
},
|
||||
|
@ -81,11 +64,26 @@ var tests = [{
|
|||
result: {
|
||||
data: '0x34234bf23bf4234',
|
||||
value: '0x64',
|
||||
from: 'XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS',
|
||||
to: 'XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS',
|
||||
from: '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
|
||||
to: '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
|
||||
gas: '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 () {
|
||||
|
|
|
@ -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){
|
||||
|
||||
});
|
||||
});
|
||||
|
|
|
@ -5,25 +5,25 @@ var testMethod = require('./helpers/test.method.js');
|
|||
var method = 'getBalance';
|
||||
|
||||
var tests = [{
|
||||
args: [301, 2],
|
||||
args: ['0x000000000000000000000000000000000000012d', 2],
|
||||
formattedArgs: ['0x000000000000000000000000000000000000012d', '0x2'],
|
||||
result: '0x31981',
|
||||
formattedResult: new BigNumber('0x31981', 16),
|
||||
call: 'eth_'+ method
|
||||
},{
|
||||
args: ['0x12d', '0x1'],
|
||||
args: ['0x000000000000000000000000000000000000012d', '0x1'],
|
||||
formattedArgs: ['0x000000000000000000000000000000000000012d', '0x1'],
|
||||
result: '0x31981',
|
||||
formattedResult: new BigNumber('0x31981', 16),
|
||||
call: 'eth_'+ method
|
||||
}, {
|
||||
args: [0x12d, 0x1],
|
||||
args: ['0x000000000000000000000000000000000000012d', 0x1],
|
||||
formattedArgs: ['0x000000000000000000000000000000000000012d', '0x1'],
|
||||
result: '0x31981',
|
||||
formattedResult: new BigNumber('0x31981', 16),
|
||||
call: 'eth_'+ method
|
||||
}, {
|
||||
args: [0x12d],
|
||||
args: ['0x000000000000000000000000000000000000012d'],
|
||||
formattedArgs: ['0x000000000000000000000000000000000000012d', web3.eth.defaultBlock],
|
||||
result: '0x31981',
|
||||
formattedResult: new BigNumber('0x31981', 16),
|
||||
|
@ -41,20 +41,26 @@ var tests = [{
|
|||
formattedResult: new BigNumber('0x31981', 16),
|
||||
call: 'eth_'+ method
|
||||
}, {
|
||||
args: ['1255171934823351805979544608257289442498956485798', 0x1],
|
||||
formattedArgs: ['0xdbdbdb2cbd23b783741e8d7fcf51e459b497e4a6', '0x1'],
|
||||
args: ['0x000000000000000000000000000000000000012d', 0x1],
|
||||
formattedArgs: ['0x000000000000000000000000000000000000012d', '0x1'],
|
||||
result: '0x31981',
|
||||
formattedResult: new BigNumber('0x31981', 16),
|
||||
call: 'eth_'+ method
|
||||
}, {
|
||||
args: ['1255171934823351805979544608257289442498956485798'],
|
||||
formattedArgs: ['0xdbdbdb2cbd23b783741e8d7fcf51e459b497e4a6', 'latest'],
|
||||
args: ['0x000000000000000000000000000000000000012d'],
|
||||
formattedArgs: ['0x000000000000000000000000000000000000012d', 'latest'],
|
||||
result: '0x31981',
|
||||
formattedResult: new BigNumber('0x31981', 16),
|
||||
call: 'eth_'+ method
|
||||
}, {
|
||||
args: ['0x00000000000000000000aaaaaaaaaaaaaaaaaaa'],
|
||||
formattedArgs: ['0x000000000000000000000aaaaaaaaaaaaaaaaaaa', 'latest'],
|
||||
args: ['000000000000000000000000000000000000012d'],
|
||||
formattedArgs: ['0x000000000000000000000000000000000000012d', 'latest'],
|
||||
result: '0x31981',
|
||||
formattedResult: new BigNumber('0x31981', 16),
|
||||
call: 'eth_'+ method
|
||||
}, {
|
||||
args: ['XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS'],
|
||||
formattedArgs: ['0x00c5496aee77c1ba1f0854206a26dda82a81d6d8', 'latest'],
|
||||
result: '0x31981',
|
||||
formattedResult: new BigNumber('0x31981', 16),
|
||||
call: 'eth_'+ method
|
||||
|
|
|
@ -7,7 +7,7 @@ describe('web3.eth.sendIBANTransaction', function () {
|
|||
it('should send transaction', function () {
|
||||
|
||||
var iban = 'XE81ETHXREGGAVOFYORK';
|
||||
var address = '0x1234567890123456789012345678901234500000';
|
||||
var address = '0x1234567890123456789012345678901234500000';
|
||||
var exAddress = '0x1234567890123456789012345678901234567890'
|
||||
|
||||
var provider = new FakeHttpProvider2();
|
||||
|
|
Loading…
Reference in New Issue