mirror of
https://github.com/Permissionless-Software-Foundation/bch-dex.git
synced 2026-09-21 16:52:00 -07:00
Got ensureFunds() working in real transaction
This commit is contained in:
@@ -73,10 +73,10 @@ class OfferLib {
|
||||
// trade.
|
||||
async ensureFunds (offerEntity) {
|
||||
try {
|
||||
// console.log('this.adapters.wallet: ', this.adapters.wallet)
|
||||
// console.log('this.adapters.wallet: ', this.adapters.wallet.bchWallet)
|
||||
|
||||
// Get UTXOs.
|
||||
const utxos = this.adapters.wallet.utxos.utxoStore
|
||||
const utxos = this.adapters.wallet.bchWallet.utxos.utxoStore
|
||||
// console.log(`utxos: ${JSON.stringify(utxos, null, 2)}`)
|
||||
|
||||
if (offerEntity.buyOrSell.includes('sell')) {
|
||||
|
||||
@@ -14,12 +14,12 @@ async function start () {
|
||||
lokadId: 'SWP',
|
||||
messageType: 1,
|
||||
messageClass: 1,
|
||||
tokenId: 'token-id',
|
||||
tokenId:
|
||||
'38e97c5d7d3585a2cbf3f9580c82ca33985f9cb0845d4dcce220cb709f9538b0',
|
||||
buyOrSell: 'sell',
|
||||
rateInSats: 1000,
|
||||
minSatsToExchange: 1250,
|
||||
utxoTxid: 'txid-goes-here',
|
||||
utxoVout: 1
|
||||
minSatsToExchange: 10,
|
||||
numTokens: 0.1
|
||||
}
|
||||
|
||||
const options = {
|
||||
|
||||
@@ -83,7 +83,11 @@ const bchjs = {
|
||||
// generateSignature: async () => {}
|
||||
// }
|
||||
const { MockBchWallet } = require('./wallet')
|
||||
const wallet = new MockBchWallet()
|
||||
const wallet = {
|
||||
burnPsf: async () => {},
|
||||
generateSignature: async () => {},
|
||||
bchWallet: new MockBchWallet()
|
||||
}
|
||||
|
||||
const p2wdb = {
|
||||
write: async () => {}
|
||||
|
||||
@@ -27,9 +27,6 @@ class MockBchWallet {
|
||||
return { success: true, txid: 'txid' }
|
||||
}
|
||||
|
||||
this.burnPsf = async () => {}
|
||||
this.generateSignature = async () => {}
|
||||
|
||||
// Environment variable is used by wallet-balance.unit.js to force an error.
|
||||
if (process.env.NO_UTXO) {
|
||||
this.utxos = {}
|
||||
|
||||
Reference in New Issue
Block a user