2015-05-23 13:59:19 +00:00
|
|
|
var chai = require('chai');
|
|
|
|
var assert = chai.assert;
|
|
|
|
var web3 = require('../index');
|
|
|
|
var FakeHttpProvider2 = require('./helpers/FakeHttpProvider2');
|
|
|
|
|
|
|
|
describe('web3.eth.sendIBANTransaction', function () {
|
|
|
|
it('should send transaction', function () {
|
|
|
|
|
|
|
|
var iban = 'XE81ETHXREGGAVOFYORK';
|
2015-08-08 19:22:01 +00:00
|
|
|
var address = '0x1234567890123456789012345678901234500000';
|
2015-05-23 13:59:19 +00:00
|
|
|
var exAddress = '0x1234567890123456789012345678901234567890'
|
|
|
|
|
|
|
|
var provider = new FakeHttpProvider2();
|
|
|
|
web3.setProvider(provider);
|
|
|
|
web3.reset();
|
|
|
|
|
|
|
|
provider.injectResultList([{
|
|
|
|
result: exAddress
|
|
|
|
}, {
|
|
|
|
result: ''
|
|
|
|
}]);
|
|
|
|
|
|
|
|
var step = 0;
|
|
|
|
provider.injectValidation(function (payload) {
|
|
|
|
if (step === 0) {
|
|
|
|
step++;
|
|
|
|
assert.equal(payload.method, 'eth_call');
|
|
|
|
assert.deepEqual(payload.params, [{
|
2015-08-07 09:19:44 +00:00
|
|
|
data: "0x3b3b57de5852454700000000000000000000000000000000000000000000000000000000",
|
|
|
|
to: web3.eth.ibanNamereg.address
|
2015-05-23 13:59:19 +00:00
|
|
|
}, "latest"]);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
assert.equal(payload.method, 'eth_sendTransaction');
|
|
|
|
assert.deepEqual(payload.params, [{
|
|
|
|
data: '0xb214faa54741564f46594f524b0000000000000000000000000000000000000000000000',
|
|
|
|
from: address,
|
|
|
|
to: exAddress,
|
|
|
|
value: payload.params[0].value // don't check this
|
|
|
|
}]);
|
|
|
|
});
|
|
|
|
|
|
|
|
web3.eth.sendIBANTransaction(address, iban, 10000);
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|