Files
bch-dex/src/adapters/localdb/models/order.js
T

55 lines
1.7 KiB
JavaScript
Raw Normal View History

/*
Order Model. Orders are 'internal' to the system and track the HD wallet index
that contains funds for that Order. This is in contrast to Offers, which
are 'external' to the system and mirrored by every instance of bch-dex.
2022-03-22 11:05:31 -07:00
See the dev-docs/specification.md for details on each property.
*/
2022-10-01 11:40:41 -07:00
import mongoose from 'mongoose'
2022-02-23 05:51:12 -08:00
const Order = new mongoose.Schema({
// Token data
tokenId: { type: String, required: true },
utxoTxid: { type: String, required: true },
utxoVout: { type: Number, required: true },
ticker: { type: String, required: true },
tokenType: { type: Number, required: true },
// Trade data
buyOrSell: { type: String, required: true },
numTokens: { type: Number, required: true },
rateInBaseUnit: { type: String, required: true },
minUnitsToExchange: { type: String },
2022-02-23 05:51:12 -08:00
p2wdbTxid: { type: String },
p2wdbHash: { type: String },
makerAddr: { type: String, required: true },
2025-11-10 18:45:37 -04:00
makerNpub: { type: String, required: true },
// Authentication data
signature: { type: String },
sigMsg: { type: String },
offerBchAddr: { type: String },
offerPubKey: { type: String },
// Wallet Data
hdIndex: { type: Number, required: true }, // HD index address holding the UTXO for this offer.
// SWaP Protocol Properties
lokadId: { type: String },
messageType: { type: Number },
messageClass: { type: Number },
nostrEventId: { type: String, required: true }, // Nostr Event Id.
// Additional properties found in createOrder
dataType: { type: String, required: true },
userId: { type: String, required: true },
// Operator fee and address
operatorAddress: { type: String },
operatorPercentage: { type: Number }
2022-02-23 05:51:12 -08:00
})
2022-10-01 11:40:41 -07:00
export default mongoose.model('order', Order)