implement block and tx objects.
This commit is contained in:
parent
9eb7eefe0f
commit
9e49864413
@ -56,6 +56,10 @@
|
|||||||
|
|
||||||
# bitcoind:
|
# bitcoind:
|
||||||
'<(BITCOIN_DIR)/src/libbitcoind.so',
|
'<(BITCOIN_DIR)/src/libbitcoind.so',
|
||||||
|
|
||||||
|
# '<(BITCOIN_DIR)/src/libbitcoin_server.a',
|
||||||
|
# '<(BITCOIN_DIR)/src/libbitcoin_common.a',
|
||||||
|
# '<(BITCOIN_DIR)/src/libbitcoin_wallet.a',
|
||||||
]
|
]
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,6 +9,7 @@ var EventEmitter = require('events').EventEmitter;
|
|||||||
var bitcoindjs = require('../build/Release/bitcoindjs.node');
|
var bitcoindjs = require('../build/Release/bitcoindjs.node');
|
||||||
var util = require('util');
|
var util = require('util');
|
||||||
var net = require('net');
|
var net = require('net');
|
||||||
|
var bn = require('bn.js');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bitcoin
|
* 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
|
* Utils
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -17,7 +17,8 @@
|
|||||||
"bitcoind"
|
"bitcoind"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"nan": "1.3.0"
|
"nan": "1.3.0",
|
||||||
|
"bn.js": "^0.10.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"mocha": "~1.16.2"
|
"mocha": "~1.16.2"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user