Got first successful take workflow complete

This commit is contained in:
Chris Troutner
2022-03-25 12:17:13 -07:00
parent dbd5845e3a
commit 1206b6576e
5 changed files with 21 additions and 4 deletions
+1
View File
@@ -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 },
+1
View File
@@ -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 },
+7 -2
View File
@@ -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
+7 -2
View File
@@ -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
+5
View File
@@ -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)