Move tx subdocs into their own files
This commit is contained in:
parent
3efd16c6af
commit
1143bd803a
@ -1,5 +1,5 @@
|
||||
const config = {
|
||||
full_node: false,
|
||||
full_node: true,
|
||||
logging: 'debug',
|
||||
bcoin: {
|
||||
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 Input = require('./input');
|
||||
const Output = require('./output');
|
||||
|
||||
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({
|
||||
hash: String,
|
||||
witnessHash: String,
|
||||
@ -29,18 +16,14 @@ const TransactionSchema = new Schema({
|
||||
version: Number,
|
||||
flag: Number,
|
||||
lockTime: Number,
|
||||
inputs: [InputSchema],
|
||||
outputs: [OutputSchema],
|
||||
inputs: [Input.schema],
|
||||
outputs: [Output.schema],
|
||||
size: Number,
|
||||
network: String,
|
||||
});
|
||||
|
||||
const Transaction = mongoose.model('Transaction', TransactionSchema);
|
||||
const Input = mongoose.model('Input', InputSchema);
|
||||
const Output = mongoose.model('Output', OutputSchema);
|
||||
|
||||
module.exports = {
|
||||
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