implement block and tx objects.

This commit is contained in:
Christopher Jeffrey 2014-09-25 10:59:36 -07:00
parent 9eb7eefe0f
commit 9e49864413
3 changed files with 87 additions and 1 deletions

View File

@ -56,6 +56,10 @@
# bitcoind:
'<(BITCOIN_DIR)/src/libbitcoind.so',
# '<(BITCOIN_DIR)/src/libbitcoin_server.a',
# '<(BITCOIN_DIR)/src/libbitcoin_common.a',
# '<(BITCOIN_DIR)/src/libbitcoin_wallet.a',
]
}]
}

View File

@ -9,6 +9,7 @@ var EventEmitter = require('events').EventEmitter;
var bitcoindjs = require('../build/Release/bitcoindjs.node');
var util = require('util');
var net = require('net');
var bn = require('bn.js');
/**
* Bitcoin
@ -279,6 +280,86 @@ Bitcoin.prototype.close = function(callback) {
});
};
/**
* Block
*/
function Block(data) {
if (!(this instanceof Block)) {
return new Block(data);
}
}
/**
* Transaction
*/
function Transaction(data) {
if (!(this instanceof Transaction)) {
return new Transaction(data);
}
this.nMinTxFee = data.nMinTxFee || new bn(0);
this.nMinRelayTxFee = data.nMinRelayTxFee || new bn(0);
this.CURRENT_VERSION = 1;
this.nVersion = data.nVersion || -1;
this.vin = data.vin || [];
this.vout = data.vout || [];
this.nLockTime = data.nLockTime || null;
}
Transaction.prototype.getSerializeSize = function() {
;
};
Transaction.prototype.serialize = function() {
;
};
Transaction.prototype.unserialize = function() {
;
};
Transaction.prototype.setNull = function() {
;
};
Transaction.prototype.isNull = function() {
;
};
Transaction.prototype.getHash = function() {
;
};
Transaction.prototype.getValueOut = function() {
;
};
Transaction.prototype.computePriority = function() {
;
};
Transaction.prototype.isCoinbase = function() {
;
};
Transaction.prototype.equal = function() {
;
};
Transaction.prototype.notEqual = function() {
;
};
Transaction.prototype.toString = function() {
;
};
Transaction.prototype.print = function() {
;
};
/**
* Utils
*/

View File

@ -17,7 +17,8 @@
"bitcoind"
],
"dependencies": {
"nan": "1.3.0"
"nan": "1.3.0",
"bn.js": "^0.10.0"
},
"devDependencies": {
"mocha": "~1.16.2"