mirror of https://github.com/status-im/web3.js.git
changed extend to _extend
This commit is contained in:
parent
d14c706901
commit
7518ed47f8
|
@ -1505,7 +1505,7 @@ Object.defineProperty(web3.eth, 'defaultAccount', {
|
|||
|
||||
|
||||
// EXTEND
|
||||
web3.extend = function(extension){
|
||||
web3._extend = function(extension){
|
||||
/*jshint maxcomplexity: 6 */
|
||||
|
||||
if(extension.property && !web3[extension.property])
|
||||
|
@ -1514,10 +1514,10 @@ web3.extend = function(extension){
|
|||
setupMethods(web3[extension.property] || web3, extension.methods || []);
|
||||
setupProperties(web3[extension.property] || web3, extension.properties || []);
|
||||
};
|
||||
web3.extend.formatters = formatters;
|
||||
web3.extend.utils = utils;
|
||||
web3.extend.Method = require('./web3/method');
|
||||
web3.extend.Property = require('./web3/property');
|
||||
web3._extend.formatters = formatters;
|
||||
web3._extend.utils = utils;
|
||||
web3._extend.Method = require('./web3/method');
|
||||
web3._extend.Property = require('./web3/property');
|
||||
|
||||
|
||||
/// setups all api methods
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1505,7 +1505,7 @@ Object.defineProperty(web3.eth, 'defaultAccount', {
|
|||
|
||||
|
||||
// EXTEND
|
||||
web3.extend = function(extension){
|
||||
web3._extend = function(extension){
|
||||
/*jshint maxcomplexity: 6 */
|
||||
|
||||
if(extension.property && !web3[extension.property])
|
||||
|
@ -1514,10 +1514,10 @@ web3.extend = function(extension){
|
|||
setupMethods(web3[extension.property] || web3, extension.methods || []);
|
||||
setupProperties(web3[extension.property] || web3, extension.properties || []);
|
||||
};
|
||||
web3.extend.formatters = formatters;
|
||||
web3.extend.utils = utils;
|
||||
web3.extend.Method = require('./web3/method');
|
||||
web3.extend.Property = require('./web3/property');
|
||||
web3._extend.formatters = formatters;
|
||||
web3._extend.utils = utils;
|
||||
web3._extend.Method = require('./web3/method');
|
||||
web3._extend.Property = require('./web3/property');
|
||||
|
||||
|
||||
/// setups all api methods
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
10
lib/web3.js
10
lib/web3.js
|
@ -151,7 +151,7 @@ Object.defineProperty(web3.eth, 'defaultAccount', {
|
|||
|
||||
|
||||
// EXTEND
|
||||
web3.extend = function(extension){
|
||||
web3._extend = function(extension){
|
||||
/*jshint maxcomplexity: 6 */
|
||||
|
||||
if(extension.property && !web3[extension.property])
|
||||
|
@ -160,10 +160,10 @@ web3.extend = function(extension){
|
|||
setupMethods(web3[extension.property] || web3, extension.methods || []);
|
||||
setupProperties(web3[extension.property] || web3, extension.properties || []);
|
||||
};
|
||||
web3.extend.formatters = formatters;
|
||||
web3.extend.utils = utils;
|
||||
web3.extend.Method = require('./web3/method');
|
||||
web3.extend.Property = require('./web3/property');
|
||||
web3._extend.formatters = formatters;
|
||||
web3._extend.utils = utils;
|
||||
web3._extend.Method = require('./web3/method');
|
||||
web3._extend.Property = require('./web3/property');
|
||||
|
||||
|
||||
/// setups all api methods
|
||||
|
|
|
@ -5,40 +5,40 @@ var web3 = require('../lib/web3');
|
|||
|
||||
|
||||
var tests = [{
|
||||
properties: [new web3.extend.Property({
|
||||
properties: [new web3._extend.Property({
|
||||
name: 'gasPrice',
|
||||
getter: 'eth_gasPrice',
|
||||
outputFormatter: web3.extend.formatters.outputBigNumberFormatter
|
||||
outputFormatter: web3._extend.formatters.outputBigNumberFormatter
|
||||
})]
|
||||
},{
|
||||
methods: [new web3.extend.Method({
|
||||
methods: [new web3._extend.Method({
|
||||
name: 'getBalance',
|
||||
call: 'eth_getBalance',
|
||||
params: 2,
|
||||
inputFormatter: [web3.extend.utils.toAddress, web3.extend.formatters.inputDefaultBlockNumberFormatter],
|
||||
outputFormatter: web3.extend.formatters.outputBigNumberFormatter
|
||||
inputFormatter: [web3._extend.utils.toAddress, web3._extend.formatters.inputDefaultBlockNumberFormatter],
|
||||
outputFormatter: web3._extend.formatters.outputBigNumberFormatter
|
||||
})]
|
||||
},{
|
||||
property: 'admin',
|
||||
properties: [new web3.extend.Property({
|
||||
properties: [new web3._extend.Property({
|
||||
name: 'gasPrice',
|
||||
getter: 'eth_gasPrice',
|
||||
outputFormatter: web3.extend.formatters.outputBigNumberFormatter
|
||||
outputFormatter: web3._extend.formatters.outputBigNumberFormatter
|
||||
})],
|
||||
methods: [new web3.extend.Method({
|
||||
methods: [new web3._extend.Method({
|
||||
name: 'getBalance',
|
||||
call: 'eth_getBalance',
|
||||
params: 2,
|
||||
inputFormatter: [web3.extend.utils.toAddress, web3.extend.formatters.inputDefaultBlockNumberFormatter],
|
||||
outputFormatter: web3.extend.formatters.outputBigNumberFormatter
|
||||
inputFormatter: [web3._extend.utils.toAddress, web3._extend.formatters.inputDefaultBlockNumberFormatter],
|
||||
outputFormatter: web3._extend.formatters.outputBigNumberFormatter
|
||||
})]
|
||||
}];
|
||||
|
||||
describe('web3', function () {
|
||||
describe('extend', function () {
|
||||
describe('_extend', function () {
|
||||
tests.forEach(function (test, index) {
|
||||
it('test no: ' + index, function () {
|
||||
web3.extend(test);
|
||||
web3._extend(test);
|
||||
|
||||
|
||||
if(test.properties)
|
||||
|
|
Loading…
Reference in New Issue