Comments (5)
@knorrium @hunicus can you please look into fixing this as well as the API docs? seems it doesn't work and the API docs are wrong too
from mempool.js.
Working example
import * as WebSocket from 'ws';
const serverWS = (): WebSocket => {
const ws = new WebSocket('wss://mempool.space/testnet/api/v1/ws');
const interval = setInterval(function ping() {
ws.ping();
}, 30000);
ws.on('open', function open() {
console.log('ws opened');
ws.send(
JSON.stringify({ 'track-address': 'mq9Kmu6AGUmbgAJ73SdkERg59uXFnNeCX2' }),
);
});
ws.on('close', async function close() {
console.log('ws closed');
clearInterval(interval);
ws.terminate();
await sleep(60000);
serverWS();
});
return ws;
};
const sleep = (ms: number) => {
return new Promise((resolve) => {
setTimeout(resolve, ms);
});
};
export { serverWS };
And after
const ws = serverWS();
ws.on('message', function incoming(data) {
const res = JSON.parse(data.toString()) // <- your tx data here
console.log(JSON.stringify(res, null, 3))
});
But it doesn't work as expected. Incoming only one transaction notification like:
{
"address-transactions": [
{
"vsize": 143,
"feePerVsize": 1.0052356020942408,
"effectiveFeePerVsize": 1.0052356020942408,
"txid": "57b26a3b5c10f9652d8144bc8431daf45fb2cc19f5d2af488e0c611bb57eb2ed",
"version": 2,
"locktime": 2281541,
"vin": [
{
"txid": "721a9c0d53152aaae66a234fb7074e49ae5fcbd90ca879af93abed463d84ecbf",
"vout": 0,
"prevout": {
"scriptpubkey": "0014250a3f51ebfd2608206d34034d1a1629bcad66a8",
"scriptpubkey_asm": "OP_0 OP_PUSHBYTES_20 250a3f51ebfd2608206d34034d1a1629bcad66a8",
"scriptpubkey_type": "v0_p2wpkh",
"scriptpubkey_address": "tb1qy59r750tl5nqsgrdxsp56xsk9x726e4gdqsk86",
"value": 139284092
},
"scriptsig": "",
"scriptsig_asm": "",
"witness": [
"304402203b68c1f7bfecaba2c213ec631cfd58ed8edb85f1838d14d23a366a9335e8f2b602207651bfd32c93200ca192954cf15a2b784d73b166731e8c7bdc3330c246c417a301",
"02e30949984d16c3b9d87d10ad2bba140e31339f37afdfa59515e905e8f553d431"
],
"is_coinbase": false,
"sequence": 4294967294
}
],
"vout": [
{
"scriptpubkey": "001460651d9d488fd59674d650b2269fe09953b2d4c8",
"scriptpubkey_asm": "OP_0 OP_PUSHBYTES_20 60651d9d488fd59674d650b2269fe09953b2d4c8",
"scriptpubkey_type": "v0_p2wpkh",
"scriptpubkey_address": "tb1qvpj3m82g3l2evaxk2zezd8lqn9fm94xgq2g939",
"value": 139253948
},
{
"scriptpubkey": "76a914699a098fbfbcc2b5e03fb7edb2ce8b6e166e3f7c88ac",
"scriptpubkey_asm": "OP_DUP OP_HASH160 OP_PUSHBYTES_20 699a098fbfbcc2b5e03fb7edb2ce8b6e166e3f7c OP_EQUALVERIFY OP_CHECKSIG",
"scriptpubkey_type": "p2pkh",
"scriptpubkey_address": "mq9Kmu6AGUmbgAJ73SdkERg59uXFnNeCX2",
"value": 30000
}
],
"size": 225,
"weight": 573,
"fee": 144,
"status": {
"confirmed": false
},
"firstSeen": 1655887723,
"bestDescendant": null,
"ancestors": [
{
"txid": "721a9c0d53152aaae66a234fb7074e49ae5fcbd90ca879af93abed463d84ecbf",
"weight": 573,
"fee": 144
}
],
"cpfpChecked": true
}
]
}
And then object below many times
{
"conversions": {
"AED": 0,
"AUD": 29272.26,
"BDT": 0,
"BHD": 0,
"BMD": 0,
"BRL": 103870.78,
"CAD": 26210.21,
"CHF": 19514.4,
"CLP": 0,
"CNY": 0,
"CZK": 0,
"DKK": 0,
"EUR": 19187.96,
"GBP": 16515.16,
"HKD": 159675.03,
"HUF": 0,
"IDR": 300581142.86,
"ILS": 0,
"INR": 0,
"JPY": 2747821.51,
"KRW": 26367417.04,
"KWD": 0,
"LKR": 0,
"MMK": 0,
"MXN": 0,
"MYR": 88916.24,
"NGN": 10403417.36,
"NOK": 0,
"NZD": 32276.01,
"PHP": 0,
"PKR": 0,
"PLN": 0,
"RUB": 1083887.16,
"SAR": 0,
"SEK": 0,
"SGD": 28467.76,
"THB": 0,
"TRY": 351400.23,
"TWD": 0,
"UAH": 648703.86,
"USD": 20162.47,
"VND": 0,
"ZAR": 326427.28
}
}
from mempool.js.
I can confirm what @justficks is saying. Using track-address
will deliver address-transactions
payload when a transaction involving the address is seen in mempool but will not deliver block-transactions
payload when the transaction is mined into a block.
@wiz we'd really like to depend on this functionality for Zaprite. Any chance we can get some eyes on this?
Thank you!
from mempool.js.
Any update on this?
from mempool.js.
@wiz It seems this is not fixed yet because I keep only receiving the conversions. Can you confirm? When can it be fixed?
from mempool.js.
Related Issues (20)
- mempool.space "name": "@mempool/bisq.js", "version": "2.2.1", "description": "NPM package module for Bisq APIs.", "main": "../lib/index-bisq.js", "keywords": [ "axios", "bitcoin", "bisq", "blockchain", "html", "bisq.js", "mempool.space", "mempool.js", "mempool", "websocket", "nodejs", "typescript" ], "author": "Miguel Medeiros <[email protected]> (miguelmedeiros.com.br)", "url": "https://bisq.markets/", "private": false, "repository": { "type": "git", "url": "git://github.com/mempool/mempool.js.git" }, "types": "../lib/index-bisq.d.ts", "scripts": { "start": "ts-node ../src/index-bisq.ts",
- 1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY
- 0x9b554ADaA65fa9A7dF802702Fb363802C54D0076 HOT 1
- 3kc3egAYJpYq7EopjH28N6huk1s864ixax9XWtzrA2cm
- replaced raw transactions in mempool HOT 1
- const liquid = liquidJS( bc1qjwz55y5a24nusxutnhykq08scxxedvh9wpu7q6 ); HOT 1
- ddejfvww7sqtk.cloudfront.net/production/e13e558/_next/static.14.7999.6797979797798/1300000000/1000000000/00/00/01/01
- ddejfvww7sqtk.cloudfront.net/production/e13e558/_next/static.14.7999.6797979797798/1300000000/1000000000/00/00/01/01#:~:text=Y32MnqXMQLhcP5dyg2anzGxG8rkx7ZDn50jDasUOXFNXJEu6jzabOy5Y
- Vulnerable axios & IP packages used ! HOT 1
- Just in case there's any significance to it, here's a sample of the log when I looked just now. It still shows 'Offline' when viewing the mempool page. HOT 1
- const address = '1wizSAYSbuyXbt9d8JV8ytm5acqq2TorC';
- mempool
- Access to XMLHttpRequest at 'https://mempool.space/testnet/api/tx' from origin 'http://localhost:5173' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.
- GET /api/address/:address/utxo HOT 3
- https://github.com/mempool/mempool.js/issues/188#issue-2255751081
- Mempool
- npm package version needs to be updated HOT 2
- npm i @mempool/mempool.js
- Unconfirmed transaction
- Remove hard-coded `/api` path
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mempool.js.