removed deprecated && unused lines from contract.js

This commit is contained in:
Marek Kotewicz 2015-03-31 10:35:36 +02:00
parent 5885bfe69b
commit 57d9f1f036
8 changed files with 41 additions and 56 deletions

View File

@ -1287,22 +1287,6 @@ var addFunctionRelatedPropertiesToContract = function (contract) {
contract._options = options;
return contract;
};
// DEPRECATED
contract.transact = function (options) {
console.warn('myContract.transact() is deprecated please use myContract.sendTransaction() instead.');
return contract.sendTransaction(options);
};
contract._options = {};
['gas', 'gasPrice', 'value', 'from'].forEach(function(p) {
contract[p] = function (v) {
contract._options[p] = v;
return contract;
};
});
};
var addFunctionsToContract = function (contract, desc, address) {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

16
dist/ethereum.js vendored
View File

@ -1287,22 +1287,6 @@ var addFunctionRelatedPropertiesToContract = function (contract) {
contract._options = options;
return contract;
};
// DEPRECATED
contract.transact = function (options) {
console.warn('myContract.transact() is deprecated please use myContract.sendTransaction() instead.');
return contract.sendTransaction(options);
};
contract._options = {};
['gas', 'gasPrice', 'value', 'from'].forEach(function(p) {
contract[p] = function (v) {
contract._options[p] = v;
return contract;
};
});
};
var addFunctionsToContract = function (contract, desc, address) {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -34,28 +34,11 @@ var addFunctionRelatedPropertiesToContract = function (contract) {
return contract;
};
contract.sendTransaction = function (options) {
contract._isTransaction = true;
contract._options = options;
return contract;
};
// DEPRECATED
contract.transact = function (options) {
console.warn('myContract.transact() is deprecated please use myContract.sendTransaction() instead.');
return contract.sendTransaction(options);
};
contract._options = {};
['gas', 'gasPrice', 'value', 'from'].forEach(function(p) {
contract[p] = function (v) {
contract._options[p] = v;
return contract;
};
});
};
var addFunctionsToContract = function (contract, desc, address) {

View File

@ -191,5 +191,39 @@ describe('web3.eth.contract', function () {
});
it('should sendTransaction with optional params', function () {
var provider = new FakeHttpProvider();
web3.setProvider(provider);
web3.reset();
var sha3 = '0x5131231231231231231231';
var address = '0x1234567890123456789012345678901234567890';
provider.injectResult(sha3);
var step = 0;
provider.injectValidation(function (payload) {
if (step === 0) {
step = 1;
assert.equal(payload.jsonrpc, '2.0');
assert.equal(payload.method, 'web3_sha3');
assert.equal(payload.params[0], web3.fromAscii('send(address,uint256)'));
} else if (step === 1) {
assert.equal(payload.method, 'eth_sendTransaction');
assert.deepEqual(payload.params, [{
data: sha3.slice(0, 10) +
'0000000000000000000000001234567890123456789012345678901234567890' +
'0000000000000000000000000000000000000000000000000000000000000011' ,
to: address,
from: address,
gas: '0xc350',
gasPrice: '0xbb8',
value: '0x2710'
}]);
}
});
var Contract = web3.eth.contract(desc);
var contract = new Contract(address);
contract.sendTransaction({from: address, gas: 50000, gasPrice: 3000, value: 10000}).send(address, 17);
});
});
});