Merge pull request #197 from Permissionless-Software-Foundation/ct-unstable

fix(psf-slp-indexer getAddress): Letting ecash addrs pass through
This commit is contained in:
Chris Troutner
2022-07-10 18:26:46 -07:00
committed by GitHub
3 changed files with 44 additions and 21 deletions
+1 -1
View File
@@ -42,6 +42,6 @@ logs/*
docs/*
docker/mainnet/start-local-mainnet.sh
docker/testnet/start-local-testnet.sh
start-local-bchn.sh
!logs/README.md
+2
View File
@@ -97,6 +97,7 @@ class PsfSlpIndexer {
})
}
if (!address.includes('ecash')) {
// Ensure the input is a valid BCH address.
try {
_this.bchjs.SLP.Address.toCashAddress(address)
@@ -119,6 +120,7 @@ class PsfSlpIndexer {
'Invalid network. Trying to use a testnet address on mainnet, or vice versa.'
})
}
}
const response = await _this.axios.post(
`${_this.psfSlpIndexerApi}slp/address/`,
+21
View File
@@ -430,6 +430,27 @@ describe('#PsfSlpIndexer', () => {
assert.isArray(balance.txs)
assert.isArray(balance.balances)
})
it('should GET data for ecash address', async function () {
req.body.address =
'ecash:qr5c4hfy52zn87484cucvzle5pljz0gtr5vhtw9z09'
// Mock the RPC call for unit tests.
if (process.env.TEST === 'unit') {
sandbox.stub(uut.axios, 'post').resolves({ data: mockData.balance })
} else {
return this.skip()
}
const result = await uut.getAddress(req, res)
const balance = result.balance
assert.property(balance, 'utxos')
assert.property(balance, 'txs')
assert.property(balance, 'balances')
assert.isArray(balance.utxos)
assert.isArray(balance.txs)
assert.isArray(balance.balances)
})
})
describe('#getStatus', async () => {