mirror of
https://github.com/Permissionless-Software-Foundation/bch-dex.git
synced 2026-09-21 16:52:00 -07:00
Got webhooks Order creation working
This commit is contained in:
+2
-2
@@ -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')
|
||||
|
||||
Vendored
+1
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user