Got webhooks Order creation working

This commit is contained in:
Chris Troutner
2022-02-23 15:23:37 -08:00
parent f630b61343
commit e7e6f31c96
5 changed files with 14 additions and 10 deletions
+2 -2
View File
@@ -94,13 +94,13 @@ class Server {
try {
try {
// Delete an old webhook if it exists.
await webhookLib.deleteWebhook('http://localhost:5700/order')
await webhookLib.deleteWebhook(`http://localhost:${config.port}/order`)
} catch (err) {
/* exit quietly */
// console.log('err deleting webhook: ', err)
}
await webhookLib.createWebhook('http://localhost:5700/order')
await webhookLib.createWebhook(`http://localhost:${config.port}/order`)
console.log('Webhook created')
} catch (error) {
console.log('Webhook cant be created')
+1
View File
@@ -82,6 +82,7 @@ module.exports = {
webhookService: process.env.WEBHOOKSERVICE
? process.env.WEBHOOKSERVICE
: 'http://localhost:5010/webhook', // P2WDB.
p2wdbAppId: process.env.APP_ID ? process.env.APP_ID : 'bch-dex-test556',
// IPFS Ports
ipfsTcpPort: process.env.IPFS_TCP_PORT ? process.env.IPFS_TCP_PORT : 4001,
+1 -2
View File
@@ -216,8 +216,7 @@ class WalletAdapter {
`Token UTXO of with ID of ${P2WDB_TOKEN_ID} and quantity greater than ${PROOF_OF_BURN_QTY} could not be found in wallet.`
)
}
console.log(`tokenUtxo: ${JSON.stringify(tokenUtxo, null, 2)}`)
// console.log(`tokenUtxo: ${JSON.stringify(tokenUtxo, null, 2)}`)
const result = await this.bchWallet.burnTokens(
PROOF_OF_BURN_QTY,
+2 -4
View File
@@ -7,8 +7,6 @@ const axios = require('axios')
let _this
const APPID = 'swapTest555'
class WebHook {
constructor () {
_this = this
@@ -26,7 +24,7 @@ class WebHook {
const endpoint = _this.config.webhookService
const obj = {
appId: APPID,
appId: this.config.p2wdbAppId,
url
}
@@ -49,7 +47,7 @@ class WebHook {
const endpoint = _this.config.webhookService
const obj = {
appId: APPID,
appId: this.config.p2wdbAppId,
url
}
+8 -2
View File
@@ -1,6 +1,11 @@
const { wlogger } = require('../adapters/wlogger')
/*
Offer use-case library.
*/
// Local libraries
const { wlogger } = require('../adapters/wlogger')
const OfferEntity = require('../entities/offer')
const config = require('../../config')
class OfferLib {
constructor (localConfig = {}) {
@@ -16,6 +21,7 @@ class OfferLib {
this.offerEntity = new OfferEntity()
this.OfferModel = this.adapters.localdb.Offer
this.bch = this.adapters.bch
this.config = config
}
// Create a new offer model and add it to the Mongo database.
@@ -57,7 +63,7 @@ class OfferLib {
txid,
signature,
message,
appId: 'bch-dex-test556',
appId: this.config.p2wdbAppId,
data: offerEntity
}