mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
Repurpose fromBlock/toBlock RPC parameters, update web3.js
This commit is contained in:
parent
6d019710ef
commit
b68c3ddfef
4 changed files with 90 additions and 69 deletions
|
|
@ -22,6 +22,7 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
|
@ -475,13 +476,11 @@ func returnLogs(logs []*types.Log) []*types.Log {
|
||||||
// UnmarshalJSON sets *args fields with given data.
|
// UnmarshalJSON sets *args fields with given data.
|
||||||
func (args *FilterCriteria) UnmarshalJSON(data []byte) error {
|
func (args *FilterCriteria) UnmarshalJSON(data []byte) error {
|
||||||
type input struct {
|
type input struct {
|
||||||
BlockHash *common.Hash `json:"blockHash"`
|
BlockHash *common.Hash `json:"blockHash"`
|
||||||
FromBlock *rpc.BlockNumber `json:"fromBlock"`
|
FromBlock *string `json:"fromBlock"`
|
||||||
FromBlockHash *common.Hash `json:"fromBlockHash"`
|
ToBlock *string `json:"toBlock"`
|
||||||
ToBlock *rpc.BlockNumber `json:"toBlock"`
|
Addresses interface{} `json:"address"`
|
||||||
ToBlockHash *common.Hash `json:"toBlockHash"`
|
Topics []interface{} `json:"topics"`
|
||||||
Addresses interface{} `json:"address"`
|
|
||||||
Topics []interface{} `json:"topics"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var raw input
|
var raw input
|
||||||
|
|
@ -497,16 +496,20 @@ func (args *FilterCriteria) UnmarshalJSON(data []byte) error {
|
||||||
args.BlockHash = raw.BlockHash
|
args.BlockHash = raw.BlockHash
|
||||||
} else {
|
} else {
|
||||||
if raw.FromBlock != nil {
|
if raw.FromBlock != nil {
|
||||||
args.FromBlock = big.NewInt(raw.FromBlock.Int64())
|
if strings.HasPrefix(*raw.FromBlock, "0x") {
|
||||||
}
|
hash := common.HexToHash(*raw.FromBlock)
|
||||||
if raw.FromBlockHash != nil {
|
args.FromBlockHash = &hash
|
||||||
args.FromBlockHash = raw.FromBlockHash
|
} else {
|
||||||
|
args.FromBlock.UnmarshalJSON([]byte(*raw.FromBlock))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if raw.ToBlock != nil {
|
if raw.ToBlock != nil {
|
||||||
args.ToBlock = big.NewInt(raw.ToBlock.Int64())
|
if strings.HasPrefix(*raw.ToBlock, "0x") {
|
||||||
}
|
hash := common.HexToHash(*raw.ToBlock)
|
||||||
if raw.ToBlockHash != nil {
|
args.ToBlockHash = &hash
|
||||||
args.ToBlockHash = raw.ToBlockHash
|
} else {
|
||||||
|
args.ToBlock.UnmarshalJSON([]byte(*raw.ToBlock))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -200,6 +200,10 @@ func (f *Filter) Logs(ctx context.Context) ([]*types.Log, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if end.Number.Cmp(begin.Number) < 0 {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
ancestor, mainChain, err := f.findCommonAncestor(ctx, begin, end)
|
ancestor, mainChain, err := f.findCommonAncestor(ctx, begin, end)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
@ -287,7 +291,7 @@ func (f *Filter) indexedLogs(ctx context.Context, begin, end uint64) ([]*types.L
|
||||||
func (f *Filter) unindexedLogs(ctx context.Context, begin, end common.Hash) ([]*types.Log, error) {
|
func (f *Filter) unindexedLogs(ctx context.Context, begin, end common.Hash) ([]*types.Log, error) {
|
||||||
var logs []*types.Log
|
var logs []*types.Log
|
||||||
|
|
||||||
for begin != end {
|
for {
|
||||||
header, err := f.backend.HeaderByHash(ctx, end)
|
header, err := f.backend.HeaderByHash(ctx, end)
|
||||||
if header == nil || err != nil {
|
if header == nil || err != nil {
|
||||||
return logs, err
|
return logs, err
|
||||||
|
|
@ -297,6 +301,9 @@ func (f *Filter) unindexedLogs(ctx context.Context, begin, end common.Hash) ([]*
|
||||||
return logs, err
|
return logs, err
|
||||||
}
|
}
|
||||||
logs = append(logs, found...)
|
logs = append(logs, found...)
|
||||||
|
if begin == end {
|
||||||
|
break
|
||||||
|
}
|
||||||
end = header.ParentHash
|
end = header.ParentHash
|
||||||
}
|
}
|
||||||
return logs, nil
|
return logs, nil
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -1192,7 +1192,7 @@ module.exports = SolidityTypeInt;
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* @file param.js
|
* @file param.js
|
||||||
* @author Marek Kotewicz <marek@ethdev.com>
|
* @author Marek Kotewicz <marek@ethdev.com>
|
||||||
* @date 2015
|
* @date 2015
|
||||||
|
|
@ -1211,7 +1211,7 @@ var SolidityParam = function (value, offset) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method should be used to get length of params's dynamic part
|
* This method should be used to get length of params's dynamic part
|
||||||
*
|
*
|
||||||
* @method dynamicPartLength
|
* @method dynamicPartLength
|
||||||
* @returns {Number} length of dynamic part (in bytes)
|
* @returns {Number} length of dynamic part (in bytes)
|
||||||
*/
|
*/
|
||||||
|
|
@ -1239,7 +1239,7 @@ SolidityParam.prototype.withOffset = function (offset) {
|
||||||
* @param {SolidityParam} result of combination
|
* @param {SolidityParam} result of combination
|
||||||
*/
|
*/
|
||||||
SolidityParam.prototype.combine = function (param) {
|
SolidityParam.prototype.combine = function (param) {
|
||||||
return new SolidityParam(this.value + param.value);
|
return new SolidityParam(this.value + param.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -1271,8 +1271,8 @@ SolidityParam.prototype.offsetAsBytes = function () {
|
||||||
*/
|
*/
|
||||||
SolidityParam.prototype.staticPart = function () {
|
SolidityParam.prototype.staticPart = function () {
|
||||||
if (!this.isDynamic()) {
|
if (!this.isDynamic()) {
|
||||||
return this.value;
|
return this.value;
|
||||||
}
|
}
|
||||||
return this.offsetAsBytes();
|
return this.offsetAsBytes();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -1304,7 +1304,7 @@ SolidityParam.prototype.encode = function () {
|
||||||
* @returns {String}
|
* @returns {String}
|
||||||
*/
|
*/
|
||||||
SolidityParam.encodeList = function (params) {
|
SolidityParam.encodeList = function (params) {
|
||||||
|
|
||||||
// updating offsets
|
// updating offsets
|
||||||
var totalOffset = params.length * 32;
|
var totalOffset = params.length * 32;
|
||||||
var offsetParams = params.map(function (param) {
|
var offsetParams = params.map(function (param) {
|
||||||
|
|
@ -1746,13 +1746,13 @@ if (typeof XMLHttpRequest === 'undefined') {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utils
|
* Utils
|
||||||
*
|
*
|
||||||
* @module utils
|
* @module utils
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility functions
|
* Utility functions
|
||||||
*
|
*
|
||||||
* @class [utils] config
|
* @class [utils] config
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
|
|
@ -1819,7 +1819,7 @@ module.exports = {
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* @file sha3.js
|
* @file sha3.js
|
||||||
* @author Marek Kotewicz <marek@ethdev.com>
|
* @author Marek Kotewicz <marek@ethdev.com>
|
||||||
* @date 2015
|
* @date 2015
|
||||||
|
|
@ -2739,7 +2739,7 @@ module.exports = AllSolidityEvents;
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* @file batch.js
|
* @file batch.js
|
||||||
* @author Marek Kotewicz <marek@ethdev.com>
|
* @author Marek Kotewicz <marek@ethdev.com>
|
||||||
* @date 2015
|
* @date 2015
|
||||||
|
|
@ -2784,7 +2784,7 @@ Batch.prototype.execute = function () {
|
||||||
requests[index].callback(null, (requests[index].format ? requests[index].format(result.result) : result.result));
|
requests[index].callback(null, (requests[index].format ? requests[index].format(result.result) : result.result));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = Batch;
|
module.exports = Batch;
|
||||||
|
|
@ -2971,7 +2971,7 @@ var ContractFactory = function (eth, abi) {
|
||||||
*/
|
*/
|
||||||
this.new = function () {
|
this.new = function () {
|
||||||
/*jshint maxcomplexity: 7 */
|
/*jshint maxcomplexity: 7 */
|
||||||
|
|
||||||
var contract = new Contract(this.eth, this.abi);
|
var contract = new Contract(this.eth, this.abi);
|
||||||
|
|
||||||
// parse arguments
|
// parse arguments
|
||||||
|
|
@ -3119,7 +3119,7 @@ module.exports = ContractFactory;
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* @file errors.js
|
* @file errors.js
|
||||||
* @author Marek Kotewicz <marek@ethdev.com>
|
* @author Marek Kotewicz <marek@ethdev.com>
|
||||||
* @date 2015
|
* @date 2015
|
||||||
|
|
@ -3394,7 +3394,7 @@ var extend = function (web3) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ex.formatters = formatters;
|
ex.formatters = formatters;
|
||||||
ex.utils = utils;
|
ex.utils = utils;
|
||||||
ex.Method = Method;
|
ex.Method = Method;
|
||||||
ex.Property = Property;
|
ex.Property = Property;
|
||||||
|
|
@ -4425,7 +4425,7 @@ module.exports = HttpProvider;
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* @file iban.js
|
* @file iban.js
|
||||||
* @author Marek Kotewicz <marek@ethdev.com>
|
* @author Marek Kotewicz <marek@ethdev.com>
|
||||||
* @date 2015
|
* @date 2015
|
||||||
|
|
@ -4625,7 +4625,7 @@ Iban.prototype.address = function () {
|
||||||
var base36 = this._iban.substr(4);
|
var base36 = this._iban.substr(4);
|
||||||
var asBn = new BigNumber(base36, 36);
|
var asBn = new BigNumber(base36, 36);
|
||||||
return padLeft(asBn.toString(16), 20);
|
return padLeft(asBn.toString(16), 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
};
|
};
|
||||||
|
|
@ -4670,7 +4670,7 @@ var IpcProvider = function (path, net) {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
this.responseCallbacks = {};
|
this.responseCallbacks = {};
|
||||||
this.path = path;
|
this.path = path;
|
||||||
|
|
||||||
this.connection = net.connect({path: this.path});
|
this.connection = net.connect({path: this.path});
|
||||||
|
|
||||||
this.connection.on('error', function(e){
|
this.connection.on('error', function(e){
|
||||||
|
|
@ -4680,7 +4680,7 @@ var IpcProvider = function (path, net) {
|
||||||
|
|
||||||
this.connection.on('end', function(){
|
this.connection.on('end', function(){
|
||||||
_this._timeout();
|
_this._timeout();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// LISTEN FOR CONNECTION RESPONSES
|
// LISTEN FOR CONNECTION RESPONSES
|
||||||
|
|
@ -4719,7 +4719,7 @@ Will parse the response and make an array out of it.
|
||||||
IpcProvider.prototype._parseResponse = function(data) {
|
IpcProvider.prototype._parseResponse = function(data) {
|
||||||
var _this = this,
|
var _this = this,
|
||||||
returnValues = [];
|
returnValues = [];
|
||||||
|
|
||||||
// DE-CHUNKER
|
// DE-CHUNKER
|
||||||
var dechunkedData = data
|
var dechunkedData = data
|
||||||
.replace(/\}[\n\r]?\{/g,'}|--|{') // }{
|
.replace(/\}[\n\r]?\{/g,'}|--|{') // }{
|
||||||
|
|
@ -4823,7 +4823,7 @@ IpcProvider.prototype.send = function (payload) {
|
||||||
try {
|
try {
|
||||||
result = JSON.parse(data);
|
result = JSON.parse(data);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
throw errors.InvalidResponse(data);
|
throw errors.InvalidResponse(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
@ -4998,7 +4998,7 @@ Method.prototype.extractCallback = function (args) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should be called to check if the number of arguments is correct
|
* Should be called to check if the number of arguments is correct
|
||||||
*
|
*
|
||||||
* @method validateArgs
|
* @method validateArgs
|
||||||
* @param {Array} arguments
|
* @param {Array} arguments
|
||||||
* @throws {Error} if it is not
|
* @throws {Error} if it is not
|
||||||
|
|
@ -5011,7 +5011,7 @@ Method.prototype.validateArgs = function (args) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should be called to format input args of method
|
* Should be called to format input args of method
|
||||||
*
|
*
|
||||||
* @method formatInput
|
* @method formatInput
|
||||||
* @param {Array}
|
* @param {Array}
|
||||||
* @return {Array}
|
* @return {Array}
|
||||||
|
|
@ -5065,7 +5065,7 @@ Method.prototype.attachToObject = function (obj) {
|
||||||
obj[name[0]] = obj[name[0]] || {};
|
obj[name[0]] = obj[name[0]] || {};
|
||||||
obj[name[0]][name[1]] = func;
|
obj[name[0]][name[1]] = func;
|
||||||
} else {
|
} else {
|
||||||
obj[name[0]] = func;
|
obj[name[0]] = func;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -5128,8 +5128,8 @@ var DB = function (web3) {
|
||||||
this._requestManager = web3._requestManager;
|
this._requestManager = web3._requestManager;
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
methods().forEach(function(method) {
|
methods().forEach(function(method) {
|
||||||
method.attachToObject(self);
|
method.attachToObject(self);
|
||||||
method.setRequestManager(web3._requestManager);
|
method.setRequestManager(web3._requestManager);
|
||||||
});
|
});
|
||||||
|
|
@ -5431,6 +5431,12 @@ var methods = function () {
|
||||||
params: 0
|
params: 0
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var getLogs = new Method({
|
||||||
|
name: 'getLogs',
|
||||||
|
call: 'eth_getLogs',
|
||||||
|
params: 1
|
||||||
|
})
|
||||||
|
|
||||||
return [
|
return [
|
||||||
getBalance,
|
getBalance,
|
||||||
getStorageAt,
|
getStorageAt,
|
||||||
|
|
@ -5454,7 +5460,8 @@ var methods = function () {
|
||||||
compileLLL,
|
compileLLL,
|
||||||
compileSerpent,
|
compileSerpent,
|
||||||
submitWork,
|
submitWork,
|
||||||
getWork
|
getWork,
|
||||||
|
getLogs
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -5554,7 +5561,7 @@ var Net = function (web3) {
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
properties().forEach(function(p) {
|
properties().forEach(function(p) {
|
||||||
p.attachToObject(self);
|
p.attachToObject(self);
|
||||||
p.setRequestManager(web3._requestManager);
|
p.setRequestManager(web3._requestManager);
|
||||||
});
|
});
|
||||||
|
|
@ -6113,7 +6120,7 @@ module.exports = {
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* @file namereg.js
|
* @file namereg.js
|
||||||
* @author Marek Kotewicz <marek@ethdev.com>
|
* @author Marek Kotewicz <marek@ethdev.com>
|
||||||
* @date 2015
|
* @date 2015
|
||||||
|
|
@ -6300,7 +6307,7 @@ module.exports = Property;
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* @file requestmanager.js
|
* @file requestmanager.js
|
||||||
* @author Jeffrey Wilcke <jeff@ethdev.com>
|
* @author Jeffrey Wilcke <jeff@ethdev.com>
|
||||||
* @author Marek Kotewicz <marek@ethdev.com>
|
* @author Marek Kotewicz <marek@ethdev.com>
|
||||||
|
|
@ -6367,7 +6374,7 @@ RequestManager.prototype.sendAsync = function (data, callback) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Jsonrpc.isValidResponse(result)) {
|
if (!Jsonrpc.isValidResponse(result)) {
|
||||||
return callback(errors.InvalidResponse(result));
|
return callback(errors.InvalidResponse(result));
|
||||||
}
|
}
|
||||||
|
|
@ -6400,7 +6407,7 @@ RequestManager.prototype.sendBatch = function (data, callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
callback(err, results);
|
callback(err, results);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -6504,7 +6511,7 @@ RequestManager.prototype.poll = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
var payload = Jsonrpc.toBatchPayload(pollsData);
|
var payload = Jsonrpc.toBatchPayload(pollsData);
|
||||||
|
|
||||||
// map the request id to they poll id
|
// map the request id to they poll id
|
||||||
var pollsIdMap = {};
|
var pollsIdMap = {};
|
||||||
payload.forEach(function(load, index){
|
payload.forEach(function(load, index){
|
||||||
|
|
@ -6534,7 +6541,7 @@ RequestManager.prototype.poll = function () {
|
||||||
} else
|
} else
|
||||||
return false;
|
return false;
|
||||||
}).filter(function (result) {
|
}).filter(function (result) {
|
||||||
return !!result;
|
return !!result;
|
||||||
}).filter(function (result) {
|
}).filter(function (result) {
|
||||||
var valid = Jsonrpc.isValidResponse(result);
|
var valid = Jsonrpc.isValidResponse(result);
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
|
|
@ -6609,16 +6616,16 @@ var pollSyncing = function(self) {
|
||||||
|
|
||||||
self.callbacks.forEach(function (callback) {
|
self.callbacks.forEach(function (callback) {
|
||||||
if (self.lastSyncState !== sync) {
|
if (self.lastSyncState !== sync) {
|
||||||
|
|
||||||
// call the callback with true first so the app can stop anything, before receiving the sync data
|
// call the callback with true first so the app can stop anything, before receiving the sync data
|
||||||
if(!self.lastSyncState && utils.isObject(sync))
|
if(!self.lastSyncState && utils.isObject(sync))
|
||||||
callback(null, true);
|
callback(null, true);
|
||||||
|
|
||||||
// call on the next CPU cycle, so the actions of the sync stop can be processes first
|
// call on the next CPU cycle, so the actions of the sync stop can be processes first
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
callback(null, sync);
|
callback(null, sync);
|
||||||
}, 0);
|
}, 0);
|
||||||
|
|
||||||
self.lastSyncState = sync;
|
self.lastSyncState = sync;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -6673,7 +6680,7 @@ module.exports = IsSyncing;
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* @file transfer.js
|
* @file transfer.js
|
||||||
* @author Marek Kotewicz <marek@ethdev.com>
|
* @author Marek Kotewicz <marek@ethdev.com>
|
||||||
* @date 2015
|
* @date 2015
|
||||||
|
|
@ -6692,7 +6699,7 @@ var exchangeAbi = require('../contracts/SmartExchange.json');
|
||||||
* @param {Function} callback, callback
|
* @param {Function} callback, callback
|
||||||
*/
|
*/
|
||||||
var transfer = function (eth, from, to, value, callback) {
|
var transfer = function (eth, from, to, value, callback) {
|
||||||
var iban = new Iban(to);
|
var iban = new Iban(to);
|
||||||
if (!iban.isValid()) {
|
if (!iban.isValid()) {
|
||||||
throw new Error('invalid iban address');
|
throw new Error('invalid iban address');
|
||||||
}
|
}
|
||||||
|
|
@ -6700,7 +6707,7 @@ var transfer = function (eth, from, to, value, callback) {
|
||||||
if (iban.isDirect()) {
|
if (iban.isDirect()) {
|
||||||
return transferToAddress(eth, from, iban.address(), value, callback);
|
return transferToAddress(eth, from, iban.address(), value, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!callback) {
|
if (!callback) {
|
||||||
var address = eth.icapNamereg().addr(iban.institution());
|
var address = eth.icapNamereg().addr(iban.institution());
|
||||||
return deposit(eth, from, address, value, iban.client());
|
return deposit(eth, from, address, value, iban.client());
|
||||||
|
|
@ -6709,7 +6716,7 @@ var transfer = function (eth, from, to, value, callback) {
|
||||||
eth.icapNamereg().addr(iban.institution(), function (err, address) {
|
eth.icapNamereg().addr(iban.institution(), function (err, address) {
|
||||||
return deposit(eth, from, address, value, iban.client(), callback);
|
return deposit(eth, from, address, value, iban.client(), callback);
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue