Move tx subdocs into their own files
This commit is contained in:
parent
3efd16c6af
commit
1143bd803a
@ -1,5 +1,5 @@
|
|||||||
const config = {
|
const config = {
|
||||||
full_node: false,
|
full_node: true,
|
||||||
logging: 'debug',
|
logging: 'debug',
|
||||||
bcoin: {
|
bcoin: {
|
||||||
network: 'main',
|
network: 'main',
|
||||||
|
|||||||
15
models/input.js
Normal file
15
models/input.js
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
const mongoose = require('mongoose');
|
||||||
|
|
||||||
|
const Schema = mongoose.Schema;
|
||||||
|
|
||||||
|
const InputSchema = new Schema({
|
||||||
|
prevout: Object,
|
||||||
|
script: String,
|
||||||
|
witness: String,
|
||||||
|
sequence: Number,
|
||||||
|
address: String,
|
||||||
|
});
|
||||||
|
|
||||||
|
const Input = mongoose.model('Input', InputSchema);
|
||||||
|
|
||||||
|
module.exports = Input;
|
||||||
14
models/output.js
Normal file
14
models/output.js
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
const mongoose = require('mongoose');
|
||||||
|
|
||||||
|
const Schema = mongoose.Schema;
|
||||||
|
|
||||||
|
const OutputSchema = new Schema({
|
||||||
|
address: String,
|
||||||
|
script: String,
|
||||||
|
value: Number,
|
||||||
|
type: String,
|
||||||
|
});
|
||||||
|
|
||||||
|
const Output = mongoose.model('Output', OutputSchema);
|
||||||
|
|
||||||
|
module.exports = Output;
|
||||||
@ -1,22 +1,9 @@
|
|||||||
const mongoose = require('mongoose');
|
const mongoose = require('mongoose');
|
||||||
|
const Input = require('./input');
|
||||||
|
const Output = require('./output');
|
||||||
|
|
||||||
const Schema = mongoose.Schema;
|
const Schema = mongoose.Schema;
|
||||||
|
|
||||||
const InputSchema = new Schema({
|
|
||||||
prevout: Object,
|
|
||||||
script: String,
|
|
||||||
witness: String,
|
|
||||||
sequence: Number,
|
|
||||||
address: String,
|
|
||||||
});
|
|
||||||
|
|
||||||
const OutputSchema = new Schema({
|
|
||||||
address: String,
|
|
||||||
script: String,
|
|
||||||
value: Number,
|
|
||||||
type: String,
|
|
||||||
});
|
|
||||||
|
|
||||||
const TransactionSchema = new Schema({
|
const TransactionSchema = new Schema({
|
||||||
hash: String,
|
hash: String,
|
||||||
witnessHash: String,
|
witnessHash: String,
|
||||||
@ -29,18 +16,14 @@ const TransactionSchema = new Schema({
|
|||||||
version: Number,
|
version: Number,
|
||||||
flag: Number,
|
flag: Number,
|
||||||
lockTime: Number,
|
lockTime: Number,
|
||||||
inputs: [InputSchema],
|
inputs: [Input.schema],
|
||||||
outputs: [OutputSchema],
|
outputs: [Output.schema],
|
||||||
size: Number,
|
size: Number,
|
||||||
network: String,
|
network: String,
|
||||||
});
|
});
|
||||||
|
|
||||||
const Transaction = mongoose.model('Transaction', TransactionSchema);
|
const Transaction = mongoose.model('Transaction', TransactionSchema);
|
||||||
const Input = mongoose.model('Input', InputSchema);
|
|
||||||
const Output = mongoose.model('Output', OutputSchema);
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
Transaction,
|
Transaction,
|
||||||
Input,
|
|
||||||
Output,
|
|
||||||
};
|
};
|
||||||
|
|||||||
2215
package-lock.json
generated
Normal file
2215
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user