Got ensureFunds() working in real transaction

This commit is contained in:
Chris Troutner
2021-09-18 21:36:23 -07:00
parent 11585683d6
commit 4d25414482
4 changed files with 11 additions and 10 deletions
+2 -2
View File
@@ -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')) {
+4 -4
View File
@@ -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 = {
+5 -1
View File
@@ -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 () => {}
-3
View File
@@ -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 = {}