Compare commits

...
4 Commits
Author SHA1 Message Date
Chris Troutner ae30b89d68 Merge pull request #286 from Permissionless-Software-Foundation/ct-unstable
fix(psf-slp-indexer): Adding block height forecast to unconfirmed non…
2026-01-15 16:27:21 -07:00
Chris Troutner 2e88d26ff2 fix(psf-slp-indexer): Adding block height forecast to unconfirmed non-SLP TXs 2026-01-15 16:23:47 -07:00
Chris Troutner b1745d37e0 Merge pull request #285 from Permissionless-Software-Foundation/ct-unstable
fix(x402): Updating x402-bch-axios with faster payment
2025-12-31 15:33:06 -07:00
Chris Troutner 9733c07e04 fix(x402): Updating x402-bch-axios with faster payment 2025-12-31 15:28:44 -07:00
4 changed files with 30 additions and 12 deletions
+10 -10
View File
@@ -32,7 +32,7 @@
"slp-mdm": "0.0.7",
"slp-parser": "0.0.4",
"wif": "2.0.6",
"x402-bch-axios": "2.1.1"
"x402-bch-axios": "2.2.1"
},
"devDependencies": {
"apidoc": "1.2.0",
@@ -779,9 +779,9 @@
}
},
"node_modules/@eslint-community/eslint-utils": {
"version": "4.9.0",
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.0.tgz",
"integrity": "sha512-ayVFHdtZ+hsq1t2Dy24wCmGXGe4q9Gu3smhLYALJrr473ZH27MsnSL+LKUlimp4BWJqMDMLmPpx/Q9R3OAlL4g==",
"version": "4.9.1",
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.1.tgz",
"integrity": "sha512-phrYmNiYppR7znFEdqgfWHXR6NCkZEK7hwWDHZUjit/2/U0r6XvkDl0SYnoM51Hq7FhCGdLDT6zxCCOY1hexsQ==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -6277,9 +6277,9 @@
}
},
"node_modules/esquery": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz",
"integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==",
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/esquery/-/esquery-1.7.0.tgz",
"integrity": "sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g==",
"dev": true,
"license": "BSD-3-Clause",
"dependencies": {
@@ -16804,9 +16804,9 @@
"license": "ISC"
},
"node_modules/x402-bch-axios": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/x402-bch-axios/-/x402-bch-axios-2.1.1.tgz",
"integrity": "sha512-cRUWTpEjwoY7sDVSxS26lSoaxGQ0OxrggQjU+WqUo3aCj00p1TwNeLIxwX6AxX89y4dRPXfuC5Pm/9mxTg058w==",
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/x402-bch-axios/-/x402-bch-axios-2.2.1.tgz",
"integrity": "sha512-N23DpQRA746bqGDTCJYVQ8QL55PoxE6LTSNMFzx5sySsvnBem6H0hQLSf2N9e45O8xPVw3ulSvXncgTcVM8ikw==",
"license": "MIT",
"dependencies": {
"@chris.troutner/retry-queue": "1.0.11",
+1 -1
View File
@@ -52,7 +52,7 @@
"slp-mdm": "0.0.7",
"slp-parser": "0.0.4",
"wif": "2.0.6",
"x402-bch-axios": "2.1.1"
"x402-bch-axios": "2.2.1"
},
"devDependencies": {
"apidoc": "1.2.0",
+18
View File
@@ -12,6 +12,7 @@ import axios from 'axios'
// Local libraries
import RawTransaction from './raw-transactions.js'
import SlpUtils from './slp/utils.js'
import Blockchain from './blockchain.js'
// let _this
@@ -31,6 +32,7 @@ class PsfSlpIndexer {
// Encapsulate dependencies
this.rawTransaction = new RawTransaction(config)
this.slpUtils = new SlpUtils(config)
this.blockchain = new Blockchain(config)
}
/**
@@ -317,6 +319,22 @@ class PsfSlpIndexer {
const txDetails = await this.rawTransaction.getTxData(txid)
// console.log(`txDetails: ${JSON.stringify(txDetails, null, 2)}`)
// Add blockheight, height, time, and blocktime to the txDetails object.
if (txDetails.height === null) {
// Get current block height and increment by 1
const currentBlockHeight = await this.blockchain.getBlockCount()
const estimatedHeight = currentBlockHeight + 1
// Set height and blockheight
txDetails.height = estimatedHeight
txDetails.blockheight = estimatedHeight
// Set time and blocktime to current unix timestamp
const currentTime = Math.floor(Date.now() / 1000)
txDetails.time = currentTime
txDetails.blocktime = currentTime
}
if (isInBlacklist) {
txDetails.isValidSlp = null
} else {
+1 -1
View File
@@ -18,7 +18,7 @@ describe('#price', () => {
})
describe('#getPsffppPrice', () => {
it('should get the price of BCH in several currencies', async () => {
it('should get the price to write 1MB to the PSFFPP', async () => {
const result = await bchjs.Price.getPsffppPrice()
// console.log(result)