67 lines
1.6 KiB
JavaScript
Raw Normal View History

2015-02-05 23:37:30 +01:00
/*
2015-10-08 15:34:07 +08:00
This file is part of web3.js.
2015-02-05 23:37:30 +01:00
2015-10-08 15:34:07 +08:00
web3.js is free software: you can redistribute it and/or modify
2015-02-05 23:37:30 +01:00
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
2015-10-08 15:34:07 +08:00
web3.js is distributed in the hope that it will be useful,
2015-02-05 23:37:30 +01:00
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
2015-10-08 15:34:07 +08:00
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
2015-02-05 23:37:30 +01:00
*/
/** @file db.js
* @authors:
* Marek Kotewicz <marek@ethdev.com>
* @date 2015
*/
2015-08-06 18:25:41 +02:00
var Method = require('../method');
2015-03-12 16:33:19 +01:00
2015-10-07 04:32:32 +02:00
var DB = function (web3) {
2015-10-08 04:09:51 +02:00
this._requestManager = web3._requestManager;
var self = this;
methods().forEach(function(method) {
method.attachToObject(self);
method.setRequestManager(web3._requestManager);
});
2015-10-07 04:32:32 +02:00
};
2015-10-08 04:09:51 +02:00
var methods = function () {
var putString = new Method({
name: 'putString',
call: 'db_putString',
params: 3
});
var getString = new Method({
name: 'getString',
call: 'db_getString',
params: 2
});
var putHex = new Method({
name: 'putHex',
call: 'db_putHex',
params: 3
});
var getHex = new Method({
name: 'getHex',
call: 'db_getHex',
params: 2
});
return [
putString, getString, putHex, getHex
];
};
2015-10-07 04:32:32 +02:00
module.exports = DB;