mirror of
https://github.com/Permissionless-Software-Foundation/bch-dex.git
synced 2026-09-21 16:52:00 -07:00
Got first successful take workflow complete
This commit is contained in:
@@ -6,6 +6,7 @@ const Offer = new mongoose.Schema({
|
||||
tokenId: { type: String },
|
||||
utxoTxid: { type: String },
|
||||
utxoVout: { type: Number },
|
||||
ticker: { type: String },
|
||||
|
||||
// Trade data
|
||||
buyOrSell: { type: String },
|
||||
|
||||
@@ -13,6 +13,7 @@ const Order = new mongoose.Schema({
|
||||
tokenId: { type: String },
|
||||
utxoTxid: { type: String },
|
||||
utxoVout: { type: Number },
|
||||
ticker: { type: String },
|
||||
|
||||
// Trade data
|
||||
buyOrSell: { type: String },
|
||||
|
||||
@@ -28,7 +28,8 @@ class OfferEntity {
|
||||
utxoTxid,
|
||||
utxoVout,
|
||||
offerStatus,
|
||||
makerAddr
|
||||
makerAddr,
|
||||
ticker
|
||||
} = offerData.data
|
||||
|
||||
// Input Validation
|
||||
@@ -65,6 +66,9 @@ class OfferEntity {
|
||||
if (!makerAddr || typeof makerAddr !== 'string') {
|
||||
throw new Error("Property 'makerAddr' must be a string.")
|
||||
}
|
||||
if (!ticker || typeof ticker !== 'string') {
|
||||
throw new Error("Property 'ticker' must be a string.")
|
||||
}
|
||||
|
||||
const validatedOfferData = {
|
||||
messageType,
|
||||
@@ -81,7 +85,8 @@ class OfferEntity {
|
||||
txid: offerData.txid,
|
||||
p2wdbHash: offerData.hash,
|
||||
offerStatus: offerStatus || this.offerStatus[0],
|
||||
makerAddr
|
||||
makerAddr,
|
||||
ticker
|
||||
}
|
||||
|
||||
return validatedOfferData
|
||||
|
||||
@@ -16,7 +16,8 @@ class Order {
|
||||
rateInBaseUnit,
|
||||
minUnitsToExchange,
|
||||
numTokens,
|
||||
makerAddr
|
||||
makerAddr,
|
||||
ticker
|
||||
} = data
|
||||
|
||||
// Input Validation
|
||||
@@ -44,6 +45,9 @@ class Order {
|
||||
if (!makerAddr || typeof makerAddr !== 'string') {
|
||||
throw new Error("Property 'makerAddr' must be a string.")
|
||||
}
|
||||
if (!ticker || typeof ticker !== 'string') {
|
||||
throw new Error("Property 'ticker' must be a string.")
|
||||
}
|
||||
|
||||
const offerData = {
|
||||
messageType,
|
||||
@@ -53,7 +57,8 @@ class Order {
|
||||
rateInBaseUnit,
|
||||
minUnitsToExchange,
|
||||
numTokens,
|
||||
makerAddr
|
||||
makerAddr,
|
||||
ticker
|
||||
}
|
||||
|
||||
return offerData
|
||||
|
||||
@@ -33,6 +33,11 @@ class OrderLib {
|
||||
entryObj.makerAddr = this.adapters.wallet.bchWallet.walletInfo.cashAddress
|
||||
console.log('entryObj.makerAddr: ', entryObj.makerAddr)
|
||||
|
||||
// Get Ticker for token ID.
|
||||
const tokenData = await this.adapters.wallet.bchWallet.getTxData([entryObj.tokenId])
|
||||
// console.log(`tokenData: ${JSON.stringify(tokenData, null, 2)}`)
|
||||
entryObj.ticker = tokenData[0].tokenTicker
|
||||
|
||||
// Input Validation
|
||||
const orderEntity = this.orderEntity.validate(entryObj)
|
||||
console.log('orderEntity: ', orderEntity)
|
||||
|
||||
Reference in New Issue
Block a user